@behold/widget 0.5.10 → 0.5.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ import{c as t,p as s,g as i,s as e,a as o,h}from"./index-ANfp_6HB.js";import{B as a,I as n,V as r,A as l,b as c,g as d}from"./base-QRGqT4gW.js";import{c as p,a as u}from"./caret-right-xsqAZl9R.js";class g{containerEl;slideEls;height;gap;borderRadius;applyBorderRadiusToContainer;snapToSlide;bindToScrollPos;resizeObserver;onSlideChange;t;i;o;h;l;p;u;m;v;S;P;M;_;C;k;R;T;$;A;I;L;B;j;F;G;V;anchorSlide;finalAnchorSlide;constructor({onSlideChange:t}){this.h=[],this.l=!1,this.p=!1,this.u=!1,this.m=0,this.v=0,this.S=0,this.anchorSlide=0,this.P=0,this.M={start:0,previous:0},this._=[],this.C=0,this.$=1/60,this.A=3,this.I=2,this.borderRadius=20,this.applyBorderRadiusToContainer=!1,this.gap=20,this.height=300,this.snapToSlide=!1,this.bindToScrollPos=!1,this.k=40,this.R=0,this.T=0,this.L=window.innerHeight,this.B=null,this.j=0,this.F=()=>{},this.G=!1,this.onSlideChange=t;let s=window.ResizeObserver;"ResizeObserver"in window==0&&(s=window.BeholdResizeObserver),this.resizeObserver=new s((t=>this.handleResize(t))),this.handlePointerdown=this.handlePointerdown.bind(this),this.handlePointermove=this.handlePointermove.bind(this),this.handlePointerup=this.handlePointerup.bind(this)}init({containerEl:s,slideEls:i,height:e=300,gap:o=20,borderRadius:h=40,applyBorderRadiusToContainer:a=!0,snapToSlide:n=!1,bindToScrollPos:r=!1}){this.containerEl=s,this.slideEls=i.map((s=>t({classes:"ec-slide",contents:s}))),this.o=i,this.t=s.offsetWidth,this.i=s?.scrollWidth||0,this.updateSettings({height:e,gap:o,borderRadius:h,applyBorderRadiusToContainer:a,snapToSlide:n,bindToScrollPos:r}),this.addEventListeners(),this.containerEl.style.setProperty("--ec-container-width",`${this.t}px`),this.containerEl.beholdReplaceChildren(...this.slideEls),this.l=!0,this.loop()}updateSettings({height:t=300,gap:s=20,borderRadius:i=40,applyBorderRadiusToContainer:e=!0,snapToSlide:o=!1,bindToScrollPos:h=!1}){cancelAnimationFrame(this.V),this.V=requestAnimationFrame((()=>{this.height=t,this.gap=s,this.borderRadius=Math.min(i/100*this.height,.45*this.t/2),this.k=Math.max(this.borderRadius,40),this.applyBorderRadiusToContainer=e,this.snapToSlide=o,this.bindToScrollPos=h,this.containerEl.style.setProperty("--ec-height",`${this.height}px`),this.containerEl.style.setProperty("--ec-border-radius",this.applyBorderRadiusToContainer?`${this.borderRadius}px`:"0px")}))}destroy(){this.l=!1,cancelAnimationFrame(this.V),this.removeEventListeners(),this.slideEls?.length&&this.slideEls.forEach((t=>{t.remove()})),this.containerEl&&this.containerEl.remove(),this.slideEls=null,this.containerEl=null}handleResize(t){let s=null;t&&t.forEach((t=>{t.target===this.containerEl&&(s=t.borderBoxSize[0].inlineSize)})),this.updateDimensions(s),this.P=Math.max(Math.min(0,this.P),this.t-this.i)}addEventListeners(){this.removeEventListeners(),this.slideEls.length&&this.slideEls.forEach((t=>{this.resizeObserver.observe(t)})),this.containerEl&&(this.resizeObserver.observe(this.containerEl),this.containerEl.addEventListener("pointerdown",this.handlePointerdown),document.addEventListener("pointermove",this.handlePointermove,{passive:!0}),document.addEventListener("pointerup",this.handlePointerup),document.body.addEventListener("pointerleave",this.handlePointerup))}removeEventListeners(){this.resizeObserver.disconnect(),this.containerEl&&(this.containerEl.removeEventListener("pointerdown",this.handlePointerdown),document.removeEventListener("pointermove",this.handlePointermove),document.removeEventListener("pointerup",this.handlePointerup))}handlePointerdown(t){this.p=!0,this.v=this.S,this.P=this.S,this.M.start=t.clientX,this.M.previous=t.clientX,this.updateDimensions()}handlePointermove(t){if(!this.p)return;const i=t.clientX-this.M.start;Math.abs(i)>10&&this.containerEl.classList.add("ec-is-dragging"),this.P=this.v+i,s(this._,t.clientX-this.M.previous,10),this.M.previous=t.clientX}handlePointerup(){var t;this.containerEl.classList.remove("ec-is-dragging"),this.p=!1,this.P+=10*((t=this._).length?t.reduce(((t,s)=>t+s),0)/t.length:0),this.P=Math.max(Math.min(0,this.P),this.t-this.i),this.snapToSlide&&(this.P=-this.getClosestSlideToPoint(this.P).leftEdge)}updateDimensions(t){this.t=t||this.containerEl.offsetWidth;let s=0;this.h=this.slideEls.map(((t,i)=>{let e=t.offsetWidth,o=s;return s+=e,i<this.h.length-1&&(s+=this.gap),{width:e,x:o}})),this.i=s,this.finalAnchorSlide=this.getFinalAnchorSlide(),this.containerEl.style.setProperty("--ec-container-width",`${this.t}px`)}getAcceleration({displacement:t,m:s,stiffness:i=7,mass:e=17,friction:o=1.25}){let h=-i*t/e-o*s;return Math.abs(h)<.001&&(h=0),h*this.$}getClosestSlideToPoint(t){return this.h.reduce(((s,i,e)=>{const o=Math.abs(s.cumulativeWidth+t);return o<s.distanceFromTarget?{index:e,distanceFromTarget:o,leftEdge:s.cumulativeWidth,cumulativeWidth:s.cumulativeWidth+i.width+this.gap}:{...s,cumulativeWidth:s.cumulativeWidth+i.width+this.gap}}),{index:0,distanceFromTarget:1/0,leftEdge:0,cumulativeWidth:0})}getFinalAnchorSlide(){return this.slideEls.reduceRight(((t,s,i)=>(t.cumulativeWidth<this.t&&(t.index=i,t.cumulativeWidth+=this.h[i]?.width||0),t)),{index:0,cumulativeWidth:0}).index}updateScrollPos(){this.F(),this.F=i(this.containerEl,(t=>{this.t=t.width;const s=Math.max(Math.min((this.L-t.top)/(this.L+t.height),1),0);if(s!==this.j){this.u=!0;const t=this.j-s,i=this.L*t*.5;this.P+=i,this.P=Math.max(Math.min(0,this.P),this.t-this.i),this.j=s}this.B=t}))}updatePosition(){const t=this.S-this.P;let s=200,i=23,e=80;this.u&&(s=600,i=40,e=40),(0===this.P||this.P<=this.t-this.i)&&(s=100,i=16,e=45);const o=this.getAcceleration({displacement:t,m:this.m,stiffness:s,friction:i,mass:e});this.m+=o,this.S+=b(this.m)}getSlidePositions(){const t=b(this.S);let s=t,i=!1;const e=this.slideEls.map(((e,o)=>{const h=this.o[o],a=this.h[o]?.width;o>0&&(s+=this.h[o-1]?.width+this.gap);let n=0,r=0,l=0,c=0,d=Math.min(a*this.A,this.t);const p=this.h[o];p&&p.x+p.width*this.A>this.i&&(d=a*(this.slideEls.length-o)+Math.round(this.R));let u=Math.min(Math.max(d-Math.max(this.t-s+Math.round(this.R),0),0)/(d-this.k),1);const g=(a-this.k)*u;if(l=g,n=-g/2,c-=g,s<this.t&&s+a-l+this.gap>=this.t&&t<=0){const t=a-r-l,e=this.k-(this.t-s)<=0?t:this.t-s,h=this.t-(s+e);h>0&&!this.R&&(this.R=h*this.I,this.T=o+1,i=!0),e<this.k/2&&!this.R&&(this.R=(e+this.gap)*this.I,this.T=o+1,i=!0)}Math.round(s-this.gap)<=0&&Math.round(a+s)>0&&(o!==this.anchorSlide&&this.onSlideChange&&this.onSlideChange(o),this.anchorSlide=o),s<=0&&(r=Math.min(Math.abs(s),a-this.k),n=s/-2),this.G&&(s>this.t+250||s+a<-250?h.remove():h.isConnected||e.append(h));const b={el:e,contentEl:h,xPos:s,rightClipInset:l,leftClipInset:r,innerTranslate:n};return s+=c,b}));return i?this.getSlidePositions():e}positionSlides(){this.getSlidePositions().forEach((({el:t,contentEl:s,xPos:i,rightClipInset:e,leftClipInset:o,innerTranslate:h},a)=>{const n=Math.min(this.borderRadius,this.h[a]?.width/2);t.style.transform=`translate3d(${i}px, 0 ,0)`,t.style.clipPath=`inset(0 ${e}px 0 ${o}px round ${n}px)`,s.style.transform=`translate3d(${h}px, 0, 0)`}))}goToSlide(t){this.updateDimensions(),this.P=-this.h[t].x,this.P=Math.max(Math.min(0,this.P),this.t-this.i)}advance(){this.goToSlide(Math.min(this.getClosestSlideToPoint(this.P).index+1,this.slideEls.length-1))}retreat(){this.goToSlide(Math.max(this.getClosestSlideToPoint(this.P).index-1,0))}render(){this._.shift(),this.slideEls&&(this.bindToScrollPos&&this.updateScrollPos(),this.updatePosition(),this.positionSlides(),this.u=!1)}loop(){if(!this.l)return;const t=performance.now();t-this.C>16&&(this.render(),this.C=t),requestAnimationFrame((()=>this.loop()))}}function b(t,s=3){return parseFloat(t.toFixed(s))}class f extends a{label="ElasticCarousel";widgetSettings;feedMetadata;posts;previewLoadingColors=null;containerEl;headerEl;innerEl;footerEl;instagramLogoEl;labelEl;leftArrowEl;rightArrowEl;slidesContainerEl;postEls;popoverGalleryEl;appliedBreakpoint;medianPaletteHSL;gyre;constructor(){super(),this.onPropChange(this.W,["widgetSettings","feedMetadata","posts","previewLoadingColors"],["widgetSettings","feedMetadata","posts"],this.setup),n.register(),r.register(),l.register(),this.gyre=new g({onSlideChange:t=>this.O(t)}),this.H=this.H.bind(this),this.addEventListener("post-focus-next",this.D),this.addEventListener("post-focus-previous",this.J),this.onConnect((()=>{this.slidesContainerEl=t({classes:"ec-slides"}),this.headerEl=t({type:"header",classes:"ec-header"}),this.innerEl=t({classes:"ec-inner",contents:[this.slidesContainerEl]}),this.footerEl=t({type:"footer",classes:"ec-footer"}),this.labelEl=t({classes:"ec-label"}),this.leftArrowEl=t({type:"button",classes:"ec-button ec-retreat",contents:[p],listeners:{click:()=>this.q()},attributes:{tabindex:-1,disabled:!0}}),this.rightArrowEl=t({type:"button",classes:"ec-button ec-advance",contents:[u],listeners:{click:()=>this.U()},attributes:{tabindex:-1}}),this.containerEl=t({type:"figure",classes:"ec-carousel",contents:[this.innerEl]}),this.renderWidget(this.containerEl,[c,'.ec-carousel{--ec-controls-margin:20px;--ec-button-border-radius:40%;--ec-icon-color:#4a4a4a;--ec-text-color:#4a4a4a;--ec-button-color:#f4f4f4;--ec-button-hover-color:#ececec;--ec-button-icon-color:#4a4a4a;--ec-button-icon-hover-color:#2e2e2e;--ec-button-gap:min(calc(var(--ec-controls-margin)/2),5px);flex-direction:column;height:var(--ec-height);margin:0;overflow:hidden;width:100%}.ec-carousel,.ec-inner{display:flex;justify-content:center}.ec-inner{align-items:center}.ec-slides{border-radius:var(--ec-border-radius);contain:style paint;cursor:grab;height:var(--ec-height);justify-content:flex-start;overflow:hidden;position:relative;touch-action:none;width:100%}.ec-slide,.ec-slides{display:flex;isolation:isolate}.ec-slide{contain:content;flex-shrink:0;height:100%;left:0;max-width:calc(var(--ec-container-width)*.45);position:absolute;top:0;-moz-user-select:none;user-select:none;-webkit-user-select:none;will-change:clip-path,transform}.ec-is-dragging{cursor:grabbing}.ec-is-dragging .ec-slide{pointer-events:none}.ec-footer,.ec-header{display:flex;justify-content:center}.ec-carousel--controls-sides .ec-footer,.ec-carousel--controls-sides .ec-header{padding:0 64px}.ec-header{margin-bottom:var(--ec-controls-margin)}.ec-footer{margin-top:var(--ec-controls-margin)}.ec-label{align-items:center;display:flex;flex-shrink:1;gap:7px 5px;line-height:1.2;min-width:0;overflow:hidden;text-overflow:ellipsis;-moz-user-select:none;user-select:none;-webkit-user-select:none}.ec-carousel--controls-center .ec-button+.ec-label,.ec-carousel--controls-split .ec-button+.ec-label{margin:0 max(calc(var(--ec-controls-margin)*1.5),20px)}.ec-carousel--label-right .ec-label{margin-left:auto}.ec-carousel--label-left .ec-label{margin-right:auto}.ec-label svg{flex-shrink:0;height:24px;margin-right:5px;width:24px}.ec-label svg path{fill:var(--ec-icon-color)}.ec-label a{color:var(--ec-text-color);display:inline-block;font-family:inherit;font-size:19px;overflow:hidden;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.ec-button,.ec-carousel--controls-center .ec-footer,.ec-carousel--controls-center .ec-header{justify-content:center}.ec-button{align-items:center;background-color:transparent;border:none;cursor:pointer;display:flex;flex-shrink:0;height:44px;padding:0;transition:all .3s ease;width:44px}.ec-carousel--controls-sides .ec-button{height:var(--ec-height);width:64px}.ec-button:disabled{cursor:default;opacity:.5}.ec-button:before{background-color:var(--ec-button-color);border-radius:var(--ec-button-border-radius);content:"";height:44px;position:absolute;transition:all .3s ease;width:44px}.ec-button:not(:disabled):hover:before{background-color:var(--ec-button-hover-color)}.ec-button svg{height:14px;position:relative;width:auto;z-index:1}.ec-button svg path{fill:var(--ec-button-icon-color);transition:all .3s ease}.ec-button:not(:disabled):hover svg path{fill:var(--ec-button-icon-hover-color)}.ec-retreat{padding-right:var(--ec-button-gap);width:calc(44px + var(--ec-button-gap))}.ec-carousel--controls-split .ec-retreat{margin-right:auto}.ec-carousel--controls-right .ec-retreat{margin-left:auto}.ec-advance{padding-left:var(--ec-button-gap);width:calc(44px + var(--ec-button-gap))}.ec-carousel--controls-split .ec-advance{margin-left:auto}.ec-carousel--controls-left .ec-advance{margin-right:auto}.ec-carousel--controls-sides .ec-retreat{padding-right:20px}.ec-carousel--controls-sides .ec-advance{padding-left:20px}.post{height:100%;max-width:calc(var(--ec-container-width)*.45)}.post a{-webkit-user-drag:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.post--placeholder{background-color:#dedede;height:0;padding-bottom:calc(100%/var(--post-aspect-ratio))}']),this.setAttribute("tabindex","0"),this.setAttribute("aria-label","Gallery of Instagram posts. Shift + arrow keys to navigate"),this.onResize(this,this,this.N)}))}setup(){if("transparent"!==this.widgetSettings.loadingColor){const t=this.posts.filter((t=>t.colorPalette)).map((t=>t.colorPalette));this.medianPaletteHSL=d(t,this.widgetSettings.loadingColor)}const s=this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints);this.renderBreakpoint(s),e(this.containerEl,{"--ec-icon-color":this.widgetSettings.iconColor,"--ec-text-color":this.widgetSettings.textColor,"--ec-button-color":this.widgetSettings.buttonColor,"--ec-button-hover-color":this.widgetSettings.buttonHoverColor,"--ec-button-icon-color":this.widgetSettings.buttonIconColor,"--ec-button-icon-hover-color":this.widgetSettings.buttonIconHoverColor}),this.postEls.forEach((t=>{t.widgetSettings=this.widgetSettings,t.feedMetadata=this.feedMetadata}));const i=document.createElement("template");if(i.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M295.42,6c-53.2,2.51-89.53,11-121.29,23.48-32.87,12.81-60.73,30-88.45,57.82S40.89,143,28.17,175.92c-12.31,31.83-20.65,68.19-23,121.42S2.3,367.68,2.56,503.46,3.42,656.26,6,709.6c2.54,53.19,11,89.51,23.48,121.28,12.83,32.87,30,60.72,57.83,88.45S143,964.09,176,976.83c31.8,12.29,68.17,20.67,121.39,23s70.35,2.87,206.09,2.61,152.83-.86,206.16-3.39S799.1,988,830.88,975.58c32.87-12.86,60.74-30,88.45-57.84S964.1,862,976.81,829.06c12.32-31.8,20.69-68.17,23-121.35,2.33-53.37,2.88-70.41,2.62-206.17s-.87-152.78-3.4-206.1-11-89.53-23.47-121.32c-12.85-32.87-30-60.7-57.82-88.45S862,40.87,829.07,28.19c-31.82-12.31-68.17-20.7-121.39-23S637.33,2.3,501.54,2.56,348.75,3.4,295.42,6m5.84,903.88c-48.75-2.12-75.22-10.22-92.86-17-23.36-9-40-19.88-57.58-37.29s-28.38-34.11-37.5-57.42c-6.85-17.64-15.1-44.08-17.38-92.83-2.48-52.69-3-68.51-3.29-202s.22-149.29,2.53-202c2.08-48.71,10.23-75.21,17-92.84,9-23.39,19.84-40,37.29-57.57s34.1-28.39,57.43-37.51c17.62-6.88,44.06-15.06,92.79-17.38,52.73-2.5,68.53-3,202-3.29s149.31.21,202.06,2.53c48.71,2.12,75.22,10.19,92.83,17,23.37,9,40,19.81,57.57,37.29s28.4,34.07,37.52,57.45c6.89,17.57,15.07,44,17.37,92.76,2.51,52.73,3.08,68.54,3.32,202s-.23,149.31-2.54,202c-2.13,48.75-10.21,75.23-17,92.89-9,23.35-19.85,40-37.31,57.56s-34.09,28.38-57.43,37.5c-17.6,6.87-44.07,15.07-92.76,17.39-52.73,2.48-68.53,3-202.05,3.29s-149.27-.25-202-2.53m407.6-674.61a60,60,0,1,0,59.88-60.1,60,60,0,0,0-59.88,60.1M245.77,503c.28,141.8,115.44,256.49,257.21,256.22S759.52,643.8,759.25,502,643.79,245.48,502,245.76,245.5,361.22,245.77,503m90.06-.18a166.67,166.67,0,1,1,167,166.34,166.65,166.65,0,0,1-167-166.34" transform="translate(-2.5 -2.5)"/><title>Instagram</title></svg>',this.feedMetadata.hashtags?.length){const s=this.feedMetadata.hashtags.map(((s,i,e)=>t({type:"a",contents:["#",s,i<e.length-1?", ":""],attributes:{target:"_blank",href:`https://instagram.com/explore/tags/${s}`}})));this.labelEl.beholdReplaceChildren(i.content,...s)}else{const s=t({type:"a",contents:[this.feedMetadata.username],attributes:{target:"_blank",href:`https://instagram.com/${this.feedMetadata.username}`}});this.labelEl.beholdReplaceChildren(i.content,s)}"openPopupGallery"===this.widgetSettings.onPostClick&&this.enablePopoverGallery()}O(t){0===t&&this.leftArrowEl?this.leftArrowEl.disabled=!0:this.leftArrowEl.disabled=!1,t>=this.gyre.finalAnchorSlide?this.rightArrowEl.disabled=!0:this.rightArrowEl.disabled=!1}W({changedProp:t,oldValue:s,newValue:i}){switch(t){case"posts":this.K({oldValue:s,newValue:i});break;case"widgetSettings":this.X(s,i);break;case"feedMetadata":this.Y();break;case"previewLoadingColors":this.postEls.forEach((t=>{t.previewLoadingColors=this.previewLoadingColors})),o(this,{"is-previewing-loading-colors":!!this.previewLoadingColors})}}K({oldValue:t,newValue:s}){this.postEls=[],this.renderBreakpoint(this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints),!0),this.popoverGalleryEl&&(this.popoverGalleryEl.posts=this.posts)}X(t,s){let i=!1;this.postEls?.length&&!h(t.breakpoints,s.breakpoints,["postHeight"],1)||(i=!0),e(this.containerEl,{"--ec-icon-color":this.widgetSettings.iconColor,"--ec-text-color":this.widgetSettings.textColor,"--ec-button-color":this.widgetSettings.buttonColor,"--ec-button-hover-color":this.widgetSettings.buttonHoverColor,"--ec-button-icon-color":this.widgetSettings.buttonIconColor,"--ec-button-icon-hover-color":this.widgetSettings.buttonIconHoverColor}),"openPopupGallery"!==t?.onPostClick&&"openPopupGallery"===s?.onPostClick&&this.enablePopoverGallery();const o=this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints);this.renderBreakpoint(o,i),this.postEls.forEach((t=>{t.widgetSettings=this.widgetSettings})),this.popoverGalleryEl&&(this.popoverGalleryEl.widgetSettings=this.widgetSettings)}Y(){let t=`from @${this.feedMetadata.username}`;this.feedMetadata.hashtags?.length&&(t=`from hashtag${this.feedMetadata.hashtags.length>1?"s":""} ${this.feedMetadata.hashtags.join(", ")}`),this.setAttribute("aria-label",`Gallery of Instagram posts ${t}. Shift + arrow keys to navigate`),this.postEls.forEach((t=>{t.feedMetadata=this.feedMetadata})),this.popoverGalleryEl&&(this.popoverGalleryEl.feedMetadata=this.feedMetadata)}async enablePopoverGallery(){if(this.popoverGalleryEl)return;const{default:t}=await import("./PopoverGallery-XY6iWNsl.js");t.register(),this.popoverGalleryEl=document.createElement("behold-popover-gallery"),Object.assign(this.popoverGalleryEl,{widgetSettings:this.widgetSettings,feedMetadata:this.feedMetadata,posts:this.posts,closeFocusEl:this,onSlideChange:t=>{this.gyre.goToSlide(t),this.popoverGalleryEl.closeFocusEl=this.postEls[t]}})}N(t){const s=t.contentBoxSize?.[0]?.inlineSize,i=this.widgetSettings.breakpoints,e=this.getMatchingBreakpoint(s,i);this.renderBreakpoint(e)}J(){if(!this.postEls.length)return;let t=[...this.postEls].indexOf(this.shadow.activeElement?.parentElement);t>0&&(t-=1),this.postEls[t].focus(),this.gyre.goToSlide(t)}D(){if(!this.postEls.length)return;let t=[...this.postEls].indexOf(this.shadow.activeElement?.parentElement);this.gyre.anchorSlide>0&&t<this.gyre.anchorSlide&&(t=this.gyre.anchorSlide),t>-1&&t<this.postEls.length-1&&(t+=1),t<0&&(t=0),this.postEls[t].focus(),this.gyre.goToSlide(t)}H(t){this.popoverGalleryEl.open(this.postEls.indexOf(t),t)}U(){this.gyre&&this.gyre.advance()}q(){this.gyre&&this.gyre.retreat()}renderPosts(t){this.postEls=this.createPostEls(t),this.raf((()=>{this.gyre.init({containerEl:this.slidesContainerEl,slideEls:this.postEls,height:t.postHeight,gap:t.gap.x,borderRadius:parseInt(t.borderRadius),applyBorderRadiusToContainer:t.applyBorderRadiusToContainer||!0,snapToSlide:t.snapToSlide||!1,bindToScrollPos:t.bindToScrollPos||!1})}),"renderPosts")}getMatchingBreakpoint(t,s){return Object.entries(s).map((([t,s])=>({width:t,...s}))).filter((t=>"default"!==t.width)).sort(((t,s)=>parseInt(s.width)-parseInt(t.width))).reduce(((s,i)=>t<=parseInt(i.width)?i:s),s.default)}renderBreakpoint(t,s=!1){if(!this.posts||!this.containerEl)return;const i=this.appliedBreakpoint,{showControls:a,controlsPosition:n,controlsJustification:r,showLabel:l,labelPosition:c,labelJustification:d,buttonBorderRadius:p,controlsMargin:u}=t;if(this.postEls?.length&&!h(i,t,["numPosts","forcePostAspectRatio","postAspectRatio"])||(s=!0),this.widgetSettings.maxWidth&&this.widgetSettings.constrainWidth&&this.containerEl.style.maxWidth!==`${this.widgetSettings.maxWidth}px`&&(this.containerEl.style.maxWidth=`${this.widgetSettings.maxWidth}px`),this.widgetSettings.constrainWidth||(this.containerEl.style.maxWidth=""),this.leftArrowEl.remove(),this.rightArrowEl.remove(),h(i,t,["showControls","controlsPosition","controlsJustification","showLabel","labelPosition","labelJustification"])||a&&!this.leftArrowEl.isConnected||l&&!this.labelEl.isConnected){this.leftArrowEl.remove(),this.rightArrowEl.remove(),this.labelEl.remove(),this.headerEl.remove(),this.footerEl.remove(),e(this.containerEl,{"--ec-button-border-radius":`${p}%`,"--ec-controls-margin":`${u}px`}),o(this.containerEl,{"ec-carousel--controls-sides":"sides"===n,"ec-carousel--controls-left":"left"===r,"ec-carousel--controls-right":"right"===r,"ec-carousel--controls-center":"center"===r,"ec-carousel--controls-split":"split"===r,"ec-carousel--label-left":"left"===d,"ec-carousel--label-right":"right"===d,"ec-carousel--label-center":"left"===d}),l&&("top"===c&&this.headerEl.append(this.labelEl),"bottom"===c&&this.footerEl.append(this.labelEl));let t=this.innerEl;if("top"===n&&(t=this.headerEl),"bottom"===n&&(t=this.footerEl),a&&"sides"===n)t.prepend(this.leftArrowEl),t.append(this.rightArrowEl);else if(a)switch(r){case"left":t.prepend(this.rightArrowEl),t.prepend(this.leftArrowEl);break;case"right":t.append(this.leftArrowEl),t.append(this.rightArrowEl);break;default:t.prepend(this.leftArrowEl),t.append(this.rightArrowEl)}this.headerEl.childElementCount&&this.containerEl.prepend(this.headerEl),this.footerEl.childElementCount&&this.containerEl.append(this.footerEl)}this.containerEl.setAttribute("data-hover-effect",this.widgetSettings.hoverEffect),s?this.renderPosts(t):this.gyre.updateSettings({height:t.postHeight,gap:t.gap.x,borderRadius:parseInt(t.borderRadius),applyBorderRadiusToContainer:t.applyBorderRadiusToContainer,snapToSlide:t.snapToSlide,bindToScrollPos:t.bindToScrollPos}),this.appliedBreakpoint=t}createPostEls(s){const{numPosts:i,postHeight:e,postAspectRatio:o,forcePostAspectRatio:h}=s,a=this.posts.filter(((t,i)=>i<(s?.numPosts||this.posts?.length||200))),n=a.map(((s,n)=>{const r=[s.sizes.full.width,s.sizes.full.height],l=h?o||[1,1]:r,c=l.reduce(((t,s)=>t/s));let d="behold-image-post";return"VIDEO"===s.mediaType&&(d="behold-video-post"),"CAROUSEL_ALBUM"===s.mediaType&&(d="behold-album-post"),t({type:d,props:{post:s,widgetSettings:this.widgetSettings,feedMetadata:this.feedMetadata,medianPaletteHSL:this.medianPaletteHSL,onClick:this.H,hasRowGap:!0,isLastRow:!1,index:n,aspectRatio:l,totalPosts:a?.length||i||this.posts?.length||0},style:{width:e*c+"px","--post-aspect-ratio":c}})}));for(;n.length<s.numPosts;){const s=t({classes:"post post--placeholder",style:{width:`${e}px`,"--post-aspect-ratio":1}});n.push(s)}return n}static register(t="behold-elastic-carousel"){return customElements.get(t)||customElements.define(t,f),t}}export{f as default};
@@ -1 +1 @@
1
- import{B as t,t as e,c as s,a as n}from"./index-8GmY65W7.js";class l extends t{label="ErrorMessage";shadow;logoEl;styleEl;errorTitleEl;errorMessageEl;errorMessageTextEl;errorMessage;constructor(){super(),this.shadow=this.attachShadow({mode:"open"}),this.onPropChange(this.t,["errorMessage"]),this.onConnect((()=>{this.onResize(this,this,e(this.l,50,this))})),this.onConnect((()=>{this.render()}))}t({changedProp:t}){this.render()}render(){if(!this.errorMessage)return;let t='<?xml version="1.0" encoding="utf-8"?>\n<svg version="1.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.5 20.5" enable-background="new 0 0 20.5 20.5" xml:space="preserve">\n<g>\n\t<path fill="#010101" d="M10.2,20.5c-1.2,0-2.4-0.2-3.8-0.5c-2.9-0.7-5.3-3.1-6-6.1C0.2,12.7,0,11.4,0,10.3C0,9.2,0.1,8,0.4,6.8\n\t\tC1.1,3.6,3.7,1,6.9,0.4c2.4-0.5,4.4-0.5,6.8,0c3.3,0.7,5.8,3.2,6.5,6.5c0.2,1.1,0.4,2.3,0.4,3.3c0,1.1-0.1,2.3-0.4,3.5l0,0\n\t\tc-0.7,3.2-3.2,5.7-6.4,6.4C12.5,20.4,11.3,20.5,10.2,20.5z M10.2,1.5c-0.9,0-2,0.1-3,0.3C4.5,2.4,2.5,4.5,1.9,7.1\n\t\tc-0.2,1.1-0.4,2.2-0.4,3.1c0,1,0.1,2.2,0.4,3.4c0.6,2.4,2.5,4.4,4.9,5c2.3,0.6,4.2,0.6,6.6,0.1c2.6-0.6,4.7-2.7,5.2-5.3\n\t\tc0.2-1.1,0.3-2.1,0.3-3.2c0-1-0.1-2-0.3-3c-0.5-2.7-2.6-4.7-5.3-5.3C12.2,1.6,11.2,1.5,10.2,1.5z"/>\n</g>\n<g>\n\t<g>\n\t\t<path fill="#010101" d="M10.2,13.5c0.6,0,1,0.5,1,1.1c0,0.6-0.5,1.1-1,1.1s-1-0.5-1-1.1C9.2,14,9.7,13.5,10.2,13.5z M9.6,12.3\n\t\t\tL9.3,4.7h1.9l-0.3,7.5H9.6z"/>\n\t</g>\n</g>\n</svg>',e="Error";this.errorMessage.includes("Upgrade")&&(t='<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17.54 17.54"><path d="M8.77,17.54c-2.35,0-4.7-.81-6.33-2.44C-.81,11.84-.81,5.69,2.44,2.44,5.69-.81,11.84-.81,15.1,2.44c3.26,3.25,3.25,9.4,0,12.66-1.63,1.63-3.98,2.44-6.33,2.44ZM8.77,1.51c-1.97,0-3.94,.67-5.27,1.99C.84,6.16,.84,11.38,3.5,14.04c2.66,2.66,7.88,2.66,10.54,0,2.66-2.66,2.66-7.88,0-10.54-1.33-1.33-3.3-1.99-5.27-1.99Z"/><path d="M8.76,13.02c-.41,0-.75-.34-.75-.75V5.26c0-.41,.34-.75,.75-.75s.75,.34,.75,.75v7.01c0,.41-.34,.75-.75,.75Z"/><path d="M6.36,8.42c-.19,0-.38-.07-.53-.22-.29-.29-.29-.77,0-1.06l2.41-2.41c.29-.29,.77-.29,1.06,0s.29,.77,0,1.06l-2.41,2.41c-.15,.15-.34,.22-.53,.22Z"/><path d="M11.17,8.42c-.19,0-.38-.07-.53-.22l-2.41-2.41c-.29-.29-.29-.77,0-1.06s.77-.29,1.06,0l2.41,2.41c.29,.29,.29,.77,0,1.06-.15,.15-.34,.22-.53,.22Z"/></svg>',e="Upgrade Required"),this.logoEl=s({type:"a",classes:"logo",contents:'<?xml version="1.0" encoding="utf-8"?>\n<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 91.5 29.5" enable-background="new 0 0 91.5 29.5" xml:space="preserve">\n<g>\n\t<path fill="#3BA566" d="M12,11.7c0.8,0,1.8,0.1,2.8,0.3c1.3,0.3,2.4,1.3,2.6,2.6c0.2,1,0.3,1.9,0.3,2.8s-0.1,1.9-0.3,2.9\n\t\tc-0.3,1.3-1.3,2.3-2.6,2.6c-1,0.2-2,0.4-2.8,0.4c-0.9,0-1.9-0.1-3-0.4s-2-1.2-2.3-2.3s-0.4-2.1-0.4-3c0-0.8,0.1-1.8,0.3-2.8\n\t\tc0.3-1.3,1.3-2.4,2.6-2.6C10.2,11.9,11.2,11.7,12,11.7 M12,5.5c-1.4,0-2.8,0.2-4,0.5c-3.8,0.7-6.7,3.6-7.5,7.4\n\t\tC0.2,14.7,0,16.1,0,17.5c0,1.6,0.2,3.1,0.6,4.5c0.8,3.4,3.5,6.1,6.9,7c1.4,0.3,2.9,0.5,4.5,0.5c1.5,0,2.9-0.2,4.2-0.5\n\t\tc3.7-0.8,6.5-3.7,7.3-7.4c0.3-1.3,0.5-2.7,0.5-4.2c0-1.4-0.2-2.8-0.4-4c-0.8-3.8-3.7-6.6-7.5-7.4C14.8,5.7,13.4,5.5,12,5.5L12,5.5z\n\t\t"/>\n</g>\n<g id="type">\n\t<path fill="#FFFFFF" d="M42.2,20.8c0,2.6-1.9,4.3-5.1,4.3h-5.2c0.5-1.4,0.6-2.5,0.6-3.9v-7.7c0-1.4-0.1-2.5-0.6-3.9H37\n\t\tc2.4,0,4.7,1,4.7,3.6c0,2.1-1.4,3.4-3.1,3.9C40.5,17.5,42.2,18.5,42.2,20.8z M35.2,10.4c0,1.1-0.1,2-0.1,3v3.4h1.4\n\t\tc1.7,0,2.5-1.2,2.5-3.1c0-2.2-1-3.4-3.2-3.4C35.6,10.4,35.4,10.4,35.2,10.4z M39.5,21.3c0-2.4-1.4-3.6-3.3-3.6\n\t\tc-0.2,0-0.6,0-1.1,0.1v3.5c0,0.9,0,2,0.1,2.9c0.5,0.1,0.9,0.1,1.4,0.1C38.6,24.3,39.5,23.2,39.5,21.3z"/>\n\t<path fill="#FFFFFF" d="M52.7,19.1h-6.5c0.2,2.5,1.2,4.1,3.8,4.1c1.1,0,1.8-0.3,2.6-0.9c-0.2,1.6-1.5,3.1-3.9,3.1c-3,0-5-2.4-5-6.2\n\t\tc0-3.4,1.6-6.4,5-6.4c2.9,0,4,2.1,4,4.5C52.7,17.3,52.7,19.1,52.7,19.1z M50.2,17.3c0-2.5-0.7-3.6-1.8-3.6c-1.3,0-2.1,1.5-2.1,4.3\n\t\tv0.3h3C50,18.4,50.2,18.3,50.2,17.3z"/>\n\t<path fill="#FFFFFF" d="M64,25.2h-2.8c-0.2-1.1-0.3-2.4-0.3-3.8v-4.6c0-1.4-0.5-2.1-1.5-2.1c-0.6,0-1.3,0.2-2.1,1.2v5.6\n\t\tc0,1.3,0.1,2.3,0.6,3.6h-3.6c0.5-1.3,0.6-2.3,0.6-3.6v-8.2c0-1.5,0-2.9-0.6-4c1.1-0.3,2-0.7,3-1.2v7c0.9-1.6,2.2-2.2,3.4-2.2\n\t\tc1.6,0,2.6,1,2.6,3.4v5C63.4,22.7,63.5,23.8,64,25.2z"/>\n\t<path fill="#FFFFFF" d="M65.4,19.2c0-3.8,2-6.3,5-6.3c2.9,0,4.8,2.7,4.8,6.3c0,3.8-2,6.3-5,6.3C67.3,25.4,65.4,22.8,65.4,19.2z\n\t\t M72.4,19.9c0-3.1-0.7-6.1-2.4-6.1c-1.3,0-1.9,1.7-1.9,4.6c0,3.2,0.7,6.1,2.4,6.1C71.8,24.5,72.4,23,72.4,19.9z"/>\n\t<path fill="#FFFFFF" d="M77.3,21.5v-8.2c0-1.5,0-2.9-0.6-4c1.1-0.3,2-0.7,3-1.2v13.4c0,1.3,0.1,2.3,0.6,3.6h-3.6\n\t\tC77.2,23.8,77.3,22.8,77.3,21.5z"/>\n\t<path fill="#FFFFFF" d="M89,25.2c-0.2-0.3-0.4-0.8-0.4-1.4c-0.7,1.1-1.6,1.5-2.8,1.5c-2.2,0-4-1.9-4-5.6c0-4.4,2.4-6.8,5-6.8\n\t\tc0.7,0,1.2,0.1,1.7,0.4l0,0c0-1.4,0-2.9-0.6-3.9c1.1-0.3,2-0.7,3-1.2v13.3c0,1.3,0.1,2.2,0.6,3.6H89V25.2z M88.5,23.1v-6.6\n\t\tc0-2-0.8-2.6-1.7-2.6c-1.4,0-2.3,1.5-2.3,4.8c0,3.4,1.1,4.9,2.8,4.9C87.8,23.5,88.2,23.4,88.5,23.1z"/>\n</g>\n<g>\n\t<path fill="#FFFFFF" d="M32.3,4.7V0.1h2.2c1,0,1.6,0.7,1.6,1.5c0,0.8-0.6,1.5-1.6,1.5h-1.2v1.7H32.3z M34.3,0.9h-1.1v1.3h1.1\n\t\tC34.7,2.2,35,2,35,1.6C35,1.2,34.7,0.9,34.3,0.9z"/>\n\t<path fill="#FFFFFF" d="M39.5,0C41,0,42,1,42,2.4c0,1.4-1,2.4-2.4,2.4c-1.4,0-2.4-1-2.4-2.4C37.1,1,38.1,0,39.5,0z M39.5,0.9\n\t\tc-0.9,0-1.4,0.7-1.4,1.5c0,0.9,0.6,1.5,1.4,1.5S41,3.3,41,2.4C41,1.5,40.4,0.9,39.5,0.9z"/>\n\t<path fill="#FFFFFF" d="M46.8,4.7L46,1.5l-0.8,3.2h-1.1l-1.3-4.7h1.1l0.8,3.4l0.9-3.4h0.8l0.9,3.4l0.8-3.4h1.1l-1.3,4.7H46.8z"/>\n\t<path fill="#FFFFFF" d="M50.4,4.7V0.1h3.3v0.9h-2.3v1h2.3v0.9h-2.3v1.1h2.3v0.9H50.4z"/>\n\t<path fill="#FFFFFF" d="M57.8,4.7l-0.9-1.7h-0.7v1.7h-1V0.1h2.2c1,0,1.6,0.6,1.6,1.5c0,0.8-0.5,1.3-1,1.4l1.1,1.8H57.8z M57.2,0.9\n\t\th-1v1.3h1c0.4,0,0.7-0.3,0.7-0.6C57.9,1.2,57.6,0.9,57.2,0.9z"/>\n\t<path fill="#FFFFFF" d="M60.4,4.7V0.1h3.3v0.9h-2.3v1h2.3v0.9h-2.3v1.1h2.3v0.9H60.4z"/>\n\t<path fill="#FFFFFF" d="M65.1,4.7V0.1H67c1.5,0,2.5,0.9,2.5,2.3c0,1.4-1,2.3-2.5,2.3H65.1z M66.1,3.9H67c0.9,0,1.5-0.7,1.5-1.5\n\t\tC68.4,1.6,67.9,1,67,1h-0.8V3.9z"/>\n\t<path fill="#FFFFFF" d="M73.3,4.7V0.1h2.5c0.9,0,1.3,0.6,1.3,1.2c0,0.6-0.4,1-0.8,1.1c0.5,0.1,0.9,0.6,0.9,1.1\n\t\tc0,0.7-0.5,1.3-1.4,1.3H73.3z M74.3,2h1.2c0.3,0,0.5-0.2,0.5-0.5c0-0.3-0.2-0.5-0.5-0.5h-1.2V2z M74.3,3.9h1.3\n\t\tc0.4,0,0.6-0.2,0.6-0.6c0-0.3-0.2-0.5-0.6-0.5h-1.3V3.9z"/>\n\t<path fill="#FFFFFF" d="M79.8,4.7V2.8L78,0.1h1.1L80.3,2l1.1-1.9h1.1l-1.8,2.8v1.9H79.8z"/>\n</g>\n</svg>',attributes:{href:"https://behold.so",target:"_blank","aria-label":"behold"}}),this.errorTitleEl=s({classes:"message__title",contents:[t,e]}),this.errorMessageTextEl=s({classes:"message__inner"}),this.errorMessageTextEl.innerHTML=this.errorMessage?.replace("Upgrade your plan",'<a href="https://app.behold.so/account" target="blank">Upgrade your plan</a>'),this.errorMessageEl=s({classes:"message",contents:[this.errorTitleEl,this.errorMessageTextEl]}),this.styleEl=s({type:"style",contents:":host{align-items:center;background:#f1f1f1 url(https://behold.pictures/widget:error-background.webp) 0 no-repeat;background-size:auto 100%;border:none;border-radius:20px;box-shadow:none;box-sizing:border-box;color:#000;display:flex;height:200px;justify-content:space-between;margin:0;max-width:750px;min-width:50px;outline:none;overflow:hidden;width:100%}:host *{box-sizing:border-box}:host(.large){height:180px}:host(.medium),:host(.small){background:#f1f1f1 url(https://behold.pictures/widget:error-background-small.webp) top no-repeat;background-size:auto 186px;flex-direction:column;height:auto}.logo{align-items:center;background:linear-gradient(90deg,rgba(0,0,0,.75) 10%,rgba(0,0,0,.5) 75%,transparent);display:flex;flex-grow:0;flex-shrink:0;height:100%;justify-content:center;padding:0 10px 5px 0;width:220px}.logo svg{height:40px;width:auto}:host(.large) .logo{width:180px}:host(.large) .logo svg{height:35px}:host(.medium) .logo,:host(.small) .logo{background:linear-gradient(180deg,rgba(0,0,0,.75) 10%,rgba(0,0,0,.5) 40%,transparent);height:150px;width:100%}.message{align-items:center;display:flex;flex-direction:column;flex-grow:1;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;font-size:16px;gap:15px;justify-content:center;line-height:1.5;padding:20px 60px 20px 80px;text-align:center}.message a{color:#000;display:inline-block;text-decoration:underline}:host(.large) .message{font-size:15px;gap:10px;padding:20px 30px 20px 70px}:host(.medium) .message{font-size:16px;gap:15px;padding:40px 30px}:host(.small) .message{font-size:15px;gap:15px;padding:30px 20px}.message__title{align-items:center;display:flex;font-size:20px;font-weight:500;justify-content:center}.message__title svg{height:25px;margin-right:15px;width:25px}:host(.large) .message__title{font-size:18px}:host(.large) .message__title svg{height:20px;margin-right:10px;width:20px}:host(.medium) .message__title,:host(.small) .message__title{flex-direction:column;font-size:17px}:host(.medium) .message__title svg,:host(.small) .message__title svg{margin-bottom:7px;margin-right:0}".toString()}),this.shadow.beholdReplaceChildren(this.logoEl,this.errorMessageEl,this.styleEl)}l(t){const e=t?.borderBoxSize?.[0]?.inlineSize||t?.contentRect?.width||0;let s="xlarge";e<600&&(s="large"),e<500&&(s="medium"),e<250&&(s="small"),["small","medium","large","xlarge"].forEach((t=>{n(this,{[`${t}`]:t===s})}))}static register(t="behold-error-message"){return customElements.get(t)||customElements.define(t,l),t}}export{l as default};
1
+ import{B as t,t as e,c as s,a as n}from"./index-ANfp_6HB.js";class l extends t{label="ErrorMessage";shadow;logoEl;styleEl;errorTitleEl;errorMessageEl;errorMessageTextEl;errorMessage;constructor(){super(),this.shadow=this.attachShadow({mode:"open"}),this.onPropChange(this.t,["errorMessage"]),this.onConnect((()=>{this.onResize(this,this,e(this.l,50,this))})),this.onConnect((()=>{this.render()}))}t({changedProp:t}){this.render()}render(){if(!this.errorMessage)return;let t='<?xml version="1.0" encoding="utf-8"?>\n<svg version="1.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.5 20.5" enable-background="new 0 0 20.5 20.5" xml:space="preserve">\n<g>\n\t<path fill="#010101" d="M10.2,20.5c-1.2,0-2.4-0.2-3.8-0.5c-2.9-0.7-5.3-3.1-6-6.1C0.2,12.7,0,11.4,0,10.3C0,9.2,0.1,8,0.4,6.8\n\t\tC1.1,3.6,3.7,1,6.9,0.4c2.4-0.5,4.4-0.5,6.8,0c3.3,0.7,5.8,3.2,6.5,6.5c0.2,1.1,0.4,2.3,0.4,3.3c0,1.1-0.1,2.3-0.4,3.5l0,0\n\t\tc-0.7,3.2-3.2,5.7-6.4,6.4C12.5,20.4,11.3,20.5,10.2,20.5z M10.2,1.5c-0.9,0-2,0.1-3,0.3C4.5,2.4,2.5,4.5,1.9,7.1\n\t\tc-0.2,1.1-0.4,2.2-0.4,3.1c0,1,0.1,2.2,0.4,3.4c0.6,2.4,2.5,4.4,4.9,5c2.3,0.6,4.2,0.6,6.6,0.1c2.6-0.6,4.7-2.7,5.2-5.3\n\t\tc0.2-1.1,0.3-2.1,0.3-3.2c0-1-0.1-2-0.3-3c-0.5-2.7-2.6-4.7-5.3-5.3C12.2,1.6,11.2,1.5,10.2,1.5z"/>\n</g>\n<g>\n\t<g>\n\t\t<path fill="#010101" d="M10.2,13.5c0.6,0,1,0.5,1,1.1c0,0.6-0.5,1.1-1,1.1s-1-0.5-1-1.1C9.2,14,9.7,13.5,10.2,13.5z M9.6,12.3\n\t\t\tL9.3,4.7h1.9l-0.3,7.5H9.6z"/>\n\t</g>\n</g>\n</svg>',e="Error";this.errorMessage.includes("Upgrade")&&(t='<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17.54 17.54"><path d="M8.77,17.54c-2.35,0-4.7-.81-6.33-2.44C-.81,11.84-.81,5.69,2.44,2.44,5.69-.81,11.84-.81,15.1,2.44c3.26,3.25,3.25,9.4,0,12.66-1.63,1.63-3.98,2.44-6.33,2.44ZM8.77,1.51c-1.97,0-3.94,.67-5.27,1.99C.84,6.16,.84,11.38,3.5,14.04c2.66,2.66,7.88,2.66,10.54,0,2.66-2.66,2.66-7.88,0-10.54-1.33-1.33-3.3-1.99-5.27-1.99Z"/><path d="M8.76,13.02c-.41,0-.75-.34-.75-.75V5.26c0-.41,.34-.75,.75-.75s.75,.34,.75,.75v7.01c0,.41-.34,.75-.75,.75Z"/><path d="M6.36,8.42c-.19,0-.38-.07-.53-.22-.29-.29-.29-.77,0-1.06l2.41-2.41c.29-.29,.77-.29,1.06,0s.29,.77,0,1.06l-2.41,2.41c-.15,.15-.34,.22-.53,.22Z"/><path d="M11.17,8.42c-.19,0-.38-.07-.53-.22l-2.41-2.41c-.29-.29-.29-.77,0-1.06s.77-.29,1.06,0l2.41,2.41c.29,.29,.29,.77,0,1.06-.15,.15-.34,.22-.53,.22Z"/></svg>',e="Upgrade Required"),this.logoEl=s({type:"a",classes:"logo",contents:'<?xml version="1.0" encoding="utf-8"?>\n<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 91.5 29.5" enable-background="new 0 0 91.5 29.5" xml:space="preserve">\n<g>\n\t<path fill="#3BA566" d="M12,11.7c0.8,0,1.8,0.1,2.8,0.3c1.3,0.3,2.4,1.3,2.6,2.6c0.2,1,0.3,1.9,0.3,2.8s-0.1,1.9-0.3,2.9\n\t\tc-0.3,1.3-1.3,2.3-2.6,2.6c-1,0.2-2,0.4-2.8,0.4c-0.9,0-1.9-0.1-3-0.4s-2-1.2-2.3-2.3s-0.4-2.1-0.4-3c0-0.8,0.1-1.8,0.3-2.8\n\t\tc0.3-1.3,1.3-2.4,2.6-2.6C10.2,11.9,11.2,11.7,12,11.7 M12,5.5c-1.4,0-2.8,0.2-4,0.5c-3.8,0.7-6.7,3.6-7.5,7.4\n\t\tC0.2,14.7,0,16.1,0,17.5c0,1.6,0.2,3.1,0.6,4.5c0.8,3.4,3.5,6.1,6.9,7c1.4,0.3,2.9,0.5,4.5,0.5c1.5,0,2.9-0.2,4.2-0.5\n\t\tc3.7-0.8,6.5-3.7,7.3-7.4c0.3-1.3,0.5-2.7,0.5-4.2c0-1.4-0.2-2.8-0.4-4c-0.8-3.8-3.7-6.6-7.5-7.4C14.8,5.7,13.4,5.5,12,5.5L12,5.5z\n\t\t"/>\n</g>\n<g id="type">\n\t<path fill="#FFFFFF" d="M42.2,20.8c0,2.6-1.9,4.3-5.1,4.3h-5.2c0.5-1.4,0.6-2.5,0.6-3.9v-7.7c0-1.4-0.1-2.5-0.6-3.9H37\n\t\tc2.4,0,4.7,1,4.7,3.6c0,2.1-1.4,3.4-3.1,3.9C40.5,17.5,42.2,18.5,42.2,20.8z M35.2,10.4c0,1.1-0.1,2-0.1,3v3.4h1.4\n\t\tc1.7,0,2.5-1.2,2.5-3.1c0-2.2-1-3.4-3.2-3.4C35.6,10.4,35.4,10.4,35.2,10.4z M39.5,21.3c0-2.4-1.4-3.6-3.3-3.6\n\t\tc-0.2,0-0.6,0-1.1,0.1v3.5c0,0.9,0,2,0.1,2.9c0.5,0.1,0.9,0.1,1.4,0.1C38.6,24.3,39.5,23.2,39.5,21.3z"/>\n\t<path fill="#FFFFFF" d="M52.7,19.1h-6.5c0.2,2.5,1.2,4.1,3.8,4.1c1.1,0,1.8-0.3,2.6-0.9c-0.2,1.6-1.5,3.1-3.9,3.1c-3,0-5-2.4-5-6.2\n\t\tc0-3.4,1.6-6.4,5-6.4c2.9,0,4,2.1,4,4.5C52.7,17.3,52.7,19.1,52.7,19.1z M50.2,17.3c0-2.5-0.7-3.6-1.8-3.6c-1.3,0-2.1,1.5-2.1,4.3\n\t\tv0.3h3C50,18.4,50.2,18.3,50.2,17.3z"/>\n\t<path fill="#FFFFFF" d="M64,25.2h-2.8c-0.2-1.1-0.3-2.4-0.3-3.8v-4.6c0-1.4-0.5-2.1-1.5-2.1c-0.6,0-1.3,0.2-2.1,1.2v5.6\n\t\tc0,1.3,0.1,2.3,0.6,3.6h-3.6c0.5-1.3,0.6-2.3,0.6-3.6v-8.2c0-1.5,0-2.9-0.6-4c1.1-0.3,2-0.7,3-1.2v7c0.9-1.6,2.2-2.2,3.4-2.2\n\t\tc1.6,0,2.6,1,2.6,3.4v5C63.4,22.7,63.5,23.8,64,25.2z"/>\n\t<path fill="#FFFFFF" d="M65.4,19.2c0-3.8,2-6.3,5-6.3c2.9,0,4.8,2.7,4.8,6.3c0,3.8-2,6.3-5,6.3C67.3,25.4,65.4,22.8,65.4,19.2z\n\t\t M72.4,19.9c0-3.1-0.7-6.1-2.4-6.1c-1.3,0-1.9,1.7-1.9,4.6c0,3.2,0.7,6.1,2.4,6.1C71.8,24.5,72.4,23,72.4,19.9z"/>\n\t<path fill="#FFFFFF" d="M77.3,21.5v-8.2c0-1.5,0-2.9-0.6-4c1.1-0.3,2-0.7,3-1.2v13.4c0,1.3,0.1,2.3,0.6,3.6h-3.6\n\t\tC77.2,23.8,77.3,22.8,77.3,21.5z"/>\n\t<path fill="#FFFFFF" d="M89,25.2c-0.2-0.3-0.4-0.8-0.4-1.4c-0.7,1.1-1.6,1.5-2.8,1.5c-2.2,0-4-1.9-4-5.6c0-4.4,2.4-6.8,5-6.8\n\t\tc0.7,0,1.2,0.1,1.7,0.4l0,0c0-1.4,0-2.9-0.6-3.9c1.1-0.3,2-0.7,3-1.2v13.3c0,1.3,0.1,2.2,0.6,3.6H89V25.2z M88.5,23.1v-6.6\n\t\tc0-2-0.8-2.6-1.7-2.6c-1.4,0-2.3,1.5-2.3,4.8c0,3.4,1.1,4.9,2.8,4.9C87.8,23.5,88.2,23.4,88.5,23.1z"/>\n</g>\n<g>\n\t<path fill="#FFFFFF" d="M32.3,4.7V0.1h2.2c1,0,1.6,0.7,1.6,1.5c0,0.8-0.6,1.5-1.6,1.5h-1.2v1.7H32.3z M34.3,0.9h-1.1v1.3h1.1\n\t\tC34.7,2.2,35,2,35,1.6C35,1.2,34.7,0.9,34.3,0.9z"/>\n\t<path fill="#FFFFFF" d="M39.5,0C41,0,42,1,42,2.4c0,1.4-1,2.4-2.4,2.4c-1.4,0-2.4-1-2.4-2.4C37.1,1,38.1,0,39.5,0z M39.5,0.9\n\t\tc-0.9,0-1.4,0.7-1.4,1.5c0,0.9,0.6,1.5,1.4,1.5S41,3.3,41,2.4C41,1.5,40.4,0.9,39.5,0.9z"/>\n\t<path fill="#FFFFFF" d="M46.8,4.7L46,1.5l-0.8,3.2h-1.1l-1.3-4.7h1.1l0.8,3.4l0.9-3.4h0.8l0.9,3.4l0.8-3.4h1.1l-1.3,4.7H46.8z"/>\n\t<path fill="#FFFFFF" d="M50.4,4.7V0.1h3.3v0.9h-2.3v1h2.3v0.9h-2.3v1.1h2.3v0.9H50.4z"/>\n\t<path fill="#FFFFFF" d="M57.8,4.7l-0.9-1.7h-0.7v1.7h-1V0.1h2.2c1,0,1.6,0.6,1.6,1.5c0,0.8-0.5,1.3-1,1.4l1.1,1.8H57.8z M57.2,0.9\n\t\th-1v1.3h1c0.4,0,0.7-0.3,0.7-0.6C57.9,1.2,57.6,0.9,57.2,0.9z"/>\n\t<path fill="#FFFFFF" d="M60.4,4.7V0.1h3.3v0.9h-2.3v1h2.3v0.9h-2.3v1.1h2.3v0.9H60.4z"/>\n\t<path fill="#FFFFFF" d="M65.1,4.7V0.1H67c1.5,0,2.5,0.9,2.5,2.3c0,1.4-1,2.3-2.5,2.3H65.1z M66.1,3.9H67c0.9,0,1.5-0.7,1.5-1.5\n\t\tC68.4,1.6,67.9,1,67,1h-0.8V3.9z"/>\n\t<path fill="#FFFFFF" d="M73.3,4.7V0.1h2.5c0.9,0,1.3,0.6,1.3,1.2c0,0.6-0.4,1-0.8,1.1c0.5,0.1,0.9,0.6,0.9,1.1\n\t\tc0,0.7-0.5,1.3-1.4,1.3H73.3z M74.3,2h1.2c0.3,0,0.5-0.2,0.5-0.5c0-0.3-0.2-0.5-0.5-0.5h-1.2V2z M74.3,3.9h1.3\n\t\tc0.4,0,0.6-0.2,0.6-0.6c0-0.3-0.2-0.5-0.6-0.5h-1.3V3.9z"/>\n\t<path fill="#FFFFFF" d="M79.8,4.7V2.8L78,0.1h1.1L80.3,2l1.1-1.9h1.1l-1.8,2.8v1.9H79.8z"/>\n</g>\n</svg>',attributes:{href:"https://behold.so",target:"_blank","aria-label":"behold"}}),this.errorTitleEl=s({classes:"message__title",contents:[t,e]}),this.errorMessageTextEl=s({classes:"message__inner"}),this.errorMessageTextEl.innerHTML=this.errorMessage?.replace("Upgrade your plan",'<a href="https://app.behold.so/account" target="blank">Upgrade your plan</a>'),this.errorMessageEl=s({classes:"message",contents:[this.errorTitleEl,this.errorMessageTextEl]}),this.styleEl=s({type:"style",contents:":host{align-items:center;background:#f1f1f1 url(https://behold.pictures/widget:error-background.webp) 0 no-repeat;background-size:auto 100%;border:none;border-radius:20px;box-shadow:none;box-sizing:border-box;color:#000;display:flex;height:200px;justify-content:space-between;margin:0;max-width:750px;min-width:50px;outline:none;overflow:hidden;width:100%}:host *{box-sizing:border-box}:host(.large){height:180px}:host(.medium),:host(.small){background:#f1f1f1 url(https://behold.pictures/widget:error-background-small.webp) top no-repeat;background-size:auto 186px;flex-direction:column;height:auto}.logo{align-items:center;background:linear-gradient(90deg,rgba(0,0,0,.75) 10%,rgba(0,0,0,.5) 75%,transparent);display:flex;flex-grow:0;flex-shrink:0;height:100%;justify-content:center;padding:0 10px 5px 0;width:220px}.logo svg{height:40px;width:auto}:host(.large) .logo{width:180px}:host(.large) .logo svg{height:35px}:host(.medium) .logo,:host(.small) .logo{background:linear-gradient(180deg,rgba(0,0,0,.75) 10%,rgba(0,0,0,.5) 40%,transparent);height:150px;width:100%}.message{align-items:center;display:flex;flex-direction:column;flex-grow:1;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;font-size:16px;gap:15px;justify-content:center;line-height:1.5;padding:20px 60px 20px 80px;text-align:center}.message a{color:#000;display:inline-block;text-decoration:underline}:host(.large) .message{font-size:15px;gap:10px;padding:20px 30px 20px 70px}:host(.medium) .message{font-size:16px;gap:15px;padding:40px 30px}:host(.small) .message{font-size:15px;gap:15px;padding:30px 20px}.message__title{align-items:center;display:flex;font-size:20px;font-weight:500;justify-content:center}.message__title svg{height:25px;margin-right:15px;width:25px}:host(.large) .message__title{font-size:18px}:host(.large) .message__title svg{height:20px;margin-right:10px;width:20px}:host(.medium) .message__title,:host(.small) .message__title{flex-direction:column;font-size:17px}:host(.medium) .message__title svg,:host(.small) .message__title svg{margin-bottom:7px;margin-right:0}".toString()}),this.shadow.beholdReplaceChildren(this.logoEl,this.errorMessageEl,this.styleEl)}l(t){const e=t?.borderBoxSize?.[0]?.inlineSize||t?.contentRect?.width||0;let s="xlarge";e<600&&(s="large"),e<500&&(s="medium"),e<250&&(s="small"),["small","medium","large","xlarge"].forEach((t=>{n(this,{[`${t}`]:t===s})}))}static register(t="behold-error-message"){return customElements.get(t)||customElements.define(t,l),t}}export{l as default};
@@ -1 +1 @@
1
- import{c as t,a as s,s as e,f as i,t as h}from"./index-8GmY65W7.js";import{B as a,I as o,V as n,A as r,b as l,g as p}from"./base-n8LJb_Nn.js";class d extends a{label="GalleryWall";widgetSettings;feedMetadata;posts;previewLoadingColors=null;containerEl;heightRefEl;postEls;popoverGalleryEl;appliedBreakpoint;medianPaletteHSL;constructor(){super(),this.onPropChange(this.t,["widgetSettings","feedMetadata","posts","previewLoadingColors"],["widgetSettings","feedMetadata","posts"],this.setup),o.register(),n.register(),r.register(),this.i=this.i.bind(this),this.addEventListener("post-focus-next",this.h),this.addEventListener("post-focus-previous",this.o),this.onConnect((()=>{this.style.opacity="0",this.heightRefEl=t({classes:"height-ref"}),this.containerEl=t({type:"figure",classes:"posts",contents:[this.heightRefEl]}),this.renderWidget(this.containerEl,[l,".posts{display:block;min-height:100%;width:100%}.height-ref{position:relative}.post{-webkit-font-smoothing:inherit;-moz-osx-font-smoothing:inherit;border:none;color:inherit;display:block;font:inherit;height:100px;left:0;line-height:normal;overflow:hidden;position:absolute;top:0;transform-origin:top left;transition:background .3s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100px}.post--placeholder{background-color:#dedede;position:absolute}"]),this.setAttribute("tabindex","0"),this.setAttribute("aria-label","Gallery of Instagram posts. Shift + arrow keys to navigate"),this.onResize(this,this.containerEl,this.l)}))}setup(){if("transparent"!==this.widgetSettings.loadingColor){const t=this.posts.filter((t=>t.colorPalette)).map((t=>t.colorPalette));this.medianPaletteHSL=p(t,this.widgetSettings.loadingColor)}const t=this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints);this.renderBreakpoint(t),this.style.opacity="","openPopupGallery"===this.widgetSettings.onPostClick&&this.enablePopoverGallery()}t({changedProp:t,oldValue:e,newValue:i}){switch(t){case"posts":this.p();break;case"widgetSettings":this.u(e,i);break;case"feedMetadata":this.m();break;case"previewLoadingColors":this.postEls.forEach((t=>{t.previewLoadingColors=this.previewLoadingColors})),s(this,{"is-previewing-loading-colors":!!this.previewLoadingColors})}}p(){this.postEls=[],this.renderBreakpoint(this.appliedBreakpoint,!0),this.popoverGalleryEl&&(this.popoverGalleryEl.posts=this.posts)}u(t,s){"openPopupGallery"!==t?.onPostClick&&"openPopupGallery"===s?.onPostClick&&this.enablePopoverGallery(),this.renderBreakpoint(this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints)),this.postEls.forEach((t=>{t.widgetSettings=this.widgetSettings})),this.popoverGalleryEl&&(this.popoverGalleryEl.widgetSettings=this.widgetSettings)}m(){let t=`from @${this.feedMetadata.username}`;this.feedMetadata.hashtags?.length&&(t=`from hashtag${this.feedMetadata.hashtags.length>1?"s":""} ${this.feedMetadata.hashtags.join(", ")}`),this.setAttribute("aria-label",`Gallery of Instagram posts ${t}. Shift + arrow keys to navigate`),this.postEls.forEach((t=>{t.feedMetadata=this.feedMetadata})),this.popoverGalleryEl&&(this.popoverGalleryEl.feedMetadata=this.feedMetadata)}async enablePopoverGallery(){const{default:t}=await import("./PopoverGallery-zJPbgntZ.js");t.register(),this.popoverGalleryEl=document.createElement("behold-popover-gallery"),Object.assign(this.popoverGalleryEl,{widgetSettings:this.widgetSettings,feedMetadata:this.feedMetadata,posts:this.posts,closeFocusEl:this,onSlideChange:t=>{this.popoverGalleryEl.closeFocusEl=this.postEls[t]}})}l(t){const s=t.contentBoxSize?.[0]?.inlineSize,e=this.widgetSettings.breakpoints,i=this.getMatchingBreakpoint(s,e);this.renderBreakpoint(i)}o(){if(!this.postEls.length)return;let t=[...this.heightRefEl.children].indexOf(this.shadow.activeElement?.parentElement);t>0?t-=1:t=this.postEls.length-1,this.postEls[t].focus()}h(){if(!this.postEls.length)return;let t=[...this.heightRefEl.children].indexOf(this.shadow.activeElement?.parentElement);t>-1&&t<this.postEls.length-1?t+=1:t=0,this.postEls[t].focus()}i(t){this.popoverGalleryEl.open(this.postEls.indexOf(t),t)}renderPosts(t){this.postEls=this.createPostEls(t),this.raf((()=>{this.heightRefEl.beholdReplaceChildren(...this.postEls)}),"renderPosts")}getMatchingBreakpoint(t,s){return Object.entries(s).map((([t,s])=>({width:t,...s}))).filter((t=>"default"!==t.width)).sort(((t,s)=>s.width.localeCompare(t.width))).reduce(((s,e)=>t<=parseInt(e.width)?e:s),{...s.default,numPosts:s.default.galleryWallLayout.length})}renderBreakpoint(t,s=!1){this.cancelRaf("setContainerHeight"),this.postEls||(s=!0);const h=this.appliedBreakpoint;this.appliedBreakpoint=t;const{gap:a,borderRadius:o,numPosts:n,galleryWallLayout:r,galleryWallNamedLayout:l}=t;switch(this.widgetSettings.alignment){case"left":this.style.justifyContent="flex-start";break;case"right":this.style.justifyContent="flex-end";break;default:this.style.justifyContent="center"}this.widgetSettings.maxWidth&&this.widgetSettings.constrainWidth&&this.containerEl.style.maxWidth!==`${this.widgetSettings.maxWidth}px`&&(this.containerEl.style.maxWidth=`${this.widgetSettings.maxWidth}px`),this.widgetSettings.constrainWidth||(this.containerEl.style.maxWidth=""),this.containerEl.setAttribute("data-hover-effect",this.widgetSettings.hoverEffect),e(this.containerEl,{"--post-border-radius":`${o}%`}),(h?.numPosts!==n||h?.galleryWallNamedLayout!==l.toString()||s)&&this.renderPosts(t);const p=this.containerEl.offsetWidth,d=a.x/1e3*p,c=a.y/1e3*p;this.postEls.forEach(((t,s)=>{const[e,i,h,a]=r?.[s]?r[s].split(",").map((t=>parseInt(t))):[0,0,10,10],o=e*(p/100)+d/2,n=i*(p/100);t.style.transform=`translate(${o}px, ${n}px`,t.style.width=h*(p/100)-d+"px",t.style.height=a*(p/100)-c+"px"})),i(),this.raf((()=>{this.setContainerHeight()}),"setContainerHeight")}createPostEls(s){const{gap:e,postAspectRatio:i}=s,h=s?.numPosts||this.posts?.length||200,a=this.posts.filter(((t,s)=>s<h)),o=a.map(((h,o)=>{let n="behold-image-post";return"VIDEO"===h.mediaType&&(n="behold-video-post"),"CAROUSEL_ALBUM"===h.mediaType&&(n="behold-album-post"),t({type:n,props:{post:h,widgetSettings:this.widgetSettings,feedMetadata:this.feedMetadata,medianPaletteHSL:this.medianPaletteHSL,onClick:this.i,hasRowGap:"0"!=`${e.y}`,index:o,aspectRatio:i||[1,1],totalPosts:a?.length||s?.numPosts||this.posts?.length||0}})}));return o.length<s.galleryWallLayout.length&&s.galleryWallLayout.filter(((t,s)=>s>=o.length)).forEach((s=>{const e=t({classes:"post post--placeholder"});o.push(e)})),o}setContainerHeight=h((()=>{this.style.height=`${this.heightRefEl.scrollHeight}px`}),10,this);static register(t="behold-gallery-wall"){return customElements.get(t)||customElements.define(t,d),t}}export{d as default};
1
+ import{c as t,a as s,s as e,f as i,t as h}from"./index-ANfp_6HB.js";import{B as a,I as o,V as n,A as r,b as l,g as p}from"./base-QRGqT4gW.js";class d extends a{label="GalleryWall";widgetSettings;feedMetadata;posts;previewLoadingColors=null;containerEl;heightRefEl;postEls;popoverGalleryEl;appliedBreakpoint;medianPaletteHSL;constructor(){super(),this.onPropChange(this.t,["widgetSettings","feedMetadata","posts","previewLoadingColors"],["widgetSettings","feedMetadata","posts"],this.setup),o.register(),n.register(),r.register(),this.i=this.i.bind(this),this.addEventListener("post-focus-next",this.h),this.addEventListener("post-focus-previous",this.o),this.onConnect((()=>{this.style.opacity="0",this.heightRefEl=t({classes:"height-ref"}),this.containerEl=t({type:"figure",classes:"posts",contents:[this.heightRefEl]}),this.renderWidget(this.containerEl,[l,".posts{display:block;min-height:100%;width:100%}.height-ref{position:relative}.post{-webkit-font-smoothing:inherit;-moz-osx-font-smoothing:inherit;border:none;color:inherit;display:block;font:inherit;height:100px;left:0;line-height:normal;overflow:hidden;position:absolute;top:0;transform-origin:top left;transition:background .3s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100px}.post--placeholder{background-color:#dedede;position:absolute}"]),this.setAttribute("tabindex","0"),this.setAttribute("aria-label","Gallery of Instagram posts. Shift + arrow keys to navigate"),this.onResize(this,this.containerEl,this.l)}))}setup(){if("transparent"!==this.widgetSettings.loadingColor){const t=this.posts.filter((t=>t.colorPalette)).map((t=>t.colorPalette));this.medianPaletteHSL=p(t,this.widgetSettings.loadingColor)}const t=this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints);this.renderBreakpoint(t),this.style.opacity="","openPopupGallery"===this.widgetSettings.onPostClick&&this.enablePopoverGallery()}t({changedProp:t,oldValue:e,newValue:i}){switch(t){case"posts":this.p();break;case"widgetSettings":this.u(e,i);break;case"feedMetadata":this.m();break;case"previewLoadingColors":this.postEls.forEach((t=>{t.previewLoadingColors=this.previewLoadingColors})),s(this,{"is-previewing-loading-colors":!!this.previewLoadingColors})}}p(){this.postEls=[],this.renderBreakpoint(this.appliedBreakpoint,!0),this.popoverGalleryEl&&(this.popoverGalleryEl.posts=this.posts)}u(t,s){"openPopupGallery"!==t?.onPostClick&&"openPopupGallery"===s?.onPostClick&&this.enablePopoverGallery(),this.renderBreakpoint(this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints)),this.postEls.forEach((t=>{t.widgetSettings=this.widgetSettings})),this.popoverGalleryEl&&(this.popoverGalleryEl.widgetSettings=this.widgetSettings)}m(){let t=`from @${this.feedMetadata.username}`;this.feedMetadata.hashtags?.length&&(t=`from hashtag${this.feedMetadata.hashtags.length>1?"s":""} ${this.feedMetadata.hashtags.join(", ")}`),this.setAttribute("aria-label",`Gallery of Instagram posts ${t}. Shift + arrow keys to navigate`),this.postEls.forEach((t=>{t.feedMetadata=this.feedMetadata})),this.popoverGalleryEl&&(this.popoverGalleryEl.feedMetadata=this.feedMetadata)}async enablePopoverGallery(){const{default:t}=await import("./PopoverGallery-XY6iWNsl.js");t.register(),this.popoverGalleryEl=document.createElement("behold-popover-gallery"),Object.assign(this.popoverGalleryEl,{widgetSettings:this.widgetSettings,feedMetadata:this.feedMetadata,posts:this.posts,closeFocusEl:this,onSlideChange:t=>{this.popoverGalleryEl.closeFocusEl=this.postEls[t]}})}l(t){const s=t.contentBoxSize?.[0]?.inlineSize,e=this.widgetSettings.breakpoints,i=this.getMatchingBreakpoint(s,e);this.renderBreakpoint(i)}o(){if(!this.postEls.length)return;let t=[...this.heightRefEl.children].indexOf(this.shadow.activeElement?.parentElement);t>0?t-=1:t=this.postEls.length-1,this.postEls[t].focus()}h(){if(!this.postEls.length)return;let t=[...this.heightRefEl.children].indexOf(this.shadow.activeElement?.parentElement);t>-1&&t<this.postEls.length-1?t+=1:t=0,this.postEls[t].focus()}i(t){this.popoverGalleryEl.open(this.postEls.indexOf(t),t)}renderPosts(t){this.postEls=this.createPostEls(t),this.raf((()=>{this.heightRefEl.beholdReplaceChildren(...this.postEls)}),"renderPosts")}getMatchingBreakpoint(t,s){return Object.entries(s).map((([t,s])=>({width:t,...s}))).filter((t=>"default"!==t.width)).sort(((t,s)=>s.width.localeCompare(t.width))).reduce(((s,e)=>t<=parseInt(e.width)?e:s),{...s.default,numPosts:s.default.galleryWallLayout.length})}renderBreakpoint(t,s=!1){this.cancelRaf("setContainerHeight"),this.postEls||(s=!0);const h=this.appliedBreakpoint;this.appliedBreakpoint=t;const{gap:a,borderRadius:o,numPosts:n,galleryWallLayout:r,galleryWallNamedLayout:l}=t;switch(this.widgetSettings.alignment){case"left":this.style.justifyContent="flex-start";break;case"right":this.style.justifyContent="flex-end";break;default:this.style.justifyContent="center"}this.widgetSettings.maxWidth&&this.widgetSettings.constrainWidth&&this.containerEl.style.maxWidth!==`${this.widgetSettings.maxWidth}px`&&(this.containerEl.style.maxWidth=`${this.widgetSettings.maxWidth}px`),this.widgetSettings.constrainWidth||(this.containerEl.style.maxWidth=""),this.containerEl.setAttribute("data-hover-effect",this.widgetSettings.hoverEffect),e(this.containerEl,{"--post-border-radius":`${o}%`}),(h?.numPosts!==n||h?.galleryWallNamedLayout!==l.toString()||s)&&this.renderPosts(t);const p=this.containerEl.offsetWidth,d=a.x/1e3*p,c=a.y/1e3*p;this.postEls.forEach(((t,s)=>{const[e,i,h,a]=r?.[s]?r[s].split(",").map((t=>parseInt(t))):[0,0,10,10],o=e*(p/100)+d/2,n=i*(p/100);t.style.transform=`translate(${o}px, ${n}px`,t.style.width=h*(p/100)-d+"px",t.style.height=a*(p/100)-c+"px"})),i(),this.raf((()=>{this.setContainerHeight()}),"setContainerHeight")}createPostEls(s){const{gap:e,postAspectRatio:i}=s,h=s?.numPosts||this.posts?.length||200,a=this.posts.filter(((t,s)=>s<h)),o=a.map(((h,o)=>{let n="behold-image-post";return"VIDEO"===h.mediaType&&(n="behold-video-post"),"CAROUSEL_ALBUM"===h.mediaType&&(n="behold-album-post"),t({type:n,props:{post:h,widgetSettings:this.widgetSettings,feedMetadata:this.feedMetadata,medianPaletteHSL:this.medianPaletteHSL,onClick:this.i,hasRowGap:"0"!=`${e.y}`,index:o,aspectRatio:i||[1,1],totalPosts:a?.length||s?.numPosts||this.posts?.length||0}})}));return o.length<s.galleryWallLayout.length&&s.galleryWallLayout.filter(((t,s)=>s>=o.length)).forEach((s=>{const e=t({classes:"post post--placeholder"});o.push(e)})),o}setContainerHeight=h((()=>{this.style.height=`${this.heightRefEl.scrollHeight}px`}),10,this);static register(t="behold-gallery-wall"){return customElements.get(t)||customElements.define(t,d),t}}export{d as default};
@@ -1 +1 @@
1
- import{c as t,a as s,f as i,s as e}from"./index-8GmY65W7.js";import{B as h,I as a,V as o,A as r,b as n,g as l}from"./base-n8LJb_Nn.js";class p extends h{label="Grid";widgetSettings;feedMetadata;posts;previewLoadingColors=null;containerEl;postEls;popoverGalleryEl;appliedBreakpoint;medianPaletteHSL;constructor(){super(),this.onPropChange(this.t,["widgetSettings","feedMetadata","posts","previewLoadingColors"],["widgetSettings","feedMetadata","posts"],this.setup),a.register(),o.register(),r.register(),this.i=this.i.bind(this),this.addEventListener("post-focus-next",this.h),this.addEventListener("post-focus-previous",this.o),this.onConnect((()=>{this.containerEl=t({type:"figure",classes:"posts"}),this.renderWidget(this.containerEl,[n,".post--placeholder{background-color:#dedede;height:0;padding-bottom:calc(100%/var(--post-aspect-ratio))}"]),this.setAttribute("tabindex","0"),this.setAttribute("aria-label","Gallery of Instagram posts. Shift + arrow keys to navigate"),this.onResize(this,this,this.l)}))}setup(){if("transparent"!==this.widgetSettings.loadingColor){const t=this.posts.filter((t=>t.colorPalette)).map((t=>t.colorPalette));this.medianPaletteHSL=l(t,this.widgetSettings.loadingColor)}const t=this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints);this.renderBreakpoint(t),this.postEls.forEach((t=>{t.widgetSettings=this.widgetSettings,t.feedMetadata=this.feedMetadata})),"openPopupGallery"===this.widgetSettings.onPostClick&&this.enablePopoverGallery()}t({changedProp:t,oldValue:i,newValue:e}){switch(t){case"posts":this.p({oldValue:i,newValue:e});break;case"widgetSettings":this.u(i,e);break;case"feedMetadata":this.m();break;case"previewLoadingColors":this.postEls.forEach((t=>{t.previewLoadingColors=this.previewLoadingColors})),s(this,{"is-previewing-loading-colors":!!this.previewLoadingColors})}}p({oldValue:t,newValue:s}){this.postEls=[],this.renderBreakpoint(this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints),!0),this.popoverGalleryEl&&(this.popoverGalleryEl.posts=this.posts)}u(t,s){"openPopupGallery"!==t?.onPostClick&&"openPopupGallery"===s?.onPostClick&&this.enablePopoverGallery();const i=this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints);this.renderBreakpoint(i),this.postEls.forEach((t=>{t.widgetSettings=this.widgetSettings})),this.popoverGalleryEl&&(this.popoverGalleryEl.widgetSettings=this.widgetSettings)}m(){let t=`from @${this.feedMetadata.username}`;this.feedMetadata.hashtags?.length&&(t=`from hashtag${this.feedMetadata.hashtags.length>1?"s":""} ${this.feedMetadata.hashtags.join(", ")}`),this.setAttribute("aria-label",`Gallery of Instagram posts ${t}. Shift + arrow keys to navigate`),this.postEls.forEach((t=>{t.feedMetadata=this.feedMetadata})),this.popoverGalleryEl&&(this.popoverGalleryEl.feedMetadata=this.feedMetadata)}async enablePopoverGallery(){if(this.popoverGalleryEl)return;const{default:t}=await import("./PopoverGallery-zJPbgntZ.js");t.register(),this.popoverGalleryEl=document.createElement("behold-popover-gallery"),Object.assign(this.popoverGalleryEl,{widgetSettings:this.widgetSettings,feedMetadata:this.feedMetadata,posts:this.posts,closeFocusEl:this,onSlideChange:t=>{this.popoverGalleryEl.closeFocusEl=this.postEls[t]}})}l(t){const s=t.contentBoxSize?.[0]?.inlineSize,i=this.widgetSettings.breakpoints,e=this.getMatchingBreakpoint(s,i);this.renderBreakpoint(e)}o(){if(!this.postEls.length)return;let t=[...this.containerEl.children].indexOf(this.shadow.activeElement?.parentElement);t>0?t-=1:t=this.postEls.length-1,this.postEls[t].focus()}h(){if(!this.postEls.length)return;let t=[...this.containerEl.children].indexOf(this.shadow.activeElement?.parentElement);t>-1&&t<this.postEls.length-1?t+=1:t=0,this.postEls[t].focus()}i(t){this.popoverGalleryEl.open(this.postEls.indexOf(t),t)}renderPosts(t){this.postEls=this.createPostEls(t),this.raf((()=>{this.containerEl.beholdReplaceChildren(...this.postEls)}),"renderPosts")}getMatchingBreakpoint(t,s){return Object.entries(s).map((([t,s])=>({width:t,...s}))).filter((t=>"default"!==t.width)).sort(((t,s)=>parseInt(s.width)-parseInt(t.width))).reduce(((s,i)=>t<=parseInt(i.width)?i:s),{numPosts:this.posts.length,...s.default})}renderBreakpoint(t,s=!1){if(!this.posts||!this.containerEl)return;this.postEls?.length||(s=!0);const h=this.appliedBreakpoint,{numColumns:a,gap:o,borderRadius:r,numPosts:n,postAspectRatio:l}=t;switch(h?.numPosts>n&&(this.containerEl.beholdReplaceChildren(),i()),this.widgetSettings.alignment){case"left":this.style.justifyContent="flex-start";break;case"right":this.style.justifyContent="flex-end";break;default:this.style.justifyContent="center"}this.widgetSettings.maxWidth&&this.widgetSettings.constrainWidth&&this.containerEl.style.maxWidth!==`${this.widgetSettings.maxWidth}px`&&(this.containerEl.style.maxWidth=`${this.widgetSettings.maxWidth}px`),this.widgetSettings.constrainWidth||(this.containerEl.style.maxWidth=""),this.containerEl.style.gridTemplateColumns=`repeat(${a}, 1fr)`,this.containerEl.style.gap=`${o.y}px ${o.x}px`,this.containerEl.setAttribute("data-hover-effect",this.widgetSettings.hoverEffect);let p=(l||[1,1]).reduce(((t,s)=>t/s));e(this.containerEl,{"--post-border-radius":`${r}%`,"--post-aspect-ratio":`${p}`}),(h?.numPosts!==n||s)&&this.renderPosts(t),this.postEls.forEach(((s,i)=>{s.hasRowGap="0"!=`${t.gap.y}`})),this.appliedBreakpoint=t}createPostEls(s){const{numPosts:i,numColumns:e,gap:h,postAspectRatio:a}=s,o=this.posts.filter(((t,i)=>i<(s?.numPosts||this.posts?.length||200))),r=o.map(((s,r)=>{const n=Math.ceil((i||this.posts.length)/e);let l="behold-image-post";return"VIDEO"===s.mediaType&&(l="behold-video-post"),"CAROUSEL_ALBUM"===s.mediaType&&(l="behold-album-post"),t({type:l,props:{post:s,widgetSettings:this.widgetSettings,feedMetadata:this.feedMetadata,medianPaletteHSL:this.medianPaletteHSL,onClick:this.i,hasRowGap:"0"!=`${h.y}`,isLastRow:Math.ceil((r+1)/e)===n,index:r,aspectRatio:a||[1,1],totalPosts:o?.length||i||this.posts?.length||0}})}));for(;r.length<s.numPosts;){const s=t({classes:"post post--placeholder"});r.push(s)}return r}static register(t="behold-grid"){return customElements.get(t)||customElements.define(t,p),t}}export{p as default};
1
+ import{c as t,a as s,f as i,s as e}from"./index-ANfp_6HB.js";import{B as h,I as a,V as o,A as r,b as n,g as l}from"./base-QRGqT4gW.js";class p extends h{label="Grid";widgetSettings;feedMetadata;posts;previewLoadingColors=null;containerEl;postEls;popoverGalleryEl;appliedBreakpoint;medianPaletteHSL;constructor(){super(),this.onPropChange(this.t,["widgetSettings","feedMetadata","posts","previewLoadingColors"],["widgetSettings","feedMetadata","posts"],this.setup),a.register(),o.register(),r.register(),this.i=this.i.bind(this),this.addEventListener("post-focus-next",this.h),this.addEventListener("post-focus-previous",this.o),this.onConnect((()=>{this.containerEl=t({type:"figure",classes:"posts"}),this.renderWidget(this.containerEl,[n,".post--placeholder{background-color:#dedede;height:0;padding-bottom:calc(100%/var(--post-aspect-ratio))}"]),this.setAttribute("tabindex","0"),this.setAttribute("aria-label","Gallery of Instagram posts. Shift + arrow keys to navigate"),this.onResize(this,this,this.l)}))}setup(){if("transparent"!==this.widgetSettings.loadingColor){const t=this.posts.filter((t=>t.colorPalette)).map((t=>t.colorPalette));this.medianPaletteHSL=l(t,this.widgetSettings.loadingColor)}const t=this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints);this.renderBreakpoint(t),this.postEls.forEach((t=>{t.widgetSettings=this.widgetSettings,t.feedMetadata=this.feedMetadata})),"openPopupGallery"===this.widgetSettings.onPostClick&&this.enablePopoverGallery()}t({changedProp:t,oldValue:i,newValue:e}){switch(t){case"posts":this.p({oldValue:i,newValue:e});break;case"widgetSettings":this.u(i,e);break;case"feedMetadata":this.m();break;case"previewLoadingColors":this.postEls.forEach((t=>{t.previewLoadingColors=this.previewLoadingColors})),s(this,{"is-previewing-loading-colors":!!this.previewLoadingColors})}}p({oldValue:t,newValue:s}){this.postEls=[],this.renderBreakpoint(this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints),!0),this.popoverGalleryEl&&(this.popoverGalleryEl.posts=this.posts)}u(t,s){"openPopupGallery"!==t?.onPostClick&&"openPopupGallery"===s?.onPostClick&&this.enablePopoverGallery();const i=this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints);this.renderBreakpoint(i),this.postEls.forEach((t=>{t.widgetSettings=this.widgetSettings})),this.popoverGalleryEl&&(this.popoverGalleryEl.widgetSettings=this.widgetSettings)}m(){let t=`from @${this.feedMetadata.username}`;this.feedMetadata.hashtags?.length&&(t=`from hashtag${this.feedMetadata.hashtags.length>1?"s":""} ${this.feedMetadata.hashtags.join(", ")}`),this.setAttribute("aria-label",`Gallery of Instagram posts ${t}. Shift + arrow keys to navigate`),this.postEls.forEach((t=>{t.feedMetadata=this.feedMetadata})),this.popoverGalleryEl&&(this.popoverGalleryEl.feedMetadata=this.feedMetadata)}async enablePopoverGallery(){if(this.popoverGalleryEl)return;const{default:t}=await import("./PopoverGallery-XY6iWNsl.js");t.register(),this.popoverGalleryEl=document.createElement("behold-popover-gallery"),Object.assign(this.popoverGalleryEl,{widgetSettings:this.widgetSettings,feedMetadata:this.feedMetadata,posts:this.posts,closeFocusEl:this,onSlideChange:t=>{this.popoverGalleryEl.closeFocusEl=this.postEls[t]}})}l(t){const s=t.contentBoxSize?.[0]?.inlineSize,i=this.widgetSettings.breakpoints,e=this.getMatchingBreakpoint(s,i);this.renderBreakpoint(e)}o(){if(!this.postEls.length)return;let t=[...this.containerEl.children].indexOf(this.shadow.activeElement?.parentElement);t>0?t-=1:t=this.postEls.length-1,this.postEls[t].focus()}h(){if(!this.postEls.length)return;let t=[...this.containerEl.children].indexOf(this.shadow.activeElement?.parentElement);t>-1&&t<this.postEls.length-1?t+=1:t=0,this.postEls[t].focus()}i(t){this.popoverGalleryEl.open(this.postEls.indexOf(t),t)}renderPosts(t){this.postEls=this.createPostEls(t),this.raf((()=>{this.containerEl.beholdReplaceChildren(...this.postEls)}),"renderPosts")}getMatchingBreakpoint(t,s){return Object.entries(s).map((([t,s])=>({width:t,...s}))).filter((t=>"default"!==t.width)).sort(((t,s)=>parseInt(s.width)-parseInt(t.width))).reduce(((s,i)=>t<=parseInt(i.width)?i:s),{numPosts:this.posts.length,...s.default})}renderBreakpoint(t,s=!1){if(!this.posts||!this.containerEl)return;this.postEls?.length||(s=!0);const h=this.appliedBreakpoint,{numColumns:a,gap:o,borderRadius:r,numPosts:n,postAspectRatio:l}=t;switch(h?.numPosts>n&&(this.containerEl.beholdReplaceChildren(),i()),this.widgetSettings.alignment){case"left":this.style.justifyContent="flex-start";break;case"right":this.style.justifyContent="flex-end";break;default:this.style.justifyContent="center"}this.widgetSettings.maxWidth&&this.widgetSettings.constrainWidth&&this.containerEl.style.maxWidth!==`${this.widgetSettings.maxWidth}px`&&(this.containerEl.style.maxWidth=`${this.widgetSettings.maxWidth}px`),this.widgetSettings.constrainWidth||(this.containerEl.style.maxWidth=""),this.containerEl.style.gridTemplateColumns=`repeat(${a}, 1fr)`,this.containerEl.style.gap=`${o.y}px ${o.x}px`,this.containerEl.setAttribute("data-hover-effect",this.widgetSettings.hoverEffect);let p=(l||[1,1]).reduce(((t,s)=>t/s));e(this.containerEl,{"--post-border-radius":`${r}%`,"--post-aspect-ratio":`${p}`}),(h?.numPosts!==n||s)&&this.renderPosts(t),this.postEls.forEach(((s,i)=>{s.hasRowGap="0"!=`${t.gap.y}`})),this.appliedBreakpoint=t}createPostEls(s){const{numPosts:i,numColumns:e,gap:h,postAspectRatio:a}=s,o=this.posts.filter(((t,i)=>i<(s?.numPosts||this.posts?.length||200))),r=o.map(((s,r)=>{const n=Math.ceil((i||this.posts.length)/e);let l="behold-image-post";return"VIDEO"===s.mediaType&&(l="behold-video-post"),"CAROUSEL_ALBUM"===s.mediaType&&(l="behold-album-post"),t({type:l,props:{post:s,widgetSettings:this.widgetSettings,feedMetadata:this.feedMetadata,medianPaletteHSL:this.medianPaletteHSL,onClick:this.i,hasRowGap:"0"!=`${h.y}`,isLastRow:Math.ceil((r+1)/e)===n,index:r,aspectRatio:a||[1,1],totalPosts:o?.length||i||this.posts?.length||0}})}));for(;r.length<s.numPosts;){const s=t({classes:"post post--placeholder"});r.push(s)}return r}static register(t="behold-grid"){return customElements.get(t)||customElements.define(t,p),t}}export{p as default};
@@ -1 +1 @@
1
- import{t,e,c as i,a as s,f as o,p as r,j as a,B as h,k as n,l,h as c}from"./index-8GmY65W7.js";import{a as d,c as p,R as u}from"./base-n8LJb_Nn.js";import{c as b,a as m}from"./caret-right-xsqAZl9R.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;F;A;P;$;O;j;T;R;constructor({slides:e,containerEl:i,breadcrumbsContainerEl:s,previousEl:o,nextEl:r,onSlideChange:a,breadcrumbDiameter:h=7,dynamicBreadCrumbsCutoff:n=10,keyboardNav:l=!0,dragLimit:c=.5,virtualize:d=!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=c,this.virtualize=d,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.F=0,this.A=0,this.P=0,this.$=0,this.O=[],this.j=new g((t=>this.R(t))),this.init=this.init.bind(this),this.destroy=this.destroy.bind(this),this.B=this.B.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.T=t(this.G,10,this),this.R=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.B({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.j?.observe(this.containerEl),this.tt(this.index,this.index,!1),this.B({index:t,animate:!1,forceUpdate:!0,isInitial:!0}))}destroy(){this.t&&(clearTimeout(this._),clearTimeout(this.k),cancelAnimationFrame(this.m),cancelAnimationFrame(this.v),this.j.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))))}B({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.P=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.A=-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.B({index:this.index}):this.B({index:this.index-1,easing:t})}U(t="ease"){"string"!=typeof t&&(t="ease"),this.index>=this.h.length-1?this.B({index:this.index}):this.B({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.F=this.L.leftDelta,this.A=this.F/this.L.parent.width*100,this.o.style.transform=`translateX(${this.A}%)`,this.o.style.transition=this.baseTransition,this.P=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.P=Math.abs(a/s),i<0&&(this.S="left"),i>0&&(this.S="right");const l=this.F+this.$;this.A=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.A+100*this.index)/100)}px`:`${Math.min(2.75*this.breadcrumbDiameter,this.breadcrumbDiameter+Math.abs(4*this.breadcrumbDiameter*(this.A+100*this.index)/100))}px`,this.o.style.transform=`translateX(${this.A}%)`,this.o.style.transition=this.baseTransition}q(t){this.T({x:t.clientX,y:t.clientY},!1)}X(t){this.T({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.P>=1)&&(this.A+100*this.index<0&&"left"===this.S&&(e="advance"),this.A+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.B({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.ct,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.B({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)}ct(){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()}B({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 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-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>',A='<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 P extends h{label="PopoverSlideVideo";dt;ut;bt;post;constructor(){super(),d.register(),p.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.dt=i({type:"behold-video",classes:"video",props:{mediaUrl:this.post.mediaUrl,sizes:this.post.sizes},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?F:A,listeners:{click:this._t},attributes:{"aria-label":this.globalState.isMuted?"unmute":"mute"}}),this.globalState.isMuted?this.dt.mute():this.dt.unmute(),this.classList.add("video-container","video-container--paused"),this.beholdReplaceChildren(this.dt,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.dt.isPlaying&&this.dt.play(),!e.isPlaying&&this.dt.isPlaying&&this.dt.pause())}wt({changedProps:t,newState:e}){t.includes("isMuted")&&this.dt&&this.bt&&(e.isMuted?(this.dt.mute(),this.bt.innerHTML=F):(this.dt.unmute(),this.bt.innerHTML=A))}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.dt&&(this.dt.isPlaying?this.pause():this.play())}_t(){this.dt&&(this.dt.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.dt?.preload()}static register(t="behold-popover-slide-video"){return customElements.get(t)||customElements.define(t,P),t}}class $ extends h{label="PopoverSlideAlbum";kt;Ct;Et;zt;St;Mt;Dt;currentSlideIndex=0;post;constructor(){super(),this.onPropChange((()=>{}),["post"]),p.register(),P.register(),this.Lt=this.Lt.bind(this),this.Ft=this.Ft.bind(this),this.preload=this.preload.bind(this),this.onConnect((()=>{this.Et=this.At();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:b}),this.St=i({type:"button",classes:"slide__carousel-next",attributes:{"aria-label":"Next album slide"},contents:m}),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.Ft)})),this.onDisconnect((()=>{this.Dt.destroy(),this.Dt=null}))}Pt(){E({include:[this.Et[this.currentSlideIndex]],exclude:this.Et.filter(((t,e)=>e!==this.currentSlideIndex)),merge:!0})}Ft(t){t.isIntersecting&&this.Dt.init(0)}Lt(t,e=!1){t!==this.currentSlideIndex&&this.globalState.keyboardNavEnabled&&n(`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.Pt(),e||this.$t(t)}$t(t){const e=u(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=u(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})}At(){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 j='<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 T extends h{label="PopoverGallerySlide";o;Ot;jt;Tt;Rt;Bt;It;Ut;Vt;Ht;Nt;post;feedMetadata;constructor(){super(),this.onPropChange(this.qt,["post","feedMetadata"]),p.register(),P.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=u(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=u(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.jt="@"+this.feedMetadata.username,this.feedMetadata.hashtags&&(this.Ot=j,this.jt=this.feedMetadata.hashtags.join(", ")),this.Tt=this.Ot?i({classes:"slide__avatar",contents:this.Ot,attributes:{"aria-label":this.feedMetadata.hashtags?"hashtags":"username"}}):null,this.Rt=i({classes:"slide__header",contents:[this.Tt,this.jt]}),this.Bt=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.Rt,this.Bt,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.jt="@"+e.username,e.hashtags?.length?(this.Ot=j,this.jt=e.hashtags.join(", ")):this.Ot=e?.profilePictureUrl?i({type:"img",attributes:{src:e.profilePictureUrl}}):null,this.Tt=this.Ot?i({classes:"slide__avatar",contents:this.Ot,attributes:{"aria-label":this.feedMetadata.hashtags?"hashtags":"username"}}):null,this.Rt=i({classes:"slide__header",contents:[this.Tt,this.jt]});break;case"post":this.Ht||this.render(),"IMAGE"===e?.mediaType?Object.assign(this.Ht,{sizes:this.post.sizes,mediaUrl:this.post.mediaUrl,showLoader:!0}):R(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 u(t?.colorPalette?.dominant||"100,100,100").map((t=>Math.round(t)))}expandCaption(){this.Bt&&(this.Bt.style.transition="",this.Bt.style.height=this.Bt.offsetHeight+"px",this.Bt.innerHTML=this.post?.caption||"",o(),this.raf((()=>{this.Bt.style.transition="height .3s ease",this.Bt.style.height=this.Bt.scrollHeight+"px",this.to((()=>{this.Bt.style.transition="",this.Bt.style.height=""}),300,"expandCaption")}),"expandCaption"))}collapseCaption(){if(!this.Bt)return;const t=l({text:this.post.caption,maxChars:120,maxLines:4});this.Bt.innerHTML=t,t?.length<this.post?.caption?.length&&this.Bt.appendChild(this.Nt)}static register(t="behold-popover-gallery-slide"){return customElements.get(t)||customElements.define(t,T),t}}const R=t=>"BEHOLD-IMAGE"===t.tagName;class B extends h{label="PopoverGallery";posts;widgetSettings;feedMetadata;closeFocusEl=document.body;onSlideChange;Xt=900;Gt;Zt;Kt;Yt;zt;St;Jt;Qt;o;Wt;te;ee;ie=0;se="";oe="";constructor(){super(),this.Gt=this.attachShadow({mode:"open"}),this.onPropChange(this.qt,["posts","widgetSettings","feedMetadata"]),T.register(),this.Lt=this.Lt.bind(this),this.re=this.re.bind(this),this.ae=this.ae.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.Yt=i({classes:"overlay",listeners:{click:this.re}}),this.zt=i({type:"button",classes:"previous",attributes:{"aria-label":"Previous post"},contents:b}),this.St=i({type:"button",classes:"next",attributes:{"aria-label":"Next post"},contents:m}),this.Jt=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.re()}}}),this.Qt=i({classes:"breadcrumbs"}),this.Wt=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.Wt}),this.Zt=document.createDocumentFragment(),this.Zt.beholdReplaceChildren(this.Yt,this.o,this.Qt,this.zt,this.St,this.Jt),this.Kt=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.te=new S({slides:this.Wt,containerEl:this.o,breadcrumbsContainerEl:this.Qt,previousEl:this.zt,nextEl:this.St,onSlideChange:this.Lt,breadcrumbDiameter:this.Wt.length>9?9:8,virtualize:!0,dragLimit:.4}),this.ee=new D({slides:this.Wt,containerEl:this.o,onSlideChange:this.Lt,onRequestClose:()=>{this.re()}}),this.onResize(this,this,this.Z)})),this.onDisconnect((()=>{document.removeEventListener("keydown",this.ae),z(this.closeFocusEl),this.te.destroy(),this.ee.destroy(),this.te=null,this.ee=null,document.body.style.overflow=this.se,document.documentElement.style.paddingRight=this.oe}))}qt({changedProp:t,oldValue:e,newValue:i}){switch(t){case"posts":i&&this.o&&(this.Wt=i.map((t=>{const e=document.createElement("behold-popover-gallery-slide");return e.post=t,e.feedMetadata=this.feedMetadata,e})),this.o.beholdReplaceChildren(this.Wt));case"widgetSettings":c(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.Wt&&this.Wt.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.Yt.style.backgroundColor=`hsl(${t[0]} ${Math.min(t[1],50)}% ${Math.min(t[2],15)}% / ${i})`}),"overlayColor")}}ae(t){"Escape"===t.code&&(t.preventDefault(),this.re())}open(t,e){this.ie=t,this.cancelRaf("open"),this.closeFocusEl=e,this.se=document.body.style.overflow;const i=window.innerWidth-document.documentElement.clientWidth;this.oe=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.he(),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.Gt,this.Wt?.filter(((e,i)=>i!==t)),1),this.ne(this.offsetWidth),document.addEventListener("keydown",this.ae)}),"open")}re(){this.cancelTo("close"),this.classList.remove("is-visible"),this.to(this.remove.bind(this),300,"close"),z(this.closeFocusEl),document.removeEventListener("keydown",this.ae),document.body.style.overflow=this.se,document.documentElement.style.paddingRight=this.oe,this.style.paddingRight=""}Lt(t){this.ie=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&&n(`${e}, post ${t+1} of ${this.Wt.length} in gallery`),E({include:[this.Gt],exclude:this.Wt.filter(((e,i)=>i!==t)),merge:!1}),this.onSlideChange&&this.onSlideChange(t),this.Wt.forEach(((e,i)=>{i===t?e.activate():e.deactivate()}));const i=this.Wt[t-1]??null,s=this.Wt[t+1]??null;i&&this.raf((()=>i.preload()),"preloadPrev"),s&&this.raf((()=>s.preload()),"preloadNext");const o=this.Wt?.[t]?this.Wt[t].getBackgroundColor():null;o&&this.updateGlobalState({popoverOverlayHslArray:o})}ne(t){t>this.Xt?(this.classList.remove("is-scroller"),this.zt.style.display="",this.St.style.display="",this.ee.destroy(),this.te.init(this.ie),this.Wt.forEach((t=>t.expandCaption())),this.updateGlobalState({popoverOverlayOpacity:.85})):(this.classList.add("is-scroller"),this.te.destroy(),this.ee.init(this.ie),this.Wt.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.ne(e)}he(){document.body.append(this),this.Gt.beholdReplaceChildren(this.Zt,this.Kt)}static register(t="behold-popover-gallery"){return customElements.get(t)||customElements.define(t,B),t}}export{B as default};
1
+ import{t,e,c as i,a as s,f as o,p as r,j as a,B as h,k as n,l,h as c}from"./index-ANfp_6HB.js";import{a as d,c as p,R as u}from"./base-QRGqT4gW.js";import{c as b,a as m}from"./caret-right-xsqAZl9R.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;F;A;P;$;O;j;T;R;constructor({slides:e,containerEl:i,breadcrumbsContainerEl:s,previousEl:o,nextEl:r,onSlideChange:a,breadcrumbDiameter:h=7,dynamicBreadCrumbsCutoff:n=10,keyboardNav:l=!0,dragLimit:c=.5,virtualize:d=!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=c,this.virtualize=d,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.F=0,this.A=0,this.P=0,this.$=0,this.O=[],this.j=new g((t=>this.R(t))),this.init=this.init.bind(this),this.destroy=this.destroy.bind(this),this.B=this.B.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.T=t(this.G,10,this),this.R=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.B({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.j?.observe(this.containerEl),this.tt(this.index,this.index,!1),this.B({index:t,animate:!1,forceUpdate:!0,isInitial:!0}))}destroy(){this.t&&(clearTimeout(this._),clearTimeout(this.k),cancelAnimationFrame(this.m),cancelAnimationFrame(this.v),this.j.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))))}B({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.P=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.A=-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.B({index:this.index}):this.B({index:this.index-1,easing:t})}U(t="ease"){"string"!=typeof t&&(t="ease"),this.index>=this.h.length-1?this.B({index:this.index}):this.B({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.F=this.L.leftDelta,this.A=this.F/this.L.parent.width*100,this.o.style.transform=`translateX(${this.A}%)`,this.o.style.transition=this.baseTransition,this.P=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.P=Math.abs(a/s),i<0&&(this.S="left"),i>0&&(this.S="right");const l=this.F+this.$;this.A=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.A+100*this.index)/100)}px`:`${Math.min(2.75*this.breadcrumbDiameter,this.breadcrumbDiameter+Math.abs(4*this.breadcrumbDiameter*(this.A+100*this.index)/100))}px`,this.o.style.transform=`translateX(${this.A}%)`,this.o.style.transition=this.baseTransition}q(t){this.T({x:t.clientX,y:t.clientY},!1)}X(t){this.T({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.P>=1)&&(this.A+100*this.index<0&&"left"===this.S&&(e="advance"),this.A+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.B({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.ct,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.B({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)}ct(){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()}B({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 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-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>',A='<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 P extends h{label="PopoverSlideVideo";dt;ut;bt;post;constructor(){super(),d.register(),p.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.dt=i({type:"behold-video",classes:"video",props:{mediaUrl:this.post.mediaUrl,sizes:this.post.sizes},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?F:A,listeners:{click:this._t},attributes:{"aria-label":this.globalState.isMuted?"unmute":"mute"}}),this.globalState.isMuted?this.dt.mute():this.dt.unmute(),this.classList.add("video-container","video-container--paused"),this.beholdReplaceChildren(this.dt,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.dt.isPlaying&&this.dt.play(),!e.isPlaying&&this.dt.isPlaying&&this.dt.pause())}wt({changedProps:t,newState:e}){t.includes("isMuted")&&this.dt&&this.bt&&(e.isMuted?(this.dt.mute(),this.bt.innerHTML=F):(this.dt.unmute(),this.bt.innerHTML=A))}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.dt&&(this.dt.isPlaying?this.pause():this.play())}_t(){this.dt&&(this.dt.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.dt?.preload()}static register(t="behold-popover-slide-video"){return customElements.get(t)||customElements.define(t,P),t}}class $ extends h{label="PopoverSlideAlbum";kt;Ct;Et;zt;St;Mt;Dt;currentSlideIndex=0;post;constructor(){super(),this.onPropChange((()=>{}),["post"]),p.register(),P.register(),this.Lt=this.Lt.bind(this),this.Ft=this.Ft.bind(this),this.preload=this.preload.bind(this),this.onConnect((()=>{this.Et=this.At();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:b}),this.St=i({type:"button",classes:"slide__carousel-next",attributes:{"aria-label":"Next album slide"},contents:m}),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.Ft)})),this.onDisconnect((()=>{this.Dt.destroy(),this.Dt=null}))}Pt(){E({include:[this.Et[this.currentSlideIndex]],exclude:this.Et.filter(((t,e)=>e!==this.currentSlideIndex)),merge:!0})}Ft(t){t.isIntersecting&&this.Dt.init(0)}Lt(t,e=!1){t!==this.currentSlideIndex&&this.globalState.keyboardNavEnabled&&n(`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.Pt(),e||this.$t(t)}$t(t){const e=u(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=u(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})}At(){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 j='<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 T extends h{label="PopoverGallerySlide";o;Ot;jt;Tt;Rt;Bt;It;Ut;Vt;Ht;Nt;post;feedMetadata;constructor(){super(),this.onPropChange(this.qt,["post","feedMetadata"]),p.register(),P.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=u(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=u(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.jt="@"+this.feedMetadata.username,this.feedMetadata.hashtags&&(this.Ot=j,this.jt=this.feedMetadata.hashtags.join(", ")),this.Tt=this.Ot?i({classes:"slide__avatar",contents:this.Ot,attributes:{"aria-label":this.feedMetadata.hashtags?"hashtags":"username"}}):null,this.Rt=i({classes:"slide__header",contents:[this.Tt,this.jt]}),this.Bt=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.Rt,this.Bt,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.jt="@"+e.username,e.hashtags?.length?(this.Ot=j,this.jt=e.hashtags.join(", ")):this.Ot=e?.profilePictureUrl?i({type:"img",attributes:{src:e.profilePictureUrl}}):null,this.Tt=this.Ot?i({classes:"slide__avatar",contents:this.Ot,attributes:{"aria-label":this.feedMetadata.hashtags?"hashtags":"username"}}):null,this.Rt=i({classes:"slide__header",contents:[this.Tt,this.jt]});break;case"post":this.Ht||this.render(),"IMAGE"===e?.mediaType?Object.assign(this.Ht,{sizes:this.post.sizes,mediaUrl:this.post.mediaUrl,showLoader:!0}):R(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 u(t?.colorPalette?.dominant||"100,100,100").map((t=>Math.round(t)))}expandCaption(){this.Bt&&(this.Bt.style.transition="",this.Bt.style.height=this.Bt.offsetHeight+"px",this.Bt.innerHTML=this.post?.caption||"",o(),this.raf((()=>{this.Bt.style.transition="height .3s ease",this.Bt.style.height=this.Bt.scrollHeight+"px",this.to((()=>{this.Bt.style.transition="",this.Bt.style.height=""}),300,"expandCaption")}),"expandCaption"))}collapseCaption(){if(!this.Bt)return;const t=l({text:this.post.caption,maxChars:120,maxLines:4});this.Bt.innerHTML=t,t?.length<this.post?.caption?.length&&this.Bt.appendChild(this.Nt)}static register(t="behold-popover-gallery-slide"){return customElements.get(t)||customElements.define(t,T),t}}const R=t=>"BEHOLD-IMAGE"===t.tagName;class B extends h{label="PopoverGallery";posts;widgetSettings;feedMetadata;closeFocusEl=document.body;onSlideChange;Xt=900;Gt;Zt;Kt;Yt;zt;St;Jt;Qt;o;Wt;te;ee;ie=0;se="";oe="";constructor(){super(),this.Gt=this.attachShadow({mode:"open"}),this.onPropChange(this.qt,["posts","widgetSettings","feedMetadata"]),T.register(),this.Lt=this.Lt.bind(this),this.re=this.re.bind(this),this.ae=this.ae.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.Yt=i({classes:"overlay",listeners:{click:this.re}}),this.zt=i({type:"button",classes:"previous",attributes:{"aria-label":"Previous post"},contents:b}),this.St=i({type:"button",classes:"next",attributes:{"aria-label":"Next post"},contents:m}),this.Jt=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.re()}}}),this.Qt=i({classes:"breadcrumbs"}),this.Wt=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.Wt}),this.Zt=document.createDocumentFragment(),this.Zt.beholdReplaceChildren(this.Yt,this.o,this.Qt,this.zt,this.St,this.Jt),this.Kt=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.te=new S({slides:this.Wt,containerEl:this.o,breadcrumbsContainerEl:this.Qt,previousEl:this.zt,nextEl:this.St,onSlideChange:this.Lt,breadcrumbDiameter:this.Wt.length>9?9:8,virtualize:!0,dragLimit:.4}),this.ee=new D({slides:this.Wt,containerEl:this.o,onSlideChange:this.Lt,onRequestClose:()=>{this.re()}}),this.onResize(this,this,this.Z)})),this.onDisconnect((()=>{document.removeEventListener("keydown",this.ae),z(this.closeFocusEl),this.te.destroy(),this.ee.destroy(),this.te=null,this.ee=null,document.body.style.overflow=this.se,document.documentElement.style.paddingRight=this.oe}))}qt({changedProp:t,oldValue:e,newValue:i}){switch(t){case"posts":i&&this.o&&(this.Wt=i.map((t=>{const e=document.createElement("behold-popover-gallery-slide");return e.post=t,e.feedMetadata=this.feedMetadata,e})),this.o.beholdReplaceChildren(this.Wt));case"widgetSettings":c(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.Wt&&this.Wt.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.Yt.style.backgroundColor=`hsl(${t[0]} ${Math.min(t[1],50)}% ${Math.min(t[2],15)}% / ${i})`}),"overlayColor")}}ae(t){"Escape"===t.code&&(t.preventDefault(),this.re())}open(t,e){this.ie=t,this.cancelRaf("open"),this.closeFocusEl=e,this.se=document.body.style.overflow;const i=window.innerWidth-document.documentElement.clientWidth;this.oe=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.he(),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.Gt,this.Wt?.filter(((e,i)=>i!==t)),1),this.ne(this.offsetWidth),document.addEventListener("keydown",this.ae)}),"open")}re(){this.cancelTo("close"),this.classList.remove("is-visible"),this.to(this.remove.bind(this),300,"close"),z(this.closeFocusEl),document.removeEventListener("keydown",this.ae),document.body.style.overflow=this.se,document.documentElement.style.paddingRight=this.oe,this.style.paddingRight=""}Lt(t){this.ie=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&&n(`${e}, post ${t+1} of ${this.Wt.length} in gallery`),E({include:[this.Gt],exclude:this.Wt.filter(((e,i)=>i!==t)),merge:!1}),this.onSlideChange&&this.onSlideChange(t),this.Wt.forEach(((e,i)=>{i===t?e.activate():e.deactivate()}));const i=this.Wt[t-1]??null,s=this.Wt[t+1]??null;i&&this.raf((()=>i.preload()),"preloadPrev"),s&&this.raf((()=>s.preload()),"preloadNext");const o=this.Wt?.[t]?this.Wt[t].getBackgroundColor():null;o&&this.updateGlobalState({popoverOverlayHslArray:o})}ne(t){t>this.Xt?(this.classList.remove("is-scroller"),this.zt.style.display="",this.St.style.display="",this.ee.destroy(),this.te.init(this.ie),this.Wt.forEach((t=>t.expandCaption())),this.updateGlobalState({popoverOverlayOpacity:.85})):(this.classList.add("is-scroller"),this.te.destroy(),this.ee.init(this.ie),this.Wt.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.ne(e)}he(){document.body.append(this),this.Gt.beholdReplaceChildren(this.Zt,this.Kt)}static register(t="behold-popover-gallery"){return customElements.get(t)||customElements.define(t,B),t}}export{B as default};
@@ -1 +1 @@
1
- import{B as e,a as t,h as o,s,c as i,t as a,b as r,f as h,i as n,d as l}from"./index-8GmY65W7.js";function c(e){if(!e)return e;let[t,o,s]=e.split(",");t/=255,o/=255,s/=255;const i=Math.max(t,o,s),a=i-Math.min(t,o,s),r=a?i===t?(o-s)/a:i===o?2+(s-t)/a:4+(t-o)/a:0;return[60*r<0?60*r+360:60*r,100*(a?i<=.5?a/(2*i-a):a/(2-(2*i-a)):0),100*(2*i-a)/2]}function d(e,t){const o=(s=e,i="dominant",s.filter((e=>e[i])).map((e=>e[i]))).map((e=>c(e).join(",")));var s,i;return[p(f(o,0)),p(f(o,1)),p(f(o,2))]}function p(e){const t=[...e];t.sort((function(e,t){return e-t}));const o=Math.floor((t.length-1)/2);return t.length%2?t[o]:(t[o]+t[o+1])/2}function f(e,t){return e.map((e=>parseInt(e.split(",")[t])))}class b extends e{label="BaseWidget";shadow;styleEl;contents;stylesAdded;constructor(){super(),this.shadow=this.attachShadow({mode:"open"}),this.handleKeydown=this.handleKeydown.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleFocusout=this.handleFocusout.bind(this),this.handleShadowFocusout=this.handleShadowFocusout.bind(this),this.onGlobalStateChange((()=>{t(this,{"keyboard-nav":this.globalState.keyboardNavEnabled})})),this.onConnect((()=>{this.styleEl=document.createElement("style"),t(this,{"keyboard-nav":this.globalState.keyboardNavEnabled}),this.addEventListener("focus",this.handleFocus),this.addEventListener("focusout",this.handleFocusout),this.shadow.addEventListener("focusout",this.handleShadowFocusout),this.addEventListener("keydown",this.handleKeydown)}))}focusPreviousPost(){this.dispatchEvent(new CustomEvent("post-focus-previous"))}focusNextPost(){this.dispatchEvent(new CustomEvent("post-focus-next"))}handleKeydown(e){"ArrowLeft"===e.key&&e.shiftKey&&this.focusPreviousPost(),"ArrowRight"===e.key&&e.shiftKey&&this.focusNextPost(),this.shadow.activeElement&&this.classList.remove("has-focus")}handleFocus(e){this.shadow.activeElement||this.classList.add("has-focus")}handleFocusout(){this.classList.remove("has-focus")}handleShadowFocusout(e){e.relatedTarget===this&&this.classList.add("has-focus")}renderWidget(e,t){this.stylesAdded&&this.contents?this.contents.replaceWith(e):(this.contents=e,this.styleEl.beholdReplaceChildren(...t.map((e=>e.toString()))),this.shadow.beholdReplaceChildren(this.contents,this.styleEl),this.stylesAdded=!0)}}function v(e){return e?`hsl(${e[0]}, ${e[1]}%, ${e[2]}%, ${Math.max(1*Math.random(),.3)})`:""}class m extends e{label="BasePost";post;widgetSettings;feedMetadata;medianPaletteHSL;hasRowGap=!1;isLastRow=!1;onClick;previewLoadingColors=null;aspectRatio;index;totalPosts;t;o;constructor(){super(),this.onPropChange(this.i,["post","widgetSettings","feedMetadata","medianPaletteHSL","hasRowGap","isLastRow","previewLoadingColors","aspectRatio","index","totalPosts"],["post","widgetSettings","feedMetadata","medianPaletteHSL","index","totalPosts"]),this.h=this.h.bind(this),this.onConnect((()=>{this.onResize(this,this,this.l)}))}i({changedProp:e,oldValue:t,newValue:s}){switch(e){case"post":o(s,t,["colorPalette"])&&this.p();break;case"widgetSettings":o(s,t,["loadingColor","loadingColorTone"])&&this.p(),this.t&&o(s,t,["linkTarget"])&&s?.onPostClick?.toLowerCase().includes("link")&&this.t.setAttribute("target",s.linkTarget),this.t&&o(s,t,["customLinkURL"])&&"customLink"===s.onPostClick&&this.t.setAttribute("href",s.customLinkURL),o(s,t,["hoverOverlayColor","hoverOverlayCustomColor","hoverOverlayOpacity"])&&this.v(),this.m();break;case"previewLoadingColors":this.p();break;case"hasRowGap":case"isLastRow":this.m()}}v(){let e="rgba(0, 0, 0, 0.3)",t=this.widgetSettings.hoverOverlayCustomColor??"0,0,0",o=this.widgetSettings.hoverOverlayOpacity??65;if("auto"===this.widgetSettings.hoverOverlayColor){const t=c(this.post.colorPalette?.dominant||"100,100,100").map((e=>Math.round(e)));e=`hsl(${t[0]} ${Math.min(t[1],50)}% ${Math.min(t[2],40)}% / ${o/100})`}if("custom"===this.widgetSettings.hoverOverlayColor){const s=t.split(",");e=`hsl(${s[0]} ${s[1]}% ${s[2]}% / ${o/100})`}s(this,{"--overlay-color":e})}m(){t(this,{post:!0,"post--hover-icon":"showIcon"===this.widgetSettings.onHover,"post--hover-caption":"showCaption"===this.widgetSettings.onHover,"post--has-row-gap":this.hasRowGap,"post--last-row":this.isLastRow}),this.v()}renderPost(e){let t="div",o=this.post.permalink;this.m(),"linkToProfile"===this.widgetSettings.onPostClick&&this.feedMetadata.username&&(o=`https://instagram.com/${this.feedMetadata.username}`),"customLink"===this.widgetSettings.onPostClick&&this.widgetSettings.customLinkURL&&(o=this.widgetSettings?.customLinkURL),this.widgetSettings.onPostClick.toLowerCase().includes("link")&&(t="a"),this.widgetSettings.onPostClick.toLowerCase().includes("popup")&&(t="button");let s=null;if("showCaption"===this.widgetSettings.onHover){const e=i({contents:this.post.prunedCaption?.length?this.post.prunedCaption:this.post.caption,classes:"post-caption__inner"});s=i({contents:e,classes:"post-caption"})}let a="image";switch(this.post?.mediaType){case"VIDEO":a=this.post.isReel?"reel":"video";break;case"CAROUSEL_ALBUM":a="album";break;default:a="image"}this.t=i({type:t,contents:[e,s||""],attributes:{draggable:"false","aria-label":`${a}, post ${this.index+1} of ${this.totalPosts}`,tabindex:-1,..."a"===t?{href:o,target:this.widgetSettings.linkTarget}:{}},listeners:{..."button"===t?{click:this.h}:{}}}),this.beholdReplaceChildren(this.t)}p(){const e=this.previewLoadingColors??this.widgetSettings.loadingColor;this.style.backgroundColor=function(e,t,o,s){let i="";switch(e){case"dominant":case"vibrant":case"muted":case"vibrantLight":case"mutedLight":case"vibrantDark":case"mutedDark":i=t?`rgb(${t[e]})`:v(s);break;case"tone":if(o){const e=o.split(",");if(t){const o=(a=c(t.dominant)[2]-s[2],Math.log(Math.abs(a))/Math.log(1.6)*Math.sign(a));i=`hsl(${e[0]},${e[1]}%,${parseInt(e[2])+o}%)`}else i=`hsl(${e[0]},${e[1]}%,${e[2]}%, ${Math.max(1*Math.random(),.3)})`}else i=v(s)}var a;return i}(e,this.post.colorPalette,this.widgetSettings.loadingColorTone,this.medianPaletteHSL)}l(e){const o=e?.borderBoxSize?.[0]?.inlineSize||e?.contentRect?.width||0,i=e?.borderBoxSize?.[0]?.blockSize||e?.contentRect?.height||0;let a="xlarge";o<600&&(a="large"),o<400&&(a="medium"),o<250&&(a="small"),o<175&&(a="xsmall"),["xsmall","small","medium","large","xlarge"].forEach((e=>{s(this,{"--post-width":o+"px","--post-height":i+"px"}),t(this,{[`post--${e}`]:e===a})}))}h(){this.onClick&&this.onClick(this)}focus(){this.t.focus()}}class u extends e{label="Image";sizes;mediaUrl;aspectRatio;showLoader=!1;u;k;G={isLoaded:!1,isVisible:!1,didError:!1,shouldPreload:!1,loaderIsShowing:!1,imageSrc:null,sizeObj:null};F;constructor(){super(),this.onPropChange(this._,["sizes","mediaUrl","aspectRatio","showLoader"],["sizes","mediaUrl","aspectRatio"]),this.onLocalStateChange(this.P,this.G),this.C=this.C.bind(this),this.S=this.S.bind(this),this.L=this.L.bind(this),this.F=a(this.l,50,this),this.preload=this.preload.bind(this),this.onConnect((()=>{const e=this.aspectRatio?300:this.sizes?.full.height??300,t=this.aspectRatio?300*this.aspectRatio:this.sizes?.full.width??300;this.style.aspectRatio=this.aspectRatio?`${this.aspectRatio}`:`${t}/${e}`;let o=this.sizes?.full.height?r(t,e):this.mediaUrl??r(t,e);this.u=i({type:"img",attributes:{alt:"",role:"presentation",height:e+"px",width:t+"px",tabindex:-1,src:o,draggable:"false"},listeners:{load:this.S,error:this.L}}),this.showLoader?(this.k=i({classes:"ldr"}),this.beholdReplaceChildren(this.k,this.u)):this.beholdReplaceChildren(this.u),h(),this.raf((()=>{this.onResize(this,this,this.F),this.onIntersection(this,this.C)}),"connect")})),this.onDisconnect((()=>{this.updateLocalState({isVisible:!1,isLoaded:!1}),this.u&&(this.u.removeEventListener("load",this.S),this.u.removeEventListener("error",this.L))}))}_({changedProp:e,oldValue:t,newValue:o}){switch(e){case"showLoader":!t&&o&&this.u&&(this.k=i({classes:"ldr"}),this.beholdReplaceChildren(this.k,this.u));break;case"sizes":if(n(t,o))return;this.updateLocalState({isLoaded:!1,sizeObj:this.u?.isConnected?this.M(this.offsetWidth,this.offsetHeight):null})}}P({changedProps:e,newState:o}){if(e.includes("loaderIsShowing")&&this.k&&t(this.k,{"ldr--visible":o.loaderIsShowing&&!o.isLoaded}),e.includes("imageSrc")&&this.u&&(o.isVisible||o.shouldPreload)&&o.imageSrc!==this.u.src&&(this.u.src=o.imageSrc),e.includes("sizeObj")&&!o.didError){const e=this.mediaUrl;this.updateLocalState({imageSrc:o.sizeObj?.mediaUrl??e})}}C(e){e.isIntersecting?(this.updateLocalState({isVisible:!0}),!this.localState.isLoaded&&this.showLoader&&this.to((()=>{this.updateLocalState({loaderIsShowing:!0})}),50,"loader"),this.localState.imageSrc&&this.u.src!==this.localState.imageSrc&&(this.u.src=this.localState.imageSrc)):this.updateLocalState({isVisible:!1})}l(e){let t=e.borderBoxSize?e.borderBoxSize[0].inlineSize:e.contentRect.width||0,o=e.borderBoxSize?e.borderBoxSize[0].blockSize:e.contentRect.height||0;const s=this.M(t,o);(!this.localState.sizeObj?.width||this.localState.sizeObj?.width<s?.width||this.localState.sizeObj?.height<s?.height)&&this.updateLocalState({sizeObj:s})}S(){this.u.src!==this.localState.imageSrc&&!this.localState.shouldPreload&&this.sizes?.full.height||(this.cancelTo("loader"),this.updateLocalState({isLoaded:!0,loaderIsShowing:!1}),this.dispatchEvent(new Event("load")),this.classList.add("is-loaded"))}L(){this.localState.imageSrc===this.mediaUrl||this.localState.didError||(this.updateLocalState({didError:!0}),this.updateLocalState({imageSrc:this.mediaUrl}))}M(e,t){if(this.sizes)return this.sizes?Object.values(this.sizes).reduce((function(o,s){return Math.abs(s.width/2-e)<Math.abs(o.width/2-e)||Math.abs(s.height/2-t)<Math.abs(o.height/2-t)?s:o})):null}preload(){this.localState.isLoaded||(this.localState.imageSrc&&this.localState.sizeObj&&this.u.src!==this.localState.imageSrc?this.u.src=this.localState.imageSrc:this.updateLocalState({shouldPreload:!0}))}static register(e="behold-image"){return customElements.get(e)||customElements.define(e,u),e}}class g extends m{label="ImagePost";u;constructor(){super(),u.register(),this.onPropChange(this._,["post","widgetSettings","aspectRatio"],null,this.R)}_({changedProp:e,oldValue:t,newValue:s}){switch(e){case"widgetSettings":o(s,t,["onHover","onPostClick"])&&this.R();break;case"post":case"aspectRatio":this.R()}}R(){const{sizes:e,mediaUrl:t}=this.post;this.u=i({type:"behold-image",props:{sizes:e,mediaUrl:t,aspectRatio:this.aspectRatio.reduce(((e,t)=>e/t))}}),this.renderPost(this.u)}static register(e="behold-image-post"){return customElements.get(e)||customElements.define(e,g),e}}class y extends e{label="Video";mediaUrl;sizes;autoplay;aspectRatio;B;$;V;u;constructor(){super(),this.B=this.autoplay||!1,this.$=!1,this.C=this.C.bind(this),this.j=this.j.bind(this),this.I=this.I.bind(this),this.U=this.U.bind(this),this.O=this.O.bind(this),this.preload=this.preload.bind(this),document.addEventListener("visibilitychange",this.I),this.onLoop((async()=>{if(this.V&&this.isLoaded){if(!this.$&&this.B&&!this.T)try{this.$=!0,await this.V.play(),this.$=!1}catch(e){this.$=!1}!this.B&&this.T&&(this.V.pause(),this.$=!1)}}),15),this.onPropChange((({changedProp:e,newValue:t})=>{this.localState.shouldPreload&&this.mediaUrl&&l("video",this.mediaUrl),"autoplay"===e&&(t?this.play():this.pause())}),["mediaUrl","sizes","autoplay","aspectRatio"],["mediaUrl","sizes"]),this.onLocalStateChange((()=>{}),{isMuted:!0,isLoaded:!1,shouldPreload:!1}),this.onConnect((()=>{this.onIntersection(this,this.C),this.render()})),this.onDisconnect((()=>{document.removeEventListener("visibilitychange",this.I),this.V&&(this.V.removeEventListener("play",this.U),this.V.removeEventListener("pause",this.O),this.V.removeEventListener("loadeddata",this.j))}))}get isPlaying(){return this.B||!1}get T(){return!!(this.V.currentTime>0&&!this.V.paused&&!this.V.ended&&this.V.readyState>2)}get paused(){return this.V?.paused}get muted(){return this.V?.muted}get isLoaded(){return this.localState.isLoaded}render(){this.V=i({type:"video",attributes:{loop:!0,playsinline:!0,crossorigin:"anonymous",tabIndex:-1,disablePictureInPicture:!0,disableremoteplayback:!0,height:this.sizes?.full.height||100,width:this.sizes?.full.width||100},props:{muted:this.localState.isMuted,autoplay:this.autoplay||!1},listeners:{play:this.U,pause:this.O}}),this.u=i({type:"img",attributes:{height:this.sizes.full.height,width:this.sizes.full.width,src:r(this.sizes.full.width,this.sizes.full.height)}}),this.beholdReplaceChildren(this.u)}C(e){e.isIntersecting&&this.V?this.V.src!==this.mediaUrl&&(this.V.addEventListener("loadeddata",this.j,{once:!0}),this.V.src=this.mediaUrl,this.V.load()):this.autoplay||this.pause()}j(){this.updateLocalState({isLoaded:!0}),this.autoplay||(this.V.currentTime=.25,this.V.pause()),this.dispatchEvent(new Event("load")),this.beholdReplaceChildren(this.V),h(),this.raf((()=>{this.classList.add("is-loaded")}),"_handleVideoLoad")}U(){this.dispatchEvent(new Event("play"))}O(){this.dispatchEvent(new Event("pause"))}play(){this.B=!0}pause(){this.B=!1}mute(){this.updateLocalState({isMuted:!0}),this.V&&(this.V.muted=!0)}unmute(){this.updateLocalState({isMuted:!1}),this.V&&(this.V.muted=!1)}I(){document.hidden&&(this.pause(),this.V&&this.V.pause()),!document.hidden&&this.autoplay&&this.play()}preload(){!this.localState.isLoaded&&this.mediaUrl?l("video",this.mediaUrl):this.updateLocalState({shouldPreload:!0})}static register(e="behold-video"){return customElements.get(e)||customElements.define(e,y),e}}class w extends m{label="VideoPost";V;u;constructor(){super(),this.onPropChange(this._,["post","widgetSettings","aspectRatio"],null,this.R),y.register(),u.register(),this.H=this.H.bind(this),this.A=this.A.bind(this),this.onDisconnect((()=>{this.removeEventListener("mouseover",this.H),this.removeEventListener("mouseleave",this.A)}))}_({changedProp:e,oldValue:t,newValue:s}){switch(e){case"widgetSettings":o(t,s,["onHover","onPostClick","previewVideosOnHover"])&&this.R(),o(t,s,["autoplayVideos"])&&(this.widgetSettings.previewVideosOnHover?this.V.autoplay=s.autoplayVideos:this.R());break;case"post":case"aspectRatio":this.R()}}H(){this.V?.play()}A(){this.widgetSettings.autoplayVideos||this.V?.pause()}R(){const{sizes:e,mediaUrl:t,thumbnailUrl:o}=this.post;(this.widgetSettings.previewVideosOnHover||this.widgetSettings.autoplayVideos)&&t||!e.full.mediaUrl&&!o&&t?(this.V=i({type:"behold-video",props:{mediaUrl:t,sizes:e,autoplay:this.widgetSettings.autoplayVideos,aspectRatio:this.aspectRatio.reduce(((e,t)=>e/t))},listeners:{mouseover:this.H,mouseleave:this.A}}),this.renderPost(this.V)):(this.u=i({type:"behold-image",props:{sizes:e,mediaUrl:o,aspectRatio:this.aspectRatio.reduce(((e,t)=>e/t))}}),this.renderPost(this.u))}static register(e="behold-video-post"){return customElements.get(e)||customElements.define(e,w),e}}class k extends m{label="AlbumPost";Y;constructor(){super(),u.register(),y.register(),this.onPropChange(this._,["post","widgetSettings"],null,this.R)}_({changedProp:e,oldValue:t,newValue:s}){switch(e){case"widgetSettings":o(s,t,["onHover","onPostClick"])&&this.R();break;case"post":case"aspectRatio":this.R()}}R(){let{sizes:e,mediaUrl:t,children:o}=this.post;if(!e.full.mediaUrl&&!t){const s=o.reduce(((e,t)=>"VIDEO"===t.mediaType?t.sizes.full.mediaUrl||t.thumbnailUrl?t:e:t.sizes.full.mediaUrl||t.mediaUrl?t:e));e=s.sizes,t=s.thumbnailUrl??s.mediaUrl}this.post.mediaUrlIsVideo?this.Y=i({type:"behold-video",props:{sizes:e,mediaUrl:t,aspectRatio:this.aspectRatio.reduce(((e,t)=>e/t))}}):this.Y=i({type:"behold-image",props:{sizes:e,mediaUrl:t,aspectRatio:this.aspectRatio.reduce(((e,t)=>e/t))}}),this.renderPost(this.Y)}static register(e="behold-album-post"){return customElements.get(e)||customElements.define(e,k),e}}var z=":host{--post-border-radius:0;--post-aspect-ratio:1;--icon-instagram: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='M17.6 3.2c4.7 0 5.2 0 7.1.1 1.7.1 2.6.4 3.2.6.8.3 1.4.7 2 1.3.6.6 1 1.2 1.3 2 .2.6.5 1.5.6 3.3.1 1.8.1 2.4.1 7.1s0 5.2-.1 7.1c-.1 1.7-.4 2.6-.6 3.2-.6 1.5-1.8 2.7-3.3 3.3-.6.2-1.5.5-3.2.6-1.8.1-2.4.1-7.1.1s-5.2 0-7.1-.1c-1.7-.1-2.6-.4-3.2-.6-.8-.3-1.4-.7-2-1.3-.6-.6-1-1.2-1.3-2-.2-.6-.5-1.5-.6-3.2-.1-1.8-.1-2.4-.1-7.1s0-5.2.1-7.1c0-1.8.3-2.7.6-3.3.3-.8.7-1.4 1.3-2 .6-.6 1.2-1 2-1.3.6-.2 1.5-.5 3.2-.6 1.9-.1 2.4-.1 7.1-.1m0-3.2c-4.8 0-5.3 0-7.2.1-1.9.1-3.2.4-4.3.8C5 1.4 3.9 2 3 2.9c-.9.9-1.5 2-2 3.1C.6 7.1.3 8.4.2 10.2c-.1 1.9-.1 2.5-.1 7.2s0 5.3.1 7.2c.1 2 .4 3.2.8 4.4.4 1.2 1.1 2.2 2 3.1.9.9 1.9 1.6 3.1 2 1.1.4 2.4.7 4.2.8s2.5.1 7.2.1 5.3 0 7.2-.1c1.9-.1 3.1-.4 4.2-.8 2.3-.9 4.2-2.8 5.1-5.1.4-1.1.7-2.4.8-4.2.1-1.9.1-2.5.1-7.2s0-5.3-.1-7.2c-.1-1.9-.4-3.1-.8-4.2-.4-1.2-1.1-2.2-2-3.1-.9-.9-1.9-1.6-3.1-2-1.1-.4-2.4-.7-4.2-.8-1.8-.3-2.4-.3-7.1-.3z'/%3E%3Cpath fill='%23FFF' d='M17.6 8.5c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 14.8c-3.2 0-5.8-2.6-5.8-5.8s2.6-5.8 5.8-5.8 5.8 2.6 5.8 5.8-2.6 5.8-5.8 5.8z'/%3E%3Ccircle fill='%23FFF' cx='26.9' cy='8.2' r='2.1'/%3E%3C/svg%3E\");--icon-video: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='M30.1 15.5 7.2 2.3c-1.5-.9-3.5.2-3.5 1.9v26.5c0 1.7 1.9 2.9 3.4 1.9L30 19.4c1.7-.8 1.7-3 .1-3.9z'/%3E%3C/svg%3E\");--icon-album: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\");align-items:center;border:none;box-shadow:none;box-sizing:border-box;display:flex;flex-wrap:wrap;justify-content:center;margin:0;min-width:50px;outline:none;position:relative;width:100%}:host *{box-sizing:border-box}:host(.keyboard-nav.has-focus){outline:none}:host(.keyboard-nav.has-focus):before{background-color:rgba(0,0,0,.25);border-radius:6px;content:\"\";display:block;height:100%;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:100%;z-index:1}:host(.keyboard-nav.has-focus):after{background-color:#222;border-radius:6px;box-shadow:0 0 0 2px #4169e1,0 0 0 3px #fff,0 .6px .4px rgba(0,0,0,.042),0 1.3px 1px rgba(0,0,0,.061),0 2.5px 1.9px rgba(0,0,0,.075),0 4.5px 3.4px rgba(0,0,0,.089),0 8.4px 6.3px rgba(0,0,0,.108),0 20px 15px rgba(0,0,0,.15);color:#fff;content:\"Shift + arrow keys to navigate posts\";font-family:sans-serif;font-size:16px;max-width:80%;padding:15px;position:absolute;text-align:center;z-index:1}@media (max-width:1300px){:host(.keyboard-nav.has-focus):after{font-size:15px}}:host(.keyboard-nav.has-focus) .posts{opacity:.65}.posts{display:grid;margin:0;max-width:100%;padding:0;width:100%}.post{-webkit-font-smoothing:inherit;-moz-osx-font-smoothing:inherit;align-self:stretch;border:none;border-radius:var(--post-border-radius) /calc(var(--post-border-radius)*var(--post-aspect-ratio));color:inherit;font:inherit;isolation:isolate;line-height:normal;margin:0 0 -1px;overflow:hidden;transform:translateZ(0);transition:background .3s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:calc(100% + .5px)}:host(.keyboard-nav) .post.post:focus-within{box-shadow:0 0 0 1px #fff,0 0 0 3px #4169e1,0 0 0 4px #fff;z-index:1}:host(.is-previewing-loading-colors) .post *{opacity:0}.post.post--has-row-gap,.post.post--last-row{margin:0}.post:before{background-color:transparent;border-radius:var(--post-border-radius) /calc(var(--post-border-radius)*var(--post-aspect-ratio));content:\"\";height:100%;left:0;pointer-events:none;position:absolute;top:0;transition:all 2s cubic-bezier(.215,.61,.355,1);width:100%;z-index:2}@supports ((-webkit-backdrop-filter:blur(3px)) or (backdrop-filter:blur(3px))){[data-hover-effect*=blur i] .post:before{height:calc(100% - 1px);left:0;opacity:0;top:0;transition:all .6s cubic-bezier(.215,.61,.355,1);width:100%}}.post.post--hover-icon:after{background-image:var(--icon);background-position:50%;background-repeat:no-repeat;background-size:auto 100%;border-radius:var(--post-border-radius) /calc(var(--post-border-radius)*var(--post-aspect-ratio));content:\"\";height:12%;height:calc(min(var(--post-width), var(--post-height))*.12);left:0;max-height:30px;min-height:20px;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translateY(-50%) scale(.75);transition:all .6s cubic-bezier(.215,.61,.355,1);width:100%;will-change:transform;z-index:3}@media (prefers-reduced-motion){.post.post--hover-icon:after{transition:none}}.post behold-album,.post behold-image,.post behold-video{height:100%;width:100%}.post>a,.post>button,.post>div{background-color:transparent;border:0;box-shadow:none;color:inherit;display:block;font:inherit;height:100%;line-height:inherit;outline:none;padding:0;transition:opacity .3s ease;width:100%}.post a,.post button{cursor:pointer}behold-image-post{--icon:var(--icon-instagram)}behold-video-post{--icon:var(--icon-video)}behold-album-post{--icon:var(--icon-album)}.post-caption{align-items:center;background-color:var(--overlay-color);display:flex;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;font-size:15px;height:100%;justify-content:center;left:0;line-height:1.5;opacity:0;padding:15%;pointer-events:none;position:absolute;top:0;transition:opacity .4s ease;width:100%;z-index:2}.post:hover .post-caption,:host(:host(.keyboard-nav)) .post:focus-within .post-caption{opacity:1}.post--xlarge .post-caption{--lines:12;--innerScale:scale(0.98);padding:20%}.post--large .post-caption{--lines:9;--innerScale:scale(0.98)}.post--medium .post-caption{--lines:6;--innerScale:scale(0.97);font-size:14px}.post--small .post-caption{--lines:4;--innerScale:scale(0.95);font-size:13px;line-height:1.25}.post--xsmall .post-caption{--lines:3;--innerScale:scale(0.95);font-size:12px;line-height:1.25}.post-caption__inner{-webkit-line-clamp:var(--lines);-webkit-box-orient:vertical;color:#fff;display:-webkit-box;opacity:0;overflow:hidden;text-align:center;transform:var(--innerScale);transition:all .3s ease;white-space:pre-line;will-change:transform,opacity;word-break:none}@media (prefers-reduced-motion){.post-caption__inner{transform:none}}.post:hover .post-caption__inner,:host(.keyboard-nav) .post:focus-within .post-caption__inner{opacity:1;transform:none;transition:all .3s ease}:host(.keyboard-nav) .post:focus-within:before{background-color:var(--overlay-color);transition:all .6s cubic-bezier(.215,.61,.355,1)}:host(.keyboard-nav) .post:focus-within:after{opacity:1;transform:translateY(-50%)}:host(.keyboard-nav) [data-hover-effect=fade] .post:focus-within:before,[data-hover-effect=fade] .post:hover:before{background-color:var(--overlay-color);transition:all .6s cubic-bezier(.215,.61,.355,1)}:host(.keyboard-nav) [data-hover-effect=fade] .post:focus-within:after,[data-hover-effect=fade] .post:hover:after{opacity:1;transform:translateY(-50%)}:host(.keyboard-nav) [data-hover-effect=zoomFade] .post:focus-within behold-image img,:host(.keyboard-nav) [data-hover-effect=zoomFade] .post:focus-within behold-video video,[data-hover-effect=zoomFade] .post:hover behold-image img,[data-hover-effect=zoomFade] .post:hover behold-video video{transform:scale(1.05)}@media (prefers-reduced-motion){:host(.keyboard-nav) [data-hover-effect=zoomFade] .post:focus-within behold-image img,:host(.keyboard-nav) [data-hover-effect=zoomFade] .post:focus-within behold-video video,[data-hover-effect=zoomFade] .post:hover behold-image img,[data-hover-effect=zoomFade] .post:hover behold-video video{transform:none}}:host(.keyboard-nav) [data-hover-effect=zoomFade] .post:focus-within:before,[data-hover-effect=zoomFade] .post:hover:before{background-color:var(--overlay-color);transition:all .6s cubic-bezier(.215,.61,.355,1)}:host(.keyboard-nav) [data-hover-effect=zoomFade] .post:focus-within:after,[data-hover-effect=zoomFade] .post:hover:after{opacity:1;transform:translateY(-50%)}@supports not ((-webkit-backdrop-filter:blur(3px)) or (backdrop-filter:blur(3px))){:host(.keyboard-nav) [data-hover-effect=blur] .post:focus-within behold-image,:host(.keyboard-nav) [data-hover-effect=blur] .post:focus-within behold-video,[data-hover-effect=blur] .post:hover behold-image,[data-hover-effect=blur] .post:hover behold-video{filter:brightness(97%) blur(3px);transition:all .6s cubic-bezier(.215,.61,.355,1)}}@supports ((-webkit-backdrop-filter:blur(3px)) or (backdrop-filter:blur(3px))){:host(.keyboard-nav) [data-hover-effect=blur] .post:focus-within:before,[data-hover-effect=blur] .post:hover:before{-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);background-color:rgba(0,0,0,.002);opacity:1}}:host(.keyboard-nav) [data-hover-effect=blur] .post:focus-within:after,[data-hover-effect=blur] .post:hover:after{opacity:1;transform:translateY(-50%)}:host(.keyboard-nav) [data-hover-effect=zoomBlur] .post:focus-within behold-image,:host(.keyboard-nav) [data-hover-effect=zoomBlur] .post:focus-within behold-video,[data-hover-effect=zoomBlur] .post:hover behold-image,[data-hover-effect=zoomBlur] .post:hover behold-video{transform:scale(1.05);transition:all .6s cubic-bezier(.215,.61,.355,1)}@media (prefers-reduced-motion){:host(.keyboard-nav) [data-hover-effect=zoomBlur] .post:focus-within behold-image,:host(.keyboard-nav) [data-hover-effect=zoomBlur] .post:focus-within behold-video,[data-hover-effect=zoomBlur] .post:hover behold-image,[data-hover-effect=zoomBlur] .post:hover behold-video{transform:none}}@supports not ((-webkit-backdrop-filter:blur(3px)) or (backdrop-filter:blur(3px))){:host(.keyboard-nav) [data-hover-effect=zoomBlur] .post:focus-within behold-image,:host(.keyboard-nav) [data-hover-effect=zoomBlur] .post:focus-within behold-video,[data-hover-effect=zoomBlur] .post:hover behold-image,[data-hover-effect=zoomBlur] .post:hover behold-video{filter:brightness(97%) blur(3px)}}@supports ((-webkit-backdrop-filter:blur(3px)) or (backdrop-filter:blur(3px))){:host(.keyboard-nav) [data-hover-effect=zoomBlur] .post:focus-within:before,[data-hover-effect=zoomBlur] .post:hover:before{-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);background-color:rgba(0,0,0,.002);opacity:1}}:host(.keyboard-nav) [data-hover-effect=zoomBlur] .post:focus-within:after,[data-hover-effect=zoomBlur] .post:hover:after{opacity:1;transform:translateY(-50%)}:host(.keyboard-nav) [data-hover-effect=toGreyscale] .post:focus-within behold-image,:host(.keyboard-nav) [data-hover-effect=toGreyscale] .post:focus-within behold-video,[data-hover-effect=toGreyscale] .post:hover behold-image,[data-hover-effect=toGreyscale] .post:hover behold-video{filter:grayscale(100%);transition:all .6s cubic-bezier(.215,.61,.355,1)}:host(.keyboard-nav) [data-hover-effect=toGreyscale] .post:focus-within:after,[data-hover-effect=toGreyscale] .post:hover:after{opacity:1;transform:translateY(-50%)}:host(.keyboard-nav) [data-hover-effect=zoomToGreyscale] .post:focus-within behold-image,:host(.keyboard-nav) [data-hover-effect=zoomToGreyscale] .post:focus-within behold-video,[data-hover-effect=zoomToGreyscale] .post:hover behold-image,[data-hover-effect=zoomToGreyscale] .post:hover behold-video{filter:grayscale(100%);transform:scale(1.05);transition:all .6s cubic-bezier(.215,.61,.355,1)}@media (prefers-reduced-motion){:host(.keyboard-nav) [data-hover-effect=zoomToGreyscale] .post:focus-within behold-image,:host(.keyboard-nav) [data-hover-effect=zoomToGreyscale] .post:focus-within behold-video,[data-hover-effect=zoomToGreyscale] .post:hover behold-image,[data-hover-effect=zoomToGreyscale] .post:hover behold-video{transform:none}}:host(.keyboard-nav) [data-hover-effect=zoomToGreyscale] .post:focus-within:after,[data-hover-effect=zoomToGreyscale] .post:hover:after{opacity:1;transform:translateY(-50%)}:host(.keyboard-nav) [data-hover-effect=fromGreyscale] .post,[data-hover-effect=fromGreyscale] .post{filter:grayscale(100%)}:host(.keyboard-nav) [data-hover-effect=fromGreyscale] .post:focus,:host(.keyboard-nav) [data-hover-effect=fromGreyscale] .post:hover,[data-hover-effect=fromGreyscale] .post:focus,[data-hover-effect=fromGreyscale] .post:hover{filter:grayscale(0);transition:all .6s cubic-bezier(.215,.61,.355,1)}:host(.keyboard-nav) [data-hover-effect=fromGreyscale] .post:focus.post--hover-caption:before,:host(.keyboard-nav) [data-hover-effect=fromGreyscale] .post:hover.post--hover-caption:before,[data-hover-effect=fromGreyscale] .post:focus.post--hover-caption:before,[data-hover-effect=fromGreyscale] .post:hover.post--hover-caption:before{background-color:var(--overlay-color);transition:all .6s cubic-bezier(.215,.61,.355,1)}:host(.keyboard-nav) [data-hover-effect=fromGreyscale] .post:focus:after,:host(.keyboard-nav) [data-hover-effect=fromGreyscale] .post:hover:after,[data-hover-effect=fromGreyscale] .post:focus:after,[data-hover-effect=fromGreyscale] .post:hover:after{opacity:1;transform:translateY(-50%)}:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post,[data-hover-effect=zoomFromGreyscale] .post{filter:grayscale(100%)}:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:focus,:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:hover,[data-hover-effect=zoomFromGreyscale] .post:focus,[data-hover-effect=zoomFromGreyscale] .post:hover{filter:grayscale(0)}:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:focus behold-image,:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:focus behold-video,:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:hover behold-image,:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:hover behold-video,[data-hover-effect=zoomFromGreyscale] .post:focus behold-image,[data-hover-effect=zoomFromGreyscale] .post:focus behold-video,[data-hover-effect=zoomFromGreyscale] .post:hover behold-image,[data-hover-effect=zoomFromGreyscale] .post:hover behold-video{transform:scale(1.05);transition:all .6s cubic-bezier(.215,.61,.355,1)}@media (prefers-reduced-motion){:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:focus behold-image,:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:focus behold-video,:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:hover behold-image,:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:hover behold-video,[data-hover-effect=zoomFromGreyscale] .post:focus behold-image,[data-hover-effect=zoomFromGreyscale] .post:focus behold-video,[data-hover-effect=zoomFromGreyscale] .post:hover behold-image,[data-hover-effect=zoomFromGreyscale] .post:hover behold-video{transform:none}}:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:focus.post--hover-caption:before,:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:hover.post--hover-caption:before,[data-hover-effect=zoomFromGreyscale] .post:focus.post--hover-caption:before,[data-hover-effect=zoomFromGreyscale] .post:hover.post--hover-caption:before{background-color:var(--overlay-color);transition:all .6s cubic-bezier(.215,.61,.355,1)}:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:focus:after,:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:hover:after,[data-hover-effect=zoomFromGreyscale] .post:focus:after,[data-hover-effect=zoomFromGreyscale] .post:hover:after{opacity:1;transform:translateY(-50%)}behold-image{display:block;height:0;overflow:hidden;padding:0;padding-bottom:calc(100%/var(--post-aspect-ratio));position:relative;transition:all .6s cubic-bezier(.215,.61,.355,1);width:100%}behold-image img{border-radius:0;height:100%;left:0;-o-object-fit:cover;object-fit:cover;-o-object-position:center center;object-position:center center;opacity:0;pointer-events:none;position:absolute;top:0;transition:all .6s cubic-bezier(.215,.61,.355,1),opacity .6s ease;vertical-align:middle;width:100%;will-change:transform;z-index:1}@supports not ((-webkit-backdrop-filter:blur(3px)) or (backdrop-filter:blur(3px))){[data-hover-effect=blur] behold-image img,[data-hover-effect=zoomBlur] behold-image img{height:calc(100% + 6px);left:-3px;top:-3px;width:calc(100% + 6px)}}.post--reel behold-image img{-o-object-position:center 25%;object-position:center 25%}behold-image.is-loaded img{opacity:1}behold-video{display:block;height:0;overflow:hidden;padding:0;padding-bottom:calc(100%/var(--post-aspect-ratio));position:relative;transition:all .6s cubic-bezier(.215,.61,.355,1);width:100%}behold-video video{height:100%;left:0;-o-object-fit:cover;object-fit:cover;-o-object-position:center center;object-position:center center;opacity:0;pointer-events:none;position:absolute;top:0;transition:all .6s cubic-bezier(.215,.61,.355,1),opacity .6s ease;vertical-align:middle;width:100%;will-change:transform}.post--reel behold-video video{-o-object-position:center 25%;object-position:center 25%}behold-video.is-loaded video{opacity:1}";export{k as A,b as B,g as I,c as R,w as V,y as a,z as b,u as c,d as g};
1
+ import{B as e,a as t,h as o,s,c as i,t as a,b as r,f as h,i as n,d as l}from"./index-ANfp_6HB.js";function c(e){if(!e)return e;let[t,o,s]=e.split(",");t/=255,o/=255,s/=255;const i=Math.max(t,o,s),a=i-Math.min(t,o,s),r=a?i===t?(o-s)/a:i===o?2+(s-t)/a:4+(t-o)/a:0;return[60*r<0?60*r+360:60*r,100*(a?i<=.5?a/(2*i-a):a/(2-(2*i-a)):0),100*(2*i-a)/2]}function d(e,t){const o=(s=e,i="dominant",s.filter((e=>e[i])).map((e=>e[i]))).map((e=>c(e).join(",")));var s,i;return[p(f(o,0)),p(f(o,1)),p(f(o,2))]}function p(e){const t=[...e];t.sort((function(e,t){return e-t}));const o=Math.floor((t.length-1)/2);return t.length%2?t[o]:(t[o]+t[o+1])/2}function f(e,t){return e.map((e=>parseInt(e.split(",")[t])))}class b extends e{label="BaseWidget";shadow;styleEl;contents;stylesAdded;constructor(){super(),this.shadow=this.attachShadow({mode:"open"}),this.handleKeydown=this.handleKeydown.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleFocusout=this.handleFocusout.bind(this),this.handleShadowFocusout=this.handleShadowFocusout.bind(this),this.onGlobalStateChange((()=>{t(this,{"keyboard-nav":this.globalState.keyboardNavEnabled})})),this.onConnect((()=>{this.styleEl=document.createElement("style"),t(this,{"keyboard-nav":this.globalState.keyboardNavEnabled}),this.addEventListener("focus",this.handleFocus),this.addEventListener("focusout",this.handleFocusout),this.shadow.addEventListener("focusout",this.handleShadowFocusout),this.addEventListener("keydown",this.handleKeydown)}))}focusPreviousPost(){this.dispatchEvent(new CustomEvent("post-focus-previous"))}focusNextPost(){this.dispatchEvent(new CustomEvent("post-focus-next"))}handleKeydown(e){"ArrowLeft"===e.key&&e.shiftKey&&this.focusPreviousPost(),"ArrowRight"===e.key&&e.shiftKey&&this.focusNextPost(),this.shadow.activeElement&&this.classList.remove("has-focus")}handleFocus(e){this.shadow.activeElement||this.classList.add("has-focus")}handleFocusout(){this.classList.remove("has-focus")}handleShadowFocusout(e){e.relatedTarget===this&&this.classList.add("has-focus")}renderWidget(e,t){this.stylesAdded&&this.contents?this.contents.replaceWith(e):(this.contents=e,this.styleEl.beholdReplaceChildren(...t.map((e=>e.toString()))),this.shadow.beholdReplaceChildren(this.contents,this.styleEl),this.stylesAdded=!0)}}function v(e){return e?`hsl(${e[0]}, ${e[1]}%, ${e[2]}%, ${Math.max(1*Math.random(),.3)})`:""}class m extends e{label="BasePost";post;widgetSettings;feedMetadata;medianPaletteHSL;hasRowGap=!1;isLastRow=!1;onClick;previewLoadingColors=null;aspectRatio;index;totalPosts;t;o;constructor(){super(),this.onPropChange(this.i,["post","widgetSettings","feedMetadata","medianPaletteHSL","hasRowGap","isLastRow","previewLoadingColors","aspectRatio","index","totalPosts"],["post","widgetSettings","feedMetadata","medianPaletteHSL","index","totalPosts"]),this.h=this.h.bind(this),this.onConnect((()=>{this.onResize(this,this,this.l)}))}i({changedProp:e,oldValue:t,newValue:s}){switch(e){case"post":o(s,t,["colorPalette"])&&this.p();break;case"widgetSettings":o(s,t,["loadingColor","loadingColorTone"])&&this.p(),this.t&&o(s,t,["linkTarget"])&&s?.onPostClick?.toLowerCase().includes("link")&&this.t.setAttribute("target",s.linkTarget),this.t&&o(s,t,["customLinkURL"])&&"customLink"===s.onPostClick&&this.t.setAttribute("href",s.customLinkURL),o(s,t,["hoverOverlayColor","hoverOverlayCustomColor","hoverOverlayOpacity"])&&this.v(),this.m();break;case"previewLoadingColors":this.p();break;case"hasRowGap":case"isLastRow":this.m()}}v(){let e="rgba(0, 0, 0, 0.3)",t=this.widgetSettings.hoverOverlayCustomColor??"0,0,0",o=this.widgetSettings.hoverOverlayOpacity??65;if("auto"===this.widgetSettings.hoverOverlayColor){const t=c(this.post.colorPalette?.dominant||"100,100,100").map((e=>Math.round(e)));e=`hsl(${t[0]} ${Math.min(t[1],50)}% ${Math.min(t[2],40)}% / ${o/100})`}if("custom"===this.widgetSettings.hoverOverlayColor){const s=t.split(",");e=`hsl(${s[0]} ${s[1]}% ${s[2]}% / ${o/100})`}s(this,{"--overlay-color":e})}m(){t(this,{post:!0,"post--hover-icon":"showIcon"===this.widgetSettings.onHover,"post--hover-caption":"showCaption"===this.widgetSettings.onHover,"post--has-row-gap":this.hasRowGap,"post--last-row":this.isLastRow}),this.v()}renderPost(e){let t="div",o=this.post.permalink;this.m(),"linkToProfile"===this.widgetSettings.onPostClick&&this.feedMetadata.username&&(o=`https://instagram.com/${this.feedMetadata.username}`),"customLink"===this.widgetSettings.onPostClick&&this.widgetSettings.customLinkURL&&(o=this.widgetSettings?.customLinkURL),this.widgetSettings.onPostClick.toLowerCase().includes("link")&&(t="a"),this.widgetSettings.onPostClick.toLowerCase().includes("popup")&&(t="button");let s=null;if("showCaption"===this.widgetSettings.onHover){const e=i({contents:this.post.prunedCaption?.length?this.post.prunedCaption:this.post.caption,classes:"post-caption__inner"});s=i({contents:e,classes:"post-caption"})}let a="image";switch(this.post?.mediaType){case"VIDEO":a=this.post.isReel?"reel":"video";break;case"CAROUSEL_ALBUM":a="album";break;default:a="image"}this.t=i({type:t,contents:[e,s||""],attributes:{draggable:"false","aria-label":`${a}, post ${this.index+1} of ${this.totalPosts}`,tabindex:-1,..."a"===t?{href:o,target:this.widgetSettings.linkTarget}:{}},listeners:{..."button"===t?{click:this.h}:{}}}),this.beholdReplaceChildren(this.t)}p(){const e=this.previewLoadingColors??this.widgetSettings.loadingColor;this.style.backgroundColor=function(e,t,o,s){let i="";switch(e){case"dominant":case"vibrant":case"muted":case"vibrantLight":case"mutedLight":case"vibrantDark":case"mutedDark":i=t?`rgb(${t[e]})`:v(s);break;case"tone":if(o){const e=o.split(",");if(t){const o=(a=c(t.dominant)[2]-s[2],Math.log(Math.abs(a))/Math.log(1.6)*Math.sign(a));i=`hsl(${e[0]},${e[1]}%,${parseInt(e[2])+o}%)`}else i=`hsl(${e[0]},${e[1]}%,${e[2]}%, ${Math.max(1*Math.random(),.3)})`}else i=v(s)}var a;return i}(e,this.post.colorPalette,this.widgetSettings.loadingColorTone,this.medianPaletteHSL)}l(e){const o=e?.borderBoxSize?.[0]?.inlineSize||e?.contentRect?.width||0,i=e?.borderBoxSize?.[0]?.blockSize||e?.contentRect?.height||0;let a="xlarge";o<600&&(a="large"),o<400&&(a="medium"),o<250&&(a="small"),o<175&&(a="xsmall"),["xsmall","small","medium","large","xlarge"].forEach((e=>{s(this,{"--post-width":o+"px","--post-height":i+"px"}),t(this,{[`post--${e}`]:e===a})}))}h(){this.onClick&&this.onClick(this)}focus(){this.t.focus()}}class u extends e{label="Image";sizes;mediaUrl;aspectRatio;showLoader=!1;u;k;G={isLoaded:!1,isVisible:!1,didError:!1,shouldPreload:!1,loaderIsShowing:!1,imageSrc:null,sizeObj:null};F;constructor(){super(),this.onPropChange(this._,["sizes","mediaUrl","aspectRatio","showLoader"],["sizes","mediaUrl","aspectRatio"]),this.onLocalStateChange(this.P,this.G),this.C=this.C.bind(this),this.S=this.S.bind(this),this.L=this.L.bind(this),this.F=a(this.l,50,this),this.preload=this.preload.bind(this),this.onConnect((()=>{const e=this.aspectRatio?300:this.sizes?.full.height??300,t=this.aspectRatio?300*this.aspectRatio:this.sizes?.full.width??300;this.style.aspectRatio=this.aspectRatio?`${this.aspectRatio}`:`${t}/${e}`;let o=this.sizes?.full.height?r(t,e):this.mediaUrl??r(t,e);this.u=i({type:"img",attributes:{alt:"",role:"presentation",height:e+"px",width:t+"px",tabindex:-1,src:o,draggable:"false"},listeners:{load:this.S,error:this.L}}),this.showLoader?(this.k=i({classes:"ldr"}),this.beholdReplaceChildren(this.k,this.u)):this.beholdReplaceChildren(this.u),h(),this.raf((()=>{this.onResize(this,this,this.F),this.onIntersection(this,this.C)}),"connect")})),this.onDisconnect((()=>{this.updateLocalState({isVisible:!1,isLoaded:!1}),this.u&&(this.u.removeEventListener("load",this.S),this.u.removeEventListener("error",this.L))}))}_({changedProp:e,oldValue:t,newValue:o}){switch(e){case"showLoader":!t&&o&&this.u&&(this.k=i({classes:"ldr"}),this.beholdReplaceChildren(this.k,this.u));break;case"sizes":if(n(t,o))return;this.updateLocalState({isLoaded:!1,sizeObj:this.u?.isConnected?this.M(this.offsetWidth,this.offsetHeight):null})}}P({changedProps:e,newState:o}){if(e.includes("loaderIsShowing")&&this.k&&t(this.k,{"ldr--visible":o.loaderIsShowing&&!o.isLoaded}),e.includes("imageSrc")&&this.u&&(o.isVisible||o.shouldPreload)&&o.imageSrc!==this.u.src&&(this.u.src=o.imageSrc),e.includes("sizeObj")&&!o.didError){const e=this.mediaUrl;this.updateLocalState({imageSrc:o.sizeObj?.mediaUrl??e})}}C(e){e.isIntersecting?(this.updateLocalState({isVisible:!0}),!this.localState.isLoaded&&this.showLoader&&this.to((()=>{this.updateLocalState({loaderIsShowing:!0})}),50,"loader"),this.localState.imageSrc&&this.u.src!==this.localState.imageSrc&&(this.u.src=this.localState.imageSrc)):this.updateLocalState({isVisible:!1})}l(e){let t=e.borderBoxSize?e.borderBoxSize[0].inlineSize:e.contentRect.width||0,o=e.borderBoxSize?e.borderBoxSize[0].blockSize:e.contentRect.height||0;const s=this.M(t,o);(!this.localState.sizeObj?.width||this.localState.sizeObj?.width<s?.width||this.localState.sizeObj?.height<s?.height)&&this.updateLocalState({sizeObj:s})}S(){this.u.src!==this.localState.imageSrc&&!this.localState.shouldPreload&&this.sizes?.full.height||(this.cancelTo("loader"),this.updateLocalState({isLoaded:!0,loaderIsShowing:!1}),this.dispatchEvent(new Event("load")),this.classList.add("is-loaded"))}L(){this.localState.imageSrc===this.mediaUrl||this.localState.didError||(this.updateLocalState({didError:!0}),this.updateLocalState({imageSrc:this.mediaUrl}))}M(e,t){if(this.sizes)return this.sizes?Object.values(this.sizes).reduce((function(o,s){return Math.abs(s.width/2-e)<Math.abs(o.width/2-e)||Math.abs(s.height/2-t)<Math.abs(o.height/2-t)?s:o})):null}preload(){this.localState.isLoaded||(this.localState.imageSrc&&this.localState.sizeObj&&this.u.src!==this.localState.imageSrc?this.u.src=this.localState.imageSrc:this.updateLocalState({shouldPreload:!0}))}static register(e="behold-image"){return customElements.get(e)||customElements.define(e,u),e}}class g extends m{label="ImagePost";u;constructor(){super(),u.register(),this.onPropChange(this._,["post","widgetSettings","aspectRatio"],null,this.R)}_({changedProp:e,oldValue:t,newValue:s}){switch(e){case"widgetSettings":o(s,t,["onHover","onPostClick"])&&this.R();break;case"post":case"aspectRatio":this.R()}}R(){const{sizes:e,mediaUrl:t}=this.post;this.u=i({type:"behold-image",props:{sizes:e,mediaUrl:t,aspectRatio:this.aspectRatio.reduce(((e,t)=>e/t))}}),this.renderPost(this.u)}static register(e="behold-image-post"){return customElements.get(e)||customElements.define(e,g),e}}class y extends e{label="Video";mediaUrl;sizes;autoplay;aspectRatio;B;$;V;u;constructor(){super(),this.B=this.autoplay||!1,this.$=!1,this.C=this.C.bind(this),this.j=this.j.bind(this),this.I=this.I.bind(this),this.U=this.U.bind(this),this.O=this.O.bind(this),this.preload=this.preload.bind(this),document.addEventListener("visibilitychange",this.I),this.onLoop((async()=>{if(this.V&&this.isLoaded){if(!this.$&&this.B&&!this.T)try{this.$=!0,await this.V.play(),this.$=!1}catch(e){this.$=!1}!this.B&&this.T&&(this.V.pause(),this.$=!1)}}),15),this.onPropChange((({changedProp:e,newValue:t})=>{this.localState.shouldPreload&&this.mediaUrl&&l("video",this.mediaUrl),"autoplay"===e&&(t?this.play():this.pause())}),["mediaUrl","sizes","autoplay","aspectRatio"],["mediaUrl","sizes"]),this.onLocalStateChange((()=>{}),{isMuted:!0,isLoaded:!1,shouldPreload:!1}),this.onConnect((()=>{this.onIntersection(this,this.C),this.render()})),this.onDisconnect((()=>{document.removeEventListener("visibilitychange",this.I),this.V&&(this.V.removeEventListener("play",this.U),this.V.removeEventListener("pause",this.O),this.V.removeEventListener("loadeddata",this.j))}))}get isPlaying(){return this.B||!1}get T(){return!!(this.V.currentTime>0&&!this.V.paused&&!this.V.ended&&this.V.readyState>2)}get paused(){return this.V?.paused}get muted(){return this.V?.muted}get isLoaded(){return this.localState.isLoaded}render(){this.V=i({type:"video",attributes:{loop:!0,playsinline:!0,crossorigin:"anonymous",tabIndex:-1,disablePictureInPicture:!0,disableremoteplayback:!0,height:this.sizes?.full.height||100,width:this.sizes?.full.width||100},props:{muted:this.localState.isMuted,autoplay:this.autoplay||!1},listeners:{play:this.U,pause:this.O}}),this.u=i({type:"img",attributes:{height:this.sizes.full.height,width:this.sizes.full.width,src:r(this.sizes.full.width,this.sizes.full.height)}}),this.beholdReplaceChildren(this.u)}C(e){e.isIntersecting&&this.V?this.V.src!==this.mediaUrl&&(this.V.addEventListener("loadeddata",this.j,{once:!0}),this.V.src=this.mediaUrl,this.V.load()):this.autoplay||this.pause()}j(){this.updateLocalState({isLoaded:!0}),this.autoplay||(this.V.currentTime=.25,this.V.pause()),this.dispatchEvent(new Event("load")),this.beholdReplaceChildren(this.V),h(),this.raf((()=>{this.classList.add("is-loaded")}),"_handleVideoLoad")}U(){this.dispatchEvent(new Event("play"))}O(){this.dispatchEvent(new Event("pause"))}play(){this.B=!0}pause(){this.B=!1}mute(){this.updateLocalState({isMuted:!0}),this.V&&(this.V.muted=!0)}unmute(){this.updateLocalState({isMuted:!1}),this.V&&(this.V.muted=!1)}I(){document.hidden&&(this.pause(),this.V&&this.V.pause()),!document.hidden&&this.autoplay&&this.play()}preload(){!this.localState.isLoaded&&this.mediaUrl?l("video",this.mediaUrl):this.updateLocalState({shouldPreload:!0})}static register(e="behold-video"){return customElements.get(e)||customElements.define(e,y),e}}class w extends m{label="VideoPost";V;u;constructor(){super(),this.onPropChange(this._,["post","widgetSettings","aspectRatio"],null,this.R),y.register(),u.register(),this.H=this.H.bind(this),this.A=this.A.bind(this),this.onDisconnect((()=>{this.removeEventListener("mouseover",this.H),this.removeEventListener("mouseleave",this.A)}))}_({changedProp:e,oldValue:t,newValue:s}){switch(e){case"widgetSettings":o(t,s,["onHover","onPostClick","previewVideosOnHover"])&&this.R(),o(t,s,["autoplayVideos"])&&(this.widgetSettings.previewVideosOnHover?this.V.autoplay=s.autoplayVideos:this.R());break;case"post":case"aspectRatio":this.R()}}H(){this.V?.play()}A(){this.widgetSettings.autoplayVideos||this.V?.pause()}R(){const{sizes:e,mediaUrl:t,thumbnailUrl:o}=this.post;(this.widgetSettings.previewVideosOnHover||this.widgetSettings.autoplayVideos)&&t||!e.full.mediaUrl&&!o&&t?(this.V=i({type:"behold-video",props:{mediaUrl:t,sizes:e,autoplay:this.widgetSettings.autoplayVideos,aspectRatio:this.aspectRatio.reduce(((e,t)=>e/t))},listeners:{mouseover:this.H,mouseleave:this.A}}),this.renderPost(this.V)):(this.u=i({type:"behold-image",props:{sizes:e,mediaUrl:o,aspectRatio:this.aspectRatio.reduce(((e,t)=>e/t))}}),this.renderPost(this.u))}static register(e="behold-video-post"){return customElements.get(e)||customElements.define(e,w),e}}class k extends m{label="AlbumPost";Y;constructor(){super(),u.register(),y.register(),this.onPropChange(this._,["post","widgetSettings"],null,this.R)}_({changedProp:e,oldValue:t,newValue:s}){switch(e){case"widgetSettings":o(s,t,["onHover","onPostClick"])&&this.R();break;case"post":case"aspectRatio":this.R()}}R(){let{sizes:e,mediaUrl:t,children:o}=this.post;if(!e.full.mediaUrl&&!t){const s=o.reduce(((e,t)=>"VIDEO"===t.mediaType?t.sizes.full.mediaUrl||t.thumbnailUrl?t:e:t.sizes.full.mediaUrl||t.mediaUrl?t:e));e=s.sizes,t=s.thumbnailUrl??s.mediaUrl}this.post.mediaUrlIsVideo?this.Y=i({type:"behold-video",props:{sizes:e,mediaUrl:t,aspectRatio:this.aspectRatio.reduce(((e,t)=>e/t))}}):this.Y=i({type:"behold-image",props:{sizes:e,mediaUrl:t,aspectRatio:this.aspectRatio.reduce(((e,t)=>e/t))}}),this.renderPost(this.Y)}static register(e="behold-album-post"){return customElements.get(e)||customElements.define(e,k),e}}var z=":host{--post-border-radius:0;--post-aspect-ratio:1;--icon-instagram: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='M17.6 3.2c4.7 0 5.2 0 7.1.1 1.7.1 2.6.4 3.2.6.8.3 1.4.7 2 1.3.6.6 1 1.2 1.3 2 .2.6.5 1.5.6 3.3.1 1.8.1 2.4.1 7.1s0 5.2-.1 7.1c-.1 1.7-.4 2.6-.6 3.2-.6 1.5-1.8 2.7-3.3 3.3-.6.2-1.5.5-3.2.6-1.8.1-2.4.1-7.1.1s-5.2 0-7.1-.1c-1.7-.1-2.6-.4-3.2-.6-.8-.3-1.4-.7-2-1.3-.6-.6-1-1.2-1.3-2-.2-.6-.5-1.5-.6-3.2-.1-1.8-.1-2.4-.1-7.1s0-5.2.1-7.1c0-1.8.3-2.7.6-3.3.3-.8.7-1.4 1.3-2 .6-.6 1.2-1 2-1.3.6-.2 1.5-.5 3.2-.6 1.9-.1 2.4-.1 7.1-.1m0-3.2c-4.8 0-5.3 0-7.2.1-1.9.1-3.2.4-4.3.8C5 1.4 3.9 2 3 2.9c-.9.9-1.5 2-2 3.1C.6 7.1.3 8.4.2 10.2c-.1 1.9-.1 2.5-.1 7.2s0 5.3.1 7.2c.1 2 .4 3.2.8 4.4.4 1.2 1.1 2.2 2 3.1.9.9 1.9 1.6 3.1 2 1.1.4 2.4.7 4.2.8s2.5.1 7.2.1 5.3 0 7.2-.1c1.9-.1 3.1-.4 4.2-.8 2.3-.9 4.2-2.8 5.1-5.1.4-1.1.7-2.4.8-4.2.1-1.9.1-2.5.1-7.2s0-5.3-.1-7.2c-.1-1.9-.4-3.1-.8-4.2-.4-1.2-1.1-2.2-2-3.1-.9-.9-1.9-1.6-3.1-2-1.1-.4-2.4-.7-4.2-.8-1.8-.3-2.4-.3-7.1-.3z'/%3E%3Cpath fill='%23FFF' d='M17.6 8.5c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 14.8c-3.2 0-5.8-2.6-5.8-5.8s2.6-5.8 5.8-5.8 5.8 2.6 5.8 5.8-2.6 5.8-5.8 5.8z'/%3E%3Ccircle fill='%23FFF' cx='26.9' cy='8.2' r='2.1'/%3E%3C/svg%3E\");--icon-video: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='M30.1 15.5 7.2 2.3c-1.5-.9-3.5.2-3.5 1.9v26.5c0 1.7 1.9 2.9 3.4 1.9L30 19.4c1.7-.8 1.7-3 .1-3.9z'/%3E%3C/svg%3E\");--icon-album: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\");align-items:center;border:none;box-shadow:none;box-sizing:border-box;display:flex;flex-wrap:wrap;justify-content:center;margin:0;min-width:50px;outline:none;position:relative;width:100%}:host *{box-sizing:border-box}:host(.keyboard-nav.has-focus){outline:none}:host(.keyboard-nav.has-focus):before{background-color:rgba(0,0,0,.25);border-radius:6px;content:\"\";display:block;height:100%;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:100%;z-index:1}:host(.keyboard-nav.has-focus):after{background-color:#222;border-radius:6px;box-shadow:0 0 0 2px #4169e1,0 0 0 3px #fff,0 .6px .4px rgba(0,0,0,.042),0 1.3px 1px rgba(0,0,0,.061),0 2.5px 1.9px rgba(0,0,0,.075),0 4.5px 3.4px rgba(0,0,0,.089),0 8.4px 6.3px rgba(0,0,0,.108),0 20px 15px rgba(0,0,0,.15);color:#fff;content:\"Shift + arrow keys to navigate posts\";font-family:sans-serif;font-size:16px;max-width:80%;padding:15px;position:absolute;text-align:center;z-index:1}@media (max-width:1300px){:host(.keyboard-nav.has-focus):after{font-size:15px}}:host(.keyboard-nav.has-focus) .posts{opacity:.65}.posts{display:grid;margin:0;max-width:100%;padding:0;width:100%}.post{-webkit-font-smoothing:inherit;-moz-osx-font-smoothing:inherit;align-self:stretch;border:none;border-radius:var(--post-border-radius) /calc(var(--post-border-radius)*var(--post-aspect-ratio));color:inherit;font:inherit;isolation:isolate;line-height:normal;margin:0 0 -1px;overflow:hidden;transform:translateZ(0);transition:background .3s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:calc(100% + .5px)}:host(.keyboard-nav) .post.post:focus-within{box-shadow:0 0 0 1px #fff,0 0 0 3px #4169e1,0 0 0 4px #fff;z-index:1}:host(.is-previewing-loading-colors) .post *{opacity:0}.post.post--has-row-gap,.post.post--last-row{margin:0}.post:before{background-color:transparent;border-radius:var(--post-border-radius) /calc(var(--post-border-radius)*var(--post-aspect-ratio));content:\"\";height:100%;left:0;pointer-events:none;position:absolute;top:0;transition:all 2s cubic-bezier(.215,.61,.355,1);width:100%;z-index:2}@supports ((-webkit-backdrop-filter:blur(3px)) or (backdrop-filter:blur(3px))){[data-hover-effect*=blur i] .post:before{height:calc(100% - 1px);left:0;opacity:0;top:0;transition:all .6s cubic-bezier(.215,.61,.355,1);width:100%}}.post.post--hover-icon:after{background-image:var(--icon);background-position:50%;background-repeat:no-repeat;background-size:auto 100%;border-radius:var(--post-border-radius) /calc(var(--post-border-radius)*var(--post-aspect-ratio));content:\"\";height:12%;height:calc(min(var(--post-width), var(--post-height))*.12);left:0;max-height:30px;min-height:20px;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translateY(-50%) scale(.75);transition:all .6s cubic-bezier(.215,.61,.355,1);width:100%;will-change:transform;z-index:3}@media (prefers-reduced-motion){.post.post--hover-icon:after{transition:none}}.post behold-album,.post behold-image,.post behold-video{height:100%;width:100%}.post>a,.post>button,.post>div{background-color:transparent;border:0;box-shadow:none;color:inherit;display:block;font:inherit;height:100%;line-height:inherit;outline:none;padding:0;transition:opacity .3s ease;width:100%}.post a,.post button{cursor:pointer}behold-image-post{--icon:var(--icon-instagram)}behold-video-post{--icon:var(--icon-video)}behold-album-post{--icon:var(--icon-album)}.post-caption{align-items:center;background-color:var(--overlay-color);display:flex;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;font-size:15px;height:100%;justify-content:center;left:0;line-height:1.5;opacity:0;padding:15%;pointer-events:none;position:absolute;top:0;transition:opacity .4s ease;width:100%;z-index:2}.post:hover .post-caption,:host(:host(.keyboard-nav)) .post:focus-within .post-caption{opacity:1}.post--xlarge .post-caption{--lines:12;--innerScale:scale(0.98);padding:20%}.post--large .post-caption{--lines:9;--innerScale:scale(0.98)}.post--medium .post-caption{--lines:6;--innerScale:scale(0.97);font-size:14px}.post--small .post-caption{--lines:4;--innerScale:scale(0.95);font-size:13px;line-height:1.25}.post--xsmall .post-caption{--lines:3;--innerScale:scale(0.95);font-size:12px;line-height:1.25}.post-caption__inner{-webkit-line-clamp:var(--lines);-webkit-box-orient:vertical;color:#fff;display:-webkit-box;opacity:0;overflow:hidden;text-align:center;transform:var(--innerScale);transition:all .3s ease;white-space:pre-line;will-change:transform,opacity;word-break:none}@media (prefers-reduced-motion){.post-caption__inner{transform:none}}.post:hover .post-caption__inner,:host(.keyboard-nav) .post:focus-within .post-caption__inner{opacity:1;transform:none;transition:all .3s ease}:host(.keyboard-nav) .post:focus-within:before{background-color:var(--overlay-color);transition:all .6s cubic-bezier(.215,.61,.355,1)}:host(.keyboard-nav) .post:focus-within:after{opacity:1;transform:translateY(-50%)}:host(.keyboard-nav) [data-hover-effect=fade] .post:focus-within:before,[data-hover-effect=fade] .post:hover:before{background-color:var(--overlay-color);transition:all .6s cubic-bezier(.215,.61,.355,1)}:host(.keyboard-nav) [data-hover-effect=fade] .post:focus-within:after,[data-hover-effect=fade] .post:hover:after{opacity:1;transform:translateY(-50%)}:host(.keyboard-nav) [data-hover-effect=zoomFade] .post:focus-within behold-image img,:host(.keyboard-nav) [data-hover-effect=zoomFade] .post:focus-within behold-video video,[data-hover-effect=zoomFade] .post:hover behold-image img,[data-hover-effect=zoomFade] .post:hover behold-video video{transform:scale(1.05)}@media (prefers-reduced-motion){:host(.keyboard-nav) [data-hover-effect=zoomFade] .post:focus-within behold-image img,:host(.keyboard-nav) [data-hover-effect=zoomFade] .post:focus-within behold-video video,[data-hover-effect=zoomFade] .post:hover behold-image img,[data-hover-effect=zoomFade] .post:hover behold-video video{transform:none}}:host(.keyboard-nav) [data-hover-effect=zoomFade] .post:focus-within:before,[data-hover-effect=zoomFade] .post:hover:before{background-color:var(--overlay-color);transition:all .6s cubic-bezier(.215,.61,.355,1)}:host(.keyboard-nav) [data-hover-effect=zoomFade] .post:focus-within:after,[data-hover-effect=zoomFade] .post:hover:after{opacity:1;transform:translateY(-50%)}@supports not ((-webkit-backdrop-filter:blur(3px)) or (backdrop-filter:blur(3px))){:host(.keyboard-nav) [data-hover-effect=blur] .post:focus-within behold-image,:host(.keyboard-nav) [data-hover-effect=blur] .post:focus-within behold-video,[data-hover-effect=blur] .post:hover behold-image,[data-hover-effect=blur] .post:hover behold-video{filter:brightness(97%) blur(3px);transition:all .6s cubic-bezier(.215,.61,.355,1)}}@supports ((-webkit-backdrop-filter:blur(3px)) or (backdrop-filter:blur(3px))){:host(.keyboard-nav) [data-hover-effect=blur] .post:focus-within:before,[data-hover-effect=blur] .post:hover:before{-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);background-color:rgba(0,0,0,.002);opacity:1}}:host(.keyboard-nav) [data-hover-effect=blur] .post:focus-within:after,[data-hover-effect=blur] .post:hover:after{opacity:1;transform:translateY(-50%)}:host(.keyboard-nav) [data-hover-effect=zoomBlur] .post:focus-within behold-image,:host(.keyboard-nav) [data-hover-effect=zoomBlur] .post:focus-within behold-video,[data-hover-effect=zoomBlur] .post:hover behold-image,[data-hover-effect=zoomBlur] .post:hover behold-video{transform:scale(1.05);transition:all .6s cubic-bezier(.215,.61,.355,1)}@media (prefers-reduced-motion){:host(.keyboard-nav) [data-hover-effect=zoomBlur] .post:focus-within behold-image,:host(.keyboard-nav) [data-hover-effect=zoomBlur] .post:focus-within behold-video,[data-hover-effect=zoomBlur] .post:hover behold-image,[data-hover-effect=zoomBlur] .post:hover behold-video{transform:none}}@supports not ((-webkit-backdrop-filter:blur(3px)) or (backdrop-filter:blur(3px))){:host(.keyboard-nav) [data-hover-effect=zoomBlur] .post:focus-within behold-image,:host(.keyboard-nav) [data-hover-effect=zoomBlur] .post:focus-within behold-video,[data-hover-effect=zoomBlur] .post:hover behold-image,[data-hover-effect=zoomBlur] .post:hover behold-video{filter:brightness(97%) blur(3px)}}@supports ((-webkit-backdrop-filter:blur(3px)) or (backdrop-filter:blur(3px))){:host(.keyboard-nav) [data-hover-effect=zoomBlur] .post:focus-within:before,[data-hover-effect=zoomBlur] .post:hover:before{-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);background-color:rgba(0,0,0,.002);opacity:1}}:host(.keyboard-nav) [data-hover-effect=zoomBlur] .post:focus-within:after,[data-hover-effect=zoomBlur] .post:hover:after{opacity:1;transform:translateY(-50%)}:host(.keyboard-nav) [data-hover-effect=toGreyscale] .post:focus-within behold-image,:host(.keyboard-nav) [data-hover-effect=toGreyscale] .post:focus-within behold-video,[data-hover-effect=toGreyscale] .post:hover behold-image,[data-hover-effect=toGreyscale] .post:hover behold-video{filter:grayscale(100%);transition:all .6s cubic-bezier(.215,.61,.355,1)}:host(.keyboard-nav) [data-hover-effect=toGreyscale] .post:focus-within:after,[data-hover-effect=toGreyscale] .post:hover:after{opacity:1;transform:translateY(-50%)}:host(.keyboard-nav) [data-hover-effect=zoomToGreyscale] .post:focus-within behold-image,:host(.keyboard-nav) [data-hover-effect=zoomToGreyscale] .post:focus-within behold-video,[data-hover-effect=zoomToGreyscale] .post:hover behold-image,[data-hover-effect=zoomToGreyscale] .post:hover behold-video{filter:grayscale(100%);transform:scale(1.05);transition:all .6s cubic-bezier(.215,.61,.355,1)}@media (prefers-reduced-motion){:host(.keyboard-nav) [data-hover-effect=zoomToGreyscale] .post:focus-within behold-image,:host(.keyboard-nav) [data-hover-effect=zoomToGreyscale] .post:focus-within behold-video,[data-hover-effect=zoomToGreyscale] .post:hover behold-image,[data-hover-effect=zoomToGreyscale] .post:hover behold-video{transform:none}}:host(.keyboard-nav) [data-hover-effect=zoomToGreyscale] .post:focus-within:after,[data-hover-effect=zoomToGreyscale] .post:hover:after{opacity:1;transform:translateY(-50%)}:host(.keyboard-nav) [data-hover-effect=fromGreyscale] .post,[data-hover-effect=fromGreyscale] .post{filter:grayscale(100%)}:host(.keyboard-nav) [data-hover-effect=fromGreyscale] .post:focus,:host(.keyboard-nav) [data-hover-effect=fromGreyscale] .post:hover,[data-hover-effect=fromGreyscale] .post:focus,[data-hover-effect=fromGreyscale] .post:hover{filter:grayscale(0);transition:all .6s cubic-bezier(.215,.61,.355,1)}:host(.keyboard-nav) [data-hover-effect=fromGreyscale] .post:focus.post--hover-caption:before,:host(.keyboard-nav) [data-hover-effect=fromGreyscale] .post:hover.post--hover-caption:before,[data-hover-effect=fromGreyscale] .post:focus.post--hover-caption:before,[data-hover-effect=fromGreyscale] .post:hover.post--hover-caption:before{background-color:var(--overlay-color);transition:all .6s cubic-bezier(.215,.61,.355,1)}:host(.keyboard-nav) [data-hover-effect=fromGreyscale] .post:focus:after,:host(.keyboard-nav) [data-hover-effect=fromGreyscale] .post:hover:after,[data-hover-effect=fromGreyscale] .post:focus:after,[data-hover-effect=fromGreyscale] .post:hover:after{opacity:1;transform:translateY(-50%)}:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post,[data-hover-effect=zoomFromGreyscale] .post{filter:grayscale(100%)}:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:focus,:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:hover,[data-hover-effect=zoomFromGreyscale] .post:focus,[data-hover-effect=zoomFromGreyscale] .post:hover{filter:grayscale(0)}:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:focus behold-image,:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:focus behold-video,:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:hover behold-image,:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:hover behold-video,[data-hover-effect=zoomFromGreyscale] .post:focus behold-image,[data-hover-effect=zoomFromGreyscale] .post:focus behold-video,[data-hover-effect=zoomFromGreyscale] .post:hover behold-image,[data-hover-effect=zoomFromGreyscale] .post:hover behold-video{transform:scale(1.05);transition:all .6s cubic-bezier(.215,.61,.355,1)}@media (prefers-reduced-motion){:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:focus behold-image,:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:focus behold-video,:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:hover behold-image,:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:hover behold-video,[data-hover-effect=zoomFromGreyscale] .post:focus behold-image,[data-hover-effect=zoomFromGreyscale] .post:focus behold-video,[data-hover-effect=zoomFromGreyscale] .post:hover behold-image,[data-hover-effect=zoomFromGreyscale] .post:hover behold-video{transform:none}}:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:focus.post--hover-caption:before,:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:hover.post--hover-caption:before,[data-hover-effect=zoomFromGreyscale] .post:focus.post--hover-caption:before,[data-hover-effect=zoomFromGreyscale] .post:hover.post--hover-caption:before{background-color:var(--overlay-color);transition:all .6s cubic-bezier(.215,.61,.355,1)}:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:focus:after,:host(.keyboard-nav) [data-hover-effect=zoomFromGreyscale] .post:hover:after,[data-hover-effect=zoomFromGreyscale] .post:focus:after,[data-hover-effect=zoomFromGreyscale] .post:hover:after{opacity:1;transform:translateY(-50%)}behold-image{display:block;height:0;overflow:hidden;padding:0;padding-bottom:calc(100%/var(--post-aspect-ratio));position:relative;transition:all .6s cubic-bezier(.215,.61,.355,1);width:100%}behold-image img{border-radius:0;height:100%;left:0;-o-object-fit:cover;object-fit:cover;-o-object-position:center center;object-position:center center;opacity:0;pointer-events:none;position:absolute;top:0;transition:all .6s cubic-bezier(.215,.61,.355,1),opacity .6s ease;vertical-align:middle;width:100%;will-change:transform;z-index:1}@supports not ((-webkit-backdrop-filter:blur(3px)) or (backdrop-filter:blur(3px))){[data-hover-effect=blur] behold-image img,[data-hover-effect=zoomBlur] behold-image img{height:calc(100% + 6px);left:-3px;top:-3px;width:calc(100% + 6px)}}.post--reel behold-image img{-o-object-position:center 25%;object-position:center 25%}behold-image.is-loaded img{opacity:1}behold-video{display:block;height:0;overflow:hidden;padding:0;padding-bottom:calc(100%/var(--post-aspect-ratio));position:relative;transition:all .6s cubic-bezier(.215,.61,.355,1);width:100%}behold-video video{height:100%;left:0;-o-object-fit:cover;object-fit:cover;-o-object-position:center center;object-position:center center;opacity:0;pointer-events:none;position:absolute;top:0;transition:all .6s cubic-bezier(.215,.61,.355,1),opacity .6s ease;vertical-align:middle;width:100%;will-change:transform}.post--reel behold-video video{-o-object-position:center 25%;object-position:center 25%}behold-video.is-loaded video{opacity:1}";export{k as A,b as B,g as I,c as R,w as V,y as a,z as b,u as c,d as g};
@@ -1 +1 @@
1
- function t(t){return JSON.parse(JSON.stringify(t,((t,e)=>void 0===e?null:e)))}function e(){return document.body.offsetTop}async function s(t,e){const s=document.createElement(t);return new Promise(((n,i)=>{switch(t){case"img":s.addEventListener("load",(()=>{n(e)}));break;case"video":s.addEventListener("loadeddata",(()=>n(e)))}s.addEventListener("error",(t=>{i(t)})),s.src=e}))}function n({text:t,maxLines:e=2,maxChars:s=50}){if(!t)return;const n=t.match(/.*/g).filter((t=>t.length>0)).slice(0,e).join("").length,i=Math.min(n,s);return t.slice(0,i)}function i(t,e){return`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' width='${t}' height='${e}'%3E%3C/svg%3E%0A`}function o(t){return new Promise((e=>{let s=new IntersectionObserver((t=>{let n=t.reduce(((t,e,s)=>e.intersectionRatio>t.intersectionRatio?{index:s,intersectionRatio:e.intersectionRatio}:t),{intersectionRatio:0,index:null});s.disconnect(),s=null,e(n.index)}));t.forEach((t=>s.observe(t)))}))}function r(t,e){let s=!1,n=new IntersectionObserver((t=>{s||(n.disconnect(),n=null,e(t[0].boundingClientRect))}));return n.observe(t),function(){s||(s=!0,n&&(n.disconnect(),n=null))}}function a(t){return t.isConnected?"#document"===t.nodeName||t instanceof ShadowRoot?t:a(t.parentNode):document}function l(t,e,s=null,n=!1){let i=n?performance.now():0,o=null;return(...n)=>{let r=performance.now();clearTimeout(o),o=setTimeout((()=>t.apply(s,n)),e),r-i>e&&(clearTimeout(o),i=r,t.apply(s,n))}}function c(t,e){Object.entries(e).forEach((([e,s])=>{s?t.classList.add(e):t.classList.remove(e)}))}function h(t,e){Object.keys(e).forEach((s=>{t.style.setProperty(s,e[s])}))}function d(t,e,s,n=0){if("string"==typeof s&&(s=[s]),n>0){let n=!1;return Object.keys(t).length!==Object.keys(e).length||(Object.keys(t).forEach((i=>{d(t[i],e[i],s)&&(n=!0)})),n)}return s.reduce(((s,n)=>!u(t?.[n],e?.[n])||s),!1)}function u(t,e,s=!1,n=!1){if(n&&(Array.isArray(t)&&(t=t.sort()),Array.isArray(e)&&(e=e.sort())),s&&("number"==typeof t&&(t=t.toString()),"number"==typeof e&&(e=e.toString())),typeof t!=typeof e)return!1;if(null===t&&null===e)return!0;if(null===t&&null!==e)return!1;if(null!==t&&null===e)return!1;if(void 0===t&&void 0===e)return!0;if(void 0===t&&void 0!==e)return!1;if(void 0!==t&&void 0===e)return!1;if("object"==typeof t)return Object.keys(t).length===Object.keys(e).length&&Object.entries(t).reduce(((t,[i,o])=>!!u(o,e[i],s,n)&&t),!0);if(Array.isArray(t)){let i=!0;return t.forEach(((t,o)=>{u(t,e[o],s,n)||(i=!1)})),i}return t===e}function p(t,e="assertive"){const s=document.createElement("div");s.innerHTML=t,s.setAttribute("aria-live",e),s.setAttribute("aria-atomic","true"),s.style.cssText="\n position: absolute;\n position: absolute !important;\n width: 1px !important;\n height: 1px !important;\n padding: 0 !important;\n margin: -1px !important;\n overflow: hidden !important;\n clip: rect(0,0,0,0) !important;\n white-space: nowrap !important;\n border: 0 !important;\n ",requestAnimationFrame((()=>{document.body.appendChild(s),setTimeout((()=>{s.remove()}),500)}))}function w(t,e,s){t.length===s&&t.shift(),t.push(e)}let m={isMuted:!0,keyboardNavEnabled:!1,popoverOverlayHslArray:[0,0,0],popoverOverlayOpacity:.6},b=!1,f=null,g=null;const v=new Map,y=new Map,O=new Map,j=new Set;!function t(){O.forEach((t=>{const e=performance.now(),{minWait:s,lastInvocation:n,callback:i}=t,o=e-n;o>s&&(i(o),O.set(i,{...t,lastInvocation:e}))})),requestAnimationFrame(t)}();class S extends HTMLElement{label="BaseElement";storedProperties=new Map;requiredProperties=[];hasRequiredProps=!1;propChangeHandlers=new Map;delayedPropChangeHandlers=new Map;queuedPropUpdates=new Set;localState=Object.freeze({});localStateChangeHandlers=new Set;connectHandlers=new Set;disconnectHandlers=new Set;rafs=new Map;timeouts=new Map;constructor(){if(super(),this.t=this.t.bind(this),this.i=this.i.bind(this),this.o=this.o.bind(this),!f){let t=window.ResizeObserver;"ResizeObserver"in window==0&&(t=window.BeholdResizeObserver),f=new t((t=>{t.forEach((t=>{const e=v.get(t.target);e&&e(t)}))}))}g||(g=new IntersectionObserver((t=>{t.forEach((t=>{const e=y.get(t.target);e&&e(t)}))}))),b||(b=!0,document.addEventListener("keydown",this.t),document.addEventListener("mousedown",this.i),document.addEventListener("mousemove",this.o,{passive:!0}))}connectedCallback(){this.connectHandlers.forEach((t=>t()))}disconnectedCallback(){this.rafs.forEach((t=>cancelAnimationFrame(t))),this.rafs.clear(),this.timeouts.forEach((t=>clearTimeout(t))),this.timeouts.clear(),this.disconnectHandlers.forEach((t=>t()))}onConnect(t){this.connectHandlers.add(t)}onDisconnect(t){this.disconnectHandlers.add(t)}onResize(t,e,s){v.set(e,s.bind(t)),f.observe(e),this.disconnectHandlers.add((()=>{v.delete(e),f.unobserve(e)}))}onIntersection(t,e){y.set(t,e),g.observe(t),this.disconnectHandlers.add((()=>{y.delete(t),g.unobserve(t)}))}onLoop(t,e=50){O.set(t,{minWait:e,lastInvocation:0,callback:t}),this.disconnectHandlers.add((()=>{O.delete(t)}))}onPropChange(e,s,n=null,i=null){n?this.requiredProperties.push(...n):this.requiredProperties.push(...s),s.forEach((s=>{void 0!==this[s]&&this.storedProperties.set(s,this[s]),this.propChangeHandlers.get(s)||(this.propChangeHandlers.set(s,[]),this.delayedPropChangeHandlers.set(s,[])),i?this.delayedPropChangeHandlers.get(s).push(e):this.propChangeHandlers.get(s).push(e),Object.defineProperty(this,s,{set(e){void 0===e&&(e=null,console.warn(`Attempted to set value of ${s} as "undefined" on ${this.label}. ${s} was coerced to null instead.`)),e=t(e);const n=this.storedProperties.has(s)?t(this.storedProperties.get(s)):null;this.storedProperties.set(s,e),this.hasRequiredProps=this.requiredProperties.every((t=>this.storedProperties.has(t))),this.queueHandlers({prop:s,oldValue:n,newValue:e})},get(){return this.storedProperties.get(s)}})})),i&&(i=i.bind(this),queueMicrotask((()=>{this.hasRequiredProps&&(i(),this.delayedPropChangeHandlers.forEach(((t,e)=>{this.propChangeHandlers.set(e,[...this.propChangeHandlers.get(e),...t])})))}))),this.queueMissingPropsCheck()}queueHandlers({prop:t,oldValue:e,newValue:s}){this.hasRequiredProps?(this.queuedPropUpdates.size&&(this.queuedPropUpdates.delete(t),this.runQueuedPropHandlers()),this.propChangeHandlers.get(t).forEach((n=>{n.call(this,{changedProp:t,oldValue:e,newValue:s})}))):this.queuedPropUpdates.add(t)}runQueuedPropHandlers(){this.queuedPropUpdates.forEach((t=>{this.propChangeHandlers.get(t).forEach((e=>{e.call(this,{changedProp:t,oldValue:null,newValue:this[t]})}))})),this.queuedPropUpdates.clear()}updateLocalState(e){const s=Object.freeze(t(this.localState));this.localState=Object.freeze({...this.localState,...e}),this.localStateChangeHandlers.forEach((t=>t({changedProps:Object.keys(e),oldState:s,newState:this.localState})))}onLocalStateChange(t,e){this.localState={...this.localState,...e};const s=t.bind(this);this.localStateChangeHandlers.add(s)}updateGlobalState(e){const s=t(m);m={...m,...e},j.forEach((t=>t({changedProps:Object.keys(e),oldState:s,newState:m})))}onGlobalStateChange(t){this.connectHandlers.add((()=>{const e=t.bind(this);j.add(e),this.disconnectHandlers.add((()=>j.delete(e)))}))}t(t){"Tab"===t.key&&this.updateGlobalState({keyboardNavEnabled:!0})}i(t){0===t.clientX&&0===t.clientY||this.updateGlobalState({keyboardNavEnabled:!1})}o(t){t.ctrlKey||t.altKey||t.shiftKey||t.metaKey||0===t.movementX||0===t.movementY||this.updateGlobalState({keyboardNavEnabled:!1})}get globalState(){return m}set globalState(t){throw new Error("Shared state cannot be set directly. Use this.updateGlobalState() instead.")}raf(t,e,s=!0){s&&cancelAnimationFrame(this.rafs.get(e));const n=requestAnimationFrame((()=>{t(),this.rafs.delete(e)}));return this.rafs.set(e,n),n}cancelRaf(t){cancelAnimationFrame(this.rafs.get(t)),this.rafs.delete(t)}to(t,e,s){const n=setTimeout((()=>{t(),this.timeouts.delete(s)}),e);return this.timeouts.set(s,n),n}cancelTo(t){clearTimeout(this.timeouts.get(t)),this.timeouts.delete(t)}queueMissingPropsCheck(){queueMicrotask((()=>{if(this.requiredProperties.length&&!this.hasRequiredProps){const t=this.requiredProperties.filter((t=>!this.storedProperties.has(t)));console.error(`${this.label||this.tagName} is missing required props: ${t.join(", ")}`)}}))}}function x(t){let{type:e="div",classes:s=[],contents:n=[],attributes:i={},props:o={},style:r={},listeners:a={}}=t;s=Array.isArray(s)?s:[s];const l=document.createElement(e);return Array.isArray(n)||(n=[n]),n=n.filter((t=>null!=t)).map((t=>{if("string"==typeof t&&t.includes("</svg>")){const e=document.createElement("template");return e.innerHTML=t,e.content}return t})),l.beholdReplaceChildren(...n),s.length&&(l.className=s.join(" ")),Object.keys(i).forEach((t=>{l.setAttribute(t,i[t])})),Object.assign(l,o),Object.keys(r).forEach((t=>{"--"===t.substring(0,2)?l.style.setProperty(t,r[t]):l.style[t]=r[t]})),Object.keys(a).forEach((t=>{l.addEventListener(t,a[t])})),l}class C extends S{label="BeholdWidget";shadow;abortController;loadedWidget;static get observedAttributes(){return["feed-id"]}constructor(){super(),this.shadow=this.attachShadow({mode:"open"}),this.abortController=null,this.onPropChange(this.l,["widgetSettings","feedMetadata","posts","previewLoadingColors","errorMessage"],[])}attributeChangedCallback(t,e,s){"feed-id"===t&&s!==e&&this.getFeed(s)}l({changedProp:t,oldValue:e,newValue:s}){"errorMessage"!==t||e||!s?"widgetSettings"===t&&d(s,e,"type")&&s?.type?this.loadWidget(s.type):this.loadedWidget&&!u(s,e)&&(this.loadedWidget[t]=s):this.loadWidget("ErrorMessage")}async loadWidget(t){if(await import("./replaceChildren-4H1qCpyP.js"),"ResizeObserver"in window==0){const{ResizeObserver:t}=await import("./resizeObserver--rsjm-GV.js");window.BeholdResizeObserver=t}const e=(await this.importWidget(t.replace(/.?/,(t=>t.toUpperCase())))).register(),s=x({type:e}),n=x({type:"style",contents:":host{align-items:center;box-sizing:border-box;display:flex;flex-wrap:wrap;justify-content:center;margin:0;min-width:50px;overflow:hidden;position:relative;width:100%}:host *{box-sizing:border-box}:host([hidden]){display:none}".toString()});this.shadow.beholdReplaceChildren(s,n),this.loadedWidget=this.shadow.querySelector(e),this.widgetSettings&&(this.loadedWidget.widgetSettings=this.widgetSettings),this.feedMetadata&&(this.loadedWidget.feedMetadata=this.feedMetadata),this.posts&&(this.loadedWidget.posts=this.posts),this.loadedWidget.errorMessage=this.errorMessage||null,this.dispatchEvent(new Event("load")),window.dispatchEvent(new CustomEvent("behold:widget-loaded",{detail:{id:this["feed-id"]}}))}async getFeed(t){if(t){this.abortController&&this.abortController.abort(),this.abortController=new AbortController;try{const e=await fetch(`https://feeds.behold.so/${t}`,{mode:"cors",signal:this.abortController.signal});if(e.ok){const t=await e.json();if(!t.widgetSettings)throw new Error("JSON feeds cannot be used as a widget");if(t.widgetSettings.klaviyoWebFeedId)throw new Error("Klaviyo feeds cannot be used as an embedded widget");this.widgetSettings=t.widgetSettings,this.feedMetadata={username:t.username,profilePictureUrl:t.profilePictureUrl,website:t.website,followersCount:t.followersCount,hashtags:t.hashtags},this.posts=t.posts||t.media}else{const t=await e.text();this.errorMessage=t}}catch(t){"The user aborted a request."!==t.message&&(this.errorMessage=t.message)}}else this.errorMessage="No feed ID provided"}async importWidget(t){const{default:e}=await function(t){switch(t){case"./widgets/ElasticCarousel.ts":return import("./ElasticCarousel-c08uvOFF.js");case"./widgets/ErrorMessage.ts":return import("./ErrorMessage-tuxDaJI_.js");case"./widgets/GalleryWall.ts":return import("./GalleryWall-vXKMF67Z.js");case"./widgets/Grid.ts":return import("./Grid-1Xz5XRHy.js");default:return new Promise((function(e,s){("function"==typeof queueMicrotask?queueMicrotask:setTimeout)(s.bind(null,new Error("Unknown variable dynamic import: "+t)))}))}}(`./widgets/${t}.ts`);return e}}var M={register:(t="behold-widget")=>{customElements.get(t)||customElements.define(t,class extends C{})},element:C};export{S as B,M as W,c as a,i as b,x as c,s as d,a as e,e as f,r as g,d as h,u as i,o as j,p as k,n as l,w as p,h as s,l as t};
1
+ function t(t){return JSON.parse(JSON.stringify(t,((t,e)=>void 0===e?null:e)))}function e(){return document.body.offsetTop}async function s(t,e){const s=document.createElement(t);return new Promise(((n,i)=>{switch(t){case"img":s.addEventListener("load",(()=>{n(e)}));break;case"video":s.addEventListener("loadeddata",(()=>n(e)))}s.addEventListener("error",(t=>{i(t)})),s.src=e}))}function n({text:t,maxLines:e=2,maxChars:s=50}){if(!t)return;const n=t.match(/.*/g).filter((t=>t.length>0)).slice(0,e).join("").length,i=Math.min(n,s);return t.slice(0,i)}function i(t,e){return`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' width='${t}' height='${e}'%3E%3C/svg%3E%0A`}function o(t){return new Promise((e=>{let s=new IntersectionObserver((t=>{let n=t.reduce(((t,e,s)=>e.intersectionRatio>t.intersectionRatio?{index:s,intersectionRatio:e.intersectionRatio}:t),{intersectionRatio:0,index:null});s.disconnect(),s=null,e(n.index)}));t.forEach((t=>s.observe(t)))}))}function r(t,e){let s=!1,n=new IntersectionObserver((t=>{s||(n.disconnect(),n=null,e(t[0].boundingClientRect))}));return n.observe(t),function(){s||(s=!0,n&&(n.disconnect(),n=null))}}function a(t){return t.isConnected?"#document"===t.nodeName||t instanceof ShadowRoot?t:a(t.parentNode):document}function l(t,e,s=null,n=!1){let i=n?performance.now():0,o=null;return(...n)=>{let r=performance.now();clearTimeout(o),o=setTimeout((()=>t.apply(s,n)),e),r-i>e&&(clearTimeout(o),i=r,t.apply(s,n))}}function c(t,e){Object.entries(e).forEach((([e,s])=>{s?t.classList.add(e):t.classList.remove(e)}))}function h(t,e){Object.keys(e).forEach((s=>{t.style.setProperty(s,e[s])}))}function d(t,e,s,n=0){if("string"==typeof s&&(s=[s]),n>0){let n=!1;return Object.keys(t).length!==Object.keys(e).length||(Object.keys(t).forEach((i=>{d(t[i],e[i],s)&&(n=!0)})),n)}return s.reduce(((s,n)=>!u(t?.[n],e?.[n])||s),!1)}function u(t,e,s=!1,n=!1){if(n&&(Array.isArray(t)&&(t=t.sort()),Array.isArray(e)&&(e=e.sort())),s&&("number"==typeof t&&(t=t.toString()),"number"==typeof e&&(e=e.toString())),typeof t!=typeof e)return!1;if(null===t&&null===e)return!0;if(null===t&&null!==e)return!1;if(null!==t&&null===e)return!1;if(void 0===t&&void 0===e)return!0;if(void 0===t&&void 0!==e)return!1;if(void 0!==t&&void 0===e)return!1;if("object"==typeof t)return Object.keys(t).length===Object.keys(e).length&&Object.entries(t).reduce(((t,[i,o])=>!!u(o,e[i],s,n)&&t),!0);if(Array.isArray(t)){let i=!0;return t.forEach(((t,o)=>{u(t,e[o],s,n)||(i=!1)})),i}return t===e}function p(t,e="assertive"){const s=document.createElement("div");s.innerHTML=t,s.setAttribute("aria-live",e),s.setAttribute("aria-atomic","true"),s.style.cssText="\n position: absolute;\n position: absolute !important;\n width: 1px !important;\n height: 1px !important;\n padding: 0 !important;\n margin: -1px !important;\n overflow: hidden !important;\n clip: rect(0,0,0,0) !important;\n white-space: nowrap !important;\n border: 0 !important;\n ",requestAnimationFrame((()=>{document.body.appendChild(s),setTimeout((()=>{s.remove()}),500)}))}function w(t,e,s){t.length===s&&t.shift(),t.push(e)}let m={isMuted:!0,keyboardNavEnabled:!1,popoverOverlayHslArray:[0,0,0],popoverOverlayOpacity:.6},b=!1,f=null,g=null;const v=new Map,y=new Map,O=new Map,j=new Set;!function t(){O.forEach((t=>{const e=performance.now(),{minWait:s,lastInvocation:n,callback:i}=t,o=e-n;o>s&&(i(o),O.set(i,{...t,lastInvocation:e}))})),requestAnimationFrame(t)}();class S extends HTMLElement{label="BaseElement";storedProperties=new Map;requiredProperties=[];hasRequiredProps=!1;propChangeHandlers=new Map;delayedPropChangeHandlers=new Map;queuedPropUpdates=new Set;localState=Object.freeze({});localStateChangeHandlers=new Set;connectHandlers=new Set;disconnectHandlers=new Set;rafs=new Map;timeouts=new Map;constructor(){if(super(),this.t=this.t.bind(this),this.i=this.i.bind(this),this.o=this.o.bind(this),!f){let t=window.ResizeObserver;"ResizeObserver"in window==0&&(t=window.BeholdResizeObserver),f=new t((t=>{t.forEach((t=>{const e=v.get(t.target);e&&e(t)}))}))}g||(g=new IntersectionObserver((t=>{t.forEach((t=>{const e=y.get(t.target);e&&e(t)}))}))),b||(b=!0,document.addEventListener("keydown",this.t),document.addEventListener("mousedown",this.i),document.addEventListener("mousemove",this.o,{passive:!0}))}connectedCallback(){this.connectHandlers.forEach((t=>t()))}disconnectedCallback(){this.rafs.forEach((t=>cancelAnimationFrame(t))),this.rafs.clear(),this.timeouts.forEach((t=>clearTimeout(t))),this.timeouts.clear(),this.disconnectHandlers.forEach((t=>t()))}onConnect(t){this.connectHandlers.add(t)}onDisconnect(t){this.disconnectHandlers.add(t)}onResize(t,e,s){v.set(e,s.bind(t)),f.observe(e),this.disconnectHandlers.add((()=>{v.delete(e),f.unobserve(e)}))}onIntersection(t,e){y.set(t,e),g.observe(t),this.disconnectHandlers.add((()=>{y.delete(t),g.unobserve(t)}))}onLoop(t,e=50){O.set(t,{minWait:e,lastInvocation:0,callback:t}),this.disconnectHandlers.add((()=>{O.delete(t)}))}onPropChange(e,s,n=null,i=null){n?this.requiredProperties.push(...n):this.requiredProperties.push(...s),s.forEach((s=>{void 0!==this[s]&&this.storedProperties.set(s,this[s]),this.propChangeHandlers.get(s)||(this.propChangeHandlers.set(s,[]),this.delayedPropChangeHandlers.set(s,[])),i?this.delayedPropChangeHandlers.get(s).push(e):this.propChangeHandlers.get(s).push(e),Object.defineProperty(this,s,{set(e){void 0===e&&(e=null,console.warn(`Attempted to set value of ${s} as "undefined" on ${this.label}. ${s} was coerced to null instead.`)),e=t(e);const n=this.storedProperties.has(s)?t(this.storedProperties.get(s)):null;this.storedProperties.set(s,e),this.hasRequiredProps=this.requiredProperties.every((t=>this.storedProperties.has(t))),this.queueHandlers({prop:s,oldValue:n,newValue:e})},get(){return this.storedProperties.get(s)}})})),i&&(i=i.bind(this),queueMicrotask((()=>{this.hasRequiredProps&&(i(),this.delayedPropChangeHandlers.forEach(((t,e)=>{this.propChangeHandlers.set(e,[...this.propChangeHandlers.get(e),...t])})))}))),this.queueMissingPropsCheck()}queueHandlers({prop:t,oldValue:e,newValue:s}){this.hasRequiredProps?(this.queuedPropUpdates.size&&(this.queuedPropUpdates.delete(t),this.runQueuedPropHandlers()),this.propChangeHandlers.get(t).forEach((n=>{n.call(this,{changedProp:t,oldValue:e,newValue:s})}))):this.queuedPropUpdates.add(t)}runQueuedPropHandlers(){this.queuedPropUpdates.forEach((t=>{this.propChangeHandlers.get(t).forEach((e=>{e.call(this,{changedProp:t,oldValue:null,newValue:this[t]})}))})),this.queuedPropUpdates.clear()}updateLocalState(e){const s=Object.freeze(t(this.localState));this.localState=Object.freeze({...this.localState,...e}),this.localStateChangeHandlers.forEach((t=>t({changedProps:Object.keys(e),oldState:s,newState:this.localState})))}onLocalStateChange(t,e){this.localState={...this.localState,...e};const s=t.bind(this);this.localStateChangeHandlers.add(s)}updateGlobalState(e){const s=t(m);m={...m,...e},j.forEach((t=>t({changedProps:Object.keys(e),oldState:s,newState:m})))}onGlobalStateChange(t){this.connectHandlers.add((()=>{const e=t.bind(this);j.add(e),this.disconnectHandlers.add((()=>j.delete(e)))}))}t(t){"Tab"===t.key&&this.updateGlobalState({keyboardNavEnabled:!0})}i(t){0===t.clientX&&0===t.clientY||this.updateGlobalState({keyboardNavEnabled:!1})}o(t){t.ctrlKey||t.altKey||t.shiftKey||t.metaKey||0===t.movementX||0===t.movementY||this.updateGlobalState({keyboardNavEnabled:!1})}get globalState(){return m}set globalState(t){throw new Error("Shared state cannot be set directly. Use this.updateGlobalState() instead.")}raf(t,e,s=!0){s&&cancelAnimationFrame(this.rafs.get(e));const n=requestAnimationFrame((()=>{t(),this.rafs.delete(e)}));return this.rafs.set(e,n),n}cancelRaf(t){cancelAnimationFrame(this.rafs.get(t)),this.rafs.delete(t)}to(t,e,s){const n=setTimeout((()=>{t(),this.timeouts.delete(s)}),e);return this.timeouts.set(s,n),n}cancelTo(t){clearTimeout(this.timeouts.get(t)),this.timeouts.delete(t)}queueMissingPropsCheck(){queueMicrotask((()=>{if(this.requiredProperties.length&&!this.hasRequiredProps){const t=this.requiredProperties.filter((t=>!this.storedProperties.has(t)));console.error(`${this.label||this.tagName} is missing required props: ${t.join(", ")}`)}}))}}function x(t){let{type:e="div",classes:s=[],contents:n=[],attributes:i={},props:o={},style:r={},listeners:a={}}=t;s=Array.isArray(s)?s:[s];const l=document.createElement(e);return Array.isArray(n)||(n=[n]),n=n.filter((t=>null!=t)).map((t=>{if("string"==typeof t&&t.includes("</svg>")){const e=document.createElement("template");return e.innerHTML=t,e.content}return t})),l.beholdReplaceChildren(...n),s.length&&(l.className=s.join(" ")),Object.keys(i).forEach((t=>{l.setAttribute(t,i[t])})),Object.assign(l,o),Object.keys(r).forEach((t=>{"--"===t.substring(0,2)?l.style.setProperty(t,r[t]):l.style[t]=r[t]})),Object.keys(a).forEach((t=>{l.addEventListener(t,a[t])})),l}class C extends S{label="BeholdWidget";shadow;abortController;loadedWidget;static get observedAttributes(){return["feed-id"]}constructor(){super(),this.shadow=this.attachShadow({mode:"open"}),this.abortController=null,this.onPropChange(this.l,["widgetSettings","feedMetadata","posts","previewLoadingColors","errorMessage"],[])}attributeChangedCallback(t,e,s){"feed-id"===t&&s!==e&&this.getFeed(s)}l({changedProp:t,oldValue:e,newValue:s}){"errorMessage"!==t||e||!s?"widgetSettings"===t&&d(s,e,"type")&&s?.type?this.loadWidget(s.type):this.loadedWidget&&!u(s,e)&&(this.loadedWidget[t]=s):this.loadWidget("ErrorMessage")}async loadWidget(t){if(await import("./replaceChildren-4H1qCpyP.js"),"ResizeObserver"in window==0){const{ResizeObserver:t}=await import("./resizeObserver--rsjm-GV.js");window.BeholdResizeObserver=t}const e=(await this.importWidget(t.replace(/.?/,(t=>t.toUpperCase())))).register(),s=x({type:e}),n=x({type:"style",contents:":host{align-items:center;box-sizing:border-box;display:flex;flex-wrap:wrap;justify-content:center;margin:0;min-width:50px;overflow:hidden;position:relative;width:100%}:host *{box-sizing:border-box}:host([hidden]){display:none}".toString()});this.shadow.beholdReplaceChildren(s,n),this.loadedWidget=this.shadow.querySelector(e),this.widgetSettings&&(this.loadedWidget.widgetSettings=this.widgetSettings),this.feedMetadata&&(this.loadedWidget.feedMetadata=this.feedMetadata),this.posts&&(this.loadedWidget.posts=this.posts),this.loadedWidget.errorMessage=this.errorMessage||null,this.dispatchEvent(new Event("load")),window.dispatchEvent(new CustomEvent("behold:widget-loaded",{detail:{id:this["feed-id"]}}))}async getFeed(t){if(t){this.abortController&&this.abortController.abort(),this.abortController=new AbortController;try{const e=await fetch(`https://feeds.behold.so/${t}`,{mode:"cors",signal:this.abortController.signal});if(e.ok){const t=await e.json();if(!t.widgetSettings)throw new Error("JSON feeds cannot be used as a widget");if(t.widgetSettings.klaviyoWebFeedId)throw new Error("Klaviyo feeds cannot be used as an embedded widget");this.widgetSettings=t.widgetSettings,this.feedMetadata={username:t.username,profilePictureUrl:t.profilePictureUrl,website:t.website,followersCount:t.followersCount,hashtags:t.hashtags},this.posts=t.posts||t.media}else{const t=await e.text();this.errorMessage=t}}catch(t){"The user aborted a request."!==t.message&&(this.errorMessage=t.message)}}else this.errorMessage="No feed ID provided"}async importWidget(t){const{default:e}=await function(t){switch(t){case"./widgets/ElasticCarousel.ts":return import("./ElasticCarousel-rPc9O5UB.js");case"./widgets/ErrorMessage.ts":return import("./ErrorMessage-dC06K_8X.js");case"./widgets/GalleryWall.ts":return import("./GalleryWall-Mte2T_vn.js");case"./widgets/Grid.ts":return import("./Grid-qwz5AHuu.js");default:return new Promise((function(e,s){("function"==typeof queueMicrotask?queueMicrotask:setTimeout)(s.bind(null,new Error("Unknown variable dynamic import: "+t)))}))}}(`./widgets/${t}.ts`);return e}}var M={register:(t="behold-widget")=>{customElements.get(t)||customElements.define(t,class extends C{})},element:C};export{S as B,M as W,c as a,i as b,x as c,s as d,a as e,e as f,r as g,d as h,u as i,o as j,p as k,n as l,w as p,h as s,l as t};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export{W as widget}from"./index-8GmY65W7.js";
1
+ export{W as widget}from"./index-ANfp_6HB.js";
@@ -40,6 +40,7 @@ export default class Gyre {
40
40
  _scrollProgress: number;
41
41
  _abortScrollCheck: Function;
42
42
  _virtualize: boolean;
43
+ _raf: number;
43
44
  anchorSlide: number;
44
45
  finalAnchorSlide: number;
45
46
  constructor({ onSlideChange }: {
@@ -1 +1 @@
1
- {"version":3,"file":"gyre.d.ts","sourceRoot":"","sources":["../../src/lib/gyre.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,OAAO,IAAI;IACvB,WAAW,EAAE,WAAW,CAAA;IACxB,QAAQ,EAAE,WAAW,EAAE,CAAA;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,YAAY,EAAE,MAAM,CAAA;IACpB,4BAA4B,EAAE,OAAO,CAAA;IACrC,WAAW,EAAE,OAAO,CAAA;IACpB,eAAe,EAAE,OAAO,CAAA;IACxB,cAAc,EAAE,cAAc,CAAA;IAC9B,aAAa,EAAE,QAAQ,CAAA;IAEvB,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,gBAAgB,EAAE,WAAW,EAAE,CAAA;IAC/B,gBAAgB,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAChD,cAAc,EAAE,OAAO,CAAA;IACvB,WAAW,EAAE,OAAO,CAAA;IACpB,YAAY,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,EAAE,MAAM,CAAA;IACxB,gBAAgB,EAAE,MAAM,CAAA;IACxB,eAAe,EAAE,MAAM,CAAA;IACvB,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;IAC5C,cAAc,EAAE,EAAE,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,iBAAiB,EAAE,MAAM,CAAA;IACzB,UAAU,EAAE,MAAM,CAAA;IAClB,sBAAsB,EAAE,MAAM,CAAA;IAC9B,qBAAqB,EAAE,MAAM,CAAA;IAC7B,aAAa,EAAE,MAAM,CAAA;IACrB,cAAc,EAAE,eAAe,CAAA;IAC/B,eAAe,EAAE,MAAM,CAAA;IACvB,iBAAiB,EAAE,QAAQ,CAAA;IAC3B,WAAW,EAAE,OAAO,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,MAAM,CAAA;gBAEZ,EAAE,aAAa,EAAE,EAAE;QAAE,aAAa,EAAE,QAAQ,CAAA;KAAE;IAgD1D,IAAI,CAAC,EACH,WAAW,EACX,QAAQ,EACR,MAAY,EACZ,GAAQ,EACR,YAAiB,EACjB,4BAAmC,EACnC,WAAmB,EACnB,eAAuB,GACxB,EAAE;QACD,WAAW,EAAE,WAAW,CAAA;QACxB,QAAQ,EAAE,WAAW,EAAE,CAAA;QACvB,MAAM,EAAE,MAAM,CAAA;QACd,GAAG,EAAE,MAAM,CAAA;QACX,YAAY,EAAE,MAAM,CAAA;QACpB,4BAA4B,EAAE,OAAO,CAAA;QACrC,WAAW,EAAE,OAAO,CAAA;QACpB,eAAe,EAAE,OAAO,CAAA;KACzB;IAiCD,cAAc,CAAC,EACb,MAAY,EACZ,GAAQ,EACR,YAAiB,EACjB,4BAAmC,EACnC,WAAmB,EACnB,eAAuB,GACxB,EAAE;QACD,MAAM,EAAE,MAAM,CAAA;QACd,GAAG,EAAE,MAAM,CAAA;QACX,YAAY,EAAE,MAAM,CAAA;QACpB,4BAA4B,EAAE,OAAO,CAAA;QACrC,WAAW,EAAE,OAAO,CAAA;QACpB,eAAe,EAAE,OAAO,CAAA;KACzB;IAkBD,OAAO;IAeP,YAAY,CAAC,OAAO,EAAE,mBAAmB,EAAE;IAkB3C,iBAAiB;IAgCjB,oBAAoB;IAmBpB,iBAAiB,CAAC,CAAC,EAAE,YAAY;IASjC,iBAAiB,CAAC,CAAC,EAAE,YAAY;IAWjC,eAAe;IAkBf,gBAAgB,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI;IAoB/C,eAAe,CAAC,EACd,YAAY,EACZ,SAAS,EACT,SAAa,EACb,IAAS,EACT,QAAe,GAChB,EAAE;QACD,YAAY,EAAE,MAAM,CAAA;QACpB,SAAS,EAAE,MAAM,CAAA;QACjB,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,QAAQ,CAAC,EAAE,MAAM,CAAA;KAClB;IAMD,sBAAsB,CAAC,CAAC,EAAE,MAAM;;;;;;IA0BhC,mBAAmB;IAkBnB,eAAe;IAiCf,cAAc;IAiCd,iBAAiB,IAAI;QACnB,EAAE,EAAE,WAAW,CAAA;QACf,SAAS,EAAE,WAAW,CAAA;QACtB,IAAI,EAAE,MAAM,CAAA;QACZ,cAAc,EAAE,MAAM,CAAA;QACtB,aAAa,EAAE,MAAM,CAAA;QACrB,cAAc,EAAE,MAAM,CAAA;KACvB,EAAE;IAkIH,cAAc;IAmBd,SAAS,CAAC,UAAU,EAAE,MAAM;IAU5B,OAAO;IASP,OAAO;IAMP,MAAM;IAWN,IAAI;CAWL"}
1
+ {"version":3,"file":"gyre.d.ts","sourceRoot":"","sources":["../../src/lib/gyre.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,OAAO,IAAI;IACvB,WAAW,EAAE,WAAW,CAAA;IACxB,QAAQ,EAAE,WAAW,EAAE,CAAA;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,YAAY,EAAE,MAAM,CAAA;IACpB,4BAA4B,EAAE,OAAO,CAAA;IACrC,WAAW,EAAE,OAAO,CAAA;IACpB,eAAe,EAAE,OAAO,CAAA;IACxB,cAAc,EAAE,cAAc,CAAA;IAC9B,aAAa,EAAE,QAAQ,CAAA;IAEvB,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,gBAAgB,EAAE,WAAW,EAAE,CAAA;IAC/B,gBAAgB,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAChD,cAAc,EAAE,OAAO,CAAA;IACvB,WAAW,EAAE,OAAO,CAAA;IACpB,YAAY,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,EAAE,MAAM,CAAA;IACxB,gBAAgB,EAAE,MAAM,CAAA;IACxB,eAAe,EAAE,MAAM,CAAA;IACvB,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;IAC5C,cAAc,EAAE,EAAE,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,iBAAiB,EAAE,MAAM,CAAA;IACzB,UAAU,EAAE,MAAM,CAAA;IAClB,sBAAsB,EAAE,MAAM,CAAA;IAC9B,qBAAqB,EAAE,MAAM,CAAA;IAC7B,aAAa,EAAE,MAAM,CAAA;IACrB,cAAc,EAAE,eAAe,CAAA;IAC/B,eAAe,EAAE,MAAM,CAAA;IACvB,iBAAiB,EAAE,QAAQ,CAAA;IAC3B,WAAW,EAAE,OAAO,CAAA;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,MAAM,CAAA;gBAEZ,EAAE,aAAa,EAAE,EAAE;QAAE,aAAa,EAAE,QAAQ,CAAA;KAAE;IAgD1D,IAAI,CAAC,EACH,WAAW,EACX,QAAQ,EACR,MAAY,EACZ,GAAQ,EACR,YAAiB,EACjB,4BAAmC,EACnC,WAAmB,EACnB,eAAuB,GACxB,EAAE;QACD,WAAW,EAAE,WAAW,CAAA;QACxB,QAAQ,EAAE,WAAW,EAAE,CAAA;QACvB,MAAM,EAAE,MAAM,CAAA;QACd,GAAG,EAAE,MAAM,CAAA;QACX,YAAY,EAAE,MAAM,CAAA;QACpB,4BAA4B,EAAE,OAAO,CAAA;QACrC,WAAW,EAAE,OAAO,CAAA;QACpB,eAAe,EAAE,OAAO,CAAA;KACzB;IAiCD,cAAc,CAAC,EACb,MAAY,EACZ,GAAQ,EACR,YAAiB,EACjB,4BAAmC,EACnC,WAAmB,EACnB,eAAuB,GACxB,EAAE;QACD,MAAM,EAAE,MAAM,CAAA;QACd,GAAG,EAAE,MAAM,CAAA;QACX,YAAY,EAAE,MAAM,CAAA;QACpB,4BAA4B,EAAE,OAAO,CAAA;QACrC,WAAW,EAAE,OAAO,CAAA;QACpB,eAAe,EAAE,OAAO,CAAA;KACzB;IAqBD,OAAO;IAgBP,YAAY,CAAC,OAAO,EAAE,mBAAmB,EAAE;IAkB3C,iBAAiB;IAgCjB,oBAAoB;IAmBpB,iBAAiB,CAAC,CAAC,EAAE,YAAY;IASjC,iBAAiB,CAAC,CAAC,EAAE,YAAY;IAWjC,eAAe;IAkBf,gBAAgB,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI;IAoB/C,eAAe,CAAC,EACd,YAAY,EACZ,SAAS,EACT,SAAa,EACb,IAAS,EACT,QAAe,GAChB,EAAE;QACD,YAAY,EAAE,MAAM,CAAA;QACpB,SAAS,EAAE,MAAM,CAAA;QACjB,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,QAAQ,CAAC,EAAE,MAAM,CAAA;KAClB;IAMD,sBAAsB,CAAC,CAAC,EAAE,MAAM;;;;;;IA0BhC,mBAAmB;IAkBnB,eAAe;IAiCf,cAAc;IAiCd,iBAAiB,IAAI;QACnB,EAAE,EAAE,WAAW,CAAA;QACf,SAAS,EAAE,WAAW,CAAA;QACtB,IAAI,EAAE,MAAM,CAAA;QACZ,cAAc,EAAE,MAAM,CAAA;QACtB,aAAa,EAAE,MAAM,CAAA;QACrB,cAAc,EAAE,MAAM,CAAA;KACvB,EAAE;IAkIH,cAAc;IAmBd,SAAS,CAAC,UAAU,EAAE,MAAM;IAU5B,OAAO;IASP,OAAO;IAMP,MAAM;IAWN,IAAI;CAWL"}
@@ -9,13 +9,14 @@ export default class ElasticCarousel extends Base {
9
9
  posts: Posts;
10
10
  previewLoadingColors: string;
11
11
  containerEl: HTMLElement;
12
+ headerEl: HTMLElement;
13
+ innerEl: HTMLElement;
12
14
  footerEl: HTMLElement;
13
15
  instagramLogoEl: HTMLImageElement;
14
- sourceEl: HTMLLinkElement;
15
- controlsEl: HTMLElement;
16
+ labelEl: HTMLLinkElement;
16
17
  leftArrowEl: HTMLButtonElement;
17
18
  rightArrowEl: HTMLButtonElement;
18
- innerEl: HTMLElement;
19
+ slidesContainerEl: HTMLElement;
19
20
  postEls: Array<any>;
20
21
  popoverGalleryEl: PopoverGallery;
21
22
  appliedBreakpoint: Breakpoint;
@@ -82,9 +83,11 @@ export default class ElasticCarousel extends Base {
82
83
  showControls: boolean;
83
84
  controlsPosition: "top" | "bottom" | "sides";
84
85
  controlsJustification: "center" | "left" | "right" | "split";
85
- footerMargin: number;
86
+ controlsMargin: number;
86
87
  buttonBorderRadius: number;
87
- showUsername: boolean;
88
+ showLabel: boolean;
89
+ labelPosition: "top" | "bottom";
90
+ labelJustification: "center" | "left" | "right";
88
91
  postHeight: number;
89
92
  };
90
93
  renderBreakpoint(breakpoint: Breakpoint, forceRender?: boolean): void;
@@ -1 +1 @@
1
- {"version":3,"file":"ElasticCarousel.d.ts","sourceRoot":"","sources":["../../src/widgets/ElasticCarousel.ts"],"names":[],"mappings":"AAGA,OAAO,IAAI,MAAM,2BAA2B,CAAA;AAI5C,OAAO,IAAI,MAAM,gBAAgB,CAAA;AACjC,OAAO,KAAK,cAAc,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAA;AAUnD,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,IAAI;IAC/C,KAAK,SAAoB;IAGzB,cAAc,EAAE,cAAc,CAAA;IAC9B,YAAY,EAAE,YAAY,CAAA;IAC1B,KAAK,EAAE,KAAK,CAAA;IACZ,oBAAoB,EAAE,MAAM,CAAO;IAGnC,WAAW,EAAE,WAAW,CAAA;IACxB,QAAQ,EAAE,WAAW,CAAA;IACrB,eAAe,EAAE,gBAAgB,CAAA;IACjC,QAAQ,EAAE,eAAe,CAAA;IACzB,UAAU,EAAE,WAAW,CAAA;IACvB,WAAW,EAAE,iBAAiB,CAAA;IAC9B,YAAY,EAAE,iBAAiB,CAAA;IAC/B,OAAO,EAAE,WAAW,CAAA;IACpB,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;IACnB,gBAAgB,EAAE,cAAc,CAAA;IAChC,iBAAiB,EAAE,UAAU,CAAA;IAC7B,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAC/B,IAAI,EAAE,IAAI,CAAA;;IA0FV,KAAK;IAyEL;;OAEG;IACH,kBAAkB,CAAC,KAAK,KAAA;IAiBxB,iBAAiB,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE;;;;KAAA;IAyBrD,kBAAkB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE;;;KAAA;IAkBzC,qBAAqB,CAAC,QAAQ,KAAA,EAAE,QAAQ,KAAA;IA6CxC,qBAAqB;IAqBrB;;OAEG;IACG,oBAAoB;IAsB1B,aAAa,CAAC,KAAK,EAAE,mBAAmB;IAUxC;;OAEG;IACH,wBAAwB;IAcxB;;OAEG;IACH,oBAAoB;IAyBpB;;OAEG;IACH,gBAAgB,CAAC,IAAI,EAAE,QAAQ;IAI/B;;OAEG;IACH,QAAQ;IAMR;;OAEG;IACH,QAAQ;IASR,WAAW,CAAC,UAAU,EAAE,UAAU;IAqBlC,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;IAa7D,gBAAgB,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,GAAE,OAAe;IA2IrE,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC;IAgEtD,MAAM,CAAC,QAAQ,CAAC,IAAI,SAA4B,GAAG,MAAM;CAM1D;AAKD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,yBAAyB,EAAE,eAAe,CAAA;KAC3C;CACF"}
1
+ {"version":3,"file":"ElasticCarousel.d.ts","sourceRoot":"","sources":["../../src/widgets/ElasticCarousel.ts"],"names":[],"mappings":"AAGA,OAAO,IAAI,MAAM,2BAA2B,CAAA;AAI5C,OAAO,IAAI,MAAM,gBAAgB,CAAA;AACjC,OAAO,KAAK,cAAc,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAA;AAUnD,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,IAAI;IAC/C,KAAK,SAAoB;IAGzB,cAAc,EAAE,cAAc,CAAA;IAC9B,YAAY,EAAE,YAAY,CAAA;IAC1B,KAAK,EAAE,KAAK,CAAA;IACZ,oBAAoB,EAAE,MAAM,CAAO;IAGnC,WAAW,EAAE,WAAW,CAAA;IACxB,QAAQ,EAAE,WAAW,CAAA;IACrB,OAAO,EAAE,WAAW,CAAA;IACpB,QAAQ,EAAE,WAAW,CAAA;IACrB,eAAe,EAAE,gBAAgB,CAAA;IACjC,OAAO,EAAE,eAAe,CAAA;IACxB,WAAW,EAAE,iBAAiB,CAAA;IAC9B,YAAY,EAAE,iBAAiB,CAAA;IAC/B,iBAAiB,EAAE,WAAW,CAAA;IAC9B,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;IACnB,gBAAgB,EAAE,cAAc,CAAA;IAChC,iBAAiB,EAAE,UAAU,CAAA;IAC7B,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAC/B,IAAI,EAAE,IAAI,CAAA;;IA6FV,KAAK;IAyEL;;OAEG;IACH,kBAAkB,CAAC,KAAK,KAAA;IAiBxB,iBAAiB,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE;;;;KAAA;IAyBrD,kBAAkB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE;;;KAAA;IAkBzC,qBAAqB,CAAC,QAAQ,KAAA,EAAE,QAAQ,KAAA;IA6CxC,qBAAqB;IAqBrB;;OAEG;IACG,oBAAoB;IAsB1B,aAAa,CAAC,KAAK,EAAE,mBAAmB;IAUxC;;OAEG;IACH,wBAAwB;IAcxB;;OAEG;IACH,oBAAoB;IAyBpB;;OAEG;IACH,gBAAgB,CAAC,IAAI,EAAE,QAAQ;IAI/B;;OAEG;IACH,QAAQ;IAMR;;OAEG;IACH,QAAQ;IASR,WAAW,CAAC,UAAU,EAAE,UAAU;IAqBlC,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;IAa7D,gBAAgB,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,GAAE,OAAe;IAmJrE,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC;IAgEtD,MAAM,CAAC,QAAQ,CAAC,IAAI,SAA4B,GAAG,MAAM;CAM1D;AAKD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,yBAAyB,EAAE,eAAe,CAAA;KAC3C;CACF"}
@@ -59,9 +59,11 @@ export default class GalleryWall extends Base {
59
59
  showControls: boolean;
60
60
  controlsPosition: "top" | "bottom" | "sides";
61
61
  controlsJustification: "center" | "left" | "right" | "split";
62
- footerMargin: number;
62
+ controlsMargin: number;
63
63
  buttonBorderRadius: number;
64
- showUsername: boolean;
64
+ showLabel: boolean;
65
+ labelPosition: "top" | "bottom";
66
+ labelJustification: "center" | "left" | "right";
65
67
  postHeight: number;
66
68
  };
67
69
  renderBreakpoint(breakpoint: Breakpoint, forceRender?: boolean): void;
@@ -1 +1 @@
1
- {"version":3,"file":"GalleryWall.d.ts","sourceRoot":"","sources":["../../src/widgets/GalleryWall.ts"],"names":[],"mappings":"AAGA,OAAO,IAAI,MAAM,2BAA2B,CAAA;AAI5C,OAAO,KAAK,cAAc,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAA;AAOnD,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,IAAI;IAC3C,KAAK,SAAgB;IAGrB,cAAc,EAAE,cAAc,CAAA;IAC9B,YAAY,EAAE,YAAY,CAAA;IAC1B,KAAK,EAAE,KAAK,CAAA;IACZ,oBAAoB,EAAE,MAAM,CAAO;IAGnC,WAAW,EAAE,WAAW,CAAA;IACxB,WAAW,EAAE,WAAW,CAAA;IACxB,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;IACxB,gBAAgB,EAAE,cAAc,CAAA;IAChC,iBAAiB,EAAE,UAAU,CAAA;IAC7B,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;;IAsD/B,KAAK;IAgCL,iBAAiB,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE;;;;KAAA;IA0BrD,kBAAkB;IAYlB,qBAAqB,CAAC,QAAQ,KAAA,EAAE,QAAQ,KAAA;IA0BxC,qBAAqB;IAqBrB;;OAEG;IACG,oBAAoB;IAoB1B,aAAa,CAAC,KAAK,EAAE,mBAAmB;IAUxC;;OAEG;IACH,wBAAwB;IAexB;;OAEG;IACH,oBAAoB;IAepB;;OAEG;IACH,gBAAgB,CAAC,IAAI,EAAE,QAAQ;IAO/B,WAAW,CAAC,UAAU,EAAE,UAAU;IAWlC,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;IAqB7D,gBAAgB,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,GAAE,OAAe;IAmFrE,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC;IAuDtD,kBAAkB,WAMjB;IAKD,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAwB,GAAG,MAAM;CAMtD;AAKD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,qBAAqB,EAAE,WAAW,CAAA;KACnC;CACF"}
1
+ {"version":3,"file":"GalleryWall.d.ts","sourceRoot":"","sources":["../../src/widgets/GalleryWall.ts"],"names":[],"mappings":"AAGA,OAAO,IAAI,MAAM,2BAA2B,CAAA;AAI5C,OAAO,KAAK,cAAc,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAA;AAOnD,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,IAAI;IAC3C,KAAK,SAAgB;IAGrB,cAAc,EAAE,cAAc,CAAA;IAC9B,YAAY,EAAE,YAAY,CAAA;IAC1B,KAAK,EAAE,KAAK,CAAA;IACZ,oBAAoB,EAAE,MAAM,CAAO;IAGnC,WAAW,EAAE,WAAW,CAAA;IACxB,WAAW,EAAE,WAAW,CAAA;IACxB,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;IACxB,gBAAgB,EAAE,cAAc,CAAA;IAChC,iBAAiB,EAAE,UAAU,CAAA;IAC7B,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;;IAsD/B,KAAK;IAgCL,iBAAiB,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE;;;;KAAA;IA0BrD,kBAAkB;IAYlB,qBAAqB,CAAC,QAAQ,KAAA,EAAE,QAAQ,KAAA;IA0BxC,qBAAqB;IAqBrB;;OAEG;IACG,oBAAoB;IAoB1B,aAAa,CAAC,KAAK,EAAE,mBAAmB;IAUxC;;OAEG;IACH,wBAAwB;IAexB;;OAEG;IACH,oBAAoB;IAepB;;OAEG;IACH,gBAAgB,CAAC,IAAI,EAAE,QAAQ;IAO/B,WAAW,CAAC,UAAU,EAAE,UAAU;IAWlC,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;IAqB7D,gBAAgB,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,GAAE,OAAe;IAmFrE,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC;IAuDtD,kBAAkB,WAMjB;IAKD,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAwB,GAAG,MAAM;CAMtD;AAKD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,qBAAqB,EAAE,WAAW,CAAA;KACnC;CACF"}
@@ -61,9 +61,11 @@ export default class Grid extends Base {
61
61
  showControls: boolean;
62
62
  controlsPosition: "top" | "bottom" | "sides";
63
63
  controlsJustification: "center" | "left" | "right" | "split";
64
- footerMargin: number;
64
+ controlsMargin: number;
65
65
  buttonBorderRadius: number;
66
- showUsername: boolean;
66
+ showLabel: boolean;
67
+ labelPosition: "top" | "bottom";
68
+ labelJustification: "center" | "left" | "right";
67
69
  postHeight: number;
68
70
  };
69
71
  renderBreakpoint(breakpoint: Breakpoint, forceRender?: boolean): void;
@@ -1 +1 @@
1
- {"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../src/widgets/Grid.ts"],"names":[],"mappings":"AAGA,OAAO,IAAI,MAAM,2BAA2B,CAAA;AAI5C,OAAO,KAAK,cAAc,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAA;AAOnD,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,IAAI;IACpC,KAAK,SAAS;IAGd,cAAc,EAAE,cAAc,CAAA;IAC9B,YAAY,EAAE,YAAY,CAAA;IAC1B,KAAK,EAAE,KAAK,CAAA;IACZ,oBAAoB,EAAE,MAAM,CAAO;IAGnC,WAAW,EAAE,WAAW,CAAA;IACxB,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;IACnB,gBAAgB,EAAE,cAAc,CAAA;IAChC,iBAAiB,EAAE,UAAU,CAAA;IAC7B,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;;IAgD/B,KAAK;IAoCL,iBAAiB,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE;;;;KAAA;IAyBrD,kBAAkB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE;;;KAAA;IAkBzC,qBAAqB,CAAC,QAAQ,KAAA,EAAE,QAAQ,KAAA;IA2BxC,qBAAqB;IAqBrB;;OAEG;IACG,oBAAoB;IAqB1B,aAAa,CAAC,KAAK,EAAE,mBAAmB;IAUxC;;OAEG;IACH,wBAAwB;IAexB;;OAEG;IACH,oBAAoB;IAepB;;OAEG;IACH,gBAAgB,CAAC,IAAI,EAAE,QAAQ;IAO/B,WAAW,CAAC,UAAU,EAAE,UAAU;IAWlC,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;IAkB7D,gBAAgB,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,GAAE,OAAe;IAsErE,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC;IAmDtD,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAgB,GAAG,MAAM;CAM9C;AAKD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,IAAI,CAAA;KACpB;CACF"}
1
+ {"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../src/widgets/Grid.ts"],"names":[],"mappings":"AAGA,OAAO,IAAI,MAAM,2BAA2B,CAAA;AAI5C,OAAO,KAAK,cAAc,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAA;AAOnD,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,IAAI;IACpC,KAAK,SAAS;IAGd,cAAc,EAAE,cAAc,CAAA;IAC9B,YAAY,EAAE,YAAY,CAAA;IAC1B,KAAK,EAAE,KAAK,CAAA;IACZ,oBAAoB,EAAE,MAAM,CAAO;IAGnC,WAAW,EAAE,WAAW,CAAA;IACxB,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;IACnB,gBAAgB,EAAE,cAAc,CAAA;IAChC,iBAAiB,EAAE,UAAU,CAAA;IAC7B,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;;IAgD/B,KAAK;IAoCL,iBAAiB,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE;;;;KAAA;IAyBrD,kBAAkB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE;;;KAAA;IAkBzC,qBAAqB,CAAC,QAAQ,KAAA,EAAE,QAAQ,KAAA;IA2BxC,qBAAqB;IAqBrB;;OAEG;IACG,oBAAoB;IAqB1B,aAAa,CAAC,KAAK,EAAE,mBAAmB;IAUxC;;OAEG;IACH,wBAAwB;IAexB;;OAEG;IACH,oBAAoB;IAepB;;OAEG;IACH,gBAAgB,CAAC,IAAI,EAAE,QAAQ;IAO/B,WAAW,CAAC,UAAU,EAAE,UAAU;IAWlC,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;IAkB7D,gBAAgB,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,GAAE,OAAe;IAsErE,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC;IAmDtD,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAgB,GAAG,MAAM;CAM9C;AAKD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,IAAI,CAAA;KACpB;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@behold/widget",
3
- "version": "0.5.10",
3
+ "version": "0.5.12",
4
4
  "author": "Griffin Johnston",
5
5
  "license": "UNLICENSED",
6
6
  "keywords": [
@@ -35,7 +35,7 @@
35
35
  "build:rollup:prod": "npx rollup -c rollup.config.prod.js",
36
36
  "build:prod": "npm run build:setup && npm run build:rollup:prod",
37
37
  "build:dev": "npm run build:setup && npm run build:rollup:dev",
38
- "demo": "cp -r src/demo dist && http-server -p 8084 dist",
38
+ "demo": "cp -r src/demo dist && http-server -p 8085 dist",
39
39
  "deploy": "npm run build:prod && npm publish --access public"
40
40
  },
41
41
  "devDependencies": {
@@ -1 +0,0 @@
1
- import{c as t,p as s,g as i,s as e,a as o,h}from"./index-8GmY65W7.js";import{B as r,I as n,V as a,A as c,b as l,g as d}from"./base-n8LJb_Nn.js";import{c as p,a as u}from"./caret-right-xsqAZl9R.js";class g{containerEl;slideEls;height;gap;borderRadius;applyBorderRadiusToContainer;snapToSlide;bindToScrollPos;resizeObserver;onSlideChange;t;i;o;h;l;p;u;m;v;S;P;M;_;C;k;R;j;T;$;I;A;B;L;G;F;anchorSlide;finalAnchorSlide;constructor({onSlideChange:t}){this.h=[],this.l=!1,this.p=!1,this.u=!1,this.m=0,this.v=0,this.S=0,this.anchorSlide=0,this.P=0,this.M={start:0,previous:0},this._=[],this.C=0,this.T=1/60,this.$=3,this.I=2,this.borderRadius=20,this.applyBorderRadiusToContainer=!1,this.gap=20,this.height=300,this.snapToSlide=!1,this.bindToScrollPos=!1,this.k=40,this.R=0,this.j=0,this.A=window.innerHeight,this.B=null,this.L=0,this.G=()=>{},this.F=!1,this.onSlideChange=t;let s=window.ResizeObserver;"ResizeObserver"in window==0&&(s=window.BeholdResizeObserver),this.resizeObserver=new s((t=>this.handleResize(t))),this.handlePointerdown=this.handlePointerdown.bind(this),this.handlePointermove=this.handlePointermove.bind(this),this.handlePointerup=this.handlePointerup.bind(this)}init({containerEl:s,slideEls:i,height:e=300,gap:o=20,borderRadius:h=40,applyBorderRadiusToContainer:r=!0,snapToSlide:n=!1,bindToScrollPos:a=!1}){this.containerEl=s,this.slideEls=i.map((s=>t({classes:"ec-slide",contents:s}))),this.o=i,this.t=s.offsetWidth,this.i=s?.scrollWidth||0,this.updateSettings({height:e,gap:o,borderRadius:h,applyBorderRadiusToContainer:r,snapToSlide:n,bindToScrollPos:a}),this.addEventListeners(),this.containerEl.style.setProperty("--ec-container-width",`${this.t}px`),this.containerEl.beholdReplaceChildren(...this.slideEls),this.l=!0,this.loop()}updateSettings({height:t=300,gap:s=20,borderRadius:i=40,applyBorderRadiusToContainer:e=!0,snapToSlide:o=!1,bindToScrollPos:h=!1}){this.height=t,this.gap=s,this.borderRadius=Math.min(i/100*this.height,.45*this.t/2),this.k=Math.max(this.borderRadius,40),this.applyBorderRadiusToContainer=e,this.snapToSlide=o,this.bindToScrollPos=h,this.containerEl.style.setProperty("--ec-height",`${this.height}px`),this.containerEl.style.setProperty("--ec-border-radius",this.applyBorderRadiusToContainer?`${this.borderRadius}px`:"0px")}destroy(){this.l=!1,this.removeEventListeners(),this.slideEls?.length&&this.slideEls.forEach((t=>{t.remove()})),this.containerEl&&this.containerEl.remove(),this.slideEls=null,this.containerEl=null}handleResize(t){let s=null;t&&t.forEach((t=>{t.target===this.containerEl&&(s=t.borderBoxSize[0].inlineSize)})),this.updateDimensions(s),this.P=Math.max(Math.min(0,this.P),this.t-this.i)}addEventListeners(){this.removeEventListeners(),this.slideEls.length&&this.slideEls.forEach((t=>{this.resizeObserver.observe(t)})),this.containerEl&&(this.resizeObserver.observe(this.containerEl),this.containerEl.addEventListener("pointerdown",this.handlePointerdown),document.addEventListener("pointermove",this.handlePointermove,{passive:!0}),document.addEventListener("pointerup",this.handlePointerup),document.body.addEventListener("pointerleave",this.handlePointerup))}removeEventListeners(){this.resizeObserver.disconnect(),this.containerEl&&(this.containerEl.removeEventListener("pointerdown",this.handlePointerdown),document.removeEventListener("pointermove",this.handlePointermove),document.removeEventListener("pointerup",this.handlePointerup))}handlePointerdown(t){this.p=!0,this.v=this.S,this.P=this.S,this.M.start=t.clientX,this.M.previous=t.clientX,this.updateDimensions()}handlePointermove(t){if(!this.p)return;const i=t.clientX-this.M.start;Math.abs(i)>10&&this.containerEl.classList.add("ec-is-dragging"),this.P=this.v+i,s(this._,t.clientX-this.M.previous,10),this.M.previous=t.clientX}handlePointerup(){var t;this.containerEl.classList.remove("ec-is-dragging"),this.p=!1,this.P+=10*((t=this._).length?t.reduce(((t,s)=>t+s),0)/t.length:0),this.P=Math.max(Math.min(0,this.P),this.t-this.i),this.snapToSlide&&(this.P=-this.getClosestSlideToPoint(this.P).leftEdge)}updateDimensions(t){this.t=t||this.containerEl.offsetWidth;let s=0;this.h=this.slideEls.map(((t,i)=>{let e=t.offsetWidth,o=s;return s+=e,i<this.h.length-1&&(s+=this.gap),{width:e,x:o}})),this.i=s,this.finalAnchorSlide=this.getFinalAnchorSlide(),this.containerEl.style.setProperty("--ec-container-width",`${this.t}px`)}getAcceleration({displacement:t,m:s,stiffness:i=7,mass:e=17,friction:o=1.25}){let h=-i*t/e-o*s;return Math.abs(h)<.001&&(h=0),h*this.T}getClosestSlideToPoint(t){return this.h.reduce(((s,i,e)=>{const o=Math.abs(s.cumulativeWidth+t);return o<s.distanceFromTarget?{index:e,distanceFromTarget:o,leftEdge:s.cumulativeWidth,cumulativeWidth:s.cumulativeWidth+i.width+this.gap}:{...s,cumulativeWidth:s.cumulativeWidth+i.width+this.gap}}),{index:0,distanceFromTarget:1/0,leftEdge:0,cumulativeWidth:0})}getFinalAnchorSlide(){return this.slideEls.reduceRight(((t,s,i)=>(t.cumulativeWidth<this.t&&(t.index=i,t.cumulativeWidth+=this.h[i]?.width||0),t)),{index:0,cumulativeWidth:0}).index}updateScrollPos(){this.G(),this.G=i(this.containerEl,(t=>{this.t=t.width;const s=Math.max(Math.min((this.A-t.top)/(this.A+t.height),1),0);if(s!==this.L){this.u=!0;const t=this.L-s,i=this.A*t*.5;this.P+=i,this.P=Math.max(Math.min(0,this.P),this.t-this.i),this.L=s}this.B=t}))}updatePosition(){const t=this.S-this.P;let s=200,i=23,e=80;this.u&&(s=600,i=40,e=40),(0===this.P||this.P<=this.t-this.i)&&(s=100,i=16,e=45);const o=this.getAcceleration({displacement:t,m:this.m,stiffness:s,friction:i,mass:e});this.m+=o,this.S+=f(this.m)}getSlidePositions(){const t=f(this.S);let s=t,i=!1;const e=this.slideEls.map(((e,o)=>{const h=this.o[o],r=this.h[o]?.width;o>0&&(s+=this.h[o-1]?.width+this.gap);let n=0,a=0,c=0,l=0,d=Math.min(r*this.$,this.t);const p=this.h[o];p&&p.x+p.width*this.$>this.i&&(d=r*(this.slideEls.length-o)+Math.round(this.R));let u=Math.min(Math.max(d-Math.max(this.t-s+Math.round(this.R),0),0)/(d-this.k),1);const g=(r-this.k)*u;if(c=g,n=-g/2,l-=g,s<this.t&&s+r-c+this.gap>=this.t&&t<=0){const t=r-a-c,e=this.k-(this.t-s)<=0?t:this.t-s,h=this.t-(s+e);h>0&&!this.R&&(this.R=h*this.I,this.j=o+1,i=!0),e<this.k/2&&!this.R&&(this.R=(e+this.gap)*this.I,this.j=o+1,i=!0)}Math.round(s-this.gap)<=0&&Math.round(r+s)>0&&(o!==this.anchorSlide&&this.onSlideChange&&this.onSlideChange(o),this.anchorSlide=o),s<=0&&(a=Math.min(Math.abs(s),r-this.k),n=s/-2),this.F&&(s>this.t+250||s+r<-250?h.remove():h.isConnected||e.append(h));const f={el:e,contentEl:h,xPos:s,rightClipInset:c,leftClipInset:a,innerTranslate:n};return s+=l,f}));return i?this.getSlidePositions():e}positionSlides(){this.getSlidePositions().forEach((({el:t,contentEl:s,xPos:i,rightClipInset:e,leftClipInset:o,innerTranslate:h},r)=>{const n=Math.min(this.borderRadius,this.h[r]?.width/2);t.style.transform=`translate3d(${i}px, 0 ,0)`,t.style.clipPath=`inset(0 ${e}px 0 ${o}px round ${n}px)`,s.style.transform=`translate3d(${h}px, 0, 0)`}))}goToSlide(t){this.updateDimensions(),this.P=-this.h[t].x,this.P=Math.max(Math.min(0,this.P),this.t-this.i)}advance(){this.goToSlide(Math.min(this.getClosestSlideToPoint(this.P).index+1,this.slideEls.length-1))}retreat(){this.goToSlide(Math.max(this.getClosestSlideToPoint(this.P).index-1,0))}render(){this._.shift(),this.slideEls&&(this.bindToScrollPos&&this.updateScrollPos(),this.updatePosition(),this.positionSlides(),this.u=!1)}loop(){if(!this.l)return;const t=performance.now();t-this.C>16&&(this.render(),this.C=t),requestAnimationFrame((()=>this.loop()))}}function f(t,s=3){return parseFloat(t.toFixed(s))}class b extends r{label="ElasticCarousel";widgetSettings;feedMetadata;posts;previewLoadingColors=null;containerEl;footerEl;instagramLogoEl;sourceEl;controlsEl;leftArrowEl;rightArrowEl;innerEl;postEls;popoverGalleryEl;appliedBreakpoint;medianPaletteHSL;gyre;constructor(){super(),this.onPropChange(this.V,["widgetSettings","feedMetadata","posts","previewLoadingColors"],["widgetSettings","feedMetadata","posts"],this.setup),n.register(),a.register(),c.register(),this.gyre=new g({onSlideChange:t=>this.W(t)}),this.O=this.O.bind(this),this.addEventListener("post-focus-next",this.H),this.addEventListener("post-focus-previous",this.D),this.onConnect((()=>{this.innerEl=t({type:"div",classes:"ec-slides"}),this.footerEl=t({type:"footer",classes:"ec-footer"}),this.sourceEl=t({type:"div",classes:"ec-source"}),this.controlsEl=t({classes:"ec-controls"}),this.leftArrowEl=t({type:"button",classes:"ec-button ec-retreat",contents:[p],listeners:{click:()=>this.U()},attributes:{tabindex:-1,disabled:!0}}),this.rightArrowEl=t({type:"button",classes:"ec-button ec-advance",contents:[u],listeners:{click:()=>this.J()},attributes:{tabindex:-1}}),this.containerEl=t({type:"figure",classes:"ec-carousel",contents:[this.innerEl]}),this.renderWidget(this.containerEl,[l,'.ec-carousel{--ec-footer-margin:20px;--ec-button-border-radius:40%;--ec-icon-color:#4a4a4a;--ec-text-color:#4a4a4a;--ec-button-color:#f4f4f4;--ec-button-hover-color:#ececec;--ec-button-icon-color:#4a4a4a;--ec-button-icon-hover-color:#2e2e2e;display:flex;height:var(--ec-height);justify-content:center;margin:0;overflow:hidden;width:100%}.ec-carousel--controls-bottom,.ec-carousel--controls-top{flex-direction:column}.ec-slides{border-radius:var(--ec-border-radius);contain:style paint;cursor:grab;height:var(--ec-height);justify-content:flex-start;overflow:hidden;position:relative;touch-action:none;width:100%}.ec-slide,.ec-slides{display:flex;isolation:isolate}.ec-slide{contain:content;flex-shrink:0;height:100%;left:0;max-width:calc(var(--ec-container-width)*.45);position:absolute;top:0;-moz-user-select:none;user-select:none;-webkit-user-select:none;will-change:clip-path,transform}.ec-is-dragging{cursor:grabbing}.ec-is-dragging .ec-slide{pointer-events:none}.ec-footer{display:flex;justify-content:space-between}.ec-carousel--controls-top .ec-footer{margin-bottom:var(--ec-footer-margin)}.ec-carousel--controls-bottom .ec-footer{margin-top:var(--ec-footer-margin)}.ec-source{align-items:center;display:flex;flex-shrink:1;gap:7px 5px;line-height:1.2;min-width:0;overflow:hidden;text-overflow:ellipsis;-moz-user-select:none;user-select:none;-webkit-user-select:none}.ec-carousel--controls-justify-center .ec-source,.ec-carousel--controls-justify-split .ec-source{margin:0 max(calc(var(--ec-footer-margin)*1.5),20px)}.ec-source svg{flex-shrink:0;height:24px;margin-right:5px;width:24px}.ec-source svg path{fill:var(--ec-icon-color)}.ec-source a{color:var(--ec-text-color);display:inline-block;font-family:inherit;font-size:19px;overflow:hidden;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.ec-carousel--controls-justify-center .ec-footer{justify-content:center}.ec-controls{display:flex;flex-shrink:0;height:44px;width:auto}.ec-carousel--controls-justify-right .ec-controls{margin-left:auto}.ec-carousel--controls-justify-left .ec-controls{margin-right:auto}.ec-carousel--controls-justify-split .ec-controls{justify-content:space-between;width:100%}.ec-button{align-items:center;background-color:transparent;border:none;cursor:pointer;display:flex;flex-shrink:0;justify-content:center;padding:0;transition:all .3s ease;width:44px}.ec-carousel--controls-sides .ec-button{height:var(--ec-height);width:64px}.ec-button:disabled{cursor:default;opacity:.5}.ec-button:before{background-color:var(--ec-button-color);border-radius:var(--ec-button-border-radius);content:"";height:44px;position:absolute;transition:all .3s ease;width:44px}.ec-button:not(:disabled):hover:before{background-color:var(--ec-button-hover-color)}.ec-button svg{height:14px;position:relative;width:auto;z-index:1}.ec-button svg path{fill:var(--ec-button-icon-color);transition:all .3s ease}.ec-button:not(:disabled):hover svg path{fill:var(--ec-button-icon-hover-color)}.ec-retreat{padding-right:calc(var(--ec-footer-margin)/4)}.ec-advance,.ec-retreat{width:calc(44px + var(--ec-footer-margin)/4)}.ec-advance{padding-left:calc(var(--ec-footer-margin)/4)}.ec-carousel--controls-sides .ec-retreat{padding-right:20px}.ec-carousel--controls-sides .ec-advance{padding-left:20px}.post{height:100%;max-width:calc(var(--ec-container-width)*.45)}.post a{-webkit-user-drag:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.post--placeholder{background-color:#dedede;height:0;padding-bottom:calc(100%/var(--post-aspect-ratio))}']),this.setAttribute("tabindex","0"),this.setAttribute("aria-label","Gallery of Instagram posts. Shift + arrow keys to navigate"),this.onResize(this,this,this.q)}))}setup(){if("transparent"!==this.widgetSettings.loadingColor){const t=this.posts.filter((t=>t.colorPalette)).map((t=>t.colorPalette));this.medianPaletteHSL=d(t,this.widgetSettings.loadingColor)}const s=this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints);this.renderBreakpoint(s),e(this.containerEl,{"--ec-icon-color":this.widgetSettings.iconColor,"--ec-text-color":this.widgetSettings.textColor,"--ec-button-color":this.widgetSettings.buttonColor,"--ec-button-hover-color":this.widgetSettings.buttonHoverColor,"--ec-button-icon-color":this.widgetSettings.buttonIconColor,"--ec-button-icon-hover-color":this.widgetSettings.buttonIconHoverColor}),this.postEls.forEach((t=>{t.widgetSettings=this.widgetSettings,t.feedMetadata=this.feedMetadata}));const i=document.createElement("template");if(i.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M295.42,6c-53.2,2.51-89.53,11-121.29,23.48-32.87,12.81-60.73,30-88.45,57.82S40.89,143,28.17,175.92c-12.31,31.83-20.65,68.19-23,121.42S2.3,367.68,2.56,503.46,3.42,656.26,6,709.6c2.54,53.19,11,89.51,23.48,121.28,12.83,32.87,30,60.72,57.83,88.45S143,964.09,176,976.83c31.8,12.29,68.17,20.67,121.39,23s70.35,2.87,206.09,2.61,152.83-.86,206.16-3.39S799.1,988,830.88,975.58c32.87-12.86,60.74-30,88.45-57.84S964.1,862,976.81,829.06c12.32-31.8,20.69-68.17,23-121.35,2.33-53.37,2.88-70.41,2.62-206.17s-.87-152.78-3.4-206.1-11-89.53-23.47-121.32c-12.85-32.87-30-60.7-57.82-88.45S862,40.87,829.07,28.19c-31.82-12.31-68.17-20.7-121.39-23S637.33,2.3,501.54,2.56,348.75,3.4,295.42,6m5.84,903.88c-48.75-2.12-75.22-10.22-92.86-17-23.36-9-40-19.88-57.58-37.29s-28.38-34.11-37.5-57.42c-6.85-17.64-15.1-44.08-17.38-92.83-2.48-52.69-3-68.51-3.29-202s.22-149.29,2.53-202c2.08-48.71,10.23-75.21,17-92.84,9-23.39,19.84-40,37.29-57.57s34.1-28.39,57.43-37.51c17.62-6.88,44.06-15.06,92.79-17.38,52.73-2.5,68.53-3,202-3.29s149.31.21,202.06,2.53c48.71,2.12,75.22,10.19,92.83,17,23.37,9,40,19.81,57.57,37.29s28.4,34.07,37.52,57.45c6.89,17.57,15.07,44,17.37,92.76,2.51,52.73,3.08,68.54,3.32,202s-.23,149.31-2.54,202c-2.13,48.75-10.21,75.23-17,92.89-9,23.35-19.85,40-37.31,57.56s-34.09,28.38-57.43,37.5c-17.6,6.87-44.07,15.07-92.76,17.39-52.73,2.48-68.53,3-202.05,3.29s-149.27-.25-202-2.53m407.6-674.61a60,60,0,1,0,59.88-60.1,60,60,0,0,0-59.88,60.1M245.77,503c.28,141.8,115.44,256.49,257.21,256.22S759.52,643.8,759.25,502,643.79,245.48,502,245.76,245.5,361.22,245.77,503m90.06-.18a166.67,166.67,0,1,1,167,166.34,166.65,166.65,0,0,1-167-166.34" transform="translate(-2.5 -2.5)"/><title>Instagram</title></svg>',this.feedMetadata.hashtags?.length){const s=this.feedMetadata.hashtags.map(((s,i,e)=>t({type:"a",contents:["#",s,i<e.length-1?", ":""],attributes:{target:"_blank",href:`https://instagram.com/explore/tags/${s}`}})));this.sourceEl.beholdReplaceChildren(i.content,...s)}else{const s=t({type:"a",contents:[this.feedMetadata.username],attributes:{target:"_blank",href:`https://instagram.com/${this.feedMetadata.username}`}});this.sourceEl.beholdReplaceChildren(i.content,s)}"openPopupGallery"===this.widgetSettings.onPostClick&&this.enablePopoverGallery()}W(t){0===t&&this.leftArrowEl?this.leftArrowEl.disabled=!0:this.leftArrowEl.disabled=!1,t>=this.gyre.finalAnchorSlide?this.rightArrowEl.disabled=!0:this.rightArrowEl.disabled=!1}V({changedProp:t,oldValue:s,newValue:i}){switch(t){case"posts":this.N({oldValue:s,newValue:i});break;case"widgetSettings":this.K(s,i);break;case"feedMetadata":this.X();break;case"previewLoadingColors":this.postEls.forEach((t=>{t.previewLoadingColors=this.previewLoadingColors})),o(this,{"is-previewing-loading-colors":!!this.previewLoadingColors})}}N({oldValue:t,newValue:s}){this.postEls=[],this.renderBreakpoint(this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints),!0),this.popoverGalleryEl&&(this.popoverGalleryEl.posts=this.posts)}K(t,s){let i=!1;this.postEls?.length&&!h(t.breakpoints,s.breakpoints,["postHeight"],1)||(i=!0),e(this.containerEl,{"--ec-icon-color":this.widgetSettings.iconColor,"--ec-text-color":this.widgetSettings.textColor,"--ec-button-color":this.widgetSettings.buttonColor,"--ec-button-hover-color":this.widgetSettings.buttonHoverColor,"--ec-button-icon-color":this.widgetSettings.buttonIconColor,"--ec-button-icon-hover-color":this.widgetSettings.buttonIconHoverColor}),"openPopupGallery"!==t?.onPostClick&&"openPopupGallery"===s?.onPostClick&&this.enablePopoverGallery();const o=this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints);this.renderBreakpoint(o,i),this.postEls.forEach((t=>{t.widgetSettings=this.widgetSettings})),this.popoverGalleryEl&&(this.popoverGalleryEl.widgetSettings=this.widgetSettings)}X(){let t=`from @${this.feedMetadata.username}`;this.feedMetadata.hashtags?.length&&(t=`from hashtag${this.feedMetadata.hashtags.length>1?"s":""} ${this.feedMetadata.hashtags.join(", ")}`),this.setAttribute("aria-label",`Gallery of Instagram posts ${t}. Shift + arrow keys to navigate`),this.postEls.forEach((t=>{t.feedMetadata=this.feedMetadata})),this.popoverGalleryEl&&(this.popoverGalleryEl.feedMetadata=this.feedMetadata)}async enablePopoverGallery(){if(this.popoverGalleryEl)return;const{default:t}=await import("./PopoverGallery-zJPbgntZ.js");t.register(),this.popoverGalleryEl=document.createElement("behold-popover-gallery"),Object.assign(this.popoverGalleryEl,{widgetSettings:this.widgetSettings,feedMetadata:this.feedMetadata,posts:this.posts,closeFocusEl:this,onSlideChange:t=>{this.gyre.goToSlide(t),this.popoverGalleryEl.closeFocusEl=this.postEls[t]}})}q(t){const s=t.contentBoxSize?.[0]?.inlineSize,i=this.widgetSettings.breakpoints,e=this.getMatchingBreakpoint(s,i);this.renderBreakpoint(e)}D(){if(!this.postEls.length)return;let t=[...this.postEls].indexOf(this.shadow.activeElement?.parentElement);t>0&&(t-=1),this.postEls[t].focus(),this.gyre.goToSlide(t)}H(){if(!this.postEls.length)return;let t=[...this.postEls].indexOf(this.shadow.activeElement?.parentElement);this.gyre.anchorSlide>0&&t<this.gyre.anchorSlide&&(t=this.gyre.anchorSlide),t>-1&&t<this.postEls.length-1&&(t+=1),t<0&&(t=0),this.postEls[t].focus(),this.gyre.goToSlide(t)}O(t){this.popoverGalleryEl.open(this.postEls.indexOf(t),t)}J(){this.gyre&&this.gyre.advance()}U(){this.gyre&&this.gyre.retreat()}renderPosts(t){this.postEls=this.createPostEls(t),this.raf((()=>{this.gyre.init({containerEl:this.innerEl,slideEls:this.postEls,height:t.postHeight,gap:t.gap.x,borderRadius:parseInt(t.borderRadius),applyBorderRadiusToContainer:t.applyBorderRadiusToContainer||!0,snapToSlide:t.snapToSlide||!1,bindToScrollPos:t.bindToScrollPos||!1})}),"renderPosts")}getMatchingBreakpoint(t,s){return Object.entries(s).map((([t,s])=>({width:t,...s}))).filter((t=>"default"!==t.width)).sort(((t,s)=>parseInt(s.width)-parseInt(t.width))).reduce(((s,i)=>t<=parseInt(i.width)?i:s),s.default)}renderBreakpoint(t,s=!1){if(!this.posts||!this.containerEl)return;const i=this.appliedBreakpoint,{showControls:r,controlsPosition:n,controlsJustification:a,showUsername:c,buttonBorderRadius:l,footerMargin:d}=t;this.postEls?.length&&!h(i,t,["numPosts","forcePostAspectRatio","postAspectRatio"])||(s=!0),this.widgetSettings.maxWidth&&this.widgetSettings.constrainWidth&&this.containerEl.style.maxWidth!==`${this.widgetSettings.maxWidth}px`&&(this.containerEl.style.maxWidth=`${this.widgetSettings.maxWidth}px`),this.widgetSettings.constrainWidth||(this.containerEl.style.maxWidth=""),this.leftArrowEl.remove(),this.rightArrowEl.remove(),(h(i,t,["showControls","controlsPosition","controlsJustification"])||r&&!this.leftArrowEl.isConnected)&&(this.leftArrowEl.remove(),this.rightArrowEl.remove(),this.sourceEl.remove(),this.controlsEl.remove(),this.footerEl.remove(),r&&(e(this.containerEl,{"--ec-button-border-radius":`${l}%`,"--ec-footer-margin":`${d}px`}),o(this.containerEl,{"ec-carousel--controls-sides":"sides"===n,"ec-carousel--controls-top":"top"===n,"ec-carousel--controls-bottom":"bottom"===n,"ec-carousel--controls-justify-right":"right"===a,"ec-carousel--controls-justify-center":"center"===a,"ec-carousel--controls-justify-left":"left"===a,"ec-carousel--controls-justify-split":"split"===a}),"sides"===n&&(this.containerEl.prepend(this.leftArrowEl),this.containerEl.append(this.rightArrowEl)),"top,bottom".includes(n)&&(this.controlsEl.append(this.leftArrowEl,this.rightArrowEl),this.footerEl.append(this.controlsEl)),c&&"top,bottom".includes(n)&&"left"===a&&this.footerEl.append(this.sourceEl),c&&"top,bottom".includes(n)&&"right"===a&&this.footerEl.prepend(this.sourceEl),c&&"top,bottom".includes(n)&&"center,split".includes(a)&&this.leftArrowEl.after(this.sourceEl),"bottom".includes(n)&&this.containerEl.append(this.footerEl),"top".includes(n)&&this.containerEl.prepend(this.footerEl))),this.containerEl.setAttribute("data-hover-effect",this.widgetSettings.hoverEffect),s?this.renderPosts(t):this.gyre.updateSettings({height:t.postHeight,gap:t.gap.x,borderRadius:parseInt(t.borderRadius),applyBorderRadiusToContainer:t.applyBorderRadiusToContainer,snapToSlide:t.snapToSlide,bindToScrollPos:t.bindToScrollPos}),this.appliedBreakpoint=t}createPostEls(s){const{numPosts:i,postHeight:e,postAspectRatio:o,forcePostAspectRatio:h}=s,r=this.posts.filter(((t,i)=>i<(s?.numPosts||this.posts?.length||200))),n=r.map(((s,n)=>{const a=[s.sizes.full.width,s.sizes.full.height],c=h?o||[1,1]:a,l=c.reduce(((t,s)=>t/s));let d="behold-image-post";return"VIDEO"===s.mediaType&&(d="behold-video-post"),"CAROUSEL_ALBUM"===s.mediaType&&(d="behold-album-post"),t({type:d,props:{post:s,widgetSettings:this.widgetSettings,feedMetadata:this.feedMetadata,medianPaletteHSL:this.medianPaletteHSL,onClick:this.O,hasRowGap:!0,isLastRow:!1,index:n,aspectRatio:c,totalPosts:r?.length||i||this.posts?.length||0},style:{width:e*l+"px","--post-aspect-ratio":l}})}));for(;n.length<s.numPosts;){const s=t({classes:"post post--placeholder",style:{width:`${e}px`,"--post-aspect-ratio":1}});n.push(s)}return n}static register(t="behold-elastic-carousel"){return customElements.get(t)||customElements.define(t,b),t}}export{b as default};