!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1fb2cfb7-8dca-4018-9c9d-1b48adb4a418",e._sentryDebugIdIdentifier="sentry-dbid-1fb2cfb7-8dca-4018-9c9d-1b48adb4a418")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1260],{27866:function(e,t,n){n.d(t,{E:function(){return a},FS:function(){return u},Hg:function(){return l},Jq:function(){return p},NY:function(){return s},RB:function(){return f},WU:function(){return d},a:function(){return m},jN:function(){return _},le:function(){return w},zO:function(){return g}});var r=n(14587);function o(e,t){let n=t.find(t=>!!t&&!!t.name&&t.name.toString().toLowerCase()===e.toLowerCase());return n?n.hex:e}function i(e){return e&&e.length?e.filter(e=>e).map(e=>{let t=e.directus_files_id;return t?(0,r.TI)(t.id):null}):[]}function a(e,t){if(!e||!t)return[];let n=e?e.map(e=>({color:e.product_color,size:e.size})).filter(e=>e.color):[];return(n?n.filter((e,t,n)=>t===n.findIndex(t=>{var n,r;return(null===(n=t.color)||void 0===n?void 0:n.toLowerCase())===(null===(r=e.color)||void 0===r?void 0:r.toLowerCase())})):[]).map(e=>{if(!e.color)return null;let n=e.color.split("/"),r=[o(n[0],t)];if(2===n.length){let e=o(n[1],t);r.push(e)}return{...e,colors:r||[],isSelected:!0}}).filter(e=>e)}function u(e){let{items:t,params:n}=e,{priceField:o,currency:u,languageCode:d,subFolder:l,productSlug:c,colors:s}=n;return t.map(e=>{let t=e[o]?e[o].split("-").map(e=>(0,r.xG)({amount:e,currency:u,languageCode:d})).join(" - "):null,n="/".concat(l,"/").concat(c,"/").concat(e.product_slug,"/"),m=i(e.product_images),p=i(e.hover_pictures),w=i(e.feature_1_images),g=i(e.feature_2_images),_=a(e.product_variants,s);return{title:null==e?void 0:e.product_name,price:t,status:null==e?void 0:e.status,description:null==e?void 0:e.product_description,label:null==e?void 0:e.label,slug:n,image:m.length?m[0]:"",settingImage:p.length?p[0]:w.length?w[0]:g.length?g[0]:m[0],categoryName:e.category_reference?e.category_reference.category_name:"No Category",variants:_,display_split_images:!0}})}function d(e,t){let n=e.translations?e.translations.find(e=>{var n;return!!e&&(null===(n=e.languages_code)||void 0===n?void 0:n.code)===t}):null;return n?{...e,...c(n)}:e}function l(e,t){return e.map(e=>{let n=e.translations?e.translations.find(e=>{var n;return!!e&&(null===(n=e.languages_code)||void 0===n?void 0:n.code)===t}):null;return n?{...e,...c(n)}:e})}function c(e){let t={};return Object.values(e).forEach((n,r)=>{n&&(t[Object.keys(e)[r]]=n)}),t}function s(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"no",r={...e};if(!t)return null;let o=e.countries_header?e.countries_header.find(e=>{let n=e?null==e?void 0:e.countries:[];return!!n&&n.find(e=>!!e&&e.iso_31661===t)}):null;if(o){let{translations:e=[],...t}={...o,main_image:o.image},i=c(t);delete i.id;let a={...i},u={};if(e&&e.length>0){let t=e?e.find(e=>{var t;return(null==e?void 0:null===(t=e.languages_code)||void 0===t?void 0:t.code)===n}):null;t&&(delete t.languages_code,u=c({...t}))}r={...r,...a,...u}}return r}function m(e,t,n){let r={...e};if(!t)return r;let o=e&&e.countries?e.countries.find(e=>!!e&&!!e.countries&&e.countries.find(e=>!!e&&e.iso_31661===t)):null;if(o){let{translations:e=[],...t}={...o},i=c(t);delete i.id;let a={...i},u={};if(e&&e.length>0){let t=e?e.find(e=>{var t;return(null==e?void 0:null===(t=e.languages_code)||void 0===t?void 0:t.code)===n}):null;t&&(delete t.languages_code,u=c({...t}))}r={...r,...a,...u}}return r}function p(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"no";return e.map(e=>{let n=e.translations?e.translations.find(e=>!!e&&e.core_value_language_code===t):null;return n?{...e,...c(n)}:e}).map(e=>{var t,n,o,i;return{id:e.id,title:e.core_value_title,message:e.core_value_message,img:(0,r.TI)(null!==(o=null===(t=e.icon)||void 0===t?void 0:t.id)&&void 0!==o?o:"",{width:"200"}),icon:(0,r.TI)(null!==(i=null===(n=e.overlay_icon)||void 0===n?void 0:n.id)&&void 0!==i?i:"",{width:"200"})}})}function w(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"nb",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"no";return l(e,n).map(e=>{let n="/".concat(t,"/").concat(e.product_category_slug);return{id:e&&e.id?e.id.toString():"",name:e.category_name||"",slug:n,icon:e.icon?(0,r.TI)(e.icon.id,{width:"300"}):""}})}function g(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"no";return e.map(e=>{let n=e.translations?e.translations.find(e=>{var n;return!!e&&(null===(n=e.languages_code)||void 0===n?void 0:n.code)===t}):null;return n?{...e,...c(n)}:e}).map(e=>{var t,n,o,i,a,u,d,l;let c="",s="",m=e.mode?"dark":"light",p=null==e?void 0:e.box_template,w=null==e?void 0:e.box_template_2;p&&p.name&&(c=p.name.toString().toLowerCase().replace(" ","_").replace(" ","")),w&&w.name&&(s=w.name.toString().toLowerCase().replace(" ","_").replace(" ",""));let g=null==e?void 0:e.product,_=null==e?void 0:e.product_2;return{product_name:(null==e?void 0:e.product)?g.product_name:"",product_name_2:(null==e?void 0:e.product_2)?null==_?void 0:_.product_name:"",title:null==e?void 0:e.campaign_title,title_2:null==e?void 0:e.campaign_title_2,button_text:null==e?void 0:e.campaign_button_text,button_url:null==e?void 0:e.button_url,button_text_2:null==e?void 0:e.campaign_button_text_2,button_url_2:null==e?void 0:e.button_url_2,text:null==e?void 0:e.text,text_2:null==e?void 0:e.text_2,big_text:null==e?void 0:e.big_text,big_text_2:null==e?void 0:e.big_text_2,type:null==e?void 0:e.type,mode:m,box_type:c,box_type_2:s,slug:null==g?void 0:g.slug,slug_2:null==_?void 0:_.slug,box_small_image:(0,r.TI)(null==e?void 0:null===(t=e.box_small_image)||void 0===t?void 0:t.id,{width:"800"}),box_medium_image:(0,r.TI)(null==e?void 0:null===(n=e.box_medium_image)||void 0===n?void 0:n.id,{width:"800"}),box_large_image:(0,r.TI)(null==e?void 0:null===(o=e.box_large_image)||void 0===o?void 0:o.id,{width:"800"}),box_main_image:(0,r.TI)(null==e?void 0:null===(i=e.box_main_image)||void 0===i?void 0:i.id,{width:"800"}),box_small_image_2:(0,r.TI)(null==e?void 0:null===(a=e.box_small_image_2)||void 0===a?void 0:a.id,{width:"800"}),box_medium_image_2:(0,r.TI)(null==e?void 0:null===(u=e.box_medium_image_2)||void 0===u?void 0:u.id,{width:"800"}),box_large_image_2:(0,r.TI)(null==e?void 0:null===(d=e.box_large_image_2)||void 0===d?void 0:d.id,{width:"800"}),box_main_image_2:(0,r.TI)(null==e?void 0:null===(l=e.box_main_image_2)||void 0===l?void 0:l.id,{width:"800"})}})}function _(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"no",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"nb";return e.map(e=>{let t=e.translations?e.translations.find(e=>!!e&&e.language_code===n):null;return t?{...e,...t}:e}).map(e=>{var n;let o=null===(n=e.image)||void 0===n?void 0:n.id;return{title:null==e?void 0:e.name,image:(0,r.TI)(o||"",{width:"500"}),settingImage:(0,r.TI)(o||"",{width:"500"}),btnText:"Shop now",slug:"/".concat(t,"/").concat(null==e?void 0:e.slug),price:""}})}function f(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"no";return e.map(e=>{let t=e.translations?e.translations.find(e=>!!e&&e.info_language_code===n):null;return t?{...e,...t}:e}).map(e=>{var n;return{to:"/".concat(t,"/").concat(null==e?void 0:e.destination_url),title:(null==e?void 0:e.title)||"",image:(0,r.TI)((null==e?void 0:null===(n=e.image)||void 0===n?void 0:n.id)||"",{width:"500"}),text:(null==e?void 0:e.info_block_message)||""}})}},72310:function(e,t,n){n.d(t,{Z:function(){return E},j:function(){return L}});var r=n(57437),o=n(2265),i=n(93484),a=n(88357),u=n(64131),d=n(95106),l=n(39098),c=n(29013);async function s(e){let{marketId:t,shippingCountry:n,locale:r}=e;if(!t)throw Error("No market Id provided");let o=(0,c.rI)({marketId:t,countryCode:n});if(o){let e=await w({orderId:o,marketId:t});if(e&&["draft","pending"].includes(e.attributes.status))return e;(0,c.m2)(n,t)}return v({marketId:t,shippingCountry:n,locale:r})}let m=["cart_url","checkout_url","country_code","coupon_code","currency_code","customer_email","guest","language_code","line_items","metadata","number","reference_origin","reference","return_url","shipping_country_code_lock","skus_count","status","subtotal_amount_cents","terms_url","total_amount_with_taxes_cents"],p=["sku_code","quantity","formatted_total_amount","unit_amount_cents","metadata","name","image_url","item_type","item"];async function w(e){let{orderId:t,marketId:n}=e;try{var r;let e=await (0,l.h)(n),o=await fetch("".concat("https://non-stop-dogwear.commercelayer.io","/api/orders/").concat(t,"?fields[orders]=").concat(m.join(","),"&fields[line_items]=").concat(p.join(","),"&include=line_items,line_items.item"),{headers:{Authorization:"Bearer ".concat(e)}});if(!o.ok)throw Error("Error fetching order");let i=await o.json(),a=i.included?(r=i.included.filter(e=>"line_items"===e.type||"skus"===e.type)).filter(e=>"line_items"===e.type).filter(e=>"skus"===e.relationships.item.data.type).map(e=>{let t=r.find(t=>t.id===e.relationships.item.data.id),n={...e};return n.inventory=t&&"skus"===t.type?t.attributes.inventory.quantity:1,n}):[];return{...i.data,lineItems:a}}catch(e){console.warn("Error fetching order, creating a new one...");return}}function g(){let e=localStorage.getItem("recommended_size")||"";try{return e?JSON.parse(e):void 0}catch(e){return}}function _(){return{referrer:sessionStorage.getItem("referrer")||"",utm_medium:sessionStorage.getItem("utm_medium")||"",utm_source:sessionStorage.getItem("utm_source")||"",utm_content:sessionStorage.getItem("utm_content")||"",utm_campaign:sessionStorage.getItem("utm_campaign")||""}}function f(){let e={},t=decodeURIComponent(u.Z.get("rmStoreGateway"));if(!t)return e;let n=t.split("|").find(e=>"atrv"===e.split(":")[0]);return n?e={siteID:null==n?void 0:n.split(":")[1],dateAdded:d.ou.now().toFormat("yyyy-LL-dd")}:e}async function v(e){let{marketId:t,shippingCountry:n,locale:r}=e,o=await (0,l.h)(t),i=await fetch("".concat("https://non-stop-dogwear.commercelayer.io","/api/orders/"),{method:"POST",headers:{Authorization:"Bearer ".concat(o),"Content-Type":"application/vnd.api+json"},body:JSON.stringify({data:{type:"orders",attributes:{shipping_country_code_lock:n,freight_taxable:!0,language_code:r.languageCode,cart_url:r.cartUrl,return_url:r.returnUrl,privacy_url:r.privacyUrl,terms_url:r.termsUrl,metadata:{userAgent:navigator.userAgent,sources:[_()],recommendedSize:[g()],...f()}}}})}),a=await i.json();return(0,c.Nu)(n,a.data.id,t),sessionStorage.setItem("addedTrafficSource","true"),{...a.data,lineItems:[]}}async function h(e){let{marketId:t,orderId:n,attributes:r}=e,o=await (0,l.h)(t);try{await fetch("".concat("https://non-stop-dogwear.commercelayer.io","/api/orders/").concat(n),{method:"PATCH",headers:{Authorization:"Bearer ".concat(o),"Content-Type":"application/vnd.api+json"},body:JSON.stringify({data:{id:n,type:"orders",attributes:r}})})}catch(e){console.warn("Error updating order")}return w({orderId:n,marketId:t})}async function y(e){let{marketId:t,orderId:n}=e,r=await (0,l.h)(t),o=await fetch("".concat("https://non-stop-dogwear.commercelayer.io","/api/orders/").concat(n,"?fields[orders]=metadata"),{headers:{Authorization:"Bearer ".concat(r)}});return(await o.json()).data.attributes.metadata.sources||[]}async function I(e){let{marketId:t,orderId:n}=e;if(t&&"true"!==sessionStorage.getItem("addedTrafficSource")){let e=await y({marketId:t,orderId:n});Array.isArray(e)||(e=[]),e.push(_()),await h({marketId:t,orderId:n,attributes:{metadata:{sources:e,recommendedSize:[g()]}}}),sessionStorage.setItem("addedTrafficSource","true")}}async function b(e){let{marketId:t,orderId:n,sku:r,metadata:o}=e;if(!t)throw Error("No market Id for line item");let i=await (0,l.h)(t),a={data:{type:"line_items",attributes:{sku_code:r,quantity:1,metadata:o},relationships:{order:{data:{type:"orders",id:n,attributes:{metadata:{recommendedSize:[g()]}}}}}}};if(!(await fetch("".concat("https://non-stop-dogwear.commercelayer.io","/api/line_items/"),{method:"POST",headers:{Authorization:"Bearer ".concat(i),"Content-Type":"application/vnd.api+json"},body:JSON.stringify(a)})).ok)throw Error("Failed to create line item");return w({orderId:n,marketId:t})}async function C(e){let{id:t,marketId:n,orderId:r}=e;if(!n)throw Error("No market Id for line item");let o=await (0,l.h)(n);if(!(await fetch("".concat("https://non-stop-dogwear.commercelayer.io","/api/line_items/").concat(t),{method:"DELETE",headers:{Authorization:"Bearer ".concat(o),"Content-Type":"application/vnd.api+json"}})).ok)throw Error("Failed to delete line item");return w({orderId:r,marketId:n})}async function S(e){let{id:t,marketId:n,orderId:r,quantity:o}=e;if(!n)throw Error("No market Id for line item");let i=await (0,l.h)(n);try{if(!(await fetch("".concat("https://non-stop-dogwear.commercelayer.io","/api/line_items/").concat(t),{method:"PATCH",headers:{Authorization:"Bearer ".concat(i),"Content-Type":"application/vnd.api+json"},body:JSON.stringify({data:{id:t,type:"line_items",attributes:{quantity:o}}})})).ok)throw Error("Failed to update line item")}catch(e){}finally{return w({orderId:r,marketId:n})}}let k={CH:{name:"Switzerland",marketId:"qoLdBhRBzo",countryCode:"CH",availableShippingCountries:["CH"],shippingCost:"14.9",freeShippingMinimum:"60",cartUrl:"https://www.nonstopdogwear.com/de/",returnUrl:"https://www.nonstopdogwear.com/de/products/",privacyUrl:"https://www.nonstopdogwear.com/de/privacy/",termsUrl:"https://www.nonstopdogwear.com/de/terms/",priceField:"switzerland_chf",currency:"CHF"},DK:{name:"Denmark",marketId:"ElJGehrnao",countryCode:"DK",availableShippingCountries:["DK","GL"],shippingCost:"129",freeShippingMinimum:"450",cartUrl:"https://www.nonstopdogwear.com/en/",returnUrl:"https://www.nonstopdogwear.com/en/products/",privacyUrl:"https://www.nonstopdogwear.com/en/privacy/",termsUrl:"https://www.nonstopdogwear.com/en/terms/",priceField:"denmark_dkk",currency:"DKK"},DE:{name:"Germany",marketId:"XjBdyheyDl",countryCode:"",availableShippingCountries:["DE"],shippingCost:"14.9",freeShippingMinimum:"60",cartUrl:"https://www.nonstopdogwear.com/en/",returnUrl:"https://www.nonstopdogwear.com/en/products/",privacyUrl:"https://www.nonstopdogwear.com/en/privacy/",termsUrl:"https://www.nonstopdogwear.com/en/terms/",priceField:"europe_eur",currency:"EUR"},EU:{name:"Europe",marketId:"rlEPzhVzGg",countryCode:"",availableShippingCountries:["AT","BE","BG","CY","CZ","EE","ES","FR","GR","HR","HU","IE","IT","LT","LU","LV","MT","NL","PL","PT","RO","SI","SK"],shippingCost:"14.9",freeShippingMinimum:"60",cartUrl:"https://www.nonstopdogwear.com/en/",returnUrl:"https://www.nonstopdogwear.com/en/products/",privacyUrl:"https://www.nonstopdogwear.com/en/privacy/",termsUrl:"https://www.nonstopdogwear.com/en/terms/",priceField:"europe_eur",currency:"EUR"},FI:{name:"Finland",marketId:"GoeMQhnJBo",countryCode:"FI",availableShippingCountries:["FI"],shippingCost:"14.9",freeShippingMinimum:"60",cartUrl:"https://www.nonstopdogwear.com/fi/",returnUrl:"https://www.nonstopdogwear.com/fi/tuotteet/",privacyUrl:"https://www.nonstopdogwear.com/fi/yksityisyydensuojakayntanto/",termsUrl:"https://www.nonstopdogwear.com/fi/ostoehdot/",priceField:"finland_eur",currency:"EUR"},INT:{name:"International",marketId:"KoaJYhPDEj",countryCode:"",availableShippingCountries:["AF","DZ","AS","AO","AI","AQ","AG","AR","AM","AW","AU","AZ","BS","BH","BD","BB","BZ","BJ","BM","BT","BO","BW","BV","BR","IO","BN","BF","BI","KH","CM","CA","CV","KY","CF","TD","CL","CN","CX","CC","CO","KM","CG","CK","CR","CU","DJ","DM","DO","TP","EC","EG","SV","GQ","ER","ET","FK","FO","FJ","PF","GA","GM","GE","GH","GD","GU","GT","GN","GW","GY","HT","HM","HN","HK","IN","ID","IR","IQ","IL","CI","JM","JP","JO","KZ","KE","KI","KW","KG","LA","LB","LS","LR","LY","LI","MO","MK","MG","MW","MY","MV","ML","MH","MR","MU","MX","FM","MN","MS","MA","MZ","MM","NA","NR","NP","AN","NZ","NI","NE","NG","NU","NF","KP","MP","OM","PK","PW","PS","PA","PG","PY","PE","PH","PN","PR","QA","RW","SH","KN","LC","PM","VC","WS","ST","SA","SN","SC","SL","SG","SB","SO","ZA","GS","KR","SS","LK","SD","SR","SJ","SZ","SY","TJ","TZ","TH","CD","TG","TK","TO","TT","TN","TR","TM","TC","TV","TW","UG","UA","AE","UM","UY","UZ","VU","VE","VN","VG","VI","WF","EH","YE","YU","ZM","ZW","RU","AD","AL","AX","BA","BY","IS","MC","MD","ME","RS","SM","SX","VA","GF","GP","MF","MQ","NC","RE","TF","YT"],recommendedCountries:["BR","AF","DZ","AS","AO","AI","AQ","AG","AM","AW","AU","AZ","BS","BH","BD","BB","BZ","BJ","BM","BT","BW","BV","IO","BN","BF","BI","KH","CM","CA","CV","KY","CF","TD","CN","CX","CC","KM","CG","CK","CR","DJ","DM","TP","EG","ER","ET","FK","FO","FJ","PF","GA","GM","GE","GH","GD","GU","GN","GW","GY","HT","HM","HN","HK","IN","ID","IR","IQ","IL","CI","JM","JP","JO","KZ","KE","KI","KW","KG","LA","LB","LS","LR","LY","LI","MO","MK","MG","MW","MY","MV","ML","MH","MR","MU","FM","MN","MS","MA","MZ","MM","NA","NR","NP","AN","NZ","NI","NE","NG","NU","NF","KP","MP","OM","PK","PW","PS","PG","PH","PN","PR","QA","RW","SH","KN","LC","PM","VC","WS","ST","SA","SN","SC","SL","SG","SB","SO","ZA","GS","KR","SS","LK","SD","SR","SJ","SZ","SY","TJ","TZ","TH","CD","TG","TK","TO","TT","TN","TR","TM","TC","TV","TW","UG","UA","AE","UM","UY","UZ","VU","VN","VG","VI","WF","EH","YE","YU","ZM","ZW","RU"],shippingCost:"14.9",freeShippingMinimum:"60",cartUrl:"https://www.nonstopdogwear.com/en/",returnUrl:"https://www.nonstopdogwear.com/en/products/",privacyUrl:"https://www.nonstopdogwear.com/en/privacy/",termsUrl:"https://www.nonstopdogwear.com/en/terms/",priceField:"international_usd",currency:"USD"},NO:{name:"Norway",marketId:"vlGRmhdJWg",countryCode:"NO",availableShippingCountries:["NO"],shippingCost:"99",freeShippingMinimum:"500",cartUrl:"https://www.nonstopdogwear.com/no/",returnUrl:"https://www.nonstopdogwear.com/no/produkter/",privacyUrl:"https://www.nonstopdogwear.com/no/personvernerklaering/",termsUrl:"https://www.nonstopdogwear.com/no/kjopsbetingelser/",priceField:"norway_nok",currency:"NOK"},SE:{name:"Sweden",iconName:"se",subFolder:"se",marketId:"XlBdyhaLGj",countryCode:"SE",availableShippingCountries:["SE"],shippingCost:"149",freeShippingMinimum:"600",cartUrl:"https://www.nonstopdogwear.com/se/",returnUrl:"https://www.nonstopdogwear.com/se/produkter/",privacyUrl:"https://www.nonstopdogwear.com/se/integritetsforklaring/",termsUrl:"https://www.nonstopdogwear.com/se/kopvillkor/",priceField:"sweden_sek",currency:"SEK"},UK:{name:"United Kingdom",marketId:"EjJGehrQVg",countryCode:"",availableShippingCountries:["GB","GG","GI","IM","JE"],shippingCost:"14.9",freeShippingMinimum:"50",cartUrl:"https://www.nonstopdogwear.com/en/",returnUrl:"https://www.nonstopdogwear.com/en/products/",privacyUrl:"https://www.nonstopdogwear.com/en/privacy/",termsUrl:"https://www.nonstopdogwear.com/en/terms/",priceField:"united_kingdom_gbp",currency:"GBP"},USA:{name:"United States",marketId:"DomJOhJXEj",countryCode:"",availableShippingCountries:["US"],recommendedCountries:[],shippingCost:"14.9",freeShippingMinimum:"60",cartUrl:"https://www.nonstopdogwear.com/en/",returnUrl:"https://www.nonstopdogwear.com/en/products/",privacyUrl:"https://www.nonstopdogwear.com/en/privacy/",termsUrl:"https://www.nonstopdogwear.com/en/terms/",priceField:"international_usd",currency:"USD"}};async function T(e){return new Promise(t=>setTimeout(t,1e3*e))}async function U(){let e=sessionStorage.getItem("countryCode");if(e&&"undefined"!==e)return e;try{let e=await fetch("https://pro.ip-api.com/json?key=".concat("wboJhYeVOQoDHrR")),t=await e.json();return t.countryCode&&sessionStorage.setItem("countryCode",t.countryCode),t.countryCode}catch(e){return console.error(e),sessionStorage.setItem("countryCode","NO"),"NO"}}var x=n(14587);let M=o.createContext(void 0);function E(e){let{locale:t,children:n}=e,u=!!(0,x.jU)()&&!!localStorage&&JSON.parse(localStorage.getItem("wantsImperialSystem")||"false"),[d,l]=(0,o.useState)(),[m,p]=(0,o.useState)(!1),[_,v]=(0,o.useState)(k.NO),[y,E]=(0,o.useState)("NO"),[L,N]=(0,o.useState)(void 0),[A,G]=(0,o.useState)(u||!1),[F,P]=(0,o.useState)(!1);function B(e){return d?d.lineItems.findIndex(t=>t.attributes.sku_code===e):-1}async function R(e){let{name:n,sku:r,imageUrl:o,productReference:i}=e,a=d?{...d}:await s({marketId:_.marketId,shippingCountry:y,locale:t});a&&!a.lineItems&&(a.lineItems=[]),p(!0);let u=B(r);if(u>-1&&a)a.lineItems[u].attributes.quantity=a.lineItems[u].attributes.quantity+1;else{null==a||a.lineItems.push({id:"tmpSku",type:"line_items",attributes:{sku_code:r,quantity:1,unit_amount_cents:-1,name:n||null,image_url:o||null,item_type:"skus",metadata:{product_reference:i}}}),l(a);let e=await b({marketId:_.marketId,orderId:(null==a?void 0:a.id)||"",sku:r,metadata:{product_reference:i}});l(e),e.attributes.coupon_code&&(await T(1),e=await w({marketId:_.marketId||"",orderId:(null==a?void 0:a.id)||""})),l(e),function(e){let{name:t,sku:n,order:r,market:o}=e;(function(e){var t,n,r,o,i,a;let{name:u,sku:d,order:l,market:c}=e;window.dataLayer=window.dataLayer||[],window.dataLayer.push({ecommerce:null});let s=l.lineItems,m=s.find(e=>e.attributes.sku_code===d);window.dataLayer.push({event:"addToCart",ecommerce:{market:c.toLowerCase(),currencyCode:l.attributes.currency_code,orderId:l.attributes.number,add:{products:[{name:u,id:d,price:m&&m.attributes.unit_amount_cents/100,quantity:1,productReference:null==m?void 0:null===(n=m.attributes)||void 0===n?void 0:null===(t=n.metadata)||void 0===t?void 0:t.product_id,legacyProductReference:(null==m?void 0:null===(o=m.attributes)||void 0===o?void 0:null===(r=o.metadata)||void 0===r?void 0:r.legacy_product_id)||(null==m?void 0:null===(a=m.attributes)||void 0===a?void 0:null===(i=a.metadata)||void 0===i?void 0:i.product_id)}],allItems:s.map(e=>{var t,n,r,o,i,a;return{id:e.attributes.sku_code,quantity:e.attributes.quantity,price:e.attributes.unit_amount_cents/100,productReference:null==e?void 0:null===(n=e.attributes)||void 0===n?void 0:null===(t=n.metadata)||void 0===t?void 0:t.product_id,legacyProductReference:(null==e?void 0:null===(o=e.attributes)||void 0===o?void 0:null===(r=o.metadata)||void 0===r?void 0:r.legacy_product_id)||(null==e?void 0:null===(a=e.attributes)||void 0===a?void 0:null===(i=a.metadata)||void 0===i?void 0:i.product_id)}})}}})})({name:t,sku:n,order:r,market:o}),function(e){let{sku:t,order:n}=e;window.dataLayer=window.dataLayer||[],window.dataLayer.push({ecommerce:null});let r=n.lineItems,o=r.find(e=>e.attributes.sku_code===t);o&&window.dataLayer.push({event:"add_to_cart",ecommerce:{items:[{item_id:o.attributes.sku_code,item_name:o.attributes.name,coupon:n.attributes.coupon_code,currency:n.attributes.currency_code,index:r.findIndex(e=>e.attributes.sku_code===t),price:o.attributes.unit_amount_cents/100,quantity:1}]}})}({sku:n,order:r})}({name:n,sku:r,order:e,market:_.name}),I({marketId:_.marketId,orderId:(null==a?void 0:a.id)||""})}}(0,o.useEffect)(()=>{let e=void 0!==window?window.location:"",t=new URLSearchParams(e?e.search:"").get("shipping-country");t&&N(t.toUpperCase())},[]),(0,o.useEffect)(()=>{let e=Object.values(k).find(e=>e.availableShippingCountries.includes(y));if(e)v(e),L?L===y&&P(!0):P(!0);else throw Error("Market not found for shipping country: ".concat(y))},[y]),(0,o.useEffect)(()=>{let e=!1;return async function(){let n=(null==_?void 0:_.marketId)||"",r=(0,c.rI)({marketId:n,countryCode:y});if(r){var o;let i=await w({orderId:r,marketId:n}),a=JSON.parse(window.localStorage.getItem("rakutenTrigger")||"{}");window.localStorage.removeItem("rakutenTrigger");let u=await h({marketId:n,orderId:r,attributes:{shipping_country_code_lock:y,language_code:t.languageCode,cart_url:t.cartUrl,return_url:t.returnUrl,privacy_url:t.privacyUrl,terms_url:t.termsUrl,metadata:{...a?f():{},...(null==i?void 0:null===(o=i.attributes)||void 0===o?void 0:o.metadata)||{},recommendedSize:[g()]}}});e||l(u)}else l(void 0)}(),()=>{e=!0}},[_,t.languageCode]),(0,o.useEffect)(()=>{document.body.style.overflow=m?"hidden":"auto"},[m]),(0,o.useEffect)(()=>{d&&_&&(function(e,t){window.dataLayer=window.dataLayer||[],window.dataLayer.push({ecommerce:null});let n=e.lineItems;window.dataLayer.push({event:"viewCart",ecommerce:{market:t.toLowerCase(),currencyCode:e.attributes.currency_code,orderId:e.attributes.number,cart:{allItems:n.map(e=>{var t,n,r,o;return{id:e.attributes.sku_code,quantity:e.attributes.quantity,price:e.attributes.unit_amount_cents/100,productReference:null==e?void 0:null===(n=e.attributes)||void 0===n?void 0:null===(t=n.metadata)||void 0===t?void 0:t.product_id,legacyProductReference:null==e?void 0:null===(o=e.attributes)||void 0===o?void 0:null===(r=o.metadata)||void 0===r?void 0:r.legacy_product_id}})}}})}(d,_.name),function(e){window.dataLayer=window.dataLayer||[],window.dataLayer.push({ecommerce:null});let t=e.lineItems.map((t,n)=>({item_id:t.attributes.sku_code,item_name:t.attributes.name,coupon:e.attributes.coupon_code,currency:e.attributes.currency_code,index:n,price:t.attributes.unit_amount_cents/100,quantity:t.attributes.quantity}));window.dataLayer.push({event:"view_cart",ecommerce:{items:t}})}(d))},[d,_]),(0,o.useEffect)(()=>{let e=!1;return async function(){if(L){E(L);return}let t=sessionStorage.getItem("countryCode");t||(t=await U());let n=sessionStorage.getItem("shippingCountryManuallyChanged");n?e||E(n):e||"RU"===t||E(t||"")}(),()=>{e=!0}},[L]),(0,o.useEffect)(()=>{let e=!1;return async function(){if(d||(0,c.rI)({marketId:(null==_?void 0:_.marketId)||"",countryCode:y})){let n=await s({marketId:_.marketId,shippingCountry:y,locale:t});(0,i.Z)(d,n)||e||l(n)}}(),()=>{e=!0}},[]);let j=(0,o.useMemo)(()=>(0,a.Z)(async e=>{let t=await S(e);l(t),t.attributes.coupon_code&&(await T(1),l(await w({marketId:_.marketId||"",orderId:t.id})))},500),[]);async function K(e){let{sku:n,quantity:r}=e,o=d?{...d}:await s({marketId:_.marketId,shippingCountry:y,locale:t});o&&!o.lineItems&&(o.lineItems=[]);let i=B(n);i>-1&&o?(o.lineItems[i].attributes.quantity=r,l(o),await j({marketId:_.marketId,id:o.lineItems[i].id,sku:n,orderId:o.id,quantity:r})):l(o)}async function O(e){let n=d?{...d}:await s({marketId:_.marketId,shippingCountry:y,locale:t});n&&!n.lineItems&&(n.lineItems=[]);let r=B(e);if(r>-1&&n){let t=n.lineItems.splice(r,1)[0];l(n);let o=await C({marketId:_.marketId,id:t.id,orderId:n.id});window.dataLayer=window.dataLayer||[],window.dataLayer.push({ecommerce:null}),window.dataLayer.push({event:"removeFromCart",ecommerce:{remove:{products:[{id:e}]}}}),l(o),o.attributes.coupon_code&&(await T(1),l(await w({marketId:_.marketId||"",orderId:o.id})))}else l(n)}return(0,r.jsx)(M.Provider,{value:{setCartVisible:p,isCartVisible:m,addToCart:R,order:d,removeFromCart:O,updateQuantity:K,shippingCountry:y,setShippingCountry:E,market:_,setMarket:v,isMarketInitialized:F,isImperial:A,setImperial:G},children:n})}function L(){let e=(0,o.useContext)(M);if(void 0===e)throw Error("useCart must be used within a CartProvider");return e}},67577:function(e,t,n){n.d(t,{Z:function(){return u},b:function(){return d}});var r=n(57437),o=n(2265),i=n(42586);let a=(0,o.createContext)(void 0);function u(e){let{children:t,locale:n,hreflang:o}=e,u=(0,i.useTranslations)(n.languageCode);return(0,r.jsx)(a.Provider,{value:{locale:n,hreflang:o,translate:u},children:t})}function d(){let e=(0,o.useContext)(a);if(void 0===e)throw Error("useLocale must be used within a LocaleProvider");return e}},14587:function(e,t,n){n.d(t,{$G:function(){return d},AD:function(){return I},Oh:function(){return b},TI:function(){return i},VT:function(){return m},Vm:function(){return y},WM:function(){return _},an:function(){return v},gI:function(){return C},jU:function(){return p},ju:function(){return u},jv:function(){return a},lK:function(){return g},qq:function(){return f},xG:function(){return o},xP:function(){return c}});var r=n(45130);let o=e=>{let{amount:t,languageCode:n,currency:r}=e;return"en"===n&&(n="en-GB"),new Intl.NumberFormat(n,{style:"currency",currency:r}).format(Number(t))};function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"".concat("https://nonstopdogwear.directus.app/assets","/").concat(e).concat(r.Z(t)?"":"?".concat(new URLSearchParams(t)))}function a(e){let t;try{t=new URL(e)}catch(e){return!1}return"http:"===t.protocol||"https:"===t.protocol}function u(e){return e?e.replace(/<[^>]*>/g,""):""}let d=e=>e.length>100?"".concat(e.slice(0,99),"…"):e,l=new Map;l.set("mm",e=>({value:(e/25.4).toFixed(1),unit:"in"})),l.set("cm",e=>({value:(e/2.54).toFixed(1),unit:"in"})),l.set("m",e=>({value:Math.floor(3.281*e).toFixed(0),unit:"′",secondaryValue:Number((39.37*e).toFixed(0))%12,secondaryUnit:"″"})),l.set("g",e=>({value:(e/28.35).toFixed(1),unit:" oz"})),l.set("kg",e=>({value:(2.20462*e).toFixed(1),unit:"lbs"})),l.set("mL",e=>({value:(e/29.574).toFixed(1),unit:"fl oz"}));let c=new Map;c.set("cm","in"),c.set("kg","lbs");let s=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["x","-"],n=t.filter(t=>e.includes(t));return!!Array.isArray(n)&&0!==n.length&&n[0]},m=(e,t)=>{let{value:n,unit:r}=t;if(!r)return n.toString();if(e)return"".concat(n,"\xa0").concat(r);if(!l.has(r))return console.error("No conversion found for ".concat(r)),"".concat(n,"\xa0").concat(r);let o=l.get(r),i=s(n),a=n.split(i||" "),u=o(a),d=u.unit;if("secondaryUnit"in u){let{secondaryUnit:e}=u;return a.map(t=>{let{value:n,secondaryValue:r}=o(t);return"".concat(n).concat(d,"\xa0").concat(r).concat(e)}).join(" ".concat(i," "))}return"".concat(a.map(e=>"".concat(o(e).value)).join("  "),"\xa0").concat(d)},p=()=>!0,w=["1-pate","10-pate-2-extra","small","medium","0","1","2","3","4","4.5","5","5.5","6","6.5","7","7.5","8","8.5","9","9.5","10","10.5","24","27","30","33","35","36","40","43","45","46","49","50","52","55","60","65","70","74","80","90","1-m","2-m","2-8-m","3-m","2-m-13-mm","2-8-m-13-mm","2-8-m-23-mm","3-8-m-23-mm","10mm/1.5m","15mm/1.5m","20mm/1.7m","10-mm-1-5-m","15-mm-1-5-m","20-mm-1-7-m","50-ml","100-ml","300-ml","500-ml","junior","original","6xs","5xs","4xs","3xs","xxxs","2xs","xxs","xs","s","m","l","xl","xxl","2xl","xxxl","3xl","4xl","5xl"],g=(e,t)=>w.findIndex(t=>{var n,r;return t===(null==e?void 0:null===(r=e.attributes)||void 0===r?void 0:null===(n=r.metadata)||void 0===n?void 0:n.size.toLowerCase())})-w.findIndex(e=>{var n,r;return e===(null==t?void 0:null===(r=t.attributes)||void 0===r?void 0:null===(n=r.metadata)||void 0===n?void 0:n.size.toLowerCase())}),_=(e,t)=>w.findIndex(t=>t===(null==e?void 0:e.name.toLowerCase()))-w.findIndex(e=>e===(null==t?void 0:t.name.toLowerCase())),f=(e,t)=>w.findIndex(t=>t===e.size.toLowerCase())-w.findIndex(e=>e===t.size.toLowerCase()),v=(e,t)=>w.findIndex(t=>t===e.key.toLowerCase())-w.findIndex(e=>e===t.key.toLowerCase()),h=new Map;h.set("cm",e=>(2.54*e).toFixed(1)),h.set("kg",e=>(e/2.205).toFixed(1));let y=(e,t,n)=>n&&h.has(t)?h.get(t)(e):e,I=(e,t,n)=>{let r=[...t],o=r.findIndex(t=>t.id===e);-1!==o&&(r[o].selected=!r[o].selected),n(r)},b=(e,t,n)=>{let r=[...t],o=r.findIndex(t=>t.id===e);-1!==o&&(r[o].selected=!r[o].selected),n(r)},C=(e,t,n)=>{let r=[...t],o=r.findIndex(t=>t.id===e);-1!==o&&(r[o].selected=!r[o].selected),n(r)}},39098:function(e,t,n){n.d(t,{h:function(){return o}});var r=n(29013);async function o(e){if(!e)throw Error("No market Id provided COMMERCELAYER_BASE_URL");let t=(0,r.xD)(e);return t&&function(e,t){try{let n=JSON.parse(atob(e.split(".")[1])),r=n?n.scope:"",o=Math.floor(Date.now()/1e3);if(n.exp&&n.exp>o&&r==="market:id:".concat(t))return!0}catch(e){console.error("Invalid token format",e)}return!1}(t,e)?t:i(e)}async function i(e){let t=await fetch("https://auth.commercelayer.io/oauth/token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"client_credentials",client_id:"jw2cAPTz3jW59ha4CTCcv1yZ3-lMhHUPGFbFpLZv-TE",scope:"market:id:".concat(e)})});if(!t.ok)throw Error("Failed to generate access token");let n=await t.json();return(0,r.Gx)(n.access_token,n.expires_in/86400,e),n.access_token}},29013:function(e,t,n){n.d(t,{Gx:function(){return i},Nu:function(){return u},m2:function(){return d},rI:function(){return a},xD:function(){return o}});var r=n(64131);function o(e){return r.Z.get("cl_access_token_".concat("jw2cAPTz3jW59ha4CTCcv1yZ3-lMhHUPGFbFpLZv-TE","_").concat(e))}function i(e,t,n){r.Z.set("cl_access_token_".concat("jw2cAPTz3jW59ha4CTCcv1yZ3-lMhHUPGFbFpLZv-TE","_").concat(n),e,{expires:t,sameSite:"strict",secure:!0})}function a(e){let{marketId:t,countryCode:n}=e;return r.Z.get("order_token_".concat("jw2cAPTz3jW59ha4CTCcv1yZ3-lMhHUPGFbFpLZv-TE","_").concat(t,"_").concat(n))}function u(e,t,n){r.Z.set("order_token_".concat("jw2cAPTz3jW59ha4CTCcv1yZ3-lMhHUPGFbFpLZv-TE","_").concat(n,"_").concat(e),t,{expires:30,sameSite:"strict",secure:!0})}function d(e,t){r.Z.remove("order_token_".concat("jw2cAPTz3jW59ha4CTCcv1yZ3-lMhHUPGFbFpLZv-TE","_").concat(t,"_").concat(e))}}}]);