"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[32],{104:(e,n,s)=>{s.d(n,{a:()=>k});var t=s(1),c=s(4),r=s(139),i=s(0),l=s(3),a=s(11);const{wrapper:o,openList:u,wrapperCheckBox:d,wrapperSelected:p,list:h,listOnTop:g,listInMenu:m,listEntriesWrapper:x,listEntriesWrapperEntry:v,listEntriesWrapperEntryIcon:f,listEntriesWrapperEntryText:j}=r.a,k=({size:e,currentCountry:n,countries:s,showLanguageInMenu:r,topPlacement:k})=>{if(!s||0===(null==s?void 0:s.length))return null;const y=(0,c.useRef)(null),b=(0,c.useRef)(null),[w,C]=(0,c.useState)(!1),O=(0,c.useCallback)((e=>{C(e),(e=>{const n={event:"country_picker_toggle",event_action:"click:toggle",event_category:"Country Picker",event_label:e?"Open":"Close"};a.b.push(n)})(e)}),[]),{useOnClickOutside:E}={useOnClickOutside:function(e,n,s){(0,i.useEffect)((()=>{const t=t=>{e.current&&!e.current.contains(t.target)&&n.current&&!n.current.contains(t.target)&&s(t)};return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}}),[e,n,s])}},L=(null==s?void 0:s.length)?s.filter((e=>e.code!==n)).sort(((e,n)=>"US"===e.code?-1:"US"===n.code?1:"CA"===e.code?-1:"CA"===n.code?1:0)):[];if(0===L.length)return null;const N=s.find((e=>e.code===n));return E(y,b,(()=>{b.current&&O(!1)})),(0,t.jsxs)("div",Object.assign({style:{"--icon-width":"small"===e?"30px":"50px","--icon-height":"small"===e?"20px":"40px"},className:(0,l.c)(o,w&&u)},{children:[(0,t.jsxs)("div",Object.assign({className:p},{children:[(0,t.jsx)("div",{style:{backgroundImage:`url(https://cdn.shopify.com/static/images/flags/${null==N?void 0:N.code.toLowerCase()}.svg)`,"--icon-width":"small"===e?"30px":"50px","--icon-height":"small"===e?"20px":"40px"}}),(0,t.jsx)("p",{children:null==N?void 0:N.currency})]})),(0,t.jsx)("input",{ref:b,type:"checkbox",className:d,checked:w,onChange:()=>O(!w)}),w&&(0,t.jsx)("ul",Object.assign({ref:y,className:(0,l.c)(h,k&&g,r&&m)},{children:L.map((n=>(0,t.jsx)("li",Object.assign({className:x},{children:(0,t.jsxs)("a",Object.assign({onClick:()=>(e=>{b.current&&(O(!1),"undefined"!=typeof document&&(document.cookie=`3bn_country=${e}; path=/; expires=Fri, 31 Dec 9999 23:59:59 GMT`,window.location.reload()))})(n.code),className:v},{children:[(0,t.jsx)("span",Object.assign({className:f},{children:(0,t.jsx)("div",{style:{backgroundImage:`url(https://cdn.shopify.com/static/images/flags/${n.code.toLowerCase()}.svg)`,"--icon-width":"small"===e?"30px":"50px","--icon-height":"small"===e?"20px":"40px"}})})),(0,t.jsxs)("span",Object.assign({className:j},{children:[n.name," ",n.currency]}))]}))}))))}))]}))}}}]);