PageSourceSearch

https://www.unistra.fr/themes/custom/studiometa/dist/476.2d6d551667455d4e780a.js

js unistra.fr collected 2026-09-24 08:26:32 UTC 11,085 bytes, 3 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[476],{117:function(K,f,a){a.r(f),a.d(f,{default:function(){return u}});var l=a(678),w=a(1817),d=a.n(w),$=a(3909),g=a(4165);function h(s){return class extends s{get map(){return(0,g.o)(this,u)?.map}get mapbox(){return(0,g.o)(this,u)?.mapbox}}}var N=Object.defineProperty,O=(s,t,e)=>t in s?N(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,c=(s,t,e)=>O(s,typeof t!="symbol"?t+"":t,e);class y extends h(l.C){constructor(){super(...arguments),c(this,"filteredItems"),c(this,"cache",{}),c(this,"clickedPoints",new Set),c(this,"currentNid",null)}get geoJson(){const t=[],e={type:"FeatureCollection",features:this.filteredItems.map(this.itemToGeoJsonFeature).filter(({properties:i,geometry:o})=>this.$parent.filterIds===!1?!0:(this.$parent.filterIds.includes(`${i.nid}`)&&t.push(o.coordinates),this.$parent.filterIds.includes(`${i.nid}`)))};return t.length===1&&this.map.flyTo({center:t[0]}),t.length>1&&this.$options.name==="localities"&&this.map.fitBounds(t,{padding:{top:90,bottom:180,left:90,right:90}}),e}mounted(){this.filteredItems=Object.values(this.$options.source),this.addImages();const t=window.location.search,e=new URLSearchParams(t);e.get("nid")&&this.openModalOnMounted(e.get("nid"));const i=document.querySelector("#map-modal .modal-close");i&&i.addEventListener("click",()=>{this.currentNid&&(this.clickedPoints.delete(this.currentNid),this.updatePinState())})}updatePinState(){this.map.setLayoutProperty(`unclustered-point-${this.$options.name}`,"icon-image",["case",["in",["get","nid"],["literal",Array.from(this.clickedPoints)]],`${this.$options.name}-clicked`,`${this.$options.name}-normal`])}async openModalOnMounted(t){const e=document.querySelector("#map-modal"),i=document.querySelector("#map-modal-content"),o=`${window.location.origin}${window.location.pathname}/${t}`;this.currentNid=t,this.clickedPoints.add(t),this.updatePinState();let n="";this.cache[o]?n=this.cache[o]:(n=await(await fetch(o)).text(),this.cache[o]=n),i.innerHTML=n,e.open()}itemToGeoJsonFeature({location:t,...e}){return typeof t>"u"?!1:{type:"Feature",geometry:{type:"Point",coordinates:[Number.parseFloat(t.longitude,10),Number.parseFloat(t.latitude,10)]},properties:e}}addImages(){this.map.loadImage(this.$options.pinImage,(t,e)=>{if(t)throw t;this.map.addImage(`${this.$options.name}-normal`,e),this.$options.pinImageClicked&&this.map.loadImage(this.$options.pinImageClicked,(i,o)=>{if(i)throw i;this.map.addImage(`${this.$options.name}-clicked`,o)}),this.addSourceData(),this.addClusterLayer(),this.addClusterCountLayer(),this.addUnclusterPointLayer(),this.addEvents()})}addSourceData(){this.source=this.map.addSource(this.$options.name,{type:"geojson",data:this.geoJson,cluster:!0,clusterMaxZoom:8,clusterRadius:50})}addClusterLayer(){this.map.addLayer({id:`clusters-${this.$options.name}`,type:"circle",source:this.$options.name,filter:["has","point_count"],paint:{"circle-color":"#000","circle-radius":["step",["get","point_count"],20,10,30,30,40]},layout:{visibility:this.$options.name==="localities"?"visible":"none"}})}addClusterCountLayer(){this.map.addLayer({id:`clusters-count-${this.$options.name}`,type:"symbol",source:this.$options.name,filter:["has","point_count"],paint:{"text-color":"#ffffff"},layout:{"text-field":["get","point_count_abbreviated"],"text-size":16,visibility:this.$options.name==="localities"?"visible":"none"}})}addUnclusterPointLayer(){this.map.addLayer({id:`unclustered-point-${this.$options.name}`,type:"symbol",source:this.$options.name,filter:["!",["has","point_count"]],layout:{"icon-image":["case",["in",["get","nid"],["literal",Array.from(this.clickedPoints)]],`${this.$options.name}-clicked`,`${this.$options.name}-normal`],"icon-size":.5,"icon-allow-overlap":!0,visibility:this.$options.name==="localities"?"visible":"none"},paint:{}})}addEvents(){this.map.on("click",`clusters-${this.$options.name}`,t=>{const e=this.map.queryRenderedFeatures(t.point,{layers:[`clusters-${this.$options.name}`]}),i=e[0].properties.cluster_id;this.map.getSource(this.$options.name).getClusterExpansionZoom(i,(o,n)=>{o||this.map.easeTo({center:e[0].geometry.coordinates,zoom:n})})}),this.$options.name==="localities"&&(this.map.on("mouseenter",`cluster
1s-${this.$options.name}`,()=>{this.map.getCanvas().style.cursor="pointer"}),this.map.on("mouseleave",`clusters-${this.$options.name}`,()=>{this.map.getCanvas().style.cursor=""}),this.map.on("mouseenter",`unclustered-point-${this.$options.name}`,()=>{this.map.getCanvas().style.cursor="pointer"}),this.map.on("mouseleave",`unclustered-point-${this.$options.name}`,()=>{this.map.getCanvas().style.cursor=""}),this.map.on("click",`unclustered-point-${this.$options.name}`,async t=>{const e=document.querySelector("#map-modal"),i=document.querySelector("#map-modal-content"),{endpoint:o,nid:n}=t.features[0].properties;let r="";this.currentNid&&this.clickedPoints.delete(this.currentNid),this.currentNid=n,this.clickedPoints.add(n),this.updatePinState(),this.cache[o]?r=this.cache[o]:(r=await(await fetch(o)).text(),this.cache[o]=r),i.innerHTML=r,e.open()}))}}c(y,"config",{name:"MapboxCluster",options:{source:Array,id:String,pinImage:String,pinImageClicked:String,name:String}});var T=Object.defineProperty,A=(s,t,e)=>t in s?T(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,E=(s,t,e)=>A(s,typeof t!="symbol"?t+"":t,e);class v extends h(l.C){onChange(){const t=this.$el.checked?"visible":"none";this.map.setLayoutProperty(`clusters-${this.$options.name}`,"visibility",t),this.map.setLayoutProperty(`clusters-count-${this.$options.name}`,"visibility",t),this.map.setLayoutProperty(`unclustered-point-${this.$options.name}`,"visibility",t)}}E(v,"config",{name:"MapClusterLayerControl",options:{name:String}});var m=a(4060),B=Object.defineProperty,J=(s,t,e)=>t in s?B(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,b=(s,t,e)=>J(s,typeof t!="symbol"?t+"":t,e);class C extends l.C{constructor(){super(...arguments),b(this,"isOpen",!1)}onBtnClick(){return this.isOpen?this.close():this.open()}open(){this.isOpen=!0,this.$refs.list.setAttribute("aria-hidden","false"),(0,m.remove)(this.$refs.list,["opacity-0","pointer-events-none"])}close(){this.isOpen=!1,this.$refs.list.setAttribute("aria-hidden","true"),(0,m.add)(this.$refs.list,["opacity-0","pointer-events-none"])}}b(C,"config",{name:"MapFilters",refs:["btn","list"]});var V=Object.defineProperty,z=(s,t,e)=>t in s?V(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,U=(s,t,e)=>z(s,typeof t!="symbol"?t+"":t,e);class F extends h(l.C){onClick(){const{longitude:t,latitude:e}=JSON.parse(this.$options.to);this.$parent.$children.FlyToBtn.forEach(i=>{(0,m.toggle)(i.$el,["bg-main-1","text-white"],i.$el===this.$el)}),t&&e&&this.map.flyTo({center:[Number.parseFloat(t),Number.parseFloat(e)]})}}U(F,"config",{name:"FlyToBtn",options:{to:String}});var k=Object.defineProperty,P=s=>{throw TypeError(s)},G=(s,t,e)=>t in s?k(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,M=(s,t,e)=>G(s,typeof t!="symbol"?t+"":t,e),S=(s,t,e)=>t.has(s)||P("Cannot "+e),H=(s,t,e)=>(S(s,t,"read from private field"),e?e.call(s):t.get(s)),R=(s,t,e)=>t.has(s)?P("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),W=(s,t,e,i)=>(S(s,t,"write to private field"),i?i.call(s,e):t.set(s,e),e),p;class I extends l.C{constructor(){super(...arguments),R(this,p,!1),M(this,"currentFocus",-1)}get isInputFocus(){return H(this,p)}set isInputFocus(t){W(this,p,t),this.$refs.datalist.style.display=t&&this.$refs.options.some(({style:e})=>e.display!=="none")?"block":"none"}get value(){return this.$refs.input.value}get sendValue(){return this.$refs.input.dataset.val}mounted(){this.isInputFocus=!1;for(const t of this.$refs.options)t.addEventListener("click",()=>{this.$refs.input.value=t.dataset.label,this.$refs.input.dataset.val=t.dataset.value,this.isInputFocus=!1})}onFormSubmit({event:t}){if(t.preventDefault(),this.sendValue==="")return this.$emit("search",!1);if(this.sendValue)return this.$emit("search",JSON.parse(this.sendValue))}onInputFocus(){this.isInputFocus=!0}filterOptions(){const t=this.value.toUpperCase();for(const e of this.$refs.options)e.dataset.label.toUpperCase().includes(t)?e.style.display="block":e.style.display="none"}onInputInput(){this.onInputFocus=!0,this.filterOptions(),this.$refs.datalist.style.height=this.$refs.input.value.length>0?"auto":"",this.$refs.datalist.style.display=this.$refs.options.some(({style:t})=>t.display!=="none")?"block":"none"}keyed({event:t,isDown:e,ENTER:i,ESC:o,UP:n,DOWN:r}
1){this.isInputFocus&&(e&&r&&(this.currentFocus++,this.addActive(this.$refs.options)),e&&n&&(this.currentFocus--,this.addActive(this.$refs.options)),e&&i&&(t.preventDefault(),this.currentFocus>-1&&this.$refs.options&&this.$refs.options[this.currentFocus].click()),e&&o&&(this.isInputFocus=!1))}addActive(t){if(!t)return!1;this.removeActive(t);const e=t.filter(({style:i})=>i.display!=="none");this.currentFocus>=e.length&&(this.currentFocus=0),this.currentFocus<0&&(this.currentFocus=e.length-1),e[this.currentFocus].classList.add("active"),e[this.currentFocus].scrollIntoView()}removeActive(t){for(const e of t)e.classList.remove("active")}}p=new WeakMap,M(I,"config",{name:"MapSearch",refs:["input","form","datalist","options[]"],emits:["search"]});var Q=a(2739),Y=a(6294),Z=Object.defineProperty,D=(s,t,e)=>t in s?Z(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,x=(s,t,e)=>D(s,typeof t!="symbol"?t+"":t,e);(0,$.Ef)({components:[$.aF]});function L(s){return t=>new Promise(e=>{t.isLoaded?e(s):t.$on("map-load",()=>e(s))})}class u extends l.C{constructor(){super(...arguments),x(this,"filterIds",!1)}get mapboxOptions(){return{container:this.$refs.map,center:this.$options.center,zoom:this.$options.zoom,minZoom:5,projection:"mercator",pitch:0,style:this.$options.style,logoPosition:"bottom-right"}}async mounted(){this.mapbox=d(),this.mapbox.accessToken=this.$options.accessToken,this.map=new this.mapbox.Map(this.mapboxOptions),this.map.on("load",()=>{this.isLoaded=!0,this.$emit("map-load")});const t=new(d()).NavigationControl({showCompass:!1});this.map.addControl(t,"top-right"),this.map.addControl(new(d()).GeolocateControl({positionOptions:{enableHighAccuracy:!0},trackUserLocation:!0,showUserHeading:!0}))}onMapSearchSearch({args:t}){this.filterIds=t[0],this.$children.MapboxCluster.forEach(e=>{const i=e.geoJson;(0,Y.d)(()=>{this.map.getSource(`${e.$options.name}`).setData(i)})})}destroyed(){this.map?.remove()}}x(u,"config",{name:"Map",emits:["map-load"],options:{accessToken:{type:String,default:()=>"pk.eyJ1IjoiYWdlbmNlc3R1ZGlvbWV0YSIsImEiOiJjbHpzYm84Z2kyM3J2Mmtxd3duNW8xdGR2In0.KfzA2DYB0YKrHTEB4fQzNg"},zoom:{type:Number,default:()=>14},center:{type:Array,default:()=>[7.7638753,48.582645]},style:{type:String,default:()=>"mapbox://styles/agencestudiometa/clx0izcct01ow01qs7eiv7u9f"}},refs:["map"],components:{MapFilters:C,FlyToBtn:F,MapSearch:I,MapboxCluster:L(y),MapClusterLayerControl:L(v)}})}}]);
2
3//# sourceMappingURL=476.2d6d551667455d4e780a.js.map

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.