(()=>{"use strict";var e={144:(e,t,i)=>{i.d(t,{Z:()=>a});var n=i(81),r=i.n(n),o=i(645),s=i.n(o)()(r());s.push([e.id,'/* Default reco style for all clients */\n\njarvisml-product-rec .carousel_box {\n position: relative;\n margin: 0 0 20px;\n}\njarvisml-product-rec .carousel_box.with_buttons {\n /* padding: 0 35px; define this if you need */\n --buttonWidth: 32px;\n --buttonHeight: 32px;\n --buttonRoundness: 50%;\n}\n\njarvisml-product-rec .carousel_hitbox {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n width: 50px;\n height: 100px;\n border: none;\n background: transparent;\n cursor: pointer;\n z-index: 1;\n}\njarvisml-product-rec .carousel_btn {\n border: 1px solid #000;\n background-color: #fff;\n border-radius: var(--buttonRoundness);\n width: var(--buttonWidth);\n height: var(--buttonHeight);\n opacity: 0.6;\n}\njarvisml-product-rec .carousel_btn span {\n line-height: 70px;\n font-size: 25px;\n}\njarvisml-product-rec .carousel_btn svg {\n position: relative;\n top: 50%;\n transform: translateY(-50%);\n}\n\njarvisml-product-rec .carousel_hitbox.leftSide {\n left: -4px;\n}\njarvisml-product-rec .carousel_hitbox.rightSide {\n right: -11px;\n}\n\njarvisml-product-rec .carousel_hitbox:hover:enabled .carousel_btn {\n opacity: 1;\n}\njarvisml-product-rec .carousel_hitbox:active .carousel_btn {\n transform: scale(0.95);\n}\n\njarvisml-product-rec .carousel_hitbox:disabled .carousel_btn {\n opacity: 0.4;\n}\njarvisml-product-rec .carousel_hitbox:hover:disabled:active .carousel_btn {\n opacity: 0.7;\n}\n\njarvisml-product-rec .product_list {\n display: flex;\n padding: 0 0 15px 0;\n margin: 0;\n list-style-type: none;\n overflow-x: auto;\n overflow-y: hidden;\n gap: var(--product-spacing);\n}\n\njarvisml-product-rec .product_item {\n position: relative;\n flex: 1;\n height: fit-content;\n min-width: calc(100% / var(--desktop-col-count) - ((var(--product-spacing) * (var(--desktop-col-count) - 1)) / var(--desktop-col-count)));\n}\n\njarvisml-product-rec .imgBox {\n overflow: hidden;\n position: relative;\n}\n\njarvisml-product-rec .product_img {\n position: absolute;\n left: 0;\n top: 0;\n padding: 0;\n margin: 0;\n width: 100%;\n object-fit: contain;\n aspect-ratio: 1;\n cursor: pointer;\n opacity: 0;\n transition: opacity 0.4s ease;\n user-select: none;\n}\n\njarvisml-product-rec .product_details-container {\n text-align: var(--details-alignment);\n}\n\njarvisml-product-rec .product_link {\n display: block;\n text-decoration: none;\n color: inherit; \n}\n\njarvisml-product-rec .product_label {\n text-decoration: none;\n color: currentColor;\n line-height: 24px;\n max-height: 72px;\n -webkit-line-clamp: 3;\n -webkit-box-orient: vertical;\n display: -webkit-box;\n overflow: hidden;\n overflow-wrap: break-word;\n cursor: pointer;\n margin: 0;\n text-align: var(--details-alignment);\n}\n\njarvisml-product-rec .product_rating {\n display: flex;\n justify-content: var(--details-alignment);\n}\n\njarvisml-product-rec span.product_stars {\n margin-right: 6px;\n}\n\njarvisml-product-rec .rating_star {\n fill: lightgrey;\n margin-right: 4px;\n}\n\njarvisml-product-rec .rating_star.active{\n fill: #fed94b;\n}\n\njarvisml-product-rec .rating_count {\n font-size: 1em;\n}\n\njarvisml-product-rec .product_price {\n font-size: 100%;\n font-weight: bold;\n cursor: pointer;\n}\n\njarvisml-product-rec .pixel {\n opacity: 0.001;\n pointer-events: none;\n display: block;\n float: right;\n position: relative;\n right: 30%;\n margin: -1px 0 0 0;\n}\n\njarvisml-product-rec .swatch_area {\n display: inline-block;\n max-width: 100%;\n overflow-x: auto;\n padding: 4px 0;\n --swatchSize: 19px;\n}\n@media only screen and (max-width: 768px) {\n /* Small screens ~= "mobile" */\n\n jarvisml-product-rec .product_item {\n min-width: calc(100% / var(--mobile-col-count) - ((var(--product-spacing) * (var(--mobile-col-count) - 1)) / var(--mobile-col-count)));\n } \n\n jarvisml-product-rec .swatch_area {\n --swatchSize: 34px;\n --swatchRoundness: 50%;\n }\n}\n\njarvisml-product-rec .swatch_box {\n display: flex;\n width: fit-content;\n}\njarvisml-product-rec .swatch_box_2rows {\n line-height: 0;\n overflow-y: hidden;\n height: calc(2 * (var(--swatchSize) + 12px));\n}\njarvisml-product-rec .swatch_box_all_rows {\n line-height: 0;\n height: fit-content;\n}\n\njarvisml-product-rec .swatch_button {\n position: relative;\n display: inline-block;\n box-sizing: content-box;\n height: var(--swatchSize);\n width: var(--swatchSize);\n line-height: 0;\n margin: 2.5px; /* > .selected box-shadow */\n border-radius: var(--swatchRoundness);\n border: 3.5px solid transparent;\n cursor: pointer;\n}\njarvisml-product-rec .swatch_button.selected {\n box-shadow: 0 0 0 2px;\n}\njarvisml-product-rec .swatch_button_img {\n height: 100%;\n width: 100%;\n background-position: 50%;\n background-size: cover;\n background-repeat: no-repeat;\n border-radius: var(--swatchRoundness);\n box-shadow: 0 0 1px 1px;\n color: #777;\n}\njarvisml-product-rec .swatch_button_img.small_image {\n object-fit: contain;\n}\njarvisml-product-rec .swatch_button_img.image_spot {\n object-position: 60% 50%;\n object-fit: none;\n}\njarvisml-product-rec .swatch_button_unavailable {\n display: block;\n position: absolute;\n left: 0.5px;\n top: calc(50% - 0.5px);\n height: 1px;\n width: calc(100% - 1px);\n color: black;\n background: white;\n box-shadow: 0px 0px 1px 0px;\n transform: rotate(-45deg);\n}\njarvisml-product-rec .swatch_button_unavailable_ext {\n display: none;\n}\n\njarvisml-product-rec .tag_box {\n z-index: 1;\n position: absolute;\n top: 0;\n height: 100%;\n width: 100%;\n cursor: pointer;\n}\njarvisml-product-rec .jml-tag {\n display: none;\n position: absolute;\n}\n.jml-tags_label {\n display: block;\n position: absolute;\n background: black;\n padding: 6px 8px;\n color: white;\n top: 0;\n right: 0;\n font-size: 14px;\n}\n\njarvisml-product-rec span.price-strikethrough {\n text-decoration: line-through;\n}\njarvisml-product-rec span.price-sale {\n display: inline-block;\n margin-left: 1ex;\n}\n\n/* For Accessibility */\njarvisml-product-rec .jml-visually-hidden {\n position:absolute;\n width: 1px;\n height: 1px;\n border: 0;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n overflow: hidden;\n}',""]);const a=s},484:(e,t,i)=>{i.d(t,{Z:()=>a});var n=i(81),r=i.n(n),o=i(645),s=i.n(o)()(r());s.push([e.id,"ul.jml-search-document-container {\n display: flex;\n list-style-type: none;\n margin: 1rem 0;\n gap: 1.2rem;\n flex-wrap: wrap;\n max-height: 120px;\n padding: 1rem 0;\n overflow: hidden;\n border-bottom: 1px solid #a1a1a1;\n}\n\nli.jml-document {\n padding: 1rem 2rem;\n background: #F0F0F0;\n height: 40px;\n margin: 0;\n display: flex;\n justify-content: left;\n align-items: center;\n}\n\nli.jml-document a {\n display: inline-block;\n max-width: 260px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}",""]);const a=s},447:(e,t,i)=>{i.d(t,{Z:()=>a});var n=i(81),r=i.n(n),o=i(645),s=i.n(o)()(r());s.push([e.id,'/*css for Filters*/\n.jml-filters-section .filter-groups .filter-list.collapsible-content {\n max-height: 160px;\n visibility: hidden;\n opacity: 0;\n overflow: hidden;\n height: 0;\n margin: 0;\n transition: opacity .3s cubic-bezier(.25,.46,.45,.94),height .3s cubic-bezier(.25,.46,.45,.94);\n}\n\n.jml-filters-section .filter-groups .filter-list.collapsible-content.is-open {\n visibility: visible;\n opacity: 1;\n overflow-y: auto;\n height: auto;\n margin-bottom: 4px;\n font-size: 12px;\n transition: opacity 1s cubic-bezier(.25,.46,.45,.94),height .35s cubic-bezier(.25,.46,.45,.94);\n}\n\n.jml-filters-section .filter-groups .filter-groups-label .collapsible-trigger {\n border: none;\n width: 100%;\n padding: 12px 10px 12px 0;\n text-align: left;\n background: none;\n font-size: 14px;\n font-weight: bold;\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n.jml-filters-section .filter-groups .filter-groups-label .collapsible-trigger .icon {\n transition: all .1s ease-in;\n}\n\n.jml-filters-section .filter-groups .filter-groups-label .collapsible-trigger.is-open .icon {\n transition: all .1s ease-in;\n transform: scaleY(-1);\n}\n\n.jml-filters-section .filter-groups * {\n cursor: pointer;\n}\n\n.jml-filters-section .filter-groups .filter-content input {\n margin: 0px;\n}\n\n#jarvis-search-results .mobile-filter-button {\n background-color: #fff;\n border: 1px solid;\n display: none;\n align-items: center;\n justify-content: space-evenly;\n min-width: 140px;\n padding: 8px;\n height: 40px;\n font-size: 16px;\n}\n\n#jarvis-search-results .mobile-filter-button svg {\n width: 15%;\n}\n\n.relevant-filters-added .jml-search-block .jml-filters-section {\n flex-basis: 20%;\n margin: 0 6px;\n max-width: 220px;\n position: relative;\n top: 10px;\n overflow-y: auto;\n}\n\n.relevant-filters-added .jml-search-block .jml-search-results {\n flex-basis: 80%;\n flex-grow: 1;\n margin: 0 1em;\n}\n\n.jml-search-block .jml-search-results {\n width: 100%;\n}\n\n.jml-filters-section .filter-groups {\n margin: 2px;\n overflow: hidden;\n border-top: 1px solid #e8e8e1;\n}\n\n.jml-filters-section .filters .heading-section {\n font-weight: 700;\n}\n\n.jml-filters-section .filter-groups:first-of-type {\n border-top: 0;\n}\n\n.jml-filters-section .mobile-filter-cross {\n display: none;\n}\n\n.jml-filters-section .filter-list .view-more-filter-list {\n display: none;\n}\n\n.jml-filters-section .filter-list a.view-more-options, .jml-filters-section .filter-list a.view-less-options {\n text-decoration: none;\n color: #000;\n font-weight: 600;\n}\n\n.jml-filters-section .filter-list a.view-more-options:hover, .jml-filters-section .filter-list a.view-less-options:hover {\n text-decoration: underline;\n}\n\n.jml-filters-section .filter-content {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 4px 0;\n}\n\n.jml-filters-section .filter-content label {\n margin: 0;\n padding: 0;\n margin-left: 8px;\n font-size: 12px;\n font-weight: 200;\n}\n\n\n.jml-filters-section .price-parent-container {\n padding: 13px 8px;\n}\n\n.jml-filters-section .price-parent-container .price-input {\n width: 100%;\n display: flex;\n margin: 0 0 20px;\n}\n.jml-filters-section .price-parent-container .price-input .input-field {\n display: flex;\n width: 100%;\n align-items: center;\n}\n.jml-filters-section .price-parent-container .input-field input {\n width: 100%;\n height: 100%;\n outline: none;\n font-size: 14px;\n margin-right: 10px;\n border-radius: 5px;\n text-align: center;\n border: 1px solid #999;\n -moz-appearance: textfield;\n}\n.jml-filters-section .price-parent-container .input-field input[type="number"]::-webkit-outer-spin-button,\n.jml-filters-section .price-parent-container .input-field input[type="number"]::-webkit-inner-spin-button {\n -webkit-appearance: none;\n}\n.jml-filters-section .price-parent-container .price-input .price-separator {\n display: flex;\n font-size: 19px;\n align-items: center;\n justify-content: center;\n margin: 0 14px;\n}\n.jml-filters-section .price-parent-container .price-slider {\n height: 2px;\n position: relative;\n background: #ddd;\n border-radius: 2px;\n}\n.jml-filters-section .price-parent-container .price-slider .price-progress {\n height: 2px;\n left: 0%;\n right: 0%;\n position: absolute;\n border-radius: 2px;\n background-color: #000;\n display: block;\n z-index: 1;\n}\n.jml-filters-section .price-parent-container .price-range-input {\n position: relative;\n width: 100%;\n margin-bottom: 1em;\n}\n.jml-filters-section .price-parent-container .price-range-input input {\n position: absolute;\n width: 100%;\n height: 2px;\n top: -2px;\n margin: 0;\n padding: 0;\n z-index: 1;\n background: none;\n pointer-events: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n}\n.jml-filters-section .price-parent-container input[type="range"]::-webkit-slider-thumb {\n height: 12px;\n width: 12px;\n border-radius: 50%;\n background: #000;\n pointer-events: auto;\n -webkit-appearance: none;\n cursor: pointer;\n z-index: 2;\n}\n.jml-filters-section .price-parent-container input[type="range"]::-moz-range-thumb {\n height: 12px;\n width: 12px;\n border: none;\n border-radius: 50%;\n background: #000;\n pointer-events: auto;\n -moz-appearance: none;\n cursor: pointer;\n z-index: 2;\n}\n\n.jml-filters-section .price-parent-container .price-search {\n padding: 6px 14px;\n float: right;\n background: #fff;\n border: 1px solid;\n color: #000;\n border-radius: 5px;\n}\n\n.jml-filters-section .price-parent-container .price-search:hover {\n background: #000;\n color: #fff;\n}\n\n.jml-filters-section span.collapsible-trigger-icon {\n width: auto;\n}\n\n#jarvis-search-results .jml-action-button-container {\n display: none;\n}\n\n@media only screen and (max-width: 435px) {\n .jml-search-results .action-buttons-container {\n align-items: center;\n justify-content: space-between;\n width: 100%;\n margin-bottom: 1em;\n display: flex;\n }\n\n .jml-filters-section {\n position: fixed;\n z-index: 99;\n top: 0;\n bottom: 0;\n background: white;\n width: 95%;\n max-width: 340px;\n display: flex;\n left: 0;\n align-items: flex-start;\n transition: all .1s ease-in;\n padding: 2em 1em;\n margin: 0;\n visibility: hidden;\n opacity: 1;\n height: 0;\n }\n\n .jml-filters-section .heading-section {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 15px 10px 15px 0;\n }\n\n .jml-filters-section .filters {\n width: 100%;\n overflow-y: auto;\n height: 100%;\n }\n\n .jml-filters-section.mobile-open {\n visibility: visible;\n opacity: 1;\n height: auto;\n min-height: 100%;\n }\n\n .jml-filters-section .mobile-filter-cross {\n display: flex;\n background: none;\n border: none;\n font-size: 24px;\n }\n\n #jarvis-search-results .mobile-filter-button {\n display: flex;\n width: 46%;\n min-width: inherit;\n }\n #jarvis-search-results .jml-action-button-container {\n align-items: center;\n justify-content: space-between;\n width: 100%;\n margin-bottom: 1em;\n display: flex;\n }\n #jarvis-default-sort-box {\n display: none;\n }\n}',""]);const a=s},731:(e,t,i)=>{i.d(t,{Z:()=>a});var n=i(81),r=i.n(n),o=i(645),s=i.n(o)()(r());s.push([e.id,"\n/* css for infinite scroll loader */\n#jarvis-loader-container {\n display: inline-block;\n position: relative;\n width: 80px;\n height: 80px;\n visibility: hidden;\n }\n \n #jarvis-loader-container div {\n position: absolute;\n top: 33px;\n width: 13px;\n height: 13px;\n border-radius: 50%;\n background: #000;\n animation-timing-function: cubic-bezier(0, 1, 1, 0);\n }\n \n #jarvis-loader-container div:nth-child(1) {\n left: 8px;\n animation: lds-ellipsis1 0.6s infinite;\n }\n \n #jarvis-loader-container div:nth-child(2) {\n left: 8px;\n animation: lds-ellipsis2 0.6s infinite;\n }\n \n #jarvis-loader-container div:nth-child(3) {\n left: 32px;\n animation: lds-ellipsis2 0.6s infinite;\n }\n \n #jarvis-loader-container div:nth-child(4) {\n left: 56px;\n animation: lds-ellipsis3 0.6s infinite;\n }\n \n @keyframes lds-ellipsis1 {\n 0% {\n transform: scale(0);\n }\n \n 100% {\n transform: scale(1);\n }\n }\n \n @keyframes lds-ellipsis3 {\n 0% {\n transform: scale(1);\n }\n \n 100% {\n transform: scale(0);\n }\n }\n \n @keyframes lds-ellipsis2 {\n 0% {\n transform: translate(0, 0);\n }\n \n 100% {\n transform: translate(24px, 0);\n }\n }",""]);const a=s},812:(e,t,i)=>{i.d(t,{Z:()=>a});var n=i(81),r=i.n(n),o=i(645),s=i.n(o)()(r());s.push([e.id,"div.jml-unavailable-overlay-label {\n position: absolute;\n top: 15px;\n left: 15px;\n z-index: 100;\n padding: 3px 6px 3px 6px;\n background: #D3D3D3;\n color: white;\n font-size: 1.4rem;\n}",""]);const a=s},645:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var i="",n=void 0!==t[5];return t[4]&&(i+="@supports (".concat(t[4],") {")),t[2]&&(i+="@media ".concat(t[2]," {")),n&&(i+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),i+=e(t),n&&(i+="}"),t[2]&&(i+="}"),t[4]&&(i+="}"),i})).join("")},t.i=function(e,i,n,r,o){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(n)for(var a=0;a0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=o),i&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=i):d[2]=i),r&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=r):d[4]="".concat(r)),t.push(d))}},t}},81:e=>{e.exports=function(e){return e[1]}},379:e=>{var t=[];function i(e){for(var i=-1,n=0;n{var t={};e.exports=function(e,i){var n=function(e){if(void 0===t[e]){var i=document.querySelector(e);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}t[e]=i}return t[e]}(e);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(i)}},216:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},565:(e,t,i)=>{e.exports=function(e){var t=i.nc;t&&e.setAttribute("nonce",t)}},37:e=>{var t,i=(t=[],function(e,i){return t[e]=i,t.filter(Boolean).join("\n")});function n(e,t,n,r){var o;if(n)o="";else{o="",r.supports&&(o+="@supports (".concat(r.supports,") {")),r.media&&(o+="@media ".concat(r.media," {"));var s=void 0!==r.layer;s&&(o+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),o+=r.css,s&&(o+="}"),r.media&&(o+="}"),r.supports&&(o+="}")}if(e.styleSheet)e.styleSheet.cssText=i(t,o);else{var a=document.createTextNode(o),l=e.childNodes;l[t]&&e.removeChild(l[t]),l.length?e.insertBefore(a,l[t]):e.appendChild(a)}}var r={singleton:null,singletonCounter:0};e.exports=function(e){var t=r.singletonCounter++,i=r.singleton||(r.singleton=e.insertStyleElement(e));return{update:function(e){n(i,t,!1,e)},remove:function(e){n(i,t,!0,e)}}}},593:(e,t,i)=>{i.d(t,{j:()=>o,pv:()=>n,t8:()=>r});const n={shopify:"shopify_json",wc:"wc",hospitality:"hospitality_json",marine:"marine",ecommerce:"ecommerce"};function r(e){const t=new Date,i=new Date(t.getTime()+6048e5);document.cookie=`_jarvis_cid=${e}; expires=${i}`}function o(){var e,t;return`${e=1e15,t=Number.MAX_SAFE_INTEGER,Math.floor(Math.random()*(t-(e+1))+e)}.${function(){const e=new Date,t=e.getTime()+60*e.getTimezoneOffset()*1e3;return Math.round(t/1e3)}()}.1`}},717:(e,t,i)=>{i.d(t,{U:()=>re});var n=i(575),r=i(199),o=i(636),s=i(63),a=i(625),l=i(660);const c="~VARIANT_ID~";function d(e){const t=[],i=[360,540,720,900,1080];for(const n in i)t.push(`${e}&width=${i[n]} ${i[n]}w`);return t.toString()}function u(e,t){let i=e.indexOf("/products/");return i<0&&(i=e.lastIndexOf("/files/")),`${e.substring(0,i)}/files/${t}_50x50.png`}function p(e,t,i){const n=e.lastIndexOf(".");return n<0?e:`${e.substring(0,n)}_${t}x${i}${e.substring(n)}`}function h(e){return e?e.startsWith("https:")?e.substring(6):e:""}function m(e,t){const i=Number(e);return isNaN(i)?e:t(i)}function g(e,t,i){var n,r;const o=null===(n=e.attributes[t])||void 0===n?void 0:n.nodeValue;if(void 0===o||""===o){if(!(null===(r=window.JarvisMLOptions)||void 0===r?void 0:r.extensionSettings))return i;const e=function(e){if(!e.startsWith("data-"))return e;const t=e.substring(5).split(/-|_/);return t[0]+t.slice(1).map((e=>e[0].toUpperCase()+e.substring(1))).join("")}(t),n=window.JarvisMLOptions.extensionSettings[e]||i;return String(n)}return o}function f(e,t){const i=t?encodeURIComponent(`&variant=${t}`):"";return e.landing_page_click_tracker_url.replace(c,i)}function v(e,t){Object.keys(t).forEach((i=>{e.setAttribute(i,t[i])}))}var y=i(379),_=i.n(y),b=i(37),w=i.n(b),S=i(569),I=i.n(S),x=i(565),j=i.n(x),C=i(216),A=i.n(C),k=i(144),L={};k.Z&&k.Z.locals&&(L.locals=k.Z.locals);var R,M=0,P={};P.setAttributes=j(),P.insert=I().bind(null,"head"),P.domAPI=w(),P.insertStyleElement=A(),L.use=function(e){return P.options=e||{},M++||(R=_()(k.Z,P)),L},L.unuse=function(){M>0&&!--M&&(R(),R=null)};const E=L,T="*main*",B="*alt*";let $=null,F=null,D=0,O="RESET";function U(e,t){e===F&&clearTimeout($),F=e,$=setTimeout(t,50)}function z(e){e.removeEventListener("click",V),e.removeEventListener("mouseenter",H),e.removeEventListener("mouseleave",Q)}function q(e){const t=e.currentTarget._product;clearTimeout($),t.gotoVariant()}function N(e){const t=e.currentTarget._product;"STAY"!==O&&U(t,(()=>t.showImage(B)))}function J(e){const t=e.currentTarget._product;"STAY"!==O&&U(t,(()=>t.showImage(T)))}function V(e){const t=e.currentTarget,i=t._product,n=Date.now()-D;i.currentVariantId=t._variantId,n>100&&i.gotoVariant()}function H(e){const t=e.currentTarget,i=t._product;D=Date.now(),i.currentVariantId=t._variantId;const n=t._swatchName;U(i,(()=>i.showSwatch(n)))}function Q(e){const t=e.currentTarget._product;"STAY"!==O&&U(t,(()=>t.showImage(T)))}var G=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const Z={brackets:"M15 4.5l-7.5 7.5l7.5 7.5",arrows:"M11 4.5l-7.5 7.5l7.5 7.5m-7.5-7.5l16 0"},K={brackets:"M9 4.5l7.5 7.5-7.5 7.5",arrows:"M13 4.5l7.5 7.5-7.5 7.5m7.5-7.5l-16 0"},W="http://www.w3.org/2000/svg",Y=`\n \n \n \n \n \n `,X="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",ee=100,te=Date.now();class ie{constructor(e){this.topElement=e,this.products=[],this.jarvisRecoApi=null,this.productButtonAction=null,this.getSettings(),this.hideAll(!0),console.info("ProductRec constructor",Date.now()-te)}getSettings(){this.maxProductCount=this.getIntSetting("data-product_count",4),this.showCarouselButtons=this.getBoolSetting("data-show_carousel_buttons",!0),this.carouselButtonSize=this.getStrSetting("carouselButtonSize","32px"),this.carouselButtonIcon=this.getStrSetting("carouselButtonIcon","brackets"),this.carouselButtonRoundness=this.getStrSetting("carouselButtonRoundness","100"),this.carouselButtonSvg=this.getStrSetting("carouselButtonSvg",""),this.carouselButtonSvgPathLeft=this.getStrSetting("carouselButtonSvgPathLeft",""),this.carouselButtonSvgPathRight=this.getStrSetting("carouselButtonSvgPathRight",""),this.carouselButtonLabelLeft=this.getStrSetting("carouselButtonLabelLeft",""),this.carouselButtonLabelRight=this.getStrSetting("carouselButtonLabelRight",""),this.hoverBehavior=this.getStrSetting("data-hover_behavior","RESET"),this.showAltImage=this.getBoolSetting("data-show_alt_image",!1),this.productItemClasses=this.getStrSetting("data-product_item_classes","product_item"),this.labelClasses=this.getStrSetting("data-label_classes","product_label"),this.priceClasses=this.getStrSetting("data-price_classes","product_price"),this.forceZeroCents=this.getBoolSetting("data-price_show_zero_cents",!1),this.showCustomLabel=this.getBoolSetting("data-show_custom_label",!1),this.tagFilters=this.getStrSetting("data-tag_filter",""),this.swatchBoxClasses=this.getStrSetting("data-swatch_box_classes","swatch_box"),this.swatchRoundness=this.getStrSetting("data-swatch_roundness","100"),this.swatchImageType=this.getStrSetting("data-swatch_image_type","option-icon"),this.hideUnavailableSwatches=this.getBoolSetting("data-hide_unavailable_swatches",!1),this.swatchSize=this.getIntSetting("data-swatch_size",0),this.swatchSizeMobile=this.getIntSetting("data-swatch_size_mobile",0),this.headingLabel=this.getStrSetting("data-heading",""),this.headingTag=this.getStrSetting("data-heading_tag","h2"),this.headingClasses=this.getStrSetting("data-heading_classes","jarvis-recommendations-header"),this.buttonBoxClasses=this.getStrSetting("data-button_box_classes","disabled"),this.productButtonClasses=this.getStrSetting("data-product_button_classes","product_button"),this.productButtonLabel=this.getStrSetting("data-product_button_label",""),this.showVendor=this.getBoolSetting("data-product_vendor",!1),this.showRatings=this.getBoolSetting("data-product_rating",!1),this.productDetailsAlignment=this.getStrSetting("data-product_details_alignment","start"),this.showCurrencyCodeAndSymbol=this.getBoolSetting("data-show_currency_code",!1),this.columnsDesktop=this.getIntSetting("data-columns_desktop",4),this.columnsMobile=this.getStrSetting("data-columns_mobile","2"),this.productSpacing=this.getIntSetting("data-product_spacing",10)}getIntSetting(e,t){return function(e,t,i){const n=g(e,t,"");if(void 0===n||""===n)return i;const r=parseInt(n);return isNaN(r)?i:r}(this.topElement,e,t)}getBoolSetting(e,t){return function(e,t,i){const n=g(e,t,"");return void 0===n||""===n?i:n&&"false"!==n}(this.topElement,e,t)}getStrSetting(e,t){return g(this.topElement,e,t)}setOptions(e){for(const t in e)void 0!==this[t]?this[t]=e[t]:console.warn(`Not an option: ${t} (value ignored: ${e[t]})`)}createDom(){E.use(),function(e){switch(e){case"STAY":case"RESET":O=e;break;default:O="RESET"}}(this.hoverBehavior),this.swatchRoundness=m(this.swatchRoundness,(e=>e/2+"%")),this.carouselButtonRoundness=m(this.carouselButtonRoundness,(e=>e/2+"%")),this.headingLabel&&((0,a.Fz)(this.topElement,this.headingTag||"h2",this.headingClasses).innerText=this.headingLabel);const e=!a.tq&&this.showCarouselButtons;if(this.carouselBox=(0,a.Mq)(this.topElement,"div","carousel_box"+(e?" with_buttons":"")),this.productListElement=(0,a.Mq)(this.carouselBox,"ol","product_list"),this.productListElement.style.cssText=`\n --product-spacing: ${this.productSpacing}px;\n --details-alignment: ${this.productDetailsAlignment};\n --desktop-col-count: ${this.columnsDesktop};\n --mobile-col-count: ${this.columnsMobile};\n `,e){this.carouselBox.style.setProperty("--buttonRoundness",this.carouselButtonRoundness);const[e,t]=function(e){const t=e=>`${e}px`,i=e.split(",");if(1===i.length){const i=m(e,t);return[i,i]}return[m(i[0],t),m(i[1],t)]}(this.carouselButtonSize);this.carouselBox.style.setProperty("--buttonWidth",e),this.carouselBox.style.setProperty("--buttonHeight",t),this.leftBtn=this.createCarouselButton("leftSide","<",-1),this.rightBtn=this.createCarouselButton("rightSide",">",1),this.productListElement.onscroll=()=>this.enableCarouselButtons()}for(let e=0;ethis.onResize()),300),window.addEventListener("resize",this.resizeHandler)}onResize(){this.enableCarouselButtons()}createCarouselButton(e,t,i){const n=(0,a.Mq)(this.carouselBox,"button","carousel_hitbox "+e);(0,a.Vc)(n,"",(()=>this.onCarouselButtonClick(i)));const r=(0,a.Mq)(n,"div","carousel_btn");if(this.carouselButtonLabelLeft&&this.carouselButtonLabelRight){const e="<"===t?this.carouselButtonLabelLeft:this.carouselButtonLabelRight;r.innerHTML=`${e}`}else{const e="<"===t?this.carouselButtonSvgPathLeft||Z[this.carouselButtonIcon]:this.carouselButtonSvgPathRight||K[this.carouselButtonIcon];r.innerHTML=(this.carouselButtonSvg||'\n ').replace("%PATH%",e)}return n.hidden=!0,n}onCarouselButtonClick(e){const t=this.getVisibleProducts(),i=this.productListElement.scrollWidth,n=i/t.length,r=this.productListElement.clientWidth;let o=this.productListElement.scrollLeft;if(re.clientWidth?(this.leftBtn.hidden=this.rightBtn.hidden=!1,this.leftBtn.disabled=0===e.scrollLeft,this.rightBtn.disabled=e.scrollLeft>=e.scrollWidth-e.clientWidth-1):this.leftBtn.hidden=this.rightBtn.hidden=!0}getVisibleProducts(){return this.products.filter((e=>!e.element.hidden))}hideAll(e){this.topElement.hidden=e}initRecos(){var e,t,i;return G(this,void 0,void 0,(function*(){this.jarvisRecoApi=yield(0,s.Gu)(),console.info("waitForSdk",Date.now()-te),this.jarvisRecoApi.jmlUtilities.setCurrency(null===(t=null===(e=window.Shopify)||void 0===e?void 0:e.currency)||void 0===t?void 0:t.active);const n=this.jarvisRecoApi.jmlUtilities.currencySettings;this.forceZeroCents&&(n.showZeroCents=!0),this.showCurrencyCodeAndSymbol&&(n.showCodeAndSymbol=!0,n.symbolPosition="before",n.codePosition="after"),(null===(i=window.JarvisMLOptions)||void 0===i?void 0:i.currencySettings)&&Object.assign(n,window.JarvisMLOptions.currencySettings),yield this.fetchData(),this.enableCarouselButtons()}))}destroy(){this.products.forEach((e=>{e.destroy()})),this.products=[],window.removeEventListener("resize",this.resizeHandler),E.unuse()}fetchData(){return G(this,void 0,void 0,(function*(){if(0===this.products.length)return null;const e=Math.max(this.products.length,10);console.info("fetchData",Date.now()-te,e),"jarvis-ml-dev.myshopify.com"===this.jarvisRecoApi.apiRoot.collectedIds.source||this.jarvisRecoApi.apiRoot.collectedIds.shopifyDomain;const t=this.jarvisRecoApi.buildRecommendationUrl(null,null,e),i=this.jarvisRecoApi.getBaseUrl();try{const e=yield fetch(t),n=yield e.json(),r=(0,a.q2)(n.recommendations);n.recommendations=r.slice(0,this.products.length),this.jarvisRecoApi.apiRoot.idCollection.processVisitIdResponse(n);const o=n.recommendations;if(console.info(`received ${null==o?void 0:o.length} recs`,Date.now()-te),!o||0===o.length)return null;this.hideAll(!1),this.jarvisRecoApi.apiRoot.recommendations=o;const s=Math.min(o.length,this.products.length),l=[];for(let e=0;e{t.productButtonAction&&t.productButtonAction(this,e)}))}var o;this.label.onclick=this.price.onclick=()=>this.gotoVariant(),(o=this.imageBox)._product=this,o.addEventListener("click",q),o.addEventListener("mouseenter",N),o.addEventListener("mouseleave",J)}destroy(){var e;this.label.onclick=this.price.onclick=null,(e=this.imageBox).removeEventListener("click",q),e.removeEventListener("mouseenter",N),e.removeEventListener("mouseleave",J);for(const e in this.swatches)z(this.swatches[e])}setFromReco(e,t){return G(this,void 0,void 0,(function*(){this.recoData=e;const i=function(e,t){let i;const n=e.landing_page_click_tracker_url,r="&destination_url=",o=n.indexOf(r);if(o>=0){let s=n.indexOf("&",o+1);-1===s&&(s=n.length);let a=decodeURIComponent(n.substring(o+r.length,s)),d=(0,l.eY)(a,"variant");d&&(a=(0,l.ch)(a,`variant=${d}`),d=d.split("?")[0],i=parseInt(d)),e.landing_page_click_tracker_url=t+n.substring(0,o)+`${r}${encodeURIComponent(a)}${c}`+n.substring(s)}else console.error(`missing destination_url: ${n}`),e.landing_page_click_tracker_url=`${t}${n}${c}`;i||(i=function(e){let t=(0,l.eY)(e.landing_page_url,"variant");if(t=t&&t.split("?")[0],t)return parseInt(t);if(e.variant_id){const t=e.variant_id.split("/");return parseInt(t[t.length-1])}return 0}(e));const s=e.landing_page_url.indexOf("?");return s>=0&&(e.landing_page_url=e.landing_page_url.substring(0,s)),i}(e,t),n=`${e.landing_page_url}.js`;this.mainImage.src=this.makeSizedImageUrl(e.product_image_url),this.mainImage.onerror=()=>this.onImageError(),this.mainImage.onload=()=>{this.mainImage.onload=this.mainImage.onerror=null},this.mainImage.style.position="relative",this.mainImage.style.opacity="1",this.label.innerText=e.title,this.label.ariaHidden="true",this.setRatings(e),this.pixel.src=t+e.impression_tracker_url,yield this.setFromShopifyAPI(n,i)}))}setTags(){this.recoData.label&&this.productRec.showCustomLabel&&this.createTag(this.recoData.label,"jml-tags_label");for(const e of this.productData.tags)this.createTag(e)}createTag(e,t=""){const i=e.replace(/[^0-9a-zA-Z]/g,"-");if(!t&&!(0,a.BL)(i,this.productRec.tagFilters))return;this.tagBox||(this.tagBox=(0,a.Mq)(this.imageBox,"div","tag_box"));const n=t?`${t} tag-${i}`:`jml-tag tag-${i}`;(0,a.Mq)(this.tagBox,"div",n).innerText=e}setPrice(e,t,i){const n=this.formatOnePrice(e),r=i?" from ":" ";if(t&&t>e){const e=this.formatOnePrice(t);this.price.innerHTML=` Regular Price ${e} Sale Price ${r}${n}`}else this.price.innerHTML=i?` Sale Price ${r}${n}`:` Regular Price ${n}`}formatOnePrice(e){const t=this.productRec.jarvisRecoApi.jmlUtilities;if(this.recoData.bulk_quantity>1){const i=t.computeUnitPrice(e,this.recoData.bulk_quantity);return`${t.formatPrice(e)} / ${t.formatPrice(i)} ea`}return t.formatPrice(e)}showPrice(e){const t=this.currentVariantId?this.productData.variants.filter((e=>e.id===this.currentVariantId))[0]:null;if(e){const e=this.groupedVariants[t.selected_option];this.setPrice(e.priceMin/ee,e.compareAtPrice/ee,e.priceVaries)}else if(t)if(t.compare_at_price)this.setPrice(t.price/ee,t.compare_at_price/ee,!1);else{const e=this.productData;this.setPrice(e.price/ee,null,e.price_varies)}else{const e=this.productData;this.setPrice(e.price/ee,e.compare_at_price/ee,e.price_varies)}}setRatings(e){if(!this.productRec.showRatings||!e.review_data)return;const t=e.review_data;if(t.average_rating&&t.number_of_votes){this.rating.innerHTML+=Y;const e=t.average_rating,i=t.number_of_votes,n=(0,a.Mq)(this.rating,"span","product_stars");n.role="img",n.ariaLabel=`Rating is ${parseFloat(e.toFixed(1))} out of 5`;const r=Math.floor(e),o=.5*Math.round((e-r)/.5),s="12",l="12";for(let e=1;e<=5;e++){const t=document.createElementNS(W,"svg");v(t,{class:"rating_star",width:s,height:l,viewBox:`0 0 ${s} ${l}`});const i=document.createElementNS(W,"use");i.setAttributeNS("http://www.w3.org/1999/xlink","href","#star"),e<=r&&t.classList.add("active"),e===r+1&&1===o?t.classList.add("active"):e===r+1&&.5===o&&i.setAttribute("fill","url(#half)"),t.appendChild(i),n.appendChild(t)}this.rating.innerHTML+=` ${i} total reviewsReviews`}}onImageError(){this.mainImage.onload=this.mainImage.onerror=null,this.mainImage.src=X}gotoVariant(){location.href=f(this.recoData,this.currentVariantId)}setImage(e,t){if(t){if(this.images[e])this.images[e].src=this.makeSizedImageUrl(t),this.images[e].srcset=d(t),this.images[e].sizes="(min-width: 769px) 25vw, 39vw";else{const i=(0,a.Mq)(this.imageBox,"img","product_img",{loading:"lazy"});i.src=this.makeSizedImageUrl(t),i.srcset=d(t),i.sizes="(min-width: 769px) 25vw, 39vw",i.draggable=!1,this.images[e]=i}this.images[e].alt=`${this.productData.title} ${e}`}}makeSizedImageUrl(e){return function(e,t){const i=e.lastIndexOf(".");if(i<0)return e;const n=e.substring(i+1);if(!/^[a-zA-Z]{3,4}(\?v=[0-9]+)?$/.exec(n))return e;let r=e.substring(0,i);const o=r.lastIndexOf("_");return o>=0&&/^[0-9]*x[0-9]*$/.exec(r.substring(o+1))&&(r=r.substring(0,o)),`${r}_400x400.${n}`}(e)}setSwatch(e,t,i,n){if(!this.swatchBox)return;const r=(0,a.Mq)(this.swatchBox,"div","swatch_button");n&&(r.setAttribute("isunavailable","true"),(0,a.Mq)(r,"div","swatch_button_unavailable_ext"),(0,a.Mq)(r,"div","swatch_button_unavailable")),this.swatches[e]=r,function(e,t,i,n){const r=e;r._product=t,r._swatchName=i,r._variantId=n,e.addEventListener("click",V),e.addEventListener("mouseenter",H),e.addEventListener("mouseleave",Q)}(r,this,e,i);let o="swatch_button_img";"small-image"===this.productRec.swatchImageType||e===B?o+=" small_image":"image-spot"===this.productRec.swatchImageType&&(o+=" image_spot");const s=(0,a.Mq)(r,"img",o,{loading:"lazy"});s.src=t,s.draggable=!1,s.alt=e,s.ariaLabel=e,s.role="option",s.onerror=()=>this.handleMissingColor(s,e),s.onload=()=>{s.onload=s.onerror=null}}handleMissingColor(e,t){e.onerror=e.onload=null,e.classList.add("color_only"),e.src=X;for(const i of t.split("-"))if(CSS.supports("color",i)){e.style.backgroundColor=i;break}}setFromShopifyAPI(e,t){return G(this,void 0,void 0,(function*(){try{const i=yield fetch(e),n=yield i.json();this.productData=n,this.groupedVariants=function(e,t){var i;const n=null===(i=e.options.find((e=>"color"===e.name.toLowerCase())))||void 0===i?void 0:i.position,r=n&&n>=1&&n<=3?`option${n}`:"",o={};for(const i of e.variants){if(i.selected_option=r&&i[r]||"",!i.available&&t)continue;i.featured_image||(i.featured_image={src:e.images[0]});const n=i.selected_option;o[n]?o[n].variants.push(i):o[n]={variants:[i]}}return function(e){const t=Number.MAX_SAFE_INTEGER,i=e=>e===t?null:e;for(const n of Object.values(e)){let e=!1,r=null,o=t,s=0,a=t,l=t,c=0,d=t;for(const i of n.variants)i.available?(e=!0,r=r||i,o=Math.min(o,i.price),s=Math.max(s,i.price),a=Math.min(a,i.compare_at_price||t)):(l=Math.min(l,i.price),c=Math.max(c,i.price),d=Math.min(d,i.compare_at_price||t));n.available=e,n.featuredVariant=e?r:n.variants[0],o=i(Math.min(o,l)),s=Math.max(s,c),n.priceMin=o,n.priceVaries=oe.id===i))[0]),!n){const t=e.images[0];n=e.variants.filter((e=>{var i,n,r;return n=null===(i=e.featured_image)||void 0===i?void 0:i.src,r=t,h(n)===h(r)}))[0]}if(!n)return null;if(!n.available){const e=t[n.selected_option];(null==e?void 0:e.available)&&(n=e.featuredVariant)}return n}(n,this.groupedVariants,t);this.setMainAndAltImage(r),this.showPrice(!1),this.swatchBox&&this.setSwatchesFromVariants(),this.setTags(),n.vendor&&this.productRec.showVendor&&(this.vendor.innerText=n.vendor)}catch(e){console.error(e),this.productRec.hideBrokenProduct(this)}}))}setMainAndAltImage(e){var t;const i=this.productData.images[0];this.setImage(T,(null===(t=null==e?void 0:e.featured_image)||void 0===t?void 0:t.src)||i),this.mainImgVariantId=(null==e?void 0:e.id)||0,this.currentVariantId=this.mainImgVariantId,this.productLink.setAttribute("href",f(this.recoData,this.currentVariantId)),this.productLink.setAttribute("aria-labelledby",`${this.productData.handle}_selected`),this.productLink.title=this.productData.title,this.productRec.showAltImage&&this.productData.images[1]&&(this.setImage(B,this.productData.images[1]),this.setSwatch(B,this.productData.images[1],this.mainImgVariantId,!1)),this.mainImage.alt=`${this.productData.title} ${(null==e?void 0:e.selected_option)||""}`,this.mainImage.id=`${this.productData.handle}_selected`}setSwatchesFromVariants(){for(const e of function(e,t,i){const n=[];for(const[r,o]of Object.entries(e)){if(""===r)continue;if(!o.available&&i)continue;const e=o.featuredVariant,s=e.selected_option.toLowerCase().replace(/["'(){}[\]]/g,"").replace(/ /g,"-").normalize("NFKD").replace(/\p{Diacritic}/gu,"").replace(/[^-_.a-z0-9]+/g,"_").replace(/^[-_]+/,"").replace(/[-_]+$/,""),a=e.featured_image.src;let l;switch(t){case"option-icon":l=u(a,s);break;case"image-spot":l=a;break;default:l=p(a,100,100)}n.push({variant:e,imageName:s,imageUrl:a,iconUrl:l,available:o.available})}return n}(this.groupedVariants,this.productRec.swatchImageType,this.productRec.hideUnavailableSwatches))this.setImage(e.imageName,e.imageUrl),this.setSwatch(e.imageName,e.iconUrl,e.variant.id,!e.available)}showSwatch(e){e!==this.currentSwatch&&this.swatches[e]&&this.showImage(e,!0)}showImage(e,t=!1){e!==this.currentImage&&this.images[e]&&(this.images[this.currentImage].style.opacity="0",this.images[this.currentImage].removeAttribute("id"),this.images[e].style.opacity="1",this.currentImage=e,this.currentSwatch&&(this.swatches[this.currentSwatch].classList.remove("selected"),this.currentSwatch=""),t?(this.swatches[e].classList.add("selected"),this.currentSwatch=e,this.images[this.currentSwatch].id=`${this.productData.handle}_selected`,this.productLink.setAttribute("href",f(this.recoData,this.currentVariantId))):(this.currentVariantId=this.mainImgVariantId,this.mainImage.id=`${this.productData.handle}_selected`,this.productLink.setAttribute("href",f(this.recoData,this.currentVariantId))),this.showPrice(t))}}class re{constructor(e){this.scriptParams=e,this.initialized=!1,this.waitRecoCallbacks=[],this.waitSearchCallbacks=[],this.backendApiUrl="",this.setApiUrl()}setApiUrl(){this.backendApiUrl="https://api2.jarvisml.com/"}waitForSdkRecos(){return this.ProductRec=ie,new Promise((e=>{this.personalizedRecos?e(this.personalizedRecos):this.waitRecoCallbacks.push(e)}))}waitForSdkSearch(){return new Promise((e=>{this.personalizedSearch?e(this.personalizedSearch):this.waitSearchCallbacks.push(e)}))}initPersonalizedReco(e,t,i){const r=new n.tF(this,e);if(this.personalizedRecos=r,t)this.initPersonalizedRecommendations=()=>{this.recommendations||r.loadRecommendations(this.collectedIds)};else if(this.waitRecoCallbacks.length)for(;this.waitRecoCallbacks.length;)this.waitRecoCallbacks.pop()(r);else i&&r.loadRecommendations(this.collectedIds)}initPersonalizedSearch(e){this.searchFilters={soft_filters:[],hard_filters:[],filter_dict:{}},this.filtering=new o.h;const t=new r.S(this,e);for(this.personalizedSearch=t,this.triggerFilteredResults=t.triggerFilteredResults,t.initPersonalizedSearch();this.waitSearchCallbacks.length;)this.waitSearchCallbacks.pop()(t)}addEvents(){const e=document.getElementsByClassName("jarvis-item-link");if(e&&e.length){let t=0,i=0;const n=e.length/this.recommendations.length;for(const r of e){const e=document.createAttribute("recommendationSlot");e.value=String(t),r.setAttributeNode(e),r.addEventListener("click",(e=>{const t=e.target;if(this.eventListener&&t.href){const i=t.href.split("&destination_url=")[1],n=t.attributes.recommendationslot.value;this.eventListener(e,{slot:n,destinationUrl:decodeURIComponent(i),recommendation:this.recommendations[n]})}})),i++,i===n&&(i=0,t++)}}}getCollectedIds(e){this.collectedIds?e(this.filterCollectedIds(this.collectedIds)):this.collectedIdsCallback=e}_sendDelayedCollectedIds(){this.collectedIdsCallback&&this.collectedIdsCallback(this.filterCollectedIds(this.collectedIds))}registerForEvents(e){this.eventListener=e}filterCollectedIds(e){const t={};return e.googleAnalyticsId&&(t.ga_id=e.googleAnalyticsId),e.jarvisPixelId&&(t.visit_id=e.jarvisPixelId),t}}},63:(e,t,i)=>{i.d(t,{Gu:()=>g,RL:()=>m});var n=i(717),r=i(625),o=i(259),s=i(575),a=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};let l,c,d=o.R;function u(){const e=document.getElementsByClassName("jarvis-info-form");if(e&&e.length){const t=(e,t)=>a(this,void 0,void 0,(function*(){var i;const n=t.querySelector("input[type='email']");n&&n.value&&(e.preventDefault(),yield c.idCollection.sendUserEnquiryFormData({email:n.value,formType:(null===(i=t.dataset)||void 0===i?void 0:i.formType)||"user-enquiry-form"}).finally((()=>{var e;"FORM"===t.tagName&&(null===(e=t.dataset)||void 0===e?void 0:e.redirectAfterSubmit)&&t.submit()})))}));for(const i of e)if("FORM"===i.tagName)i.addEventListener("submit",(e=>a(this,void 0,void 0,(function*(){t(e,i)}))));else{const e=i.querySelector("input[type='submit']");e&&e.addEventListener("click",(e=>a(this,void 0,void 0,(function*(){t(e,i)}))))}}}function p(e,t){return a(this,void 0,void 0,(function*(){if(e.initialized)return;if(e.initialized=!0,window.JarvisMlSdk){const i=window.JarvisMlSdk;return void(i.delayedInitCalls?i.delayedInitCalls.push((()=>{h(e,t)})):h(e,t))}window.JarvisMlSdk=e,window.JarvisML=e,e.delayedInitCalls=[];const i=new d(e),n=yield i.collectIds();for(e.idCollection=i,e.collectedIds=n,e.sendCustomData=e=>i.sendCustomData(e),e.sendShopifyAddToCartEvent=()=>i.sendShopifyAddToCartEvent();e.delayedInitCalls.length;)e.delayedInitCalls.pop()();e.delayedInitCalls=null,h(e,t),i.sendIdData(),function(e){new MutationObserver((function(){const t=`${window.location.hostname}${window.location.pathname}`;if(l){if(t!==l&&(l=t,e.idCollection.readIdData(),e.idCollection.sendIdData(),!(0,s.Ky)())){const t=new r.PW(e);e.initPersonalizedReco(t,!1,!0)}}else l=t})).observe(document,{subtree:!0,childList:!0})}(e),u()}))}function h(e,t){const i=window.JarvisMlSdk,n=e===i;n||(e.idCollection=i.idCollection,e.collectedIds=i.collectedIds,e.sendCustomData=i.sendCustomData,e.sendShopifyAddToCartEvent=i.sendShopifyAddToCartEvent),e.useBaseCss=Boolean(e.scriptParams.useBaseCss);const o=new r.PW(e);e.initPersonalizedReco(o,t,n),e.initPersonalizedSearch(o),e._sendDelayedCollectedIds()}function m(){const e={};if(document.currentScript&&document.currentScript.src){const t=new URL(document.currentScript.src);e.initManually=t.searchParams.get("init_manually"),e.onLoad=t.searchParams.get("onload"),e.useBaseCss=t.searchParams.get("use_base_css"),e.customerId=t.searchParams.get("customer_id"),e.vertical=t.searchParams.get("vertical"),e.debugSource=t.searchParams.get("debug_source"),e.debugShopifyDomain=t.searchParams.get("debug_shopify_domain"),e.debugExperimentId=t.searchParams.get("debug_experiment_id")}return c=new n.U(e),e.initManually?window.initializeJarvisMLSdk=e=>{p(c,e)}:e.onLoad||["complete","loaded","interactive"].indexOf(document.readyState)>=0?p(c,!1):document.addEventListener("DOMContentLoaded",(()=>{p(c,!1)})),c}function g(){return c.waitForSdkRecos()}},128:(e,t,i)=>{i.d(t,{U:()=>l,w:()=>a});var n=i(625),r=i(660),o=i(25),s=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};function a(e){const t=e.baseUrl,i=e.collectedIds,n=i.shopifyPageType?null:e.pageType||i.pageType||"search",o=e.searchQuery||"";let s=`${t}dynamic_search/display_json?source=${i.source}`;return"ecommerce"===e.collectedIds.vertical&&(s=`${t}dynamic_search/ecommerce/display_json?source=${i.source}`),s=(0,r.a3)(s,"ga_id",i.googleAnalyticsId),s=(0,r.a3)(s,"shopify_cid",i.shopifyId),s=(0,r.a3)(s,"shopify_domain",i.shopifyDomain),s=(0,r.a3)(s,"shopify_page_type",i.shopifyPageType),s=(0,r.a3)(s,"shopify_product_id",i.shopifyProductId),s=(0,r.a3)(s,"page_type",n),s=(0,r.a3)(s,"customer_id",i.customerId),s=(0,r.a3)(s,"jarvis_cid",i.jarvisClientId),s=(0,r.a3)(s,"visit_id",i.jarvisPixelId),s=(0,r.a3)(s,"consent",i.jarvisConsentOpt),s=(0,r.a3)(s,"query",o),s=(0,r.a3)(s,"search_params",encodeURIComponent(JSON.stringify({filter_dict:{Aidaptive_Availability:"In-Stock"}}))),s}class l{constructor(e,t){this.apiRoot=e,this.searchFilterSection=t}initializeDefaultFilters(){this.renderDefaultFilterSection(),this.fetchFiltersData()}addEventsInFilters(e){const{filtering:t}=this.apiRoot,i=e.querySelectorAll(".decrement-icon"),n=e.querySelectorAll(".increment-icon");i.forEach((e=>{e.onclick=()=>{const i=e.parentNode.querySelector("input[type='number']");i.value=t.updateCount(parseInt(i.value),!1)}})),n.forEach((e=>{e.onclick=()=>{const i=e.parentNode.querySelector("input[type='number']");i.value=t.updateCount(parseInt(i.value),!0)}})),this.handleAdditionalFiltersEvents()}handleAdditionalFiltersEvents(){const e=document.querySelector(".jml-modal"),t=document.querySelector(".jml-overlay"),i=document.querySelector(".jml-filter-btn"),n=document.querySelector(".jml-modal-close");i.addEventListener("click",(()=>{e.classList.remove("jml-hidden"),t.classList.remove("jml-hidden")})),n.addEventListener("click",(()=>{e.classList.add("jml-hidden"),t.classList.add("jml-hidden")}))}renderDefaultFilterSection(){return s(this,void 0,void 0,(function*(){const e=this.searchFilterSection,t=`${e.calendarSection} ${e.filterAndModalSection} ${e.searchBtn} ${e.sortField} `;document.getElementById("jarvis-default-filters").innerHTML=t;const i=document.getElementById("jarvis-default-filters");(yield(0,o.X)("default-filters",(()=>!!i),5e3))&&(this.addEventsInFilters(i),document.getElementById("jarvis-default-search-filters-form").addEventListener("submit",(e=>this.onJarvisDefaultFormSubmit(e))))}))}fetchFiltersData(){return s(this,void 0,void 0,(function*(){const e=a({baseUrl:this.apiRoot.backendApiUrl,collectedIds:this.apiRoot.collectedIds}),t=yield fetch(e).catch((e=>(0,n.Qm)(`fetchSearchFilters error: ${e.message}`,"personalized_search"))),i=t?yield t.json():{};this.renderSortSelector(i),this.renderAdditionalFilters(i)}))}renderSortSelector(e){const t=document.querySelector(".jml-search-options.jml-default-sort-container");if(!t)return;if(t&&!e.sort_options)return void(t.style.display="none");const i=document.createElement("select");i.id="jml-sort-select-box",i.name="sort",i.onchange=e=>this.onJarvisDefaultFormSubmit(e),this.renderSortOptions(i,e),t.appendChild(i)}renderSortOptions(e,t){return t.sort_options.forEach((i=>{const n=document.createElement("option");n.value=i.sort_field,n.text=i.sort_label,n.selected=i.sort_field===t.default_sort_option.sort_field,e.appendChild(n)})),e}renderAdditionalFilters(e){const t=document.querySelector(".jml-search-options .jml-default-filter-modal"),i=document.querySelector(".jml-filter-btn"),n=t.querySelector(".jml-modal-options");i&&t&&(!t||e.filter_display?e.filter_display.filter_options.forEach((e=>{switch(e.filter_type){case"range":{const i=this.createRangeFilters(e);i&&n.insertAdjacentHTML("beforeend",i),this.addEventsInFilters(t);break}case"checkbox":{const t=this.createSelectOptionsFilters(e);t&&n.insertAdjacentHTML("beforeend",t),this.addUncheckEventOnFilters(n);break}default:console.log("Unknown input field type:",e.filter_type)}})):i.style.display="none")}addUncheckEventOnFilters(e){e.querySelectorAll('input[type="checkbox"]').forEach((e=>{e.addEventListener("change",(e=>this.removeFiltersOnUncheck(e)))}))}removeFiltersOnUncheck(e){const t=e.target,i=t.name,n=t.value,r=window.JarvisML.filtering;t.checked||("(Various)"===i?r.removeFilter(n):r.removeFilter(i,n))}createSelectOptionsFilters(e){if(!e.options||e.options.length<1)return null;let t=this.searchFilterSection.selectFilterOuterSection;t=t.replaceAll("%label%",e.label);let i="";return e.options.forEach((t=>{let n=this.searchFilterSection.selectFilterSection;n=n.replaceAll("%filter_field%","(Various)"===e.filter_field?e.filter_field:t.filter_name),n=n.replaceAll("%filter_value%","(Various)"===e.filter_field?t.filter_name:t.filter_value),n=n.replaceAll("%filter_label%",t.filter_label),i+=n})),t=t.replaceAll("%select_options%",i),t}createRangeFilters(e){let t=this.searchFilterSection.rangeFilterSection;return t=t.replaceAll("%label%",e.label),t=t.replaceAll("%filter_field%",e.filter_field),t=t.replaceAll("%min_value%",e.min_value),t=t.replaceAll("%max_value%",e.max_value),t}onJarvisDefaultFormSubmit(e){e.preventDefault();const t=document.getElementById("jarvis-default-search-filters-form"),i=new FormData(t),n=window.JarvisML.filtering;let r,o,s,a;for(const[e,t]of i.entries())"sort"===e?n.setSortBy(t,!0):"bedrooms"===e?n.setBedrooms(t):"sleeps"===e?n.setSleeps(t):"bathrooms"===e?n.setBathrooms(t):"arrival"===e?r=t:"departure"===e?o=t:"arrival-mobile"===e?s=t:"departure-mobile"===e?a=t:"(Various)"===e?n.setFilter(t,!0):n.setFilter(e,i.getAll(e));r=r||s,o=o||a,r&&o&&n.setDate(r,o),this.apiRoot.triggerFilteredResults(),document.querySelectorAll(".jml-modal.jml-default-filter-modal, .jml-overlay").forEach((e=>{e.classList.contains("jml-hidden")||e.classList.add("jml-hidden")}))}}},259:(e,t,i)=>{i.d(t,{R:()=>d});var n=i(625),r=i(25),o=i(593),s=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const a=/[^a-zA-Z]shopify[^a-zA-Z]/,l="jml-cart-products",c="jml-cart-variants";class d{constructor(e){this.cartItems=[],this.apiRoot=e,e.collectedIds?(console.error("Unexpected error"),this.collectedIds=e.collectedIds,this.googleAnalyticsId=e.collectedIds.googleAnalyticsId,this.jarvisPixelId=e.collectedIds.jarvisPixelId):this.collectedIds={}}fetchGoogleAnalyticsId(e,t=0){var i;if(null===(i=window.gaGlobal)||void 0===i?void 0:i.vid)e(window.gaGlobal.vid);else if("function"==typeof window.ga)this.callGoogleAnalyticsGetClientId(e);else{const i=[0,5,20,60][t];void 0!==i?setTimeout((()=>this.fetchGoogleAnalyticsId(e,t+1)),i):e(void 0)}}callGoogleAnalyticsGetClientId(e){let t=!0;window.ga((()=>{var i;if(!t)return;t=!1;const n=window.ga.getAll();e(null===(i=null==n?void 0:n[0])||void 0===i?void 0:i.get("clientId"))})),t&&setTimeout((()=>{t&&(t=!1,e(void 0))}),100)}readIdData(){var e,t,i,n,r,s,a,d,u,p,h,m,g,f,v;const y=this.apiRoot.scriptParams;this.entryPoint=o.pv[this.vertical],this.sdkVersion="2024.4.26.22",this.sdkPlatform="web",window.location&&window.location.hostname&&(this.hostname=window.location.hostname.replace("www.","")),window.location&&window.location.pathname&&(this.source=`${this.hostname}${window.location.pathname}`),window.location.search&&(this.source=`${this.source}${window.location.search}`),window.location&&window.location.origin&&(this.origin=`${window.location.origin}`),window.location&&window.location.search?this.fullUrl=`${this.source}${window.location.search}`:window.location&&window.location.href&&!window.location.search&&(this.fullUrl=window.location.href);const _=document.cookie.split(";");for(const e of _)if(e.indexOf(" _ga=")>-1&&!this.googleAnalyticsId){const t=e.split(".");t.shift(),t.shift(),this.googleAnalyticsId=t.join(".")}else if(e.indexOf("_jarvis_cid=")>-1){const t=e.split("_jarvis_cid=");t.shift(),t.length>0&&(this.jarvisClientId=t[0],(0,o.t8)(this.jarvisClientId))}else if(e.indexOf("__kla_id=")>-1){const t=e.split("__kla_id=");if(t.shift(),t.length>0){const e=atob(t[0]),i=JSON.parse(e);i&&i.$exchange_id&&(this.klaviyoExchangeId=i.$exchange_id)}}else if(e.indexOf("hubspotutk=")>-1){const t=e.split("hubspotutk=");t.shift(),t.length>0&&(this.hubspotUserToken=t[0])}if(this.jarvisClientId||(this.jarvisClientId=(0,o.j)(),(0,o.t8)(this.jarvisClientId)),"hospitality"!==this.vertical&&"marine"!==this.vertical||!y.customerId||(this.customerId=y.customerId),"wc"===this.vertical||"ecommerce"===this.vertical&&window.wpmDataLayer){this.pageType=null===(t=null===(e=window.wpmDataLayer)||void 0===e?void 0:e.shop)||void 0===t?void 0:t.page_type,this.productId=Object.keys((null===(i=window.wpmDataLayer)||void 0===i?void 0:i.products)||{})[0]||null;const o=null===(s=null===(r=null===(n=window.wpmDataLayer)||void 0===n?void 0:n.user)||void 0===r?void 0:r.id)||void 0===s?void 0:s.raw;this.personId=o?String(o):null}else if("ecommerce"===this.vertical&&window.woocommerce_params&&!window.wpmDataLayer){const e=document.querySelectorAll("link[rel='alternate'][type='application/json']");if(e&&e.length){const t=e[0].href;if(t.indexOf("/product/")>-1){this.pageType="product";const e=t.split("/product/");e&&2==e.length&&(this.productId=e[1])}}}if("ecommerce"===this.vertical&&(window.bcContext||window.BCData))if(window.bcContext)this.productId=null===(d=null===(a=window.bcContext)||void 0===a?void 0:a.product)||void 0===d?void 0:d.id,this.customerId=null===(p=null===(u=window.bcContext)||void 0===u?void 0:u.customer)||void 0===p?void 0:p.id;else if(!window.bcContext&&window.BCData){const e=document.querySelector('input[name="product_id"]');if(e){this.productId=e.getAttribute("value");const t=document.getElementById("form-action-addToCart");t&&t.addEventListener("click",(()=>{this.sendBigCommerceAddToCartEvent(this.productId)}));const i=document.querySelector(".orderConfirmation-section strong");i&&i.innerHTML&&(this.orderId=i.innerHTML)}}if(this.source.indexOf("denisonyachtsales.com")>-1){const e=this.source.split("/");for(let t=e.length-1;t>=0;t--)if(!isNaN(Number(e[t]))){this.productId=e[t];break}if(!this.productId){const e=document.querySelector('input[id="api-id"]');e&&(this.productId=e.getAttribute("value"))}}window.__st&&window.__st.cid&&(this.shopifyId=window.__st.cid),window.Shopify&&window.Shopify.shop&&(this.shopifyDomain=window.Shopify.shop),window.Shopify&&window.Shopify.Checkout&&window.Shopify.Checkout.apiHost&&!window.Shopify.shop&&(this.shopifyDomain=window.Shopify.Checkout.apiHost);const b=null===(m=null===(h=window.ShopifyAnalytics)||void 0===h?void 0:h.meta)||void 0===m?void 0:m.page;if(b&&(b.pageType?this.shopifyPageType=b.pageType:"cart_page"===(null===(g=window.Shopify)||void 0===g?void 0:g.CartType)?this.shopifyPageType="cart":"thank_you"===(null===(v=null===(f=window.Shopify)||void 0===f?void 0:f.Checkout)||void 0===v?void 0:v.page)&&(this.shopifyPageType="thankyou")),window.Shopify&&window.Shopify.checkout&&window.Shopify.checkout.order_id&&(this.shopifyOrderId=window.Shopify.checkout.order_id),window.wpmDataLayer){const e=document.querySelector(".woocommerce-order-overview__order order strong");e&&e.innerHTML&&(this.orderId=e.innerHTML)}if(this.source.indexOf("microminimus.com/checkout/order-received")>-1){const e=this.source.split("/");e.pop();const t=e.pop();t&&!isNaN(parseInt(t))&&(this.orderId=t)}if(window.ShopifyAnalytics&&window.ShopifyAnalytics.meta&&window.ShopifyAnalytics.meta.product){this.shopifyProductId=window.ShopifyAnalytics.meta.product.id,window.ShopifyAnalytics.meta.selectedVariantId&&(this.shopifyVariantId=window.ShopifyAnalytics.meta.selectedVariantId);const e=document.querySelectorAll("button[type=submit]");for(const t of e)t&&t.getAttribute("class")&&(t.getAttribute("class").indexOf("add-to-cart")>-1||t.getAttribute("class").indexOf("addtocart")>-1||t.getAttribute("class").indexOf("product-form__cart-submit")>-1||t.getAttribute("class").indexOf("atc-button")>-1)&&t.addEventListener("click",(()=>{this.sendShopifyAddToCartEvent()}))}const w=y.debugSource||"",S=y.debugShopifyDomain||"",I=y.debugExperimentId||"";w&&(this.source=w,this.hostname=w,this.fullUrl=w),S&&(this.shopifyDomain=S),I&&(this.experimentId=I),this.collectedIds.googleAnalyticsId=this.googleAnalyticsId,this.collectedIds.personId=this.personId,this.collectedIds.shopifyId=this.shopifyId,this.collectedIds.jarvisClientId=this.jarvisClientId,this.collectedIds.hubspotUserToken=this.hubspotUserToken,this.collectedIds.klaviyoExchangeId=this.klaviyoExchangeId,this.collectedIds.customerId=this.customerId,this.collectedIds.entryPoint=this.entryPoint,this.collectedIds.vertical=this.vertical,this.collectedIds.source=this.source,this.collectedIds.origin=this.origin,this.collectedIds.hostname=this.hostname,this.collectedIds.fullUrl=this.fullUrl,this.collectedIds.pageType=this.pageType,this.collectedIds.productId=this.productId,this.collectedIds.shopifyDomain=this.shopifyDomain,this.collectedIds.shopifyPageType=this.shopifyPageType,this.collectedIds.shopifyProductId=this.shopifyProductId,this.collectedIds.shopifyOrderId=this.shopifyOrderId,this.collectedIds.orderId=this.orderId,this.collectedIds.shopifyVariantId=this.shopifyVariantId,this.collectedIds.sdkVersion=this.sdkVersion,this.collectedIds.sdkPlatform=this.sdkPlatform,this.collectedIds.jarvisConsentOpt=this.jarvisConsentOpt,this.collectedIds.cartProductsAsUrl=localStorage.getItem(l),this.collectedIds.cartVariantsAsUrl=localStorage.getItem(c),this.collectedIds.experimentId=this.experimentId}sendIdData(){const e=this.collectedIds;let t=`&source=${e.source}`;const i={source:e.source,type:"jarvis_id_collection"};return e.sdkVersion&&(i.sdk_version=e.sdkVersion),e.sdkPlatform&&(i.sdk_platform=e.sdkPlatform),e.fullUrl&&(i.full_url=e.fullUrl),e.jarvisPixelId&&(t=`${t}&visit_id=${e.jarvisPixelId}`,i.visit_id=e.jarvisPixelId),e.googleAnalyticsId&&(t=`${t}&ga_id=${e.googleAnalyticsId}`,i.ga_id=e.googleAnalyticsId),e.jarvisClientId&&(i.jarvis_cid=e.jarvisClientId),e.shopifyId&&(t=`${t}&shopify_cid=${e.shopifyId}`,i.shopify_cid=e.shopifyId),e.shopifyDomain&&(t=`${t}&shopify_domain=${e.shopifyDomain}`,i.shopify_domain=e.shopifyDomain),e.shopifyPageType&&(t=`${t}&shopify_page_type=${e.shopifyPageType}`,i.shopify_page_type=e.shopifyPageType),e.shopifyProductId&&(t=`${t}&shopify_product_id=${e.shopifyProductId}`,i.shopify_product_id=e.shopifyProductId),e.productId&&(t=`${t}&product_id=${e.productId}`,i.product_id=e.productId),e.shopifyOrderId&&(t=`${t}&shopify_order_id=${e.shopifyOrderId}`,i.shopify_order_id=e.shopifyOrderId),e.orderId&&(t=`${t}&order_id=${e.orderId}`,i.order_id=e.orderId),e.shopifyVariantId&&(t=`${t}&shopify_variant_id=${e.shopifyVariantId}`,i.shopify_variant_id=e.shopifyVariantId),e.customerId&&(t=`${t}&customer_id=${e.customerId}`,i.customer_id=e.customerId),e.hubspotUserToken&&(i.hubspot_user_token=e.hubspotUserToken),e.klaviyoExchangeId&&(i.klaviyo_exchange_id=e.klaviyoExchangeId),e.experimentId&&(i.experiment_id=e.experimentId),this.sendDataToBackend("jarvis_id_collection",t,i)}sendCustomData(e){if(!e||!this.apiRoot.collectedIds)return;let t="";const i=this.apiRoot.collectedIds,n={type:"custom_data_collection"};i&&i.jarvisPixelId&&(t=`${t}&visit_id=${i.jarvisPixelId}`,n.visit_id=i.jarvisPixelId),i&&i.shopifyDomain&&(t=`${t}&shopify_domain=${i.shopifyDomain}`,n.shopify_domain=i.shopifyDomain);for(const[i,r]of Object.entries(e))t=`${t}&${i}=${r}`,n[i]=r;return this.sendDataToBackend("custom_data_collection",t,n)}sendShopifyAddToCartEvent(){var e;if(!window.Shopify||!this.apiRoot.collectedIds)return;let t="";const i=this.apiRoot.collectedIds,n={type:"add_to_cart_event"};i.jarvisPixelId&&(t=`${t}&visit_id=${i.jarvisPixelId}`,n.visit_id=i.jarvisPixelId),i.shopifyDomain&&(t=`${t}&shopify_domain=${i.shopifyDomain}`,n.shopify_domain=i.shopifyDomain);const r=null===(e=window.ShopifyAnalytics)||void 0===e?void 0:e.meta;if(null==r?void 0:r.product){const e=r.product.id;if(t=`${t}&shopify_product_id=${e}`,n.shopify_product_id=e,r.selectedVariantId){const e=r.selectedVariantId;t=`${t}&shopify_variant_id=${e}`,n.shopify_variant_id=e}this.addItemToCart(r.product.id,r.selectedVariantId)}return this.sendDataToBackend("add_to_cart_event",t,n)}sendBigCommerceAddToCartEvent(e){if(!window.BCData||!this.apiRoot.collectedIds||!e)return;const t=this.apiRoot.collectedIds,i=`&source=${t.source}&cart_item=${e}`,n=Object.assign({type:"add_to_cart_event",cart_item:e},t);return this.sendDataToBackend("add_to_cart_event",i,n)}sendUserEnquiryFormData(e){return s(this,void 0,void 0,(function*(){const t=this.apiRoot.collectedIds,i=`&source=${t.source}`,n=Object.assign(Object.assign({},t),{type:"user_enquiry_event",email:e.email,form_type:e.formType});return yield this.sendDataToBackend("user_enquiry_event",i,n)}))}sendDataToBackend(e,t,i){return s(this,void 0,void 0,(function*(){try{const n=`${this.apiRoot.backendApiUrl}pixel/record?type=${e}${t}`,r=yield fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}),o=yield r.json();this.processVisitIdResponse(o)}catch(t){(0,n.Qm)(`${e} error: ${t.message}`,e)}}))}processVisitIdResponse(e){(null==e?void 0:e.visit_id)?(this.jarvisPixelId!==e.visit_id&&(console.info("visit_id:",e.visit_id," previous:",this.jarvisPixelId),this.jarvisPixelId=e.visit_id),this.apiRoot.collectedIds&&this.jarvisPixelId!==this.apiRoot.collectedIds.jarvisPixelId&&(console.info("collected visit_id:",this.jarvisPixelId," previous:",this.apiRoot.collectedIds.jarvisPixelId),this.apiRoot.collectedIds.jarvisPixelId=this.jarvisPixelId)):console.error(`pixel/record: ${JSON.stringify(e)}`)}isShopify(){if(this.isECommerce())return!1;if(window.Shopify)return!0;if("shopify"===this.apiRoot.scriptParams.vertical)return!0;for(let e=0;ei.product_id===e&&i.variant_id===t)).length>0||(this.cartItems.push({product_id:e,variant_id:t,quantity:1,price:0}),this.cacheCartItems(this.cartItems))}cacheCartItems(e){var t;this.cartItems=e;const i=(null===(t=this.cartItems)||void 0===t?void 0:t.slice(0,5))||[];this.collectedIds.cartProductsAsUrl=this.idListAsUrl("cart_products",i.map((e=>e.product_id))),this.collectedIds.cartVariantsAsUrl=this.idListAsUrl("cart_variants",i.map((e=>e.variant_id))),localStorage.setItem(l,this.collectedIds.cartProductsAsUrl),localStorage.setItem(c,this.collectedIds.cartVariantsAsUrl)}idListAsUrl(e,t){return 0===t.length?"":t.map((e=>encodeURIComponent(e))).join(`&${e}=`)}fetchCartItems(){return s(this,void 0,void 0,(function*(){let e;switch(this.vertical){case"shopify":e=yield this.fetchShopifyCart();break;case"ecommerce":window.BCData?e=yield this.fetchBigCommerceCart():window.wpmDataLayer&&(e=yield this.fetchWooCommerceCart());break;default:e=[]}this.cacheCartItems(e)}))}fetchShopifyCart(){return s(this,void 0,void 0,(function*(){if(!this.origin)return[];try{const e=yield fetch(`${this.origin}/cart.js`),t=(yield e.json()).items||[],i=[];for(const e of t)e.product_id&&e.variant_id&&e.quantity&&e.final_price&&i.push({product_id:e.product_id,variant_id:e.variant_id,quantity:e.quantity,price:e.final_price});return i}catch(e){return(0,n.Qm)(`getShopifyCart: ${e.message}`,"id_collection"),[]}}))}fetchBigCommerceCart(){return s(this,void 0,void 0,(function*(){if(!this.origin)return[];try{const e=yield fetch(`${this.origin}/api/storefront/carts`),t=yield e.json(),i=[];for(const e of t){if(!e.lineItems||!e.lineItems.physicalItems)continue;const t=e.lineItems.physicalItems;for(const e of t)e.productId&&e.variantId&&e.quantity&&e.listPrice&&i.push({product_id:e.productId,variant_id:e.variantId,quantity:e.quantity,price:e.listPrice})}return i}catch(e){return(0,n.Qm)(`getBigCommerceCart: ${e.message}`,"id_collection"),[]}}))}fetchWooCommerceCart(){return s(this,void 0,void 0,(function*(){if(!window.wpmDataLayer.cart)return[];try{const e=[];for(const t in window.wpmDataLayer.cart){const i=window.wpmDataLayer.cart[t];i.id&&i.quantity&&i.price&&e.push({product_id:i.id,variant_id:i.variantId||"",quantity:i.quantity,price:i.price})}return e}catch(e){return(0,n.Qm)(`getWooCommerceCart: ${e.message}`,"id_collection"),[]}}))}collectIds(){return s(this,void 0,void 0,(function*(){const e=[];if(e.push(new Promise((e=>{this.fetchGoogleAnalyticsId((t=>{this.googleAnalyticsId=t,e()}))}))),this.isShopify()){if(this.vertical="shopify",!window.Shopify||!window.ShopifyAnalytics){const t=2e3;e.push((0,r.X)("Shopify",(()=>window.Shopify&&window.ShopifyAnalytics),t))}}else if(this.isWooCommerce())this.vertical="wc",window.wpmDataLayer||e.push((0,r.X)("WooCommerce",(()=>window.wpmDataLayer),1e4));else if(this.isMarine())this.vertical="marine";else if(this.isECommerce()){this.vertical="ecommerce";const t=window.location&&window.location.hostname&&window.location.hostname.indexOf("dell.com")>-1;window.wpmDataLayer&&window.bcContext&&window.BCData||t||e.push((0,r.X)("WooCommerce or Big Commerce",(()=>window.wpmDataLayer||window.bcContext||window.BCData),1e3))}else this.vertical="hospitality";return yield Promise.all(e),this.readIdData(),this.fetchCartItems(),this.collectedIds}))}}},625:(e,t,i)=>{i.d(t,{BL:()=>c,Ds:()=>m,Fz:()=>p,I_:()=>g,Mq:()=>d,PW:()=>a,Qm:()=>f,Vc:()=>h,Y_:()=>v,q2:()=>y,tq:()=>r});var n=i(25),r=r=window.screen.width<=768;const o={AED:{symbol:"AED"},AFN:{symbol:"؋"},ALL:{symbol:"L",decimalSeparator:",",groupSeparator:" "},AMD:{codePosition:"after"},ANG:{symbol:"ƒ",decimalSeparator:",",groupSeparator:" "},AOA:{symbol:"Kz",symbolPosition:"after",decimalSeparator:","},ARG:{symbol:"$",decimalSeparator:","},AUD:{symbol:"$",groupSeparator:" "},AWG:{symbol:"ƒ"},AZN:{symbol:"₼",decimalSeparator:","},BAN:{symbol:"KM",decimalSeparator:",",groupSeparator:" "},BBD:{symbol:"$"},BDT:{symbol:"৳"},BGN:{symbol:"лв",decimalSeparator:","},BHD:{decimalCount:3},BIF:{symbol:"FBu"},BMD:{symbol:"$"},BND:{symbol:"B$"},BOB:{symbol:"Bs",decimalSeparator:","},BRL:{symbol:"R$",decimalSeparator:","},BSD:{symbol:"B$"},BTN:{symbol:"Nu"},BWP:{symbol:"P"},BYN:{symbol:"Br",decimalSeparator:","},BZD:{symbol:"BZ$"},CAD:{symbol:"CA$",groupSeparator:","},CDF:{symbol:"FC"},CHF:{symbol:"CHF",groupSeparator:"'"},CLP:{symbol:"$",decimalSeparator:","},CNY:{symbol:"¥",groupSeparator:","},COP:{symbol:"$",decimalSeparator:","},CRC:{symbol:"₡",decimalSeparator:","},CUP:{symbol:"CUC$",decimalSeparator:","},CVE:{symbol:"CVE",decimalCount:0},CZK:{symbol:"Kč",groupSeparator:" "},DKK:{symbol:"kr",decimalSeparator:",",groupSeparator:" "},DJF:{symbol:"Fdj",decimalCount:0},DOP:{symbol:"RD$"},DZD:{symbol:"دج",decimalSeparator:","},EGP:{symbol:"E£"},ERN:{symbol:"Nkf"},ETB:{symbol:"Br"},EUR:{symbol:"€",decimalSeparator:",",groupSeparator:"."},FKP:{symbol:"FK£"},GBP:{symbol:"£"},GEL:{symbol:"₾",decimalSeparator:","},GHS:{symbol:"GH₵"},GMD:{symbol:"D"},GNF:{symbol:"FG",decimalCount:0},GTQ:{symbol:"Q"},GYD:{symbol:"G$"},HKD:{symbol:"HK$"},HNL:{symbol:"L"},HRK:{symbol:"kn",decimalSeparator:",",groupSeparator:" "},HTG:{symbol:"G"},HUF:{symbol:"ft",decimalSeparator:",",groupSeparator:" "},IDR:{symbol:"Rp",decimalCount:0,decimalSeparator:","},ILS:{symbol:"₪",groupSeparator:","},INR:{symbol:"₹",groupSeparator:","},IRR:{symbol:"﷼"},ISK:{symbol:"Íkr",decimalSeparator:","},IQD:{symbol:"ع.د",decimalCount:3},JMD:{symbol:"J$"},JOD:{symbol:"ينار",decimalCount:3},JPY:{symbol:"¥",decimalCount:0,groupSeparator:","},KES:{symbol:"KSh"},KGS:{symbol:"som",decimalSeparator:","},KHR:{symbol:"៛"},KMF:{symbol:"CF",decimalCount:0},KPW:{symbol:"₩"},KRW:{symbol:"₩",decimalCount:0,groupSeparator:","},KWD:{symbol:"ك",decimalCount:3},KYD:{symbol:"CI$"},KZT:{symbol:"₸",decimalSeparator:","},LAK:{symbol:"₭"},LBP:{symbol:"ل.ل",decimalSeparator:","},LKR:{symbol:"Rs"},LRD:{symbol:"LD$"},LSL:{symbol:"L"},LYD:{symbol:"LD",decimalCount:3},MAD:{symbol:"DH",decimalSeparator:","},MDL:{symbol:"L",decimalSeparator:","},MGA:{symbol:"AR"},MKD:{symbol:"ден"},MMK:{symbol:"K"},MNT:{symbol:"₮",decimalSeparator:","},MOP:{symbol:"MOP$"},MRU:{symbol:"UM"},MUR:{symbol:"₨"},MVR:{symbol:"MRf"},MWK:{symbol:"K"},MXN:{symbol:"$"},MYR:{symbol:"RM",groupSeparator:","},MZN:{symbol:"MT",decimalSeparator:","},NAD:{symbol:"N$",decimalSeparator:","},NIO:{symbol:"C$"},NOK:{symbol:"kr",decimalSeparator:",",groupSeparator:" "},NPR:{symbol:"Rs"},NZD:{symbol:"$",groupSeparator:","},OMR:{symbol:"ر.ع",decimalCount:3},PAB:{symbol:"B/."},PEN:{symbol:"S/.",decimalSeparator:","},PHP:{symbol:"₱",groupSeparator:","},PKR:{symbol:"Rs"},PLN:{symbol:"zł",groupSeparator:" "},PYG:{symbol:"₲",decimalCount:0,decimalSeparator:","},QAR:{symbol:"ر.ق"},RON:{symbol:"lei",groupSeparator:" "},RSD:{symbol:"RSD",decimalSeparator:",",groupSeparator:" "},RUB:{symbol:"₽"},RWF:{symbol:"R₣",decimalCount:0},SAR:{symbol:"SR"},SCR:{symbol:"SR"},SDG:{symbol:"SDG"},SEK:{symbol:"kr",decimalSeparator:",",groupSeparator:" "},SGD:{symbol:"S$",groupSeparator:","},SLL:{symbol:"Le"},SOS:{symbol:"Sh.So.",decimalSeparator:","},SSP:{symbol:"SS£"},SRD:{symbol:"Sr$",decimalSeparator:","},STN:{symbol:"Db"},SYP:{symbol:"£S"},SZL:{symbol:"L"},TJS:{symbol:"TJS"},THB:{symbol:"฿",groupSeparator:","},TMT:{sumbol:"m",decimalSeparator:","},TND:{symbol:"د.ت",decimalCount:3,decimalSeparator:","},TRY:{symbol:"₺"},TTD:{symbol:"TT$"},TWD:{symbol:"NT$"},TZS:{symbol:"TSh"},UAH:{symbol:"₴",decimalSeparator:","},UGX:{symbol:"USh",decimalCount:0},USD:{symbol:"$"},UYU:{symbol:"$U",decimalSeparator:","},UZS:{symbol:"som",decimalSeparator:","},VED:{symbol:"Bs.",decimalSeparator:","},VND:{symbol:"₫",decimalCount:0,decimalSeparator:","},XAF:{symbol:"FCFA",decimalCount:0},XCD:{symbol:"$"},XOF:{symbol:"CFA",decimalCount:0},YER:{symbol:"﷼"},ZAR:{symbol:"R",decimalSeparator:","}},s={".":",",",":"."};class a{constructor(e){var t,i,n;if(this.currencySettings={},this.apiRoot=e,null===(t=window.JarvisMLOptions)||void 0===t?void 0:t.currencies)for(const[e,t]of Object.entries(window.JarvisMLOptions.currencies)){const i=o[e]||{};Object.assign(i,t),o[e]=i}this.setCurrency((null===(n=null===(i=window.Shopify)||void 0===i?void 0:i.currency)||void 0===n?void 0:n.active)||"USD")}processSecondaryImageForEcommerce(e){if(e.length<=1)return"";for(let t=0;t "),o=e[i];t.push({filter_name:n,filter_value:r,product_count:o})}return t}processEcommerceApiResponse(e){return"ecommerce"!==this.apiRoot.collectedIds.vertical?e:e.map((e=>{const t=this.processSecondaryImageForEcommerce(e.images);return{entity_id:e.id,sku:e.sku,title:e.name,description:e.description,landing_page_click_tracker_url:e.landing_page_click_tracker_url,impression_tracker_url:e.impression_tracker_url,product_image_url:e.featured_image.url,secondary_image_url:t,price:e.price,currency_code:e.currency_code,compare_at_price:e.compare_at_price,availability:e.availability,long_name:e.long_name,created_at:e.created_at,updated_at:e.updated_at,sale_price:e.sale_price,variants:e.variants}}))}processEcommerceVariants(e){var t;if("ecommerce"!==this.apiRoot.collectedIds.vertical)return{};const i={};for(const n of e){if(!n||!n.options||(null===(t=n.options)||void 0===t?void 0:t.length)<=0)return e;const r=Object.assign({},{availability:n.availability,variant_id:n.id,product_id:n.product_id,sku:n.sku},...n.options),o=r.key.toLowerCase();i[o]?i[o].push(r):i[o]=[r],i[o].sort(((e,t)=>t.value.toLowerCase()t.value.toLowerCase()?1:0))}return i}setEcommerceRatings(){return e=this,t=void 0,r=function*(){"ecommerce"===this.apiRoot.collectedIds.vertical&&window.yotpoWidgetsContainer&&(yield(0,n.X)("yotpoWidgetsContainer object availability",(()=>"undefined"!=typeof window&&void 0!==window.yotpoWidgetsContainer),5e3))&&window.yotpoWidgetsContainer.initWidgets()},new((i=void 0)||(i=Promise))((function(n,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}));var e,t,i,r}processTemplateVariables(e){var t,i,n,r,o;const s=e.hasLocalHTMLTemplate;let a=e.listItemSection;const l=e.htmlTemplate,c=e.values,d=e.favBtnContent,u=e.currentIndex||0,p=this.apiRoot.backendApiUrl;let h=s?a:l.itemLinkSection;h=h.replaceAll("%landing_page_click_tracker_url%",`${p}${c.landing_page_click_tracker_url}`),h=h.replaceAll("%product_title%",c.title),h=h.replaceAll("%landing_page_url%",`${c.landing_page_url}`),h=h.replaceAll("%city%",c.city||""),h=h.replaceAll("%arrival_date%",c.arrival_date||""),h=h.replaceAll("%departure_date%",c.departure_date||""),d&&(h=h.replaceAll("%fav_btn_content%",d)),c.property_id&&(h=h.replaceAll("%property_id%",c.property_id)),c.unit_id&&(h=h.replaceAll("%unit_id%",c.unit_id)),s?h=h.replaceAll("%product_image_url%",`src="${encodeURI(c.product_image_url)}"`):(h=h.replaceAll("%product_image_url%",encodeURI(c.product_image_url)),a=a.replaceAll("%product_image_url%",encodeURI(c.product_image_url))),c.main_image&&c.main_image.url&&(h=h.replaceAll("%main_image_url%",encodeURI(c.main_image.url))),h=h.replaceAll("%secondary_image_url%",encodeURI(c.secondary_image_url)||""),h=h.replaceAll("%long_name%",c.long_name||""),h=c.availability?h.replaceAll("%hideUnavailableOverlay%","hidden"):h.replaceAll("%hideUnavailableOverlay%","");let m=s?h:l.productInfoSection;if(m=m.replaceAll("%landing_page_click_tracker_url%",`${p}${c.landing_page_click_tracker_url}`),m=m.replaceAll("%price_text_strong%",c.price_text_strong?c.price_text_strong:""),m=m.replaceAll("%price_text_small%",c.price_text_small?c.price_text_small:""),m=m.replaceAll("%product_title%",c.title),m=m.replaceAll("%product_description%",c.description||""),m=m.replaceAll("%desc%",c.desc||""),m=m.replaceAll("%compare_at_price%",c.compare_at_price?"$"+c.compare_at_price:""),m=m.replaceAll("%arrival_date%",c.arrival_date||""),m=m.replaceAll("%departure_date%",c.departure_date||""),c.property_id&&(m=m.replaceAll("%property_id%",c.property_id)),c.review_data){const e=5,t=c.review_data.average_rating||0,i=c.review_data.number_of_votes||0,n=t/e*100||0;m=m.replaceAll("%num_votes%",String(i)),m=m.replaceAll("%ratings_percentage%",String(n))}if(m=m.replaceAll("%ameneties_1%",c.ameneties_1),m=m.replaceAll("%ameneties_2%",c.ameneties_2),m=m.replaceAll("%ameneties_3%",c.ameneties_3),m=m.replaceAll("%city%",c.city||""),m=m.replaceAll("%state%",c.state||""),c.location){const e=c.location;let t="";e.city&&(t=`${e.city}`),e.state&&(t=`${t}, ${e.state}`),e.country&&(t=`${t}, ${e.country}`),m=m.replaceAll("%city_state_country%",t)}m=m.replaceAll("%address%",c.address||""),c.bedrooms?m=m.replaceAll("%bedrooms%",String(c.bedrooms)):c.hospitality_listing_detail&&c.hospitality_listing_detail.bedrooms?m=m.replaceAll("%bedrooms%",String(c.hospitality_listing_detail.bedrooms)):(m=m.replaceAll("%bedrooms%","-"),m=m.replaceAll("bedrooms","studio")),m=c.bathrooms?m.replaceAll("%bathrooms%",String(c.bathrooms)):c.hospitality_listing_detail&&c.hospitality_listing_detail.bathrooms?m.replaceAll("%bathrooms%",String(c.hospitality_listing_detail.bathrooms)):m.replaceAll("%bathrooms%","-");const g=c.currency||c.currency_code;g?(this.setCurrency(g),m=m.replaceAll("%currency%",this.getCurrencySymbol(g))):m=m.replaceAll("%currency%",""),m=(null===(t=c.variants)||void 0===t?void 0:t.length)>1?this.addPriceRange(m,c):this.addPrice(m,c),m=m.replaceAll("%master_bedroom%",(null===(i=c.available_amenities)||void 0===i?void 0:i.masterBedrooms)||""),m=m.replaceAll("%distance_to_beach%",(null===(n=c.available_amenities)||void 0===n?void 0:n.distanceToBeach)||""),m=m.replaceAll("%dog_friendly%","true"==(null===(r=c.available_amenities)||void 0===r?void 0:r["Dog Friendly"])?"inline-block":"none");let f,v,y,_="";!s&&l&&l.carouselItemSection&&l.carouselItemFallbackImage&&(f=l.carouselBodySection,v=l.carouselItemSection,y=l.carouselItemFallbackImage,y=y.replaceAll("%product_title%",c.title));let b,w,S,I="",x=0,j="hidden";if(c.additional_fields&&c.additional_fields.length){for(const e of c.additional_fields){if("deal_listing_url"===e.key&&e.value){const t=new URL(c.landing_page_click_tracker_url,p),i=this.convertTrackingUrl(e.value,t);h=h.replaceAll("%deal_listing_url%",i),m=m.replaceAll("%deal_listing_url%",i)}if(h=h.replaceAll(`%${e.key}%`,e.value||""),"price"!==e.key||e.value&&"0"!==e.value||(m=m.replaceAll("From $%price% / Night","Inquire Now")),"price"===e.key&&parseInt(e.value)>0&&(b=parseInt(e.value)),"sleeps"===e.key&&parseInt(e.value)>0&&(w=parseInt(e.value)),"price_currency_code"!==e.key&&"currency_code"!==e.key||!e.value||(m=m.replaceAll(`%${e.key}%`,`${this.getCurrencySymbol(e.value)}`)),"square_feet"!==e.key||e.value&&"0"!==e.value||(m=m.replaceAll("%square_feet%","N/A")),"hide_price_from_ui"===e.key&&"true"===e.value&&(I="hidden"),"half_baths"===e.key&&parseInt(e.value)>0&&(x+=parseInt(e.value),j=""),"full_baths"===e.key&&parseInt(e.value)>0&&(x+=parseInt(e.value)),m=m.replaceAll(`%${e.key}%`,e.value||""),h=h.replaceAll(`%${e.key}%`,e.value||""),y&&(y=y.replaceAll(`%${e.key}%`,e.value)),("slider_imgs_urls"===e.key||"resized_images"===e.key||"additional_images"===e.key)&&v&&e.value&&e.value.length){let t;"resized_images"===e.key&&e.value.length>=5&&(e.value=e.value.slice(0,5)),t=Array.isArray(e.value)?e.value:JSON.parse(e.value);const i=t.length;t.forEach(((e,t)=>{let n=v.replaceAll("%item_index%",t);n=n.replaceAll("%aria_index%",t+1),n=n.replaceAll("%aria_total%",i),n=`${n.replaceAll("'",'"')}`,e="object"==typeof e&&e.url?e.url:e,n=n.replaceAll("%slider_img_url%",e),n=n.replaceAll("%product_title%",c.title),_+=n}))}if("resized_images"===e.key&&e.value&&e.value.length){let t;t=Array.isArray(e.value)?e.value:JSON.parse(e.value),t&&t.length&&(h=h.replaceAll("%resized_image_url%",t[0]),m=m.replaceAll("%resized_image_url%",t[0]))}}""===_&&y?(y=y.replaceAll("%product_image_url%",encodeURI(c.product_image_url)),h=h.replaceAll("%carousel_content%",y)):""!==_&&f&&(f=f.replaceAll("%carousel_items%",_),f=f.replaceAll("%carousel_previous_btn%",l.carouselItemPrevButton),f=f.replaceAll("%carousel_next_btn%",l.carouselItemNextButton),h=h.replaceAll("%carousel_content%",f))}b&&w&&(S=Math.round(b/w)),m=m.replaceAll("%price_per_person%",String(S)||""),m=m.replaceAll("%price_visibility%",I),m=m.replaceAll("%half_bath_visibility%",j),m=m.replaceAll("%total_bathrooms%",String(x));let C="",A="hidden",k="";if(!s&&l&&l.productVariantItems&&l.productVariantSection){if(c.variants&&c.variants.length){k=l.productVariantSection;const e=this.processEcommerceVariants(c.variants);e&&(null===(o=e.size)||void 0===o?void 0:o.length)>0&&(e.size.forEach((e=>{const t=e.availability?"":"unavailable";C+=l.productVariantItems.replaceAll("%variant_value%",e.value||"").replaceAll("%product_id%",e.product_id||"").replaceAll("%variant_id%",e.variant_id||"").replaceAll("%variant_sku%",e.sku||"").replaceAll("%variant_availability%",t||"")})),A="")}k=k.replaceAll("%product_variants%",C||""),k=k.replaceAll("%variant_visibility%",A||""),m=m.replaceAll("%product_variant_section%",k||"")}let L="";if(c.impression_tracker_url&&(L=`Jarvis ML pixel recommendations`),a=s?m+L:a.replace("%product_article_content%",h+m+L),a=a.replaceAll("%latitude%",c.latitude||""),a=a.replaceAll("%longitude%",c.longitude||""),a=a.replaceAll("%product_title%",c.title||""),a=a.replaceAll("%property_id%",c.property_id||"0"),a=a.replaceAll("%serial_no%",String(u)),a=a.replaceAll("%landing_page_click_tracker_url%",`${p}${c.landing_page_click_tracker_url}`||""),a=a.replaceAll("%arrival_date%",c.arrival_date||""),a=a.replaceAll("%departure_date%",c.departure_date||""),c.entity_id){const e=c.entity_id.split(":").pop();a=a.replaceAll("%product_id%",e||"")}return a}addPrice(e,t){var i,n;const r=Number(null===(i=t.price)||void 0===i?void 0:i.value)>=1?t.price.value:Number(t.price)>=1?t.price:"",o=Number(null===(n=t.sale_price)||void 0===n?void 0:n.value)>=1?t.sale_price.value:Number(t.sale_price)>=1?t.sale_price:"";let s="",a="";return r&&o?(e=(e=e.replaceAll("%formatted_price%",this.formatPrice(Number(r)))).replaceAll("%sale_price%",this.formatPrice(Number(o))),s="hidden"):r&&!o?(e=(e=e.replaceAll("%formatted_price%",this.formatPrice(Number(r)))).replaceAll("%sale_price%",""),a="hidden"):(s="hidden",a="hidden",e=e.replaceAll("%formatted_price%","")),(e=e.replaceAll("%original_price_visibility%",s)).replaceAll("%sale_price_visibility%",a)}calculateMinMaxPriceFromVariants(e){const t=[],i=[];return e.forEach((e=>{e.price&&t.push(e.price.value),e.sale_price&&i.push(e.sale_price.value)})),{minOriginalPrice:t.length>1?Math.min(...t):null,maxOriginalPrice:t.length>1?Math.max(...t):null,minSalePrice:i.length>1?Math.min(...i):null,maxSalePrice:i.length>1?Math.max(...i):null}}addPriceRange(e,t){const i=this.calculateMinMaxPriceFromVariants(t.variants);if(!i.maxOriginalPrice||!i.minOriginalPrice||i.maxOriginalPrice===i.minOriginalPrice)return this.addPrice(e,t);const n=`${this.formatPrice(i.minOriginalPrice)} - ${this.formatPrice(i.maxOriginalPrice)}`;let r;i.minSalePrice&&i.maxSalePrice&&(r=`${this.formatPrice(i.minSalePrice)} - ${this.formatPrice(i.maxSalePrice)}`);let o="",s="";return n&&r?(e=(e=e.replaceAll("%formatted_price%",n)).replaceAll("%sale_price%",r),o="hidden"):n&&!r?(e=(e=e.replaceAll("%formatted_price%",n)).replaceAll("%sale_price%",""),s="hidden"):(o="hidden",s="hidden",e=e.replaceAll("%formatted_price%","")),(e=e.replaceAll("%original_price_visibility%",o)).replaceAll("%sale_price_visibility%",s)}populateGrandTotals(e){for(const t in e)if(e[t]){const i=e[t].total,n=e[t].discount,r=!n||0!=parseInt(n);if(i&&r){const e=document.getElementById(`jml-original-price-${t}`),r=e.innerHTML,o=parseInt(i)+parseInt(n);e.innerHTML=r.replaceAll("%original_price%",String(o)),e.style.visibility="visible"}const o=r?document.getElementById(`jml-discounted-price-${t}`):document.getElementById(`jml-grand-total-${t}`),s=o.innerHTML;o.innerHTML=s.replaceAll(r?"%discounted_price%":"%grand_total%",i),o.style.visibility="visible",r||(document.getElementById(`jml-discounted-price-${t}`).style.display="none")}}convertTrackingUrl(e,t){const i=t.searchParams;return i.set("destination_url",e),t.search=i.toString(),t.toString()}setCurrency(e){this.currencySettings.code=e||"USD";const t=o[this.currencySettings.code]||{};this.currencySettings.decimalCount=void 0!==t.decimalCount?t.decimalCount:2,this.currencySettings.decimalSeparator=t.decimalSeparator||".",this.currencySettings.groupSeparator=void 0!==t.groupSeparator?t.groupSeparator:s[this.currencySettings.decimalSeparator]||",",this.currencySettings.groupSize=void 0!==t.groupSize?t.groupSize:3,this.currencySettings.codePosition=t.codePosition||"before",this.currencySettings.symbolPosition=t.symbolPosition||"before",this.currencySettings.showZeroCents=void 0!==t.showZeroCents&&t.showZeroCents}formatPrice(e){return function(e,t){var i;if("number"!=typeof e||isNaN(e))return"";let n=e.toFixed(t.decimalCount);if(!t.showZeroCents&&t.decimalCount>0){const e=t.decimalCount+1;n.slice(-e)===l.slice(0,e)&&(n=n.slice(0,-e))}const r=n.lastIndexOf(".");if(r>-1&&"."!==t.decimalSeparator&&(n=n.replace(".",t.decimalSeparator)),t.groupSize&&t.groupSeparator){const e=r>-1?r:n.length,i=e%t.groupSize||t.groupSize;let o=n.substring(0,i);for(let r=i;r{i&&clearTimeout(i),i=setTimeout(e,t,n)}}function g(e){let t="";for(const i in e){t+=i+" {\n";for(const n in e[i])if("object"==typeof e[i][n]){t+="\t"+n+" {\n";for(const r in e[i][n])t+="\t\t"+r+": "+e[i][n][r]+";\n";t+=" \t}\n"}else t+="\t"+n+": "+e[i][n]+";\n";t+="}\n"}const i=document.createElement("style");i.innerHTML=t,document.body.append(i)}function f(e,t="personalized_recommendations"){let i;console.error(e),i=" https://tr.jarvisml.com/status_check";const n={domain_name:window.location&&window.location.href||"jarvisml.com",feature_type:t,message:e};fetch(" https://tr.jarvisml.com/status_check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function v(){const e=document.getElementsByTagName("head"),t=e[0].getElementsByTagName("link");let i=!1;for(let e=0;e')}function y(e){const t=e;for(let e=t.length-1;e>0;e--){const i=Math.floor(Math.random()*(e+1));[t[e],t[i]]=[t[i],t[e]]}return t}},629:(e,t,i)=>{i.d(t,{Z:()=>r});var n=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};class r{constructor(e,t){this.apiKey=e,this.properties=t}loadMapsApi(){return n(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{const i=document.createElement("script");i.src=`https://maps.googleapis.com/maps/api/js?key=${this.apiKey}&callback=initMap`,i.async=!0,i.defer=!0,i.onerror=t,window.initMap=e,document.head.appendChild(i)}))}))}initMap(e=!1){return n(this,void 0,void 0,(function*(){const t=document.getElementById("jarvis-default-map");if(!t)return;if(!e&&"object"==typeof google&&"object"==typeof google.maps)return;"undefined"==typeof google&&(yield this.loadMapsApi());const{Map:i}=yield google.maps.importLibrary("maps"),{AdvancedMarkerElement:n}=yield google.maps.importLibrary("marker"),{LatLng:r}=yield google.maps.importLibrary("core"),o=this.calculateCenter(this.properties),s=new i(t,{zoom:11,center:new r(o.lat,o.long),mapId:"4504f8b37365c3d0"});this.handleMapHeightDynamically();for(const e of this.properties){const t=new n({map:s,content:this.buildContent(e),position:new r(e.latitude,e.longitude),title:e.title});t.addListener("click",(()=>{this.toggleHighlight(t)}))}}))}calculateCenter(e){if(0===e.length)return null;let t=0,i=0;for(let n=0;n{const e=document.querySelector("#jarvis-default-map"),t=e.getBoundingClientRect().top;e.style.height=`calc(100vh - ${t}px)`})).observe(e)}toggleHighlight(e){const t=e.content;t.classList.contains("highlight")?(t.classList.remove("highlight"),e.zIndex=null):(t.classList.add("highlight"),e.zIndex=1)}buildContent(e){const t=document.createElement("div");return t.classList.add("jml-map-property"),t.innerHTML=`\n
\n \n \n \n
\n
\n
${e.title}
\n
${e.price} ${e.currency}
\n
${e.city}
\n
\n
\n \n bedroom\n ${e.bedrooms}\n
\n
\n \n bathroom\n ${e.bathrooms}\n
\n
\n
\n `,t}}},575:(e,t,i)=>{i.d(t,{tF:()=>u,Ky:()=>d});var n=i(625),r=i(25);function o(e,t){if(e&&t){if(t.targetClass&&t.settings||console.error("Target class not specified in the template"),e.url){const t=document.createElement("script");t.setAttribute("src",e.url),document.body.appendChild(t)}"slick"===e.name&&e.initializePerBlock?function(e){if(!window.jQuery)return;const t=()=>{setTimeout((function(){window.jQuery(e.targetClass).not(".slick-initialized").slick(e.settings)}),e.waitTime||2e3)};window.jQuery.isReady?t():window.jQuery((function(){t()}))}(t):"swiper"===e.name&&e.initializePerBlock?function(e){window.Swiper&&new window.Swiper(e.targetClass,e.settings)}(t):"owl"===e.name&&e.initializePerBlock?function(e){var t,i,n,o;t=this,i=void 0,o=function*(){if(!window.jQuery)return;if(!(yield(0,r.X)("owl-carousel",(()=>window.jQuery&&window.jQuery(e.targetClass)&&window.jQuery(e.targetClass).owlCarousel),e.waitTime||2e3)))return;const t=()=>{window.jQuery(e.targetClass).owlCarousel(e.settings)};window.jQuery.isReady?t():window.jQuery((function(){t()}))},new((n=void 0)||(n=Promise))((function(e,r){function s(e){try{l(o.next(e))}catch(e){r(e)}}function a(e){try{l(o.throw(e))}catch(e){r(e)}}function l(t){var i;t.done?e(t.value):(i=t.value,i instanceof n?i:new n((function(e){e(i)}))).then(s,a)}l((o=o.apply(t,i||[])).next())}))}(t):"flexslider"===e.name&&e.initializePerBlock&&function(e){if(!window.jQuery)return;const t=()=>{setTimeout((function(){window.jQuery(e.targetClass).flexslider(e.settings)}),e.waitTime||2e3)};window.jQuery.isReady?t():window.jQuery((function(){t()}))}(t)}}var s=i(660);function a(e){const t=e.baseUrl,i=e.collectedIds,n=e.pageType||i.pageType,r=e.locationFilter,o=e.recommendationsCount;let a=`${t}dynamic_experience/${i.entryPoint}?source=${i.source}`;return("marine"===i.vertical||"ecommerce"===i.vertical||i.source.indexOf("siebert-realty.com")>-1||i.source.indexOf("whimstay.com")>-1)&&(a=`https://miner.aidaptive.com/api/v2/aidaptive_serving/recommend?host_name=${i.hostname}`,a=(0,s.a3)(a,"full_url",i.fullUrl)),a=(0,s.a3)(a,"recos_count",o),a=(0,s.a3)(a,"ga_id",i.googleAnalyticsId),a=(0,s.a3)(a,"product_id",i.productId),a=(0,s.a3)(a,"person_id",i.personId),a=(0,s.a3)(a,"customer_id",i.customerId),a=(0,s.a3)(a,"shopify_cid",i.shopifyId),a=(0,s.a3)(a,"shopify_domain",i.shopifyDomain),a=(0,s.a3)(a,"shopify_page_type",i.shopifyPageType),a=(0,s.a3)(a,"shopify_product_id",i.shopifyProductId),a=(0,s.a3)(a,"jarvis_cid",i.jarvisClientId),a=(0,s.a3)(a,"visit_id",i.jarvisPixelId),a=(0,s.a3)(a,"page_type",n),r&&(a=(0,s.a3)(a,"location",encodeURIComponent(r))),a=(0,s.a3)(a,"cart_products",i.cartProductsAsUrl),a=(0,s.a3)(a,"cart_variants",i.cartVariantsAsUrl),a=(0,s.a3)(a,"consent",i.jarvisConsentOpt),a=(0,s.a3)(a,"experiment_id",i.experimentId),a}i(593);const l=["jarvis-personalized-recommendations","aidaptive-recommendations"];function c(){const e=[];for(const t of l){const i=document.getElementsByClassName(t);for(const t of i)e.push(t);if(0===i.length){const i=document.getElementById(t);i&&e.push(i)}}return e}function d(){for(const e of c())if(e.firstChild)return!0;return!1}class u{constructor(e,t){this.mutationObserversMap=new WeakMap,this.apiRoot=e,this.jmlUtilities=t}getBaseUrl(){return this.apiRoot.backendApiUrl}buildRecommendationUrl(e,t,i,n,r){return a({baseUrl:e||this.apiRoot.backendApiUrl,collectedIds:t||this.apiRoot.collectedIds,recommendationsCount:i,pageType:n,locationFilter:r})}populateRecommendationItem(e,t,i){let n,r;if(n=i?String(document.getElementsByClassName("jarvis-list-item")[0].outerHTML):t.listItemSection,e.isFavorited)if(i){const e=document.getElementsByClassName("jarvis-remove-fav-btn");e&&e.length&&(r=String(e[0].outerHTML))}else r=t.removeFavoriteBtn;else if(i){const e=document.getElementsByClassName("jarvis-add-fav-btn");e&&e.length&&(r=String(e[0].outerHTML))}else r=t.addFavoriteBtn;const o={hasLocalHTMLTemplate:i,listItemSection:n,htmlTemplate:t,values:e,favBtnContent:r};return this.jmlUtilities.processTemplateVariables(o)}populateTemplate(e,t,i,r){let s,a,l,c,d,u=this.apiRoot.useBaseCss,p=!1;if(t.dataset.localTemplate&&(p=!!document.getElementById(t.dataset.localTemplate)),i&&i.length>1&&!p){const e=t.dataset.template||"home";i[1]&&i[1].recommendations&&i[1].recommendations[e]?a=i[1].recommendations[e]:(a=i[2].recommendations[e],u=!0),i[1]&&i[1].carouselLibraryConfig&&(l=i[1].carouselLibraryConfig),i[1]&&i[1].customCss&&(c=i[1].customCss)}if(!a&&!p||void 0!==e.showPersonalizedRecommendations&&!e.showPersonalizedRecommendations)return void(t.style.visibility="hidden");if(p){s={};const e=document.getElementById(t.dataset.localTemplate);t.innerHTML+=e.outerHTML;for(const e of t.children)e.style.visibility=""}else s=a,t.innerHTML+=s.outerSection;if(u&&(0,n.Y_)(),a.cssUrls)for(const e of a.cssUrls){if(document.querySelector(`link[href='${e}']`))continue;const t=document.createElement("link");t.href=e,t.type="text/css",t.rel="stylesheet",document.body.append(t)}if(!p){d=document.getElementById("jarvis-outer-section"),d.id=`${d.id}-${r}`;let t=e.recommendationsTitle?e.recommendationsTitle:"Recommended for you";s.primaryTitle&&s.alternateTitle&&e.aidaptive_cohort&&(t="test"===e.aidaptive_cohort?s.primaryTitle:s.alternateTitle),s.titleSection=s.titleSection.replace("%recommendationsTitle%",t)}let h="";for(const t of e.recommendations)h+=this.populateRecommendationItem(t,s,p);if(p)t.getElementsByClassName("jarvis-list-section")[0].innerHTML=h;else{let e=s.listSection;e=e.replace("%list_content%",h),d.innerHTML=d.innerHTML.replace("%outer_section_content%",s.titleSection+e)}c&&(0,n.I_)(c),o(l,a.carouselConfig),"brondell.com"===this.apiRoot.collectedIds.source&&this.jmlUtilities.setEcommerceRatings();const m=t.dataset.tintColor;if(m){const e=document.querySelectorAll("#jarvis-price-listing");for(let t=0;t-1),u=a({baseUrl:t,collectedIds:e,recommendationsCount:s>=10||!d?s:10,pageType:r,locationFilter:o});let p;const h=!!document.getElementsByClassName("jarvis-recommendations-template").length;try{const t=[];if(window.Shopify?t.push(fetch(u).then((e=>e.text())).catch((e=>{(0,n.Qm)(`Jarvis Error: ${e.message}`,"personalized_recommendations")}))):t.push(fetch(u).then((e=>e?e.json():{}))),!h&&i&&i.length){const i=e.hostname.replaceAll(".","-");t.push(fetch(`https://cdn.jarvisml.com/templates/${i}-templates.json`).then((e=>e?e.json():{})).catch((()=>{}))),t.push(fetch("https://cdn.jarvisml.com/templates/jarvis-base-templates.json").then((e=>e?e.json():{})))}const r=yield Promise.all(t);if(r&&r.length&&!window.Shopify)p=r[0];else{if(!(r&&r.length&&window.Shopify)){for(const e of i)e.style.visibility="hidden";return}p=JSON.parse(r[0])}"marine"===e.vertical||"ecommerce"===e.vertical||e.source.indexOf("siebert-realty.com")>-1?p={recommendations:p.entities,aidaptive_cohort:p.aidaptive_cohort}:this.apiRoot.idCollection.processVisitIdResponse(p);const o=d?(0,n.q2)([...p.recommendations]):p.recommendations,s=window.getJarvisMLFavorites?yield window.getJarvisMLFavorites():[];for(const e of o)for(const t of s)if(t&&t.id.includes(e.property_id))e.isFavorited=!0;else if(t&&e.additional_fields&&e.additional_fields.length)for(const i of e.additional_fields)"api_id"!==i.key||i.value!==t.id||(e.isFavorited=!0);for(const[e,t]of i.entries()){const i=l.shift(),n=o.splice(0,i)||[],s=Object.assign({},p);s.recommendations=n,s.aidaptive_cohort=p.aidaptive_cohort,n&&n.length&&this.populateTemplate(s,t,r,e)}this.apiRoot.recommendations="marine"===e.vertical||"ecommerce"===e.vertical||e.source.indexOf("siebert-realty.com")>-1?p.entities:p.recommendations,p&&p.aidaptive_cohort&&this.logAidaptiveCohort(p.aidaptive_cohort),this.apiRoot.addEvents()}catch(e){(0,n.Qm)(`Error loading Jarvis ML recommendations: ${e.message}`,"personalized_recommendations")}},new((r=void 0)||(r=Promise))((function(e,n){function s(e){try{l(o.next(e))}catch(e){n(e)}}function a(e){try{l(o.throw(e))}catch(e){n(e)}}function l(t){var i;t.done?e(t.value):(i=t.value,i instanceof r?i:new r((function(e){e(i)}))).then(s,a)}l((o=o.apply(t,i||[])).next())}));var t,i,r,o}locationFilterChangeListener(e){const t=this.mutationObserversMap.get(e);if(e.innerHTML="",t&&t["data-location-filter"])return;const i=new MutationObserver((function(e){e.forEach((function(e){"data-location-filter"===e.attributeName&&window.JarvisML.personalizedRecos.loadRecommendations(window.JarvisML.collectedIds)}))}));i.observe(e,{attributes:!0,subtree:!0});const n=this.mutationObserversMap.get(e)||{};n["data-location-filter"]=i,this.mutationObserversMap.set(e,n)}logAidaptiveCohort(e){}}},199:(e,t,i)=>{i.d(t,{S:()=>G});var n=i(625),r=i(660);function o(e){const t=e.baseUrl,i=e.collectedIds,n=e.value,o=e.pageSize,a=e.pageToken,l=e.totalRecords?e.totalRecords:0,c=e.searchParams,d=e.additionalParams,u=e.sortOption?e.sortOption:"",p=e.aggFilters||0;let h=`${t}dynamic_search/${i.entryPoint}?source=${i.source}`;if("ecommerce"===e.collectedIds.vertical&&(h=`${t}dynamic_search/ecommerce/search?source=${i.source}`),h=(0,r.a3)(h,"ga_id",i.googleAnalyticsId),h=(0,r.a3)(h,"shopify_cid",i.shopifyId),h=(0,r.a3)(h,"shopify_domain",i.shopifyDomain),h=(0,r.a3)(h,"shopify_page_type",i.shopifyPageType),h=(0,r.a3)(h,"shopify_product_id",i.shopifyProductId),h=(0,r.a3)(h,"customer_id",i.customerId),h=(0,r.a3)(h,"jarvis_cid",i.jarvisClientId),h=(0,r.a3)(h,"visit_id",i.jarvisPixelId),h=(0,r.a3)(h,"query",n),h=(0,r.a3)(h,"result_count",o),h=(0,r.a3)(h,"recos_count",l),"ecommerce"===e.collectedIds.vertical?(h=(0,r.a3)(h,"offset",a),h=(0,r.a3)(h,"limit",o),h=s(h,c,"filter_params")):h=(0,r.a3)(h,"pagination_token",a),h=(0,r.a3)(h,"sort",u),h=(0,r.a3)(h,"consent",i.jarvisConsentOpt),h=(0,r.a3)(h,"agg_filters",p),d){const e=encodeURIComponent(JSON.stringify(d));h=(0,r.a3)(h,"ap",e)}return"ecommerce"!==e.collectedIds.vertical&&(h=s(h,c,"search_params")),h}function s(e,t,i){if(!t||Object.keys(t).length<1)return e;const n={};for(const[i,r]of Object.entries(t))if("sort"===i)e=`${e}&sort=${r}`;else if(r||!1===r){if(Array.isArray(r)&&r.length<1||"object"==typeof r&&Object.keys(r).length<1)continue;n[i]=r}return Object.keys(n).length<1?e:`${e}&${i}=${encodeURIComponent(JSON.stringify(n))}`}i(25);var a=i(629),l=i(128);const c=' ',d='';class u{constructor(e,t,i,n,r){this.filters=e,this.priceRange=t,this.filterSearchResults=n,this.showPreRenderLoader=r,this.containerId=i,this.container=document.getElementById(i),this.render()}render(){!this.filters||this.filters.length<1||(this.container.classList.add("jml-filters-section"),this.createFilterContainer())}toTitleCase(e){return e.replace(/\b\w/g,(e=>e.toUpperCase()))}createFilterBtnMobile(){const e=document.querySelector(".jml-sr-header .action-buttons-container")||document.querySelector("#jarvis-search-results .jml-action-button-container");if(!e||e.querySelector(".mobile-filter-button"))return;const t=(0,n.Mq)(e,"button","mobile-filter-button");t.innerHTML=' Filters',t.addEventListener("click",(e=>{this.toggleMobileFilter(e)}))}createFilterGroup(e){const t=document.createElement("div");t.classList.add("filter-groups");const i=document.createElement("div");i.classList.add("filter-groups-label");const n=document.createElement("button");n.classList.add("collapsible-trigger","is-open"),n.innerText=this.toTitleCase(e),n.addEventListener("click",(e=>{this.toggleCollapsibleFilter(e)}));const r=document.createElement("span");return r.classList.add("collapsible-trigger-icon"),r.innerHTML=c,n.appendChild(r),i.appendChild(n),t.appendChild(i),t}renderPriceFilter(){const e=this.priceRange.min_price;if(!this.priceRange.max_price&&!e)return null;const t=this.createFilterGroup("Price"),i=document.createElement("div");i.classList.add("filter-list","collapsible-content","is-open");const n=this.createPriceRangeSlider();return i.appendChild(n),t.appendChild(i),t}createPriceRangeSlider(){const e=JSON.parse(window.sessionStorage.getItem("jarvisPriceRangeFilter")||"{}"),t=document.createElement("div");t.className="price-parent-container";const i=document.createElement("div");i.className="price-input";const n=document.createElement("div");n.className="input-field";const r=document.createElement("input");r.type="number",r.className="input-min",r.placeholder="Min",e.min_price&&(r.value=e.min_price),r.oninput=e=>this.onPriceInputChange(e),n.appendChild(r);const o=document.createElement("div");o.className="input-field";const s=document.createElement("input");s.type="number",s.className="input-max",s.placeholder="Max",e.max_price&&(s.value=e.max_price),s.oninput=e=>this.onPriceInputChange(e),o.appendChild(s);const a=document.createElement("button");return a.type="button",a.className="price-search",a.innerText="Go",a.onclick=e=>this.onPriceRangeSearch(e),i.appendChild(n),i.appendChild(o),i.appendChild(a),t.appendChild(i),t}onPriceRangeSearch(e){const t=e.target.parentElement,i={max_price:t.closest(".price-parent-container").querySelector(".input-max").value,min_price:t.closest(".price-parent-container").querySelector(".input-min").value};window.sessionStorage.setItem("jarvisPriceRangeFilter",JSON.stringify(i)),this.showPreRenderLoader(),this.filterSearchResults()}onPriceInputChange(e){var t;const i=e.target.parentElement,n=i.closest(".price-input").querySelector(".input-max"),r=i.closest(".price-input").querySelector(".input-min"),o=parseInt((null===(t=document.querySelector(`#${this.containerId} .price-range-max`))||void 0===t?void 0:t.getAttribute("max"))||"0"),s=parseInt(n.value),a=parseInt(r.value),l=document.querySelector(`#${this.containerId} .price-slider .price-progress`),c=document.querySelector(`#${this.containerId} .price-range-min`),d=document.querySelector(`#${this.containerId} .price-range-max`);s-a>=10&&s<=o&&("input-min"==e.target.className?(c.value=a.toString(),l.style.left=this.rangeMarginLeft(a,o)):(d.value=s.toString(),l.style.right=this.rangeMarginRight(s,o)))}onPriceRangeChange(e){const t=e.target.parentElement,i=t.querySelector(".price-range-max"),n=t.querySelector(".price-range-min"),r=parseInt(t.querySelector(".price-range-max").getAttribute("max")),o=parseInt(t.querySelector(".price-range-max").getAttribute("min")),s=parseInt(i.value),a=parseInt(n.value);if(s-a<10)"price-range-min"==e.target.className?n.value=(s-10).toString():i.value=(a+10).toString();else{const e=document.querySelector(`#${this.containerId} .input-min`),t=document.querySelector(`#${this.containerId} .input-max`);a===o?(e.placeholder="Min",e.value=""):e.value=a.toString(),s===r?(t.placeholder="Max",t.value=""):t.value=s.toString();const i=document.querySelector(`#${this.containerId} .price-slider .price-progress`);i.style.left=this.rangeMarginLeft(a,r),i.style.right=this.rangeMarginRight(s,r)}}rangeMarginLeft(e,t){return e/t*100+"%"}rangeMarginRight(e,t){return 100-e/t*100+"%"}createFilterContainer(){this.createFilterBtnMobile();const e=document.createElement("section");e.classList.add("filters");const t=document.createElement("div");t.classList.add("heading-section");const i=document.createElement("button");i.classList.add("mobile-filter-cross"),i.innerHTML=d,i.addEventListener("click",(e=>{this.toggleMobileFilter(e)})),t.appendChild(i),e.appendChild(t);const n={};for(const{filter_name:e,filter_value:t,product_count:i}of this.filters)n[e]||(n[e]=[]),n[e].push({filter_value:t,product_count:i});const r=this.renderPriceFilter();r&&e.appendChild(r),this.createFilterSections(n,e);const o=document.querySelector(`#${this.containerId} section.filters`);o?this.container.replaceChild(e,o):this.container.appendChild(e)}createFilterSections(e,t){for(const[i,n]of Object.entries(e)){if(i.includes("aidaptive"))continue;const e=document.createElement("div");e.classList.add("filter-groups");const r=document.createElement("div");r.classList.add("filter-groups-label");const o=document.createElement("button");o.classList.add("collapsible-trigger","is-open"),o.innerText=this.toTitleCase(i),o.addEventListener("click",(e=>{this.toggleCollapsibleFilter(e)}));const s=document.createElement("span");s.classList.add("collapsible-trigger-icon"),s.innerHTML=c,o.appendChild(s),r.appendChild(o),e.appendChild(r);const a=n.length>5;this.createFilterValues(n,i,e,t,a)}}createFilterValues(e,t,i,n,r){var o,s;const a=JSON.parse(window.sessionStorage.getItem("jarvisSelectedFilters")||"{}"),l=document.createElement("div");l.classList.add("filter-list","collapsible-content","is-open");const c=document.createElement("div");c.classList.add("view-more-filter-list");let d=0;for(const[n,{filter_value:u,product_count:p}]of e.entries()){const e=document.createElement("div");e.classList.add("filter-content");const h=document.createElement("input");h.type="checkbox",h.name=t,h.value=u,h.id=`${t}-${u}`,h.addEventListener("change",(e=>{const t=e.target;this.updateFilterEvent(t.name,t.value)})),(null===(o=a[t])||void 0===o?void 0:o.length)>0&&(null===(s=a[t])||void 0===s?void 0:s.includes(u))&&(h.checked=!0);const m=document.createElement("label");if(m.htmlFor=h.id,m.innerText=`${u} (${p})`,e.appendChild(h),e.appendChild(m),r){if(n<4)l.appendChild(e);else if(c.appendChild(e),l.appendChild(c),0===d){const e=document.createElement("a");e.href="javascript:void(0);",e.innerText="View more options",e.className="view-more-options",e.addEventListener("click",(e=>{this.onViewMoreButtonClick(e)})),l.appendChild(e),d++}}else l.appendChild(e);i.appendChild(l)}n.appendChild(i)}onViewMoreButtonClick(e){const t=e.target.closest(".filter-groups").querySelector(".filter-list.collapsible-content"),i=t.querySelector(".view-more-filter-list"),n=t.querySelector(".view-more-options");i.style.display="block",n.style.display="none";let r=t.querySelector(".view-less-options");r?r.style.display="block":(r=document.createElement("a"),r.href="javascript:void(0);",r.innerText="View less options",r.classList="view-less-options",r.addEventListener("click",(e=>{this.onViewLessButtonClick(e)})),t.appendChild(r))}onViewLessButtonClick(e){const t=e.target.closest(".filter-groups").querySelector(".filter-list.collapsible-content"),i=t.querySelector(".view-more-filter-list"),n=t.querySelector(".view-more-options"),r=t.querySelector(".view-less-options");i.style.display="none",n.style.display="block",r.style.display="none"}toggleCollapsibleFilter(e){const t=e.target.closest(".filter-groups").querySelector(".filter-list.collapsible-content"),i=e.target.closest(".filter-groups").querySelector(".collapsible-trigger");t.classList.contains("is-open")?t.classList.remove("is-open"):t.classList.add("is-open"),i.classList.contains("is-open")?i.classList.remove("is-open"):i.classList.add("is-open")}toggleMobileFilter(e=null){const t=document.querySelector("#jml-filters-section")||document.querySelector("#jarvis-search-filters");t&&(t.classList.contains("mobile-open")?t.classList.remove("mobile-open"):t.classList.add("mobile-open"))}updateFilterEvent(e,t){let i=JSON.parse(window.sessionStorage.getItem("jarvisSelectedFilters")||"{}");if(Object.prototype.hasOwnProperty.call(i,e)){i[e].includes(t)?i[e]=i[e].filter((e=>e!==t)):i[e].push(t);const n=Object.fromEntries(Object.entries(i).filter((([e,t])=>t.length>0)));i=Object.assign({},n)}else i[e]=[t];this.renderFilteredResults(i)}renderSelectedFiltersPill(){const e=document.querySelector("#jml-selected-filters-pill-container"),t=JSON.parse(window.sessionStorage.getItem("jarvisSelectedFilters")||"{}");if(!e)return;if(Object.keys(t).length<1)return void(e.style.display="none");e.style.display="block";const i=document.querySelector("#jml-selected-filters-pill-container .selected-filters-pills");i.innerHTML="",Object.entries(t).forEach((([e,t])=>{t.forEach((t=>{const r=(0,n.Mq)(i,"div","pill-container");(0,n.Mq)(r,"span","pill-label").innerText=t;const o=(0,n.Mq)(r,"span","pill-remove");o.innerHTML=d,o.addEventListener("click",(()=>{this.updateFilterEvent(e,t)}))}))})),document.querySelector("#jml-selected-filters-pill-container .filter-clearall").addEventListener("click",(e=>{e.preventDefault(),this.renderFilteredResults({})}))}renderFilteredResults(e){window.sessionStorage.setItem("jarvisSelectedFilters",JSON.stringify(e)),this.toggleMobileFilter(),this.renderSelectedFiltersPill(),this.showPreRenderLoader(),this.filterSearchResults()}getContainer(){return this.container}}var p=i(379),h=i.n(p),m=i(37),g=i.n(m),f=i(569),v=i.n(f),y=i(565),_=i.n(y),b=i(216),w=i.n(b),S=i(447),I={};S.Z&&S.Z.locals&&(I.locals=S.Z.locals);var x,j=0,C={};C.setAttributes=_(),C.insert=v().bind(null,"head"),C.domAPI=g(),C.insertStyleElement=w(),I.use=function(e){return C.options=e||{},j++||(x=h()(S.Z,C)),I},I.unuse=function(){j>0&&!--j&&(x(),x=null)};const A=I;var k=i(731),L={};k.Z&&k.Z.locals&&(L.locals=k.Z.locals);var R,M=0,P={};P.setAttributes=_(),P.insert=v().bind(null,"head"),P.domAPI=g(),P.insertStyleElement=w(),L.use=function(e){return P.options=e||{},M++||(R=h()(k.Z,P)),L},L.unuse=function(){M>0&&!--M&&(R(),R=null)};const E=L;var T=i(484),B={};T.Z&&T.Z.locals&&(B.locals=T.Z.locals);var $,F=0,D={};D.setAttributes=_(),D.insert=v().bind(null,"head"),D.domAPI=g(),D.insertStyleElement=w(),B.use=function(e){return D.options=e||{},F++||($=h()(T.Z,D)),B},B.unuse=function(){F>0&&!--F&&($(),$=null)};const O=B;var U=i(812),z={};U.Z&&U.Z.locals&&(z.locals=U.Z.locals);var q,N=0,J={};J.setAttributes=_(),J.insert=v().bind(null,"head"),J.domAPI=g(),J.insertStyleElement=w(),z.use=function(e){return J.options=e||{},N++||(q=h()(U.Z,J)),z},z.unuse=function(){N>0&&!--N&&(q(),q=null)};const V=z;var H=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};const Q=["query","s","q","search_query"];class G{constructor(e,t){this.searchModalTemplate=null,this.searchPageTemplate=null,this.recordCount=null,this.apiMetaData=null,this.searchQuery=null,this.paginationTemplate=null,this.isScrollChange=null,this.currentScrolls=1,this.apiFiltersData=null,this.registerInfiniteScroll=()=>{const e=document.getElementsByTagName("footer")[0];let t=0;e&&(t=e.offsetHeight),E.use(),window.addEventListener("scroll",(()=>{window.scrollY+window.innerHeight+80+t>=document.documentElement.scrollHeight&&!this.isScrollChange&&this.searchPageTemplate&&this.searchPageTemplate.loaderSection&&("ecommerce"===this.apiRoot.collectedIds.vertical&&this.paginationOffset?(this.isScrollChange=!0,document.getElementById("jarvis-loader-container")&&(document.getElementById("jarvis-loader-container").style.visibility="visible"),this.populateSearchResults({searchQuery:this.searchQuery,pageToken:this.paginationOffset,scrollPage:!0})):this.apiMetaData&&this.apiMetaData.next_token&&(this.isScrollChange=!0,document.getElementById("jarvis-loader-container")&&(document.getElementById("jarvis-loader-container").style.visibility="visible"),this.populateSearchResults({searchQuery:this.searchQuery,pageToken:this.apiMetaData.next_token,scrollPage:!0})))}))},this.searchEventaction=e=>{this.searchQuery=e,window.sessionStorage.setItem("searchQuery",e),e.length?e.length<3||this.showSearchModal(e):this.hideSearchModal()},this.showSearchModal=e=>H(this,void 0,void 0,(function*(){const t=document.getElementById("jarvis-search-modal");if(!t)return;const i={baseUrl:this.apiRoot.backendApiUrl,collectedIds:this.apiRoot.collectedIds,value:e,totalRecords:this.recordCount},n=yield this.fetchSearchResults(i);t.style.display="flex",this.populateSearchModal(n)})),this.renderPaginationElem=()=>{const e=this.apiMetaData.tokens;if(!e)return"";const t=Math.ceil(this.apiMetaData.total_result_count/this.apiMetaData.result_count);this.currentPage=this.apiMetaData.at,this.apiMetaData.prev_token||(this.currentPage=1),this.apiMetaData.next_token||(this.currentPage=t);let i=this.paginationTemplate.listItemPrevButton.replaceAll("%page_token%",this.apiMetaData.prev_token||"");for(let t=0;t{for(let t=0;tthis.switchPage(e)),!1)})),this.paginationTemplate.outerSection.replaceAll("%page_items%",i)},this.switchPage=e=>{var t;e.preventDefault();let i=e.currentTarget.getAttribute("data-page-token");const n=parseInt(e.currentTarget.getAttribute("data-page-no"));isNaN(n)&&!i||n===this.currentPage||(isNaN(n)||(i=n>0&&(null===(t=this.apiMetaData)||void 0===t?void 0:t.tokens)?this.apiMetaData.tokens[n-1]:null),this.populateSearchResults({searchQuery:this.searchQuery,pageToken:i}))},this.triggerFilteredResults=()=>{this.populateSearchResults()},this.populateSearchResults=e=>H(this,void 0,void 0,(function*(){const t=this.apiRoot.useBaseCss;let i=null==e?void 0:e.searchQuery;const r=null==e?void 0:e.pageToken,o=null==e?void 0:e.scrollPage,s=null==e?void 0:e.filterResults,l=null==e?void 0:e.sortResults;t&&(0,n.Y_)(),i||(i=this.readSearchQueryFromUrl()||this.searchQuery||window.sessionStorage.getItem("searchQuery")),i!==window.sessionStorage.getItem("lastSearchQuery")&&(window.sessionStorage.setItem("jarvisSelectedFilters","{}"),window.sessionStorage.setItem("jarvisPriceRangeFilter","{}")),window.sessionStorage.setItem("lastSearchQuery",i);const c=this.apiRoot.backendApiUrl,d=document.getElementById("jarvis-search-results"),u=document.getElementById("jarvis-personalized-search"),p=u||d,h=parseInt(null==p?void 0:p.getAttribute("data-record-count")),m=parseInt(null==p?void 0:p.getAttribute("data-maximum-records")),g=h||this.recordCount||6,f=m||400,v=[],y=new URLSearchParams(window.location.search);if(!o||s||l?this.currentScrolls=1:this.currentScrolls++,(this.totalResults0){const e={hasLocalHTMLTemplate:!1,listItemSection:this.searchPageTemplate.listItemSection,htmlTemplate:this.searchPageTemplate,favBtnContent:"",values:null},t=this.apiRoot.searchFilters;b.forEach(((i,n)=>{if(t.arrival_date&&t.departure_date){i.arrival_date=t.arrival_date,i.departure_date=t.departure_date;for(const e of i.additional_fields)"api_id"===e.key&&v.push(e.value)}e.values=i,e.favBtnContent=i.isFavorited?this.searchPageTemplate.removeFavoriteBtn:this.searchPageTemplate.addFavoriteBtn,e.currentIndex=w+n,S+=this.jmlUtilities.processTemplateVariables(e)}));const i=!!u;if(new a.Z("AIzaSyDq4TgFAkRbCyyBRneMzKDnfCFK9YoxOyY",window.JarvisML.searchResults).initMap(i),document.getElementsByClassName("jml-search-item-container")[0]&&o)return document.getElementById("jarvis-loader-container").style.visibility="hidden",this.isScrollChange=!1,document.getElementsByClassName("jml-search-item-container")[0].innerHTML+=S,this.fetchGrandTotals(v),this.switchSecondaryProductImage(),void this.callExternalIntegrations()}else S=this.searchPageTemplate.noResults;const I=this.searchPageTemplate.listSection.replaceAll("%list_content%",S);let x=this.searchPageTemplate.outerSection;x=x.replace("%document_result_component%",this.documentListContainer||""),x=x.replace("%outer_section_content%",I),this.setTotalRecordCount(),x=this.addPagination(x),d.innerHTML=x,this.filtersSection&&(this.filtersSection.createFilterBtnMobile(),this.renderCustomMobileSortBox(this.apiFiltersData,this.templateData)),this.callExternalIntegrations(),this.fetchGrandTotals(v),this.switchSecondaryProductImage();const j=document.getElementById("jarvis-personalized-search"),C=null==j?void 0:j.dataset.tintColor;C&&(document.querySelectorAll("#jarvis-personalized-search .tint-color").forEach((e=>{e.style.color=C})),document.querySelectorAll("#jarvis-personalized-search .tint-bg-color").forEach((e=>{e.style.backgroundColor=C})))})),this.apiRoot=e,this.jmlUtilities=t}getBaseUrl(){return this.apiRoot.backendApiUrl}getApiUrl(e,t,i=null,n=null,r=0,s="",a=0){return o({baseUrl:this.apiRoot.backendApiUrl,collectedIds:this.apiRoot.collectedIds,value:e,pageSize:t,pageToken:i,searchParams:n,totalRecords:r,sortOption:s,aggFilters:a})}onJarvisFormSubmit(e){e.preventDefault();const t=document.getElementById("jarvis-search-filters-form"),i=new FormData(t),n=this.searchSchema,r=n&&n.sortSchema||null,o=n&&n.filtersSchema||null,s=window.JarvisML.filtering;let a,l;for(const[e,t]of i.entries())if(e&&o&&o[e]){const n=o[e];if(!n)continue;if("sort"===n.keyName&&r){const e=r[t];e&&e.keyName&&s.setSortBy(e.keyName,!e.descending)}else if("bedrooms"===n.keyName)s.setBedrooms(t);else if("sleeps"===n.keyName)s.setSleeps(t);else if("bathrooms"===n.keyName)s.setBathrooms(t);else if("arrival"===n.keyName)a=t;else if("departure"===n.keyName)l=t;else if("array"===n.valueType)s.setFilter(n.keyName,i.getAll(e));else if(!n.keyName&&n.setSeparately&&n.repeats){const e=Array.isArray(t)?t:[t];for(const t of e)s.setFilter(t,!0)}else n.keyName&&s.setFilter(n.keyName,t)}a&&l&&s.setDate(a,l),this.triggerFilteredResults()}renderDefaultSearchUI(e,t){return H(this,void 0,void 0,(function*(){if(!t)return!1;const i=yield this.fetchJsonTemplates(e,t),n=this.searchPageTemplate.defaultSearchSection||"";t.innerHTML=n;const r=i.search&&i.search["search-filter-items"];return r?(this.defaultSearchFilters=new l.U(this.apiRoot,r),this.defaultSearchFilters.initializeDefaultFilters()):document.querySelector("#jarvis-personalized-search .jml-navbar").style.display="none",!0}))}renderSearchModal(e,t){return H(this,void 0,void 0,(function*(){const i=document.getElementById("jarvis-search-input");if(!i)return;yield this.fetchJsonTemplates(e,null);const r=parseInt(i.getAttribute("data-record-count"));isNaN(r)||(this.recordCount=r);const o=this.readSearchQueryFromUrl()||this.searchQuery||window.sessionStorage.getItem("searchQuery");i.value=o,i.addEventListener("input",(0,n.Ds)((e=>this.searchEventaction(e.target.value)),400)),i.addEventListener("click",(0,n.Ds)((e=>this.searchEventaction(e.target.value)),250)),document.body.addEventListener("click",(e=>{i.contains(e.target)||this.hideSearchModal()}));let s=document.getElementById("jarvis-search-modal");s||t||(i.parentElement.insertAdjacentHTML("beforeend",this.searchModalTemplate.outerSection),s=document.getElementById("jarvis-search-modal"),s&&(s.style.display="none"))}))}loadSearchUI(e,t=null){return H(this,void 0,void 0,(function*(){const i=document.getElementById("jarvis-search-results");if(this.renderSearchModal(e,i),!i)return;const r=yield this.fetchJsonTemplates(e,t),o=this.readSearchQueryFromUrl()||this.searchQuery,s=(0,l.w)({baseUrl:this.apiRoot.backendApiUrl,collectedIds:this.apiRoot.collectedIds,searchQuery:o}),a=yield fetch(s).catch((e=>(0,n.Qm)(`fetchSearchFilters error: ${e.message}`,"personalized_search")));this.apiFiltersData=a?yield a.json():{},this.renderCustomSortBox(this.apiFiltersData,r),this.populateSearchResults(),this.registerInfiniteScroll(),this.takeOverFiltersForm(),V.use()}))}retryFetchWithFallback(e,t,i=1){return H(this,void 0,void 0,(function*(){let n,r=0;for(;r<=i;)try{return n=yield fetch(e),n}catch(e){if(!(r{(0,n.Qm)(`fetchSearchDocuments error: ${e.message}`,"personalized_search")})),a=s?yield s.json():{},l=null==a?void 0:a.pages;if(!l||(null==l?void 0:l.length)<1)return"";let c="";return l.forEach((e=>{c+=i.listItemSection.replaceAll("%document_title%",e.name).replaceAll("%document_link%",e.link||e.url)})),O.use(),i.listSection.replaceAll("%list_document_content%",c)}))}renderCustomSortBox(e,t){const i=document.getElementById("jarvis-default-sort-box");if(!i||!e.sort_options)return;i.innerHTML=t.search["search-filter-items"].sortFieldInnerContent;const n=document.querySelector("#jarvis-default-sort-box .jml-sort-select-box");n&&(this.renderSortOptions(n,e),n.onchange=e=>this.onJarvisSortChange(e))}renderCustomMobileSortBox(e,t){const i=document.querySelector("#jarvis-search-results .jml-action-button-container");if(!i||!e.sort_options)return;let r=document.querySelector("#jarvis-search-results .jarvis-default-mobile-sort-box");if(r)return;r=(0,n.Mq)(i,"div","jarvis-default-mobile-sort-box"),r.innerHTML=t.search["search-filter-items"].sortFieldInnerContent;const o=document.querySelector(".jarvis-default-mobile-sort-box .jml-sort-select-box");o&&(this.renderSortOptions(o,e),o.onchange=e=>this.onJarvisSortChange(e))}onJarvisSortChange(e){window.JarvisML.filtering.setSortBy(e.target.value,!0),this.populateSearchResults({sortResults:!0})}processSortOptionsForEcommerce(e){if("ecommerce"!==this.apiRoot.collectedIds.vertical)return e;const t=e.sort_options.map((e=>({sort_label:e,sort_field:e}))),i={sort_field:e.default_sort_option,sort_label:e.default_sort_option};return e.sort_options=t,e.default_sort_option=i,e}renderSortOptions(e,t){const i=JSON.parse(JSON.stringify(t)),n=this.processSortOptionsForEcommerce(i);return n.sort_options.forEach((t=>{const i=document.createElement("option");i.value=t.sort_field,i.text=t.sort_label,i.selected=t.sort_field===n.default_sort_option.sort_field,e.appendChild(i)})),e}renderCustomFilterSection(e){if(!document.getElementById("jarvis-search-filters"))return;const t={min_price:null==e?void 0:e.min_price_value,max_price:null==e?void 0:e.max_price_value};this.filtersSection=new u(this.jmlUtilities.processEcommerceTaxonomy(null==e?void 0:e.taxonomy),t,"jarvis-search-filters",(()=>this.populateSearchResults({filterResults:!0})),Z),A.use()}takeOverFiltersForm(){const e=document.getElementById("jarvis-search-filters-form");e&&(e.setAttribute("action",null),e.setAttribute("method",null),e.addEventListener("submit",(e=>window.JarvisML.onJarvisFormSubmit(e))),this.apiRoot.onJarvisFormSubmit=e=>this.onJarvisFormSubmit(e))}hideSearchModal(){const e=document.getElementById("jarvis-search-modal");e&&(e.style.display="none",e.innerHTML="")}handleUserFavourites(e){return H(this,void 0,void 0,(function*(){if(!window.getJarvisMLFavorites)return e;const t=yield window.getJarvisMLFavorites();for(const i of e)for(const e of t)if(e&&e.id.includes(i.property_id))i.isFavorited=!0;else if(e&&i.additional_fields&&i.additional_fields.length)for(const t of i.additional_fields)"api_id"!==t.key||t.value!==e.id||(i.isFavorited=!0);return e}))}setSearchedResults(e,t){if(!e)return this.apiRoot.searchResults=t||[],0;const i=[...this.apiRoot.searchResults,...t],n=this.apiRoot.searchResults.length;return this.apiRoot.searchResults=i,n}populateSearchModal(e){const t=this.apiRoot.backendApiUrl,i=document.getElementById("jarvis-search-modal");if(!i)return void console.error("Search Modal not found");let n="";(null==e?void 0:e.length)>0?e.forEach((e=>{var i;const r=(null===(i=e.landing_page_click_tracker_url)||void 0===i?void 0:i.startsWith("http"))?e.landing_page_click_tracker_url:`${t}${e.landing_page_click_tracker_url}`;n+=this.searchModalTemplate.itemLinkSection.replaceAll("%product_image_url%",e.product_image_url).replaceAll("%price_text_small%",e.price_text_small||e.price).replaceAll("%product_title%",e.title).replaceAll("%landing_page_click_tracker_url%",r)})):n=this.searchModalTemplate.noResults;const r=this.searchModalTemplate.listSection.replace("%list_content%",n);i.innerHTML=r}processFiltersForEcommerce(e){const t=[];for(const i in e)e[i].forEach((e=>{t.push(`${i} -> ${e}`)}));return t}getSearchFilterObject(){if(document.getElementById("jarvis-search-filters")){const e=JSON.parse(window.sessionStorage.getItem("jarvisSelectedFilters")||"{}"),t=JSON.parse(window.sessionStorage.getItem("jarvisPriceRangeFilter")||"{}"),i=window.JarvisML.searchFilters.sort;let n={};return Object.keys(e).length>0&&(n="ecommerce"===this.apiRoot.collectedIds.vertical?{taxonomies:this.processFiltersForEcommerce(e)}:{filter_dict:e}),t.max_price&&(n.max_price=parseInt(t.max_price)),t.min_price&&(n.min_price=parseInt(t.min_price)),i&&(n.sort=i),n}return window.JarvisML.searchFilters}fetchSearchResults(e){var t;return H(this,void 0,void 0,(function*(){const i=o(e),r=yield this.retryFetchWithFallback(i,(e=>{const t=document.getElementById("jarvis-loader-container");t&&(t.style.visibility="hidden",this.isScrollChange=!1),(0,n.Qm)(`fetchSearchResults error: ${e.message}`,"personalized_search")})),s=r?yield r.json():{},a=(null==s?void 0:s.recommendations)||(null==s?void 0:s.ranked_products)||(null==s?void 0:s.products);let l=(null==a?void 0:a.data)||a;return this.apiMetaData=null==a?void 0:a.metadata,this.totalResults=(null===(t=this.apiMetaData)||void 0===t?void 0:t.total_result_count)||(null==s?void 0:s.total_results),this.paginationOffset=null==s?void 0:s.next_offset,this.ecommerceFiltersAggregation=null==s?void 0:s.aggregation,!l||(null==l?void 0:l.length)<1||(this.totalPages=Math.ceil(this.totalResults/(null==e?void 0:e.pageSize)),l=this.jmlUtilities.processEcommerceApiResponse(l),l=yield this.handleUserFavourites(l)),l}))}readSearchQueryFromUrl(){const e=window.location.href,t=new URL(e),i=Q.find((e=>t.searchParams.has(e)));return i?t.searchParams.get(i):null}callExternalIntegrations(){"brondell.com"===this.apiRoot.collectedIds.source&&this.jmlUtilities.setEcommerceRatings()}switchSecondaryProductImage(){document.querySelectorAll("#jarvis-search-results .jml-search-item-container .jml-main-image").forEach((e=>{const t=e.getAttribute("data-secondaryimage-src"),i=e.getAttribute("src");t&&(e.addEventListener("mouseenter",(()=>{e.setAttribute("srcset",t)})),e.addEventListener("mouseleave",(()=>{e.setAttribute("srcset",i)})))}))}fetchGrandTotals(e){var t;const i=this.apiRoot.searchFilters;if((null===(t=this.apiRoot.collectedIds.source)||void 0===t?void 0:t.indexOf("summitcove.com/rentals"))>-1&&i.arrival_date&&i.departure_date){const t=new URLSearchParams(window.location.search),o=function(e){let t;t="https://api.aidaptive.com",t=`${t}/hospitality_pricing/prices?source=${e.collectedIds.source}`,t=(0,r.a3)(t,"arrival_date",e.arrivalDate),t=(0,r.a3)(t,"departure_date",e.departureDate);for(const i of e.ids)t=(0,r.a3)(t,"ids",i);return e.promoCode&&(t=(0,r.a3)(t,"promo_code",e.promoCode)),t}({ids:e,collectedIds:this.apiRoot.collectedIds,promoCode:t.get("promocode"),arrivalDate:i.arrival_date,departureDate:i.departure_date});fetch(o).then((e=>e.json())).then((e=>{e&&e.prices&&this.jmlUtilities.populateGrandTotals(e.prices)})).catch((e=>{(0,n.Qm)(`fetchGrandTotals error: ${e.message}`,"grand_totals")}))}}addPagination(e){if(this.searchPageTemplate.loaderSection)e=e.replaceAll("%pagination_component%",this.searchPageTemplate.loaderSection);else{const t=this.paginationTemplate&&this.apiMetaData;e=e.replaceAll("%pagination_component%",t?this.renderPaginationElem():"")}return e}setTotalRecordCount(){const e=document.getElementById("jarvis-search-count");if(!e)return;const t=this.searchQuery||window.sessionStorage.getItem("searchQuery")||this.readSearchQueryFromUrl();(this.totalResults||0===this.totalResults)&&this.searchPageTemplate.recordsCountSection?(e.hidden=!1,e.innerHTML=this.searchPageTemplate.recordsCountSection.replaceAll("%total_records%",this.totalResults).replaceAll("%search_query%",t)):e.hidden=!0}waitForPageSwitch(){return new Promise((e=>{const t=document.getElementsByClassName("jarvis-page-switch");if(t&&t.length>0)return void e(t);const i=setInterval((()=>{const t=document.getElementsByClassName("jarvis-page-switch");t&&t.length>0&&(clearInterval(i),e(t))}),100)}))}fetchJsonTemplates(e,t=null){return H(this,void 0,void 0,(function*(){if(this.searchPageTemplate)return;const i=`https://cdn.jarvisml.com/templates/${e.hostname.replaceAll(".","-")}-templates.json`,[r,o]=yield Promise.all([fetch(i).then((e=>e.ok?e.json():{})),fetch("https://cdn.jarvisml.com/templates/jarvis-base-templates.json").then((e=>e.ok?e.json():{}))]);let s=null;if(!t&&r.search?s=r:o.search&&(s=o,(0,n.Y_)()),s)return this.searchModalTemplate=s.search["search-modal"],this.searchPageTemplate=s.search["search-page-items"],this.paginationTemplate=s.pagination,this.searchSchema=s.searchSchema,this.templateData=s,s;console.error("Template not found")}))}initPersonalizedSearch(){return H(this,void 0,void 0,(function*(){const e=this.apiRoot.collectedIds;if(!e)return;this.hideSearchModal();const t=document.getElementById("jarvis-personalized-search");yield this.renderDefaultSearchUI(e,t),yield this.loadSearchUI(e,t)}))}}function Z(){}},636:(e,t,i)=>{i.d(t,{h:()=>n});class n{setDate(e,t){e&&t?window.JarvisML&&window.JarvisML.searchFilters&&(window.JarvisML.searchFilters.arrival_date=e,window.JarvisML.searchFilters.departure_date=t):console.log("Error configuring Jarvis ML date filters: Missing arrival or departure date")}setSleeps(e,t=!1){e?t?(window.JarvisML.searchFilters.min_sleeps=e,window.JarvisML.searchFilters.max_sleeps=e,window.JarvisML.searchFilters.sleeps&&delete window.JarvisML.searchFilters.sleeps):(window.JarvisML.searchFilters.sleeps=e,window.JarvisML.searchFilters.min_sleeps&&(delete window.JarvisML.searchFilters.min_sleeps,delete window.JarvisML.searchFilters.max_sleeps)):console.log("Error configuring Jarvis ML filter: Sleeps value is missing")}setBedrooms(e,t=!1){e?(window.JarvisML.searchFilters.min_bedrooms=e,t?window.JarvisML.searchFilters.max_bedrooms=e:window.JarvisML.searchFilters.max_bedrooms&&delete window.JarvisML.searchFilters.max_bedrooms):console.log("Error configuring Jarvis ML filter: Bedrooms value is missing")}setBathrooms(e,t=!1){e?(window.JarvisML.searchFilters.min_bathrooms=e,t?window.JarvisML.searchFilters.max_bathrooms=e:window.JarvisML.searchFilters.max_bathrooms&&delete window.JarvisML.searchFilters.max_bathrooms):console.log("Error configuring Jarvis ML filter: Bathrooms value is missing")}setSortBy(e,t=!0){e?window.JarvisML.searchFilters.sort=t?e:`${e}_desc`:console.log("Error configuring Jarvis ML filter: Sort value is missing")}setFilter(e,t,i=!0){if(!e)return void console.log("Error configuring Jarvis ML filter: No key specified. Examples: location, property_type etc.");if(!t||"object"==typeof t&&!Array.isArray(t))return void console.log(`Error configuring Jarvis ML filter ${e} \n\n Try setting a boolean, string, int or an array like the following examples: \n\n setFilter(key, value, anyOf): anyOf is required if search result must have that filter for sure. \n\n \n setFilter("Heated Pool", true) for setting an amenity or feature that matches \n\n setFilter("city", ["San Francisco", "Tokyo", "Mumbai"]) for setting multiple values \n\n setFilter("lodging", ["Condo", "Townhome"]) - this returns any property that is a condo or townhome \n\n\n `);Array.isArray(t)&&!i&&console.log(`Error configuring Jarvis ML filter ${e}: \n\n Search doesn't return results unless it's any of ${t}. \n\n Setting anyOf as false is not supported if value is an array.`);const n=i?"soft_filters":"hard_filters";window.JarvisML.searchFilters.filter_dict[e]=t,e&&window.JarvisML.searchFilters[n].indexOf(e)<0&&window.JarvisML.searchFilters[n].push(e)}removeFilter(e,t=null){if(!e)return void console.log("Error removing Jarvis ML filter: Please provide a key");if(Array.isArray(window.JarvisML.searchFilters.filter_dict[e])&&t){const i=window.JarvisML.searchFilters.filter_dict[e].filter((e=>e!==t));if(window.JarvisML.searchFilters.filter_dict[e]=i,i.length>0)return}else window.JarvisML.searchFilters.filter_dict[e]&&delete window.JarvisML.searchFilters.filter_dict[e];const i=window.JarvisML.searchFilters.soft_filters.indexOf(e),n=window.JarvisML.searchFilters.hard_filters.indexOf(e);i>=0&&window.JarvisML.searchFilters.soft_filters.splice(i,1),n>=0&&window.JarvisML.searchFilters.hard_filters.splice(n,1)}updateCount(e,t){return t?e+1:e>0?e-1:0}reset(){window.JarvisML.searchFilters.soft_filters=[],window.JarvisML.searchFilters.hard_filters=[],window.JarvisML.searchFilters.filter_dict={}}}},120:(e,t,i)=>{(0,i(63).RL)()},660:(e,t,i)=>{function n(e,t,i){return null!=i&&""!==i?`${e}&${t}=${i}`:e}function r(e,t){const i=e.indexOf(t);if(i<0)return console.error(`removeUrlParam: ${t}?`),e;const n=e.substring(0,i),r=n[i-1];if("&"!==r&&"?"!==r)return console.error(`removeUrlParam: ${e} / ${t}`),e;const o=e.substring(i+t.length);return o?"&"!==o[0]?(console.error(`removeUrlParam: ${e} / ${t}`),e):n+o.substring(1):n.substring(0,i-1)}function o(e,t){const i=new URL(e);return new URLSearchParams(i.search).get(t)}i.d(t,{a3:()=>n,ch:()=>r,eY:()=>o})},25:(e,t,i)=>{i.d(t,{X:()=>r});var n=function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};function r(e,t,i,r=50){return n(this,void 0,void 0,(function*(){if(t())return!0;const n=Date.now();return new Promise((o=>{const s=setInterval((()=>{const r=Boolean(t());!r&&Date.now()-n{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.nc=void 0,i(120),i(63),i(259),i(717),i(575),i(199),i(636),i(128),i(629)})();