PageSourceSearch

https://www.ain-tourisme.com/app/dist/adt-ain/addons/woody-addon-t…-touristicmaps-map-component.3be29cb99e.mjs

js ain-tourisme.com collected 2026-10-02 05:47:42 UTC 2,974 bytes, 1 lines download raw bytes

1import p from"woody_library_woody_component";import h from"woody_addon_touristicmaps_map_manager";class m extends p{tmaps=null;tmapsConfig={};loaded=!1;manager=null;constructor(){super()}connectedCallback(){this.connected=!0,this.dataset.delegateInit==null&&this.init().catch(t=>{throw t})}init(t={}){if(this.initialized)throw new Error("MapComponent was already initialized");return t.manager?this.manager=t.manager:this.manager=new h,this.manager.setMapComponent(this),this.initialized=!0,new Promise(async(e,i)=>{try{const n=this.querySelector("script[data-config]");if(!n)throw new Error("MapManager - configEl is missed on ",this);const s=JSON.parse(n.textContent);if(!s)throw new Error("MapManager - config is missed on ",this);this.config=s.woody_config||{},this.tmapsConfig=s.tmaps_config||{};let o=document.createElement("script");const d=window.globals.tmaps.url_api,c=window.globals.tmaps.url_api_lazy;o.setAttribute("src",this.config.lazy?c:d),o.setAttribute("type","module"),this.appendChild(o);let a=document.createElement("script");a.setAttribute("type","application/json"),a.textContent=JSON.stringify(this.tmapsConfig||{}),await customElements.whenDefined(this.config.lazy?"lazy-touristic-map":"touristic-map");const r=document.createElement(this.config.lazy?"lazy-touristic-map":"touristic-map");r.appendChild(a),r.connectAfter(async()=>{},async(l,g,u)=>{this.tmaps=l,await this._mapLoaded(t),e()}),this.appendChild(r)}catch(n){i(n)}})}async _mapLoaded(t={}){if(this.loaded)throw new Error("MapComponent - _mapLoaded() should be called once");if(this.loaded=!0,this.dispatchEvent(new CustomEvent("loaded")),this.config.controls)for(const e of this.config.controls){const{default:i}=await import(e.module);this.addControl(new i(e.args))}if(this.config.marker_model){let e=t.getDefaultSelectedPinIndex?t.getDefaultSelectedPinIndex():void 0;e==null&&(e=this.config?.default_selected_pin_index),this.setMarkersModel(this.config.marker_model,e)}this.config.geojsons&&this.config.geojsons.length>0&&this.config.geojsons.forEach(e=>{this.addGeojson(e)}),this.config.fit_bounds&&this.fitBounds(),this.dispatchEvent(new CustomEvent("ready"))}setMarkersModel(t,e){t=this.manager.parseMarkerModelConfig(t),this.tmaps.setMarkers(t,e)}setPosition(t,e){this.tmaps.position({center:t,range:e})}setRange(t){this.tmaps.range(t)}addGeojson(t,e=!0){t=this.manager.parseGeojson(t),this.tmaps.addGeojson(t,e)}fitBounds(t=!0){const e=this.tmaps.fittingBounds();e&&this.tmaps.position({...e,animate:t})}getFittingBounds(){return this.tmaps.fittingBounds()}setSelectedPinIndex(t,e=!0,i=!0){this.tmaps.setSelectedPinIndex(parseInt(t),e,i)}setSelectedPinIndexForLocation(t,e,i=!0,n=!0){this.setSelectedPinIndex(parseInt(this.manager.getMappedPinIndexForLocation(t,e)),i,n)}addControl(t){this.loaded||console.warn("MapComponent - addControl - map is not yet loaded"),t.setMapComponent(this),this.tmaps.addControl(t.getSymbol(),t.getPosition(),t.createPanel())}}export{m as default};

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.