1(self.webpackChunksvk_designsystem=self.webpackChunksvk_designsystem||[]).push([[9425],{5527:function(module){module.exports=function(obj){obj||(obj={});var __t,__p="",__e=_.escape,__j=Array.prototype.join;function print(){__p+=__j.call(arguments,"")}with(obj)__p+='<aside class="map-panel map-panel--cluster" id="panel-'+__e(markers[0].data.id)+'-nav" surface="primary-100">\n\t<div class="map-panel__container">\n\t\t<h2 class="map-panel__title">Välj en plats</h2>\n\t\t<ul class="map-panel__list list--none">\n\t\t\t',markers.forEach((t,e)=>{__p+='\n\t\t\t\t<li>\n\t\t\t\t\t<button class="svk-link map-panel-marker-btn" data-index="'+__e(e)+'">\n\t\t\t\t\t\t'+__e(t.data.name)+"\n\t\t\t\t\t</button>\n\t\t\t\t</li>\n\t\t\t"}),__p+='\n\t\t</ul>\n\t</div>\n\t<button class="svk-button button--icon map-panel-nav-close" aria-label="Stäng">\n\t\t<svk-icon name="close"></svk-icon>\n\t</button>\n</aside>\n';return __p}},31251:function(module){module.exports=function(obj){obj||(obj={});var __t,__p="",__e=_.escape,__j=Array.prototype.join;function print(){__p+=__j.call(arguments,"")}with(obj)__p+='<aside class="map-panel map-panel--place" id="panel-'+__e(data.id)+'" surface="white">\n\t<button class="svk-button button--icon map-panel-close" aria-label="Stäng">\n\t\t<svk-icon name="close"></svk-icon>\n\t</button>\n\t<svk-illustration file="line" name="kyrkovalet" class="map-panel__image"></svk-illustration>\n\t<div class="map-panel__content">\n\t\t'+(null==(__t=data.distance?`\n\t\t\t<p class="list-item__meta paragraph-75">\n\t\t\t\t${formatDistanceToKilometers(data.distance)} från vald plats\n\t\t\t</p>`:"")?"":__t)+'\n\t\t<h3 class="heading-04 content__title">\n\t\t\t<a href="'+__e("/kyrkoval/hitta-din-lokal")+"/"+__e(data.slug)+'">'+__e(data.name)+'</a>\n\t\t</h3>\n\t\t<div class="label-75 content__meta">\n\t\t\t<svk-icon name="group"></svk-icon> '+__e(data.owner?.name)+'\n\t\t</div>\n\t\t<div class="label-75 content__meta">\n\t\t\t<svk-icon name="clock"></svk-icon> '+__e(data.openHours?.todaysOpenHours?.displayStatus||"Stängt")+"\n\t\t</div>\n\t\t",data.placeTypes?.pollingStation?.canPrintDubblettrostkort&&(__p+='\n\t\t\t<span class="label-75 content__meta">\n\t\t\t\t<svk-icon name="info"></svk-icon>\n\t\t\t\tKan skriva ut röstkort\n\t\t\t</span>\n\t\t'),__p+="\n\t</div>\n</aside>\n";return __p}},28619:function(t,e,n){"use strict";n.d(e,{T4:function(){return c},em:function(){return l}});const i=["maps","geometry","geocoding"];let s=null,a={};function o(){return window.google?.maps?Promise.resolve(window.google.maps):s||(s=new Promise((t,e)=>{const n="__svkGoogleMapsCoreLoaded",i=document.createElement("script"),a=encodeURIComponent("AIzaSyDlZrwxkgarRlpukU1YMKgtqlTbJImFt6o");window[n]=()=>{delete window[n],t(window.google.maps)},i.async=!0,i.src=`//maps.googleapis.com/maps/api/js?key=${a}&language=sv&v=weekly&loading=async&callback=${n}`,i.onerror=()=>{delete window[n],s=null,e(new Error("Failed to load Google Maps JS API (core).\nExisting script tags:\n"+[...document.scripts].map(t=>t.src||"").filter(t=>t.includes("maps.googleapis.com/maps/api/js")).join("\n")))},document.head.appendChild(i)}),s)}function r(t){const e=function(t){return window.google?.maps?"maps"===t&&window.google.maps.Map?window.google.maps:"marker"===t&&window.google.maps.marker?window.google.maps.marker:"geometry"===t&&window.google.maps.geometry?window.google.maps.geometry:"geocoding"===t&&window.google.maps.Geocoder?window.google.maps:null:null}(t);if(e)return Promise.resolve(e);if(!a[t]){if("function"!=typeof google.maps.importLibrary)return Promise.reject(new Error(`Google Maps library "${t}" is not available on this page.`));a[t]=google.maps.importLibrary(t)}return a[t]}function l(t=[]){const e=[...new Set(t)];return o().then(()=>Promise.all(e.map(t=>r(t))))}function c(t){return l(i).then(()=>{"function"==typeof t&&t()}).catch(console.error)}},40651:function(t,e,n){"use strict";n.d(e,{ml:function(){return l},po:function(){return d},ur:function(){return h}});const i="#000",s="#fff",a=1,o=99999;function r(t={}){return{width:t.width||44,height:t.height||52}}function l(t){if(t&&t.position)return t.position instanceof google.maps.LatLng||"function"==typeof t.position.lat&&"function"==typeof t.position.lng?t.position:"number"==typeof t.position.lat&&"number"==typeof t.position.lng?new google.maps.LatLng(t.position.lat,t.position.lng):void 0}function c(t){let e=r(t.icon?.size),n=t.icon?.labelOrigin||{x:22,
1y:22},a=(t.icon?.origin?.x||0)>=e.width,o=void 0!==t.markerLabel,l=t.markerLabel?.fontSize||"16px";t.markerContent.style.width=`${e.width}px`,t.markerContent.style.height=`${e.height}px`,t.markerContent.style.backgroundImage=`url(${t.icon.url})`,t.markerContent.style.backgroundSize=`${2*e.width}px ${e.height}px`,t.markerContent.style.backgroundPosition=a?`-${e.width}px 0`:"0 0",o?(t.markerLabelEl.textContent=t.markerLabel.text||"",t.markerLabelEl.style.display="block",t.markerLabelEl.style.left=`${n.x}px`,t.markerLabelEl.style.top=`${n.y}px`,t.markerLabelEl.style.fontFamily=t.markerLabel.fontFamily||"DM Sans",t.markerLabelEl.style.fontSize=l,t.markerLabelEl.style.fontWeight=t.markerLabel.fontWeight||"500",t.markerLabelEl.style.color=t.markerLabel.color||(a?s:i)):(t.markerLabelEl.style.display="none",t.markerLabelEl.textContent="")}function d({map:t,position:e,title:n,data:i,icon:s,label:o,zIndex:d=a}){const{AdvancedMarkerElement:h}=google.maps.marker,{content:m,label:u}=function(){const t=document.createElement("div"),e=document.createElement("span");return t.className="svk-map-marker",e.className="svk-map-marker__label",Object.assign(t.style,{position:"relative",display:"block",backgroundRepeat:"no-repeat",backgroundPosition:"0 0",cursor:"pointer",transform:"translate3d(0, 0, 0)"}),Object.assign(e.style,{position:"absolute",transform:"translate(-50%, -50%)",textAlign:"center",pointerEvents:"none",lineHeight:"1",whiteSpace:"nowrap"}),t.appendChild(e),{content:t,label:e}}(),p=new h({map:t,position:e,title:n,content:m,gmpClickable:!0,zIndex:d});return p.data=i,p.icon={...s,size:r(s?.size),origin:s?.origin||new google.maps.Point(0,0),labelOrigin:s?.labelOrigin||{x:22,y:22}},p.markerLabel=o?{...o}:void 0,p.markerContent=m,p.markerLabelEl=u,p.defaultZIndex=d,p.getPosition=function(){return l(this)},p.getLabel=function(){return this.markerLabel?{...this.markerLabel}:void 0},p.setLabel=function(t){this.markerLabel=t?{...t}:void 0,c(this)},p.setIcon=function(t){this.icon={...this.icon,...t,size:r(t?.size||this.icon?.size),origin:t?.origin||this.icon?.origin||new google.maps.Point(0,0),labelOrigin:t?.labelOrigin||this.icon?.labelOrigin||{x:22,y:22}},c(this)},p.setZIndex=function(t){this.zIndex=t},c(p),p}function h({iconUrl:t,textColor:e=i,fontFamily:n="DM Sans",fontSize:s="16px",fontWeight:a="500",titleFormatter:r}){return{render(i){let l=i.count;return d({position:i.position,title:r?r(l):`${l} markorer`,icon:{url:t,size:{width:44,height:52},origin:new google.maps.Point(0,0),labelOrigin:{x:22,y:22}},label:{text:String(l),color:e,fontFamily:n,fontSize:s,fontWeight:a},zIndex:o+l})}}}},52874:function(t,e,n){"use strict";n.r(e);var i=n(5527),s=n(48357);e.default=class{constructor(t,e={}){this.dom={},this.dom.el=t,this.currentPanel=null,this.handleCloseClick=this.handleCloseClick.bind(this),this.options=e,this.currentMarkers=void 0,this.bindEvents()}openMenuPanel(t){this.currentMarkers=[...t],this.dom.el.insertAdjacentHTML("beforeend",i({markers:t})),this.currentPanel=this.dom.el.querySelector(`#panel-${t[0].data.id}-nav`),s(this.currentPanel,{translateX:[0,300]},{duration:150}),this.dom.el.querySelector(".map-panel-nav-close").addEventListener("click",this.handleCloseClick)}closeMenuPanel(){null!==this.currentPanel&&(s(this.currentPanel,{translateX:[300,0]},{duration:150,complete:()=>{this.dom.el.querySelector(".map-panel-nav-close").removeEventListener("click",this.handleCloseClick),this.currentPanel.parentElement.removeChild(this.currentPanel),this.currentPanel=null}}),this.options.onClose&&"function"==typeof this.options.onClose&&this.options.onClose(),this.currentMarkers=void 0)}handleCloseClick(){this.closeMenuPanel()}handleClick(t){if(t.target.matches(".map-panel-marker-btn")){let e=parseInt(t.target.getAttribute("data-index"),10),n=this.currentMarkers[e];this.options.onClick&&"function"==typeof this.options.onClick&&(setTimeout(()=>{this.options.onClick(n)},300),this.closeMenuPanel())}}bindEvents(){this.dom.el.addEventListener("click",this.handleClick.bind(this))}}},72614:function(t,e,n){"use strict";n.r(e);var i=n(31251),s=n(99258),a=n(48357);e.default=class{constructor(t,e={}){this.dom={},this.dom.el=t,this.currentPanel=null,this.currentMarker=void 0,this.handleCloseClick=this.handleCloseClick.bind(this),this.options=e}
1openPanel(t){this.currentMarker=t,this.dom.el.insertAdjacentHTML("beforeend",i({formatDistanceToKilometers:s.z,data:t})),this.currentPanel=this.dom.el.querySelector(`#panel-${t.id}`),this.dom.el.querySelector(".map-panel-close").addEventListener("click",this.handleCloseClick),a(this.currentPanel,{translateX:["0%","100%"]},{duration:150})}closePanel(){null!==this.currentPanel&&(this.currentPanel=this.dom.el.querySelector("#panel-"+this.currentMarker.id),a(this.currentPanel,{translateX:["100%","0%"]},{duration:150,complete:()=>{this.dom.el.querySelector(".map-panel-close").removeEventListener("click",this.handleCloseClick),this.currentPanel.parentElement.removeChild(this.currentPanel),this.currentPanel=null}}),this.options.onClose&&"function"==typeof this.options.onClose&&this.options.onClose(this.currentMarker.id),this.currentMarker=void 0)}handleCloseClick(){this.closePanel()}}},49425:function(t,e,n){"use strict";n.r(e),n.d(e,{SvkPollingStationSearchMap:function(){return c}});var i=n(28534),s=n(28619),a=n(40651),o=n(99499),r=n(72614),l=n(52874);n(95093).locale("sv");class c extends HTMLElement{constructor(){super(),this.dom={},this.dom.el=this,this.options={cluster:!0,data:[],markerEvent:"panel",fullscreenControl:!1,streetViewControl:!1,scrollwheel:!1,minZoom:2,maxZoom:18},this.components={},this.map=null,this.bounds=void 0,this.initZoomLevel=void 0,this.items=[],this.markers=[],this.currentMarker=void 0,this.currentCluster=void 0,this.markerCluster=null,this.handleDataUpdate=this.handleDataUpdate.bind(this)}connectedCallback(){this.waitForGoogleMaps=(()=>{(0,s.em)(["marker"]).then(()=>{this.initMap(),this.initComponents(),this.addMarkers(),this.bindEvents(),i.default.set({view:"map"})})})()}disconnectedCallback(){this.waitForGoogleMaps=null,this.dataCallback=null,i.default.unsubscribe("getData",this.handleDataUpdate)}initMap(){this.mapStyles={...this.mapStyles,...this.options},this.mapStyles.zoom=3.9,this.mapStyles.center=new window.google.maps.LatLng(61,17),this.mapStyles.disableDefaultUI=!1,this.mapStyles.zoomControl=!0,this.mapStyles.mapId="692f62d000d4d233",this.mapStyles.zoomControlOptions={position:window.google.maps.ControlPosition.LEFT_CENTER},this.innerHTML='<div class="map-container"></div><button class="map__reset-zoom svk-button button--secondary button--size-75 js-reset-zoom">Ã
terställ zoom</button>',this.map=new google.maps.Map(this.querySelector(".map-container"),this.mapStyles),this.markerCluster=new o.w1({map:this.map,markers:this.markers,algorithm:new o.t9({maxZoom:19,radius:60}),renderer:(0,a.ur)({iconUrl:"/assets/presentation/verktygsladan/assets/svg/pin-number.svg",textColor:"#000",fontFamily:"DM Sans",fontSize:"16px",fontWeight:"500",titleFormatter:t=>`${t} platser`}),onClusterClick:(t,e)=>this.handleClusterClick(e,t)}),this.bounds=new google.maps.LatLngBounds}initComponents(){this.components.mapPanel=new r.default(this.dom.el,{onClose:this.handleOnPanelClose.bind(this)}),this.options.cluster&&(this.components.mapClusterNav=new l.default(this.dom.el,{onClose:this.handleMenuPanelClose.bind(this),onClick:this.handleMenuPanelItemClick.bind(this)}))}adjustMapBounds(){this.markers.length?(this.map.fitBounds(this.bounds),google.maps.event.addListenerOnce(this.map,"bounds_changed",()=>{this.initZoomLevel=this.map.getZoom(),this.initZoomLevel>=10&&(this.initZoomLevel=10)})):(this.map.setCenter(new window.google.maps.LatLng(61,17)),this.map.setZoom(3.9))}updateData(t){this.removeAllMarkers(),this.addMarkers(t)}handleDataUpdate(t){this.removeAllMarkers(),this.addMarkers(t)}addMarkers(t){t?.results&&t.results.length&&(t.results.forEach(t=>{if(null!==t.geoLocation){const e=this.createMarker(t);this.markers.push(e)}}),this.markerCluster.addMarkers(this.markers),this.adjustMapBounds())}createMarker(t,e){const n=(0,a.po)({position:new google.maps.LatLng(t.geolocation.geometry.coordinates[1],t.geolocation.geometry.coordinates[0]),map:this.map,data:t,icon:{url:"/assets/presentation/verktygsladan/assets/svg/pin-default.svg",size:new google.maps.Size(44,54),labelOrigin:{x:22,y:22},origin:new google.maps.Point(0,0)}});return n.addListener("click",t=>{this.handleMarkerClick(t,n)}),this.bounds.extend(n.position),n}
1removeAllMarkers(){this.markers.forEach(t=>{"map"in t&&(t.map=null)}),this.markers=[],this.markerCluster.clearMarkers(),this.bounds=new google.maps.LatLngBounds}activateCurrentMarker(t){t.setIcon({url:t.icon.url,size:new google.maps.Size(t.icon.size.width,t.icon.size.height),origin:new google.maps.Point(t.icon.size.width,0)}),this.currentMarker=t,this.map.panTo(t.getPosition())}deActivateCurrentMarker(){if(void 0===this.currentMarker)return!1;if(this.options.sorted){var t=this.currentMarker.getLabel();t.color="#000",this.currentMarker.setLabel(t),this.currentMarker.setZIndex(-1*parseInt(t.text))}this.currentMarker.setIcon({url:this.currentMarker.icon.url,size:new google.maps.Size(this.currentMarker.icon.size.width,this.currentMarker.icon.size.height),origin:new google.maps.Point(0,0),labelOrigin:{x:22,y:22}}),this.currentMarker=void 0}handleMenuPanelItemClick(t){if(this.currentMarker){let e=this.currentMarker.data.id;if(this.components.mapPanel.closePanel(),this.deActivateCurrentMarker(),e===t.data.id)return}void 0!==this.currentCluster&&(this.components.mapClusterNav.closeMenuPanel(),this.currentCluster=void 0),this.components.mapPanel.openPanel(t.data),this.activateCurrentMarker(t)}handleMenuPanelClose(){this.currentCluster=void 0}handleOnPanelClose(){this.deActivateCurrentMarker()}handleMarkerClick(t,e){if(this.currentMarker){let t=this.currentMarker.data.id;if(this.components.mapPanel.closePanel(),this.deActivateCurrentMarker(),t===e.data.id)return;this.activateCurrentMarker(e),setTimeout(()=>{this.components.mapPanel.openPanel(e.data)},300)}else void 0!==this.currentCluster&&(this.components.mapClusterNav.closeMenuPanel(),this.currentCluster=void 0),this.components.mapPanel.openPanel(e.data),this.activateCurrentMarker(e)}handleClusterClick(t){let e=t.markers||[];if(void 0!==this.currentMarker&&(this.components.mapPanel.closePanel(),this.deActivateCurrentMarker()),void 0!==this.currentCluster&&this.currentCluster.markers[0].data.id===e[0]?.data.id)this.components.mapClusterNav.closeMenuPanel(),this.components.mapPanel.closePanel(),this.currentCluster=void 0;else if(this.map.getZoom()>=18){this.currentCluster=t,this.components.mapClusterNav.openMenuPanel(e);let n=(0,a.ml)(e[0]);n&&this.map.setCenter(n)}else t.bounds&&this.map.fitBounds(t.bounds)}handleStoreChange(t){this.filter=t.filter,this.removeAllMarkers(),this.addMarkers()}handleResetZoom(){this.initZoomLevel>=10?this.map.setZoom(10):this.map.fitBounds(this.bounds)}handleFilterChange(t){this.components?.mapPanel?.closePanel(),this.components?.mapClusterNav?.closeMenuPanel()}bindEvents(){this.map.addListener("zoom_changed",()=>{setTimeout(()=>{const t=this.map.getZoom();void 0!==this.initZoomLevel&&(t>this.initZoomLevel?this.querySelector(".js-reset-zoom").classList.add("is-active"):this.querySelector(".js-reset-zoom").classList.remove("is-active"))},50)}),i.default.subscribe("getData",this.handleDataUpdate),i.default.subscribe("update",this.handleFilterChange.bind(this)),this.querySelector(".js-reset-zoom").addEventListener("click",this.handleResetZoom.bind(this))}template(){this.innerHTML='\n\t\t\t<div class="results__header">\n\t\t\t\t<div class="results__total-container">\n\t\t\t\t\t<span class="results__total label-75" role="alert" aria-live="assertive" aria-atomic="true"></span>\n\t\t\t\t\t<button class="svk-button results__filter-button js-open-filter">Filtrera</button>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t'}}window.customElements.define("svk-pollingstation-search-map",c)}}]);
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.