@panoramax/web-viewer 4.0.3-develop-885abb56 → 4.0.3-develop-a32876ba

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -9,7 +9,7 @@
9
9
  * LICENSE file in the root directory of this source tree.
10
10
  *
11
11
  */
12
- !function(at,st){"object"===typeof exports&&"object"===typeof module?module.exports=st():"function"===typeof define&&define.amd?define("Panoramax",[],st):"object"===typeof exports?exports.Panoramax=st():at.Panoramax=st()}(this,(()=>(()=>{var at={9039:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>Basic});var ut=ot(4542),Hl=ot(5254),rc=ot(4964),sc=ot(8340),oc=ot(5995),_c=ot(7343),wc=ot(2614),Sc=ot.n(wc),iu=ot(8330);ot(1865),ot(3638);class Basic extends ut.WF{constructor(){let at=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.users=["geovisio"],this.mapstyle=this.getAttribute("mapstyle")||sc.DEFAULT_TILES,this.lang=this.getAttribute("lang")||null,this.endpoint=this.getAttribute("endpoint")||null,this.picture=this.getAttribute("picture")||null,this.sequence=this.getAttribute("sequence")||null,console.info(`\ud83d\udcf7 Panoramax ${this.getClassName()} - Version ${iu.rE} (885abb5)\n\n\ud83c\udd98 Issues can be reported at ${iu.Jk.O}`),at||(this._isInternetFast=null,(0,_c.isInternetFast)().then((at=>this._isInternetFast=at)))}connectedCallback(){super.connectedCallback(),this._t=(0,rc.getTranslations)(this.lang),this.loader=(0,oc.createWebComp)("pnx-loader",{_parent:this,"no-label":(0,_c.isInIframe)()}),this._loadsAPI&&this.endpoint&&this._loadsAPI===this.endpoint||this.api&&this.api._endpoint===this.endpoint||!this.endpoint||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())}_setupAPI(){if(this.loader=this.loader||(0,oc.createWebComp)("pnx-loader",{_parent:this}),!this.endpoint)return void console.warn("No endpoint is defined");this._loadsAPI=this.endpoint;let at=this.endpoint;try{this.mapstyle=JSON.parse(this.mapstyle)}catch(ot){}try{this.api=new Hl.A(this.endpoint,{users:this.users,fetch:this.fetchOptions,style:this.mapstyle}),this.api.onceReady().then((()=>{if(at!=this._loadsAPI||!this.api)return;let st=this.api.getUnavailableFeatures(),ot=this.api.getAvailableFeatures();ot=0===st.length?"\u2705 All features available":"\u2705 Available features: "+ot.join(", "),st=0===st.length?"":"\ud83d\udeab Unavailable features: "+st.join(", "),console.info(`\ud83c\udf10 Connected to API "${this.api._metadata.name}" (${this.api._endpoint})\n\u2139\ufe0f API runs STAC ${this.api._metadata.stac_version} ${this.api._metadata.geovisio_version?"& GeoVisio "+this.api._metadata.geovisio_version:""}\n ${ot}\n ${st}\n`.trim())})).catch((at=>this.loader.dismiss(at,this._t.pnx.error_api))).finally((()=>delete this._loadsAPI))}catch(ot){var st;delete this._loadsAPI,null!==(st=this.loader)&&void 0!==st&&st.dismiss?this.loader.dismiss(ot,this._t.pnx.error_api):console.error(ot)}}onceReady(){throw new Error("You must override this method on sub-class")}onceAPIReady(){return this.api?this.api.onceReady():new Promise((at=>setTimeout(at,100))).then(this.onceAPIReady.bind(this))}createRenderRoot(){return this}attributeChangedCallback(at,st,ot){if(super.attributeChangedCallback(at,st,ot),"endpoint"===at&&(this._loadsAPI&&ot&&this._loadsAPI===ot||this.api&&this.api._endpoint===ot||!ot||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())),["picture","sequence"].includes(at)){let ut,Hl,rc,sc;"picture"===at?(ut=this.sequence,rc=this.sequence,Hl=ot,sc=st):(ut=ot,rc=st,Hl=this.picture,sc=this.picture),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{seqId:ut,picId:Hl,prevSeqId:rc,prevPicId:sc}}))}}getClassName(){return"Basic"}select(){let at=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,st=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&(this.picture=null,this.sequence=null),this.picture=st,this.sequence=at}isWidthSmall(){return(null===this||void 0===this?void 0:this.offsetWidth)<576}isHeightSmall(){return(null===this||void 0===this?void 0:this.offsetHeight)<400}render(){return ut.qy`<p>Should not be used directly, use Viewer/CoverageMap/Editor instead</p>`}getSubComponentsNames(){return["loader","api"]}addEventListener(at,st,ot){let ut=at.split(":").shift();if(ut&&this.getSubComponentsNames().includes(ut)){var Hl;const rc=at.substring(ut.length+1);null!==(Hl=this[ut])&&void 0!==Hl&&Hl.addEventListener?this[ut].addEventListener(rc,st,ot):setTimeout((()=>this.addEventListener(at,st,ot)),50)}else super.addEventListener(at,st,ot)}static GetJSONConverter(){return{fromAttribute:at=>"object"===typeof at?at:Sc().parse(at),toAttribute:at=>JSON.stringify(at)}}}Basic.properties={picture:{type:String,reflect:!0},sequence:{type:String,reflect:!0},fetchOptions:{converter:Basic.GetJSONConverter()},users:{type:Array,reflect:!0},mapstyle:{type:String},lang:{type:String},endpoint:{type:String}}},153:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>CoverageMap});var ut=ot(9039),Hl=ot(5642),rc=ot(8340),sc=ot(927),oc=(ot(7776),ot(2118));class CoverageMap extends ut.A{constructor(){super(),this._mapContainer=document.createElement("div"),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this._initParams=new oc.Ay(oc.Ay.GetComponentProperties(CoverageMap,this)),this._initMap()}))}disconnectedCallback(){var at;super.disconnectedCallback(),null===(at=this.map)||void 0===at||at.destroy()}getClassName(){return"CoverageMap"}onceReady(){return this.map&&this.map.waitForEnoughMapLoaded?this.map.waitForEnoughMapLoaded():new Promise((at=>setTimeout(at,100))).then(this.onceReady.bind(this))}render(){return[this.loader,this._mapContainer]}getSubComponentsNames(){const at=super.getSubComponentsNames();return at.push("map"),at}_initMap(){class MyMap extends Hl.A{_getLayerStyleProperties(at){return"pictures_symbols"===at?{layout:{visibility:"none"}}:super._getLayerStyleProperties(at)}}this.map=new MyMap(this,this._mapContainer,Object.assign({},this._initParams.getMapInit(),{hash:!0})),this.map.addControl(new sc.NavigationControl({showCompass:!1})),this.loader.setAttribute("value",70),this.addEventListener("select",this._onSelect.bind(this)),this.map.on("picture-click",(at=>this.select(at.seqId,at.picId))),this.map.on("sequence-click",(at=>this.select(at.seqId))),this.map.waitForEnoughMapLoaded().then((async()=>{await(0,oc.mK)(this.map,this._initParams.getMapPostInit()),this.map.reloadLayersStyles(),this.loader.dismiss()}))}_onSelect(at){if(at.detail.picId||at.detail.seqId){const st=at.detail.picId?"pictures":"sequences",ot=this.map.queryRenderedFeatures({layers:[...this.map._userLayers].map((at=>(0,rc.getUserLayerId)(at,st))),filter:["==",["get","id"],at.detail.picId||at.detail.seqId]});ot.length>=0&&null!=ot[0]&&this.map._attachPreviewToPictures({features:ot},st)}}}CoverageMap.properties={map:{converter:ut.A.GetJSONConverter()},...ut.A.properties},customElements.define("pnx-coverage-map",CoverageMap)},1752:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>Editor});ot(7365);var ut=ot(9039),Hl=ot(5642),rc=ot(9048),sc=(ot(7534),ot(6810),ot(508)),oc=ot(8340),_c=ot(1545),wc=(ot(4542),ot(5995));const Sc="sequence-headings";class Editor extends ut.A{constructor(){super(),this.raster=null,this.background="streets",this.users=[],this._psvContainer=document.createElement("div"),this._mapContainer=document.createElement("div"),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this.sequence||this.loader.dismiss({},"No sequence is selected"),this.addEventListener("select",this._onSelect.bind(this)),this._initPSV(),this._initMap()}))}disconnectedCallback(){var at,st;super.disconnectedCallback(),null===(at=this.map)||void 0===at||at.destroy(),null===(st=this.psv)||void 0===st||st.destroy()}getClassName(){return"Editor"}onceReady(){var at,st;return this.map&&this.psv&&null!==(at=(st=this.map).loaded)&&void 0!==at&&at.call(st)?Promise.resolve():new Promise((at=>setTimeout(at,100))).then(this.onceReady.bind(this))}connectedCallback(){Array.isArray(this.users)&&this.users.length>0&&(console.warn("Parameters users can't be changed in Editor, only selected sequence can be visible"),this.users=[]),super.connectedCallback()}attributeChangedCallback(at,st,ot){"users"===at&&Array.isArray(ot)&&ot.length>0?console.warn("Parameters users can't be changed in Editor, only selected sequence can be visible"):super.attributeChangedCallback(at,st,ot)}render(){return[this.loader,this._psvContainer,this._mapContainer]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["map","psv"])}_initPSV(){try{this.psv=new rc.Ay(this,this._psvContainer),this.psv._myVTour.datasource.nodeResolver=this._getNode.bind(this)}catch(at){let st=_c.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(at,st)}}_initMap(){try{this.map=new Hl.A(this,this._mapContainer,{raster:this.raster,background:this.background,supplementaryStyle:this._createMapStyle(),zoom:15}),(0,oc.linkMapAndPhoto)(this),this.loader.setAttribute("value",50),this._loadSequence(),this.map.once("load",(()=>{this.map.hasTwoBackgrounds()&&this._addMapBackgroundWidget(),this._bindPicturesEvents()}));const at=this.map._picMarker.setRotation.bind(this.map._picMarker);this.map._picMarker.setRotation=st=>(st=void 0===this._lastRelHeading?st:st+this._lastRelHeading-this.psv.getPictureRelativeHeading(),at(st))}catch(at){this.loader.dismiss(at,this._t.pnx.error_psv)}}_createMapStyle(){return{sources:{geovisio_editor_sequences:{type:"geojson",data:{type:"FeatureCollection",features:[]}}},layers:[{id:"geovisio_editor_sequences",type:"line",source:"geovisio_editor_sequences",layout:{...oc.VECTOR_STYLES.SEQUENCES.layout},paint:{...oc.VECTOR_STYLES.SEQUENCES.paint}},{id:"geovisio_editor_pictures",type:"circle",source:"geovisio_editor_sequences",layout:{...oc.VECTOR_STYLES.PICTURES.layout},paint:{...oc.VECTOR_STYLES.PICTURES.paint}}]}}_bindPicturesEvents(){this.map.on("mousemove","geovisio_editor_pictures",(()=>{this.map.getCanvas().style.cursor="pointer"})),this.map.on("mouseleave","geovisio_editor_pictures",(()=>{this.map.getCanvas().style.cursor=""})),this.map.on("click","geovisio_editor_pictures",this.map._onPictureClick.bind(this.map))}_loadSequence(){return this.loader.setAttribute("value",60),this.api.getSequenceItems(this.sequence).then((at=>{if(this.loader.setAttribute("value",80),this.map.once("sourcedata",(()=>{this.map.setPaintProperty("geovisio_editor_sequences","line-color",this.map._getLayerColorStyle("sequences")),this.map.setPaintProperty("geovisio_editor_pictures","circle-color",this.map._getLayerColorStyle("pictures")),this.map.setLayoutProperty("geovisio_editor_sequences","visibility","visible"),this.map.setLayoutProperty("geovisio_editor_pictures","visibility","visible"),this.map.once("styledata",(()=>this.loader.dismiss()))})),this._sequenceData=at.features,this.map.getSource("geovisio_editor_sequences").setData({type:"FeatureCollection",features:[{id:this.sequence,type:"Feature",properties:{id:this.sequence},geometry:{type:"LineString",coordinates:at.features.map((at=>at.geometry.coordinates))}},...at.features.map((at=>(at.properties.id=at.id,at.properties.sequences=[this.sequence],at)))]}),this.picture){const st=at.features.find((at=>at.id===this.picture));st?(this.select(this.sequence,this.picture,!0),this.map.jumpTo({center:st.geometry.coordinates,zoom:18})):console.log("Picture with ID",st,"was not found")}else{const st=[...at.features[0].geometry.coordinates,...at.features[0].geometry.coordinates];for(let ot=1;ot<at.features.length;ot++){const ut=at.features[ot].geometry.coordinates;ut[0]<st[0]&&(st[0]=ut[0]),ut[1]<st[1]&&(st[1]=ut[1]),ut[0]>st[2]&&(st[2]=ut[0]),ut[1]>st[3]&&(st[3]=ut[1])}this.map.fitBounds(st,{animate:!1})}})).catch((at=>this.loader.dismiss(at,this._t.pnx.error_api)))}_getNode(at){const st=this._sequenceData.find((st=>st.properties.id===at)),ot=st?(0,sc.apiFeatureToPSVNode)(st,this._t,this._isInternetFast):null;return ot&&delete ot.links,ot}_addMapBackgroundWidget(){const at=(0,wc.createWebComp)("pnx-map-background",{_parent:this,size:"sm"});this._mapContainer.appendChild(at)}previewSequenceHeadingChange(at){const st=void 0!==this.map.getLayer(Sc);if(this.map._picMarkerPreview.remove(),void 0===at)return delete this._lastRelHeading,st&&this.map.setLayoutProperty(Sc,"visibility","none"),void(this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x));this._lastRelHeading=at,st||this.map.addLayer({id:Sc,type:"symbol",source:"geovisio_editor_sequences",layout:{"icon-image":"pnx-marker","icon-overlap":"always","icon-size":.8}});const ot=-this.psv.getPictureRelativeHeading();this.map.setLayoutProperty(Sc,"visibility","visible"),this.map.setLayoutProperty(Sc,"icon-rotate",["+",["get","view:azimuth"],ot,at]);const ut=[["==",["geometry-type"],"Point"]];this.picture&&ut.push(["!=",["get","id"],this.picture]),this.map.setFilter(Sc,["all",...ut]),this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x)}_onSelect(){void 0!==this._lastRelHeading&&this.previewSequenceHeadingChange(this._lastRelHeading)}}Editor.properties={raster:{converter:ut.A.GetJSONConverter()},background:{type:String},...ut.A.properties},customElements.define("pnx-editor",Editor)},3407:(at,st,ot)=>{"use strict";ot.d(st,{Ay:()=>PhotoViewer,RD:()=>su});ot(970);var ut=ot(1545),Hl=ot(4451),rc=ot(9039),sc=ot(9048),oc=ot(5995),_c=ot(7343),wc=ot(2118),Sc=ot(4207);const iu=Math.PI/6,su=["pnx-mini","pnx-widget-player","pnx-widget-zoom"];class PhotoViewer extends rc.A{constructor(){super(),this.psv={},this["url-parameters"]=this.getAttribute("url-parameters")||!0,this["keyboard-shortcuts"]=this.getAttribute("keyboard-shortcuts")||!0,this.widgets=this.getAttribute("widgets")||"true",this.grid=(0,oc.createWebComp)("pnx-cornered-grid"),this.psvContainer=document.createElement("div"),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.popup=(0,oc.createWebComp)("pnx-popup",{_parent:this,onclose:this._onPopupClose.bind(this)})}_createInitParamsHandler(){var at,st;this._initParams=new wc.Ay(wc.Ay.GetComponentProperties(PhotoViewer,this),Object.assign({},null===(at=this.urlHandler)||void 0===at?void 0:at.currentURLParams(),null===(st=this.urlHandler)||void 0===st?void 0:st.currentURLParams(!0)),{})}_initWidgets(){"false"!==this._initParams.getParentPostInit().widgets&&(this.grid.appendChild((0,oc.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.isWidthSmall()?(this.legend=(0,oc.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,oc.createWebComp)("pnx-bottom-drawer",{slot:"bottom",_parent:this,class:this._initParams.getParentPostInit().picture?void 0:"pnx-hidden"}),this.bottomDrawer.appendChild(this.legend),this.grid.appendChild(this.bottomDrawer),this.addEventListener("select",(at=>{(0,_c.isNullId)(at.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,oc.createWebComp)("pnx-widget-legend",{slot:this.isWidthSmall()?void 0:"top-left",_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild((0,oc.createWebComp)("pnx-widget-zoom",{slot:"bottom-right",class:"pnx-print-hidden",_parent:this})),this.grid.appendChild(this.legend),this.grid.appendChild((0,oc.createWebComp)("pnx-hashtags",{slot:"top-right",_parent:this,class:"pnx-only-psv pnx-print-hidden"}))))}connectedCallback(){super.connectedCallback(),this.presetsManager=new Sc.A(this.lang),this["url-parameters"]&&"false"!==this["url-parameters"]&&(this.urlHandler=new Hl.A(this),this.onceReady().then((()=>{this.urlHandler.listenToChanges(),this.urlHandler._onParentChange()}))),this.onceAPIReady().then(this._postAPIInit.bind(this))}disconnectedCallback(){var at,st;super.disconnectedCallback(),null===(at=this.urlHandler)||void 0===at||at.destroy(),null===(st=this.psv)||void 0===st||st.destroy()}firstUpdated(){super.firstUpdated(),this._moveChildToGrid()}getClassName(){return"PhotoViewer"}onceReady(){return this.oncePSVReady().then((()=>this._initParams.getParentPostInit().picture&&!this.psv.getPictureMetadata()?this.onceFirstPicLoaded():Promise.resolve()))}render(){return[this.loader,this.grid,this.popup]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["psv","grid","popup","urlHandler"])}oncePSVReady(){let at;return new Promise((st=>{at=setInterval((()=>{this.psv&&"object"===typeof this.psv&&(this.psv.container?(clearInterval(at),st()):this.psv.addEventListener&&this.psv.addEventListener("ready",(()=>{clearInterval(at),st()}),{once:!0}))}),250)}))}onceFirstPicLoaded(){return this.oncePSVReady().then((()=>this.psv.getPictureMetadata()?Promise.resolve():new Promise((at=>{this.psv.addEventListener("picture-loaded",at,{once:!0})}))))}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const at=this._initParams.getParentPostInit();this._initPSV(),this._initWidgets(),(0,wc.ai)(this,at),at.keyboardShortcuts&&this._handleKeyboardManagement(),at.picture?this.psv.addEventListener("picture-loaded",(()=>this.loader.dismiss()),{once:!0}):this.loader.dismiss()}_initPSV(){try{this.psv=new sc.Ay(this,this.psvContainer,{shouldGoFast:this._psvShouldGoFast.bind(this),keyboard:"always",keyboardActions:{...ut.zY.keyboardActions,8:"ROTATE_UP",2:"ROTATE_DOWN",4:"ROTATE_LEFT",6:"ROTATE_RIGHT",PageUp:()=>this.psv.goToNextPicture(),9:()=>this.psv.goToNextPicture(),PageDown:()=>this.psv.goToPrevPicture(),3:()=>this.psv.goToPrevPicture(),5:()=>this.moveCenter(),"*":()=>this.moveCenter(),Home:()=>this._toggleFocus(),7:()=>this._toggleFocus(),End:()=>this.mini.toggleAttribute("collapsed"),1:()=>this.mini.toggleAttribute("collapsed")," ":()=>this.psv.toggleSequencePlaying(),0:()=>this.psv.toggleSequencePlaying()},...this._initParams.getPSVInit()}),this.oncePSVReady().then((()=>{this.loader.setAttribute("value",50),(0,wc.Vy)(this.psv,this._initParams.getPSVPostInit())}))}catch(at){let st=ut.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(at,st)}}_handleKeyboardManagement(){const keytonone=()=>this.psv.stopKeyboardControl(),keytopsv=()=>this.psv.startKeyboardControl();this.popup.addEventListener("open",keytonone),this.popup.addEventListener("close",keytopsv),this.psv.addEventListener("click",keytopsv);for(let at of this.grid.childNodes)"bg"===at.getAttribute("slot")||su.includes(at.tagName.toLowerCase())||(at.addEventListener("focusin",keytonone),at.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&keytopsv()})))}_psvShouldGoFast(){return this.psv._sequencePlaying&&this.psv.getTransitionDuration()<1e3}_moveChildToGrid(){Array.from(this.querySelectorAll("[slot]")).forEach((at=>{var st;null!==(st=at.tagName)&&void 0!==st&&st.toLowerCase().startsWith("pnx-")&&(at._parent=this,at._t=this._t),"editors"===at.getAttribute("slot")?this.onceReady().then((()=>{var st;return null===(st=this.legend)||void 0===st?void 0:st.appendChild(at)})):this.grid.appendChild(at)}))}setPopup(at){let st=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;at?this.popup.setAttribute("visible",""):this.popup.removeAttribute("visible"),this.popup.innerHTML="","string"===typeof st?this.popup.innerHTML=st:Array.isArray(st)&&st.forEach((at=>this.popup.appendChild(at)))}_onPopupClose(){this.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:this.map&&this.isMapWide()?"map":"pic"}}))}_showQualityScoreDoc(){this.setPopup(!0,[(0,oc.createWebComp)("pnx-quality-score-doc",{_t:this._t})])}_showReportForm(){if(!this.psv.getPictureMetadata())throw new Error("No picture currently selected");this.setPopup(!0,[(0,oc.createWebComp)("pnx-report-form",{_parent:this})])}_showShareOptions(){this.setPopup(!0,[(0,oc.createWebComp)("pnx-share-menu",{_parent:this})])}moveCenter(){this.psv.getPictureMetadata()&&this._psvAnimate({speed:sc.LM,yaw:0,pitch:0,zoom:sc.cS})}moveLeft(){this._moveToDirection("left")}moveRight(){this._moveToDirection("right")}moveUp(){this._moveToDirection("up")}moveDown(){this._moveToDirection("down")}_moveToDirection(at){let st=this.psv.getPosition();switch(at){case"up":st.pitch+=iu;break;case"left":st.yaw-=iu;break;case"down":st.pitch-=iu;break;case"right":st.yaw+=iu}this._psvAnimate({speed:sc.LM,...st})}_psvAnimate(at){this._lastPsvAnim&&this._lastPsvAnim.cancel(),this._lastPsvAnim=this.psv.animate(at)}addEventListener(at,st,ot){super.addEventListener(at,st,ot)}}PhotoViewer.properties={psv:{converter:rc.A.GetJSONConverter()},widgets:{type:String},"url-parameters":{type:String},"keyboard-shortcuts":{type:String},...rc.A.properties},customElements.define("pnx-photo-viewer",PhotoViewer)},8743:(at,st,ot)=>{"use strict";ot.d(st,{$:()=>su,A:()=>Viewer});ot(9616);var ut=ot(8340),Hl=ot(3407),rc=(ot(9039),ot(2771)),sc=ot(7343),oc=ot(5995),_c=ot(9683),wc=ot(2e3),Sc=ot(9438),iu=ot(2118);const su=20,lu=(Math.PI,100);class Viewer extends Hl.Ay{constructor(){super(),this.map=!0,this.geocoder=this.getAttribute("geocoder")||"nominatim",this.mini=(0,oc.createWebComp)("pnx-mini",{slot:"bottom-left",_parent:this,onexpand:this._onMiniExpand.bind(this),collapsed:!!(0,sc.isNullId)(this.picture)||void 0}),this.mini.addEventListener("expand",this._toggleFocus.bind(this)),this.grid.appendChild(this.mini),this.mapContainer=document.createElement("div")}_createInitParamsHandler(){var at,st;this._initParams=new iu.Ay(iu.Ay.GetComponentProperties(Viewer,this),Object.assign({},null===(at=this.urlHandler)||void 0===at?void 0:at.currentURLParams(),null===(st=this.urlHandler)||void 0===st?void 0:st.currentURLParams(!0)),{map:(0,ut.getMapParamsFromLocalStorage)()})}_initWidgets(){var at,st;"false"!==this._initParams.getParentPostInit().widgets&&(this.grid.appendChild((0,oc.createWebComp)("pnx-widget-zoom",{slot:this.isWidthSmall()?"top-left":"bottom-right",class:this.isWidthSmall()?"pnx-only-map pnx-print-hidden":"pnx-print-hidden",_parent:this})),this.isWidthSmall()?(this.legend=(0,oc.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,oc.createWebComp)("pnx-bottom-drawer",{slot:"bottom",_parent:this,class:this._initParams.getParentPostInit().picture?void 0:"pnx-hidden"}),this.bottomDrawer.appendChild(this.legend),this.grid.appendChild(this.bottomDrawer),this.addEventListener("select",(at=>{(0,sc.isNullId)(at.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,oc.createWebComp)("pnx-widget-legend",{slot:this.isWidthSmall()?"top":"top-left",_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild(this.legend),this.grid.appendChild((0,oc.createWebComp)("pnx-hashtags",{slot:"top-right",_parent:this,class:"pnx-only-psv pnx-print-hidden"}))),this.grid.appendChild((0,oc.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,oc.createWebComp)("pnx-widget-geosearch",{slot:this.isWidthSmall()?"top-right":"top-left",_parent:this,class:"pnx-only-map pnx-print-hidden",geocoder:this._initParams.getParentPostInit().geocoder})),this.grid.appendChild((0,oc.createWebComp)("pnx-widget-mapfilters",{slot:this.isWidthSmall()?"top-right":"top-left",_parent:this,"user-search":null!==this.api._endpoints.user_search&&null!==this.api._endpoints.user_tiles,"quality-score":(null===(at=this.map)||void 0===at||null===(st=at._hasQualityScore)||void 0===st?void 0:st.call(at))||!1,class:"pnx-only-map pnx-print-hidden"})),this.grid.appendChild((0,oc.createWebComp)("pnx-widget-maplayers",{slot:"top-right",_parent:this,class:"pnx-only-map pnx-print-hidden"})))}disconnectedCallback(){var at;super.disconnectedCallback(),null===(at=this.map)||void 0===at||at.destroy()}getClassName(){return"Viewer"}getSubComponentsNames(){return super.getSubComponentsNames().concat(["mini","map"])}onceReady(){return Promise.all([this.oncePSVReady(),this.onceMapReady()]).then((()=>this._initParams.getParentPostInit().picture&&!this.psv.getPictureMetadata()?this.onceFirstPicLoaded():Promise.resolve()))}attributeChangedCallback(at,st,ot){var ut,Hl,rc,oc;(super.attributeChangedCallback(at,st,ot),"picture"===at)&&(null===(ut=this.legend)||void 0===ut||null===(Hl=ut.setAttribute)||void 0===Hl||Hl.call(ut,"picture",ot),(0,sc.isNullId)(st)&&!(0,sc.isNullId)(ot)&&this.mini.removeAttribute("collapsed"),(0,sc.isNullId)(ot)?this.map&&this.isMapWide()?this.mini.classList.add("pnx-hidden"):this.map&&!this.isMapWide()&&this._setFocus("map"):(this.mini.classList.remove("pnx-hidden"),(0,sc.isNullId)(st)&&(this._setFocus("pic"),"closed"===(null===(rc=this.bottomDrawer)||void 0===rc||null===(oc=rc.getAttribute)||void 0===oc?void 0:oc.call(rc,"openness"))&&this.bottomDrawer.setAttribute("openness","half-opened"))));"focus"===at&&this._setFocus(ot)}onceMapReady(){if(!this.map)return Promise.resolve();let at;return new Promise((st=>{at=setInterval((()=>{var ot,ut,Hl;"object"===typeof this.map&&(null!==(ot=this.map)&&void 0!==ot&&null!==(ut=ot.loaded)&&void 0!==ut&&ut.call(ot)?(clearInterval(at),st()):null!==(Hl=this.map)&&void 0!==Hl&&Hl.once&&this.map.once("render",(()=>{clearInterval(at),st()})))}),250)}))}async _initMap(){await new Promise((at=>{this.map=new rc.A(this,this.mapContainer,this._initParams.getMapInit()),(0,ut.saveMapParamsToLocalStorage)(this.map),this.map.once("users-changed",(()=>{this.loader.setAttribute("value",75),at()}))})),await(0,iu.mK)(this.map,this._initParams.getMapPostInit()),(0,ut.initMapKeyboardHandler)(this),(0,ut.linkMapAndPhoto)(this)}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const at=this._initParams.getParentPostInit();this._initPSV(),await this._initMap(),this._initWidgets(),this._moveChildToGrid(),(0,iu.iz)(this,at),at.keyboardShortcuts&&this._handleKeyboardManagement(),at.picture?this.psv.addEventListener("picture-loaded",(()=>{(0,iu.iz)(this,at),this.loader.dismiss()}),{once:!0}):this.loader.dismiss()}_handleKeyboardManagement(){const keytomap=()=>{this.psv.stopKeyboardControl(),this.map.keyboard.enable()},keytopsv=()=>{this.psv.startKeyboardControl(),this.map.keyboard.disable()},keytonone=()=>{this.psv.stopKeyboardControl(),this.map.keyboard.disable()},keytofocused=()=>{this.map&&this.isMapWide()?keytomap():keytopsv()};this.addEventListener("focus-changed",(at=>{"map"===at.detail.focus&&keytomap(),this.popup.getAttribute("visible")?keytonone():keytopsv()})),this.popup.addEventListener("open",(()=>keytonone())),this.popup.addEventListener("close",(()=>keytofocused()));for(let at of this.grid.childNodes)"bg"===at.getAttribute("slot")||Hl.RD.includes(at.tagName.toLowerCase())||(at.addEventListener("focusin",(()=>keytonone())),at.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&keytofocused()})))}moveCenter(){const at=this.psv.getPictureMetadata();at&&(this.map&&this.isMapWide()?this.map.flyTo({center:at.gps,zoom:20}):super.moveCenter())}_moveToDirection(at){if(this.map&&this.isMapWide()){let st;switch(at){case"up":st=[0,-100];break;case"left":st=[-100,0];break;case"down":st=[0,lu];break;case"right":st=[lu,0]}this.map.panBy(st)}else super._moveToDirection(at)}isMapWide(){return this.mapContainer.parentNode==this.grid}_setFocus(at){var st,ot,ut,Hl;let rc=arguments.length>1&&void 0!==arguments[1]&&arguments[1],Sc=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("map"===at&&!this.map)throw new Error("Map is not enabled");if(!["map","pic"].includes(at))throw new Error("Invalid focus value (should be pic or map)");if(this.focus=at,(Sc||("map"!==at||!this.map||!this.isMapWide())&&("pic"!==at||this.map&&this.isMapWide()))&&("map"===at?(this.psvContainer.parentNode==this.grid&&(this.grid.removeChild(this.psvContainer),this.psvContainer.removeAttribute("slot")),this.mapContainer.parentNode==this.mini&&this.mini.removeChild(this.mapContainer),this.mapContainer.setAttribute("slot","bg"),this.grid.appendChild(this.mapContainer),this.mini.appendChild(this.psvContainer),this.mini.icon=(0,oc.fa)(_c.pt),(0,sc.isNullId)(this.picture)?this.mini.classList.add("pnx-hidden"):this.mini.classList.remove("pnx-hidden"),this.map.getCanvas().focus()):(this.mapContainer.parentNode==this.grid&&(this.grid.removeChild(this.mapContainer),this.mapContainer.removeAttribute("slot")),this.psvContainer.parentNode==this.mini&&this.mini.removeChild(this.psvContainer),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.mini.classList.remove("pnx-hidden"),this.mini.appendChild(this.mapContainer),this.mini.icon=(0,oc.fa)(wc.e5),this.psvContainer.focus()),null===this||void 0===this||null===(st=this.map)||void 0===st||null===(ot=st.resize)||void 0===ot||ot.call(st),this.psv.autoSize(),this.psv.forceRefresh(),null===(ut=this.legend)||void 0===ut||null===(Hl=ut.setAttribute)||void 0===Hl||Hl.call(ut,"focus",this.focus),!rc)){const st=new CustomEvent("focus-changed",{detail:{focus:at}});this.dispatchEvent(st)}}_toggleFocus(){this._setFocus(this.isMapWide()?"pic":"map")}_onMiniExpand(){this.map.resize(),this.psv.autoSize()}_onMapFiltersChange(){var at;const st=(0,Sc.qi)("#pnx-map-filters-menu"),ot=null===st||void 0===st?void 0:st.shadowRoot.getElementById("pnx-filter-date-from"),ut=null===st||void 0===st?void 0:st.shadowRoot.getElementById("pnx-filter-date-end"),Hl=null===st||void 0===st?void 0:st.shadowRoot.querySelectorAll("input[name='pnx-filter-type']"),rc=(0,Sc.qi)("#pnx-map-theme");let sc="";for(let wc=0;wc<Hl.length;wc++){const at=Hl[wc];if(at.checked){sc=at.value;break}}let oc=[];if(null!==(at=this.map)&&void 0!==at&&at._hasQualityScore()){const at=null===st||void 0===st?void 0:st.shadowRoot.getElementById("pnx-filter-qualityscore");oc=((null===at||void 0===at?void 0:at.grade)||"").split(",").map((at=>parseInt(at))).filter((at=>!isNaN(at))),5==oc.length&&(oc=[])}const _c={minDate:null===ot||void 0===ot?void 0:ot.value,maxDate:null===ut||void 0===ut?void 0:ut.value,pic_type:sc,theme:null===rc||void 0===rc?void 0:rc.value,qualityscore:oc};this.map.setFilters(_c)}}Viewer.properties={map:{converter:Hl.Ay.GetJSONConverter()},focus:{type:String,reflect:!0},geocoder:{type:String},...Hl.Ay.properties},customElements.define("pnx-viewer",Viewer)},3921:(at,st,ot)=>{"use strict";ot.r(st),ot.d(st,{Basic:()=>ut.A,CoverageMap:()=>Hl.A,Editor:()=>rc.A,PhotoViewer:()=>oc.Ay,Viewer:()=>sc.A});var ut=ot(9039),Hl=ot(153),rc=ot(1752),sc=ot(8743),oc=ot(3407)},9341:(at,st,ot)=>{"use strict";ot.r(st),ot.d(st,{core:()=>ut,layout:()=>Hl,menus:()=>rc,ui:()=>sc});var ut=ot(3921),Hl=ot(456),rc=ot(8794),sc=ot(9472)},6784:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>BottomDrawer});var ut=ot(4542),Hl=ot(1198);const rc={opened:0,"half-opened":.7,closed:1};class BottomDrawer extends ut.WF{constructor(){super(),this._isDragging=!1,this.openness="half-opened"}firstUpdated(){var at;super.firstUpdated(),this._boundTouchMove=this._onTouchMove.bind(this),this._boundTouchEnd=this._onTouchEnd.bind(this),this._drawerHeight=window.innerHeight-30;const st=this._getDrawer();st&&(st.style.height=`${this._drawerHeight}px`,st.style.maxHeight=`${this._drawerHeight}px`,null===(at=this._parent)||void 0===at||at.onceReady().then((()=>{var at,st;null===(at=this._parent.map)||void 0===at||at.addEventListener("click",(()=>this.openness="closed")),null===(st=this._parent.psv)||void 0===st||st.addEventListener("click",(()=>this.openness="closed"))})))}attributeChangedCallback(at,st,ot){if(super.attributeChangedCallback(at,st,ot),"openness"===at){if("opened"!==ot){const at=this.shadowRoot.querySelector(".content");at&&(at.scrollTop=0)}const at=this._getDrawer();at&&(at.style.transform=null)}}disconnectedCallback(){super.disconnectedCallback(),this._cleanupTouchListeners()}_getDrawer(){var at;return null===(at=this.shadowRoot)||void 0===at?void 0:at.querySelector(".drawer")}_onHandleClick(){"opened"===this.openness?this.openness="closed":"half-opened"===this.openness?this.openness="opened":"closed"===this.openness&&(this.openness="half-opened")}_onTouchStart(at){this._isDragging=!0,this._startFingerY=at.touches[0].clientY,this._deltaFingerY=0,this._drawerY=this._drawerHeight*rc[this.openness],window.addEventListener("touchmove",this._boundTouchMove,{passive:!0}),window.addEventListener("touchend",this._boundTouchEnd),window.addEventListener("touchcancel",this._boundTouchEnd)}_onTouchMove(at){if(!this._isDragging)return;const st=this.shadowRoot.querySelector(".content");st.scrollHeight>st.offsetHeight&&st.scrollTop>0?this._updateDrawerTransform(0):(this._deltaFingerY=at.touches[0].clientY-this._startFingerY,this._updateDrawerTransform(this._drawerY+this._deltaFingerY))}_onTouchEnd(at){(this._isDragging&&!(Math.abs(this._deltaFingerY)<30)||at.target.closest(".handle"))&&(at.preventDefault(),this._isDragging=!1,0===this._deltaFingerY&&"closed"===this.openness?this.openness="half-opened":this._updateDrawerTransform(this._drawerY+this._deltaFingerY,!0),this._cleanupTouchListeners(),this._startFingerY=null,this._deltaFingerY=null)}_cleanupTouchListeners(){window.removeEventListener("touchmove",this._boundTouchMove),window.removeEventListener("touchend",this._boundTouchEnd),window.removeEventListener("touchcancel",this._boundTouchCancel)}_updateDrawerTransform(at){let st=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const ot=this._getDrawer();ot&&(at=Math.max(0,Math.min(at,this._drawerHeight-30)),st&&(this._deltaFingerY<0?"closed"===this.openness?Math.abs(this._deltaFingerY)>this._drawerHeight*(1-rc["half-opened"])?this.openness="opened":this.openness="half-opened":this.openness="opened":this.openness="closed",this._drawerY=null,at=Math.max(0,Math.min(rc[this.openness]*this._drawerHeight,this._drawerHeight-30))),ot.style.transform=`translateY(${at}px)`)}render(){const at={drawer:!0,[this.openness]:!0,dragging:this._isDragging};return ut.qy`
12
+ !function(at,st){"object"===typeof exports&&"object"===typeof module?module.exports=st():"function"===typeof define&&define.amd?define("Panoramax",[],st):"object"===typeof exports?exports.Panoramax=st():at.Panoramax=st()}(this,(()=>(()=>{var at={9039:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>Basic});var ut=ot(4542),Hl=ot(5254),rc=ot(4964),sc=ot(8340),oc=ot(5995),_c=ot(7343),wc=ot(2614),Sc=ot.n(wc),iu=ot(8330);ot(1865),ot(3638);class Basic extends ut.WF{constructor(){let at=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.users=["geovisio"],this.mapstyle=this.getAttribute("mapstyle")||sc.DEFAULT_TILES,this.lang=this.getAttribute("lang")||null,this.endpoint=this.getAttribute("endpoint")||null,this.picture=this.getAttribute("picture")||null,this.sequence=this.getAttribute("sequence")||null,console.info(`\ud83d\udcf7 Panoramax ${this.getClassName()} - Version ${iu.rE} (a32876b)\n\n\ud83c\udd98 Issues can be reported at ${iu.Jk.O}`),at||(this._isInternetFast=null,(0,_c.isInternetFast)().then((at=>this._isInternetFast=at)))}connectedCallback(){super.connectedCallback(),this._t=(0,rc.getTranslations)(this.lang),this.loader=(0,oc.createWebComp)("pnx-loader",{_parent:this,"no-label":(0,_c.isInIframe)()}),this._loadsAPI&&this.endpoint&&this._loadsAPI===this.endpoint||this.api&&this.api._endpoint===this.endpoint||!this.endpoint||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())}_setupAPI(){if(this.loader=this.loader||(0,oc.createWebComp)("pnx-loader",{_parent:this}),!this.endpoint)return void console.warn("No endpoint is defined");this._loadsAPI=this.endpoint;let at=this.endpoint;try{this.mapstyle=JSON.parse(this.mapstyle)}catch(ot){}try{this.api=new Hl.A(this.endpoint,{users:this.users,fetch:this.fetchOptions,style:this.mapstyle}),this.api.onceReady().then((()=>{if(at!=this._loadsAPI||!this.api)return;let st=this.api.getUnavailableFeatures(),ot=this.api.getAvailableFeatures();ot=0===st.length?"\u2705 All features available":"\u2705 Available features: "+ot.join(", "),st=0===st.length?"":"\ud83d\udeab Unavailable features: "+st.join(", "),console.info(`\ud83c\udf10 Connected to API "${this.api._metadata.name}" (${this.api._endpoint})\n\u2139\ufe0f API runs STAC ${this.api._metadata.stac_version} ${this.api._metadata.geovisio_version?"& GeoVisio "+this.api._metadata.geovisio_version:""}\n ${ot}\n ${st}\n`.trim())})).catch((at=>this.loader.dismiss(at,this._t.pnx.error_api))).finally((()=>delete this._loadsAPI))}catch(ot){var st;delete this._loadsAPI,null!==(st=this.loader)&&void 0!==st&&st.dismiss?this.loader.dismiss(ot,this._t.pnx.error_api):console.error(ot)}}onceReady(){throw new Error("You must override this method on sub-class")}onceAPIReady(){return this.api?this.api.onceReady():new Promise((at=>setTimeout(at,100))).then(this.onceAPIReady.bind(this))}createRenderRoot(){return this}attributeChangedCallback(at,st,ot){if(super.attributeChangedCallback(at,st,ot),"endpoint"===at&&(this._loadsAPI&&ot&&this._loadsAPI===ot||this.api&&this.api._endpoint===ot||!ot||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())),["picture","sequence"].includes(at)){let ut,Hl,rc,sc;"picture"===at?(ut=this.sequence,rc=this.sequence,Hl=ot,sc=st):(ut=ot,rc=st,Hl=this.picture,sc=this.picture),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{seqId:ut,picId:Hl,prevSeqId:rc,prevPicId:sc}}))}}getClassName(){return"Basic"}select(){let at=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,st=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&(this.picture=null,this.sequence=null),this.picture=st,this.sequence=at}isWidthSmall(){return(null===this||void 0===this?void 0:this.offsetWidth)<576}isHeightSmall(){return(null===this||void 0===this?void 0:this.offsetHeight)<400}render(){return ut.qy`<p>Should not be used directly, use Viewer/CoverageMap/Editor instead</p>`}getSubComponentsNames(){return["loader","api"]}addEventListener(at,st,ot){let ut=at.split(":").shift();if(ut&&this.getSubComponentsNames().includes(ut)){var Hl;const rc=at.substring(ut.length+1);null!==(Hl=this[ut])&&void 0!==Hl&&Hl.addEventListener?this[ut].addEventListener(rc,st,ot):setTimeout((()=>this.addEventListener(at,st,ot)),50)}else super.addEventListener(at,st,ot)}static GetJSONConverter(){return{fromAttribute:at=>"object"===typeof at?at:Sc().parse(at),toAttribute:at=>JSON.stringify(at)}}}Basic.properties={picture:{type:String,reflect:!0},sequence:{type:String,reflect:!0},fetchOptions:{converter:Basic.GetJSONConverter()},users:{type:Array,reflect:!0},mapstyle:{type:String},lang:{type:String},endpoint:{type:String}}},153:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>CoverageMap});var ut=ot(9039),Hl=ot(5642),rc=ot(8340),sc=ot(927),oc=(ot(7776),ot(2118));class CoverageMap extends ut.A{constructor(){super(),this._mapContainer=document.createElement("div"),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this._initParams=new oc.Ay(oc.Ay.GetComponentProperties(CoverageMap,this)),this._initMap()}))}disconnectedCallback(){var at;super.disconnectedCallback(),null===(at=this.map)||void 0===at||at.destroy()}getClassName(){return"CoverageMap"}onceReady(){return this.map&&this.map.waitForEnoughMapLoaded?this.map.waitForEnoughMapLoaded():new Promise((at=>setTimeout(at,100))).then(this.onceReady.bind(this))}render(){return[this.loader,this._mapContainer]}getSubComponentsNames(){const at=super.getSubComponentsNames();return at.push("map"),at}_initMap(){class MyMap extends Hl.A{_getLayerStyleProperties(at){return"pictures_symbols"===at?{layout:{visibility:"none"}}:super._getLayerStyleProperties(at)}}this.map=new MyMap(this,this._mapContainer,Object.assign({},this._initParams.getMapInit(),{hash:!0})),this.map.addControl(new sc.NavigationControl({showCompass:!1})),this.loader.setAttribute("value",70),this.addEventListener("select",this._onSelect.bind(this)),this.map.on("picture-click",(at=>this.select(at.seqId,at.picId))),this.map.on("sequence-click",(at=>this.select(at.seqId))),this.map.waitForEnoughMapLoaded().then((async()=>{await(0,oc.mK)(this.map,this._initParams.getMapPostInit()),this.map.reloadLayersStyles(),this.loader.dismiss()}))}_onSelect(at){if(at.detail.picId||at.detail.seqId){const st=at.detail.picId?"pictures":"sequences",ot=this.map.queryRenderedFeatures({layers:[...this.map._userLayers].map((at=>(0,rc.getUserLayerId)(at,st))),filter:["==",["get","id"],at.detail.picId||at.detail.seqId]});ot.length>=0&&null!=ot[0]&&this.map._attachPreviewToPictures({features:ot},st)}}}CoverageMap.properties={map:{converter:ut.A.GetJSONConverter()},...ut.A.properties},customElements.define("pnx-coverage-map",CoverageMap)},1752:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>Editor});ot(7365);var ut=ot(9039),Hl=ot(5642),rc=ot(9048),sc=(ot(7534),ot(6810),ot(508)),oc=ot(8340),_c=ot(1545),wc=(ot(4542),ot(5995));const Sc="sequence-headings";class Editor extends ut.A{constructor(){super(),this.raster=null,this.background="streets",this.users=[],this._psvContainer=document.createElement("div"),this._mapContainer=document.createElement("div"),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this.sequence||this.loader.dismiss({},"No sequence is selected"),this.addEventListener("select",this._onSelect.bind(this)),this._initPSV(),this._initMap()}))}disconnectedCallback(){var at,st;super.disconnectedCallback(),null===(at=this.map)||void 0===at||at.destroy(),null===(st=this.psv)||void 0===st||st.destroy()}getClassName(){return"Editor"}onceReady(){var at,st;return this.map&&this.psv&&null!==(at=(st=this.map).loaded)&&void 0!==at&&at.call(st)?Promise.resolve():new Promise((at=>setTimeout(at,100))).then(this.onceReady.bind(this))}connectedCallback(){Array.isArray(this.users)&&this.users.length>0&&(console.warn("Parameters users can't be changed in Editor, only selected sequence can be visible"),this.users=[]),super.connectedCallback()}attributeChangedCallback(at,st,ot){"users"===at&&Array.isArray(ot)&&ot.length>0?console.warn("Parameters users can't be changed in Editor, only selected sequence can be visible"):super.attributeChangedCallback(at,st,ot)}render(){return[this.loader,this._psvContainer,this._mapContainer]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["map","psv"])}_initPSV(){try{this.psv=new rc.Ay(this,this._psvContainer),this.psv._myVTour.datasource.nodeResolver=this._getNode.bind(this)}catch(at){let st=_c.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(at,st)}}_initMap(){try{this.map=new Hl.A(this,this._mapContainer,{raster:this.raster,background:this.background,supplementaryStyle:this._createMapStyle(),zoom:15,picMarkerDraggable:!0}),(0,oc.linkMapAndPhoto)(this),this.loader.setAttribute("value",50),this._loadSequence(),this.map.once("load",(()=>{this.map.hasTwoBackgrounds()&&this._addMapBackgroundWidget(),this._bindPicturesEvents()}));const at=this.map._picMarker.setRotation.bind(this.map._picMarker);this.map._picMarker.setRotation=st=>(st=void 0===this._lastRelHeading?st:st+this._lastRelHeading-this.psv.getPictureRelativeHeading(),at(st))}catch(at){this.loader.dismiss(at,this._t.pnx.error_psv)}}_createMapStyle(){return{sources:{geovisio_editor_sequences:{type:"geojson",data:{type:"FeatureCollection",features:[]}}},layers:[{id:"geovisio_editor_sequences",type:"line",source:"geovisio_editor_sequences",layout:{...oc.VECTOR_STYLES.SEQUENCES.layout},paint:{...oc.VECTOR_STYLES.SEQUENCES.paint}},{id:"geovisio_editor_pictures",type:"circle",source:"geovisio_editor_sequences",layout:{...oc.VECTOR_STYLES.PICTURES.layout},paint:{...oc.VECTOR_STYLES.PICTURES.paint}}]}}_bindPicturesEvents(){this.map.on("mousemove","geovisio_editor_pictures",(()=>{this.map.getCanvas().style.cursor="pointer"})),this.map.on("mouseleave","geovisio_editor_pictures",(()=>{this.map.getCanvas().style.cursor=""})),this.map.on("click","geovisio_editor_pictures",this.map._onPictureClick.bind(this.map))}_loadSequence(){return this.loader.setAttribute("value",60),this.api.getSequenceItems(this.sequence).then((at=>{if(this.loader.setAttribute("value",80),this.map.once("sourcedata",(()=>{this.map.setPaintProperty("geovisio_editor_sequences","line-color",this.map._getLayerColorStyle("sequences")),this.map.setPaintProperty("geovisio_editor_pictures","circle-color",this.map._getLayerColorStyle("pictures")),this.map.setLayoutProperty("geovisio_editor_sequences","visibility","visible"),this.map.setLayoutProperty("geovisio_editor_pictures","visibility","visible"),this.map.once("styledata",(()=>this.loader.dismiss()))})),this._sequenceData=at.features,this.map.getSource("geovisio_editor_sequences").setData({type:"FeatureCollection",features:[{id:this.sequence,type:"Feature",properties:{id:this.sequence},geometry:{type:"LineString",coordinates:at.features.map((at=>at.geometry.coordinates))}},...at.features.map((at=>(at.properties.id=at.id,at.properties.sequences=[this.sequence],at)))]}),this.picture){const st=at.features.find((at=>at.id===this.picture));st?(this.select(this.sequence,this.picture,!0),this.map.jumpTo({center:st.geometry.coordinates,zoom:18})):console.log("Picture with ID",st,"was not found")}else{const st=[...at.features[0].geometry.coordinates,...at.features[0].geometry.coordinates];for(let ot=1;ot<at.features.length;ot++){const ut=at.features[ot].geometry.coordinates;ut[0]<st[0]&&(st[0]=ut[0]),ut[1]<st[1]&&(st[1]=ut[1]),ut[0]>st[2]&&(st[2]=ut[0]),ut[1]>st[3]&&(st[3]=ut[1])}this.map.fitBounds(st,{animate:!1})}})).catch((at=>this.loader.dismiss(at,this._t.pnx.error_api)))}_getNode(at){const st=this._sequenceData.find((st=>st.properties.id===at)),ot=st?(0,sc.apiFeatureToPSVNode)(st,this._t,this._isInternetFast):null;return ot&&delete ot.links,ot}_addMapBackgroundWidget(){const at=(0,wc.createWebComp)("pnx-map-background",{_parent:this,size:"sm"});this._mapContainer.appendChild(at)}previewSequenceHeadingChange(at){const st=void 0!==this.map.getLayer(Sc);if(this.map._picMarkerPreview.remove(),void 0===at)return delete this._lastRelHeading,st&&this.map.setLayoutProperty(Sc,"visibility","none"),void(this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x));this._lastRelHeading=at,st||this.map.addLayer({id:Sc,type:"symbol",source:"geovisio_editor_sequences",layout:{"icon-image":"pnx-marker","icon-overlap":"always","icon-size":.8}});const ot=-this.psv.getPictureRelativeHeading();this.map.setLayoutProperty(Sc,"visibility","visible"),this.map.setLayoutProperty(Sc,"icon-rotate",["+",["get","view:azimuth"],ot,at]);const ut=[["==",["geometry-type"],"Point"]];this.picture&&ut.push(["!=",["get","id"],this.picture]),this.map.setFilter(Sc,["all",...ut]),this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x)}_onSelect(){void 0!==this._lastRelHeading&&this.previewSequenceHeadingChange(this._lastRelHeading)}}Editor.properties={raster:{converter:ut.A.GetJSONConverter()},background:{type:String},...ut.A.properties},customElements.define("pnx-editor",Editor)},3407:(at,st,ot)=>{"use strict";ot.d(st,{Ay:()=>PhotoViewer,RD:()=>su});ot(970);var ut=ot(1545),Hl=ot(4451),rc=ot(9039),sc=ot(9048),oc=ot(5995),_c=ot(7343),wc=ot(2118),Sc=ot(4207);const iu=Math.PI/6,su=["pnx-mini","pnx-widget-player","pnx-widget-zoom"];class PhotoViewer extends rc.A{constructor(){super(),this.psv={},this["url-parameters"]=this.getAttribute("url-parameters")||!0,this["keyboard-shortcuts"]=this.getAttribute("keyboard-shortcuts")||!0,this.widgets=this.getAttribute("widgets")||"true",this.grid=(0,oc.createWebComp)("pnx-cornered-grid"),this.psvContainer=document.createElement("div"),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.popup=(0,oc.createWebComp)("pnx-popup",{_parent:this,onclose:this._onPopupClose.bind(this)})}_createInitParamsHandler(){var at,st;this._initParams=new wc.Ay(wc.Ay.GetComponentProperties(PhotoViewer,this),Object.assign({},null===(at=this.urlHandler)||void 0===at?void 0:at.currentURLParams(),null===(st=this.urlHandler)||void 0===st?void 0:st.currentURLParams(!0)),{})}_initWidgets(){"false"!==this._initParams.getParentPostInit().widgets&&(this.grid.appendChild((0,oc.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.isWidthSmall()?(this.legend=(0,oc.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,oc.createWebComp)("pnx-bottom-drawer",{slot:"bottom",_parent:this,class:this._initParams.getParentPostInit().picture?void 0:"pnx-hidden"}),this.bottomDrawer.appendChild(this.legend),this.grid.appendChild(this.bottomDrawer),this.addEventListener("select",(at=>{(0,_c.isNullId)(at.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,oc.createWebComp)("pnx-widget-legend",{slot:this.isWidthSmall()?void 0:"top-left",_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild((0,oc.createWebComp)("pnx-widget-zoom",{slot:"bottom-right",class:"pnx-print-hidden",_parent:this})),this.grid.appendChild(this.legend),this.grid.appendChild((0,oc.createWebComp)("pnx-hashtags",{slot:"top-right",_parent:this,class:"pnx-only-psv pnx-print-hidden"}))))}connectedCallback(){super.connectedCallback(),this.presetsManager=new Sc.A(this.lang),this["url-parameters"]&&"false"!==this["url-parameters"]&&(this.urlHandler=new Hl.A(this),this.onceReady().then((()=>{this.urlHandler.listenToChanges(),this.urlHandler._onParentChange()}))),this.onceAPIReady().then(this._postAPIInit.bind(this))}disconnectedCallback(){var at,st;super.disconnectedCallback(),null===(at=this.urlHandler)||void 0===at||at.destroy(),null===(st=this.psv)||void 0===st||st.destroy()}firstUpdated(){super.firstUpdated(),this._moveChildToGrid()}getClassName(){return"PhotoViewer"}onceReady(){return this.oncePSVReady().then((()=>this._initParams.getParentPostInit().picture&&!this.psv.getPictureMetadata()?this.onceFirstPicLoaded():Promise.resolve()))}render(){return[this.loader,this.grid,this.popup]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["psv","grid","popup","urlHandler"])}oncePSVReady(){let at;return new Promise((st=>{at=setInterval((()=>{this.psv&&"object"===typeof this.psv&&(this.psv.container?(clearInterval(at),st()):this.psv.addEventListener&&this.psv.addEventListener("ready",(()=>{clearInterval(at),st()}),{once:!0}))}),250)}))}onceFirstPicLoaded(){return this.oncePSVReady().then((()=>this.psv.getPictureMetadata()?Promise.resolve():new Promise((at=>{this.psv.addEventListener("picture-loaded",at,{once:!0})}))))}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const at=this._initParams.getParentPostInit();this._initPSV(),this._initWidgets(),(0,wc.ai)(this,at),at.keyboardShortcuts&&this._handleKeyboardManagement(),at.picture?this.psv.addEventListener("picture-loaded",(()=>this.loader.dismiss()),{once:!0}):this.loader.dismiss()}_initPSV(){try{this.psv=new sc.Ay(this,this.psvContainer,{shouldGoFast:this._psvShouldGoFast.bind(this),keyboard:"always",keyboardActions:{...ut.zY.keyboardActions,8:"ROTATE_UP",2:"ROTATE_DOWN",4:"ROTATE_LEFT",6:"ROTATE_RIGHT",PageUp:()=>this.psv.goToNextPicture(),9:()=>this.psv.goToNextPicture(),PageDown:()=>this.psv.goToPrevPicture(),3:()=>this.psv.goToPrevPicture(),5:()=>this.moveCenter(),"*":()=>this.moveCenter(),Home:()=>this._toggleFocus(),7:()=>this._toggleFocus(),End:()=>this.mini.toggleAttribute("collapsed"),1:()=>this.mini.toggleAttribute("collapsed")," ":()=>this.psv.toggleSequencePlaying(),0:()=>this.psv.toggleSequencePlaying()},...this._initParams.getPSVInit()}),this.oncePSVReady().then((()=>{this.loader.setAttribute("value",50),(0,wc.Vy)(this.psv,this._initParams.getPSVPostInit())}))}catch(at){let st=ut.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(at,st)}}_handleKeyboardManagement(){const keytonone=()=>this.psv.stopKeyboardControl(),keytopsv=()=>this.psv.startKeyboardControl();this.popup.addEventListener("open",keytonone),this.popup.addEventListener("close",keytopsv),this.psv.addEventListener("click",keytopsv);for(let at of this.grid.childNodes)"bg"===at.getAttribute("slot")||su.includes(at.tagName.toLowerCase())||(at.addEventListener("focusin",keytonone),at.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&keytopsv()})))}_psvShouldGoFast(){return this.psv._sequencePlaying&&this.psv.getTransitionDuration()<1e3}_moveChildToGrid(){Array.from(this.querySelectorAll("[slot]")).forEach((at=>{var st;null!==(st=at.tagName)&&void 0!==st&&st.toLowerCase().startsWith("pnx-")&&(at._parent=this,at._t=this._t),"editors"===at.getAttribute("slot")?this.onceReady().then((()=>{var st;return null===(st=this.legend)||void 0===st?void 0:st.appendChild(at)})):this.grid.appendChild(at)}))}setPopup(at){let st=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;at?this.popup.setAttribute("visible",""):this.popup.removeAttribute("visible"),this.popup.innerHTML="","string"===typeof st?this.popup.innerHTML=st:Array.isArray(st)&&st.forEach((at=>this.popup.appendChild(at)))}_onPopupClose(){this.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:this.map&&this.isMapWide()?"map":"pic"}}))}_showQualityScoreDoc(){this.setPopup(!0,[(0,oc.createWebComp)("pnx-quality-score-doc",{_t:this._t})])}_showReportForm(){if(!this.psv.getPictureMetadata())throw new Error("No picture currently selected");this.setPopup(!0,[(0,oc.createWebComp)("pnx-report-form",{_parent:this})])}_showShareOptions(){this.setPopup(!0,[(0,oc.createWebComp)("pnx-share-menu",{_parent:this})])}moveCenter(){this.psv.getPictureMetadata()&&this._psvAnimate({speed:sc.LM,yaw:0,pitch:0,zoom:sc.cS})}moveLeft(){this._moveToDirection("left")}moveRight(){this._moveToDirection("right")}moveUp(){this._moveToDirection("up")}moveDown(){this._moveToDirection("down")}_moveToDirection(at){let st=this.psv.getPosition();switch(at){case"up":st.pitch+=iu;break;case"left":st.yaw-=iu;break;case"down":st.pitch-=iu;break;case"right":st.yaw+=iu}this._psvAnimate({speed:sc.LM,...st})}_psvAnimate(at){this._lastPsvAnim&&this._lastPsvAnim.cancel(),this._lastPsvAnim=this.psv.animate(at)}addEventListener(at,st,ot){super.addEventListener(at,st,ot)}}PhotoViewer.properties={psv:{converter:rc.A.GetJSONConverter()},widgets:{type:String},"url-parameters":{type:String},"keyboard-shortcuts":{type:String},...rc.A.properties},customElements.define("pnx-photo-viewer",PhotoViewer)},8743:(at,st,ot)=>{"use strict";ot.d(st,{$:()=>su,A:()=>Viewer});ot(9616);var ut=ot(8340),Hl=ot(3407),rc=(ot(9039),ot(2771)),sc=ot(7343),oc=ot(5995),_c=ot(9683),wc=ot(2e3),Sc=ot(9438),iu=ot(2118);const su=20,lu=(Math.PI,100);class Viewer extends Hl.Ay{constructor(){super(),this.map=!0,this.geocoder=this.getAttribute("geocoder")||"nominatim",this.mini=(0,oc.createWebComp)("pnx-mini",{slot:"bottom-left",_parent:this,onexpand:this._onMiniExpand.bind(this),collapsed:!!(0,sc.isNullId)(this.picture)||void 0}),this.mini.addEventListener("expand",this._toggleFocus.bind(this)),this.grid.appendChild(this.mini),this.mapContainer=document.createElement("div")}_createInitParamsHandler(){var at,st;this._initParams=new iu.Ay(iu.Ay.GetComponentProperties(Viewer,this),Object.assign({},null===(at=this.urlHandler)||void 0===at?void 0:at.currentURLParams(),null===(st=this.urlHandler)||void 0===st?void 0:st.currentURLParams(!0)),{map:(0,ut.getMapParamsFromLocalStorage)()})}_initWidgets(){var at,st;"false"!==this._initParams.getParentPostInit().widgets&&(this.grid.appendChild((0,oc.createWebComp)("pnx-widget-zoom",{slot:this.isWidthSmall()?"top-left":"bottom-right",class:this.isWidthSmall()?"pnx-only-map pnx-print-hidden":"pnx-print-hidden",_parent:this})),this.isWidthSmall()?(this.legend=(0,oc.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,oc.createWebComp)("pnx-bottom-drawer",{slot:"bottom",_parent:this,class:this._initParams.getParentPostInit().picture?void 0:"pnx-hidden"}),this.bottomDrawer.appendChild(this.legend),this.grid.appendChild(this.bottomDrawer),this.addEventListener("select",(at=>{(0,sc.isNullId)(at.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,oc.createWebComp)("pnx-widget-legend",{slot:this.isWidthSmall()?"top":"top-left",_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild(this.legend),this.grid.appendChild((0,oc.createWebComp)("pnx-hashtags",{slot:"top-right",_parent:this,class:"pnx-only-psv pnx-print-hidden"}))),this.grid.appendChild((0,oc.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,oc.createWebComp)("pnx-widget-geosearch",{slot:this.isWidthSmall()?"top-right":"top-left",_parent:this,class:"pnx-only-map pnx-print-hidden",geocoder:this._initParams.getParentPostInit().geocoder})),this.grid.appendChild((0,oc.createWebComp)("pnx-widget-mapfilters",{slot:this.isWidthSmall()?"top-right":"top-left",_parent:this,"user-search":null!==this.api._endpoints.user_search&&null!==this.api._endpoints.user_tiles,"quality-score":(null===(at=this.map)||void 0===at||null===(st=at._hasQualityScore)||void 0===st?void 0:st.call(at))||!1,class:"pnx-only-map pnx-print-hidden"})),this.grid.appendChild((0,oc.createWebComp)("pnx-widget-maplayers",{slot:"top-right",_parent:this,class:"pnx-only-map pnx-print-hidden"})))}disconnectedCallback(){var at;super.disconnectedCallback(),null===(at=this.map)||void 0===at||at.destroy()}getClassName(){return"Viewer"}getSubComponentsNames(){return super.getSubComponentsNames().concat(["mini","map"])}onceReady(){return Promise.all([this.oncePSVReady(),this.onceMapReady()]).then((()=>this._initParams.getParentPostInit().picture&&!this.psv.getPictureMetadata()?this.onceFirstPicLoaded():Promise.resolve()))}attributeChangedCallback(at,st,ot){var ut,Hl,rc,oc;(super.attributeChangedCallback(at,st,ot),"picture"===at)&&(null===(ut=this.legend)||void 0===ut||null===(Hl=ut.setAttribute)||void 0===Hl||Hl.call(ut,"picture",ot),(0,sc.isNullId)(st)&&!(0,sc.isNullId)(ot)&&this.mini.removeAttribute("collapsed"),(0,sc.isNullId)(ot)?this.map&&this.isMapWide()?this.mini.classList.add("pnx-hidden"):this.map&&!this.isMapWide()&&this._setFocus("map"):(this.mini.classList.remove("pnx-hidden"),(0,sc.isNullId)(st)&&(this._setFocus("pic"),"closed"===(null===(rc=this.bottomDrawer)||void 0===rc||null===(oc=rc.getAttribute)||void 0===oc?void 0:oc.call(rc,"openness"))&&this.bottomDrawer.setAttribute("openness","half-opened"))));"focus"===at&&this._setFocus(ot)}onceMapReady(){if(!this.map)return Promise.resolve();let at;return new Promise((st=>{at=setInterval((()=>{var ot,ut,Hl;"object"===typeof this.map&&(null!==(ot=this.map)&&void 0!==ot&&null!==(ut=ot.loaded)&&void 0!==ut&&ut.call(ot)?(clearInterval(at),st()):null!==(Hl=this.map)&&void 0!==Hl&&Hl.once&&this.map.once("render",(()=>{clearInterval(at),st()})))}),250)}))}async _initMap(){await new Promise((at=>{this.map=new rc.A(this,this.mapContainer,this._initParams.getMapInit()),(0,ut.saveMapParamsToLocalStorage)(this.map),this.map.once("users-changed",(()=>{this.loader.setAttribute("value",75),at()}))})),await(0,iu.mK)(this.map,this._initParams.getMapPostInit()),(0,ut.initMapKeyboardHandler)(this),(0,ut.linkMapAndPhoto)(this)}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const at=this._initParams.getParentPostInit();this._initPSV(),await this._initMap(),this._initWidgets(),this._moveChildToGrid(),(0,iu.iz)(this,at),at.keyboardShortcuts&&this._handleKeyboardManagement(),at.picture?this.psv.addEventListener("picture-loaded",(()=>{(0,iu.iz)(this,at),this.loader.dismiss()}),{once:!0}):this.loader.dismiss()}_handleKeyboardManagement(){const keytomap=()=>{this.psv.stopKeyboardControl(),this.map.keyboard.enable()},keytopsv=()=>{this.psv.startKeyboardControl(),this.map.keyboard.disable()},keytonone=()=>{this.psv.stopKeyboardControl(),this.map.keyboard.disable()},keytofocused=()=>{this.map&&this.isMapWide()?keytomap():keytopsv()};this.addEventListener("focus-changed",(at=>{"map"===at.detail.focus&&keytomap(),this.popup.getAttribute("visible")?keytonone():keytopsv()})),this.popup.addEventListener("open",(()=>keytonone())),this.popup.addEventListener("close",(()=>keytofocused()));for(let at of this.grid.childNodes)"bg"===at.getAttribute("slot")||Hl.RD.includes(at.tagName.toLowerCase())||(at.addEventListener("focusin",(()=>keytonone())),at.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&keytofocused()})))}moveCenter(){const at=this.psv.getPictureMetadata();at&&(this.map&&this.isMapWide()?this.map.flyTo({center:at.gps,zoom:20}):super.moveCenter())}_moveToDirection(at){if(this.map&&this.isMapWide()){let st;switch(at){case"up":st=[0,-100];break;case"left":st=[-100,0];break;case"down":st=[0,lu];break;case"right":st=[lu,0]}this.map.panBy(st)}else super._moveToDirection(at)}isMapWide(){return this.mapContainer.parentNode==this.grid}_setFocus(at){var st,ot,ut,Hl;let rc=arguments.length>1&&void 0!==arguments[1]&&arguments[1],Sc=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("map"===at&&!this.map)throw new Error("Map is not enabled");if(!["map","pic"].includes(at))throw new Error("Invalid focus value (should be pic or map)");if(this.focus=at,(Sc||("map"!==at||!this.map||!this.isMapWide())&&("pic"!==at||this.map&&this.isMapWide()))&&("map"===at?(this.psvContainer.parentNode==this.grid&&(this.grid.removeChild(this.psvContainer),this.psvContainer.removeAttribute("slot")),this.mapContainer.parentNode==this.mini&&this.mini.removeChild(this.mapContainer),this.mapContainer.setAttribute("slot","bg"),this.grid.appendChild(this.mapContainer),this.mini.appendChild(this.psvContainer),this.mini.icon=(0,oc.fa)(_c.pt),(0,sc.isNullId)(this.picture)?this.mini.classList.add("pnx-hidden"):this.mini.classList.remove("pnx-hidden"),this.map.getCanvas().focus()):(this.mapContainer.parentNode==this.grid&&(this.grid.removeChild(this.mapContainer),this.mapContainer.removeAttribute("slot")),this.psvContainer.parentNode==this.mini&&this.mini.removeChild(this.psvContainer),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.mini.classList.remove("pnx-hidden"),this.mini.appendChild(this.mapContainer),this.mini.icon=(0,oc.fa)(wc.e5),this.psvContainer.focus()),null===this||void 0===this||null===(st=this.map)||void 0===st||null===(ot=st.resize)||void 0===ot||ot.call(st),this.psv.autoSize(),this.psv.forceRefresh(),null===(ut=this.legend)||void 0===ut||null===(Hl=ut.setAttribute)||void 0===Hl||Hl.call(ut,"focus",this.focus),!rc)){const st=new CustomEvent("focus-changed",{detail:{focus:at}});this.dispatchEvent(st)}}_toggleFocus(){this._setFocus(this.isMapWide()?"pic":"map")}_onMiniExpand(){this.map.resize(),this.psv.autoSize()}_onMapFiltersChange(){var at;const st=(0,Sc.qi)("#pnx-map-filters-menu"),ot=null===st||void 0===st?void 0:st.shadowRoot.getElementById("pnx-filter-date-from"),ut=null===st||void 0===st?void 0:st.shadowRoot.getElementById("pnx-filter-date-end"),Hl=null===st||void 0===st?void 0:st.shadowRoot.querySelectorAll("input[name='pnx-filter-type']"),rc=(0,Sc.qi)("#pnx-map-theme");let sc="";for(let wc=0;wc<Hl.length;wc++){const at=Hl[wc];if(at.checked){sc=at.value;break}}let oc=[];if(null!==(at=this.map)&&void 0!==at&&at._hasQualityScore()){const at=null===st||void 0===st?void 0:st.shadowRoot.getElementById("pnx-filter-qualityscore");oc=((null===at||void 0===at?void 0:at.grade)||"").split(",").map((at=>parseInt(at))).filter((at=>!isNaN(at))),5==oc.length&&(oc=[])}const _c={minDate:null===ot||void 0===ot?void 0:ot.value,maxDate:null===ut||void 0===ut?void 0:ut.value,pic_type:sc,theme:null===rc||void 0===rc?void 0:rc.value,qualityscore:oc};this.map.setFilters(_c)}}Viewer.properties={map:{converter:Hl.Ay.GetJSONConverter()},focus:{type:String,reflect:!0},geocoder:{type:String},...Hl.Ay.properties},customElements.define("pnx-viewer",Viewer)},3921:(at,st,ot)=>{"use strict";ot.r(st),ot.d(st,{Basic:()=>ut.A,CoverageMap:()=>Hl.A,Editor:()=>rc.A,PhotoViewer:()=>oc.Ay,Viewer:()=>sc.A});var ut=ot(9039),Hl=ot(153),rc=ot(1752),sc=ot(8743),oc=ot(3407)},9341:(at,st,ot)=>{"use strict";ot.r(st),ot.d(st,{core:()=>ut,layout:()=>Hl,menus:()=>rc,ui:()=>sc});var ut=ot(3921),Hl=ot(456),rc=ot(8794),sc=ot(9472)},6784:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>BottomDrawer});var ut=ot(4542),Hl=ot(1198);const rc={opened:0,"half-opened":.7,closed:1};class BottomDrawer extends ut.WF{constructor(){super(),this._isDragging=!1,this.openness="half-opened"}firstUpdated(){var at;super.firstUpdated(),this._boundTouchMove=this._onTouchMove.bind(this),this._boundTouchEnd=this._onTouchEnd.bind(this),this._drawerHeight=window.innerHeight-30;const st=this._getDrawer();st&&(st.style.height=`${this._drawerHeight}px`,st.style.maxHeight=`${this._drawerHeight}px`,null===(at=this._parent)||void 0===at||at.onceReady().then((()=>{var at,st;null===(at=this._parent.map)||void 0===at||at.addEventListener("click",(()=>this.openness="closed")),null===(st=this._parent.psv)||void 0===st||st.addEventListener("click",(()=>this.openness="closed"))})))}attributeChangedCallback(at,st,ot){if(super.attributeChangedCallback(at,st,ot),"openness"===at){if("opened"!==ot){const at=this.shadowRoot.querySelector(".content");at&&(at.scrollTop=0)}const at=this._getDrawer();at&&(at.style.transform=null)}}disconnectedCallback(){super.disconnectedCallback(),this._cleanupTouchListeners()}_getDrawer(){var at;return null===(at=this.shadowRoot)||void 0===at?void 0:at.querySelector(".drawer")}_onHandleClick(){"opened"===this.openness?this.openness="closed":"half-opened"===this.openness?this.openness="opened":"closed"===this.openness&&(this.openness="half-opened")}_onTouchStart(at){this._isDragging=!0,this._startFingerY=at.touches[0].clientY,this._deltaFingerY=0,this._drawerY=this._drawerHeight*rc[this.openness],window.addEventListener("touchmove",this._boundTouchMove,{passive:!0}),window.addEventListener("touchend",this._boundTouchEnd),window.addEventListener("touchcancel",this._boundTouchEnd)}_onTouchMove(at){if(!this._isDragging)return;const st=this.shadowRoot.querySelector(".content");st.scrollHeight>st.offsetHeight&&st.scrollTop>0?this._updateDrawerTransform(0):(this._deltaFingerY=at.touches[0].clientY-this._startFingerY,this._updateDrawerTransform(this._drawerY+this._deltaFingerY))}_onTouchEnd(at){(this._isDragging&&!(Math.abs(this._deltaFingerY)<30)||at.target.closest(".handle"))&&(at.preventDefault(),this._isDragging=!1,0===this._deltaFingerY&&"closed"===this.openness?this.openness="half-opened":this._updateDrawerTransform(this._drawerY+this._deltaFingerY,!0),this._cleanupTouchListeners(),this._startFingerY=null,this._deltaFingerY=null)}_cleanupTouchListeners(){window.removeEventListener("touchmove",this._boundTouchMove),window.removeEventListener("touchend",this._boundTouchEnd),window.removeEventListener("touchcancel",this._boundTouchCancel)}_updateDrawerTransform(at){let st=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const ot=this._getDrawer();ot&&(at=Math.max(0,Math.min(at,this._drawerHeight-30)),st&&(this._deltaFingerY<0?"closed"===this.openness?Math.abs(this._deltaFingerY)>this._drawerHeight*(1-rc["half-opened"])?this.openness="opened":this.openness="half-opened":this.openness="opened":this.openness="closed",this._drawerY=null,at=Math.max(0,Math.min(rc[this.openness]*this._drawerHeight,this._drawerHeight-30))),ot.style.transform=`translateY(${at}px)`)}render(){const at={drawer:!0,[this.openness]:!0,dragging:this._isDragging};return ut.qy`
13
13
  <div
14
14
  class=${(0,Hl.H)(at)}
15
15
  @touchstart="${this._onTouchStart}"
@@ -1708,7 +1708,7 @@
1708
1708
  }
1709
1709
  /* Logo */
1710
1710
  img.logo-dead { width: 100px; }
1711
- `,Loader.properties={_mode:{state:!0},_label:{state:!0},_isLabelFun:{state:!0},visible:{type:Boolean,reflect:!0},"no-label":{type:Boolean},value:{type:Number}},customElements.define("pnx-loader",Loader)},5642:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>Map});ot(3041);var ut=ot(8340),Hl=ot(7343),rc=ot(6883),sc=ot(270),oc=ot(6462),_c=ot(9740),wc=(ot(6795),ot(927)),Sc=ot.n(wc),iu=ot(2968),su=ot.n(iu),lu=ot(748);Sc().workerClass=su(),Sc().addProtocol("pmtiles",(new lu.Zs).tile);class Map extends Sc().Map{constructor(at,st){let ot=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var Hl;(super({container:st,style:(0,ut.combineStyles)(at,ot),center:[0,0],zoom:0,maxZoom:24,attributionControl:!1,dragRotate:!1,pitchWithRotate:!1,touchZoomRotate:!0,touchPitch:!1,doubleClickZoom:!1,canvasContextAttributes:{preserveDrawingBuffer:!at.isWidthSmall()},transformRequest:at.api._getMapRequestTransform(),locale:at._t.maplibre,hash:!1,...ot}),this._loadMarkerImages(),this._parent=at,this._options=ot,this.getContainer().classList.add("pnx-map"),void 0===ot.touchZoomRotate)&&(null===this||void 0===this||null===(Hl=this.touchZoomRotate)||void 0===Hl||Hl.disableRotation());this._options.raster&&(this._options.background=this._options.background||"streets"),this._attribution=new(Sc().AttributionControl)({compact:!1,...ot.attributionControl}),this.addControl(this._attribution),this._initMapPosition(),this._picMarker=this._getPictureMarker(),this._picMarkerPreview=this._getPictureMarker(!1),this._picThumbUrl={},this._seqPictures={},this._userLayers=new Set,this._parent.addEventListener("select",this.reloadLayersStyles.bind(this)),setTimeout((()=>{var at;!this.loaded()&&null!==(at=this._parent)&&void 0!==at&&at.loader.isVisible()&&this._parent.loader.dismiss({},this._parent._t.map.slow_loading,(async()=>{await this._postLoad(),this._parent.loader.dismiss()}))}),15e3),this.waitForEnoughMapLoaded().then((async()=>await this._postLoad()))}async _postLoad(){this.resize(),await this.setVisibleUsers(this._parent.users),this.reloadLayersStyles(),this.fire("ready")}destroy(){this.remove(),delete this._parent,delete this._options,delete this._attribution,delete this._picMarker,delete this._picMarkerPreview,delete this._picThumbUrl,delete this._seqPictures,delete this._userLayers}waitForEnoughMapLoaded(){return new Promise((at=>{let st=0,ot=0,ut=0,Hl=0;const onSourceDataLoading=at=>{"source"===at.dataType&&at.tile&&(at.sourceId.startsWith("geovisio")?ot++:st++)},onSourceData=at=>{"source"===at.dataType&&at.tile&&(at.sourceId.startsWith("geovisio")?(Hl++,at.isSourceLoaded&&(Hl=ot)):(ut++,at.isSourceLoaded&&(ut=st))),checkEnoughLoaded()},checkEnoughLoaded=()=>{ut/st>=.75&&(0===ot||Hl/ot>=.75)&&(this.off("sourcedata",onSourceData),this.off("sourcedataloading",onSourceDataLoading),at())};this.on("sourcedataloading",onSourceDataLoading),this.on("sourcedata",onSourceData)}))}_initMapPosition(){this._options.center&&this._options.center!=[0,0]||this._options.zoom&&0!==this._options.zoom||this._options.hash||this._parent.onceAPIReady().then((()=>{var at,st;let ot=null===(at=this._parent)||void 0===at||null===(st=at.api)||void 0===st?void 0:st.getDataBbox();if(ot)try{ot=new(Sc().LngLatBounds)(ot),this.loaded()?this.fitBounds(ot,{animate:!1}):this.waitForEnoughMapLoaded().then((()=>this.fitBounds(ot,{animate:!1})))}catch(ut){console.warn("Received invalid bbox: "+ot)}}))}_loadMarkerImages(){[{id:"pnx-marker",img:rc},{id:"pnx-arrow-flat",img:oc},{id:"pnx-arrow-360",img:_c}].forEach((at=>{const st=new Image(64,64);st.onload=()=>this.addImage(at.id,st),st.src=at.img}))}_hasQualityScore(){var at,st,ot,ut;const Hl=(null===(at=this.getStyle())||void 0===at||null===(st=at.metadata)||void 0===st?void 0:st["panoramax:fields"])||{};return(null===Hl||void 0===Hl||null===(ot=Hl.pictures)||void 0===ot?void 0:ot.includes("gps_accuracy"))&&(null===Hl||void 0===Hl||null===(ut=Hl.pictures)||void 0===ut?void 0:ut.includes("h_pixel_density"))}_hasGridStats(){var at,st,ot,ut,Hl,rc;const sc=(null===(at=this.getStyle())||void 0===at||null===(st=at.metadata)||void 0===st?void 0:st["panoramax:fields"])||{};return(null===sc||void 0===sc||null===(ot=sc.grid)||void 0===ot?void 0:ot.includes("nb_360_pictures"))&&(null===sc||void 0===sc||null===(ut=sc.grid)||void 0===ut?void 0:ut.includes("nb_flat_pictures"))&&(null===sc||void 0===sc||null===(Hl=sc.grid)||void 0===Hl?void 0:Hl.includes("coef_360_pictures"))&&(null===sc||void 0===sc||null===(rc=sc.grid)||void 0===rc?void 0:rc.includes("coef_flat_pictures"))}reloadVectorTiles(){[...this._userLayers].forEach((at=>{const st=this.getSource((0,ut.getUserSourceId)(at));st.setTiles(st.tiles)}))}hasTwoBackgrounds(){return void 0!==this.getLayer(ut.RASTER_LAYER_ID)}getBackground(){if(!this.getLayer(ut.RASTER_LAYER_ID))return"streets";return"visible"==this.getLayoutProperty(ut.RASTER_LAYER_ID,"visibility")?"aerial":"streets"}setBackground(at){if(!this.getLayer(ut.RASTER_LAYER_ID)&&"aerial"===at)throw new Error("No aerial imagery available");this.getLayer(ut.RASTER_LAYER_ID)&&(this.setLayoutProperty(ut.RASTER_LAYER_ID,"visibility","aerial"===at?"visible":"none"),this.fire("background-changed",{background:at||"streets"}))}getVisibleUsers(){return[...this._userLayers].filter((at=>this.getLayer((0,ut.getUserLayerId)(at,"pictures"))&&"visible"===this.getLayoutProperty((0,ut.getUserLayerId)(at,"pictures"),"visibility")))}onceLayerReady(at){return this.getLayer(at)?Promise.resolve():new Promise((at=>{setTimeout(at,250)})).then((()=>this.onceLayerReady(at)))}async setVisibleUsers(){let at=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];"string"===typeof at?at=[at]:null===at&&(at=[]),await Promise.all(at.filter((at=>""!=at&&!this._userLayers.has(at))).map((at=>(this._createPicturesTilesLayer(at),this.onceLayerReady((0,ut.getUserLayerId)(at,"pictures"))))));const st=["pictures","sequences","sequences_plus","grid","pictures_symbols"];[...this._userLayers].forEach((ot=>{st.forEach((st=>{const Hl=(0,ut.getUserLayerId)(ot,st);this.getLayer(Hl)&&this.setLayoutProperty(Hl,"visibility",at.includes(ot)?"visible":"none")}))})),this.reloadLayersStyles(),this.fire("users-changed",{usersIds:at})}filterUserLayersContent(at,st){[...this._userLayers].forEach((ot=>{this.getLayer((0,ut.getUserLayerId)(ot,at))?(this.setFilter((0,ut.getUserLayerId)(ot,at),st),"sequences"===at&&this.getLayer((0,ut.getUserLayerId)(ot,"sequences_plus"))&&this.setFilter((0,ut.getUserLayerId)(ot,"sequences_plus"),st),"pictures"===at&&this.getLayer((0,ut.getUserLayerId)(ot,"pictures_symbols"))&&this.setFilter((0,ut.getUserLayerId)(ot,"pictures_symbols"),st)):console.warn("Layer",(0,ut.getUserLayerId)(ot,at),"not ready")}))}displayPictureMarker(at,st,ot){let Hl=arguments.length>3&&void 0!==arguments[3]&&arguments[3],rc=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;this._picMarkerPreview.remove(),void 0!==at&&void 0!==st?(this._picMarker.setLngLat([at,st]).setRotation(ot).addTo(this),this._picMarker.picId=rc):this._picMarker.remove(),this.reloadLayersStyles(),Hl||void 0===at||void 0===st||this.flyTo({center:[at,st],zoom:this.getZoom()<ut.TILES_PICTURES_ZOOM+2?ut.TILES_PICTURES_ZOOM+2:this.getZoom(),maxDuration:2e3})}reloadLayersStyles(){const updateStyle=(at,st)=>{[...this._userLayers].forEach((ot=>{const Hl=(0,ut.getUserLayerId)(ot,at);if(this.getLayer(Hl)){for(let at in st.layout)this.setLayoutProperty(Hl,at,st.layout[at]);for(let at in st.paint)this.setPaintProperty(Hl,at,st.paint[at])}else console.warn("Layer",Hl,"not ready")}))};["pictures","pictures_symbols","sequences"].forEach((at=>{updateStyle(at,this._getLayerStyleProperties(at))}))}async _createPicturesTilesLayer(at){this._userLayers.add(at);const st=this.getStyle().layers.find(ut.isLabelLayer);if("geovisio"!==at&&!this.getSource(`geovisio_${at}`)){const ot=await this._parent.api.getUserMapStyle(at);Object.entries(ot.sources).forEach((at=>{let[st,ot]=at;return this.addSource(st,ot)})),ot.layers=ot.layers||[];ot.layers.concat((0,ut.getMissingLayerStyles)(ot.sources,ot.layers)).filter((at=>Object.keys(at).length>0)).forEach((at=>this.addLayer(at,null===st||void 0===st?void 0:st.id)))}this._picPreviewTimer=null,this._picPopup=new(Sc().Popup)({closeButton:!1,closeOnClick:!this._parent.isWidthSmall(),offset:3}),this._picPopup.on("close",(()=>{delete this._picPopup._picId}));const ot=(0,ut.getUserLayerId)(at,"pictures");this.on("mousemove",ot,(at=>{this.getCanvas().style.cursor="pointer";const st=Object.assign({},at);clearTimeout(this._picPreviewTimer),this._picPreviewTimer=setTimeout((()=>this._attachPreviewToPictures(st,ot)),100)})),this.on("mouseleave",ot,(()=>{clearTimeout(this._picPreviewTimer),this.getCanvas().style.cursor="",this._picPopup._picId,this._picPopup.remove()})),this.on("click",ot,this._onPictureClick.bind(this));const Hl=(0,ut.getUserLayerId)(at,"sequences_plus");this.on("mousemove",Hl,(at=>{if(this._onSequenceHover(at),this.getZoom()<=ut.TILES_PICTURES_ZOOM+1&&(this.getCanvas().style.cursor="pointer",at.features[0].properties.id)){const st=Object.assign({},at);clearTimeout(this._picPreviewTimer),this._picPreviewTimer=setTimeout((()=>this._attachPreviewToPictures(st,Hl)),100)}})),this.on("mouseleave",Hl,(()=>{clearTimeout(this._picPreviewTimer),this.getCanvas().style.cursor="",this._picPopup._picId,this._picPopup.remove()})),this.on("click",Hl,(at=>{at.preventDefault(),this.getZoom()<=ut.TILES_PICTURES_ZOOM+1&&this._onSequenceClick(at)})),"geovisio"===at&&this.getLayer("geovisio_grid")&&(this.on("mousemove","geovisio_grid",(at=>{if(this.getZoom()<=ut.TILES_PICTURES_ZOOM+1){this.getCanvas().style.cursor="pointer";const st=Object.assign({},at);clearTimeout(this._picPreviewTimer),this._picPreviewTimer=setTimeout((()=>this._attachPreviewToPictures(st,"geovisio_grid")),100)}})),this.on("mouseleave","geovisio_grid",(()=>{clearTimeout(this._picPreviewTimer),this.getCanvas().style.cursor="",this._picPopup._picId,this._picPopup.remove()})),this.on("click","geovisio_grid",(at=>{at.preventDefault(),this.flyTo({center:at.lngLat,zoom:ut.TILES_PICTURES_ZOOM-6})}))),this.on("click",(at=>{!1===at.defaultPrevented&&(clearTimeout(this._picPreviewTimer),this._picPopup.remove())}))}_getLayerStyleProperties(at){if("pictures_symbols"===at)return{paint:{},layout:{"icon-image":["case",["==",["get","id"],this._parent.picture],"",["==",["get","type"],"equirectangular"],"pnx-arrow-360","pnx-arrow-flat"],"symbol-sort-key":this._getLayerSortStyle(at)}};{const st={pictures:"circle",sequences:"line"};return{paint:Object.assign({[`${st[at]}-color`]:this._getLayerColorStyle(at)},ut.VECTOR_STYLES[at.toUpperCase()].paint),layout:Object.assign({[`${st[at]}-sort-key`]:this._getLayerSortStyle(at)},ut.VECTOR_STYLES[at.toUpperCase()].layout)}}}_getLayerColorStyle(at){const st=["case",["==",["get","hidden"],!0],Hl.COLORS.HIDDEN,["==",["get","geovisio:status"],"hidden"],Hl.COLORS.HIDDEN],ot=this._parent.sequence;return"sequences"==at&&ot?st.push(["==",["get","id"],ot],Hl.COLORS.SELECTED):at.startsWith("pictures")&&ot&&st.push(["in",ot,["get","sequences"]],Hl.COLORS.SELECTED),st.push(Hl.COLORS.BASE),st}_getLayerSortStyle(at){const st=["case",["==",["get","hidden"],!0],90],ot=this._parent.sequence;return"sequences"==at&&ot?st.push(["==",["get","id"],ot],100):at.startsWith("pictures")&&ot&&st.push(["in",ot,["get","sequences"]],100),st.push(10),st}_attachPreviewToPictures(at,st){let ot=at.features.pop();if(!ot||ot.properties.id==this._picPopup._picId)return;let Hl=null;if(st.endsWith("pictures")?Hl=ot.geometry.coordinates.slice():at.lngLat&&(Hl=[at.lngLat.lng,at.lngLat.lat]),!Hl){const at="LineString"===ot.geometry.type?[ot.geometry.coordinates]:ot.geometry.coordinates;let st=null;const ut=this.getBounds(),rc=ut.getCenter();for(let ot=0;ot<at.length;ot++)for(let sc=0;sc<at[ot].length;sc++)if(ut.contains(at[ot][sc])){let ut=rc.distanceTo(new(Sc().LngLat)(...at[ot][sc]));(null===st||ut<st)&&(Hl=at[ot][sc],st=ut)}if(!Hl)return}this._picPopup.setLngLat(Hl).addTo(this),this._picThumbUrl[ot.properties.id]||this._picPopup.setDOMContent((0,ut.getThumbGif)(this._parent._t)),this._picPopup._loading=ot.properties.id,this._picPopup._picId=ot.properties.id;const displayThumb=at=>{if(this._picPopup._loading===ot.properties.id)if(delete this._picPopup._loading,at){let st=document.createElement("img");st.classList.add("pnx-map-thumb"),st.alt=this._parent._t.map.thumbnail;let ut=new Image;if(ut.src=at,ut.addEventListener("load",(()=>{ot.properties.hidden?st.children[0].src=ut.src:st.src=ut.src,this._picPopup.setDOMContent(st)})),ot.properties.hidden){const at=document.createElement("div");at.classList.add("pnx-map-thumb-legend"),at.appendChild(document.createTextNode(this._parent._t.map.not_public));const ot=document.createElement("div");ot.appendChild(st),ot.appendChild(at),st=ot}}else this._picPopup.remove()};st.endsWith("pictures")?this._getPictureThumbURL(ot.properties.id).then(displayThumb):st.endsWith("grid")?this._getThumbURL(Hl).then(displayThumb):this._getSequenceThumbURL(ot.properties.id,new(Sc().LngLat)(...Hl)).then(displayThumb)}_getThumbURL(at){return this._parent.api.getPicturesAroundCoordinates(at[1],at[0],.1,1).then((at=>{var st;const ot=null===at||void 0===at||null===(st=at.features)||void 0===st?void 0:st.pop();return ot?this._parent.api.findThumbnailInPictureFeature(ot):null}))}_getSequenceThumbURL(at,st){return st?this._parent.api.getPicturesAroundCoordinates(st.lat,st.lng,1,1,at).then((st=>{var ot;return(null===st||void 0===st||null===(ot=st.features)||void 0===ot?void 0:ot.length)>0?this._parent.api.findThumbnailInPictureFeature(st.features[0]):this._parent.api.getPictureThumbnailURLForSequence(at)})):this._parent.api.getPictureThumbnailURLForSequence(at)}_getPictureThumbURL(at,st){let ot=null;return at&&(void 0!==this._picThumbUrl[at]?ot="string"===typeof this._picThumbUrl[at]?Promise.resolve(this._picThumbUrl[at]):this._picThumbUrl[at]:(this._picThumbUrl[at]=this._parent.api.getPictureThumbnailURL(at,st).then((st=>st?(this._picThumbUrl[at]=st,st):(this._picThumbUrl[at]=null,null))).catch((()=>{this._picThumbUrl[at]=null})),ot=this._picThumbUrl[at])),ot}_getPictureMarker(){let at=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const st=document.createElement("img");return st.src=at?sc:rc,st.alt="",new(Sc().Marker)({element:st,picId:null})}_onSequenceHover(at){var st;at.preventDefault(),at.features.length>0&&null!==(st=at.features[0].properties)&&void 0!==st&&st.id&&this.fire("sequence-hover",{seqId:at.features[0].properties.id})}_onSequenceClick(at){var st;at.preventDefault(),at.features.length>0&&null!==(st=at.features[0].properties)&&void 0!==st&&st.id&&this.fire("sequence-click",{seqId:at.features[0].properties.id,coordinates:at.lngLat})}_onPictureClick(at){var st,ot;at.preventDefault();const ut=(null===at||void 0===at||null===(st=at.features)||void 0===st?void 0:st.length)>0?at.features[0]:null;if(null!==ut&&void 0!==ut&&null!==(ot=ut.properties)&&void 0!==ot&&ot.id){let st=null;try{ut.properties.sequences&&(Array.isArray(ut.properties.sequences)||(ut.properties.sequences=JSON.parse(ut.properties.sequences)),st=ut.properties.sequences.pop())}catch(at){console.log("Sequence ID is not available in vector tiles for picture "+ut.properties.id)}this.fire("picture-click",{picId:ut.properties.id,seqId:st,feature:ut})}}addEventListener(at,st){let ot=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};null!==ot&&void 0!==ot&&ot.once?this.once(at,st):this.on(at,st)}}},2771:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>MapMore,T:()=>oc});var ut=ot(5642),Hl=ot(7343),rc=ot(8340);const sc={DEFAULT:"default",AGE:"age",TYPE:"type",SCORE:"score"},oc=["minDate","maxDate","pic_type","camera","theme","qualityscore"];class MapMore extends ut.A{constructor(at,st){super(at,st,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),this._mapFilters={},this._options.theme&&(this._mapFilters={theme:this._options.theme})}reloadLayersStyles(){if(super.reloadLayersStyles(),this._hasGridStats()){let at="coef";this._mapFilters.pic_type&&(at="flat"==this._mapFilters.pic_type?"coef_flat_pictures":"coef_360_pictures"),this.getStyle().layers.filter((at=>at.id.endsWith("_grid"))).forEach((st=>{const ot=(0,rc.switchCoefValue)(st,at);for(let at in ot.layout)this.setLayoutProperty(st.id,at,ot.layout[at]);for(let at in ot.paint)this.setPaintProperty(st.id,at,ot.paint[at])}))}}_getDatesForLayerColors(){const at=864e5,st=Date.now();return[st-30*at,st-365*at,st-730*at].map((at=>new Date(at).toISOString().split("T")[0]))}_getLayerColorStyle(at){var st,ot,ut,oc,_c,wc,Sc,iu;const su=["case",["==",["get","hidden"],!0],Hl.COLORS.HIDDEN],lu=(null===(st=this._parent.psv)||void 0===st||null===(ot=st._myVTour)||void 0===ot||null===(ut=ot.state)||void 0===ut?void 0:ut.loadingNode)||(null===(oc=this._parent.psv)||void 0===oc||null===(_c=oc._myVTour)||void 0===_c||null===(wc=_c.state)||void 0===wc||null===(Sc=wc.currentNode)||void 0===Sc?void 0:Sc.id),cu=lu?null===(iu=this._parent.psv)||void 0===iu?void 0:iu._picturesSequences[lu]:null;if("sequences"==at&&cu?su.push(["==",["get","id"],cu],Hl.COLORS.SELECTED):"pictures"==at&&cu&&su.push(["in",cu,["get","sequences"]],Hl.COLORS.SELECTED),this._mapFilters.theme==sc.AGE){const st="sequences"==at?"date":"ts",ot=this._getDatesForLayerColors();su.push(["!",["has",st]],Hl.COLORS.BASE,[">=",["get",st],ot[0]],Hl.COLORS.PALETTE_4,[">=",["get",st],ot[1]],Hl.COLORS.PALETTE_3,[">=",["get",st],ot[2]],Hl.COLORS.PALETTE_2,Hl.COLORS.PALETTE_1)}else this._mapFilters.theme==sc.TYPE?su.push(["!",["has","type"]],Hl.COLORS.BASE,["==",["get","type"],"equirectangular"],Hl.COLORS.QUALI_1,Hl.COLORS.QUALI_2):this._mapFilters.theme==sc.SCORE?su.push(["==",rc.MAP_EXPR_QUALITYSCORE,5],Hl.QUALITYSCORE_VALUES[0].color,["==",rc.MAP_EXPR_QUALITYSCORE,4],Hl.QUALITYSCORE_VALUES[1].color,["==",rc.MAP_EXPR_QUALITYSCORE,3],Hl.QUALITYSCORE_VALUES[2].color,["==",rc.MAP_EXPR_QUALITYSCORE,2],Hl.QUALITYSCORE_VALUES[3].color,Hl.QUALITYSCORE_VALUES[4].color):su.push(Hl.COLORS.BASE);return su}_getLayerSortStyle(at){var st,ot,ut,Hl,oc,_c,wc,Sc;const iu=["case",["==",["get","hidden"],!0],90],su=(null===(st=this._parent.psv)||void 0===st||null===(ot=st._myVTour)||void 0===ot||null===(ut=ot.state)||void 0===ut?void 0:ut.loadingNode)||(null===(Hl=this._parent.psv)||void 0===Hl||null===(oc=Hl._myVTour)||void 0===oc||null===(_c=oc.state)||void 0===_c||null===(wc=_c.currentNode)||void 0===wc?void 0:wc.id),lu=su?null===(Sc=this._parent.psv)||void 0===Sc?void 0:Sc._picturesSequences[su]:null;if("sequences"==at&&lu?iu.push(["==",["get","id"],lu],100):"pictures"==at&&lu&&iu.push(["in",lu,["get","sequences"]],100),this._mapFilters.theme==sc.AGE){const st="sequences"==at?"date":"ts",ot=this._getDatesForLayerColors();iu.push(["!",["has",st]],0,[">=",["get",st],ot[0]],50,[">=",["get",st],ot[1]],49,[">=",["get",st],ot[2]],48)}else this._mapFilters.theme==sc.TYPE?iu.push(["!",["has","type"]],0,["==",["get","type"],"equirectangular"],50):this._mapFilters.theme==sc.SCORE&&iu.push(["==",rc.MAP_EXPR_QUALITYSCORE,5],80,["==",rc.MAP_EXPR_QUALITYSCORE,4],65,["==",rc.MAP_EXPR_QUALITYSCORE,3],50,["==",rc.MAP_EXPR_QUALITYSCORE,2],35,["==",rc.MAP_EXPR_QUALITYSCORE,1],20);return iu.push(10),iu}_mapFiltersToLayersFilters(at){let st={},ot=[],ut=[],Hl=!1;if(at.minDate&&""!==at.minDate&&(st.minDate=at.minDate,ot.push([">=",["get","date"],at.minDate]),ut.push([">=",["get","ts"],at.minDate])),at.maxDate&&""!==at.maxDate){st.maxDate=at.maxDate,ot.push(["<=",["get","date"],at.maxDate]);let Hl=new Date(at.maxDate);Hl.setDate(Hl.getDate()+1),Hl=Hl.toISOString().split("T")[0],ut.push(["<=",["get","ts"],Hl])}if(at.pic_type&&""!==at.pic_type&&(st.pic_type="flat"===at.pic_type?"flat":"equirectangular",ot.push(["==",["get","type"],st.pic_type]),ut.push(["==",["get","type"],st.pic_type])),this._hasGridStats()&&(Hl=!0),at.camera&&""!==at.camera){st.camera=at.camera;const Hl=at.camera.toLowerCase().trim()+" ",rc=at.camera.toLowerCase().trim()+"zzzzzzzzzzzzzzzzzzzz",sc=["collator",{"case-sensitive":!1,"diacritic-sensitive":!1}];ot.push([">=",["get","model"],Hl,sc]),ot.push(["<=",["get","model"],rc,sc]),ut.push([">=",["get","model"],Hl,sc]),ut.push(["<=",["get","model"],rc,sc])}return at.qualityscore&&at.qualityscore.length>0&&(st.qualityscore=at.qualityscore,ot.push(["in",rc.MAP_EXPR_QUALITYSCORE,["literal",st.qualityscore]]),ut.push(["in",rc.MAP_EXPR_QUALITYSCORE,["literal",st.qualityscore]])),at.theme&&Object.values(sc).includes(at.theme)&&(st.theme=at.theme,Hl=!0),0==ot.length?ot=null:ot.unshift("all"),0==ut.length?ut=null:(ut.unshift("all"),ut=["step",["zoom"],!0,rc.TILES_PICTURES_ZOOM,ut]),{mapFilters:st,mapSeqFilters:ot,mapPicFilters:ut,reloadMapStyle:Hl}}setFilters(at){let st=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{mapFilters:ot,mapSeqFilters:ut,mapPicFilters:Hl,reloadMapStyle:rc}=this._mapFiltersToLayersFilters(at);this._mapFilters=ot,rc&&this.reloadLayersStyles();const oc=this.getVisibleUsers().includes("geovisio");ut&&oc&&(ut=["step",["zoom"],!0,7,ut]),this.filterUserLayersContent("sequences",ut),this.filterUserLayersContent("pictures",Hl),!st&&(null!==ut||null!==Hl||null!==this._mapFilters.theme&&this._mapFilters.theme!==sc.DEFAULT)&&oc&&this.getZoom()<7&&!this._hasGridStats()&&this.easeTo({zoom:7}),this.fire("filters-changed",Object.assign({},this._mapFilters))}async setVisibleUsers(){let at=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];await super.setVisibleUsers(at);let{mapSeqFilters:st,mapPicFilters:ot,reloadMapStyle:ut}=this._mapFiltersToLayersFilters(this._mapFilters);ut&&this.reloadLayersStyles();const Hl=at.includes("geovisio");st&&Hl&&(st=["step",["zoom"],!0,7,st]),this.filterUserLayersContent("sequences",st),this.filterUserLayersContent("pictures",ot)}}},9048:(at,st,ot)=>{"use strict";ot.d(st,{Ay:()=>Photo,LM:()=>cu,Vf:()=>uu,cS:()=>lu});ot(5003);var ut=ot(5975),Hl=ot(2305),rc=ot(7343),sc=ot(508),oc=(ot(3961),ot(1080),ot(2710),ot(1575),ot(1545)),_c=ot(3348),wc=ot(4991),Sc=ot(3727);const iu={baseUrl:ut,width:1280,cols:2,rows:1,tileUrl:()=>null},su={id:rc.BASE_PANORAMA_ID,caption:"",panorama:iu,links:[],gps:[0,0],sequence:{},sphereCorrection:{},horizontalFov:360,properties:{}},lu=30,cu=250,uu=3e3;oc.jM.useNewAnglesOrder=!0;class Photo extends oc.jM{constructor(at,st){var ot;let ut=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super({container:st,adapter:[Sc.A,{showErrorTile:!1,baseBlur:!1,resolution:at.isWidthSmall()?32:64,shouldGoFast:ut.shouldGoFast}],withCredentials:at.api._getPSVWithCredentials(),requestHeaders:null===at||void 0===at||null===(ot=at.fetchOptions)||void 0===ot?void 0:ot.headers,panorama:iu,lang:at._t.psv,minFov:5,loadingTxt:"&nbsp;",navbar:null,rendererParameters:{preserveDrawingBuffer:!at.isWidthSmall()},plugins:[[_c.$,{dataMode:"server",positionMode:"gps",renderMode:"3d",preload:!0,getNode:()=>{},transitionOptions:()=>{},arrowsPosition:{linkOverlapAngle:Math.PI/6}}],[wc.b,{}]],...ut}),this._parent=at,this._options=ut,st.classList.add("pnx-psv"),this._shouldGoFast=(null===ut||void 0===ut?void 0:ut.shouldGoFast)||(()=>!1),this._transitionDuration=(null===ut||void 0===ut?void 0:ut.transitionDuration)||cu,this._myVTour=this.getPlugin(_c.$),this._myVTour.datasource.nodeResolver=this._getNodeFromAPI.bind(this),this._myVTour.config.transitionOptions=this._psvNodeTransition.bind(this),this._clearArrows=this._myVTour.arrowsRenderer.clear.bind(this._myVTour.arrowsRenderer),this._myVTour.arrowsRenderer.clear=()=>{},this._myMarkers=this.getPlugin(wc.b),this._annotationsVisible=!1,this._sequencePlaying=!1,this._picturesNavigation=this._options.picturesNavigation||"any",this._picturesSequences={},this._myVTour.addEventListener("enter-arrow",this._onEnterArrow.bind(this)),this._myVTour.addEventListener("leave-arrow",this._onLeaveArrow.bind(this)),this._myVTour.addEventListener("node-changed",this._onNodeChanged.bind(this)),this._myMarkers.addEventListener("select-marker",this._onSelectMarker.bind(this)),this.addEventListener("position-updated",this._onPositionUpdated.bind(this)),this.addEventListener("zoom-updated",this._onZoomUpdated.bind(this)),this.addEventListener("dblclick",this._onDoubleClick.bind(this)),this._parent.addEventListener("select",this._onSelect.bind(this)),this.loader.size=150,this.loader.color="rgba(61, 61, 61, 0.5)",this.loader.textColor="rgba(255, 255, 255, 0.7)",this.loader.border=5,this.loader.thickness=10,this.loader.canvas.setAttribute("viewBox","0 0 150 150"),this.loader.__updateContent(),this._options.position&&!this._parent.picture&&this.goToPosition(...this._options.position)}async _getNodeFromAPI(at){var st,ot;if((0,rc.isNullId)(at))return su;const ut=await fetch(this._parent.api.getPictureMetadataUrl(at,this._picturesSequences[at]),this._parent.api._getFetchOptions());let Hl=await ut.json();if(Hl.features&&(Hl=Hl.features.pop()),!Hl||0===Object.keys(Hl).length||!ut.ok)throw this._parent.loader&&this._parent.loader.dismiss(!0,this._parent._t.pnx.error_pic),new Error("Picture with ID "+at+" was not found");this._picturesSequences[at]=Hl.collection;const oc=(0,sc.apiFeatureToPSVNode)(Hl,this._parent._t,this._parent._isInternetFast,this._picturesNavFilter.bind(this));var _c,wc;null!==oc&&void 0!==oc&&null!==(st=oc.sequence)&&void 0!==st&&st.prevPic&&(this._picturesSequences[null===oc||void 0===oc||null===(_c=oc.sequence)||void 0===_c?void 0:_c.prevPic]=Hl.collection);null!==oc&&void 0!==oc&&null!==(ot=oc.sequence)&&void 0!==ot&&ot.nextPic&&(this._picturesSequences[null===oc||void 0===oc||null===(wc=oc.sequence)||void 0===wc?void 0:wc.nextPic]=Hl.collection);return oc}_psvNodeTransition(at,st,ot){var ut,Hl,sc;let oc={};const _c=this._shouldGoFast()?0:Math.min(cu,this._transitionDuration),wc=_c>100,Sc=null!=(ot||(null===st||void 0===st?void 0:st.links.find((st=>st.nodeId==at.id)))),iu=st&&at.sequence.id===st.sequence.id,su=((null===st||void 0===st||null===(ut=st.properties)||void 0===ut?void 0:ut["view:azimuth"])||0)*(Math.PI/180),uu=((null===at||void 0===at||null===(Hl=at.properties)||void 0===Hl?void 0:Hl["view:azimuth"])||0)*(Math.PI/180),pu=(0,rc.getRelativeHeading)(at)*(Math.PI/180);this.setOption("maxFov",Math.min(3*at.horizontalFov/4,90));const mu={showLoader:!1,effect:"none",speed:0,rotation:!1,rotateTo:{pitch:0,yaw:-pu},zoomTo:lu};if(360==at.horizontalFov)oc=st?(0,rc.getDistance)(st.gps,at.gps)>=.001?mu:{speed:_c,effect:Sc&&wc?"fade":"none",rotation:Sc&&iu&&wc,rotateTo:this.getPosition()}:mu;else if(iu){const at=this.getPosition().yaw,ot=st.horizontalFov*(Math.PI/180)/2,ut=at<=ot||at>=2*Math.PI-ot,Hl=Math.abs(su-uu)<=Math.PI/4;oc={speed:_c,effect:Sc&&Hl&&wc?"fade":"none",rotation:Sc&&Hl&&wc,rotateTo:ut?this.getPosition():{pitch:0,yaw:0},zoomTo:ut?this.getZoomLevel():lu}}else oc=Object.assign(mu,{rotateTo:{pitch:0,yaw:0}});"fade"===oc.effect&&oc.speed>=150?setTimeout(this._clearArrows,oc.speed-100):this._clearArrows();const gu=new CustomEvent("picture-loading",{detail:{...Object.assign({},this.getXYZ(),oc.rotateTo?{x:180*(uu+oc.rotateTo.yaw)/Math.PI}:null,oc.zoomTo?{z:oc.zoomTo}:null),picId:at.id,lon:at.gps[0],lat:at.gps[1],first:(null===(sc=this._parent._initParams)||void 0===sc?void 0:sc.getParentPostInit().picture)==at.id}});return this.dispatchEvent(gu),oc}_onEnterArrow(at){const st=at.link,ot=at.node;let ut;ot&&(ut=360===ot.horizontalFov?(this.getPictureOriginalHeading()+180*this.getPosition().yaw/Math.PI)%360:this.getPictureOriginalHeading());const Hl=new CustomEvent("picture-preview-started",{detail:{picId:st.nodeId,coordinates:st.gps,direction:ut}});this.dispatchEvent(Hl)}_onLeaveArrow(at){const st=at.link,ot=new CustomEvent("picture-preview-stopped",{detail:{picId:st.nodeId}});this.dispatchEvent(ot)}_onPositionUpdated(at){let{position:st}=at;const ot=(0,rc.positionToXYZ)(st,this.getZoomLevel());ot.x+=this.getPictureOriginalHeading(),ot.x=ot.x%360;const ut=new CustomEvent("view-rotated",{detail:ot});this.dispatchEvent(ut),this._onTilesStartLoading()}_onZoomUpdated(at){let{zoomLevel:st}=at;const ot=new CustomEvent("view-rotated",{detail:{...this.getXY(),z:st}});this.dispatchEvent(ot),this._onTilesStartLoading()}_onDoubleClick(){this.unfocusAnnotation()}_onNodeChanged(at){for(let Hl of document.getElementsByClassName("pnx-psv-tour-arrows"))Hl.classList.remove("pnx-clicked");if(at.node.id){var st,ot,ut;const Hl=(null===(st=this._parent._initParams)||void 0===st?void 0:st.getParentPostInit().picture)==at.node.id;this._parent.select(null===(ot=at.node)||void 0===ot||null===(ut=ot.sequence)||void 0===ut?void 0:ut.id,at.node.id);const rc=this.getPictureMetadata();if(!rc)return void this.dispatchEvent(new CustomEvent("picture-loaded",{detail:{}}));this._prevSequence=rc.sequence.id;const sc=new CustomEvent("picture-loaded",{detail:{...this.getXYZ(),picId:at.node.id,lon:rc.gps[0],lat:rc.gps[1],first:Hl}});this.dispatchEvent(sc),rc.panorama.hdUrl?(this.setOption("downloadUrl",rc.panorama.hdUrl),this.setOption("downloadName",at.node.id+".jpg")):this.setOption("downloadUrl",null),this._annotationsVisible&&this.toggleAllAnnotations(!0)}this._onTilesStartLoading()}_onSelectMarker(at){var st;if(at.marker&&null!==(st=at.marker.id)&&void 0!==st&&st.startsWith("annotation-")){const st=new CustomEvent("annotation-click",{detail:{annotationId:at.marker.data.id}});this.dispatchEvent(st)}}_onTilesStartLoading(){this._tilesQueueTimer&&(clearInterval(this._tilesQueueTimer),delete this._tilesQueueTimer),this._tilesQueueTimer=setInterval((()=>{if(0===Object.keys(this.adapter.queue.tasks).length){if(this._myVTour.state.currentNode){const at=new CustomEvent("picture-tiles-loaded",{detail:{picId:this._myVTour.state.currentNode.id}});this.dispatchEvent(at)}clearInterval(this._tilesQueueTimer),delete this._tilesQueueTimer}}),100)}getPictureMetadata(){var at,st,ot;return(0,rc.isNullId)(null===(at=this._myVTour)||void 0===at||null===(st=at.state)||void 0===st||null===(ot=st.currentNode)||void 0===ot?void 0:ot.id)?null:this._myVTour.state.currentNode?Object.assign({},this._myVTour.state.currentNode):null}getPictureId(){var at,st,ot,ut,Hl;const sc=(null===(at=this._myVTour)||void 0===at||null===(st=at.state)||void 0===st?void 0:st.loadingNode)||(null===(ot=this._myVTour)||void 0===ot||null===(ut=ot.state)||void 0===ut||null===(Hl=ut.currentNode)||void 0===Hl?void 0:Hl.id);return(0,rc.isNullId)(sc)?null:sc}_onSelect(at){var st;at.detail.seqId&&(this._picturesSequences[at.detail.picId]=at.detail.seqId),(null===(st=this._myVTour.getCurrentNode())||void 0===st?void 0:st.id)!==at.detail.picId&&(this.loader.show(),this._myVTour.setCurrentNode(at.detail.picId).catch((at=>{this.showErrorOverlay(at,this._parent._t.pnx.error_pic,!0)})))}goToNextPicture(){if(!this.getPictureMetadata())throw new Error("No picture currently selected");const at=this.getPictureMetadata().sequence.nextPic;if(!at)throw new Error("No next picture available");this._parent.select(this.getPictureMetadata().sequence.id,at)}goToPrevPicture(){if(!this.getPictureMetadata())throw new Error("No picture currently selected");const at=this.getPictureMetadata().sequence.prevPic;if(!at)throw new Error("No previous picture available");this._parent.select(this.getPictureMetadata().sequence.id,at)}async goToPosition(at,st){return this._parent.api.getPicturesAroundCoordinates(at,st).then((at=>{if(at.features.length>0){const st=at.features.pop();return this._parent.select(null===st||void 0===st?void 0:st.collection,st.id),st.id}return Promise.reject(new Error("No picture found nearby given coordinates"))}))}getXY(){const at=(0,rc.positionToXYZ)(this.getPosition());return at.x=(at.x+this.getPictureOriginalHeading())%360,at}getXYZ(){const at=this.getXY();return at.z=this.getZoomLevel(),at}getPictureOriginalHeading(){var at,st;return(null===(at=this.getPictureMetadata())||void 0===at||null===(st=at.properties)||void 0===st?void 0:st["view:azimuth"])||0}getPictureRelativeHeading(){return(0,rc.getRelativeHeading)(this.getPictureMetadata())}clearPictureMetadataCache(){var at,st,ot,ut;const Hl=null===(at=this.getPictureMetadata())||void 0===at?void 0:at.id,rc=null===(st=this.getPictureMetadata())||void 0===st||null===(ot=st.sequence)||void 0===ot?void 0:ot.id;null===(ut=this._myVTour.state.currentTooltip)||void 0===ut||ut.hide(),this._myVTour.state.currentTooltip=null,this._myVTour.state.currentNode=null,this._myVTour.state.preload={},this._myVTour.datasource.nodes={},Hl&&this._parent.select(rc,Hl)}setXYZ(at,st,ot){const ut=(0,rc.xyzToPosition)(at-this.getPictureOriginalHeading(),st,ot);this.rotate({yaw:ut.yaw,pitch:ut.pitch}),this.zoom(ut.zoom)}setHigherContrast(at){this.renderer.renderer.toneMapping=at?3:0,this.renderer.renderer.toneMappingExposure=at?2:1,this.needsUpdate()}getTransitionDuration(){return this._transitionDuration}setTransitionDuration(at){if((at=parseFloat(at))<100||at>uu)throw new Error("Invalid transition duration (should be between 100 and "+uu+")");this._transitionDuration=at;const st=new CustomEvent("transition-duration-changed",{detail:{value:at}});this.dispatchEvent(st)}setPanorama(at,st){const onFailure=at=>{var st;return this.showErrorOverlay(at,null===(st=this._parent)||void 0===st?void 0:st._t.pnx.error_pic,!0)};try{return super.setPanorama(at,st).catch(onFailure)}catch(ot){onFailure(ot)}}showErrorOverlay(at,st,ot){var ut,rc,sc,oc;null!==(ut=this._parent)&&void 0!==ut&&ut.loader.isVisible()||!this.overlay.isVisible()?null===(rc=this._parent)||void 0===rc||rc.loader.dismiss(at,st,ot?()=>{var at;null===(at=this._parent)||void 0===at||at.loader.dismiss(),this.overlay.hide()}:void 0):(console.error(at),this.overlay.show({image:`<img style="width: 200px" src="${Hl}" alt="" />`,title:null===(sc=this._parent)||void 0===sc?void 0:sc._t.pnx.error,text:st+"<br />"+(null===(oc=this._parent)||void 0===oc?void 0:oc._t.pnx.error_click),dissmisable:ot}))}playSequence(){this._sequencePlaying=!0;const at=new Event("sequence-playing",{bubbles:!0,composed:!0});this.dispatchEvent(at);const nextPicturePlay=()=>{if(this._sequencePlaying){this.addEventListener("picture-loaded",(()=>{this._playTimer=setTimeout((()=>{nextPicturePlay()}),this.getTransitionDuration())}),{once:!0});try{this.goToNextPicture()}catch(at){this.stopSequence()}}};this.addEventListener("click",(()=>this.stopSequence())),nextPicturePlay()}stopSequence(){this._sequencePlaying=!1,this._playTimer&&(clearTimeout(this._playTimer),delete this._playTimer),this.forceRefresh();const at=new Event("sequence-stopped",{bubbles:!0,composed:!0});this.dispatchEvent(at)}isSequencePlaying(){return this._sequencePlaying}toggleSequencePlaying(){this.isSequencePlaying()?this.stopSequence():this.playSequence()}getPicturesNavigation(){return this._picturesNavigation}setPicturesNavigation(at){"none"===at&&(at="pic"),this._picturesNavigation=at;const st=new CustomEvent("pictures-navigation-changed",{detail:{value:at}});this.dispatchEvent(st)}_picturesNavFilter(at){switch(this._picturesNavigation){case"seq":return["next","prev"].includes(at.rel);case"pic":case"none":return!1;default:return!0}}areAnnotationsVisible(){return this._annotationsVisible}toggleAllAnnotations(at){const st=this.getPictureMetadata();if(!st)throw this._myMarkers.clearMarkers(),new Error("No picture currently selected");if(at){var ot,ut;let at=st.properties.annotations;0===(null===(ot=at)||void 0===ot?void 0:ot.length)&&console.warn("No annotation available on picture",st.id);const Hl=null===(ut=this.state.textureData.panoData)||void 0===ut?void 0:ut.baseData;at=at.map((at=>{const st=this.getPictureMetadata().properties["pers:interior_orientation"].sensor_array_dimensions;if(!st)return console.warn("Picture lacks pers:interior_orientation.sensor_array_dimensions property, can't compute marker"),null;const ot=at.shape.coordinates.map((at=>at.map((at=>{const ot=[at[0]*Hl.croppedWidth/st[0],at[1]*Hl.croppedHeight/st[1]],ut=[(Hl.croppedX+ot[0])/Hl.fullWidth,(Hl.croppedY+ot[1])/Hl.fullHeight];return[2*(ut[0]-.5)*Math.PI,(.5-ut[1])*Math.PI]}))));return{id:`annotation-${at.id}`,polygon:ot,data:{id:at.id},svgStyle:{stroke:"var(--orange)",strokeWidth:"3px",fill:"var(--orange-transparent)",cursor:"pointer"},tooltip:this._parent._t.pnx.semantics_annotation_tooltip}})),this._myMarkers.setMarkers(at)}else this._myMarkers.clearMarkers();const Hl=this._annotationsVisible!=at;this._annotationsVisible=at,Hl&&this.dispatchEvent(new CustomEvent("annotations-toggled",{detail:{visible:at}}))}focusOnAnnotation(at){this.areAnnotationsVisible()||this.toggleAllAnnotations(!0),this.unfocusAnnotation(!0);const st=`annotation-${at}`;this._myMarkers.updateMarker({id:st,svgStyle:{stroke:"var(--red)",strokeWidth:"3px",fill:"var(--red-transparent)"},data:{selected:!0}}),this._myMarkers.gotoMarker(st,0),this.zoom(65)}unfocusAnnotation(){let at=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const st=Object.keys(this._myMarkers.markers).filter((at=>{var st,ot,ut;return at.startsWith("annotation-")&&(null===(st=this._myMarkers.markers[at])||void 0===st||null===(ot=st.config)||void 0===ot||null===(ut=ot.data)||void 0===ut?void 0:ut.selected)}));st.length>0&&(st.forEach((at=>{this._myMarkers.updateMarker({id:at,svgStyle:{stroke:"var(--orange)",strokeWidth:"3px",fill:"var(--orange-transparent)"},data:{selected:!1}})})),at||this.dispatchEvent(new Event("annotations-unfocused")))}forceRefresh(){var at;const st=this._myVTour.getCurrentNode();if(st&&st.panorama.baseUrl!==(null===st||void 0===st||null===(at=st.panorama)||void 0===at?void 0:at.origBaseUrl)){const at=this.getZoomLevel(),ot=this.getPosition();this._myVTour.state.currentNode=null,this._myVTour.setCurrentNode(st.id,{zoomTo:at,rotateTo:ot,fadeIn:!1,speed:0,rotation:!1})}st&&st.panorama.rows>1&&this.adapter.__refresh()}}},4374:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>Popup});var ut=ot(4542),Hl=ot(5995),rc=ot(8591),sc=ot(6627);class Popup extends ut.WF{constructor(){super(),this.visible=!1}connectedCallback(){super.connectedCallback(),this.addEventListener("click",(at=>{at.target===this&&this.close()})),document.addEventListener("keyup",(at=>{"Escape"===at.key&&this.visible&&this.close()}))}attributeChangedCallback(at,st,ot){super.attributeChangedCallback(at,st,ot),"visible"==at&&(""!==ot&&!0!==ot||this.dispatchEvent(new Event("open")))}close(){this.visible=!1,this.dispatchEvent(new Event("close"))}render(){return ut.qy`
1711
+ `,Loader.properties={_mode:{state:!0},_label:{state:!0},_isLabelFun:{state:!0},visible:{type:Boolean,reflect:!0},"no-label":{type:Boolean},value:{type:Number}},customElements.define("pnx-loader",Loader)},5642:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>Map});ot(3041);var ut=ot(8340),Hl=ot(7343),rc=ot(6883),sc=ot(270),oc=ot(6462),_c=ot(9740),wc=(ot(6795),ot(927)),Sc=ot.n(wc),iu=ot(2968),su=ot.n(iu),lu=ot(748);Sc().workerClass=su(),Sc().addProtocol("pmtiles",(new lu.Zs).tile);class Map extends Sc().Map{constructor(at,st){let ot=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var Hl;(super({container:st,style:(0,ut.combineStyles)(at,ot),center:[0,0],zoom:0,maxZoom:24,attributionControl:!1,dragRotate:!1,pitchWithRotate:!1,touchZoomRotate:!0,touchPitch:!1,doubleClickZoom:!1,canvasContextAttributes:{preserveDrawingBuffer:!at.isWidthSmall()},transformRequest:at.api._getMapRequestTransform(),locale:at._t.maplibre,hash:!1,...ot}),this._loadMarkerImages(),this._parent=at,this._options=ot,this.getContainer().classList.add("pnx-map"),void 0===ot.touchZoomRotate)&&(null===this||void 0===this||null===(Hl=this.touchZoomRotate)||void 0===Hl||Hl.disableRotation());this._options.raster&&(this._options.background=this._options.background||"streets"),this._attribution=new(Sc().AttributionControl)({compact:!1,...ot.attributionControl}),this.addControl(this._attribution),this._initMapPosition(),this._picMarker=this._getPictureMarker(),this._picMarkerPreview=this._getPictureMarker(!1),this._picThumbUrl={},this._seqPictures={},this._userLayers=new Set,this._parent.addEventListener("select",this.reloadLayersStyles.bind(this)),setTimeout((()=>{var at;!this.loaded()&&null!==(at=this._parent)&&void 0!==at&&at.loader.isVisible()&&this._parent.loader.dismiss({},this._parent._t.map.slow_loading,(async()=>{await this._postLoad(),this._parent.loader.dismiss()}))}),15e3),this.waitForEnoughMapLoaded().then((async()=>await this._postLoad()))}async _postLoad(){this.resize(),await this.setVisibleUsers(this._parent.users),this.reloadLayersStyles(),this.fire("ready")}destroy(){this.remove(),delete this._parent,delete this._options,delete this._attribution,delete this._picMarker,delete this._picMarkerPreview,delete this._picThumbUrl,delete this._seqPictures,delete this._userLayers}waitForEnoughMapLoaded(){return new Promise((at=>{let st=0,ot=0,ut=0,Hl=0;const onSourceDataLoading=at=>{"source"===at.dataType&&at.tile&&(at.sourceId.startsWith("geovisio")?ot++:st++)},onSourceData=at=>{"source"===at.dataType&&at.tile&&(at.sourceId.startsWith("geovisio")?(Hl++,at.isSourceLoaded&&(Hl=ot)):(ut++,at.isSourceLoaded&&(ut=st))),checkEnoughLoaded()},checkEnoughLoaded=()=>{ut/st>=.75&&(0===ot||Hl/ot>=.75)&&(this.off("sourcedata",onSourceData),this.off("sourcedataloading",onSourceDataLoading),at())};this.on("sourcedataloading",onSourceDataLoading),this.on("sourcedata",onSourceData)}))}_initMapPosition(){this._options.center&&this._options.center!=[0,0]||this._options.zoom&&0!==this._options.zoom||this._options.hash||this._parent.onceAPIReady().then((()=>{var at,st;let ot=null===(at=this._parent)||void 0===at||null===(st=at.api)||void 0===st?void 0:st.getDataBbox();if(ot)try{ot=new(Sc().LngLatBounds)(ot),this.loaded()?this.fitBounds(ot,{animate:!1}):this.waitForEnoughMapLoaded().then((()=>this.fitBounds(ot,{animate:!1})))}catch(ut){console.warn("Received invalid bbox: "+ot)}}))}_loadMarkerImages(){[{id:"pnx-marker",img:rc},{id:"pnx-arrow-flat",img:oc},{id:"pnx-arrow-360",img:_c}].forEach((at=>{const st=new Image(64,64);st.onload=()=>this.addImage(at.id,st),st.src=at.img}))}_hasQualityScore(){var at,st,ot,ut;const Hl=(null===(at=this.getStyle())||void 0===at||null===(st=at.metadata)||void 0===st?void 0:st["panoramax:fields"])||{};return(null===Hl||void 0===Hl||null===(ot=Hl.pictures)||void 0===ot?void 0:ot.includes("gps_accuracy"))&&(null===Hl||void 0===Hl||null===(ut=Hl.pictures)||void 0===ut?void 0:ut.includes("h_pixel_density"))}_hasGridStats(){var at,st,ot,ut,Hl,rc;const sc=(null===(at=this.getStyle())||void 0===at||null===(st=at.metadata)||void 0===st?void 0:st["panoramax:fields"])||{};return(null===sc||void 0===sc||null===(ot=sc.grid)||void 0===ot?void 0:ot.includes("nb_360_pictures"))&&(null===sc||void 0===sc||null===(ut=sc.grid)||void 0===ut?void 0:ut.includes("nb_flat_pictures"))&&(null===sc||void 0===sc||null===(Hl=sc.grid)||void 0===Hl?void 0:Hl.includes("coef_360_pictures"))&&(null===sc||void 0===sc||null===(rc=sc.grid)||void 0===rc?void 0:rc.includes("coef_flat_pictures"))}reloadVectorTiles(){[...this._userLayers].forEach((at=>{const st=this.getSource((0,ut.getUserSourceId)(at));st.setTiles(st.tiles)}))}hasTwoBackgrounds(){return void 0!==this.getLayer(ut.RASTER_LAYER_ID)}getBackground(){if(!this.getLayer(ut.RASTER_LAYER_ID))return"streets";return"visible"==this.getLayoutProperty(ut.RASTER_LAYER_ID,"visibility")?"aerial":"streets"}setBackground(at){if(!this.getLayer(ut.RASTER_LAYER_ID)&&"aerial"===at)throw new Error("No aerial imagery available");this.getLayer(ut.RASTER_LAYER_ID)&&(this.setLayoutProperty(ut.RASTER_LAYER_ID,"visibility","aerial"===at?"visible":"none"),this.fire("background-changed",{background:at||"streets"}))}getVisibleUsers(){return[...this._userLayers].filter((at=>this.getLayer((0,ut.getUserLayerId)(at,"pictures"))&&"visible"===this.getLayoutProperty((0,ut.getUserLayerId)(at,"pictures"),"visibility")))}onceLayerReady(at){return this.getLayer(at)?Promise.resolve():new Promise((at=>{setTimeout(at,250)})).then((()=>this.onceLayerReady(at)))}async setVisibleUsers(){let at=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];"string"===typeof at?at=[at]:null===at&&(at=[]),await Promise.all(at.filter((at=>""!=at&&!this._userLayers.has(at))).map((at=>(this._createPicturesTilesLayer(at),this.onceLayerReady((0,ut.getUserLayerId)(at,"pictures"))))));const st=["pictures","sequences","sequences_plus","grid","pictures_symbols"];[...this._userLayers].forEach((ot=>{st.forEach((st=>{const Hl=(0,ut.getUserLayerId)(ot,st);this.getLayer(Hl)&&this.setLayoutProperty(Hl,"visibility",at.includes(ot)?"visible":"none")}))})),this.reloadLayersStyles(),this.fire("users-changed",{usersIds:at})}filterUserLayersContent(at,st){[...this._userLayers].forEach((ot=>{this.getLayer((0,ut.getUserLayerId)(ot,at))?(this.setFilter((0,ut.getUserLayerId)(ot,at),st),"sequences"===at&&this.getLayer((0,ut.getUserLayerId)(ot,"sequences_plus"))&&this.setFilter((0,ut.getUserLayerId)(ot,"sequences_plus"),st),"pictures"===at&&this.getLayer((0,ut.getUserLayerId)(ot,"pictures_symbols"))&&this.setFilter((0,ut.getUserLayerId)(ot,"pictures_symbols"),st)):console.warn("Layer",(0,ut.getUserLayerId)(ot,at),"not ready")}))}displayPictureMarker(at,st,ot){let Hl=arguments.length>3&&void 0!==arguments[3]&&arguments[3],rc=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;this._picMarkerPreview.remove(),void 0!==at&&void 0!==st?(this._picMarker.setLngLat([at,st]).setRotation(ot).addTo(this),this._picMarker.picId=rc):this._picMarker.remove(),this.reloadLayersStyles(),Hl||void 0===at||void 0===st||this.flyTo({center:[at,st],zoom:this.getZoom()<ut.TILES_PICTURES_ZOOM+2?ut.TILES_PICTURES_ZOOM+2:this.getZoom(),maxDuration:2e3})}reloadLayersStyles(){const updateStyle=(at,st)=>{[...this._userLayers].forEach((ot=>{const Hl=(0,ut.getUserLayerId)(ot,at);if(this.getLayer(Hl)){for(let at in st.layout)this.setLayoutProperty(Hl,at,st.layout[at]);for(let at in st.paint)this.setPaintProperty(Hl,at,st.paint[at])}else console.warn("Layer",Hl,"not ready")}))};["pictures","pictures_symbols","sequences"].forEach((at=>{updateStyle(at,this._getLayerStyleProperties(at))}))}async _createPicturesTilesLayer(at){this._userLayers.add(at);const st=this.getStyle().layers.find(ut.isLabelLayer);if("geovisio"!==at&&!this.getSource(`geovisio_${at}`)){const ot=await this._parent.api.getUserMapStyle(at);Object.entries(ot.sources).forEach((at=>{let[st,ot]=at;return this.addSource(st,ot)})),ot.layers=ot.layers||[];ot.layers.concat((0,ut.getMissingLayerStyles)(ot.sources,ot.layers)).filter((at=>Object.keys(at).length>0)).forEach((at=>this.addLayer(at,null===st||void 0===st?void 0:st.id)))}this._picPreviewTimer=null,this._picPopup=new(Sc().Popup)({closeButton:!1,closeOnClick:!this._parent.isWidthSmall(),offset:3}),this._picPopup.on("close",(()=>{delete this._picPopup._picId}));const ot=(0,ut.getUserLayerId)(at,"pictures");this.on("mousemove",ot,(at=>{this.getCanvas().style.cursor="pointer";const st=Object.assign({},at);clearTimeout(this._picPreviewTimer),this._picPreviewTimer=setTimeout((()=>this._attachPreviewToPictures(st,ot)),100)})),this.on("mouseleave",ot,(()=>{clearTimeout(this._picPreviewTimer),this.getCanvas().style.cursor="",this._picPopup._picId,this._picPopup.remove()})),this.on("click",ot,this._onPictureClick.bind(this));const Hl=(0,ut.getUserLayerId)(at,"sequences_plus");this.on("mousemove",Hl,(at=>{if(this._onSequenceHover(at),this.getZoom()<=ut.TILES_PICTURES_ZOOM+1&&(this.getCanvas().style.cursor="pointer",at.features[0].properties.id)){const st=Object.assign({},at);clearTimeout(this._picPreviewTimer),this._picPreviewTimer=setTimeout((()=>this._attachPreviewToPictures(st,Hl)),100)}})),this.on("mouseleave",Hl,(()=>{clearTimeout(this._picPreviewTimer),this.getCanvas().style.cursor="",this._picPopup._picId,this._picPopup.remove()})),this.on("click",Hl,(at=>{at.preventDefault(),this.getZoom()<=ut.TILES_PICTURES_ZOOM+1&&this._onSequenceClick(at)})),"geovisio"===at&&this.getLayer("geovisio_grid")&&(this.on("mousemove","geovisio_grid",(at=>{if(this.getZoom()<=ut.TILES_PICTURES_ZOOM+1){this.getCanvas().style.cursor="pointer";const st=Object.assign({},at);clearTimeout(this._picPreviewTimer),this._picPreviewTimer=setTimeout((()=>this._attachPreviewToPictures(st,"geovisio_grid")),100)}})),this.on("mouseleave","geovisio_grid",(()=>{clearTimeout(this._picPreviewTimer),this.getCanvas().style.cursor="",this._picPopup._picId,this._picPopup.remove()})),this.on("click","geovisio_grid",(at=>{at.preventDefault(),this.flyTo({center:at.lngLat,zoom:ut.TILES_PICTURES_ZOOM-6})}))),this.on("click",(at=>{!1===at.defaultPrevented&&(clearTimeout(this._picPreviewTimer),this._picPopup.remove())}))}_getLayerStyleProperties(at){if("pictures_symbols"===at)return{paint:{},layout:{"icon-image":["case",["==",["get","id"],this._parent.picture],"",["==",["get","type"],"equirectangular"],"pnx-arrow-360","pnx-arrow-flat"],"symbol-sort-key":this._getLayerSortStyle(at)}};{const st={pictures:"circle",sequences:"line"};return{paint:Object.assign({[`${st[at]}-color`]:this._getLayerColorStyle(at)},ut.VECTOR_STYLES[at.toUpperCase()].paint),layout:Object.assign({[`${st[at]}-sort-key`]:this._getLayerSortStyle(at)},ut.VECTOR_STYLES[at.toUpperCase()].layout)}}}_getLayerColorStyle(at){const st=["case",["==",["get","hidden"],!0],Hl.COLORS.HIDDEN,["==",["get","geovisio:status"],"hidden"],Hl.COLORS.HIDDEN],ot=this._parent.sequence;return"sequences"==at&&ot?st.push(["==",["get","id"],ot],Hl.COLORS.SELECTED):at.startsWith("pictures")&&ot&&st.push(["in",ot,["get","sequences"]],Hl.COLORS.SELECTED),st.push(Hl.COLORS.BASE),st}_getLayerSortStyle(at){const st=["case",["==",["get","hidden"],!0],90],ot=this._parent.sequence;return"sequences"==at&&ot?st.push(["==",["get","id"],ot],100):at.startsWith("pictures")&&ot&&st.push(["in",ot,["get","sequences"]],100),st.push(10),st}_attachPreviewToPictures(at,st){let ot=at.features.pop();if(!ot||ot.properties.id==this._picPopup._picId)return;let Hl=null;if(st.endsWith("pictures")?Hl=ot.geometry.coordinates.slice():at.lngLat&&(Hl=[at.lngLat.lng,at.lngLat.lat]),!Hl){const at="LineString"===ot.geometry.type?[ot.geometry.coordinates]:ot.geometry.coordinates;let st=null;const ut=this.getBounds(),rc=ut.getCenter();for(let ot=0;ot<at.length;ot++)for(let sc=0;sc<at[ot].length;sc++)if(ut.contains(at[ot][sc])){let ut=rc.distanceTo(new(Sc().LngLat)(...at[ot][sc]));(null===st||ut<st)&&(Hl=at[ot][sc],st=ut)}if(!Hl)return}this._picPopup.setLngLat(Hl).addTo(this),this._picThumbUrl[ot.properties.id]||this._picPopup.setDOMContent((0,ut.getThumbGif)(this._parent._t)),this._picPopup._loading=ot.properties.id,this._picPopup._picId=ot.properties.id;const displayThumb=at=>{if(this._picPopup._loading===ot.properties.id)if(delete this._picPopup._loading,at){let st=document.createElement("img");st.classList.add("pnx-map-thumb"),st.alt=this._parent._t.map.thumbnail;let ut=new Image;if(ut.src=at,ut.addEventListener("load",(()=>{ot.properties.hidden?st.children[0].src=ut.src:st.src=ut.src,this._picPopup.setDOMContent(st)})),ot.properties.hidden){const at=document.createElement("div");at.classList.add("pnx-map-thumb-legend"),at.appendChild(document.createTextNode(this._parent._t.map.not_public));const ot=document.createElement("div");ot.appendChild(st),ot.appendChild(at),st=ot}}else this._picPopup.remove()};st.endsWith("pictures")?this._getPictureThumbURL(ot.properties.id).then(displayThumb):st.endsWith("grid")?this._getThumbURL(Hl).then(displayThumb):this._getSequenceThumbURL(ot.properties.id,new(Sc().LngLat)(...Hl)).then(displayThumb)}_getThumbURL(at){return this._parent.api.getPicturesAroundCoordinates(at[1],at[0],.1,1).then((at=>{var st;const ot=null===at||void 0===at||null===(st=at.features)||void 0===st?void 0:st.pop();return ot?this._parent.api.findThumbnailInPictureFeature(ot):null}))}_getSequenceThumbURL(at,st){return st?this._parent.api.getPicturesAroundCoordinates(st.lat,st.lng,1,1,at).then((st=>{var ot;return(null===st||void 0===st||null===(ot=st.features)||void 0===ot?void 0:ot.length)>0?this._parent.api.findThumbnailInPictureFeature(st.features[0]):this._parent.api.getPictureThumbnailURLForSequence(at)})):this._parent.api.getPictureThumbnailURLForSequence(at)}_getPictureThumbURL(at,st){let ot=null;return at&&(void 0!==this._picThumbUrl[at]?ot="string"===typeof this._picThumbUrl[at]?Promise.resolve(this._picThumbUrl[at]):this._picThumbUrl[at]:(this._picThumbUrl[at]=this._parent.api.getPictureThumbnailURL(at,st).then((st=>st?(this._picThumbUrl[at]=st,st):(this._picThumbUrl[at]=null,null))).catch((()=>{this._picThumbUrl[at]=null})),ot=this._picThumbUrl[at])),ot}_getPictureMarker(){let at=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const st=document.createElement("img");return st.src=at?sc:rc,st.alt="",new(Sc().Marker)({element:st,picId:null}).setDraggable(at&&this._options.picMarkerDraggable)}_onSequenceHover(at){var st;at.preventDefault(),at.features.length>0&&null!==(st=at.features[0].properties)&&void 0!==st&&st.id&&this.fire("sequence-hover",{seqId:at.features[0].properties.id})}_onSequenceClick(at){var st;at.preventDefault(),at.features.length>0&&null!==(st=at.features[0].properties)&&void 0!==st&&st.id&&this.fire("sequence-click",{seqId:at.features[0].properties.id,coordinates:at.lngLat})}_onPictureClick(at){var st,ot;at.preventDefault();const ut=(null===at||void 0===at||null===(st=at.features)||void 0===st?void 0:st.length)>0?at.features[0]:null;if(null!==ut&&void 0!==ut&&null!==(ot=ut.properties)&&void 0!==ot&&ot.id){let st=null;try{ut.properties.sequences&&(Array.isArray(ut.properties.sequences)||(ut.properties.sequences=JSON.parse(ut.properties.sequences)),st=ut.properties.sequences.pop())}catch(at){console.log("Sequence ID is not available in vector tiles for picture "+ut.properties.id)}this.fire("picture-click",{picId:ut.properties.id,seqId:st,feature:ut})}}addEventListener(at,st){let ot=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};null!==ot&&void 0!==ot&&ot.once?this.once(at,st):this.on(at,st)}}},2771:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>MapMore,T:()=>oc});var ut=ot(5642),Hl=ot(7343),rc=ot(8340);const sc={DEFAULT:"default",AGE:"age",TYPE:"type",SCORE:"score"},oc=["minDate","maxDate","pic_type","camera","theme","qualityscore"];class MapMore extends ut.A{constructor(at,st){super(at,st,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),this._mapFilters={},this._options.theme&&(this._mapFilters={theme:this._options.theme})}reloadLayersStyles(){if(super.reloadLayersStyles(),this._hasGridStats()){let at="coef";this._mapFilters.pic_type&&(at="flat"==this._mapFilters.pic_type?"coef_flat_pictures":"coef_360_pictures"),this.getStyle().layers.filter((at=>at.id.endsWith("_grid"))).forEach((st=>{const ot=(0,rc.switchCoefValue)(st,at);for(let at in ot.layout)this.setLayoutProperty(st.id,at,ot.layout[at]);for(let at in ot.paint)this.setPaintProperty(st.id,at,ot.paint[at])}))}}_getDatesForLayerColors(){const at=864e5,st=Date.now();return[st-30*at,st-365*at,st-730*at].map((at=>new Date(at).toISOString().split("T")[0]))}_getLayerColorStyle(at){var st,ot,ut,oc,_c,wc,Sc,iu;const su=["case",["==",["get","hidden"],!0],Hl.COLORS.HIDDEN],lu=(null===(st=this._parent.psv)||void 0===st||null===(ot=st._myVTour)||void 0===ot||null===(ut=ot.state)||void 0===ut?void 0:ut.loadingNode)||(null===(oc=this._parent.psv)||void 0===oc||null===(_c=oc._myVTour)||void 0===_c||null===(wc=_c.state)||void 0===wc||null===(Sc=wc.currentNode)||void 0===Sc?void 0:Sc.id),cu=lu?null===(iu=this._parent.psv)||void 0===iu?void 0:iu._picturesSequences[lu]:null;if("sequences"==at&&cu?su.push(["==",["get","id"],cu],Hl.COLORS.SELECTED):"pictures"==at&&cu&&su.push(["in",cu,["get","sequences"]],Hl.COLORS.SELECTED),this._mapFilters.theme==sc.AGE){const st="sequences"==at?"date":"ts",ot=this._getDatesForLayerColors();su.push(["!",["has",st]],Hl.COLORS.BASE,[">=",["get",st],ot[0]],Hl.COLORS.PALETTE_4,[">=",["get",st],ot[1]],Hl.COLORS.PALETTE_3,[">=",["get",st],ot[2]],Hl.COLORS.PALETTE_2,Hl.COLORS.PALETTE_1)}else this._mapFilters.theme==sc.TYPE?su.push(["!",["has","type"]],Hl.COLORS.BASE,["==",["get","type"],"equirectangular"],Hl.COLORS.QUALI_1,Hl.COLORS.QUALI_2):this._mapFilters.theme==sc.SCORE?su.push(["==",rc.MAP_EXPR_QUALITYSCORE,5],Hl.QUALITYSCORE_VALUES[0].color,["==",rc.MAP_EXPR_QUALITYSCORE,4],Hl.QUALITYSCORE_VALUES[1].color,["==",rc.MAP_EXPR_QUALITYSCORE,3],Hl.QUALITYSCORE_VALUES[2].color,["==",rc.MAP_EXPR_QUALITYSCORE,2],Hl.QUALITYSCORE_VALUES[3].color,Hl.QUALITYSCORE_VALUES[4].color):su.push(Hl.COLORS.BASE);return su}_getLayerSortStyle(at){var st,ot,ut,Hl,oc,_c,wc,Sc;const iu=["case",["==",["get","hidden"],!0],90],su=(null===(st=this._parent.psv)||void 0===st||null===(ot=st._myVTour)||void 0===ot||null===(ut=ot.state)||void 0===ut?void 0:ut.loadingNode)||(null===(Hl=this._parent.psv)||void 0===Hl||null===(oc=Hl._myVTour)||void 0===oc||null===(_c=oc.state)||void 0===_c||null===(wc=_c.currentNode)||void 0===wc?void 0:wc.id),lu=su?null===(Sc=this._parent.psv)||void 0===Sc?void 0:Sc._picturesSequences[su]:null;if("sequences"==at&&lu?iu.push(["==",["get","id"],lu],100):"pictures"==at&&lu&&iu.push(["in",lu,["get","sequences"]],100),this._mapFilters.theme==sc.AGE){const st="sequences"==at?"date":"ts",ot=this._getDatesForLayerColors();iu.push(["!",["has",st]],0,[">=",["get",st],ot[0]],50,[">=",["get",st],ot[1]],49,[">=",["get",st],ot[2]],48)}else this._mapFilters.theme==sc.TYPE?iu.push(["!",["has","type"]],0,["==",["get","type"],"equirectangular"],50):this._mapFilters.theme==sc.SCORE&&iu.push(["==",rc.MAP_EXPR_QUALITYSCORE,5],80,["==",rc.MAP_EXPR_QUALITYSCORE,4],65,["==",rc.MAP_EXPR_QUALITYSCORE,3],50,["==",rc.MAP_EXPR_QUALITYSCORE,2],35,["==",rc.MAP_EXPR_QUALITYSCORE,1],20);return iu.push(10),iu}_mapFiltersToLayersFilters(at){let st={},ot=[],ut=[],Hl=!1;if(at.minDate&&""!==at.minDate&&(st.minDate=at.minDate,ot.push([">=",["get","date"],at.minDate]),ut.push([">=",["get","ts"],at.minDate])),at.maxDate&&""!==at.maxDate){st.maxDate=at.maxDate,ot.push(["<=",["get","date"],at.maxDate]);let Hl=new Date(at.maxDate);Hl.setDate(Hl.getDate()+1),Hl=Hl.toISOString().split("T")[0],ut.push(["<=",["get","ts"],Hl])}if(at.pic_type&&""!==at.pic_type&&(st.pic_type="flat"===at.pic_type?"flat":"equirectangular",ot.push(["==",["get","type"],st.pic_type]),ut.push(["==",["get","type"],st.pic_type])),this._hasGridStats()&&(Hl=!0),at.camera&&""!==at.camera){st.camera=at.camera;const Hl=at.camera.toLowerCase().trim()+" ",rc=at.camera.toLowerCase().trim()+"zzzzzzzzzzzzzzzzzzzz",sc=["collator",{"case-sensitive":!1,"diacritic-sensitive":!1}];ot.push([">=",["get","model"],Hl,sc]),ot.push(["<=",["get","model"],rc,sc]),ut.push([">=",["get","model"],Hl,sc]),ut.push(["<=",["get","model"],rc,sc])}return at.qualityscore&&at.qualityscore.length>0&&(st.qualityscore=at.qualityscore,ot.push(["in",rc.MAP_EXPR_QUALITYSCORE,["literal",st.qualityscore]]),ut.push(["in",rc.MAP_EXPR_QUALITYSCORE,["literal",st.qualityscore]])),at.theme&&Object.values(sc).includes(at.theme)&&(st.theme=at.theme,Hl=!0),0==ot.length?ot=null:ot.unshift("all"),0==ut.length?ut=null:(ut.unshift("all"),ut=["step",["zoom"],!0,rc.TILES_PICTURES_ZOOM,ut]),{mapFilters:st,mapSeqFilters:ot,mapPicFilters:ut,reloadMapStyle:Hl}}setFilters(at){let st=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{mapFilters:ot,mapSeqFilters:ut,mapPicFilters:Hl,reloadMapStyle:rc}=this._mapFiltersToLayersFilters(at);this._mapFilters=ot,rc&&this.reloadLayersStyles();const oc=this.getVisibleUsers().includes("geovisio");ut&&oc&&(ut=["step",["zoom"],!0,7,ut]),this.filterUserLayersContent("sequences",ut),this.filterUserLayersContent("pictures",Hl),!st&&(null!==ut||null!==Hl||null!==this._mapFilters.theme&&this._mapFilters.theme!==sc.DEFAULT)&&oc&&this.getZoom()<7&&!this._hasGridStats()&&this.easeTo({zoom:7}),this.fire("filters-changed",Object.assign({},this._mapFilters))}async setVisibleUsers(){let at=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];await super.setVisibleUsers(at);let{mapSeqFilters:st,mapPicFilters:ot,reloadMapStyle:ut}=this._mapFiltersToLayersFilters(this._mapFilters);ut&&this.reloadLayersStyles();const Hl=at.includes("geovisio");st&&Hl&&(st=["step",["zoom"],!0,7,st]),this.filterUserLayersContent("sequences",st),this.filterUserLayersContent("pictures",ot)}}},9048:(at,st,ot)=>{"use strict";ot.d(st,{Ay:()=>Photo,LM:()=>cu,Vf:()=>uu,cS:()=>lu});ot(5003);var ut=ot(5975),Hl=ot(2305),rc=ot(7343),sc=ot(508),oc=(ot(3961),ot(1080),ot(2710),ot(1575),ot(1545)),_c=ot(3348),wc=ot(4991),Sc=ot(3727);const iu={baseUrl:ut,width:1280,cols:2,rows:1,tileUrl:()=>null},su={id:rc.BASE_PANORAMA_ID,caption:"",panorama:iu,links:[],gps:[0,0],sequence:{},sphereCorrection:{},horizontalFov:360,properties:{}},lu=30,cu=250,uu=3e3;oc.jM.useNewAnglesOrder=!0;class Photo extends oc.jM{constructor(at,st){var ot;let ut=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super({container:st,adapter:[Sc.A,{showErrorTile:!1,baseBlur:!1,resolution:at.isWidthSmall()?32:64,shouldGoFast:ut.shouldGoFast}],withCredentials:at.api._getPSVWithCredentials(),requestHeaders:null===at||void 0===at||null===(ot=at.fetchOptions)||void 0===ot?void 0:ot.headers,panorama:iu,lang:at._t.psv,minFov:5,loadingTxt:"&nbsp;",navbar:null,rendererParameters:{preserveDrawingBuffer:!at.isWidthSmall()},plugins:[[_c.$,{dataMode:"server",positionMode:"gps",renderMode:"3d",preload:!0,getNode:()=>{},transitionOptions:()=>{},arrowsPosition:{linkOverlapAngle:Math.PI/6}}],[wc.b,{}]],...ut}),this._parent=at,this._options=ut,st.classList.add("pnx-psv"),this._shouldGoFast=(null===ut||void 0===ut?void 0:ut.shouldGoFast)||(()=>!1),this._transitionDuration=(null===ut||void 0===ut?void 0:ut.transitionDuration)||cu,this._myVTour=this.getPlugin(_c.$),this._myVTour.datasource.nodeResolver=this._getNodeFromAPI.bind(this),this._myVTour.config.transitionOptions=this._psvNodeTransition.bind(this),this._clearArrows=this._myVTour.arrowsRenderer.clear.bind(this._myVTour.arrowsRenderer),this._myVTour.arrowsRenderer.clear=()=>{},this._myMarkers=this.getPlugin(wc.b),this._annotationsVisible=!1,this._sequencePlaying=!1,this._picturesNavigation=this._options.picturesNavigation||"any",this._picturesSequences={},this._myVTour.addEventListener("enter-arrow",this._onEnterArrow.bind(this)),this._myVTour.addEventListener("leave-arrow",this._onLeaveArrow.bind(this)),this._myVTour.addEventListener("node-changed",this._onNodeChanged.bind(this)),this._myMarkers.addEventListener("select-marker",this._onSelectMarker.bind(this)),this.addEventListener("position-updated",this._onPositionUpdated.bind(this)),this.addEventListener("zoom-updated",this._onZoomUpdated.bind(this)),this.addEventListener("dblclick",this._onDoubleClick.bind(this)),this._parent.addEventListener("select",this._onSelect.bind(this)),this.loader.size=150,this.loader.color="rgba(61, 61, 61, 0.5)",this.loader.textColor="rgba(255, 255, 255, 0.7)",this.loader.border=5,this.loader.thickness=10,this.loader.canvas.setAttribute("viewBox","0 0 150 150"),this.loader.__updateContent(),this._options.position&&!this._parent.picture&&this.goToPosition(...this._options.position)}async _getNodeFromAPI(at){var st,ot;if((0,rc.isNullId)(at))return su;const ut=await fetch(this._parent.api.getPictureMetadataUrl(at,this._picturesSequences[at]),this._parent.api._getFetchOptions());let Hl=await ut.json();if(Hl.features&&(Hl=Hl.features.pop()),!Hl||0===Object.keys(Hl).length||!ut.ok)throw this._parent.loader&&this._parent.loader.dismiss(!0,this._parent._t.pnx.error_pic),new Error("Picture with ID "+at+" was not found");this._picturesSequences[at]=Hl.collection;const oc=(0,sc.apiFeatureToPSVNode)(Hl,this._parent._t,this._parent._isInternetFast,this._picturesNavFilter.bind(this));var _c,wc;null!==oc&&void 0!==oc&&null!==(st=oc.sequence)&&void 0!==st&&st.prevPic&&(this._picturesSequences[null===oc||void 0===oc||null===(_c=oc.sequence)||void 0===_c?void 0:_c.prevPic]=Hl.collection);null!==oc&&void 0!==oc&&null!==(ot=oc.sequence)&&void 0!==ot&&ot.nextPic&&(this._picturesSequences[null===oc||void 0===oc||null===(wc=oc.sequence)||void 0===wc?void 0:wc.nextPic]=Hl.collection);return oc}_psvNodeTransition(at,st,ot){var ut,Hl,sc;let oc={};const _c=this._shouldGoFast()?0:Math.min(cu,this._transitionDuration),wc=_c>100,Sc=null!=(ot||(null===st||void 0===st?void 0:st.links.find((st=>st.nodeId==at.id)))),iu=st&&at.sequence.id===st.sequence.id,su=((null===st||void 0===st||null===(ut=st.properties)||void 0===ut?void 0:ut["view:azimuth"])||0)*(Math.PI/180),uu=((null===at||void 0===at||null===(Hl=at.properties)||void 0===Hl?void 0:Hl["view:azimuth"])||0)*(Math.PI/180),pu=(0,rc.getRelativeHeading)(at)*(Math.PI/180);this.setOption("maxFov",Math.min(3*at.horizontalFov/4,90));const mu={showLoader:!1,effect:"none",speed:0,rotation:!1,rotateTo:{pitch:0,yaw:-pu},zoomTo:lu};if(360==at.horizontalFov)oc=st?(0,rc.getDistance)(st.gps,at.gps)>=.001?mu:{speed:_c,effect:Sc&&wc?"fade":"none",rotation:Sc&&iu&&wc,rotateTo:this.getPosition()}:mu;else if(iu){const at=this.getPosition().yaw,ot=st.horizontalFov*(Math.PI/180)/2,ut=at<=ot||at>=2*Math.PI-ot,Hl=Math.abs(su-uu)<=Math.PI/4;oc={speed:_c,effect:Sc&&Hl&&wc?"fade":"none",rotation:Sc&&Hl&&wc,rotateTo:ut?this.getPosition():{pitch:0,yaw:0},zoomTo:ut?this.getZoomLevel():lu}}else oc=Object.assign(mu,{rotateTo:{pitch:0,yaw:0}});"fade"===oc.effect&&oc.speed>=150?setTimeout(this._clearArrows,oc.speed-100):this._clearArrows();const gu=new CustomEvent("picture-loading",{detail:{...Object.assign({},this.getXYZ(),oc.rotateTo?{x:180*(uu+oc.rotateTo.yaw)/Math.PI}:null,oc.zoomTo?{z:oc.zoomTo}:null),picId:at.id,lon:at.gps[0],lat:at.gps[1],first:(null===(sc=this._parent._initParams)||void 0===sc?void 0:sc.getParentPostInit().picture)==at.id}});return this.dispatchEvent(gu),oc}_onEnterArrow(at){const st=at.link,ot=at.node;let ut;ot&&(ut=360===ot.horizontalFov?(this.getPictureOriginalHeading()+180*this.getPosition().yaw/Math.PI)%360:this.getPictureOriginalHeading());const Hl=new CustomEvent("picture-preview-started",{detail:{picId:st.nodeId,coordinates:st.gps,direction:ut}});this.dispatchEvent(Hl)}_onLeaveArrow(at){const st=at.link,ot=new CustomEvent("picture-preview-stopped",{detail:{picId:st.nodeId}});this.dispatchEvent(ot)}_onPositionUpdated(at){let{position:st}=at;const ot=(0,rc.positionToXYZ)(st,this.getZoomLevel());ot.x+=this.getPictureOriginalHeading(),ot.x=ot.x%360;const ut=new CustomEvent("view-rotated",{detail:ot});this.dispatchEvent(ut),this._onTilesStartLoading()}_onZoomUpdated(at){let{zoomLevel:st}=at;const ot=new CustomEvent("view-rotated",{detail:{...this.getXY(),z:st}});this.dispatchEvent(ot),this._onTilesStartLoading()}_onDoubleClick(){this.unfocusAnnotation()}_onNodeChanged(at){for(let Hl of document.getElementsByClassName("pnx-psv-tour-arrows"))Hl.classList.remove("pnx-clicked");if(at.node.id){var st,ot,ut;const Hl=(null===(st=this._parent._initParams)||void 0===st?void 0:st.getParentPostInit().picture)==at.node.id;this._parent.select(null===(ot=at.node)||void 0===ot||null===(ut=ot.sequence)||void 0===ut?void 0:ut.id,at.node.id);const rc=this.getPictureMetadata();if(!rc)return void this.dispatchEvent(new CustomEvent("picture-loaded",{detail:{}}));this._prevSequence=rc.sequence.id;const sc=new CustomEvent("picture-loaded",{detail:{...this.getXYZ(),picId:at.node.id,lon:rc.gps[0],lat:rc.gps[1],first:Hl}});this.dispatchEvent(sc),rc.panorama.hdUrl?(this.setOption("downloadUrl",rc.panorama.hdUrl),this.setOption("downloadName",at.node.id+".jpg")):this.setOption("downloadUrl",null),this._annotationsVisible&&this.toggleAllAnnotations(!0)}this._onTilesStartLoading()}_onSelectMarker(at){var st;if(at.marker&&null!==(st=at.marker.id)&&void 0!==st&&st.startsWith("annotation-")){const st=new CustomEvent("annotation-click",{detail:{annotationId:at.marker.data.id}});this.dispatchEvent(st)}}_onTilesStartLoading(){this._tilesQueueTimer&&(clearInterval(this._tilesQueueTimer),delete this._tilesQueueTimer),this._tilesQueueTimer=setInterval((()=>{if(0===Object.keys(this.adapter.queue.tasks).length){if(this._myVTour.state.currentNode){const at=new CustomEvent("picture-tiles-loaded",{detail:{picId:this._myVTour.state.currentNode.id}});this.dispatchEvent(at)}clearInterval(this._tilesQueueTimer),delete this._tilesQueueTimer}}),100)}getPictureMetadata(){var at,st,ot;return(0,rc.isNullId)(null===(at=this._myVTour)||void 0===at||null===(st=at.state)||void 0===st||null===(ot=st.currentNode)||void 0===ot?void 0:ot.id)?null:this._myVTour.state.currentNode?Object.assign({},this._myVTour.state.currentNode):null}getPictureId(){var at,st,ot,ut,Hl;const sc=(null===(at=this._myVTour)||void 0===at||null===(st=at.state)||void 0===st?void 0:st.loadingNode)||(null===(ot=this._myVTour)||void 0===ot||null===(ut=ot.state)||void 0===ut||null===(Hl=ut.currentNode)||void 0===Hl?void 0:Hl.id);return(0,rc.isNullId)(sc)?null:sc}_onSelect(at){var st;at.detail.seqId&&(this._picturesSequences[at.detail.picId]=at.detail.seqId),(null===(st=this._myVTour.getCurrentNode())||void 0===st?void 0:st.id)!==at.detail.picId&&(this.loader.show(),this._myVTour.setCurrentNode(at.detail.picId).catch((at=>{this.showErrorOverlay(at,this._parent._t.pnx.error_pic,!0)})))}goToNextPicture(){if(!this.getPictureMetadata())throw new Error("No picture currently selected");const at=this.getPictureMetadata().sequence.nextPic;if(!at)throw new Error("No next picture available");this._parent.select(this.getPictureMetadata().sequence.id,at)}goToPrevPicture(){if(!this.getPictureMetadata())throw new Error("No picture currently selected");const at=this.getPictureMetadata().sequence.prevPic;if(!at)throw new Error("No previous picture available");this._parent.select(this.getPictureMetadata().sequence.id,at)}async goToPosition(at,st){return this._parent.api.getPicturesAroundCoordinates(at,st).then((at=>{if(at.features.length>0){const st=at.features.pop();return this._parent.select(null===st||void 0===st?void 0:st.collection,st.id),st.id}return Promise.reject(new Error("No picture found nearby given coordinates"))}))}getXY(){const at=(0,rc.positionToXYZ)(this.getPosition());return at.x=(at.x+this.getPictureOriginalHeading())%360,at}getXYZ(){const at=this.getXY();return at.z=this.getZoomLevel(),at}getPictureOriginalHeading(){var at,st;return(null===(at=this.getPictureMetadata())||void 0===at||null===(st=at.properties)||void 0===st?void 0:st["view:azimuth"])||0}getPictureRelativeHeading(){return(0,rc.getRelativeHeading)(this.getPictureMetadata())}clearPictureMetadataCache(){var at,st,ot,ut;const Hl=null===(at=this.getPictureMetadata())||void 0===at?void 0:at.id,rc=null===(st=this.getPictureMetadata())||void 0===st||null===(ot=st.sequence)||void 0===ot?void 0:ot.id;null===(ut=this._myVTour.state.currentTooltip)||void 0===ut||ut.hide(),this._myVTour.state.currentTooltip=null,this._myVTour.state.currentNode=null,this._myVTour.state.preload={},this._myVTour.datasource.nodes={},Hl&&this._parent.select(rc,Hl)}setXYZ(at,st,ot){const ut=(0,rc.xyzToPosition)(at-this.getPictureOriginalHeading(),st,ot);this.rotate({yaw:ut.yaw,pitch:ut.pitch}),this.zoom(ut.zoom)}setHigherContrast(at){this.renderer.renderer.toneMapping=at?3:0,this.renderer.renderer.toneMappingExposure=at?2:1,this.needsUpdate()}getTransitionDuration(){return this._transitionDuration}setTransitionDuration(at){if((at=parseFloat(at))<100||at>uu)throw new Error("Invalid transition duration (should be between 100 and "+uu+")");this._transitionDuration=at;const st=new CustomEvent("transition-duration-changed",{detail:{value:at}});this.dispatchEvent(st)}setPanorama(at,st){const onFailure=at=>{var st;return this.showErrorOverlay(at,null===(st=this._parent)||void 0===st?void 0:st._t.pnx.error_pic,!0)};try{return super.setPanorama(at,st).catch(onFailure)}catch(ot){onFailure(ot)}}showErrorOverlay(at,st,ot){var ut,rc,sc,oc;null!==(ut=this._parent)&&void 0!==ut&&ut.loader.isVisible()||!this.overlay.isVisible()?null===(rc=this._parent)||void 0===rc||rc.loader.dismiss(at,st,ot?()=>{var at;null===(at=this._parent)||void 0===at||at.loader.dismiss(),this.overlay.hide()}:void 0):(console.error(at),this.overlay.show({image:`<img style="width: 200px" src="${Hl}" alt="" />`,title:null===(sc=this._parent)||void 0===sc?void 0:sc._t.pnx.error,text:st+"<br />"+(null===(oc=this._parent)||void 0===oc?void 0:oc._t.pnx.error_click),dissmisable:ot}))}playSequence(){this._sequencePlaying=!0;const at=new Event("sequence-playing",{bubbles:!0,composed:!0});this.dispatchEvent(at);const nextPicturePlay=()=>{if(this._sequencePlaying){this.addEventListener("picture-loaded",(()=>{this._playTimer=setTimeout((()=>{nextPicturePlay()}),this.getTransitionDuration())}),{once:!0});try{this.goToNextPicture()}catch(at){this.stopSequence()}}};this.addEventListener("click",(()=>this.stopSequence())),nextPicturePlay()}stopSequence(){this._sequencePlaying=!1,this._playTimer&&(clearTimeout(this._playTimer),delete this._playTimer),this.forceRefresh();const at=new Event("sequence-stopped",{bubbles:!0,composed:!0});this.dispatchEvent(at)}isSequencePlaying(){return this._sequencePlaying}toggleSequencePlaying(){this.isSequencePlaying()?this.stopSequence():this.playSequence()}getPicturesNavigation(){return this._picturesNavigation}setPicturesNavigation(at){"none"===at&&(at="pic"),this._picturesNavigation=at;const st=new CustomEvent("pictures-navigation-changed",{detail:{value:at}});this.dispatchEvent(st)}_picturesNavFilter(at){switch(this._picturesNavigation){case"seq":return["next","prev"].includes(at.rel);case"pic":case"none":return!1;default:return!0}}areAnnotationsVisible(){return this._annotationsVisible}toggleAllAnnotations(at){const st=this.getPictureMetadata();if(!st)throw this._myMarkers.clearMarkers(),new Error("No picture currently selected");if(at){var ot,ut;let at=st.properties.annotations;0===(null===(ot=at)||void 0===ot?void 0:ot.length)&&console.warn("No annotation available on picture",st.id);const Hl=null===(ut=this.state.textureData.panoData)||void 0===ut?void 0:ut.baseData;at=at.map((at=>{const st=this.getPictureMetadata().properties["pers:interior_orientation"].sensor_array_dimensions;if(!st)return console.warn("Picture lacks pers:interior_orientation.sensor_array_dimensions property, can't compute marker"),null;const ot=at.shape.coordinates.map((at=>at.map((at=>{const ot=[at[0]*Hl.croppedWidth/st[0],at[1]*Hl.croppedHeight/st[1]],ut=[(Hl.croppedX+ot[0])/Hl.fullWidth,(Hl.croppedY+ot[1])/Hl.fullHeight];return[2*(ut[0]-.5)*Math.PI,(.5-ut[1])*Math.PI]}))));return{id:`annotation-${at.id}`,polygon:ot,data:{id:at.id},svgStyle:{stroke:"var(--orange)",strokeWidth:"3px",fill:"var(--orange-transparent)",cursor:"pointer"},tooltip:this._parent._t.pnx.semantics_annotation_tooltip}})),this._myMarkers.setMarkers(at)}else this._myMarkers.clearMarkers();const Hl=this._annotationsVisible!=at;this._annotationsVisible=at,Hl&&this.dispatchEvent(new CustomEvent("annotations-toggled",{detail:{visible:at}}))}focusOnAnnotation(at){this.areAnnotationsVisible()||this.toggleAllAnnotations(!0),this.unfocusAnnotation(!0);const st=`annotation-${at}`;this._myMarkers.updateMarker({id:st,svgStyle:{stroke:"var(--red)",strokeWidth:"3px",fill:"var(--red-transparent)"},data:{selected:!0}}),this._myMarkers.gotoMarker(st,0),this.zoom(65)}unfocusAnnotation(){let at=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const st=Object.keys(this._myMarkers.markers).filter((at=>{var st,ot,ut;return at.startsWith("annotation-")&&(null===(st=this._myMarkers.markers[at])||void 0===st||null===(ot=st.config)||void 0===ot||null===(ut=ot.data)||void 0===ut?void 0:ut.selected)}));st.length>0&&(st.forEach((at=>{this._myMarkers.updateMarker({id:at,svgStyle:{stroke:"var(--orange)",strokeWidth:"3px",fill:"var(--orange-transparent)"},data:{selected:!1}})})),at||this.dispatchEvent(new Event("annotations-unfocused")))}forceRefresh(){var at;const st=this._myVTour.getCurrentNode();if(st&&st.panorama.baseUrl!==(null===st||void 0===st||null===(at=st.panorama)||void 0===at?void 0:at.origBaseUrl)){const at=this.getZoomLevel(),ot=this.getPosition();this._myVTour.state.currentNode=null,this._myVTour.setCurrentNode(st.id,{zoomTo:at,rotateTo:ot,fadeIn:!1,speed:0,rotation:!1})}st&&st.panorama.rows>1&&this.adapter.__refresh()}}},4374:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>Popup});var ut=ot(4542),Hl=ot(5995),rc=ot(8591),sc=ot(6627);class Popup extends ut.WF{constructor(){super(),this.visible=!1}connectedCallback(){super.connectedCallback(),this.addEventListener("click",(at=>{at.target===this&&this.close()})),document.addEventListener("keyup",(at=>{"Escape"===at.key&&this.visible&&this.close()}))}attributeChangedCallback(at,st,ot){super.attributeChangedCallback(at,st,ot),"visible"==at&&(""!==ot&&!0!==ot||this.dispatchEvent(new Event("open")))}close(){this.visible=!1,this.dispatchEvent(new Event("close"))}render(){return ut.qy`
1712
1712
  <div class="pnx-panel pnx-padded">
1713
1713
  <pnx-button
1714
1714
  class="btn-close"