@tailor-cms/ce-brightcove-video-display 0.1.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,262 +1,712 @@
1
- "use strict";
2
- var import_index = require("./index.css");
3
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
4
- const vue = require("vue");
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ require('./index.css');let vue = require("vue");
6
+ //#region ../manifest/dist/index.mjs
5
7
  var type = "BRIGHTCOVE_VIDEO";
6
8
  var name = "Brightcove Video";
7
9
  var initState = () => ({
8
- accountId: "",
9
- playerId: "",
10
- videoId: ""
10
+ accountId: "",
11
+ playerId: "",
12
+ videoId: ""
11
13
  });
12
- var ui = {
13
- // Display icon, https://pictogrammers.com/library/mdi/
14
- icon: "mdi-video",
15
- // Does element support only full width or can be used within layouts
16
- // (e.g. 50/50 layout)
17
- forceFullWidth: false
18
- };
14
+ var isEmpty = (data) => !data.videoId;
19
15
  var manifest$1 = {
20
- type,
21
- version: "1.0",
22
- name,
23
- ssr: false,
24
- initState,
25
- ui
16
+ type,
17
+ version: "1.0",
18
+ name,
19
+ ssr: false,
20
+ initState,
21
+ isEmpty,
22
+ ui: {
23
+ icon: "mdi-video",
24
+ forceFullWidth: false
25
+ }
26
26
  };
