site-libsoc/Server/public/js/components/map-component.js

2 lines
1.3 KiB
JavaScript

import{g as t,S as a,i as e,a as s,b as o,v as r,s as i,f as n,n as c,j as l,d as p,o as m,x as h}from"./index-3cab5f92.js";const{customElements:u}=t;function b(t){let a;return{c(){a=n("div"),this.c=c,l(a,"id","map")},m(e,s){o(e,a,s),t[2](a)},p:c,i:c,o:c,d(e){e&&p(a),t[2](null)}}}function d(t,a,e){let s,{callback:o=null}=a;function r(t,a){let e=L.map(s,{center:t,zoom:a});return L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',minNativeZoom:2,minZoom:2,maxNativeZoom:16,maxZoom:16}).addTo(e),e}return m((()=>{o(r)})),t.$$set=t=>{"callback"in t&&e(1,o=t.callback)},[s,o,function(t){h[t?"unshift":"push"]((()=>{s=t,e(0,s)}))}]}class g extends a{constructor(t){super(),this.shadowRoot.innerHTML="<style>@import 'https://unpkg.com/leaflet@1.9.4/dist/leaflet.css';#map{height:var(--height);width:var(--width,100%);margin-bottom:var(--margin-bottom,0)\n }</style>",e(this,{target:this.shadowRoot,props:s(this.attributes),customElement:!0},d,b,i,{callback:1},null),t&&(t.target&&o(t.target,this,t.anchor),t.props&&(this.$set(t.props),r()))}static get observedAttributes(){return["callback"]}get callback(){return this.$$.ctx[1]}set callback(t){this.$$set({callback:t}),r()}}u.define("map-component",g);export{g as default};