@panoramax/web-viewer 3.2.3-develop-8b82a4e5 → 3.2.3-develop-22a06610
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(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=null,this.sequence=null,console.info(`\ud83d\udcf7 Panoramax ${this.getClassName()} - Version ${ql.rE} (8b82a4e)\n\n\ud83c\udd98 Issues can be reported at ${ql.Jk.O}`),this._t=(0,Ll.getTranslations)(this.lang),Qe||(this.loader=(0,Ul.createWebComp)("pnx-loader",{_parent:this,"no-label":(0,Gl.isInIframe)()}),this._isInternetFast=null,(0,Gl.isInternetFast)().then((Qe=>this._isInternetFast=Qe)))}connectedCallback(){super.connectedCallback(),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((()=>{(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);const Hl=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)}),this["url-parameters"]&&"false"!==this["url-parameters"]&&(this.urlHandler=new Dl.A(this),this.onceReady().then((()=>{this.urlHandler.listenToChanges(),this.urlHandler._onParentChange()})))}_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)))}connectedCallback(){super.connectedCallback(),this._moveChildToGrid(),this.onceAPIReady().then((async()=>{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()}))}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,this.slot]}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})}))))}_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",(()=>keytopsv())))}_psvShouldGoFast(){return this.psv._sequencePlaying&&this.psv.getTransitionDuration()<1e3}_moveChildToGrid(){for(let Wn=0;Wn<this.childNodes.length;Wn++){var Qe;let Co=this.childNodes[Wn];var rt;if(null!==(Qe=Co.getAttribute)&&void 0!==Qe&&Qe.call(Co,"slot"))null!==(rt=Co.tagName)&&void 0!==rt&&rt.toLowerCase().startsWith("pnx-")&&(Co._parent=this,Co._t=this._t),"editors"===Co.getAttribute("slot")?this.onceReady().then((()=>this.legend.appendChild(Co))):this.grid.appendChild(Co)}}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+=Hl;break;case"left":rt.yaw-=Hl;break;case"down":rt.pitch-=Hl;break;case"right":rt.yaw+=Hl}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,{$:()=>Kl,A:()=>Viewer});Wn(9616);var Co=Wn(8340),Dl=Wn(3407),Ll=Wn(9039),Rl=Wn(2771),Ul=Wn(7343),Gl=Wn(5995),Zl=Wn(9683),Hl=Wn(2e3),ql=Wn(9438),Ql=Wn(2118);const Kl=20,$l=(Math.PI,100);class Viewer extends Dl.A{constructor(){super(),this.map=!0,this.geocoder=this.getAttribute("geocoder")||"nominatim",this.mini=(0,Gl.createWebComp)("pnx-mini",{slot:"bottom-left",_parent:this,onexpand:this._onMiniExpand.bind(this),collapsed:!!(0,Ul.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,Gl.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,Gl.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,Gl.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,Ul.isNullId)(Qe.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,Gl.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,Gl.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,Gl.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,Gl.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,Gl.createWebComp)("pnx-widget-maplayers",{slot:"top-right",_parent:this,class:"pnx-only-map pnx-print-hidden"})))}connectedCallback(){Ll.A.prototype.connectedCallback.call(this),this._moveChildToGrid(),this.onceAPIReady().then((async()=>{this.loader.setAttribute("value",30),this._createInitParamsHandler();const Qe=this._initParams.getParentPostInit();this._initPSV(),await this._initMap(),this._initWidgets(),(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()}))}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;(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,Ul.isNullId)(rt)&&!(0,Ul.isNullId)(Wn)&&this.mini.removeAttribute("collapsed"),(0,Ul.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,Ul.isNullId)(rt)&&this._setFocus("pic")));"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 Rl.A(this,this.mapContainer,this._initParams.getMapInit()),(0,Co.saveMapParamsToLocalStorage)(this.map),this.map.once("users-changed",(()=>{this.loader.setAttribute("value",75),Qe()}))})),(0,Ql.mK)(this.map,this._initParams.getMapPostInit()),(0,Co.initMapKeyboardHandler)(this),(0,Co.linkMapAndPhoto)(this)}_handleKeyboardManagement(){const keytomap=()=>{this.psv.stopKeyboardControl(),this.map.keyboard.enable()},keytopsv=()=>{var Qe,rt;this.psv.startKeyboardControl(),null===(Qe=this.map)||void 0===Qe||null===(rt=Qe.keyboard)||void 0===rt||rt.disable()},keytonone=()=>{var Qe,rt;this.psv.stopKeyboardControl(),null===(Qe=this.map)||void 0===Qe||null===(rt=Qe.keyboard)||void 0===rt||rt.disable()},keytofocused=()=>{this.map&&this.isMapWide()?keytomap():keytopsv()};this.addEventListener("focus-changed",(Qe=>{"map"===Qe.detail.focus?keytomap():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",(()=>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,$l];break;case"right":rt=[$l,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],Rl=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,(Rl||("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,Gl.fa)(Zl.pt),(0,Ul.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,Gl.fa)(Hl.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,ql.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.getElementById("pnx-filter-type-flat"),Ll=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-type-360"),Rl=(0,ql.qi)("#pnx-map-theme");let Ul="";null===Ll||void 0===Ll||!Ll.checked||null!==Dl&&void 0!==Dl&&Dl.checked||(Ul="equirectangular"),null!==Ll&&void 0!==Ll&&Ll.checked||null===Dl||void 0===Dl||!Dl.checked||(Ul="flat");let Gl=[];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");Gl=((null===Qe||void 0===Qe?void 0:Qe.grade)||"").split(",").map((Qe=>parseInt(Qe))).filter((Qe=>!isNaN(Qe))),5==Gl.length&&(Gl=[])}const Zl={minDate:null===Wn||void 0===Wn?void 0:Wn.value,maxDate:null===Co||void 0===Co?void 0:Co.value,pic_type:Ul,theme:null===Rl||void 0===Rl?void 0:Rl.value,qualityscore:Gl};this.map.setFilters(Zl)}}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},Rl=[0,.4],Ul=[.4,.8],Gl=[.8,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=null===(Qe=this.shadowRoot)||void 0===Qe?void 0:Qe.querySelector(".drawer");rt&&(rt.style.height=`${this._drawerHeight}px`,rt.style.maxHeight=`${this._drawerHeight}px`)}disconnectedCallback(){super.disconnectedCallback(),this._cleanupTouchListeners()}_onHandleClick(){"opened"===this.openness||"closed"===this.openness?this.openness="half-opened":"half-opened"===this.openness&&(this.openness="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){this._isDragging&&(this._deltaFingerY=Qe.touches[0].clientY-this._startFingerY,this._updateDrawerTransform(this._drawerY+this._deltaFingerY))}_onTouchEnd(){this._isDragging&&(this._isDragging=!1,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){var rt;let Wn=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const Co=null===(rt=this.shadowRoot)||void 0===rt?void 0:rt.querySelector(".drawer");if(Co)if(Qe=Math.max(0,Math.min(Qe,this._drawerHeight-30)),Wn){const rt=Qe/(this._drawerHeight-30);rt>Rl[0]&&rt<=Rl[1]&&(this.openness="opened"),rt>Ul[0]&&rt<=Ul[1]&&(this.openness="half-opened"),rt>Gl[0]&&rt<=Gl[1]&&(this.openness="closed"),this._drawerY=null,Co.style.transform=null}else Co.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=null,this.sequence=null,console.info(`\ud83d\udcf7 Panoramax ${this.getClassName()} - Version ${ql.rE} (22a0661)\n\n\ud83c\udd98 Issues can be reported at ${ql.Jk.O}`),this._t=(0,Ll.getTranslations)(this.lang),Qe||(this.loader=(0,Ul.createWebComp)("pnx-loader",{_parent:this,"no-label":(0,Gl.isInIframe)()}),this._isInternetFast=null,(0,Gl.isInternetFast)().then((Qe=>this._isInternetFast=Qe)))}connectedCallback(){super.connectedCallback(),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((()=>{(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);const Hl=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)}),this["url-parameters"]&&"false"!==this["url-parameters"]&&(this.urlHandler=new Dl.A(this),this.onceReady().then((()=>{this.urlHandler.listenToChanges(),this.urlHandler._onParentChange()})))}_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)))}connectedCallback(){super.connectedCallback(),this._moveChildToGrid(),this.onceAPIReady().then((async()=>{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()}))}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,this.slot]}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})}))))}_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",(()=>keytopsv())))}_psvShouldGoFast(){return this.psv._sequencePlaying&&this.psv.getTransitionDuration()<1e3}_moveChildToGrid(){for(let Wn=0;Wn<this.childNodes.length;Wn++){var Qe;let Co=this.childNodes[Wn];var rt;if(null!==(Qe=Co.getAttribute)&&void 0!==Qe&&Qe.call(Co,"slot"))null!==(rt=Co.tagName)&&void 0!==rt&&rt.toLowerCase().startsWith("pnx-")&&(Co._parent=this,Co._t=this._t),"editors"===Co.getAttribute("slot")?this.onceReady().then((()=>this.legend.appendChild(Co))):this.grid.appendChild(Co)}}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+=Hl;break;case"left":rt.yaw-=Hl;break;case"down":rt.pitch-=Hl;break;case"right":rt.yaw+=Hl}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,{$:()=>Kl,A:()=>Viewer});Wn(9616);var Co=Wn(8340),Dl=Wn(3407),Ll=Wn(9039),Rl=Wn(2771),Ul=Wn(7343),Gl=Wn(5995),Zl=Wn(9683),Hl=Wn(2e3),ql=Wn(9438),Ql=Wn(2118);const Kl=20,$l=(Math.PI,100);class Viewer extends Dl.A{constructor(){super(),this.map=!0,this.geocoder=this.getAttribute("geocoder")||"nominatim",this.mini=(0,Gl.createWebComp)("pnx-mini",{slot:"bottom-left",_parent:this,onexpand:this._onMiniExpand.bind(this),collapsed:!!(0,Ul.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,Gl.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,Gl.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,Gl.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,Ul.isNullId)(Qe.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,Gl.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,Gl.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,Gl.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,Gl.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,Gl.createWebComp)("pnx-widget-maplayers",{slot:"top-right",_parent:this,class:"pnx-only-map pnx-print-hidden"})))}connectedCallback(){Ll.A.prototype.connectedCallback.call(this),this._moveChildToGrid(),this.onceAPIReady().then((async()=>{this.loader.setAttribute("value",30),this._createInitParamsHandler();const Qe=this._initParams.getParentPostInit();this._initPSV(),await this._initMap(),this._initWidgets(),(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()}))}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;(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,Ul.isNullId)(rt)&&!(0,Ul.isNullId)(Wn)&&this.mini.removeAttribute("collapsed"),(0,Ul.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,Ul.isNullId)(rt)&&this._setFocus("pic")));"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 Rl.A(this,this.mapContainer,this._initParams.getMapInit()),(0,Co.saveMapParamsToLocalStorage)(this.map),this.map.once("users-changed",(()=>{this.loader.setAttribute("value",75),Qe()}))})),(0,Ql.mK)(this.map,this._initParams.getMapPostInit()),(0,Co.initMapKeyboardHandler)(this),(0,Co.linkMapAndPhoto)(this)}_handleKeyboardManagement(){const keytomap=()=>{this.psv.stopKeyboardControl(),this.map.keyboard.enable()},keytopsv=()=>{var Qe,rt;this.psv.startKeyboardControl(),null===(Qe=this.map)||void 0===Qe||null===(rt=Qe.keyboard)||void 0===rt||rt.disable()},keytonone=()=>{var Qe,rt;this.psv.stopKeyboardControl(),null===(Qe=this.map)||void 0===Qe||null===(rt=Qe.keyboard)||void 0===rt||rt.disable()},keytofocused=()=>{this.map&&this.isMapWide()?keytomap():keytopsv()};this.addEventListener("focus-changed",(Qe=>{"map"===Qe.detail.focus?keytomap():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",(()=>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,$l];break;case"right":rt=[$l,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],Rl=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,(Rl||("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,Gl.fa)(Zl.pt),(0,Ul.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,Gl.fa)(Hl.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,ql.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.getElementById("pnx-filter-type-flat"),Ll=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-type-360"),Rl=(0,ql.qi)("#pnx-map-theme");let Ul="";null===Ll||void 0===Ll||!Ll.checked||null!==Dl&&void 0!==Dl&&Dl.checked||(Ul="equirectangular"),null!==Ll&&void 0!==Ll&&Ll.checked||null===Dl||void 0===Dl||!Dl.checked||(Ul="flat");let Gl=[];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");Gl=((null===Qe||void 0===Qe?void 0:Qe.grade)||"").split(",").map((Qe=>parseInt(Qe))).filter((Qe=>!isNaN(Qe))),5==Gl.length&&(Gl=[])}const Zl={minDate:null===Wn||void 0===Wn?void 0:Wn.value,maxDate:null===Co||void 0===Co?void 0:Co.value,pic_type:Ul,theme:null===Rl||void 0===Rl?void 0:Rl.value,qualityscore:Gl};this.map.setFilters(Zl)}}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},Rl=[0,.4],Ul=[.4,.8],Gl=[.8,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=null===(Qe=this.shadowRoot)||void 0===Qe?void 0:Qe.querySelector(".drawer");rt&&(rt.style.height=`${this._drawerHeight}px`,rt.style.maxHeight=`${this._drawerHeight}px`)}disconnectedCallback(){super.disconnectedCallback(),this._cleanupTouchListeners()}_onHandleClick(){"opened"===this.openness||"closed"===this.openness?this.openness="half-opened":"half-opened"===this.openness&&(this.openness="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){this._isDragging&&(this._deltaFingerY=Qe.touches[0].clientY-this._startFingerY,this._updateDrawerTransform(this._drawerY+this._deltaFingerY))}_onTouchEnd(){this._isDragging&&(this._isDragging=!1,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){var rt;let Wn=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const Co=null===(rt=this.shadowRoot)||void 0===rt?void 0:rt.querySelector(".drawer");if(Co)if(Qe=Math.max(0,Math.min(Qe,this._drawerHeight-30)),Wn){const rt=Qe/(this._drawerHeight-30);rt>Rl[0]&&rt<=Rl[1]&&(this.openness="opened"),rt>Ul[0]&&rt<=Ul[1]&&(this.openness="half-opened"),rt>Gl[0]&&rt<=Gl[1]&&(this.openness="closed"),this._drawerY=null,Co.style.transform=null}else Co.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}"
|
|
@@ -233,7 +233,7 @@
|
|
|
233
233
|
/* Content */
|
|
234
234
|
.contents ::slotted(div) { display: none !important; }
|
|
235
235
|
.contents ::slotted(.active) { display: block !important; }
|
|
236
|
-
`,Tabs.properties={activeTabIndex:{type:Number}},customElements.define("pnx-tabs",Tabs)},456:(Qe,rt,Wn)=>{"use strict";Wn.r(rt),Wn.d(rt,{BottomDrawer:()=>Co.A,CorneredGrid:()=>Dl.A,Mini:()=>Ll.A,Tabs:()=>Rl.A});var Co=Wn(6784),Dl=Wn(7422),Ll=Wn(1445),Rl=Wn(5534)},5036:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>MapBackground});var Co=Wn(4542),Dl=Wn(7534),Ll=Wn(6810);class MapBackground extends Co.WF{constructor(){super(),this.size="md"}connectedCallback(){var Qe,rt,Wn,Co;super.connectedCallback(),null===(Qe=this._parent)||void 0===Qe||null===(rt=Qe.map)||void 0===rt||rt.on("background-changed",(Qe=>{this.bg=Qe.background})),this.bg=null===(Wn=this._parent)||void 0===Wn||null===(Co=Wn.map)||void 0===Co?void 0:Co.getBackground()}_onBgSelect(Qe){var rt,Wn;this.bg=Qe.target.value,null===(rt=this._parent)||void 0===rt||null===(Wn=rt.map)||void 0===Wn||Wn.setBackground(this.bg)}render(){var Qe,rt;return Co.qy`
|
|
236
|
+
`,Tabs.properties={activeTabIndex:{type:Number,reflect:!0}},customElements.define("pnx-tabs",Tabs)},456:(Qe,rt,Wn)=>{"use strict";Wn.r(rt),Wn.d(rt,{BottomDrawer:()=>Co.A,CorneredGrid:()=>Dl.A,Mini:()=>Ll.A,Tabs:()=>Rl.A});var Co=Wn(6784),Dl=Wn(7422),Ll=Wn(1445),Rl=Wn(5534)},5036:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>MapBackground});var Co=Wn(4542),Dl=Wn(7534),Ll=Wn(6810);class MapBackground extends Co.WF{constructor(){super(),this.size="md"}connectedCallback(){var Qe,rt,Wn,Co;super.connectedCallback(),null===(Qe=this._parent)||void 0===Qe||null===(rt=Qe.map)||void 0===rt||rt.on("background-changed",(Qe=>{this.bg=Qe.background})),this.bg=null===(Wn=this._parent)||void 0===Wn||null===(Co=Wn.map)||void 0===Co?void 0:Co.getBackground()}_onBgSelect(Qe){var rt,Wn;this.bg=Qe.target.value,null===(rt=this._parent)||void 0===rt||null===(Wn=rt.map)||void 0===Wn||Wn.setBackground(this.bg)}render(){var Qe,rt;return Co.qy`
|
|
237
237
|
<input
|
|
238
238
|
type="radio"
|
|
239
239
|
id="bg-streets"
|
|
@@ -741,7 +741,7 @@
|
|
|
741
741
|
|
|
742
742
|
/* Editors */
|
|
743
743
|
#pic-legend-editors { margin: 0 10px; }
|
|
744
|
-
`],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(8591),Tc=Wn(508),tu=Wn(7343);const missing=()=>(0,Ll.fa)(Ql.Ev,{styles:{height:"16px"}});class PictureMetadata extends Co.WF{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.psv)||void 0===Co||Co.addEventListener("picture-loaded",(()=>{var Qe,rt;this._meta=null===(Qe=this._parent)||void 0===Qe||null===(rt=Qe.psv)||void 0===rt?void 0:rt.getPictureMetadata()}))}_toTab(Qe,rt){return Dl.qy`
|
|
744
|
+
`],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(8591),Tc=Wn(508),tu=Wn(7343);const missing=()=>(0,Ll.fa)(Ql.Ev,{styles:{height:"16px"}});class PictureMetadata extends Co.WF{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.psv)||void 0===Co||Co.addEventListener("picture-loaded",(()=>{var Qe,rt;this._meta=null===(Qe=this._parent)||void 0===Qe||null===(rt=Qe.psv)||void 0===rt?void 0:rt.getPictureMetadata()}))}_onQualityScoreClick(){const Qe=this.shadowRoot.querySelector("pnx-tabs");Qe&&Qe.setAttribute("activeTabIndex",3)}_toTab(Qe,rt){return Dl.qy`
|
|
745
745
|
<h4 slot="title">${Qe}</h4>
|
|
746
746
|
<div slot="content" class="data-blocks">
|
|
747
747
|
${rt.filter((Qe=>Qe)).map((Qe=>Dl.qy`<div class="data-block" style=${Qe.style}>
|
|
@@ -770,7 +770,11 @@
|
|
|
770
770
|
`},Ld&&{title:null===(gd=this._parent)||void 0===gd?void 0:gd._t.pnx.metadata_camera,content:Dl.qy`
|
|
771
771
|
<strong>${Pd.length>0?Pd:missing()}</strong>
|
|
772
772
|
<br />${Bd}
|
|
773
|
-
`},(null===(Ad=this._meta)||void 0===Ad||null===(yd=Ad.caption)||void 0===yd?void 0:yd.license)&&{title:null===(_d=this._parent)||void 0===_d?void 0:_d._t.pnx.metadata_general_license,content:Dl.qy`${(0,Dl.Bk)(this._meta.caption.license)}`},Zd&&{title:null===(vd=this._parent)||void 0===vd?void 0:vd._t.pnx.metadata_quality,content:Dl.qy`<pnx-quality-score
|
|
773
|
+
`},(null===(Ad=this._meta)||void 0===Ad||null===(yd=Ad.caption)||void 0===yd?void 0:yd.license)&&{title:null===(_d=this._parent)||void 0===_d?void 0:_d._t.pnx.metadata_general_license,content:Dl.qy`${(0,Dl.Bk)(this._meta.caption.license)}`},Zd&&{title:null===(vd=this._parent)||void 0===vd?void 0:vd._t.pnx.metadata_quality,content:Dl.qy`<pnx-quality-score
|
|
774
|
+
grade=${Wd}
|
|
775
|
+
style="font-size: 14px; cursor: pointer"
|
|
776
|
+
@click=${this._onQualityScoreClick}
|
|
777
|
+
/>`},{title:null===(xd=this._parent)||void 0===xd?void 0:xd._t.pnx.metadata_general_copy_id,content_style:"display: flex; gap: 5px;",content:Dl.qy`
|
|
774
778
|
<pnx-copy-button
|
|
775
779
|
kind="outline"
|
|
776
780
|
size="sm"
|
|
@@ -816,7 +820,6 @@
|
|
|
816
820
|
}
|
|
817
821
|
|
|
818
822
|
/* Small data blocks */
|
|
819
|
-
/* .data-blocks { display: flex; } */
|
|
820
823
|
.data-block {
|
|
821
824
|
display: inline-block;
|
|
822
825
|
min-width: 50%;
|
|
@@ -1803,7 +1806,9 @@
|
|
|
1803
1806
|
style=${"map"==this.focus?"display: none":""}
|
|
1804
1807
|
collapsable
|
|
1805
1808
|
>
|
|
1806
|
-
<slot slot="editors" name="editors"
|
|
1809
|
+
<slot slot="editors" name="editors">
|
|
1810
|
+
<pnx-widget-osmeditors ._parent=${this._parent} />
|
|
1811
|
+
</slot>
|
|
1807
1812
|
</pnx-picture-legend>
|
|
1808
1813
|
<pnx-map-legend
|
|
1809
1814
|
._parent=${this._parent}
|