AlkantarClanX12

Your IP : 216.73.217.24


Current Path : /www/capitalgmcbuickregina_830/public/wp-content/themes/lbx-egypt/public/scripts/isolated/
Upload File :
Current File : /www/capitalgmcbuickregina_830/public/wp-content/themes/lbx-egypt/public/scripts/isolated/lineup.js

"use strict";(self.webpackChunksage=self.webpackChunksage||[]).push([[5044],{1618:function(e,t,r){var o=r(1451),n=r(4942),i=r(1002);function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){(0,n.Z)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return c(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var o=0,n=function(){};return{s:n,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw i}}}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}var u=window.GraphqlData,f={props:["makeByDefault","selectedCategory","makes","colorizerOrientation","excludedModelsOption","lang","graphqlEndpoint","excludedCategories","modelOrder","categoryOrder"],data:function(){return{vehicles:[],categories:[],categorySelected:this.selectedCategory||"All",selectedMake:this.makeByDefault||null,makesSelector:[],hasData:!0,firstLoad:!1}},created:function(){},mounted:function(){if(this.makes){this.makesSelector=this.makes.split(","),this.makesSelector=this.makesSelector.map((function(e){return{make:e.toLowerCase(),imageUrl:"".concat("https://v5websitescdn.blob.core.windows.net/v5cdn/components/makes/").concat(e.toLowerCase(),".png")}}))}if(this.selectedMake){var e="all"==this.selectedCategory.toLowerCase();this.getData(this.selectedMake,e)}},methods:{selectCategory:function(e){this.categorySelected=e,jQuery(".line-up-6__models-section").css({visibility:"invisible",opacity:0}),setTimeout((function(){jQuery(".line-up-6__models-section").slick("slickUnfilter"),"All"!=e&&jQuery(".line-up-6__models-section").slick("slickFilter",".".concat(e.replace(/ /g,"").replace(/&/g,"").toLowerCase())),jQuery(".line-up-6__models-section").slick("refresh"),jQuery(".line-up-6__models-section").css({visibility:"visible",opacity:1,"transition-delay":"0s"})}),400)},selectMake:function(e){e!=this.selectedMake&&e&&(this.categorySelected="All",this.vehicles=null,this.selectedMake=e,this.getData(e,!0))},getData:function(e,t){var r=this,o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n="vehicles_".concat(e),i=sessionStorage.getItem(n);i&&!o?(this.vehicles=null,setTimeout((function(){r.vehicles=JSON.parse(i),r.processVehicles(t)}),200)):i||u.authenticateAndFetchData(e,"lineup",null,null,this.graphqlEndpoint).then((function(e){sessionStorage.setItem(n,JSON.stringify(e)),o||(r.vehicles=e,r.processVehicles(t))})).catch((function(e){console.error("Error:",e.message)}))},processVehicles:function(e){var t=this;this.excludedModelsOption&&(this.vehicles=this.vehicles.filter((function(e){var r="".concat(e.modelData.year," ").concat(e.modelData.model.toLowerCase());return!t.excludedModelsOption.map((function(e){return e.toLowerCase()})).includes(r)}))),this.vehicles.forEach((function(e){var r,o,n,a,l,c,u,f=null;if(t.colorizerOrientation&&(null==e||null===(r=e.modelData)||void 0===r||null===(o=r.colorizer)||void 0===o?void 0:o.length)>0){var d,h=s(e.modelData.colorizer);try{for(h.s();!(d=h.n()).done;){var p=d.value;if(p.images&&p.images.length>0){var m,g=s(p.images);try{for(g.s();!(m=g.n()).done;){var y=m.value;if(y.imageType===t.colorizerOrientation){f=y.image||y.url;break}}}catch(e){g.e(e)}finally{g.f()}if(f)break}}}catch(e){h.e(e)}finally{h.f()}}f||(f=(null===(n=e.modelData.jellybean)||void 0===n?void 0:n.sourceUrl)||(null===(a=e.modelData.colorizer[0])||void 0===a||null===(l=a.images[0])||void 0===l?void 0:l.image)||(null===(c=e.modelData.colorizer[0])||void 0===c||null===(u=c.images[0])||void 0===u?void 0:u.url));"object"===(0,i.Z)(f)&&f.sourceUrl&&(f=f.sourceUrl),e.modelData.mainImage=f,e.modelData.slug="".concat("en-CA"==t.lang?"/new":"/neufs","/").concat(e.modelData.year,"-").concat(e.modelData.make.toLowerCase().replace(/ /g,"-"),"-").concat(e.modelData.model.toLowerCase().replace(/ /g,"-"),"/")})),this.vehicles=this.vehicles.map((function(e){return l(l({},e),{},{loading:!0,error:!1})})),this.hasData=this.vehicles.length>0;var r={};this.vehicles.forEach((function(e){r[e.modelData.category]||(r[e.modelData.category]=1)}));var n=(r=Object.keys(r)).reduce((function(e,t){return e.concat(t.split(",").map((function(e){return e.trim()})))}),[]),a=(0,o.Z)(new Set(n));if(a.length>1&&a.unshift("All"),this.categoryOrder&&this.categoryOrder.length>0){var c=this.categoryOrder.map((function(e){return e.toLowerCase()})),u=new Map(c.map((function(e,t){return[e,t]})));a.sort((function(e,t){var r=e.toLowerCase(),o=t.toLowerCase(),n=u.has(r),i=u.has(o);return n&&!i?-1:!n&&i?1:n&&i?u.get(r)-u.get(o):r.localeCompare(o)}))}if(this.categories=a,setTimeout((function(){var r=jQuery(".line-up-6__models-section");r.hasClass("slick-initialized")?r.slick("refresh"):r.slick({dots:!1,arrows:!0,prevArrow:'<button class="slick-prev-egypt slick-arrow" aria-label="Next" type="button" aria-disabled="false"><svg width="36" height="36" viewBox="0 0 36 36" class="fill-current text-primary" xmlns="http://www.w3.org/2000/svg"><g filter="url(#filter0_d_689_818)"><circle cx="18" cy="16" r="16" fill="white"/></g><path d="M12 28L28 16L12 4L12 8L23 16L12 24L12 28Z"/><defs><filter id="filter0_d_689_818" x="0" y="0" width="36" height="36" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="2"/><feGaussianBlur stdDeviation="1"/><feComposite in2="hardAlpha" operator="out"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_689_818"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_689_818" result="shape"/></filter></defs></svg></button>',nextArrow:'<button class="slick-next-egypt slick-arrow" aria-label="Next" type="button" aria-disabled="false"><svg width="36" height="36" viewBox="0 0 36 36" class="fill-current text-primary" xmlns="http://www.w3.org/2000/svg"><g filter="url(#filter0_d_689_818)"><circle cx="18" cy="16" r="16" fill="white"/></g><path d="M12 28L28 16L12 4L12 8L23 16L12 24L12 28Z"/><defs><filter id="filter0_d_689_818" x="0" y="0" width="36" height="36" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="2"/><feGaussianBlur stdDeviation="1"/><feComposite in2="hardAlpha" operator="out"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_689_818"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_689_818" result="shape"/></filter></defs></svg></button>',infinite:!1,speed:500,slidesToShow:4,slidesToScroll:4,initialSlide:0,responsive:[{breakpoint:1536,settings:{slidesToShow:3,slidesToScroll:3}},{breakpoint:1024,settings:{slidesToShow:2,slidesToScroll:2}},{breakpoint:640,settings:{slidesToShow:1,slidesToScroll:1}}]}),r.slick("slickUnfilter"),e||r.slick("slickFilter",".".concat(t.categorySelected.replace(/ /g,"").replace(/&/g,"").toLowerCase())),r.css({visibility:"visible",opacity:1,"transition-delay":"0s"}),t.firstLoad=!0}),50),this.modelOrder&&this.modelOrder.length>0){var f=this.modelOrder.map((function(e){return e.toLowerCase()})),d=new Map(f.map((function(e,t){return[e,t]})));this.vehicles.sort((function(e,t){var r=e.modelData.model.toLowerCase(),o=t.modelData.model.toLowerCase(),n=d.has(r),i=d.has(o);return n&&!i?-1:!n&&i?1:n&&i?d.get(r)-d.get(o):r.localeCompare(o)}))}},getClassList:function(e){var t="line-up-6__models-section__model text-center";return e.forEach((function(e){t+=" ".concat(e.replace(/ /g,"").replace(/&/g,"").toLowerCase())})),t},isMoreThanZero:function(e){return e.length>0},isMoreThanOne:function(e){return e.length>1},onLoad:function(e){this.vehicles[e].loading=!1},onError:function(e){this.vehicles[e].loading=!1,this.vehicles[e].error=!0},loadingTemplate:function(){return'\n        <div role="status" class="flex justify-center items-center">\n          <svg aria-hidden="true" class="mr-2 w-8 h-8 text-gray-200 animate-spin"\n            viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">\n            <path\n              d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"\n              fill="currentColor" />\n            <path class="fill-current text-primary"\n              d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"\n              fill="none" />\n          </svg>\n        </div>\n        <span class="flex justify-center items-center font-primary-bold loading-text">'.concat("en-CA"==this.lang?"Loading":"Chargement","...</span>")}},watch:{firstLoad:function(e){var t=this;e&&this.makes&&this.makes.split(",").forEach((function(e){e.toLowerCase()!=t.selectedMake&&t.getData(e.toLowerCase(),!1,!0)}))}},filters:{moneyFormat:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=new Intl.NumberFormat(t,{style:"currency",currency:"CAD",minimumFractionDigits:r});return 0!=r?o.format(e):o.format(Math.floor(e))}}};Vue.component("lineup",f)},907:function(e,t,r){function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}r.d(t,{Z:function(){return o}})},4942:function(e,t,r){function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.d(t,{Z:function(){return o}})},1451:function(e,t,r){r.d(t,{Z:function(){return i}});var o=r(907);var n=r(181);function i(e){return function(e){if(Array.isArray(e))return(0,o.Z)(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||(0,n.Z)(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},1002:function(e,t,r){function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}r.d(t,{Z:function(){return o}})},181:function(e,t,r){r.d(t,{Z:function(){return n}});var o=r(907);function n(e,t){if(e){if("string"==typeof e)return(0,o.Z)(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?(0,o.Z)(e,t):void 0}}}},function(e){var t;t=1618,e(e.s=t)}]);
//# sourceMappingURL=lineup.js.map