@panoramax/web-viewer 4.4.0-develop-edb70d88 → 4.4.0
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 +1 -1
- package/build/photoviewer.js +1 -1
- package/package.json +1 -1
- package/src/translations/br.json +1 -4
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(le,vt){"object"===typeof exports&&"object"===typeof module?module.exports=vt():"function"===typeof define&&define.amd?define("Panoramax",[],vt):"object"===typeof exports?exports.Panoramax=vt():le.Panoramax=vt()}(this,(()=>(()=>{var le={9039:(le,vt,bt)=>{"use strict";bt.d(vt,{A:()=>Basic});var ls=bt(4542),ho=bt(5254),Dl=bt(4964),Fl=bt(7208),sc=bt(5995),uc=bt(7343),mc=bt(2614),gc=bt.n(mc),Ac=bt(8330);bt(1865),bt(3638);class Basic extends ls.WF{constructor(){let le=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.users=["geovisio"],this["map-style"]=this.getAttribute("map-style")||(0,Fl.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 ${Ac.rE} (edb70d8)\n\n\ud83c\udd98 Issues can be reported at ${Ac.Jk.O}`),le||(this._isInternetFast=null,(0,uc.isInternetFast)().then((le=>this._isInternetFast=le)))}connectedCallback(){super.connectedCallback(),this._t=(0,Dl.getTranslations)(this.lang),this.loader=(0,sc.createWebComp)("pnx-loader",{_parent:this,"no-label":(0,uc.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((le=>{let[vt,bt]=le;this.getAttribute(vt)&&console.error(`Component attribute "${vt}" has been renamed into "${bt}". Old attribute "${vt}" is ignored.`)})),(0,uc.isInIframe)()&&this.classList.add("pnx-iframed")}_setupAPI(){if(this.loader=this.loader||(0,sc.createWebComp)("pnx-loader",{_parent:this}),!this.endpoint)return void console.warn("No endpoint is defined");this._loadsAPI=this.endpoint;let le=this.endpoint;try{this["map-style"]=JSON.parse(this["map-style"])}catch(bt){}try{this.api=new ho.A(this.endpoint,{users:this.users,fetch:this["fetch-options"],style:this["map-style"]}),this.api.onceReady().then((()=>{if(le!=this._loadsAPI||!this.api)return;let vt=this.api.getUnavailableFeatures(),bt=this.api.getAvailableFeatures();bt=0===vt.length?"\u2705 All features available":"\u2705 Available features: "+bt.join(", "),vt=0===vt.length?"":"\ud83d\udeab Unavailable features: "+vt.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 ${bt}\n ${vt}\n`.trim())})).catch((le=>this.loader.dismiss(le,this._t.pnx.error_api))).finally((()=>delete this._loadsAPI))}catch(bt){var vt;delete this._loadsAPI,null!==(vt=this.loader)&&void 0!==vt&&vt.dismiss?this.loader.dismiss(bt,this._t.pnx.error_api):console.error(bt)}}onceReady(){throw new Error("You must override this method on sub-class")}onceAPIReady(){return this.api?this.api.onceReady():new Promise((le=>setTimeout(le,100))).then(this.onceAPIReady.bind(this))}createRenderRoot(){return this}attributeChangedCallback(le,vt,bt){if(super.attributeChangedCallback(le,vt,bt),"endpoint"===le&&(this._loadsAPI&&bt&&this._loadsAPI===bt||this.api&&this.api._endpoint===bt||!bt||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())),["picture","sequence"].includes(le)){let ls,ho,Dl,Fl;"picture"===le?(ls=this.sequence,Dl=this.sequence,ho=bt,Fl=vt):(ls=bt,Dl=vt,ho=this.picture,Fl=this.picture),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{seqId:ls,picId:ho,prevSeqId:Dl,prevPicId:Fl}}))}}getClassName(){return"Basic"}select(){let le=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,vt=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=vt,this.sequence=le}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 ls.qy`<p>Should not be used directly, use Viewer/CoverageMap/Editor instead</p>`}getSubComponentsNames(){return["loader","api"]}addEventListener(le,vt,bt){let ls=le.split(":").shift();if(ls&&this.getSubComponentsNames().includes(ls)){var ho;const Dl=le.substring(ls.length+1);null!==(ho=this[ls])&&void 0!==ho&&ho.addEventListener?this[ls].addEventListener(Dl,vt,bt):setTimeout((()=>this.addEventListener(le,vt,bt)),50)}else super.addEventListener(le,vt,bt)}static GetJSONConverter(){return{fromAttribute:le=>null===le||""===le?null:"object"===typeof le||Array.isArray(le)?le:gc().parse(le),toAttribute:le=>null===le||""===le?"":"string"===typeof le?le:gc().stringify(le)}}}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:(le,vt,bt)=>{"use strict";bt.d(vt,{A:()=>CoverageMap});var ls=bt(9039),ho=bt(5642),Dl=bt(8340),Fl=bt(927),sc=(bt(7776),bt(2118));class CoverageMap extends ls.A{constructor(){super(),this._mapContainer=document.createElement("div"),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this._initParams=new sc.Ay(sc.Ay.GetComponentProperties(CoverageMap,this)),this._initMap()}))}disconnectedCallback(){var le;super.disconnectedCallback(),null===(le=this.map)||void 0===le||le.destroy()}getClassName(){return"CoverageMap"}onceReady(){return this.map&&this.map.waitForEnoughMapLoaded?this.map.waitForEnoughMapLoaded():new Promise((le=>setTimeout(le,100))).then(this.onceReady.bind(this))}render(){return[this.loader,this._mapContainer]}getSubComponentsNames(){const le=super.getSubComponentsNames();return le.push("map"),le}_initMap(){this.map=new ho.A(this,this._mapContainer,Object.assign({},this._initParams.getMapInit(),{hash:!0})),this.map.addControl(new Fl.NavigationControl({showCompass:!1})),this.loader.setAttribute("value",70),this.addEventListener("select",this._onSelect.bind(this)),this.map.on("picture-click",(le=>this.select(le.seqId,le.picId))),this.map.on("sequence-click",(le=>this.select(le.seqId))),this.map.waitForEnoughMapLoaded().then((async()=>{await(0,sc.mK)(this.map,this._initParams.getMapPostInit()),this.map.reloadLayersStyles(),this.loader.dismiss()}))}_onSelect(le){if(le.detail.picId||le.detail.seqId){const vt=le.detail.picId?"pictures":"sequences",bt=this.map.queryRenderedFeatures({layers:[...this.map._userLayers].map((le=>(0,Dl.getUserLayerId)(le,vt))),filter:["==",["get","id"],le.detail.picId||le.detail.seqId]});bt.length>=0&&null!=bt[0]&&this.map._attachPreviewToPictures({features:bt},vt)}}}CoverageMap.properties={"map-options":{converter:ls.A.GetJSONConverter()},...ls.A.properties},customElements.define("pnx-coverage-map",CoverageMap)},1752:(le,vt,bt)=>{"use strict";bt.d(vt,{A:()=>Editor});bt(7365);var ls=bt(9039),ho=bt(5642),Dl=bt(9048),Fl=bt(508),sc=bt(8340),uc=bt(1545),mc=bt(5995);const gc="sequence-headings";class Editor extends ls.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,mc.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 le,vt;super.disconnectedCallback(),null===(le=this.map)||void 0===le||le.destroy(),null===(vt=this.psv)||void 0===vt||vt.destroy()}getClassName(){return"Editor"}onceReady(){var le,vt;return this.map&&this.psv&&null!==(le=(vt=this.map).loaded)&&void 0!==le&&le.call(vt)?Promise.resolve():new Promise((le=>setTimeout(le,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(le,vt,bt){"users"===le&&Array.isArray(bt)&&bt.length>0?console.warn("Parameters users can't be changed in Editor, only selected sequence can be visible"):super.attributeChangedCallback(le,vt,bt)}render(){return[this.loader,this.grid]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["map","psv","grid"])}_initPSV(){try{this.psv=new Dl.Ay(this,this._psvContainer),this.psv._myVTour.datasource.nodeResolver=this._getNode.bind(this),this.grid.appendChild((0,mc.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:"xl",more:"never"}))}catch(le){let vt=uc.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(le,vt)}}_initMap(){try{this.map=new ho.A(this,this._mapContainer,{raster:this.raster,background:this.background,supplementaryStyle:this._createMapStyle(),zoom:15,picMarkerDraggable:!0}),(0,sc.linkMapAndPhoto)(this),this.loader.setAttribute("value",50),this._loadSequence(),this.map.once("load",(()=>{this.map.hasTwoBackgrounds()&&this._addMapBackgroundWidget(),this._bindPicturesEvents()}));const le=this.map._picMarker.setRotation.bind(this.map._picMarker);this.map._picMarker.setRotation=vt=>(vt=void 0===this._lastRelHeading?vt:vt+this._lastRelHeading-this.psv.getPictureRelativeHeading(),le(vt))}catch(le){this.loader.dismiss(le,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:{...sc.VECTOR_STYLES_NOCROWD.SEQUENCES.layout},paint:{...sc.VECTOR_STYLES_NOCROWD.SEQUENCES.paint}},{id:"geovisio_editor_pictures",type:"circle",source:"geovisio_editor_sequences",layout:{...sc.VECTOR_STYLES_NOCROWD.PICTURES.layout},paint:{...sc.VECTOR_STYLES_NOCROWD.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((le=>{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=le.features,this.map.getSource("geovisio_editor_sequences").setData({type:"FeatureCollection",features:[{id:this.sequence,type:"Feature",properties:{id:this.sequence},geometry:{type:"LineString",coordinates:le.features.map((le=>le.geometry.coordinates))}},...le.features.map((le=>(le.properties.id=le.id,le.properties.sequences=[this.sequence],le)))]}),this.picture){const vt=le.features.find((le=>le.id===this.picture));vt?(this.select(this.sequence,this.picture,!0),this.map.jumpTo({center:vt.geometry.coordinates,zoom:18})):console.log("Picture with ID",vt,"was not found")}else{const vt=[...le.features[0].geometry.coordinates,...le.features[0].geometry.coordinates];for(let bt=1;bt<le.features.length;bt++){const ls=le.features[bt].geometry.coordinates;ls[0]<vt[0]&&(vt[0]=ls[0]),ls[1]<vt[1]&&(vt[1]=ls[1]),ls[0]>vt[2]&&(vt[2]=ls[0]),ls[1]>vt[3]&&(vt[3]=ls[1])}this.map.fitBounds(vt,{animate:!1})}})).catch((le=>this.loader.dismiss(le,this._t.pnx.error_api)))}_getNode(le){const vt=this._sequenceData.find((vt=>vt.properties.id===le)),bt=vt?(0,Fl.apiFeatureToPSVNode)(vt,this._t,this._isInternetFast,void 0,(le=>this.api.cleanResourceURL(le))):null;return bt&&delete bt.links,bt}_addMapBackgroundWidget(){const le=(0,mc.createWebComp)("pnx-map-background",{_parent:this,size:"sm",slot:"bottom-left"});this.grid.appendChild(le)}_moveChildToGrid(){Array.from(this.querySelectorAll("[slot]")).forEach((le=>{var vt;null!==(vt=le.tagName)&&void 0!==vt&&vt.toLowerCase().startsWith("pnx-")&&(le._parent=this,le._t=this._t),this.grid.appendChild(le)}))}previewSequenceHeadingChange(le){const vt=void 0!==this.map.getLayer(gc);if(this.map._picMarkerPreview.remove(),void 0===le)return delete this._lastRelHeading,vt&&this.map.setLayoutProperty(gc,"visibility","none"),void(this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x));this._lastRelHeading=le,vt||this.map.addLayer({id:gc,type:"symbol",source:"geovisio_editor_sequences",layout:{"icon-image":"pnx-marker","icon-overlap":"always","icon-size":.8}});const bt=-this.psv.getPictureRelativeHeading();this.map.setLayoutProperty(gc,"visibility","visible"),this.map.setLayoutProperty(gc,"icon-rotate",["+",["get","view:azimuth"],bt,le]);const ls=[["==",["geometry-type"],"Point"]];this.picture&&ls.push(["!=",["get","id"],this.picture]),this.map.setFilter(gc,["all",...ls]),this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x)}_onSelect(){void 0!==this._lastRelHeading&&this.previewSequenceHeadingChange(this._lastRelHeading)}}Editor.properties={raster:{converter:ls.A.GetJSONConverter()},background:{type:String},...ls.A.properties},customElements.define("pnx-editor",Editor)},3407:(le,vt,bt)=>{"use strict";bt.d(vt,{$p:()=>Ac,Ay:()=>PhotoViewer,RD:()=>kc});bt(970);var ls=bt(1545),ho=bt(4451),Dl=bt(9039),Fl=bt(9048),sc=bt(5995),uc=bt(7343),mc=bt(2118),gc=bt(4207);const Ac=20,Ec=Math.PI/6,kc=["pnx-mini","pnx-widget-player","pnx-widget-zoom"];class PhotoViewer extends Dl.A{constructor(){super(),this["psv-options"]={},this["url-parameters"]=this.getAttribute("url-parameters")||"true",this["keyboard-shortcuts"]=this.getAttribute("keyboard-shortcuts")||"true",this["skip-tags-menu-opening"]="true"!==(this.getAttribute("skip-tags-menu-opening")||"false"),this["share-base-url"]=this.getAttribute("share-base-url")||null,this.widgets=this.getAttribute("widgets")||"true",this.grid=(0,sc.createWebComp)("pnx-cornered-grid"),this.psvContainer=document.createElement("div"),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.popup=(0,sc.createWebComp)("pnx-popup",{_parent:this,onclose:this._onPopupClose.bind(this)}),this.tabindex=0,this._sequencesMetadata={}}_createInitParamsHandler(){var le,vt;this._initParams=new mc.Ay(mc.Ay.GetComponentProperties(PhotoViewer,this),Object.assign({},null===(le=this.urlHandler)||void 0===le?void 0:le.currentURLParams(),null===(vt=this.urlHandler)||void 0===vt?void 0:vt.currentURLParams(!0)),{disableAnnotations:localStorage.getItem(uc.DISABLE_ANNOTATIONS_PARAM)})}_initWidgets(){"false"!==this._initParams.getParentPostInit().widgets&&((0,uc.isInIframe)()||(this.grid.appendChild((0,sc.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,sc.createWebComp)("pnx-annotations-switch",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"}))),(0,uc.isInIframe)()?(this.legend=(0,sc.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,sc.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,sc.createWebComp)("pnx-bottom-drawer",{slot:"bottom",_parent:this,class:this._initParams.getParentPostInit().willLoadPicture?void 0:"pnx-hidden"}),this.bottomDrawer.appendChild(this.legend),this.grid.appendChild(this.bottomDrawer),this.addEventListener("select",(le=>{(0,uc.isNullId)(le.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,sc.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,sc.createWebComp)("pnx-widget-zoom",{slot:"bottom-right",class:"pnx-print-hidden",_parent:this})),this.grid.appendChild(this.legend)))}connectedCallback(){super.connectedCallback(),this.presetsManager=new gc.A(this.lang),"false"!==this["url-parameters"]&&(this.urlHandler=new ho.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 le,vt;super.disconnectedCallback(),null===(le=this.urlHandler)||void 0===le||le.destroy(),null===(vt=this.psv)||void 0===vt||vt.destroy(),document.body.removeEventListener("click",this._toggleKeyboardBasedOnFocus),window.removeEventListener("keypress",this._toggleKeyboardBasedOnFocus)}getClassName(){return"PhotoViewer"}onceReady(){return this.oncePSVReady().then((()=>this._initParams.getParentPostInit().willLoadPicture&&!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 le;return new Promise((vt=>{le=setInterval((()=>{this.psv&&"object"===typeof this.psv&&(this.psv.container?(clearInterval(le),vt()):this.psv.addEventListener&&this.psv.addEventListener("ready",(()=>{clearInterval(le),vt()}),{once:!0}))}),250)}))}onceFirstPicLoaded(){return this.oncePSVReady().then((()=>this.psv.getPictureMetadata()?Promise.resolve():new Promise((le=>{this.psv.addEventListener("picture-loaded",le,{once:!0})}))))}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const le=this._initParams.getParentPostInit();this._initPSV(),this._initWidgets(),(0,mc.ai)(this,le),le.keyboardShortcuts&&this._handleKeyboardManagement(),le.willLoadPicture?this.psv.getPictureMetadata()?this.loader.dismiss():this.psv.addEventListener("picture-loaded",(()=>this.loader.dismiss()),{once:!0}):this.loader.dismiss()}_initPSV(){try{this.psv=new Fl.Ay(this,this.psvContainer,{shouldGoFast:this._psvShouldGoFast.bind(this),keyboard:"always",keyboardActions:{...ls.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 le;return null===(le=this._toggleFocus)||void 0===le?void 0:le.call(this)},7:()=>{var le;return null===(le=this._toggleFocus)||void 0===le?void 0:le.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,mc.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"))),this.psv.addEventListener("dblclick",(()=>clearTimeout(this._gridFocus))),this.psv.addEventListener("click",(le=>{clearTimeout(this._gridFocus),"CANVAS"===le.data.target.tagName&&(!this.isMapWide||this.isMapWide&&!this.isMapWide())&&(this._gridFocus=setTimeout((()=>{this.grid.toggleAway()?this.classList.add("pnx-grid-toggled"):this.classList.remove("pnx-grid-toggled")}),250))})),this.psvContainer.addEventListener("mousemove",(()=>{this.grid._hidden&&(clearTimeout(this._gridFocus),this.grid.toggleAway(!0),this.classList.remove("pnx-grid-toggled"))}))}catch(le){let vt=ls.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(le,vt)}}_enableKeyboard(){this.psv.startKeyboardControl()}_disableKeyboard(){this.psv.stopKeyboardControl()}_toggleKeyboardBasedOnFocus(le){const vt=(null===le||void 0===le?void 0:le.target)||document.activeElement;if(this.contains(vt)){for(let le of this.grid.childNodes)if("bg"!==le.getAttribute("slot")&&!kc.includes(le.tagName.toLowerCase())&&le.contains(vt))return void this._disableKeyboard();if(null!==this.popup.getAttribute("visible"))return void this._disableKeyboard();this._enableKeyboard()}else this._disableKeyboard()}_handleKeyboardManagement(){window.addEventListener("click",(le=>this._toggleKeyboardBasedOnFocus(le))),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 le of this.grid.childNodes)"bg"===le.getAttribute("slot")||kc.includes(le.tagName.toLowerCase())||(le.addEventListener("focusin",this._disableKeyboard.bind(this)),le.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((le=>{var vt;null!==(vt=le.tagName)&&void 0!==vt&&vt.toLowerCase().startsWith("pnx-")&&(le._parent=this,le._t=this._t),"editors"===le.getAttribute("slot")?this.onceReady().then((()=>{var vt;return null===(vt=this.legend)||void 0===vt?void 0:vt.appendChild(le)})):this.grid.appendChild(le)}))}setPopup(le){let vt=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;le?this.popup.setAttribute("visible",""):this.popup.removeAttribute("visible"),this.popup.innerHTML="","string"===typeof vt?this.popup.innerHTML=vt:Array.isArray(vt)&&vt.forEach((le=>this.popup.appendChild(le)))}_onPopupClose(){this.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:this.map&&this.isMapWide()?"map":"pic"}}))}_showQualityScoreDoc(){this.setPopup(!0,[(0,sc.createWebComp)("pnx-quality-score-doc",{_t:this._t})])}_showReportForm(){if(!this.psv.getPictureMetadata())throw new Error("No picture currently selected");this.setPopup(!0,[(0,sc.createWebComp)("pnx-report-form",{_parent:this})])}_showShareOptions(){this.setPopup(!0,[(0,sc.createWebComp)("pnx-share-menu",{_parent:this,"base-url":this["share-base-url"]})])}_showSemanticsDoc(){this.setPopup(!0,[(0,sc.createWebComp)("pnx-semantics-doc",{_t:this._t})])}_showSemanticsDownload(){this.setPopup(!0,[(0,sc.createWebComp)("pnx-semantics-download",{_t:this._t})])}moveCenter(){this.psv.getPictureMetadata()&&this._psvAnimate({speed:Fl.LM,yaw:0,pitch:0,zoom:Fl.cS})}moveLeft(){this._moveToDirection("left")}moveRight(){this._moveToDirection("right")}moveUp(){this._moveToDirection("up")}moveDown(){this._moveToDirection("down")}_moveToDirection(le){let vt=this.psv.getPosition();switch(le){case"up":vt.pitch+=Ec;break;case"left":vt.yaw-=Ec;break;case"down":vt.pitch-=Ec;break;case"right":vt.yaw+=Ec}this._psvAnimate({speed:Fl.LM,...vt})}_psvAnimate(le){this._lastPsvAnim&&this._lastPsvAnim.cancel(),this._lastPsvAnim=this.psv.animate(le)}addEventListener(le,vt,bt){super.addEventListener(le,vt,bt)}}PhotoViewer.properties={"psv-options":{converter:Dl.A.GetJSONConverter()},widgets:{type:String},"url-parameters":{type:String},"keyboard-shortcuts":{type:String},tabindex:{type:Number},"skip-tags-menu-opening":{type:String},"share-base-url":{type:String},...Dl.A.properties},customElements.define("pnx-photo-viewer",PhotoViewer)},8743:(le,vt,bt)=>{"use strict";bt.d(vt,{A:()=>Viewer});bt(9616);var ls=bt(8340),ho=bt(3407),Dl=bt(2771),Fl=bt(7343),sc=bt(5995),uc=bt(9683),mc=bt(2e3),gc=bt(9438),Ac=bt(2118);const Ec=100;class Viewer extends ho.Ay{constructor(){super(),this["map-options"]=!0,this.geocoder=this.getAttribute("geocoder")||"nominatim",this.mini=(0,sc.createWebComp)("pnx-mini",{slot:"bottom-left",_parent:this,onexpand:this._onMiniExpand.bind(this),collapsed:!!(0,Fl.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 le,vt;this._initParams=new Ac.Ay(Ac.Ay.GetComponentProperties(Viewer,this),Object.assign({},null===(le=this.urlHandler)||void 0===le?void 0:le.currentURLParams(),null===(vt=this.urlHandler)||void 0===vt?void 0:vt.currentURLParams(!0)),{map:(0,ls.getMapParamsFromLocalStorage)(),disableAnnotations:localStorage.getItem(Fl.DISABLE_ANNOTATIONS_PARAM)})}_initWidgets(){var le,vt;"false"!==this._initParams.getParentPostInit().widgets&&(this.grid.appendChild((0,sc.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,Fl.isInIframe)()?(this.legend=(0,sc.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,sc.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,sc.createWebComp)("pnx-bottom-drawer",{slot:"bottom",_parent:this,class:this._initParams.getParentPostInit().willLoadPicture?void 0:"pnx-hidden"}),this.bottomDrawer.appendChild(this.legend),this.grid.appendChild(this.bottomDrawer),this.addEventListener("select",(le=>{(0,Fl.isNullId)(le.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,sc.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,sc.createWebComp)("pnx-mini-picture-legend",{_parent:this}),this.grid.appendChild(this.legend)),(0,Fl.isInIframe)()||(this.grid.appendChild((0,sc.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,sc.createWebComp)("pnx-annotations-switch",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,sc.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,sc.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===(le=this.map)||void 0===le||null===(vt=le._hasQualityScore)||void 0===vt?void 0:vt.call(le))||!1,class:"pnx-only-map pnx-print-hidden"})),this.grid.appendChild((0,sc.createWebComp)("pnx-widget-semantics-filters",{slot:this.isWidthSmall()?"top-right":"top-left",_parent:this,class:"pnx-only-map pnx-print-hidden"})),this.grid.appendChild((0,sc.createWebComp)("pnx-widget-maplayers",{slot:"top-right",_parent:this,class:"pnx-only-map pnx-print-hidden"}))))}disconnectedCallback(){var le;super.disconnectedCallback(),null===(le=this.map)||void 0===le||le.destroy()}getClassName(){return"Viewer"}getSubComponentsNames(){return super.getSubComponentsNames().concat(["mini","map"])}onceReady(){return Promise.all([this.oncePSVReady(),this.onceMapReady()]).then((()=>this._initParams.getParentPostInit().willLoadPicture&&!this.psv.getPictureMetadata()?this.onceFirstPicLoaded():Promise.resolve()))}attributeChangedCallback(le,vt,bt){var ls,ho;if(super.attributeChangedCallback(le,vt,bt),"picture"===le)if(null===(ls=this.legend)||void 0===ls||null===(ho=ls.setAttribute)||void 0===ho||ho.call(ls,"picture",bt),(0,Fl.isNullId)(vt)&&!(0,Fl.isNullId)(bt)&&this.mini.removeAttribute("collapsed"),(0,Fl.isNullId)(bt))this.map&&this.isMapWide()?this.mini.classList.add("pnx-hidden"):this.map&&!this.isMapWide()&&this._setFocus("map");else if((0,Fl.isNullId)(vt)&&this.sequence==this._initParams.getParentPostInit().sequence&&!this._initParams.getParentPostInit().picture){var Dl,sc;this.mini.classList.remove("pnx-hidden"),this.mini.removeAttribute("collapsed"),"closed"===(null===(Dl=this.bottomDrawer)||void 0===Dl||null===(sc=Dl.getAttribute)||void 0===sc?void 0:sc.call(Dl,"openness"))&&this.bottomDrawer.setAttribute("openness","half-opened")}else{var uc,mc;if(this.mini.classList.remove("pnx-hidden"),(0,Fl.isNullId)(vt))this._setFocus("pic"),"closed"===(null===(uc=this.bottomDrawer)||void 0===uc||null===(mc=uc.getAttribute)||void 0===mc?void 0:mc.call(uc,"openness"))&&this.bottomDrawer.setAttribute("openness","half-opened")}"focus"===le&&this._setFocus(bt)}onceMapReady(){if(!this["map-options"])return Promise.resolve();let le;return new Promise((vt=>{le=setInterval((()=>{var bt,ls,ho;"object"===typeof this.map&&(null!==(bt=this.map)&&void 0!==bt&&null!==(ls=bt.loaded)&&void 0!==ls&&ls.call(bt)?(clearInterval(le),vt()):null!==(ho=this.map)&&void 0!==ho&&ho.once&&this.map.once("render",(()=>{clearInterval(le),vt()})))}),250)}))}async _initMap(){await new Promise((le=>{this.map=new Dl.A(this,this.mapContainer,this._initParams.getMapInit()),(0,ls.saveMapParamsToLocalStorage)(this.map),this.map.once("users-changed",(()=>{this.loader.setAttribute("value",75),le()}))})),await(0,Ac.mK)(this.map,this._initParams.getMapPostInit()),(0,ls.initMapKeyboardHandler)(this),(0,ls.linkMapAndPhoto)(this)}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const le=this._initParams.getParentPostInit();this._initPSV(),await this._initMap(),this._initWidgets(),this._moveChildToGrid(),(0,Ac.iz)(this,le),le.keyboardShortcuts&&this._handleKeyboardManagement(),le.willLoadPicture?this.psv.addEventListener("picture-loaded",(vt=>{(0,Ac.iz)(this,le),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()}_handleKeyboardManagement(){window.addEventListener("click",(le=>this._toggleKeyboardBasedOnFocus(le))),window.addEventListener("keypress",this._toggleKeyboardBasedOnFocus.bind(this)),this.addEventListener("focus-changed",(le=>{this.popup.getAttribute("visible")?this._disableKeyboard():"map"===le.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 le of this.grid.childNodes)"bg"===le.getAttribute("slot")||ho.RD.includes(le.tagName.toLowerCase())||(le.addEventListener("focusin",this._disableKeyboard.bind(this)),le.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&this._enableKeyboard()})))}moveCenter(){const le=this.psv.getPictureMetadata();le&&(this.map&&this.isMapWide()?this.map.flyTo({center:le.gps,zoom:20}):super.moveCenter())}_moveToDirection(le){if(this.map&&this.isMapWide()){let vt;switch(le){case"up":vt=[0,-100];break;case"left":vt=[-100,0];break;case"down":vt=[0,Ec];break;case"right":vt=[Ec,0]}this.map.panBy(vt)}else super._moveToDirection(le)}isMapWide(){return this.mapContainer.parentNode==this.grid}_setFocus(le){var vt,bt,ls,ho;let Dl=arguments.length>1&&void 0!==arguments[1]&&arguments[1],gc=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("map"===le&&!this.map)throw new Error("Map is not enabled");if(!["map","pic"].includes(le))throw new Error("Invalid focus value (should be pic or map)");if(this.focus=le,(gc||("map"!==le||!this.map||!this.isMapWide())&&("pic"!==le||this.map&&this.isMapWide()))&&("map"===le?(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,sc.fa)(uc.pt),this._miniPicLegend&&this.mini.appendChild(this._miniPicLegend),(0,Fl.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,sc.fa)(mc.e5),this.psvContainer.focus()),null===this||void 0===this||null===(vt=this.map)||void 0===vt||null===(bt=vt.resize)||void 0===bt||bt.call(vt),this.psv.autoSize(),this.psv.forceRefresh(),null===(ls=this.legend)||void 0===ls||null===(ho=ls.setAttribute)||void 0===ho||ho.call(ls,"focus",this.focus),!Dl)){const vt=new CustomEvent("focus-changed",{detail:{focus:le}});this.dispatchEvent(vt)}}_toggleFocus(){this._setFocus(this.isMapWide()?"pic":"map")}_onMiniExpand(){this.map.resize(),this.psv.autoSize()}_onMapFiltersChange(){var le;const vt=(0,gc.qi)("#pnx-map-filters-menu"),bt=(0,gc.qi)("#pnx-map-theme"),ho=(0,ls.mapFiltersFormValues)(vt,bt,null===(le=this.map)||void 0===le?void 0:le._hasQualityScore());this.map.setFilters(ho)}_showLocationPrecisionDoc(){this.setPopup(!0,[(0,sc.createWebComp)("pnx-location-precision-doc",{_t:this._t})])}}Viewer.properties={"map-options":{converter:ho.Ay.GetJSONConverter()},focus:{type:String,reflect:!0},geocoder:{type:String},tabindex:{type:Number},...ho.Ay.properties},customElements.define("pnx-viewer",Viewer)},3921:(le,vt,bt)=>{"use strict";bt.r(vt),bt.d(vt,{Basic:()=>ls.A,CoverageMap:()=>ho.A,Editor:()=>Dl.A,PhotoViewer:()=>sc.Ay,Viewer:()=>Fl.A});var ls=bt(9039),ho=bt(153),Dl=bt(1752),Fl=bt(8743),sc=bt(3407)},9341:(le,vt,bt)=>{"use strict";bt.r(vt),bt.d(vt,{core:()=>ls,layout:()=>ho,menus:()=>Dl,ui:()=>Fl});var ls=bt(3921),ho=bt(456),Dl=bt(8794),Fl=bt(7091)},6784:(le,vt,bt)=>{"use strict";bt.d(vt,{A:()=>BottomDrawer});var ls=bt(4542),ho=bt(1198),Dl=bt(5995);const Fl={opened:0,"half-opened":.7,closed:1};class BottomDrawer extends ls.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 le=this._getDrawer();le&&(le.style.height=`${this._drawerHeight}px`,le.style.maxHeight=`${this._drawerHeight}px`,(0,Dl.onceParentAvailable)(this).then((()=>this._parent.onceReady())).then((()=>{var le,vt;null===(le=this._parent.map)||void 0===le||le.addEventListener("click",(()=>this.openness="closed")),null===(vt=this._parent.psv)||void 0===vt||vt.addEventListener("click",(()=>this.openness="closed"))})))}attributeChangedCallback(le,vt,bt){if(super.attributeChangedCallback(le,vt,bt),"openness"===le){if("opened"!==bt){const le=this.shadowRoot.querySelector(".content");le&&(le.scrollTop=0)}const le=this._getDrawer();le&&(le.style.transform=null)}}disconnectedCallback(){super.disconnectedCallback(),this._cleanupTouchListeners()}_getDrawer(){var le;return null===(le=this.shadowRoot)||void 0===le?void 0:le.querySelector(".drawer")}_onHandleClick(){"opened"===this.openness?this.openness="closed":"half-opened"===this.openness?this.openness="opened":"closed"===this.openness&&(this.openness="half-opened")}_onTouchStart(le){this._isDragging=!0,this._startFingerY=le.touches[0].clientY,this._deltaFingerY=0,this._drawerY=this._drawerHeight*Fl[this.openness],window.addEventListener("touchmove",this._boundTouchMove,{passive:!0}),window.addEventListener("touchend",this._boundTouchEnd),window.addEventListener("touchcancel",this._boundTouchEnd)}_onTouchMove(le){if(!this._isDragging)return;const vt=this.shadowRoot.querySelector(".content");vt.scrollHeight>vt.offsetHeight&&vt.scrollTop>0?this._updateDrawerTransform(0):(this._deltaFingerY=le.touches[0].clientY-this._startFingerY,this._updateDrawerTransform(this._drawerY+this._deltaFingerY))}_onTouchEnd(le){(this._isDragging&&!(Math.abs(this._deltaFingerY)<30)||le.target.closest(".handle"))&&(le.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(le){let vt=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const bt=this._getDrawer();bt&&(le=Math.max(0,Math.min(le,this._drawerHeight-30)),vt&&(this._deltaFingerY<0?"closed"===this.openness?Math.abs(this._deltaFingerY)>this._drawerHeight*(1-Fl["half-opened"])?this.openness="opened":this.openness="half-opened":this.openness="opened":this.openness="closed",this._drawerY=null,le=Math.max(0,Math.min(Fl[this.openness]*this._drawerHeight,this._drawerHeight-30))),bt.style.transform=`translateY(${le}px)`)}render(){const le={drawer:!0,[this.openness]:!0,dragging:this._isDragging};return ls.qy`
|
|
12
|
+
!function(le,vt){"object"===typeof exports&&"object"===typeof module?module.exports=vt():"function"===typeof define&&define.amd?define("Panoramax",[],vt):"object"===typeof exports?exports.Panoramax=vt():le.Panoramax=vt()}(this,(()=>(()=>{var le={9039:(le,vt,bt)=>{"use strict";bt.d(vt,{A:()=>Basic});var ls=bt(4542),ho=bt(5254),Dl=bt(4964),Fl=bt(7208),sc=bt(5995),uc=bt(7343),mc=bt(2614),gc=bt.n(mc),Ac=bt(8330);bt(1865),bt(3638);class Basic extends ls.WF{constructor(){let le=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.users=["geovisio"],this["map-style"]=this.getAttribute("map-style")||(0,Fl.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 ${Ac.rE} (b7ee2f6)\n\n\ud83c\udd98 Issues can be reported at ${Ac.Jk.O}`),le||(this._isInternetFast=null,(0,uc.isInternetFast)().then((le=>this._isInternetFast=le)))}connectedCallback(){super.connectedCallback(),this._t=(0,Dl.getTranslations)(this.lang),this.loader=(0,sc.createWebComp)("pnx-loader",{_parent:this,"no-label":(0,uc.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((le=>{let[vt,bt]=le;this.getAttribute(vt)&&console.error(`Component attribute "${vt}" has been renamed into "${bt}". Old attribute "${vt}" is ignored.`)})),(0,uc.isInIframe)()&&this.classList.add("pnx-iframed")}_setupAPI(){if(this.loader=this.loader||(0,sc.createWebComp)("pnx-loader",{_parent:this}),!this.endpoint)return void console.warn("No endpoint is defined");this._loadsAPI=this.endpoint;let le=this.endpoint;try{this["map-style"]=JSON.parse(this["map-style"])}catch(bt){}try{this.api=new ho.A(this.endpoint,{users:this.users,fetch:this["fetch-options"],style:this["map-style"]}),this.api.onceReady().then((()=>{if(le!=this._loadsAPI||!this.api)return;let vt=this.api.getUnavailableFeatures(),bt=this.api.getAvailableFeatures();bt=0===vt.length?"\u2705 All features available":"\u2705 Available features: "+bt.join(", "),vt=0===vt.length?"":"\ud83d\udeab Unavailable features: "+vt.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 ${bt}\n ${vt}\n`.trim())})).catch((le=>this.loader.dismiss(le,this._t.pnx.error_api))).finally((()=>delete this._loadsAPI))}catch(bt){var vt;delete this._loadsAPI,null!==(vt=this.loader)&&void 0!==vt&&vt.dismiss?this.loader.dismiss(bt,this._t.pnx.error_api):console.error(bt)}}onceReady(){throw new Error("You must override this method on sub-class")}onceAPIReady(){return this.api?this.api.onceReady():new Promise((le=>setTimeout(le,100))).then(this.onceAPIReady.bind(this))}createRenderRoot(){return this}attributeChangedCallback(le,vt,bt){if(super.attributeChangedCallback(le,vt,bt),"endpoint"===le&&(this._loadsAPI&&bt&&this._loadsAPI===bt||this.api&&this.api._endpoint===bt||!bt||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())),["picture","sequence"].includes(le)){let ls,ho,Dl,Fl;"picture"===le?(ls=this.sequence,Dl=this.sequence,ho=bt,Fl=vt):(ls=bt,Dl=vt,ho=this.picture,Fl=this.picture),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{seqId:ls,picId:ho,prevSeqId:Dl,prevPicId:Fl}}))}}getClassName(){return"Basic"}select(){let le=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,vt=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=vt,this.sequence=le}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 ls.qy`<p>Should not be used directly, use Viewer/CoverageMap/Editor instead</p>`}getSubComponentsNames(){return["loader","api"]}addEventListener(le,vt,bt){let ls=le.split(":").shift();if(ls&&this.getSubComponentsNames().includes(ls)){var ho;const Dl=le.substring(ls.length+1);null!==(ho=this[ls])&&void 0!==ho&&ho.addEventListener?this[ls].addEventListener(Dl,vt,bt):setTimeout((()=>this.addEventListener(le,vt,bt)),50)}else super.addEventListener(le,vt,bt)}static GetJSONConverter(){return{fromAttribute:le=>null===le||""===le?null:"object"===typeof le||Array.isArray(le)?le:gc().parse(le),toAttribute:le=>null===le||""===le?"":"string"===typeof le?le:gc().stringify(le)}}}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:(le,vt,bt)=>{"use strict";bt.d(vt,{A:()=>CoverageMap});var ls=bt(9039),ho=bt(5642),Dl=bt(8340),Fl=bt(927),sc=(bt(7776),bt(2118));class CoverageMap extends ls.A{constructor(){super(),this._mapContainer=document.createElement("div"),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this._initParams=new sc.Ay(sc.Ay.GetComponentProperties(CoverageMap,this)),this._initMap()}))}disconnectedCallback(){var le;super.disconnectedCallback(),null===(le=this.map)||void 0===le||le.destroy()}getClassName(){return"CoverageMap"}onceReady(){return this.map&&this.map.waitForEnoughMapLoaded?this.map.waitForEnoughMapLoaded():new Promise((le=>setTimeout(le,100))).then(this.onceReady.bind(this))}render(){return[this.loader,this._mapContainer]}getSubComponentsNames(){const le=super.getSubComponentsNames();return le.push("map"),le}_initMap(){this.map=new ho.A(this,this._mapContainer,Object.assign({},this._initParams.getMapInit(),{hash:!0})),this.map.addControl(new Fl.NavigationControl({showCompass:!1})),this.loader.setAttribute("value",70),this.addEventListener("select",this._onSelect.bind(this)),this.map.on("picture-click",(le=>this.select(le.seqId,le.picId))),this.map.on("sequence-click",(le=>this.select(le.seqId))),this.map.waitForEnoughMapLoaded().then((async()=>{await(0,sc.mK)(this.map,this._initParams.getMapPostInit()),this.map.reloadLayersStyles(),this.loader.dismiss()}))}_onSelect(le){if(le.detail.picId||le.detail.seqId){const vt=le.detail.picId?"pictures":"sequences",bt=this.map.queryRenderedFeatures({layers:[...this.map._userLayers].map((le=>(0,Dl.getUserLayerId)(le,vt))),filter:["==",["get","id"],le.detail.picId||le.detail.seqId]});bt.length>=0&&null!=bt[0]&&this.map._attachPreviewToPictures({features:bt},vt)}}}CoverageMap.properties={"map-options":{converter:ls.A.GetJSONConverter()},...ls.A.properties},customElements.define("pnx-coverage-map",CoverageMap)},1752:(le,vt,bt)=>{"use strict";bt.d(vt,{A:()=>Editor});bt(7365);var ls=bt(9039),ho=bt(5642),Dl=bt(9048),Fl=bt(508),sc=bt(8340),uc=bt(1545),mc=bt(5995);const gc="sequence-headings";class Editor extends ls.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,mc.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 le,vt;super.disconnectedCallback(),null===(le=this.map)||void 0===le||le.destroy(),null===(vt=this.psv)||void 0===vt||vt.destroy()}getClassName(){return"Editor"}onceReady(){var le,vt;return this.map&&this.psv&&null!==(le=(vt=this.map).loaded)&&void 0!==le&&le.call(vt)?Promise.resolve():new Promise((le=>setTimeout(le,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(le,vt,bt){"users"===le&&Array.isArray(bt)&&bt.length>0?console.warn("Parameters users can't be changed in Editor, only selected sequence can be visible"):super.attributeChangedCallback(le,vt,bt)}render(){return[this.loader,this.grid]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["map","psv","grid"])}_initPSV(){try{this.psv=new Dl.Ay(this,this._psvContainer),this.psv._myVTour.datasource.nodeResolver=this._getNode.bind(this),this.grid.appendChild((0,mc.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:"xl",more:"never"}))}catch(le){let vt=uc.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(le,vt)}}_initMap(){try{this.map=new ho.A(this,this._mapContainer,{raster:this.raster,background:this.background,supplementaryStyle:this._createMapStyle(),zoom:15,picMarkerDraggable:!0}),(0,sc.linkMapAndPhoto)(this),this.loader.setAttribute("value",50),this._loadSequence(),this.map.once("load",(()=>{this.map.hasTwoBackgrounds()&&this._addMapBackgroundWidget(),this._bindPicturesEvents()}));const le=this.map._picMarker.setRotation.bind(this.map._picMarker);this.map._picMarker.setRotation=vt=>(vt=void 0===this._lastRelHeading?vt:vt+this._lastRelHeading-this.psv.getPictureRelativeHeading(),le(vt))}catch(le){this.loader.dismiss(le,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:{...sc.VECTOR_STYLES_NOCROWD.SEQUENCES.layout},paint:{...sc.VECTOR_STYLES_NOCROWD.SEQUENCES.paint}},{id:"geovisio_editor_pictures",type:"circle",source:"geovisio_editor_sequences",layout:{...sc.VECTOR_STYLES_NOCROWD.PICTURES.layout},paint:{...sc.VECTOR_STYLES_NOCROWD.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((le=>{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=le.features,this.map.getSource("geovisio_editor_sequences").setData({type:"FeatureCollection",features:[{id:this.sequence,type:"Feature",properties:{id:this.sequence},geometry:{type:"LineString",coordinates:le.features.map((le=>le.geometry.coordinates))}},...le.features.map((le=>(le.properties.id=le.id,le.properties.sequences=[this.sequence],le)))]}),this.picture){const vt=le.features.find((le=>le.id===this.picture));vt?(this.select(this.sequence,this.picture,!0),this.map.jumpTo({center:vt.geometry.coordinates,zoom:18})):console.log("Picture with ID",vt,"was not found")}else{const vt=[...le.features[0].geometry.coordinates,...le.features[0].geometry.coordinates];for(let bt=1;bt<le.features.length;bt++){const ls=le.features[bt].geometry.coordinates;ls[0]<vt[0]&&(vt[0]=ls[0]),ls[1]<vt[1]&&(vt[1]=ls[1]),ls[0]>vt[2]&&(vt[2]=ls[0]),ls[1]>vt[3]&&(vt[3]=ls[1])}this.map.fitBounds(vt,{animate:!1})}})).catch((le=>this.loader.dismiss(le,this._t.pnx.error_api)))}_getNode(le){const vt=this._sequenceData.find((vt=>vt.properties.id===le)),bt=vt?(0,Fl.apiFeatureToPSVNode)(vt,this._t,this._isInternetFast,void 0,(le=>this.api.cleanResourceURL(le))):null;return bt&&delete bt.links,bt}_addMapBackgroundWidget(){const le=(0,mc.createWebComp)("pnx-map-background",{_parent:this,size:"sm",slot:"bottom-left"});this.grid.appendChild(le)}_moveChildToGrid(){Array.from(this.querySelectorAll("[slot]")).forEach((le=>{var vt;null!==(vt=le.tagName)&&void 0!==vt&&vt.toLowerCase().startsWith("pnx-")&&(le._parent=this,le._t=this._t),this.grid.appendChild(le)}))}previewSequenceHeadingChange(le){const vt=void 0!==this.map.getLayer(gc);if(this.map._picMarkerPreview.remove(),void 0===le)return delete this._lastRelHeading,vt&&this.map.setLayoutProperty(gc,"visibility","none"),void(this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x));this._lastRelHeading=le,vt||this.map.addLayer({id:gc,type:"symbol",source:"geovisio_editor_sequences",layout:{"icon-image":"pnx-marker","icon-overlap":"always","icon-size":.8}});const bt=-this.psv.getPictureRelativeHeading();this.map.setLayoutProperty(gc,"visibility","visible"),this.map.setLayoutProperty(gc,"icon-rotate",["+",["get","view:azimuth"],bt,le]);const ls=[["==",["geometry-type"],"Point"]];this.picture&&ls.push(["!=",["get","id"],this.picture]),this.map.setFilter(gc,["all",...ls]),this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x)}_onSelect(){void 0!==this._lastRelHeading&&this.previewSequenceHeadingChange(this._lastRelHeading)}}Editor.properties={raster:{converter:ls.A.GetJSONConverter()},background:{type:String},...ls.A.properties},customElements.define("pnx-editor",Editor)},3407:(le,vt,bt)=>{"use strict";bt.d(vt,{$p:()=>Ac,Ay:()=>PhotoViewer,RD:()=>kc});bt(970);var ls=bt(1545),ho=bt(4451),Dl=bt(9039),Fl=bt(9048),sc=bt(5995),uc=bt(7343),mc=bt(2118),gc=bt(4207);const Ac=20,Ec=Math.PI/6,kc=["pnx-mini","pnx-widget-player","pnx-widget-zoom"];class PhotoViewer extends Dl.A{constructor(){super(),this["psv-options"]={},this["url-parameters"]=this.getAttribute("url-parameters")||"true",this["keyboard-shortcuts"]=this.getAttribute("keyboard-shortcuts")||"true",this["skip-tags-menu-opening"]="true"!==(this.getAttribute("skip-tags-menu-opening")||"false"),this["share-base-url"]=this.getAttribute("share-base-url")||null,this.widgets=this.getAttribute("widgets")||"true",this.grid=(0,sc.createWebComp)("pnx-cornered-grid"),this.psvContainer=document.createElement("div"),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.popup=(0,sc.createWebComp)("pnx-popup",{_parent:this,onclose:this._onPopupClose.bind(this)}),this.tabindex=0,this._sequencesMetadata={}}_createInitParamsHandler(){var le,vt;this._initParams=new mc.Ay(mc.Ay.GetComponentProperties(PhotoViewer,this),Object.assign({},null===(le=this.urlHandler)||void 0===le?void 0:le.currentURLParams(),null===(vt=this.urlHandler)||void 0===vt?void 0:vt.currentURLParams(!0)),{disableAnnotations:localStorage.getItem(uc.DISABLE_ANNOTATIONS_PARAM)})}_initWidgets(){"false"!==this._initParams.getParentPostInit().widgets&&((0,uc.isInIframe)()||(this.grid.appendChild((0,sc.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,sc.createWebComp)("pnx-annotations-switch",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"}))),(0,uc.isInIframe)()?(this.legend=(0,sc.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,sc.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,sc.createWebComp)("pnx-bottom-drawer",{slot:"bottom",_parent:this,class:this._initParams.getParentPostInit().willLoadPicture?void 0:"pnx-hidden"}),this.bottomDrawer.appendChild(this.legend),this.grid.appendChild(this.bottomDrawer),this.addEventListener("select",(le=>{(0,uc.isNullId)(le.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,sc.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,sc.createWebComp)("pnx-widget-zoom",{slot:"bottom-right",class:"pnx-print-hidden",_parent:this})),this.grid.appendChild(this.legend)))}connectedCallback(){super.connectedCallback(),this.presetsManager=new gc.A(this.lang),"false"!==this["url-parameters"]&&(this.urlHandler=new ho.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 le,vt;super.disconnectedCallback(),null===(le=this.urlHandler)||void 0===le||le.destroy(),null===(vt=this.psv)||void 0===vt||vt.destroy(),document.body.removeEventListener("click",this._toggleKeyboardBasedOnFocus),window.removeEventListener("keypress",this._toggleKeyboardBasedOnFocus)}getClassName(){return"PhotoViewer"}onceReady(){return this.oncePSVReady().then((()=>this._initParams.getParentPostInit().willLoadPicture&&!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 le;return new Promise((vt=>{le=setInterval((()=>{this.psv&&"object"===typeof this.psv&&(this.psv.container?(clearInterval(le),vt()):this.psv.addEventListener&&this.psv.addEventListener("ready",(()=>{clearInterval(le),vt()}),{once:!0}))}),250)}))}onceFirstPicLoaded(){return this.oncePSVReady().then((()=>this.psv.getPictureMetadata()?Promise.resolve():new Promise((le=>{this.psv.addEventListener("picture-loaded",le,{once:!0})}))))}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const le=this._initParams.getParentPostInit();this._initPSV(),this._initWidgets(),(0,mc.ai)(this,le),le.keyboardShortcuts&&this._handleKeyboardManagement(),le.willLoadPicture?this.psv.getPictureMetadata()?this.loader.dismiss():this.psv.addEventListener("picture-loaded",(()=>this.loader.dismiss()),{once:!0}):this.loader.dismiss()}_initPSV(){try{this.psv=new Fl.Ay(this,this.psvContainer,{shouldGoFast:this._psvShouldGoFast.bind(this),keyboard:"always",keyboardActions:{...ls.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 le;return null===(le=this._toggleFocus)||void 0===le?void 0:le.call(this)},7:()=>{var le;return null===(le=this._toggleFocus)||void 0===le?void 0:le.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,mc.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"))),this.psv.addEventListener("dblclick",(()=>clearTimeout(this._gridFocus))),this.psv.addEventListener("click",(le=>{clearTimeout(this._gridFocus),"CANVAS"===le.data.target.tagName&&(!this.isMapWide||this.isMapWide&&!this.isMapWide())&&(this._gridFocus=setTimeout((()=>{this.grid.toggleAway()?this.classList.add("pnx-grid-toggled"):this.classList.remove("pnx-grid-toggled")}),250))})),this.psvContainer.addEventListener("mousemove",(()=>{this.grid._hidden&&(clearTimeout(this._gridFocus),this.grid.toggleAway(!0),this.classList.remove("pnx-grid-toggled"))}))}catch(le){let vt=ls.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(le,vt)}}_enableKeyboard(){this.psv.startKeyboardControl()}_disableKeyboard(){this.psv.stopKeyboardControl()}_toggleKeyboardBasedOnFocus(le){const vt=(null===le||void 0===le?void 0:le.target)||document.activeElement;if(this.contains(vt)){for(let le of this.grid.childNodes)if("bg"!==le.getAttribute("slot")&&!kc.includes(le.tagName.toLowerCase())&&le.contains(vt))return void this._disableKeyboard();if(null!==this.popup.getAttribute("visible"))return void this._disableKeyboard();this._enableKeyboard()}else this._disableKeyboard()}_handleKeyboardManagement(){window.addEventListener("click",(le=>this._toggleKeyboardBasedOnFocus(le))),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 le of this.grid.childNodes)"bg"===le.getAttribute("slot")||kc.includes(le.tagName.toLowerCase())||(le.addEventListener("focusin",this._disableKeyboard.bind(this)),le.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((le=>{var vt;null!==(vt=le.tagName)&&void 0!==vt&&vt.toLowerCase().startsWith("pnx-")&&(le._parent=this,le._t=this._t),"editors"===le.getAttribute("slot")?this.onceReady().then((()=>{var vt;return null===(vt=this.legend)||void 0===vt?void 0:vt.appendChild(le)})):this.grid.appendChild(le)}))}setPopup(le){let vt=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;le?this.popup.setAttribute("visible",""):this.popup.removeAttribute("visible"),this.popup.innerHTML="","string"===typeof vt?this.popup.innerHTML=vt:Array.isArray(vt)&&vt.forEach((le=>this.popup.appendChild(le)))}_onPopupClose(){this.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:this.map&&this.isMapWide()?"map":"pic"}}))}_showQualityScoreDoc(){this.setPopup(!0,[(0,sc.createWebComp)("pnx-quality-score-doc",{_t:this._t})])}_showReportForm(){if(!this.psv.getPictureMetadata())throw new Error("No picture currently selected");this.setPopup(!0,[(0,sc.createWebComp)("pnx-report-form",{_parent:this})])}_showShareOptions(){this.setPopup(!0,[(0,sc.createWebComp)("pnx-share-menu",{_parent:this,"base-url":this["share-base-url"]})])}_showSemanticsDoc(){this.setPopup(!0,[(0,sc.createWebComp)("pnx-semantics-doc",{_t:this._t})])}_showSemanticsDownload(){this.setPopup(!0,[(0,sc.createWebComp)("pnx-semantics-download",{_t:this._t})])}moveCenter(){this.psv.getPictureMetadata()&&this._psvAnimate({speed:Fl.LM,yaw:0,pitch:0,zoom:Fl.cS})}moveLeft(){this._moveToDirection("left")}moveRight(){this._moveToDirection("right")}moveUp(){this._moveToDirection("up")}moveDown(){this._moveToDirection("down")}_moveToDirection(le){let vt=this.psv.getPosition();switch(le){case"up":vt.pitch+=Ec;break;case"left":vt.yaw-=Ec;break;case"down":vt.pitch-=Ec;break;case"right":vt.yaw+=Ec}this._psvAnimate({speed:Fl.LM,...vt})}_psvAnimate(le){this._lastPsvAnim&&this._lastPsvAnim.cancel(),this._lastPsvAnim=this.psv.animate(le)}addEventListener(le,vt,bt){super.addEventListener(le,vt,bt)}}PhotoViewer.properties={"psv-options":{converter:Dl.A.GetJSONConverter()},widgets:{type:String},"url-parameters":{type:String},"keyboard-shortcuts":{type:String},tabindex:{type:Number},"skip-tags-menu-opening":{type:String},"share-base-url":{type:String},...Dl.A.properties},customElements.define("pnx-photo-viewer",PhotoViewer)},8743:(le,vt,bt)=>{"use strict";bt.d(vt,{A:()=>Viewer});bt(9616);var ls=bt(8340),ho=bt(3407),Dl=bt(2771),Fl=bt(7343),sc=bt(5995),uc=bt(9683),mc=bt(2e3),gc=bt(9438),Ac=bt(2118);const Ec=100;class Viewer extends ho.Ay{constructor(){super(),this["map-options"]=!0,this.geocoder=this.getAttribute("geocoder")||"nominatim",this.mini=(0,sc.createWebComp)("pnx-mini",{slot:"bottom-left",_parent:this,onexpand:this._onMiniExpand.bind(this),collapsed:!!(0,Fl.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 le,vt;this._initParams=new Ac.Ay(Ac.Ay.GetComponentProperties(Viewer,this),Object.assign({},null===(le=this.urlHandler)||void 0===le?void 0:le.currentURLParams(),null===(vt=this.urlHandler)||void 0===vt?void 0:vt.currentURLParams(!0)),{map:(0,ls.getMapParamsFromLocalStorage)(),disableAnnotations:localStorage.getItem(Fl.DISABLE_ANNOTATIONS_PARAM)})}_initWidgets(){var le,vt;"false"!==this._initParams.getParentPostInit().widgets&&(this.grid.appendChild((0,sc.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,Fl.isInIframe)()?(this.legend=(0,sc.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,sc.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,sc.createWebComp)("pnx-bottom-drawer",{slot:"bottom",_parent:this,class:this._initParams.getParentPostInit().willLoadPicture?void 0:"pnx-hidden"}),this.bottomDrawer.appendChild(this.legend),this.grid.appendChild(this.bottomDrawer),this.addEventListener("select",(le=>{(0,Fl.isNullId)(le.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,sc.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,sc.createWebComp)("pnx-mini-picture-legend",{_parent:this}),this.grid.appendChild(this.legend)),(0,Fl.isInIframe)()||(this.grid.appendChild((0,sc.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,sc.createWebComp)("pnx-annotations-switch",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,sc.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,sc.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===(le=this.map)||void 0===le||null===(vt=le._hasQualityScore)||void 0===vt?void 0:vt.call(le))||!1,class:"pnx-only-map pnx-print-hidden"})),this.grid.appendChild((0,sc.createWebComp)("pnx-widget-semantics-filters",{slot:this.isWidthSmall()?"top-right":"top-left",_parent:this,class:"pnx-only-map pnx-print-hidden"})),this.grid.appendChild((0,sc.createWebComp)("pnx-widget-maplayers",{slot:"top-right",_parent:this,class:"pnx-only-map pnx-print-hidden"}))))}disconnectedCallback(){var le;super.disconnectedCallback(),null===(le=this.map)||void 0===le||le.destroy()}getClassName(){return"Viewer"}getSubComponentsNames(){return super.getSubComponentsNames().concat(["mini","map"])}onceReady(){return Promise.all([this.oncePSVReady(),this.onceMapReady()]).then((()=>this._initParams.getParentPostInit().willLoadPicture&&!this.psv.getPictureMetadata()?this.onceFirstPicLoaded():Promise.resolve()))}attributeChangedCallback(le,vt,bt){var ls,ho;if(super.attributeChangedCallback(le,vt,bt),"picture"===le)if(null===(ls=this.legend)||void 0===ls||null===(ho=ls.setAttribute)||void 0===ho||ho.call(ls,"picture",bt),(0,Fl.isNullId)(vt)&&!(0,Fl.isNullId)(bt)&&this.mini.removeAttribute("collapsed"),(0,Fl.isNullId)(bt))this.map&&this.isMapWide()?this.mini.classList.add("pnx-hidden"):this.map&&!this.isMapWide()&&this._setFocus("map");else if((0,Fl.isNullId)(vt)&&this.sequence==this._initParams.getParentPostInit().sequence&&!this._initParams.getParentPostInit().picture){var Dl,sc;this.mini.classList.remove("pnx-hidden"),this.mini.removeAttribute("collapsed"),"closed"===(null===(Dl=this.bottomDrawer)||void 0===Dl||null===(sc=Dl.getAttribute)||void 0===sc?void 0:sc.call(Dl,"openness"))&&this.bottomDrawer.setAttribute("openness","half-opened")}else{var uc,mc;if(this.mini.classList.remove("pnx-hidden"),(0,Fl.isNullId)(vt))this._setFocus("pic"),"closed"===(null===(uc=this.bottomDrawer)||void 0===uc||null===(mc=uc.getAttribute)||void 0===mc?void 0:mc.call(uc,"openness"))&&this.bottomDrawer.setAttribute("openness","half-opened")}"focus"===le&&this._setFocus(bt)}onceMapReady(){if(!this["map-options"])return Promise.resolve();let le;return new Promise((vt=>{le=setInterval((()=>{var bt,ls,ho;"object"===typeof this.map&&(null!==(bt=this.map)&&void 0!==bt&&null!==(ls=bt.loaded)&&void 0!==ls&&ls.call(bt)?(clearInterval(le),vt()):null!==(ho=this.map)&&void 0!==ho&&ho.once&&this.map.once("render",(()=>{clearInterval(le),vt()})))}),250)}))}async _initMap(){await new Promise((le=>{this.map=new Dl.A(this,this.mapContainer,this._initParams.getMapInit()),(0,ls.saveMapParamsToLocalStorage)(this.map),this.map.once("users-changed",(()=>{this.loader.setAttribute("value",75),le()}))})),await(0,Ac.mK)(this.map,this._initParams.getMapPostInit()),(0,ls.initMapKeyboardHandler)(this),(0,ls.linkMapAndPhoto)(this)}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const le=this._initParams.getParentPostInit();this._initPSV(),await this._initMap(),this._initWidgets(),this._moveChildToGrid(),(0,Ac.iz)(this,le),le.keyboardShortcuts&&this._handleKeyboardManagement(),le.willLoadPicture?this.psv.addEventListener("picture-loaded",(vt=>{(0,Ac.iz)(this,le),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()}_handleKeyboardManagement(){window.addEventListener("click",(le=>this._toggleKeyboardBasedOnFocus(le))),window.addEventListener("keypress",this._toggleKeyboardBasedOnFocus.bind(this)),this.addEventListener("focus-changed",(le=>{this.popup.getAttribute("visible")?this._disableKeyboard():"map"===le.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 le of this.grid.childNodes)"bg"===le.getAttribute("slot")||ho.RD.includes(le.tagName.toLowerCase())||(le.addEventListener("focusin",this._disableKeyboard.bind(this)),le.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&this._enableKeyboard()})))}moveCenter(){const le=this.psv.getPictureMetadata();le&&(this.map&&this.isMapWide()?this.map.flyTo({center:le.gps,zoom:20}):super.moveCenter())}_moveToDirection(le){if(this.map&&this.isMapWide()){let vt;switch(le){case"up":vt=[0,-100];break;case"left":vt=[-100,0];break;case"down":vt=[0,Ec];break;case"right":vt=[Ec,0]}this.map.panBy(vt)}else super._moveToDirection(le)}isMapWide(){return this.mapContainer.parentNode==this.grid}_setFocus(le){var vt,bt,ls,ho;let Dl=arguments.length>1&&void 0!==arguments[1]&&arguments[1],gc=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("map"===le&&!this.map)throw new Error("Map is not enabled");if(!["map","pic"].includes(le))throw new Error("Invalid focus value (should be pic or map)");if(this.focus=le,(gc||("map"!==le||!this.map||!this.isMapWide())&&("pic"!==le||this.map&&this.isMapWide()))&&("map"===le?(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,sc.fa)(uc.pt),this._miniPicLegend&&this.mini.appendChild(this._miniPicLegend),(0,Fl.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,sc.fa)(mc.e5),this.psvContainer.focus()),null===this||void 0===this||null===(vt=this.map)||void 0===vt||null===(bt=vt.resize)||void 0===bt||bt.call(vt),this.psv.autoSize(),this.psv.forceRefresh(),null===(ls=this.legend)||void 0===ls||null===(ho=ls.setAttribute)||void 0===ho||ho.call(ls,"focus",this.focus),!Dl)){const vt=new CustomEvent("focus-changed",{detail:{focus:le}});this.dispatchEvent(vt)}}_toggleFocus(){this._setFocus(this.isMapWide()?"pic":"map")}_onMiniExpand(){this.map.resize(),this.psv.autoSize()}_onMapFiltersChange(){var le;const vt=(0,gc.qi)("#pnx-map-filters-menu"),bt=(0,gc.qi)("#pnx-map-theme"),ho=(0,ls.mapFiltersFormValues)(vt,bt,null===(le=this.map)||void 0===le?void 0:le._hasQualityScore());this.map.setFilters(ho)}_showLocationPrecisionDoc(){this.setPopup(!0,[(0,sc.createWebComp)("pnx-location-precision-doc",{_t:this._t})])}}Viewer.properties={"map-options":{converter:ho.Ay.GetJSONConverter()},focus:{type:String,reflect:!0},geocoder:{type:String},tabindex:{type:Number},...ho.Ay.properties},customElements.define("pnx-viewer",Viewer)},3921:(le,vt,bt)=>{"use strict";bt.r(vt),bt.d(vt,{Basic:()=>ls.A,CoverageMap:()=>ho.A,Editor:()=>Dl.A,PhotoViewer:()=>sc.Ay,Viewer:()=>Fl.A});var ls=bt(9039),ho=bt(153),Dl=bt(1752),Fl=bt(8743),sc=bt(3407)},9341:(le,vt,bt)=>{"use strict";bt.r(vt),bt.d(vt,{core:()=>ls,layout:()=>ho,menus:()=>Dl,ui:()=>Fl});var ls=bt(3921),ho=bt(456),Dl=bt(8794),Fl=bt(7091)},6784:(le,vt,bt)=>{"use strict";bt.d(vt,{A:()=>BottomDrawer});var ls=bt(4542),ho=bt(1198),Dl=bt(5995);const Fl={opened:0,"half-opened":.7,closed:1};class BottomDrawer extends ls.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 le=this._getDrawer();le&&(le.style.height=`${this._drawerHeight}px`,le.style.maxHeight=`${this._drawerHeight}px`,(0,Dl.onceParentAvailable)(this).then((()=>this._parent.onceReady())).then((()=>{var le,vt;null===(le=this._parent.map)||void 0===le||le.addEventListener("click",(()=>this.openness="closed")),null===(vt=this._parent.psv)||void 0===vt||vt.addEventListener("click",(()=>this.openness="closed"))})))}attributeChangedCallback(le,vt,bt){if(super.attributeChangedCallback(le,vt,bt),"openness"===le){if("opened"!==bt){const le=this.shadowRoot.querySelector(".content");le&&(le.scrollTop=0)}const le=this._getDrawer();le&&(le.style.transform=null)}}disconnectedCallback(){super.disconnectedCallback(),this._cleanupTouchListeners()}_getDrawer(){var le;return null===(le=this.shadowRoot)||void 0===le?void 0:le.querySelector(".drawer")}_onHandleClick(){"opened"===this.openness?this.openness="closed":"half-opened"===this.openness?this.openness="opened":"closed"===this.openness&&(this.openness="half-opened")}_onTouchStart(le){this._isDragging=!0,this._startFingerY=le.touches[0].clientY,this._deltaFingerY=0,this._drawerY=this._drawerHeight*Fl[this.openness],window.addEventListener("touchmove",this._boundTouchMove,{passive:!0}),window.addEventListener("touchend",this._boundTouchEnd),window.addEventListener("touchcancel",this._boundTouchEnd)}_onTouchMove(le){if(!this._isDragging)return;const vt=this.shadowRoot.querySelector(".content");vt.scrollHeight>vt.offsetHeight&&vt.scrollTop>0?this._updateDrawerTransform(0):(this._deltaFingerY=le.touches[0].clientY-this._startFingerY,this._updateDrawerTransform(this._drawerY+this._deltaFingerY))}_onTouchEnd(le){(this._isDragging&&!(Math.abs(this._deltaFingerY)<30)||le.target.closest(".handle"))&&(le.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(le){let vt=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const bt=this._getDrawer();bt&&(le=Math.max(0,Math.min(le,this._drawerHeight-30)),vt&&(this._deltaFingerY<0?"closed"===this.openness?Math.abs(this._deltaFingerY)>this._drawerHeight*(1-Fl["half-opened"])?this.openness="opened":this.openness="half-opened":this.openness="opened":this.openness="closed",this._drawerY=null,le=Math.max(0,Math.min(Fl[this.openness]*this._drawerHeight,this._drawerHeight-30))),bt.style.transform=`translateY(${le}px)`)}render(){const le={drawer:!0,[this.openness]:!0,dragging:this._isDragging};return ls.qy`
|
|
13
13
|
<div
|
|
14
14
|
class=${(0,ho.H)(le)}
|
|
15
15
|
@touchstart="${this._onTouchStart}"
|
package/build/photoviewer.js
CHANGED
|
@@ -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),_=A(7343),E=A(2614),x=A.n(E),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} (edb70d8)\n\n\ud83c\udd98 Issues can be reported at ${w.Jk.O}`),t||(this._isInternetFast=null,(0,_.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,_.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.`)})),(0,_.isInIframe)()&&this.classList.add("pnx-iframed")}_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),_=A(7343),E=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")||"true",this["keyboard-shortcuts"]=this.getAttribute("keyboard-shortcuts")||"true",this["skip-tags-menu-opening"]="true"!==(this.getAttribute("skip-tags-menu-opening")||"false"),this["share-base-url"]=this.getAttribute("share-base-url")||null,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,this._sequencesMetadata={}}_createInitParamsHandler(){var t,a;this._initParams=new E.Ay(E.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)),{disableAnnotations:localStorage.getItem(_.DISABLE_ANNOTATIONS_PARAM)})}_initWidgets(){"false"!==this._initParams.getParentPostInit().widgets&&((0,_.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,_.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().willLoadPicture?void 0:"pnx-hidden"}),this.bottomDrawer.appendChild(this.legend),this.grid.appendChild(this.bottomDrawer),this.addEventListener("select",(t=>{(0,_.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),"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().willLoadPicture&&!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,E.ai)(this,t),t.keyboardShortcuts&&this._handleKeyboardManagement(),t.willLoadPicture?this.psv.getPictureMetadata()?this.loader.dismiss():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,E.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"))),this.psv.addEventListener("dblclick",(()=>clearTimeout(this._gridFocus))),this.psv.addEventListener("click",(t=>{clearTimeout(this._gridFocus),"CANVAS"===t.data.target.tagName&&(!this.isMapWide||this.isMapWide&&!this.isMapWide())&&(this._gridFocus=setTimeout((()=>{this.grid.toggleAway()?this.classList.add("pnx-grid-toggled"):this.classList.remove("pnx-grid-toggled")}),250))})),this.psvContainer.addEventListener("mousemove",(()=>{this.grid._hidden&&(clearTimeout(this._gridFocus),this.grid.toggleAway(!0),this.classList.remove("pnx-grid-toggled"))}))}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();if(null!==this.popup.getAttribute("visible"))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,"base-url":this["share-base-url"]})])}_showSemanticsDoc(){this.setPopup(!0,[(0,v.createWebComp)("pnx-semantics-doc",{_t:this._t})])}_showSemanticsDownload(){this.setPopup(!0,[(0,v.createWebComp)("pnx-semantics-download",{_t:this._t})])}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},"skip-tags-menu-opening":{type:String},"share-base-url":{type:String},...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),_=A(7343),E=A(2614),x=A.n(E),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} (b7ee2f6)\n\n\ud83c\udd98 Issues can be reported at ${w.Jk.O}`),t||(this._isInternetFast=null,(0,_.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,_.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.`)})),(0,_.isInIframe)()&&this.classList.add("pnx-iframed")}_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),_=A(7343),E=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")||"true",this["keyboard-shortcuts"]=this.getAttribute("keyboard-shortcuts")||"true",this["skip-tags-menu-opening"]="true"!==(this.getAttribute("skip-tags-menu-opening")||"false"),this["share-base-url"]=this.getAttribute("share-base-url")||null,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,this._sequencesMetadata={}}_createInitParamsHandler(){var t,a;this._initParams=new E.Ay(E.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)),{disableAnnotations:localStorage.getItem(_.DISABLE_ANNOTATIONS_PARAM)})}_initWidgets(){"false"!==this._initParams.getParentPostInit().widgets&&((0,_.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,_.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().willLoadPicture?void 0:"pnx-hidden"}),this.bottomDrawer.appendChild(this.legend),this.grid.appendChild(this.bottomDrawer),this.addEventListener("select",(t=>{(0,_.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),"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().willLoadPicture&&!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,E.ai)(this,t),t.keyboardShortcuts&&this._handleKeyboardManagement(),t.willLoadPicture?this.psv.getPictureMetadata()?this.loader.dismiss():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,E.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"))),this.psv.addEventListener("dblclick",(()=>clearTimeout(this._gridFocus))),this.psv.addEventListener("click",(t=>{clearTimeout(this._gridFocus),"CANVAS"===t.data.target.tagName&&(!this.isMapWide||this.isMapWide&&!this.isMapWide())&&(this._gridFocus=setTimeout((()=>{this.grid.toggleAway()?this.classList.add("pnx-grid-toggled"):this.classList.remove("pnx-grid-toggled")}),250))})),this.psvContainer.addEventListener("mousemove",(()=>{this.grid._hidden&&(clearTimeout(this._gridFocus),this.grid.toggleAway(!0),this.classList.remove("pnx-grid-toggled"))}))}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();if(null!==this.popup.getAttribute("visible"))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,"base-url":this["share-base-url"]})])}_showSemanticsDoc(){this.setPopup(!0,[(0,v.createWebComp)("pnx-semantics-doc",{_t:this._t})])}_showSemanticsDownload(){this.setPopup(!0,[(0,v.createWebComp)("pnx-semantics-download",{_t:this._t})])}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},"skip-tags-menu-opening":{type:String},"share-base-url":{type:String},...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
package/src/translations/br.json
CHANGED
|
@@ -55,10 +55,7 @@
|
|
|
55
55
|
"error": "Ur gudenn zo ganeomp…",
|
|
56
56
|
"picture_360": "360°",
|
|
57
57
|
"share_print": "Moullañ",
|
|
58
|
-
"metadata_general_picid_link": "Mont d'an deskrivadur JSON eus ar foto"
|
|
59
|
-
"semantics_key": "Alc'hwez",
|
|
60
|
-
"visibility_owner-only": "Kuzhet",
|
|
61
|
-
"semantics_value_show_osm": "Gwelout war OpenStreetMap"
|
|
58
|
+
"metadata_general_picid_link": "Mont d'an deskrivadur JSON eus ar foto"
|
|
62
59
|
},
|
|
63
60
|
"map": {
|
|
64
61
|
"more_panoramax": "Gouzout hiroc'h diwar-benn Panoramax"
|