@panoramax/web-viewer 4.1.0-develop-d86468b8 → 4.1.0-develop-5ce55f3f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -9,7 +9,7 @@
9
9
  * LICENSE file in the root directory of this source tree.
10
10
  *
11
11
  */
12
- !function(at,st){"object"===typeof exports&&"object"===typeof module?module.exports=st():"function"===typeof define&&define.amd?define("Panoramax",[],st):"object"===typeof exports?exports.Panoramax=st():at.Panoramax=st()}(this,(()=>(()=>{var at={9039:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>Basic});var ut=ot(4542),Hl=ot(5254),rc=ot(4964),sc=ot(7208),oc=ot(5995),_c=ot(7343),wc=ot(2614),Sc=ot.n(wc),iu=ot(8330);ot(1865),ot(3638);class Basic extends ut.WF{constructor(){let at=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.users=["geovisio"],this["map-style"]=this.getAttribute("map-style")||(0,sc.MapTiles)(),this.lang=this.getAttribute("lang")||null,this.endpoint=this.getAttribute("endpoint")||null,this.picture=this.getAttribute("picture")||null,this.sequence=this.getAttribute("sequence")||null,console.info(`\ud83d\udcf7 Panoramax ${this.getClassName()} - Version ${iu.rE} (d86468b)\n\n\ud83c\udd98 Issues can be reported at ${iu.Jk.O}`),at||(this._isInternetFast=null,(0,_c.isInternetFast)().then((at=>this._isInternetFast=at)))}connectedCallback(){super.connectedCallback(),this._t=(0,rc.getTranslations)(this.lang),this.loader=(0,oc.createWebComp)("pnx-loader",{_parent:this,"no-label":(0,_c.isInIframe)()}),this._loadsAPI&&this.endpoint&&this._loadsAPI===this.endpoint||this.api&&this.api._endpoint===this.endpoint||!this.endpoint||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI()),Object.entries({map:"map-options",psv:"psv-options",fetchOptions:"fetch-options",mapstyle:"map-style"}).forEach((at=>{let[st,ot]=at;this.getAttribute(st)&&console.error(`Component attribute "${st}" has been renamed into "${ot}". Old attribute "${st}" is ignored.`)}))}_setupAPI(){if(this.loader=this.loader||(0,oc.createWebComp)("pnx-loader",{_parent:this}),!this.endpoint)return void console.warn("No endpoint is defined");this._loadsAPI=this.endpoint;let at=this.endpoint;try{this["map-style"]=JSON.parse(this["map-style"])}catch(ot){}try{this.api=new Hl.A(this.endpoint,{users:this.users,fetch:this["fetch-options"],style:this["map-style"]}),this.api.onceReady().then((()=>{if(at!=this._loadsAPI||!this.api)return;let st=this.api.getUnavailableFeatures(),ot=this.api.getAvailableFeatures();ot=0===st.length?"\u2705 All features available":"\u2705 Available features: "+ot.join(", "),st=0===st.length?"":"\ud83d\udeab Unavailable features: "+st.join(", "),console.info(`\ud83c\udf10 Connected to API "${this.api._metadata.name}" (${this.api._endpoint})\n\u2139\ufe0f API runs STAC ${this.api._metadata.stac_version} ${this.api._metadata.geovisio_version?"& GeoVisio "+this.api._metadata.geovisio_version:""}\n ${ot}\n ${st}\n`.trim())})).catch((at=>this.loader.dismiss(at,this._t.pnx.error_api))).finally((()=>delete this._loadsAPI))}catch(ot){var st;delete this._loadsAPI,null!==(st=this.loader)&&void 0!==st&&st.dismiss?this.loader.dismiss(ot,this._t.pnx.error_api):console.error(ot)}}onceReady(){throw new Error("You must override this method on sub-class")}onceAPIReady(){return this.api?this.api.onceReady():new Promise((at=>setTimeout(at,100))).then(this.onceAPIReady.bind(this))}createRenderRoot(){return this}attributeChangedCallback(at,st,ot){if(super.attributeChangedCallback(at,st,ot),"endpoint"===at&&(this._loadsAPI&&ot&&this._loadsAPI===ot||this.api&&this.api._endpoint===ot||!ot||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())),["picture","sequence"].includes(at)){let ut,Hl,rc,sc;"picture"===at?(ut=this.sequence,rc=this.sequence,Hl=ot,sc=st):(ut=ot,rc=st,Hl=this.picture,sc=this.picture),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{seqId:ut,picId:Hl,prevSeqId:rc,prevPicId:sc}}))}}getClassName(){return"Basic"}select(){let at=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,st=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&(this.picture=null,this.sequence=null),this.picture=st,this.sequence=at}isWidthSmall(){return(null===this||void 0===this?void 0:this.offsetWidth)<576}isHeightSmall(){return(null===this||void 0===this?void 0:this.offsetHeight)<400}render(){return ut.qy`<p>Should not be used directly, use Viewer/CoverageMap/Editor instead</p>`}getSubComponentsNames(){return["loader","api"]}addEventListener(at,st,ot){let ut=at.split(":").shift();if(ut&&this.getSubComponentsNames().includes(ut)){var Hl;const rc=at.substring(ut.length+1);null!==(Hl=this[ut])&&void 0!==Hl&&Hl.addEventListener?this[ut].addEventListener(rc,st,ot):setTimeout((()=>this.addEventListener(at,st,ot)),50)}else super.addEventListener(at,st,ot)}static GetJSONConverter(){return{fromAttribute:at=>null===at||""===at?null:"object"===typeof at||Array.isArray(at)?at:Sc().parse(at),toAttribute:at=>null===at||""===at?"":"string"===typeof at?at:Sc().stringify(at)}}}Basic.properties={picture:{type:String,reflect:!0},sequence:{type:String,reflect:!0},"fetch-options":{converter:Basic.GetJSONConverter()},users:{type:Array,reflect:!0},"map-style":{type:String},lang:{type:String},endpoint:{type:String}}},153:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>CoverageMap});var ut=ot(9039),Hl=ot(5642),rc=ot(8340),sc=ot(927),oc=(ot(7776),ot(2118));class CoverageMap extends ut.A{constructor(){super(),this._mapContainer=document.createElement("div"),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this._initParams=new oc.Ay(oc.Ay.GetComponentProperties(CoverageMap,this)),this._initMap()}))}disconnectedCallback(){var at;super.disconnectedCallback(),null===(at=this.map)||void 0===at||at.destroy()}getClassName(){return"CoverageMap"}onceReady(){return this.map&&this.map.waitForEnoughMapLoaded?this.map.waitForEnoughMapLoaded():new Promise((at=>setTimeout(at,100))).then(this.onceReady.bind(this))}render(){return[this.loader,this._mapContainer]}getSubComponentsNames(){const at=super.getSubComponentsNames();return at.push("map"),at}_initMap(){class MyMap extends Hl.A{_getLayerStyleProperties(at){return"pictures_symbols"===at?{layout:{visibility:"none"}}:super._getLayerStyleProperties(at)}}this.map=new MyMap(this,this._mapContainer,Object.assign({},this._initParams.getMapInit(),{hash:!0})),this.map.addControl(new sc.NavigationControl({showCompass:!1})),this.loader.setAttribute("value",70),this.addEventListener("select",this._onSelect.bind(this)),this.map.on("picture-click",(at=>this.select(at.seqId,at.picId))),this.map.on("sequence-click",(at=>this.select(at.seqId))),this.map.waitForEnoughMapLoaded().then((async()=>{await(0,oc.mK)(this.map,this._initParams.getMapPostInit()),this.map.reloadLayersStyles(),this.loader.dismiss()}))}_onSelect(at){if(at.detail.picId||at.detail.seqId){const st=at.detail.picId?"pictures":"sequences",ot=this.map.queryRenderedFeatures({layers:[...this.map._userLayers].map((at=>(0,rc.getUserLayerId)(at,st))),filter:["==",["get","id"],at.detail.picId||at.detail.seqId]});ot.length>=0&&null!=ot[0]&&this.map._attachPreviewToPictures({features:ot},st)}}}CoverageMap.properties={"map-options":{converter:ut.A.GetJSONConverter()},...ut.A.properties},customElements.define("pnx-coverage-map",CoverageMap)},1752:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>Editor});ot(7365);var ut=ot(9039),Hl=ot(5642),rc=ot(9048),sc=ot(508),oc=ot(8340),_c=ot(1545),wc=ot(5995);const Sc="sequence-headings";class Editor extends ut.A{constructor(){super(),this.raster=null,this.background="streets",this.users=[],this._psvContainer=document.createElement("div"),this._psvContainer.setAttribute("slot","bg"),this._mapContainer=document.createElement("div"),this._mapContainer.setAttribute("slot","bg"),this.grid=(0,wc.createWebComp)("pnx-cornered-grid"),this.grid.appendChild(this._psvContainer),this.grid.appendChild(this._mapContainer),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this.sequence||this.loader.dismiss({},"No sequence is selected"),this.addEventListener("select",this._onSelect.bind(this)),this._initPSV(),this._initMap()}))}disconnectedCallback(){var at,st;super.disconnectedCallback(),null===(at=this.map)||void 0===at||at.destroy(),null===(st=this.psv)||void 0===st||st.destroy()}getClassName(){return"Editor"}onceReady(){var at,st;return this.map&&this.psv&&null!==(at=(st=this.map).loaded)&&void 0!==at&&at.call(st)?Promise.resolve():new Promise((at=>setTimeout(at,100))).then(this.onceReady.bind(this))}connectedCallback(){Array.isArray(this.users)&&this.users.length>0&&(console.warn("Parameters users can't be changed in Editor, only selected sequence can be visible"),this.users=[]),super.connectedCallback(),this._moveChildToGrid(),window.addEventListener("DOMContentLoaded",(()=>{this._moveChildToGrid()}),{once:!0})}attributeChangedCallback(at,st,ot){"users"===at&&Array.isArray(ot)&&ot.length>0?console.warn("Parameters users can't be changed in Editor, only selected sequence can be visible"):super.attributeChangedCallback(at,st,ot)}render(){return[this.loader,this.grid]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["map","psv","grid"])}_initPSV(){try{this.psv=new rc.Ay(this,this._psvContainer),this.psv._myVTour.datasource.nodeResolver=this._getNode.bind(this)}catch(at){let st=_c.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(at,st)}}_initMap(){try{this.map=new Hl.A(this,this._mapContainer,{raster:this.raster,background:this.background,supplementaryStyle:this._createMapStyle(),zoom:15,picMarkerDraggable:!0}),(0,oc.linkMapAndPhoto)(this),this.loader.setAttribute("value",50),this._loadSequence(),this.map.once("load",(()=>{this.map.hasTwoBackgrounds()&&this._addMapBackgroundWidget(),this._bindPicturesEvents()}));const at=this.map._picMarker.setRotation.bind(this.map._picMarker);this.map._picMarker.setRotation=st=>(st=void 0===this._lastRelHeading?st:st+this._lastRelHeading-this.psv.getPictureRelativeHeading(),at(st))}catch(at){this.loader.dismiss(at,this._t.pnx.error_psv)}}_createMapStyle(){return{sources:{geovisio_editor_sequences:{type:"geojson",data:{type:"FeatureCollection",features:[]}}},layers:[{id:"geovisio_editor_sequences",type:"line",source:"geovisio_editor_sequences",layout:{...oc.VECTOR_STYLES.SEQUENCES.layout},paint:{...oc.VECTOR_STYLES.SEQUENCES.paint}},{id:"geovisio_editor_pictures",type:"circle",source:"geovisio_editor_sequences",layout:{...oc.VECTOR_STYLES.PICTURES.layout},paint:{...oc.VECTOR_STYLES.PICTURES.paint}}]}}_bindPicturesEvents(){this.map.on("mousemove","geovisio_editor_pictures",(()=>{this.map.getCanvas().style.cursor="pointer"})),this.map.on("mouseleave","geovisio_editor_pictures",(()=>{this.map.getCanvas().style.cursor=""})),this.map.on("click","geovisio_editor_pictures",this.map._onPictureClick.bind(this.map))}_loadSequence(){return this.loader.setAttribute("value",60),this.api.getSequenceItems(this.sequence).then((at=>{if(this.loader.setAttribute("value",80),this.map.once("sourcedata",(()=>{this.map.setPaintProperty("geovisio_editor_sequences","line-color",this.map._getLayerColorStyle("sequences")),this.map.setPaintProperty("geovisio_editor_pictures","circle-color",this.map._getLayerColorStyle("pictures")),this.map.setLayoutProperty("geovisio_editor_sequences","visibility","visible"),this.map.setLayoutProperty("geovisio_editor_pictures","visibility","visible"),this.map.once("styledata",(()=>this.loader.dismiss()))})),this._sequenceData=at.features,this.map.getSource("geovisio_editor_sequences").setData({type:"FeatureCollection",features:[{id:this.sequence,type:"Feature",properties:{id:this.sequence},geometry:{type:"LineString",coordinates:at.features.map((at=>at.geometry.coordinates))}},...at.features.map((at=>(at.properties.id=at.id,at.properties.sequences=[this.sequence],at)))]}),this.picture){const st=at.features.find((at=>at.id===this.picture));st?(this.select(this.sequence,this.picture,!0),this.map.jumpTo({center:st.geometry.coordinates,zoom:18})):console.log("Picture with ID",st,"was not found")}else{const st=[...at.features[0].geometry.coordinates,...at.features[0].geometry.coordinates];for(let ot=1;ot<at.features.length;ot++){const ut=at.features[ot].geometry.coordinates;ut[0]<st[0]&&(st[0]=ut[0]),ut[1]<st[1]&&(st[1]=ut[1]),ut[0]>st[2]&&(st[2]=ut[0]),ut[1]>st[3]&&(st[3]=ut[1])}this.map.fitBounds(st,{animate:!1})}})).catch((at=>this.loader.dismiss(at,this._t.pnx.error_api)))}_getNode(at){const st=this._sequenceData.find((st=>st.properties.id===at)),ot=st?(0,sc.apiFeatureToPSVNode)(st,this._t,this._isInternetFast,void 0,(at=>this.api.cleanResourceURL(at))):null;return ot&&delete ot.links,ot}_addMapBackgroundWidget(){const at=(0,wc.createWebComp)("pnx-map-background",{_parent:this,size:"sm",slot:"bottom-left"});this.grid.appendChild(at)}_moveChildToGrid(){Array.from(this.querySelectorAll("[slot]")).forEach((at=>{var st;null!==(st=at.tagName)&&void 0!==st&&st.toLowerCase().startsWith("pnx-")&&(at._parent=this,at._t=this._t),this.grid.appendChild(at)}))}previewSequenceHeadingChange(at){const st=void 0!==this.map.getLayer(Sc);if(this.map._picMarkerPreview.remove(),void 0===at)return delete this._lastRelHeading,st&&this.map.setLayoutProperty(Sc,"visibility","none"),void(this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x));this._lastRelHeading=at,st||this.map.addLayer({id:Sc,type:"symbol",source:"geovisio_editor_sequences",layout:{"icon-image":"pnx-marker","icon-overlap":"always","icon-size":.8}});const ot=-this.psv.getPictureRelativeHeading();this.map.setLayoutProperty(Sc,"visibility","visible"),this.map.setLayoutProperty(Sc,"icon-rotate",["+",["get","view:azimuth"],ot,at]);const ut=[["==",["geometry-type"],"Point"]];this.picture&&ut.push(["!=",["get","id"],this.picture]),this.map.setFilter(Sc,["all",...ut]),this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x)}_onSelect(){void 0!==this._lastRelHeading&&this.previewSequenceHeadingChange(this._lastRelHeading)}}Editor.properties={raster:{converter:ut.A.GetJSONConverter()},background:{type:String},...ut.A.properties},customElements.define("pnx-editor",Editor)},3407:(at,st,ot)=>{"use strict";ot.d(st,{$p:()=>iu,Ay:()=>PhotoViewer,RD:()=>lu});ot(970);var ut=ot(1545),Hl=ot(4451),rc=ot(9039),sc=ot(9048),oc=ot(5995),_c=ot(7343),wc=ot(2118),Sc=ot(4207);const iu=20,su=Math.PI/6,lu=["pnx-mini","pnx-widget-player","pnx-widget-zoom"];class PhotoViewer extends rc.A{constructor(){super(),this["psv-options"]={},this["url-parameters"]=this.getAttribute("url-parameters")||!0,this["keyboard-shortcuts"]=this.getAttribute("keyboard-shortcuts")||!0,this.widgets=this.getAttribute("widgets")||"true",this.grid=(0,oc.createWebComp)("pnx-cornered-grid"),this.psvContainer=document.createElement("div"),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.popup=(0,oc.createWebComp)("pnx-popup",{_parent:this,onclose:this._onPopupClose.bind(this)}),this.tabindex=0}_createInitParamsHandler(){var at,st;this._initParams=new wc.Ay(wc.Ay.GetComponentProperties(PhotoViewer,this),Object.assign({},null===(at=this.urlHandler)||void 0===at?void 0:at.currentURLParams(),null===(st=this.urlHandler)||void 0===st?void 0:st.currentURLParams(!0)),{})}_initWidgets(){"false"!==this._initParams.getParentPostInit().widgets&&((0,_c.isInIframe)()||(this.grid.appendChild((0,oc.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,oc.createWebComp)("pnx-annotations-switch",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"}))),(0,_c.isInIframe)()?(this.legend=(0,oc.createWebComp)("pnx-widget-legend",{slot:"bottom-right",light:!0,_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild(this.legend)):this.isWidthSmall()?(this.legend=(0,oc.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,oc.createWebComp)("pnx-bottom-drawer",{slot:"bottom",_parent:this,class:this._initParams.getParentPostInit().picture?void 0:"pnx-hidden"}),this.bottomDrawer.appendChild(this.legend),this.grid.appendChild(this.bottomDrawer),this.addEventListener("select",(at=>{(0,_c.isNullId)(at.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,oc.createWebComp)("pnx-widget-legend",{slot:this.isWidthSmall()?void 0:"top-left",_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild((0,oc.createWebComp)("pnx-widget-zoom",{slot:"bottom-right",class:"pnx-print-hidden",_parent:this})),this.grid.appendChild(this.legend)))}connectedCallback(){super.connectedCallback(),this.presetsManager=new Sc.A(this.lang),this["url-parameters"]&&"false"!==this["url-parameters"]&&(this.urlHandler=new Hl.A(this),this.onceReady().then((()=>{this.urlHandler.listenToChanges(),this.urlHandler._onParentChange()}))),this.onceAPIReady().then(this._postAPIInit.bind(this)),this._moveChildToGrid(),window.addEventListener("DOMContentLoaded",(()=>{this._moveChildToGrid()}),{once:!0})}disconnectedCallback(){var at,st;super.disconnectedCallback(),null===(at=this.urlHandler)||void 0===at||at.destroy(),null===(st=this.psv)||void 0===st||st.destroy(),document.body.removeEventListener("click",this._toggleKeyboardBasedOnFocus),window.removeEventListener("keypress",this._toggleKeyboardBasedOnFocus)}getClassName(){return"PhotoViewer"}onceReady(){return this.oncePSVReady().then((()=>this._initParams.getParentPostInit().picture&&!this.psv.getPictureMetadata()?this.onceFirstPicLoaded():Promise.resolve()))}render(){return[this.loader,this.grid,this.popup]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["psv","grid","popup","urlHandler"])}oncePSVReady(){let at;return new Promise((st=>{at=setInterval((()=>{this.psv&&"object"===typeof this.psv&&(this.psv.container?(clearInterval(at),st()):this.psv.addEventListener&&this.psv.addEventListener("ready",(()=>{clearInterval(at),st()}),{once:!0}))}),250)}))}onceFirstPicLoaded(){return this.oncePSVReady().then((()=>this.psv.getPictureMetadata()?Promise.resolve():new Promise((at=>{this.psv.addEventListener("picture-loaded",at,{once:!0})}))))}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const at=this._initParams.getParentPostInit();this._initPSV(),this._initWidgets(),(0,wc.ai)(this,at),at.keyboardShortcuts&&this._handleKeyboardManagement(),at.picture?this.psv.addEventListener("picture-loaded",(()=>this.loader.dismiss()),{once:!0}):this.loader.dismiss()}_initPSV(){try{this.psv=new sc.Ay(this,this.psvContainer,{shouldGoFast:this._psvShouldGoFast.bind(this),keyboard:"always",keyboardActions:{...ut.zY.keyboardActions,8:"ROTATE_UP",2:"ROTATE_DOWN",4:"ROTATE_LEFT",6:"ROTATE_RIGHT",PageUp:()=>this.psv.goToNextPicture(),9:()=>this.psv.goToNextPicture(),PageDown:()=>this.psv.goToPrevPicture(),3:()=>this.psv.goToPrevPicture(),5:()=>this.moveCenter(),"*":()=>this.moveCenter(),Home:()=>{var at;return null===(at=this._toggleFocus)||void 0===at?void 0:at.call(this)},7:()=>{var at;return null===(at=this._toggleFocus)||void 0===at?void 0:at.call(this)},End:()=>this.mini.toggleAttribute("collapsed"),1:()=>this.mini.toggleAttribute("collapsed")," ":()=>this.psv.toggleSequencePlaying(),0:()=>this.psv.toggleSequencePlaying()},...this._initParams.getPSVInit()}),this.oncePSVReady().then((()=>{this.loader.setAttribute("value",50),(0,wc.Vy)(this.psv,this._initParams.getPSVPostInit())})),this.psv.addEventListener("sequence-playing",(()=>this.classList.add("pnx-playing"))),this.psv.addEventListener("sequence-stopped",(()=>this.classList.remove("pnx-playing")))}catch(at){let st=ut.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(at,st)}}_enableKeyboard(){this.psv.startKeyboardControl()}_disableKeyboard(){this.psv.stopKeyboardControl()}_toggleKeyboardBasedOnFocus(at){const st=(null===at||void 0===at?void 0:at.target)||document.activeElement;if(this.contains(st)){for(let at of this.grid.childNodes)if("bg"!==at.getAttribute("slot")&&!lu.includes(at.tagName.toLowerCase())&&at.contains(st))return void this._disableKeyboard();this._enableKeyboard()}else this._disableKeyboard()}_handleKeyboardManagement(){window.addEventListener("click",(at=>this._toggleKeyboardBasedOnFocus(at))),window.addEventListener("keypress",this._toggleKeyboardBasedOnFocus.bind(this)),this.popup.addEventListener("open",this._disableKeyboard.bind(this)),this.popup.addEventListener("close",this._enableKeyboard.bind(this)),this.psv.addEventListener("click",this._enableKeyboard.bind(this));for(let at of this.grid.childNodes)"bg"===at.getAttribute("slot")||lu.includes(at.tagName.toLowerCase())||(at.addEventListener("focusin",this._disableKeyboard.bind(this)),at.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&this._enableKeyboard()})))}_psvShouldGoFast(){return this.psv._sequencePlaying&&this.psv.getTransitionDuration()<1e3}_moveChildToGrid(){Array.from(this.querySelectorAll("[slot]")).forEach((at=>{var st;null!==(st=at.tagName)&&void 0!==st&&st.toLowerCase().startsWith("pnx-")&&(at._parent=this,at._t=this._t),"editors"===at.getAttribute("slot")?this.onceReady().then((()=>{var st;return null===(st=this.legend)||void 0===st?void 0:st.appendChild(at)})):this.grid.appendChild(at)}))}setPopup(at){let st=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;at?this.popup.setAttribute("visible",""):this.popup.removeAttribute("visible"),this.popup.innerHTML="","string"===typeof st?this.popup.innerHTML=st:Array.isArray(st)&&st.forEach((at=>this.popup.appendChild(at)))}_onPopupClose(){this.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:this.map&&this.isMapWide()?"map":"pic"}}))}_showQualityScoreDoc(){this.setPopup(!0,[(0,oc.createWebComp)("pnx-quality-score-doc",{_t:this._t})])}_showReportForm(){if(!this.psv.getPictureMetadata())throw new Error("No picture currently selected");this.setPopup(!0,[(0,oc.createWebComp)("pnx-report-form",{_parent:this})])}_showShareOptions(){this.setPopup(!0,[(0,oc.createWebComp)("pnx-share-menu",{_parent:this})])}moveCenter(){this.psv.getPictureMetadata()&&this._psvAnimate({speed:sc.LM,yaw:0,pitch:0,zoom:sc.cS})}moveLeft(){this._moveToDirection("left")}moveRight(){this._moveToDirection("right")}moveUp(){this._moveToDirection("up")}moveDown(){this._moveToDirection("down")}_moveToDirection(at){let st=this.psv.getPosition();switch(at){case"up":st.pitch+=su;break;case"left":st.yaw-=su;break;case"down":st.pitch-=su;break;case"right":st.yaw+=su}this._psvAnimate({speed:sc.LM,...st})}_psvAnimate(at){this._lastPsvAnim&&this._lastPsvAnim.cancel(),this._lastPsvAnim=this.psv.animate(at)}addEventListener(at,st,ot){super.addEventListener(at,st,ot)}}PhotoViewer.properties={"psv-options":{converter:rc.A.GetJSONConverter()},widgets:{type:String},"url-parameters":{type:String},"keyboard-shortcuts":{type:String},tabindex:{type:Number},...rc.A.properties},customElements.define("pnx-photo-viewer",PhotoViewer)},8743:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>Viewer});ot(9616);var ut=ot(8340),Hl=ot(3407),rc=ot(2771),sc=ot(7343),oc=ot(5995),_c=ot(9683),wc=ot(2e3),Sc=ot(9438),iu=ot(2118);const su=100;class Viewer extends Hl.Ay{constructor(){super(),this["map-options"]=!0,this.geocoder=this.getAttribute("geocoder")||"nominatim",this.mini=(0,oc.createWebComp)("pnx-mini",{slot:"bottom-left",_parent:this,onexpand:this._onMiniExpand.bind(this),collapsed:!!(0,sc.isNullId)(this.picture)||void 0}),this.mini.addEventListener("expand",this._toggleFocus.bind(this)),this.grid.appendChild(this.mini),this.mapContainer=document.createElement("div"),this.tabindex=0}_createInitParamsHandler(){var at,st;this._initParams=new iu.Ay(iu.Ay.GetComponentProperties(Viewer,this),Object.assign({},null===(at=this.urlHandler)||void 0===at?void 0:at.currentURLParams(),null===(st=this.urlHandler)||void 0===st?void 0:st.currentURLParams(!0)),{map:(0,ut.getMapParamsFromLocalStorage)()})}_initWidgets(){var at,st;"false"!==this._initParams.getParentPostInit().widgets&&(this.grid.appendChild((0,oc.createWebComp)("pnx-widget-zoom",{slot:this.isWidthSmall()?"top-left":"bottom-right",class:this.isWidthSmall()?"pnx-only-map pnx-print-hidden":"pnx-print-hidden",_parent:this})),(0,sc.isInIframe)()?(this.legend=(0,oc.createWebComp)("pnx-widget-legend",{slot:"bottom-right",light:!0,_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild(this.legend)):this.isWidthSmall()?(this.legend=(0,oc.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,oc.createWebComp)("pnx-bottom-drawer",{slot:"bottom",_parent:this,class:this._initParams.getParentPostInit().picture?void 0:"pnx-hidden"}),this.bottomDrawer.appendChild(this.legend),this.grid.appendChild(this.bottomDrawer),this.addEventListener("select",(at=>{(0,sc.isNullId)(at.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,oc.createWebComp)("pnx-widget-legend",{slot:this.isWidthSmall()?"top":"top-left",_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this._miniPicLegend=(0,oc.createWebComp)("pnx-mini-picture-legend",{_parent:this}),this.grid.appendChild(this.legend)),(0,sc.isInIframe)()||(this.grid.appendChild((0,oc.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,oc.createWebComp)("pnx-annotations-switch",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,oc.createWebComp)("pnx-widget-geosearch",{slot:this.isWidthSmall()?"top-right":"top-left",_parent:this,class:"pnx-only-map pnx-print-hidden",geocoder:this._initParams.getParentPostInit().geocoder})),this.grid.appendChild((0,oc.createWebComp)("pnx-widget-mapfilters",{slot:this.isWidthSmall()?"top-right":"top-left",_parent:this,"user-search":null!==this.api._endpoints.user_search&&null!==this.api._endpoints.user_tiles,"quality-score":(null===(at=this.map)||void 0===at||null===(st=at._hasQualityScore)||void 0===st?void 0:st.call(at))||!1,class:"pnx-only-map pnx-print-hidden"})),this.grid.appendChild((0,oc.createWebComp)("pnx-widget-maplayers",{slot:"top-right",_parent:this,class:"pnx-only-map pnx-print-hidden"}))))}disconnectedCallback(){var at;super.disconnectedCallback(),null===(at=this.map)||void 0===at||at.destroy()}getClassName(){return"Viewer"}getSubComponentsNames(){return super.getSubComponentsNames().concat(["mini","map"])}onceReady(){return Promise.all([this.oncePSVReady(),this.onceMapReady()]).then((()=>this._initParams.getParentPostInit().picture&&!this.psv.getPictureMetadata()?this.onceFirstPicLoaded():Promise.resolve()))}attributeChangedCallback(at,st,ot){var ut,Hl,rc,oc;(super.attributeChangedCallback(at,st,ot),"picture"===at)&&(null===(ut=this.legend)||void 0===ut||null===(Hl=ut.setAttribute)||void 0===Hl||Hl.call(ut,"picture",ot),(0,sc.isNullId)(st)&&!(0,sc.isNullId)(ot)&&this.mini.removeAttribute("collapsed"),(0,sc.isNullId)(ot)?this.map&&this.isMapWide()?this.mini.classList.add("pnx-hidden"):this.map&&!this.isMapWide()&&this._setFocus("map"):(this.mini.classList.remove("pnx-hidden"),(0,sc.isNullId)(st)&&(this._setFocus("pic"),"closed"===(null===(rc=this.bottomDrawer)||void 0===rc||null===(oc=rc.getAttribute)||void 0===oc?void 0:oc.call(rc,"openness"))&&this.bottomDrawer.setAttribute("openness","half-opened"))));"focus"===at&&this._setFocus(ot)}onceMapReady(){if(!this.map)return Promise.resolve();let at;return new Promise((st=>{at=setInterval((()=>{var ot,ut,Hl;"object"===typeof this.map&&(null!==(ot=this.map)&&void 0!==ot&&null!==(ut=ot.loaded)&&void 0!==ut&&ut.call(ot)?(clearInterval(at),st()):null!==(Hl=this.map)&&void 0!==Hl&&Hl.once&&this.map.once("render",(()=>{clearInterval(at),st()})))}),250)}))}async _initMap(){await new Promise((at=>{this.map=new rc.A(this,this.mapContainer,this._initParams.getMapInit()),(0,ut.saveMapParamsToLocalStorage)(this.map),this.map.once("users-changed",(()=>{this.loader.setAttribute("value",75),at()}))})),await(0,iu.mK)(this.map,this._initParams.getMapPostInit()),(0,ut.initMapKeyboardHandler)(this),(0,ut.linkMapAndPhoto)(this)}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const at=this._initParams.getParentPostInit();this._initPSV(),await this._initMap(),this._initWidgets(),this._moveChildToGrid(),(0,iu.iz)(this,at),at.keyboardShortcuts&&this._handleKeyboardManagement(),at.picture?this.psv.addEventListener("picture-loaded",(()=>{(0,iu.iz)(this,at),this.loader.dismiss()}),{once:!0}):this.loader.dismiss()}_enableKeyboard(){this.map&&this.isMapWide()?this._enableKeyboardMap():this._enableKeyboardPSV()}_enableKeyboardMap(){this.psv.stopKeyboardControl(),this.map.keyboard.enable()}_enableKeyboardPSV(){this.psv.startKeyboardControl(),this.map.keyboard.disable()}_disableKeyboard(){this.psv.stopKeyboardControl(),this.map.keyboard.disable()}_toggleKeyboardBasedOnFocus(at){const st=(null===at||void 0===at?void 0:at.target)||document.activeElement;if(this.contains(st)){for(let at of this.grid.childNodes)if("bg"!==at.getAttribute("slot")&&!Hl.RD.includes(at.tagName.toLowerCase())&&at.contains(st))return void this._disableKeyboard();this._enableKeyboard()}else this._disableKeyboard()}_handleKeyboardManagement(){window.addEventListener("click",(at=>this._toggleKeyboardBasedOnFocus(at))),window.addEventListener("keypress",this._toggleKeyboardBasedOnFocus.bind(this)),this.addEventListener("focus-changed",(at=>{this.popup.getAttribute("visible")?this._disableKeyboard():"map"===at.detail.focus?this._enableKeyboardMap():this._enableKeyboardPSV()})),this.popup.addEventListener("open",this._disableKeyboard.bind(this)),this.popup.addEventListener("close",this._enableKeyboard.bind(this)),this.psv.addEventListener("click",this._enableKeyboardPSV.bind(this));for(let at of this.grid.childNodes)"bg"===at.getAttribute("slot")||Hl.RD.includes(at.tagName.toLowerCase())||(at.addEventListener("focusin",this._disableKeyboard.bind(this)),at.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&this._enableKeyboard()})))}moveCenter(){const at=this.psv.getPictureMetadata();at&&(this.map&&this.isMapWide()?this.map.flyTo({center:at.gps,zoom:20}):super.moveCenter())}_moveToDirection(at){if(this.map&&this.isMapWide()){let st;switch(at){case"up":st=[0,-100];break;case"left":st=[-100,0];break;case"down":st=[0,su];break;case"right":st=[su,0]}this.map.panBy(st)}else super._moveToDirection(at)}isMapWide(){return this.mapContainer.parentNode==this.grid}_setFocus(at){var st,ot,ut,Hl;let rc=arguments.length>1&&void 0!==arguments[1]&&arguments[1],Sc=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("map"===at&&!this.map)throw new Error("Map is not enabled");if(!["map","pic"].includes(at))throw new Error("Invalid focus value (should be pic or map)");if(this.focus=at,(Sc||("map"!==at||!this.map||!this.isMapWide())&&("pic"!==at||this.map&&this.isMapWide()))&&("map"===at?(this.psvContainer.parentNode==this.grid&&(this.grid.removeChild(this.psvContainer),this.psvContainer.removeAttribute("slot")),this.mapContainer.parentNode==this.mini&&this.mini.removeChild(this.mapContainer),this.mapContainer.setAttribute("slot","bg"),this.grid.appendChild(this.mapContainer),this.mini.appendChild(this.psvContainer),this.mini.icon=(0,oc.fa)(_c.pt),this._miniPicLegend&&this.mini.appendChild(this._miniPicLegend),(0,sc.isNullId)(this.picture)?this.mini.classList.add("pnx-hidden"):this.mini.classList.remove("pnx-hidden"),this.map.getCanvas().focus()):(this.mapContainer.parentNode==this.grid&&(this.grid.removeChild(this.mapContainer),this.mapContainer.removeAttribute("slot")),this.psvContainer.parentNode==this.mini&&(this.mini.removeChild(this.psvContainer),this._miniPicLegend&&this.mini.removeChild(this._miniPicLegend)),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.mini.classList.remove("pnx-hidden"),this.mini.appendChild(this.mapContainer),this.mini.icon=(0,oc.fa)(wc.e5),this.psvContainer.focus()),null===this||void 0===this||null===(st=this.map)||void 0===st||null===(ot=st.resize)||void 0===ot||ot.call(st),this.psv.autoSize(),this.psv.forceRefresh(),null===(ut=this.legend)||void 0===ut||null===(Hl=ut.setAttribute)||void 0===Hl||Hl.call(ut,"focus",this.focus),!rc)){const st=new CustomEvent("focus-changed",{detail:{focus:at}});this.dispatchEvent(st)}}_toggleFocus(){this._setFocus(this.isMapWide()?"pic":"map")}_onMiniExpand(){this.map.resize(),this.psv.autoSize()}_onMapFiltersChange(){var at;const st=(0,Sc.qi)("#pnx-map-filters-menu"),ot=(0,Sc.qi)("#pnx-map-theme"),Hl=(0,ut.mapFiltersFormValues)(st,ot,null===(at=this.map)||void 0===at?void 0:at._hasQualityScore());this.map.setFilters(Hl)}}Viewer.properties={"map-options":{converter:Hl.Ay.GetJSONConverter()},focus:{type:String,reflect:!0},geocoder:{type:String},tabindex:{type:Number},...Hl.Ay.properties},customElements.define("pnx-viewer",Viewer)},3921:(at,st,ot)=>{"use strict";ot.r(st),ot.d(st,{Basic:()=>ut.A,CoverageMap:()=>Hl.A,Editor:()=>rc.A,PhotoViewer:()=>oc.Ay,Viewer:()=>sc.A});var ut=ot(9039),Hl=ot(153),rc=ot(1752),sc=ot(8743),oc=ot(3407)},9341:(at,st,ot)=>{"use strict";ot.r(st),ot.d(st,{core:()=>ut,layout:()=>Hl,menus:()=>rc,ui:()=>sc});var ut=ot(3921),Hl=ot(456),rc=ot(8794),sc=ot(9472)},6784:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>BottomDrawer});var ut=ot(4542),Hl=ot(1198),rc=ot(5995);const sc={opened:0,"half-opened":.7,closed:1};class BottomDrawer extends ut.WF{constructor(){super(),this._isDragging=!1,this.openness="half-opened"}firstUpdated(){super.firstUpdated(),this._boundTouchMove=this._onTouchMove.bind(this),this._boundTouchEnd=this._onTouchEnd.bind(this),this._drawerHeight=window.innerHeight-30;const at=this._getDrawer();at&&(at.style.height=`${this._drawerHeight}px`,at.style.maxHeight=`${this._drawerHeight}px`,(0,rc.onceParentAvailable)(this).then((()=>this._parent.onceReady())).then((()=>{var at,st;null===(at=this._parent.map)||void 0===at||at.addEventListener("click",(()=>this.openness="closed")),null===(st=this._parent.psv)||void 0===st||st.addEventListener("click",(()=>this.openness="closed"))})))}attributeChangedCallback(at,st,ot){if(super.attributeChangedCallback(at,st,ot),"openness"===at){if("opened"!==ot){const at=this.shadowRoot.querySelector(".content");at&&(at.scrollTop=0)}const at=this._getDrawer();at&&(at.style.transform=null)}}disconnectedCallback(){super.disconnectedCallback(),this._cleanupTouchListeners()}_getDrawer(){var at;return null===(at=this.shadowRoot)||void 0===at?void 0:at.querySelector(".drawer")}_onHandleClick(){"opened"===this.openness?this.openness="closed":"half-opened"===this.openness?this.openness="opened":"closed"===this.openness&&(this.openness="half-opened")}_onTouchStart(at){this._isDragging=!0,this._startFingerY=at.touches[0].clientY,this._deltaFingerY=0,this._drawerY=this._drawerHeight*sc[this.openness],window.addEventListener("touchmove",this._boundTouchMove,{passive:!0}),window.addEventListener("touchend",this._boundTouchEnd),window.addEventListener("touchcancel",this._boundTouchEnd)}_onTouchMove(at){if(!this._isDragging)return;const st=this.shadowRoot.querySelector(".content");st.scrollHeight>st.offsetHeight&&st.scrollTop>0?this._updateDrawerTransform(0):(this._deltaFingerY=at.touches[0].clientY-this._startFingerY,this._updateDrawerTransform(this._drawerY+this._deltaFingerY))}_onTouchEnd(at){(this._isDragging&&!(Math.abs(this._deltaFingerY)<30)||at.target.closest(".handle"))&&(at.preventDefault(),this._isDragging=!1,0===this._deltaFingerY&&"closed"===this.openness?this.openness="half-opened":this._updateDrawerTransform(this._drawerY+this._deltaFingerY,!0),this._cleanupTouchListeners(),this._startFingerY=null,this._deltaFingerY=null)}_cleanupTouchListeners(){window.removeEventListener("touchmove",this._boundTouchMove),window.removeEventListener("touchend",this._boundTouchEnd),window.removeEventListener("touchcancel",this._boundTouchCancel)}_updateDrawerTransform(at){let st=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const ot=this._getDrawer();ot&&(at=Math.max(0,Math.min(at,this._drawerHeight-30)),st&&(this._deltaFingerY<0?"closed"===this.openness?Math.abs(this._deltaFingerY)>this._drawerHeight*(1-sc["half-opened"])?this.openness="opened":this.openness="half-opened":this.openness="opened":this.openness="closed",this._drawerY=null,at=Math.max(0,Math.min(sc[this.openness]*this._drawerHeight,this._drawerHeight-30))),ot.style.transform=`translateY(${at}px)`)}render(){const at={drawer:!0,[this.openness]:!0,dragging:this._isDragging};return ut.qy`
12
+ !function(at,st){"object"===typeof exports&&"object"===typeof module?module.exports=st():"function"===typeof define&&define.amd?define("Panoramax",[],st):"object"===typeof exports?exports.Panoramax=st():at.Panoramax=st()}(this,(()=>(()=>{var at={9039:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>Basic});var ut=ot(4542),Hl=ot(5254),rc=ot(4964),sc=ot(7208),oc=ot(5995),_c=ot(7343),wc=ot(2614),Sc=ot.n(wc),iu=ot(8330);ot(1865),ot(3638);class Basic extends ut.WF{constructor(){let at=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.users=["geovisio"],this["map-style"]=this.getAttribute("map-style")||(0,sc.MapTiles)(),this.lang=this.getAttribute("lang")||null,this.endpoint=this.getAttribute("endpoint")||null,this.picture=this.getAttribute("picture")||null,this.sequence=this.getAttribute("sequence")||null,console.info(`\ud83d\udcf7 Panoramax ${this.getClassName()} - Version ${iu.rE} (5ce55f3)\n\n\ud83c\udd98 Issues can be reported at ${iu.Jk.O}`),at||(this._isInternetFast=null,(0,_c.isInternetFast)().then((at=>this._isInternetFast=at)))}connectedCallback(){super.connectedCallback(),this._t=(0,rc.getTranslations)(this.lang),this.loader=(0,oc.createWebComp)("pnx-loader",{_parent:this,"no-label":(0,_c.isInIframe)()}),this._loadsAPI&&this.endpoint&&this._loadsAPI===this.endpoint||this.api&&this.api._endpoint===this.endpoint||!this.endpoint||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI()),Object.entries({map:"map-options",psv:"psv-options",fetchOptions:"fetch-options",mapstyle:"map-style"}).forEach((at=>{let[st,ot]=at;this.getAttribute(st)&&console.error(`Component attribute "${st}" has been renamed into "${ot}". Old attribute "${st}" is ignored.`)}))}_setupAPI(){if(this.loader=this.loader||(0,oc.createWebComp)("pnx-loader",{_parent:this}),!this.endpoint)return void console.warn("No endpoint is defined");this._loadsAPI=this.endpoint;let at=this.endpoint;try{this["map-style"]=JSON.parse(this["map-style"])}catch(ot){}try{this.api=new Hl.A(this.endpoint,{users:this.users,fetch:this["fetch-options"],style:this["map-style"]}),this.api.onceReady().then((()=>{if(at!=this._loadsAPI||!this.api)return;let st=this.api.getUnavailableFeatures(),ot=this.api.getAvailableFeatures();ot=0===st.length?"\u2705 All features available":"\u2705 Available features: "+ot.join(", "),st=0===st.length?"":"\ud83d\udeab Unavailable features: "+st.join(", "),console.info(`\ud83c\udf10 Connected to API "${this.api._metadata.name}" (${this.api._endpoint})\n\u2139\ufe0f API runs STAC ${this.api._metadata.stac_version} ${this.api._metadata.geovisio_version?"& GeoVisio "+this.api._metadata.geovisio_version:""}\n ${ot}\n ${st}\n`.trim())})).catch((at=>this.loader.dismiss(at,this._t.pnx.error_api))).finally((()=>delete this._loadsAPI))}catch(ot){var st;delete this._loadsAPI,null!==(st=this.loader)&&void 0!==st&&st.dismiss?this.loader.dismiss(ot,this._t.pnx.error_api):console.error(ot)}}onceReady(){throw new Error("You must override this method on sub-class")}onceAPIReady(){return this.api?this.api.onceReady():new Promise((at=>setTimeout(at,100))).then(this.onceAPIReady.bind(this))}createRenderRoot(){return this}attributeChangedCallback(at,st,ot){if(super.attributeChangedCallback(at,st,ot),"endpoint"===at&&(this._loadsAPI&&ot&&this._loadsAPI===ot||this.api&&this.api._endpoint===ot||!ot||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())),["picture","sequence"].includes(at)){let ut,Hl,rc,sc;"picture"===at?(ut=this.sequence,rc=this.sequence,Hl=ot,sc=st):(ut=ot,rc=st,Hl=this.picture,sc=this.picture),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{seqId:ut,picId:Hl,prevSeqId:rc,prevPicId:sc}}))}}getClassName(){return"Basic"}select(){let at=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,st=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&(this.picture=null,this.sequence=null),this.picture=st,this.sequence=at}isWidthSmall(){return(null===this||void 0===this?void 0:this.offsetWidth)<576}isHeightSmall(){return(null===this||void 0===this?void 0:this.offsetHeight)<400}render(){return ut.qy`<p>Should not be used directly, use Viewer/CoverageMap/Editor instead</p>`}getSubComponentsNames(){return["loader","api"]}addEventListener(at,st,ot){let ut=at.split(":").shift();if(ut&&this.getSubComponentsNames().includes(ut)){var Hl;const rc=at.substring(ut.length+1);null!==(Hl=this[ut])&&void 0!==Hl&&Hl.addEventListener?this[ut].addEventListener(rc,st,ot):setTimeout((()=>this.addEventListener(at,st,ot)),50)}else super.addEventListener(at,st,ot)}static GetJSONConverter(){return{fromAttribute:at=>null===at||""===at?null:"object"===typeof at||Array.isArray(at)?at:Sc().parse(at),toAttribute:at=>null===at||""===at?"":"string"===typeof at?at:Sc().stringify(at)}}}Basic.properties={picture:{type:String,reflect:!0},sequence:{type:String,reflect:!0},"fetch-options":{converter:Basic.GetJSONConverter()},users:{type:Array,reflect:!0},"map-style":{type:String},lang:{type:String},endpoint:{type:String}}},153:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>CoverageMap});var ut=ot(9039),Hl=ot(5642),rc=ot(8340),sc=ot(927),oc=(ot(7776),ot(2118));class CoverageMap extends ut.A{constructor(){super(),this._mapContainer=document.createElement("div"),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this._initParams=new oc.Ay(oc.Ay.GetComponentProperties(CoverageMap,this)),this._initMap()}))}disconnectedCallback(){var at;super.disconnectedCallback(),null===(at=this.map)||void 0===at||at.destroy()}getClassName(){return"CoverageMap"}onceReady(){return this.map&&this.map.waitForEnoughMapLoaded?this.map.waitForEnoughMapLoaded():new Promise((at=>setTimeout(at,100))).then(this.onceReady.bind(this))}render(){return[this.loader,this._mapContainer]}getSubComponentsNames(){const at=super.getSubComponentsNames();return at.push("map"),at}_initMap(){class MyMap extends Hl.A{_getLayerStyleProperties(at){return"pictures_symbols"===at?{layout:{visibility:"none"}}:super._getLayerStyleProperties(at)}}this.map=new MyMap(this,this._mapContainer,Object.assign({},this._initParams.getMapInit(),{hash:!0})),this.map.addControl(new sc.NavigationControl({showCompass:!1})),this.loader.setAttribute("value",70),this.addEventListener("select",this._onSelect.bind(this)),this.map.on("picture-click",(at=>this.select(at.seqId,at.picId))),this.map.on("sequence-click",(at=>this.select(at.seqId))),this.map.waitForEnoughMapLoaded().then((async()=>{await(0,oc.mK)(this.map,this._initParams.getMapPostInit()),this.map.reloadLayersStyles(),this.loader.dismiss()}))}_onSelect(at){if(at.detail.picId||at.detail.seqId){const st=at.detail.picId?"pictures":"sequences",ot=this.map.queryRenderedFeatures({layers:[...this.map._userLayers].map((at=>(0,rc.getUserLayerId)(at,st))),filter:["==",["get","id"],at.detail.picId||at.detail.seqId]});ot.length>=0&&null!=ot[0]&&this.map._attachPreviewToPictures({features:ot},st)}}}CoverageMap.properties={"map-options":{converter:ut.A.GetJSONConverter()},...ut.A.properties},customElements.define("pnx-coverage-map",CoverageMap)},1752:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>Editor});ot(7365);var ut=ot(9039),Hl=ot(5642),rc=ot(9048),sc=ot(508),oc=ot(8340),_c=ot(1545),wc=ot(5995);const Sc="sequence-headings";class Editor extends ut.A{constructor(){super(),this.raster=null,this.background="streets",this.users=[],this._psvContainer=document.createElement("div"),this._psvContainer.setAttribute("slot","bg"),this._mapContainer=document.createElement("div"),this._mapContainer.setAttribute("slot","bg"),this.grid=(0,wc.createWebComp)("pnx-cornered-grid"),this.grid.appendChild(this._psvContainer),this.grid.appendChild(this._mapContainer),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this.sequence||this.loader.dismiss({},"No sequence is selected"),this.addEventListener("select",this._onSelect.bind(this)),this._initPSV(),this._initMap()}))}disconnectedCallback(){var at,st;super.disconnectedCallback(),null===(at=this.map)||void 0===at||at.destroy(),null===(st=this.psv)||void 0===st||st.destroy()}getClassName(){return"Editor"}onceReady(){var at,st;return this.map&&this.psv&&null!==(at=(st=this.map).loaded)&&void 0!==at&&at.call(st)?Promise.resolve():new Promise((at=>setTimeout(at,100))).then(this.onceReady.bind(this))}connectedCallback(){Array.isArray(this.users)&&this.users.length>0&&(console.warn("Parameters users can't be changed in Editor, only selected sequence can be visible"),this.users=[]),super.connectedCallback(),this._moveChildToGrid(),window.addEventListener("DOMContentLoaded",(()=>{this._moveChildToGrid()}),{once:!0})}attributeChangedCallback(at,st,ot){"users"===at&&Array.isArray(ot)&&ot.length>0?console.warn("Parameters users can't be changed in Editor, only selected sequence can be visible"):super.attributeChangedCallback(at,st,ot)}render(){return[this.loader,this.grid]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["map","psv","grid"])}_initPSV(){try{this.psv=new rc.Ay(this,this._psvContainer),this.psv._myVTour.datasource.nodeResolver=this._getNode.bind(this)}catch(at){let st=_c.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(at,st)}}_initMap(){try{this.map=new Hl.A(this,this._mapContainer,{raster:this.raster,background:this.background,supplementaryStyle:this._createMapStyle(),zoom:15,picMarkerDraggable:!0}),(0,oc.linkMapAndPhoto)(this),this.loader.setAttribute("value",50),this._loadSequence(),this.map.once("load",(()=>{this.map.hasTwoBackgrounds()&&this._addMapBackgroundWidget(),this._bindPicturesEvents()}));const at=this.map._picMarker.setRotation.bind(this.map._picMarker);this.map._picMarker.setRotation=st=>(st=void 0===this._lastRelHeading?st:st+this._lastRelHeading-this.psv.getPictureRelativeHeading(),at(st))}catch(at){this.loader.dismiss(at,this._t.pnx.error_psv)}}_createMapStyle(){return{sources:{geovisio_editor_sequences:{type:"geojson",data:{type:"FeatureCollection",features:[]}}},layers:[{id:"geovisio_editor_sequences",type:"line",source:"geovisio_editor_sequences",layout:{...oc.VECTOR_STYLES.SEQUENCES.layout},paint:{...oc.VECTOR_STYLES.SEQUENCES.paint}},{id:"geovisio_editor_pictures",type:"circle",source:"geovisio_editor_sequences",layout:{...oc.VECTOR_STYLES.PICTURES.layout},paint:{...oc.VECTOR_STYLES.PICTURES.paint}}]}}_bindPicturesEvents(){this.map.on("mousemove","geovisio_editor_pictures",(()=>{this.map.getCanvas().style.cursor="pointer"})),this.map.on("mouseleave","geovisio_editor_pictures",(()=>{this.map.getCanvas().style.cursor=""})),this.map.on("click","geovisio_editor_pictures",this.map._onPictureClick.bind(this.map))}_loadSequence(){return this.loader.setAttribute("value",60),this.api.getSequenceItems(this.sequence).then((at=>{if(this.loader.setAttribute("value",80),this.map.once("sourcedata",(()=>{this.map.setPaintProperty("geovisio_editor_sequences","line-color",this.map._getLayerColorStyle("sequences")),this.map.setPaintProperty("geovisio_editor_pictures","circle-color",this.map._getLayerColorStyle("pictures")),this.map.setLayoutProperty("geovisio_editor_sequences","visibility","visible"),this.map.setLayoutProperty("geovisio_editor_pictures","visibility","visible"),this.map.once("styledata",(()=>this.loader.dismiss()))})),this._sequenceData=at.features,this.map.getSource("geovisio_editor_sequences").setData({type:"FeatureCollection",features:[{id:this.sequence,type:"Feature",properties:{id:this.sequence},geometry:{type:"LineString",coordinates:at.features.map((at=>at.geometry.coordinates))}},...at.features.map((at=>(at.properties.id=at.id,at.properties.sequences=[this.sequence],at)))]}),this.picture){const st=at.features.find((at=>at.id===this.picture));st?(this.select(this.sequence,this.picture,!0),this.map.jumpTo({center:st.geometry.coordinates,zoom:18})):console.log("Picture with ID",st,"was not found")}else{const st=[...at.features[0].geometry.coordinates,...at.features[0].geometry.coordinates];for(let ot=1;ot<at.features.length;ot++){const ut=at.features[ot].geometry.coordinates;ut[0]<st[0]&&(st[0]=ut[0]),ut[1]<st[1]&&(st[1]=ut[1]),ut[0]>st[2]&&(st[2]=ut[0]),ut[1]>st[3]&&(st[3]=ut[1])}this.map.fitBounds(st,{animate:!1})}})).catch((at=>this.loader.dismiss(at,this._t.pnx.error_api)))}_getNode(at){const st=this._sequenceData.find((st=>st.properties.id===at)),ot=st?(0,sc.apiFeatureToPSVNode)(st,this._t,this._isInternetFast,void 0,(at=>this.api.cleanResourceURL(at))):null;return ot&&delete ot.links,ot}_addMapBackgroundWidget(){const at=(0,wc.createWebComp)("pnx-map-background",{_parent:this,size:"sm",slot:"bottom-left"});this.grid.appendChild(at)}_moveChildToGrid(){Array.from(this.querySelectorAll("[slot]")).forEach((at=>{var st;null!==(st=at.tagName)&&void 0!==st&&st.toLowerCase().startsWith("pnx-")&&(at._parent=this,at._t=this._t),this.grid.appendChild(at)}))}previewSequenceHeadingChange(at){const st=void 0!==this.map.getLayer(Sc);if(this.map._picMarkerPreview.remove(),void 0===at)return delete this._lastRelHeading,st&&this.map.setLayoutProperty(Sc,"visibility","none"),void(this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x));this._lastRelHeading=at,st||this.map.addLayer({id:Sc,type:"symbol",source:"geovisio_editor_sequences",layout:{"icon-image":"pnx-marker","icon-overlap":"always","icon-size":.8}});const ot=-this.psv.getPictureRelativeHeading();this.map.setLayoutProperty(Sc,"visibility","visible"),this.map.setLayoutProperty(Sc,"icon-rotate",["+",["get","view:azimuth"],ot,at]);const ut=[["==",["geometry-type"],"Point"]];this.picture&&ut.push(["!=",["get","id"],this.picture]),this.map.setFilter(Sc,["all",...ut]),this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x)}_onSelect(){void 0!==this._lastRelHeading&&this.previewSequenceHeadingChange(this._lastRelHeading)}}Editor.properties={raster:{converter:ut.A.GetJSONConverter()},background:{type:String},...ut.A.properties},customElements.define("pnx-editor",Editor)},3407:(at,st,ot)=>{"use strict";ot.d(st,{$p:()=>iu,Ay:()=>PhotoViewer,RD:()=>lu});ot(970);var ut=ot(1545),Hl=ot(4451),rc=ot(9039),sc=ot(9048),oc=ot(5995),_c=ot(7343),wc=ot(2118),Sc=ot(4207);const iu=20,su=Math.PI/6,lu=["pnx-mini","pnx-widget-player","pnx-widget-zoom"];class PhotoViewer extends rc.A{constructor(){super(),this["psv-options"]={},this["url-parameters"]=this.getAttribute("url-parameters")||!0,this["keyboard-shortcuts"]=this.getAttribute("keyboard-shortcuts")||!0,this.widgets=this.getAttribute("widgets")||"true",this.grid=(0,oc.createWebComp)("pnx-cornered-grid"),this.psvContainer=document.createElement("div"),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.popup=(0,oc.createWebComp)("pnx-popup",{_parent:this,onclose:this._onPopupClose.bind(this)}),this.tabindex=0}_createInitParamsHandler(){var at,st;this._initParams=new wc.Ay(wc.Ay.GetComponentProperties(PhotoViewer,this),Object.assign({},null===(at=this.urlHandler)||void 0===at?void 0:at.currentURLParams(),null===(st=this.urlHandler)||void 0===st?void 0:st.currentURLParams(!0)),{})}_initWidgets(){"false"!==this._initParams.getParentPostInit().widgets&&((0,_c.isInIframe)()||(this.grid.appendChild((0,oc.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,oc.createWebComp)("pnx-annotations-switch",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"}))),(0,_c.isInIframe)()?(this.legend=(0,oc.createWebComp)("pnx-widget-legend",{slot:"bottom-right",light:!0,_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild(this.legend)):this.isWidthSmall()?(this.legend=(0,oc.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,oc.createWebComp)("pnx-bottom-drawer",{slot:"bottom",_parent:this,class:this._initParams.getParentPostInit().picture?void 0:"pnx-hidden"}),this.bottomDrawer.appendChild(this.legend),this.grid.appendChild(this.bottomDrawer),this.addEventListener("select",(at=>{(0,_c.isNullId)(at.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,oc.createWebComp)("pnx-widget-legend",{slot:this.isWidthSmall()?void 0:"top-left",_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild((0,oc.createWebComp)("pnx-widget-zoom",{slot:"bottom-right",class:"pnx-print-hidden",_parent:this})),this.grid.appendChild(this.legend)))}connectedCallback(){super.connectedCallback(),this.presetsManager=new Sc.A(this.lang),this["url-parameters"]&&"false"!==this["url-parameters"]&&(this.urlHandler=new Hl.A(this),this.onceReady().then((()=>{this.urlHandler.listenToChanges(),this.urlHandler._onParentChange()}))),this.onceAPIReady().then(this._postAPIInit.bind(this)),this._moveChildToGrid(),window.addEventListener("DOMContentLoaded",(()=>{this._moveChildToGrid()}),{once:!0})}disconnectedCallback(){var at,st;super.disconnectedCallback(),null===(at=this.urlHandler)||void 0===at||at.destroy(),null===(st=this.psv)||void 0===st||st.destroy(),document.body.removeEventListener("click",this._toggleKeyboardBasedOnFocus),window.removeEventListener("keypress",this._toggleKeyboardBasedOnFocus)}getClassName(){return"PhotoViewer"}onceReady(){return this.oncePSVReady().then((()=>this._initParams.getParentPostInit().picture&&!this.psv.getPictureMetadata()?this.onceFirstPicLoaded():Promise.resolve()))}render(){return[this.loader,this.grid,this.popup]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["psv","grid","popup","urlHandler"])}oncePSVReady(){let at;return new Promise((st=>{at=setInterval((()=>{this.psv&&"object"===typeof this.psv&&(this.psv.container?(clearInterval(at),st()):this.psv.addEventListener&&this.psv.addEventListener("ready",(()=>{clearInterval(at),st()}),{once:!0}))}),250)}))}onceFirstPicLoaded(){return this.oncePSVReady().then((()=>this.psv.getPictureMetadata()?Promise.resolve():new Promise((at=>{this.psv.addEventListener("picture-loaded",at,{once:!0})}))))}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const at=this._initParams.getParentPostInit();this._initPSV(),this._initWidgets(),(0,wc.ai)(this,at),at.keyboardShortcuts&&this._handleKeyboardManagement(),at.picture?this.psv.addEventListener("picture-loaded",(()=>this.loader.dismiss()),{once:!0}):this.loader.dismiss()}_initPSV(){try{this.psv=new sc.Ay(this,this.psvContainer,{shouldGoFast:this._psvShouldGoFast.bind(this),keyboard:"always",keyboardActions:{...ut.zY.keyboardActions,8:"ROTATE_UP",2:"ROTATE_DOWN",4:"ROTATE_LEFT",6:"ROTATE_RIGHT",PageUp:()=>this.psv.goToNextPicture(),9:()=>this.psv.goToNextPicture(),PageDown:()=>this.psv.goToPrevPicture(),3:()=>this.psv.goToPrevPicture(),5:()=>this.moveCenter(),"*":()=>this.moveCenter(),Home:()=>{var at;return null===(at=this._toggleFocus)||void 0===at?void 0:at.call(this)},7:()=>{var at;return null===(at=this._toggleFocus)||void 0===at?void 0:at.call(this)},End:()=>this.mini.toggleAttribute("collapsed"),1:()=>this.mini.toggleAttribute("collapsed")," ":()=>this.psv.toggleSequencePlaying(),0:()=>this.psv.toggleSequencePlaying()},...this._initParams.getPSVInit()}),this.oncePSVReady().then((()=>{this.loader.setAttribute("value",50),(0,wc.Vy)(this.psv,this._initParams.getPSVPostInit())})),this.psv.addEventListener("sequence-playing",(()=>this.classList.add("pnx-playing"))),this.psv.addEventListener("sequence-stopped",(()=>this.classList.remove("pnx-playing")))}catch(at){let st=ut.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(at,st)}}_enableKeyboard(){this.psv.startKeyboardControl()}_disableKeyboard(){this.psv.stopKeyboardControl()}_toggleKeyboardBasedOnFocus(at){const st=(null===at||void 0===at?void 0:at.target)||document.activeElement;if(this.contains(st)){for(let at of this.grid.childNodes)if("bg"!==at.getAttribute("slot")&&!lu.includes(at.tagName.toLowerCase())&&at.contains(st))return void this._disableKeyboard();this._enableKeyboard()}else this._disableKeyboard()}_handleKeyboardManagement(){window.addEventListener("click",(at=>this._toggleKeyboardBasedOnFocus(at))),window.addEventListener("keypress",this._toggleKeyboardBasedOnFocus.bind(this)),this.popup.addEventListener("open",this._disableKeyboard.bind(this)),this.popup.addEventListener("close",this._enableKeyboard.bind(this)),this.psv.addEventListener("click",this._enableKeyboard.bind(this));for(let at of this.grid.childNodes)"bg"===at.getAttribute("slot")||lu.includes(at.tagName.toLowerCase())||(at.addEventListener("focusin",this._disableKeyboard.bind(this)),at.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&this._enableKeyboard()})))}_psvShouldGoFast(){return this.psv._sequencePlaying&&this.psv.getTransitionDuration()<1e3}_moveChildToGrid(){Array.from(this.querySelectorAll("[slot]")).forEach((at=>{var st;null!==(st=at.tagName)&&void 0!==st&&st.toLowerCase().startsWith("pnx-")&&(at._parent=this,at._t=this._t),"editors"===at.getAttribute("slot")?this.onceReady().then((()=>{var st;return null===(st=this.legend)||void 0===st?void 0:st.appendChild(at)})):this.grid.appendChild(at)}))}setPopup(at){let st=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;at?this.popup.setAttribute("visible",""):this.popup.removeAttribute("visible"),this.popup.innerHTML="","string"===typeof st?this.popup.innerHTML=st:Array.isArray(st)&&st.forEach((at=>this.popup.appendChild(at)))}_onPopupClose(){this.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:this.map&&this.isMapWide()?"map":"pic"}}))}_showQualityScoreDoc(){this.setPopup(!0,[(0,oc.createWebComp)("pnx-quality-score-doc",{_t:this._t})])}_showReportForm(){if(!this.psv.getPictureMetadata())throw new Error("No picture currently selected");this.setPopup(!0,[(0,oc.createWebComp)("pnx-report-form",{_parent:this})])}_showShareOptions(){this.setPopup(!0,[(0,oc.createWebComp)("pnx-share-menu",{_parent:this})])}moveCenter(){this.psv.getPictureMetadata()&&this._psvAnimate({speed:sc.LM,yaw:0,pitch:0,zoom:sc.cS})}moveLeft(){this._moveToDirection("left")}moveRight(){this._moveToDirection("right")}moveUp(){this._moveToDirection("up")}moveDown(){this._moveToDirection("down")}_moveToDirection(at){let st=this.psv.getPosition();switch(at){case"up":st.pitch+=su;break;case"left":st.yaw-=su;break;case"down":st.pitch-=su;break;case"right":st.yaw+=su}this._psvAnimate({speed:sc.LM,...st})}_psvAnimate(at){this._lastPsvAnim&&this._lastPsvAnim.cancel(),this._lastPsvAnim=this.psv.animate(at)}addEventListener(at,st,ot){super.addEventListener(at,st,ot)}}PhotoViewer.properties={"psv-options":{converter:rc.A.GetJSONConverter()},widgets:{type:String},"url-parameters":{type:String},"keyboard-shortcuts":{type:String},tabindex:{type:Number},...rc.A.properties},customElements.define("pnx-photo-viewer",PhotoViewer)},8743:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>Viewer});ot(9616);var ut=ot(8340),Hl=ot(3407),rc=ot(2771),sc=ot(7343),oc=ot(5995),_c=ot(9683),wc=ot(2e3),Sc=ot(9438),iu=ot(2118);const su=100;class Viewer extends Hl.Ay{constructor(){super(),this["map-options"]=!0,this.geocoder=this.getAttribute("geocoder")||"nominatim",this.mini=(0,oc.createWebComp)("pnx-mini",{slot:"bottom-left",_parent:this,onexpand:this._onMiniExpand.bind(this),collapsed:!!(0,sc.isNullId)(this.picture)||void 0}),this.mini.addEventListener("expand",this._toggleFocus.bind(this)),this.grid.appendChild(this.mini),this.mapContainer=document.createElement("div"),this.tabindex=0}_createInitParamsHandler(){var at,st;this._initParams=new iu.Ay(iu.Ay.GetComponentProperties(Viewer,this),Object.assign({},null===(at=this.urlHandler)||void 0===at?void 0:at.currentURLParams(),null===(st=this.urlHandler)||void 0===st?void 0:st.currentURLParams(!0)),{map:(0,ut.getMapParamsFromLocalStorage)()})}_initWidgets(){var at,st;"false"!==this._initParams.getParentPostInit().widgets&&(this.grid.appendChild((0,oc.createWebComp)("pnx-widget-zoom",{slot:this.isWidthSmall()?"top-left":"bottom-right",class:this.isWidthSmall()?"pnx-only-map pnx-print-hidden":"pnx-print-hidden",_parent:this})),(0,sc.isInIframe)()?(this.legend=(0,oc.createWebComp)("pnx-widget-legend",{slot:"bottom-right",light:!0,_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild(this.legend)):this.isWidthSmall()?(this.legend=(0,oc.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,oc.createWebComp)("pnx-bottom-drawer",{slot:"bottom",_parent:this,class:this._initParams.getParentPostInit().picture?void 0:"pnx-hidden"}),this.bottomDrawer.appendChild(this.legend),this.grid.appendChild(this.bottomDrawer),this.addEventListener("select",(at=>{(0,sc.isNullId)(at.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,oc.createWebComp)("pnx-widget-legend",{slot:this.isWidthSmall()?"top":"top-left",_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this._miniPicLegend=(0,oc.createWebComp)("pnx-mini-picture-legend",{_parent:this}),this.grid.appendChild(this.legend)),(0,sc.isInIframe)()||(this.grid.appendChild((0,oc.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,oc.createWebComp)("pnx-annotations-switch",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,oc.createWebComp)("pnx-widget-geosearch",{slot:this.isWidthSmall()?"top-right":"top-left",_parent:this,class:"pnx-only-map pnx-print-hidden",geocoder:this._initParams.getParentPostInit().geocoder})),this.grid.appendChild((0,oc.createWebComp)("pnx-widget-mapfilters",{slot:this.isWidthSmall()?"top-right":"top-left",_parent:this,"user-search":null!==this.api._endpoints.user_search&&null!==this.api._endpoints.user_tiles,"quality-score":(null===(at=this.map)||void 0===at||null===(st=at._hasQualityScore)||void 0===st?void 0:st.call(at))||!1,class:"pnx-only-map pnx-print-hidden"})),this.grid.appendChild((0,oc.createWebComp)("pnx-widget-maplayers",{slot:"top-right",_parent:this,class:"pnx-only-map pnx-print-hidden"}))))}disconnectedCallback(){var at;super.disconnectedCallback(),null===(at=this.map)||void 0===at||at.destroy()}getClassName(){return"Viewer"}getSubComponentsNames(){return super.getSubComponentsNames().concat(["mini","map"])}onceReady(){return Promise.all([this.oncePSVReady(),this.onceMapReady()]).then((()=>this._initParams.getParentPostInit().picture&&!this.psv.getPictureMetadata()?this.onceFirstPicLoaded():Promise.resolve()))}attributeChangedCallback(at,st,ot){var ut,Hl,rc,oc;(super.attributeChangedCallback(at,st,ot),"picture"===at)&&(null===(ut=this.legend)||void 0===ut||null===(Hl=ut.setAttribute)||void 0===Hl||Hl.call(ut,"picture",ot),(0,sc.isNullId)(st)&&!(0,sc.isNullId)(ot)&&this.mini.removeAttribute("collapsed"),(0,sc.isNullId)(ot)?this.map&&this.isMapWide()?this.mini.classList.add("pnx-hidden"):this.map&&!this.isMapWide()&&this._setFocus("map"):(this.mini.classList.remove("pnx-hidden"),(0,sc.isNullId)(st)&&(this._setFocus("pic"),"closed"===(null===(rc=this.bottomDrawer)||void 0===rc||null===(oc=rc.getAttribute)||void 0===oc?void 0:oc.call(rc,"openness"))&&this.bottomDrawer.setAttribute("openness","half-opened"))));"focus"===at&&this._setFocus(ot)}onceMapReady(){if(!this.map)return Promise.resolve();let at;return new Promise((st=>{at=setInterval((()=>{var ot,ut,Hl;"object"===typeof this.map&&(null!==(ot=this.map)&&void 0!==ot&&null!==(ut=ot.loaded)&&void 0!==ut&&ut.call(ot)?(clearInterval(at),st()):null!==(Hl=this.map)&&void 0!==Hl&&Hl.once&&this.map.once("render",(()=>{clearInterval(at),st()})))}),250)}))}async _initMap(){await new Promise((at=>{this.map=new rc.A(this,this.mapContainer,this._initParams.getMapInit()),(0,ut.saveMapParamsToLocalStorage)(this.map),this.map.once("users-changed",(()=>{this.loader.setAttribute("value",75),at()}))})),await(0,iu.mK)(this.map,this._initParams.getMapPostInit()),(0,ut.initMapKeyboardHandler)(this),(0,ut.linkMapAndPhoto)(this)}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const at=this._initParams.getParentPostInit();this._initPSV(),await this._initMap(),this._initWidgets(),this._moveChildToGrid(),(0,iu.iz)(this,at),at.keyboardShortcuts&&this._handleKeyboardManagement(),at.picture?this.psv.addEventListener("picture-loaded",(()=>{(0,iu.iz)(this,at),this.loader.dismiss()}),{once:!0}):this.loader.dismiss()}_enableKeyboard(){this.map&&this.isMapWide()?this._enableKeyboardMap():this._enableKeyboardPSV()}_enableKeyboardMap(){this.psv.stopKeyboardControl(),this.map.keyboard.enable()}_enableKeyboardPSV(){this.psv.startKeyboardControl(),this.map.keyboard.disable()}_disableKeyboard(){this.psv.stopKeyboardControl(),this.map.keyboard.disable()}_toggleKeyboardBasedOnFocus(at){const st=(null===at||void 0===at?void 0:at.target)||document.activeElement;if(this.contains(st)){for(let at of this.grid.childNodes)if("bg"!==at.getAttribute("slot")&&!Hl.RD.includes(at.tagName.toLowerCase())&&at.contains(st))return void this._disableKeyboard();this._enableKeyboard()}else this._disableKeyboard()}_handleKeyboardManagement(){window.addEventListener("click",(at=>this._toggleKeyboardBasedOnFocus(at))),window.addEventListener("keypress",this._toggleKeyboardBasedOnFocus.bind(this)),this.addEventListener("focus-changed",(at=>{this.popup.getAttribute("visible")?this._disableKeyboard():"map"===at.detail.focus?this._enableKeyboardMap():this._enableKeyboardPSV()})),this.popup.addEventListener("open",this._disableKeyboard.bind(this)),this.popup.addEventListener("close",this._enableKeyboard.bind(this)),this.psv.addEventListener("click",this._enableKeyboardPSV.bind(this));for(let at of this.grid.childNodes)"bg"===at.getAttribute("slot")||Hl.RD.includes(at.tagName.toLowerCase())||(at.addEventListener("focusin",this._disableKeyboard.bind(this)),at.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&this._enableKeyboard()})))}moveCenter(){const at=this.psv.getPictureMetadata();at&&(this.map&&this.isMapWide()?this.map.flyTo({center:at.gps,zoom:20}):super.moveCenter())}_moveToDirection(at){if(this.map&&this.isMapWide()){let st;switch(at){case"up":st=[0,-100];break;case"left":st=[-100,0];break;case"down":st=[0,su];break;case"right":st=[su,0]}this.map.panBy(st)}else super._moveToDirection(at)}isMapWide(){return this.mapContainer.parentNode==this.grid}_setFocus(at){var st,ot,ut,Hl;let rc=arguments.length>1&&void 0!==arguments[1]&&arguments[1],Sc=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("map"===at&&!this.map)throw new Error("Map is not enabled");if(!["map","pic"].includes(at))throw new Error("Invalid focus value (should be pic or map)");if(this.focus=at,(Sc||("map"!==at||!this.map||!this.isMapWide())&&("pic"!==at||this.map&&this.isMapWide()))&&("map"===at?(this.psvContainer.parentNode==this.grid&&(this.grid.removeChild(this.psvContainer),this.psvContainer.removeAttribute("slot")),this.mapContainer.parentNode==this.mini&&this.mini.removeChild(this.mapContainer),this.mapContainer.setAttribute("slot","bg"),this.grid.appendChild(this.mapContainer),this.mini.appendChild(this.psvContainer),this.mini.icon=(0,oc.fa)(_c.pt),this._miniPicLegend&&this.mini.appendChild(this._miniPicLegend),(0,sc.isNullId)(this.picture)?this.mini.classList.add("pnx-hidden"):this.mini.classList.remove("pnx-hidden"),this.map.getCanvas().focus()):(this.mapContainer.parentNode==this.grid&&(this.grid.removeChild(this.mapContainer),this.mapContainer.removeAttribute("slot")),this.psvContainer.parentNode==this.mini&&(this.mini.removeChild(this.psvContainer),this._miniPicLegend&&this.mini.removeChild(this._miniPicLegend)),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.mini.classList.remove("pnx-hidden"),this.mini.appendChild(this.mapContainer),this.mini.icon=(0,oc.fa)(wc.e5),this.psvContainer.focus()),null===this||void 0===this||null===(st=this.map)||void 0===st||null===(ot=st.resize)||void 0===ot||ot.call(st),this.psv.autoSize(),this.psv.forceRefresh(),null===(ut=this.legend)||void 0===ut||null===(Hl=ut.setAttribute)||void 0===Hl||Hl.call(ut,"focus",this.focus),!rc)){const st=new CustomEvent("focus-changed",{detail:{focus:at}});this.dispatchEvent(st)}}_toggleFocus(){this._setFocus(this.isMapWide()?"pic":"map")}_onMiniExpand(){this.map.resize(),this.psv.autoSize()}_onMapFiltersChange(){var at;const st=(0,Sc.qi)("#pnx-map-filters-menu"),ot=(0,Sc.qi)("#pnx-map-theme"),Hl=(0,ut.mapFiltersFormValues)(st,ot,null===(at=this.map)||void 0===at?void 0:at._hasQualityScore());this.map.setFilters(Hl)}}Viewer.properties={"map-options":{converter:Hl.Ay.GetJSONConverter()},focus:{type:String,reflect:!0},geocoder:{type:String},tabindex:{type:Number},...Hl.Ay.properties},customElements.define("pnx-viewer",Viewer)},3921:(at,st,ot)=>{"use strict";ot.r(st),ot.d(st,{Basic:()=>ut.A,CoverageMap:()=>Hl.A,Editor:()=>rc.A,PhotoViewer:()=>oc.Ay,Viewer:()=>sc.A});var ut=ot(9039),Hl=ot(153),rc=ot(1752),sc=ot(8743),oc=ot(3407)},9341:(at,st,ot)=>{"use strict";ot.r(st),ot.d(st,{core:()=>ut,layout:()=>Hl,menus:()=>rc,ui:()=>sc});var ut=ot(3921),Hl=ot(456),rc=ot(8794),sc=ot(9472)},6784:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>BottomDrawer});var ut=ot(4542),Hl=ot(1198),rc=ot(5995);const sc={opened:0,"half-opened":.7,closed:1};class BottomDrawer extends ut.WF{constructor(){super(),this._isDragging=!1,this.openness="half-opened"}firstUpdated(){super.firstUpdated(),this._boundTouchMove=this._onTouchMove.bind(this),this._boundTouchEnd=this._onTouchEnd.bind(this),this._drawerHeight=window.innerHeight-30;const at=this._getDrawer();at&&(at.style.height=`${this._drawerHeight}px`,at.style.maxHeight=`${this._drawerHeight}px`,(0,rc.onceParentAvailable)(this).then((()=>this._parent.onceReady())).then((()=>{var at,st;null===(at=this._parent.map)||void 0===at||at.addEventListener("click",(()=>this.openness="closed")),null===(st=this._parent.psv)||void 0===st||st.addEventListener("click",(()=>this.openness="closed"))})))}attributeChangedCallback(at,st,ot){if(super.attributeChangedCallback(at,st,ot),"openness"===at){if("opened"!==ot){const at=this.shadowRoot.querySelector(".content");at&&(at.scrollTop=0)}const at=this._getDrawer();at&&(at.style.transform=null)}}disconnectedCallback(){super.disconnectedCallback(),this._cleanupTouchListeners()}_getDrawer(){var at;return null===(at=this.shadowRoot)||void 0===at?void 0:at.querySelector(".drawer")}_onHandleClick(){"opened"===this.openness?this.openness="closed":"half-opened"===this.openness?this.openness="opened":"closed"===this.openness&&(this.openness="half-opened")}_onTouchStart(at){this._isDragging=!0,this._startFingerY=at.touches[0].clientY,this._deltaFingerY=0,this._drawerY=this._drawerHeight*sc[this.openness],window.addEventListener("touchmove",this._boundTouchMove,{passive:!0}),window.addEventListener("touchend",this._boundTouchEnd),window.addEventListener("touchcancel",this._boundTouchEnd)}_onTouchMove(at){if(!this._isDragging)return;const st=this.shadowRoot.querySelector(".content");st.scrollHeight>st.offsetHeight&&st.scrollTop>0?this._updateDrawerTransform(0):(this._deltaFingerY=at.touches[0].clientY-this._startFingerY,this._updateDrawerTransform(this._drawerY+this._deltaFingerY))}_onTouchEnd(at){(this._isDragging&&!(Math.abs(this._deltaFingerY)<30)||at.target.closest(".handle"))&&(at.preventDefault(),this._isDragging=!1,0===this._deltaFingerY&&"closed"===this.openness?this.openness="half-opened":this._updateDrawerTransform(this._drawerY+this._deltaFingerY,!0),this._cleanupTouchListeners(),this._startFingerY=null,this._deltaFingerY=null)}_cleanupTouchListeners(){window.removeEventListener("touchmove",this._boundTouchMove),window.removeEventListener("touchend",this._boundTouchEnd),window.removeEventListener("touchcancel",this._boundTouchCancel)}_updateDrawerTransform(at){let st=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const ot=this._getDrawer();ot&&(at=Math.max(0,Math.min(at,this._drawerHeight-30)),st&&(this._deltaFingerY<0?"closed"===this.openness?Math.abs(this._deltaFingerY)>this._drawerHeight*(1-sc["half-opened"])?this.openness="opened":this.openness="half-opened":this.openness="opened":this.openness="closed",this._drawerY=null,at=Math.max(0,Math.min(sc[this.openness]*this._drawerHeight,this._drawerHeight-30))),ot.style.transform=`translateY(${at}px)`)}render(){const at={drawer:!0,[this.openness]:!0,dragging:this._isDragging};return ut.qy`
13
13
  <div
14
14
  class=${(0,Hl.H)(at)}
15
15
  @touchstart="${this._onTouchStart}"
@@ -9,7 +9,7 @@
9
9
  * LICENSE file in the root directory of this source tree.
10
10
  *
11
11
  */
12
- !function(t,a){"object"===typeof exports&&"object"===typeof module?module.exports=a():"function"===typeof define&&define.amd?define("Panoramax",[],a):"object"===typeof exports?exports.Panoramax=a():t.Panoramax=a()}(this,(()=>(()=>{var t={9039:(t,a,A)=>{"use strict";A.d(a,{A:()=>Basic});var h=A(4542),p=A(5254),g=A(4964),m=A(7208),v=A(5995),E=A(7343),_=A(2614),x=A.n(_),w=A(8330);A(1865),A(3638);class Basic extends h.WF{constructor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.users=["geovisio"],this["map-style"]=this.getAttribute("map-style")||(0,m.MapTiles)(),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 ${w.rE} (d86468b)\n\n\ud83c\udd98 Issues can be reported at ${w.Jk.O}`),t||(this._isInternetFast=null,(0,E.isInternetFast)().then((t=>this._isInternetFast=t)))}connectedCallback(){super.connectedCallback(),this._t=(0,g.getTranslations)(this.lang),this.loader=(0,v.createWebComp)("pnx-loader",{_parent:this,"no-label":(0,E.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()),Object.entries({map:"map-options",psv:"psv-options",fetchOptions:"fetch-options",mapstyle:"map-style"}).forEach((t=>{let[a,A]=t;this.getAttribute(a)&&console.error(`Component attribute "${a}" has been renamed into "${A}". Old attribute "${a}" is ignored.`)}))}_setupAPI(){if(this.loader=this.loader||(0,v.createWebComp)("pnx-loader",{_parent:this}),!this.endpoint)return void console.warn("No endpoint is defined");this._loadsAPI=this.endpoint;let t=this.endpoint;try{this["map-style"]=JSON.parse(this["map-style"])}catch(A){}try{this.api=new p.A(this.endpoint,{users:this.users,fetch:this["fetch-options"],style:this["map-style"]}),this.api.onceReady().then((()=>{if(t!=this._loadsAPI||!this.api)return;let a=this.api.getUnavailableFeatures(),A=this.api.getAvailableFeatures();A=0===a.length?"\u2705 All features available":"\u2705 Available features: "+A.join(", "),a=0===a.length?"":"\ud83d\udeab Unavailable features: "+a.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 ${A}\n ${a}\n`.trim())})).catch((t=>this.loader.dismiss(t,this._t.pnx.error_api))).finally((()=>delete this._loadsAPI))}catch(A){var a;delete this._loadsAPI,null!==(a=this.loader)&&void 0!==a&&a.dismiss?this.loader.dismiss(A,this._t.pnx.error_api):console.error(A)}}onceReady(){throw new Error("You must override this method on sub-class")}onceAPIReady(){return this.api?this.api.onceReady():new Promise((t=>setTimeout(t,100))).then(this.onceAPIReady.bind(this))}createRenderRoot(){return this}attributeChangedCallback(t,a,A){if(super.attributeChangedCallback(t,a,A),"endpoint"===t&&(this._loadsAPI&&A&&this._loadsAPI===A||this.api&&this.api._endpoint===A||!A||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())),["picture","sequence"].includes(t)){let h,p,g,m;"picture"===t?(h=this.sequence,g=this.sequence,p=A,m=a):(h=A,g=a,p=this.picture,m=this.picture),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{seqId:h,picId:p,prevSeqId:g,prevPicId:m}}))}}getClassName(){return"Basic"}select(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,a=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=a,this.sequence=t}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 h.qy`<p>Should not be used directly, use Viewer/CoverageMap/Editor instead</p>`}getSubComponentsNames(){return["loader","api"]}addEventListener(t,a,A){let h=t.split(":").shift();if(h&&this.getSubComponentsNames().includes(h)){var p;const g=t.substring(h.length+1);null!==(p=this[h])&&void 0!==p&&p.addEventListener?this[h].addEventListener(g,a,A):setTimeout((()=>this.addEventListener(t,a,A)),50)}else super.addEventListener(t,a,A)}static GetJSONConverter(){return{fromAttribute:t=>null===t||""===t?null:"object"===typeof t||Array.isArray(t)?t:x().parse(t),toAttribute:t=>null===t||""===t?"":"string"===typeof t?t:x().stringify(t)}}}Basic.properties={picture:{type:String,reflect:!0},sequence:{type:String,reflect:!0},"fetch-options":{converter:Basic.GetJSONConverter()},users:{type:Array,reflect:!0},"map-style":{type:String},lang:{type:String},endpoint:{type:String}}},3407:(t,a,A)=>{"use strict";A.d(a,{$p:()=>w,Ay:()=>PhotoViewer});A(970);var h=A(1545),p=A(4451),g=A(9039),m=A(9048),v=A(5995),E=A(7343),_=A(2118),x=A(4207);const w=20,C=Math.PI/6,T=["pnx-mini","pnx-widget-player","pnx-widget-zoom"];class PhotoViewer extends g.A{constructor(){super(),this["psv-options"]={},this["url-parameters"]=this.getAttribute("url-parameters")||!0,this["keyboard-shortcuts"]=this.getAttribute("keyboard-shortcuts")||!0,this.widgets=this.getAttribute("widgets")||"true",this.grid=(0,v.createWebComp)("pnx-cornered-grid"),this.psvContainer=document.createElement("div"),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.popup=(0,v.createWebComp)("pnx-popup",{_parent:this,onclose:this._onPopupClose.bind(this)}),this.tabindex=0}_createInitParamsHandler(){var t,a;this._initParams=new _.Ay(_.Ay.GetComponentProperties(PhotoViewer,this),Object.assign({},null===(t=this.urlHandler)||void 0===t?void 0:t.currentURLParams(),null===(a=this.urlHandler)||void 0===a?void 0:a.currentURLParams(!0)),{})}_initWidgets(){"false"!==this._initParams.getParentPostInit().widgets&&((0,E.isInIframe)()||(this.grid.appendChild((0,v.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,v.createWebComp)("pnx-annotations-switch",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"}))),(0,E.isInIframe)()?(this.legend=(0,v.createWebComp)("pnx-widget-legend",{slot:"bottom-right",light:!0,_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild(this.legend)):this.isWidthSmall()?(this.legend=(0,v.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,v.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",(t=>{(0,E.isNullId)(t.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,v.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,v.createWebComp)("pnx-widget-zoom",{slot:"bottom-right",class:"pnx-print-hidden",_parent:this})),this.grid.appendChild(this.legend)))}connectedCallback(){super.connectedCallback(),this.presetsManager=new x.A(this.lang),this["url-parameters"]&&"false"!==this["url-parameters"]&&(this.urlHandler=new p.A(this),this.onceReady().then((()=>{this.urlHandler.listenToChanges(),this.urlHandler._onParentChange()}))),this.onceAPIReady().then(this._postAPIInit.bind(this)),this._moveChildToGrid(),window.addEventListener("DOMContentLoaded",(()=>{this._moveChildToGrid()}),{once:!0})}disconnectedCallback(){var t,a;super.disconnectedCallback(),null===(t=this.urlHandler)||void 0===t||t.destroy(),null===(a=this.psv)||void 0===a||a.destroy(),document.body.removeEventListener("click",this._toggleKeyboardBasedOnFocus),window.removeEventListener("keypress",this._toggleKeyboardBasedOnFocus)}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 t;return new Promise((a=>{t=setInterval((()=>{this.psv&&"object"===typeof this.psv&&(this.psv.container?(clearInterval(t),a()):this.psv.addEventListener&&this.psv.addEventListener("ready",(()=>{clearInterval(t),a()}),{once:!0}))}),250)}))}onceFirstPicLoaded(){return this.oncePSVReady().then((()=>this.psv.getPictureMetadata()?Promise.resolve():new Promise((t=>{this.psv.addEventListener("picture-loaded",t,{once:!0})}))))}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const t=this._initParams.getParentPostInit();this._initPSV(),this._initWidgets(),(0,_.ai)(this,t),t.keyboardShortcuts&&this._handleKeyboardManagement(),t.picture?this.psv.addEventListener("picture-loaded",(()=>this.loader.dismiss()),{once:!0}):this.loader.dismiss()}_initPSV(){try{this.psv=new m.Ay(this,this.psvContainer,{shouldGoFast:this._psvShouldGoFast.bind(this),keyboard:"always",keyboardActions:{...h.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:()=>{var t;return null===(t=this._toggleFocus)||void 0===t?void 0:t.call(this)},7:()=>{var t;return null===(t=this._toggleFocus)||void 0===t?void 0:t.call(this)},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,_.Vy)(this.psv,this._initParams.getPSVPostInit())})),this.psv.addEventListener("sequence-playing",(()=>this.classList.add("pnx-playing"))),this.psv.addEventListener("sequence-stopped",(()=>this.classList.remove("pnx-playing")))}catch(t){let a=h.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(t,a)}}_enableKeyboard(){this.psv.startKeyboardControl()}_disableKeyboard(){this.psv.stopKeyboardControl()}_toggleKeyboardBasedOnFocus(t){const a=(null===t||void 0===t?void 0:t.target)||document.activeElement;if(this.contains(a)){for(let t of this.grid.childNodes)if("bg"!==t.getAttribute("slot")&&!T.includes(t.tagName.toLowerCase())&&t.contains(a))return void this._disableKeyboard();this._enableKeyboard()}else this._disableKeyboard()}_handleKeyboardManagement(){window.addEventListener("click",(t=>this._toggleKeyboardBasedOnFocus(t))),window.addEventListener("keypress",this._toggleKeyboardBasedOnFocus.bind(this)),this.popup.addEventListener("open",this._disableKeyboard.bind(this)),this.popup.addEventListener("close",this._enableKeyboard.bind(this)),this.psv.addEventListener("click",this._enableKeyboard.bind(this));for(let t of this.grid.childNodes)"bg"===t.getAttribute("slot")||T.includes(t.tagName.toLowerCase())||(t.addEventListener("focusin",this._disableKeyboard.bind(this)),t.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&this._enableKeyboard()})))}_psvShouldGoFast(){return this.psv._sequencePlaying&&this.psv.getTransitionDuration()<1e3}_moveChildToGrid(){Array.from(this.querySelectorAll("[slot]")).forEach((t=>{var a;null!==(a=t.tagName)&&void 0!==a&&a.toLowerCase().startsWith("pnx-")&&(t._parent=this,t._t=this._t),"editors"===t.getAttribute("slot")?this.onceReady().then((()=>{var a;return null===(a=this.legend)||void 0===a?void 0:a.appendChild(t)})):this.grid.appendChild(t)}))}setPopup(t){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t?this.popup.setAttribute("visible",""):this.popup.removeAttribute("visible"),this.popup.innerHTML="","string"===typeof a?this.popup.innerHTML=a:Array.isArray(a)&&a.forEach((t=>this.popup.appendChild(t)))}_onPopupClose(){this.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:this.map&&this.isMapWide()?"map":"pic"}}))}_showQualityScoreDoc(){this.setPopup(!0,[(0,v.createWebComp)("pnx-quality-score-doc",{_t:this._t})])}_showReportForm(){if(!this.psv.getPictureMetadata())throw new Error("No picture currently selected");this.setPopup(!0,[(0,v.createWebComp)("pnx-report-form",{_parent:this})])}_showShareOptions(){this.setPopup(!0,[(0,v.createWebComp)("pnx-share-menu",{_parent:this})])}moveCenter(){this.psv.getPictureMetadata()&&this._psvAnimate({speed:m.LM,yaw:0,pitch:0,zoom:m.cS})}moveLeft(){this._moveToDirection("left")}moveRight(){this._moveToDirection("right")}moveUp(){this._moveToDirection("up")}moveDown(){this._moveToDirection("down")}_moveToDirection(t){let a=this.psv.getPosition();switch(t){case"up":a.pitch+=C;break;case"left":a.yaw-=C;break;case"down":a.pitch-=C;break;case"right":a.yaw+=C}this._psvAnimate({speed:m.LM,...a})}_psvAnimate(t){this._lastPsvAnim&&this._lastPsvAnim.cancel(),this._lastPsvAnim=this.psv.animate(t)}addEventListener(t,a,A){super.addEventListener(t,a,A)}}PhotoViewer.properties={"psv-options":{converter:g.A.GetJSONConverter()},widgets:{type:String},"url-parameters":{type:String},"keyboard-shortcuts":{type:String},tabindex:{type:Number},...g.A.properties},customElements.define("pnx-photo-viewer",PhotoViewer)},2504:(t,a,A)=>{"use strict";A.r(a),A.d(a,{layout:()=>h,menus:()=>p,ui:()=>g});var h=A(456),p=A(9015),g=A(6957)},6784:(t,a,A)=>{"use strict";A.d(a,{A:()=>BottomDrawer});var h=A(4542),p=A(1198),g=A(5995);const m={opened:0,"half-opened":.7,closed:1};class BottomDrawer extends h.WF{constructor(){super(),this._isDragging=!1,this.openness="half-opened"}firstUpdated(){super.firstUpdated(),this._boundTouchMove=this._onTouchMove.bind(this),this._boundTouchEnd=this._onTouchEnd.bind(this),this._drawerHeight=window.innerHeight-30;const t=this._getDrawer();t&&(t.style.height=`${this._drawerHeight}px`,t.style.maxHeight=`${this._drawerHeight}px`,(0,g.onceParentAvailable)(this).then((()=>this._parent.onceReady())).then((()=>{var t,a;null===(t=this._parent.map)||void 0===t||t.addEventListener("click",(()=>this.openness="closed")),null===(a=this._parent.psv)||void 0===a||a.addEventListener("click",(()=>this.openness="closed"))})))}attributeChangedCallback(t,a,A){if(super.attributeChangedCallback(t,a,A),"openness"===t){if("opened"!==A){const t=this.shadowRoot.querySelector(".content");t&&(t.scrollTop=0)}const t=this._getDrawer();t&&(t.style.transform=null)}}disconnectedCallback(){super.disconnectedCallback(),this._cleanupTouchListeners()}_getDrawer(){var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".drawer")}_onHandleClick(){"opened"===this.openness?this.openness="closed":"half-opened"===this.openness?this.openness="opened":"closed"===this.openness&&(this.openness="half-opened")}_onTouchStart(t){this._isDragging=!0,this._startFingerY=t.touches[0].clientY,this._deltaFingerY=0,this._drawerY=this._drawerHeight*m[this.openness],window.addEventListener("touchmove",this._boundTouchMove,{passive:!0}),window.addEventListener("touchend",this._boundTouchEnd),window.addEventListener("touchcancel",this._boundTouchEnd)}_onTouchMove(t){if(!this._isDragging)return;const a=this.shadowRoot.querySelector(".content");a.scrollHeight>a.offsetHeight&&a.scrollTop>0?this._updateDrawerTransform(0):(this._deltaFingerY=t.touches[0].clientY-this._startFingerY,this._updateDrawerTransform(this._drawerY+this._deltaFingerY))}_onTouchEnd(t){(this._isDragging&&!(Math.abs(this._deltaFingerY)<30)||t.target.closest(".handle"))&&(t.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(t){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const A=this._getDrawer();A&&(t=Math.max(0,Math.min(t,this._drawerHeight-30)),a&&(this._deltaFingerY<0?"closed"===this.openness?Math.abs(this._deltaFingerY)>this._drawerHeight*(1-m["half-opened"])?this.openness="opened":this.openness="half-opened":this.openness="opened":this.openness="closed",this._drawerY=null,t=Math.max(0,Math.min(m[this.openness]*this._drawerHeight,this._drawerHeight-30))),A.style.transform=`translateY(${t}px)`)}render(){const t={drawer:!0,[this.openness]:!0,dragging:this._isDragging};return h.qy`
12
+ !function(t,a){"object"===typeof exports&&"object"===typeof module?module.exports=a():"function"===typeof define&&define.amd?define("Panoramax",[],a):"object"===typeof exports?exports.Panoramax=a():t.Panoramax=a()}(this,(()=>(()=>{var t={9039:(t,a,A)=>{"use strict";A.d(a,{A:()=>Basic});var h=A(4542),p=A(5254),g=A(4964),m=A(7208),v=A(5995),E=A(7343),_=A(2614),x=A.n(_),w=A(8330);A(1865),A(3638);class Basic extends h.WF{constructor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.users=["geovisio"],this["map-style"]=this.getAttribute("map-style")||(0,m.MapTiles)(),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 ${w.rE} (5ce55f3)\n\n\ud83c\udd98 Issues can be reported at ${w.Jk.O}`),t||(this._isInternetFast=null,(0,E.isInternetFast)().then((t=>this._isInternetFast=t)))}connectedCallback(){super.connectedCallback(),this._t=(0,g.getTranslations)(this.lang),this.loader=(0,v.createWebComp)("pnx-loader",{_parent:this,"no-label":(0,E.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()),Object.entries({map:"map-options",psv:"psv-options",fetchOptions:"fetch-options",mapstyle:"map-style"}).forEach((t=>{let[a,A]=t;this.getAttribute(a)&&console.error(`Component attribute "${a}" has been renamed into "${A}". Old attribute "${a}" is ignored.`)}))}_setupAPI(){if(this.loader=this.loader||(0,v.createWebComp)("pnx-loader",{_parent:this}),!this.endpoint)return void console.warn("No endpoint is defined");this._loadsAPI=this.endpoint;let t=this.endpoint;try{this["map-style"]=JSON.parse(this["map-style"])}catch(A){}try{this.api=new p.A(this.endpoint,{users:this.users,fetch:this["fetch-options"],style:this["map-style"]}),this.api.onceReady().then((()=>{if(t!=this._loadsAPI||!this.api)return;let a=this.api.getUnavailableFeatures(),A=this.api.getAvailableFeatures();A=0===a.length?"\u2705 All features available":"\u2705 Available features: "+A.join(", "),a=0===a.length?"":"\ud83d\udeab Unavailable features: "+a.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 ${A}\n ${a}\n`.trim())})).catch((t=>this.loader.dismiss(t,this._t.pnx.error_api))).finally((()=>delete this._loadsAPI))}catch(A){var a;delete this._loadsAPI,null!==(a=this.loader)&&void 0!==a&&a.dismiss?this.loader.dismiss(A,this._t.pnx.error_api):console.error(A)}}onceReady(){throw new Error("You must override this method on sub-class")}onceAPIReady(){return this.api?this.api.onceReady():new Promise((t=>setTimeout(t,100))).then(this.onceAPIReady.bind(this))}createRenderRoot(){return this}attributeChangedCallback(t,a,A){if(super.attributeChangedCallback(t,a,A),"endpoint"===t&&(this._loadsAPI&&A&&this._loadsAPI===A||this.api&&this.api._endpoint===A||!A||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())),["picture","sequence"].includes(t)){let h,p,g,m;"picture"===t?(h=this.sequence,g=this.sequence,p=A,m=a):(h=A,g=a,p=this.picture,m=this.picture),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{seqId:h,picId:p,prevSeqId:g,prevPicId:m}}))}}getClassName(){return"Basic"}select(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,a=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=a,this.sequence=t}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 h.qy`<p>Should not be used directly, use Viewer/CoverageMap/Editor instead</p>`}getSubComponentsNames(){return["loader","api"]}addEventListener(t,a,A){let h=t.split(":").shift();if(h&&this.getSubComponentsNames().includes(h)){var p;const g=t.substring(h.length+1);null!==(p=this[h])&&void 0!==p&&p.addEventListener?this[h].addEventListener(g,a,A):setTimeout((()=>this.addEventListener(t,a,A)),50)}else super.addEventListener(t,a,A)}static GetJSONConverter(){return{fromAttribute:t=>null===t||""===t?null:"object"===typeof t||Array.isArray(t)?t:x().parse(t),toAttribute:t=>null===t||""===t?"":"string"===typeof t?t:x().stringify(t)}}}Basic.properties={picture:{type:String,reflect:!0},sequence:{type:String,reflect:!0},"fetch-options":{converter:Basic.GetJSONConverter()},users:{type:Array,reflect:!0},"map-style":{type:String},lang:{type:String},endpoint:{type:String}}},3407:(t,a,A)=>{"use strict";A.d(a,{$p:()=>w,Ay:()=>PhotoViewer});A(970);var h=A(1545),p=A(4451),g=A(9039),m=A(9048),v=A(5995),E=A(7343),_=A(2118),x=A(4207);const w=20,C=Math.PI/6,T=["pnx-mini","pnx-widget-player","pnx-widget-zoom"];class PhotoViewer extends g.A{constructor(){super(),this["psv-options"]={},this["url-parameters"]=this.getAttribute("url-parameters")||!0,this["keyboard-shortcuts"]=this.getAttribute("keyboard-shortcuts")||!0,this.widgets=this.getAttribute("widgets")||"true",this.grid=(0,v.createWebComp)("pnx-cornered-grid"),this.psvContainer=document.createElement("div"),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.popup=(0,v.createWebComp)("pnx-popup",{_parent:this,onclose:this._onPopupClose.bind(this)}),this.tabindex=0}_createInitParamsHandler(){var t,a;this._initParams=new _.Ay(_.Ay.GetComponentProperties(PhotoViewer,this),Object.assign({},null===(t=this.urlHandler)||void 0===t?void 0:t.currentURLParams(),null===(a=this.urlHandler)||void 0===a?void 0:a.currentURLParams(!0)),{})}_initWidgets(){"false"!==this._initParams.getParentPostInit().widgets&&((0,E.isInIframe)()||(this.grid.appendChild((0,v.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,v.createWebComp)("pnx-annotations-switch",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"}))),(0,E.isInIframe)()?(this.legend=(0,v.createWebComp)("pnx-widget-legend",{slot:"bottom-right",light:!0,_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild(this.legend)):this.isWidthSmall()?(this.legend=(0,v.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,v.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",(t=>{(0,E.isNullId)(t.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,v.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,v.createWebComp)("pnx-widget-zoom",{slot:"bottom-right",class:"pnx-print-hidden",_parent:this})),this.grid.appendChild(this.legend)))}connectedCallback(){super.connectedCallback(),this.presetsManager=new x.A(this.lang),this["url-parameters"]&&"false"!==this["url-parameters"]&&(this.urlHandler=new p.A(this),this.onceReady().then((()=>{this.urlHandler.listenToChanges(),this.urlHandler._onParentChange()}))),this.onceAPIReady().then(this._postAPIInit.bind(this)),this._moveChildToGrid(),window.addEventListener("DOMContentLoaded",(()=>{this._moveChildToGrid()}),{once:!0})}disconnectedCallback(){var t,a;super.disconnectedCallback(),null===(t=this.urlHandler)||void 0===t||t.destroy(),null===(a=this.psv)||void 0===a||a.destroy(),document.body.removeEventListener("click",this._toggleKeyboardBasedOnFocus),window.removeEventListener("keypress",this._toggleKeyboardBasedOnFocus)}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 t;return new Promise((a=>{t=setInterval((()=>{this.psv&&"object"===typeof this.psv&&(this.psv.container?(clearInterval(t),a()):this.psv.addEventListener&&this.psv.addEventListener("ready",(()=>{clearInterval(t),a()}),{once:!0}))}),250)}))}onceFirstPicLoaded(){return this.oncePSVReady().then((()=>this.psv.getPictureMetadata()?Promise.resolve():new Promise((t=>{this.psv.addEventListener("picture-loaded",t,{once:!0})}))))}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const t=this._initParams.getParentPostInit();this._initPSV(),this._initWidgets(),(0,_.ai)(this,t),t.keyboardShortcuts&&this._handleKeyboardManagement(),t.picture?this.psv.addEventListener("picture-loaded",(()=>this.loader.dismiss()),{once:!0}):this.loader.dismiss()}_initPSV(){try{this.psv=new m.Ay(this,this.psvContainer,{shouldGoFast:this._psvShouldGoFast.bind(this),keyboard:"always",keyboardActions:{...h.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:()=>{var t;return null===(t=this._toggleFocus)||void 0===t?void 0:t.call(this)},7:()=>{var t;return null===(t=this._toggleFocus)||void 0===t?void 0:t.call(this)},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,_.Vy)(this.psv,this._initParams.getPSVPostInit())})),this.psv.addEventListener("sequence-playing",(()=>this.classList.add("pnx-playing"))),this.psv.addEventListener("sequence-stopped",(()=>this.classList.remove("pnx-playing")))}catch(t){let a=h.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(t,a)}}_enableKeyboard(){this.psv.startKeyboardControl()}_disableKeyboard(){this.psv.stopKeyboardControl()}_toggleKeyboardBasedOnFocus(t){const a=(null===t||void 0===t?void 0:t.target)||document.activeElement;if(this.contains(a)){for(let t of this.grid.childNodes)if("bg"!==t.getAttribute("slot")&&!T.includes(t.tagName.toLowerCase())&&t.contains(a))return void this._disableKeyboard();this._enableKeyboard()}else this._disableKeyboard()}_handleKeyboardManagement(){window.addEventListener("click",(t=>this._toggleKeyboardBasedOnFocus(t))),window.addEventListener("keypress",this._toggleKeyboardBasedOnFocus.bind(this)),this.popup.addEventListener("open",this._disableKeyboard.bind(this)),this.popup.addEventListener("close",this._enableKeyboard.bind(this)),this.psv.addEventListener("click",this._enableKeyboard.bind(this));for(let t of this.grid.childNodes)"bg"===t.getAttribute("slot")||T.includes(t.tagName.toLowerCase())||(t.addEventListener("focusin",this._disableKeyboard.bind(this)),t.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&this._enableKeyboard()})))}_psvShouldGoFast(){return this.psv._sequencePlaying&&this.psv.getTransitionDuration()<1e3}_moveChildToGrid(){Array.from(this.querySelectorAll("[slot]")).forEach((t=>{var a;null!==(a=t.tagName)&&void 0!==a&&a.toLowerCase().startsWith("pnx-")&&(t._parent=this,t._t=this._t),"editors"===t.getAttribute("slot")?this.onceReady().then((()=>{var a;return null===(a=this.legend)||void 0===a?void 0:a.appendChild(t)})):this.grid.appendChild(t)}))}setPopup(t){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t?this.popup.setAttribute("visible",""):this.popup.removeAttribute("visible"),this.popup.innerHTML="","string"===typeof a?this.popup.innerHTML=a:Array.isArray(a)&&a.forEach((t=>this.popup.appendChild(t)))}_onPopupClose(){this.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:this.map&&this.isMapWide()?"map":"pic"}}))}_showQualityScoreDoc(){this.setPopup(!0,[(0,v.createWebComp)("pnx-quality-score-doc",{_t:this._t})])}_showReportForm(){if(!this.psv.getPictureMetadata())throw new Error("No picture currently selected");this.setPopup(!0,[(0,v.createWebComp)("pnx-report-form",{_parent:this})])}_showShareOptions(){this.setPopup(!0,[(0,v.createWebComp)("pnx-share-menu",{_parent:this})])}moveCenter(){this.psv.getPictureMetadata()&&this._psvAnimate({speed:m.LM,yaw:0,pitch:0,zoom:m.cS})}moveLeft(){this._moveToDirection("left")}moveRight(){this._moveToDirection("right")}moveUp(){this._moveToDirection("up")}moveDown(){this._moveToDirection("down")}_moveToDirection(t){let a=this.psv.getPosition();switch(t){case"up":a.pitch+=C;break;case"left":a.yaw-=C;break;case"down":a.pitch-=C;break;case"right":a.yaw+=C}this._psvAnimate({speed:m.LM,...a})}_psvAnimate(t){this._lastPsvAnim&&this._lastPsvAnim.cancel(),this._lastPsvAnim=this.psv.animate(t)}addEventListener(t,a,A){super.addEventListener(t,a,A)}}PhotoViewer.properties={"psv-options":{converter:g.A.GetJSONConverter()},widgets:{type:String},"url-parameters":{type:String},"keyboard-shortcuts":{type:String},tabindex:{type:Number},...g.A.properties},customElements.define("pnx-photo-viewer",PhotoViewer)},2504:(t,a,A)=>{"use strict";A.r(a),A.d(a,{layout:()=>h,menus:()=>p,ui:()=>g});var h=A(456),p=A(9015),g=A(6957)},6784:(t,a,A)=>{"use strict";A.d(a,{A:()=>BottomDrawer});var h=A(4542),p=A(1198),g=A(5995);const m={opened:0,"half-opened":.7,closed:1};class BottomDrawer extends h.WF{constructor(){super(),this._isDragging=!1,this.openness="half-opened"}firstUpdated(){super.firstUpdated(),this._boundTouchMove=this._onTouchMove.bind(this),this._boundTouchEnd=this._onTouchEnd.bind(this),this._drawerHeight=window.innerHeight-30;const t=this._getDrawer();t&&(t.style.height=`${this._drawerHeight}px`,t.style.maxHeight=`${this._drawerHeight}px`,(0,g.onceParentAvailable)(this).then((()=>this._parent.onceReady())).then((()=>{var t,a;null===(t=this._parent.map)||void 0===t||t.addEventListener("click",(()=>this.openness="closed")),null===(a=this._parent.psv)||void 0===a||a.addEventListener("click",(()=>this.openness="closed"))})))}attributeChangedCallback(t,a,A){if(super.attributeChangedCallback(t,a,A),"openness"===t){if("opened"!==A){const t=this.shadowRoot.querySelector(".content");t&&(t.scrollTop=0)}const t=this._getDrawer();t&&(t.style.transform=null)}}disconnectedCallback(){super.disconnectedCallback(),this._cleanupTouchListeners()}_getDrawer(){var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".drawer")}_onHandleClick(){"opened"===this.openness?this.openness="closed":"half-opened"===this.openness?this.openness="opened":"closed"===this.openness&&(this.openness="half-opened")}_onTouchStart(t){this._isDragging=!0,this._startFingerY=t.touches[0].clientY,this._deltaFingerY=0,this._drawerY=this._drawerHeight*m[this.openness],window.addEventListener("touchmove",this._boundTouchMove,{passive:!0}),window.addEventListener("touchend",this._boundTouchEnd),window.addEventListener("touchcancel",this._boundTouchEnd)}_onTouchMove(t){if(!this._isDragging)return;const a=this.shadowRoot.querySelector(".content");a.scrollHeight>a.offsetHeight&&a.scrollTop>0?this._updateDrawerTransform(0):(this._deltaFingerY=t.touches[0].clientY-this._startFingerY,this._updateDrawerTransform(this._drawerY+this._deltaFingerY))}_onTouchEnd(t){(this._isDragging&&!(Math.abs(this._deltaFingerY)<30)||t.target.closest(".handle"))&&(t.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(t){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const A=this._getDrawer();A&&(t=Math.max(0,Math.min(t,this._drawerHeight-30)),a&&(this._deltaFingerY<0?"closed"===this.openness?Math.abs(this._deltaFingerY)>this._drawerHeight*(1-m["half-opened"])?this.openness="opened":this.openness="half-opened":this.openness="opened":this.openness="closed",this._drawerY=null,t=Math.max(0,Math.min(m[this.openness]*this._drawerHeight,this._drawerHeight-30))),A.style.transform=`translateY(${t}px)`)}render(){const t={drawer:!0,[this.openness]:!0,dragging:this._isDragging};return h.qy`
13
13
  <div
14
14
  class=${(0,p.H)(t)}
15
15
  @touchstart="${this._onTouchStart}"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoramax/web-viewer",
3
- "version": "4.1.0-develop-d86468b8",
3
+ "version": "4.1.0-develop-5ce55f3f",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "build/index.js",
6
6
  "author": "Panoramax team",
@@ -0,0 +1 @@
1
+ {}