@arc-ui/community-components 3.2.0 → 3.4.0

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 (158) hide show
  1. package/.turbo/turbo-build.log +133 -13
  2. package/CHANGELOG.md +31 -0
  3. package/lib/Accordion/Accordion.cjs +2 -3
  4. package/lib/Accordion/Accordion.mjs +2 -3
  5. package/lib/ActionTile/ActionTile.cjs +4 -5
  6. package/lib/ActionTile/ActionTile.mjs +10 -11
  7. package/lib/ActionTile/styles.css +1 -1
  8. package/lib/ArticleSidebar/ArticleSidebar.cjs +9 -10
  9. package/lib/ArticleSidebar/ArticleSidebar.mjs +46 -47
  10. package/lib/Author/Author.cjs +2 -3
  11. package/lib/Author/Author.mjs +2 -3
  12. package/lib/BannerWithTabs/BannerWithTabs.cjs +4 -5
  13. package/lib/BannerWithTabs/BannerWithTabs.mjs +8 -9
  14. package/lib/ContentInfoWidget/ContentInfoWidget.cjs +3 -2
  15. package/lib/ContentInfoWidget/ContentInfoWidget.mjs +8 -7
  16. package/lib/CopyLead/CopyLead.cjs +32 -23
  17. package/lib/CopyLead/CopyLead.mjs +60 -51
  18. package/lib/DownloadList/DownloadList.cjs +6 -8
  19. package/lib/DownloadList/DownloadList.mjs +11 -13
  20. package/lib/FAQs/FAQs.cjs +5 -6
  21. package/lib/FAQs/FAQs.mjs +22 -23
  22. package/lib/FeaturePost/FeaturePost.cjs +14 -15
  23. package/lib/FeaturePost/FeaturePost.mjs +54 -55
  24. package/lib/Highlights/Highlights.cjs +11 -12
  25. package/lib/Highlights/Highlights.mjs +24 -25
  26. package/lib/InlineLinkGroup/InlineLinkGroup.cjs +25 -0
  27. package/lib/InlineLinkGroup/InlineLinkGroup.mjs +23 -0
  28. package/lib/InlineLinkGroup/styles.css +1 -0
  29. package/lib/LinkTile/LinkTile.cjs +6 -6
  30. package/lib/LinkTile/LinkTile.mjs +7 -7
  31. package/lib/LinkTile/styles.css +1 -1
  32. package/lib/ProductNavigation/ProductNavigation.cjs +6 -7
  33. package/lib/ProductNavigation/ProductNavigation.mjs +18 -19
  34. package/lib/PromoListing/PromoListing.cjs +7 -8
  35. package/lib/PromoListing/PromoListing.mjs +17 -18
  36. package/lib/PromoListingThumbnailSignpost/PromoListingThumbnailSignpost.cjs +7 -8
  37. package/lib/PromoListingThumbnailSignpost/PromoListingThumbnailSignpost.mjs +9 -10
  38. package/lib/Quote/Quote.cjs +5 -6
  39. package/lib/Quote/Quote.mjs +9 -10
  40. package/lib/SectionHeading/SectionHeading.cjs +2 -3
  41. package/lib/SectionHeading/SectionHeading.mjs +2 -3
  42. package/lib/Statistics/Statistics.cjs +21 -19
  43. package/lib/Statistics/Statistics.mjs +35 -33
  44. package/lib/Statistics/styles.css +1 -1
  45. package/lib/Summary/Summary.cjs +4 -4
  46. package/lib/Summary/Summary.mjs +13 -13
  47. package/lib/ThumbnailSignpost/ThumbnailSignpost.cjs +2 -3
  48. package/lib/ThumbnailSignpost/ThumbnailSignpost.mjs +2 -3
  49. package/lib/VideoHeroCard/VideoHeroCard.cjs +76 -0
  50. package/lib/VideoHeroCard/VideoHeroCard.mjs +74 -0
  51. package/lib/VideoPortraitCard/VideoPortraitCard.cjs +22 -0
  52. package/lib/VideoPortraitCard/VideoPortraitCard.mjs +20 -0
  53. package/lib/_shared/cjs/{Accordion-DfNGOjTm.cjs → Accordion-QqDoB3pY.cjs} +8 -9
  54. package/lib/_shared/cjs/{Author-D4dKNQem.cjs → Author-aL8YXi7C.cjs} +4 -5
  55. package/lib/_shared/cjs/Preview-Dx1kCzJ1.cjs +102 -0
  56. package/lib/_shared/cjs/{SectionHeading-DeSFM0HV.cjs → SectionHeading-Dj-dJfv3.cjs} +4 -5
  57. package/lib/_shared/cjs/{ThumbnailSignpost-GkOiwt-Z.cjs → ThumbnailSignpost-SBnrGooA.cjs} +4 -5
  58. package/lib/_shared/cjs/VideoCardThumbnail-BqYgpk0u.cjs +440 -0
  59. package/lib/_shared/cjs/dash.all.min-BPXzla24.cjs +6 -0
  60. package/lib/_shared/cjs/{tslib.es6-BxB9I209.cjs → filter-attrs-C26zOt4_.cjs} +25 -0
  61. package/lib/_shared/cjs/hls-Ckhp5fVA.cjs +36628 -0
  62. package/lib/_shared/cjs/index-DjiIVIaV.cjs +96 -0
  63. package/lib/_shared/cjs/index-oGP6D6gL.cjs +14826 -0
  64. package/lib/_shared/cjs/{index.es-Dq8bYrbW.cjs → index.es-B0J3cvrY.cjs} +1 -1
  65. package/lib/_shared/cjs/mixin-BFwaXKGB.cjs +1027 -0
  66. package/lib/_shared/cjs/react-CEvhi3LL.cjs +737 -0
  67. package/lib/_shared/cjs/react-CqsEClV0.cjs +466 -0
  68. package/lib/_shared/cjs/react-DE6M3seI.cjs +496 -0
  69. package/lib/_shared/cjs/react-Dri2yjKm.cjs +554 -0
  70. package/lib/_shared/cjs/react-DxToimBj.cjs +4239 -0
  71. package/lib/_shared/cjs/react-JTfV8OSA.cjs +325 -0
  72. package/lib/_shared/cjs/react-caXJFZ8W.cjs +400 -0
  73. package/lib/_shared/cjs/react-fep2ei7j.cjs +727 -0
  74. package/lib/_shared/esm/{Accordion-cd1oYvBv.mjs → Accordion-DtU7jbCv.mjs} +16 -17
  75. package/lib/_shared/esm/Author-CJQFrQM9.mjs +27 -0
  76. package/lib/_shared/esm/Preview-CmbKOgEO.mjs +100 -0
  77. package/lib/_shared/esm/{SectionHeading-CpDLCndw.mjs → SectionHeading-BskdQ2Tt.mjs} +10 -11
  78. package/lib/_shared/esm/{ThumbnailSignpost-BeRiXbUp.mjs → ThumbnailSignpost-CBSdQiHw.mjs} +13 -14
  79. package/lib/_shared/esm/VideoCardThumbnail-VfOKmPCv.mjs +437 -0
  80. package/lib/_shared/esm/dash.all.min-CbWI_8dN.mjs +4 -0
  81. package/lib/_shared/esm/{tslib.es6-D6Wu-xwB.mjs → filter-attrs-D-1kWaCP.mjs} +25 -1
  82. package/lib/_shared/esm/hls-AFbJDS9D.mjs +36625 -0
  83. package/lib/_shared/esm/index-CrcIrdjn.mjs +14799 -0
  84. package/lib/_shared/esm/index-DYnuIO1L.mjs +94 -0
  85. package/lib/_shared/esm/{index.es-Bfdys5__.mjs → index.es-DraZ-qKh.mjs} +1 -1
  86. package/lib/_shared/esm/mixin-BGGG8VrM.mjs +1024 -0
  87. package/lib/_shared/esm/react-BGimq-TB.mjs +4237 -0
  88. package/lib/_shared/esm/react-BHT4t_eQ.mjs +494 -0
  89. package/lib/_shared/esm/react-BSd0sGcO.mjs +464 -0
  90. package/lib/_shared/esm/react-CSr43fZV.mjs +552 -0
  91. package/lib/_shared/esm/react-Ca6E7Fr-.mjs +398 -0
  92. package/lib/_shared/esm/react-DG070IvZ.mjs +725 -0
  93. package/lib/_shared/esm/react-DZyqy7W7.mjs +735 -0
  94. package/lib/_shared/esm/react-WW_9iHcl.mjs +323 -0
  95. package/lib/index.cjs +299 -181
  96. package/lib/index.cjs.map +1 -1
  97. package/lib/index.d.cts +77 -63
  98. package/lib/index.d.mts +77 -63
  99. package/lib/index.mjs +297 -181
  100. package/lib/index.mjs.map +1 -1
  101. package/lib/styles.css +1 -1
  102. package/package.json +15 -12
  103. package/rollup.config.js +1 -1
  104. package/src/components/ActionTile/ActionTile.module.css +56 -37
  105. package/src/components/ActionTile/ActionTile.tsx +1 -1
  106. package/src/components/ArticleSidebar/ArticleSidebar.tsx +4 -6
  107. package/src/components/Author/Author.tsx +0 -3
  108. package/src/components/BannerWithTabs/BannerWithTabs.tsx +4 -6
  109. package/src/components/ContentInfoWidget/ContentInfoWidget.tsx +3 -4
  110. package/src/components/CopyLead/components/MediaContent/MediaContent.tsx +7 -6
  111. package/src/components/CopyLead/templates/Content/Content.tsx +5 -3
  112. package/src/components/CopyLead/templates/Media/Media.tsx +5 -6
  113. package/src/components/DownloadList/DownloadList.tsx +8 -8
  114. package/src/components/FeaturePost/FeaturePost.tsx +3 -7
  115. package/src/components/Highlights/Highlights.tsx +3 -2
  116. package/src/components/Highlights/components/HighlightItem/HighlightItem.tsx +3 -2
  117. package/src/components/Highlights/components/HighlightList/HighlightList.tsx +5 -2
  118. package/src/components/InlineLinkGroup/InlineLinkGroup.module.css +81 -0
  119. package/src/components/InlineLinkGroup/InlineLinkGroup.tsx +67 -0
  120. package/src/components/InlineLinkGroup/index.ts +5 -0
  121. package/src/components/LinkTile/LinkTile.module.css +62 -26
  122. package/src/components/LinkTile/LinkTile.tsx +8 -1
  123. package/src/components/PromoListing/PromoListing.tsx +3 -11
  124. package/src/components/PromoListingThumbnailSignpost/PromoListingThumbnailSignpost.tsx +2 -0
  125. package/src/components/Quote/Quote.tsx +1 -7
  126. package/src/components/Statistics/Statistics.module.css +0 -10
  127. package/src/components/Statistics/Statistics.tsx +35 -32
  128. package/src/components/Summary/Summary.tsx +3 -1
  129. package/src/components/VideoHeroCard/VideoHeroCard.tsx +63 -0
  130. package/src/components/VideoHeroCard/components/VideoHeroCardContent/VideoHeroCardContent.module.css +32 -0
  131. package/src/components/VideoHeroCard/components/VideoHeroCardContent/VideoHeroCardContent.tsx +97 -0
  132. package/src/components/VideoHeroCard/components/VideoHeroCardContent/index.ts +4 -0
  133. package/src/components/VideoHeroCard/index.ts +1 -0
  134. package/src/components/VideoPortraitCard/VideoPortraitCard.tsx +54 -0
  135. package/src/components/VideoPortraitCard/index.ts +4 -0
  136. package/src/components/index.ts +3 -1
  137. package/src/internal/MultiLineText/MultiLineText.tsx +25 -0
  138. package/src/internal/MultiLineText/index.ts +1 -0
  139. package/src/internal/VideoCardPlayer/VideoCardPlayer.module.css +54 -0
  140. package/src/internal/VideoCardPlayer/VideoCardPlayer.tsx +62 -0
  141. package/src/internal/VideoCardPlayer/components/VideoCardPlayIcon/VideoCardPlayIcon.module.css +41 -0
  142. package/src/internal/VideoCardPlayer/components/VideoCardPlayIcon/VideoCardPlayIcon.tsx +28 -0
  143. package/src/internal/VideoCardPlayer/components/VideoCardPlayIcon/index.ts +1 -0
  144. package/src/internal/VideoCardPlayer/components/VideoCardThumbnail/VideoCardThumbnail.module.css +58 -0
  145. package/src/internal/VideoCardPlayer/components/VideoCardThumbnail/VideoCardThumbnail.tsx +38 -0
  146. package/src/internal/VideoCardPlayer/components/VideoCardThumbnail/index.ts +1 -0
  147. package/src/internal/VideoCardPlayer/index.ts +2 -0
  148. package/src/internal/VideoCardPlayer/types/player-props.ts +6 -0
  149. package/versions.json +1 -1
  150. package/lib/HeroLink/HeroLink.cjs +0 -35
  151. package/lib/HeroLink/HeroLink.mjs +0 -33
  152. package/lib/HeroLink/styles.css +0 -1
  153. package/lib/_shared/cjs/filter-attrs-BizjMsy0.cjs +0 -27
  154. package/lib/_shared/esm/Author-HnYsFTPT.mjs +0 -28
  155. package/lib/_shared/esm/filter-attrs-DZ7RCEZm.mjs +0 -25
  156. package/src/components/HeroLink/HeroLink.module.css +0 -44
  157. package/src/components/HeroLink/HeroLink.tsx +0 -136
  158. package/src/components/HeroLink/index.ts +0 -2
