(()=>{var tn=Object.defineProperty,rn=Object.defineProperties;var sn=Object.getOwnPropertyDescriptors;var Ps=Object.getOwnPropertySymbols;var Oa=Object.prototype.hasOwnProperty,za=Object.prototype.propertyIsEnumerable;var Ea=(r,e,t)=>e in r?tn(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,n=(r,e)=>{for(var t in e||(e={}))Oa.call(e,t)&&Ea(r,t,e[t]);if(Ps)for(var t of Ps(e))za.call(e,t)&&Ea(r,t,e[t]);return r},h=(r,e)=>rn(r,sn(e));var ja=(r,e)=>{var t={};for(var i in r)Oa.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&Ps)for(var i of Ps(r))e.indexOf(i)<0&&za.call(r,i)&&(t[i]=r[i]);return t};var m=(r,e,t)=>new Promise((i,s)=>{var a=d=>{try{l(t.next(d))}catch(u){s(u)}},o=d=>{try{l(t.throw(d))}catch(u){s(u)}},l=d=>d.done?i(d.value):Promise.resolve(d.value).then(a,o);l((t=t.apply(r,e)).next())});function B(r,e,t=!1){var i;return function(){var s=this,a=arguments;clearTimeout(i),i=setTimeout(function(){i=null,t||r.apply(s,a)},e),t&&!i&&r.apply(s,a)}}var w=class{constructor(e={}){if(this.e=e||{},!this.app)throw new Error("Fera app is required");this.it=!1,this.Uo()}get app(){return this.e.app==="this"?this:this.e.app||window&&globalThis.fera}get store(){return this.e.store?this.e.store:this.app.store}t(e,t=null){return this.app.t(e,t)}formatNumber(e,t={}){return this.app.i18n.formatNumber(e,t)}V(e){return`${this.app.config.cdnUrl.replace(/\/$/,"").replace(/\/js$/,"/js/v3")}/${e.replace(/^\//,"")}?v=${this.app.version}`}C(){this.Zo&&this.qt("log",arguments)}Yo(){this.qt("info",arguments)}get Ai(){return this.e.environment||this.app.environment}get Zo(){return this.app.config.debugMode}get Ei(){return this.app.config.devMode}get Oi(){return this.Ai==="test"}ne(){this.qt("warn",arguments)}get st(){return["development","test","staging"].includes(this.Ai)||this.Ei||this.Oi}D(){if(this.qt("error",arguments),this.st){let e=arguments[0]instanceof Error?arguments[0]:new Error(arguments[0]);throw globalThis.at=globalThis.at||[],globalThis.at.push({line_number:e.lineno,column_number:e.colno,message:e.message}),e}}qt(e,t){globalThis.console&&(typeof t[0]=="string"&&(t[0]=`[Fera] ${t[0]}`),console[e].apply(this,t))}destroy(){this.le=[],this.Se=[]}on(e,t){return typeof e!="string"&&(t=e.callback,e=e.event),(e.indexOf(" ")===-1?[e]:e.split(" ")).forEach(s=>{if(s==="ready"&&this.it===!0)return t(this);this.le[s]=this.le[s]||[],this.le[s].push(t)}),this}once(e,t){var i=e.indexOf(" ")===-1?[e]:e.split(" ");return i.forEach(s=>{if(s==="ready"&&this.it===!0)return t(this);this.Se[s]=this.Se[s]||[],this.Se[s].push(t)}),this}clearOnceListeners(e){this.Se[e]=[]}clearListeners(e){this.le[e]=[]}trigger(e,t=null){return(e.indexOf(" ")===-1?[e]:e.split(" ")).forEach(s=>{let a=this.le[s];a&&a.length>0&&a.forEach(l=>l(t));let o=this.Se[s];o&&o.length>0&&(o.forEach(l=>l(t)),this.clearOnceListeners(s))}),this}debouncedTrigger(e,t=null){return this.Wt=this.Wt||{},this.Wt[e]||(this.Wt[e]=B(()=>this.trigger(e,t),100)),this.Wt[e](),this}Uo(){this.le=n({},this.e.listeners||this.e.on||{}),this._s(this.le),delete this.e.listeners,delete this.e.on,this.Se=n({},this.e.once),this._s(this.Se),delete this.e.once}_s(e){Object.keys(e).forEach(t=>{t.split(" ").forEach(i=>{typeof e[i]=="function"&&(e[i]=[e[i]])})})}Cs(){this.it=!0,this.trigger("ready",this)}static zi(){return globalThis.ji=globalThis.ji||0,globalThis.ji+=1,globalThis.ji}zi(){return this.constructor.zi()}k(){return this.ks=this.ks||this.zi(),this.ks}};function Ct(r,{timeout:e=1e3,checkInterval:t=100,timeoutError:i=null}){return r()?Promise.resolve(!0):new Promise(s=>{let a=0,o=setInterval(()=>{if(r())clearInterval(o),s(!0);else if(a>=e){if(clearInterval(o),i)throw typeof i=="string"?new Error(i):i;s(!1)}a+=t},t)})}function F(r,e=!0){return e===!0?[!0,1,"1","true","t","yes","y","on"].indexOf(r)!==-1:[!1,0,null,"0","false","f","no","n","off",void 0].indexOf(r)===-1}var ce=class r extends URL{get params(){return this.de||(this.de=Object.fromEntries(new URLSearchParams(this.search).entries()))}toString(){return this.search=new URLSearchParams(this.params).toString(),super.toString()}get ext(){return this.pathname.split(".").pop()}clone(){return new r(this.toString())}};function li(r,e=!1){return r.replace(/[\s_.-]/g," ").split(" ").map(([i,...s],a)=>a===0&&!e?(i||"").toLowerCase()+s.join("").toLowerCase():(i||"").toUpperCase()+s.join("").toLowerCase()).join("")}var ki=class extends w{get Ss(){return{r:"showContentSubmitter",pr:"showReturningShopperReviewModal",writeReview:"showContentSubmitter",submitContent:"showContentSubmitter",submitReview:"showContentSubmitter",review:"showContentSubmitter",editReview:"showContentSubmitter",showContentSubmission:"showContentSubmitter",showReturningShopperReviews:"showReturningShopperReviewModal",showReturningVisitorReviews:"showReturningShopperReviewModal"}}get Ms(){return{locale:["locale","fera_locale","feraLocale","fera_language","feraLanguage","lang","fera_lang","feraLang"],designMode:["design","design_mode","designMode","fera_design","feraDesign","fera_design_mode","feraDesignMode"],adminMode:["admin_mode","adminMode","fera_admin","feraAdmin","fera_admin_mode","feraAdminMode"],debugMode:["debug_mode","debugMode","fera_debug","feraDebug","fera_debug_mode","feraDebugMode"]}}isHttps(){return this.url.protocol.toString().match(/^https:?/)}hasUrlApiParam(){let e=this.params.fera||this.params.f;return!(!e||(e=this.Ss[e]||e,typeof this.app[e]!="function"))}triggerUrlApi(){let e=this.params.fera||this.params.f;if(e&&(e=this.Ss[e]||e,typeof this.app[e]=="function"))try{e==="r"&&(e="writeReview"),this.app[e]()}catch(t){this.D(t)}}loadUrlConfig(){let e={};Object.keys(this.Ms).forEach(t=>{for(let i of this.Ms[t])if(typeof this.params[i]!="undefined"){e[t]=this.params[i];break}}),this.app.configure(e)}get url(){let e=new URLSearchParams(globalThis.location.search).get("test_url");return new ce(e||this.e.url||globalThis.location.toString())}get isRoot(){return!!(this.path==""||this.path=="/"||this.path.toString().match(/^\/([a-z]{2}(-[a-z]{2})?\/?)$/i))}get path(){return this.url.pathname}get params(){return this.url.params}getFeraParam(e){let t=e;return Array.isArray(e)&&(t=e.find(i=>(i=`${i}`.replace(/^fera_?/i,""),this.params[`fera_${i}`]||this.params[`fera${li(i||"",!0)}`]))),t=`${t}`.replace(/^fera_?/i,""),this.params[`fera_${t}`]||this.params[`fera${li(t||"",!0)}`]}addParams(e={}){if(this.app.config.designMode)return;let t=new ce(globalThis.location.toString());Object.keys(e).forEach(i=>{t.params[i]!=e[i]&&(t.params[i]=e[i])}),globalThis.history.replaceState(e,"",t.toString())}removeParams(e={}){if(this.app.config.designMode)return;let t=new ce(globalThis.location.toString());Object.keys(e).forEach(i=>{t.params[i]==e[i]&&delete t.params[i]}),globalThis.history.replaceState(e,"",t.toString())}hasFeraFlag(e){return typeof this.getFeraParam(e)!="undefined"}isFeraFlag(e,t){return Array.isArray(e)?e.some(i=>this.isFeraFlag(i,t)):this.hasFeraFlag(e)?F(this.getFeraParam(e))===F(t):!1}};function ft(r,e,{prependArray:t=!1}={}){let i=n({},r);return Object.keys(e).forEach(s=>{s in i?Array.isArray(i[s])?i[s]=t?[...e[s],...i[s]]:[...i[s],...e[s]]:typeof i[s]=="object"?i[s]=ft(i[s],e[s],{prependArray:t}):i[s]=e[s]:i[s]=e[s]}),i}var Si=class extends w{constructor(e){super(e),this.template=this.e.template}get filters(){return{default:(e,t)=>e!==void 0?e:t,t:e=>this.t(e)}}get variables(){return this.e.variables||{}}get varsAsStr(){return this.Vi?this.Vi:(this.Vi=Object.keys(this.variables).map(e=>`const ${e} = ${this.Xo(this.variables[e])};`).join(""),this.Vi)}Jo(e){return e.split(".").reduce((t,i)=>{if(t&&t[i])return t[i]},this.variables)}render(){return this.template.replace(/\{%-?\s*if\s+([^%+{}]*?)\s*-?%}(.*)\{%-?\s*else? ?if\s+([^%+{}]*?)\s*-?%}(.*)\{%-?\s*else\s*-?%}(.*)\{%-?\s*endif\s*-?%}/g,(e,t,i,s,a,o)=>this.Fe(t)?i:this.Fe(s)?a:o).replace(/\{%-?\s*if\s+([^%+{}]*?)\s*-?%}(.*)\{%-?\s*else? ?if\s+([^%+{}]*?)\s*-?%}(.*)\{%-?\s*else\s*-?%}(.*)\{%-?\s*endif\s*-?%}/g,(e,t,i,s,a)=>this.Fe(t)?i:this.Fe(s)?a:"").replace(/\{%-?\s*if\s+([^%+{}]*?)\s*-?%}(.*)\{%-?\s*else\s*-?%}(.*)\{%-?\s*endif\s*-?%}/g,(e,t,i,s)=>this.Fe(t)?i:s).replace(/\{%-?\s*if\s+([^%+{}]*?)\s*-?%}(.*)\{%-?\s*endif\s*-?%}/g,(e,t,i)=>this.Fe(t)?i:"").replace(/\{\{\s*([^}]+?)\s*}}/g,(e,t)=>this.Ko(t))}Ko(e){let[t,...i]=e.split("|").map(a=>a.trim()),s=this.Jo(t);for(let a of i){let[o,...l]=a.split(":").map(d=>d.trim());this.filters[o]&&(s=this.filters[o](s,...l))}return s}Xo(e){let t=[];return JSON.stringify(e,(i,s)=>{if(typeof s=="object"&&s!==null){if(t.includes(s))return;t.push(s)}return s})}Fe(e){let t=`return ${e.replace(/\s+or\s+/," || ").replace(/\s+and\s+/," && ")}`;return new Function(`${this.varsAsStr}; ${t}`)()}};var Mi=class extends w{constructor(e={}){var t;super(e),this.Ht=((t=this.app.store)==null?void 0:t.translations)||{}}static get supportedLanguageCodes(){return["en","de","es","fr","id","it","nl","no","pt","ro","ru","sk","sv","th","zh-TW"]}get isCurrentLocaleSupported(){return this.constructor.supportedLanguageCodes.includes(this.locale)}get locale(){let e=this.app.locale||"en";return["zh","zh-cn","zh-tw"].includes(e.toLowerCase())&&(e="zh-TW"),e}formatNumber(e,t={}){return new Intl.NumberFormat(this.locale,t).format(e)}t(e,t=null){if(!e)return"";let i=this.ot[e],s,a;return typeof e!="string"&&(e.toString?e=e.toString():e=`${e}`),i||(s=this.Go(e),i=this.ot[s]),i=i||this.ot[this.Di(e)]||this.ot[this.Di(e,!0)]||e,a=i,t&&i.match(/\{[{%]/)&&(a=this.Qo(i,t)),s&&s!=e&&i==this.ot[s]&&(a=this.Di(a)),a}loadTranslations(){return m(this,arguments,function*(e=this.locale){var t;if(e!="en"&&((t=this.app.store)==null?void 0:t.locale)!==e){if(!this.isCurrentLocaleSupported){this.C(`${e} locale not natively supported.`);return}try{let i=yield this.app.api.retrieveTranslations(e);this.Ht=ft(i,this.Ht)}catch(i){this.D(i)}}})}get ot(){return this.Ht[this.locale]||this.Ht.en||{}}Go(e){return e.replace(/(&)/g,"&").replace(/(<)/g,"<").replace(/(>)/g,">").replace(/(")/g,'"').replace(/(')/g,"'")}Di(e,t=!1){let i=e;return t&&(i=i.replace(/&/g,"&")),i.replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}Qo(e,t={}){return new Si({app:this.app,template:e,variables:t}).render()}};var Fe=class{constructor(e,t,i){this.stateValue=e,this.ruleValue=t,this.operator=i}isTrue(){return this[this.operator]()}equal(){return this.stateValue==this.ruleValue}not_equal(){return!this.equal()}equal_i(){return this.equal()}not_equal_i(){return!this.equal_i()}contains(){return this.stateValue==this.ruleValue}not_contains(){return!this.contains()}less(){return this.stateValuethis.ruleValue}greater_or_equal(){return this.stateValue>=this.ruleValue}between(){return this.greater()||this.less()}not_between(){return!this.between()}};var kt=class extends Fe{constructor(e,t,i){super(String(e).trim(),String(t).trim(),i)}equal(){return this.stateValue==this.ruleValue}equal_i(){return this.stateValue.toLowerCase()==this.ruleValue.toLowerCase()}contains(){return this.stateValue.toLowerCase().indexOf(this.ruleValue.toLowerCase())!==-1}less(){return parseFloat(this.stateValue)parseFloat(this.ruleValue)}greater_or_equal(){return parseFloat(this.stateValue)>=parseFloat(this.ruleValue)}between(){return this.ruleValue.indexOf(this.stateValue)!==-1}begins_with(){return this.stateValue&&this.stateValue.indexOf(this.ruleValue||"")===0}};var Ri=class extends kt{constructor(e,t,i){super(e,t.value,i)}};var Ti=class extends Fe{constructor(e,t,i){super(e,t,i),typeof this.stateValue!="string"&&(this.stateValue=String(this.stateValue).split(",")),this.stateValue=this.stateValue.sort()}equal(){let e=this.ruleValue;return typeof this.ruleValue!="object"&&(e=String(this.ruleValue).split(",")),this.stateValue.join(",")==e.sort().join(",")}contains(){return this.stateValue.indexOf(this.ruleValue)!==-1}less(){return this.stateValue.lengththis.ruleValue}greater_or_equal(){return this.stateValue.length>=this.ruleValue}between(){return this.ruleValue.every(e=>this.stateValue.indexOf(e)!==-1)}};var $i=class extends w{constructor(e){super(e),this.rule=this.e.rule,this.atomic=!0,this.comparisonClass=this.en()}match(e){return m(this,null,function*(){let t=yield e.fetchValue(this.rule.field,this.rule.value);return t==null?!1:new this.comparisonClass(t,this.rule.value,this.rule.operator).isTrue()})}en(){return this.rule.type==="string"?this.rule.field.match(/_param$/)&&typeof this.rule.value=="object"?Ri:kt:this.rule.type==="array"?Ti:Fe}};var qe=class extends w{constructor(e){var t;super(e),this.conditions=this.e.conditions||{rules:[]},typeof this.conditions=="string"&&(this.conditions=JSON.parse(this.conditions)),Array.isArray(this.conditions)&&(this.conditions={rules:this.conditions}),this.rules=(t=this.conditions.rules)==null?void 0:t.map(i=>i.condition?new this.constructor({app:this.app,conditions:i}):new $i({app:this.app,rule:i})),this.separator=this.conditions.condition}get hasRule(){return this.rules&&this.rules.length>0}match(e){return this.hasRule?new Promise(t=>Promise.all(this.rules.map(i=>i.match(e))).then(i=>{this.separator==="AND"?t(i.every(s=>s)):t(i.some(s=>s))})):Promise.resolve(!0)}};function be(){var r;return((r=navigator.userAgentData)==null?void 0:r.mobile)||globalThis.innerWidth<575}var M=class extends w{constructor(e={},t={}){super(t),this.data={},this.Rs=n({},this.Ts()),Object.keys(e||{}).forEach(i=>{e[i]!==null&&e[i]!==void 0&&(this.Rs[i]=e[i])}),this.resourceName=this.e.resourceName||this.constructor.resourceName,this.resourceTitle=this.e.resourceTitle||this.resourceName.replace(/(^\w{1})|(\s{1}\w{1})/g,i=>i.toUpperCase()),this.defaultParams=this.e.defaultParams||{},this.loadDataFromServer(this.Rs,{fresh:!0}),this.persisted||Object.keys(this.data).forEach(i=>{this.changes[i]={to:this.data[i]}}),this.readOnlyAttributes=["id","type","type_name"],this.Nc=new Date().getTime(),this.$s=this.$s||[],this.tn(),this.Cs()}get persisted(){return!!this.id}get nt(){return{}}get B(){return null}get qe(){return this.B?(this.data[this.B]=this.data[this.B]||{},this.data[this.B]):{}}get Bs(){return{}}Ts(){return this.Bs}static get aliasAttributes(){return{}}static get resourceName(){throw new Error(`BaseModel static get resourceName not overridden for type ${this.name}. Please override this method in your model class.`)}static get associations(){return{hasOne:[],hasMany:[]}}static get cssClassName(){throw new Error("cssClassName must be implemented by subclass")}get cssClassName(){return this.constructor.cssClassName}tn(){var e,t;(e=this.constructor.associations.hasOne)==null||e.forEach(i=>{let s=i.key.replace(/[\-_](\w)/g,o=>o.charAt(1).toUpperCase()),a=this.e[i.key]||this.e[s]||this.get(i.key)||this.get(s);a instanceof this.constructor?this[s]=a:typeof a=="object"&&(this[s]=this.G(i,a))}),(t=this.constructor.associations.hasMany)==null||t.forEach(i=>{let s=i.key.replace(/[\-_](\w)/g,o=>o.charAt(1).toUpperCase()),a=this.e[i.key]||this.e[s]||this.get(i.key)||this.get(s);a instanceof Array&&(this[s]=a.map(o=>o instanceof this.constructor?o:typeof a=="object"?this.G(i,o):null).filter(o=>o!==null))}),this.Ps()}Ps(){this.constructor.allAssociations.forEach(e=>{e.through&&this[e.through]&&(this[e.key]||this[e.through][e.key]&&(this[e.key]=this[e.through][e.key]))})}get title(){return this.getResourceTitle()||this.getResourceName()}getResourceTitle(){return this.resourceTitle}getResourceName(){return this.resourceName}set(e,t,i){if(typeof e=="object"&&typeof t=="undefined")return Object.keys(e).forEach(a=>{this.set(a,e[a],i)}),this;let s=this.get(e);return JSON.stringify(s)!=JSON.stringify(t)&&this.Q(e,t),this}b(e){return this.constructor.aliasAttributes[e]?this.b(this.constructor.aliasAttributes[e]):e==="id"?this.id:this.B&&Object.keys(this.nt).includes(e)?typeof this.qe[e]!="undefined"?this.qe[e]:this.nt[e]:this.data[e]}Q(e,t){if(this.constructor.aliasAttributes[e])return this.Q(this.constructor.aliasAttributes[e],t);if(e==="id"){this.id=t;return}if(this.B===e&&typeof t=="object")return Object.keys(t).forEach(i=>this.Q(i,t[i]));this.B&&Object.keys(this.nt).includes(e)?this.qe[e]=t:this.data[e]=t}isSet(e){let t=this.b(e);return typeof t!="undefined"&&t!==null}get(e,t){if(e==="id")return this.id;let i=this.b(e);return typeof t!="undefined"&&(typeof i=="undefined"||i===null||i==="")?t:i}has(e){let t=this.b(e);return typeof t=="boolean"?this.is(e):!(typeof t=="undefined"||t===null||t==="")}can(e){return this.is(e)}is(e){let t=this.b(e);if(typeof t=="undefined"){if(typeof this.b(`is_${e}`)!="undefined")return this.is(`is_${e}`);if(typeof this.b(`has_${e}`)!="undefined")return this.is(`has_${e}`);if(typeof this.b(`can_${e}`)!="undefined")return this.is(`can_${e}`);if(typeof this.b(`dont_${e}`)!="undefined")return!this.is(`dont_${e}`)}return!!t}getData(){return h(n(n(n({},this.nt),this.data),this.qe),{id:this.id})}clone(){return new this.constructor(h(n({},JSON.parse(JSON.stringify(this.data))),{id:this.id}),n({},this.e))}rn(e){let t={},i=n({},this.data);return Object.keys(e).concat(Object.keys(i)).filter((a,o,l)=>l.indexOf(a)===o).forEach(a=>{let o=i[a],l=e[a];this.$s.includes(a)&&(o=JSON.stringify(o),l=JSON.stringify(l)),o!==l&&(t[a]={from:o,to:l,attribute:a})}),t}sn(e,t,i={}){let s=e.key.replace(/[\-_](\w)/g,a=>a.charAt(1).toUpperCase());t===null?this[s]=null:this[s]?this[s].loadDataFromServer(t,i):this[s]=this.G(e,t)}G(e,t){if(Array.isArray(t))return t.map(a=>this.G(e,a));let i={app:this.app};e.inverseOf&&(i[e.inverseOf]=this);let s;return t instanceof e.klass?(s=t,e.inverseOf&&(s[e.inverseOf]=s[e.inverseOf]||this)):(e.inverseOf&&(i[e.inverseOf]=this),s=new e.klass(t,i)),s}static get allAssociations(){return[...this.associations.hasOne||[],...this.associations.hasMany||[]]}loadDataFromServer(e,t={}){let i=t.fresh||Object.keys(this.data).length<1,s=i?{}:this.rn(e),a=n({},e||{});return a.id&&!this.id&&(this.id=a.id,delete a.id),Object.keys(a).length<1&&i?{}:(this.B&&a[this.B]&&i&&(this.data[this.B]=a[this.B],delete a[this.B]),Object.keys(a).forEach(o=>this.Q(o,a[o])),this.constructor.allAssociations.forEach(o=>{typeof a[o.key]!="undefined"&&this.sn(o,a[o.key],t)}),this.Ps(),this.changes=this.changes||{},i?this.changes={}:(Object.keys(s).forEach(o=>{this.changes[o]?this.changes[o].to=s[o].to:this.changes[o]=s[o]}),this.an(s)),this.trigger("load load:after"),s)}setData(e){Object.keys(e).forEach(t=>this.set(t,e[t]))}an(e){if(!e)return;let t=Object.keys(e);t.length<1||(t.forEach(i=>{i!="id"&&this.trigger(`${i}.change ${i}.update`,e[i])}),this.debouncedTrigger("change update",e))}};var St=class extends M{constructor(e,t={}){super(e,h(n({},t),{resourceName:"channel"}))}get url(){return this.get("url")}get code(){return this.get("code")}};var Mt=class extends w{constructor(e){super(e),this.e.models&&(this.models=this.e.models),this.e.meta&&(this.meta=this.e.meta),this.Ut=this.e.params||{},this.ge={},this.Ls()}Ni(){return this.lt(this.e.models,{offset:0,limit:this.e.models.length,total_count:this.e.models.length,page:1}),this.models}forEach(e){return this.models.forEach(e)}every(e){return this.models.every(e)}get length(){return this.models.length}sort(e){return m(this,null,function*(){this.Is!==e&&(this.Is=e,this.trigger("sort:before",{sortBy:e}),yield this.reload(),this.trigger("sort:after",{sortBy:e}))})}filter(e=null){return m(this,null,function*(){e!==null&&(this.ge=n(n({},this.ge),e)),this.trigger("filter:before",this.ge),yield this.reload(),this.trigger("filter:after",this.ge)})}removeFilters(e){return Array.isArray(e)||(e=[e]),e.forEach(t=>delete this.ge[t]),this.filter()}clearFilters(){return this.ge={},this.filter()}load(){return m(this,arguments,function*(e={}){throw new Error("load() method must be implemented in the child class")})}reload(){return m(this,null,function*(){this.Ls(),this.trigger("reload:before"),yield this.load(),this.trigger("reload reload:after",this.models)})}Ls(){this.models=[],this.meta={},this.Fi=null,this.loaded=!1}loadMore(){return this.load().then(e=>{this.loaded=!0,e.length&&e.length>0&&this.trigger("load:more load",e)})}loadPage(e){return this.trigger("load.page:before"),this.load({page:e}).then(t=>{this.loaded=!0,t.length&&t.length>0&&this.trigger("load:page",t)})}loadNextPage(){return this.loadPage(this.nextPage)}loadPrevPage(){return this.loadPage(this.currentPage-1)}qi(){this.As=!0,this.trigger("load:before")}get items(){return this.models}get isLoading(){return this.As}lt(e,t){this.e.usePagination?this.models=e:this.models=this.models.concat(e),this.meta=t,this.Fi===null&&(this.Fi=t.offset),this.As=!1,this.trigger("load:after load",e)}get hasMore(){return this.meta?this.models.length `)}};var We=class extends Error{constructor({response:e,app:t}){super(e.json.message||e.json.code),this.code=e.json.code,this.response=e,this.app=t}};var ie=class extends M{constructor(e,t={}){super(e,n({resourceName:"media"},t))}static get associations(){return{hasOne:[{key:"customer",klass:ue,through:"review"},{key:"product",klass:R,through:"review"},{key:"review",klass:O}]}}get isVideo(){return!1}get isPhoto(){return!1}G(e,t){return e.klass===ue&&t&&(t.reviews=[this]),super.G(e,t)}get isUploaded(){return!0}loadAssociatedReviewFromServer(){let e=this.get("review_id");if(e){let t=this.constructor.allAssociations.find(i=>i.key==="review");return this.app.api.retrieveReview(e).then(i=>{let s=t.key.replace(/[\-_](\w)/g,a=>a.charAt(1).toUpperCase());return this[s]=this.G(t,i),this[s]}).catch(i=>this.nn(i))}else return null}nn(e){if(e instanceof We&&(e.code==="not_found"||e.response&&e.response.status===404))return this.ne(`Unable to load associated review(#${this.get("review_id")}) for media(#${this.id}). This may be due to the review being deleted.`),null;throw e}get type(){return this.get("type","photo")}get url(){return this.get("url",this.get("thumbnail_url",this.constructor.placeholderUrl))}get thumbnailUrl(){return this.get("thumbnail_url",this.constructor.placeholderUrl)}get smallThumbnailUrl(){return this.get("thumbnail_url","").replace("width=400,height=400","width=200,height=200").replace("class=thumb","class=sthumb")}static get placeholderUrl(){return"https://uploads.fera.ai/placeholders/photo.png"}static get SOCIAL_URL_REGEXES(){return{youtube:/^((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu\.be))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/,facebook:/^(?:(?:https?:)?\/\/)?(?:(www|web|m)\.)?(facebook|fb)\.com\/[a-zA-Z0-9.]+\/videos\/(?:[a-zA-Z0-9.]+\/)?([0-9]+)/,vimeo:/(http|https)?:\/\/(www\.|player\.)?vimeo\.com\/(?:(channels|video)\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)(\d+)(?:|\/\?)/,instagram:/(https?:\/\/(?:www\.)?instagram\.com\/(reel|p)\/([^/?#&]+)).*/}}};var Se=class extends ie{constructor(e,t={}){super(e,n({resourceName:"video"},t))}get isVideo(){return!0}get isPhoto(){return!1}static get placeholderUrl(){return"https://uploads.fera.ai/placeholders/video.png"}get importedVideoUrl(){return this.videoType==="url"?this.url:(this.constructor.SOCIAL_URL_REGEXES[this.videoType].test(this.url),this.videoType==="youtube"?`https://www.youtube.com/embed/${RegExp.$5}?modestbranding=1&autoplay=1`:this.videoType==="vimeo"?`https://player.vimeo.com/video/${RegExp.$5}`:this.videoType==="instagram"?`https://www.instagram.com/p/${RegExp.$3}/embed`:this.videoType==="facebook"?`https://www.facebook.com/plugins/video.php?href=${this.url}`:this.url)}get videoType(){return Object.keys(this.constructor.SOCIAL_URL_REGEXES).find(e=>this.constructor.SOCIAL_URL_REGEXES[e].test(this.url))||"url"}get isUploaded(){return this.videoType==="url"}get type(){return"video"}};var Me=class extends ie{constructor(e,t={}){super(e,n({resourceName:"photo"},t))}get isVideo(){return!1}get isPhoto(){return!0}get thumbnailUrl(){return this.get("thumbnail_url",this.get("url")||this.constructor.placeholderUrl)}get type(){return"photo"}};var O=class extends M{constructor(e,t={}){super(e,n({resourceName:"review"},t))}get title(){return this.forProduct?this.t("Product Review"):this.t("Store Review")}get bodyHtml(){return this.body.toString().replace(/\n/g,`
`)}get rating(){return this.get("rating")}static get associations(){return{hasOne:[{key:"customer",klass:ue},{key:"product",klass:R},{key:"channel",klass:St}],hasMany:[{key:"media",klass:ie,inverseOf:"review"}]}}G(e,t){if(e.klass===ue&&t&&(t.reviews=[this]),e.klass===ie&&t){let i=t.type==="video"?Se:Me;return super.G(h(n({},e),{klass:i}),t)}return super.G(e,t)}get body(){return this.get("body",this.get("heading",""))}get storeReply(){return this.get("store_reply")?new Bi(this.get("store_reply"),{app:this.app,review:this}):null}get forProduct(){return this.get("subject")==="product"}get forStore(){return this.get("subject")==="store"}get hasLinkableProduct(){return this.forProduct&&this.product&&this.product.get("url")}get hasDisplayableProduct(){return this.forProduct&&this.product&&this.product.get("name")}};var R=class extends M{constructor(e,t={}){super(e,n({resourceName:"product"},t))}static get aliasAttributes(){return h(n({},super.aliasAttributes),{product_id:"id"})}static get associations(){return{hasMany:[{key:"reviews",klass:O,inverseOf:"product"},{key:"media",klass:ie,inverseOf:"product"}]}}static get resourceName(){return"product"}get isLinkable(){return this.is("visible")&&this.get("url")}get name(){return this.get("name")}get rating(){return this.get("rating",{count:0,average:0})}get averageRating(){return this.rating.average}get url(){return this.get("url")}get thumbnailUrl(){return this.get("thumbnail_url","")}get smallThumbnailUrl(){return this.thumbnailUrl?this.thumbnailUrl.includes("class=thumb")?this.thumbnailUrl.replace("class=thumb","class=vsthumb"):this.thumbnailUrl.includes("width=")?this.thumbnailUrl.replace("width=400,height=400","width=80,height=80"):this.thumbnailUrl.match(/https?:\/\/cdn\.shopify.*/)?this.thumbnailUrl.replace(/_[0-9]+x[0-9]+\./,"_80x80."):this.thumbnailUrl.match(/wixstatic.*w_[0-9]+,h_[0-9]+/)?this.thumbnailUrl.replace(/w_[0-9]+,h_[0-9]+/,"w_80,h_80"):this.thumbnailUrl:this.thumbnailUrl}get counts(){return this.get("counts",this.get("cached_counts",{}))}getCount(e,t=0){return this.counts[e]||t}};var Pi=class extends w{constructor(e){super(e),this.data=this.e.data||{},this.data.current_page=this.data.current_page||{}}matches(e){return new qe({app:this.app,conditions:e}).match(this)}get device(){return this.ln||(this.ln={width:globalThis.screen&&globalThis.screen.width,height:globalThis.screen&&globalThis.screen.height,agent:navigator&&navigator.userAgent,language:navigator&&navigator.language})}get pageUrl(){var e;return this.dn||(this.dn=new ce((e=this.data.current_page.url)!=null?e:this.app.request.url.toString()))}get productId(){return this.ve||(this.ve=this.data.product_id||this.data.product.id||this.app.currentProductId)}get pageTitle(){var e;return(e=this.data.current_page.title)!=null?e:document.title}fetchValue(e,t){return m(this,null,function*(){return this.fetchOtherValue(e,t)||(yield this.fetchLocationValue(e))||this.fetchProductValue(e)})}fetchOtherValue(e,t){switch(e){case"request_url":return this.pageUrl;case"request_title":return this.pageTitle;case"request_is_root":return this.app.request.isRoot;case"request_path":return this.app.request.path;case"request_url_param":return this.hn(t);case"is_mobile":return be()?1:0;case"is_not_mobile":return be()?1:0}return!1}fetchProductValue(e){return m(this,null,function*(){if(e.match(/^(current_)?product_/)){let t=e.replace(/^(current_)?product_/,"");if(t==="id")return this.productId;if(this.u=this.u||this.data.product||(yield this.app.currentProduct),this.u)this.u instanceof R||(this.u=new R(this.u,{app:this.app}));else if(this.productId)this.u=yield this.app.api.retrieveProduct(this.productId);else return!1;if(this.u.has(t))return this.u.get(t)}return!1})}fetchLocationValue(e){return m(this,null,function*(){let t={shopper_country_code:"country_code",shopper_city:"city",shopper_region_name:"region_name",shopper_continent:"continent"};if(t[e]||e.match(/gdpr/)){if(this.Zt=this.Zt||(yield this.app.geoService.retrieveLocation()),this.Zt[t[e]])return this.Zt[t[e]];let i=this.constructor.GDPR_COUNTRY_CODES.indexOf(this.Zt.country_code)!==-1;if(e==="shopper_from_gdpr")return i;if(e==="shopper_not_from_gdpr")return!i}return!1})}hn(e){return typeof e.value=="undefined"?this.pageUrl.search:this.pageUrl.params[e.param]}static get GDPR_COUNTRY_CODES(){return"AT|BE|BG|HR|CY|CZ|DK|EE|FI|FR|DE|GR|HU|IE|IT|LV|LT|LU|MT|NL|PL|PT|RO|SK|SI|ES|SE|GB".split("|")}};function Js(){try{return window.self!==window.top}catch(r){return!0}}var Li=class extends w{constructor(e){super(e),this.cn()}cn(){(this.useSampleData||this.app.request.isFeraFlag(["admin","admin_mode"],!0))&&!F(this.app.storage.get("Config.AdminMode.Enabled"),!1)?this.adminMode=!0:this.app.request.isFeraFlag(["admin","admin_mode"],!1)&&this.adminMode&&(this.adminMode=!1)}get apiKey(){return this.e.apiKey||this.e.api_key||this.e.store_pk||this.e.public_key}get appInstanceId(){return this.e.appInstanceId||this.e.app_instance_id}get mockApi(){return this.e.mockApi}get cacheDisabled(){return Js()||this.adminMode||this.app.request.isFeraFlag("cache",!1)||this.Ei&&!this.app.request.isFeraFlag("cache",!0)||this.app.request.params.fera=="clearCache"}get adminMode(){return this.e.admin_mode||F(this.app.storage.get("Config.AdminMode.Enabled"),!1)}set adminMode(e){this.e.admin_mode=e,this.app.storage.set("Config.AdminMode.Enabled",e),this.Yo(`Admin mode ${e?"auto-enabled":"disabled"}. Caching ${e?"disabled":"enabled"}.`)}get debugMode(){return this.e.debugMode||this.app.request.isFeraFlag(["debug","debug_mode"],!0)||this.devMode}get devMode(){return this.e.devMode||this.e.dev_mode||this.e.environment=="development"}get useSampleData(){return this.designMode||this.e.useSampleData||this.app.request.isFeraFlag(["sample_mode","sample"],!0)||this.hasTestModeFlag}get hasTestModeFlag(){return this.e.testMode||this.app.request.isFeraFlag(["test_mode","test"],!0)}get Yt(){if(this.Ai==="production"){let e="https://cdn.fera.ai/";return{app:"https://app.fera.ai/",apiCdn:`${e}api/`,api:"https://api.fera.ai/",cdn:`${e}js/`}}else{let e="{{ BASE_APP_URL }}/".replace(/\/\/+/,"/"),t=`${e}api/`;return{app:e,apiCdn:this.e.apiUrl||t,api:t,cdn:`${e}js/v3/`}}}get appUrl(){return this.get("appUrl",this.get("app_url",this.Yt.app))}get apiUrl(){return this.get("apiUrl",this.get("api_url",this.Yt.api))}get cdnUrl(){return this.get("cdnUrl",this.get("cdn_url",this.Yt.cdn))}get apiCdnUrl(){return this.get("apiCdnUrl",this.get("api_cdn_url",this.Yt.apiCdn))}get baseApiCdnUrl(){return`${this.apiCdnUrl}`.replace(/\/$/,"")+"/v3/public"}get baseApiUrl(){return`${this.apiUrl}`.replace(/\/$/,"")+"/v3/public"}get designMode(){return this.getBool("designMode",this.getBool("design_mode",!1))||this.app.request.isFeraFlag(["design","design_mode"],!0)}get store(){return this.e.store||null}get locale(){var e;return this.get("locale",(e=this.app.store)==null?void 0:e.locale)}isSet(e){return this.e[e]!==void 0&&this.e[e]!==null}get(e,t=null){return this.isSet(e)?this.e[e]:t}getBool(e,t=!1){return F(this.get(e,t))}get autoIntegrationSelectors(){return this.e.autoIntegrationSelectors||{"after product detail price":[],"after product detail title":[],"after product section":[],page:[{selector:"main",action:"append_to"},{selector:"body",action:"append_to"}],"add to cart button":[{selector:"product-info variant-radios",action:"insert_before"},{selector:'form[action~="/cart/add"] .product-single__add-to-cart',action:"insert_before"},{selector:'form[action~="/cart/add"] button[type=submit]',action:"insert_before"},{selector:'form[action~="/cart/add"] input[type=submit]',action:"insert_before"},{selector:".product-form__cart-submit",action:"insert_before"},{selector:".add-to-cart",action:"insert_before"},{selector:".addToCart",action:"insert_before"},{selector:".add_to_cart",action:"insert_before"},{selector:"#addToCart",action:"insert_before"},{selector:"#add-to-cart",action:"insert_before"},{selector:"#add_to_cart",action:"insert_before"},{selector:".add-to-cart input.button",action:"insert_before"},{selector:".btn-addtocart",action:"insert_before"}],"first header":[{selector:"h1"}],"cart form":[{selector:'form[action~="/cart"]'}],"cart footer":[{selector:".cart__footer",action:"insert_before"}],"cart header":[{selector:".cart-header",action:"insert_before"}],"product content":[{selector:".product__content .grid",action:"insert_after"},{selector:".product__content .grid .grid__item",action:"append_to"},{selector:'[data-section-id="product-template"] .product-single + .product-single__description'},{selector:'[data-section-id="product-template"] .product-single'},{selector:".product-page > .wrapper > .grid.product-single",action:"insert_after"},{selector:".grid.product-single",action:"insert_after"},{selector:".index-section--featured-product"},{selector:'[data-section-id="product"]',action:"insert_after"}],"bottom of product content":[],"product description":[{selector:" .product-single__description",action:"insert_before"}],"before footer":[{selector:"main section:last-of-type",action:"insert_after"},{selector:"body > section:last-of-type",action:"insert_after"},{selector:"main",action:"append_to"},{selector:"footer",action:"insert_before"}],footer:[{selector:'[data-section-id="footer"] .site-footer__content',action:"insert_after"},{selector:"footer > .site-footer__linklist",action:"insert_after"},{selector:"footer .grid-uniform",action:"insert_before"},{selector:"footer .footer__content",action:"insert_before"},{selector:"footer .hr--small",action:"insert_before"},{selector:"footer .site-footer__bottom",action:"insert_before"},{selector:"footer .flex-footer",action:"insert_before"},{selector:'[data-section-id="footer"] .grid:last-child',action:"insert_before"},{selector:"footer .footer__blocks-wrapper",action:"insert_before"}]}}update(e={}){e.autoIntegrationSelectors&&(this.e.autoIntegrationSelectors=ft(this.autoIntegrationSelectors,e.autoIntegrationSelectors,{prependArray:!0}),delete e.autoIntegrationSelectors),this.e=n(n({},this.e),e)}set(e,t){this.e[e]=t}has(e,t=!0){return typeof this.e[e]=="undefined"||this.e[e]===null?!1:t&&!!this.e[e]}};var Rt=class extends w{constructor(e){super(e),this.response=this.e.response}handle(e,t){return this.failed?(t(new Error(this.json.message||this.json.code)),!0):(e(),!1)}get clientOutdated(){return F(this.response.headers.get("Api-Client-Outdated"))}checkForErrors(){if(this.failed)throw new We({app:this.app,response:this})}get failed(){return this.status>=400}get json(){return this.e.json}get errors(){return this.json.errors}get status(){return this.response.status}get headers(){return this.response.headers}static from(i){return m(this,arguments,function*(e,t={}){let s;try{s=e.status<500?yield e.json():{}}catch(a){a instanceof SyntaxError&&e.status>=400&&e.status<500&&(s={message:e.statusText||{400:"Please check your request and try again.",401:"You are not authorized to access this resource.",403:"This request is forbidden.",404:"Request or resource not found. Please check your request and try again.",405:"You're not allowed to perform this action.",406:"Your input was not accepted. Please check it and try again.",415:"The media you tried to upload is not allowed. Please try again with a different file.",429:"You're making too many requests too quickly. Please slow down a bit and try again in a couple minutes."}[e.status]},s.code=s.message.replace(/ /g,"_").toLowerCase())}return new this(h(n({},t),{json:s,response:e}))})}get isSuccess(){return!this.failed}get isClientError(){return this.status>=400&&this.status<500}get isServerError(){return this.status>=500}};var Va={header:"Product Reviews",header_visible:!0,layout:"list",header_when_showing_other_reviews:"Reviews",show_products_for_other_reviews:!0,min_cols:1,write_review_visible:!0,write_review_style:"primary",mobile_write_review_button:"icon",page_size:null,mobile_page_size:null,pagination_mode:"show_more",show_more_style:"secondary",sort_by_enabled:!1,sort_by:"quality:desc",when_no_reviews:"show_all_reviews",sortable:!0,border_visible:!1,bg_visible:!1,header_summary_visible:!0,summaries_visible:!0,store_replies_visible:!0,summary_filters_visible:!0,open_summary_filters_by_default:!1,summary_filter_collapsible:!0,customer_avatars_visible:!0,customer_media_visible:!0,customer_locations_visible:!0,dates_visible:!0,products_visible:!1,ratings_visible:!0,source_icons_visible:!0,default_customer_image:"https://cdn.fera.ai/img/shoppers/placeholder2.png"};function Ls(r){return r.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/([a-zA-Z])(\d)/g,"$1_$2").replace(/([A-Z])(\d)/g,"$1_$2").replace(/[^a-zA-Z0-9]/g,"_").toLowerCase()}function di(r){return r.replace(/[\s_.]/g,"-").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase().replace(/-{2,}/g,"-")}function Ks(r,e){let t={};return e.forEach(i=>{i in r&&(t[i]=r[i])}),t}var K=class extends M{constructor(e,t={}){super(e,n({resourceName:"widget"},t))}static get aliasAttributes(){return h(n({},super.aliasAttributes),{heading:"header",layout_code:"layout",theme_code:"theme",options:"type_settings"})}static get defaultTypeSettings(){return{}}get nt(){return this.constructor.defaultTypeSettings}hasValidOptsToRender(e){return this.forProduct?e.productId||this.productId:!0}get dt(){return["header"]}Ts(){let e=n({},this.Bs);return Object.keys(e).forEach(t=>{this.dt.includes(t)&&(e[t]=this.t(e[t]))}),e}get cssClassName(){return`${this.constructor.cssClassName}-${this.k()}`}get collectionParams(){return Ks(this.getData(),["page_size","limit","sort_by"])}get usePagination(){return this.get("pagination_mode","pagination")==="pagination"}get options(){return this.qe}get allowedElementAttributes(){return this.U.concat(["layout","theme","header","conditions"]).concat(Object.keys(this.qe))}loadDataFromElement(e){Array.from(e.attributes).forEach(t=>this.setFromElement(t.name,t.value))}setFromElement(e,t){if(e.match(/^(data-)?(fera-)?(widget|api-key|type|container|style|rating|class|product([_-]?id|Id)?)$/))return;if(e=Ls(e).replace(/^data_/,"").replace(/^fera_/,""),["options","settings","data-options","data-settings"].includes(e)&&typeof t=="string"&&t[0]==="{"){this.loadTypeDataFromElement(t);return}this.allowedElementAttributes.includes(e)&&this.set(e,t)}loadTypeDataFromElement(e){let t=JSON.parse(e);Object.keys(t).forEach(i=>this.set(i,t[i]))}get U(){return[]}Q(e,t){return this.U.includes(e)?this.Xt(e,t):super.Q(e,t)}Xt(e,t){this.designVars[`--${di(e)}`]=t}b(e){return this.U.includes(e)?this.designVars[Ls(e)]:super.b(e)}get B(){return"type_settings"}get targetSection(){return this.get("target_section")}get onlyShowInHomePage(){return this.targetSection&&!!this.targetSection.match(/^home(_page)?$/i)}get isVisible(){return this.installationMethod?this.onlyShowInHomePage&&!this.app.request.isRoot&&this.needsInstall?!1:this.app.config.designMode?!0:this.needsInstall&&!this.is("installed")?!1:this.app.request.getFeraParam("widget")?this.app.request.getFeraParam("widget")==this.id:!this.isDeactivated:!0}get isDeactivated(){return this.canBeDeactivated&&!this.is("activated")}get needsInstall(){return["auto","selector"].includes(this.installationMethod)}get canBeDeactivated(){return this.is("installed")&&["auto","selector","tag"].includes(this.installationMethod)}get conditions(){return new qe({app:this.app,conditions:this.get("conditions")})}get designVars(){return this.b("design_vars")||this.Q("design_vars",{}),this.b("design_vars")}get autoIntegrationPossibilities(){return[]}get installation(){return h(n({},this.installationSettings),{method:this.installationMethod})}get installationSettings(){return this.get("installation_settings",this.get("integration_settings",{}))}get installationMethod(){return this.get("installation_method",this.get("integration_method",this.canAutoIntegrate?"auto":null))}get canAutoIntegrate(){return!0}get autoIntegrated(){return this.installation.method==="auto"}get selectorIntegrated(){return this.installation.method==="selector"}get tagIntegrated(){return this.installation.method==="tag"}get managedInFera(){return this.autoIntegrated||this.selectorIntegrated||this.tagIntegrated}get type(){return this.get("type")}};var Re=class extends K{get U(){return super.U.concat(["star_color","star_bg_color"])}get collectionParams(){return h(n({},super.collectionParams),{page_size:this.pageSize,include_aggregate_rating:!0})}get dt(){return["header"]}get minCols(){return parseInt(this.get("min_cols",2))==2?2:1}b(e){let t=super.b(e);return this.dt.includes(e)?this.t(t):t}get hideWhenNoReviews(){return this.get("when_no_reviews")==="hide"}get sortBy(){return this.get("sort_by_enabled")?this.get("sort_by"):this.is("customer_media_visible")?"quality:desc":"created_at:desc"}get paginationMode(){return this.get("pagination_mode",this.un)}get layout(){return this.get("layout",this.Es)}get pageSize(){return this.get("page_size",this.ht)}get desktopPageSize(){return this.get("page_size",this.pn)}get mobilePageSize(){return this.get("mobile_page_size",this.ct)}getData(){let e=super.getData();return e.layout=this.layout,e.pagination_mode=this.paginationMode,e.page_size=this.pageSize,e.sortBy=this.sortBy,e}get ht(){return this.layout==="masonry"?Math.max(Math.round(globalThis.innerWidth/300*Math.max(Math.round(globalThis.innerHeight/300),2)),6):Math.max(Math.round(globalThis.outerHeight/300)*2,6)}get un(){return this.layout==="masonry"?"show_more":"pagination"}get Es(){return"masonry"}get pn(){return this.layout==="masonry"?12:6}get ct(){return 6}};var re=class extends Re{get type(){return"product_reviews"}get forProduct(){return!0}static get defaultTypeSettings(){return Va}get dt(){return[...super.dt,"header_when_showing_other_reviews"]}static get cssClassName(){return"fera-productReviews-widget"}get Es(){return"list"}get autoIntegrationPossibilities(){return[...this.app.config.autoIntegrationSelectors["after product section"],...this.app.config.autoIntegrationSelectors["product content"],...this.app.config.autoIntegrationSelectors["bottom of product content"],...this.app.config.autoIntegrationSelectors.page]}get productId(){return this.autoIntegrated||this.selectorIntegrated?this.app.currentProductId:null}};var Da={header:"Reviews",header_visible:!0,layout:"masonry",min_cols:1,review_ids:[],write_review_visible:!0,write_review_style:"primary",mobile_write_review_button:"icon",page_size:null,mobile_page_size:null,sort_by_enabled:!1,sort_by:"quality:desc",pagination_mode:"show_more",show_more_style:"secondary",sortable:!1,types_to_show:"both",border_visible:!1,bg_visible:!1,header_summary_visible:!0,summaries_visible:!0,store_replies_visible:!0,summary_filters_visible:!0,open_summary_filters_by_default:!1,summary_filter_collapsible:!0,customer_avatars_visible:!0,customer_media_visible:!0,customer_locations_visible:!0,products_visible:!0,source_icons_visible:!0,dates_visible:!0,ratings_visible:!0,when_no_reviews:"show",default_customer_image:"https://cdn.fera.ai/img/shoppers/placeholder2.png"};var G=class extends Re{get type(){return"all_reviews"}static get defaultTypeSettings(){return Da}get forProduct(){return!1}get collectionParams(){let e=n({},super.collectionParams);return this.get("types_to_show","both")!=="both"&&(e.subject=this.get("types_to_show")),e}static get cssClassName(){return"fera-allReviews-widget"}get autoIntegrationPossibilities(){return[...this.app.config.autoIntegrationSelectors["before footer"],...this.app.config.autoIntegrationSelectors.page]}};var Is={when_no_reviews:"hide",count_num_visible:!0,count_with_text_visible:!1,avg_num_visible:!1};var oe=class extends K{static get defaultTypeSettings(){return Is}static parseTransientRating(e){if(!e||!e.dataset)return null;let t=e.dataset.rating||e.dataset.feraRating||e.dataset.ratingAverage||e.dataset.averageRating;e.attributes.rating&&(t=e.attributes.rating.value);let i=e.dataset.count||e.dataset.feraCount||e.dataset.ratingCount||e.dataset.reviewCount||e.dataset.reviewsCount;return e.attributes.count&&(i=e.attributes.count.value),t&&t.indexOf("{")===0&&t.indexOf("{{")!==0?JSON.parse(t):t&&i?{average:t,count:i}:null}hasValidOptsToRender(e){return this.constructor.parseTransientRating(e.el||e.container)||super.hasValidOptsToRender(e)}static get aliasAttributes(){return h(n({},super.aliasAttributes),{show_avg_rating:"avg_num_visible",count_visible:"count_num_visible",show_count:"count_num_visible"})}Q(e,t){e==="hide_when_no_reviews"?super.Q("when_no_reviews",t===!0||t==="true"?"hide":"show"):super.Q(e,t)}Xt(e,t){return e==="size"&&typeof t=="number"?this.Xt(e,`${t}px`):super.Xt(e,t)}get showWhenNoReviews(){return this.get("when_no_reviews")==="show"}get allowedElementAttributes(){return super.allowedElementAttributes.concat(["rating","count","rating_average","rating_count"])}b(e){return e==="hide_when_no_reviews"?this.b("when_no_reviews")==="hide":super.b(e)}get U(){return super.U.concat(["star_color","star_bg_color","size","star_spacing","alignment","vertical_margin"])}get forProduct(){return!0}static get cssClassName(){return"fera-productRating-widget"}};var Na={header:"Customer Photos & Videos",header_visible:!0,min_rating:4,min_cols:2,sort_by:"created_at:desc",page_size:8,mobile_page_size:4,border_visible:!1,bg_visible:!1,pagination_mode:"show_more"};var Oe=class extends K{get type(){return"media_gallery"}static get defaultTypeSettings(){return Na}get forProduct(){return!1}static get cssClassName(){return"fera-mediaGallery-widget"}get collectionParams(){return h(n({},super.collectionParams),{"review.min_rating":this.get("min_rating",4)})}get autoIntegrationPossibilities(){return[...this.app.config.autoIntegrationSelectors["before footer"],...this.app.config.autoIntegrationSelectors.page]}};var Fa={header:"Customer Photos & Videos",header_visible:!0,min_rating:4,min_cols:2,sort_by:"created_at:desc",page_size:8,mobile_page_size:4,border_visible:!1,bg_visible:!1,pagination_mode:"show_more",when_no_media:"hide"};var ze=class extends K{static get defaultTypeSettings(){return Fa}static get cssClassName(){return"fera-productMediaGallery-widget"}get type(){return"product_media_gallery"}get forProduct(){return!0}get collectionParams(){return h(n({},super.collectionParams),{"review.min_rating":this.get("min_rating",4)})}get productId(){return this.autoIntegrated||this.selectorIntegrated?this.app.currentProductId:null}get autoIntegrationPossibilities(){return[...this.app.config.autoIntegrationSelectors["after product section"],...this.app.config.autoIntegrationSelectors["product content"],...this.app.config.autoIntegrationSelectors["bottom of product content"],...this.app.config.autoIntegrationSelectors.page]}get hideWhenNoMedia(){return this.get("when_no_media")=="hide"}};var qa={header:"Testimonials",header_visible:!0,types_to_show:"store",min_rating:4,autoplay_enabled:!0,autoplay_speed:5e3,only_with_content:!0,customer_media_visible:!1,ratings_visible:!0,summaries_visible:!0,dates_visible:!0,customer_avatars_visible:!1,customer_locations_visible:!0,store_replies_visible:!1,products_visible:!0,border_visible:!1,bg_visible:!1,page_size:12,sort_by_enabled:!1,sort_by:"created_at:desc"};var je=class extends Re{get type(){return"testimonial_carousel"}static get defaultTypeSettings(){return qa}get forProduct(){return!1}static get cssClassName(){return"fera-testimonialCarousel-widget"}get collectionParams(){return h(n({},super.collectionParams),{ratings:this.mn})}get mn(){let e=Math.max(this.get("min_rating",5),1),t=[];for(let i=1;i<=5;i++)i>=e&&t.push(i);return t}get autoIntegrationPossibilities(){return[...this.app.config.autoIntegrationSelectors["before footer"],...this.app.config.autoIntegrationSelectors.page]}};var Ii=class extends oe{get type(){return"product_detail_rating"}static get defaultTypeSettings(){return Is}get autoIntegrationPossibilities(){return[...this.app.config.autoIntegrationSelectors["after product detail price"],...this.app.config.autoIntegrationSelectors["after product detail title"],...this.app.config.autoIntegrationSelectors["add to cart button"]]}static get cssClassName(){return"fera-productDetailRating-widget"}get productId(){return this.autoIntegrated||this.selectorIntegrated?this.app.currentProductId:null}};var Wa={when_no_reviews:"hide",count_num_visible:!0,count_with_text_visible:!1,avg_num_visible:!1};var Ai=class extends oe{get type(){return"product_collection_rating"}static get defaultTypeSettings(){return Wa}static get cssClassName(){return"fera-productCollectionRating-widget"}get canAutoIntegrate(){return!1}};var Ha={stars_visible:!0,bg_visible:!1};var He=class extends K{get type(){return"overall_rating_banner"}static get defaultTypeSettings(){return Ha}static get cssClassName(){return"fera-overallRatingBanner-widget"}get U(){return super.U.concat(["star_color","text_color"])}get allowedElementAttributes(){return super.allowedElementAttributes.concat(["star_color","text_color"])}get autoIntegrationPossibilities(){return[...this.app.config.autoIntegrationSelectors["before footer"],...this.app.config.autoIntegrationSelectors.page]}};var Ua={when_no_reviews:"hide",count_num_visible:!0,star_visible:!0,text_visible:!0,screen_edge:"left",corner_style:"sharp",layout:"masonry",min_cols:1,bg_visible:!1};var Ue=class extends K{get type(){return"floating_rating_badge"}static get defaultTypeSettings(){return Ua}static get cssClassName(){return"fera-floatingRatingBadge-widget"}get U(){return super.U.concat(["star_color","text_color"])}get allowedElementAttributes(){return super.allowedElementAttributes.concat(["star_color","text_color"])}get autoIntegrationPossibilities(){return[...this.app.config.autoIntegrationSelectors.page]}};var Tt=class extends w{static initModel(e,t){let i=e.product||e.productId||e.product_id,s=e.type.match(/^(rating|product_rating|product_reviews_summary)$/);return e.type.match(/^product_reviews$/)||e.type.match(/^reviews$/)&&i?new re(e,t):e.type.match(/^(reviews|all_reviews)$/)?new G(e,t):e.type.match(/^(product_(view|detail)_rating)$/)||s&&e.editor?new Ii(e,t):e.type.match(/^(product_(category|collection|list)_rating)$/)?new Ai(e,t):s?new oe(e,t):e.type.match(/^product_media(_gallery)?$/)||e.type.match(/^media(_gallery)?$/)&&i?new ze(e,t):e.type.match(/^(media(_gallery)?|((store|product)_)?(customer_)?media)$/)?new Oe(e,t):e.type.match(/^(testimonial_|store_reviews?_)?carousel$/)?new je(e,t):e.type.match(/^(overall_rating(_banner)?|store_reviews_summary)$/)?new He(e,t):e.type.match(/^(floating_rating_badge)$/)?new Ue(e,t):(console.warn(`Unknown widget model class for type '${e.type}'.`),new K(e,t))}};var Te=class extends M{constructor(e,t={}){super(e,n({resourceName:"store"},t)),this.e.widgets&&(this.data.widgets=this.e.widgets)}static get cssClassName(){return"fera"}get locale(){return this.get("supported_language","en")}get translations(){return ft(this.sourceTranslations,this.customTranslations)}get sourceTranslations(){return this.get("frontend_translations",{})}get customTranslations(){return this.get("translated_strings",{})}get widgets(){return this.Z||(this.Z=this.get("widgets",[]).map(e=>Tt.initModel(e,{app:this.app,store:this})))}static get resourceName(){return"store"}get theme(){return this.get("theme","neutral")}get rating(){return this.get("rating",{})}get averageRating(){return this.rating.average}get hasReviewProductExclusions(){return this.reviewProductExclusions.hasRule}get reviewProductExclusions(){return this.gn||(this.gn=new qe({app:this.app,conditions:this.get("review_product_exclusions")}))}get counts(){return this.get("counts",this.get("cached_counts",{}))}getCount(e,t=0){return this.counts[e]||t}};var Ei=class extends w{constructor(e){super(e),this.api=this.e.api,this.vn=this.e.configs}retrieveResource(e,t){return new Promise((i,s)=>{let a=this.vn.find(o=>o.route===e);if(!a)throw new Error(`${e} combinable config not defined.`);a.queue.push({resolve:i,reject:s,id:t}),setTimeout(()=>this.wn(a),1)})}wn(e){if(e.queue.length>0){let t=e.queue;e.queue=[];let i=[...new Set(t.map(s=>s.id.toString()))];i.length===1?this.bn(e,t):this.yn(e,i,t)}}yn(e,t,i){let s=e.klass,o={limit:Math.min(t.length,100)};o[e.request.filter]=t,this.api.listResource({path:e.request.path,params:o,klass:s,key:e.listKey,cache:!0}).then(l=>this.xn(e,l,i),l=>i.forEach(d=>d.reject(l)))}xn(e,t,i){i.forEach(s=>{let a=t[e.listKey].find(o=>e.matchAttributes.some(l=>o.get(l).toString()===s.id.toString()));a?s.resolve(a):s.resolve(e.resolveEmpty(s.id))})}bn(e,t){let i=e.klass,s=e.route.replace("{{ id }}",t[0].id);this.api.retrieveResource(s,{},!0).then(a=>t.forEach(o=>o.resolve(new i(a.json,{app:this.app}))),a=>t.forEach(o=>o.reject(a)))}};var $t=class extends M{constructor(e,t={}){super(e,n({resourceName:"content_campaign"},t))}get mediaTypes(){let e=[];return this.is("allow_photo")&&e.push("image"),this.is("allow_video")&&e.push("video"),e}get requestMedia(){return this.is("request_media")}get requestReview(){return!this.requestMedia}};var Bt=class extends M{constructor(e,t={}){super(e,n({resourceName:"submission"},t))}static get associations(){return{hasOne:[{key:"content_campaign",klass:$t}],hasMany:[{key:"reviews",klass:O},{key:"media",klass:ie}]}}get token(){return this.get("token")}get customerId(){return this.get("external_customer_id")||this.get("customer_id")}hasCustomer(){return this.isSet("customer_id")||this.isSet("external_customer_id")}};var Oi=class extends M{constructor(e,t={}){super(e,n({resourceName:"message"},t))}static get associations(){return{hasOne:[{key:"content_campaign",klass:$t},{key:"active_submission",klass:Bt}],hasMany:[{key:"products",klass:R},{key:"reviews",klass:O}]}}};var zi=class extends M{constructor(e,t={}){super(e,n({resourceName:"order"},t))}static get associations(){return{hasMany:[{key:"reviews",klass:O},{key:"products",klass:R}]}}};var ji=class extends w{constructor(e={}){super(e),this.L={},this.Os=new Ei({app:this.app,api:this,configs:[{route:"products/{{ id }}/rating",klass:Ee,queue:[],listKey:"ratings",request:{path:"products/ratings",filter:"product_ids"},matchAttributes:["product_id","external_product_id"],resolveEmpty:t=>new Ee({external_product_id:t,count:0},{app:this.app})},{route:"products/{{ id }}",klass:R,queue:[],listKey:"products",request:{path:"products",filter:"external_ids"},matchAttributes:["id","external_id"],resolveEmpty:t=>new R({external_id:t},{app:this.app})}]})}clearCache(){return this.L={},this}retrieveStore(){return new Promise((e,t)=>{this.retrieveResource("store",{},!0).then(i=>{if(i.headers.get("X-Loc")){let s=i.headers.get("X-Loc").split("|");this.app.geoService.setLocation({region_name:s[0],country_code:s[1],latitude:s[3],longitude:s[4],continent:s[5],ip:i.headers.get("X-Ip")})}else i.headers.get("cdn-RequestCountryCode")&&this.app.geoService.setLocation({country_code:i.headers.get("Cdn-RequestCountryCode")});e(new Te(i.json,{app:this.app}))},t)})}retrieveSubmissionOrder(e,t){return new Promise((i,s)=>{this.retrieveResource(`submissions/orders/${e}`,{email:t}).then(a=>{a.handle(()=>i(new zi(a.json,{app:this.app})),s)},s)})}retrieveMessage(e){return new Promise((t,i)=>{this.retrieveResource(`messages/${e}`).then(s=>{t(new Oi(s.json,{app:this.app}))},i)})}createSubmission(e={}){return new Promise((t,i)=>{this.ut("submissions",e).then(s=>{s.handle(()=>t(new Bt(s.json,{app:this.app})),i)},i)})}finalizeSubmission(e,t={}){return new Promise((i,s)=>{this.ut(`submissions/${e}/finalize`,t).then(a=>{a.handle(()=>i(a.json),s)},s)})}deleteSubmission(e){return new Promise((t,i)=>{this.Jt({path:`submissions/${e}`,method:"DELETE"}).then(s=>{s.handle(()=>t(s.json),i)},i)})}listMedia(e={}){return this.listResource({path:"media",params:e,klassFunc:t=>t.type==="video"?Se:Me,cache:!0})}listProductMedia(e,t={}){return this.zs({productId:e,params:t,subPath:"media",klassFunc:i=>i.type==="video"?Se:Me,cache:!0})}listReviews(e={}){return this.js({params:e,cache:!0})}listProductReviews(e,t={}){return this.zs({productId:e,params:t,subPath:"reviews",klass:O,cache:!0})}retrievePrivateReview(e){return new Promise((t,i)=>{this.retrieveResource(`submissions/reviews/${e}`).then(s=>{s.handle(()=>t(new O(s.json,{app:this.app})),i)},i)})}retrieveReview(e){return m(this,null,function*(){let t=yield this.retrieveResource(`reviews/${e}`,{},!0);return new O(t.json,{app:this.app})})}retrieveMedia(e){return m(this,null,function*(){let t=yield this.retrieveResource(`media/${e}`,{},!0),i=t.json.type==="video"?Se:Me;return new i(t.json,{app:this.app})})}listStoreReviews(e={}){return this.js({params:h(n({},e),{subject:"store"}),cache:!0})}createReview(e,t={},i={}){return this.ut(`submissions/${e}/reviews`,t,i)}createMedia(e,t={},i={}){return this.ut(`submissions/${e}/batch_media`,t,i)}createCustomer(e,t={},i={}){return new Promise((s,a)=>{this.ut(`submissions/${e}/customers`,t,i).then(o=>{o.handle(()=>s(o.json),a)},a)})}retrieveTranslations(e,t=!0){return m(this,null,function*(){let i=`/i18n/${e}.json`,s=this.V(i),a=yield this.Jt({url:s,cache:t});return a.checkForErrors(),{[e]:a.json}})}retrieveCustomer(e){return m(this,null,function*(){let t=yield this.retrieveResource(`customers/${e}`,{},!0);return new ue(t.json,{app:this.app})})}retrieveProductRating(e){return this.Os.retrieveResource("products/{{ id }}/rating",e)}listProductRatings(e){e=Array.isArray(e)?e:[e];let t={product_ids:e.join(",")};return this.listResource({path:"ratings",params:t,klass:Ee,cache:!0})}retrieveRating(e){return m(this,null,function*(){if(e)return this.retrieveProductRating(e);let t=yield this.retrieveResource("rating",{},!0);return new Ee(t.json,{app:this.app})})}retrieveProduct(e){return this.Os.retrieveResource("products/{{ id }}",e)}listProducts(e={}){return this.listResource({path:"products",params:e,klass:R,cache:!0})}zs({productId:e,params:t={},subPath:i,klassFunc:s=null,klass:a=null,cache:o=!0}){return s=s||(()=>a),new Promise((l,d)=>{this.retrieveResource(`products/${e}/${i}`,t,o).then(u=>{let c=new R(u.json.product,{app:this.app}),p=u.json.data.map(v=>{let y=s(v);return new y(v,{app:this.app,product:c})});c[i]=p;let g={product:c,meta:u.json.meta};u.json.rating&&(g.rating=u.json.rating),g[i]=p,l(g)},d)})}listResource(l){return m(this,arguments,function*({path:e,params:t,klass:i=null,klassFunc:s=null,key:a=null,cache:o=!1}){a=a||e,s=s||(()=>i),this.app.config.useSampleData&&(t=h(n({},t),{samples:!0}));let d=yield this.retrieveResource(e,t,o);d.checkForErrors();let u={meta:d.json.meta};return u[a]=d.json.data.map(c=>{let p=s(c);return new p(c,{app:this.app})}),u})}js({params:e,cache:t=!1}){return this.app.config.useSampleData&&(e=h(n({},e),{samples:!0})),new Promise((i,s)=>{this.retrieveResource("reviews",e,t).then(a=>{a.checkForErrors();let o={meta:a.json.meta};o.reviews=a.json.data.map(l=>new O(l,{app:this.app})),a.json.rating&&(o.rating=a.json.rating),i(o)},s)})}retrieveResource(s){return m(this,arguments,function*(e,t={},i=!1){this.app.config.useSampleData&&(t=h(n({},t),{samples:!0}));let a=yield this.Jt({path:e,params:t,method:"GET",cache:i});return a.checkForErrors(),a})}ut(e,t={},i={}){return this.Jt({path:e,params:i,method:"POST",body:t})}get isConfigured(){return this.app.config&&(this.app.config.apiKey||this.app.config.appInstanceId)}Jt(d){return m(this,arguments,function*({url:e,path:t,params:i={},method:s="GET",headers:a={},body:o=null,cache:l=!1}){let u=this.e.mock||fetch;this.app.config.cacheDisabled&&(l=!1,s==="GET"&&(i.cache=!1)),l&&(u!==fetch||typeof caches=="undefined")&&(l=!1),yield this._n();let c=l?this.app.config.baseApiCdnUrl:this.app.config.baseApiUrl;if(e=e||new ce(`${c}/${t}.json?${this.Cn(i)}`),["POST","PUT"].includes(s)){this.app.request.isHttps&&this.app.request.url.protocol!=e.protocol?(o=this.kn(o),delete a["Content-Type"]):(a["Content-Type"]="application/json",o=JSON.stringify(o));let g=yield u(e.toString(),{method:s,body:o,headers:a});return Rt.from(g,{app:this.app})}let p=`${s} ${e}${JSON.stringify(a)} | ${JSON.stringify(o)}`;if(!l){let g=yield u(e.toString(),{method:s,body:o,headers:a});return Rt.from(g,{app:this.app})}return new Promise((g,v)=>{this.L[p]?this.L[p].resolved?g(this.L[p].resolved):this.L[p].queue.push({resolve:g,reject:v}):(this.L[p]={queue:[]},this.Sn(e.toString(),{resolve:g,reject:v,method:s,body:o,headers:a,cacheKey:p,fetchMethod:u}))})})}Sn(u,c){return m(this,arguments,function*(e,{resolve:t,reject:i,method:s,body:a,headers:o,cacheKey:l,fetchMethod:d}){try{let p,g=yield caches.open("Fera.RequestCache");p=yield g.match(e.toString()),p?d(e.toString(),{method:s,body:a,headers:o}).then(y=>g.put(e.toString(),y.clone())):(p=yield d(e.toString(),{method:s,body:a,headers:o}),g.put(e.toString(),p.clone()));let v=yield Rt.from(p,{app:this.app});for(v.clientOutdated&&this.app.assetService.clearCache(),this.L[l].resolved=v,t(v);this.L[l].queue.length>0;)this.L[l].queue.shift().resolve(v);v.failed&&delete this.L[l]}catch(p){for(this.L[l].rejected=p,i(p);this.L[l].queue.length>0;)this.L[l].queue.shift().reject(p)}})}_n(){return m(this,null,function*(){let e=this.st?1e3:6e4;if(!(yield Ct(()=>this.isConfigured,{timeout:e})))throw new Error(`Fera API key not configured (waited ${e/1e3}s for config).`)})}Cn(e={}){return new URLSearchParams(n(n({},this.Mn),e))}get Mn(){let e={client:`fjs-${this.app.version}`};if(this.app.config.apiKey)e.api_key=this.app.config.apiKey;else if(this.app.config.appInstanceId)e.app_instance_id=this.app.config.appInstanceId;else throw new Error("Fera API key not configured.");return e}kn(e){let t=new FormData,i=(s,a)=>{Array.isArray(s)?s.forEach((o,l)=>{i(o,`${a}[${l}]`)}):typeof s=="object"&&s!==null?Object.keys(s).forEach(o=>{let l=s[o],d=a?`${a}[${o}]`:o;i(l,d)}):t.append(a,s)};return i(e),t}};function Gs(){var r=new Date().getTime();return globalThis.performance&&typeof globalThis.performance.now=="function"&&(r+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=(r+Math.random()*16)%16|0;return r=Math.floor(r/16),(e=="x"?t:t&3|8).toString(16)})}var Vi=class extends w{getId(){return this.id?this.id:(this.app.config.designMode||(this.id=this.app.storage.get("shopperId")),this.updateBasedOnUrl(),this.id||this.issueNewId(),this.id)}setId(e){this.id=e,this.id.indexOf(" path=/")!==-1&&(this.id=this.id.replace(" path=/","")),!this.app.config.designMode&&this.app.storage.set("shopperId",this.id,5*365)}updateBasedOnUrl(){let e=this.app.request.params,t=e.visitor||e.visitor_id||e.shopper||e.shopper_id;if(!t)return this.id;t=t.toLowerCase(),this.id&&this.id.toLowerCase()!==t&&this.C("Shopper (visitor) ID was changed from URL.",this.id,t),this.setId(t)}issueNewId(){let e=Gs();this.setId(e)}};var Di=class extends w{start(){this.Rn()}Rn(){this.Wi&&this.Tn("fera_starting")}get Wi(){return this.Hi?this.Hi:(this.Hi=globalThis.opener?globalThis.opener:globalThis.parent&&globalThis.parent.length>0&&window!==globalThis.top?globalThis.parent:null,this.Hi)}Tn(e){try{let t=new URL(this.app.config.appUrl).href;this.Wi&&this.Wi.postMessage(JSON.stringify({params:{status:e}}),t)}catch(t){}}};var Ni=class extends w{constructor(e){super(e),this.location=this.app.storage.getObject("geo")}static get example(){return{ip:"17.235.64.1",continent:"NA",country_code:"US",country_name:"United States",region_code:"TX",region_name:"Texas",city:"Austin",zip_code:"78760",time_zone:"America/Chicago",latitude:30.3076576,longitude:-97.9205515}}setLocation(e){this.location=this.location||{},this.location=n(n({},this.location),e),this.app.storage.setObject("geo",e,365)}retrieveLocation(){return m(this,null,function*(){return this.location?this.location:(this.setLocation(yield fetch("https://geo.bananastand.io/json/").then(e=>e.json())),this.location)})}};var Fi=class extends w{removeSeoAttributes(e){!e||!e.removeAttribute||(e.removeAttribute("itemprop"),e.removeAttribute("itemtype"),e.removeAttribute("itemscope"),e.querySelectorAll("[itemprop],[itemtype],[itemscope]").forEach(t=>{t.removeAttribute("itemprop"),t.removeAttribute("itemtype"),t.removeAttribute("itemscope")}))}removeFromWidget(e){this.removeSeoAttributes(e.el),this.Vs(t=>{if(!t.aggregateRating||t.aggregateRating["@type"]!="AggregateRating")return;let i=t.aggregateRating.reviewCount&&t.aggregateRating.reviewCount>0,s=t.aggregateRating.ratingCount&&t.aggregateRating.ratingCount>0;!i&&!s&&delete t.aggregateRating})}loadFromWidget(e){if(!e.usingSampleData)try{this.addReviewDataToSeoScripts(e.el);let t=e.el.closest("[itemType]");(!t||!t.getAttribute("itemType").match(/\/Product$/))&&(this.copySeoAttributesToProductContext(e.el),this.removeSeoAttributes(e.el)),this.removeDuplicateAggregateRatingSeoAttr()}catch(t){this.D(t)}}copySeoAttributesToProductContext(e){this.repairProductSchemas();let t=document.querySelectorAll('[itemType*="/Product"][itemscope]');if(t.length<1)return this.C("Tried to copy object to optimize for SEO but could not find parent product SEO item type."),!1;if(t.length>0){let i=e.cloneNode(!0);i.style.visibility="hidden",i.style.overflow="hidden",i.style.height="0",i.style.width="0",i.removeAttribute("class"),i.removeAttribute("id"),i.removeAttribute("data-fera-widget"),i.removeAttribute("data-fera-widget"),i.querySelectorAll("[class]").forEach(s=>{s.removeAttribute("class"),s.removeAttribute("id")}),i.setAttribute("data-fera-seo-message","added to ensure search engines read content properly"),t[0].append(i)}return!0}repairProductSchemas(){let e=document.querySelectorAll('[itemType*="/Product"]:not([itemscope])');e.length<1||e.forEach(t=>{if(t.querySelectorAll('[itemProp="name"]').length<1)return;t.setAttribute("itemscope","");let s=t.querySelectorAll('[itemType*="/Offer"]:not([itemscope])');s.length<1||s.forEach(a=>a.setAttribute("itemscope",""))})}removeDuplicateAggregateRatingSeoAttr(){let e=document.querySelector('[itemType*="Product"]');if(!e)return!1;let t=e.querySelectorAll('[itemType*="AggregateRating"]');if(t.length>0){let i;t.forEach(s=>{let a=s.parentElement.closest("[itemType]");a&&a.getAttribute("itemType").match(/\/Product$/)&&!i?i=s:this.removeSeoAttributes(s)})}return!0}addReviewDataToSeoScripts(e){this.Vs(t=>{this.$n(e,t),t.aggregateRating&&this.Bn(e,t)})}Vs(e){let t=document.querySelectorAll('script[type="application/ld+json"]');if(t.length<1){this.C("Could not find any SEO script definitions.");return}t.forEach(i=>{let s=i.innerHTML.replace(/[\n\t\r]/g," ").trim();if(!s)return;let a;try{a=JSON.parse(s)}catch(o){this.C("Encountered an error while trying to parse JSON for application/ld+json. Reading will be skipped.",o,i)}if(!a){this.ne("Failed to properly parse your application/ld+json. This could indicate that your site code/theme is not properly handling SEO elements. Contact our team for help.");return}a instanceof Array&&(a=a[0],this.Ds=!0),a["@graph"]&&a["@graph"]instanceof Array&&(this.Ns=!0,this.Ui=a["@graph"].findIndex(o=>o["@type"]&&o["@type"]=="Product"),this.Fs=a,a["@graph"][this.Ui]&&(a=a["@graph"][this.Ui])),a["@type"]&&a["@type"].match(/Product$/)&&(e&&e(a),this.Ds&&(a=[a],this.Ds=!1),this.Ns&&(this.Fs["@graph"][this.Ui]=a,a=this.Fs,this.Ns=!1),i.innerHTML=JSON.stringify(a))})}$n(e,t){if(!e)return;let i=e.querySelector('[itemprop="aggregateRating"] ');if(!i)return;t.aggregateRating=t.aggregateRating||{},t.aggregateRating["@type"]="AggregateRating";let s=i.querySelector('[itemprop="ratingValue"]'),a=i.querySelector('[itemprop="ratingCount"]'),o=i.querySelector('[itemprop="reviewCount"]');s&&s.innerText&&(t.aggregateRating.ratingValue=s.innerText.trim()),a&&a.innerText&&(t.aggregateRating.ratingCount=a.innerText.trim()),o&&o.innerText&&(t.aggregateRating.reviewCount=o.innerText.trim()),t.review=Array.isArray(t.review)?t.review:[],!t.aggregateRating.reviewCount&&!t.aggregateRating.ratingCount&&delete t.aggregateRating}Bn(e,t){e.querySelectorAll('[itemprop="review"]').forEach(i=>{let s=i.querySelector('[itemprop="datePublished"]')&&i.querySelector('[itemprop="datePublished"]').getAttribute("content")||"",a=i.querySelector('[itemprop="author"]')&&i.querySelector('[itemprop="author"]').innerText||"",o=i.dataset.id,l=i.querySelector('[itemprop="ratingValue"]')&&i.querySelector('[itemprop="ratingValue"]').innerText||"",d=i.querySelector('[itemprop="description"]')&&i.querySelector('[itemprop="description"]').innerText||"";if(!s||!a||t.review&&t.review.find&&t.review.find(p=>p.identifier==o?!0:p.datePublished==s.trim()&&p.author.name==a.trim()))return;let c={"@context":"https://schema.org/","@type":"Review",identifier:o,datePublished:s,author:{"@type":"Person",name:a.trim()},reviewBody:d.trim(),reviewRating:{"@type":"Rating"}};l&&(c.reviewRating.ratingValue=l.trim()),c.reviewBody&&t.review.push(c)})}};var qi=class extends w{constructor(e){super(e),this.qs=this.e.prefix||this.e.namespace||"Fera."}reset(){document.cookie.split(";").map(e=>e.split("=")[0]).filter(e=>e.match(/^\s*Fera\./)).map(e=>e.replace(/^\s*Fera\./,"")).forEach(e=>this.setCookie(e,"",-1))}setCookie(e,t,i){let s="";if(i){let d=new Date;d.setTime(d.getTime()+i*24*60*60*1e3),s="; expires="+d.toUTCString()}let a=this.app.request.url.protocol==="https:",o=a?"None":"Lax",l=this.qs+e+"="+t+s+`; path=/; SameSite=${o}`;a&&(l+="; Secure");try{document.cookie=l}catch(d){if(d.message.match(/This document is sandboxed/))return;throw d}}set(e,t,i){this.setCookie(e,t,i)}getCookie(e,t){t=t||null;let i=this.qs+e+"=",s=null;try{s=document.cookie.split(";")}catch(a){if(a.message.match(/This document is sandboxed/))return t;throw a}for(let a=0;athis.Pn(t,e[t])))}get loadedStylesExternally(){return document.querySelectorAll("#fera_css_bundle,#fera_bundle,#fera_css").length>0}clearCache(){let e=Array.from(document.querySelectorAll('[href*="/fera.css"],[src*="/fera.js"],[src*="/fera.bundle.js"]')).map(t=>t.href||t.src);e.push(this.V("fera.css")),e.push(this.V("fera.js")),e=[...new Set(e)],e.forEach(t=>t&&fetch(t,{cache:"reload"})),this.Ln(),this.C("Fera asset browser cache was forced to clear.")}Ln(){let e=globalThis.localStorage.getItem("Fera.AssetCache.ferajs");if(e)try{let t=JSON.parse(e);t.url&&fetch(t.url,{cache:"reload"})}catch(t){this.C("Legacy cache parse failure.")}globalThis.localStorage.removeItem("Fera.AssetCache.ferajs")}Pn(e,t){let i=new ce(t.match(/^https?/i)?t:this.V(t));if(i.ext==="css")return this.Kt(i,e);if(i.ext==="js")return this.Zi(i,e);throw new Error(`Unknown external resource type: ${t}/${i}`)}Kt(e,t){return this.Ws({type:"link",id:t,url:e,container:document.head,otherAttributes:{rel:"stylesheet",href:e,fetchpriority:"high",crossOrigin:"anonymous"}})}Zi(e,t){return this.Ws({type:"script",id:t,url:e,container:document.body,otherAttributes:{async:!0,src:e}})}Ws({type:e,id:t,url:i,container:s,prepend:a=!1,otherAttributes:o={}}){let l=`fera-${t}-${i.ext}`,d=document.getElementById(`fera-${t}-${i.ext}`);return d=d||document.head.querySelector(`[src*="${i}"],[href*="${i}"],[src*="${i.pathname}"],[href*="${i.pathname}"]`),d?(Object.keys(o).forEach(u=>{d[u]!=o[u]&&(d[u]=o[u])}),Promise.resolve({id:t,element:d})):new Promise((u,c)=>{let p=document.createElement(e);p.id=l,Object.keys(o).forEach(g=>p[g]=o[g]),p.addEventListener("load",()=>setTimeout(()=>u({id:t,element:p}),1)),p.addEventListener("error",()=>c(new Error(`Failed to load ${i}.`))),a?s.prepend(p):s.appendChild(p)})}};var Hi=class extends w{constructor(e){super(e),this.N={0:{}},this.refresh=B(()=>this.refreshNow(),10),this.In(),this.detectedTextDirection=="rtl"&&this.addToRoot("--txt-direction: rtl")}get detectedTextDirection(){return this.An||(this.An=this.En())}convertCssClassToCssVariable(e,t,i=null){let s=document.createElement("div");s.classList.add(e),s.style.display="none",(document.querySelector("body > main")||document.body).append(s);let o=getComputedStyle(s)[t];return s.remove(),!o||o==="none"?!1:(i=i||`--${di(t)}`,i.match(/^--/)||(i=`--${i}`),this.addToRoot(`${i}: ${o}`),!0)}addToRoot(e,t=!1){e=e.replace(/\s*;\s*$/,""),this.Yi=this.Yi||{},this.Yi[e]=e,this.update({code:"root",content:`.fera { ${Object.values(this.Yi).join("; ")}; }`,priority:0,now:t})}add({code:e,content:t,priority:i,now:s=!1}){this.N[i]=this.N[i]||{},t=`${this.N[i][e]||""} ${t}`,this.update({code:e,content:t,priority:i,now:s})}update({code:e=null,content:t,priority:i=10,now:s=!1}){let a=t;if(t instanceof M&&(a=this.convertModelToCss(t),e=e||t.cssClassName),!e&&this.st)throw new Error("CSS must have a code or the model must implement cssClassName");return this.N[i]=this.N[i]||{},this.N[i][e]=a||"",s?this.refreshNow():this.refresh(),this}remove(e){let t=!1;Object.keys(this.N).forEach(i=>{this.N[i][e]&&(delete this.N[i][e],t=!0)}),t&&this.refreshNow()}refreshNow(){let e=(this.generateCss()||"").trim();(this.We||e)&&(this.Hs=this.generateCss(),this.element.innerHTML=`/* Generated by Fera.js: */ ${this.Hs}`)}generateCss(){return Object.keys(this.N).sort((t,i)=>t-i).map(t=>Object.keys(this.N[t]).map(i=>this.N[t][i]).join(` `)).join(` `)}get element(){return this.We||(document.getElementById("fera-css")?this.We=document.getElementById("fera-css"):(this.We=document.createElement("style"),this.We.id="fera-css",document.body.appendChild(this.We))),this.We}convertModelToCss(e){let t=e.designVars||e.get("design_vars",{}),i=this.Ei?` `:" ",s="",a=Object.keys(t).map(o=>{let l=o.match(/^--/)?o:`--${di(o)}`;return t[o]?`${l}: ${t[o]} !important;`:""}).filter(o=>!!o).join(i);return a&&e.cssClassName&&(s+=`.${e.cssClassName} {${i}${a}${i}}${i}`),e.get("custom_css","")&&(s+=` /* Custom CSS >> */ ${e.get("custom_css","")}/* << Custom CSS */`),s}get css(){return this.Hs||""}In(){let e=getComputedStyle(document.documentElement).getPropertyValue("font-size")||"16px",t=parseFloat(e)/16;t!==1&&this.addToRoot(`--font-scale: ${t}`)}En(){let e=document.querySelector("p,a,div,body");return e&&getComputedStyle(e).direction=="rtl"?"rtl":"ltr"}};function Za(r,e){for(var t=0;tr.length)&&(e=r.length);for(var t=0,i=new Array(e);t0&&this.registerTriggers.apply(this,As(l)),this.onClick=this.onClick.bind(this),this.onKeydown=this.onKeydown.bind(this)}var e,t,i;return e=r,(t=[{key:"registerTriggers",value:function(){for(var s=this,a=arguments.length,o=new Array(a),l=0;l0&&arguments[0]!==void 0?arguments[0]:null;if(this.activeElement=document.activeElement,this.modal.setAttribute("aria-hidden","false"),this.modal.classList.add(this.config.openClass),this.scrollBehaviour("disable"),this.addEventListeners(),this.config.awaitOpenAnimation){var o=function l(){s.modal.removeEventListener("animationend",l,!1),s.setFocusToFirstNode()};this.modal.addEventListener("animationend",o,!1)}else this.setFocusToFirstNode();this.config.onShow(this.modal,this.activeElement,a)}},{key:"closeModal",value:function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,a=this.modal;if(this.modal.setAttribute("aria-hidden","true"),this.removeEventListeners(),this.scrollBehaviour("enable"),this.activeElement&&this.activeElement.focus&&this.activeElement.focus(),this.config.onClose(this.modal,this.activeElement,s),this.config.awaitCloseAnimation){var o=this.config.openClass;this.modal.addEventListener("animationend",function l(){a.classList.remove(o),a.removeEventListener("animationend",l,!1)},!1)}else a.classList.remove(this.config.openClass)}},{key:"closeModalById",value:function(s){this.modal=document.getElementById(s),this.modal&&this.closeModal()}},{key:"scrollBehaviour",value:function(s){if(this.config.disableScroll){var a=document.querySelector("body");switch(s){case"enable":Object.assign(a.style,{overflow:""});break;case"disable":Object.assign(a.style,{overflow:"hidden"})}}}},{key:"addEventListeners",value:function(){this.modal.addEventListener("touchstart",this.onClick),this.modal.addEventListener("click",this.onClick),document.addEventListener("keydown",this.onKeydown)}},{key:"removeEventListeners",value:function(){this.modal.removeEventListener("touchstart",this.onClick),this.modal.removeEventListener("click",this.onClick),document.removeEventListener("keydown",this.onKeydown)}},{key:"onClick",value:function(s){(s.target.hasAttribute(this.config.closeTrigger)||s.target.parentNode.hasAttribute(this.config.closeTrigger))&&(s.preventDefault(),s.stopPropagation(),this.closeModal(s))}},{key:"onKeydown",value:function(s){s.keyCode===27&&this.closeModal(s),s.keyCode===9&&this.retainFocus(s)}},{key:"getFocusableNodes",value:function(){var s=this.modal.querySelectorAll(Ya);return Array.apply(void 0,As(s))}},{key:"setFocusToFirstNode",value:function(){var s=this;if(!this.config.disableFocus){var a=this.getFocusableNodes();if(a.length!==0){var o=a.filter(function(l){return!l.hasAttribute(s.config.closeTrigger)});o.length>0&&o[0].focus(),o.length===0&&a[0].focus()}}}},{key:"retainFocus",value:function(s){var a=this.getFocusableNodes();if(a.length!==0)if(a=a.filter(function(l){return l.offsetParent!==null}),this.modal.contains(document.activeElement)){var o=a.indexOf(document.activeElement);s.shiftKey&&o===0&&(a[a.length-1].focus(),s.preventDefault()),!s.shiftKey&&a.length>0&&o===a.length-1&&(a[0].focus(),s.preventDefault())}else a[0].focus()}}])&&Za(e.prototype,t),i&&Za(e,i),r}(),Pt=null,ta=function(r){if(!document.getElementById(r))return console.warn("MicroModal: \u2757Seems like you have missed %c'".concat(r,"'"),"background-color: #f8f9fa;color: #50596c;font-weight: bold;","ID somewhere in your code. Refer example below to resolve it."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",'')),!1},Xa=function(r,e){if(function(i){i.length<=0&&(console.warn("MicroModal: \u2757Please specify at least one %c'micromodal-trigger'","background-color: #f8f9fa;color: #50596c;font-weight: bold;","data attribute."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",''))}(r),!e)return!0;for(var t in e)ta(t);return!0},{init:function(r){var e=Object.assign({},{openTrigger:"data-micromodal-trigger"},r),t=As(document.querySelectorAll("[".concat(e.openTrigger,"]"))),i=function(o,l){var d=[];return o.forEach(function(u){var c=u.attributes[l].value;d[c]===void 0&&(d[c]=[]),d[c].push(u)}),d}(t,e.openTrigger);if(e.debugMode!==!0||Xa(t,i)!==!1)for(var s in i){var a=i[s];e.targetModal=s,e.triggers=As(a),Pt=new ea(e)}},show:function(r,e){var t=e||{};t.targetModal=r,t.debugMode===!0&&ta(r)===!1||(Pt&&Pt.removeEventListeners(),(Pt=new ea(t)).showModal())},close:function(r){r?Pt.closeModalById(r):Pt.closeModal()}});typeof window!="undefined"&&(window.MicroModal=Ja);var ia=Ja;var f=class r extends w{constructor(e={}){super(typeof e=="string"?{content:e}:e),this.e.el&&this.e.el.dataset&&(this.e=n(n({},this.e.el.dataset),this.e),this.el=this.e.el),this.He=[],this.F=this.e.children||this.e.contents||[],this.Xi=[],this.content=this.e.content,this.e.c&&this.addClass(this.e.c)}get isVisible(){if(!this.el||!this.rendered)return!1;let e=globalThis.getComputedStyle(this.el);return e.width!=="0"&&e.height!=="0"&&e.opacity!=="0"&&e.display!=="none"&&e.visibility!=="hidden"}get i(){return{app:this.app}}renderAsync(){return m(this,null,function*(){return this.ft="queued",this.render(),this})}render(){return this.l()===!1?this.el:(this.ft="during",this.On(),this.zn(),this.jn(),this.He.forEach(e=>this.el.classList.add(e)),this.Vn(),this.Dn(),this.ft="after",this.r(),this.a(),this.rendered=!0,setTimeout(()=>this.d(),1),this.trigger("render"),this.el)}d(){this.Fc=!0,this.ft="complete",this.trigger("render:complete")}get Nn(){return globalThis.innerWidth<=550}On(){let e=this.Us(this.s);this.el&&this.s?(Array.from(e.attributes).forEach(t=>{this.el.getAttribute(t.name)===null&&this.el.setAttribute(t.name,t.value)}),e.classList.forEach(t=>this.el.classList.add(t)),this.el.innerHTML=e.innerHTML):this.el=e}Ji(){this.trigger("resize",null,{bubbleUp:!0})}trigger(e,t=null,{bubbleUp:i=!1}={}){super.trigger(e,t),i&&this.parent&&this.parent.trigger(e,t,{bubbleUp:i})}debouncedTrigger(e,t=null,{bubbleUp:i=!1}={}){super.debouncedTrigger(e,t),i&&this.parent&&this.parent.debouncedTrigger(e,t,{bubbleUp:i})}zn(){this.Y("a[data-fera-action],button[data-fera-action]",e=>{if(typeof this[e.dataset.feraAction]!="function"){this.D(`${this.constructor.name}#${e.dataset.feraAction} referenced in component template but not defined.`,{component:this,el:e});return}e.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this[e.dataset.feraAction](t)})})}jn(){this.Y("[data-fera-component],[data-fera-component-container]",e=>{let t=this[e.dataset.feraComponent||e.dataset.feraComponentContainer];if(!t){this.D(`Couldn't find child component object instance ${this.constructor.name}.${e.dataset.feraComponent} referenced in component template.`,{container:e});return}t.rendered?t.refreshView():(e.dataset.feraComponent&&(t.el=e),t.parent=this,t.render(),e.dataset.feraComponentContainer&&e.appendChild(t.el)),this.Xi.includes(t)||this.Xi.push(t)})}p(e,t,{replace:i=!0}={}){i&&(this.o(e).innerHTML=""),this.Fn(e,t)}Fn(e,t){return this.o(e).appendChild(t.renderOnce()),this}Vn(){this.Gt=this.o("[data-fera-child-container]")||this,this.F&&this.F.forEach(e=>{e instanceof r?(e.parent=this,this.Gt.append(e.render())):Object.keys(e).forEach(t=>{typeof t=="string"&&(e[t]instanceof r&&(e[t].parent=this),this.p(t,e[t]))})})}addChild(e,t=null){if(e instanceof r){if(t)return this.addChild({[t]:e});if(this.F.includes(e))return e.refreshView();e.parent=this,this.F.push(e),this.rendered&&this.Gt.append(e.render())}else{if(Array.isArray(e))return e.forEach(i=>this.addChild(i,t));Object.keys(e).forEach(i=>{if(typeof i=="string"){let s=this.F.find(a=>!(a instanceof r)&&a[i]===e[i]);s?s.refreshView():(this.F.push({[i]:e[i]}),this.rendered&&this.p(i,e[i]))}})}}addChildren(e,t=null){return this.addChild(e,t)}Us(e){if(!e)throw new Error(`${this.constructor.name} is missing a template.`);let t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.childNodes.length>1&&this.D(`${this.constructor.name} has ${t.content.childNodes.length} root elements (max: 1).`,{template:t}),t.content.firstChild}addClass(e){return e?(e.indexOf(" ")!==-1?e.split(" ").forEach(t=>this.addClass(t)):(this.He.includes(e)||this.He.push(e),this.el&&!this.el.classList.contains(e)&&this.el.classList.add(e)),this):this}removeClass(e){return e?(e.indexOf(" ")!==-1?e.split(" ").forEach(t=>this.removeClass(t)):(this.He=this.He.filter(t=>t!==e.trim()),this.el&&this.el.classList.contains(e)&&this.el.classList.remove(e)),this):this}contains(e){return this.el?(e=e instanceof this.constructor?e.el:e,this===e||this.el.contains(e)):!1}toggleClass(e,t=null){t?this.addClass(e):t===null?this.toggleClass(e,!this.hasClass(e)):this.removeClass(e)}hasClass(e){return this.el?this.el.classList.contains(e):this.He.includes(e)}renderOnce(){return this.rendered?this.el:this.render()}toString(){return this.el.outerHTML}qn(e){return this.el.querySelectorAll(e)}Y(e,t){this.qn(e).forEach(t)}o(e){return this.el.querySelector(e)}Ki(e,t,i){this.Y(e,s=>s.addEventListener(t,i))}hide(){this.addClass("fera-hidden"),this.trigger("hide")}show(){this.removeClass("fera-hidden"),this.trigger("show")}toggleVisible(e){this.toggleClass("fera-hidden",!e)}get isShowing(){return this.rendered&&!this.el.classList.contains("fera-hidden")}Qt(e){this.Y(e,t=>t.classList.add("fera-hidden"))}Gi(e){this.Y(e,t=>t.classList.remove("fera-hidden"))}Qi(e,t){t?this.Gi(e):this.Qt(e)}qc(e,t,i){this.Y(e,s=>s.classList.toggle(t,i))}append(e){return e=e&&typeof e.renderOnce=="function"?e.renderOnce():e,this.el.append(e)}prepend(e){return e=e&&typeof e.renderOnce=="function"?e.renderOnce():e,this.el.prepend(e)}insertBefore(e,t){return e=e&&typeof e.renderOnce=="function"?e.renderOnce():e,t=t&&t instanceof r?t.el:t,this.el.insertBefore(e,t)}remove(){this.el&&this.el.remove()}destroy(){this.remove(),this.rendered=!1,this.destroyed=!0,delete this.el,super.destroy()}clearChildren(){this.F.forEach(e=>e.remove()),this.F=[]}clear(){return this.el&&(this.el.innerHTML=""),this.F=[],this}Wc(e,t,i){if(typeof t=="function"){this.el.addEventListener(e,t);return}document.addEventListener(e,function(s){for(var a=s.target;a&&a!=this;a=a.parentNode)if(a.matches(t)){i.call(a,s);break}},!1)}Wn(e){return e.replace(/-./g,t=>t[1].toUpperCase())}attr(e,t=void 0){return t===void 0?this.el.getAttribute(e):(t===null?this.el.removeAttribute(e):this.el.setAttribute(e,t),this)}data(e=void 0,t=void 0){return e===void 0?this.el.dataset:(e=e.indexOf("-")===-1?e:this.Wn(e),t===void 0?this.el.dataset[e]||this.el[e]:(t===null?delete this.el.dataset[e]:typeof t=="object"?this.el[e]=t:this.el.dataset[e]=t,this))}Dn(){this.el.fera||(this.el.fera=this)}l(){this.ft="before"}r(){(this.e.onClick||Object.keys(this.le).some(t=>t=="click"))&&this.Hn(),(this.e.onSwipe!==void 0||Object.keys(this.le).some(t=>t.startsWith("swipe")))&&this.er()}R(e=null){if(this.addClass("fera-loading"),!this.rendered)return;this.Ue=this.Ue||this.Us(this.Un);let t=this.Ue.querySelector("[data-fera-text-container]");e?(t.innerText=e,t.classList.remove("fera-hidden")):t.classList.add("fera-hidden"),this.pt&&this.o(this.pt)?this.o(this.pt).append(this.Ue):this.append(this.Ue)}_(){this.removeClass("fera-loading"),this.rendered&&this.Ue&&this.Ue.remove()}get pt(){return null}get Un(){return`
`}er(){this.Zn||(this.el.addEventListener("touchstart",e=>this.Yn(e),{passive:!0}),this.el.addEventListener("touchend",e=>this.Xn(e),{passive:!0}),this.Zn=!0)}Yn(e){if(e.targetTouches&&e.targetTouches.length&&e.targetTouches.length>1){this.ei=null;return}globalThis.visualViewport&&globalThis.visualViewport.scale&&globalThis.visualViewport.scale>1.1||(this.Zs=new Date,this.Ys=e.changedTouches[0].screenX,this.ei=e.changedTouches[0].screenY)}Xn(e){this.ei&&this.Zs&&(new Date().getTime()-this.Zs.getTime()>1e3||(this.Xs=e.changedTouches[0].screenX,this.Js=e.changedTouches[0].screenY,this.Jn()))}Jn(){this.Xs+50<=this.Ys&&this.trigger("swipe:left"),this.Xs-50>=this.Ys&&this.trigger("swipe:right"),this.Js+50<=this.ei&&this.trigger("swipe:up"),this.Js-50>=this.ei&&this.trigger("swipe:down")}Hn(){this.Kn||(this.addClass("fera--clickable"),this.el.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),this.tr(e),this.Kn=!0}))}onElement(e,t){this.el?this.el.addEventListener(e,i=>t(i)):this.once("render",()=>this.el.addEventListener(e,i=>t(i)))}addEventListener(e,t){this.onElement(e,t)}tr(e){this.e.onClick&&this.e.onClick(e),this.trigger("click",e,{bubbleUp:!0})}a(){}refreshView(){return this.rendered&&this.a(),this.Gn.forEach(e=>e.refreshView()),this.Xi.forEach(e=>e.refreshView()),this}get Gn(){return this.F.map(e=>e instanceof r?e:Object.values(e)).flat()}get s(){return this.e.tpl||""}};var Ze=class extends f{get pt(){return"[data-fera-content]"}get Ks(){return"[data-fera-content]"}show(e=null){if(e&&(this.content=e),!this.content){this.D(`${this.constructor.name} has no content`,{component:this,opts:this.e});return}this.rendered?this.refreshView():this.render(),this.Qn(),super.show()}hide(){super.hide(),this.ir&&(this.el.remove(),this.ir=!1)}Qn(){this.ir||(document.querySelector("body").append(this.el),this.ir=!0)}Me(){this.p(this.Ks,this.content)}r(){super.r(),this.Gs=this.el.querySelector(this.Ks),this.Me(),this.tl()}tl(){document.addEventListener("keydown",e=>{this.isShowing&&this.rr(e)})}rr(e){e.code==="Escape"&&this.hide()}};var Ui=class extends f{get s(){return` `}};var q=class extends Ze{constructor(e){super(e),this.content=this.e.content}l(){super.l(),this.app.trigger("modal.render:before",this)}get S(){return this.e.title}get Re(){return!1}get brandingComponent(){return null}get pt(){return"[data-fera-modal-dialog]"}r(){super.r(),this.p(".fera-modal-close-btn",new Ui({app:this.app})),this.app.on("page:change",()=>this.hide(!0)),this.il=this.o(".fera-modal-close-btn"),this.Ki("[data-fera-close-btn]","click",()=>this.sr()),this.ti=this.o("[data-fera-modal-dialog]"),setInterval(()=>this.ar(),500),setInterval(()=>this.ar(),1e3),this.Qs=this.o("[data-fera-modal-overlay]"),this.e.allowOutsideClick&&(this.Qs.addEventListener("click",e=>e.currentTarget==this.Qs&&this.hide()),this.ti.addEventListener("click",e=>e.stopPropagation())),this.Re&&this.brandingComponent&&this.p("[data-fera-modal-branding-container]",this.brandingComponent),this.ee&&globalThis.addEventListener("popstate",e=>{!this.rendered||this.destroyed||e.state&&Object.keys(this.ee).every(t=>e.state[t]==this.ee[t])&&this.app[e.state.fera]()})}sr(){this.hide()}ar(){this.isShowing&&this.ea&&this.toggleClass("fera-modal--overflow-y",this.rl>globalThis.innerHeight)}get rl(){let e=this.ti.offsetHeight;return e+=parseInt(globalThis.getComputedStyle(this.ti).getPropertyValue("margin-top")),e+=parseInt(globalThis.getComputedStyle(this.ti).getPropertyValue("margin-bottom")),e}show(){var e;super.show(this.content);try{ia.show(`modal-${this.k()}`,{disableFocus:!0}),this.ea=!0,(e=document==null?void 0:document.body)==null||e.classList.add("fera-modal--open")}catch(t){this.ea=!0}return this.ar(),this.sl(),this}sl(){this.ee&&this.app.request.addParams(this.ee)}or(){return this.e.beforeHide?this.e.beforeHide():!0}al(){this.ee&&this.app.request.removeParams(this.ee)}hide(e=!1){var t;return(e||this.or())&&(ia.close(`modal-${this.k()}`),(t=document==null?void 0:document.body)==null||t.classList.remove("fera-modal--open"),super.hide(),this.al()),this}startLoading(e=null){this.R(e)}stopLoading(){this._()}get ol(){return this.Re?'
':""}get ta(){return`

${this.S||""}

`}get s(){return``}};var Lt=class extends f{constructor(e){super(e),this.mt=this.e.value||this.e.initialValue,this.nl=this.e.required||!1,this.g=this.e.disabled||!1}r(){super.r(),this.I=this.o("[data-fera-input]")}get ll(){return this.e.name}get ia(){let e=`data-fera-input class="fera-input" name="${this.ll}"`;return this.nl&&(e+=" required"),this.g&&(e+=" disabled"),e+=Object.keys(this.e.inputAttr||{}).map(t=>` ${t}="${this.e.inputAttr[t]}"`).join(""),e}get disabled(){return this.g}disable(){this.g||(this.g=!0,this.refreshView())}enable(){this.g&&(this.g=!1,this.refreshView())}};var It=class extends Lt{constructor(e){super(e),this.ra=null}get disabled(){return this.g}set value(e){this.setValue(e)}get value(){return this.mt}val(){return this.value}setValue(e){this.mt=e,this.I.value=e,this.a();let t=new Event("input",{bubbles:!0});this.I.dispatchEvent(t),this.trigger("change",this.mt)}disable(){this.g||(this.g=!0,this.a())}enable(){this.g&&(this.g=!1,this.a())}setHoverValue(e){this.ra=e,this.sa()}a(){super.a(),this.sa(),this.toggleClass("fera-rating-input--disabled",this.g)}r(){super.r(),this.nr()}aa(e){let t=parseInt(e.dataset.rating);this.setValue(t)}nr(){this.Y("[data-rating-star]",e=>{e.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.aa(e)}),e.addEventListener("keyup",t=>{["Enter","Space"].includes(t.code)&&this.aa(e)}),e.addEventListener("mouseover",()=>{let t=parseInt(e.dataset.rating);this.setHoverValue(t)}),e.addEventListener("mouseout",()=>{this.setHoverValue(null)})})}sa(){this.Y("[data-rating-star]",e=>{parseInt(e.dataset.rating)<=(this.ra||this.value)?e.classList.add("fera-rating-input-star--starred"):e.classList.remove("fera-rating-input-star--starred")})}dl(e){return`\u2605`}get s(){return`
${[1,2,3,4,5].map(e=>this.dl(e)).join("")}
`}};var Zi=class extends f{get s(){return` `}};var se=class extends f{constructor(e){super(e),this.Te=this.e.icon,this.gt=this.e.text||"",this.g=this.e.disabled||!1,this.Hc=this.e.submit||!1,this.lr=this.e.loadingText||this.t("Loading..."),this.dr=this.e.loading||!1,this.hl=this.e.loadingIcon||new Zi(this.i)}get oa(){return h(n({},this.e.attributes||{}),{role:"button",disabled:this.g})}setType(e){this.rendered&&(this.ii&&this.removeClass(`fera-btn--${this.ii}`),this.addClass(`fera-btn--${e}`)),this.e.type=e}get ii(){return this.e.type||"primary"}get na(){return this.e.size||"md"}get hr(){return this.e.tagName||(this.e.type==="link"?"a":"button")}disable(){this.g=!0,this.a()}softDisable(){this.addClass("fera-btn--disabled")}enable(){this.g=!1,this.removeClass("fera-btn--disabled"),this.a()}get disabled(){return this.g||this.softDisabled}get softDisabled(){return this.hasClass("fera-btn--disabled")}r(){super.r(),this.ii&&this.addClass(`fera-btn--${this.ii}`),this.na&&this.addClass(`fera-btn--${this.na}`),this.Ze=this.o("[data-fera-icon-container]"),this.ri=this.o("[data-fera-text-container]"),this.e.responsive&&(this.addClass("fera-btn--responsive"),this.ri.classList.add("fera-hidden-xs"),this.e.responsive==="swap"?this.Ze.classList.add("fera-visible-xs-flex"):this.e.responsive==="none"&&(this.Ze.classList.add("fera-hidden"),this.ri.classList.remove("fera-hidden-xs"))),this.a()}a(){super.a(),this.dr?(this.ri.innerHTML=this.lr,this.p("[data-fera-icon-container]",this.hl,{replace:!0}),this.Ze.classList.remove("fera-hidden")):(this.ri.innerHTML=this.gt,this.Te&&this.e.responsive!=="none"?(this.p("[data-fera-icon-container]",this.Te,{replace:!0}),this.Ze.classList.remove("fera-hidden")):(this.Ze.innerHTML="",this.Ze.classList.add("fera-hidden"))),this.g?this.el.setAttribute("disabled",!0):this.el.removeAttribute("disabled")}tr(e){this.disabled?this.cl(e):(this.e.onClick&&this.e.onClick(e),this.trigger("click"))}cl(e){this.e.onDisabledClick&&this.e.onDisabledClick(e),this.trigger("click:disabled")}R(e=null){this.rendered&&(this.dr=!0,this.lr=e||this.lr,this.a())}startLoading(e=null){return this.R(e)}_(){this.dr=!1,this.a()}stopLoading(){return this._()}ul(){let e=Object.keys(this.oa).map(t=>`${t}="${this.oa[t]}"`).join(" ");if(this.hr==="a"&&(e+=` href="${this.e.href||"#"}"`),this.e.responsive||!this.gt){let t=this.e.altText||this.gt||"";t?e+=` aria-label="${t}"`:this.C("Btn missing altText",this)}return e}get s(){return`<${this.hr} class="fera-btn" ${this.ul()}> ${this.e.text||""} `}};var Yi=class extends f{constructor(e){super(e),this.fl=e.defaultRating||0}r(){super.r(),this.A=new It(h(n({},this.i),{inputName:"fera-rating",value:this.fl})),this.A.on("change",()=>{this.A.value>0&&this.trigger("rating:click",this.A.value)}),this.pl=new se(h(n({},this.i),{text:this.t("Ask me later"),type:"link",onClick:()=>this.trigger("postpone")})),this.p("[data-fera-rating-container]",this.A),this.p("[data-fera-returning-shopper-review-ask-later-btn]",this.pl),this.refreshView()}get s(){return`
${this.t("Not ready to leave a review just yet?")}
`}};var Xi=class extends q{constructor(e){super(h(n({},e),{allowOutsideClick:!0,title:"How was your last Order?"})),this.order=e.order,this.content=new Yi(this.i),this.addClass("fera-returning-shopper-review-modal")}get i(){return h(n({},super.i),{defaultRating:this.e.defaultRating})}r(){super.r(),this.content.on("rating:click",e=>this.ml(e)),this.content.on("postpone",this.gl.bind(this))}ml(e){this.hide(),this.app.showContentSubmitter(h(n({},this.cr),{rating:e}))}get cr(){return{attributionCode:"returning_shopper_review.modal",orderModel:this.order,canAbandon:this.app.config.designMode}}gl(){this.app.storage.set("ReturningShopperReview.AskLater",!0,1),this.hide()}sr(){this.app.storage.deleteCookie("Customer.LastOrder"),super.sr()}get ta(){let e="Welcome back!";return this.order.get("customer_first_name",null)&&(e=`Welcome back, ${this.order.get("customer_first_name")}!`),`
${e}

${this.S||""}

`}};var Ji=class extends w{tryToShow(){return m(this,null,function*(){if(!this.app.store.is("returning_shopper_reviews_enabled")||this.app.request.hasUrlApiParam()||this.app.storage.get("ReturningShopperReview.AskLater"))return!1;let t=this.app.storage.getCookieObject("Customer.LastOrder");if(!t||!t.orderId||!t.customerEmail)return!1;let i;try{i=yield this.app.api.retrieveSubmissionOrder(t.orderId,t.customerEmail)}catch(s){s.message.match(/Order not found/)&&(this.app.storage.get("Order.GracePeriod")==t.orderId?(this.app.storage.deleteCookie("Customer.LastOrder"),this.app.storage.deleteCookie("Order.GracePeriod")):(this.app.storage.set("Order.GracePeriod",t.orderId,30),this.app.storage.set("ReturningShopperReview.AskLater",!0,3)))}if(i){if(this.app.storage.deleteCookie("Order.GracePeriod"),i.is("due_for_returning_shopper_review"))return this.showModal(i);i.is("already_reviewed")?this.app.storage.deleteCookie("Customer.LastOrder"):this.app.storage.set("ReturningShopperReview.AskLater",!0,2)}return!1})}showModal(e){return this.la=new Xi({app:this.app,order:e}),this.la.show(),this.la}};var Ki=class extends w{constructor(e){super(e),this.he=[],this.vl=[],this.wl(this.e.pushBuffer)}flush(){for(this.bl();this.he.length>0;){let e=this.he.shift();this.vl.push(e),this.app.push(...e)}}get q(){return{theme:"setTheme",product:"setCurrentProduct",store:"setStore",config:"configure",ready:["once","ready"]}}get da(){return["configure","setStore","setCurrentProduct","setTheme"]}wl(e){if(!e)return;let t=null,i=[];e.forEach(s=>{if(s&&typeof s=="object"&&(s.method||s.action)){let o=s.method||s.action;delete s.method,delete s.action;let l=s.data?s.data:s;this.he.push([o,l]);return}let a=typeof s=="object"?s.method||s.action:s;this.yl(a,s)?(t&&this.he.push([t,...i]),t=a,i=s.args||[s.data]):t&&this.xl(t,s)?i.push(s):(t&&this.he.push([t,...i]),t=s,i=[])}),t&&this.he.push([t,...i])}xl(e,t){return typeof e!="string"||this.q[e]&&Array.isArray(this.q[e])&&this.q[e][0]===t||this.q[t]&&Array.isArray(this.q[t])&&this.q[t][0]===e?!0:typeof this.app[t]!="function"&&!this.q[t]}yl(e,t){return typeof e!="string"||typeof t!="object"?!1:typeof this.app[e]=="function"||this.q[e]}_l(){this.he=this.he.map(e=>{let t=e[0];return this.q[t]&&(e.shift(),(Array.isArray(this.q[t])?this.q[t]:[this.q[t]]).reverse().forEach(i=>{e.unshift(i)})),e})}bl(){this._l(),this.he.sort((e,t)=>{let i=this.da.indexOf(e[0]),s=this.da.indexOf(t[0]);return i<0?1:s<0?-1:i-s})}};var $e=class extends q{constructor(e){super(h(n({},e),{allowOutsideClick:!0})),this.addClass("fera-submitter-modal")}};var Gi=class extends f{get s(){return`${this.t(`}};var Qi=class extends f{get s(){return`${this.t(`}};var Ye=class extends f{constructor(e){super(e),this.media=this.e.media,this.addClass(`fera-media fera-media--${this.media.type}`)}r(){super.r(),this.thumbnailImg=this.o(`[data-fera-${this.media.type}-item-thumbnail]`),this.thumbnailImg&&this.media.thumbnailUrl&&this.thumbnailImg.addEventListener("error",()=>this.trigger("error",this.media.thumbnailUrl))}usePlaceholderAsThumbnailUrl(){this.media.set("thumbnail_url",this.media.constructor.placeholderUrl),this.thumbnailImg.src=this.thumbnailImgUrl,this.refreshView()}d(){super.d(),this.toggleClass("fera-media--placeholder",this.isPlaceholder)}get url(){return this.media.url}get isPlaceholder(){return this.media.isUploaded&&!!this.url.match(/uploads\.fera\..+\/placeholders?(\/|[a-z-_]*\.[a-z]+)/)}};var At=class extends Ye{constructor(e){super(e),this.addClass(`fera-media-thumbnail fera-media-thumbnail--${this.media.type}`),this.e.size&&this.addClass(`fera-media-thumbnail--${this.e.size}`)}get url(){return this.media.thumbnailUrl}get thumbnailImgUrl(){return this.e.size==="small"?this.media.smallThumbnailUrl||"":this.media.thumbnailUrl||""}get Cl(){return``}get ha(){return this.media.url||""}get kl(){return this.Cl}get s(){return`
${this.kl}
`}};function Ka(){if(globalThis.fera&&globalThis.fera.ua)return globalThis.fera.ua;let r=globalThis.navigator.userAgent,e=null;return r.match(/Firefox/)?e="firefox":r.match(/Chrome\/[0-9]+/)?r.match(/Edg\/[0-9]+/)?e="edge":e="chrome":r.match(/Safari\/[0-9]+/)&&(e="safari"),globalThis.fera.ua=e,e}function Ga(r){return Array.isArray(r)||(r=[r]),r.includes(Ka())}var Xe=class extends Ye{r(){super.r(),this.addClass("fera-media--video"),Ga(["chrome","edge"])&&this.el.addEventListener("click",()=>this.togglePlay())}get imgForLightboxBg(){return this.errored?null:this.media.thumbnailUrl}togglePlay(){this.paused?this.play():this.stop()}get paused(){return this.el&&this.el.paused}play(){return this.el&&this.el.play&&this.paused&&this.el.play()}stop(){return this.el&&this.el.pause&&!this.paused&&this.el.pause()}Sl(){let e=this.media.importedVideoUrl;return["youtube","vimeo","instagram","facebook"].includes(this.media.videoType)?``:this.fa(e)}fa(e){return`