@panoramax/web-viewer 4.0.3-develop-0c0d89e3 → 4.0.3-develop-e49e7274

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/CHANGELOG.md CHANGED
@@ -8,6 +8,10 @@ Before _2.0.0_, Viewer was embed in the [API repository](https://gitlab.com/pano
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ### Changed
12
+
13
+ - In picture legend, in _General_ tab, capture date shows seconds and is clickable to access _Camera_ tab.
14
+
11
15
  ## [4.0.3] - 2025-05-23
12
16
 
13
17
  ### Added
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(Qe,rt){"object"===typeof exports&&"object"===typeof module?module.exports=rt():"function"===typeof define&&define.amd?define("Panoramax",[],rt):"object"===typeof exports?exports.Panoramax=rt():Qe.Panoramax=rt()}(this,(()=>(()=>{var Qe={9039:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>Basic});var Co=Wn(4542),Dl=Wn(5254),Ll=Wn(4964),Rl=Wn(8340),Ul=Wn(5995),Gl=Wn(7343),Zl=Wn(2614),Hl=Wn.n(Zl),ql=Wn(8330);Wn(1865),Wn(3638);class Basic extends Co.WF{constructor(){let Qe=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.users=["geovisio"],this.mapstyle=this.getAttribute("mapstyle")||Rl.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 ${ql.rE} (0c0d89e)\n\n\ud83c\udd98 Issues can be reported at ${ql.Jk.O}`),Qe||(this._isInternetFast=null,(0,Gl.isInternetFast)().then((Qe=>this._isInternetFast=Qe)))}connectedCallback(){super.connectedCallback(),this._t=(0,Ll.getTranslations)(this.lang),this.loader=(0,Ul.createWebComp)("pnx-loader",{_parent:this,"no-label":(0,Gl.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,Ul.createWebComp)("pnx-loader",{_parent:this}),!this.endpoint)return void console.warn("No endpoint is defined");this._loadsAPI=this.endpoint;let Qe=this.endpoint;try{this.mapstyle=JSON.parse(this.mapstyle)}catch(Wn){}try{this.api=new Dl.A(this.endpoint,{users:this.users,fetch:this.fetchOptions,style:this.mapstyle}),this.api.onceReady().then((()=>{if(Qe!=this._loadsAPI||!this.api)return;let rt=this.api.getUnavailableFeatures(),Wn=this.api.getAvailableFeatures();Wn=0===rt.length?"\u2705 All features available":"\u2705 Available features: "+Wn.join(", "),rt=0===rt.length?"":"\ud83d\udeab Unavailable features: "+rt.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 ${Wn}\n ${rt}\n`.trim())})).catch((Qe=>this.loader.dismiss(Qe,this._t.pnx.error_api))).finally((()=>delete this._loadsAPI))}catch(Wn){var rt;delete this._loadsAPI,null!==(rt=this.loader)&&void 0!==rt&&rt.dismiss?this.loader.dismiss(Wn,this._t.pnx.error_api):console.error(Wn)}}onceReady(){throw new Error("You must override this method on sub-class")}onceAPIReady(){return this.api?this.api.onceReady():new Promise((Qe=>setTimeout(Qe,100))).then(this.onceAPIReady.bind(this))}createRenderRoot(){return this}attributeChangedCallback(Qe,rt,Wn){if(super.attributeChangedCallback(Qe,rt,Wn),"endpoint"===Qe&&(this._loadsAPI&&Wn&&this._loadsAPI===Wn||this.api&&this.api._endpoint===Wn||!Wn||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())),["picture","sequence"].includes(Qe)){let Co,Dl,Ll,Rl;"picture"===Qe?(Co=this.sequence,Ll=this.sequence,Dl=Wn,Rl=rt):(Co=Wn,Ll=rt,Dl=this.picture,Rl=this.picture),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{seqId:Co,picId:Dl,prevSeqId:Ll,prevPicId:Rl}}))}}getClassName(){return"Basic"}select(){let Qe=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,rt=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=rt,this.sequence=Qe}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 Co.qy`<p>Should not be used directly, use Viewer/CoverageMap/Editor instead</p>`}getSubComponentsNames(){return["loader","api"]}addEventListener(Qe,rt,Wn){let Co=Qe.split(":").shift();if(Co&&this.getSubComponentsNames().includes(Co)){var Dl;const Ll=Qe.substring(Co.length+1);null!==(Dl=this[Co])&&void 0!==Dl&&Dl.addEventListener?this[Co].addEventListener(Ll,rt,Wn):setTimeout((()=>this.addEventListener(Qe,rt,Wn)),50)}else super.addEventListener(Qe,rt,Wn)}static GetJSONConverter(){return{fromAttribute:Qe=>"object"===typeof Qe?Qe:Hl().parse(Qe),toAttribute:Qe=>JSON.stringify(Qe)}}}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:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>CoverageMap});var Co=Wn(9039),Dl=Wn(5642),Ll=Wn(8340),Rl=Wn(927),Ul=(Wn(7776),Wn(2118));class CoverageMap extends Co.A{constructor(){super(),this._mapContainer=document.createElement("div"),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this._initParams=new Ul.Ay(Ul.Ay.GetComponentProperties(CoverageMap,this)),this._initMap()}))}getClassName(){return"CoverageMap"}onceReady(){return this.map&&this.map.waitForEnoughMapLoaded?this.map.waitForEnoughMapLoaded():new Promise((Qe=>setTimeout(Qe,100))).then(this.onceReady.bind(this))}render(){return[this.loader,this._mapContainer]}getSubComponentsNames(){const Qe=super.getSubComponentsNames();return Qe.push("map"),Qe}_initMap(){class MyMap extends Dl.A{_getLayerStyleProperties(Qe){return"pictures_symbols"===Qe?{layout:{visibility:"none"}}:super._getLayerStyleProperties(Qe)}}this.map=new MyMap(this,this._mapContainer,Object.assign({},this._initParams.getMapInit(),{hash:!0})),this.map.addControl(new Rl.NavigationControl({showCompass:!1})),this.loader.setAttribute("value",70),this.addEventListener("select",this._onSelect.bind(this)),this.map.on("picture-click",(Qe=>this.select(Qe.seqId,Qe.picId))),this.map.on("sequence-click",(Qe=>this.select(Qe.seqId))),this.map.waitForEnoughMapLoaded().then((async()=>{await(0,Ul.mK)(this.map,this._initParams.getMapPostInit()),this.map.reloadLayersStyles(),this.loader.dismiss()}))}_onSelect(Qe){if(Qe.detail.picId||Qe.detail.seqId){const rt=Qe.detail.picId?"pictures":"sequences",Wn=this.map.queryRenderedFeatures({layers:[...this.map._userLayers].map((Qe=>(0,Ll.getUserLayerId)(Qe,rt))),filter:["==",["get","id"],Qe.detail.picId||Qe.detail.seqId]});Wn.length>=0&&null!=Wn[0]&&this.map._attachPreviewToPictures({features:Wn},rt)}}}CoverageMap.properties={map:{converter:Co.A.GetJSONConverter()},...Co.A.properties},customElements.define("pnx-coverage-map",CoverageMap)},1752:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>Editor});Wn(7365);var Co=Wn(9039),Dl=Wn(5642),Ll=Wn(9048),Rl=(Wn(7534),Wn(6810),Wn(508)),Ul=Wn(8340),Gl=Wn(1545),Zl=(Wn(4542),Wn(5995));const Hl="sequence-headings";class Editor extends Co.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()}))}getClassName(){return"Editor"}onceReady(){var Qe,rt;return this.map&&this.psv&&null!==(Qe=(rt=this.map).loaded)&&void 0!==Qe&&Qe.call(rt)?Promise.resolve():new Promise((Qe=>setTimeout(Qe,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(Qe,rt,Wn){"users"===Qe&&Array.isArray(Wn)&&Wn.length>0?console.warn("Parameters users can't be changed in Editor, only selected sequence can be visible"):super.attributeChangedCallback(Qe,rt,Wn)}render(){return[this.loader,this._psvContainer,this._mapContainer]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["map","psv"])}_initPSV(){try{this.psv=new Ll.Ay(this,this._psvContainer),this.psv._myVTour.datasource.nodeResolver=this._getNode.bind(this)}catch(Qe){let rt=Gl.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(Qe,rt)}}_initMap(){try{this.map=new Dl.A(this,this._mapContainer,{raster:this.raster,background:this.background,supplementaryStyle:this._createMapStyle(),zoom:15}),(0,Ul.linkMapAndPhoto)(this),this.loader.setAttribute("value",50),this._loadSequence(),this.map.once("load",(()=>{this.map.hasTwoBackgrounds()&&this._addMapBackgroundWidget(),this._bindPicturesEvents()}));const Qe=this.map._picMarker.setRotation.bind(this.map._picMarker);this.map._picMarker.setRotation=rt=>(rt=void 0===this._lastRelHeading?rt:rt+this._lastRelHeading-this.psv.getPictureRelativeHeading(),Qe(rt))}catch(Qe){this.loader.dismiss(Qe,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:{...Ul.VECTOR_STYLES.SEQUENCES.layout},paint:{...Ul.VECTOR_STYLES.SEQUENCES.paint}},{id:"geovisio_editor_pictures",type:"circle",source:"geovisio_editor_sequences",layout:{...Ul.VECTOR_STYLES.PICTURES.layout},paint:{...Ul.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((Qe=>{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=Qe.features,this.map.getSource("geovisio_editor_sequences").setData({type:"FeatureCollection",features:[{type:"Feature",properties:{id:this.sequence},geometry:{type:"LineString",coordinates:Qe.features.map((Qe=>Qe.geometry.coordinates))}},...Qe.features.map((Qe=>(Qe.properties.id=Qe.id,Qe.properties.sequences=[this.sequence],Qe)))]}),this.picture){const rt=Qe.features.find((Qe=>Qe.id===this.picture));rt?(this.select(this.sequence,this.picture,!0),this.map.jumpTo({center:rt.geometry.coordinates,zoom:18})):console.log("Picture with ID",rt,"was not found")}else{const rt=[...Qe.features[0].geometry.coordinates,...Qe.features[0].geometry.coordinates];for(let Wn=1;Wn<Qe.features.length;Wn++){const Co=Qe.features[Wn].geometry.coordinates;Co[0]<rt[0]&&(rt[0]=Co[0]),Co[1]<rt[1]&&(rt[1]=Co[1]),Co[0]>rt[2]&&(rt[2]=Co[0]),Co[1]>rt[3]&&(rt[3]=Co[1])}this.map.fitBounds(rt,{animate:!1})}})).catch((Qe=>this.loader.dismiss(Qe,this._t.pnx.error_api)))}_getNode(Qe){const rt=this._sequenceData.find((rt=>rt.properties.id===Qe)),Wn=rt?(0,Rl.apiFeatureToPSVNode)(rt,this._t,this._isInternetFast):null;return Wn&&delete Wn.links,Wn}_addMapBackgroundWidget(){const Qe=(0,Zl.createWebComp)("pnx-map-background",{_parent:this,size:"sm"});this._mapContainer.appendChild(Qe)}previewSequenceHeadingChange(Qe){const rt=void 0!==this.map.getLayer(Hl);if(this.map._picMarkerPreview.remove(),void 0===Qe)return delete this._lastRelHeading,rt&&this.map.setLayoutProperty(Hl,"visibility","none"),void(this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x));this._lastRelHeading=Qe,rt||this.map.addLayer({id:Hl,type:"symbol",source:"geovisio_editor_sequences",layout:{"icon-image":"pnx-marker","icon-overlap":"always","icon-size":.8}});const Wn=-this.psv.getPictureRelativeHeading();this.map.setLayoutProperty(Hl,"visibility","visible"),this.map.setLayoutProperty(Hl,"icon-rotate",["+",["get","view:azimuth"],Wn,Qe]);const Co=[["==",["geometry-type"],"Point"]];this.picture&&Co.push(["!=",["get","id"],this.picture]),this.map.setFilter(Hl,["all",...Co]),this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x)}_onSelect(){void 0!==this._lastRelHeading&&this.previewSequenceHeadingChange(this._lastRelHeading)}}Editor.properties={raster:{converter:Co.A.GetJSONConverter()},background:{type:String},...Co.A.properties},customElements.define("pnx-editor",Editor)},3407:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>PhotoViewer});Wn(970);var Co=Wn(1545),Dl=Wn(4451),Ll=Wn(9039),Rl=Wn(9048),Ul=Wn(5995),Gl=Wn(7343),Zl=Wn(2118),Hl=Wn(4207);const ql=Math.PI/6;class PhotoViewer extends Ll.A{constructor(){super(),this.psv={},this["url-parameters"]=this.getAttribute("url-parameters")||!0,this.widgets=this.getAttribute("widgets")||"true",this.grid=(0,Ul.createWebComp)("pnx-cornered-grid"),this.psvContainer=document.createElement("div"),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.popup=(0,Ul.createWebComp)("pnx-popup",{_parent:this,onclose:this._onPopupClose.bind(this)})}_createInitParamsHandler(){var Qe,rt;this._initParams=new Zl.Ay(Zl.Ay.GetComponentProperties(PhotoViewer,this),Object.assign({},null===(Qe=this.urlHandler)||void 0===Qe?void 0:Qe.currentURLParams(),null===(rt=this.urlHandler)||void 0===rt?void 0:rt.currentURLParams(!0)),{})}_initWidgets(){"false"!==this._initParams.getParentPostInit().widgets&&(this.grid.appendChild((0,Ul.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,Ul.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,Ul.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",(Qe=>{(0,Gl.isNullId)(Qe.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,Ul.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,Ul.createWebComp)("pnx-widget-zoom",{slot:"bottom-right",class:"pnx-print-hidden",_parent:this})),this.grid.appendChild(this.legend),this.grid.appendChild((0,Ul.createWebComp)("pnx-hashtags",{slot:"top-right",_parent:this,class:"pnx-only-psv pnx-print-hidden"}))))}connectedCallback(){super.connectedCallback(),this.presetsManager=new Hl.A(this.lang),this["url-parameters"]&&"false"!==this["url-parameters"]&&(this.urlHandler=new Dl.A(this),this.onceReady().then((()=>{this.urlHandler.listenToChanges(),this.urlHandler._onParentChange()}))),this.onceAPIReady().then(this._postAPIInit.bind(this))}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 Qe;return new Promise((rt=>{Qe=setInterval((()=>{this.psv&&"object"===typeof this.psv&&(this.psv.container?(clearInterval(Qe),rt()):this.psv.addEventListener&&this.psv.addEventListener("ready",(()=>{clearInterval(Qe),rt()}),{once:!0}))}),250)}))}onceFirstPicLoaded(){return this.oncePSVReady().then((()=>this.psv.getPictureMetadata()?Promise.resolve():new Promise((Qe=>{this.psv.addEventListener("picture-loaded",Qe,{once:!0})}))))}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const Qe=this._initParams.getParentPostInit();this._initPSV(),this._initWidgets(),(0,Zl.ai)(this,Qe),this._handleKeyboardManagement(),Qe.picture?this.psv.addEventListener("picture-loaded",(()=>this.loader.dismiss()),{once:!0}):this.loader.dismiss()}_initPSV(){try{this.psv=new Rl.Ay(this,this.psvContainer,{shouldGoFast:this._psvShouldGoFast.bind(this),keyboard:"always",keyboardActions:{...Co.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,Zl.Vy)(this.psv,this._initParams.getPSVPostInit())}))}catch(Qe){let rt=Co.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(Qe,rt)}}_handleKeyboardManagement(){const keytonone=()=>this.psv.stopKeyboardControl(),keytopsv=()=>this.psv.startKeyboardControl();this.popup.addEventListener("open",(()=>keytonone())),this.popup.addEventListener("close",(()=>keytopsv()));for(let Qe of this.grid.childNodes)"bg"!==Qe.getAttribute("slot")&&(Qe.addEventListener("focusin",(()=>keytonone())),Qe.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&keytopsv()})))}_psvShouldGoFast(){return this.psv._sequencePlaying&&this.psv.getTransitionDuration()<1e3}_moveChildToGrid(){Array.from(this.querySelectorAll("[slot]")).forEach((Qe=>{var rt;null!==(rt=Qe.tagName)&&void 0!==rt&&rt.toLowerCase().startsWith("pnx-")&&(Qe._parent=this,Qe._t=this._t),"editors"===Qe.getAttribute("slot")?this.onceReady().then((()=>{var rt;return null===(rt=this.legend)||void 0===rt?void 0:rt.appendChild(Qe)})):this.grid.appendChild(Qe)}))}setPopup(Qe){let rt=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Qe?this.popup.setAttribute("visible",""):this.popup.removeAttribute("visible"),this.popup.innerHTML="","string"===typeof rt?this.popup.innerHTML=rt:Array.isArray(rt)&&rt.forEach((Qe=>this.popup.appendChild(Qe)))}_onPopupClose(){this.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:this.map&&this.isMapWide()?"map":"pic"}}))}_showQualityScoreDoc(){this.setPopup(!0,[(0,Ul.createWebComp)("pnx-quality-score-doc",{_t:this._t})])}_showReportForm(){if(!this.psv.getPictureMetadata())throw new Error("No picture currently selected");this.setPopup(!0,[(0,Ul.createWebComp)("pnx-report-form",{_parent:this})])}_showShareOptions(){this.setPopup(!0,[(0,Ul.createWebComp)("pnx-share-menu",{_parent:this})])}moveCenter(){this.psv.getPictureMetadata()&&this._psvAnimate({speed:Rl.LM,yaw:0,pitch:0,zoom:Rl.cS})}moveLeft(){this._moveToDirection("left")}moveRight(){this._moveToDirection("right")}moveUp(){this._moveToDirection("up")}moveDown(){this._moveToDirection("down")}_moveToDirection(Qe){let rt=this.psv.getPosition();switch(Qe){case"up":rt.pitch+=ql;break;case"left":rt.yaw-=ql;break;case"down":rt.pitch-=ql;break;case"right":rt.yaw+=ql}this._psvAnimate({speed:Rl.LM,...rt})}_psvAnimate(Qe){this._lastPsvAnim&&this._lastPsvAnim.cancel(),this._lastPsvAnim=this.psv.animate(Qe)}addEventListener(Qe,rt,Wn){super.addEventListener(Qe,rt,Wn)}}PhotoViewer.properties={psv:{converter:Ll.A.GetJSONConverter()},widgets:{type:String},"url-parameters":{type:String},...Ll.A.properties},customElements.define("pnx-photo-viewer",PhotoViewer)},8743:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{$:()=>Ql,A:()=>Viewer});Wn(9616);var Co=Wn(8340),Dl=Wn(3407),Ll=(Wn(9039),Wn(2771)),Rl=Wn(7343),Ul=Wn(5995),Gl=Wn(9683),Zl=Wn(2e3),Hl=Wn(9438),ql=Wn(2118);const Ql=20,Kl=(Math.PI,100);class Viewer extends Dl.A{constructor(){super(),this.map=!0,this.geocoder=this.getAttribute("geocoder")||"nominatim",this.mini=(0,Ul.createWebComp)("pnx-mini",{slot:"bottom-left",_parent:this,onexpand:this._onMiniExpand.bind(this),collapsed:!!(0,Rl.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 Qe,rt;this._initParams=new ql.Ay(ql.Ay.GetComponentProperties(Viewer,this),Object.assign({},null===(Qe=this.urlHandler)||void 0===Qe?void 0:Qe.currentURLParams(),null===(rt=this.urlHandler)||void 0===rt?void 0:rt.currentURLParams(!0)),{map:(0,Co.getMapParamsFromLocalStorage)()})}_initWidgets(){var Qe,rt;"false"!==this._initParams.getParentPostInit().widgets&&(this.grid.appendChild((0,Ul.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,Ul.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,Ul.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",(Qe=>{(0,Rl.isNullId)(Qe.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,Ul.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,Ul.createWebComp)("pnx-hashtags",{slot:"top-right",_parent:this,class:"pnx-only-psv pnx-print-hidden"}))),this.grid.appendChild((0,Ul.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,Ul.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,Ul.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===(Qe=this.map)||void 0===Qe||null===(rt=Qe._hasQualityScore)||void 0===rt?void 0:rt.call(Qe))||!1,class:"pnx-only-map pnx-print-hidden"})),this.grid.appendChild((0,Ul.createWebComp)("pnx-widget-maplayers",{slot:"top-right",_parent:this,class:"pnx-only-map pnx-print-hidden"})))}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(Qe,rt,Wn){var Co,Dl,Ll,Ul;(super.attributeChangedCallback(Qe,rt,Wn),"picture"===Qe)&&(null===(Co=this.legend)||void 0===Co||null===(Dl=Co.setAttribute)||void 0===Dl||Dl.call(Co,"picture",Wn),(0,Rl.isNullId)(rt)&&!(0,Rl.isNullId)(Wn)&&this.mini.removeAttribute("collapsed"),(0,Rl.isNullId)(Wn)?this.map&&this.isMapWide()?this.mini.classList.add("pnx-hidden"):this.map&&!this.isMapWide()&&this._setFocus("map"):(this.mini.classList.remove("pnx-hidden"),(0,Rl.isNullId)(rt)&&(this._setFocus("pic"),"closed"===(null===(Ll=this.bottomDrawer)||void 0===Ll||null===(Ul=Ll.getAttribute)||void 0===Ul?void 0:Ul.call(Ll,"openness"))&&this.bottomDrawer.setAttribute("openness","half-opened"))));"focus"===Qe&&this._setFocus(Wn)}onceMapReady(){if(!this.map)return Promise.resolve();let Qe;return new Promise((rt=>{Qe=setInterval((()=>{var Wn,Co,Dl;"object"===typeof this.map&&(null!==(Wn=this.map)&&void 0!==Wn&&null!==(Co=Wn.loaded)&&void 0!==Co&&Co.call(Wn)?(clearInterval(Qe),rt()):null!==(Dl=this.map)&&void 0!==Dl&&Dl.once&&this.map.once("render",(()=>{clearInterval(Qe),rt()})))}),250)}))}async _initMap(){await new Promise((Qe=>{this.map=new Ll.A(this,this.mapContainer,this._initParams.getMapInit()),(0,Co.saveMapParamsToLocalStorage)(this.map),this.map.once("users-changed",(()=>{this.loader.setAttribute("value",75),Qe()}))})),await(0,ql.mK)(this.map,this._initParams.getMapPostInit()),(0,Co.initMapKeyboardHandler)(this),(0,Co.linkMapAndPhoto)(this)}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const Qe=this._initParams.getParentPostInit();this._initPSV(),await this._initMap(),this._initWidgets(),this._moveChildToGrid(),(0,ql.iz)(this,Qe),this._handleKeyboardManagement(),Qe.picture?this.psv.addEventListener("picture-loaded",(()=>{(0,ql.iz)(this,Qe),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",(Qe=>{"map"===Qe.detail.focus&&keytomap(),this.popup.getAttribute("visible")?keytonone():keytopsv()})),this.popup.addEventListener("open",(()=>keytonone())),this.popup.addEventListener("close",(()=>keytofocused()));for(let Qe of this.grid.childNodes)"bg"!==Qe.getAttribute("slot")&&(Qe.addEventListener("focusin",(()=>keytonone())),Qe.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&keytofocused()})))}moveCenter(){const Qe=this.psv.getPictureMetadata();Qe&&(this.map&&this.isMapWide()?this.map.flyTo({center:Qe.gps,zoom:20}):super.moveCenter())}_moveToDirection(Qe){if(this.map&&this.isMapWide()){let rt;switch(Qe){case"up":rt=[0,-100];break;case"left":rt=[-100,0];break;case"down":rt=[0,Kl];break;case"right":rt=[Kl,0]}this.map.panBy(rt)}else super._moveToDirection(Qe)}isMapWide(){return this.mapContainer.parentNode==this.grid}_setFocus(Qe){var rt,Wn,Co,Dl;let Ll=arguments.length>1&&void 0!==arguments[1]&&arguments[1],Hl=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("map"===Qe&&!this.map)throw new Error("Map is not enabled");if(!["map","pic"].includes(Qe))throw new Error("Invalid focus value (should be pic or map)");if(this.focus=Qe,(Hl||("map"!==Qe||!this.map||!this.isMapWide())&&("pic"!==Qe||this.map&&this.isMapWide()))&&("map"===Qe?(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,Ul.fa)(Gl.pt),(0,Rl.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,Ul.fa)(Zl.e5),this.psvContainer.focus()),null===this||void 0===this||null===(rt=this.map)||void 0===rt||null===(Wn=rt.resize)||void 0===Wn||Wn.call(rt),this.psv.autoSize(),this.psv.forceRefresh(),null===(Co=this.legend)||void 0===Co||null===(Dl=Co.setAttribute)||void 0===Dl||Dl.call(Co,"focus",this.focus),!Ll)){const rt=new CustomEvent("focus-changed",{detail:{focus:Qe}});this.dispatchEvent(rt)}}_toggleFocus(){this._setFocus(this.isMapWide()?"pic":"map")}_onMiniExpand(){this.map.resize(),this.psv.autoSize()}_onMapFiltersChange(){var Qe;const rt=(0,Hl.qi)("#pnx-map-filters-menu"),Wn=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-date-from"),Co=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-date-end"),Dl=null===rt||void 0===rt?void 0:rt.shadowRoot.querySelectorAll("input[name='pnx-filter-type']"),Ll=(0,Hl.qi)("#pnx-map-theme");let Rl="";for(let Zl=0;Zl<Dl.length;Zl++){const Qe=Dl[Zl];if(Qe.checked){Rl=Qe.value;break}}let Ul=[];if(null!==(Qe=this.map)&&void 0!==Qe&&Qe._hasQualityScore()){const Qe=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-qualityscore");Ul=((null===Qe||void 0===Qe?void 0:Qe.grade)||"").split(",").map((Qe=>parseInt(Qe))).filter((Qe=>!isNaN(Qe))),5==Ul.length&&(Ul=[])}const Gl={minDate:null===Wn||void 0===Wn?void 0:Wn.value,maxDate:null===Co||void 0===Co?void 0:Co.value,pic_type:Rl,theme:null===Ll||void 0===Ll?void 0:Ll.value,qualityscore:Ul};this.map.setFilters(Gl)}}Viewer.properties={map:{converter:Dl.A.GetJSONConverter()},focus:{type:String,reflect:!0},geocoder:{type:String},...Dl.A.properties},customElements.define("pnx-viewer",Viewer)},3921:(Qe,rt,Wn)=>{"use strict";Wn.r(rt),Wn.d(rt,{Basic:()=>Co.A,CoverageMap:()=>Dl.A,Editor:()=>Ll.A,PhotoViewer:()=>Ul.A,Viewer:()=>Rl.A});var Co=Wn(9039),Dl=Wn(153),Ll=Wn(1752),Rl=Wn(8743),Ul=Wn(3407)},9341:(Qe,rt,Wn)=>{"use strict";Wn.r(rt),Wn.d(rt,{core:()=>Co,layout:()=>Dl,menus:()=>Ll,ui:()=>Rl});var Co=Wn(3921),Dl=Wn(456),Ll=Wn(8794),Rl=Wn(9472)},6784:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>BottomDrawer});var Co=Wn(4542),Dl=Wn(1198);const Ll={opened:0,"half-opened":.7,closed:1};class BottomDrawer extends Co.WF{constructor(){super(),this._isDragging=!1,this.openness="half-opened"}firstUpdated(){var Qe;super.firstUpdated(),this._boundTouchMove=this._onTouchMove.bind(this),this._boundTouchEnd=this._onTouchEnd.bind(this),this._drawerHeight=window.innerHeight-30;const rt=this._getDrawer();rt&&(rt.style.height=`${this._drawerHeight}px`,rt.style.maxHeight=`${this._drawerHeight}px`,null===(Qe=this._parent)||void 0===Qe||Qe.onceReady().then((()=>{var Qe,rt;null===(Qe=this._parent.map)||void 0===Qe||Qe.addEventListener("click",(()=>this.openness="closed")),null===(rt=this._parent.psv)||void 0===rt||rt.addEventListener("click",(()=>this.openness="closed"))})))}attributeChangedCallback(Qe,rt,Wn){if(super.attributeChangedCallback(Qe,rt,Wn),"openness"===Qe){if("opened"!==Wn){const Qe=this.shadowRoot.querySelector(".content");Qe&&(Qe.scrollTop=0)}const Qe=this._getDrawer();Qe&&(Qe.style.transform=null)}}disconnectedCallback(){super.disconnectedCallback(),this._cleanupTouchListeners()}_getDrawer(){var Qe;return null===(Qe=this.shadowRoot)||void 0===Qe?void 0:Qe.querySelector(".drawer")}_onHandleClick(){"opened"===this.openness?this.openness="closed":"half-opened"===this.openness?this.openness="opened":"closed"===this.openness&&(this.openness="half-opened")}_onTouchStart(Qe){this._isDragging=!0,this._startFingerY=Qe.touches[0].clientY,this._deltaFingerY=0,this._drawerY=this._drawerHeight*Ll[this.openness],window.addEventListener("touchmove",this._boundTouchMove,{passive:!0}),window.addEventListener("touchend",this._boundTouchEnd),window.addEventListener("touchcancel",this._boundTouchEnd)}_onTouchMove(Qe){if(!this._isDragging)return;const rt=this.shadowRoot.querySelector(".content");rt.scrollHeight>rt.offsetHeight&&rt.scrollTop>0?this._updateDrawerTransform(0):(this._deltaFingerY=Qe.touches[0].clientY-this._startFingerY,this._updateDrawerTransform(this._drawerY+this._deltaFingerY))}_onTouchEnd(Qe){(this._isDragging&&!(Math.abs(this._deltaFingerY)<30)||Qe.target.closest(".handle"))&&(Qe.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(Qe){let rt=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const Wn=this._getDrawer();Wn&&(Qe=Math.max(0,Math.min(Qe,this._drawerHeight-30)),rt&&(this._deltaFingerY<0?"closed"===this.openness?Math.abs(this._deltaFingerY)>this._drawerHeight*(1-Ll["half-opened"])?this.openness="opened":this.openness="half-opened":this.openness="opened":this.openness="closed",this._drawerY=null,Qe=Math.max(0,Math.min(Ll[this.openness]*this._drawerHeight,this._drawerHeight-30))),Wn.style.transform=`translateY(${Qe}px)`)}render(){const Qe={drawer:!0,[this.openness]:!0,dragging:this._isDragging};return Co.qy`
12
+ !function(Qe,rt){"object"===typeof exports&&"object"===typeof module?module.exports=rt():"function"===typeof define&&define.amd?define("Panoramax",[],rt):"object"===typeof exports?exports.Panoramax=rt():Qe.Panoramax=rt()}(this,(()=>(()=>{var Qe={9039:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>Basic});var Co=Wn(4542),Dl=Wn(5254),Ll=Wn(4964),Rl=Wn(8340),Ul=Wn(5995),Gl=Wn(7343),Zl=Wn(2614),Hl=Wn.n(Zl),ql=Wn(8330);Wn(1865),Wn(3638);class Basic extends Co.WF{constructor(){let Qe=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.users=["geovisio"],this.mapstyle=this.getAttribute("mapstyle")||Rl.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 ${ql.rE} (e49e727)\n\n\ud83c\udd98 Issues can be reported at ${ql.Jk.O}`),Qe||(this._isInternetFast=null,(0,Gl.isInternetFast)().then((Qe=>this._isInternetFast=Qe)))}connectedCallback(){super.connectedCallback(),this._t=(0,Ll.getTranslations)(this.lang),this.loader=(0,Ul.createWebComp)("pnx-loader",{_parent:this,"no-label":(0,Gl.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,Ul.createWebComp)("pnx-loader",{_parent:this}),!this.endpoint)return void console.warn("No endpoint is defined");this._loadsAPI=this.endpoint;let Qe=this.endpoint;try{this.mapstyle=JSON.parse(this.mapstyle)}catch(Wn){}try{this.api=new Dl.A(this.endpoint,{users:this.users,fetch:this.fetchOptions,style:this.mapstyle}),this.api.onceReady().then((()=>{if(Qe!=this._loadsAPI||!this.api)return;let rt=this.api.getUnavailableFeatures(),Wn=this.api.getAvailableFeatures();Wn=0===rt.length?"\u2705 All features available":"\u2705 Available features: "+Wn.join(", "),rt=0===rt.length?"":"\ud83d\udeab Unavailable features: "+rt.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 ${Wn}\n ${rt}\n`.trim())})).catch((Qe=>this.loader.dismiss(Qe,this._t.pnx.error_api))).finally((()=>delete this._loadsAPI))}catch(Wn){var rt;delete this._loadsAPI,null!==(rt=this.loader)&&void 0!==rt&&rt.dismiss?this.loader.dismiss(Wn,this._t.pnx.error_api):console.error(Wn)}}onceReady(){throw new Error("You must override this method on sub-class")}onceAPIReady(){return this.api?this.api.onceReady():new Promise((Qe=>setTimeout(Qe,100))).then(this.onceAPIReady.bind(this))}createRenderRoot(){return this}attributeChangedCallback(Qe,rt,Wn){if(super.attributeChangedCallback(Qe,rt,Wn),"endpoint"===Qe&&(this._loadsAPI&&Wn&&this._loadsAPI===Wn||this.api&&this.api._endpoint===Wn||!Wn||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())),["picture","sequence"].includes(Qe)){let Co,Dl,Ll,Rl;"picture"===Qe?(Co=this.sequence,Ll=this.sequence,Dl=Wn,Rl=rt):(Co=Wn,Ll=rt,Dl=this.picture,Rl=this.picture),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{seqId:Co,picId:Dl,prevSeqId:Ll,prevPicId:Rl}}))}}getClassName(){return"Basic"}select(){let Qe=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,rt=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=rt,this.sequence=Qe}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 Co.qy`<p>Should not be used directly, use Viewer/CoverageMap/Editor instead</p>`}getSubComponentsNames(){return["loader","api"]}addEventListener(Qe,rt,Wn){let Co=Qe.split(":").shift();if(Co&&this.getSubComponentsNames().includes(Co)){var Dl;const Ll=Qe.substring(Co.length+1);null!==(Dl=this[Co])&&void 0!==Dl&&Dl.addEventListener?this[Co].addEventListener(Ll,rt,Wn):setTimeout((()=>this.addEventListener(Qe,rt,Wn)),50)}else super.addEventListener(Qe,rt,Wn)}static GetJSONConverter(){return{fromAttribute:Qe=>"object"===typeof Qe?Qe:Hl().parse(Qe),toAttribute:Qe=>JSON.stringify(Qe)}}}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:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>CoverageMap});var Co=Wn(9039),Dl=Wn(5642),Ll=Wn(8340),Rl=Wn(927),Ul=(Wn(7776),Wn(2118));class CoverageMap extends Co.A{constructor(){super(),this._mapContainer=document.createElement("div"),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this._initParams=new Ul.Ay(Ul.Ay.GetComponentProperties(CoverageMap,this)),this._initMap()}))}getClassName(){return"CoverageMap"}onceReady(){return this.map&&this.map.waitForEnoughMapLoaded?this.map.waitForEnoughMapLoaded():new Promise((Qe=>setTimeout(Qe,100))).then(this.onceReady.bind(this))}render(){return[this.loader,this._mapContainer]}getSubComponentsNames(){const Qe=super.getSubComponentsNames();return Qe.push("map"),Qe}_initMap(){class MyMap extends Dl.A{_getLayerStyleProperties(Qe){return"pictures_symbols"===Qe?{layout:{visibility:"none"}}:super._getLayerStyleProperties(Qe)}}this.map=new MyMap(this,this._mapContainer,Object.assign({},this._initParams.getMapInit(),{hash:!0})),this.map.addControl(new Rl.NavigationControl({showCompass:!1})),this.loader.setAttribute("value",70),this.addEventListener("select",this._onSelect.bind(this)),this.map.on("picture-click",(Qe=>this.select(Qe.seqId,Qe.picId))),this.map.on("sequence-click",(Qe=>this.select(Qe.seqId))),this.map.waitForEnoughMapLoaded().then((async()=>{await(0,Ul.mK)(this.map,this._initParams.getMapPostInit()),this.map.reloadLayersStyles(),this.loader.dismiss()}))}_onSelect(Qe){if(Qe.detail.picId||Qe.detail.seqId){const rt=Qe.detail.picId?"pictures":"sequences",Wn=this.map.queryRenderedFeatures({layers:[...this.map._userLayers].map((Qe=>(0,Ll.getUserLayerId)(Qe,rt))),filter:["==",["get","id"],Qe.detail.picId||Qe.detail.seqId]});Wn.length>=0&&null!=Wn[0]&&this.map._attachPreviewToPictures({features:Wn},rt)}}}CoverageMap.properties={map:{converter:Co.A.GetJSONConverter()},...Co.A.properties},customElements.define("pnx-coverage-map",CoverageMap)},1752:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>Editor});Wn(7365);var Co=Wn(9039),Dl=Wn(5642),Ll=Wn(9048),Rl=(Wn(7534),Wn(6810),Wn(508)),Ul=Wn(8340),Gl=Wn(1545),Zl=(Wn(4542),Wn(5995));const Hl="sequence-headings";class Editor extends Co.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()}))}getClassName(){return"Editor"}onceReady(){var Qe,rt;return this.map&&this.psv&&null!==(Qe=(rt=this.map).loaded)&&void 0!==Qe&&Qe.call(rt)?Promise.resolve():new Promise((Qe=>setTimeout(Qe,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(Qe,rt,Wn){"users"===Qe&&Array.isArray(Wn)&&Wn.length>0?console.warn("Parameters users can't be changed in Editor, only selected sequence can be visible"):super.attributeChangedCallback(Qe,rt,Wn)}render(){return[this.loader,this._psvContainer,this._mapContainer]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["map","psv"])}_initPSV(){try{this.psv=new Ll.Ay(this,this._psvContainer),this.psv._myVTour.datasource.nodeResolver=this._getNode.bind(this)}catch(Qe){let rt=Gl.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(Qe,rt)}}_initMap(){try{this.map=new Dl.A(this,this._mapContainer,{raster:this.raster,background:this.background,supplementaryStyle:this._createMapStyle(),zoom:15}),(0,Ul.linkMapAndPhoto)(this),this.loader.setAttribute("value",50),this._loadSequence(),this.map.once("load",(()=>{this.map.hasTwoBackgrounds()&&this._addMapBackgroundWidget(),this._bindPicturesEvents()}));const Qe=this.map._picMarker.setRotation.bind(this.map._picMarker);this.map._picMarker.setRotation=rt=>(rt=void 0===this._lastRelHeading?rt:rt+this._lastRelHeading-this.psv.getPictureRelativeHeading(),Qe(rt))}catch(Qe){this.loader.dismiss(Qe,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:{...Ul.VECTOR_STYLES.SEQUENCES.layout},paint:{...Ul.VECTOR_STYLES.SEQUENCES.paint}},{id:"geovisio_editor_pictures",type:"circle",source:"geovisio_editor_sequences",layout:{...Ul.VECTOR_STYLES.PICTURES.layout},paint:{...Ul.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((Qe=>{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=Qe.features,this.map.getSource("geovisio_editor_sequences").setData({type:"FeatureCollection",features:[{type:"Feature",properties:{id:this.sequence},geometry:{type:"LineString",coordinates:Qe.features.map((Qe=>Qe.geometry.coordinates))}},...Qe.features.map((Qe=>(Qe.properties.id=Qe.id,Qe.properties.sequences=[this.sequence],Qe)))]}),this.picture){const rt=Qe.features.find((Qe=>Qe.id===this.picture));rt?(this.select(this.sequence,this.picture,!0),this.map.jumpTo({center:rt.geometry.coordinates,zoom:18})):console.log("Picture with ID",rt,"was not found")}else{const rt=[...Qe.features[0].geometry.coordinates,...Qe.features[0].geometry.coordinates];for(let Wn=1;Wn<Qe.features.length;Wn++){const Co=Qe.features[Wn].geometry.coordinates;Co[0]<rt[0]&&(rt[0]=Co[0]),Co[1]<rt[1]&&(rt[1]=Co[1]),Co[0]>rt[2]&&(rt[2]=Co[0]),Co[1]>rt[3]&&(rt[3]=Co[1])}this.map.fitBounds(rt,{animate:!1})}})).catch((Qe=>this.loader.dismiss(Qe,this._t.pnx.error_api)))}_getNode(Qe){const rt=this._sequenceData.find((rt=>rt.properties.id===Qe)),Wn=rt?(0,Rl.apiFeatureToPSVNode)(rt,this._t,this._isInternetFast):null;return Wn&&delete Wn.links,Wn}_addMapBackgroundWidget(){const Qe=(0,Zl.createWebComp)("pnx-map-background",{_parent:this,size:"sm"});this._mapContainer.appendChild(Qe)}previewSequenceHeadingChange(Qe){const rt=void 0!==this.map.getLayer(Hl);if(this.map._picMarkerPreview.remove(),void 0===Qe)return delete this._lastRelHeading,rt&&this.map.setLayoutProperty(Hl,"visibility","none"),void(this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x));this._lastRelHeading=Qe,rt||this.map.addLayer({id:Hl,type:"symbol",source:"geovisio_editor_sequences",layout:{"icon-image":"pnx-marker","icon-overlap":"always","icon-size":.8}});const Wn=-this.psv.getPictureRelativeHeading();this.map.setLayoutProperty(Hl,"visibility","visible"),this.map.setLayoutProperty(Hl,"icon-rotate",["+",["get","view:azimuth"],Wn,Qe]);const Co=[["==",["geometry-type"],"Point"]];this.picture&&Co.push(["!=",["get","id"],this.picture]),this.map.setFilter(Hl,["all",...Co]),this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x)}_onSelect(){void 0!==this._lastRelHeading&&this.previewSequenceHeadingChange(this._lastRelHeading)}}Editor.properties={raster:{converter:Co.A.GetJSONConverter()},background:{type:String},...Co.A.properties},customElements.define("pnx-editor",Editor)},3407:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>PhotoViewer});Wn(970);var Co=Wn(1545),Dl=Wn(4451),Ll=Wn(9039),Rl=Wn(9048),Ul=Wn(5995),Gl=Wn(7343),Zl=Wn(2118),Hl=Wn(4207);const ql=Math.PI/6;class PhotoViewer extends Ll.A{constructor(){super(),this.psv={},this["url-parameters"]=this.getAttribute("url-parameters")||!0,this.widgets=this.getAttribute("widgets")||"true",this.grid=(0,Ul.createWebComp)("pnx-cornered-grid"),this.psvContainer=document.createElement("div"),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.popup=(0,Ul.createWebComp)("pnx-popup",{_parent:this,onclose:this._onPopupClose.bind(this)})}_createInitParamsHandler(){var Qe,rt;this._initParams=new Zl.Ay(Zl.Ay.GetComponentProperties(PhotoViewer,this),Object.assign({},null===(Qe=this.urlHandler)||void 0===Qe?void 0:Qe.currentURLParams(),null===(rt=this.urlHandler)||void 0===rt?void 0:rt.currentURLParams(!0)),{})}_initWidgets(){"false"!==this._initParams.getParentPostInit().widgets&&(this.grid.appendChild((0,Ul.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,Ul.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,Ul.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",(Qe=>{(0,Gl.isNullId)(Qe.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,Ul.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,Ul.createWebComp)("pnx-widget-zoom",{slot:"bottom-right",class:"pnx-print-hidden",_parent:this})),this.grid.appendChild(this.legend),this.grid.appendChild((0,Ul.createWebComp)("pnx-hashtags",{slot:"top-right",_parent:this,class:"pnx-only-psv pnx-print-hidden"}))))}connectedCallback(){super.connectedCallback(),this.presetsManager=new Hl.A(this.lang),this["url-parameters"]&&"false"!==this["url-parameters"]&&(this.urlHandler=new Dl.A(this),this.onceReady().then((()=>{this.urlHandler.listenToChanges(),this.urlHandler._onParentChange()}))),this.onceAPIReady().then(this._postAPIInit.bind(this))}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 Qe;return new Promise((rt=>{Qe=setInterval((()=>{this.psv&&"object"===typeof this.psv&&(this.psv.container?(clearInterval(Qe),rt()):this.psv.addEventListener&&this.psv.addEventListener("ready",(()=>{clearInterval(Qe),rt()}),{once:!0}))}),250)}))}onceFirstPicLoaded(){return this.oncePSVReady().then((()=>this.psv.getPictureMetadata()?Promise.resolve():new Promise((Qe=>{this.psv.addEventListener("picture-loaded",Qe,{once:!0})}))))}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const Qe=this._initParams.getParentPostInit();this._initPSV(),this._initWidgets(),(0,Zl.ai)(this,Qe),this._handleKeyboardManagement(),Qe.picture?this.psv.addEventListener("picture-loaded",(()=>this.loader.dismiss()),{once:!0}):this.loader.dismiss()}_initPSV(){try{this.psv=new Rl.Ay(this,this.psvContainer,{shouldGoFast:this._psvShouldGoFast.bind(this),keyboard:"always",keyboardActions:{...Co.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,Zl.Vy)(this.psv,this._initParams.getPSVPostInit())}))}catch(Qe){let rt=Co.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(Qe,rt)}}_handleKeyboardManagement(){const keytonone=()=>this.psv.stopKeyboardControl(),keytopsv=()=>this.psv.startKeyboardControl();this.popup.addEventListener("open",(()=>keytonone())),this.popup.addEventListener("close",(()=>keytopsv()));for(let Qe of this.grid.childNodes)"bg"!==Qe.getAttribute("slot")&&(Qe.addEventListener("focusin",(()=>keytonone())),Qe.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&keytopsv()})))}_psvShouldGoFast(){return this.psv._sequencePlaying&&this.psv.getTransitionDuration()<1e3}_moveChildToGrid(){Array.from(this.querySelectorAll("[slot]")).forEach((Qe=>{var rt;null!==(rt=Qe.tagName)&&void 0!==rt&&rt.toLowerCase().startsWith("pnx-")&&(Qe._parent=this,Qe._t=this._t),"editors"===Qe.getAttribute("slot")?this.onceReady().then((()=>{var rt;return null===(rt=this.legend)||void 0===rt?void 0:rt.appendChild(Qe)})):this.grid.appendChild(Qe)}))}setPopup(Qe){let rt=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Qe?this.popup.setAttribute("visible",""):this.popup.removeAttribute("visible"),this.popup.innerHTML="","string"===typeof rt?this.popup.innerHTML=rt:Array.isArray(rt)&&rt.forEach((Qe=>this.popup.appendChild(Qe)))}_onPopupClose(){this.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:this.map&&this.isMapWide()?"map":"pic"}}))}_showQualityScoreDoc(){this.setPopup(!0,[(0,Ul.createWebComp)("pnx-quality-score-doc",{_t:this._t})])}_showReportForm(){if(!this.psv.getPictureMetadata())throw new Error("No picture currently selected");this.setPopup(!0,[(0,Ul.createWebComp)("pnx-report-form",{_parent:this})])}_showShareOptions(){this.setPopup(!0,[(0,Ul.createWebComp)("pnx-share-menu",{_parent:this})])}moveCenter(){this.psv.getPictureMetadata()&&this._psvAnimate({speed:Rl.LM,yaw:0,pitch:0,zoom:Rl.cS})}moveLeft(){this._moveToDirection("left")}moveRight(){this._moveToDirection("right")}moveUp(){this._moveToDirection("up")}moveDown(){this._moveToDirection("down")}_moveToDirection(Qe){let rt=this.psv.getPosition();switch(Qe){case"up":rt.pitch+=ql;break;case"left":rt.yaw-=ql;break;case"down":rt.pitch-=ql;break;case"right":rt.yaw+=ql}this._psvAnimate({speed:Rl.LM,...rt})}_psvAnimate(Qe){this._lastPsvAnim&&this._lastPsvAnim.cancel(),this._lastPsvAnim=this.psv.animate(Qe)}addEventListener(Qe,rt,Wn){super.addEventListener(Qe,rt,Wn)}}PhotoViewer.properties={psv:{converter:Ll.A.GetJSONConverter()},widgets:{type:String},"url-parameters":{type:String},...Ll.A.properties},customElements.define("pnx-photo-viewer",PhotoViewer)},8743:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{$:()=>Ql,A:()=>Viewer});Wn(9616);var Co=Wn(8340),Dl=Wn(3407),Ll=(Wn(9039),Wn(2771)),Rl=Wn(7343),Ul=Wn(5995),Gl=Wn(9683),Zl=Wn(2e3),Hl=Wn(9438),ql=Wn(2118);const Ql=20,Kl=(Math.PI,100);class Viewer extends Dl.A{constructor(){super(),this.map=!0,this.geocoder=this.getAttribute("geocoder")||"nominatim",this.mini=(0,Ul.createWebComp)("pnx-mini",{slot:"bottom-left",_parent:this,onexpand:this._onMiniExpand.bind(this),collapsed:!!(0,Rl.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 Qe,rt;this._initParams=new ql.Ay(ql.Ay.GetComponentProperties(Viewer,this),Object.assign({},null===(Qe=this.urlHandler)||void 0===Qe?void 0:Qe.currentURLParams(),null===(rt=this.urlHandler)||void 0===rt?void 0:rt.currentURLParams(!0)),{map:(0,Co.getMapParamsFromLocalStorage)()})}_initWidgets(){var Qe,rt;"false"!==this._initParams.getParentPostInit().widgets&&(this.grid.appendChild((0,Ul.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,Ul.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,Ul.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",(Qe=>{(0,Rl.isNullId)(Qe.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,Ul.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,Ul.createWebComp)("pnx-hashtags",{slot:"top-right",_parent:this,class:"pnx-only-psv pnx-print-hidden"}))),this.grid.appendChild((0,Ul.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,Ul.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,Ul.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===(Qe=this.map)||void 0===Qe||null===(rt=Qe._hasQualityScore)||void 0===rt?void 0:rt.call(Qe))||!1,class:"pnx-only-map pnx-print-hidden"})),this.grid.appendChild((0,Ul.createWebComp)("pnx-widget-maplayers",{slot:"top-right",_parent:this,class:"pnx-only-map pnx-print-hidden"})))}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(Qe,rt,Wn){var Co,Dl,Ll,Ul;(super.attributeChangedCallback(Qe,rt,Wn),"picture"===Qe)&&(null===(Co=this.legend)||void 0===Co||null===(Dl=Co.setAttribute)||void 0===Dl||Dl.call(Co,"picture",Wn),(0,Rl.isNullId)(rt)&&!(0,Rl.isNullId)(Wn)&&this.mini.removeAttribute("collapsed"),(0,Rl.isNullId)(Wn)?this.map&&this.isMapWide()?this.mini.classList.add("pnx-hidden"):this.map&&!this.isMapWide()&&this._setFocus("map"):(this.mini.classList.remove("pnx-hidden"),(0,Rl.isNullId)(rt)&&(this._setFocus("pic"),"closed"===(null===(Ll=this.bottomDrawer)||void 0===Ll||null===(Ul=Ll.getAttribute)||void 0===Ul?void 0:Ul.call(Ll,"openness"))&&this.bottomDrawer.setAttribute("openness","half-opened"))));"focus"===Qe&&this._setFocus(Wn)}onceMapReady(){if(!this.map)return Promise.resolve();let Qe;return new Promise((rt=>{Qe=setInterval((()=>{var Wn,Co,Dl;"object"===typeof this.map&&(null!==(Wn=this.map)&&void 0!==Wn&&null!==(Co=Wn.loaded)&&void 0!==Co&&Co.call(Wn)?(clearInterval(Qe),rt()):null!==(Dl=this.map)&&void 0!==Dl&&Dl.once&&this.map.once("render",(()=>{clearInterval(Qe),rt()})))}),250)}))}async _initMap(){await new Promise((Qe=>{this.map=new Ll.A(this,this.mapContainer,this._initParams.getMapInit()),(0,Co.saveMapParamsToLocalStorage)(this.map),this.map.once("users-changed",(()=>{this.loader.setAttribute("value",75),Qe()}))})),await(0,ql.mK)(this.map,this._initParams.getMapPostInit()),(0,Co.initMapKeyboardHandler)(this),(0,Co.linkMapAndPhoto)(this)}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const Qe=this._initParams.getParentPostInit();this._initPSV(),await this._initMap(),this._initWidgets(),this._moveChildToGrid(),(0,ql.iz)(this,Qe),this._handleKeyboardManagement(),Qe.picture?this.psv.addEventListener("picture-loaded",(()=>{(0,ql.iz)(this,Qe),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",(Qe=>{"map"===Qe.detail.focus&&keytomap(),this.popup.getAttribute("visible")?keytonone():keytopsv()})),this.popup.addEventListener("open",(()=>keytonone())),this.popup.addEventListener("close",(()=>keytofocused()));for(let Qe of this.grid.childNodes)"bg"!==Qe.getAttribute("slot")&&(Qe.addEventListener("focusin",(()=>keytonone())),Qe.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&keytofocused()})))}moveCenter(){const Qe=this.psv.getPictureMetadata();Qe&&(this.map&&this.isMapWide()?this.map.flyTo({center:Qe.gps,zoom:20}):super.moveCenter())}_moveToDirection(Qe){if(this.map&&this.isMapWide()){let rt;switch(Qe){case"up":rt=[0,-100];break;case"left":rt=[-100,0];break;case"down":rt=[0,Kl];break;case"right":rt=[Kl,0]}this.map.panBy(rt)}else super._moveToDirection(Qe)}isMapWide(){return this.mapContainer.parentNode==this.grid}_setFocus(Qe){var rt,Wn,Co,Dl;let Ll=arguments.length>1&&void 0!==arguments[1]&&arguments[1],Hl=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("map"===Qe&&!this.map)throw new Error("Map is not enabled");if(!["map","pic"].includes(Qe))throw new Error("Invalid focus value (should be pic or map)");if(this.focus=Qe,(Hl||("map"!==Qe||!this.map||!this.isMapWide())&&("pic"!==Qe||this.map&&this.isMapWide()))&&("map"===Qe?(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,Ul.fa)(Gl.pt),(0,Rl.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,Ul.fa)(Zl.e5),this.psvContainer.focus()),null===this||void 0===this||null===(rt=this.map)||void 0===rt||null===(Wn=rt.resize)||void 0===Wn||Wn.call(rt),this.psv.autoSize(),this.psv.forceRefresh(),null===(Co=this.legend)||void 0===Co||null===(Dl=Co.setAttribute)||void 0===Dl||Dl.call(Co,"focus",this.focus),!Ll)){const rt=new CustomEvent("focus-changed",{detail:{focus:Qe}});this.dispatchEvent(rt)}}_toggleFocus(){this._setFocus(this.isMapWide()?"pic":"map")}_onMiniExpand(){this.map.resize(),this.psv.autoSize()}_onMapFiltersChange(){var Qe;const rt=(0,Hl.qi)("#pnx-map-filters-menu"),Wn=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-date-from"),Co=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-date-end"),Dl=null===rt||void 0===rt?void 0:rt.shadowRoot.querySelectorAll("input[name='pnx-filter-type']"),Ll=(0,Hl.qi)("#pnx-map-theme");let Rl="";for(let Zl=0;Zl<Dl.length;Zl++){const Qe=Dl[Zl];if(Qe.checked){Rl=Qe.value;break}}let Ul=[];if(null!==(Qe=this.map)&&void 0!==Qe&&Qe._hasQualityScore()){const Qe=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-qualityscore");Ul=((null===Qe||void 0===Qe?void 0:Qe.grade)||"").split(",").map((Qe=>parseInt(Qe))).filter((Qe=>!isNaN(Qe))),5==Ul.length&&(Ul=[])}const Gl={minDate:null===Wn||void 0===Wn?void 0:Wn.value,maxDate:null===Co||void 0===Co?void 0:Co.value,pic_type:Rl,theme:null===Ll||void 0===Ll?void 0:Ll.value,qualityscore:Ul};this.map.setFilters(Gl)}}Viewer.properties={map:{converter:Dl.A.GetJSONConverter()},focus:{type:String,reflect:!0},geocoder:{type:String},...Dl.A.properties},customElements.define("pnx-viewer",Viewer)},3921:(Qe,rt,Wn)=>{"use strict";Wn.r(rt),Wn.d(rt,{Basic:()=>Co.A,CoverageMap:()=>Dl.A,Editor:()=>Ll.A,PhotoViewer:()=>Ul.A,Viewer:()=>Rl.A});var Co=Wn(9039),Dl=Wn(153),Ll=Wn(1752),Rl=Wn(8743),Ul=Wn(3407)},9341:(Qe,rt,Wn)=>{"use strict";Wn.r(rt),Wn.d(rt,{core:()=>Co,layout:()=>Dl,menus:()=>Ll,ui:()=>Rl});var Co=Wn(3921),Dl=Wn(456),Ll=Wn(8794),Rl=Wn(9472)},6784:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>BottomDrawer});var Co=Wn(4542),Dl=Wn(1198);const Ll={opened:0,"half-opened":.7,closed:1};class BottomDrawer extends Co.WF{constructor(){super(),this._isDragging=!1,this.openness="half-opened"}firstUpdated(){var Qe;super.firstUpdated(),this._boundTouchMove=this._onTouchMove.bind(this),this._boundTouchEnd=this._onTouchEnd.bind(this),this._drawerHeight=window.innerHeight-30;const rt=this._getDrawer();rt&&(rt.style.height=`${this._drawerHeight}px`,rt.style.maxHeight=`${this._drawerHeight}px`,null===(Qe=this._parent)||void 0===Qe||Qe.onceReady().then((()=>{var Qe,rt;null===(Qe=this._parent.map)||void 0===Qe||Qe.addEventListener("click",(()=>this.openness="closed")),null===(rt=this._parent.psv)||void 0===rt||rt.addEventListener("click",(()=>this.openness="closed"))})))}attributeChangedCallback(Qe,rt,Wn){if(super.attributeChangedCallback(Qe,rt,Wn),"openness"===Qe){if("opened"!==Wn){const Qe=this.shadowRoot.querySelector(".content");Qe&&(Qe.scrollTop=0)}const Qe=this._getDrawer();Qe&&(Qe.style.transform=null)}}disconnectedCallback(){super.disconnectedCallback(),this._cleanupTouchListeners()}_getDrawer(){var Qe;return null===(Qe=this.shadowRoot)||void 0===Qe?void 0:Qe.querySelector(".drawer")}_onHandleClick(){"opened"===this.openness?this.openness="closed":"half-opened"===this.openness?this.openness="opened":"closed"===this.openness&&(this.openness="half-opened")}_onTouchStart(Qe){this._isDragging=!0,this._startFingerY=Qe.touches[0].clientY,this._deltaFingerY=0,this._drawerY=this._drawerHeight*Ll[this.openness],window.addEventListener("touchmove",this._boundTouchMove,{passive:!0}),window.addEventListener("touchend",this._boundTouchEnd),window.addEventListener("touchcancel",this._boundTouchEnd)}_onTouchMove(Qe){if(!this._isDragging)return;const rt=this.shadowRoot.querySelector(".content");rt.scrollHeight>rt.offsetHeight&&rt.scrollTop>0?this._updateDrawerTransform(0):(this._deltaFingerY=Qe.touches[0].clientY-this._startFingerY,this._updateDrawerTransform(this._drawerY+this._deltaFingerY))}_onTouchEnd(Qe){(this._isDragging&&!(Math.abs(this._deltaFingerY)<30)||Qe.target.closest(".handle"))&&(Qe.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(Qe){let rt=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const Wn=this._getDrawer();Wn&&(Qe=Math.max(0,Math.min(Qe,this._drawerHeight-30)),rt&&(this._deltaFingerY<0?"closed"===this.openness?Math.abs(this._deltaFingerY)>this._drawerHeight*(1-Ll["half-opened"])?this.openness="opened":this.openness="half-opened":this.openness="opened":this.openness="closed",this._drawerY=null,Qe=Math.max(0,Math.min(Ll[this.openness]*this._drawerHeight,this._drawerHeight-30))),Wn.style.transform=`translateY(${Qe}px)`)}render(){const Qe={drawer:!0,[this.openness]:!0,dragging:this._isDragging};return Co.qy`
13
13
  <div
14
14
  class=${(0,Dl.H)(Qe)}
15
15
  @touchstart="${this._onTouchStart}"
@@ -788,12 +788,12 @@
788
788
 
789
789
  /* Editors */
790
790
  #pic-legend-editors { margin: 0 10px; }
791
- `],PictureLegend.properties={_caption:{state:!0},_addr:{state:!0},_expanded:{state:!0},collapsable:{type:Boolean}},customElements.define("pnx-picture-legend",PictureLegend)},6993:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>PictureMetadata});var Co=Wn(4542),Dl=Wn(686),Ll=Wn(5995),Rl=Wn(3520),Ul=Wn(3233),Gl=Wn(99),Zl=Wn(5279),Hl=Wn(4954),ql=Wn(2077),Ql=Wn(5124),Kl=Wn(6668),$l=Wn(2593),Tc=Wn(4336),tu=Wn(6249),lu=Wn(8591),du=Wn(508),fu=Wn(7343);const missing=()=>(0,Ll.fa)(Ql.Ev,{styles:{height:"16px"}});class PictureMetadata extends Co.WF{constructor(){super(),this._semanticsPicShowAll=!1}connectedCallback(){var Qe,rt,Wn,Co;super.connectedCallback(),this._meta=null===(Qe=this._parent)||void 0===Qe||null===(rt=Qe.psv)||void 0===rt?void 0:rt.getPictureMetadata(),null===(Wn=this._parent)||void 0===Wn||null===(Co=Wn.oncePSVReady)||void 0===Co||Co.call(Wn).then((()=>{this._parent.psv.addEventListener("picture-loaded",(()=>{this._meta=this._parent.psv.getPictureMetadata()})),this._parent.psv.addEventListener("annotation-click",(()=>{const Qe=this.shadowRoot.querySelector("pnx-tabs");Qe&&Qe.setAttribute("activeTabIndex",4)}))}))}_onQualityScoreClick(){const Qe=this.shadowRoot.querySelector("pnx-tabs");Qe&&Qe.setAttribute("activeTabIndex",3)}_toTab(Qe,rt){return Dl.qy`
791
+ `],PictureLegend.properties={_caption:{state:!0},_addr:{state:!0},_expanded:{state:!0},collapsable:{type:Boolean}},customElements.define("pnx-picture-legend",PictureLegend)},6993:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>PictureMetadata});var Co=Wn(4542),Dl=Wn(686),Ll=Wn(5995),Rl=Wn(3520),Ul=Wn(3233),Gl=Wn(99),Zl=Wn(5279),Hl=Wn(4954),ql=Wn(2077),Ql=Wn(5124),Kl=Wn(6668),$l=Wn(2593),Tc=Wn(4336),tu=Wn(6249),lu=Wn(8591),du=Wn(508),fu=Wn(7343);const missing=()=>(0,Ll.fa)(Ql.Ev,{styles:{height:"16px"}});class PictureMetadata extends Co.WF{constructor(){super(),this._semanticsPicShowAll=!1}connectedCallback(){var Qe,rt,Wn,Co;super.connectedCallback(),this._meta=null===(Qe=this._parent)||void 0===Qe||null===(rt=Qe.psv)||void 0===rt?void 0:rt.getPictureMetadata(),null===(Wn=this._parent)||void 0===Wn||null===(Co=Wn.oncePSVReady)||void 0===Co||Co.call(Wn).then((()=>{this._parent.psv.addEventListener("picture-loaded",(()=>{this._meta=this._parent.psv.getPictureMetadata()})),this._parent.psv.addEventListener("annotation-click",(()=>{const Qe=this.shadowRoot.querySelector("pnx-tabs");Qe&&Qe.setAttribute("activeTabIndex",4)}))}))}_onQualityScoreClick(){const Qe=this.shadowRoot.querySelector("pnx-tabs");Qe&&Qe.setAttribute("activeTabIndex",3)}_onCaptureDateClick(){const Qe=this.shadowRoot.querySelector("pnx-tabs");Qe&&Qe.setAttribute("activeTabIndex",1)}_toTab(Qe,rt){return Dl.qy`
792
792
  <h4 slot="title">${Qe}</h4>
793
793
  <div slot="content" class="data-blocks">
794
794
  ${rt.filter((Qe=>Qe)).map((Qe=>Dl.qy`<div class="data-block" style=${Qe.style}>
795
795
  <h5>${Qe.title}</h5>
796
- <div style=${Qe.content_style}>${Qe.content}</div>
796
+ <div style=${Qe.content_style} @click=${Qe.click}>${Qe.content}</div>
797
797
  </div>`))}
798
798
  </div>
799
799
  `}render(){var Qe,rt,Wn,Ql,lu,yu,Eu,Tu,Lu,Zu,Xu,Ju,$u,ed,td,id,nd,rd,ad,sd,od,ld,cd,ud,hd,dd,pd,md,fd,gd,Ad,yd,vd,_d,xd,bd,wd,Ed,Md,Sd,Td,Cd,kd,Id,Dd,Ld,Pd,zd,Nd,Rd,Bd,Od,Fd;if(!this._meta)return Co.s6;const jd=(null===(Qe=this._parent)||void 0===Qe?void 0:Qe.lang)||window.navigator.language,Ud=null===(rt=this._meta)||void 0===rt||null===(Wn=rt.properties)||void 0===Wn?void 0:Wn["pers:interior_orientation"],Vd=[Ud.camera_manufacturer,Ud.camera_model].filter((Qe=>Qe)).join(" "),Gd=null!==Ud&&void 0!==Ud&&Ud.focal_length?`${null===Ud||void 0===Ud?void 0:Ud.focal_length} mm`:missing();let Zd=null===Ud||void 0===Ud?void 0:Ud.sensor_array_dimensions;Zd&&(Zd=`${Zd[0]} x ${Zd[1]} px (${Math.floor(Zd[0]*Zd[1]/1e6)} Mpx)`);let Hd=null===(Ql=this._parent)||void 0===Ql?void 0:Ql._t.pnx.picture_flat,Wd=null===(lu=this._parent)||void 0===lu?void 0:lu._t.pnx.picture_flat_long,qd=null===Ud||void 0===Ud?void 0:Ud.field_of_view;var Yd,Qd;null!==qd&&void 0!==qd&&(360===qd?(Hd=null===(Yd=this._parent)||void 0===Yd?void 0:Yd._t.pnx.picture_360,Wd=null===(Qd=this._parent)||void 0===Qd?void 0:Qd._t.pnx.picture_360_long):Hd+=` (${qd}\xb0)`);const Kd=[{title:null===(yu=this._parent)||void 0===yu?void 0:yu._t.pnx.metadata_camera_make,content:(null===Ud||void 0===Ud?void 0:Ud.camera_manufacturer)||missing()},{title:null===(Eu=this._parent)||void 0===Eu?void 0:Eu._t.pnx.metadata_camera_model,content:(null===Ud||void 0===Ud?void 0:Ud.camera_model)||missing()},{title:null===(Tu=this._parent)||void 0===Tu?void 0:Tu._t.pnx.metadata_camera_type,content:Hd},{title:null===(Lu=this._parent)||void 0===Lu?void 0:Lu._t.pnx.metadata_camera_resolution,content:Zd||missing()},{title:null===(Zu=this._parent)||void 0===Zu?void 0:Zu._t.pnx.metadata_camera_focal_length,content:Gd},(null===(Xu=this._meta)||void 0===Xu||null===(Ju=Xu.caption)||void 0===Ju?void 0:Ju.date)&&{title:null===($u=this._parent)||void 0===$u?void 0:$u._t.pnx.metadata_general_date,content:Dl.qy`
@@ -843,16 +843,15 @@
843
843
  `,style:"width: 100%"});const Up=[(null===(md=this._meta)||void 0===md||null===(fd=md.caption)||void 0===fd||null===(gd=fd.producer)||void 0===gd?void 0:gd.length)>0&&{title:null===(Ad=this._parent)||void 0===Ad?void 0:Ad._t.pnx.metadata_general_author,content:Dl.qy`
844
844
  <strong>${this._meta.caption.producer[this._meta.caption.producer.length-1]}</strong>
845
845
  ${this._meta.caption.producer.length>1?Dl.qy`<br />${this._meta.caption.producer.slice(0,-1).join(", ")}`:Co.s6}
846
- `},(null===(yd=this._meta)||void 0===yd||null===(vd=yd.caption)||void 0===vd?void 0:vd.date)&&{title:null===(_d=this._parent)||void 0===_d?void 0:_d._t.pnx.metadata_general_date,content:Dl.qy`
846
+ `},(null===(yd=this._meta)||void 0===yd||null===(vd=yd.caption)||void 0===vd?void 0:vd.date)&&{title:null===(_d=this._parent)||void 0===_d?void 0:_d._t.pnx.metadata_general_date,click:this._onCaptureDateClick,content_style:"cursor: pointer",content:Dl.qy`
847
847
  <strong>${new Intl.DateTimeFormat(jd,{timeZone:this._meta.caption.tz,dateStyle:"long"}).format(this._meta.caption.date)}</strong>
848
- <br />${new Intl.DateTimeFormat(jd,{timeZone:this._meta.caption.tz,hour:"numeric",minute:"numeric"}).format(this._meta.caption.date)}
848
+ <br />${new Intl.DateTimeFormat(jd,{timeZone:this._meta.caption.tz,hour:"numeric",minute:"numeric",second:"numeric"}).format(this._meta.caption.date)}
849
849
  `},Ud&&{title:null===(xd=this._parent)||void 0===xd?void 0:xd._t.pnx.metadata_camera,content:Dl.qy`
850
850
  <strong>${Vd.length>0?Vd:missing()}</strong>
851
851
  <br />${Wd}
852
- `},(null===(bd=this._meta)||void 0===bd||null===(wd=bd.caption)||void 0===wd?void 0:wd.license)&&{title:null===(Ed=this._parent)||void 0===Ed?void 0:Ed._t.pnx.metadata_general_license,content:Dl.qy`${(0,Dl.Bk)(this._meta.caption.license)}`},$d&&{title:null===(Md=this._parent)||void 0===Md?void 0:Md._t.pnx.metadata_quality,content:Dl.qy`<pnx-quality-score
852
+ `},(null===(bd=this._meta)||void 0===bd||null===(wd=bd.caption)||void 0===wd?void 0:wd.license)&&{title:null===(Ed=this._parent)||void 0===Ed?void 0:Ed._t.pnx.metadata_general_license,content:Dl.qy`${(0,Dl.Bk)(this._meta.caption.license)}`},$d&&{title:null===(Md=this._parent)||void 0===Md?void 0:Md._t.pnx.metadata_quality,click:this._onQualityScoreClick,content:Dl.qy`<pnx-quality-score
853
853
  grade=${gp}
854
854
  style="font-size: 14px; cursor: pointer"
855
- @click=${this._onQualityScoreClick}
856
855
  />`},{title:null===(Sd=this._parent)||void 0===Sd?void 0:Sd._t.pnx.metadata_general_copy_id,content_style:"display: flex; gap: 5px;",content:Dl.qy`
857
856
  <pnx-copy-button
858
857
  kind="outline"