27
- var index_default = manifest$1;
27
+ //#endregion
28
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js
29
+ /** Detect free variable `global` from Node.js. */
30
+ var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
31
+ //#endregion
32
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_root.js
33
+ /** Detect free variable `self`. */
34
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
35
+ /** Used as a reference to the global object. */
36
+ var root = freeGlobal || freeSelf || Function("return this")();
37
+ //#endregion
38
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js
39
+ /** Built-in value references. */
40
+ var Symbol = root.Symbol;
41
+ //#endregion
42
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js
43
+ /** Used for built-in method references. */
44
+ var objectProto = Object.prototype;
45
+ /** Used to check objects for own properties. */
46
+ var hasOwnProperty = objectProto.hasOwnProperty;
47
+ /**
48
+ * Used to resolve the
49
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
50
+ * of values.
51
+ */
52
+ var nativeObjectToString$1 = objectProto.toString;
53
+ /** Built-in value references. */
54
+ var symToStringTag$1 = Symbol ? Symbol.toStringTag : void 0;
55
+ /**
56
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
57
+ *
58
+ * @private
59
+ * @param {*} value The value to query.
60
+ * @returns {string} Returns the raw `toStringTag`.
61
+ */
62
+ function getRawTag(value) {
63
+ var isOwn = hasOwnProperty.call(value, symToStringTag$1), tag = value[symToStringTag$1];
64
+ try {
65
+ value[symToStringTag$1] = void 0;
66
+ var unmasked = true;
67
+ } catch (e) {}
68
+ var result = nativeObjectToString$1.call(value);
69
+ if (unmasked) if (isOwn) value[symToStringTag$1] = tag;
70
+ else delete value[symToStringTag$1];
71
+ return result;
72
+ }
73
+ //#endregion
74
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js
75
+ /**
76
+ * Used to resolve the
77
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
78
+ * of values.
79
+ */
80
+ var nativeObjectToString = Object.prototype.toString;
81
+ /**
82
+ * Converts `value` to a string using `Object.prototype.toString`.
83
+ *
84
+ * @private
85
+ * @param {*} value The value to convert.
86
+ * @returns {string} Returns the converted string.
87
+ */
88
+ function objectToString(value) {
89
+ return nativeObjectToString.call(value);
90
+ }
91
+ //#endregion
92
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js
93
+ /** `Object#toString` result references. */
94
+ var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
95
+ /** Built-in value references. */
96
+ var symToStringTag = Symbol ? Symbol.toStringTag : void 0;
97
+ /**
98
+ * The base implementation of `getTag` without fallbacks for buggy environments.
99
+ *
100
+ * @private
101
+ * @param {*} value The value to query.
102
+ * @returns {string} Returns the `toStringTag`.
103
+ */
104
+ function baseGetTag(value) {
105
+ if (value == null) return value === void 0 ? undefinedTag : nullTag;
106
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
107
+ }
108
+ //#endregion
109
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js
110
+ /**
111
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
112
+ * and has a `typeof` result of "object".
113
+ *
114
+ * @static
115
+ * @memberOf _
116
+ * @since 4.0.0
117
+ * @category Lang
118
+ * @param {*} value The value to check.
119
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
120
+ * @example
121
+ *
122
+ * _.isObjectLike({});
123
+ * // => true
124
+ *
125
+ * _.isObjectLike([1, 2, 3]);
126
+ * // => true
127
+ *
128
+ * _.isObjectLike(_.noop);
129
+ * // => false
130
+ *
131
+ * _.isObjectLike(null);
132
+ * // => false
133
+ */
134
+ function isObjectLike(value) {
135
+ return value != null && typeof value == "object";
136
+ }
137
+ //#endregion
138
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js
139
+ /** `Object#toString` result references. */
140
+ var symbolTag = "[object Symbol]";
141
+ /**
142
+ * Checks if `value` is classified as a `Symbol` primitive or object.
143
+ *
144
+ * @static
145
+ * @memberOf _
146
+ * @since 4.0.0
147
+ * @category Lang
148
+ * @param {*} value The value to check.
149
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
150
+ * @example
151
+ *
152
+ * _.isSymbol(Symbol.iterator);
153
+ * // => true
154
+ *
155
+ * _.isSymbol('abc');
156
+ * // => false
157
+ */
158
+ function isSymbol(value) {
159
+ return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
160
+ }
161
+ //#endregion
162
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js
163
+ /** Used to match a single whitespace character. */
164
+ var reWhitespace = /\s/;
165
+ /**
166
+ * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
167
+ * character of `string`.
168
+ *
169
+ * @private
170
+ * @param {string} string The string to inspect.
171
+ * @returns {number} Returns the index of the last non-whitespace character.
172
+ */
173
+ function trimmedEndIndex(string) {
174
+ var index = string.length;
175
+ while (index-- && reWhitespace.test(string.charAt(index)));
176
+ return index;
177
+ }
178
+ //#endregion
179
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js
180
+ /** Used to match leading whitespace. */
181
+ var reTrimStart = /^\s+/;
182
+ /**
183
+ * The base implementation of `_.trim`.
184
+ *
185
+ * @private
186
+ * @param {string} string The string to trim.
187
+ * @returns {string} Returns the trimmed string.
188
+ */
189
+ function baseTrim(string) {
190
+ return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
191
+ }
192
+ //#endregion
193
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isObject.js
194
+ /**
195
+ * Checks if `value` is the
196
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
197
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
198
+ *
199
+ * @static
200
+ * @memberOf _
201
+ * @since 0.1.0
202
+ * @category Lang
203
+ * @param {*} value The value to check.
204
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
205
+ * @example
206
+ *
207
+ * _.isObject({});
208
+ * // => true
209
+ *
210
+ * _.isObject([1, 2, 3]);
211
+ * // => true
212
+ *
213
+ * _.isObject(_.noop);
214
+ * // => true
215
+ *
216
+ * _.isObject(null);
217
+ * // => false
218
+ */
219
+ function isObject(value) {
220
+ var type = typeof value;
221
+ return value != null && (type == "object" || type == "function");
222
+ }
223
+ //#endregion
224
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js
225
+ /** Used as references for various `Number` constants. */
226
+ var NAN = NaN;
227
+ /** Used to detect bad signed hexadecimal string values. */
228
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
229
+ /** Used to detect binary string values. */
230
+ var reIsBinary = /^0b[01]+$/i;
231
+ /** Used to detect octal string values. */
232
+ var reIsOctal = /^0o[0-7]+$/i;
233
+ /** Built-in method references without a dependency on `root`. */
234
+ var freeParseInt = parseInt;
235
+ /**
236
+ * Converts `value` to a number.
237
+ *
238
+ * @static
239
+ * @memberOf _
240
+ * @since 4.0.0
241
+ * @category Lang
242
+ * @param {*} value The value to process.
243
+ * @returns {number} Returns the number.
244
+ * @example
245
+ *
246
+ * _.toNumber(3.2);
247
+ * // => 3.2
248
+ *
249
+ * _.toNumber(Number.MIN_VALUE);
250
+ * // => 5e-324
251
+ *
252
+ * _.toNumber(Infinity);
253
+ * // => Infinity
254
+ *
255
+ * _.toNumber('3.2');
256
+ * // => 3.2
257
+ */
258
+ function toNumber(value) {
259
+ if (typeof value == "number") return value;
260
+ if (isSymbol(value)) return NAN;
261
+ if (isObject(value)) {
262
+ var other = typeof value.valueOf == "function" ? value.valueOf() : value;
263
+ value = isObject(other) ? other + "" : other;
264
+ }
265
+ if (typeof value != "string") return value === 0 ? value : +value;
266
+ value = baseTrim(value);
267
+ var isBinary = reIsBinary.test(value);
268
+ return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
269
+ }
270
+ //#endregion
271
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/now.js
272
+ /**
273
+ * Gets the timestamp of the number of milliseconds that have elapsed since
274
+ * the Unix epoch (1 January 1970 00:00:00 UTC).
275
+ *
276
+ * @static
277
+ * @memberOf _
278
+ * @since 2.4.0
279
+ * @category Date
280
+ * @returns {number} Returns the timestamp.
281
+ * @example
282
+ *
283
+ * _.defer(function(stamp) {
284
+ * console.log(_.now() - stamp);
285
+ * }, _.now());
286
+ * // => Logs the number of milliseconds it took for the deferred invocation.
287
+ */
288
+ var now = function() {
289
+ return root.Date.now();
290
+ };
291
+ //#endregion
292
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/debounce.js
293
+ /** Error message constants. */
294
+ var FUNC_ERROR_TEXT$1 = "Expected a function";
295
+ var nativeMax = Math.max, nativeMin = Math.min;
296
+ /**
297
+ * Creates a debounced function that delays invoking `func` until after `wait`
298
+ * milliseconds have elapsed since the last time the debounced function was
299
+ * invoked. The debounced function comes with a `cancel` method to cancel
300
+ * delayed `func` invocations and a `flush` method to immediately invoke them.
301
+ * Provide `options` to indicate whether `func` should be invoked on the
302
+ * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
303
+ * with the last arguments provided to the debounced function. Subsequent
304
+ * calls to the debounced function return the result of the last `func`
305
+ * invocation.
306
+ *
307
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
308
+ * invoked on the trailing edge of the timeout only if the debounced function
309
+ * is invoked more than once during the `wait` timeout.
310
+ *
311
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
312
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
313
+ *
314
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
315
+ * for details over the differences between `_.debounce` and `_.throttle`.
316
+ *
317
+ * @static
318
+ * @memberOf _
319
+ * @since 0.1.0
320
+ * @category Function
321
+ * @param {Function} func The function to debounce.
322
+ * @param {number} [wait=0] The number of milliseconds to delay.
323
+ * @param {Object} [options={}] The options object.
324
+ * @param {boolean} [options.leading=false]
325
+ * Specify invoking on the leading edge of the timeout.
326
+ * @param {number} [options.maxWait]
327
+ * The maximum time `func` is allowed to be delayed before it's invoked.
328
+ * @param {boolean} [options.trailing=true]
329
+ * Specify invoking on the trailing edge of the timeout.
330
+ * @returns {Function} Returns the new debounced function.
331
+ * @example
332
+ *
333
+ * // Avoid costly calculations while the window size is in flux.
334
+ * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
335
+ *
336
+ * // Invoke `sendMail` when clicked, debouncing subsequent calls.
337
+ * jQuery(element).on('click', _.debounce(sendMail, 300, {
338
+ * 'leading': true,
339
+ * 'trailing': false
340
+ * }));
341
+ *
342
+ * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
343
+ * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
344
+ * var source = new EventSource('/stream');
345
+ * jQuery(source).on('message', debounced);
346
+ *
347
+ * // Cancel the trailing debounced invocation.
348
+ * jQuery(window).on('popstate', debounced.cancel);
349
+ */
350
+ function debounce(func, wait, options) {
351
+ var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
352
+ if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT$1);
353
+ wait = toNumber(wait) || 0;
354
+ if (isObject(options)) {
355
+ leading = !!options.leading;
356
+ maxing = "maxWait" in options;
357
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
358
+ trailing = "trailing" in options ? !!options.trailing : trailing;
359
+ }
360
+ function invokeFunc(time) {
361
+ var args = lastArgs, thisArg = lastThis;
362
+ lastArgs = lastThis = void 0;
363
+ lastInvokeTime = time;
364
+ result = func.apply(thisArg, args);
365
+ return result;
366
+ }
367
+ function leadingEdge(time) {
368
+ lastInvokeTime = time;
369
+ timerId = setTimeout(timerExpired, wait);
370
+ return leading ? invokeFunc(time) : result;
371
+ }
372
+ function remainingWait(time) {
373
+ var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
374
+ return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
375
+ }
376
+ function shouldInvoke(time) {
377
+ var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
378
+ return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
379
+ }
380
+ function timerExpired() {
381
+ var time = now();
382
+ if (shouldInvoke(time)) return trailingEdge(time);
383
+ timerId = setTimeout(timerExpired, remainingWait(time));
384
+ }
385
+ function trailingEdge(time) {
386
+ timerId = void 0;
387
+ if (trailing && lastArgs) return invokeFunc(time);
388
+ lastArgs = lastThis = void 0;
389
+ return result;
390
+ }
391
+ function cancel() {
392
+ if (timerId !== void 0) clearTimeout(timerId);
393
+ lastInvokeTime = 0;
394
+ lastArgs = lastCallTime = lastThis = timerId = void 0;
395
+ }
396
+ function flush() {
397
+ return timerId === void 0 ? result : trailingEdge(now());
398
+ }
399
+ function debounced() {
400
+ var time = now(), isInvoking = shouldInvoke(time);
401
+ lastArgs = arguments;
402
+ lastThis = this;
403
+ lastCallTime = time;
404
+ if (isInvoking) {
405
+ if (timerId === void 0) return leadingEdge(lastCallTime);
406
+ if (maxing) {
407
+ clearTimeout(timerId);
408
+ timerId = setTimeout(timerExpired, wait);
409
+ return invokeFunc(lastCallTime);
410
+ }
411
+ }
412
+ if (timerId === void 0) timerId = setTimeout(timerExpired, wait);
413
+ return result;
414
+ }
415
+ debounced.cancel = cancel;
416
+ debounced.flush = flush;
417
+ return debounced;
418
+ }
419
+ //#endregion
420
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/throttle.js
421
+ /** Error message constants. */
422
+ var FUNC_ERROR_TEXT = "Expected a function";
423
+ /**
424
+ * Creates a throttled function that only invokes `func` at most once per
425
+ * every `wait` milliseconds. The throttled function comes with a `cancel`
426
+ * method to cancel delayed `func` invocations and a `flush` method to
427
+ * immediately invoke them. Provide `options` to indicate whether `func`
428
+ * should be invoked on the leading and/or trailing edge of the `wait`
429
+ * timeout. The `func` is invoked with the last arguments provided to the
430
+ * throttled function. Subsequent calls to the throttled function return the
431
+ * result of the last `func` invocation.
432
+ *
433
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
434
+ * invoked on the trailing edge of the timeout only if the throttled function
435
+ * is invoked more than once during the `wait` timeout.
436
+ *
437
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
438
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
439
+ *
440
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
441
+ * for details over the differences between `_.throttle` and `_.debounce`.
442
+ *
443
+ * @static
444
+ * @memberOf _
445
+ * @since 0.1.0
446
+ * @category Function
447
+ * @param {Function} func The function to throttle.
448
+ * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
449
+ * @param {Object} [options={}] The options object.
450
+ * @param {boolean} [options.leading=true]
451
+ * Specify invoking on the leading edge of the timeout.
452
+ * @param {boolean} [options.trailing=true]
453
+ * Specify invoking on the trailing edge of the timeout.
454
+ * @returns {Function} Returns the new throttled function.
455
+ * @example
456
+ *
457
+ * // Avoid excessively updating the position while scrolling.
458
+ * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
459
+ *
460
+ * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
461
+ * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
462
+ * jQuery(element).on('click', throttled);
463
+ *
464
+ * // Cancel the trailing throttled invocation.
465
+ * jQuery(window).on('popstate', throttled.cancel);
466
+ */
467
+ function throttle(func, wait, options) {
468
+ var leading = true, trailing = true;
469
+ if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT);
470
+ if (isObject(options)) {
471
+ leading = "leading" in options ? !!options.leading : leading;
472
+ trailing = "trailing" in options ? !!options.trailing : trailing;
473
+ }
474
+ return debounce(func, wait, {
475
+ "leading": leading,
476
+ "maxWait": wait,
477
+ "trailing": trailing
478
+ });
479
+ }
480
+ //#endregion
481
+ //#region ../../node_modules/.pnpm/url-join@5.0.0/node_modules/url-join/lib/url-join.js
28
482
  function normalize(strArray) {
29
- var resultArray = [];
30
- if (strArray.length === 0) {
31
- return "";
32
- }
33
- if (typeof strArray[0] !== "string") {
34
- throw new TypeError("Url must be a string. Received " + strArray[0]);
35
- }
36
- if (strArray[0].match(/^[^/:]+:\/*$/) && strArray.length > 1) {
37
- var first = strArray.shift();
38
- strArray[0] = first + strArray[0];
39
- }
40
- if (strArray[0].match(/^file:\/\/\//)) {
41
- strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, "$1:///");
42
- } else {
43
- strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, "$1://");
44
- }
45
- for (var i = 0; i < strArray.length; i++) {
46
- var component = strArray[i];
47
- if (typeof component !== "string") {
48
- throw new TypeError("Url must be a string. Received " + component);
49
- }
50
- if (component === "") {
51
- continue;
52
- }
53
- if (i > 0) {
54
- component = component.replace(/^[\/]+/, "");
55
- }
56
- if (i < strArray.length - 1) {
57
- component = component.replace(/[\/]+$/, "");
58
- } else {
59
- component = component.replace(/[\/]+$/, "/");
60
- }
61
- resultArray.push(component);
62
- }
63
- var str = resultArray.join("/");
64
- str = str.replace(/\/(\?|&|#[^!])/g, "$1");
65
- var parts = str.split("?");
66
- str = parts.shift() + (parts.length > 0 ? "?" : "") + parts.join("&");
67
- return str;
483
+ var resultArray = [];
484
+ if (strArray.length === 0) return "";
485
+ if (typeof strArray[0] !== "string") throw new TypeError("Url must be a string. Received " + strArray[0]);
486
+ if (strArray[0].match(/^[^/:]+:\/*$/) && strArray.length > 1) strArray[0] = strArray.shift() + strArray[0];
487
+ if (strArray[0].match(/^file:\/\/\//)) strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, "$1:///");
488
+ else strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, "$1://");
489
+ for (var i = 0; i < strArray.length; i++) {
490
+ var component = strArray[i];
491
+ if (typeof component !== "string") throw new TypeError("Url must be a string. Received " + component);
492
+ if (component === "") continue;
493
+ if (i > 0) component = component.replace(/^[\/]+/, "");
494
+ if (i < strArray.length - 1) component = component.replace(/[\/]+$/, "");
495
+ else component = component.replace(/[\/]+$/, "/");
496
+ resultArray.push(component);
497
+ }
498
+ var str = resultArray.join("/");
499
+ str = str.replace(/\/(\?|&|#[^!])/g, "$1");
500
+ var parts = str.split("?");
501
+ str = parts.shift() + (parts.length > 0 ? "?" : "") + parts.join("&");
502
+ return str;
68
503
  }
69
504
  function urlJoin() {
70
- var input;
71
- if (typeof arguments[0] === "object") {
72
- input = arguments[0];
73
- } else {
74
- input = [].slice.call(arguments);
75
- }
76
- return normalize(input);
505
+ var input;
506
+ if (typeof arguments[0] === "object") input = arguments[0];
507
+ else input = [].slice.call(arguments);
508
+ return normalize(input);
77
509
  }
78
- const _hoisted_1$1 = { class: "brightcove-player" };
79
- const BASE_URL = "//players.brightcove.net/";
80
- const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
81
- __name: "BrightcovePlayer",
82
- props: {
83
- accountId: {},
84
- playerId: {},
85
- videoId: {}
86
- },
87
- setup(__props, { expose: __expose }) {
88
- const BrightcoveErrorCode = {
89
- NOT_FOUND: "VIDEO_CLOUD_ERR_VIDEO_NOT_FOUND",
90
- INVALID_CONFIG: "ERR_INVALID_CONFIGURATION"
91
- };
92
- const props = __props;
93
- const error = vue.ref(null);
94
- const style = vue.ref(null);
95
- const script = vue.ref(null);
96
- const player = vue.ref(null);
97
- const playerUrl = vue.computed(
98
- () => urlJoin(BASE_URL, props.accountId, `${props.playerId}_default`, "index.min.js")
99
- );
100
- const showError = vue.computed(() => {
101
- if (!error.value) return false;
102
- const code = error.value.code;
103
- return code === BrightcoveErrorCode.NOT_FOUND || code === BrightcoveErrorCode.INVALID_CONFIG;
104
- });
105
- const createPlayer = () => {
106
- const video = document.createElement("video");
107
- Object.assign(video.dataset, {
108
- account: props.accountId,
109
- player: props.playerId,
110
- videoId: props.videoId
111
- });
112
- video.className = "video-js";
113
- video.setAttribute("controls", "");
114
- return video;
115
- };
116
- const destroyPlayer = () => {
117
- if (player.value) {
118
- player.value.pause();
119
- player.value.dispose();
120
- player.value = null;
121
- }
122
- error.value = null;
123
- if (script.value) document.body.removeChild(script.value);
124
- script.value = null;
125
- if (style.value) document.head.removeChild(style.value);
126
- style.value = null;
127
- if (videoWrapper.value) videoWrapper.value.innerHTML = "";
128
- };
129
- const initPlayer = (url = playerUrl.value) => {
130
- destroyPlayer();
131
- script.value = loadScript(url, document.body, (err) => {
132
- if (err) {
133
- onError({
134
- code: BrightcoveErrorCode.INVALID_CONFIG,
135
- accountId: props.accountId,
136
- playerId: props.playerId
137
- });
138
- return;
139
- }
140
- style.value = setTheme();
141
- const video = createPlayer();
142
- videoWrapper.value?.appendChild(video);
143
- player.value = window.bc(video);
144
- player.value.autoplay(false);
145
- player.value.on("error", () => onError(player.value.error()));
146
- });
147
- };
148
- const setTheme = () => {
149
- const cls = `bc-style-${props.playerId}-default`;
150
- const theme = document.head.getElementsByClassName(cls)[0];
151
- return document.head.insertBefore(theme, null);
152
- };
153
- const pause = () => {
154
- if (player.value) player.value.pause();
155
- };
156
- const onError = (err) => {
157
- error.value = err;
158
- };
159
- vue.watch(playerUrl, () => {
160
- if (!videoWrapper.value) return;
161
- initPlayer();
162
- });
163
- vue.watch(
164
- () => props.videoId,
165
- () => {
166
- if (!videoWrapper.value) return;
167
- initPlayer();
168
- }
169
- );
170
- vue.onMounted(() => {
171
- initPlayer();
172
- });
173
- vue.onBeforeUnmount(() => {
174
- destroyPlayer();
175
- });
176
- const videoWrapper = vue.ref(null);
177
- function loadScript(url, dest, cb) {
178
- const script2 = document.createElement("script");
179
- script2.src = url;
180
- script2.async = false;
181
- script2.onload = () => cb(null, script2);
182
- script2.onerror = () => cb(new Error("Error loading script!"), script2);
183
- return dest.appendChild(script2);
184
- }
185
- __expose({
186
- pause
187
- });
188
- return (_ctx, _cache) => {
189
- const _component_VIcon = vue.resolveComponent("VIcon");
190
- const _component_VSheet = vue.resolveComponent("VSheet");
191
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
192
- showError.value ? (vue.openBlock(), vue.createBlock(_component_VSheet, {
193
- key: 0,
194
- class: "h-100 d-flex flex-column align-center justify-center opacity-90",
195
- color: "black"
196
- }, {
197
- default: vue.withCtx(() => [
198
- vue.createVNode(_component_VIcon, {
199
- class: "mb-2",
200
- icon: "mdi-alert",
201
- size: "42"
202
- }),
203
- _cache[0] || (_cache[0] = vue.createElementVNode("div", { class: "text-h6" }, "Error loading media!", -1))
204
- ]),
205
- _: 1
206
- })) : vue.createCommentVNode("", true),
207
- vue.withDirectives(vue.createElementVNode("div", {
208
- ref_key: "videoWrapper",
209
- ref: videoWrapper,
210
- class: "wrapper"
211
- }, null, 512), [
212
- [vue.vShow, !showError.value]
213
- ])
214
- ]);
215
- };
216
- }
510
+ //#endregion
511
+ //#region src/components/BrightcovePlayer.vue?vue&type=script&setup=true&lang.ts
512
+ var _hoisted_1$1 = { class: "brightcove-player" };
513
+ var BASE_URL = "//players.brightcove.net/";
514
+ var BrightcovePlayer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
515
+ __name: "BrightcovePlayer",
516
+ props: {
517
+ accountId: {},
518
+ playerId: {},
519
+ videoId: {},
520
+ resumeTime: {}
521
+ },
522
+ emits: ["timeupdate", "seeked"],
523
+ setup(__props, { expose: __expose, emit: __emit }) {
524
+ const BrightcoveErrorCode = {
525
+ NOT_FOUND: "VIDEO_CLOUD_ERR_VIDEO_NOT_FOUND",
526
+ INVALID_CONFIG: "ERR_INVALID_CONFIGURATION"
527
+ };
528
+ const props = __props;
529
+ const emit = __emit;
530
+ const error = (0, vue.ref)(null);
531
+ const style = (0, vue.ref)(null);
532
+ const script = (0, vue.ref)(null);
533
+ const player = (0, vue.ref)(null);
534
+ const playerUrl = (0, vue.computed)(() => urlJoin(BASE_URL, props.accountId, `${props.playerId}_default`, "index.min.js"));
535
+ const showError = (0, vue.computed)(() => {
536
+ if (!error.value) return false;
537
+ const code = error.value.code;
538
+ return code === BrightcoveErrorCode.NOT_FOUND || code === BrightcoveErrorCode.INVALID_CONFIG;
539
+ });
540
+ const createPlayer = () => {
541
+ const video = document.createElement("video");
542
+ Object.assign(video.dataset, {
543
+ account: props.accountId,
544
+ player: props.playerId,
545
+ videoId: props.videoId
546
+ });
547
+ video.className = "video-js";
548
+ video.setAttribute("controls", "");
549
+ return video;
550
+ };
551
+ const destroyPlayer = () => {
552
+ if (player.value) {
553
+ player.value.pause();
554
+ player.value.dispose();
555
+ player.value = null;
556
+ }
557
+ error.value = null;
558
+ if (script.value) document.body.removeChild(script.value);
559
+ script.value = null;
560
+ if (style.value) document.head.removeChild(style.value);
561
+ style.value = null;
562
+ if (videoWrapper.value) videoWrapper.value.innerHTML = "";
563
+ };
564
+ const initPlayer = (url = playerUrl.value) => {
565
+ destroyPlayer();
566
+ script.value = loadScript(url, document.body, (err) => {
567
+ if (err) {
568
+ onError({
569
+ code: BrightcoveErrorCode.INVALID_CONFIG,
570
+ accountId: props.accountId,
571
+ playerId: props.playerId
572
+ });
573
+ return;
574
+ }
575
+ style.value = setTheme();
576
+ const video = createPlayer();
577
+ videoWrapper.value?.appendChild(video);
578
+ player.value = window.bc(video);
579
+ player.value.autoplay(false);
580
+ player.value.on("error", () => onError(player.value.error()));
581
+ player.value.on("timeupdate", () => emit("timeupdate", player.value.currentTime()));
582
+ player.value.on("seeked", () => emit("seeked", player.value.currentTime()));
583
+ if (props.resumeTime) player.value.one("loadedmetadata", () => player.value.currentTime(props.resumeTime));
584
+ });
585
+ };
586
+ const setTheme = () => {
587
+ const cls = `bc-style-${props.playerId}-default`;
588
+ const theme = document.head.getElementsByClassName(cls)[0];
589
+ return document.head.insertBefore(theme, null);
590
+ };
591
+ const pause = () => {
592
+ if (player.value) player.value.pause();
593
+ };
594
+ const onError = (err) => {
595
+ error.value = err;
596
+ };
597
+ (0, vue.watch)(playerUrl, () => {
598
+ if (!videoWrapper.value) return;
599
+ initPlayer();
600
+ });
601
+ (0, vue.watch)(() => props.videoId, () => {
602
+ if (!videoWrapper.value) return;
603
+ initPlayer();
604
+ });
605
+ (0, vue.onMounted)(() => {
606
+ initPlayer();
607
+ });
608
+ (0, vue.onBeforeUnmount)(() => {
609
+ destroyPlayer();
610
+ });
611
+ const videoWrapper = (0, vue.ref)(null);
612
+ function loadScript(url, dest, cb) {
613
+ const script = document.createElement("script");
614
+ script.src = url;
615
+ script.async = false;
616
+ script.onload = () => cb(null, script);
617
+ script.onerror = () => cb(/* @__PURE__ */ new Error("Error loading script!"), script);
618
+ return dest.appendChild(script);
619
+ }
620
+ __expose({ pause });
621
+ return (_ctx, _cache) => {
622
+ const _component_VIcon = (0, vue.resolveComponent)("VIcon");
623
+ const _component_VSheet = (0, vue.resolveComponent)("VSheet");
624
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$1, [showError.value ? ((0, vue.openBlock)(), (0, vue.createBlock)(_component_VSheet, {
625
+ key: 0,
626
+ class: "h-100 d-flex flex-column align-center justify-center opacity-90",
627
+ color: "black"
628
+ }, {
629
+ default: (0, vue.withCtx)(() => [(0, vue.createVNode)(_component_VIcon, {
630
+ class: "mb-2",
631
+ icon: "mdi-alert",
632
+ size: "42"
633
+ }), _cache[0] || (_cache[0] = (0, vue.createElementVNode)("div", { class: "text-title-large" }, "Error loading media!", -1))]),
634
+ _: 1
635
+ })) : (0, vue.createCommentVNode)("", true), (0, vue.withDirectives)((0, vue.createElementVNode)("div", {
636
+ ref_key: "videoWrapper",
637
+ ref: videoWrapper,
638
+ class: "wrapper"
639
+ }, null, 512), [[vue.vShow, !showError.value]])]);
640
+ };
641
+ }
217
642
  });
