1localStorage.getItem("addedtoBasket")&&window?.app_shop?.vars&&(app_shop.vars.addedToBasket=!0),localStorage.removeItem("addedtoBasket");const NumberBySelect=function(t){const{selectClass:e,inputClass:s,wrapperClass:a,generateDropdownCallback:i,afterChangeValue:o,hotspotElement:r,txt:n}=t,l=this;return this.vars={typingTimer:"",doneTypingInterval:500},this.iOS=()=>["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document,this.dropdownNumberAfterClick=t=>{const e=t.querySelector(".f-dropdown-item"),i=t.closest(a),r=i.querySelector(s);e.hasAttribute("data-more")?(i.classList.add("--more"),r.focus(),r.value=""):(i.classList.remove("--more"),r.value=e.getAttribute("data-value")),o&&o(r)},this.generateDropdownCallback=t=>{t?.querySelector("button")?.setAttribute("tabindex",-1),t?.querySelector("button")?.setAttribute("title",n?.["IloÅÄ produktów"]||""),i?.(t)},this.selectDropdownDirection=()=>{const t=r.classList.contains("--add-to-basket-plugin"),e=r.querySelector(".products__wrapper.swiper.swiper-initialized"),s=r.querySelector(".hotspot.--slider_fashion");return t&&!e&&s&&1===app_shop.vars.view?"top":"down"},this.buySelect=()=>new SelectToDropdown({direction:this.selectDropdownDirection(),disableMobileView:!0,selector:`${e}`,generateDropdownCallback:this.generateDropdownCallback||!1,afterClickDropdownCallback:!!this.dropdownNumberAfterClick&&this.dropdownNumberAfterClick}),this.moreInputChange=function(){clearTimeout(l.vars.typingTimer),l.vars.typingTimer=setTimeout((()=>{""!==this.value&&(this.setAttribute("data-prev",this.value),o&&o(this))}),l.vars.doneTypingInterval)},this.moreInputBlur=function(){""===this.value&&(this.value=this.getAttribute("data-prev"))},this.setEvents=()=>{document.querySelectorAll(s).forEach((t=>{t.classList.contains("--initialized")||(t.classList.add("--initialized"),t.addEventListener("keyup",this.moreInputChange),t.addEventListener("blur",this.moreInputBlur))}))},this.init=()=>{this.buySelect(),this.setEvents()},this.init()};class HotspotAddToBasketPlugin extends GetHotspots{constructor(t){super(),this.prefix="--add-to-basket-plugin",this.txt={"Dodano do koszyka":"Dodano do koszyka","Do koszyka":"Do koszyka","Maksymalnie możesz dodaÄ: ":"Maksymalnie możesz dodaÄ: ","Minimalnie możesz dodaÄ: ":"Minimalnie możesz dodaÄ: ",error:"WystÄ
piÅ bÅÄ
d, spróbuj ponownie później",max:"Maksymalnie możesz zamówiÄ","IloÅÄ produktów":"IloÅÄ produktów"},this.params=t||{templateClass:"hotspot_add_to_basket_quantity"}}addToBasketQuery=(t,e,s)=>JSON.stringify({query:`mutation {\n addProductsToBasket(ProductInput: [{ id: ${t}, size: "${e}", quantity: ${s} }]) {\n status\n results {\n status\n error {\n code\n message\n } \n }\n }\n }`});setForms(){this.forms=this.hotspotData?.products.map((t=>this.setForm(t)))}setRedirectToProduct(){const t=this.hotspotElement.querySelector(".hotspot_add_to_basket_link")?.content.cloneNode(!0);return!!t&&(t.querySelector(".add_to_basket__link")?.setAttribute("href",this.activeProductData?.link||""),this.activeTemplate=t,t)}setSelectValues(t){if(isNaN(t))return!1;this.activeTemplate.querySelectorAll("form.add_to_basket select option").forEach(((e,s)=>{if(e.getAttribute("data-more"))return!1;const a=(s+1)*t;e.innerHTML=a,e.setAttribute("value",a)}))}setformValues(){const t=this.activeProductData?.sizes?.reduce(((t,e)=>"disable"!==e?.availability?.status||t),!1);if("product"!==this.activeProductData?.type&&"virtual"!==this.activeProductData?.type||this.activeProductData?.sizes?.length>1)return this.setRedirectToProduct(),!1;if("virtual"===this.activeProductData?.type&&this.activeTemplate.querySelector("form.add_to_basket")?.classList.add("--virtual"),!t)return this.activeTemplate.querySelector("form.add_to_basket")?.classList.add("--disabled"),this.activeTemplate.querySelector("form.add_to_basket")?.setAttribute("aria-hidden","true"),!1;const e=this.activeProductData?.sizes?.find((t=>"disable"!==t.availability?.status)),{sellBy:s}=this.activeProductData?.unit;return super.setHtml('input[name="product"]',!1,[{name:"value",val:this.activeProductData.id||"1"}]),super.setHtml('input[name="size"]',!1,[{name:"value",val:e?.id||"uniw"}]),super.setHtml('input[name="number"]',!1,[{name:"value",val:s||"1"},{name:"data-id",val:this.activeProductData.id||"1"},{name:"data-prev",val:s||"1"}]),this.setSelectValues(parseFloat(s)),!0}numberCheck(t,e){const{quantity:s,amount:a,sellBy:i,singular:o,plural:r,precision:n}=t;if(!s)return 1;const l=parseFloat(n)||1,d=Math.pow(10,l);let u=parseFloat(s)||1;const c=parseFloat(parseFloat(i).toFixed(l))||1,p=parseFloat(a)||-1,h=Math.round(u*d),m=
1Math.round(c*d);if(u=Math.ceil(h/m)*m/d,-1!==p&&u>p){const t=Math.floor(Math.round(p*d)/m)*m/d;return Alertek.show_alert(`${e.max} ${t} ${t>1?r:o}`),t}return u}validateNumber(t,e,s){if("number"!=typeof t)return 1;const a=this.hotspotData?.products.find((t=>t?.id===e)),i=s.dataset,{plural:o,singular:r,sellBy:n,precision:l}=a?.unit||i||{},{amount:d}=a?.sizes?.[0]??i;return this.numberCheck({quantity:t,plural:o,singular:r,sellBy:n,precision:l,amount:d},this.txt)}setStatusHelper(t,e,s){if(!t||!e)return!1;t.classList.add(`--${e}`),t.innerHTML=`<span>${t.getAttribute(`data-${e}`)}</span>`||this.txt["Do koszyka"],s&&Alertek?.["error"===e?"Error":"Success"]?.(s),setTimeout((()=>{t.classList.remove(`--${e}`),t.innerHTML=`<span>${t.getAttribute("data-text")}</span>`||this.txt["Do koszyka"]}),3e3)}async addToBasket(t,e){const s=t.get("product"),a=t.get("size"),i=t.get("number");if(!s||!a||!i)return!1;e.closest("form").classList.add("--loading");const o=this.addToBasketQuery(s,a,i),r=await super.fetchData({data:o,linkParameter:"?addToBasket",tracking:!0});e.closest("form").classList.remove("--loading");const n=r?.data?.addProductsToBasket?.results?.[0]?.status,l=r?.data?.addProductsToBasket?.results?.[0]?.error?.message;if("error"===n)return this.setStatusHelper(e,n,l||this.txt.error),!1;if("success"===n){this.setStatusHelper(e,n),localStorage.setItem("addedtoBasket",!0),app_shop.fn?.menu_basket_cache?.(),app_shop.fn?.basket?.reloadForm?.(null,null,!0);const t=e.closest("form")?.querySelector(".add_to_basket__more_input");if(!t)return!1;const a=this.hotspotData?.products.find((t=>t?.id===+s)),i=t.dataset;return t.value=a?.unit?.sellBy||i?.sellBy||1,!1}this.setStatusHelper(e,"error",this.txt.error)}setEvents(){const t=this.hotspotElement.querySelectorAll(".add_to_basket__button:not(.--initialized)");t.length&&t.forEach((t=>{t.classList.add("--initialized"),t.addEventListener("click",(t=>{t.preventDefault();const e=t.target.closest("form");if(!e)return!1;this.addToBasket(new FormData(e),t.target.closest("button")||t.target)}))})),this.hotspotElement.classList.contains("--initialized")||this.hotspotElement.addEventListener("click",(t=>{const e=this.hotspotElement.querySelector(".add_to_basket__number");e&&(!e.classList.contains("--open")&&t.target.closest(".add_to_basket__number_wrapper")?this.hotspotElement.classList.remove("--dropdown-visible"):this.hotspotElement.classList.add("--dropdown-visible"))}))}changeQuantity=t=>{if(!t||""===t.value)return!1;t.value=this.validateNumber(parseFloat(t.value),parseFloat(t.getAttribute("data-id")),t)};getFormTemplate(){const t=this.hotspotElement.querySelector(this.params.templateClass)?.content.cloneNode(!0);return!!t&&(this.activeTemplate=t,this.setformValues(),this.attachPluginClass(),this.activeTemplate)}setForm(t){if(!t)return!1;this.activeProductData=t;const e=this.getFormTemplate(),s=this.hotspotTemplate?.querySelector(`.product[data-id="${t?.id}"] .product__content_wrapper`);return!(!s||!e)&&(s.append(e),{productData:t,formElement:e})}attachPluginClass(){this.hotspotElement?.classList?.add(this.prefix)}async init(t){const[e,s,a]=t;this.hotspotData=e,this.hotspotTemplate=s,this.hotspotElement=a,this.setForms()}initAfterAppend(){this.numberBySelect=new NumberBySelect({selectClass:`#${this.hotspotElement?.id} .add_to_basket__number:not(.f-dropdown)`,inputClass:`#${this.hotspotElement?.id} .add_to_basket__more_input`,wrapperClass:`#${this.hotspotElement?.id} .add_to_basket__number_wrapper`,afterChangeValue:this.changeQuantity,hotspotElement:this.hotspotElement,txt:this.txt}),this.setEvents()}}app_shop.vars.additionalHotspotQueryObj.sizesAddToBasket="\nproducts {\n type\n unit {\n singular\n plural\n sellBy\n\t\tprecision\n }\n sizes {\n id\n name\n amount\n availability {\n status\n }\n }\n}\n",app_shop.vars.hotspotCallbacksBeforeAppend.addToBasket=async(...t)=>{const[e,s,a]=t;app_shop.fn[a?.id||"hotspot"]=new HotspotAddToBasketPlugin({templateClass:".hotspot_add_to_basket"}),await(app_shop.fn[a?.id||"hotspot"]?.init?.(t))},app_shop.vars.hotspotCallbacksAfterAppend.addToBasket=async(...t)=>{const[e,s,a]=t;app_shop.fn[a?.id||"hotspot"]?.initAfterAppend?.(t)};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.