@behold/widget 0.5.55 → 0.5.57

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export{W as widget}from"./index-EcHlmDLY.js";
1
+ export { W as widget } from './index-R4lEDZFo.js';
@@ -0,0 +1,454 @@
1
+ var e,
2
+ t = [],
3
+ n = 'ResizeObserver loop completed with undelivered notifications.';
4
+ !(function (e) {
5
+ (e.BORDER_BOX = 'border-box'),
6
+ (e.CONTENT_BOX = 'content-box'),
7
+ (e.DEVICE_PIXEL_CONTENT_BOX = 'device-pixel-content-box');
8
+ })(e || (e = {}));
9
+ var r,
10
+ i = function (e) {
11
+ return Object.freeze(e)
12
+ },
13
+ o = function (e, t) {
14
+ (this.inlineSize = e), (this.blockSize = t), i(this);
15
+ },
16
+ s = (function () {
17
+ function e(e, t, n, r) {
18
+ return (
19
+ (this.x = e),
20
+ (this.y = t),
21
+ (this.width = n),
22
+ (this.height = r),
23
+ (this.top = this.y),
24
+ (this.left = this.x),
25
+ (this.bottom = this.top + this.height),
26
+ (this.right = this.left + this.width),
27
+ i(this)
28
+ )
29
+ }
30
+ return (
31
+ (e.prototype.toJSON = function () {
32
+ var e = this;
33
+ return {
34
+ x: e.x,
35
+ y: e.y,
36
+ top: e.top,
37
+ right: e.right,
38
+ bottom: e.bottom,
39
+ left: e.left,
40
+ width: e.width,
41
+ height: e.height,
42
+ }
43
+ }),
44
+ (e.fromRect = function (t) {
45
+ return new e(t.x, t.y, t.width, t.height)
46
+ }),
47
+ e
48
+ )
49
+ })(),
50
+ a = function (e) {
51
+ return e instanceof SVGElement && 'getBBox' in e
52
+ },
53
+ c = function (e) {
54
+ if (a(e)) {
55
+ var t = e.getBBox(),
56
+ n = t.width,
57
+ r = t.height;
58
+ return !n && !r
59
+ }
60
+ var i = e,
61
+ o = i.offsetWidth,
62
+ s = i.offsetHeight;
63
+ return !(o || s || e.getClientRects().length)
64
+ },
65
+ u = function (e) {
66
+ var t;
67
+ if (e instanceof Element) return !0
68
+ var n =
69
+ null === (t = null == e ? void 0 : e.ownerDocument) || void 0 === t
70
+ ? void 0
71
+ : t.defaultView;
72
+ return !!(n && e instanceof n.Element)
73
+ },
74
+ h = 'undefined' != typeof window ? window : {},
75
+ f = new WeakMap(),
76
+ d = /auto|scroll/,
77
+ v = /^tb|vertical/,
78
+ l = /msie|trident/i.test(h.navigator && h.navigator.userAgent),
79
+ p = function (e) {
80
+ return parseFloat(e || '0')
81
+ },
82
+ g = function (e, t, n) {
83
+ return (
84
+ void 0 === e && (e = 0),
85
+ void 0 === t && (t = 0),
86
+ void 0 === n && (n = !1),
87
+ new o((n ? t : e) || 0, (n ? e : t) || 0)
88
+ )
89
+ },
90
+ b = i({
91
+ devicePixelContentBoxSize: g(),
92
+ borderBoxSize: g(),
93
+ contentBoxSize: g(),
94
+ contentRect: new s(0, 0, 0, 0),
95
+ }),
96
+ w = function (e, t) {
97
+ if ((void 0 === t && (t = !1), f.has(e) && !t)) return f.get(e)
98
+ if (c(e)) return f.set(e, b), b
99
+ var n = getComputedStyle(e),
100
+ r = a(e) && e.ownerSVGElement && e.getBBox(),
101
+ o = !l && 'border-box' === n.boxSizing,
102
+ u = v.test(n.writingMode || ''),
103
+ h = !r && d.test(n.overflowY || ''),
104
+ w = !r && d.test(n.overflowX || ''),
105
+ x = r ? 0 : p(n.paddingTop),
106
+ E = r ? 0 : p(n.paddingRight),
107
+ T = r ? 0 : p(n.paddingBottom),
108
+ m = r ? 0 : p(n.paddingLeft),
109
+ y = r ? 0 : p(n.borderTopWidth),
110
+ z = r ? 0 : p(n.borderRightWidth),
111
+ B = r ? 0 : p(n.borderBottomWidth),
112
+ S = m + E,
113
+ O = x + T,
114
+ R = (r ? 0 : p(n.borderLeftWidth)) + z,
115
+ C = y + B,
116
+ k = w ? e.offsetHeight - C - e.clientHeight : 0,
117
+ N = h ? e.offsetWidth - R - e.clientWidth : 0,
118
+ D = o ? S + R : 0,
119
+ M = o ? O + C : 0,
120
+ P = r ? r.width : p(n.width) - D - N,
121
+ _ = r ? r.height : p(n.height) - M - k,
122
+ F = P + S + N + R,
123
+ I = _ + O + k + C,
124
+ L = i({
125
+ devicePixelContentBoxSize: g(
126
+ Math.round(P * devicePixelRatio),
127
+ Math.round(_ * devicePixelRatio),
128
+ u,
129
+ ),
130
+ borderBoxSize: g(F, I, u),
131
+ contentBoxSize: g(P, _, u),
132
+ contentRect: new s(m, x, P, _),
133
+ });
134
+ return f.set(e, L), L
135
+ },
136
+ x = function (t, n, r) {
137
+ var i = w(t, r),
138
+ o = i.borderBoxSize,
139
+ s = i.contentBoxSize,
140
+ a = i.devicePixelContentBoxSize;
141
+ switch (n) {
142
+ case e.DEVICE_PIXEL_CONTENT_BOX:
143
+ return a
144
+ case e.BORDER_BOX:
145
+ return o
146
+ default:
147
+ return s
148
+ }
149
+ },
150
+ E = function (e) {
151
+ var t = w(e)
152
+ ;(this.target = e),
153
+ (this.contentRect = t.contentRect),
154
+ (this.borderBoxSize = i([t.borderBoxSize])),
155
+ (this.contentBoxSize = i([t.contentBoxSize])),
156
+ (this.devicePixelContentBoxSize = i([t.devicePixelContentBoxSize]));
157
+ },
158
+ T = function (e) {
159
+ if (c(e)) return 1 / 0
160
+ for (var t = 0, n = e.parentNode; n; ) (t += 1), (n = n.parentNode);
161
+ return t
162
+ },
163
+ m = function () {
164
+ var e = 1 / 0,
165
+ n = [];
166
+ t.forEach(function (t) {
167
+ if (0 !== t.activeTargets.length) {
168
+ var r = [];
169
+ t.activeTargets.forEach(function (t) {
170
+ var n = new E(t.target),
171
+ i = T(t.target);
172
+ r.push(n),
173
+ (t.lastReportedSize = x(t.target, t.observedBox)),
174
+ i < e && (e = i);
175
+ }),
176
+ n.push(function () {
177
+ t.callback.call(t.observer, r, t.observer);
178
+ }),
179
+ t.activeTargets.splice(0, t.activeTargets.length);
180
+ }
181
+ });
182
+ for (var r = 0, i = n; r < i.length; r++) {
183
+ (0, i[r])();
184
+ }
185
+ return e
186
+ },
187
+ y = function (e) {
188
+ t.forEach(function (t) {
189
+ t.activeTargets.splice(0, t.activeTargets.length),
190
+ t.skippedTargets.splice(0, t.skippedTargets.length),
191
+ t.observationTargets.forEach(function (n) {
192
+ n.isActive() &&
193
+ (T(n.target) > e
194
+ ? t.activeTargets.push(n)
195
+ : t.skippedTargets.push(n));
196
+ });
197
+ });
198
+ },
199
+ z = function () {
200
+ var e,
201
+ r = 0;
202
+ for (
203
+ y(r);
204
+ t.some(function (e) {
205
+ return e.activeTargets.length > 0
206
+ });
207
+
208
+ )
209
+ (r = m()), y(r);
210
+ return (
211
+ t.some(function (e) {
212
+ return e.skippedTargets.length > 0
213
+ }) &&
214
+ ('function' == typeof ErrorEvent
215
+ ? (e = new ErrorEvent('error', { message: n }))
216
+ : ((e = document.createEvent('Event')).initEvent('error', !1, !1),
217
+ (e.message = n)),
218
+ window.dispatchEvent(e)),
219
+ r > 0
220
+ )
221
+ },
222
+ B = [],
223
+ S = function (e) {
224
+ if (!r) {
225
+ var t = 0,
226
+ n = document.createTextNode('');
227
+ new MutationObserver(function () {
228
+ return B.splice(0).forEach(function (e) {
229
+ return e()
230
+ })
231
+ }).observe(n, { characterData: !0 }),
232
+ (r = function () {
233
+ n.textContent = ''.concat(t ? t-- : t++);
234
+ });
235
+ }
236
+ B.push(e), r();
237
+ },
238
+ O = 0,
239
+ R = { attributes: !0, characterData: !0, childList: !0, subtree: !0 },
240
+ C = [
241
+ 'resize',
242
+ 'load',
243
+ 'transitionend',
244
+ 'animationend',
245
+ 'animationstart',
246
+ 'animationiteration',
247
+ 'keyup',
248
+ 'keydown',
249
+ 'mouseup',
250
+ 'mousedown',
251
+ 'mouseover',
252
+ 'mouseout',
253
+ 'blur',
254
+ 'focus',
255
+ ],
256
+ k = function (e) {
257
+ return void 0 === e && (e = 0), Date.now() + e
258
+ },
259
+ N = !1,
260
+ D = new ((function () {
261
+ function e() {
262
+ var e = this
263
+ ;(this.stopped = !0),
264
+ (this.listener = function () {
265
+ return e.schedule()
266
+ });
267
+ }
268
+ return (
269
+ (e.prototype.run = function (e) {
270
+ var t = this;
271
+ if ((void 0 === e && (e = 250), !N)) {
272
+ N = !0;
273
+ var n,
274
+ r = k(e)
275
+ ;(n = function () {
276
+ var n = !1;
277
+ try {
278
+ n = z();
279
+ } finally {
280
+ if (((N = !1), (e = r - k()), !O)) return
281
+ n ? t.run(1e3) : e > 0 ? t.run(e) : t.start();
282
+ }
283
+ }),
284
+ S(function () {
285
+ requestAnimationFrame(n);
286
+ });
287
+ }
288
+ }),
289
+ (e.prototype.schedule = function () {
290
+ this.stop(), this.run();
291
+ }),
292
+ (e.prototype.observe = function () {
293
+ var e = this,
294
+ t = function () {
295
+ return e.observer && e.observer.observe(document.body, R)
296
+ };
297
+ document.body ? t() : h.addEventListener('DOMContentLoaded', t);
298
+ }),
299
+ (e.prototype.start = function () {
300
+ var e = this;
301
+ this.stopped &&
302
+ ((this.stopped = !1),
303
+ (this.observer = new MutationObserver(this.listener)),
304
+ this.observe(),
305
+ C.forEach(function (t) {
306
+ return h.addEventListener(t, e.listener, !0)
307
+ }));
308
+ }),
309
+ (e.prototype.stop = function () {
310
+ var e = this;
311
+ this.stopped ||
312
+ (this.observer && this.observer.disconnect(),
313
+ C.forEach(function (t) {
314
+ return h.removeEventListener(t, e.listener, !0)
315
+ }),
316
+ (this.stopped = !0));
317
+ }),
318
+ e
319
+ )
320
+ })())(),
321
+ M = function (e) {
322
+ !O && e > 0 && D.start(), !(O += e) && D.stop();
323
+ },
324
+ P = (function () {
325
+ function t(t, n) {
326
+ (this.target = t),
327
+ (this.observedBox = n || e.CONTENT_BOX),
328
+ (this.lastReportedSize = { inlineSize: 0, blockSize: 0 });
329
+ }
330
+ return (
331
+ (t.prototype.isActive = function () {
332
+ var e,
333
+ t = x(this.target, this.observedBox, !0);
334
+ return (
335
+ (e = this.target),
336
+ a(e) ||
337
+ (function (e) {
338
+ switch (e.tagName) {
339
+ case 'INPUT':
340
+ if ('image' !== e.type) break
341
+ case 'VIDEO':
342
+ case 'AUDIO':
343
+ case 'EMBED':
344
+ case 'OBJECT':
345
+ case 'CANVAS':
346
+ case 'IFRAME':
347
+ case 'IMG':
348
+ return !0
349
+ }
350
+ return !1
351
+ })(e) ||
352
+ 'inline' !== getComputedStyle(e).display ||
353
+ (this.lastReportedSize = t),
354
+ this.lastReportedSize.inlineSize !== t.inlineSize ||
355
+ this.lastReportedSize.blockSize !== t.blockSize
356
+ )
357
+ }),
358
+ t
359
+ )
360
+ })(),
361
+ _ = function (e, t) {
362
+ (this.activeTargets = []),
363
+ (this.skippedTargets = []),
364
+ (this.observationTargets = []),
365
+ (this.observer = e),
366
+ (this.callback = t);
367
+ },
368
+ F = new WeakMap(),
369
+ I = function (e, t) {
370
+ for (var n = 0; n < e.length; n += 1) if (e[n].target === t) return n
371
+ return -1
372
+ },
373
+ L = (function () {
374
+ function e() {}
375
+ return (
376
+ (e.connect = function (e, t) {
377
+ var n = new _(e, t);
378
+ F.set(e, n);
379
+ }),
380
+ (e.observe = function (e, n, r) {
381
+ var i = F.get(e),
382
+ o = 0 === i.observationTargets.length;
383
+ I(i.observationTargets, n) < 0 &&
384
+ (o && t.push(i),
385
+ i.observationTargets.push(new P(n, r && r.box)),
386
+ M(1),
387
+ D.schedule());
388
+ }),
389
+ (e.unobserve = function (e, n) {
390
+ var r = F.get(e),
391
+ i = I(r.observationTargets, n),
392
+ o = 1 === r.observationTargets.length;
393
+ i >= 0 &&
394
+ (o && t.splice(t.indexOf(r), 1),
395
+ r.observationTargets.splice(i, 1),
396
+ M(-1));
397
+ }),
398
+ (e.disconnect = function (e) {
399
+ var t = this,
400
+ n = F.get(e);
401
+ n.observationTargets.slice().forEach(function (n) {
402
+ return t.unobserve(e, n.target)
403
+ }),
404
+ n.activeTargets.splice(0, n.activeTargets.length);
405
+ }),
406
+ e
407
+ )
408
+ })(),
409
+ W = (function () {
410
+ function e(e) {
411
+ if (0 === arguments.length)
412
+ throw new TypeError(
413
+ "Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.",
414
+ )
415
+ if ('function' != typeof e)
416
+ throw new TypeError(
417
+ "Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.",
418
+ )
419
+ L.connect(this, e);
420
+ }
421
+ return (
422
+ (e.prototype.observe = function (e, t) {
423
+ if (0 === arguments.length)
424
+ throw new TypeError(
425
+ "Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.",
426
+ )
427
+ if (!u(e))
428
+ throw new TypeError(
429
+ "Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element",
430
+ )
431
+ L.observe(this, e, t);
432
+ }),
433
+ (e.prototype.unobserve = function (e) {
434
+ if (0 === arguments.length)
435
+ throw new TypeError(
436
+ "Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.",
437
+ )
438
+ if (!u(e))
439
+ throw new TypeError(
440
+ "Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element",
441
+ )
442
+ L.unobserve(this, e);
443
+ }),
444
+ (e.prototype.disconnect = function () {
445
+ L.disconnect(this);
446
+ }),
447
+ (e.toString = function () {
448
+ return 'function ResizeObserver () { [polyfill code] }'
449
+ }),
450
+ e
451
+ )
452
+ })();
453
+
454
+ export { W as ResizeObserver, E as ResizeObserverEntry, o as ResizeObserverSize };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@behold/widget",
3
- "version": "0.5.55",
3
+ "version": "0.5.57",
4
4
  "author": "Griffin Johnston",
