@vtex/ads-stories 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +250 -26
  3. package/dist/cdn/vtex-ads-stories.js +986 -72
  4. package/dist/cdn/vtex-ads-stories.js.map +1 -1
  5. package/dist/cjs/index.cjs +2911 -403
  6. package/dist/cjs/index.cjs.map +1 -1
  7. package/dist/cjs/index.d.cts +193 -8
  8. package/dist/cjs/react.cjs.map +1 -1
  9. package/dist/cjs/react.d.cts +45 -5
  10. package/dist/esm/index.d.ts +193 -8
  11. package/dist/esm/index.js +2528 -121
  12. package/dist/esm/index.js.map +1 -1
  13. package/dist/esm/react.d.ts +45 -5
  14. package/package.json +18 -4
  15. package/src/cdn.ts +7 -3
  16. package/src/components/card/card.ts +64 -12
  17. package/src/components/carousel/carousel.ts +670 -0
  18. package/src/components/carousel/index.ts +15 -0
  19. package/src/components/events/events-controller.ts +212 -0
  20. package/src/components/events/index.ts +6 -0
  21. package/src/components/icons/assets/caret-left-bold.svg +1 -0
  22. package/src/components/icons/assets/caret-right-bold.svg +1 -0
  23. package/src/components/icons/assets/caret-up-bold.svg +1 -0
  24. package/src/components/icons/index.ts +6 -0
  25. package/src/components/media/index.ts +2 -1
  26. package/src/components/media/media.ts +21 -17
  27. package/src/components/media/video-controller.ts +47 -0
  28. package/src/components/player/index.ts +6 -2
  29. package/src/components/player/player.ts +797 -48
  30. package/src/components/product/cta.ts +56 -0
  31. package/src/components/product/index.ts +20 -0
  32. package/src/components/product/price.ts +86 -0
  33. package/src/components/product/product.styles.ts +369 -0
  34. package/src/components/product/product.ts +235 -0
  35. package/src/index.ts +9 -1
  36. package/src/locales/en.ts +29 -0
  37. package/src/locales/es.ts +30 -0
  38. package/src/locales/index.ts +36 -0
  39. package/src/locales/pt.ts +29 -0
  40. package/src/locales/types.ts +24 -0
  41. package/src/react.ts +49 -7
  42. package/src/story/index.ts +5 -1
  43. package/src/story/story.ts +505 -47
  44. package/src/tag-name.ts +1 -0
  45. package/src/types.ts +8 -12
  46. package/src/utils/fetch-story.ts +113 -0
  47. package/src/utils/http-url.ts +12 -0
  48. package/src/utils/hydrate-products.ts +88 -0
  49. package/src/utils/send-event.ts +71 -0
  50. package/src/utils/with-timeout.ts +43 -0