218
- const _export_sfc = (sfc, props) => {
219
- const target = sfc.__vccOpts || sfc;
220
- for (const [key, val] of props) {
221
- target[key] = val;
222
- }
223
- return target;
643
+ //#endregion
644
+ //#region \0plugin-vue:export-helper
645
+ var _plugin_vue_export_helper_default = (sfc, props) => {
646
+ const target = sfc.__vccOpts || sfc;
647
+ for (const [key, val] of props) target[key] = val;
648
+ return target;
224
649
  };
225
- const BrightcovePlayer = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-dd41e47c"]]);
226
- const _hoisted_1 = { class: "tce-brightcove-video-root" };
227
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
228
- __name: "Display",
229
- props: {
230
- element: {},
231
- userState: {}
232
- },
233
- emits: ["interaction"],
234
- setup(__props) {
235
- const props = __props;
236
- const accountId = vue.computed(() => props.element.data.accountId);
237
- const playerId = vue.computed(() => props.element.data.playerId);
238
- const videoId = vue.computed(() => props.element.data.videoId);
239
- const isConfigured = vue.computed(
240
- () => accountId.value && playerId.value && videoId.value
241
- );
242
- return (_ctx, _cache) => {
243
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
244
- isConfigured.value ? (vue.openBlock(), vue.createBlock(BrightcovePlayer, {
245
- key: 0,
246
- ref: "player",
247
- "account-id": accountId.value,
248
- "player-id": playerId.value,
249
- "video-id": videoId.value,
250
- class: "player"
251
- }, null, 8, ["account-id", "player-id", "video-id"])) : vue.createCommentVNode("", true)
252
- ]);
253
- };
254
- }
255
- });
256
- const Display = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d82c84d4"]]);
257
- const manifest = {
258
- ...index_default,
259
- Display
650
+ //#endregion
651
+ //#region src/components/BrightcovePlayer.vue
652
+ var BrightcovePlayer_default = /* @__PURE__ */ _plugin_vue_export_helper_default(BrightcovePlayer_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-78728a8f"]]);
653
+ //#endregion
654
+ //#region src/components/Display.vue?vue&type=script&setup=true&lang.ts
655
+ var _hoisted_1 = { class: "tce-brightcove-video-root" };
656
+ var PROGRESS_UPDATE_INTERVAL = 5e3;
657
+ var SEEK_DEBOUNCE_INTERVAL = 300;
658
+ //#endregion
659
+ //#region src/components/Display.vue
660
+ var Display_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ (0, vue.defineComponent)({
661
+ __name: "Display",
662
+ props: {
663
+ element: {},
664
+ userState: {}
665
+ },
666
+ emits: ["interaction"],
667
+ setup(__props, { emit: __emit }) {
668
+ const props = __props;
669
+ const emit = __emit;
670
+ const accountId = (0, vue.computed)(() => props.element.data.accountId);
671
+ const playerId = (0, vue.computed)(() => props.element.data.playerId);
672
+ const videoId = (0, vue.computed)(() => props.element.data.videoId);
673
+ const isConfigured = (0, vue.computed)(() => accountId.value && playerId.value && videoId.value);
674
+ const interact = (currentTime) => {
675
+ emit("interaction", {
676
+ currentTime,
677
+ furthestTime: Math.max(props.userState?.furthestTime ?? 0, currentTime)
678
+ });
679
+ };
680
+ const handleTimeUpdate = throttle(interact, PROGRESS_UPDATE_INTERVAL);
681
+ const handleSeeked = debounce(interact, SEEK_DEBOUNCE_INTERVAL);
682
+ return (_ctx, _cache) => {
683
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1, [isConfigured.value ? ((0, vue.openBlock)(), (0, vue.createBlock)(BrightcovePlayer_default, {
684
+ key: 0,
685
+ ref: "player",
686
+ "account-id": accountId.value,
687
+ "player-id": playerId.value,
688
+ "resume-time": __props.userState?.currentTime,
689
+ "video-id": videoId.value,
690
+ class: "player",
691
+ onSeeked: (0, vue.unref)(handleSeeked),
692
+ onTimeupdate: (0, vue.unref)(handleTimeUpdate)
693
+ }, null, 8, [
694
+ "account-id",
695
+ "player-id",
696
+ "resume-time",
697
+ "video-id",
698
+ "onSeeked",
699
+ "onTimeupdate"
700
+ ])) : (0, vue.createCommentVNode)("", true)]);
701
+ };
702
+ }
703
+ }), [["__scopeId", "data-v-5652f7ed"]]);
704
+ //#endregion
705
+ //#region src/index.ts
706
+ var manifest = {
707
+ ...manifest$1,
708
+ Display: Display_default
260
709
  };
261
- exports.Display = Display;
710
+ //#endregion
711
+ exports.Display = Display_default;
262
712
  exports.default = manifest;