5
5
  "license": "UNLICENSED",
6
6
  "keywords": [
@@ -1 +0,0 @@
1
- import{t,g as e,c as i,s,f as o,p as r,a,B as h,V as n,I as l,b as d,R as c,d as p,e as u,h as b,i as m}from"./index-EcHlmDLY.js";let g=document,v=null,x=new Set,f=new Set,_=new MutationObserver((function(t){t.some((t=>"attributes"===t.type||!![...t.addedNodes,...t.removedNodes].some((t=>w(t).length>0))))&&E({include:[v],merge:!0})})),y=!1;function w(t){const e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:function(t){return t.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),i=[];let s=null;for(;s=e.nextNode();)i.push(s);return i}async function k(){return(await Promise.all([...x].map((async t=>!!await function(t){return new Promise((async e=>{if(t.disabled)return void e(!1);const i=await function(t){return new Promise((e=>{const i=new IntersectionObserver((t=>{e(t[0].isIntersecting),i.disconnect()}));i.observe(t)}))}(t);e(!!i&&[...f].every((e=>!e.contains(t))))}))}(t)&&t)))).filter((t=>!!t))}function C(t){!["Tab"].includes(t.code)||t.ctrlKey||t.altKey||t.metaKey||(t.preventDefault(),"Tab"===t.code&&t.shiftKey?async function(){const t=await k();let e=t.indexOf(g.activeElement)-1;e<0&&(e=t.length-1),t[e]?.focus()}():async function(){const t=await k();let e=t.indexOf(g.activeElement)+1;(e>t.length-1||e<0)&&(e=0),t[e]?.focus()}())}function E({include:t=[],exclude:e=[],merge:i=!1}){i?(t.forEach((t=>{f.delete(t),w(t).forEach((t=>{x.has(t)||x.add(t)}))})),e.forEach((t=>f.add(t)))):(x=new Set(t.flatMap((t=>w(t)))),f=new Set(e))}function z(t){y&&(y=!1,t=t??document.body,document.removeEventListener("keydown",C),_.disconnect(),x.clear(),f.clear(),v=null,t&&t.focus())}class S{containerEl;slides;breadcrumbsContainerEl;previousEl;nextEl;keyboardNav;breadcrumbDiameter;onSlideChange;virtualize;proximalSlidesToRender;dynamicBreadCrumbsCutoff;dragLimit;transitionSpeed;baseTransition;momentumToTransition;index;t;i=document;o;h;l;p;u;m;v;_;k;C;S;M;D;L;P;F;A;$;O;T;R;B;constructor({slides:e,containerEl:i,breadcrumbsContainerEl:s,previousEl:o,nextEl:r,onSlideChange:a,breadcrumbDiameter:h=7,dynamicBreadCrumbsCutoff:n=10,keyboardNav:l=!0,dragLimit:d=.5,virtualize:c=!1,proximalSlidesToRender:p=1,momentumToTransition:u=5,transitionSpeed:b=300,baseTransition:m=""}){let g=window.ResizeObserver;"ResizeObserver"in window==0&&(g=window.BeholdResizeObserver),this.slides=e,this.containerEl=i,this.breadcrumbsContainerEl=s,this.previousEl=o,this.nextEl=r,this.onSlideChange=a,this.breadcrumbDiameter=h,this.dynamicBreadCrumbsCutoff=n,this.keyboardNav=l,this.dragLimit=d,this.virtualize=c,this.proximalSlidesToRender=p,this.transitionSpeed=b,this.baseTransition=m,this.momentumToTransition=u,this.index=0,this.t=!1,this.o=null,this.h=null,this.u=null,this.m=null,this._=null,this.k=null,this.C=!1,this.S=null,this.M={x:0,y:0},this.D={x:0,y:0},this.P=0,this.F=0,this.A=0,this.$=0,this.O=[],this.T=new g((t=>this.B(t))),this.init=this.init.bind(this),this.destroy=this.destroy.bind(this),this.j=this.j.bind(this),this.I=this.I.bind(this),this.U=this.U.bind(this),this.V=this.V.bind(this),this.H=this.H.bind(this),this.N=this.N.bind(this),this.q=this.q.bind(this),this.X=this.X.bind(this),this.R=t(this.G,10,this),this.B=t(this.Z,100,this),this.K=this.K.bind(this),this.Y=this.Y.bind(this),this.J=this.J.bind(this),this.W=this.W.bind(this),this.tt=this.tt.bind(this),this.et=this.et.bind(this),this.it=this.it.bind(this),this.st=this.st.bind(this)}it(){this.o.addEventListener("mousedown",this.K,{passive:!0}),this.o.addEventListener("touchstart",this.Y,{passive:!0}),document.body.addEventListener("mousemove",this.q,{passive:!0}),document.body.addEventListener("mouseup",this.W,{passive:!0}),document.body.addEventListener("mouseleave",this.W,{passive:!0}),document.body.addEventListener("touchmove",this.X,{passive:!0}),document.body.addEventListener("touchend",this.W,{passive:!0}),this.previousEl&&this.previousEl.addEventListener("click",this.V,{passive:!0}),this.nextEl&&this.nextEl.addEventListener("click",this.H,{passive:!0}),this.keyboardNav&&document.addEventListener("keydown",this.N)}st(){document.body.removeEventListener("mousemove",this.q),document.body.removeEventListener("mouseup",this.W),document.body.removeEventListener("mouseleave",this.W),document.body.removeEventListener("touchmove",this.X),document.body.removeEventListener("touchend",this.W),this.o&&(this.o.removeEventListener("mousedown",this.K),this.o.removeEventListener("touchstart",this.Y)),this.previousEl&&this.previousEl.removeEventListener("click",this.V),this.nextEl&&this.nextEl.removeEventListener("click",this.H),this.keyboardNav&&document.removeEventListener("keydown",this.N)}init(t=0){this.t||(this.t=!0,this.i=e(this.containerEl),this.h=this.slides.map((t=>i({classes:"hg-slide",contents:t}))),this.u=this.slides.map(((t,e)=>i({classes:"hg-breadcrumb",listeners:{click:()=>this.j({index:e})}}))),this.p=i({classes:"hg-breadcrumbs-current"}),this.l=i({classes:"hg-breadcrumbs",contents:[...this.u,this.p]}),this.o=i({classes:"hg-container",contents:this.h,style:{"touch-action":"pan-y"}}),this.containerEl.appendChild(this.o),this.breadcrumbsContainerEl&&(this.breadcrumbsContainerEl.style.setProperty("--breadCrumbDiameter",this.breadcrumbDiameter+"px"),this.breadcrumbsContainerEl.appendChild(this.l)),this.it(),this.slides.length<2&&(this.l.style.display="none",this.previousEl.style.display="none",this.nextEl.style.display="none"),this.T?.observe(this.containerEl),this.tt(this.index,this.index,!1),this.j({index:t,animate:!1,forceUpdate:!0,isInitial:!0}))}destroy(){this.t&&(clearTimeout(this._),clearTimeout(this.k),cancelAnimationFrame(this.m),cancelAnimationFrame(this.v),this.T.disconnect(),this.st(),this.u=null,this.p=null,this.l.remove(),this.l=null,this.o.remove(),this.o=null,this.i=null,this.h=null,this.t=!1)}Z(t){t?.[0]&&(this.L=M(this.containerEl,this.h))}et(t,e=!0){if(this.u.length>=this.dynamicBreadCrumbsCutoff&&this.breadcrumbsContainerEl){s(this.l,{"no-transition":!e}),requestAnimationFrame((()=>{this.l.classList.remove("no-transition")}));const i=this.l.offsetWidth/2-this.breadcrumbDiameter/2-this.u[t].offsetLeft;this.l.style.transform=`translateX(${i}px)`,this.u.forEach(((e,i)=>{s(e,{"hg-breadcrumb--hidden":i<=t-5||i>=t+5,"hg-breadcrumb--4":i===t-4||i===t+4,"hg-breadcrumb--3":i===t-3||i===t+3,"hg-breadcrumb--2":i===t-2||i===t+2,"hg-breadcrumb--1":i===t-1||i===t+1})}))}}tt(t,e,i){this.u?.length&&(this.et(t,i),this.breadcrumbsContainerEl&&(!i||this.u.length>=10&&Math.abs(t-e)>1?t>e?(this.p.style.left="",this.p.style.right=this.l.offsetWidth-(this.u[t].offsetLeft+this.breadcrumbDiameter)+"px"):(this.p.style.right="",this.p.style.left=this.u[t].offsetLeft+"px"):(t<e?(this.p.style.left="",this.p.style.right=this.l.offsetWidth-this.u[e]?.offsetLeft-this.breadcrumbDiameter+"px"):(this.p.style.right="",this.p.style.left=this.u[e]?.offsetLeft+"px"),o(),this.m=requestAnimationFrame((()=>{this.p.style.width=t>e?`${this.u[t]?.offsetLeft-this.p.offsetLeft+this.breadcrumbDiameter}px`:this.p.offsetLeft+this.p.offsetWidth-this.u[t]?.offsetLeft+"px"})),this._=setTimeout((()=>{t>e?(this.p.style.left="",this.p.style.right=this.l.offsetWidth-(this.u[t].offsetLeft+this.breadcrumbDiameter)+"px"):(this.p.style.right="",this.p.style.left=this.u[t].offsetLeft+"px"),o(),this.m=requestAnimationFrame((()=>{this.p.style.width=""}))}),200))))}j({index:t,animate:e=!0,forceUpdate:i=!1,easing:s="ease",isInitial:o=!1}){if(!this.h?.[t])return;if(!this.t)return;cancelAnimationFrame(this.v);const r=t,a=this.index;this.index=r,clearTimeout(this.k),this.virtualize&&this.h.forEach(((t,e)=>{Math.abs(this.index-e)>this.proximalSlidesToRender&&e!==a?t.hasChildNodes()&&t.beholdReplaceChildren():t.hasChildNodes()||t.beholdReplaceChildren(this.slides[e])})),window.matchMedia("(prefers-reduced-motion)").matches&&(e=!1),this.C=!1,this.A=0,r!==a||i?(cancelAnimationFrame(this.m),clearTimeout(this._),this.tt(r,a,e),this.onSlideChange&&this.onSlideChange(r,o)):this.p.style.width="",this.o.style.transition=e?`transform ${this.transitionSpeed}ms ${s}`:this.baseTransition,this.o.style.transform=`translateX(${-100*r}%)`,this.F=-100*r,this.previousEl&&(r<1?(this.i.activeElement===this.previousEl&&(this.v=requestAnimationFrame((()=>{this.nextEl.focus()}))),this.previousEl.setAttribute("disabled","true")):this.previousEl.removeAttribute("disabled")),this.nextEl&&(r>=this.h.length-1?(this.i.activeElement===this.nextEl&&(this.v=requestAnimationFrame((()=>{this.previousEl.focus()}))),this.nextEl.setAttribute("disabled","true")):this.nextEl.removeAttribute("disabled")),this.k=setTimeout((()=>{this.o.style.transition=this.baseTransition}),this.transitionSpeed)}V(){this.I()}H(){this.U()}I(t="ease"){"string"!=typeof t&&(t="ease"),this.index<1?this.j({index:this.index}):this.j({index:this.index-1,easing:t})}U(t="ease"){"string"!=typeof t&&(t="ease"),this.index>=this.h.length-1?this.j({index:this.index}):this.j({index:this.index+1,easing:t})}N(t){"ArrowRight"===t.code&&(t.preventDefault(),this.U()),"ArrowLeft"===t.code&&(t.preventDefault(),this.I())}K(t){t.stopPropagation(),t.button>0||this.J({x:t.clientX,y:t.clientY})}Y(t){t.stopPropagation(),this.J({x:t.touches.item(0).clientX,y:t.touches.item(0).clientY})}J(t){this.slides.length<2||!this.t||(this.C=!0,clearTimeout(this.k),cancelAnimationFrame(this.m),this.L=M(this.containerEl,this.h),this.P=this.L.leftDelta,this.F=this.P/this.L.parent.width*100,this.o.style.transform=`translateX(${this.F}%)`,this.o.style.transition=this.baseTransition,this.A=0,this.p.style.transition="none",this.M=t,this.D=t,this.$=0,this.O=[])}G(t,e=!1){if(this.slides.length<2||!this.C||!this.t)return;const i=t.x-this.D.x;this.L={...this.L,leftDelta:this.L.leftDelta+i,rightDelta:this.L.rightDelta+i};const s=this.L.parent.width*this.dragLimit;r(this.O,i,5),this.D=t;const o=this.L.leftDelta>0||this.L.rightDelta<0;if(o){const t=function(t,e,i,s=.125){return t*(1-(Math.abs(e)/Math.abs(i))**s)}(i,this.$,this.L.parent.width);this.$=this.$+t}else this.$=this.$+i;let a=t.x-this.M.x,h=t.y-this.M.y,n=Math.abs(h)/Math.abs(a);if(e&&n>.85)return void this.W();this.A=Math.abs(a/s),i<0&&(this.S="left"),i>0&&(this.S="right");const l=this.P+this.$;this.F=l/this.L.parent.width*100,this.$<0&&(this.p.style.right="",this.p.style.left=`${this.u[this.index].offsetLeft}px`),this.$>0&&(this.p.style.left="",this.p.style.right=this.l.offsetWidth-(this.u[this.index].offsetLeft+this.breadcrumbDiameter)+"px"),this.p.style.width=o?`${this.breadcrumbDiameter+Math.abs(4*this.breadcrumbDiameter*(this.F+100*this.index)/100)}px`:`${Math.min(2.75*this.breadcrumbDiameter,this.breadcrumbDiameter+Math.abs(4*this.breadcrumbDiameter*(this.F+100*this.index)/100))}px`,this.o.style.transform=`translateX(${this.F}%)`,this.o.style.transition=this.baseTransition}q(t){this.R({x:t.clientX,y:t.clientY},!1)}X(t){this.R({x:t.touches.item(0).clientX,y:t.touches.item(0).clientY},!0)}W(){var t;this.C=!1,this.p.style.transition="",this.o.style.transition=this.baseTransition,this.M={x:0,y:0},this.D={x:0,y:0},this.$=0;let e=null;switch(t=this.O,(Math.abs(t.reduce(((t,e)=>t+e),0)/t.length)>this.momentumToTransition||this.A>=1)&&(this.F+100*this.index<0&&"left"===this.S&&(e="advance"),this.F+100*this.index>0&&"right"===this.S&&(e="retreat")),e){case"advance":this.m=requestAnimationFrame((()=>this.U("cubic-bezier(0.25, .25, 0.5, 1)")));break;case"retreat":this.m=requestAnimationFrame((()=>this.I("cubic-bezier(0.25, .25, 0.5, 1)")));break;default:this.m=requestAnimationFrame((()=>this.j({index:this.index})))}this.S=null,this.O=[]}}function M(t,e){if(!t||!e?.length)return;const i=t.getBoundingClientRect(),s=e[0].getBoundingClientRect(),o=e[e.length-1].getBoundingClientRect();return{parent:i,firstSlide:s,lastSlide:o,leftDelta:s.left-i.left,rightDelta:o.right-i.right}}class D{slides;containerEl;onSlideChange;onRequestClose;t;ot;rt;o;ht;nt;constructor({slides:e,containerEl:i,onSlideChange:s,onRequestClose:o=null}){this.slides=e,this.containerEl=i,this.onSlideChange=s,this.onRequestClose=o,this.init=this.init.bind(this),this.destroy=this.destroy.bind(this),this.t=!1,this.ot=null,this.rt=null,this.o=null,this.lt=this.lt.bind(this),this.ht=t(this.dt,200,this)}init(t=0){this.t||(this.t=!0,this.o=i({classes:L("inner"),contents:this.slides}),this.rt=i({classes:L("container"),contents:this.o}),this.containerEl.appendChild(this.rt),this.rt.addEventListener("click",this.lt),this.rt.addEventListener("scroll",this.ht,{passive:!0}),this.j({index:t,animate:!1}))}destroy(){this.t&&(cancelAnimationFrame(this.nt),this.t=!1,this.rt.removeEventListener("click",this.lt),this.rt.removeEventListener("scroll",this.ht),this.rt.remove(),this.rt=null,this.o=null)}dt(){a(this.slides).then((t=>{this.ot!==t&&(this.ot=t,this.onSlideChange&&this.onSlideChange(this.ot))}))}lt(t){t.target===this.rt&&this.onRequestClose&&this.onRequestClose()}j({index:t,animate:e=!0}){cancelAnimationFrame(this.nt),this.slides?.[t]&&(this.ot=t,this.onSlideChange&&this.onSlideChange(this.ot),this.nt=requestAnimationFrame((()=>{const i=this.slides[t].offsetTop;this.rt?.scrollTo({top:i-10,behavior:e?"smooth":"instant"})})))}}function L(t){return"behold-ps-"+t}var P='<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve">\n<path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="M4.4,7.3C4.2,7.3,4,7.5,4,7.7v4.6c0,0.2,0.2,0.4,0.4,0.4h2.2\n\tl3.2,3.2c0.2,0.2,0.6,0.1,0.6-0.2v-2.4c0-0.1-0.1-0.2-0.1-0.3L4.8,7.4C4.7,7.4,4.6,7.3,4.5,7.3C4.5,7.3,4.4,7.3,4.4,7.3z M16.1,15.2\n\tl-1.4-1.4c0.5-0.7,1.3-1.9,1.3-3.8c0-2.8-1.8-4.3-1.8-4.3c-0.1-0.2-0.4-0.2-0.6,0L13.3,6c-0.1,0.2-0.1,0.4,0,0.6\n\tc0,0,1.4,1.2,1.4,3.4c0,1.4-0.5,2.3-0.9,2.9L12.9,12c0.3-0.4,0.6-1.1,0.6-2c0-1.7-1-2.6-1-2.6c-0.1-0.2-0.4-0.2-0.6,0l-0.4,0.3\n\tc-0.1,0.2-0.1,0.4,0,0.6c0,0,0.7,0.5,0.7,1.7c0,0.4-0.1,0.8-0.2,1.1l-1.6-1.6V4.3c0-0.3-0.4-0.5-0.6-0.2L7.4,6.5L4.8,3.9\n\tc-0.1-0.1-0.4-0.1-0.5,0L4,4.3C3.8,4.4,3.8,4.7,4,4.8l1,1.1l6.7,6.7l3.5,3.5c0.1,0.1,0.4,0.1,0.5,0l0.4-0.4\n\tC16.2,15.6,16.2,15.3,16.1,15.2z"/>\n</svg>',F='<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve">\n<path fill="#FFFFFF" d="M12.5,7.3c-0.3-0.4-0.8-0.4-1.1-0.2C11,7.4,11,7.9,11.2,8.3l0,0c0.4,0.5,0.6,1.1,0.6,1.7\n\tc0,0.6-0.2,1.2-0.6,1.7c-0.3,0.4-0.2,0.9,0.1,1.1c0.4,0.3,0.9,0.2,1.1-0.1c0,0,0,0,0,0c0.6-0.8,0.9-1.7,0.9-2.7\n\tC13.4,9,13.1,8.1,12.5,7.3z M14.6,6c-0.3-0.4-0.8-0.4-1.1-0.1C13.1,6.2,13,6.7,13.3,7c0,0,0,0,0,0c0.7,0.8,1.1,1.9,1.1,3\n\tc0,1.1-0.4,2.1-1.1,3c-0.3,0.4-0.2,0.9,0.1,1.1c0.3,0.3,0.8,0.2,1.1-0.1c0.9-1.1,1.4-2.5,1.4-4C16,8.5,15.5,7.1,14.6,6z M9.7,4\n\tC9.5,4,9.2,4,9.1,4.1L6.3,6.7H4.5C4.2,6.7,4,7,4,7.3v5.5c0,0.3,0.2,0.5,0.5,0.5h1.8l2.7,2.6l0,0c0.2,0.2,0.6,0.2,0.8,0\n\tc0.1-0.1,0.2-0.3,0.2-0.4l0-10.8C10,4.3,9.9,4.1,9.7,4z"/>\n</svg>';class A extends h{label="PopoverSlideVideo";ct;ut;bt;post;constructor(){super(),n.register(),l.register(),this.gt=this.gt.bind(this),this.vt=this.vt.bind(this),this.xt=this.xt.bind(this),this.ft=this.ft.bind(this),this._t=this._t.bind(this),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.showSoundControl=this.showSoundControl.bind(this),this.hideSoundControl=this.hideSoundControl.bind(this),this.preload=this.preload.bind(this),this.onLocalStateChange(this.yt,{isPlaying:!1}),this.onGlobalStateChange(this.wt),this.onConnect((()=>{this.post.mediaUrl?(this.ct=i({type:"behold-video",classes:"video",props:{mediaUrl:this.post.mediaUrl,sizes:this.post.sizes,renderPlaceholder:!0},listeners:{click:this.ft,load:this.gt,play:this.vt,pause:this.xt}}),this.bt=i({type:"button",classes:"video-mute",contents:this.globalState.isMuted?P:F,listeners:{click:this._t},attributes:{"aria-label":this.globalState.isMuted?"unmute":"mute"}}),this.globalState.isMuted?this.ct.mute():this.ct.unmute(),this.classList.add("video-container","video-container--paused"),this.beholdReplaceChildren(this.ct,this.bt)):(this.ut=i({type:"behold-image",props:{sizes:this.post.sizes,mediaUrl:this.post.thumbnailUrl,aspectRatio:this.post.sizes.full.width/this.post.sizes.full.height},listeners:{load:this.gt}}),this.beholdReplaceChildren(this.ut))}))}yt({changedProps:t,newState:e}){t.includes("isPlaying")&&(e.isPlaying&&!this.ct.isPlaying&&this.ct.play(),!e.isPlaying&&this.ct.isPlaying&&this.ct.pause())}wt({changedProps:t,newState:e}){t.includes("isMuted")&&this.ct&&this.bt&&(e.isMuted?(this.ct.mute(),this.bt.innerHTML=P):(this.ct.unmute(),this.bt.innerHTML=F))}gt(){this.dispatchEvent(new Event("load")),this.classList.add("is-loaded")}vt(){this.classList.remove("video-container--paused")}xt(){this.classList.add("video-container--paused")}ft(){this.ct&&(this.ct.isPlaying?this.pause():this.play())}_t(){this.ct&&(this.ct.muted?this.updateGlobalState({isMuted:!1}):this.updateGlobalState({isMuted:!0}))}play(){this.updateLocalState({isPlaying:!0}),this.showSoundControl()}pause(){this.updateLocalState({isPlaying:!1})}showSoundControl(){this.isConnected&&this.bt&&this.bt.classList.add("video-mute--visible")}hideSoundControl(){this.isConnected&&this.bt&&this.bt.classList.remove("video-mute--visible")}preload(){this.ct?.preload()}static register(t="behold-popover-slide-video"){return customElements.get(t)||customElements.define(t,A),t}}class $ extends h{label="PopoverSlideAlbum";kt;Ct;Et;zt;St;Mt;Dt;currentSlideIndex=0;post;constructor(){super(),this.onPropChange((()=>{}),["post"]),l.register(),A.register(),this.Lt=this.Lt.bind(this),this.Pt=this.Pt.bind(this),this.preload=this.preload.bind(this),this.onConnect((()=>{this.Et=this.Ft();const t=this.post.sizes?.full?.height?`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' width='${this.post.sizes?.full?.width}' height='${this.post.sizes?.full?.height}'%3E%3C/svg%3E%0A`:this.post.children?.[0]?.sizes?.full.mediaUrl||this.post.children?.[0]?.thumbnailUrl||null;this.post.mediaUrlIsVideo&&!t?this.Ct=i({type:"video",classes:"slide__carousel-spaceholder",attributes:{src:this.post.mediaUrl,height:this.post.sizes?.full?.height,width:this.post.sizes?.full?.width},props:{muted:!0}}):this.Ct=i({type:"img",classes:"slide__carousel-spaceholder",attributes:{src:t,height:this.post.sizes?.full?.height,width:this.post.sizes?.full?.width}}),this.zt=i({type:"button",classes:"slide__carousel-previous",attributes:{"aria-label":"Previous album slide"},contents:p}),this.St=i({type:"button",classes:"slide__carousel-next",attributes:{"aria-label":"Next album slide"},contents:u}),this.Mt=i({classes:"slide__carousel-breadcrumbs"}),this.kt=i({classes:"slide__carousel",contents:[...this.Et,this.zt,this.St,this.Mt]}),this.replaceChildren(this.Ct,this.kt),this.Dt=new S({slides:this.Et,containerEl:this.kt,keyboardNav:!1,breadcrumbsContainerEl:this.Mt,dynamicBreadCrumbsCutoff:7,previousEl:this.zt,nextEl:this.St,onSlideChange:this.Lt,virtualize:!0,proximalSlidesToRender:2,dragLimit:.6}),this.onIntersection(this,this.Pt)})),this.onDisconnect((()=>{this.Dt.destroy(),this.Dt=null}))}At(){E({include:[this.Et[this.currentSlideIndex]],exclude:this.Et.filter(((t,e)=>e!==this.currentSlideIndex)),merge:!0})}Pt(t){t.isIntersecting&&this.Dt.init(0)}Lt(t,e=!1){t!==this.currentSlideIndex&&this.globalState.keyboardNavEnabled&&d(`Slide ${t+1} of ${this.Et.length} in Album`),this.currentSlideIndex=t,this.Et.forEach(((e,i)=>{O(e)&&(i===t?e.play():(e.hideSoundControl(),e.pause()))}));const i=this.Et[t-1],s=this.Et[t+1];i&&i.preload(),s&&s.preload(),this.At(),e||this.$t(t)}$t(t){const e=c(this.post.children[t].colorPalette?.dominant||"100,100,100").map((t=>Math.round(t)));this.style.backgroundColor=`hsl(${e[0]} ${Math.min(e[1],35)}% ${Math.min(e[2],13)}%)`;const i=c(this.post.children[t].colorPalette?.dominant||"255,255,255").map((t=>Math.round(t))),s=`hsl(${i[0]} ${i[1]}% ${Math.max(i[2],50)}%)`;this.style.setProperty("--uib-color",s),this.updateGlobalState({popoverOverlayHslArray:e})}Ft(){return this.post.children.map((t=>{let e=null;switch(t.mediaType){case"IMAGE":e=i({type:"behold-image",classes:"slide__carousel-slide",props:{sizes:t.sizes,mediaUrl:t.mediaUrl,showLoader:!0,aspectRatio:t.sizes.full.width/t.sizes.full.height}});break;case"VIDEO":e=i({type:"behold-popover-slide-video",classes:"slide__carousel-slide",props:{post:t}})}return e}))}play(){const t=this.Et[this.currentSlideIndex];O(t)&&t.play()}pause(){this.Et.filter(O).forEach((t=>{t.hideSoundControl(),t.pause()}))}preload(){this.Et?.[0]?.preload()}static register(t="behold-popover-slide-album"){return customElements.get(t)||customElements.define(t,$),t}}const O=t=>"BEHOLD-POPOVER-SLIDE-VIDEO"===t.tagName;var T='<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">\n<g>\n\t<path fill="#262626" d="M13.8,5.9H3.2c-0.4,0-0.7-0.3-0.7-0.7s0.3-0.7,0.7-0.7h10.6c0.4,0,0.7,0.3,0.7,0.7S14.1,5.9,13.8,5.9z"/>\n</g>\n<g>\n\t<path fill="#262626" d="M12.8,10.8H2.2c-0.4,0-0.7-0.3-0.7-0.7s0.3-0.7,0.7-0.7h10.6c0.4,0,0.7,0.3,0.7,0.7S13.2,10.8,12.8,10.8z"\n\t\t/>\n</g>\n<g>\n\t<path fill="#262626" d="M8.9,15.3c0,0-0.1,0-0.1,0c-0.4-0.1-0.6-0.4-0.5-0.8l2.4-13.3c0.1-0.4,0.4-0.6,0.8-0.5\n\t\tc0.4,0.1,0.6,0.4,0.5,0.8L9.6,14.8C9.5,15.1,9.2,15.3,8.9,15.3z"/>\n</g>\n<g>\n\t<path fill="#262626" d="M4.7,15.3c0,0-0.1,0-0.1,0c-0.4-0.1-0.6-0.4-0.5-0.8L6.4,1.2c0.1-0.4,0.4-0.6,0.8-0.5\n\t\tc0.4,0.1,0.6,0.4,0.5,0.8L5.3,14.8C5.3,15.1,5,15.3,4.7,15.3z"/>\n</g>\n</svg>';class R extends h{label="PopoverGallerySlide";o;Ot;Tt;Rt;Bt;jt;It;Ut;Vt;Ht;Nt;post;feedMetadata;constructor(){super(),this.onPropChange(this.qt,["post","feedMetadata"]),l.register(),A.register(),$.register(),this.expandCaption=this.expandCaption.bind(this),this.preload=this.preload.bind(this),this.onConnect((()=>{this.render()}))}render(){if(this.classList.remove("is-loaded"),!this.post)return;const t=c(this.post.colorPalette?.dominant||"100,100,100").map((t=>Math.round(t))),e=`hsl(${t[0]} ${Math.min(t[1],35)}% ${Math.min(t[2],13)}%)`,s=c(this.post.colorPalette?.dominant||"255,255,255").map((t=>Math.round(t))),r=`hsl(${s[0]} ${s[1]}% ${Math.max(s[2],50)}%)`;switch(this.style.setProperty("--uib-color",r),this.post?.mediaType){case"VIDEO":this.Ht=i({type:"behold-popover-slide-video",classes:"slide__media",style:{backgroundColor:e},props:{post:this.post}});break;case"CAROUSEL_ALBUM":this.Ht=i({type:"behold-popover-slide-album",classes:"slide__media",style:{backgroundColor:e},props:{post:this.post,aspectRatio:this.post.sizes.full.width/this.post.sizes.full.height}});break;default:this.Ht=i({type:"behold-image",classes:"slide__media",style:{backgroundColor:e},props:{sizes:this.post.sizes,mediaUrl:this.post.mediaUrl,showLoader:!0,aspectRatio:this.post.sizes.full.width/this.post.sizes.full.height}})}this.Ot=this.feedMetadata?.profilePictureUrl?i({type:"img",attributes:{src:this.feedMetadata.profilePictureUrl}}):null,this.Tt="@"+this.feedMetadata.username,this.feedMetadata.hashtags&&(this.Ot=T,this.Tt=this.feedMetadata.hashtags.join(", ")),this.Rt=this.Ot?i({classes:"slide__avatar",contents:this.Ot,attributes:{"aria-label":this.feedMetadata.hashtags?"hashtags":"username"}}):null,this.Bt=i({classes:"slide__header",contents:[this.Rt,this.Tt]}),this.jt=this.post?.caption?.trim()?.length?i({classes:"slide__caption",contents:this.post.caption}):null,this.It=this.post.permalink?i({type:"a",attributes:{href:this.post.permalink,target:"_blank"},classes:"slide__footer-link",contents:["Go to post",'<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve">\n<g>\n\t<path d="M16,19.8H4c-2.1,0-3.8-1.7-3.8-3.8V4c0-2.1,1.7-3.8,3.8-3.8h12c2.1,0,3.8,1.7,3.8,3.8v12C19.8,18.1,18.1,19.8,16,19.8z\n\t\t M4,1.8c-1.2,0-2.2,1-2.2,2.2v12c0,1.2,1,2.2,2.2,2.2h12c1.2,0,2.2-1,2.2-2.2V4c0-1.2-1-2.2-2.2-2.2H4z"/>\n</g>\n<path d="M14.4,5.6v7.5h-1.5V8.2l-6,6l-1.1-1.1l6-6H6.9V5.6H14.4z"/>\n</svg>']}):"",this.Ut=i({classes:"slide__footer",contents:[this.It]}),this.Vt=i({classes:"slide__text",contents:[this.Bt,this.jt,this.Ut]}),this.o=i({classes:"slide__inner",contents:[this.Ht,this.Vt]}),this.Nt=i({type:"button",classes:"slide__more",contents:"… more",listeners:{click:this.expandCaption}}),this.beholdReplaceChildren(this.o),o(),this.to((()=>{this.classList.add("is-loaded")}),10,"onConnect")}qt({changedProp:t,newValue:e}){switch(t){case"feedMetadata":if(!this.isConnected)return;this.Tt="@"+e.username,e.hashtags?.length?(this.Ot=T,this.Tt=e.hashtags.join(", ")):this.Ot=e?.profilePictureUrl?i({type:"img",attributes:{src:e.profilePictureUrl}}):null,this.Rt=this.Ot?i({classes:"slide__avatar",contents:this.Ot,attributes:{"aria-label":this.feedMetadata.hashtags?"hashtags":"username"}}):null,this.Bt=i({classes:"slide__header",contents:[this.Rt,this.Tt]});break;case"post":this.Ht||this.render(),"IMAGE"===e?.mediaType?Object.assign(this.Ht,{sizes:this.post.sizes,mediaUrl:this.post.mediaUrl,showLoader:!0}):B(this.Ht)||(this.Ht.post=e)}}activate(){"VIDEO,CAROUSEL_ALBUM".includes(this.post.mediaType)&&this.Ht&&this.Ht.play()}deactivate(){"VIDEO"===this.post.mediaType&&this.Ht&&this.Ht.pause(),"CAROUSEL_ALBUM"===this.post.mediaType&&this.Ht&&this.Ht.pause()}preload(){this.Ht?.preload()}getBackgroundColor(){let t=this.post;if("CAROUSEL_ALBUM"===this.post?.mediaType){const e=this.Ht;t=this.post?.children?.[e?.currentSlideIndex??0]}return c(t?.colorPalette?.dominant||"100,100,100").map((t=>Math.round(t)))}expandCaption(){this.jt&&(this.jt.style.transition="",this.jt.style.height=this.jt.offsetHeight+"px",this.jt.innerHTML=this.post?.caption||"",o(),this.raf((()=>{this.jt.style.transition="height .3s ease",this.jt.style.height=this.jt.scrollHeight+"px",this.to((()=>{this.jt.style.transition="",this.jt.style.height=""}),300,"expandCaption")}),"expandCaption"))}collapseCaption(){if(!this.jt)return;const t=b({text:this.post.caption,maxChars:120,maxLines:4});this.jt.innerHTML=t,t?.length<this.post?.caption?.length&&this.jt.appendChild(this.Nt)}static register(t="behold-popover-gallery-slide"){return customElements.get(t)||customElements.define(t,R),t}}const B=t=>"BEHOLD-IMAGE"===t.tagName;class j extends h{label="PopoverGallery";posts;widgetSettings;feedMetadata;closeFocusEl=document.body;onSlideChange;Xt;Gt=900;Zt;Kt;Yt;Jt;zt;St;Qt;Wt;o;te;ee;ie;se=0;oe="";re="";constructor(){super(),this.Zt=this.attachShadow({mode:"open"}),this.Xt=!1,this.onPropChange(this.qt,["posts","widgetSettings","feedMetadata"]),R.register(),this.Lt=this.Lt.bind(this),this.ae=this.ae.bind(this),this.he=this.he.bind(this),this.onGlobalStateChange(this.wt),this.onConnect((()=>{s(this,{"theme--light":"light"===this.widgetSettings.popupColorTheme,"theme--dark":"dark"===this.widgetSettings.popupColorTheme,"theme--auto":"auto"===this.widgetSettings.popupColorTheme}),s(this,{"keyboard-nav":this.globalState.keyboardNavEnabled}),this.Jt=i({classes:"overlay",listeners:{click:this.ae}}),this.zt=i({type:"button",classes:"previous",attributes:{"aria-label":"Previous post"},contents:p}),this.St=i({type:"button",classes:"next",attributes:{"aria-label":"Next post"},contents:u}),this.Qt=i({type:"button",classes:"close",contents:'<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve">\n<path fill-rule="evenodd" clip-rule="evenodd" fill="#081B10" d="M11.6,10.1l5.5-5.7c0.5-0.5,0.5-1.1,0-1.6c-0.5-0.5-1.1-0.5-1.6,0\n\tl-5.5,5.6L4.4,2.8C4,2.4,3.3,2.4,2.8,2.8S2.4,4,2.8,4.4L8.4,10l-5.5,5.6c-0.5,0.5-0.5,1.1,0,1.6c0.5,0.5,1.1,0.5,1.6,0l5.5-5.6\n\tl5.5,5.6c0.5,0.5,1.1,0.5,1.6,0c0.5-0.5,0.5-1.1,0-1.6C17,15.6,11.6,10.1,11.6,10.1z"/>\n</svg>',attributes:{"aria-label":"Close"},listeners:{click:t=>{t.preventDefault(),this.ae()}}}),this.Wt=i({classes:"breadcrumbs"}),this.te=this.posts.map((t=>{const e=document.createElement("behold-popover-gallery-slide");return e.post=t,e.feedMetadata=this.feedMetadata,e})),this.o=i({classes:"inner",contents:this.te}),this.Kt=document.createDocumentFragment(),this.Kt.beholdReplaceChildren(this.Jt,this.o,this.Wt,this.zt,this.St,this.Qt),this.Yt=i({type:"style",contents:[":host{--icon-play:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 35 35' xml:space='preserve'%3E%3Cpath fill='%23FFF' d='M28.4 14.9 9.5 4.2C7.5 3.1 5 4.6 5 6.8v21.3c0 2.3 2.5 3.7 4.5 2.6l19-10.7c2-1 2-4-.1-5.1z'/%3E%3C/svg%3E\");--icon-gallery:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 35 35' xml:space='preserve'%3E%3Cpath fill='%23FFF' d='M27.3 22.7v-17c0-2.6-2.1-4.7-4.7-4.7H5.7C3.1 1 1 3.1 1 5.7v17c0 2.6 2.1 4.7 4.7 4.7h17c2.5-.1 4.6-2.2 4.6-4.7zm4-13.4v14.6c0 4.1-3.4 7.4-7.4 7.4H9.2c-.5 0-.8.6-.5 1 .9 1 2.2 1.6 3.7 1.6h12.1c5.2 0 9.3-4.2 9.3-9.3V12.5c0-1.5-.6-2.8-1.6-3.7-.3-.4-.9 0-.9.5z'/%3E%3C/svg%3E\");--bottomPadding:60px;--height:min(calc(100vh - 120px - var(--bottomPadding)),1400px);--width:calc(100vw - 120px);--text-width:400px;--text-color:#262626;--text-background:#fff;--text-size:15px;--border-color:#ededed;--ease-out-back:cubic-bezier(0.085,1.735,0.285,0.995);align-items:center;box-sizing:border-box;height:100vh;justify-content:flex-start;left:0;overflow:hidden;pointer-events:none;position:fixed;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%;z-index:99999}:host *{box-sizing:border-box}@media (max-width:1200px){:host{--text-width:300px;--text-size:13px}}:host(.is-scroller){--text-width:100%;--height:auto;--width:calc(100vw - 40px)}@media (prefers-color-scheme:dark){:host(.theme--auto){--text-color:#f2f2f2;--text-background:#1a1a1a;--border-color:#292929}}:host(.theme--dark){--text-color:#f2f2f2;--text-background:#1a1a1a;--border-color:#292929}:host(.is-visible){pointer-events:all}.overlay{background-color:rgba(0,0,0,.6);display:block;height:100%;left:0;opacity:0;pointer-events:none;position:absolute;top:0;transition:all .3s ease;width:100%;will-change:opacity,background-color}@media (min-width:901px){.overlay{-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}}:host(.is-visible) .overlay{opacity:1;pointer-events:all}.inner{display:flex;height:calc(100% - var(--bottomPadding));justify-content:center;pointer-events:none;position:relative;width:100%;z-index:1}:host(.is-scroller) .inner{height:100%}behold-popover-gallery-slide{align-items:center;display:flex;flex-grow:0;flex-shrink:0;height:calc(100% - var(--bottomPadding));justify-content:center;margin:0;opacity:0;padding:0;pointer-events:none;transform:scale(.99);transition:transform .2s ease-out,opacity .2s ease-out;width:100%}@media (min-width:901px){behold-popover-gallery-slide:active{cursor:grabbing}}@media (prefers-reduced-motion){behold-popover-gallery-slide{transform:none;transition:none}}:host(.is-visible) behold-popover-gallery-slide.is-loaded{opacity:1;transform:none}:host(.is-scroller) behold-popover-gallery-slide{height:auto;margin-top:10px}.slide__inner{align-items:center;background-color:var(--text-background);display:flex;justify-content:center;max-height:var(--height);max-width:var(--width);overflow:hidden;pointer-events:all;position:relative}:host(.is-scroller) .slide__inner{border-radius:4px;flex-direction:column}.slide__media{align-items:center;display:flex;flex-shrink:1;height:var(--height);justify-content:center;max-height:var(--height);overflow:hidden;position:relative;transition:background-color .3s ease;z-index:1}behold-image img,behold-image video,behold-video img,behold-video video{height:auto;max-height:100%;-o-object-fit:contain;object-fit:contain;-o-object-position:center center;object-position:center center;opacity:0;position:relative;width:auto;z-index:1}.behold-ps-container behold-image img,.behold-ps-container behold-image video,.behold-ps-container behold-video img,.behold-ps-container behold-video video{max-width:100%}behold-image{min-height:10px;min-width:10px;pointer-events:none;position:relative}@supports (aspect-ratio:1/1){behold-image img{min-height:100%;min-width:100%}}behold-image.is-loaded img{opacity:1;transition:opacity .4s ease}.slide__carousel{height:100%;left:0;position:absolute;top:0;width:100%}.slide__carousel:before{background:linear-gradient(0deg,rgba(0,0,0,.4),transparent);bottom:0;height:60px;left:0;width:100%;z-index:1}.slide__carousel:after,.slide__carousel:before{content:\"\";pointer-events:none;position:absolute;transform:translateZ(0)}.slide__carousel:after{background:var(--icon-gallery);height:20px;left:20px;opacity:.75;top:20px;width:20px;z-index:2}:host(.is-scroller) .slide__carousel:after{left:auto;right:15px;top:15px}img.slide__carousel-spaceholder,video.slide__carousel-spaceholder{height:auto;max-height:100%;opacity:0;pointer-events:none;visibility:hidden;width:auto}.behold-ps-container img.slide__carousel-spaceholder,.behold-ps-container video.slide__carousel-spaceholder{max-width:100%}.slide__carousel-breadcrumbs{bottom:30px;height:10px;left:50%;position:absolute;transform:translateX(-50%);z-index:2}:host(.is-scroller) .slide__carousel-breadcrumbs{bottom:10px}.slide__carousel-next,.slide__carousel-previous{align-items:center;background-color:hsla(0,0%,100%,.95);border:none;border-radius:50%;box-shadow:0 0 10px rgba(0,0,0,.2);display:flex;height:30px;justify-content:center;opacity:.75;outline:none;position:absolute;top:50%;touch-action:manipulation;transform:translateY(-50%) translateZ(0);transition:opacity .3s ease;width:30px;z-index:2}:host(.keyboard-nav) .slide__carousel-next:focus,:host(.keyboard-nav) .slide__carousel-previous:focus{background-color:#000;box-shadow:0 0 10px rgba(0,0,0,.2),0 0 0 2px #4169e1,0 0 0 3px #fff;opacity:1}:host(.keyboard-nav) .slide__carousel-next:focus svg path,:host(.keyboard-nav) .slide__carousel-previous:focus svg path{fill:#fff}.slide__carousel-next:not(:disabled),.slide__carousel-previous:not(:disabled){cursor:pointer}.slide__carousel-next:not(:disabled):hover,.slide__carousel-previous:not(:disabled):hover{opacity:1}.slide__carousel-next:disabled,.slide__carousel-previous:disabled{opacity:.25}.slide__carousel-next:before,.slide__carousel-previous:before{content:\"\";height:60px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:60px}.slide__carousel-next svg,.slide__carousel-previous svg{height:12px;position:absolute;width:12px}.slide__carousel-next svg path,.slide__carousel-previous svg path{fill:#000}:host(.is-scroller) .slide__carousel-next,:host(.is-scroller) .slide__carousel-previous{background-color:transparent;box-shadow:none;height:20px;width:20px}:host(.is-scroller) .slide__carousel-next svg path,:host(.is-scroller) .slide__carousel-previous svg path{fill:#fff}.slide__carousel-previous{left:20px}.slide__carousel-previous svg{transform:translateX(-1px)}:host(.is-scroller) .slide__carousel-previous{left:10px}.slide__carousel-next{right:20px}.slide__carousel-next svg{transform:translateX(1px)}:host(.is-scroller) .slide__carousel-next{right:10px}.slide__carousel-slide{cursor:grab;display:flex;height:var(--height);overflow:hidden;width:auto}.slide__carousel-slide:active{cursor:grabbing}.slide__carousel-slide-media{height:auto;max-height:100%;max-width:100%;-o-object-fit:contain;object-fit:contain;pointer-events:none;width:auto}.video-container{align-items:center;cursor:pointer;display:flex;height:var(--height);justify-content:center;overflow:hidden;position:relative;width:100%}.video-container:after{background:var(--icon-play);content:\"\";filter:drop-shadow(1px 1px 1px rgba(0,0,0,.1));height:80px;left:calc(50% - 40px);opacity:0;pointer-events:none;position:absolute;top:calc(50% - 40px);transform:scale(.5);transition:all .15s ease;width:80px;z-index:2}.video-container.video-container--paused:after{opacity:.8;transform:none;transition:opacity .2s ease,transform .3s var(--ease-out-back)}.video-container:active{cursor:grabbing}behold-video{align-items:center;display:flex;height:100%;width:100%}behold-video.is-loaded video{opacity:1;transition:opacity .4s ease}.video-mute{align-items:center;background:transparent;border:none;bottom:0;cursor:pointer;display:flex;height:60px;justify-content:center;margin:0;opacity:0;outline:none;padding:0;position:absolute;right:0;transform:translateZ(0);transition:opacity .1s ease;width:60px;z-index:2}.video-mute.video-mute--visible{opacity:1;transition:opacity .2s ease .2s}.video-mute:before{background-color:rgba(0,0,0,.5);border-radius:50%;content:\"\";height:28px;left:calc(50% - 14px);position:absolute;top:calc(50% - 14px);width:28px}:host(.keyboard-nav) .video-mute:focus:before{background-color:#000;box-shadow:0 0 10px rgba(0,0,0,.2),0 0 0 2px #4169e1,0 0 0 4px #fff}.video-mute svg{height:20px;left:calc(50% - 10px);position:absolute;top:calc(50% - 10px);width:20px}.slide__text{align-items:stretch;box-shadow:-1px 0 0 var(--border-color);color:var(--text-color);display:flex;flex-direction:column;flex-shrink:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;font-size:var(--text-size);height:var(--height);justify-content:flex-start;pointer-events:none;position:relative;transform:translateZ(0);width:var(--text-width);z-index:1}.slide__header{align-items:center;border-bottom:1px solid var(--border-color);display:flex;font-weight:600;line-height:1.25;padding:30px}@media (prefers-color-scheme:dark){.theme--auto .slide__header{border-color:#292929}}.slide__header.theme--dark{border-color:#292929}@media (max-width:1200px){.slide__header{padding:20px}}.slide__avatar{align-items:center;border-radius:50%;display:flex;flex-shrink:0;height:42px;justify-content:center;margin-right:10px;overflow:hidden;position:relative;width:42px}.slide__avatar:before{background:radial-gradient(circle farthest-corner at 32% 106%,#ffe17d 0,#ffcd69 10%,#fa9137 28%,#eb4141 42%,transparent 82%),linear-gradient(135deg,#c33cbe 12%,#c33cbe 58%);height:100%;left:0;top:0;width:100%}.slide__avatar:after,.slide__avatar:before{border-radius:50%;content:\"\";position:absolute}.slide__avatar:after{background-color:var(--text-background);height:calc(100% - 4px);left:2px;top:2px;width:calc(100% - 4px)}@media (prefers-color-scheme:dark){.theme--auto .slide__avatar{background-color:#333}}.slide__avatar.theme--dark{background-color:#333}.slide__avatar img{border-radius:50%;height:calc(100% - 8px);position:relative;width:calc(100% - 8px);z-index:1}.slide__avatar svg{height:15px;position:relative;width:15px;z-index:1}.slide__avatar svg path{fill:var(--text-color)}:host(.is-scroller) .slide__avatar{height:32px;width:32px}:host(.is-scroller) .slide__avatar svg{height:12px;width:12px}.slide__caption{line-height:1.5;overflow:auto;padding:30px;scrollbar-width:none;white-space:pre-wrap;word-break:break-word}:host(.is-visible) .slide__caption{pointer-events:all}.slide__caption::-webkit-scrollbar{width:0!important}:host(.is-scroller) .slide__caption{overflow:hidden}.slide__more{background:transparent;border:none;color:var(--text-color);cursor:pointer;margin:0;opacity:.75;padding:0}.slide__more:hover{opacity:1;text-decoration:underline}.slide__footer{border-top:1px solid var(--border-color);margin-top:auto}:host(.is-visible) .slide__footer{pointer-events:all}.slide__footer-link{align-items:center;color:var(--text-color);cursor:pointer;display:flex;font-size:.9333em;font-weight:600;padding:30px;text-decoration:none;transition:background .3s ease}:host(.keyboard-nav) .slide__footer-link:focus{background-color:var(--border-color);border:none;box-shadow:inset 0 0 0 1px #fff,inset 0 0 0 3px #4169e1;outline:none;transition:background .1s ease}.slide__footer-link:hover{background-color:var(--border-color)}.slide__footer-link svg{height:17px;margin-left:auto;width:17px}.slide__footer-link svg path{fill:var(--text-color)}@media (max-width:1200px){.slide__footer-link{padding:20px}}.breadcrumbs{align-items:center;bottom:calc(var(--bottomPadding)/2 + 30px - (var(--breadCrumbDiameter) + 10px)/2);display:flex;gap:calc(var(--breadCrumbDiameter)*.75);height:calc(var(--breadCrumbDiameter) + 10px);justify-content:center;left:50%;opacity:0;position:absolute;transform:translateX(-50%);width:auto;z-index:2}:host(.is-visible) .breadcrumbs{opacity:1}.breadcrumbs-current,.breadcrumbs-current:empty{background-color:#fff;border-radius:calc(var(--breadCrumbDiameter)/2);display:block;height:var(--breadCrumbDiameter);position:absolute;top:5px;transition:width .3s ease;width:var(--breadCrumbDiameter);will-change:left,right,width}.breadcrumb,.breadcrumb:empty{background-color:hsla(0,0%,100%,.4);border-radius:50%;cursor:pointer;display:block;height:7px;transition:all .3s ease;width:7px}.breadcrumb:empty:hover,.breadcrumb:hover{background-color:#fff}.close{align-items:center;background:none;border:none;cursor:pointer;display:flex;height:30px;justify-content:center;margin:0;opacity:0;padding:0;position:absolute;right:15px;top:15px;width:30px;z-index:2}:host(.is-visible) .close{opacity:.75;transition:opacity .3s ease}:host(.is-visible) .close:hover{opacity:1}:host(.keyboard-nav) .close:focus{box-shadow:0 0 0 2px #4169e1,0 0 0 3px #fff;opacity:1}.close:focus{border:none;outline:none}.close:before{content:\"\";height:60px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:60px}.close svg{height:20px;width:20px}.close svg path{fill:#fff}:host(.is-scroller) .close{background-color:hsla(0,0%,97%,.85);border-radius:50%;opacity:1;right:5px;top:5px}:host(.is-scroller) .close svg{height:14px;width:14px}:host(.is-scroller) .close svg path{fill:#000}.next,.previous{align-items:center;background:none;border:none;cursor:pointer;display:flex;height:60px;justify-content:center;margin:0;opacity:0;padding:0;position:absolute;top:calc(50% - var(--bottomPadding)/2);touch-action:manipulation;transform:translateY(-50%);width:60px;z-index:2}:host(.is-visible) .next,:host(.is-visible) .previous{opacity:.75;transition:opacity .3s ease}:host(.is-visible) .next:focus,:host(.is-visible) .previous:focus{border:none;outline:none}:host(.is-visible) .next:hover,:host(.is-visible) .previous:hover{opacity:1}:host(.is-visible) .next:disabled,:host(.is-visible) .previous:disabled{cursor:default;opacity:.15}:host(.is-visible) .next:disabled:hover,:host(.is-visible) .previous:disabled:hover{opacity:.15}:host(.keyboard-nav) .next:focus,:host(.keyboard-nav) .previous:focus{box-shadow:0 0 0 2px #4169e1,0 0 0 3px #fff;opacity:1}.next svg,.previous svg{height:16px;width:16px}.next svg path,.previous svg path{fill:#fff}.previous{left:0}.next{right:0}.ldr{--uib-size:50px;--uib-speed:1s;--uib-stroke:2px;--uib-bg-opacity:0.1;align-items:center;border-radius:calc(var(--uib-stroke)/2);contain:strict;display:none;height:var(--uib-stroke);justify-content:center;left:calc(50% - var(--uib-size)/2);overflow:hidden;position:absolute;top:calc(50% - var(--uib-stroke)/2);transform:translateZ(0);width:var(--uib-size)}.ldr.ldr--visible{display:flex}behold-image.is-loaded .ldr{display:none}.ldr:before{left:0;opacity:var(--uib-bg-opacity);position:absolute;top:0}.ldr:after,.ldr:before{background-color:var(--uib-color);content:\"\";height:100%;transition:background-color .3s ease;width:100%}.ldr:after{animation:wobble var(--uib-speed) ease-in-out infinite;border-radius:calc(var(--uib-stroke)/2);transform:translateX(-95%)}@keyframes wobble{0%,to{transform:translateX(-95%)}50%{transform:translateX(95%)}}".toString(),'.hg-container{align-items:flex-start;backface-visibility:hidden;contain:layout style;justify-content:flex-start;-webkit-user-select:none;-moz-user-select:none;user-select:none;will-change:transform}.hg-container,.hg-slide{display:flex;height:100%;width:100%}.hg-slide{contain:strict;flex-grow:0;flex-shrink:0}.hg-breadcrumbs,.hg-slide{align-items:center;justify-content:center}.hg-breadcrumbs{--ease:cubic-bezier(0.215,0.61,0.355,1);display:flex;gap:calc(var(--breadCrumbDiameter)*.75);height:calc(var(--breadCrumbDiameter) + 10px);pointer-events:all;position:relative;transition:transform .4s var(--ease);width:auto;will-change:transform}.hg-breadcrumbs.no-transition{transition:none}@media (prefers-reduced-motion){.hg-breadcrumbs{transition:none}}.hg-breadcrumbs-current,.hg-breadcrumbs-current:empty{background-color:#fff;border-radius:calc(var(--breadCrumbDiameter)/2);display:block;height:var(--breadCrumbDiameter);position:absolute;top:5px;transition:width .3s var(--ease);width:var(--breadCrumbDiameter);will-change:left,right,width}.hg-breadcrumb,.hg-breadcrumb:empty{cursor:pointer;display:block;flex-shrink:0;height:var(--breadCrumbDiameter);position:relative;width:var(--breadCrumbDiameter)}.hg-breadcrumb:before,.hg-breadcrumb:empty:before{content:"";height:60px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:calc(var(--breadCrumbDiameter)*1.75)}.hg-breadcrumb:after,.hg-breadcrumb:empty:after{background-color:hsla(0,0%,100%,.4);border-radius:50%;content:"";height:100%;left:0;position:absolute;top:0;transition:all .3s var(--ease);width:100%}.no-transition .hg-breadcrumb:after,.no-transition .hg-breadcrumb:empty:after{transition:none}@media (prefers-reduced-motion){.hg-breadcrumb:after,.hg-breadcrumb:empty:after{transition:none}}.hg-breadcrumb.hg-breadcrumb--1:after,.hg-breadcrumb:empty.hg-breadcrumb--1:after{transform:scale(.85)}.hg-breadcrumb.hg-breadcrumb--2:after,.hg-breadcrumb:empty.hg-breadcrumb--2:after{opacity:.75;transform:scale(.7)}.hg-breadcrumb.hg-breadcrumb--3:after,.hg-breadcrumb:empty.hg-breadcrumb--3:after{opacity:.5;transform:scale(.55)}.hg-breadcrumb.hg-breadcrumb--4:after,.hg-breadcrumb:empty.hg-breadcrumb--4:after{opacity:.25;transform:scale(.4)}.hg-breadcrumb.hg-breadcrumb--hidden,.hg-breadcrumb:empty.hg-breadcrumb--hidden{pointer-events:none}.hg-breadcrumb.hg-breadcrumb--hidden:after,.hg-breadcrumb:empty.hg-breadcrumb--hidden:after{opacity:0;transform:scale(0)}.hg-breadcrumb:empty:hover:after,.hg-breadcrumb:hover:after{background-color:#fff;opacity:1;transform:none}'.toString(),'.behold-ps-container{display:flex;height:100vh;justify-content:center;overflow:auto;pointer-events:all;scrollbar-width:none;width:100%}.behold-ps-container::-webkit-scrollbar{width:0!important}.behold-ps-inner{max-width:400px}.behold-ps-inner:before{height:10px}.behold-ps-inner:after,.behold-ps-inner:before{content:"";display:block;pointer-events:none;width:100%}.behold-ps-inner:after{height:90px}'.toString()]}),this.ee=new S({slides:this.te,containerEl:this.o,breadcrumbsContainerEl:this.Wt,previousEl:this.zt,nextEl:this.St,onSlideChange:this.Lt,breadcrumbDiameter:this.te.length>9?9:8,virtualize:!0,dragLimit:.4}),this.ie=new D({slides:this.te,containerEl:this.o,onSlideChange:this.Lt,onRequestClose:()=>{this.ae()}}),this.onResize(this,this,this.Z)})),this.onDisconnect((()=>{document.removeEventListener("keydown",this.he),z(this.closeFocusEl),this.ee.destroy(),this.ie.destroy(),this.ee=null,this.ie=null,document.body.style.overflow=this.oe,document.documentElement.style.paddingRight=this.re}))}qt({changedProp:t,oldValue:e,newValue:i}){switch(t){case"posts":i&&this.o&&(this.cancelRaf("updatePosts"),this.te=i.map((t=>{const e=document.createElement("behold-popover-gallery-slide");return e.post=t,e.feedMetadata=this.feedMetadata,e})),this.o.beholdReplaceChildren(...this.te),this.se=Math.min(this.se,this.te.length-1),this.Xt&&(this.ne(),o(),this.raf((()=>{this.le(this.offsetWidth)}),"updatePosts")));case"widgetSettings":m(e,i,"popupColorTheme")&&s(this,{"theme--light":"light"===this.widgetSettings.popupColorTheme,"theme--dark":"dark"===this.widgetSettings.popupColorTheme,"theme--auto":"auto"===this.widgetSettings.popupColorTheme});break;case"feedMetadata":this.te&&this.te.map((t=>{t.feedMetadata=i}))}}wt({changedProps:t,newState:e}){if(t.includes("keyboardNavEnabled")&&s(this,{"keyboard-nav":this.globalState.keyboardNavEnabled}),t.includes("popoverOverlayHslArray")||t.includes("popoverOverlayOpacity")){const t=e.popoverOverlayHslArray,i=e.popoverOverlayOpacity;this.raf((()=>{this.Jt.style.backgroundColor=`hsl(${t[0]} ${Math.min(t[1],50)}% ${Math.min(t[2],15)}% / ${i})`}),"overlayColor")}}he(t){"Escape"===t.code&&(t.preventDefault(),this.ae())}open(t,e){if(this.Xt)return;this.Xt=!0,this.se=t,this.cancelRaf("open"),this.closeFocusEl=e,this.oe=document.body.style.overflow;const i=window.innerWidth-document.documentElement.clientWidth;this.re=document.documentElement.style.paddingRight;const s=parseInt(getComputedStyle(document.documentElement).paddingRight.replace("px",""));document.documentElement.style.paddingRight=`${s+i}px`,this.style.paddingRight=`${i}px`,document.body.style.overflow="hidden",this.ne(),o(),this.raf((()=>{this.classList.add("is-visible"),async function(t,e=[],i=0){v=t,g=(t=>t instanceof ShadowRoot)(t)?t:document,y=!0,E({include:[t],exclude:e}),document.addEventListener("keydown",C),_.observe(t,{subtree:!0,attributes:!0,attributeFilter:["disabled"],childList:!0});const s=await k();s[i]?.focus()}(this.Zt,this.te?.filter(((e,i)=>i!==t)),1),this.le(this.offsetWidth),document.addEventListener("keydown",this.he)}),"open")}ae(){this.Xt&&(this.Xt=!1,this.cancelTo("close"),this.classList.remove("is-visible"),this.to(this.remove.bind(this),300,"close"),z(this.closeFocusEl),document.removeEventListener("keydown",this.he),document.body.style.overflow=this.oe,document.documentElement.style.paddingRight=this.re,this.style.paddingRight="")}Lt(t){this.se=t;let e="image";switch(this.posts[t]?.mediaType){case"VIDEO":e=this.posts[t].isReel?"reel":"video";break;case"CAROUSEL_ALBUM":e="album";break;default:e="image"}this.globalState.keyboardNavEnabled&&d(`${e}, post ${t+1} of ${this.te.length} in gallery`),E({include:[this.Zt],exclude:this.te.filter(((e,i)=>i!==t)),merge:!1}),this.onSlideChange&&this.onSlideChange(t),this.te.forEach(((e,i)=>{i===t?e.activate():e.deactivate()}));const i=this.te[t-1]??null,s=this.te[t+1]??null;i&&this.raf((()=>i.preload()),"preloadPrev"),s&&this.raf((()=>s.preload()),"preloadNext");const o=this.te?.[t]?this.te[t].getBackgroundColor():null;o&&this.updateGlobalState({popoverOverlayHslArray:o})}le(t){t>this.Gt?(this.classList.remove("is-scroller"),this.zt.style.display="",this.St.style.display="",this.ie.destroy(),this.ee.init(this.se),this.te.forEach((t=>t.expandCaption())),this.updateGlobalState({popoverOverlayOpacity:.85})):(this.classList.add("is-scroller"),this.ee.destroy(),this.ie.init(this.se),this.te.forEach((t=>t.collapseCaption())),this.zt.disabled=!1,this.zt.style.display="none",this.St.disabled=!1,this.St.style.display="none",this.updateGlobalState({popoverOverlayOpacity:.9}))}Z(t){const e=t?.borderBoxSize?.[0]?.inlineSize||t?.contentRect?.width||0;this.le(e)}ne(){document.body.append(this),this.Zt.beholdReplaceChildren(this.Kt,this.Yt)}static register(t="behold-popover-gallery"){return customElements.get(t)||customElements.define(t,j),t}}export{j as default};