@@ -0,0 +1,4239 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var index = require('./index-DjiIVIaV.cjs');
5
+
6
+ /*! @vimeo/player v2.29.0 | (c) 2025 Vimeo | MIT License | https://github.com/vimeo/player.js */
7
+ function ownKeys(object, enumerableOnly) {
8
+ var keys = Object.keys(object);
9
+ if (Object.getOwnPropertySymbols) {
10
+ var symbols = Object.getOwnPropertySymbols(object);
11
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
12
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
13
+ })), keys.push.apply(keys, symbols);
14
+ }
15
+ return keys;
16
+ }
17
+ function _objectSpread2(target) {
18
+ for (var i = 1; i < arguments.length; i++) {
19
+ var source = null != arguments[i] ? arguments[i] : {};
20
+ i % 2 ? ownKeys(Object(source), true).forEach(function (key) {
21
+ _defineProperty(target, key, source[key]);
22
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
23
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
24
+ });
25
+ }
26
+ return target;
27
+ }
28
+ function _regeneratorRuntime() {
29
+ _regeneratorRuntime = function () {
30
+ return exports;
31
+ };
32
+ var exports = {},
33
+ Op = Object.prototype,
34
+ hasOwn = Op.hasOwnProperty,
35
+ defineProperty = Object.defineProperty || function (obj, key, desc) {
36
+ obj[key] = desc.value;
37
+ },
38
+ $Symbol = "function" == typeof Symbol ? Symbol : {},
39
+ iteratorSymbol = $Symbol.iterator || "@@iterator",
40
+ asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
41
+ toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
42
+ function define(obj, key, value) {
43
+ return Object.defineProperty(obj, key, {
44
+ value: value,
45
+ enumerable: true,
46
+ configurable: true,
47
+ writable: true
48
+ }), obj[key];
49
+ }
50
+ try {
51
+ define({}, "");
52
+ } catch (err) {
53
+ define = function (obj, key, value) {
54
+ return obj[key] = value;
55
+ };
56
+ }
57
+ function wrap(innerFn, outerFn, self, tryLocsList) {
58
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
59
+ generator = Object.create(protoGenerator.prototype),
60
+ context = new Context(tryLocsList || []);
61
+ return defineProperty(generator, "_invoke", {
62
+ value: makeInvokeMethod(innerFn, self, context)
63
+ }), generator;
64
+ }
65
+ function tryCatch(fn, obj, arg) {
66
+ try {
67
+ return {
68
+ type: "normal",
69
+ arg: fn.call(obj, arg)
70
+ };
71
+ } catch (err) {
72
+ return {
73
+ type: "throw",
74
+ arg: err
75
+ };
76
+ }
77
+ }
78
+ exports.wrap = wrap;
79
+ var ContinueSentinel = {};
80
+ function Generator() {}
81
+ function GeneratorFunction() {}
82
+ function GeneratorFunctionPrototype() {}
83
+ var IteratorPrototype = {};
84
+ define(IteratorPrototype, iteratorSymbol, function () {
85
+ return this;
86
+ });
87
+ var getProto = Object.getPrototypeOf,
88
+ NativeIteratorPrototype = getProto && getProto(getProto(values([])));
89
+ NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
90
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
91
+ function defineIteratorMethods(prototype) {
92
+ ["next", "throw", "return"].forEach(function (method) {
93
+ define(prototype, method, function (arg) {
94
+ return this._invoke(method, arg);
95
+ });
96
+ });
97
+ }
98
+ function AsyncIterator(generator, PromiseImpl) {
99
+ function invoke(method, arg, resolve, reject) {
100
+ var record = tryCatch(generator[method], generator, arg);
101
+ if ("throw" !== record.type) {
102
+ var result = record.arg,
103
+ value = result.value;
104
+ return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
105
+ invoke("next", value, resolve, reject);
106
+ }, function (err) {
107
+ invoke("throw", err, resolve, reject);
108
+ }) : PromiseImpl.resolve(value).then(function (unwrapped) {
109
+ result.value = unwrapped, resolve(result);
110
+ }, function (error) {
111
+ return invoke("throw", error, resolve, reject);
112
+ });
113
+ }
114
+ reject(record.arg);
115
+ }
116
+ var previousPromise;
117
+ defineProperty(this, "_invoke", {
118
+ value: function (method, arg) {
119
+ function callInvokeWithMethodAndArg() {
120
+ return new PromiseImpl(function (resolve, reject) {
121
+ invoke(method, arg, resolve, reject);
122
+ });
123
+ }
124
+ return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
125
+ }
126
+ });
127
+ }
128
+ function makeInvokeMethod(innerFn, self, context) {
129
+ var state = "suspendedStart";
130
+ return function (method, arg) {
131
+ if ("executing" === state) throw new Error("Generator is already running");
132
+ if ("completed" === state) {
133
+ if ("throw" === method) throw arg;
134
+ return doneResult();
135
+ }
136
+ for (context.method = method, context.arg = arg;;) {
137
+ var delegate = context.delegate;
138
+ if (delegate) {
139
+ var delegateResult = maybeInvokeDelegate(delegate, context);
140
+ if (delegateResult) {
141
+ if (delegateResult === ContinueSentinel) continue;
142
+ return delegateResult;
143
+ }
144
+ }
145
+ if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
146
+ if ("suspendedStart" === state) throw state = "completed", context.arg;
147
+ context.dispatchException(context.arg);
148
+ } else "return" === context.method && context.abrupt("return", context.arg);
149
+ state = "executing";
150
+ var record = tryCatch(innerFn, self, context);
151
+ if ("normal" === record.type) {
152
+ if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
153
+ return {
154
+ value: record.arg,
155
+ done: context.done
156
+ };
157
+ }
158
+ "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
159
+ }
160
+ };
161
+ }
162
+ function maybeInvokeDelegate(delegate, context) {
163
+ var methodName = context.method,
164
+ method = delegate.iterator[methodName];
165
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
166
+ var record = tryCatch(method, delegate.iterator, context.arg);
167
+ if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
168
+ var info = record.arg;
169
+ return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
170
+ }
171
+ function pushTryEntry(locs) {
172
+ var entry = {
173
+ tryLoc: locs[0]
174
+ };
175
+ 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
176
+ }
177
+ function resetTryEntry(entry) {
178
+ var record = entry.completion || {};
179
+ record.type = "normal", delete record.arg, entry.completion = record;
180
+ }
181
+ function Context(tryLocsList) {
182
+ this.tryEntries = [{
183
+ tryLoc: "root"
184
+ }], tryLocsList.forEach(pushTryEntry, this), this.reset(true);
185
+ }
186
+ function values(iterable) {
187
+ if (iterable) {
188
+ var iteratorMethod = iterable[iteratorSymbol];
189
+ if (iteratorMethod) return iteratorMethod.call(iterable);
190
+ if ("function" == typeof iterable.next) return iterable;
191
+ if (!isNaN(iterable.length)) {
192
+ var i = -1,
193
+ next = function next() {
194
+ for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = false, next;
195
+ return next.value = undefined, next.done = true, next;
196
+ };
197
+ return next.next = next;
198
+ }
199
+ }
200
+ return {
201
+ next: doneResult
202
+ };
203
+ }
204
+ function doneResult() {
205
+ return {
206
+ value: undefined,
207
+ done: true
208
+ };
209
+ }
210
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
211
+ value: GeneratorFunctionPrototype,
212
+ configurable: true
213
+ }), defineProperty(GeneratorFunctionPrototype, "constructor", {
214
+ value: GeneratorFunction,
215
+ configurable: true
216
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
217
+ var ctor = "function" == typeof genFun && genFun.constructor;
218
+ return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
219
+ }, exports.mark = function (genFun) {
220
+ return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
221
+ }, exports.awrap = function (arg) {
222
+ return {
223
+ __await: arg
224
+ };
225
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
226
+ return this;
227
+ }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
228
+ void 0 === PromiseImpl && (PromiseImpl = Promise);
229
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
230
+ return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
231
+ return result.done ? result.value : iter.next();
232
+ });
233
+ }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
234
+ return this;
235
+ }), define(Gp, "toString", function () {
236
+ return "[object Generator]";
237
+ }), exports.keys = function (val) {
238
+ var object = Object(val),
239
+ keys = [];
240
+ for (var key in object) keys.push(key);
241
+ return keys.reverse(), function next() {
242
+ for (; keys.length;) {
243
+ var key = keys.pop();
244
+ if (key in object) return next.value = key, next.done = false, next;
245
+ }
246
+ return next.done = true, next;
247
+ };
248
+ }, exports.values = values, Context.prototype = {
249
+ constructor: Context,
250
+ reset: function (skipTempReset) {
251
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = false, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
252
+ },
253
+ stop: function () {
254
+ this.done = true;
255
+ var rootRecord = this.tryEntries[0].completion;
256
+ if ("throw" === rootRecord.type) throw rootRecord.arg;
257
+ return this.rval;
258
+ },
259
+ dispatchException: function (exception) {
260
+ if (this.done) throw exception;
261
+ var context = this;
262
+ function handle(loc, caught) {
263
+ return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
264
+ }
265
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
266
+ var entry = this.tryEntries[i],
267
+ record = entry.completion;
268
+ if ("root" === entry.tryLoc) return handle("end");
269
+ if (entry.tryLoc <= this.prev) {
270
+ var hasCatch = hasOwn.call(entry, "catchLoc"),
271
+ hasFinally = hasOwn.call(entry, "finallyLoc");
272
+ if (hasCatch && hasFinally) {
273
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, true);
274
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
275
+ } else if (hasCatch) {
276
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, true);
277
+ } else {
278
+ if (!hasFinally) throw new Error("try statement without catch or finally");
279
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
280
+ }
281
+ }
282
+ }
283
+ },
284
+ abrupt: function (type, arg) {
285
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
286
+ var entry = this.tryEntries[i];
287
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
288
+ var finallyEntry = entry;
289
+ break;
290
+ }
291
+ }
292
+ finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
293
+ var record = finallyEntry ? finallyEntry.completion : {};
294
+ return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
295
+ },
296
+ complete: function (record, afterLoc) {
297
+ if ("throw" === record.type) throw record.arg;
298
+ return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
299
+ },
300
+ finish: function (finallyLoc) {
301
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
302
+ var entry = this.tryEntries[i];
303
+ if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
304
+ }
305
+ },
306
+ catch: function (tryLoc) {
307
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
308
+ var entry = this.tryEntries[i];
309
+ if (entry.tryLoc === tryLoc) {
310
+ var record = entry.completion;
311
+ if ("throw" === record.type) {
312
+ var thrown = record.arg;
313
+ resetTryEntry(entry);
314
+ }
315
+ return thrown;
316
+ }
317
+ }
318
+ throw new Error("illegal catch attempt");
319
+ },
320
+ delegateYield: function (iterable, resultName, nextLoc) {
321
+ return this.delegate = {
322
+ iterator: values(iterable),
323
+ resultName: resultName,
324
+ nextLoc: nextLoc
325
+ }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
326
+ }
327
+ }, exports;
328
+ }
329
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
330
+ try {
331
+ var info = gen[key](arg);
332
+ var value = info.value;
333
+ } catch (error) {
334
+ reject(error);
335
+ return;
336
+ }
337
+ if (info.done) {
338
+ resolve(value);
339
+ } else {
340
+ Promise.resolve(value).then(_next, _throw);
341
+ }
342
+ }
343
+ function _asyncToGenerator(fn) {
344
+ return function () {
345
+ var self = this,
346
+ args = arguments;
347
+ return new Promise(function (resolve, reject) {
348
+ var gen = fn.apply(self, args);
349
+ function _next(value) {
350
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
351
+ }
352
+ function _throw(err) {
353
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
354
+ }
355
+ _next(undefined);
356
+ });
357
+ };
358
+ }
359
+ function _classCallCheck(instance, Constructor) {
360
+ if (!(instance instanceof Constructor)) {
361
+ throw new TypeError("Cannot call a class as a function");
362
+ }
363
+ }
364
+ function _defineProperties(target, props) {
365
+ for (var i = 0; i < props.length; i++) {
366
+ var descriptor = props[i];
367
+ descriptor.enumerable = descriptor.enumerable || false;
368
+ descriptor.configurable = true;
369
+ if ("value" in descriptor) descriptor.writable = true;
370
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
371
+ }
372
+ }
373
+ function _createClass(Constructor, protoProps, staticProps) {
374
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
375
+ Object.defineProperty(Constructor, "prototype", {
376
+ writable: false
377
+ });
378
+ return Constructor;
379
+ }
380
+ function _defineProperty(obj, key, value) {
381
+ key = _toPropertyKey(key);
382
+ if (key in obj) {
383
+ Object.defineProperty(obj, key, {
384
+ value: value,
385
+ enumerable: true,
386
+ configurable: true,
387
+ writable: true
388
+ });
389
+ } else {
390
+ obj[key] = value;
391
+ }
392
+ return obj;
393
+ }
394
+ function _inherits(subClass, superClass) {
395
+ if (typeof superClass !== "function" && superClass !== null) {
396
+ throw new TypeError("Super expression must either be null or a function");
397
+ }
398
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
399
+ constructor: {
400
+ value: subClass,
401
+ writable: true,
402
+ configurable: true
403
+ }
404
+ });
405
+ Object.defineProperty(subClass, "prototype", {
406
+ writable: false
407
+ });
408
+ if (superClass) _setPrototypeOf(subClass, superClass);
409
+ }
410
+ function _getPrototypeOf(o) {
411
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
412
+ return o.__proto__ || Object.getPrototypeOf(o);
413
+ };
414
+ return _getPrototypeOf(o);
415
+ }
416
+ function _setPrototypeOf(o, p) {
417
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
418
+ o.__proto__ = p;
419
+ return o;
420
+ };
421
+ return _setPrototypeOf(o, p);
422
+ }
423
+ function _isNativeReflectConstruct() {
424
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
425
+ if (Reflect.construct.sham) return false;
426
+ if (typeof Proxy === "function") return true;
427
+ try {
428
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
429
+ return true;
430
+ } catch (e) {
431
+ return false;
432
+ }
433
+ }
434
+ function _construct(Parent, args, Class) {
435
+ if (_isNativeReflectConstruct()) {
436
+ _construct = Reflect.construct.bind();
437
+ } else {
438
+ _construct = function _construct(Parent, args, Class) {
439
+ var a = [null];
440
+ a.push.apply(a, args);
441
+ var Constructor = Function.bind.apply(Parent, a);
442
+ var instance = new Constructor();
443
+ if (Class) _setPrototypeOf(instance, Class.prototype);
444
+ return instance;
445
+ };
446
+ }
447
+ return _construct.apply(null, arguments);
448
+ }
449
+ function _isNativeFunction(fn) {
450
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
451
+ }
452
+ function _wrapNativeSuper(Class) {
453
+ var _cache = typeof Map === "function" ? new Map() : undefined;
454
+ _wrapNativeSuper = function _wrapNativeSuper(Class) {
455
+ if (Class === null || !_isNativeFunction(Class)) return Class;
456
+ if (typeof Class !== "function") {
457
+ throw new TypeError("Super expression must either be null or a function");
458
+ }
459
+ if (typeof _cache !== "undefined") {
460
+ if (_cache.has(Class)) return _cache.get(Class);
461
+ _cache.set(Class, Wrapper);
462
+ }
463
+ function Wrapper() {
464
+ return _construct(Class, arguments, _getPrototypeOf(this).constructor);
465
+ }
466
+ Wrapper.prototype = Object.create(Class.prototype, {
467
+ constructor: {
468
+ value: Wrapper,
469
+ enumerable: false,
470
+ writable: true,
471
+ configurable: true
472
+ }
473
+ });
474
+ return _setPrototypeOf(Wrapper, Class);
475
+ };
476
+ return _wrapNativeSuper(Class);
477
+ }
478
+ function _assertThisInitialized(self) {
479
+ if (self === void 0) {
480
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
481
+ }
482
+ return self;
483
+ }
484
+ function _possibleConstructorReturn(self, call) {
485
+ if (call && (typeof call === "object" || typeof call === "function")) {
486
+ return call;
487
+ } else if (call !== void 0) {
488
+ throw new TypeError("Derived constructors may only return object or undefined");
489
+ }
490
+ return _assertThisInitialized(self);
491
+ }
492
+ function _createSuper(Derived) {
493
+ var hasNativeReflectConstruct = _isNativeReflectConstruct();
494
+ return function _createSuperInternal() {
495
+ var Super = _getPrototypeOf(Derived),
496
+ result;
497
+ if (hasNativeReflectConstruct) {
498
+ var NewTarget = _getPrototypeOf(this).constructor;
499
+ result = Reflect.construct(Super, arguments, NewTarget);
500
+ } else {
501
+ result = Super.apply(this, arguments);
502
+ }
503
+ return _possibleConstructorReturn(this, result);
504
+ };
505
+ }
506
+ function _toPrimitive(input, hint) {
507
+ if (typeof input !== "object" || input === null) return input;
508
+ var prim = input[Symbol.toPrimitive];
509
+ if (prim !== undefined) {
510
+ var res = prim.call(input, hint);
511
+ if (typeof res !== "object") return res;
512
+ throw new TypeError("@@toPrimitive must return a primitive value.");
513
+ }
514
+ return (String )(input);
515
+ }
516
+ function _toPropertyKey(arg) {
517
+ var key = _toPrimitive(arg, "string");
518
+ return typeof key === "symbol" ? key : String(key);
519
+ }
520
+
521
+ /**
522
+ * @module lib/functions
523
+ */
524
+
525
+ /**
526
+ * Check to see this is a node environment.
527
+ * @type {Boolean}
528
+ */
529
+ /* global global */
530
+ var isNode = typeof global !== 'undefined' && {}.toString.call(global) === '[object global]';
531
+
532
+ /**
533
+ * Get the name of the method for a given getter or setter.
534
+ *
535
+ * @param {string} prop The name of the property.
536
+ * @param {string} type Either “get” or “set”.
537
+ * @return {string}
538
+ */
539
+ function getMethodName(prop, type) {
540
+ if (prop.indexOf(type.toLowerCase()) === 0) {
541
+ return prop;
542
+ }
543
+ return "".concat(type.toLowerCase()).concat(prop.substr(0, 1).toUpperCase()).concat(prop.substr(1));
544
+ }
545
+
546
+ /**
547
+ * Check to see if the object is a DOM Element.
548
+ *
549
+ * @param {*} element The object to check.
550
+ * @return {boolean}
551
+ */
552
+ function isDomElement(element) {
553
+ return Boolean(element && element.nodeType === 1 && 'nodeName' in element && element.ownerDocument && element.ownerDocument.defaultView);
554
+ }
555
+
556
+ /**
557
+ * Check to see whether the value is a number.
558
+ *
559
+ * @see http://dl.dropboxusercontent.com/u/35146/js/tests/isNumber.html
560
+ * @param {*} value The value to check.
561
+ * @param {boolean} integer Check if the value is an integer.
562
+ * @return {boolean}
563
+ */
564
+ function isInteger(value) {
565
+ // eslint-disable-next-line eqeqeq
566
+ return !isNaN(parseFloat(value)) && isFinite(value) && Math.floor(value) == value;
567
+ }
568
+
569
+ /**
570
+ * Check to see if the URL is a Vimeo url.
571
+ *
572
+ * @param {string} url The url string.
573
+ * @return {boolean}
574
+ */
575
+ function isVimeoUrl(url) {
576
+ return /^(https?:)?\/\/((((player|www)\.)?vimeo\.com)|((player\.)?[a-zA-Z0-9-]+\.(videoji\.(hk|cn)|vimeo\.work)))(?=$|\/)/.test(url);
577
+ }
578
+
579
+ /**
580
+ * Check to see if the URL is for a Vimeo embed.
581
+ *
582
+ * @param {string} url The url string.
583
+ * @return {boolean}
584
+ */
585
+ function isVimeoEmbed(url) {
586
+ var expr = /^https:\/\/player\.((vimeo\.com)|([a-zA-Z0-9-]+\.(videoji\.(hk|cn)|vimeo\.work)))\/video\/\d+/;
587
+ return expr.test(url);
588
+ }
589
+ function getOembedDomain(url) {
590
+ var match = (url || '').match(/^(?:https?:)?(?:\/\/)?([^/?]+)/);
591
+ var domain = (match && match[1] || '').replace('player.', '');
592
+ var customDomains = ['.videoji.hk', '.vimeo.work', '.videoji.cn'];
593
+ for (var _i = 0, _customDomains = customDomains; _i < _customDomains.length; _i++) {
594
+ var customDomain = _customDomains[_i];
595
+ if (domain.endsWith(customDomain)) {
596
+ return domain;
597
+ }
598
+ }
599
+ return 'vimeo.com';
600
+ }
601
+
602
+ /**
603
+ * Get the Vimeo URL from an element.
604
+ * The element must have either a data-vimeo-id or data-vimeo-url attribute.
605
+ *
606
+ * @param {object} oEmbedParameters The oEmbed parameters.
607
+ * @return {string}
608
+ */
609
+ function getVimeoUrl() {
610
+ var oEmbedParameters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
611
+ var id = oEmbedParameters.id;
612
+ var url = oEmbedParameters.url;
613
+ var idOrUrl = id || url;
614
+ if (!idOrUrl) {
615
+ throw new Error('An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.');
616
+ }
617
+ if (isInteger(idOrUrl)) {
618
+ return "https://vimeo.com/".concat(idOrUrl);
619
+ }
620
+ if (isVimeoUrl(idOrUrl)) {
621
+ return idOrUrl.replace('http:', 'https:');
622
+ }
623
+ if (id) {
624
+ throw new TypeError("\u201C".concat(id, "\u201D is not a valid video id."));
625
+ }
626
+ throw new TypeError("\u201C".concat(idOrUrl, "\u201D is not a vimeo.com url."));
627
+ }
628
+
629
+ /* eslint-disable max-params */
630
+ /**
631
+ * A utility method for attaching and detaching event handlers
632
+ *
633
+ * @param {EventTarget} target
634
+ * @param {string | string[]} eventName
635
+ * @param {function} callback
636
+ * @param {'addEventListener' | 'on'} onName
637
+ * @param {'removeEventListener' | 'off'} offName
638
+ * @return {{cancel: (function(): void)}}
639
+ */
640
+ var subscribe = function subscribe(target, eventName, callback) {
641
+ var onName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'addEventListener';
642
+ var offName = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'removeEventListener';
643
+ var eventNames = typeof eventName === 'string' ? [eventName] : eventName;
644
+ eventNames.forEach(function (evName) {
645
+ target[onName](evName, callback);
646
+ });
647
+ return {
648
+ cancel: function cancel() {
649
+ return eventNames.forEach(function (evName) {
650
+ return target[offName](evName, callback);
651
+ });
652
+ }
653
+ };
654
+ };
655
+
656
+ var arrayIndexOfSupport = typeof Array.prototype.indexOf !== 'undefined';
657
+ var postMessageSupport = typeof window !== 'undefined' && typeof window.postMessage !== 'undefined';
658
+ if (!isNode && (!arrayIndexOfSupport || !postMessageSupport)) {
659
+ throw new Error('Sorry, the Vimeo Player API is not available in this browser.');
660
+ }
661
+
662
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
663
+
664
+ function createCommonjsModule(fn, module) {
665
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
666
+ }
667
+
668
+ /*!
669
+ * weakmap-polyfill v2.0.4 - ECMAScript6 WeakMap polyfill
670
+ * https://github.com/polygonplanet/weakmap-polyfill
671
+ * Copyright (c) 2015-2021 polygonplanet <polygon.planet.aqua@gmail.com>
672
+ * @license MIT
673
+ */
674
+
675
+ (function (self) {
676
+
677
+ if (self.WeakMap) {
678
+ return;
679
+ }
680
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
681
+ var hasDefine = Object.defineProperty && function () {
682
+ try {
683
+ // Avoid IE8's broken Object.defineProperty
684
+ return Object.defineProperty({}, 'x', {
685
+ value: 1
686
+ }).x === 1;
687
+ } catch (e) {}
688
+ }();
689
+ var defineProperty = function (object, name, value) {
690
+ if (hasDefine) {
691
+ Object.defineProperty(object, name, {
692
+ configurable: true,
693
+ writable: true,
694
+ value: value
695
+ });
696
+ } else {
697
+ object[name] = value;
698
+ }
699
+ };
700
+ self.WeakMap = function () {
701
+ // ECMA-262 23.3 WeakMap Objects
702
+ function WeakMap() {
703
+ if (this === void 0) {
704
+ throw new TypeError("Constructor WeakMap requires 'new'");
705
+ }
706
+ defineProperty(this, '_id', genId('_WeakMap'));
707
+
708
+ // ECMA-262 23.3.1.1 WeakMap([iterable])
709
+ if (arguments.length > 0) {
710
+ // Currently, WeakMap `iterable` argument is not supported
711
+ throw new TypeError('WeakMap iterable is not supported');
712
+ }
713
+ }
714
+
715
+ // ECMA-262 23.3.3.2 WeakMap.prototype.delete(key)
716
+ defineProperty(WeakMap.prototype, 'delete', function (key) {
717
+ checkInstance(this, 'delete');
718
+ if (!isObject(key)) {
719
+ return false;
720
+ }
721
+ var entry = key[this._id];
722
+ if (entry && entry[0] === key) {
723
+ delete key[this._id];
724
+ return true;
725
+ }
726
+ return false;
727
+ });
728
+
729
+ // ECMA-262 23.3.3.3 WeakMap.prototype.get(key)
730
+ defineProperty(WeakMap.prototype, 'get', function (key) {
731
+ checkInstance(this, 'get');
732
+ if (!isObject(key)) {
733
+ return void 0;
734
+ }
735
+ var entry = key[this._id];
736
+ if (entry && entry[0] === key) {
737
+ return entry[1];
738
+ }
739
+ return void 0;
740
+ });
741
+
742
+ // ECMA-262 23.3.3.4 WeakMap.prototype.has(key)
743
+ defineProperty(WeakMap.prototype, 'has', function (key) {
744
+ checkInstance(this, 'has');
745
+ if (!isObject(key)) {
746
+ return false;
747
+ }
748
+ var entry = key[this._id];
749
+ if (entry && entry[0] === key) {
750
+ return true;
751
+ }
752
+ return false;
753
+ });
754
+
755
+ // ECMA-262 23.3.3.5 WeakMap.prototype.set(key, value)
756
+ defineProperty(WeakMap.prototype, 'set', function (key, value) {
757
+ checkInstance(this, 'set');
758
+ if (!isObject(key)) {
759
+ throw new TypeError('Invalid value used as weak map key');
760
+ }
761
+ var entry = key[this._id];
762
+ if (entry && entry[0] === key) {
763
+ entry[1] = value;
764
+ return this;
765
+ }
766
+ defineProperty(key, this._id, [key, value]);
767
+ return this;
768
+ });
769
+ function checkInstance(x, methodName) {
770
+ if (!isObject(x) || !hasOwnProperty.call(x, '_id')) {
771
+ throw new TypeError(methodName + ' method called on incompatible receiver ' + typeof x);
772
+ }
773
+ }
774
+ function genId(prefix) {
775
+ return prefix + '_' + rand() + '.' + rand();
776
+ }
777
+ function rand() {
778
+ return Math.random().toString().substring(2);
779
+ }
780
+ defineProperty(WeakMap, '_polyfill', true);
781
+ return WeakMap;
782
+ }();
783
+ function isObject(x) {
784
+ return Object(x) === x;
785
+ }
786
+ })(typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : commonjsGlobal);
787
+
788
+ var npo_src = createCommonjsModule(function (module) {
789
+ /*! Native Promise Only
790
+ v0.8.1 (c) Kyle Simpson
791
+ MIT License: http://getify.mit-license.org
792
+ */
793
+
794
+ (function UMD(name, context, definition) {
795
+ // special form of UMD for polyfilling across evironments
796
+ context[name] = context[name] || definition();
797
+ if ( module.exports) {
798
+ module.exports = context[name];
799
+ }
800
+ })("Promise", typeof commonjsGlobal != "undefined" ? commonjsGlobal : commonjsGlobal, function DEF() {
801
+
802
+ var builtInProp,
803
+ cycle,
804
+ scheduling_queue,
805
+ ToString = Object.prototype.toString,
806
+ timer = typeof setImmediate != "undefined" ? function timer(fn) {
807
+ return setImmediate(fn);
808
+ } : setTimeout;
809
+
810
+ // dammit, IE8.
811
+ try {
812
+ Object.defineProperty({}, "x", {});
813
+ builtInProp = function builtInProp(obj, name, val, config) {
814
+ return Object.defineProperty(obj, name, {
815
+ value: val,
816
+ writable: true,
817
+ configurable: config !== false
818
+ });
819
+ };
820
+ } catch (err) {
821
+ builtInProp = function builtInProp(obj, name, val) {
822
+ obj[name] = val;
823
+ return obj;
824
+ };
825
+ }
826
+
827
+ // Note: using a queue instead of array for efficiency
828
+ scheduling_queue = function Queue() {
829
+ var first, last, item;
830
+ function Item(fn, self) {
831
+ this.fn = fn;
832
+ this.self = self;
833
+ this.next = void 0;
834
+ }
835
+ return {
836
+ add: function add(fn, self) {
837
+ item = new Item(fn, self);
838
+ if (last) {
839
+ last.next = item;
840
+ } else {
841
+ first = item;
842
+ }
843
+ last = item;
844
+ item = void 0;
845
+ },
846
+ drain: function drain() {
847
+ var f = first;
848
+ first = last = cycle = void 0;
849
+ while (f) {
850
+ f.fn.call(f.self);
851
+ f = f.next;
852
+ }
853
+ }
854
+ };
855
+ }();
856
+ function schedule(fn, self) {
857
+ scheduling_queue.add(fn, self);
858
+ if (!cycle) {
859
+ cycle = timer(scheduling_queue.drain);
860
+ }
861
+ }
862
+
863
+ // promise duck typing
864
+ function isThenable(o) {
865
+ var _then,
866
+ o_type = typeof o;
867
+ if (o != null && (o_type == "object" || o_type == "function")) {
868
+ _then = o.then;
869
+ }
870
+ return typeof _then == "function" ? _then : false;
871
+ }
872
+ function notify() {
873
+ for (var i = 0; i < this.chain.length; i++) {
874
+ notifyIsolated(this, this.state === 1 ? this.chain[i].success : this.chain[i].failure, this.chain[i]);
875
+ }
876
+ this.chain.length = 0;
877
+ }
878
+
879
+ // NOTE: This is a separate function to isolate
880
+ // the `try..catch` so that other code can be
881
+ // optimized better
882
+ function notifyIsolated(self, cb, chain) {
883
+ var ret, _then;
884
+ try {
885
+ if (cb === false) {
886
+ chain.reject(self.msg);
887
+ } else {
888
+ if (cb === true) {
889
+ ret = self.msg;
890
+ } else {
891
+ ret = cb.call(void 0, self.msg);
892
+ }
893
+ if (ret === chain.promise) {
894
+ chain.reject(TypeError("Promise-chain cycle"));
895
+ } else if (_then = isThenable(ret)) {
896
+ _then.call(ret, chain.resolve, chain.reject);
897
+ } else {
898
+ chain.resolve(ret);
899
+ }
900
+ }
901
+ } catch (err) {
902
+ chain.reject(err);
903
+ }
904
+ }
905
+ function resolve(msg) {
906
+ var _then,
907
+ self = this;
908
+
909
+ // already triggered?
910
+ if (self.triggered) {
911
+ return;
912
+ }
913
+ self.triggered = true;
914
+
915
+ // unwrap
916
+ if (self.def) {
917
+ self = self.def;
918
+ }
919
+ try {
920
+ if (_then = isThenable(msg)) {
921
+ schedule(function () {
922
+ var def_wrapper = new MakeDefWrapper(self);
923
+ try {
924
+ _then.call(msg, function $resolve$() {
925
+ resolve.apply(def_wrapper, arguments);
926
+ }, function $reject$() {
927
+ reject.apply(def_wrapper, arguments);
928
+ });
929
+ } catch (err) {
930
+ reject.call(def_wrapper, err);
931
+ }
932
+ });
933
+ } else {
934
+ self.msg = msg;
935
+ self.state = 1;
936
+ if (self.chain.length > 0) {
937
+ schedule(notify, self);
938
+ }
939
+ }
940
+ } catch (err) {
941
+ reject.call(new MakeDefWrapper(self), err);
942
+ }
943
+ }
944
+ function reject(msg) {
945
+ var self = this;
946
+
947
+ // already triggered?
948
+ if (self.triggered) {
949
+ return;
950
+ }
951
+ self.triggered = true;
952
+
953
+ // unwrap
954
+ if (self.def) {
955
+ self = self.def;
956
+ }
957
+ self.msg = msg;
958
+ self.state = 2;
959
+ if (self.chain.length > 0) {
960
+ schedule(notify, self);
961
+ }
962
+ }
963
+ function iteratePromises(Constructor, arr, resolver, rejecter) {
964
+ for (var idx = 0; idx < arr.length; idx++) {
965
+ (function IIFE(idx) {
966
+ Constructor.resolve(arr[idx]).then(function $resolver$(msg) {
967
+ resolver(idx, msg);
968
+ }, rejecter);
969
+ })(idx);
970
+ }
971
+ }
972
+ function MakeDefWrapper(self) {
973
+ this.def = self;
974
+ this.triggered = false;
975
+ }
976
+ function MakeDef(self) {
977
+ this.promise = self;
978
+ this.state = 0;
979
+ this.triggered = false;
980
+ this.chain = [];
981
+ this.msg = void 0;
982
+ }
983
+ function Promise(executor) {
984
+ if (typeof executor != "function") {
985
+ throw TypeError("Not a function");
986
+ }
987
+ if (this.__NPO__ !== 0) {
988
+ throw TypeError("Not a promise");
989
+ }
990
+
991
+ // instance shadowing the inherited "brand"
992
+ // to signal an already "initialized" promise
993
+ this.__NPO__ = 1;
994
+ var def = new MakeDef(this);
995
+ this["then"] = function then(success, failure) {
996
+ var o = {
997
+ success: typeof success == "function" ? success : true,
998
+ failure: typeof failure == "function" ? failure : false
999
+ };
1000
+ // Note: `then(..)` itself can be borrowed to be used against
1001
+ // a different promise constructor for making the chained promise,
1002
+ // by substituting a different `this` binding.
1003
+ o.promise = new this.constructor(function extractChain(resolve, reject) {
1004
+ if (typeof resolve != "function" || typeof reject != "function") {
1005
+ throw TypeError("Not a function");
1006
+ }
1007
+ o.resolve = resolve;
1008
+ o.reject = reject;
1009
+ });
1010
+ def.chain.push(o);
1011
+ if (def.state !== 0) {
1012
+ schedule(notify, def);
1013
+ }
1014
+ return o.promise;
1015
+ };
1016
+ this["catch"] = function $catch$(failure) {
1017
+ return this.then(void 0, failure);
1018
+ };
1019
+ try {
1020
+ executor.call(void 0, function publicResolve(msg) {
1021
+ resolve.call(def, msg);
1022
+ }, function publicReject(msg) {
1023
+ reject.call(def, msg);
1024
+ });
1025
+ } catch (err) {
1026
+ reject.call(def, err);
1027
+ }
1028
+ }
1029
+ var PromisePrototype = builtInProp({}, "constructor", Promise, /*configurable=*/false);
1030
+
1031
+ // Note: Android 4 cannot use `Object.defineProperty(..)` here
1032
+ Promise.prototype = PromisePrototype;
1033
+
1034
+ // built-in "brand" to signal an "uninitialized" promise
1035
+ builtInProp(PromisePrototype, "__NPO__", 0, /*configurable=*/false);
1036
+ builtInProp(Promise, "resolve", function Promise$resolve(msg) {
1037
+ var Constructor = this;
1038
+
1039
+ // spec mandated checks
1040
+ // note: best "isPromise" check that's practical for now
1041
+ if (msg && typeof msg == "object" && msg.__NPO__ === 1) {
1042
+ return msg;
1043
+ }
1044
+ return new Constructor(function executor(resolve, reject) {
1045
+ if (typeof resolve != "function" || typeof reject != "function") {
1046
+ throw TypeError("Not a function");
1047
+ }
1048
+ resolve(msg);
1049
+ });
1050
+ });
1051
+ builtInProp(Promise, "reject", function Promise$reject(msg) {
1052
+ return new this(function executor(resolve, reject) {
1053
+ if (typeof resolve != "function" || typeof reject != "function") {
1054
+ throw TypeError("Not a function");
1055
+ }
1056
+ reject(msg);
1057
+ });
1058
+ });
1059
+ builtInProp(Promise, "all", function Promise$all(arr) {
1060
+ var Constructor = this;
1061
+
1062
+ // spec mandated checks
1063
+ if (ToString.call(arr) != "[object Array]") {
1064
+ return Constructor.reject(TypeError("Not an array"));
1065
+ }
1066
+ if (arr.length === 0) {
1067
+ return Constructor.resolve([]);
1068
+ }
1069
+ return new Constructor(function executor(resolve, reject) {
1070
+ if (typeof resolve != "function" || typeof reject != "function") {
1071
+ throw TypeError("Not a function");
1072
+ }
1073
+ var len = arr.length,
1074
+ msgs = Array(len),
1075
+ count = 0;
1076
+ iteratePromises(Constructor, arr, function resolver(idx, msg) {
1077
+ msgs[idx] = msg;
1078
+ if (++count === len) {
1079
+ resolve(msgs);
1080
+ }
1081
+ }, reject);
1082
+ });
1083
+ });
1084
+ builtInProp(Promise, "race", function Promise$race(arr) {
1085
+ var Constructor = this;
1086
+
1087
+ // spec mandated checks
1088
+ if (ToString.call(arr) != "[object Array]") {
1089
+ return Constructor.reject(TypeError("Not an array"));
1090
+ }
1091
+ return new Constructor(function executor(resolve, reject) {
1092
+ if (typeof resolve != "function" || typeof reject != "function") {
1093
+ throw TypeError("Not a function");
1094
+ }
1095
+ iteratePromises(Constructor, arr, function resolver(idx, msg) {
1096
+ resolve(msg);
1097
+ }, reject);
1098
+ });
1099
+ });
1100
+ return Promise;
1101
+ });
1102
+ });
1103
+
1104
+ /**
1105
+ * @module lib/callbacks
1106
+ */
1107
+
1108
+ var callbackMap = new WeakMap();
1109
+
1110
+ /**
1111
+ * Store a callback for a method or event for a player.
1112
+ *
1113
+ * @param {Player} player The player object.
1114
+ * @param {string} name The method or event name.
1115
+ * @param {(function(this:Player, *): void|{resolve: function, reject: function})} callback
1116
+ * The callback to call or an object with resolve and reject functions for a promise.
1117
+ * @return {void}
1118
+ */
1119
+ function storeCallback(player, name, callback) {
1120
+ var playerCallbacks = callbackMap.get(player.element) || {};
1121
+ if (!(name in playerCallbacks)) {
1122
+ playerCallbacks[name] = [];
1123
+ }
1124
+ playerCallbacks[name].push(callback);
1125
+ callbackMap.set(player.element, playerCallbacks);
1126
+ }
1127
+
1128
+ /**
1129
+ * Get the callbacks for a player and event or method.
1130
+ *
1131
+ * @param {Player} player The player object.
1132
+ * @param {string} name The method or event name
1133
+ * @return {function[]}
1134
+ */
1135
+ function getCallbacks(player, name) {
1136
+ var playerCallbacks = callbackMap.get(player.element) || {};
1137
+ return playerCallbacks[name] || [];
1138
+ }
1139
+
1140
+ /**
1141
+ * Remove a stored callback for a method or event for a player.
1142
+ *
1143
+ * @param {Player} player The player object.
1144
+ * @param {string} name The method or event name
1145
+ * @param {function} [callback] The specific callback to remove.
1146
+ * @return {boolean} Was this the last callback?
1147
+ */
1148
+ function removeCallback(player, name, callback) {
1149
+ var playerCallbacks = callbackMap.get(player.element) || {};
1150
+ if (!playerCallbacks[name]) {
1151
+ return true;
1152
+ }
1153
+
1154
+ // If no callback is passed, remove all callbacks for the event
1155
+ if (!callback) {
1156
+ playerCallbacks[name] = [];
1157
+ callbackMap.set(player.element, playerCallbacks);
1158
+ return true;
1159
+ }
1160
+ var index = playerCallbacks[name].indexOf(callback);
1161
+ if (index !== -1) {
1162
+ playerCallbacks[name].splice(index, 1);
1163
+ }
1164
+ callbackMap.set(player.element, playerCallbacks);
1165
+ return playerCallbacks[name] && playerCallbacks[name].length === 0;
1166
+ }
1167
+
1168
+ /**
1169
+ * Return the first stored callback for a player and event or method.
1170
+ *
1171
+ * @param {Player} player The player object.
1172
+ * @param {string} name The method or event name.
1173
+ * @return {function} The callback, or false if there were none
1174
+ */
1175
+ function shiftCallbacks(player, name) {
1176
+ var playerCallbacks = getCallbacks(player, name);
1177
+ if (playerCallbacks.length < 1) {
1178
+ return false;
1179
+ }
1180
+ var callback = playerCallbacks.shift();
1181
+ removeCallback(player, name, callback);
1182
+ return callback;
1183
+ }
1184
+
1185
+ /**
1186
+ * Move callbacks associated with an element to another element.
1187
+ *
1188
+ * @param {HTMLElement} oldElement The old element.
1189
+ * @param {HTMLElement} newElement The new element.
1190
+ * @return {void}
1191
+ */
1192
+ function swapCallbacks(oldElement, newElement) {
1193
+ var playerCallbacks = callbackMap.get(oldElement);
1194
+ callbackMap.set(newElement, playerCallbacks);
1195
+ callbackMap.delete(oldElement);
1196
+ }
1197
+
1198
+ /**
1199
+ * @module lib/postmessage
1200
+ */
1201
+
1202
+ /**
1203
+ * Parse a message received from postMessage.
1204
+ *
1205
+ * @param {*} data The data received from postMessage.
1206
+ * @return {object}
1207
+ */
1208
+ function parseMessageData(data) {
1209
+ if (typeof data === 'string') {
1210
+ try {
1211
+ data = JSON.parse(data);
1212
+ } catch (error) {
1213
+ // If the message cannot be parsed, throw the error as a warning
1214
+ console.warn(error);
1215
+ return {};
1216
+ }
1217
+ }
1218
+ return data;
1219
+ }
1220
+
1221
+ /**
1222
+ * Post a message to the specified target.
1223
+ *
1224
+ * @param {Player} player The player object to use.
1225
+ * @param {string} method The API method to call.
1226
+ * @param {string|number|object|Array|undefined} params The parameters to send to the player.
1227
+ * @return {void}
1228
+ */
1229
+ function postMessage(player, method, params) {
1230
+ if (!player.element.contentWindow || !player.element.contentWindow.postMessage) {
1231
+ return;
1232
+ }
1233
+ var message = {
1234
+ method: method
1235
+ };
1236
+ if (params !== undefined) {
1237
+ message.value = params;
1238
+ }
1239
+
1240
+ // IE 8 and 9 do not support passing messages, so stringify them
1241
+ var ieVersion = parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/, '$1'));
1242
+ if (ieVersion >= 8 && ieVersion < 10) {
1243
+ message = JSON.stringify(message);
1244
+ }
1245
+ player.element.contentWindow.postMessage(message, player.origin);
1246
+ }
1247
+
1248
+ /**
1249
+ * Parse the data received from a message event.
1250
+ *
1251
+ * @param {Player} player The player that received the message.
1252
+ * @param {(Object|string)} data The message data. Strings will be parsed into JSON.
1253
+ * @return {void}
1254
+ */
1255
+ function processData(player, data) {
1256
+ data = parseMessageData(data);
1257
+ var callbacks = [];
1258
+ var param;
1259
+ if (data.event) {
1260
+ if (data.event === 'error') {
1261
+ var promises = getCallbacks(player, data.data.method);
1262
+ promises.forEach(function (promise) {
1263
+ var error = new Error(data.data.message);
1264
+ error.name = data.data.name;
1265
+ promise.reject(error);
1266
+ removeCallback(player, data.data.method, promise);
1267
+ });
1268
+ }
1269
+ callbacks = getCallbacks(player, "event:".concat(data.event));
1270
+ param = data.data;
1271
+ } else if (data.method) {
1272
+ var callback = shiftCallbacks(player, data.method);
1273
+ if (callback) {
1274
+ callbacks.push(callback);
1275
+ param = data.value;
1276
+ }
1277
+ }
1278
+ callbacks.forEach(function (callback) {
1279
+ try {
1280
+ if (typeof callback === 'function') {
1281
+ callback.call(player, param);
1282
+ return;
1283
+ }
1284
+ callback.resolve(param);
1285
+ } catch (e) {
1286
+ // empty
1287
+ }
1288
+ });
1289
+ }
1290
+
1291
+ /**
1292
+ * @module lib/embed
1293
+ */
1294
+ var oEmbedParameters = ['airplay', 'audio_tracks', 'audiotrack', 'autopause', 'autoplay', 'background', 'byline', 'cc', 'chapter_id', 'chapters', 'chromecast', 'color', 'colors', 'controls', 'dnt', 'end_time', 'fullscreen', 'height', 'id', 'initial_quality', 'interactive_params', 'keyboard', 'loop', 'maxheight', 'max_quality', 'maxwidth', 'min_quality', 'muted', 'play_button_position', 'playsinline', 'portrait', 'preload', 'progress_bar', 'quality', 'quality_selector', 'responsive', 'skipping_forward', 'speed', 'start_time', 'texttrack', 'thumbnail_id', 'title', 'transcript', 'transparent', 'unmute_button', 'url', 'vimeo_logo', 'volume', 'watch_full_video', 'width'];
1295
+
1296
+ /**
1297
+ * Get the 'data-vimeo'-prefixed attributes from an element as an object.
1298
+ *
1299
+ * @param {HTMLElement} element The element.
1300
+ * @param {Object} [defaults={}] The default values to use.
1301
+ * @return {Object<string, string>}
1302
+ */
1303
+ function getOEmbedParameters(element) {
1304
+ var defaults = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1305
+ return oEmbedParameters.reduce(function (params, param) {
1306
+ var value = element.getAttribute("data-vimeo-".concat(param));
1307
+ if (value || value === '') {
1308
+ params[param] = value === '' ? 1 : value;
1309
+ }
1310
+ return params;
1311
+ }, defaults);
1312
+ }
1313
+
1314
+ /**
1315
+ * Create an embed from oEmbed data inside an element.
1316
+ *
1317
+ * @param {object} data The oEmbed data.
1318
+ * @param {HTMLElement} element The element to put the iframe in.
1319
+ * @return {HTMLIFrameElement} The iframe embed.
1320
+ */
1321
+ function createEmbed(_ref, element) {
1322
+ var html = _ref.html;
1323
+ if (!element) {
1324
+ throw new TypeError('An element must be provided');
1325
+ }
1326
+ if (element.getAttribute('data-vimeo-initialized') !== null) {
1327
+ return element.querySelector('iframe');
1328
+ }
1329
+ var div = document.createElement('div');
1330
+ div.innerHTML = html;
1331
+ element.appendChild(div.firstChild);
1332
+ element.setAttribute('data-vimeo-initialized', 'true');
1333
+ return element.querySelector('iframe');
1334
+ }
1335
+
1336
+ /**
1337
+ * Make an oEmbed call for the specified URL.
1338
+ *
1339
+ * @param {string} videoUrl The vimeo.com url for the video.
1340
+ * @param {Object} [params] Parameters to pass to oEmbed.
1341
+ * @param {HTMLElement} element The element.
1342
+ * @return {Promise}
1343
+ */
1344
+ function getOEmbedData(videoUrl) {
1345
+ var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1346
+ var element = arguments.length > 2 ? arguments[2] : undefined;
1347
+ return new Promise(function (resolve, reject) {
1348
+ if (!isVimeoUrl(videoUrl)) {
1349
+ throw new TypeError("\u201C".concat(videoUrl, "\u201D is not a vimeo.com url."));
1350
+ }
1351
+ var domain = getOembedDomain(videoUrl);
1352
+ var url = "https://".concat(domain, "/api/oembed.json?url=").concat(encodeURIComponent(videoUrl));
1353
+ for (var param in params) {
1354
+ if (params.hasOwnProperty(param)) {
1355
+ url += "&".concat(param, "=").concat(encodeURIComponent(params[param]));
1356
+ }
1357
+ }
1358
+ var xhr = 'XDomainRequest' in window ? new XDomainRequest() : new XMLHttpRequest();
1359
+ xhr.open('GET', url, true);
1360
+ xhr.onload = function () {
1361
+ if (xhr.status === 404) {
1362
+ reject(new Error("\u201C".concat(videoUrl, "\u201D was not found.")));
1363
+ return;
1364
+ }
1365
+ if (xhr.status === 403) {
1366
+ reject(new Error("\u201C".concat(videoUrl, "\u201D is not embeddable.")));
1367
+ return;
1368
+ }
1369
+ try {
1370
+ var json = JSON.parse(xhr.responseText);
1371
+ // Check api response for 403 on oembed
1372
+ if (json.domain_status_code === 403) {
1373
+ // We still want to create the embed to give users visual feedback
1374
+ createEmbed(json, element);
1375
+ reject(new Error("\u201C".concat(videoUrl, "\u201D is not embeddable.")));
1376
+ return;
1377
+ }
1378
+ resolve(json);
1379
+ } catch (error) {
1380
+ reject(error);
1381
+ }
1382
+ };
1383
+ xhr.onerror = function () {
1384
+ var status = xhr.status ? " (".concat(xhr.status, ")") : '';
1385
+ reject(new Error("There was an error fetching the embed code from Vimeo".concat(status, ".")));
1386
+ };
1387
+ xhr.send();
1388
+ });
1389
+ }
1390
+
1391
+ /**
1392
+ * Initialize all embeds within a specific element
1393
+ *
1394
+ * @param {HTMLElement} [parent=document] The parent element.
1395
+ * @return {void}
1396
+ */
1397
+ function initializeEmbeds() {
1398
+ var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
1399
+ var elements = [].slice.call(parent.querySelectorAll('[data-vimeo-id], [data-vimeo-url]'));
1400
+ var handleError = function handleError(error) {
1401
+ if ('console' in window && console.error) {
1402
+ console.error("There was an error creating an embed: ".concat(error));
1403
+ }
1404
+ };
1405
+ elements.forEach(function (element) {
1406
+ try {
1407
+ // Skip any that have data-vimeo-defer
1408
+ if (element.getAttribute('data-vimeo-defer') !== null) {
1409
+ return;
1410
+ }
1411
+ var params = getOEmbedParameters(element);
1412
+ var url = getVimeoUrl(params);
1413
+ getOEmbedData(url, params, element).then(function (data) {
1414
+ return createEmbed(data, element);
1415
+ }).catch(handleError);
1416
+ } catch (error) {
1417
+ handleError(error);
1418
+ }
1419
+ });
1420
+ }
1421
+
1422
+ /**
1423
+ * Resize embeds when messaged by the player.
1424
+ *
1425
+ * @param {HTMLElement} [parent=document] The parent element.
1426
+ * @return {void}
1427
+ */
1428
+ function resizeEmbeds() {
1429
+ var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
1430
+ // Prevent execution if users include the player.js script multiple times.
1431
+ if (window.VimeoPlayerResizeEmbeds_) {
1432
+ return;
1433
+ }
1434
+ window.VimeoPlayerResizeEmbeds_ = true;
1435
+ var onMessage = function onMessage(event) {
1436
+ if (!isVimeoUrl(event.origin)) {
1437
+ return;
1438
+ }
1439
+
1440
+ // 'spacechange' is fired only on embeds with cards
1441
+ if (!event.data || event.data.event !== 'spacechange') {
1442
+ return;
1443
+ }
1444
+ var iframes = parent.querySelectorAll('iframe');
1445
+ for (var i = 0; i < iframes.length; i++) {
1446
+ if (iframes[i].contentWindow !== event.source) {
1447
+ continue;
1448
+ }
1449
+
1450
+ // Change padding-bottom of the enclosing div to accommodate
1451
+ // card carousel without distorting aspect ratio
1452
+ var space = iframes[i].parentElement;
1453
+ space.style.paddingBottom = "".concat(event.data.data[0].bottom, "px");
1454
+ break;
1455
+ }
1456
+ };
1457
+ window.addEventListener('message', onMessage);
1458
+ }
1459
+
1460
+ /**
1461
+ * Add chapters to existing metadata for Google SEO
1462
+ *
1463
+ * @param {HTMLElement} [parent=document] The parent element.
1464
+ * @return {void}
1465
+ */
1466
+ function initAppendVideoMetadata() {
1467
+ var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
1468
+ // Prevent execution if users include the player.js script multiple times.
1469
+ if (window.VimeoSeoMetadataAppended) {
1470
+ return;
1471
+ }
1472
+ window.VimeoSeoMetadataAppended = true;
1473
+ var onMessage = function onMessage(event) {
1474
+ if (!isVimeoUrl(event.origin)) {
1475
+ return;
1476
+ }
1477
+ var data = parseMessageData(event.data);
1478
+ if (!data || data.event !== 'ready') {
1479
+ return;
1480
+ }
1481
+ var iframes = parent.querySelectorAll('iframe');
1482
+ for (var i = 0; i < iframes.length; i++) {
1483
+ var iframe = iframes[i];
1484
+
1485
+ // Initiate appendVideoMetadata if iframe is a Vimeo embed
1486
+ var isValidMessageSource = iframe.contentWindow === event.source;
1487
+ if (isVimeoEmbed(iframe.src) && isValidMessageSource) {
1488
+ var player = new Player(iframe);
1489
+ player.callMethod('appendVideoMetadata', window.location.href);
1490
+ }
1491
+ }
1492
+ };
1493
+ window.addEventListener('message', onMessage);
1494
+ }
1495
+
1496
+ /**
1497
+ * Seek to time indicated by vimeo_t query parameter if present in URL
1498
+ *
1499
+ * @param {HTMLElement} [parent=document] The parent element.
1500
+ * @return {void}
1501
+ */
1502
+ function checkUrlTimeParam() {
1503
+ var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
1504
+ // Prevent execution if users include the player.js script multiple times.
1505
+ if (window.VimeoCheckedUrlTimeParam) {
1506
+ return;
1507
+ }
1508
+ window.VimeoCheckedUrlTimeParam = true;
1509
+ var handleError = function handleError(error) {
1510
+ if ('console' in window && console.error) {
1511
+ console.error("There was an error getting video Id: ".concat(error));
1512
+ }
1513
+ };
1514
+ var onMessage = function onMessage(event) {
1515
+ if (!isVimeoUrl(event.origin)) {
1516
+ return;
1517
+ }
1518
+ var data = parseMessageData(event.data);
1519
+ if (!data || data.event !== 'ready') {
1520
+ return;
1521
+ }
1522
+ var iframes = parent.querySelectorAll('iframe');
1523
+ var _loop = function _loop() {
1524
+ var iframe = iframes[i];
1525
+ var isValidMessageSource = iframe.contentWindow === event.source;
1526
+ if (isVimeoEmbed(iframe.src) && isValidMessageSource) {
1527
+ var player = new Player(iframe);
1528
+ player.getVideoId().then(function (videoId) {
1529
+ var matches = new RegExp("[?&]vimeo_t_".concat(videoId, "=([^&#]*)")).exec(window.location.href);
1530
+ if (matches && matches[1]) {
1531
+ var sec = decodeURI(matches[1]);
1532
+ player.setCurrentTime(sec);
1533
+ }
1534
+ return;
1535
+ }).catch(handleError);
1536
+ }
1537
+ };
1538
+ for (var i = 0; i < iframes.length; i++) {
1539
+ _loop();
1540
+ }
1541
+ };
1542
+ window.addEventListener('message', onMessage);
1543
+ }
1544
+
1545
+ /* MIT License
1546
+
1547
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
1548
+
1549
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1550
+
1551
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1552
+
1553
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1554
+ Terms */
1555
+
1556
+ function initializeScreenfull() {
1557
+ var fn = function () {
1558
+ var val;
1559
+ var fnMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'],
1560
+ // New WebKit
1561
+ ['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror'],
1562
+ // Old WebKit
1563
+ ['webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror'], ['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'], ['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']];
1564
+ var i = 0;
1565
+ var l = fnMap.length;
1566
+ var ret = {};
1567
+ for (; i < l; i++) {
1568
+ val = fnMap[i];
1569
+ if (val && val[1] in document) {
1570
+ for (i = 0; i < val.length; i++) {
1571
+ ret[fnMap[0][i]] = val[i];
1572
+ }
1573
+ return ret;
1574
+ }
1575
+ }
1576
+ return false;
1577
+ }();
1578
+ var eventNameMap = {
1579
+ fullscreenchange: fn.fullscreenchange,
1580
+ fullscreenerror: fn.fullscreenerror
1581
+ };
1582
+ var screenfull = {
1583
+ request: function request(element) {
1584
+ return new Promise(function (resolve, reject) {
1585
+ var onFullScreenEntered = function onFullScreenEntered() {
1586
+ screenfull.off('fullscreenchange', onFullScreenEntered);
1587
+ resolve();
1588
+ };
1589
+ screenfull.on('fullscreenchange', onFullScreenEntered);
1590
+ element = element || document.documentElement;
1591
+ var returnPromise = element[fn.requestFullscreen]();
1592
+ if (returnPromise instanceof Promise) {
1593
+ returnPromise.then(onFullScreenEntered).catch(reject);
1594
+ }
1595
+ });
1596
+ },
1597
+ exit: function exit() {
1598
+ return new Promise(function (resolve, reject) {
1599
+ if (!screenfull.isFullscreen) {
1600
+ resolve();
1601
+ return;
1602
+ }
1603
+ var onFullScreenExit = function onFullScreenExit() {
1604
+ screenfull.off('fullscreenchange', onFullScreenExit);
1605
+ resolve();
1606
+ };
1607
+ screenfull.on('fullscreenchange', onFullScreenExit);
1608
+ var returnPromise = document[fn.exitFullscreen]();
1609
+ if (returnPromise instanceof Promise) {
1610
+ returnPromise.then(onFullScreenExit).catch(reject);
1611
+ }
1612
+ });
1613
+ },
1614
+ on: function on(event, callback) {
1615
+ var eventName = eventNameMap[event];
1616
+ if (eventName) {
1617
+ document.addEventListener(eventName, callback);
1618
+ }
1619
+ },
1620
+ off: function off(event, callback) {
1621
+ var eventName = eventNameMap[event];
1622
+ if (eventName) {
1623
+ document.removeEventListener(eventName, callback);
1624
+ }
1625
+ }
1626
+ };
1627
+ Object.defineProperties(screenfull, {
1628
+ isFullscreen: {
1629
+ get: function get() {
1630
+ return Boolean(document[fn.fullscreenElement]);
1631
+ }
1632
+ },
1633
+ element: {
1634
+ enumerable: true,
1635
+ get: function get() {
1636
+ return document[fn.fullscreenElement];
1637
+ }
1638
+ },
1639
+ isEnabled: {
1640
+ enumerable: true,
1641
+ get: function get() {
1642
+ // Coerce to boolean in case of old WebKit
1643
+ return Boolean(document[fn.fullscreenEnabled]);
1644
+ }
1645
+ }
1646
+ });
1647
+ return screenfull;
1648
+ }
1649
+
1650
+ /** @typedef {import('./timing-src-connector.types').PlayerControls} PlayerControls */
1651
+ /** @typedef {import('./timing-object.types').TimingObject} TimingObject */
1652
+ /** @typedef {import('./timing-src-connector.types').TimingSrcConnectorOptions} TimingSrcConnectorOptions */
1653
+ /** @typedef {(msg: string) => any} Logger */
1654
+ /** @typedef {import('timing-object.types').TConnectionState} TConnectionState */
1655
+
1656
+ /**
1657
+ * @type {TimingSrcConnectorOptions}
1658
+ *
1659
+ * For details on these properties and their effects, see the typescript definition referenced above.
1660
+ */
1661
+ var defaultOptions = {
1662
+ role: 'viewer',
1663
+ autoPlayMuted: true,
1664
+ allowedDrift: 0.3,
1665
+ maxAllowedDrift: 1,
1666
+ minCheckInterval: 0.1,
1667
+ maxRateAdjustment: 0.2,
1668
+ maxTimeToCatchUp: 1
1669
+ };
1670
+
1671
+ /**
1672
+ * There's a proposed W3C spec for the Timing Object which would introduce a new set of APIs that would simplify time-synchronization tasks for browser applications.
1673
+ *
1674
+ * Proposed spec: https://webtiming.github.io/timingobject/
1675
+ * V3 Spec: https://timingsrc.readthedocs.io/en/latest/
1676
+ * Demuxed talk: https://www.youtube.com/watch?v=cZSjDaGDmX8
1677
+ *
1678
+ * This class makes it easy to connect Vimeo.Player to a provided TimingObject via Vimeo.Player.setTimingSrc(myTimingObject, options) and the synchronization will be handled automatically.
1679
+ *
1680
+ * There are 5 general responsibilities in TimingSrcConnector:
1681
+ *
1682
+ * 1. `updatePlayer()` which sets the player's currentTime, playbackRate and pause/play state based on current state of the TimingObject.
1683
+ * 2. `updateTimingObject()` which sets the TimingObject's position and velocity from the player's state.
1684
+ * 3. `playerUpdater` which listens for change events on the TimingObject and will respond by calling updatePlayer.
1685
+ * 4. `timingObjectUpdater` which listens to the player events of seeked, play and pause and will respond by calling `updateTimingObject()`.
1686
+ * 5. `maintainPlaybackPosition` this is code that constantly monitors the player to make sure it's always in sync with the TimingObject. This is needed because videos will generally not play with precise time accuracy and there will be some drift which becomes more noticeable over longer periods (as noted in the timing-object spec). More details on this method below.
1687
+ */
1688
+ var TimingSrcConnector = /*#__PURE__*/function (_EventTarget) {
1689
+ _inherits(TimingSrcConnector, _EventTarget);
1690
+ var _super = _createSuper(TimingSrcConnector);
1691
+ /**
1692
+ * @param {PlayerControls} player
1693
+ * @param {TimingObject} timingObject
1694
+ * @param {TimingSrcConnectorOptions} options
1695
+ * @param {Logger} logger
1696
+ */
1697
+ function TimingSrcConnector(_player, timingObject) {
1698
+ var _this;
1699
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1700
+ var logger = arguments.length > 3 ? arguments[3] : undefined;
1701
+ _classCallCheck(this, TimingSrcConnector);
1702
+ _this = _super.call(this);
1703
+ _defineProperty(_assertThisInitialized(_this), "logger", void 0);
1704
+ _defineProperty(_assertThisInitialized(_this), "speedAdjustment", 0);
1705
+ /**
1706
+ * @param {PlayerControls} player
1707
+ * @param {number} newAdjustment
1708
+ * @return {Promise<void>}
1709
+ */
1710
+ _defineProperty(_assertThisInitialized(_this), "adjustSpeed", /*#__PURE__*/function () {
1711
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(player, newAdjustment) {
1712
+ var newPlaybackRate;
1713
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1714
+ while (1) switch (_context.prev = _context.next) {
1715
+ case 0:
1716
+ if (!(_this.speedAdjustment === newAdjustment)) {
1717
+ _context.next = 2;
1718
+ break;
1719
+ }
1720
+ return _context.abrupt("return");
1721
+ case 2:
1722
+ _context.next = 4;
1723
+ return player.getPlaybackRate();
1724
+ case 4:
1725
+ _context.t0 = _context.sent;
1726
+ _context.t1 = _this.speedAdjustment;
1727
+ _context.t2 = _context.t0 - _context.t1;
1728
+ _context.t3 = newAdjustment;
1729
+ newPlaybackRate = _context.t2 + _context.t3;
1730
+ _this.log("New playbackRate: ".concat(newPlaybackRate));
1731
+ _context.next = 12;
1732
+ return player.setPlaybackRate(newPlaybackRate);
1733
+ case 12:
1734
+ _this.speedAdjustment = newAdjustment;
1735
+ case 13:
1736
+ case "end":
1737
+ return _context.stop();
1738
+ }
1739
+ }, _callee);
1740
+ }));
1741
+ return function (_x, _x2) {
1742
+ return _ref.apply(this, arguments);
1743
+ };
1744
+ }());
1745
+ _this.logger = logger;
1746
+ _this.init(timingObject, _player, _objectSpread2(_objectSpread2({}, defaultOptions), options));
1747
+ return _this;
1748
+ }
1749
+ _createClass(TimingSrcConnector, [{
1750
+ key: "disconnect",
1751
+ value: function disconnect() {
1752
+ this.dispatchEvent(new Event('disconnect'));
1753
+ }
1754
+
1755
+ /**
1756
+ * @param {TimingObject} timingObject
1757
+ * @param {PlayerControls} player
1758
+ * @param {TimingSrcConnectorOptions} options
1759
+ * @return {Promise<void>}
1760
+ */
1761
+ }, {
1762
+ key: "init",
1763
+ value: function () {
1764
+ var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(timingObject, player, options) {
1765
+ var _this2 = this;
1766
+ var playerUpdater, positionSync, timingObjectUpdater;
1767
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1768
+ while (1) switch (_context2.prev = _context2.next) {
1769
+ case 0:
1770
+ _context2.next = 2;
1771
+ return this.waitForTOReadyState(timingObject, 'open');
1772
+ case 2:
1773
+ if (!(options.role === 'viewer')) {
1774
+ _context2.next = 10;
1775
+ break;
1776
+ }
1777
+ _context2.next = 5;
1778
+ return this.updatePlayer(timingObject, player, options);
1779
+ case 5:
1780
+ playerUpdater = subscribe(timingObject, 'change', function () {
1781
+ return _this2.updatePlayer(timingObject, player, options);
1782
+ });
1783
+ positionSync = this.maintainPlaybackPosition(timingObject, player, options);
1784
+ this.addEventListener('disconnect', function () {
1785
+ positionSync.cancel();
1786
+ playerUpdater.cancel();
1787
+ });
1788
+ _context2.next = 14;
1789
+ break;
1790
+ case 10:
1791
+ _context2.next = 12;
1792
+ return this.updateTimingObject(timingObject, player);
1793
+ case 12:
1794
+ timingObjectUpdater = subscribe(player, ['seeked', 'play', 'pause', 'ratechange'], function () {
1795
+ return _this2.updateTimingObject(timingObject, player);
1796
+ }, 'on', 'off');
1797
+ this.addEventListener('disconnect', function () {
1798
+ return timingObjectUpdater.cancel();
1799
+ });
1800
+ case 14:
1801
+ case "end":
1802
+ return _context2.stop();
1803
+ }
1804
+ }, _callee2, this);
1805
+ }));
1806
+ function init(_x3, _x4, _x5) {
1807
+ return _init.apply(this, arguments);
1808
+ }
1809
+ return init;
1810
+ }()
1811
+ /**
1812
+ * Sets the TimingObject's state to reflect that of the player
1813
+ *
1814
+ * @param {TimingObject} timingObject
1815
+ * @param {PlayerControls} player
1816
+ * @return {Promise<void>}
1817
+ */
1818
+ }, {
1819
+ key: "updateTimingObject",
1820
+ value: function () {
1821
+ var _updateTimingObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(timingObject, player) {
1822
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1823
+ while (1) switch (_context3.prev = _context3.next) {
1824
+ case 0:
1825
+ _context3.t0 = timingObject;
1826
+ _context3.next = 3;
1827
+ return player.getCurrentTime();
1828
+ case 3:
1829
+ _context3.t1 = _context3.sent;
1830
+ _context3.next = 6;
1831
+ return player.getPaused();
1832
+ case 6:
1833
+ if (!_context3.sent) {
1834
+ _context3.next = 10;
1835
+ break;
1836
+ }
1837
+ _context3.t2 = 0;
1838
+ _context3.next = 13;
1839
+ break;
1840
+ case 10:
1841
+ _context3.next = 12;
1842
+ return player.getPlaybackRate();
1843
+ case 12:
1844
+ _context3.t2 = _context3.sent;
1845
+ case 13:
1846
+ _context3.t3 = _context3.t2;
1847
+ _context3.t4 = {
1848
+ position: _context3.t1,
1849
+ velocity: _context3.t3
1850
+ };
1851
+ _context3.t0.update.call(_context3.t0, _context3.t4);
1852
+ case 16:
1853
+ case "end":
1854
+ return _context3.stop();
1855
+ }
1856
+ }, _callee3);
1857
+ }));
1858
+ function updateTimingObject(_x6, _x7) {
1859
+ return _updateTimingObject.apply(this, arguments);
1860
+ }
1861
+ return updateTimingObject;
1862
+ }()
1863
+ /**
1864
+ * Sets the player's timing state to reflect that of the TimingObject
1865
+ *
1866
+ * @param {TimingObject} timingObject
1867
+ * @param {PlayerControls} player
1868
+ * @param {TimingSrcConnectorOptions} options
1869
+ * @return {Promise<void>}
1870
+ */
1871
+ }, {
1872
+ key: "updatePlayer",
1873
+ value: function () {
1874
+ var _updatePlayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(timingObject, player, options) {
1875
+ var _timingObject$query, position, velocity;
1876
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1877
+ while (1) switch (_context5.prev = _context5.next) {
1878
+ case 0:
1879
+ _timingObject$query = timingObject.query(), position = _timingObject$query.position, velocity = _timingObject$query.velocity;
1880
+ if (typeof position === 'number') {
1881
+ player.setCurrentTime(position);
1882
+ }
1883
+ if (!(typeof velocity === 'number')) {
1884
+ _context5.next = 25;
1885
+ break;
1886
+ }
1887
+ if (!(velocity === 0)) {
1888
+ _context5.next = 11;
1889
+ break;
1890
+ }
1891
+ _context5.next = 6;
1892
+ return player.getPaused();
1893
+ case 6:
1894
+ _context5.t0 = _context5.sent;
1895
+ if (!(_context5.t0 === false)) {
1896
+ _context5.next = 9;
1897
+ break;
1898
+ }
1899
+ player.pause();
1900
+ case 9:
1901
+ _context5.next = 25;
1902
+ break;
1903
+ case 11:
1904
+ if (!(velocity > 0)) {
1905
+ _context5.next = 25;
1906
+ break;
1907
+ }
1908
+ _context5.next = 14;
1909
+ return player.getPaused();
1910
+ case 14:
1911
+ _context5.t1 = _context5.sent;
1912
+ if (!(_context5.t1 === true)) {
1913
+ _context5.next = 19;
1914
+ break;
1915
+ }
1916
+ _context5.next = 18;
1917
+ return player.play().catch( /*#__PURE__*/function () {
1918
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err) {
1919
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1920
+ while (1) switch (_context4.prev = _context4.next) {
1921
+ case 0:
1922
+ if (!(err.name === 'NotAllowedError' && options.autoPlayMuted)) {
1923
+ _context4.next = 5;
1924
+ break;
1925
+ }
1926
+ _context4.next = 3;
1927
+ return player.setMuted(true);
1928
+ case 3:
1929
+ _context4.next = 5;
1930
+ return player.play().catch(function (err2) {
1931
+ return console.error('Couldn\'t play the video from TimingSrcConnector. Error:', err2);
1932
+ });
1933
+ case 5:
1934
+ case "end":
1935
+ return _context4.stop();
1936
+ }
1937
+ }, _callee4);
1938
+ }));
1939
+ return function (_x11) {
1940
+ return _ref2.apply(this, arguments);
1941
+ };
1942
+ }());
1943
+ case 18:
1944
+ this.updatePlayer(timingObject, player, options);
1945
+ case 19:
1946
+ _context5.next = 21;
1947
+ return player.getPlaybackRate();
1948
+ case 21:
1949
+ _context5.t2 = _context5.sent;
1950
+ _context5.t3 = velocity;
1951
+ if (!(_context5.t2 !== _context5.t3)) {
1952
+ _context5.next = 25;
1953
+ break;
1954
+ }
1955
+ player.setPlaybackRate(velocity);
1956
+ case 25:
1957
+ case "end":
1958
+ return _context5.stop();
1959
+ }
1960
+ }, _callee5, this);
1961
+ }));
1962
+ function updatePlayer(_x8, _x9, _x10) {
1963
+ return _updatePlayer.apply(this, arguments);
1964
+ }
1965
+ return updatePlayer;
1966
+ }()
1967
+ /**
1968
+ * Since video players do not play with 100% time precision, we need to closely monitor
1969
+ * our player to be sure it remains in sync with the TimingObject.
1970
+ *
1971
+ * If out of sync, we use the current conditions and the options provided to determine
1972
+ * whether to re-sync via setting currentTime or adjusting the playbackRate
1973
+ *
1974
+ * @param {TimingObject} timingObject
1975
+ * @param {PlayerControls} player
1976
+ * @param {TimingSrcConnectorOptions} options
1977
+ * @return {{cancel: (function(): void)}}
1978
+ */
1979
+ }, {
1980
+ key: "maintainPlaybackPosition",
1981
+ value: function maintainPlaybackPosition(timingObject, player, options) {
1982
+ var _this3 = this;
1983
+ var allowedDrift = options.allowedDrift,
1984
+ maxAllowedDrift = options.maxAllowedDrift,
1985
+ minCheckInterval = options.minCheckInterval,
1986
+ maxRateAdjustment = options.maxRateAdjustment,
1987
+ maxTimeToCatchUp = options.maxTimeToCatchUp;
1988
+ var syncInterval = Math.min(maxTimeToCatchUp, Math.max(minCheckInterval, maxAllowedDrift)) * 1000;
1989
+ var check = /*#__PURE__*/function () {
1990
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
1991
+ var diff, diffAbs, min, max, adjustment;
1992
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1993
+ while (1) switch (_context6.prev = _context6.next) {
1994
+ case 0:
1995
+ _context6.t0 = timingObject.query().velocity === 0;
1996
+ if (_context6.t0) {
1997
+ _context6.next = 6;
1998
+ break;
1999
+ }
2000
+ _context6.next = 4;
2001
+ return player.getPaused();
2002
+ case 4:
2003
+ _context6.t1 = _context6.sent;
2004
+ _context6.t0 = _context6.t1 === true;
2005
+ case 6:
2006
+ if (!_context6.t0) {
2007
+ _context6.next = 8;
2008
+ break;
2009
+ }
2010
+ return _context6.abrupt("return");
2011
+ case 8:
2012
+ _context6.t2 = timingObject.query().position;
2013
+ _context6.next = 11;
2014
+ return player.getCurrentTime();
2015
+ case 11:
2016
+ _context6.t3 = _context6.sent;
2017
+ diff = _context6.t2 - _context6.t3;
2018
+ diffAbs = Math.abs(diff);
2019
+ _this3.log("Drift: ".concat(diff));
2020
+ if (!(diffAbs > maxAllowedDrift)) {
2021
+ _context6.next = 22;
2022
+ break;
2023
+ }
2024
+ _context6.next = 18;
2025
+ return _this3.adjustSpeed(player, 0);
2026
+ case 18:
2027
+ player.setCurrentTime(timingObject.query().position);
2028
+ _this3.log('Resync by currentTime');
2029
+ _context6.next = 29;
2030
+ break;
2031
+ case 22:
2032
+ if (!(diffAbs > allowedDrift)) {
2033
+ _context6.next = 29;
2034
+ break;
2035
+ }
2036
+ min = diffAbs / maxTimeToCatchUp;
2037
+ max = maxRateAdjustment;
2038
+ adjustment = min < max ? (max - min) / 2 : max;
2039
+ _context6.next = 28;
2040
+ return _this3.adjustSpeed(player, adjustment * Math.sign(diff));
2041
+ case 28:
2042
+ _this3.log('Resync by playbackRate');
2043
+ case 29:
2044
+ case "end":
2045
+ return _context6.stop();
2046
+ }
2047
+ }, _callee6);
2048
+ }));
2049
+ return function check() {
2050
+ return _ref3.apply(this, arguments);
2051
+ };
2052
+ }();
2053
+ var interval = setInterval(function () {
2054
+ return check();
2055
+ }, syncInterval);
2056
+ return {
2057
+ cancel: function cancel() {
2058
+ return clearInterval(interval);
2059
+ }
2060
+ };
2061
+ }
2062
+
2063
+ /**
2064
+ * @param {string} msg
2065
+ */
2066
+ }, {
2067
+ key: "log",
2068
+ value: function log(msg) {
2069
+ var _this$logger;
2070
+ (_this$logger = this.logger) === null || _this$logger === void 0 ? void 0 : _this$logger.call(this, "TimingSrcConnector: ".concat(msg));
2071
+ }
2072
+ }, {
2073
+ key: "waitForTOReadyState",
2074
+ value:
2075
+ /**
2076
+ * @param {TimingObject} timingObject
2077
+ * @param {TConnectionState} state
2078
+ * @return {Promise<void>}
2079
+ */
2080
+ function waitForTOReadyState(timingObject, state) {
2081
+ return new Promise(function (resolve) {
2082
+ var check = function check() {
2083
+ if (timingObject.readyState === state) {
2084
+ resolve();
2085
+ } else {
2086
+ timingObject.addEventListener('readystatechange', check, {
2087
+ once: true
2088
+ });
2089
+ }
2090
+ };
2091
+ check();
2092
+ });
2093
+ }
2094
+ }]);
2095
+ return TimingSrcConnector;
2096
+ }( /*#__PURE__*/_wrapNativeSuper(EventTarget));
2097
+
2098
+ var playerMap = new WeakMap();
2099
+ var readyMap = new WeakMap();
2100
+ var screenfull = {};
2101
+ var Player = /*#__PURE__*/function () {
2102
+ /**
2103
+ * Create a Player.
2104
+ *
2105
+ * @param {(HTMLIFrameElement|HTMLElement|string|jQuery)} element A reference to the Vimeo
2106
+ * player iframe, and id, or a jQuery object.
2107
+ * @param {object} [options] oEmbed parameters to use when creating an embed in the element.
2108
+ * @return {Player}
2109
+ */
2110
+ function Player(element) {
2111
+ var _this = this;
2112
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2113
+ _classCallCheck(this, Player);
2114
+ /* global jQuery */
2115
+ if (window.jQuery && element instanceof jQuery) {
2116
+ if (element.length > 1 && window.console && console.warn) {
2117
+ console.warn('A jQuery object with multiple elements was passed, using the first element.');
2118
+ }
2119
+ element = element[0];
2120
+ }
2121
+
2122
+ // Find an element by ID
2123
+ if (typeof document !== 'undefined' && typeof element === 'string') {
2124
+ element = document.getElementById(element);
2125
+ }
2126
+
2127
+ // Not an element!
2128
+ if (!isDomElement(element)) {
2129
+ throw new TypeError('You must pass either a valid element or a valid id.');
2130
+ }
2131
+
2132
+ // Already initialized an embed in this div, so grab the iframe
2133
+ if (element.nodeName !== 'IFRAME') {
2134
+ var iframe = element.querySelector('iframe');
2135
+ if (iframe) {
2136
+ element = iframe;
2137
+ }
2138
+ }
2139
+
2140
+ // iframe url is not a Vimeo url
2141
+ if (element.nodeName === 'IFRAME' && !isVimeoUrl(element.getAttribute('src') || '')) {
2142
+ throw new Error('The player element passed isn’t a Vimeo embed.');
2143
+ }
2144
+
2145
+ // If there is already a player object in the map, return that
2146
+ if (playerMap.has(element)) {
2147
+ return playerMap.get(element);
2148
+ }
2149
+ this._window = element.ownerDocument.defaultView;
2150
+ this.element = element;
2151
+ this.origin = '*';
2152
+ var readyPromise = new npo_src(function (resolve, reject) {
2153
+ _this._onMessage = function (event) {
2154
+ if (!isVimeoUrl(event.origin) || _this.element.contentWindow !== event.source) {
2155
+ return;
2156
+ }
2157
+ if (_this.origin === '*') {
2158
+ _this.origin = event.origin;
2159
+ }
2160
+ var data = parseMessageData(event.data);
2161
+ var isError = data && data.event === 'error';
2162
+ var isReadyError = isError && data.data && data.data.method === 'ready';
2163
+ if (isReadyError) {
2164
+ var error = new Error(data.data.message);
2165
+ error.name = data.data.name;
2166
+ reject(error);
2167
+ return;
2168
+ }
2169
+ var isReadyEvent = data && data.event === 'ready';
2170
+ var isPingResponse = data && data.method === 'ping';
2171
+ if (isReadyEvent || isPingResponse) {
2172
+ _this.element.setAttribute('data-ready', 'true');
2173
+ resolve();
2174
+ return;
2175
+ }
2176
+ processData(_this, data);
2177
+ };
2178
+ _this._window.addEventListener('message', _this._onMessage);
2179
+ if (_this.element.nodeName !== 'IFRAME') {
2180
+ var params = getOEmbedParameters(element, options);
2181
+ var url = getVimeoUrl(params);
2182
+ getOEmbedData(url, params, element).then(function (data) {
2183
+ var iframe = createEmbed(data, element);
2184
+ // Overwrite element with the new iframe,
2185
+ // but store reference to the original element
2186
+ _this.element = iframe;
2187
+ _this._originalElement = element;
2188
+ swapCallbacks(element, iframe);
2189
+ playerMap.set(_this.element, _this);
2190
+ return data;
2191
+ }).catch(reject);
2192
+ }
2193
+ });
2194
+
2195
+ // Store a copy of this Player in the map
2196
+ readyMap.set(this, readyPromise);
2197
+ playerMap.set(this.element, this);
2198
+
2199
+ // Send a ping to the iframe so the ready promise will be resolved if
2200
+ // the player is already ready.
2201
+ if (this.element.nodeName === 'IFRAME') {
2202
+ postMessage(this, 'ping');
2203
+ }
2204
+ if (screenfull.isEnabled) {
2205
+ var exitFullscreen = function exitFullscreen() {
2206
+ return screenfull.exit();
2207
+ };
2208
+ this.fullscreenchangeHandler = function () {
2209
+ if (screenfull.isFullscreen) {
2210
+ storeCallback(_this, 'event:exitFullscreen', exitFullscreen);
2211
+ } else {
2212
+ removeCallback(_this, 'event:exitFullscreen', exitFullscreen);
2213
+ }
2214
+ // eslint-disable-next-line
2215
+ _this.ready().then(function () {
2216
+ postMessage(_this, 'fullscreenchange', screenfull.isFullscreen);
2217
+ });
2218
+ };
2219
+ screenfull.on('fullscreenchange', this.fullscreenchangeHandler);
2220
+ }
2221
+ return this;
2222
+ }
2223
+
2224
+ /**
2225
+ * Get a promise for a method.
2226
+ *
2227
+ * @param {string} name The API method to call.
2228
+ * @param {...(string|number|object|Array)} args Arguments to send via postMessage.
2229
+ * @return {Promise}
2230
+ */
2231
+ _createClass(Player, [{
2232
+ key: "callMethod",
2233
+ value: function callMethod(name) {
2234
+ var _this2 = this;
2235
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2236
+ args[_key - 1] = arguments[_key];
2237
+ }
2238
+ if (name === undefined || name === null) {
2239
+ throw new TypeError('You must pass a method name.');
2240
+ }
2241
+ return new npo_src(function (resolve, reject) {
2242
+ // We are storing the resolve/reject handlers to call later, so we
2243
+ // can’t return here.
2244
+ // eslint-disable-next-line promise/always-return
2245
+ return _this2.ready().then(function () {
2246
+ storeCallback(_this2, name, {
2247
+ resolve: resolve,
2248
+ reject: reject
2249
+ });
2250
+ postMessage(_this2, name, args);
2251
+ }).catch(reject);
2252
+ });
2253
+ }
2254
+ /**
2255
+ * Get a promise for the value of a player property.
2256
+ *
2257
+ * @param {string} name The property name
2258
+ * @return {Promise}
2259
+ */
2260
+ }, {
2261
+ key: "get",
2262
+ value: function get(name) {
2263
+ var _this3 = this;
2264
+ return new npo_src(function (resolve, reject) {
2265
+ name = getMethodName(name, 'get');
2266
+
2267
+ // We are storing the resolve/reject handlers to call later, so we
2268
+ // can’t return here.
2269
+ // eslint-disable-next-line promise/always-return
2270
+ return _this3.ready().then(function () {
2271
+ storeCallback(_this3, name, {
2272
+ resolve: resolve,
2273
+ reject: reject
2274
+ });
2275
+ postMessage(_this3, name);
2276
+ }).catch(reject);
2277
+ });
2278
+ }
2279
+
2280
+ /**
2281
+ * Get a promise for setting the value of a player property.
2282
+ *
2283
+ * @param {string} name The API method to call.
2284
+ * @param {mixed} value The value to set.
2285
+ * @return {Promise}
2286
+ */
2287
+ }, {
2288
+ key: "set",
2289
+ value: function set(name, value) {
2290
+ var _this4 = this;
2291
+ return new npo_src(function (resolve, reject) {
2292
+ name = getMethodName(name, 'set');
2293
+ if (value === undefined || value === null) {
2294
+ throw new TypeError('There must be a value to set.');
2295
+ }
2296
+
2297
+ // We are storing the resolve/reject handlers to call later, so we
2298
+ // can’t return here.
2299
+ // eslint-disable-next-line promise/always-return
2300
+ return _this4.ready().then(function () {
2301
+ storeCallback(_this4, name, {
2302
+ resolve: resolve,
2303
+ reject: reject
2304
+ });
2305
+ postMessage(_this4, name, value);
2306
+ }).catch(reject);
2307
+ });
2308
+ }
2309
+
2310
+ /**
2311
+ * Add an event listener for the specified event. Will call the
2312
+ * callback with a single parameter, `data`, that contains the data for
2313
+ * that event.
2314
+ *
2315
+ * @param {string} eventName The name of the event.
2316
+ * @param {function(*)} callback The function to call when the event fires.
2317
+ * @return {void}
2318
+ */
2319
+ }, {
2320
+ key: "on",
2321
+ value: function on(eventName, callback) {
2322
+ if (!eventName) {
2323
+ throw new TypeError('You must pass an event name.');
2324
+ }
2325
+ if (!callback) {
2326
+ throw new TypeError('You must pass a callback function.');
2327
+ }
2328
+ if (typeof callback !== 'function') {
2329
+ throw new TypeError('The callback must be a function.');
2330
+ }
2331
+ var callbacks = getCallbacks(this, "event:".concat(eventName));
2332
+ if (callbacks.length === 0) {
2333
+ this.callMethod('addEventListener', eventName).catch(function () {
2334
+ // Ignore the error. There will be an error event fired that
2335
+ // will trigger the error callback if they are listening.
2336
+ });
2337
+ }
2338
+ storeCallback(this, "event:".concat(eventName), callback);
2339
+ }
2340
+
2341
+ /**
2342
+ * Remove an event listener for the specified event. Will remove all
2343
+ * listeners for that event if a `callback` isn’t passed, or only that
2344
+ * specific callback if it is passed.
2345
+ *
2346
+ * @param {string} eventName The name of the event.
2347
+ * @param {function} [callback] The specific callback to remove.
2348
+ * @return {void}
2349
+ */
2350
+ }, {
2351
+ key: "off",
2352
+ value: function off(eventName, callback) {
2353
+ if (!eventName) {
2354
+ throw new TypeError('You must pass an event name.');
2355
+ }
2356
+ if (callback && typeof callback !== 'function') {
2357
+ throw new TypeError('The callback must be a function.');
2358
+ }
2359
+ var lastCallback = removeCallback(this, "event:".concat(eventName), callback);
2360
+
2361
+ // If there are no callbacks left, remove the listener
2362
+ if (lastCallback) {
2363
+ this.callMethod('removeEventListener', eventName).catch(function (e) {
2364
+ // Ignore the error. There will be an error event fired that
2365
+ // will trigger the error callback if they are listening.
2366
+ });
2367
+ }
2368
+ }
2369
+
2370
+ /**
2371
+ * A promise to load a new video.
2372
+ *
2373
+ * @promise LoadVideoPromise
2374
+ * @fulfill {number} The video with this id or url successfully loaded.
2375
+ * @reject {TypeError} The id was not a number.
2376
+ */
2377
+ /**
2378
+ * Load a new video into this embed. The promise will be resolved if
2379
+ * the video is successfully loaded, or it will be rejected if it could
2380
+ * not be loaded.
2381
+ *
2382
+ * @param {number|string|object} options The id of the video, the url of the video, or an object with embed options.
2383
+ * @return {LoadVideoPromise}
2384
+ */
2385
+ }, {
2386
+ key: "loadVideo",
2387
+ value: function loadVideo(options) {
2388
+ return this.callMethod('loadVideo', options);
2389
+ }
2390
+
2391
+ /**
2392
+ * A promise to perform an action when the Player is ready.
2393
+ *
2394
+ * @todo document errors
2395
+ * @promise LoadVideoPromise
2396
+ * @fulfill {void}
2397
+ */
2398
+ /**
2399
+ * Trigger a function when the player iframe has initialized. You do not
2400
+ * need to wait for `ready` to trigger to begin adding event listeners
2401
+ * or calling other methods.
2402
+ *
2403
+ * @return {ReadyPromise}
2404
+ */
2405
+ }, {
2406
+ key: "ready",
2407
+ value: function ready() {
2408
+ var readyPromise = readyMap.get(this) || new npo_src(function (resolve, reject) {
2409
+ reject(new Error('Unknown player. Probably unloaded.'));
2410
+ });
2411
+ return npo_src.resolve(readyPromise);
2412
+ }
2413
+
2414
+ /**
2415
+ * A promise to add a cue point to the player.
2416
+ *
2417
+ * @promise AddCuePointPromise
2418
+ * @fulfill {string} The id of the cue point to use for removeCuePoint.
2419
+ * @reject {RangeError} the time was less than 0 or greater than the
2420
+ * video’s duration.
2421
+ * @reject {UnsupportedError} Cue points are not supported with the current
2422
+ * player or browser.
2423
+ */
2424
+ /**
2425
+ * Add a cue point to the player.
2426
+ *
2427
+ * @param {number} time The time for the cue point.
2428
+ * @param {object} [data] Arbitrary data to be returned with the cue point.
2429
+ * @return {AddCuePointPromise}
2430
+ */
2431
+ }, {
2432
+ key: "addCuePoint",
2433
+ value: function addCuePoint(time) {
2434
+ var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2435
+ return this.callMethod('addCuePoint', {
2436
+ time: time,
2437
+ data: data
2438
+ });
2439
+ }
2440
+
2441
+ /**
2442
+ * A promise to remove a cue point from the player.
2443
+ *
2444
+ * @promise AddCuePointPromise
2445
+ * @fulfill {string} The id of the cue point that was removed.
2446
+ * @reject {InvalidCuePoint} The cue point with the specified id was not
2447
+ * found.
2448
+ * @reject {UnsupportedError} Cue points are not supported with the current
2449
+ * player or browser.
2450
+ */
2451
+ /**
2452
+ * Remove a cue point from the video.
2453
+ *
2454
+ * @param {string} id The id of the cue point to remove.
2455
+ * @return {RemoveCuePointPromise}
2456
+ */
2457
+ }, {
2458
+ key: "removeCuePoint",
2459
+ value: function removeCuePoint(id) {
2460
+ return this.callMethod('removeCuePoint', id);
2461
+ }
2462
+
2463
+ /**
2464
+ * A representation of a text track on a video.
2465
+ *
2466
+ * @typedef {Object} VimeoTextTrack
2467
+ * @property {string} language The ISO language code.
2468
+ * @property {string} kind The kind of track it is (captions or subtitles).
2469
+ * @property {string} label The human‐readable label for the track.
2470
+ */
2471
+ /**
2472
+ * A promise to enable a text track.
2473
+ *
2474
+ * @promise EnableTextTrackPromise
2475
+ * @fulfill {VimeoTextTrack} The text track that was enabled.
2476
+ * @reject {InvalidTrackLanguageError} No track was available with the
2477
+ * specified language.
2478
+ * @reject {InvalidTrackError} No track was available with the specified
2479
+ * language and kind.
2480
+ */
2481
+ /**
2482
+ * Enable the text track with the specified language, and optionally the
2483
+ * specified kind (captions or subtitles).
2484
+ *
2485
+ * When set via the API, the track language will not change the viewer’s
2486
+ * stored preference.
2487
+ *
2488
+ * @param {string} language The two‐letter language code.
2489
+ * @param {string} [kind] The kind of track to enable (captions or subtitles).
2490
+ * @return {EnableTextTrackPromise}
2491
+ */
2492
+ }, {
2493
+ key: "enableTextTrack",
2494
+ value: function enableTextTrack(language, kind) {
2495
+ if (!language) {
2496
+ throw new TypeError('You must pass a language.');
2497
+ }
2498
+ return this.callMethod('enableTextTrack', {
2499
+ language: language,
2500
+ kind: kind
2501
+ });
2502
+ }
2503
+
2504
+ /**
2505
+ * A promise to disable the active text track.
2506
+ *
2507
+ * @promise DisableTextTrackPromise
2508
+ * @fulfill {void} The track was disabled.
2509
+ */
2510
+ /**
2511
+ * Disable the currently-active text track.
2512
+ *
2513
+ * @return {DisableTextTrackPromise}
2514
+ */
2515
+ }, {
2516
+ key: "disableTextTrack",
2517
+ value: function disableTextTrack() {
2518
+ return this.callMethod('disableTextTrack');
2519
+ }
2520
+
2521
+ /**
2522
+ * A promise to pause the video.
2523
+ *
2524
+ * @promise PausePromise
2525
+ * @fulfill {void} The video was paused.
2526
+ */
2527
+ /**
2528
+ * Pause the video if it’s playing.
2529
+ *
2530
+ * @return {PausePromise}
2531
+ */
2532
+ }, {
2533
+ key: "pause",
2534
+ value: function pause() {
2535
+ return this.callMethod('pause');
2536
+ }
2537
+
2538
+ /**
2539
+ * A promise to play the video.
2540
+ *
2541
+ * @promise PlayPromise
2542
+ * @fulfill {void} The video was played.
2543
+ */
2544
+ /**
2545
+ * Play the video if it’s paused. **Note:** on iOS and some other
2546
+ * mobile devices, you cannot programmatically trigger play. Once the
2547
+ * viewer has tapped on the play button in the player, however, you
2548
+ * will be able to use this function.
2549
+ *
2550
+ * @return {PlayPromise}
2551
+ */
2552
+ }, {
2553
+ key: "play",
2554
+ value: function play() {
2555
+ return this.callMethod('play');
2556
+ }
2557
+
2558
+ /**
2559
+ * Request that the player enters fullscreen.
2560
+ * @return {Promise}
2561
+ */
2562
+ }, {
2563
+ key: "requestFullscreen",
2564
+ value: function requestFullscreen() {
2565
+ if (screenfull.isEnabled) {
2566
+ return screenfull.request(this.element);
2567
+ }
2568
+ return this.callMethod('requestFullscreen');
2569
+ }
2570
+
2571
+ /**
2572
+ * Request that the player exits fullscreen.
2573
+ * @return {Promise}
2574
+ */
2575
+ }, {
2576
+ key: "exitFullscreen",
2577
+ value: function exitFullscreen() {
2578
+ if (screenfull.isEnabled) {
2579
+ return screenfull.exit();
2580
+ }
2581
+ return this.callMethod('exitFullscreen');
2582
+ }
2583
+
2584
+ /**
2585
+ * Returns true if the player is currently fullscreen.
2586
+ * @return {Promise}
2587
+ */
2588
+ }, {
2589
+ key: "getFullscreen",
2590
+ value: function getFullscreen() {
2591
+ if (screenfull.isEnabled) {
2592
+ return npo_src.resolve(screenfull.isFullscreen);
2593
+ }
2594
+ return this.get('fullscreen');
2595
+ }
2596
+
2597
+ /**
2598
+ * Request that the player enters picture-in-picture.
2599
+ * @return {Promise}
2600
+ */
2601
+ }, {
2602
+ key: "requestPictureInPicture",
2603
+ value: function requestPictureInPicture() {
2604
+ return this.callMethod('requestPictureInPicture');
2605
+ }
2606
+
2607
+ /**
2608
+ * Request that the player exits picture-in-picture.
2609
+ * @return {Promise}
2610
+ */
2611
+ }, {
2612
+ key: "exitPictureInPicture",
2613
+ value: function exitPictureInPicture() {
2614
+ return this.callMethod('exitPictureInPicture');
2615
+ }
2616
+
2617
+ /**
2618
+ * Returns true if the player is currently picture-in-picture.
2619
+ * @return {Promise}
2620
+ */
2621
+ }, {
2622
+ key: "getPictureInPicture",
2623
+ value: function getPictureInPicture() {
2624
+ return this.get('pictureInPicture');
2625
+ }
2626
+
2627
+ /**
2628
+ * A promise to prompt the viewer to initiate remote playback.
2629
+ *
2630
+ * @promise RemotePlaybackPromptPromise
2631
+ * @fulfill {void}
2632
+ * @reject {NotFoundError} No remote playback device is available.
2633
+ */
2634
+ /**
2635
+ * Request to prompt the user to initiate remote playback.
2636
+ *
2637
+ * @return {RemotePlaybackPromptPromise}
2638
+ */
2639
+ }, {
2640
+ key: "remotePlaybackPrompt",
2641
+ value: function remotePlaybackPrompt() {
2642
+ return this.callMethod('remotePlaybackPrompt');
2643
+ }
2644
+
2645
+ /**
2646
+ * A promise to unload the video.
2647
+ *
2648
+ * @promise UnloadPromise
2649
+ * @fulfill {void} The video was unloaded.
2650
+ */
2651
+ /**
2652
+ * Return the player to its initial state.
2653
+ *
2654
+ * @return {UnloadPromise}
2655
+ */
2656
+ }, {
2657
+ key: "unload",
2658
+ value: function unload() {
2659
+ return this.callMethod('unload');
2660
+ }
2661
+
2662
+ /**
2663
+ * Cleanup the player and remove it from the DOM
2664
+ *
2665
+ * It won't be usable and a new one should be constructed
2666
+ * in order to do any operations.
2667
+ *
2668
+ * @return {Promise}
2669
+ */
2670
+ }, {
2671
+ key: "destroy",
2672
+ value: function destroy() {
2673
+ var _this5 = this;
2674
+ return new npo_src(function (resolve) {
2675
+ readyMap.delete(_this5);
2676
+ playerMap.delete(_this5.element);
2677
+ if (_this5._originalElement) {
2678
+ playerMap.delete(_this5._originalElement);
2679
+ _this5._originalElement.removeAttribute('data-vimeo-initialized');
2680
+ }
2681
+ if (_this5.element && _this5.element.nodeName === 'IFRAME' && _this5.element.parentNode) {
2682
+ // If we've added an additional wrapper div, remove that from the DOM.
2683
+ // If not, just remove the iframe element.
2684
+ if (_this5.element.parentNode.parentNode && _this5._originalElement && _this5._originalElement !== _this5.element.parentNode) {
2685
+ _this5.element.parentNode.parentNode.removeChild(_this5.element.parentNode);
2686
+ } else {
2687
+ _this5.element.parentNode.removeChild(_this5.element);
2688
+ }
2689
+ }
2690
+
2691
+ // If the clip is private there is a case where the element stays the
2692
+ // div element. Destroy should reset the div and remove the iframe child.
2693
+ if (_this5.element && _this5.element.nodeName === 'DIV' && _this5.element.parentNode) {
2694
+ _this5.element.removeAttribute('data-vimeo-initialized');
2695
+ var iframe = _this5.element.querySelector('iframe');
2696
+ if (iframe && iframe.parentNode) {
2697
+ // If we've added an additional wrapper div, remove that from the DOM.
2698
+ // If not, just remove the iframe element.
2699
+ if (iframe.parentNode.parentNode && _this5._originalElement && _this5._originalElement !== iframe.parentNode) {
2700
+ iframe.parentNode.parentNode.removeChild(iframe.parentNode);
2701
+ } else {
2702
+ iframe.parentNode.removeChild(iframe);
2703
+ }
2704
+ }
2705
+ }
2706
+ _this5._window.removeEventListener('message', _this5._onMessage);
2707
+ if (screenfull.isEnabled) {
2708
+ screenfull.off('fullscreenchange', _this5.fullscreenchangeHandler);
2709
+ }
2710
+ resolve();
2711
+ });
2712
+ }
2713
+
2714
+ /**
2715
+ * A promise to get the autopause behavior of the video.
2716
+ *
2717
+ * @promise GetAutopausePromise
2718
+ * @fulfill {boolean} Whether autopause is turned on or off.
2719
+ * @reject {UnsupportedError} Autopause is not supported with the current
2720
+ * player or browser.
2721
+ */
2722
+ /**
2723
+ * Get the autopause behavior for this player.
2724
+ *
2725
+ * @return {GetAutopausePromise}
2726
+ */
2727
+ }, {
2728
+ key: "getAutopause",
2729
+ value: function getAutopause() {
2730
+ return this.get('autopause');
2731
+ }
2732
+
2733
+ /**
2734
+ * A promise to set the autopause behavior of the video.
2735
+ *
2736
+ * @promise SetAutopausePromise
2737
+ * @fulfill {boolean} Whether autopause is turned on or off.
2738
+ * @reject {UnsupportedError} Autopause is not supported with the current
2739
+ * player or browser.
2740
+ */
2741
+ /**
2742
+ * Enable or disable the autopause behavior of this player.
2743
+ *
2744
+ * By default, when another video is played in the same browser, this
2745
+ * player will automatically pause. Unless you have a specific reason
2746
+ * for doing so, we recommend that you leave autopause set to the
2747
+ * default (`true`).
2748
+ *
2749
+ * @param {boolean} autopause
2750
+ * @return {SetAutopausePromise}
2751
+ */
2752
+ }, {
2753
+ key: "setAutopause",
2754
+ value: function setAutopause(autopause) {
2755
+ return this.set('autopause', autopause);
2756
+ }
2757
+
2758
+ /**
2759
+ * A promise to get the buffered property of the video.
2760
+ *
2761
+ * @promise GetBufferedPromise
2762
+ * @fulfill {Array} Buffered Timeranges converted to an Array.
2763
+ */
2764
+ /**
2765
+ * Get the buffered property of the video.
2766
+ *
2767
+ * @return {GetBufferedPromise}
2768
+ */
2769
+ }, {
2770
+ key: "getBuffered",
2771
+ value: function getBuffered() {
2772
+ return this.get('buffered');
2773
+ }
2774
+
2775
+ /**
2776
+ * @typedef {Object} CameraProperties
2777
+ * @prop {number} props.yaw - Number between 0 and 360.
2778
+ * @prop {number} props.pitch - Number between -90 and 90.
2779
+ * @prop {number} props.roll - Number between -180 and 180.
2780
+ * @prop {number} props.fov - The field of view in degrees.
2781
+ */
2782
+ /**
2783
+ * A promise to get the camera properties of the player.
2784
+ *
2785
+ * @promise GetCameraPromise
2786
+ * @fulfill {CameraProperties} The camera properties.
2787
+ */
2788
+ /**
2789
+ * For 360° videos get the camera properties for this player.
2790
+ *
2791
+ * @return {GetCameraPromise}
2792
+ */
2793
+ }, {
2794
+ key: "getCameraProps",
2795
+ value: function getCameraProps() {
2796
+ return this.get('cameraProps');
2797
+ }
2798
+
2799
+ /**
2800
+ * A promise to set the camera properties of the player.
2801
+ *
2802
+ * @promise SetCameraPromise
2803
+ * @fulfill {Object} The camera was successfully set.
2804
+ * @reject {RangeError} The range was out of bounds.
2805
+ */
2806
+ /**
2807
+ * For 360° videos set the camera properties for this player.
2808
+ *
2809
+ * @param {CameraProperties} camera The camera properties
2810
+ * @return {SetCameraPromise}
2811
+ */
2812
+ }, {
2813
+ key: "setCameraProps",
2814
+ value: function setCameraProps(camera) {
2815
+ return this.set('cameraProps', camera);
2816
+ }
2817
+
2818
+ /**
2819
+ * A representation of a chapter.
2820
+ *
2821
+ * @typedef {Object} VimeoChapter
2822
+ * @property {number} startTime The start time of the chapter.
2823
+ * @property {object} title The title of the chapter.
2824
+ * @property {number} index The place in the order of Chapters. Starts at 1.
2825
+ */
2826
+ /**
2827
+ * A promise to get chapters for the video.
2828
+ *
2829
+ * @promise GetChaptersPromise
2830
+ * @fulfill {VimeoChapter[]} The chapters for the video.
2831
+ */
2832
+ /**
2833
+ * Get an array of all the chapters for the video.
2834
+ *
2835
+ * @return {GetChaptersPromise}
2836
+ */
2837
+ }, {
2838
+ key: "getChapters",
2839
+ value: function getChapters() {
2840
+ return this.get('chapters');
2841
+ }
2842
+
2843
+ /**
2844
+ * A promise to get the currently active chapter.
2845
+ *
2846
+ * @promise GetCurrentChaptersPromise
2847
+ * @fulfill {VimeoChapter|undefined} The current chapter for the video.
2848
+ */
2849
+ /**
2850
+ * Get the currently active chapter for the video.
2851
+ *
2852
+ * @return {GetCurrentChaptersPromise}
2853
+ */
2854
+ }, {
2855
+ key: "getCurrentChapter",
2856
+ value: function getCurrentChapter() {
2857
+ return this.get('currentChapter');
2858
+ }
2859
+
2860
+ /**
2861
+ * A promise to get the accent color of the player.
2862
+ *
2863
+ * @promise GetColorPromise
2864
+ * @fulfill {string} The hex color of the player.
2865
+ */
2866
+ /**
2867
+ * Get the accent color for this player. Note this is deprecated in place of `getColorTwo`.
2868
+ *
2869
+ * @return {GetColorPromise}
2870
+ */
2871
+ }, {
2872
+ key: "getColor",
2873
+ value: function getColor() {
2874
+ return this.get('color');
2875
+ }
2876
+
2877
+ /**
2878
+ * A promise to get all colors for the player in an array.
2879
+ *
2880
+ * @promise GetColorsPromise
2881
+ * @fulfill {string[]} The hex colors of the player.
2882
+ */
2883
+ /**
2884
+ * Get all the colors for this player in an array: [colorOne, colorTwo, colorThree, colorFour]
2885
+ *
2886
+ * @return {GetColorPromise}
2887
+ */
2888
+ }, {
2889
+ key: "getColors",
2890
+ value: function getColors() {
2891
+ return npo_src.all([this.get('colorOne'), this.get('colorTwo'), this.get('colorThree'), this.get('colorFour')]);
2892
+ }
2893
+
2894
+ /**
2895
+ * A promise to set the accent color of the player.
2896
+ *
2897
+ * @promise SetColorPromise
2898
+ * @fulfill {string} The color was successfully set.
2899
+ * @reject {TypeError} The string was not a valid hex or rgb color.
2900
+ * @reject {ContrastError} The color was set, but the contrast is
2901
+ * outside of the acceptable range.
2902
+ * @reject {EmbedSettingsError} The owner of the player has chosen to
2903
+ * use a specific color.
2904
+ */
2905
+ /**
2906
+ * Set the accent color of this player to a hex or rgb string. Setting the
2907
+ * color may fail if the owner of the video has set their embed
2908
+ * preferences to force a specific color.
2909
+ * Note this is deprecated in place of `setColorTwo`.
2910
+ *
2911
+ * @param {string} color The hex or rgb color string to set.
2912
+ * @return {SetColorPromise}
2913
+ */
2914
+ }, {
2915
+ key: "setColor",
2916
+ value: function setColor(color) {
2917
+ return this.set('color', color);
2918
+ }
2919
+
2920
+ /**
2921
+ * A promise to set all colors for the player.
2922
+ *
2923
+ * @promise SetColorsPromise
2924
+ * @fulfill {string[]} The colors were successfully set.
2925
+ * @reject {TypeError} The string was not a valid hex or rgb color.
2926
+ * @reject {ContrastError} The color was set, but the contrast is
2927
+ * outside of the acceptable range.
2928
+ * @reject {EmbedSettingsError} The owner of the player has chosen to
2929
+ * use a specific color.
2930
+ */
2931
+ /**
2932
+ * Set the colors of this player to a hex or rgb string. Setting the
2933
+ * color may fail if the owner of the video has set their embed
2934
+ * preferences to force a specific color.
2935
+ * The colors should be passed in as an array: [colorOne, colorTwo, colorThree, colorFour].
2936
+ * If a color should not be set, the index in the array can be left as null.
2937
+ *
2938
+ * @param {string[]} colors Array of the hex or rgb color strings to set.
2939
+ * @return {SetColorsPromise}
2940
+ */
2941
+ }, {
2942
+ key: "setColors",
2943
+ value: function setColors(colors) {
2944
+ if (!Array.isArray(colors)) {
2945
+ return new npo_src(function (resolve, reject) {
2946
+ return reject(new TypeError('Argument must be an array.'));
2947
+ });
2948
+ }
2949
+ var nullPromise = new npo_src(function (resolve) {
2950
+ return resolve(null);
2951
+ });
2952
+ var colorPromises = [colors[0] ? this.set('colorOne', colors[0]) : nullPromise, colors[1] ? this.set('colorTwo', colors[1]) : nullPromise, colors[2] ? this.set('colorThree', colors[2]) : nullPromise, colors[3] ? this.set('colorFour', colors[3]) : nullPromise];
2953
+ return npo_src.all(colorPromises);
2954
+ }
2955
+
2956
+ /**
2957
+ * A representation of a cue point.
2958
+ *
2959
+ * @typedef {Object} VimeoCuePoint
2960
+ * @property {number} time The time of the cue point.
2961
+ * @property {object} data The data passed when adding the cue point.
2962
+ * @property {string} id The unique id for use with removeCuePoint.
2963
+ */
2964
+ /**
2965
+ * A promise to get the cue points of a video.
2966
+ *
2967
+ * @promise GetCuePointsPromise
2968
+ * @fulfill {VimeoCuePoint[]} The cue points added to the video.
2969
+ * @reject {UnsupportedError} Cue points are not supported with the current
2970
+ * player or browser.
2971
+ */
2972
+ /**
2973
+ * Get an array of the cue points added to the video.
2974
+ *
2975
+ * @return {GetCuePointsPromise}
2976
+ */
2977
+ }, {
2978
+ key: "getCuePoints",
2979
+ value: function getCuePoints() {
2980
+ return this.get('cuePoints');
2981
+ }
2982
+
2983
+ /**
2984
+ * A promise to get the current time of the video.
2985
+ *
2986
+ * @promise GetCurrentTimePromise
2987
+ * @fulfill {number} The current time in seconds.
2988
+ */
2989
+ /**
2990
+ * Get the current playback position in seconds.
2991
+ *
2992
+ * @return {GetCurrentTimePromise}
2993
+ */
2994
+ }, {
2995
+ key: "getCurrentTime",
2996
+ value: function getCurrentTime() {
2997
+ return this.get('currentTime');
2998
+ }
2999
+
3000
+ /**
3001
+ * A promise to set the current time of the video.
3002
+ *
3003
+ * @promise SetCurrentTimePromise
3004
+ * @fulfill {number} The actual current time that was set.
3005
+ * @reject {RangeError} the time was less than 0 or greater than the
3006
+ * video’s duration.
3007
+ */
3008
+ /**
3009
+ * Set the current playback position in seconds. If the player was
3010
+ * paused, it will remain paused. Likewise, if the player was playing,
3011
+ * it will resume playing once the video has buffered.
3012
+ *
3013
+ * You can provide an accurate time and the player will attempt to seek
3014
+ * to as close to that time as possible. The exact time will be the
3015
+ * fulfilled value of the promise.
3016
+ *
3017
+ * @param {number} currentTime
3018
+ * @return {SetCurrentTimePromise}
3019
+ */
3020
+ }, {
3021
+ key: "setCurrentTime",
3022
+ value: function setCurrentTime(currentTime) {
3023
+ return this.set('currentTime', currentTime);
3024
+ }
3025
+
3026
+ /**
3027
+ * A promise to get the duration of the video.
3028
+ *
3029
+ * @promise GetDurationPromise
3030
+ * @fulfill {number} The duration in seconds.
3031
+ */
3032
+ /**
3033
+ * Get the duration of the video in seconds. It will be rounded to the
3034
+ * nearest second before playback begins, and to the nearest thousandth
3035
+ * of a second after playback begins.
3036
+ *
3037
+ * @return {GetDurationPromise}
3038
+ */
3039
+ }, {
3040
+ key: "getDuration",
3041
+ value: function getDuration() {
3042
+ return this.get('duration');
3043
+ }
3044
+
3045
+ /**
3046
+ * A promise to get the ended state of the video.
3047
+ *
3048
+ * @promise GetEndedPromise
3049
+ * @fulfill {boolean} Whether or not the video has ended.
3050
+ */
3051
+ /**
3052
+ * Get the ended state of the video. The video has ended if
3053
+ * `currentTime === duration`.
3054
+ *
3055
+ * @return {GetEndedPromise}
3056
+ */
3057
+ }, {
3058
+ key: "getEnded",
3059
+ value: function getEnded() {
3060
+ return this.get('ended');
3061
+ }
3062
+
3063
+ /**
3064
+ * A promise to get the loop state of the player.
3065
+ *
3066
+ * @promise GetLoopPromise
3067
+ * @fulfill {boolean} Whether or not the player is set to loop.
3068
+ */
3069
+ /**
3070
+ * Get the loop state of the player.
3071
+ *
3072
+ * @return {GetLoopPromise}
3073
+ */
3074
+ }, {
3075
+ key: "getLoop",
3076
+ value: function getLoop() {
3077
+ return this.get('loop');
3078
+ }
3079
+
3080
+ /**
3081
+ * A promise to set the loop state of the player.
3082
+ *
3083
+ * @promise SetLoopPromise
3084
+ * @fulfill {boolean} The loop state that was set.
3085
+ */
3086
+ /**
3087
+ * Set the loop state of the player. When set to `true`, the player
3088
+ * will start over immediately once playback ends.
3089
+ *
3090
+ * @param {boolean} loop
3091
+ * @return {SetLoopPromise}
3092
+ */
3093
+ }, {
3094
+ key: "setLoop",
3095
+ value: function setLoop(loop) {
3096
+ return this.set('loop', loop);
3097
+ }
3098
+
3099
+ /**
3100
+ * A promise to set the muted state of the player.
3101
+ *
3102
+ * @promise SetMutedPromise
3103
+ * @fulfill {boolean} The muted state that was set.
3104
+ */
3105
+ /**
3106
+ * Set the muted state of the player. When set to `true`, the player
3107
+ * volume will be muted.
3108
+ *
3109
+ * @param {boolean} muted
3110
+ * @return {SetMutedPromise}
3111
+ */
3112
+ }, {
3113
+ key: "setMuted",
3114
+ value: function setMuted(muted) {
3115
+ return this.set('muted', muted);
3116
+ }
3117
+
3118
+ /**
3119
+ * A promise to get the muted state of the player.
3120
+ *
3121
+ * @promise GetMutedPromise
3122
+ * @fulfill {boolean} Whether or not the player is muted.
3123
+ */
3124
+ /**
3125
+ * Get the muted state of the player.
3126
+ *
3127
+ * @return {GetMutedPromise}
3128
+ */
3129
+ }, {
3130
+ key: "getMuted",
3131
+ value: function getMuted() {
3132
+ return this.get('muted');
3133
+ }
3134
+
3135
+ /**
3136
+ * A promise to get the paused state of the player.
3137
+ *
3138
+ * @promise GetLoopPromise
3139
+ * @fulfill {boolean} Whether or not the video is paused.
3140
+ */
3141
+ /**
3142
+ * Get the paused state of the player.
3143
+ *
3144
+ * @return {GetLoopPromise}
3145
+ */
3146
+ }, {
3147
+ key: "getPaused",
3148
+ value: function getPaused() {
3149
+ return this.get('paused');
3150
+ }
3151
+
3152
+ /**
3153
+ * A promise to get the playback rate of the player.
3154
+ *
3155
+ * @promise GetPlaybackRatePromise
3156
+ * @fulfill {number} The playback rate of the player on a scale from 0 to 2.
3157
+ */
3158
+ /**
3159
+ * Get the playback rate of the player on a scale from `0` to `2`.
3160
+ *
3161
+ * @return {GetPlaybackRatePromise}
3162
+ */
3163
+ }, {
3164
+ key: "getPlaybackRate",
3165
+ value: function getPlaybackRate() {
3166
+ return this.get('playbackRate');
3167
+ }
3168
+
3169
+ /**
3170
+ * A promise to set the playbackrate of the player.
3171
+ *
3172
+ * @promise SetPlaybackRatePromise
3173
+ * @fulfill {number} The playback rate was set.
3174
+ * @reject {RangeError} The playback rate was less than 0 or greater than 2.
3175
+ */
3176
+ /**
3177
+ * Set the playback rate of the player on a scale from `0` to `2`. When set
3178
+ * via the API, the playback rate will not be synchronized to other
3179
+ * players or stored as the viewer's preference.
3180
+ *
3181
+ * @param {number} playbackRate
3182
+ * @return {SetPlaybackRatePromise}
3183
+ */
3184
+ }, {
3185
+ key: "setPlaybackRate",
3186
+ value: function setPlaybackRate(playbackRate) {
3187
+ return this.set('playbackRate', playbackRate);
3188
+ }
3189
+
3190
+ /**
3191
+ * A promise to get the played property of the video.
3192
+ *
3193
+ * @promise GetPlayedPromise
3194
+ * @fulfill {Array} Played Timeranges converted to an Array.
3195
+ */
3196
+ /**
3197
+ * Get the played property of the video.
3198
+ *
3199
+ * @return {GetPlayedPromise}
3200
+ */
3201
+ }, {
3202
+ key: "getPlayed",
3203
+ value: function getPlayed() {
3204
+ return this.get('played');
3205
+ }
3206
+
3207
+ /**
3208
+ * A promise to get the qualities available of the current video.
3209
+ *
3210
+ * @promise GetQualitiesPromise
3211
+ * @fulfill {Array} The qualities of the video.
3212
+ */
3213
+ /**
3214
+ * Get the qualities of the current video.
3215
+ *
3216
+ * @return {GetQualitiesPromise}
3217
+ */
3218
+ }, {
3219
+ key: "getQualities",
3220
+ value: function getQualities() {
3221
+ return this.get('qualities');
3222
+ }
3223
+
3224
+ /**
3225
+ * A promise to get the current set quality of the video.
3226
+ *
3227
+ * @promise GetQualityPromise
3228
+ * @fulfill {string} The current set quality.
3229
+ */
3230
+ /**
3231
+ * Get the current set quality of the video.
3232
+ *
3233
+ * @return {GetQualityPromise}
3234
+ */
3235
+ }, {
3236
+ key: "getQuality",
3237
+ value: function getQuality() {
3238
+ return this.get('quality');
3239
+ }
3240
+
3241
+ /**
3242
+ * A promise to set the video quality.
3243
+ *
3244
+ * @promise SetQualityPromise
3245
+ * @fulfill {number} The quality was set.
3246
+ * @reject {RangeError} The quality is not available.
3247
+ */
3248
+ /**
3249
+ * Set a video quality.
3250
+ *
3251
+ * @param {string} quality
3252
+ * @return {SetQualityPromise}
3253
+ */
3254
+ }, {
3255
+ key: "setQuality",
3256
+ value: function setQuality(quality) {
3257
+ return this.set('quality', quality);
3258
+ }
3259
+
3260
+ /**
3261
+ * A promise to get the remote playback availability.
3262
+ *
3263
+ * @promise RemotePlaybackAvailabilityPromise
3264
+ * @fulfill {boolean} Whether remote playback is available.
3265
+ */
3266
+ /**
3267
+ * Get the availability of remote playback.
3268
+ *
3269
+ * @return {RemotePlaybackAvailabilityPromise}
3270
+ */
3271
+ }, {
3272
+ key: "getRemotePlaybackAvailability",
3273
+ value: function getRemotePlaybackAvailability() {
3274
+ return this.get('remotePlaybackAvailability');
3275
+ }
3276
+
3277
+ /**
3278
+ * A promise to get the current remote playback state.
3279
+ *
3280
+ * @promise RemotePlaybackStatePromise
3281
+ * @fulfill {string} The state of the remote playback: connecting, connected, or disconnected.
3282
+ */
3283
+ /**
3284
+ * Get the current remote playback state.
3285
+ *
3286
+ * @return {RemotePlaybackStatePromise}
3287
+ */
3288
+ }, {
3289
+ key: "getRemotePlaybackState",
3290
+ value: function getRemotePlaybackState() {
3291
+ return this.get('remotePlaybackState');
3292
+ }
3293
+
3294
+ /**
3295
+ * A promise to get the seekable property of the video.
3296
+ *
3297
+ * @promise GetSeekablePromise
3298
+ * @fulfill {Array} Seekable Timeranges converted to an Array.
3299
+ */
3300
+ /**
3301
+ * Get the seekable property of the video.
3302
+ *
3303
+ * @return {GetSeekablePromise}
3304
+ */
3305
+ }, {
3306
+ key: "getSeekable",
3307
+ value: function getSeekable() {
3308
+ return this.get('seekable');
3309
+ }
3310
+
3311
+ /**
3312
+ * A promise to get the seeking property of the player.
3313
+ *
3314
+ * @promise GetSeekingPromise
3315
+ * @fulfill {boolean} Whether or not the player is currently seeking.
3316
+ */
3317
+ /**
3318
+ * Get if the player is currently seeking.
3319
+ *
3320
+ * @return {GetSeekingPromise}
3321
+ */
3322
+ }, {
3323
+ key: "getSeeking",
3324
+ value: function getSeeking() {
3325
+ return this.get('seeking');
3326
+ }
3327
+
3328
+ /**
3329
+ * A promise to get the text tracks of a video.
3330
+ *
3331
+ * @promise GetTextTracksPromise
3332
+ * @fulfill {VimeoTextTrack[]} The text tracks associated with the video.
3333
+ */
3334
+ /**
3335
+ * Get an array of the text tracks that exist for the video.
3336
+ *
3337
+ * @return {GetTextTracksPromise}
3338
+ */
3339
+ }, {
3340
+ key: "getTextTracks",
3341
+ value: function getTextTracks() {
3342
+ return this.get('textTracks');
3343
+ }
3344
+
3345
+ /**
3346
+ * A promise to get the embed code for the video.
3347
+ *
3348
+ * @promise GetVideoEmbedCodePromise
3349
+ * @fulfill {string} The `<iframe>` embed code for the video.
3350
+ */
3351
+ /**
3352
+ * Get the `<iframe>` embed code for the video.
3353
+ *
3354
+ * @return {GetVideoEmbedCodePromise}
3355
+ */
3356
+ }, {
3357
+ key: "getVideoEmbedCode",
3358
+ value: function getVideoEmbedCode() {
3359
+ return this.get('videoEmbedCode');
3360
+ }
3361
+
3362
+ /**
3363
+ * A promise to get the id of the video.
3364
+ *
3365
+ * @promise GetVideoIdPromise
3366
+ * @fulfill {number} The id of the video.
3367
+ */
3368
+ /**
3369
+ * Get the id of the video.
3370
+ *
3371
+ * @return {GetVideoIdPromise}
3372
+ */
3373
+ }, {
3374
+ key: "getVideoId",
3375
+ value: function getVideoId() {
3376
+ return this.get('videoId');
3377
+ }
3378
+
3379
+ /**
3380
+ * A promise to get the title of the video.
3381
+ *
3382
+ * @promise GetVideoTitlePromise
3383
+ * @fulfill {number} The title of the video.
3384
+ */
3385
+ /**
3386
+ * Get the title of the video.
3387
+ *
3388
+ * @return {GetVideoTitlePromise}
3389
+ */
3390
+ }, {
3391
+ key: "getVideoTitle",
3392
+ value: function getVideoTitle() {
3393
+ return this.get('videoTitle');
3394
+ }
3395
+
3396
+ /**
3397
+ * A promise to get the native width of the video.
3398
+ *
3399
+ * @promise GetVideoWidthPromise
3400
+ * @fulfill {number} The native width of the video.
3401
+ */
3402
+ /**
3403
+ * Get the native width of the currently‐playing video. The width of
3404
+ * the highest‐resolution available will be used before playback begins.
3405
+ *
3406
+ * @return {GetVideoWidthPromise}
3407
+ */
3408
+ }, {
3409
+ key: "getVideoWidth",
3410
+ value: function getVideoWidth() {
3411
+ return this.get('videoWidth');
3412
+ }
3413
+
3414
+ /**
3415
+ * A promise to get the native height of the video.
3416
+ *
3417
+ * @promise GetVideoHeightPromise
3418
+ * @fulfill {number} The native height of the video.
3419
+ */
3420
+ /**
3421
+ * Get the native height of the currently‐playing video. The height of
3422
+ * the highest‐resolution available will be used before playback begins.
3423
+ *
3424
+ * @return {GetVideoHeightPromise}
3425
+ */
3426
+ }, {
3427
+ key: "getVideoHeight",
3428
+ value: function getVideoHeight() {
3429
+ return this.get('videoHeight');
3430
+ }
3431
+
3432
+ /**
3433
+ * A promise to get the vimeo.com url for the video.
3434
+ *
3435
+ * @promise GetVideoUrlPromise
3436
+ * @fulfill {number} The vimeo.com url for the video.
3437
+ * @reject {PrivacyError} The url isn’t available because of the video’s privacy setting.
3438
+ */
3439
+ /**
3440
+ * Get the vimeo.com url for the video.
3441
+ *
3442
+ * @return {GetVideoUrlPromise}
3443
+ */
3444
+ }, {
3445
+ key: "getVideoUrl",
3446
+ value: function getVideoUrl() {
3447
+ return this.get('videoUrl');
3448
+ }
3449
+
3450
+ /**
3451
+ * A promise to get the volume level of the player.
3452
+ *
3453
+ * @promise GetVolumePromise
3454
+ * @fulfill {number} The volume level of the player on a scale from 0 to 1.
3455
+ */
3456
+ /**
3457
+ * Get the current volume level of the player on a scale from `0` to `1`.
3458
+ *
3459
+ * Most mobile devices do not support an independent volume from the
3460
+ * system volume. In those cases, this method will always return `1`.
3461
+ *
3462
+ * @return {GetVolumePromise}
3463
+ */
3464
+ }, {
3465
+ key: "getVolume",
3466
+ value: function getVolume() {
3467
+ return this.get('volume');
3468
+ }
3469
+
3470
+ /**
3471
+ * A promise to set the volume level of the player.
3472
+ *
3473
+ * @promise SetVolumePromise
3474
+ * @fulfill {number} The volume was set.
3475
+ * @reject {RangeError} The volume was less than 0 or greater than 1.
3476
+ */
3477
+ /**
3478
+ * Set the volume of the player on a scale from `0` to `1`. When set
3479
+ * via the API, the volume level will not be synchronized to other
3480
+ * players or stored as the viewer’s preference.
3481
+ *
3482
+ * Most mobile devices do not support setting the volume. An error will
3483
+ * *not* be triggered in that situation.
3484
+ *
3485
+ * @param {number} volume
3486
+ * @return {SetVolumePromise}
3487
+ */
3488
+ }, {
3489
+ key: "setVolume",
3490
+ value: function setVolume(volume) {
3491
+ return this.set('volume', volume);
3492
+ }
3493
+
3494
+ /** @typedef {import('./lib/timing-object.types').TimingObject} TimingObject */
3495
+ /** @typedef {import('./lib/timing-src-connector.types').TimingSrcConnectorOptions} TimingSrcConnectorOptions */
3496
+ /** @typedef {import('./lib/timing-src-connector').TimingSrcConnector} TimingSrcConnector */
3497
+
3498
+ /**
3499
+ * Connects a TimingObject to the video player (https://webtiming.github.io/timingobject/)
3500
+ *
3501
+ * @param {TimingObject} timingObject
3502
+ * @param {TimingSrcConnectorOptions} options
3503
+ *
3504
+ * @return {Promise<TimingSrcConnector>}
3505
+ */
3506
+ }, {
3507
+ key: "setTimingSrc",
3508
+ value: function () {
3509
+ var _setTimingSrc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(timingObject, options) {
3510
+ var _this6 = this;
3511
+ var connector;
3512
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3513
+ while (1) switch (_context.prev = _context.next) {
3514
+ case 0:
3515
+ if (timingObject) {
3516
+ _context.next = 2;
3517
+ break;
3518
+ }
3519
+ throw new TypeError('A Timing Object must be provided.');
3520
+ case 2:
3521
+ _context.next = 4;
3522
+ return this.ready();
3523
+ case 4:
3524
+ connector = new TimingSrcConnector(this, timingObject, options);
3525
+ postMessage(this, 'notifyTimingObjectConnect');
3526
+ connector.addEventListener('disconnect', function () {
3527
+ return postMessage(_this6, 'notifyTimingObjectDisconnect');
3528
+ });
3529
+ return _context.abrupt("return", connector);
3530
+ case 8:
3531
+ case "end":
3532
+ return _context.stop();
3533
+ }
3534
+ }, _callee, this);
3535
+ }));
3536
+ function setTimingSrc(_x, _x2) {
3537
+ return _setTimingSrc.apply(this, arguments);
3538
+ }
3539
+ return setTimingSrc;
3540
+ }()
3541
+ }]);
3542
+ return Player;
3543
+ }(); // Setup embed only if this is not a node environment
3544
+ if (!isNode) {
3545
+ screenfull = initializeScreenfull();
3546
+ initializeEmbeds();
3547
+ resizeEmbeds();
3548
+ initAppendVideoMetadata();
3549
+ checkUrlTimeParam();
3550
+ }
3551
+
3552
+ const EMBED_VIDEO_BASE = "https://player.vimeo.com/video";
3553
+ const EMBED_EVENT_BASE = "https://vimeo.com/event";
3554
+ const MATCH_SRC = /vimeo\.com\/(video\/|event\/)?(\d+)(?:\/([\w-]+))?/;
3555
+ function getTemplateHTML(attrs, props = {}) {
3556
+ var _a;
3557
+ const iframeAttrs = {
3558
+ src: serializeIframeUrl(attrs, props),
3559
+ frameborder: 0,
3560
+ width: "100%",
3561
+ height: "100%",
3562
+ allow: "accelerometer; fullscreen; autoplay; encrypted-media; gyroscope; picture-in-picture"
3563
+ };
3564
+ if (props.config) {
3565
+ iframeAttrs["data-config"] = JSON.stringify(props.config);
3566
+ }
3567
+ if ((_a = props.config) == null ? void 0 : _a.referrerpolicy) {
3568
+ iframeAttrs.referrerpolicy = props.config.referrerpolicy;
3569
+ }
3570
+ return (
3571
+ /*html*/
3572
+ `
3573
+ <style>
3574
+ :host {
3575
+ display: inline-block;
3576
+ min-width: 300px;
3577
+ min-height: 150px;
3578
+ position: relative;
3579
+ }
3580
+ iframe {
3581
+ position: absolute;
3582
+ top: 0;
3583
+ left: 0;
3584
+ }
3585
+ :host(:not([controls])) {
3586
+ pointer-events: none;
3587
+ }
3588
+ </style>
3589
+ <iframe${serializeAttributes(iframeAttrs)}></iframe>
3590
+ `
3591
+ );
3592
+ }
3593
+ function serializeIframeUrl(attrs, props) {
3594
+ if (!attrs.src) return;
3595
+ let url = new URL(attrs.src);
3596
+ const matches = attrs.src.match(MATCH_SRC);
3597
+ const urlType = matches == null ? void 0 : matches[1];
3598
+ const srcId = matches == null ? void 0 : matches[2];
3599
+ const hParam = url.searchParams.get("h") || (matches == null ? void 0 : matches[3]);
3600
+ const params = {
3601
+ // ?controls=true is enabled by default in the iframe
3602
+ controls: attrs.controls === "" ? null : 0,
3603
+ autoplay: attrs.autoplay,
3604
+ loop: attrs.loop,
3605
+ muted: attrs.muted,
3606
+ playsinline: attrs.playsinline,
3607
+ preload: attrs.preload ?? "metadata",
3608
+ transparent: false,
3609
+ autopause: attrs.autopause,
3610
+ h: hParam,
3611
+ // This param is required when the video is Unlisted.
3612
+ ...props.config
3613
+ };
3614
+ if (urlType === "event/") {
3615
+ return `${EMBED_EVENT_BASE}/${srcId}/embed?${serialize(params)}`;
3616
+ }
3617
+ return `${EMBED_VIDEO_BASE}/${srcId}?${serialize(params)}`;
3618
+ }
3619
+ class VimeoVideoElement extends index.MediaPlayedRangesMixin(globalThis.HTMLElement ?? class {
3620
+ }) {
3621
+ static getTemplateHTML = getTemplateHTML;
3622
+ static shadowRootOptions = { mode: "open" };
3623
+ static observedAttributes = [
3624
+ "autoplay",
3625
+ "controls",
3626
+ "crossorigin",
3627
+ "loop",
3628
+ "muted",
3629
+ "playsinline",
3630
+ "poster",
3631
+ "preload",
3632
+ "src"
3633
+ ];
3634
+ loadComplete = new PublicPromise();
3635
+ #loadRequested;
3636
+ #hasLoaded;
3637
+ #isInit;
3638
+ #currentTime = 0;
3639
+ #duration = NaN;
3640
+ #muted = false;
3641
+ #paused = !this.autoplay;
3642
+ #playbackRate = 1;
3643
+ #progress = 0;
3644
+ #readyState = 0;
3645
+ #seeking = false;
3646
+ #volume = 1;
3647
+ #videoWidth = NaN;
3648
+ #videoHeight = NaN;
3649
+ #config = null;
3650
+ constructor() {
3651
+ super();
3652
+ this.#upgradeProperty("config");
3653
+ }
3654
+ requestFullscreen() {
3655
+ var _a, _b;
3656
+ return (_b = (_a = this.api) == null ? void 0 : _a.requestFullscreen) == null ? void 0 : _b.call(_a);
3657
+ }
3658
+ exitFullscreen() {
3659
+ var _a, _b;
3660
+ return (_b = (_a = this.api) == null ? void 0 : _a.exitFullscreen) == null ? void 0 : _b.call(_a);
3661
+ }
3662
+ requestPictureInPicture() {
3663
+ var _a, _b;
3664
+ return (_b = (_a = this.api) == null ? void 0 : _a.requestPictureInPicture) == null ? void 0 : _b.call(_a);
3665
+ }
3666
+ exitPictureInPicture() {
3667
+ var _a, _b;
3668
+ return (_b = (_a = this.api) == null ? void 0 : _a.exitPictureInPicture) == null ? void 0 : _b.call(_a);
3669
+ }
3670
+ get config() {
3671
+ return this.#config;
3672
+ }
3673
+ set config(value) {
3674
+ this.#config = value;
3675
+ }
3676
+ async load() {
3677
+ var _a;
3678
+ if (this.#loadRequested) return;
3679
+ const isFirstLoad = !this.#hasLoaded;
3680
+ if (this.#hasLoaded) this.loadComplete = new PublicPromise();
3681
+ this.#hasLoaded = true;
3682
+ await (this.#loadRequested = Promise.resolve());
3683
+ this.#loadRequested = null;
3684
+ this.#currentTime = 0;
3685
+ this.#duration = NaN;
3686
+ this.#muted = false;
3687
+ this.#paused = !this.autoplay;
3688
+ this.#playbackRate = 1;
3689
+ this.#progress = 0;
3690
+ this.#readyState = 0;
3691
+ this.#seeking = false;
3692
+ this.#volume = 1;
3693
+ this.#readyState = 0;
3694
+ this.#videoWidth = NaN;
3695
+ this.#videoHeight = NaN;
3696
+ this.dispatchEvent(new Event("emptied"));
3697
+ let oldApi = this.api;
3698
+ this.api = null;
3699
+ if (!this.src) {
3700
+ return;
3701
+ }
3702
+ this.dispatchEvent(new Event("loadstart"));
3703
+ const options = {
3704
+ autoplay: this.autoplay,
3705
+ controls: this.controls,
3706
+ loop: this.loop,
3707
+ muted: this.defaultMuted,
3708
+ playsinline: this.playsInline,
3709
+ preload: this.preload ?? "metadata",
3710
+ transparent: false,
3711
+ autopause: this.hasAttribute("autopause"),
3712
+ ...this.#config
3713
+ };
3714
+ const onLoaded = async () => {
3715
+ this.#readyState = 1;
3716
+ this.dispatchEvent(new Event("loadedmetadata"));
3717
+ if (this.api) {
3718
+ this.#muted = await this.api.getMuted();
3719
+ this.#volume = await this.api.getVolume();
3720
+ this.dispatchEvent(new Event("volumechange"));
3721
+ this.#duration = await this.api.getDuration();
3722
+ this.dispatchEvent(new Event("durationchange"));
3723
+ }
3724
+ this.dispatchEvent(new Event("loadcomplete"));
3725
+ this.loadComplete.resolve();
3726
+ };
3727
+ if (this.#isInit) {
3728
+ this.api = oldApi;
3729
+ await this.api.loadVideo({
3730
+ ...options,
3731
+ url: this.src
3732
+ });
3733
+ await onLoaded();
3734
+ await this.loadComplete;
3735
+ return;
3736
+ }
3737
+ this.#isInit = true;
3738
+ let iframe = (_a = this.shadowRoot) == null ? void 0 : _a.querySelector("iframe");
3739
+ if (isFirstLoad && iframe) {
3740
+ this.#config = JSON.parse(iframe.getAttribute("data-config") || "{}");
3741
+ }
3742
+ if (!this.shadowRoot) {
3743
+ this.attachShadow({ mode: "open" });
3744
+ this.shadowRoot.innerHTML = getTemplateHTML(namedNodeMapToObject(this.attributes), this);
3745
+ iframe = this.shadowRoot.querySelector("iframe");
3746
+ }
3747
+ this.api = new Player(iframe);
3748
+ const textTracksVideo = document.createElement("video");
3749
+ this.textTracks = textTracksVideo.textTracks;
3750
+ this.api.getTextTracks().then((vimeoTracks) => {
3751
+ vimeoTracks.forEach((t) => {
3752
+ textTracksVideo.addTextTrack(t.kind, t.label, t.language);
3753
+ });
3754
+ });
3755
+ this.textTracks.addEventListener("change", () => {
3756
+ const active = Array.from(this.textTracks).find((t) => t.mode === "showing");
3757
+ if (active) {
3758
+ this.api.enableTextTrack(active.language, active.kind);
3759
+ } else {
3760
+ this.api.disableTextTrack();
3761
+ }
3762
+ });
3763
+ const onceLoaded = () => {
3764
+ this.api.off("loaded", onceLoaded);
3765
+ onLoaded();
3766
+ };
3767
+ this.api.on("loaded", onceLoaded);
3768
+ this.api.on("bufferstart", () => {
3769
+ if (this.#paused) {
3770
+ this.#paused = false;
3771
+ this.dispatchEvent(new Event("play"));
3772
+ }
3773
+ this.dispatchEvent(new Event("waiting"));
3774
+ });
3775
+ this.api.on("play", () => {
3776
+ if (!this.#paused) return;
3777
+ this.#paused = false;
3778
+ this.dispatchEvent(new Event("play"));
3779
+ });
3780
+ this.api.on("playing", () => {
3781
+ this.#readyState = 3;
3782
+ this.#paused = false;
3783
+ this.dispatchEvent(new Event("playing"));
3784
+ });
3785
+ this.api.on("seeking", () => {
3786
+ this.#seeking = true;
3787
+ this.onSeeking();
3788
+ this.dispatchEvent(new Event("seeking"));
3789
+ });
3790
+ this.api.on("seeked", async () => {
3791
+ this.#seeking = false;
3792
+ this.#currentTime = await this.api.getCurrentTime().catch(() => this.#currentTime);
3793
+ this.dispatchEvent(new Event("seeked"));
3794
+ });
3795
+ this.api.on("pause", () => {
3796
+ this.#paused = true;
3797
+ this.dispatchEvent(new Event("pause"));
3798
+ });
3799
+ this.api.on("ended", () => {
3800
+ this.#paused = true;
3801
+ this.dispatchEvent(new Event("ended"));
3802
+ });
3803
+ this.api.on("ratechange", ({ playbackRate }) => {
3804
+ this.#playbackRate = playbackRate;
3805
+ this.dispatchEvent(new Event("ratechange"));
3806
+ });
3807
+ this.api.on("volumechange", async ({ volume }) => {
3808
+ this.#volume = volume;
3809
+ if (this.api) {
3810
+ this.#muted = await this.api.getMuted();
3811
+ }
3812
+ this.dispatchEvent(new Event("volumechange"));
3813
+ });
3814
+ this.api.on("durationchange", ({ duration }) => {
3815
+ this.#duration = duration;
3816
+ this.dispatchEvent(new Event("durationchange"));
3817
+ });
3818
+ this.api.on("timeupdate", ({ seconds }) => {
3819
+ const currentTime = Math.round(seconds * 100) / 100;
3820
+ this.#currentTime = currentTime;
3821
+ this.dispatchEvent(new Event("timeupdate"));
3822
+ });
3823
+ this.api.on("progress", ({ seconds }) => {
3824
+ this.#progress = seconds;
3825
+ this.dispatchEvent(new Event("progress"));
3826
+ });
3827
+ this.api.on("resize", ({ videoWidth, videoHeight }) => {
3828
+ this.#videoWidth = videoWidth;
3829
+ this.#videoHeight = videoHeight;
3830
+ this.dispatchEvent(new Event("resize"));
3831
+ });
3832
+ await this.loadComplete;
3833
+ }
3834
+ async attributeChangedCallback(attrName, oldValue, newValue) {
3835
+ if (oldValue === newValue) return;
3836
+ switch (attrName) {
3837
+ case "autoplay":
3838
+ case "controls":
3839
+ case "src": {
3840
+ this.load();
3841
+ return;
3842
+ }
3843
+ }
3844
+ await this.loadComplete;
3845
+ switch (attrName) {
3846
+ case "loop": {
3847
+ this.api.setLoop(this.loop);
3848
+ break;
3849
+ }
3850
+ }
3851
+ }
3852
+ async play() {
3853
+ var _a;
3854
+ this.#paused = false;
3855
+ this.dispatchEvent(new Event("play"));
3856
+ await this.loadComplete;
3857
+ try {
3858
+ await ((_a = this.api) == null ? void 0 : _a.play());
3859
+ } catch (error) {
3860
+ this.#paused = true;
3861
+ this.dispatchEvent(new Event("pause"));
3862
+ throw error;
3863
+ }
3864
+ }
3865
+ async pause() {
3866
+ var _a;
3867
+ await this.loadComplete;
3868
+ return (_a = this.api) == null ? void 0 : _a.pause();
3869
+ }
3870
+ get ended() {
3871
+ return this.#currentTime >= this.#duration;
3872
+ }
3873
+ get seeking() {
3874
+ return this.#seeking;
3875
+ }
3876
+ get readyState() {
3877
+ return this.#readyState;
3878
+ }
3879
+ get videoWidth() {
3880
+ return this.#videoWidth;
3881
+ }
3882
+ get videoHeight() {
3883
+ return this.#videoHeight;
3884
+ }
3885
+ get src() {
3886
+ return this.getAttribute("src");
3887
+ }
3888
+ set src(val) {
3889
+ if (this.src == val) return;
3890
+ this.setAttribute("src", val);
3891
+ }
3892
+ get paused() {
3893
+ return this.#paused;
3894
+ }
3895
+ get duration() {
3896
+ return this.#duration;
3897
+ }
3898
+ get autoplay() {
3899
+ return this.hasAttribute("autoplay");
3900
+ }
3901
+ set autoplay(val) {
3902
+ if (this.autoplay == val) return;
3903
+ this.toggleAttribute("autoplay", Boolean(val));
3904
+ }
3905
+ get buffered() {
3906
+ if (this.#progress > 0) {
3907
+ return createTimeRanges(0, this.#progress);
3908
+ }
3909
+ return createTimeRanges();
3910
+ }
3911
+ get controls() {
3912
+ return this.hasAttribute("controls");
3913
+ }
3914
+ set controls(val) {
3915
+ if (this.controls == val) return;
3916
+ this.toggleAttribute("controls", Boolean(val));
3917
+ }
3918
+ get currentTime() {
3919
+ return this.#currentTime;
3920
+ }
3921
+ set currentTime(val) {
3922
+ if (this.currentTime == val) return;
3923
+ this.#currentTime = val;
3924
+ this.loadComplete.then(() => {
3925
+ var _a;
3926
+ (_a = this.api) == null ? void 0 : _a.setCurrentTime(val).catch(() => {
3927
+ });
3928
+ });
3929
+ }
3930
+ get defaultMuted() {
3931
+ return this.hasAttribute("muted");
3932
+ }
3933
+ set defaultMuted(val) {
3934
+ if (this.defaultMuted == val) return;
3935
+ this.toggleAttribute("muted", Boolean(val));
3936
+ }
3937
+ get loop() {
3938
+ return this.hasAttribute("loop");
3939
+ }
3940
+ set loop(val) {
3941
+ if (this.loop == val) return;
3942
+ this.toggleAttribute("loop", Boolean(val));
3943
+ }
3944
+ get muted() {
3945
+ return this.#muted;
3946
+ }
3947
+ set muted(val) {
3948
+ if (this.muted == val) return;
3949
+ this.#muted = val;
3950
+ this.loadComplete.then(() => {
3951
+ var _a;
3952
+ (_a = this.api) == null ? void 0 : _a.setMuted(val).catch(() => {
3953
+ });
3954
+ });
3955
+ }
3956
+ get playbackRate() {
3957
+ return this.#playbackRate;
3958
+ }
3959
+ set playbackRate(val) {
3960
+ if (this.playbackRate == val) return;
3961
+ this.#playbackRate = val;
3962
+ this.loadComplete.then(() => {
3963
+ var _a;
3964
+ (_a = this.api) == null ? void 0 : _a.setPlaybackRate(val).catch(() => {
3965
+ });
3966
+ });
3967
+ }
3968
+ get playsInline() {
3969
+ return this.hasAttribute("playsinline");
3970
+ }
3971
+ set playsInline(val) {
3972
+ if (this.playsInline == val) return;
3973
+ this.toggleAttribute("playsinline", Boolean(val));
3974
+ }
3975
+ get poster() {
3976
+ return this.getAttribute("poster");
3977
+ }
3978
+ set poster(val) {
3979
+ if (this.poster == val) return;
3980
+ this.setAttribute("poster", `${val}`);
3981
+ }
3982
+ get volume() {
3983
+ return this.#volume;
3984
+ }
3985
+ set volume(val) {
3986
+ if (this.volume == val) return;
3987
+ this.#volume = val;
3988
+ this.loadComplete.then(() => {
3989
+ var _a;
3990
+ (_a = this.api) == null ? void 0 : _a.setVolume(val).catch(() => {
3991
+ });
3992
+ });
3993
+ }
3994
+ // This is a pattern to update property values that are set before
3995
+ // the custom element is upgraded.
3996
+ // https://web.dev/custom-elements-best-practices/#make-properties-lazy
3997
+ #upgradeProperty(prop) {
3998
+ if (Object.prototype.hasOwnProperty.call(this, prop)) {
3999
+ const value = this[prop];
4000
+ delete this[prop];
4001
+ this[prop] = value;
4002
+ }
4003
+ }
4004
+ }
4005
+ function serializeAttributes(attrs) {
4006
+ let html = "";
4007
+ for (const key in attrs) {
4008
+ const value = attrs[key];
4009
+ if (value === "") html += ` ${escapeHtml(key)}`;
4010
+ else html += ` ${escapeHtml(key)}="${escapeHtml(`${value}`)}"`;
4011
+ }
4012
+ return html;
4013
+ }
4014
+ function escapeHtml(str) {
4015
+ return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;").replace(/`/g, "&#x60;");
4016
+ }
4017
+ function serialize(props) {
4018
+ return String(new URLSearchParams(boolToBinary(props)));
4019
+ }
4020
+ function boolToBinary(props) {
4021
+ let p = {};
4022
+ for (let key in props) {
4023
+ let val = props[key];
4024
+ if (val === true || val === "") p[key] = 1;
4025
+ else if (val === false) p[key] = 0;
4026
+ else if (val != null) p[key] = val;
4027
+ }
4028
+ return p;
4029
+ }
4030
+ function namedNodeMapToObject(namedNodeMap) {
4031
+ let obj = {};
4032
+ for (let attr of namedNodeMap) {
4033
+ obj[attr.name] = attr.value;
4034
+ }
4035
+ return obj;
4036
+ }
4037
+ class PublicPromise extends Promise {
4038
+ constructor(executor = () => {
4039
+ }) {
4040
+ let res, rej;
4041
+ super((resolve, reject) => {
4042
+ executor(resolve, reject);
4043
+ res = resolve;
4044
+ rej = reject;
4045
+ });
4046
+ this.resolve = res;
4047
+ this.reject = rej;
4048
+ }
4049
+ }
4050
+ function createTimeRanges(start, end) {
4051
+ if (Array.isArray(start)) {
4052
+ return createTimeRangesObj(start);
4053
+ } else if (start == null || end == null || start === 0 && end === 0) {
4054
+ return createTimeRangesObj([[0, 0]]);
4055
+ }
4056
+ return createTimeRangesObj([[start, end]]);
4057
+ }
4058
+ function createTimeRangesObj(ranges) {
4059
+ Object.defineProperties(ranges, {
4060
+ start: {
4061
+ value: (i) => ranges[i][0]
4062
+ },
4063
+ end: {
4064
+ value: (i) => ranges[i][1]
4065
+ }
4066
+ });
4067
+ return ranges;
4068
+ }
4069
+ if (globalThis.customElements && !globalThis.customElements.get("vimeo-video")) {
4070
+ globalThis.customElements.define("vimeo-video", VimeoVideoElement);
4071
+ }
4072
+ var vimeo_video_element_default = VimeoVideoElement;
4073
+
4074
+ // ../../node_modules/ce-la-react/dist/ce-la-react.js
4075
+ var reservedReactProps = /* @__PURE__ */ new Set([
4076
+ "style",
4077
+ "children",
4078
+ "ref",
4079
+ "key",
4080
+ "suppressContentEditableWarning",
4081
+ "suppressHydrationWarning",
4082
+ "dangerouslySetInnerHTML"
4083
+ ]);
4084
+ var reactPropToAttrNameMap = {
4085
+ className: "class",
4086
+ htmlFor: "for"
4087
+ };
4088
+ function defaultToAttributeName(propName) {
4089
+ return propName.toLowerCase();
4090
+ }
4091
+ function defaultToAttributeValue(propValue) {
4092
+ if (typeof propValue === "boolean") return propValue ? "" : void 0;
4093
+ if (typeof propValue === "function") return void 0;
4094
+ if (typeof propValue === "object" && propValue !== null) return void 0;
4095
+ return propValue;
4096
+ }
4097
+ function createComponent({
4098
+ react: React2,
4099
+ tagName,
4100
+ elementClass,
4101
+ events,
4102
+ displayName,
4103
+ defaultProps,
4104
+ toAttributeName = defaultToAttributeName,
4105
+ toAttributeValue = defaultToAttributeValue
4106
+ }) {
4107
+ const IS_REACT_19_OR_NEWER = Number.parseInt(React2.version) >= 19;
4108
+ const ReactComponent = React2.forwardRef((props, ref) => {
4109
+ var _a, _b;
4110
+ const elementRef = React2.useRef(null);
4111
+ const prevElemPropsRef = React2.useRef(/* @__PURE__ */ new Map());
4112
+ const eventProps = {};
4113
+ const attrs = {};
4114
+ const reactProps = {};
4115
+ const elementProps = {};
4116
+ for (const [k, v] of Object.entries(props)) {
4117
+ if (reservedReactProps.has(k)) {
4118
+ reactProps[k] = v;
4119
+ continue;
4120
+ }
4121
+ const attrName = toAttributeName(reactPropToAttrNameMap[k] ?? k);
4122
+ if (elementClass.prototype && k in elementClass.prototype && !(k in (((_a = globalThis.HTMLElement) == null ? void 0 : _a.prototype) ?? {})) && !((_b = elementClass.observedAttributes) == null ? void 0 : _b.some((attr) => attr === attrName))) {
4123
+ elementProps[k] = v;
4124
+ continue;
4125
+ }
4126
+ if (k.startsWith("on")) {
4127
+ eventProps[k] = v;
4128
+ continue;
4129
+ }
4130
+ const attrValue = toAttributeValue(v);
4131
+ if (attrName && attrValue != null) {
4132
+ attrs[attrName] = String(attrValue);
4133
+ if (!IS_REACT_19_OR_NEWER) {
4134
+ reactProps[attrName] = attrValue;
4135
+ }
4136
+ }
4137
+ if (attrName && IS_REACT_19_OR_NEWER) {
4138
+ const attrValueFromDefault = defaultToAttributeValue(v);
4139
+ if (attrValue !== attrValueFromDefault) {
4140
+ reactProps[attrName] = attrValue;
4141
+ } else {
4142
+ reactProps[attrName] = v;
4143
+ }
4144
+ }
4145
+ }
4146
+ if (typeof window !== "undefined") {
4147
+ for (const propName in eventProps) {
4148
+ const callback = eventProps[propName];
4149
+ const useCapture = propName.endsWith("Capture");
4150
+ const eventName = ((events == null ? void 0 : events[propName]) ?? propName.slice(2).toLowerCase()).slice(
4151
+ 0,
4152
+ useCapture ? -7 : void 0
4153
+ );
4154
+ React2.useLayoutEffect(() => {
4155
+ const eventTarget = elementRef == null ? void 0 : elementRef.current;
4156
+ if (!eventTarget || typeof callback !== "function") return;
4157
+ eventTarget.addEventListener(eventName, callback, useCapture);
4158
+ return () => {
4159
+ eventTarget.removeEventListener(eventName, callback, useCapture);
4160
+ };
4161
+ }, [elementRef == null ? void 0 : elementRef.current, callback]);
4162
+ }
4163
+ React2.useLayoutEffect(() => {
4164
+ if (elementRef.current === null) return;
4165
+ const newElemProps = /* @__PURE__ */ new Map();
4166
+ for (const key in elementProps) {
4167
+ setProperty(elementRef.current, key, elementProps[key]);
4168
+ prevElemPropsRef.current.delete(key);
4169
+ newElemProps.set(key, elementProps[key]);
4170
+ }
4171
+ for (const [key, _value] of prevElemPropsRef.current) {
4172
+ setProperty(elementRef.current, key, void 0);
4173
+ }
4174
+ prevElemPropsRef.current = newElemProps;
4175
+ });
4176
+ }
4177
+ if (typeof window === "undefined" && (elementClass == null ? void 0 : elementClass.getTemplateHTML) && (elementClass == null ? void 0 : elementClass.shadowRootOptions)) {
4178
+ const { mode, delegatesFocus } = elementClass.shadowRootOptions;
4179
+ const templateShadowRoot = React2.createElement("template", {
4180
+ shadowrootmode: mode,
4181
+ shadowrootdelegatesfocus: delegatesFocus,
4182
+ dangerouslySetInnerHTML: {
4183
+ __html: elementClass.getTemplateHTML(attrs, props)
4184
+ },
4185
+ key: "ce-la-react-ssr-template-shadow-root"
4186
+ });
4187
+ reactProps.children = [templateShadowRoot, reactProps.children];
4188
+ }
4189
+ return React2.createElement(tagName, {
4190
+ ...defaultProps,
4191
+ ...reactProps,
4192
+ ref: React2.useCallback(
4193
+ (node) => {
4194
+ elementRef.current = node;
4195
+ if (typeof ref === "function") {
4196
+ ref(node);
4197
+ } else if (ref !== null) {
4198
+ ref.current = node;
4199
+ }
4200
+ },
4201
+ [ref]
4202
+ )
4203
+ }, reactProps.children);
4204
+ });
4205
+ ReactComponent.displayName = displayName ?? elementClass.name;
4206
+ return ReactComponent;
4207
+ }
4208
+ function setProperty(node, name, value) {
4209
+ var _a;
4210
+ node[name] = value;
4211
+ if (value == null && name in (((_a = globalThis.HTMLElement) == null ? void 0 : _a.prototype) ?? {})) {
4212
+ node.removeAttribute(name);
4213
+ }
4214
+ }
4215
+
4216
+ // dist/react.ts
4217
+ var react_default = createComponent({
4218
+ react: React,
4219
+ tagName: "vimeo-video",
4220
+ elementClass: vimeo_video_element_default,
4221
+ toAttributeName(propName) {
4222
+ if (propName === "muted") return "";
4223
+ if (propName === "defaultMuted") return "muted";
4224
+ return defaultToAttributeName(propName);
4225
+ }
4226
+ });
4227
+ /*! Bundled license information:
4228
+
4229
+ ce-la-react/dist/ce-la-react.js:
4230
+ (**
4231
+ * @license
4232
+ * Copyright 2018 Google LLC
4233
+ * SPDX-License-Identifier: BSD-3-Clause
4234
+ *
4235
+ * Modified version of `@lit/react` for vanilla custom elements with support for SSR.
4236
+ *)
4237
+ */
4238
+
4239
+ exports.default = react_default;