@@ -1,38 +1,487 @@
1
- "use strict";var VtexAdsStories=(()=>{var pe=Object.defineProperty;var pt=Object.getOwnPropertyDescriptor;var ct=Object.getOwnPropertyNames;var ut=Object.prototype.hasOwnProperty;var ft=(i,e)=>{for(var t in e)pe(i,t,{get:e[t],enumerable:!0})},mt=(i,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ct(e))!ut.call(i,o)&&o!==t&&pe(i,o,{get:()=>e[o],enumerable:!(s=pt(e,o))||s.enumerable});return i};var yt=i=>mt(pe({},"__esModule",{value:!0}),i);var Dt={};ft(Dt,{TAG_NAME:()=>F,VtexAdsStoryElement:()=>O,defineVtexAdsStories:()=>Y});var Q=globalThis,X=Q.ShadowRoot&&(Q.ShadyCSS===void 0||Q.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ce=Symbol(),Me=new WeakMap,R=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==ce)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(X&&e===void 0){let s=t!==void 0&&t.length===1;s&&(e=Me.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&Me.set(t,e))}return e}toString(){return this.cssText}},Te=i=>new R(typeof i=="string"?i:i+"",void 0,ce),x=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((s,o,r)=>s+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+i[r+1],i[0]);return new R(t,i,ce)},Le=(i,e)=>{if(X)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let s=document.createElement("style"),o=Q.litNonce;o!==void 0&&s.setAttribute("nonce",o),s.textContent=t.cssText,i.appendChild(s)}},ue=X?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let s of e.cssRules)t+=s.cssText;return Te(t)})(i):i;var{is:gt,defineProperty:$t,getOwnPropertyDescriptor:vt,getOwnPropertyNames:_t,getOwnPropertySymbols:bt,getPrototypeOf:At}=Object,_=globalThis,Oe=_.trustedTypes,xt=Oe?Oe.emptyScript:"",fe=_.reactiveElementPolyfillSupport,U=(i,e)=>i,me={toAttribute(i,e){switch(e){case Boolean:i=i?xt:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch(s){t=null}}return t}},Re=(i,e)=>!gt(i,e),Pe={attribute:!0,type:String,converter:me,reflect:!1,useDefault:!1,hasChanged:Re},He,Ve;(He=Symbol.metadata)!=null||(Symbol.metadata=Symbol("metadata")),(Ve=_.litPropertyMetadata)!=null||(_.litPropertyMetadata=new WeakMap);var y=class extends HTMLElement{static addInitializer(e){var t;this._$Ei(),((t=this.l)!=null?t:this.l=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Pe){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let s=Symbol(),o=this.getPropertyDescriptor(e,s,t);o!==void 0&&$t(this.prototype,e,o)}}static getPropertyDescriptor(e,t,s){var n;let{get:o,set:r}=(n=vt(this.prototype,e))!=null?n:{get(){return this[t]},set(l){this[t]=l}};return{get:o,set(l){let a=o==null?void 0:o.call(this);r==null||r.call(this,l),this.requestUpdate(e,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){var t;return(t=this.elementProperties.get(e))!=null?t:Pe}static _$Ei(){if(this.hasOwnProperty(U("elementProperties")))return;let e=At(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(U("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(U("properties"))){let t=this.properties,s=[..._t(t),...bt(t)];for(let o of s)this.createProperty(o,t[o])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[s,o]of t)this.elementProperties.set(s,o)}this._$Eh=new Map;for(let[t,s]of this.elementProperties){let o=this._$Eu(t,s);o!==void 0&&this._$Eh.set(o,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let s=new Set(e.flat(1/0).reverse());for(let o of s)t.unshift(ue(o))}else e!==void 0&&t.push(ue(e));return t}static _$Eu(e,t){let s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t,s;((t=this._$EO)!=null?t:this._$EO=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&((s=e.hostConnected)==null||s.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){var t;let e=(t=this.shadowRoot)!=null?t:this.attachShadow(this.constructor.shadowRootOptions);return Le(e,this.constructor.elementStyles),e}connectedCallback(){var e,t;(e=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(s=>{var o;return(o=s.hostConnected)==null?void 0:o.call(s)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var s;return(s=t.hostDisconnected)==null?void 0:s.call(t)})}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){var r;let s=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,s);if(o!==void 0&&s.reflect===!0){let n=(((r=s.converter)==null?void 0:r.toAttribute)!==void 0?s.converter:me).toAttribute(t,s.type);this._$Em=e,n==null?this.removeAttribute(o):this.setAttribute(o,n),this._$Em=null}}_$AK(e,t){var r,n,l;let s=this.constructor,o=s._$Eh.get(e);if(o!==void 0&&this._$Em!==o){let a=s.getPropertyOptions(o),d=typeof a.converter=="function"?{fromAttribute:a.converter}:((r=a.converter)==null?void 0:r.fromAttribute)!==void 0?a.converter:me;this._$Em=o;let p=d.fromAttribute(t,a.type);this[o]=(l=p!=null?p:(n=this._$Ej)==null?void 0:n.get(o))!=null?l:p,this._$Em=null}}requestUpdate(e,t,s,o=!1,r){var n,l;if(e!==void 0){let a=this.constructor;if(o===!1&&(r=this[e]),s!=null||(s=a.getPropertyOptions(e)),!(((n=s.hasChanged)!=null?n:Re)(r,t)||s.useDefault&&s.reflect&&r===((l=this._$Ej)==null?void 0:l.get(e))&&!this.hasAttribute(a._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:o,wrapped:r},n){var l,a,d;s&&!((l=this._$Ej)!=null?l:this._$Ej=new Map).has(e)&&(this._$Ej.set(e,(a=n!=null?n:t)!=null?a:this[e]),r!==!0||n!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),o===!0&&this._$Em!==e&&((d=this._$Eq)!=null?d:this._$Eq=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var s,o;if(!this.isUpdatePending)return;if(!this.hasUpdated){if((s=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[n,l]of this._$Ep)this[n]=l;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[n,l]of r){let{wrapped:a}=l,d=this[n];a!==!0||this._$AL.has(n)||d===void 0||this.C(n,void 0,l,d)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(o=this._$EO)==null||o.forEach(r=>{var n;return(n=r.hostUpdate)==null?void 0:n.call(r)}),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(s=>{var o;return(o=s.hostUpdated)==null?void 0:o.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}},ke;y.elementStyles=[],y.shadowRootOptions={mode:"open"},y[U("elementProperties")]=new Map,y[U("finalized")]=new Map,fe==null||fe({ReactiveElement:y}),((ke=_.reactiveElementVersions)!=null?ke:_.reactiveElementVersions=[]).push("2.1.2");var D=globalThis,Ue=i=>i,ee=D.trustedTypes,Ne=ee?ee.createPolicy("lit-html",{createHTML:i=>i}):void 0,$e="$lit$",g=`lit$${Math.random().toFixed(9).slice(2)}$`,ve="?"+g,wt=`<${ve}>`,C=document,B=()=>C.createComment(""),I=i=>i===null||typeof i!="object"&&typeof i!="function",_e=Array.isArray,Ge=i=>_e(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",ye=`[
2
- \f\r]`,N=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,De=/-->/g,Be=/>/g,w=RegExp(`>|${ye}(?:([^\\s"'>=/]+)(${ye}*=${ye}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Ie=/'/g,ze=/"/g,qe=/^(?:script|style|textarea|title)$/i,be=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),u=be(1),Gt=be(2),qt=be(3),$=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),je=new WeakMap,E=C.createTreeWalker(C,129);function We(i,e){if(!_e(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ne!==void 0?Ne.createHTML(e):e}var Ke=(i,e)=>{let t=i.length-1,s=[],o,r=e===2?"<svg>":e===3?"<math>":"",n=N;for(let l=0;l<t;l++){let a=i[l],d,p,c=-1,m=0;for(;m<a.length&&(n.lastIndex=m,p=n.exec(a),p!==null);)m=n.lastIndex,n===N?p[1]==="!--"?n=De:p[1]!==void 0?n=Be:p[2]!==void 0?(qe.test(p[2])&&(o=RegExp("</"+p[2],"g")),n=w):p[3]!==void 0&&(n=w):n===w?p[0]===">"?(n=o!=null?o:N,c=-1):p[1]===void 0?c=-2:(c=n.lastIndex-p[2].length,d=p[1],n=p[3]===void 0?w:p[3]==='"'?ze:Ie):n===ze||n===Ie?n=w:n===De||n===Be?n=N:(n=w,o=void 0);let v=n===w&&i[l+1].startsWith("/>")?" ":"";r+=n===N?a+wt:c>=0?(s.push(d),a.slice(0,c)+$e+a.slice(c)+g+v):a+g+(c===-2?l:v)}return[We(i,r+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]},z=class i{constructor({strings:e,_$litType$:t},s){let o;this.parts=[];let r=0,n=0,l=e.length-1,a=this.parts,[d,p]=Ke(e,t);if(this.el=i.createElement(d,s),E.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(o=E.nextNode())!==null&&a.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let c of o.getAttributeNames())if(c.endsWith($e)){let m=p[n++],v=o.getAttribute(c).split(g),J=/([.?@])?(.*)/.exec(m);a.push({type:1,index:r,name:J[2],strings:v,ctor:J[1]==="."?se:J[1]==="?"?ie:J[1]==="@"?oe:M}),o.removeAttribute(c)}else c.startsWith(g)&&(a.push({type:6,index:r}),o.removeAttribute(c));if(qe.test(o.tagName)){let c=o.textContent.split(g),m=c.length-1;if(m>0){o.textContent=ee?ee.emptyScript:"";for(let v=0;v<m;v++)o.append(c[v],B()),E.nextNode(),a.push({type:2,index:++r});o.append(c[m],B())}}}else if(o.nodeType===8)if(o.data===ve)a.push({type:2,index:r});else{let c=-1;for(;(c=o.data.indexOf(g,c+1))!==-1;)a.push({type:7,index:r}),c+=g.length-1}r++}}static createElement(e,t){let s=C.createElement("template");return s.innerHTML=e,s}};function S(i,e,t=i,s){var n,l,a;if(e===$)return e;let o=s!==void 0?(n=t._$Co)==null?void 0:n[s]:t._$Cl,r=I(e)?void 0:e._$litDirective$;return(o==null?void 0:o.constructor)!==r&&((l=o==null?void 0:o._$AO)==null||l.call(o,!1),r===void 0?o=void 0:(o=new r(i),o._$AT(i,t,s)),s!==void 0?((a=t._$Co)!=null?a:t._$Co=[])[s]=o:t._$Cl=o),o!==void 0&&(e=S(i,o._$AS(i,e.values),o,s)),e}var te=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var d;let{el:{content:t},parts:s}=this._$AD,o=((d=e==null?void 0:e.creationScope)!=null?d:C).importNode(t,!0);E.currentNode=o;let r=E.nextNode(),n=0,l=0,a=s[0];for(;a!==void 0;){if(n===a.index){let p;a.type===2?p=new P(r,r.nextSibling,this,e):a.type===1?p=new a.ctor(r,a.name,a.strings,this,e):a.type===6&&(p=new re(r,this,e)),this._$AV.push(p),a=s[++l]}n!==(a==null?void 0:a.index)&&(r=E.nextNode(),n++)}return E.currentNode=C,o}p(e){let t=0;for(let s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}},P=class i{get _$AU(){var e,t;return(t=(e=this._$AM)==null?void 0:e._$AU)!=null?t:this._$Cv}constructor(e,t,s,o){var r;this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=o,this._$Cv=(r=o==null?void 0:o.isConnected)!=null?r:!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=S(this,e,t),I(e)?e===h||e==null||e===""?(this._$AH!==h&&this._$AR(),this._$AH=h):e!==this._$AH&&e!==$&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ge(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==h&&I(this._$AH)?this._$AA.nextSibling.data=e:this.T(C.createTextNode(e)),this._$AH=e}$(e){var r;let{values:t,_$litType$:s}=e,o=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=z.createElement(We(s.h,s.h[0]),this.options)),s);if(((r=this._$AH)==null?void 0:r._$AD)===o)this._$AH.p(t);else{let n=new te(o,this),l=n.u(this.options);n.p(t),this.T(l),this._$AH=n}}_$AC(e){let t=je.get(e.strings);return t===void 0&&je.set(e.strings,t=new z(e)),t}k(e){_e(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,s,o=0;for(let r of e)o===t.length?t.push(s=new i(this.O(B()),this.O(B()),this,this.options)):s=t[o],s._$AI(r),o++;o<t.length&&(this._$AR(s&&s._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,t);e!==this._$AB;){let o=Ue(e).nextSibling;Ue(e).remove(),e=o}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},M=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,o,r){this.type=1,this._$AH=h,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=h}_$AI(e,t=this,s,o){let r=this.strings,n=!1;if(r===void 0)e=S(this,e,t,0),n=!I(e)||e!==this._$AH&&e!==$,n&&(this._$AH=e);else{let l=e,a,d;for(e=r[0],a=0;a<r.length-1;a++)d=S(this,l[s+a],t,a),d===$&&(d=this._$AH[a]),n||(n=!I(d)||d!==this._$AH[a]),d===h?e=h:e!==h&&(e+=(d!=null?d:"")+r[a+1]),this._$AH[a]=d}n&&!o&&this.j(e)}j(e){e===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e!=null?e:"")}},se=class extends M{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===h?void 0:e}},ie=class extends M{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==h)}},oe=class extends M{constructor(e,t,s,o,r){super(e,t,s,o,r),this.type=5}_$AI(e,t=this){var n;if((e=(n=S(this,e,t,0))!=null?n:h)===$)return;let s=this._$AH,o=e===h&&s!==h||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,r=e!==h&&(s===h||o);o&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,s;typeof this._$AH=="function"?this._$AH.call((s=(t=this.options)==null?void 0:t.host)!=null?s:this.element,e):this._$AH.handleEvent(e)}},re=class{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){S(this,e)}},Fe={M:$e,P:g,A:ve,C:1,L:Ke,R:te,D:Ge,V:S,I:P,H:M,N:ie,U:oe,B:se,F:re},ge=D.litHtmlPolyfillSupport,Ze;ge==null||ge(z,P),((Ze=D.litHtmlVersions)!=null?Ze:D.litHtmlVersions=[]).push("3.3.3");var Ye=(i,e,t)=>{var r,n;let s=(r=t==null?void 0:t.renderBefore)!=null?r:e,o=s._$litPart$;if(o===void 0){let l=(n=t==null?void 0:t.renderBefore)!=null?n:null;s._$litPart$=o=new P(e.insertBefore(B(),l),l,void 0,t!=null?t:{})}return o._$AI(i),o};var T=globalThis,b=class extends y{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,s;let e=super.createRenderRoot();return(s=(t=this.renderOptions).renderBefore)!=null||(t.renderBefore=e.firstChild),e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ye(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return $}},Je;b._$litElement$=!0,b.finalized=!0,(Je=T.litElementHydrateSupport)==null||Je.call(T,{LitElement:b});var Ae=T.litElementPolyfillSupport;Ae==null||Ae({LitElement:b});var Qe;((Qe=T.litElementVersions)!=null?Qe:T.litElementVersions=[]).push("4.2.2");var ne={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},j=i=>(...e)=>({_$litDirective$:i,values:e}),H=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,s){this._$Ct=e,this._$AM=t,this._$Ci=s}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var Z=class extends H{constructor(e){if(super(e),this.it=h,e.type!==ne.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===h||e==null)return this._t=void 0,this.it=e;if(e===$)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};Z.directiveName="unsafeHTML",Z.resultType=1;var Xe=j(Z);var et=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"/></svg>
4
- `;var tt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M152,96V48a8,8,0,0,1,16,0V88h40a8,8,0,0,1,0,16H160A8,8,0,0,1,152,96ZM96,152H48a8,8,0,0,0,0,16H88v40a8,8,0,0,0,16,0V160A8,8,0,0,0,96,152Zm112,0H160a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V168h40a8,8,0,0,0,0-16ZM96,40a8,8,0,0,0-8,8V88H48a8,8,0,0,0,0,16H96a8,8,0,0,0,8-8V48A8,8,0,0,0,96,40Z"/></svg>
5
- `;var st=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,48V88a8,8,0,0,1-16,0V56H168a8,8,0,0,1,0-16h40A8,8,0,0,1,216,48ZM88,200H56V168a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H88a8,8,0,0,0,0-16Zm120-40a8,8,0,0,0-8,8v32H168a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V168A8,8,0,0,0,208,160ZM88,40H48a8,8,0,0,0-8,8V88a8,8,0,0,0,16,0V56H88a8,8,0,0,0,0-16Z"/></svg>
6
- `;var it=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,48V208a16,16,0,0,1-16,16H160a16,16,0,0,1-16-16V48a16,16,0,0,1,16-16h40A16,16,0,0,1,216,48ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Z"/></svg>
7
- `;var ot=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,128a15.74,15.74,0,0,1-7.6,13.51L88.32,229.65a16,16,0,0,1-16.2.3A15.86,15.86,0,0,1,64,216.13V39.87a15.86,15.86,0,0,1,8.12-13.82,16,16,0,0,1,16.2.3L232.4,114.49A15.74,15.74,0,0,1,240,128Z"/></svg>
8
- `;var rt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M245.66,146.34a8,8,0,0,1-11.32,11.32L216,139.31l-18.34,18.35a8,8,0,0,1-11.32-11.32L204.69,128l-18.35-18.34a8,8,0,0,1,11.32-11.32L216,116.69l18.34-18.35a8,8,0,0,1,11.32,11.32L227.31,128ZM60,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H60a4,4,0,0,0,4-4V84A4,4,0,0,0,60,80Zm97.15-54.15a8,8,0,0,0-10-.16l-65.57,51A4,4,0,0,0,80,79.84v96.32a4,4,0,0,0,1.55,3.15l65.57,51a8,8,0,0,0,9,.56,8.29,8.29,0,0,0,3.91-7.18V32.25A8.27,8.27,0,0,0,157.12,25.85Z"/></svg>
9
- `;var nt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M160,32.25V223.69a8.29,8.29,0,0,1-3.91,7.18,8,8,0,0,1-9-.56l-65.57-51A4,4,0,0,1,80,176.16V79.84a4,4,0,0,1,1.55-3.15l65.57-51a8,8,0,0,1,10,.16A8.27,8.27,0,0,1,160,32.25ZM60,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H60a4,4,0,0,0,4-4V84A4,4,0,0,0,60,80Zm126.77,20.84a8,8,0,0,0-.72,11.3,24,24,0,0,1,0,31.72,8,8,0,1,0,12,10.58,40,40,0,0,0,0-52.88A8,8,0,0,0,186.74,100.84Zm40.89-26.17a8,8,0,1,0-11.92,10.66,64,64,0,0,1,0,85.34,8,8,0,1,0,11.92,10.66,80,80,0,0,0,0-106.66Z"/></svg>
10
- `;var Pt={close:et,collapse:tt,expand:st,pause:it,play:ot,soundOff:rt,soundOn:nt},Ht=Object.fromEntries(Object.entries(Pt).map(([i,e])=>[i,e.replace("<svg",'<svg class="icon" aria-hidden="true" focusable="false"')]));function A(i){return Xe(Ht[i])}var{I:Ms}=Fe;var at=i=>i.strings===void 0;var G=(i,e)=>{var s;let t=i._$AN;if(t===void 0)return!1;for(let o of t)(s=o._$AO)==null||s.call(o,e,!1),G(o,e);return!0},ae=i=>{let e,t;do{if((e=i._$AM)===void 0)break;t=e._$AN,t.delete(i),i=e}while((t==null?void 0:t.size)===0)},lt=i=>{for(let e;e=i._$AM;i=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(i))break;t.add(i),Rt(e)}};function Vt(i){this._$AN!==void 0?(ae(this),this._$AM=i,lt(this)):this._$AM=i}function kt(i,e=!1,t=0){let s=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(e)if(Array.isArray(s))for(let r=t;r<s.length;r++)G(s[r],!1),ae(s[r]);else s!=null&&(G(s,!1),ae(s));else G(this,i)}var Rt=i=>{var e,t;i.type==ne.CHILD&&((e=i._$AP)!=null||(i._$AP=kt),(t=i._$AQ)!=null||(i._$AQ=Vt))},le=class extends H{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,s){super._$AT(e,t,s),lt(this),this.isConnected=e._$AU}_$AO(e,t=!0){var s,o;e!==this.isConnected&&(this.isConnected=e,e?(s=this.reconnected)==null||s.call(this):(o=this.disconnected)==null||o.call(this)),t&&(G(this,e),ae(this))}setValue(e){if(at(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var V=()=>new we,we=class{},xe=new WeakMap,k=j(class extends le{render(i){return h}update(i,[e]){var s;let t=e!==this.G;return t&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=(s=i.options)==null?void 0:s.host,this.rt(this.ct=i.element)),h}rt(i){var e;if(this.G!==void 0)if(this.isConnected||(i=void 0),typeof this.G=="function"){let t=(e=this.ht)!=null?e:globalThis,s=xe.get(t);s===void 0&&(s=new WeakMap,xe.set(t,s)),s.get(this.G)!==void 0&&this.G.call(this.ht,void 0),s.set(this.G,i),i!==void 0&&this.G.call(this.ht,i)}else this.G.value=i}get lt(){var i,e,t;return typeof this.G=="function"?(e=xe.get((i=this.ht)!=null?i:globalThis))==null?void 0:e.get(this.G):(t=this.G)==null?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});function he(i){if(!i)return null;try{let{protocol:e}=new URL(i);return e==="https:"||e==="http:"?i:null}catch(e){return null}}function Ut(){var i,e;return(e=(i=globalThis.matchMedia)==null?void 0:i.call(globalThis,"(prefers-reduced-motion: reduce)").matches)!=null?e:!1}function q(i,e){return!e.failed&&he(i.media_url)!==null}function W(i,e){let t=he(i.poster_url),s=he(i.media_url);return u`
11
- ${t?u`<img class="poster" alt="" src=${t} />`:h}
12
- ${s&&!e.failed?u`
1
+ "use strict";var VtexAdsStories=(()=>{var Oe=Object.defineProperty;var Ir=Object.getOwnPropertyDescriptor;var Nr=Object.getOwnPropertyNames;var Hr=Object.prototype.hasOwnProperty;var Vr=(o,e)=>{for(var t in e)Oe(o,t,{get:e[t],enumerable:!0})},Dr=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Nr(e))!Hr.call(o,i)&&i!==t&&Oe(o,i,{get:()=>e[i],enumerable:!(r=Ir(e,i))||r.enumerable});return o};var Ur=o=>Dr(Oe({},"__esModule",{value:!0}),o);var li={};Vr(li,{TAG_NAME:()=>$,VtexAdsStoryCarouselElement:()=>R,defineVtexAdsStoryCarousel:()=>ce});var pe=globalThis,ue=pe.ShadowRoot&&(pe.ShadyCSS===void 0||pe.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Me=Symbol(),lt=new WeakMap,Z=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Me)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(ue&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=lt.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&lt.set(t,e))}return e}toString(){return this.cssText}},ct=o=>new Z(typeof o=="string"?o:o+"",void 0,Me),g=(o,...e)=>{let t=o.length===1?o[0]:e.reduce((r,i,s)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[s+1],o[0]);return new Z(t,o,Me)},pt=(o,e)=>{if(ue)o.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=pe.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,o.appendChild(r)}},Re=ue?o=>o:o=>o instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return ct(t)})(o):o;var{is:Br,defineProperty:Fr,getOwnPropertyDescriptor:zr,getOwnPropertyNames:qr,getOwnPropertySymbols:jr,getPrototypeOf:Wr}=Object,T=globalThis,ut=T.trustedTypes,Gr=ut?ut.emptyScript:"",Le=T.reactiveElementPolyfillSupport,X=(o,e)=>o,Ie={toAttribute(o,e){switch(e){case Boolean:o=o?Gr:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,e){let t=o;switch(e){case Boolean:t=o!==null;break;case Number:t=o===null?null:Number(o);break;case Object:case Array:try{t=JSON.parse(o)}catch(r){t=null}}return t}},vt=(o,e)=>!Br(o,e),ht={attribute:!0,type:String,converter:Ie,reflect:!1,useDefault:!1,hasChanged:vt},ft,mt;(ft=Symbol.metadata)!=null||(Symbol.metadata=Symbol("metadata")),(mt=T.litPropertyMetadata)!=null||(T.litPropertyMetadata=new WeakMap);var _=class extends HTMLElement{static addInitializer(e){var t;this._$Ei(),((t=this.l)!=null?t:this.l=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=ht){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&Fr(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){var n;let{get:i,set:s}=(n=zr(this.prototype,e))!=null?n:{get(){return this[t]},set(a){this[t]=a}};return{get:i,set(a){let d=i==null?void 0:i.call(this);s==null||s.call(this,a),this.requestUpdate(e,d,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){var t;return(t=this.elementProperties.get(e))!=null?t:ht}static _$Ei(){if(this.hasOwnProperty(X("elementProperties")))return;let e=Wr(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(X("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(X("properties"))){let t=this.properties,r=[...qr(t),...jr(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift(Re(i))}else e!==void 0&&t.push(Re(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t,r;((t=this._$EO)!=null?t:this._$EO=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&((r=e.hostConnected)==null||r.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){var t;let e=(t=this.shadowRoot)!=null?t:this.attachShadow(this.constructor.shadowRootOptions);return pt(e,this.constructor.elementStyles),e}connectedCallback(){var e,t;(e=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(r=>{var i;return(i=r.hostConnected)==null?void 0:i.call(r)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var r;return(r=t.hostDisconnected)==null?void 0:r.call(t)})}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){var s;let r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){let n=(((s=r.converter)==null?void 0:s.toAttribute)!==void 0?r.converter:Ie).toAttribute(t,r.type);this._$Em=e,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(e,t){var s,n,a;let r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let d=r.getPropertyOptions(i),l=typeof d.converter=="function"?{fromAttribute:d.converter}:((s=d.converter)==null?void 0:s.fromAttribute)!==void 0?d.converter:Ie;this._$Em=i;let p=l.fromAttribute(t,d.type);this[i]=(a=p!=null?p:(n=this._$Ej)==null?void 0:n.get(i))!=null?a:p,this._$Em=null}}requestUpdate(e,t,r,i=!1,s){var n,a;if(e!==void 0){let d=this.constructor;if(i===!1&&(s=this[e]),r!=null||(r=d.getPropertyOptions(e)),!(((n=r.hasChanged)!=null?n:vt)(s,t)||r.useDefault&&r.reflect&&s===((a=this._$Ej)==null?void 0:a.get(e))&&!this.hasAttribute(d._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:s},n){var a,d,l;r&&!((a=this._$Ej)!=null?a:this._$Ej=new Map).has(e)&&(this._$Ej.set(e,(d=n!=null?n:t)!=null?d:this[e]),s!==!0||n!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&((l=this._$Eq)!=null?l:this._$Eq=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var r,i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if((r=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[n,a]of this._$Ep)this[n]=a;this._$Ep=void 0}let s=this.constructor.elementProperties;if(s.size>0)for(let[n,a]of s){let{wrapped:d}=a,l=this[n];d!==!0||this._$AL.has(n)||l===void 0||this.C(n,void 0,a,l)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(i=this._$EO)==null||i.forEach(s=>{var n;return(n=s.hostUpdate)==null?void 0:n.call(s)}),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(r=>{var i;return(i=r.hostUpdated)==null?void 0:i.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}},yt;_.elementStyles=[],_.shadowRootOptions={mode:"open"},_[X("elementProperties")]=new Map,_[X("finalized")]=new Map,Le==null||Le({ReactiveElement:_}),((yt=T.reactiveElementVersions)!=null?yt:T.reactiveElementVersions=[]).push("2.1.2");var Q=globalThis,gt=o=>o,he=Q.trustedTypes,bt=he?he.createPolicy("lit-html",{createHTML:o=>o}):void 0,Ve="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,De="?"+C,Kr=`<${De}>`,H=document,J=()=>H.createComment(""),ee=o=>o===null||typeof o!="object"&&typeof o!="function",Ue=Array.isArray,Ct=o=>Ue(o)||typeof(o==null?void 0:o[Symbol.iterator])=="function",Ne=`[
2
+ \f\r]`,Y=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,xt=/-->/g,wt=/>/g,I=RegExp(`>|${Ne}(?:([^\\s"'>=/]+)(${Ne}*=${Ne}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),$t=/'/g,St=/"/g,Et=/^(?:script|style|textarea|title)$/i,Be=o=>(e,...t)=>({_$litType$:o,strings:e,values:t}),m=Be(1),mi=Be(2),yi=Be(3),b=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),At=new WeakMap,N=H.createTreeWalker(H,129);function Pt(o,e){if(!Ue(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return bt!==void 0?bt.createHTML(e):e}var Tt=(o,e)=>{let t=o.length-1,r=[],i,s=e===2?"<svg>":e===3?"<math>":"",n=Y;for(let a=0;a<t;a++){let d=o[a],l,p,c=-1,h=0;for(;h<d.length&&(n.lastIndex=h,p=n.exec(d),p!==null);)h=n.lastIndex,n===Y?p[1]==="!--"?n=xt:p[1]!==void 0?n=wt:p[2]!==void 0?(Et.test(p[2])&&(i=RegExp("</"+p[2],"g")),n=I):p[3]!==void 0&&(n=I):n===I?p[0]===">"?(n=i!=null?i:Y,c=-1):p[1]===void 0?c=-2:(c=n.lastIndex-p[2].length,l=p[1],n=p[3]===void 0?I:p[3]==='"'?St:$t):n===St||n===$t?n=I:n===xt||n===wt?n=Y:(n=I,i=void 0);let u=n===I&&o[a+1].startsWith("/>")?" ":"";s+=n===Y?d+Kr:c>=0?(r.push(l),d.slice(0,c)+Ve+d.slice(c)+C+u):d+C+(c===-2?a:u)}return[Pt(o,s+(o[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},te=class o{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,n=0,a=e.length-1,d=this.parts,[l,p]=Tt(e,t);if(this.el=o.createElement(l,r),N.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(i=N.nextNode())!==null&&d.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let c of i.getAttributeNames())if(c.endsWith(Ve)){let h=p[n++],u=i.getAttribute(c).split(C),y=/([.?@])?(.*)/.exec(h);d.push({type:1,index:s,name:y[2],strings:u,ctor:y[1]==="."?me:y[1]==="?"?ye:y[1]==="@"?ve:D}),i.removeAttribute(c)}else c.startsWith(C)&&(d.push({type:6,index:s}),i.removeAttribute(c));if(Et.test(i.tagName)){let c=i.textContent.split(C),h=c.length-1;if(h>0){i.textContent=he?he.emptyScript:"";for(let u=0;u<h;u++)i.append(c[u],J()),N.nextNode(),d.push({type:2,index:++s});i.append(c[h],J())}}}else if(i.nodeType===8)if(i.data===De)d.push({type:2,index:s});else{let c=-1;for(;(c=i.data.indexOf(C,c+1))!==-1;)d.push({type:7,index:s}),c+=C.length-1}s++}}static createElement(e,t){let r=H.createElement("template");return r.innerHTML=e,r}};function V(o,e,t=o,r){var n,a,d;if(e===b)return e;let i=r!==void 0?(n=t._$Co)==null?void 0:n[r]:t._$Cl,s=ee(e)?void 0:e._$litDirective$;return(i==null?void 0:i.constructor)!==s&&((a=i==null?void 0:i._$AO)==null||a.call(i,!1),s===void 0?i=void 0:(i=new s(o),i._$AT(o,t,r)),r!==void 0?((d=t._$Co)!=null?d:t._$Co=[])[r]=i:t._$Cl=i),i!==void 0&&(e=V(o,i._$AS(o,e.values),i,r)),e}var fe=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var l;let{el:{content:t},parts:r}=this._$AD,i=((l=e==null?void 0:e.creationScope)!=null?l:H).importNode(t,!0);N.currentNode=i;let s=N.nextNode(),n=0,a=0,d=r[0];for(;d!==void 0;){if(n===d.index){let p;d.type===2?p=new F(s,s.nextSibling,this,e):d.type===1?p=new d.ctor(s,d.name,d.strings,this,e):d.type===6&&(p=new ge(s,this,e)),this._$AV.push(p),d=r[++a]}n!==(d==null?void 0:d.index)&&(s=N.nextNode(),n++)}return N.currentNode=H,i}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},F=class o{get _$AU(){var e,t;return(t=(e=this._$AM)==null?void 0:e._$AU)!=null?t:this._$Cv}constructor(e,t,r,i){var s;this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=(s=i==null?void 0:i.isConnected)!=null?s:!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=V(this,e,t),ee(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==b&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ct(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==f&&ee(this._$AH)?this._$AA.nextSibling.data=e:this.T(H.createTextNode(e)),this._$AH=e}$(e){var s;let{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=te.createElement(Pt(r.h,r.h[0]),this.options)),r);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(t);else{let n=new fe(i,this),a=n.u(this.options);n.p(t),this.T(a),this._$AH=n}}_$AC(e){let t=At.get(e.strings);return t===void 0&&At.set(e.strings,t=new te(e)),t}k(e){Ue(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let s of e)i===t.length?t.push(r=new o(this.O(J()),this.O(J()),this,this.options)):r=t[i],r._$AI(s),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,t);e!==this._$AB;){let i=gt(e).nextSibling;gt(e).remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},D=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,s){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=f}_$AI(e,t=this,r,i){let s=this.strings,n=!1;if(s===void 0)e=V(this,e,t,0),n=!ee(e)||e!==this._$AH&&e!==b,n&&(this._$AH=e);else{let a=e,d,l;for(e=s[0],d=0;d<s.length-1;d++)l=V(this,a[r+d],t,d),l===b&&(l=this._$AH[d]),n||(n=!ee(l)||l!==this._$AH[d]),l===f?e=f:e!==f&&(e+=(l!=null?l:"")+s[d+1]),this._$AH[d]=l}n&&!i&&this.j(e)}j(e){e===f?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e!=null?e:"")}},me=class extends D{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===f?void 0:e}},ye=class extends D{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==f)}},ve=class extends D{constructor(e,t,r,i,s){super(e,t,r,i,s),this.type=5}_$AI(e,t=this){var n;if((e=(n=V(this,e,t,0))!=null?n:f)===b)return;let r=this._$AH,i=e===f&&r!==f||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,s=e!==f&&(r===f||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,r;typeof this._$AH=="function"?this._$AH.call((r=(t=this.options)==null?void 0:t.host)!=null?r:this.element,e):this._$AH.handleEvent(e)}},ge=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){V(this,e)}},kt={M:Ve,P:C,A:De,C:1,L:Tt,R:fe,D:Ct,V,I:F,H:D,N:ye,U:ve,B:me,F:ge},He=Q.litHtmlPolyfillSupport,_t;He==null||He(te,F),((_t=Q.litHtmlVersions)!=null?_t:Q.litHtmlVersions=[]).push("3.3.3");var Ot=(o,e,t)=>{var s,n;let r=(s=t==null?void 0:t.renderBefore)!=null?s:e,i=r._$litPart$;if(i===void 0){let a=(n=t==null?void 0:t.renderBefore)!=null?n:null;r._$litPart$=i=new F(e.insertBefore(J(),a),a,void 0,t!=null?t:{})}return i._$AI(o),i};var U=globalThis,k=class extends _{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,r;let e=super.createRenderRoot();return(r=(t=this.renderOptions).renderBefore)!=null||(t.renderBefore=e.firstChild),e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ot(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return b}},Mt;k._$litElement$=!0,k.finalized=!0,(Mt=U.litElementHydrateSupport)==null||Mt.call(U,{LitElement:k});var Fe=U.litElementPolyfillSupport;Fe==null||Fe({LitElement:k});var Rt;((Rt=U.litElementVersions)!=null?Rt:U.litElementVersions=[]).push("4.2.2");var{I:Zr}=kt,Lt=o=>o;var Nt=o=>o.strings===void 0,It=()=>document.createComment(""),z=(o,e,t)=>{var s;let r=o._$AA.parentNode,i=e===void 0?o._$AB:e._$AA;if(t===void 0){let n=r.insertBefore(It(),i),a=r.insertBefore(It(),i);t=new Zr(n,a,o,o.options)}else{let n=t._$AB.nextSibling,a=t._$AM,d=a!==o;if(d){let l;(s=t._$AQ)==null||s.call(t,o),t._$AM=o,t._$AP!==void 0&&(l=o._$AU)!==a._$AU&&t._$AP(l)}if(n!==i||d){let l=t._$AA;for(;l!==n;){let p=Lt(l).nextSibling;Lt(r).insertBefore(l,i),l=p}}}return t},O=(o,e,t=o)=>(o._$AI(e,t),o),Xr={},Ht=(o,e=Xr)=>o._$AH=e,Vt=o=>o._$AH,be=o=>{o._$AR(),o._$AA.remove()};var M={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},E=o=>(...e)=>({_$litDirective$:o,values:e}),S=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var re=(o,e)=>{var r;let t=o._$AN;if(t===void 0)return!1;for(let i of t)(r=i._$AO)==null||r.call(i,e,!1),re(i,e);return!0},xe=o=>{let e,t;do{if((e=o._$AM)===void 0)break;t=e._$AN,t.delete(o),o=e}while((t==null?void 0:t.size)===0)},Dt=o=>{for(let e;e=o._$AM;o=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(o))break;t.add(o),Jr(e)}};function Yr(o){this._$AN!==void 0?(xe(this),this._$AM=o,Dt(this)):this._$AM=o}function Qr(o,e=!1,t=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(r))for(let s=t;s<r.length;s++)re(r[s],!1),xe(r[s]);else r!=null&&(re(r,!1),xe(r));else re(this,o)}var Jr=o=>{var e,t;o.type==M.CHILD&&((e=o._$AP)!=null||(o._$AP=Qr),(t=o._$AQ)!=null||(o._$AQ=Yr))},we=class extends S{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),Dt(this),this.isConnected=e._$AU}_$AO(e,t=!0){var r,i;e!==this.isConnected&&(this.isConnected=e,e?(r=this.reconnected)==null||r.call(this):(i=this.disconnected)==null||i.call(this)),t&&(re(this,e),xe(this))}setValue(e){if(Nt(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var P=()=>new qe,qe=class{},ze=new WeakMap,x=E(class extends we{render(o){return f}update(o,[e]){var r;let t=e!==this.G;return t&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=(r=o.options)==null?void 0:r.host,this.rt(this.ct=o.element)),f}rt(o){var e;if(this.G!==void 0)if(this.isConnected||(o=void 0),typeof this.G=="function"){let t=(e=this.ht)!=null?e:globalThis,r=ze.get(t);r===void 0&&(r=new WeakMap,ze.set(t,r)),r.get(this.G)!==void 0&&this.G.call(this.ht,void 0),r.set(this.G,o),o!==void 0&&this.G.call(this.ht,o)}else this.G.value=o}get lt(){var o,e,t;return typeof this.G=="function"?(e=ze.get((o=this.ht)!=null?o:globalThis))==null?void 0:e.get(this.G):(t=this.G)==null?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var oe=class extends S{constructor(e){if(super(e),this.it=f,e.type!==M.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===f||e==null)return this._t=void 0,this.it=e;if(e===b)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};oe.directiveName="unsafeHTML",oe.resultType=1;var Ut=E(oe);var Bt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M168.49,199.51a12,12,0,0,1-17,17l-80-80a12,12,0,0,1,0-17l80-80a12,12,0,0,1,17,17L97,128Z"/></svg>
4
+ `;var Ft=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z"/></svg>
5
+ `;var zt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"/></svg>
6
+ `;var qt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"/></svg>';var jt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M152,96V48a8,8,0,0,1,16,0V88h40a8,8,0,0,1,0,16H160A8,8,0,0,1,152,96ZM96,152H48a8,8,0,0,0,0,16H88v40a8,8,0,0,0,16,0V160A8,8,0,0,0,96,152Zm112,0H160a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V168h40a8,8,0,0,0,0-16ZM96,40a8,8,0,0,0-8,8V88H48a8,8,0,0,0,0,16H96a8,8,0,0,0,8-8V48A8,8,0,0,0,96,40Z"/></svg>
7
+ `;var Wt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,48V88a8,8,0,0,1-16,0V56H168a8,8,0,0,1,0-16h40A8,8,0,0,1,216,48ZM88,200H56V168a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H88a8,8,0,0,0,0-16Zm120-40a8,8,0,0,0-8,8v32H168a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V168A8,8,0,0,0,208,160ZM88,40H48a8,8,0,0,0-8,8V88a8,8,0,0,0,16,0V56H88a8,8,0,0,0,0-16Z"/></svg>
8
+ `;var Gt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,48V208a16,16,0,0,1-16,16H160a16,16,0,0,1-16-16V48a16,16,0,0,1,16-16h40A16,16,0,0,1,216,48ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Z"/></svg>
9
+ `;var Kt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,128a15.74,15.74,0,0,1-7.6,13.51L88.32,229.65a16,16,0,0,1-16.2.3A15.86,15.86,0,0,1,64,216.13V39.87a15.86,15.86,0,0,1,8.12-13.82,16,16,0,0,1,16.2.3L232.4,114.49A15.74,15.74,0,0,1,240,128Z"/></svg>
10
+ `;var Zt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M245.66,146.34a8,8,0,0,1-11.32,11.32L216,139.31l-18.34,18.35a8,8,0,0,1-11.32-11.32L204.69,128l-18.35-18.34a8,8,0,0,1,11.32-11.32L216,116.69l18.34-18.35a8,8,0,0,1,11.32,11.32L227.31,128ZM60,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H60a4,4,0,0,0,4-4V84A4,4,0,0,0,60,80Zm97.15-54.15a8,8,0,0,0-10-.16l-65.57,51A4,4,0,0,0,80,79.84v96.32a4,4,0,0,0,1.55,3.15l65.57,51a8,8,0,0,0,9,.56,8.29,8.29,0,0,0,3.91-7.18V32.25A8.27,8.27,0,0,0,157.12,25.85Z"/></svg>
11
+ `;var Xt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M160,32.25V223.69a8.29,8.29,0,0,1-3.91,7.18,8,8,0,0,1-9-.56l-65.57-51A4,4,0,0,1,80,176.16V79.84a4,4,0,0,1,1.55-3.15l65.57-51a8,8,0,0,1,10,.16A8.27,8.27,0,0,1,160,32.25ZM60,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H60a4,4,0,0,0,4-4V84A4,4,0,0,0,60,80Zm126.77,20.84a8,8,0,0,0-.72,11.3,24,24,0,0,1,0,31.72,8,8,0,1,0,12,10.58,40,40,0,0,0,0-52.88A8,8,0,0,0,186.74,100.84Zm40.89-26.17a8,8,0,1,0-11.92,10.66,64,64,0,0,1,0,85.34,8,8,0,1,0,11.92,10.66,80,80,0,0,0,0-106.66Z"/></svg>
12
+ `;var po={caretUp:qt,close:zt,collapse:jt,expand:Wt,next:Ft,pause:Gt,play:Kt,previous:Bt,soundOff:Zt,soundOn:Xt},uo=Object.fromEntries(Object.entries(po).map(([o,e])=>[o,e.replace("<svg",'<svg class="icon" aria-hidden="true" focusable="false"')]));function v(o){return Ut(uo[o])}function w(o){if(!o)return null;try{let{protocol:e}=new URL(o);return e==="https:"||e==="http:"?o:null}catch(e){return null}}function $e(){var o,e;return(e=(o=globalThis.matchMedia)==null?void 0:o.call(globalThis,"(prefers-reduced-motion: reduce)").matches)!=null?e:!1}function q(o,e){return!e.failed&&w(o.media_url)!==null}function ie(o,e,{withVideo:t=!0,loop:r=!0,onEnded:i}={}){let s=w(o.poster_url),n=t?w(o.media_url):null;return m`
13
+ ${s?m`<img class="poster" alt="" src=${s} />`:f}
14
+ ${n&&!e.failed?m`
13
15
  <video
14
16
  class="video"
15
17
  muted
16
18
  playsinline
17
- loop
19
+ ?loop=${r}
18
20
  preload="metadata"
19
21
  .muted=${!0}
20
- ?autoplay=${!Ut()}
21
- poster=${t!=null?t:h}
22
- src=${s}
23
- ${k(e.ref)}
22
+ ?autoplay=${!$e()}
23
+ poster=${s!=null?s:f}
24
+ src=${n}
25
+ ${x(e.ref)}
24
26
  @play=${e.sync}
25
27
  @pause=${e.sync}
26
28
  @volumechange=${e.sync}
27
29
  @error=${e.fail}
30
+ @ended=${i}
28
31
  ></video>
29
- `:h}
30
- `}function de(i){var e;(e=i.play())==null||e.catch(()=>{})}var L=class{constructor(e){this.host=e;this.ref=V();this.paused=!0;this.muted=!0;this.failed=!1;this.sync=()=>{let e=this.ref.value;e&&(this.paused=e.paused,this.muted=e.muted,this.host.requestUpdate())};this.fail=()=>{this.failed=!0,this.host.requestUpdate()}}reset(){this.paused=!0,this.muted=!0,this.failed=!1}play(){let e=this.ref.value;e&&de(e)}pause(){var e;(e=this.ref.value)==null||e.pause()}resume(){let e=this.ref.value;e!=null&&e.autoplay&&de(e)}togglePlayback(){let e=this.ref.value;e&&(e.paused?de(e):e.pause())}toggleMuted(){let e=this.ref.value;e&&(e.muted=!e.muted)}};var Ee=x`
32
+ `:f}
33
+ `}function j(o){var e;(e=o.play())==null||e.catch(()=>{})}var B=class{constructor(e){this.host=e;this.ref=P();this.paused=!0;this.muted=!0;this.failed=!1;this.sync=()=>{let e=this.ref.value;e&&(this.paused=e.paused,this.muted=e.muted,this.host.requestUpdate())};this.fail=()=>{this.failed=!0,this.host.requestUpdate()}}get playing(){let e=this.ref.value;return!!e&&e.isConnected&&!e.paused}reset(){this.paused=!0,this.muted=!0,this.failed=!1}play(){let e=this.ref.value;e&&j(e)}pause(){var e;(e=this.ref.value)==null||e.pause()}resume(){let e=this.ref.value;e!=null&&e.autoplay&&j(e)}togglePlayback(){let e=this.ref.value;e&&(e.paused?j(e):e.pause())}mute(){let e=this.ref.value;e&&(e.muted=!0)}restart({withSound:e=!1}={}){let t=this.ref.value;t&&(t.currentTime=0,e?this.playWithSound():j(t))}playWithSound(){var t;let e=this.ref.value;e&&(e.muted=!1,(t=e.play())==null||t.catch(r=>{!(r instanceof DOMException&&r.name==="NotAllowedError")||this.ref.value!==e||!e.isConnected||(e.muted=!0,j(e))}))}toggleMuted(){let e=this.ref.value;e&&(e.muted=!e.muted)}};var Se="pt-BR";function Yt(o){let e=Number.NaN;return typeof o=="number"?e=o:typeof o=="string"&&o.trim()!==""&&(e=Number(o)),Number.isFinite(e)&&e>0?e:void 0}function We(o){let e=Yt(o==null?void 0:o.price),t=Yt(o==null?void 0:o.promotional_price);return t!==void 0&&(e===void 0||t<e)?e===void 0?{price:t}:{price:t,listPrice:e}:e===void 0?void 0:{price:e}}function ho(o){try{return Intl.NumberFormat.supportedLocalesOf(o).length>0}catch(e){return!1}}var je=Intl;function fo(o){var t;if(!/^[a-z]{3}$/i.test(o))return!1;let e=(t=je.supportedValuesOf)==null?void 0:t.call(je,"currency");return e?e.includes(o.toUpperCase()):!0}function Ge(o,e){let t=new Intl.NumberFormat(o&&ho(o)?o:Se,{style:"currency",currency:e&&fo(e)?e:"BRL"});return r=>t.format(r)}function Ke(o,e,t,r){var p,c,h,u;let i=o.product,s=(p=i==null?void 0:i.product_name)==null?void 0:p.trim();if(!i||!s)return;let n={name:s,imageUrl:(c=w(i.image_url))!=null?c:void 0,url:(h=w(o.destination_url))!=null?h:void 0};if(r==="loading")return{...n,label:t.product(s),isLoading:!0};if((r==null?void 0:r.available)===!1)return{...n,label:t.product(s,t.soldOut),soldOut:t.soldOut};let a=(u=r==null?void 0:r.price)!=null?u:We(i.product_metadata),d=a&&e(a.price),l=(a==null?void 0:a.listPrice)===void 0?void 0:e(a.listPrice);return{...n,price:d,listPrice:l,label:t.product(s,d,l)}}var mo=m`
34
+ <span
35
+ class="product-price product-loading product-price-loading"
36
+ aria-hidden="true"
37
+ ></span>
38
+ `,yo=m`
39
+ <span
40
+ class="product-loading product-add-to-cart-loading"
41
+ aria-hidden="true"
42
+ ></span>
43
+ `;function vo({isLoading:o,soldOut:e,price:t,listPrice:r}){return o?mo:e?m`<span class="product-price product-sold-out">${e}</span>`:t?m`
44
+ <span class="product-price">
45
+ <span>${t}</span>
46
+ ${r?m`<s class="product-list-price">${r}</s>`:f}
47
+ </span>
48
+ `:f}function Qt(o){return m`
49
+ ${o.imageUrl?m`<img class="product-image" alt="" src=${o.imageUrl} />`:f}
50
+ <span class="product-info">
51
+ <span class="product-name">${o.name}</span>
52
+ ${vo(o)}
53
+ </span>
54
+ `}function Ze(o,e){return m`
55
+ <button
56
+ type="button"
57
+ class="card-product"
58
+ aria-label=${o.label}
59
+ @click=${e}
60
+ >
61
+ ${Qt(o)}
62
+ </button>
63
+ `}function go({isLoading:o,soldOut:e},{labels:t}){return o?yo:e?m`
64
+ <button type="button" class="product-action product-unavailable" disabled>
65
+ ${t.unavailable}
66
+ </button>
67
+ `:m`
68
+ <button type="button" class="product-action product-add-to-cart">
69
+ ${t.addToCart}
70
+ </button>
71
+ `}function Xe(o,e){let{open:t}=e;return m`
72
+ <div class="card-product product-expandable" ?data-open=${t}>
73
+ <button
74
+ type="button"
75
+ class="product-summary"
76
+ aria-label=${o.label}
77
+ aria-expanded=${t?"true":"false"}
78
+ aria-controls=${e.panelId}
79
+ @click=${e.onToggle}
80
+ >
81
+ ${Qt(o)}
82
+ <span class="product-toggle">${v("caretUp")}</span>
83
+ </button>
84
+ <div id=${e.panelId} class="product-panel" ?inert=${!t}>
85
+ <div class="product-actions">
86
+ ${go(o,e)}
87
+ ${o.url?m`
88
+ <a
89
+ class="product-action product-view"
90
+ href=${o.url}
91
+ target="_blank"
92
+ rel="noopener noreferrer"
93
+ >
94
+ ${e.labels.viewProduct}
95
+ </a>
96
+ `:f}
97
+ </div>
98
+ </div>
99
+ </div>
100
+ `}function Ae(o){var r;if(o.product)return;let e=(r=o.call_to_action)==null?void 0:r.trim(),t=w(o.destination_url);return e&&t?{label:e,url:t}:void 0}function se(o,e){let t=e?r=>{r.preventDefault(),e()}:void 0;return m`
101
+ <a
102
+ class="card-cta"
103
+ href=${o.url}
104
+ target="_blank"
105
+ rel="noopener noreferrer"
106
+ @click=${t}
107
+ >
108
+ <span class="cta-label">${o.label}</span>
109
+ ${v("next")}
110
+ </a>
111
+ `}var Ye=g`
112
+ /* A glass pill at the bottom of the card, above its button: the product or
113
+ the call to action. */
114
+ .card-product,
115
+ .card-cta {
116
+ position: absolute;
117
+ right: 12px;
118
+ bottom: 12px;
119
+ left: 12px;
120
+ z-index: 1;
121
+ display: flex;
122
+ gap: 8px;
123
+ align-items: center;
124
+ box-sizing: border-box;
125
+ padding: 8px;
126
+ border: 0;
127
+ border-radius: 16px;
128
+ background: rgba(255, 255, 255, 0.15);
129
+ backdrop-filter: blur(5px);
130
+ color: #fff;
131
+ font: inherit;
132
+ text-align: left;
133
+ isolation: isolate;
134
+ transition: transform 0.2s ease;
135
+ }
136
+
137
+ /* The glass's tint and inner light, darker on hover. */
138
+ .card-product::before,
139
+ .card-cta::before {
140
+ position: absolute;
141
+ inset: 0;
142
+ z-index: -1;
143
+ border-radius: inherit;
144
+ background: rgba(0, 0, 0, 0.15);
145
+ box-shadow: inset 0 0 3px rgba(255, 255, 255, 0.42);
146
+ content: "";
147
+ transition: background-color 0.2s ease;
148
+ }
149
+
150
+ button.card-product,
151
+ .card-cta {
152
+ cursor: pointer;
153
+ }
154
+
155
+ .card-product:focus-visible,
156
+ .card-cta:focus-visible {
157
+ outline: 2px solid #fff;
158
+ outline-offset: 2px;
159
+ }
160
+
161
+ @media (hover: hover) and (pointer: fine) {
162
+ .card-product:hover,
163
+ .card-cta:hover {
164
+ transform: translateY(-2px);
165
+ }
166
+
167
+ .card-product:hover::before,
168
+ .card-cta:hover::before {
169
+ background: rgba(0, 0, 0, 0.32);
170
+ }
171
+ }
172
+
173
+ /* A Story with a link: the pill is the call to action, its text centered
174
+ with a caret after it. */
175
+ .card-cta {
176
+ justify-content: center;
177
+ gap: 6px;
178
+ height: 48px;
179
+ padding: 0 16px;
180
+ font-size: 14px;
181
+ font-weight: 700;
182
+ line-height: 1;
183
+ text-decoration: none;
184
+ }
185
+
186
+ .cta-label {
187
+ min-width: 0;
188
+ overflow: hidden;
189
+ text-overflow: ellipsis;
190
+ white-space: nowrap;
191
+ }
192
+
193
+ .card-cta .icon {
194
+ flex: none;
195
+ width: 14px;
196
+ height: 14px;
197
+ }
198
+
199
+ /* In the player: the pill is a toggle, with the actions panel below. */
200
+ .product-expandable {
201
+ display: block;
202
+ padding: 0;
203
+ transition:
204
+ background-color 0.3s ease,
205
+ color 0.3s ease,
206
+ box-shadow 0.3s ease,
207
+ transform 0.2s ease;
208
+ }
209
+
210
+ .product-expandable::before {
211
+ transition:
212
+ opacity 0.3s ease,
213
+ background-color 0.2s ease;
214
+ }
215
+
216
+ .product-summary {
217
+ display: flex;
218
+ gap: 8px;
219
+ align-items: center;
220
+ box-sizing: border-box;
221
+ width: 100%;
222
+ padding: 8px;
223
+ border: 0;
224
+ border-radius: inherit;
225
+ background: transparent;
226
+ color: inherit;
227
+ font: inherit;
228
+ text-align: left;
229
+ cursor: pointer;
230
+ transition: padding 0.3s ease;
231
+ }
232
+
233
+ .product-summary:focus-visible {
234
+ outline: 2px solid currentColor;
235
+ outline-offset: 2px;
236
+ }
237
+
238
+ /* The caret points up while closed and down while open. */
239
+ .product-toggle {
240
+ display: grid;
241
+ flex: none;
242
+ margin-right: 4px;
243
+ opacity: 0.7;
244
+ transition:
245
+ transform 0.3s ease,
246
+ opacity 0.2s ease;
247
+ }
248
+
249
+ .product-toggle .icon {
250
+ width: 14px;
251
+ height: 14px;
252
+ }
253
+
254
+ .product-summary:hover .product-toggle {
255
+ opacity: 1;
256
+ }
257
+
258
+ /* Closed: 0 rows tall, so it grows smoothly when it opens. */
259
+ .product-panel {
260
+ display: grid;
261
+ grid-template-rows: 0fr;
262
+ transition: grid-template-rows 0.3s ease;
263
+ }
264
+
265
+ .product-actions {
266
+ display: grid;
267
+ gap: 8px;
268
+ min-height: 0;
269
+ overflow: hidden;
270
+ padding: 0 12px;
271
+ opacity: 0;
272
+ transition:
273
+ padding 0.3s ease,
274
+ opacity 0.2s ease;
275
+ }
276
+
277
+ .product-action {
278
+ display: flex;
279
+ align-items: center;
280
+ justify-content: center;
281
+ box-sizing: border-box;
282
+ height: 48px;
283
+ padding: 0 16px;
284
+ border: 1px solid var(--vtex-ads-story-color-accent, #1b75a8);
285
+ border-radius: 50px;
286
+ font: inherit;
287
+ font-size: 14px;
288
+ font-weight: 700;
289
+ text-decoration: none;
290
+ cursor: pointer;
291
+ transition: background-color 0.2s ease;
292
+ }
293
+
294
+ .product-action:focus-visible {
295
+ outline: 2px solid var(--vtex-ads-story-color-accent, #1b75a8);
296
+ outline-offset: 2px;
297
+ }
298
+
299
+ .product-add-to-cart {
300
+ background: var(--vtex-ads-story-color-accent, #1b75a8);
301
+ color: var(--vtex-ads-story-color-accent-contrast, #fff);
302
+ }
303
+
304
+ .product-add-to-cart:hover {
305
+ background: color-mix(
306
+ in srgb,
307
+ var(--vtex-ads-story-color-accent, #1b75a8) 85%,
308
+ #000
309
+ );
310
+ }
311
+
312
+ /* Sold out: add to cart, disabled and grayed. */
313
+ .product-unavailable {
314
+ border-color: transparent;
315
+ background: rgba(0, 0, 0, 0.06);
316
+ color: var(--vtex-ads-story-color-muted, #6b6b6b);
317
+ cursor: not-allowed;
318
+ }
319
+
320
+ .product-view {
321
+ background: var(--vtex-ads-story-color-surface, #fff);
322
+ color: var(--vtex-ads-story-color-accent, #1b75a8);
323
+ }
324
+
325
+ /* A light tint of the accent. */
326
+ .product-view:hover {
327
+ background: color-mix(
328
+ in srgb,
329
+ var(--vtex-ads-story-color-accent, #1b75a8) 8%,
330
+ var(--vtex-ads-story-color-surface, #fff)
331
+ );
332
+ }
333
+
334
+ /* Open: a solid card (white by default), without the glass. */
335
+ .product-expandable[data-open] {
336
+ background: var(--vtex-ads-story-color-surface, #fff);
337
+ color: var(--vtex-ads-story-color-text, #242424);
338
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
339
+ }
340
+
341
+ .product-expandable[data-open]::before {
342
+ opacity: 0;
343
+ }
344
+
345
+ .product-expandable[data-open] .product-price {
346
+ color: inherit;
347
+ }
348
+
349
+ .product-expandable[data-open] .product-list-price {
350
+ color: var(--vtex-ads-story-color-muted, #6b6b6b);
351
+ opacity: 1;
352
+ }
353
+
354
+ .product-expandable[data-open] .product-summary {
355
+ padding: 12px;
356
+ }
357
+
358
+ .product-expandable[data-open] .product-toggle {
359
+ transform: rotate(180deg);
360
+ }
361
+
362
+ .product-expandable[data-open] .product-panel {
363
+ grid-template-rows: 1fr;
364
+ }
365
+
366
+ .product-expandable[data-open] .product-actions {
367
+ padding: 0 12px 12px;
368
+ opacity: 1;
369
+ transition:
370
+ padding 0.3s ease,
371
+ opacity 0.25s ease 0.1s;
372
+ }
373
+
374
+ /* Open, it stays in place on hover. */
375
+ @media (hover: hover) and (pointer: fine) {
376
+ .product-expandable[data-open]:hover {
377
+ transform: none;
378
+ }
379
+ }
380
+
381
+ @media (prefers-reduced-motion: reduce) {
382
+ .card-product,
383
+ .card-product:hover,
384
+ .card-cta,
385
+ .card-cta:hover {
386
+ transform: none;
387
+ transition: none;
388
+ }
389
+
390
+ .card-product::before,
391
+ .card-cta::before,
392
+ .product-summary,
393
+ .product-toggle,
394
+ .product-panel,
395
+ .product-actions,
396
+ .product-expandable[data-open] .product-actions {
397
+ transition: none;
398
+ }
399
+ }
400
+
401
+ .product-image {
402
+ flex: none;
403
+ width: 60px;
404
+ height: 60px;
405
+ border-radius: 8px;
406
+ background: #fff;
407
+ object-fit: contain;
408
+ }
409
+
410
+ .product-info {
411
+ display: grid;
412
+ flex: 1;
413
+ gap: 4px;
414
+ min-width: 0;
415
+ font-size: 12px;
416
+ font-weight: 700;
417
+ line-height: 16px;
418
+ }
419
+
420
+ .product-name {
421
+ display: -webkit-box;
422
+ overflow: hidden;
423
+ -webkit-box-orient: vertical;
424
+ -webkit-line-clamp: 2;
425
+ overflow-wrap: anywhere;
426
+ }
427
+
428
+ .product-price {
429
+ display: flex;
430
+ flex-wrap: wrap;
431
+ gap: 0 6px;
432
+ }
433
+
434
+ .product-list-price {
435
+ font-weight: 400;
436
+ opacity: 0.5;
437
+ }
438
+
439
+ /* In place of the price, for a product that can't be bought. */
440
+ .product-sold-out {
441
+ font-weight: 700;
442
+ opacity: 0.75;
443
+ }
444
+
445
+ /* Placeholders while the product loads, pulsing gently. */
446
+ .product-loading {
447
+ background: currentColor;
448
+ opacity: 0.25;
449
+ animation: product-loading-pulse 1.2s ease-in-out infinite alternate;
450
+ }
451
+
452
+ @keyframes product-loading-pulse {
453
+ to {
454
+ opacity: 0.1;
455
+ }
456
+ }
457
+
458
+ /* The price's: a line its height (the info's line height). */
459
+ .product-price-loading {
460
+ width: 64px;
461
+ height: 16px;
462
+ border-radius: 4px;
463
+ }
464
+
465
+ /* The add to cart button's: its size and shape. */
466
+ .product-add-to-cart-loading {
467
+ display: block;
468
+ height: 48px;
469
+ border-radius: 50px;
470
+ }
471
+
472
+ @media (prefers-reduced-motion: reduce) {
473
+ .product-loading {
474
+ animation: none;
475
+ }
476
+ }
477
+ `;var Qe=g`
478
+ /* 9:16 at the height its container gives it (--card-height, default
479
+ 500px). */
31
480
  .card {
32
481
  position: relative;
33
482
  box-sizing: border-box;
34
- width: calc(500px * 9 / 16);
35
- height: 500px;
483
+ width: calc(var(--card-height, 500px) * 9 / 16);
484
+ height: var(--card-height, 500px);
36
485
  overflow: hidden;
37
486
  border-radius: var(--vtex-ads-story-radius, 20px);
38
487
  background: #000;
@@ -133,29 +582,245 @@
133
582
  transform: translate(-50%, -50%);
134
583
  }
135
584
  }
136
- `;function Nt(i,e){return u`
585
+ `;function bo(o,e){return m`
137
586
  <button
138
587
  type="button"
139
588
  class="card-sound"
140
- aria-label=${i.muted?e.soundOnLabel:e.soundOffLabel}
141
- @click=${()=>i.toggleMuted()}
589
+ aria-label=${o.muted?e.labels.soundOn:e.labels.soundOff}
590
+ @click=${()=>o.toggleMuted()}
142
591
  >
143
- ${A(i.muted?"soundOff":"soundOn")}
592
+ ${v(o.muted?"soundOff":"soundOn")}
144
593
  </button>
145
- `}function Ce(i,e,t){return u`
146
- <div class="card">
147
- ${W(i,e)}
594
+ `}function Je(o,e,t){var i,s;let r=(i=t.withVideo)!=null?i:!0;return m`
595
+ <div
596
+ class="card"
597
+ ${x(t.ref)}
598
+ @click=${{handleEvent:()=>{var n;return(n=t.onPress)==null?void 0:n.call(t)},capture:!0}}
599
+ >
600
+ ${ie(o,e,{withVideo:r})}
148
601
  <button
149
602
  type="button"
150
603
  class="card-open"
604
+ ${x(t.openRef)}
151
605
  aria-label=${t.label}
152
606
  @click=${t.onSelect}
153
607
  >
154
- <span class="play" aria-hidden="true">${A("play")}</span>
608
+ <span class="play" aria-hidden="true">${v("play")}</span>
155
609
  </button>
156
- ${q(i,e)&&!e.paused?Nt(e,t):h}
610
+ ${r&&q(o,e)&&!e.paused?bo(e,t):f}
611
+ ${t.product?Ze(t.product,(s=t.onProductSelect)!=null?s:t.onSelect):f}
612
+ ${t.cta?se(t.cta,t.onCtaSelect):f}
157
613
  </div>
158
- `}var Se=x`
614
+ `}var Jt=(o,e,t)=>{let r=new Map;for(let i=e;i<=t;i++)r.set(o[i],i);return r},_e=E(class extends S{constructor(o){if(super(o),o.type!==M.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,e,t){let r;t===void 0?t=e:e!==void 0&&(r=e);let i=[],s=[],n=0;for(let a of o)i[n]=r?r(a,n):n,s[n]=t(a,n),n++;return{values:s,keys:i}}render(o,e,t){return this.dt(o,e,t).values}update(o,[e,t,r]){var L;let i=Vt(o),{values:s,keys:n}=this.dt(e,t,r);if(!Array.isArray(i))return this.ut=n,s;let a=(L=this.ut)!=null?L:this.ut=[],d=[],l,p,c=0,h=i.length-1,u=0,y=s.length-1;for(;c<=h&&u<=y;)if(i[c]===null)c++;else if(i[h]===null)h--;else if(a[c]===n[u])d[u]=O(i[c],s[u]),c++,u++;else if(a[h]===n[y])d[y]=O(i[h],s[y]),h--,y--;else if(a[c]===n[y])d[y]=O(i[c],s[y]),z(o,d[y+1],i[c]),c++,y--;else if(a[h]===n[u])d[u]=O(i[h],s[u]),z(o,i[c],i[h]),h--,u++;else if(l===void 0&&(l=Jt(n,u,y),p=Jt(a,c,h)),l.has(a[c]))if(l.has(a[h])){let A=p.get(n[u]),ke=A!==void 0?i[A]:null;if(ke===null){let dt=z(o,i[c]);O(dt,s[u]),d[u]=dt}else d[u]=O(ke,s[u]),z(o,i[c],ke),i[A]=null;u++}else be(i[h]),h--;else be(i[c]),c++;for(;u<=y;){let A=z(o,d[y+1]);O(A,s[u]),d[u++]=A}for(;c<=h;){let A=i[c++];A!==null&&be(A)}return this.ut=n,Ht(o,d),b}});var er="important",xo=" !"+er,W=E(class extends S{constructor(o){var e;if(super(o),o.type!==M.ATTRIBUTE||o.name!=="style"||((e=o.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((e,t)=>{let r=o[t];return r==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(o,[e]){let{style:t}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(let r of this.ft)e[r]==null&&(this.ft.delete(r),r.includes("-")?t.removeProperty(r):t[r]=null);for(let r in e){let i=e[r];if(i!=null){this.ft.add(r);let s=typeof i=="string"&&i.endsWith(xo);r.includes("-")||s?t.setProperty(r,s?i.slice(0,-11):i,s?er:""):t[r]=i}}return b}});var G=g`500px`,tr=g`24px`,ir=5e3,sr=40,et=g`(max-width: 576px)`,tt=2,ne=tt+3,rt=g`
615
+ .carousel {
616
+ position: relative;
617
+ box-sizing: border-box;
618
+ display: grid;
619
+ height: ${G};
620
+ place-items: center;
621
+ --card-height: ${G};
622
+ user-select: none;
623
+ }
624
+
625
+ .carousel[data-layout="solo"] {
626
+ padding: ${tr};
627
+ border-radius: var(--vtex-ads-story-radius, 20px);
628
+ background: var(--vtex-ads-story-color-surface, #fafafa);
629
+ --card-height: calc(${G} - 2 * ${tr});
630
+ }
631
+
632
+ .carousel[data-layout="solo"] .card {
633
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
634
+ }
635
+
636
+ .track {
637
+ position: absolute;
638
+ inset: 0;
639
+ overflow: hidden;
640
+ touch-action: pan-y;
641
+ }
642
+
643
+ /* Each slide starts centered, then moves by its own transform. */
644
+ .slide {
645
+ --ease: cubic-bezier(0.25, 1, 0.5, 1);
646
+ --duration: var(--slide-duration, 0.4s);
647
+ position: absolute;
648
+ top: 0;
649
+ left: 50%;
650
+ width: calc(${G} * 9 / 16);
651
+ height: 100%;
652
+ margin-left: calc(${G} * 9 / -32);
653
+ opacity: 0.5;
654
+ transition:
655
+ transform var(--duration) var(--ease),
656
+ opacity var(--duration) var(--ease),
657
+ visibility 0s;
658
+ }
659
+
660
+ .slide[data-active] {
661
+ opacity: 1;
662
+ }
663
+
664
+ /* Pair: --side is -1 for the first card, 1 for the second. The highlighted
665
+ card sits 47.5% of its width off center, the other (scaled to 0.9)
666
+ 52.5%, so the gap between them stays 8px. */
667
+ .carousel[data-layout="pair"] .slide {
668
+ --side: 1;
669
+ --offset: 52.5%;
670
+ --scale: 0.9;
671
+ transform: translateX(calc(var(--side) * (var(--offset) + 4px)))
672
+ scale(var(--scale));
673
+ }
674
+
675
+ .carousel[data-layout="pair"] .slide[data-index="0"] {
676
+ --side: -1;
677
+ }
678
+
679
+ .carousel[data-layout="pair"] .slide[data-active] {
680
+ --offset: 47.5%;
681
+ --scale: 1;
682
+ }
683
+
684
+ /* Rolling: --place is the slide's distance from the highlighted one, in
685
+ cards, 8px apart. A hidden slide fades out, then stops being visible. */
686
+ .carousel[data-layout="rolling"] .slide {
687
+ transform: translateX(calc(var(--place) * (100% + 8px))) scale(0.9);
688
+ }
689
+
690
+ .carousel[data-layout="rolling"] .slide[data-active] {
691
+ transform: translateX(0) scale(1);
692
+ }
693
+
694
+ .slide[data-hidden] {
695
+ opacity: 0;
696
+ visibility: hidden;
697
+ transition:
698
+ transform var(--duration) var(--ease),
699
+ opacity var(--duration) var(--ease),
700
+ visibility 0s var(--duration);
701
+ }
702
+
703
+ /* Only the highlighted card opens the player, so only it shows play. Its
704
+ sound is the only one to turn on: the others play muted, if at all. */
705
+ .slide:not([data-active]) .play,
706
+ .slide:not([data-active]) .card-sound {
707
+ display: none;
708
+ }
709
+
710
+ .arrow {
711
+ position: absolute;
712
+ top: 50%;
713
+ z-index: 2;
714
+ display: grid;
715
+ width: 32px;
716
+ height: 32px;
717
+ place-items: center;
718
+ padding: 0;
719
+ border: 1px solid rgba(133, 133, 133, 0.3);
720
+ border-radius: 50%;
721
+ background: rgba(0, 0, 0, 0.3);
722
+ backdrop-filter: blur(5px);
723
+ color: #fff;
724
+ cursor: pointer;
725
+ transform: translateY(-50%);
726
+ transition: background-color 0.2s;
727
+ }
728
+
729
+ .arrow:hover {
730
+ background: #262626;
731
+ }
732
+
733
+ .arrow:disabled {
734
+ cursor: default;
735
+ opacity: 0.5;
736
+ }
737
+
738
+ .arrow .icon {
739
+ width: 16px;
740
+ height: 16px;
741
+ }
742
+
743
+ .arrow-previous {
744
+ left: 3px;
745
+ }
746
+
747
+ .arrow-next {
748
+ right: 3px;
749
+ }
750
+
751
+ @media ${et} {
752
+ .carousel[data-layout="solo"] {
753
+ padding: 0;
754
+ background: none;
755
+ --card-height: ${G};
756
+ }
757
+
758
+ .carousel[data-layout="solo"] .card {
759
+ box-shadow: none;
760
+ }
761
+ }
762
+
763
+ @media (prefers-reduced-motion: reduce) {
764
+ .slide,
765
+ .slide[data-hidden] {
766
+ transition: none;
767
+ }
768
+ }
769
+ `,rr=(o,e)=>(o%e+e)%e;function or(o,e){let t;return r=>{t&&o.delete(t),t=r,r&&o.set(r,e)}}var ae=class{constructor(e,t){this.host=e;this.options=t;this.position=0;this.distance=1;this.count=0;this.narrow=!1;this.connected=!1;this.hovered=!1;this.focused=!1;this.cards=new Map;this.focusTargets=new Map;this.onMediaChange=e=>{var r,i;let t=this.layout;this.narrow=e.matches,this.layout!==t&&((i=(r=this.options).onLayoutChange)==null||i.call(r),this.host.requestUpdate())};this.onPointerEnter=()=>{this.hovered=!0,this.syncTimer()};this.onPointerLeave=()=>{this.hovered=!1,this.syncTimer()};this.onFocusIn=e=>{this.focused=e.target.matches(":focus-visible"),this.syncTimer()};this.onFocusOut=e=>{let t=e.currentTarget,r=e.relatedTarget;(!r||!t.contains(r))&&(this.focused=!1),this.syncTimer()};this.onPointerDown=e=>{this.endSwipe(),this.swipe={x:e.clientX,moved:!1},globalThis.addEventListener("pointerup",this.onPointerUp),globalThis.addEventListener("pointercancel",this.onPointerCancel)};this.onPointerUp=e=>{let{swipe:t}=this;if(this.removeSwipeListeners(),!t)return;let r=e.clientX-t.x;Math.abs(r)>sr&&(t.moved=!0,this.step(r<0?1:-1))};this.onPointerCancel=()=>this.endSwipe();this.onClickCapture={handleEvent:e=>{var t;(t=this.swipe)!=null&&t.moved&&(e.stopPropagation(),e.preventDefault()),this.swipe=void 0},capture:!0};e.addController(this)}get active(){return this.count?rr(this.position,this.count):0}get layout(){return this.count<2?"solo":this.count===2&&!this.narrow?"pair":"rolling"}get activeKey(){return this.layout==="rolling"?this.position:this.active}*visibleCards(){for(let[e,t]of this.cards)t.hidden||(yield[e,t])}focusActive(){for(let[e,t]of this.focusTargets)if(t.active&&e instanceof HTMLElement){e.focus();return}}hostConnected(){var e,t,r,i;this.connected=!0,this.media=(e=globalThis.matchMedia)==null?void 0:e.call(globalThis,et.toString()),(t=this.media)==null||t.addEventListener("change",this.onMediaChange),this.narrow=(i=(r=this.media)==null?void 0:r.matches)!=null?i:!1,this.syncTimer()}hostDisconnected(){var e;this.connected=!1,(e=this.media)==null||e.removeEventListener("change",this.onMediaChange),this.media=void 0,this.endSwipe(),this.syncTimer()}hostUpdated(){this.syncTimer()}reset(e){this.count=e,this.position=0,this.distance=1,this.hovered=!1,this.focused=!1,this.restartTimer()}step(e,{evenIfLocked:t=!1}={}){var i,s,n,a;if(this.count<2||e===0||(s=(i=this.options).locked)!=null&&s.call(i)&&!t)return;let r=this.activeKey;this.position+=e,this.distance=Math.abs(e),this.host.requestUpdate(),(a=(n=this.options).onStep)==null||a.call(n,r,this.activeKey),this.restartTimer()}get shouldAdvance(){var e,t;return this.connected&&this.count>1&&!this.hovered&&!this.focused&&!((t=(e=this.options).locked)!=null&&t.call(e))}syncTimer(){this.shouldAdvance&&!this.timer?this.timer=setInterval(()=>this.step(1),ir):!this.shouldAdvance&&this.timer&&this.stopTimer()}stopTimer(){clearInterval(this.timer),this.timer=void 0}restartTimer(){this.stopTimer(),this.syncTimer()}endSwipe(){this.removeSwipeListeners(),this.swipe=void 0}removeSwipeListeners(){globalThis.removeEventListener("pointerup",this.onPointerUp),globalThis.removeEventListener("pointercancel",this.onPointerCancel)}slide(e){let t={...e,cardRef:s=>r(s),focusRef:s=>i(s)},r=or(this.cards,t),i=or(this.focusTargets,t);return t}pairSlides(){let{active:e}=this;return[0,1].map(t=>this.slide({key:t,index:t,offset:t-e,active:t===e,hidden:!1}))}rollingSlides(){let{count:e}=this,t=e===2||e===4,r=t?e/2:Math.floor((e-1)/2),i=t?e/2:e-1-r,s=[];for(let n=-ne;n<=ne;n+=1)s.push(this.slide({key:this.position+n,index:rr(this.position+n,e),offset:n,active:n===0,hidden:Math.abs(n)>tt||n<-r||n>i}));return s}renderSlides(e,t){let{layout:r}=this,i=r==="pair"?this.pairSlides():this.rollingSlides();return _e(i,s=>`${r}:${s.key}`,s=>{let{index:n}=s;return m`
770
+ <div
771
+ class="slide"
772
+ data-index=${n}
773
+ ?data-active=${s.active}
774
+ ?data-hidden=${s.hidden}
775
+ ?inert=${s.hidden}
776
+ style=${W({"--place":String(s.offset)})}
777
+ >
778
+ ${t(e[n],s)}
779
+ </div>
780
+ `})}render(e,t,r){var s,n,a;if(this.layout==="solo")return m`
781
+ <div class="carousel" data-layout="solo">
782
+ ${t(e[0],this.slide({key:0,index:0,offset:0,active:!0,hidden:!1}))}
783
+ </div>
784
+ `;let i=(a=(n=(s=this.options).locked)==null?void 0:n.call(s))!=null?a:!1;return m`
785
+ <div
786
+ class="carousel"
787
+ data-layout=${this.layout}
788
+ role="region"
789
+ aria-roledescription=${r.carouselRole}
790
+ aria-label=${r.carousel}
791
+ @pointerenter=${this.onPointerEnter}
792
+ @pointerleave=${this.onPointerLeave}
793
+ @focusin=${this.onFocusIn}
794
+ @focusout=${this.onFocusOut}
795
+ >
796
+ <div
797
+ class="track"
798
+ style=${W({"--slide-duration":this.distance>1?"0.52s":"0.4s"})}
799
+ @pointerdown=${this.onPointerDown}
800
+ @click=${this.onClickCapture}
801
+ >
802
+ ${this.renderSlides(e,t)}
803
+ </div>
804
+ <button
805
+ type="button"
806
+ class="arrow arrow-previous"
807
+ aria-label=${r.previous}
808
+ ?disabled=${i}
809
+ @click=${()=>this.step(-1)}
810
+ >
811
+ ${v("previous")}
812
+ </button>
813
+ <button
814
+ type="button"
815
+ class="arrow arrow-next"
816
+ aria-label=${r.next}
817
+ ?disabled=${i}
818
+ @click=${()=>this.step(1)}
819
+ >
820
+ ${v("next")}
821
+ </button>
822
+ </div>
823
+ `}};var $="vtex-ads-story-carousel";var nr="text/plain;charset=utf-8";function ar(o,{sessionId:e,userId:t}){var s,n;let r=w(o);if(!r||globalThis.window===void 0)return!1;let i=JSON.stringify(t?{session_id:e,user_id:t}:{session_id:e});try{if((n=(s=globalThis.navigator)==null?void 0:s.sendBeacon)==null?void 0:n.call(s,r,new Blob([i],{type:nr})))return!0}catch(a){}return typeof globalThis.fetch!="function"?!1:(globalThis.fetch(r,{method:"POST",headers:{"Content-Type":nr},body:i,keepalive:!0,credentials:"omit"}).catch(a=>{console.error(`[${$}] Event request failed`,{url:r,error:a})}),!0)}var ot=.5,dr=2e3,wo={impression:"impression_url",view:"view_url",click:"click_url"},de=class{constructor(e,t){this.host=e;this.options=t;this.sent={impression:new Set,view:new Set,click:new Set};this.pendingImpressions=[];this.watched=new Map;this.onIntersect=e=>{for(let t of e){let r=this.watched.get(t.target);r&&(r.visible=t.isIntersecting&&t.intersectionRatio>=ot,r.visible?this.startTimer(r):this.stopTimer(r))}};this.onVisibilityChange=()=>{for(let e of this.watched.values())document.hidden?this.stopTimer(e):e.visible&&this.startTimer(e)};e.addController(this)}hostConnected(){var e;typeof IntersectionObserver=="function"&&(this.observer=new IntersectionObserver(this.onIntersect,{threshold:ot})),(e=globalThis.document)==null||e.addEventListener("visibilitychange",this.onVisibilityChange),this.host.updateComplete.then(()=>this.syncViewTargets())}hostDisconnected(){var e,t;(e=globalThis.document)==null||e.removeEventListener("visibilitychange",this.onVisibilityChange),(t=this.observer)==null||t.disconnect(),this.observer=void 0;for(let r of this.watched.values())clearTimeout(r.timer);this.watched.clear(),this.pendingImpressions=[]}hostUpdated(){let e=this.pendingImpressions;if(e.length&&this.options.identity().sessionId){this.pendingImpressions=[];for(let t of e)this.send("impression",t)}this.syncViewTargets()}impress(e){this.pendingImpressions=e}click(e){this.send("click",e)}key(e,t){return`${e}|${t.ad_id}`}wasSent(e,t){let{sessionId:r}=this.options.identity();return!!r&&this.sent[e].has(this.key(r,t))}send(e,t){let{sessionId:r,userId:i}=this.options.identity();if(!r||this.wasSent(e,t))return;ar(t[wo[e]],{sessionId:r,userId:i})&&this.sent[e].add(this.key(r,t))}syncViewTargets(){let{observer:e}=this;if(!e)return;let t=new Map;for(let[r,i]of this.options.viewTargets())this.wasSent("view",i)||t.set(r,i);for(let[r,i]of this.watched)t.get(r)!==i.story&&this.unwatch(r,i);for(let[r,i]of t)this.watched.has(r)||(this.watched.set(r,{story:i,visible:!1}),e.observe(r))}startTimer(e){var t;e.timer||(t=globalThis.document)!=null&&t.hidden||(e.timer=setTimeout(()=>{e.timer=void 0,this.send("view",e.story),this.wasSent("view",e.story)&&this.unwatchStory(e.story)},dr))}stopTimer(e){clearTimeout(e.timer),e.timer=void 0}unwatch(e,t){var r;this.stopTimer(t),(r=this.observer)==null||r.unobserve(e),this.watched.delete(e)}unwatchStory(e){for(let[t,r]of this.watched)r.story.ad_id===e.ad_id&&this.unwatch(t,r)}};var Ce=72,cr=48,it=g`
159
824
  .player {
160
825
  position: fixed;
161
826
  inset: auto 16px 16px auto;
@@ -188,12 +853,28 @@
188
853
  background: transparent;
189
854
  }
190
855
 
856
+ /* Focusable only to keep the focus in the player when its video is clicked
857
+ (see render): no ring around the whole player. */
858
+ .player:focus {
859
+ outline: none;
860
+ }
861
+
191
862
  .player-frame {
192
863
  position: relative;
193
864
  width: 100%;
194
865
  height: 100%;
195
866
  }
196
867
 
868
+ /* What moves in the expanded view, off center with two Stories and in the
869
+ step animation: the video, its dimming and previous and next. Expand and
870
+ close stay out of it: a transformed box becomes the one their fixed
871
+ position, at the top right of the screen, is measured from. */
872
+ .player-stage {
873
+ position: relative;
874
+ width: 100%;
875
+ height: 100%;
876
+ }
877
+
197
878
  .player .card {
198
879
  width: 100%;
199
880
  height: 100%;
@@ -240,6 +921,26 @@
240
921
  height: 20px;
241
922
  }
242
923
 
924
+ /* The product pill or the call to action. Their wrapper only stops clicks:
925
+ the pill places itself. The product is larger than on the carousel card
926
+ (as in the prototype). */
927
+ .player-destination {
928
+ display: contents;
929
+ }
930
+
931
+ .player .product-info {
932
+ font-size: 14px;
933
+ }
934
+
935
+ .player .product-image {
936
+ width: 72px;
937
+ height: 72px;
938
+ }
939
+
940
+ .player .product-price {
941
+ color: rgba(255, 255, 255, 0.7);
942
+ }
943
+
243
944
  /* Above the card: on narrow screens the expanded card can cover them. */
244
945
  .player-controls {
245
946
  position: absolute;
@@ -250,6 +951,12 @@
250
951
  gap: 8px;
251
952
  }
252
953
 
954
+ /* Previous and next Story, above the card's top left (mini player only). */
955
+ .player-nav {
956
+ right: auto;
957
+ left: 0;
958
+ }
959
+
253
960
  .player-button {
254
961
  display: grid;
255
962
  width: 36px;
@@ -303,6 +1010,116 @@
303
1010
  height: 40px;
304
1011
  }
305
1012
 
1013
+ /* Expanded with more than one Story: the other Stories' covers beside the
1014
+ video, smaller and dimmed, as in the prototype. --side is -1 (before)
1015
+ or 1 (after), --beyond how many places past the nearest one. */
1016
+ .player[data-expanded] {
1017
+ --center-height: min(78vh, 720px);
1018
+ --side-height: min(38vh, 320px);
1019
+ --side-width: calc(var(--side-height) * 9 / 16);
1020
+ --center-half: calc(var(--center-height) * 9 / 32);
1021
+ --near-gap: ${Ce}px;
1022
+ --far-gap: ${cr}px;
1023
+ --near: calc(var(--center-half) + var(--near-gap) + var(--side-width) / 2);
1024
+ --pitch: calc(var(--side-width) + var(--far-gap));
1025
+ }
1026
+
1027
+ .player-neighbor {
1028
+ position: absolute;
1029
+ top: 50%;
1030
+ left: 50%;
1031
+ width: var(--side-width);
1032
+ height: var(--side-height);
1033
+ padding: 0;
1034
+ overflow: hidden;
1035
+ border: 0;
1036
+ border-radius: 16px;
1037
+ background: #111;
1038
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
1039
+ cursor: pointer;
1040
+ transform: translate(
1041
+ calc(-50% + var(--side) * var(--near) + var(--beyond) * var(--pitch)),
1042
+ -50%
1043
+ );
1044
+ }
1045
+
1046
+ .player-neighbor img {
1047
+ width: 100%;
1048
+ height: 100%;
1049
+ object-fit: cover;
1050
+ }
1051
+
1052
+ /* Fades out as the video arrives from a dimmed cover (see animateStep). */
1053
+ .player-dim {
1054
+ position: absolute;
1055
+ inset: 0;
1056
+ z-index: 3;
1057
+ border-radius: var(--vtex-ads-story-radius, 20px);
1058
+ background: rgba(0, 0, 0, 0.35);
1059
+ opacity: 0;
1060
+ pointer-events: none;
1061
+ }
1062
+
1063
+ .player-neighbor::after {
1064
+ position: absolute;
1065
+ inset: 0;
1066
+ background: rgba(0, 0, 0, 0.35);
1067
+ content: "";
1068
+ }
1069
+
1070
+ .player-neighbor:hover::after,
1071
+ .player-neighbor:focus-visible::after {
1072
+ background: rgba(0, 0, 0, 0.12);
1073
+ }
1074
+
1075
+ .player-neighbor:focus-visible {
1076
+ outline: 2px solid #fff;
1077
+ outline-offset: 2px;
1078
+ }
1079
+
1080
+ /* Two Stories: the video moves off center toward --pair-dir, and the other
1081
+ Story sits on the other side. */
1082
+ .player[data-pair] .player-stage {
1083
+ transform: translateX(
1084
+ calc(var(--pair-dir) * (var(--near-gap) + var(--side-width)) / 2)
1085
+ );
1086
+ }
1087
+
1088
+ .player[data-pair] .player-neighbor {
1089
+ transform: translate(
1090
+ calc(
1091
+ -50% + var(--pair-dir) * -1 * (var(--center-half) + var(--near-gap) / 2)
1092
+ ),
1093
+ -50%
1094
+ );
1095
+ }
1096
+
1097
+ /* Expanded previous and next: beside the video, centered on its height. */
1098
+ .player[data-expanded] .player-nav {
1099
+ position: static;
1100
+ display: contents;
1101
+ }
1102
+
1103
+ .player[data-expanded] .player-nav .player-button {
1104
+ position: absolute;
1105
+ top: 50%;
1106
+ z-index: 2;
1107
+ transform: translateY(-50%);
1108
+ }
1109
+
1110
+ .player[data-expanded] .player-previous {
1111
+ left: -56px;
1112
+ }
1113
+
1114
+ .player[data-expanded] .player-next {
1115
+ right: -56px;
1116
+ }
1117
+
1118
+ /* With two, the other Story's cover beside the video does that. */
1119
+ .player[data-expanded][data-pair] .player-nav {
1120
+ display: none;
1121
+ }
1122
+
306
1123
  @media (max-width: 576px) {
307
1124
  .player {
308
1125
  right: 12px;
@@ -310,6 +1127,18 @@
310
1127
  height: 391px;
311
1128
  }
312
1129
 
1130
+ .player:not([data-expanded]) .product-image {
1131
+ width: 56px;
1132
+ height: 56px;
1133
+ }
1134
+
1135
+ /* "Adicionar ao carrinho" fits on one line in the narrow mini player. */
1136
+ .player:not([data-expanded]) .product-action {
1137
+ height: 40px;
1138
+ padding: 0 8px;
1139
+ font-size: 12px;
1140
+ }
1141
+
313
1142
  .player[data-expanded] {
314
1143
  background: #000;
315
1144
  }
@@ -332,6 +1161,28 @@
332
1161
  top: 60px;
333
1162
  right: 12px;
334
1163
  }
1164
+
1165
+ /* No room for the other Stories' covers: previous and next go inside
1166
+ the video's edges instead, also with two. */
1167
+ .player-neighbor {
1168
+ display: none;
1169
+ }
1170
+
1171
+ .player[data-pair] .player-stage {
1172
+ transform: none;
1173
+ }
1174
+
1175
+ .player[data-expanded][data-pair] .player-nav {
1176
+ display: contents;
1177
+ }
1178
+
1179
+ .player[data-expanded] .player-previous {
1180
+ left: 12px;
1181
+ }
1182
+
1183
+ .player[data-expanded] .player-next {
1184
+ right: 12px;
1185
+ }
335
1186
  }
336
1187
 
337
1188
  @keyframes player-in {
@@ -346,74 +1197,129 @@
346
1197
  animation: none;
347
1198
  }
348
1199
  }
349
- `;function ht(i){return typeof i.showPopover=="function"}var K=class{constructor(e,t){this.host=e;this.options=t;this.isOpen=!1;this.expanded=!1;this.switched=!1;this.shown=!1;this.dialog=V();this.expandButton=V();this.closeButton=V();this.toggleExpanded=async()=>{var t;let e=this.dialog.value;e&&(this.hide(e),this.expanded=!this.expanded,this.switched=!0,this.host.requestUpdate(),await this.host.updateComplete,this.isOpen&&(this.show(e),(t=this.expandButton.value)==null||t.focus()))};this.onKeyDown=e=>{e.key==="Escape"&&this.options.onClose()};this.onDialogClick=e=>{this.expanded&&e.target===e.currentTarget&&this.options.onClose()};this.onCancel=e=>{e.preventDefault(),this.options.onClose()};e.addController(this),this.video=new L(e)}hostDisconnected(){this.close()}async open(){var t;if(this.isOpen)return;document.addEventListener("keydown",this.onKeyDown),this.isOpen=!0,this.expanded=!1,this.switched=!1,this.video.reset(),this.host.requestUpdate(),await this.host.updateComplete;let e=this.dialog.value;!this.isOpen||!e||(this.show(e),this.video.play(),(t=this.closeButton.value)==null||t.focus())}close(){if(!this.isOpen)return;document.removeEventListener("keydown",this.onKeyDown);let e=this.dialog.value;e&&this.hide(e),this.isOpen=!1,this.host.requestUpdate()}show(e){this.shown||(this.expanded?e.showModal():ht(e)?e.showPopover():e.show(),this.shown=!0)}hide(e){this.shown&&(!this.expanded&&ht(e)?e.hidePopover():e.close(),this.shown=!1)}renderVideoControls(){let{video:e,options:t}=this,s=r=>{r.stopPropagation(),e.togglePlayback()},o=r=>{r.stopPropagation(),e.toggleMuted()};return u`
1200
+ `;function st(o,e){if(o<2)return[];if(o===2)return[e===0?1:-1];let t=[],r=new Set([0]);for(let i of[-1,1,-2,2]){let s=(i%o+o)%o;r.has(s)||(r.add(s),t.push(i))}return t}var K={duration:560,easing:"cubic-bezier(0.32, 0.72, 0, 1)"},Ee=(o,e=1)=>`translate(-50%, -50%) translateX(${o}px) scale(${e})`,pr=o=>o.animate([{opacity:0},{opacity:1}],{...K,pseudoElement:"::after"});function $o(o,e,t,{frameWidth:r,sideWidth:i}){let s=d=>{if(d===0)return 0;let l=Math.sign(d),p=r/2+Ce+i/2;return l*p+(d-l)*(i+cr)},n=i/r,a=[o.animate([{transform:`translateX(${s(e)}px) scale(${n})`},{transform:"none"}],K)];for(let{element:d,offset:l,from:p}of t){let c=p===0;a.push(d.animate([{transform:Ee(s(p),c?1/n:1)},{transform:Ee(s(l))}],K)),c&&a.push(pr(d))}return a}function So(o,e,t,{frameWidth:r,sideWidth:i}){let s=d=>d*(Ce+i)/2,n=d=>-d*(r+Ce)/2,a=i/r;return[o.animate([{transform:`translateX(${n(-t)}px) scale(${a})`},{transform:`translateX(${s(t)}px)`}],K),e.animate([{transform:Ee(s(-t),1/a)},{transform:Ee(n(t))}],K),pr(e)]}var Ao={ArrowLeft:-1,ArrowRight:1},_o=o=>!o.defaultPrevented&&!o.altKey&&!o.ctrlKey&&!o.metaKey&&!o.shiftKey;function lr(o){return typeof o.showPopover=="function"}var le=class{constructor(e,t){this.host=e;this.options=t;this.isOpen=!1;this.expanded=!1;this.productOpen=!1;this.switched=!1;this.shown=!1;this.dialog=P();this.expandButton=P();this.closeButton=P();this.stage=P();this.stageCardRef=P();this.dim=P();this.neighborElements=new Map;this.neighborRefs=new Map;this.navigation=!1;this.pairDirection=0;this.animations=[];this.toggleExpanded=async()=>{var t;let e=this.dialog.value;e&&(this.cancelAnimations(),this.hide(e),this.expanded=!this.expanded,this.switched=!0,this.host.requestUpdate(),await this.host.updateComplete,this.isOpen&&(this.show(e),(t=this.expandButton.value)==null||t.focus()))};this.onKeyDown=e=>{e.key==="Escape"&&this.options.onClose()};this.onPlayerKeyDown=e=>{var r,i;let t=Ao[e.key];!t||!this.navigation||!_o(e)||(e.preventDefault(),(i=(r=this.options).onStep)==null||i.call(r,t))};this.onDialogClick=e=>{this.expanded&&e.target===e.currentTarget&&this.options.onClose()};this.onCancel=e=>{e.preventDefault(),this.options.onClose()};this.toggleProduct=()=>{this.productOpen=!this.productOpen,this.host.requestUpdate()};this.onVideoClick=()=>{this.productOpen?this.toggleProduct():this.video.togglePlayback()};e.addController(this),this.video=new B(e)}get isExpanded(){return this.isOpen&&this.expanded}get stageCard(){return this.isOpen?this.stageCardRef.value:void 0}hostDisconnected(){this.close()}async open({productOpen:e=!1}={}){var r;if(this.isOpen)return;document.addEventListener("keydown",this.onKeyDown),this.isOpen=!0,this.expanded=!1,this.productOpen=e,this.switched=!1,this.rendered=void 0,this.beforeStep=void 0,this.video.reset(),this.host.requestUpdate(),await this.host.updateComplete;let t=this.dialog.value;!this.isOpen||!t||(this.show(t),this.video.play(),(r=this.closeButton.value)==null||r.focus())}close(){if(!this.isOpen)return;document.removeEventListener("keydown",this.onKeyDown),this.cancelAnimations();let e=this.dialog.value;e&&this.hide(e),this.isOpen=!1,this.host.requestUpdate()}async showNext(e=0){if(!this.isOpen)return;let t=!this.video.muted;this.video.failed=!1,this.productOpen=!1,this.host.requestUpdate(),await this.host.updateComplete,this.isOpen&&(this.video.restart({withSound:t}),this.animateStep(e))}cancelAnimations(){for(let e of this.animations)e.cancel();this.animations=[]}animateStep(e){var l,p;if(!this.expanded||e===0||$e())return;let t=this.stage.value,r=this.dim.value;if(!t||!r||typeof t.animate!="function")return;let{rendered:i,beforeStep:s}=this,n=(c,h)=>{var y;if(!c||!s)return h;if(c===s.story)return 0;let u=s.neighbors.find(L=>L.story===c);return(y=u==null?void 0:u.offset)!=null?y:h},a=[...this.neighborElements].map(([c,h])=>{var u;return{offset:c,element:h,from:n((u=i==null?void 0:i.neighbors.find(y=>y.offset===c))==null?void 0:u.story,c+e)}}),d={frameWidth:t.offsetWidth,sideWidth:(p=(l=a[0])==null?void 0:l.element.offsetWidth)!=null?p:0};!d.frameWidth||!d.sideWidth||(this.cancelAnimations(),this.animations=[r.animate([{opacity:1},{opacity:0}],K),...this.pairDirection?So(t,a[0].element,this.pairDirection,d):$o(t,n(i==null?void 0:i.story,e),a,d)])}neighborRef(e){let t=this.neighborRefs.get(e);return t||(t=r=>{r?this.neighborElements.set(e,r):this.neighborElements.delete(e)},this.neighborRefs.set(e,t)),t}show(e){this.shown||(this.expanded?e.showModal():lr(e)?e.showPopover():e.show(),this.shown=!0)}hide(e){this.shown&&(!this.expanded&&lr(e)?e.hidePopover():e.close(),this.shown=!1)}renderDestination({product:e,cta:t,labels:r}){let i;if(e)i=Xe(e,{open:this.productOpen,onToggle:this.toggleProduct,panelId:"player-product-panel",labels:r});else if(t)i=se(t);else return f;return m`
1201
+ <div
1202
+ class="player-destination"
1203
+ @click=${s=>s.stopPropagation()}
1204
+ >
1205
+ ${i}
1206
+ </div>
1207
+ `}renderVideoControls(e){let{video:t}=this,r=s=>{s.stopPropagation(),t.togglePlayback()},i=s=>{s.stopPropagation(),t.toggleMuted()};return m`
350
1208
  <button
351
1209
  type="button"
352
1210
  class="play player-toggle"
353
- aria-label=${e.paused?t.playLabel:t.pauseLabel}
354
- @click=${s}
1211
+ aria-label=${t.paused?e.play:e.pause}
1212
+ @click=${r}
355
1213
  >
356
- ${A(e.paused?"play":"pause")}
1214
+ ${v(t.paused?"play":"pause")}
357
1215
  </button>
358
1216
  <button
359
1217
  type="button"
360
1218
  class="player-button player-sound"
361
- aria-label=${e.muted?t.soundOnLabel:t.soundOffLabel}
362
- @click=${o}
1219
+ aria-label=${t.muted?e.soundOn:e.soundOff}
1220
+ @click=${i}
363
1221
  >
364
- ${A(e.muted?"soundOff":"soundOn")}
1222
+ ${v(t.muted?"soundOff":"soundOn")}
365
1223
  </button>
366
- `}render(e){if(!this.isOpen)return h;let{video:t,options:s,expanded:o}=this,r=q(e,t);return u`
1224
+ `}renderNavigation(e){let{options:t}=this,r=i=>()=>{var s;return(s=t.onStep)==null?void 0:s.call(t,i)};return m`
1225
+ <div class="player-controls player-nav">
1226
+ <button
1227
+ type="button"
1228
+ class="player-button player-previous"
1229
+ aria-label=${e.previous}
1230
+ @click=${r(-1)}
1231
+ >
1232
+ ${v("previous")}
1233
+ </button>
1234
+ <button
1235
+ type="button"
1236
+ class="player-button player-next"
1237
+ aria-label=${e.next}
1238
+ @click=${r(1)}
1239
+ >
1240
+ ${v("next")}
1241
+ </button>
1242
+ </div>
1243
+ `}renderNeighbors(e,t){let{options:r}=this;return _e(e,({offset:i})=>e.length===1?"single":i,({offset:i,story:s,label:n})=>{let a=w(s.poster_url),d=Math.sign(i);return m`
1244
+ <button
1245
+ type="button"
1246
+ class="player-neighbor"
1247
+ aria-label=${n!=null?n:t.show}
1248
+ style=${W({"--side":String(d),"--beyond":String(i-d)})}
1249
+ ${x(this.neighborRef(i))}
1250
+ @click=${()=>{var l;return(l=r.onStep)==null?void 0:l.call(r,i)}}
1251
+ >
1252
+ ${a?m`<img alt="" src=${a} />`:f}
1253
+ </button>
1254
+ `})}renderWindowControls(e){let{options:t,expanded:r}=this;return m`
1255
+ <div class="player-controls">
1256
+ <button
1257
+ type="button"
1258
+ class="player-button player-expand"
1259
+ aria-label=${r?e.collapse:e.expand}
1260
+ ${x(this.expandButton)}
1261
+ @click=${this.toggleExpanded}
1262
+ >
1263
+ ${v(r?"collapse":"expand")}
1264
+ </button>
1265
+ <button
1266
+ type="button"
1267
+ class="player-button player-close"
1268
+ aria-label=${e.close}
1269
+ ${x(this.closeButton)}
1270
+ @click=${t.onClose}
1271
+ >
1272
+ ${v("close")}
1273
+ </button>
1274
+ </div>
1275
+ `}renderVideo(e,t,r){let{video:i,options:s}=this;return m`
1276
+ <div class="card" ${x(this.stageCardRef)} @click=${this.onVideoClick}>
1277
+ ${ie(e,i,{loop:!t,onEnded:t?()=>{var n;return(n=s.onStep)==null?void 0:n.call(s,1)}:void 0})}
1278
+ ${q(e,i)?this.renderVideoControls(r.labels):f}
1279
+ ${this.renderDestination(r)}
1280
+ </div>
1281
+ `}track(e,t){let r=this.expanded?t:[];return this.pairDirection=r.length===1?-Math.sign(r[0].offset):0,this.rendered&&e!==this.rendered.story&&(this.beforeStep=this.rendered),this.rendered={story:e,neighbors:r},r}render(e,{labels:t,navigation:r=!1,neighbors:i=[],product:s,cta:n,onPress:a}){if(!this.isOpen)return f;let{video:d,expanded:l}=this,p=this.track(e,i),c=this.pairDirection!==0;return this.navigation=r,m`
367
1282
  <dialog
368
1283
  class="player"
369
1284
  popover="manual"
370
- aria-label=${s.label}
371
- ?data-expanded=${o}
1285
+ aria-label=${t.player}
1286
+ ?data-expanded=${l}
1287
+ ?data-pair=${c}
1288
+ style=${W({"--pair-dir":c?String(this.pairDirection):void 0})}
372
1289
  ?data-switched=${this.switched}
373
- ?data-paused=${r&&t.paused}
374
- ${k(this.dialog)}
1290
+ ?data-paused=${q(e,d)&&d.paused}
1291
+ tabindex="-1"
1292
+ ${x(this.dialog)}
375
1293
  @click=${this.onDialogClick}
376
1294
  @cancel=${this.onCancel}
1295
+ @keydown=${this.onPlayerKeyDown}
377
1296
  >
1297
+ ${this.renderNeighbors(p,t)}
378
1298
  <div class="player-frame">
379
- <div class="player-controls">
380
- <button
381
- type="button"
382
- class="player-button player-expand"
383
- aria-label=${o?s.collapseLabel:s.expandLabel}
384
- ${k(this.expandButton)}
385
- @click=${this.toggleExpanded}
386
- >
387
- ${A(o?"collapse":"expand")}
388
- </button>
389
- <button
390
- type="button"
391
- class="player-button player-close"
392
- aria-label=${s.closeLabel}
393
- ${k(this.closeButton)}
394
- @click=${s.onClose}
395
- >
396
- ${A("close")}
397
- </button>
398
- </div>
399
- <div class="card" @click=${()=>t.togglePlayback()}>
400
- ${W(e,t)}
401
- ${r?this.renderVideoControls():h}
1299
+ ${this.renderWindowControls(t)}
1300
+ <div
1301
+ class="player-stage"
1302
+ ${x(this.stage)}
1303
+ @click=${{handleEvent:h=>{let u=this.stageCardRef.value;u!=null&&u.contains(h.target)&&(a==null||a())},capture:!0}}
1304
+ >
1305
+ ${r?this.renderNavigation(t):f}
1306
+ ${this.renderVideo(e,r&&l,{product:s,cta:n,labels:t})}
1307
+ <span class="player-dim" aria-hidden="true" ${x(this.dim)}></span>
402
1308
  </div>
403
1309
  </div>
404
1310
  </dialog>
405
- `}};var F="vtex-ads-story",dt={poster_url:"https://dummyimage.com/1080x1920/e31c57/fff",media_url:"https://samplelib.com/mp4/sample-10s-vp9.mp4"},f={watch:"Assistir v\xEDdeo",player:"V\xEDdeo",expand:"Expandir v\xEDdeo",collapse:"Reduzir v\xEDdeo",close:"Fechar v\xEDdeo",play:"Reproduzir v\xEDdeo",pause:"Pausar v\xEDdeo",soundOn:"Ativar som",soundOff:"Desativar som"},O=class extends b{constructor(){super(...arguments);this.cardVideo=new L(this);this.player=new K(this,{label:f.player,expandLabel:f.expand,collapseLabel:f.collapse,closeLabel:f.close,playLabel:f.play,pauseLabel:f.pause,soundOnLabel:f.soundOn,soundOffLabel:f.soundOff,onClose:()=>this.closePlayer()})}connectedCallback(){super.connectedCallback(),this.cardVideo.resume()}openPlayer(){this.player.isOpen||(this.cardVideo.pause(),this.player.open())}closePlayer(){var t;this.player.isOpen&&(this.player.close(),this.cardVideo.resume(),(t=this.renderRoot.querySelector(".root .card-open"))==null||t.focus())}render(){return u`
1311
+ `}};var ur=(o,e)=>globalThis.fetch(o,e);var Co=()=>{let o=async(s,n,a,d,l)=>{let p=new URL(n,s).toString(),c=d?{"content-type":"application/json"}:void 0;return ur(p,{body:d?JSON.stringify(d):void 0,method:a,signal:l==null?void 0:l.signal,headers:{accept:"application/json",...c}}).then(h=>{if(!h.ok)throw console.error({description:"HTTP error",response:h}),new Error(`HTTP error! status: ${h.status}`);return h.json()})};return{get:async(s,n,a)=>o(s,n,"GET",void 0,a),post:async(s,n,a,d)=>o(s,n,"POST",a,d),put:async(s,n,a)=>o(s,n,"PUT",a),delete:async(s,n)=>o(s,n,"DELETE")}},nt=Co(),Eo="https://newtail-media.newtail.com.br/v1/rma/",Po=async(o,e,t)=>nt.post(Eo,o,e,{signal:t==null?void 0:t.signal}).then(r=>{if(r.validations&&r.validations.length>0)throw console.error(JSON.stringify({description:"Ads validation error",response:r},null,2)),new Error("Ads validation error");return r}),To=o=>Object.entries(o).filter(([,e])=>Array.isArray(e)).map(([e,t])=>[e,t.filter(r=>"product_sku"in r)]).filter(([e,t])=>t.length>0),ko=o=>Object.entries(o).filter(([,e])=>Array.isArray(e)).map(([e,t])=>[e,t.filter(r=>"type"in r&&r.type==="story")]).filter(([e,t])=>t.length>0),vr=o=>{var e;return{skuId:o.product_sku,sellerId:(e=o.seller_id)!=null?e:"1",productId:o.product_metadata.productId}},gr=o=>{var e,t,r;let{product:i}=o;if(!i)return;let s=(e=i.product_metadata)==null?void 0:e.productId;return{skuId:i.product_sku,sellerId:(r=(t=i.seller_id)!=null?t:o.seller_id)!=null?r:"1",productId:typeof s=="string"?s:""}},hr=o=>{let e={};for(let[t,r]of o)e[t]=r;return e},Oo=(o,e)=>{let t={};for(let[r,i]of Object.entries(o))t[r]=i.map(s=>e(s));return t},Mo=(o,e)=>e?new Promise((t,r)=>{let i=()=>r(e.reason);if(e.aborted){i();return}e.addEventListener("abort",i,{once:!0}),o.then(t,r).finally(()=>e.removeEventListener("abort",i))}):o,br=(o,e)=>({eventUrls:{click:o.click_url,impression:o.impression_url,view:o.view_url},eventParameters:btoa(o.impression_url),sponsoredBySellerId:e}),Ro=(o,e,t)=>({product:o,advertisement:br(e,t.sellerId)}),Lo=(o,e)=>{var t;let r=gr(o);return{story:o,product:e(r),offer:r,advertisement:br(o,(t=r==null?void 0:r.sellerId)!=null?t:o.seller_id)}},fr=(o,e)=>Object.values(o).flatMap(t=>t.map(r=>e(r))).filter(t=>t!==void 0),Io=(o,e)=>t=>t&&o.find(r=>e(r,t)),No=(o,e)=>{var t;let r={},i=[];for(let[s,n]of Object.entries(o))for(let a of n){let d=vr(a),l=e(d);l?((t=r[s])!=null||(r[s]=[]),r[s].push(Ro(l,a,d))):i.push(a)}return{byPlacement:r,failed:i}},xr=async({sponsoredProducts:o={},stories:e={}},t,r,i,s)=>{let n=[...fr(o,vr),...fr(e,gr)],a=n.length>0?await Mo(t(n,i,{signal:s==null?void 0:s.signal}),s==null?void 0:s.signal):[],d=Io(a,r);return{sponsoredProducts:No(o,d),stories:Oo(e,l=>Lo(l,d))}},wr=(o,e)=>o.items.some(t=>t.itemId===e.skuId&&t.sellers.some(r=>r.sellerId===e.sellerId)),$r=o=>`https://${o}.vtexcommercestable.com.br/api/intelligent-search/`,Sr="product_search",Ho=async(o,e,t)=>{let r=$r(o),i=`product:${e.map(encodeURIComponent).join(";")}`,s=`${Sr}?q=${i}`;return nt.get(r,s,t)},Vo=24,Do=async(o,e,t)=>{let r=$r(o),i=`sku:${e.map(encodeURIComponent).join(";")}`,s=`${Sr}?q=${i}`;return nt.get(r,s,t)},Uo=o=>{let e=new Map;for(let{skuId:t,sellerId:r}of o){let i=e.get(t);i?i.push(r):e.set(t,[r])}return e},Bo=(o,e)=>o.map(t=>{let r=e.get(t.itemId);if(!r)return null;let i=t.sellers.filter(s=>r.includes(s.sellerId));return i.length===0?null:{...t,sellers:i}}).filter(t=>t!==null),Fo=(o,e)=>{let t=Uo(e);return o.map(r=>{let i=Bo(r.items,t);return i.length===0?null:{...r,items:i}}).filter(r=>r!==null)},zo=(o,e)=>{let t=[];for(let r=0;r<o.length;r+=e)t.push(o.slice(r,r+e));return t},mr=(o,e,t,r)=>zo(t,Vo).map(i=>o(e,i,r)),qo=o=>[...new Map(o.map(e=>[e.productId,e])).values()],Ar=async(o,{accountName:e},t)=>{let r=new Set,i=new Set;for(let{productId:d,skuId:l}of o)d?r.add(d):i.add(l);let s={signal:t==null?void 0:t.signal},n=await Promise.all([...mr(Ho,e,[...r],s),...mr(Do,e,[...i],s)]),a=qo(n.flatMap(d=>d.products));return Fo(a,o)},_r=(o,{skuId:e,sellerId:t})=>{var r,i;return(i=(r=o.items.find(s=>s.itemId===e))==null?void 0:r.sellers.find(s=>s.sellerId===t))==null?void 0:i.commertialOffer},yr=o=>typeof o=="number"&&Number.isFinite(o)?o:void 0,Cr=(o,e)=>{let t=_r(o,e),r=yr(t==null?void 0:t.Price);if(r===void 0)return;let i=yr(t==null?void 0:t.ListPrice);return i!==void 0&&i>r?{price:r,listPrice:i}:{price:r}},Er=(o,e)=>{var t;let r=(t=_r(o,e))==null?void 0:t.AvailableQuantity;return typeof r=="number"&&!Number.isNaN(r)?r>0:void 0},Pe=({selectedFacets:o,attributeSynonyms:e,attributePrefix:t})=>{if(!(o!=null&&o.length))return;let r=e==null?void 0:e.map(n=>n.toLowerCase()),i=t==null?void 0:t.toLowerCase(),s=o.filter(n=>{let a=n.key.toLowerCase();return(r==null?void 0:r.includes(a))||i&&a.startsWith(i)});if(s.length>0)return s},jo=o=>{var e;return(e=Pe({selectedFacets:o,attributeSynonyms:["categoria","c"],attributePrefix:"category"}))==null?void 0:e.map(t=>t.value).join(" > ")},Wo=o=>{var e;return(e=Pe({selectedFacets:o,attributeSynonyms:["brand","b"]}))==null?void 0:e.map(t=>t.value)[0]},Go=o=>{var e;return(e=Pe({selectedFacets:o,attributeSynonyms:["productClusterIds","productClusterNames"]}))==null?void 0:e.map(t=>`product_cluster/${t.value}`)},Ko=o=>{var e;return(e=Pe({selectedFacets:o,attributeSynonyms:["sellerName","seller"]}))==null?void 0:e.map(t=>t.value)[0]},Zo=o=>({category:jo(o),brand:Wo(o),tags:Go(o),seller:Ko(o)}),Xo=({term:o,category:e,brand:t,skuId:r})=>o?"search":e?"category":t?"brand_page":r?"product_page":"home",Yo=o=>{var e;let{category:t,brand:r,tags:i,seller:s}=Zo(o.search.selectedFacets),n=(e=o.search.term)!=null?e:!t&&!r?s:void 0,a=Xo({term:n,category:t,brand:r,skuId:o.search.skuId});return{brand_name:r,category_name:t,tags:i,context:a,placements:o.placements,channel:o.identity.channel,term:n,session_id:o.identity.sessionId,user_id:o.identity.userId,product_sku:o.search.skuId}},Pr=async(o,e)=>{let t=Yo(o),r=await Po(o.identity.publisherId,t,e);return{sponsoredProducts:hr(To(r)),stories:hr(ko(r)),banners:void 0,sponsoredBrands:void 0}};var Te=(o,e,t)=>{let r=o!==void 0&&Number.isFinite(o)&&o>0?o:e,i=new AbortController,s=setTimeout(()=>i.abort(new DOMException(`Timed out after ${r} ms`,"TimeoutError")),r),n=()=>i.abort(t==null?void 0:t.reason);return t!=null&&t.aborted?n():t==null||t.addEventListener("abort",n,{once:!0}),{signal:i.signal,clear:()=>{clearTimeout(s),t==null||t.removeEventListener("abort",n)}}};var Qo=5e3,Tr={fetcher:Ar,matcher:wr,price:Cr,available:Er};async function kr(o,e,t,r,{signal:i,timeout:s}={}){var d,l;let n=new Map,a=Te(s,Qo,i);try{let p=await xr({stories:{[o]:e}},t.fetcher,(c,h)=>t.matcher(c,h),r,{signal:a.signal});for(let{story:c,product:h,offer:u}of(d=p.stories[o])!=null?d:[]){if(!h||!u)continue;let y=t.price(h,u),L=(l=t.available)==null?void 0:l.call(t,h,u);n.set(c.ad_id,{...y&&{price:y},...L!==void 0&&{available:L}})}}catch(p){a.signal.aborted||console.error(`[${$}] Product request failed`,p)}finally{a.clear()}return n}var Jo=2e3,ei=8,ti=o=>o!==void 0&&Number.isFinite(o)&&o>=1?Math.floor(o):ei;async function Or({publisherId:o,sessionId:e,placement:t,userId:r,accountName:i,channel:s,quantity:n},{signal:a,timeout:d}={}){var h;if(globalThis.window===void 0||!o||!e||!t)return[];let p=Te(d,Jo,a),c=ti(n);try{let{stories:u}=await Pr({identity:{accountName:i!=null?i:"",publisherId:o,sessionId:e,userId:r,channel:s},search:{},placements:{[t]:{quantity:c,types:["story"]}}},{signal:p.signal});return((h=u[t])!=null?h:[]).slice(0,c)}catch(u){return p.signal.aborted||console.error(`[${$}] Story request failed`,{placement:t,publisherId:o,error:u}),[]}finally{p.clear()}}var Mr={watch:"Watch video",show:"Show video",carousel:"Videos",carouselRole:"carousel",previous:"Previous video",next:"Next video",player:"Video",expand:"Expand video",collapse:"Collapse video",close:"Close video",play:"Play video",pause:"Pause video",soundOn:"Turn sound on",soundOff:"Turn sound off",addToCart:"Add to cart",unavailable:"Product unavailable",soldOut:"Sold out",viewProduct:"View product",product:(o,e,t)=>e&&t?`${o}, was ${t}, now ${e}`:e?`${o}, ${e}`:o,position:(o,e,t)=>t>1?`${o} ${e+1} of ${t}`:o};var Rr={watch:"Ver video",show:"Mostrar video",carousel:"Videos",carouselRole:"carrusel",previous:"Video anterior",next:"Video siguiente",player:"Video",expand:"Ampliar video",collapse:"Reducir video",close:"Cerrar video",play:"Reproducir video",pause:"Pausar video",soundOn:"Activar sonido",soundOff:"Desactivar sonido",addToCart:"Agregar al carrito",unavailable:"Producto no disponible",soldOut:"Agotado",viewProduct:"Ver producto",product:(o,e,t)=>e&&t?`${o}, antes ${t}, ahora ${e}`:e?`${o}, ${e}`:o,position:(o,e,t)=>t>1?`${o} ${e+1} de ${t}`:o};var at={watch:"Assistir v\xEDdeo",show:"Mostrar v\xEDdeo",carousel:"V\xEDdeos",carouselRole:"carrossel",previous:"V\xEDdeo anterior",next:"Pr\xF3ximo v\xEDdeo",player:"V\xEDdeo",expand:"Expandir v\xEDdeo",collapse:"Reduzir v\xEDdeo",close:"Fechar v\xEDdeo",play:"Reproduzir v\xEDdeo",pause:"Pausar v\xEDdeo",soundOn:"Ativar som",soundOff:"Desativar som",addToCart:"Adicionar ao carrinho",unavailable:"Produto indispon\xEDvel",soldOut:"Esgotado",viewProduct:"Ver produto",product:(o,e,t)=>e&&t?`${o}, de ${t} por ${e}`:e?`${o}, ${e}`:o,position:(o,e,t)=>t>1?`${o} ${e+1} de ${t}`:o};var ri=new Map([["pt",at],["es",Rr],["en",Mr]]);function Lr(o,e={}){var n,a,d;let t=o.split("-")[0].toLowerCase(),r=(n=ri.get(t))!=null?n:at,i=(a=e.addToCart)==null?void 0:a.trim(),s=(d=e.viewProduct)==null?void 0:d.trim();return{...r,...i&&{addToCart:i},...s&&{viewProduct:s}}}var oi=["publisherId","sessionId","placement","userId","accountName","channel","quantity","hydration"],ii=new Set(["site","app"]),si=o=>ii.has(o),ni={fromAttribute:o=>typeof o=="string"&&(o===""||o.toLowerCase()==="true")},ai={fromAttribute:o=>si(o)?o:void 0},di={fromAttribute:o=>o==="none"?"none":void 0},R=class extends k{constructor(){super();this.cardVideos=new Map;this.soundPending=!1;this.carousel=new ae(this,{onStep:(t,r)=>this.leaveHighlight(t,r),onLayoutChange:()=>{this.cardVideos.clear(),this.player.isOpen&&(this.afterRender=()=>{var t;return(t=this.activeVideo)==null?void 0:t.pause()})},locked:()=>this.player.isOpen});this.player=new le(this,{onStep:t=>this.stepInPlayer(t),onClose:()=>this.closePlayer()});this.events=new de(this,{identity:()=>({sessionId:this.sessionId,userId:this.userId}),viewTargets:()=>this.viewTargets()});this.renderSlide=(t,{key:r,index:i,offset:s,active:n,hidden:a,cardRef:d,focusRef:l})=>Je(t,this.videoFor(r),{label:this.labels.position(n?this.labels.watch:this.labels.show,i,this.stories.length),labels:this.labels,withVideo:n||this.inactiveAutoplay&&!a,product:this.productOf(t),onSelect:n?()=>this.openPlayer():()=>this.carousel.step(s),onProductSelect:n?()=>this.openPlayer({productOpen:!0}):void 0,cta:Ae(t),onCtaSelect:n?void 0:()=>this.carousel.step(s),onPress:()=>this.events.click(t),ref:d,openRef:l});this.inactiveAutoplay=!1,this.stories=[]}connectedCallback(){var t;super.connectedCallback();for(let r of this.cardVideos.values())r.resume();(t=this.request)!=null&&t.signal.aborted&&this.loadStory()}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.request)==null||t.abort()}willUpdate(t){oi.some(r=>t.has(r))&&this.loadStory()}updated(){let t=this.afterRender;this.afterRender=void 0,t==null||t()}get activeHydration(){if(this.hydration!=="none")return this.hydration?this.hydration:this.accountName?Tr:void 0}async loadStory(){var n,a,d,l,p;(n=this.request)==null||n.abort();let t=new AbortController;if(this.request=t,this.player.close(),this.showStories([]),!this.isConnected){t.abort();return}let r=await Or(this,{signal:t.signal,timeout:this.timeout});if(t.signal.aborted)return;let i=this.activeHydration;if(!i||!r.some(c=>c.product)){this.request=void 0,this.showStories(r);return}this.showStories(r,"loading");let s=await kr((a=this.placement)!=null?a:"",r,i,{accountName:(d=this.accountName)!=null?d:"",publisherId:(l=this.publisherId)!=null?l:"",sessionId:(p=this.sessionId)!=null?p:"",userId:this.userId,channel:this.channel},{signal:t.signal,timeout:this.hydrationTimeout});t.signal.aborted||(this.request=void 0,this.products=s)}showStories(t,r){this.products=r,this.cardVideos.clear(),this.soundPending=!1,this.afterRender=void 0,this.carousel.reset(t.length),this.stories=t,this.events.impress(t)}*viewTargets(){var s;let{stories:t}=this;if(!this.player.isExpanded)for(let[n,{key:a,index:d}]of this.carousel.visibleCards()){let l=t[d];l&&((s=this.cardVideos.get(a))!=null&&s.playing)&&(yield[n,l])}let r=this.player.stageCard,i=t[this.carousel.active];r&&i&&this.player.video.playing&&(yield[r,i])}videoFor(t){let r=this.cardVideos.get(t);return r||(r=new B(this),this.cardVideos.set(t,r)),r}get activeVideo(){return this.cardVideos.get(this.carousel.activeKey)}leaveHighlight(t,r){let i=this.cardVideos.get(t);this.soundPending||(this.soundPending=i!==void 0&&!i.muted),this.inactiveAutoplay?i==null||i.mute():i==null||i.reset(),this.player.isOpen?(this.soundPending=!1,this.afterRender=()=>this.videoFor(r).pause()):this.soundPending&&(this.afterRender=()=>{this.soundPending=!1,this.videoFor(r).playWithSound()});for(let s of this.cardVideos.keys())Math.abs(s-r)>ne&&this.cardVideos.delete(s)}stepInPlayer(t){this.carousel.step(t,{evenIfLocked:!0}),this.player.showNext(t)}openPlayer({productOpen:t=!1}={}){var r;this.player.isOpen||((r=this.activeVideo)==null||r.pause(),this.player.open({productOpen:t}))}closePlayer(){if(this.player.isOpen){this.player.close();for(let t of this.cardVideos.values())t.resume();this.carousel.focusActive()}}get locale(){var t,r;return(r=(t=this.closest('[lang]:not([lang=""])'))==null?void 0:t.lang)!=null?r:Se}get labels(){var n;let{locale:t,labelAddToCart:r="",labelViewProduct:i=""}=this,s=JSON.stringify([t,r,i]);return((n=this.labelSet)==null?void 0:n.key)!==s&&(this.labelSet={key:s,labels:Lr(t,{addToCart:r,viewProduct:i})}),this.labelSet.labels}get formatPrice(){var i,s;let{locale:t}=this,r=`${t}|${(i=this.currency)!=null?i:""}`;return((s=this.formatter)==null?void 0:s.key)!==r&&(this.formatter={key:r,format:Ge(t,this.currency)}),this.formatter.format}productOf(t){var i;let r=this.products==="loading"?"loading":(i=this.products)==null?void 0:i.get(t.ad_id);return Ke(t,this.formatPrice,this.labels,r)}render(){let{stories:t}=this,r=this.carousel.active,i=t[r];if(!i)return f;let s=st(t.length,r).map(n=>{let a=(r+n+t.length)%t.length;return{offset:n,story:t[a],label:this.labels.position(this.labels.show,a,t.length)}});return m`
406
1312
  <div class="root">
407
- ${Ce(dt,this.cardVideo,{label:f.watch,soundOnLabel:f.soundOn,soundOffLabel:f.soundOff,onSelect:()=>this.openPlayer()})}
1313
+ ${this.carousel.render(t,this.renderSlide,this.labels)}
408
1314
  </div>
409
- ${this.player.render(dt)}
410
- `}};O.styles=[x`
1315
+ ${this.player.render(i,{labels:this.labels,navigation:t.length>1,neighbors:s,product:this.productOf(i),cta:Ae(i),onPress:()=>this.events.click(i)})}
1316
+ `}};R.properties={publisherId:{attribute:"publisher-id"},sessionId:{attribute:"session-id"},placement:{},userId:{attribute:"user-id"},accountName:{attribute:"account-name"},channel:{converter:ai},timeout:{type:Number},quantity:{type:Number},currency:{},labelAddToCart:{attribute:"label-add-to-cart"},labelViewProduct:{attribute:"label-view-product"},hydration:{converter:di},hydrationTimeout:{type:Number,attribute:"hydration-timeout"},inactiveAutoplay:{type:Boolean,attribute:"inactive-autoplay",converter:ni},stories:{state:!0},products:{state:!0}},R.styles=[g`
411
1317
  :host {
412
1318
  display: block;
413
1319
  font-family: var(--vtex-ads-story-font-family, inherit);
414
1320
  color: var(--vtex-ads-story-color-text, inherit);
415
1321
  }
416
- `,Ee,Se];function Y(){typeof customElements!="undefined"&&(customElements.get(F)||customElements.define(F,O))}Y();return yt(Dt);})();
1322
+ `,Qe,Ye,rt,it];function ce(){typeof customElements!="undefined"&&(customElements.get($)||customElements.define($,R))}ce();return Ur(li);})();
417
1323
  /*! Icons from Phosphor Icons (https://phosphoricons.com), MIT License, Copyright (c) 2023 Phosphor Icons */
418
1324
  /*! Bundled license information:
419
1325
 
@@ -428,8 +1334,9 @@
428
1334
  lit-html/lit-html.js:
429
1335
  lit-element/lit-element.js:
430
1336
  lit-html/directive.js:
431
- lit-html/directives/unsafe-html.js:
432
1337
  lit-html/async-directive.js:
1338
+ lit-html/directives/unsafe-html.js:
1339
+ lit-html/directives/repeat.js:
433
1340
  (**
434
1341
  * @license
435
1342
  * Copyright 2017 Google LLC
@@ -450,5 +1357,12 @@ lit-html/directives/ref.js:
450
1357
  * Copyright 2020 Google LLC
451
1358
  * SPDX-License-Identifier: BSD-3-Clause
452
1359
  *)
1360
+
1361
+ lit-html/directives/style-map.js:
1362
+ (**
1363
+ * @license
1364
+ * Copyright 2018 Google LLC
1365
+ * SPDX-License-Identifier: BSD-3-Clause
1366
+ *)
453
1367
  */
454
1368
  //# sourceMappingURL=vtex-ads-stories.js.map