@panoramax/web-viewer 4.3.1-develop-2c4b2129 → 4.3.1-develop-e9d0b3c3

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.
@@ -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} (2c4b212)\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")||!0,this["keyboard-shortcuts"]=this.getAttribute("keyboard-shortcuts")||!0,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),this["url-parameters"]&&"false"!==this["url-parameters"]&&(this.urlHandler=new p.A(this),this.onceReady().then((()=>{this.urlHandler.listenToChanges(),this.urlHandler._onParentChange()}))),this.onceAPIReady().then(this._postAPIInit.bind(this)),this._moveChildToGrid(),window.addEventListener("DOMContentLoaded",(()=>{this._moveChildToGrid()}),{once:!0})}disconnectedCallback(){var t,a;super.disconnectedCallback(),null===(t=this.urlHandler)||void 0===t||t.destroy(),null===(a=this.psv)||void 0===a||a.destroy(),document.body.removeEventListener("click",this._toggleKeyboardBasedOnFocus),window.removeEventListener("keypress",this._toggleKeyboardBasedOnFocus)}getClassName(){return"PhotoViewer"}onceReady(){return this.oncePSVReady().then((()=>this._initParams.getParentPostInit().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();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} (e9d0b3c)\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")||!0,this["keyboard-shortcuts"]=this.getAttribute("keyboard-shortcuts")||!0,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),this["url-parameters"]&&"false"!==this["url-parameters"]&&(this.urlHandler=new p.A(this),this.onceReady().then((()=>{this.urlHandler.listenToChanges(),this.urlHandler._onParentChange()}))),this.onceAPIReady().then(this._postAPIInit.bind(this)),this._moveChildToGrid(),window.addEventListener("DOMContentLoaded",(()=>{this._moveChildToGrid()}),{once:!0})}disconnectedCallback(){var t,a;super.disconnectedCallback(),null===(t=this.urlHandler)||void 0===t||t.destroy(),null===(a=this.psv)||void 0===a||a.destroy(),document.body.removeEventListener("click",this._toggleKeyboardBasedOnFocus),window.removeEventListener("keypress",this._toggleKeyboardBasedOnFocus)}getClassName(){return"PhotoViewer"}onceReady(){return this.oncePSVReady().then((()=>this._initParams.getParentPostInit().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();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}"
@@ -1628,7 +1628,7 @@
1628
1628
  }
1629
1629
  /* Logo */
1630
1630
  img.logo-dead { width: 100px; }
1631
- `,Loader.properties={_mode:{state:!0},_label:{state:!0},_isLabelFun:{state:!0},visible:{type:Boolean,reflect:!0},"no-label":{type:Boolean},value:{type:Number}},customElements.define("pnx-loader",Loader)},9048:(t,a,A)=>{"use strict";A.d(a,{Ay:()=>Photo,LM:()=>D,Vf:()=>O,cS:()=>T});A(5003);var h=A(5975),p=A(2305),g=A(7343),m=A(508),v=(A(3961),A(1080),A(2710),A(1575),A(1545)),_=A(3348),E=A(4991),x=A(3727);const w={baseUrl:h,width:1280,cols:2,rows:1,tileUrl:()=>null},C={id:g.BASE_PANORAMA_ID,caption:"",panorama:w,links:[],gps:[0,0],sequence:{},sphereCorrection:{},horizontalFov:360,properties:{}},T=30,D=250,O=3e3,U="draw-annotation-1",j="draw-annotation-2",F="draw-annotation-r",G="rgb(224, 64, 251)",W="rgb(224, 64, 251, 0.5)",Y="rgb(123, 31, 162)",q="rgba(123, 31, 162, 0.5)";v.jM.useNewAnglesOrder=!0;class Photo extends v.jM{constructor(t,a){var A;let h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super({container:a,adapter:[x.A,{showErrorTile:!1,baseBlur:!1,resolution:t.isWidthSmall()?32:64,shouldGoFast:h.shouldGoFast,useXmpData:!1}],withCredentials:t.api._getPSVWithCredentials(),requestHeaders:null===t||void 0===t||null===(A=t["fetch-options"])||void 0===A?void 0:A.headers,panorama:w,lang:t._t.psv,minFov:5,loadingTxt:"&nbsp;",navbar:null,rendererParameters:{preserveDrawingBuffer:!t.isWidthSmall()},plugins:[[_.$,{dataMode:"server",positionMode:"gps",renderMode:"3d",preload:!0,getNode:()=>{},transitionOptions:()=>{},arrowsPosition:{linkOverlapAngle:Math.PI/6}}],[E.b,{}]],...h}),this._parent=t,this._options=h,a.classList.add("pnx-psv"),this._shouldGoFast=(null===h||void 0===h?void 0:h.shouldGoFast)||(()=>!1),this._transitionDuration=(null===h||void 0===h?void 0:h.transitionDuration)||D,this._myVTour=this.getPlugin(_.$),this._myVTour.datasource.nodeResolver=this._getNodeFromAPI.bind(this),this._myVTour.config.transitionOptions=this._psvNodeTransition.bind(this),this._clearArrows=this._myVTour.arrowsRenderer.clear.bind(this._myVTour.arrowsRenderer),this._myVTour.arrowsRenderer.clear=()=>{},this._myMarkers=this.getPlugin(E.b),this._annotationsVisible=!0===this._options.displayAnnotations,this._drawingAnnotation=null,this._sequencePlaying=!1,this._picturesNavigation=this._options.picturesNavigation||"any",this._picturesSequences={},this._myVTour.addEventListener("enter-arrow",this._onEnterArrow.bind(this)),this._myVTour.addEventListener("leave-arrow",this._onLeaveArrow.bind(this)),this._myVTour.addEventListener("node-changed",this._onNodeChanged.bind(this)),this._myMarkers.addEventListener("select-marker",this._onSelectMarker.bind(this)),this.addEventListener("position-updated",this._onPositionUpdated.bind(this)),this.addEventListener("zoom-updated",this._onZoomUpdated.bind(this)),this.addEventListener("dblclick",this._onDoubleClick.bind(this)),this._parent.addEventListener("select",this._onSelect.bind(this)),this.loader.size=150,this.loader.color="rgba(61, 61, 61, 0.5)",this.loader.textColor="rgba(255, 255, 255, 0.7)",this.loader.border=5,this.loader.thickness=10,this.loader.canvas.setAttribute("viewBox","0 0 150 150"),this.loader.__updateContent(),this._options.position&&!this._parent.picture&&this.goToPosition(...this._options.position)}async _getNodeFromAPI(t){var a,A;if((0,g.isNullId)(t))return C;const h=await fetch(this._parent.api.getPictureMetadataUrl(t,this._picturesSequences[t]),this._parent.api._getFetchOptions());let p=await h.json();if(p.features&&(p=p.features.pop()),!p||0===Object.keys(p).length||!h.ok)throw this._parent.loader&&this._parent.loader.dismiss(!0,this._parent._t.pnx.error_pic),new Error("Picture with ID "+t+" was not found");this._picturesSequences[t]=p.collection;const v=(0,m.apiFeatureToPSVNode)(p,this._parent._t,this._parent._isInternetFast,this._picturesNavFilter.bind(this),this._parent.api.cleanResourceURL.bind(this._parent.api));var _,E;null!==v&&void 0!==v&&null!==(a=v.sequence)&&void 0!==a&&a.prevPic&&(this._picturesSequences[null===v||void 0===v||null===(_=v.sequence)||void 0===_?void 0:_.prevPic]=p.collection);null!==v&&void 0!==v&&null!==(A=v.sequence)&&void 0!==A&&A.nextPic&&(this._picturesSequences[null===v||void 0===v||null===(E=v.sequence)||void 0===E?void 0:E.nextPic]=p.collection);return v}_psvNodeTransition(t,a,A){var h,p,m;let v={};const _=this._shouldGoFast()?0:Math.min(D,this._transitionDuration),E=_>100,x=null!=(A||(null===a||void 0===a?void 0:a.links.find((a=>a.nodeId==t.id)))),w=a&&t.sequence.id===a.sequence.id,C=((null===a||void 0===a||null===(h=a.properties)||void 0===h?void 0:h["view:azimuth"])||0)*(Math.PI/180),O=((null===t||void 0===t||null===(p=t.properties)||void 0===p?void 0:p["view:azimuth"])||0)*(Math.PI/180),U=(0,g.getRelativeHeading)(t)*(Math.PI/180);this.setOption("maxFov",Math.min(3*t.horizontalFov/4,90));const j={showLoader:!1,effect:"none",speed:0,rotation:!1,rotateTo:{pitch:0,yaw:-U},zoomTo:T};if(360==t.horizontalFov)v=a?(0,g.getDistance)(a.gps,t.gps)>=.001?j:{speed:_,effect:x&&E?"fade":"none",rotation:x&&w&&E,rotateTo:this.getPosition()}:j;else if(w){const t=this.getPosition().yaw,A=a.horizontalFov*(Math.PI/180)/2,h=t<=A||t>=2*Math.PI-A,p=Math.abs(C-O)<=Math.PI/4;v={speed:_,effect:x&&p&&E?"fade":"none",rotation:x&&p&&E,rotateTo:h?this.getPosition():{pitch:0,yaw:0},zoomTo:h?this.getZoomLevel():T}}else v=Object.assign(j,{rotateTo:{pitch:0,yaw:0}});"fade"===v.effect&&v.speed>=150?setTimeout(this._clearArrows,v.speed-100):this._clearArrows();const F=new CustomEvent("picture-loading",{detail:{...Object.assign({},this.getXYZ(),v.rotateTo?{x:180*(O+v.rotateTo.yaw)/Math.PI}:null,v.zoomTo?{z:v.zoomTo}:null),picId:t.id,lon:t.gps[0],lat:t.gps[1],first:(null===(m=this._parent._initParams)||void 0===m?void 0:m.getParentPostInit().picture)==t.id}});return this.dispatchEvent(F),v}_onEnterArrow(t){const a=t.link,A=t.node;let h;A&&(h=360===A.horizontalFov?(this.getPictureOriginalHeading()+180*this.getPosition().yaw/Math.PI)%360:this.getPictureOriginalHeading());const p=new CustomEvent("picture-preview-started",{detail:{picId:a.nodeId,coordinates:a.gps,direction:h}});this.dispatchEvent(p)}_onLeaveArrow(t){const a=t.link,A=new CustomEvent("picture-preview-stopped",{detail:{picId:a.nodeId}});this.dispatchEvent(A)}_onPositionUpdated(t){let{position:a}=t;const A=(0,g.positionToXYZ)(a,this.getZoomLevel());A.x+=this.getPictureOriginalHeading(),A.x=A.x%360;const h=new CustomEvent("view-rotated",{detail:A});this.dispatchEvent(h),this._onTilesStartLoading()}_onZoomUpdated(t){let{zoomLevel:a}=t;const A=new CustomEvent("view-rotated",{detail:{...this.getXY(),z:a}});this.dispatchEvent(A),this._onTilesStartLoading()}_onDoubleClick(){this.unfocusAnnotation(!1,!0)}_onNodeChanged(t){for(let p of document.getElementsByClassName("pnx-psv-tour-arrows"))p.classList.remove("pnx-clicked");if(t.node.id){var a,A,h;const p=(null===(a=this._parent._initParams)||void 0===a?void 0:a.getParentPostInit().picture)==t.node.id;this._parent.select(null===(A=t.node)||void 0===A||null===(h=A.sequence)||void 0===h?void 0:h.id,t.node.id);const g=this.getPictureMetadata();if(!g)return void this.dispatchEvent(new CustomEvent("picture-loaded",{detail:{}}));this._prevSequence=g.sequence.id;const m=new CustomEvent("picture-loaded",{detail:{...this.getXYZ(),picId:t.node.id,lon:g.gps[0],lat:g.gps[1],first:p}});this.dispatchEvent(m),g.panorama.hdUrl?(this.setOption("downloadUrl",g.panorama.hdUrl),this.setOption("downloadName",t.node.id+".jpg")):this.setOption("downloadUrl",null),this._annotationsVisible&&this.toggleAllAnnotations(!0)}this._onTilesStartLoading()}_onSelectMarker(t){var a;if(t.marker&&null!==(a=t.marker.id)&&void 0!==a&&a.startsWith("annotation-")){if(this.getSelectedAnnotations().find((t=>{var a,A,h;return null===(a=this._myMarkers.markers["annotation-"+t])||void 0===a||null===(A=a.config)||void 0===A||null===(h=A.data)||void 0===h?void 0:h.blockFocus})))return;this.focusOnAnnotation(t.marker.data.id)}}_onTilesStartLoading(){this._tilesQueueTimer&&(clearInterval(this._tilesQueueTimer),delete this._tilesQueueTimer),this._tilesQueueTimer=setInterval((()=>{if(0===Object.keys(this.adapter.queue.tasks).length){if(this._myVTour.state.currentNode){const t=new CustomEvent("picture-tiles-loaded",{detail:{picId:this._myVTour.state.currentNode.id}});this.dispatchEvent(t)}clearInterval(this._tilesQueueTimer),delete this._tilesQueueTimer}}),100)}getPictureMetadata(){var t,a,A;return(0,g.isNullId)(null===(t=this._myVTour)||void 0===t||null===(a=t.state)||void 0===a||null===(A=a.currentNode)||void 0===A?void 0:A.id)?null:this._myVTour.state.currentNode?Object.assign({},this._myVTour.state.currentNode):null}getPictureId(){var t,a,A,h,p;const m=(null===(t=this._myVTour)||void 0===t||null===(a=t.state)||void 0===a?void 0:a.loadingNode)||(null===(A=this._myVTour)||void 0===A||null===(h=A.state)||void 0===h||null===(p=h.currentNode)||void 0===p?void 0:p.id);return(0,g.isNullId)(m)?null:m}_onSelect(t){t.detail.seqId&&(this._picturesSequences[t.detail.picId]=t.detail.seqId),t.detail.seqId&&!t.detail.picId?(this.loader.show(),this._parent.api.getSequenceItems(t.detail.seqId,null,null,1).then((a=>{var A;if((null===a||void 0===a||null===(A=a.features)||void 0===A?void 0:A.length)>0){const A=a.features[0].id;this._picturesSequences[A]=t.detail.seqId,this._parent.select(t.detail.seqId,A)}})).catch((t=>this.showErrorOverlay(t,this._parent._t.pnx.error_pic,!0)))):t.detail.picId?this.getPictureId()!==t.detail.picId&&(this.loader.show(),this._myVTour.setCurrentNode(t.detail.picId).catch((t=>{this.showErrorOverlay(t,this._parent._t.pnx.error_pic,!0)}))):(this._myVTour.setCurrentNode(null),this._myVTour.state.currentNode.id=null,this._myVTour.state.loadingNode=null)}goToNextPicture(){if(!this.getPictureMetadata())throw new Error("No picture currently selected");if("pic"==this._picturesNavigation)throw new Error("Pictures navigation is locked to current picture");const t=this.getPictureMetadata().sequence.nextPic;if(!t)throw new Error("No next picture available");this._parent.select(this.getPictureMetadata().sequence.id,t)}goToPrevPicture(){if(!this.getPictureMetadata())throw new Error("No picture currently selected");if("pic"==this._picturesNavigation)throw new Error("Pictures navigation is locked to current picture");const t=this.getPictureMetadata().sequence.prevPic;if(!t)throw new Error("No previous picture available");this._parent.select(this.getPictureMetadata().sequence.id,t)}async goToPosition(t,a){if("pic"==this._picturesNavigation)throw new Error("Pictures navigation is locked to current picture");return this._parent.api.getPicturesAroundCoordinates(t,a).then((t=>{if(t.features.length>0){const a=t.features.pop();return this._parent.select(null===a||void 0===a?void 0:a.collection,a.id),a.id}return Promise.reject(new Error("No picture found nearby given coordinates"))}))}getXY(){const t=(0,g.positionToXYZ)(this.getPosition());return t.x=(t.x+this.getPictureOriginalHeading())%360,t}getXYZ(){const t=this.getXY();return t.z=this.getZoomLevel(),t}getPictureOriginalHeading(){var t,a;return(null===(t=this.getPictureMetadata())||void 0===t||null===(a=t.properties)||void 0===a?void 0:a["view:azimuth"])||0}getPictureRelativeHeading(){return(0,g.getRelativeHeading)(this.getPictureMetadata())}clearPictureMetadataCache(){var t,a,A,h;const p=null===(t=this.getPictureMetadata())||void 0===t?void 0:t.id,g=null===(a=this.getPictureMetadata())||void 0===a||null===(A=a.sequence)||void 0===A?void 0:A.id;null===(h=this._myVTour.state.currentTooltip)||void 0===h||h.hide(),this._myVTour.state.currentTooltip=null,this._myVTour.state.currentNode=null,this._myVTour.state.preload={},this._myVTour.datasource.nodes={},p&&this._parent.select(g,p)}setXYZ(t,a,A){const h=(0,g.xyzToPosition)(t-this.getPictureOriginalHeading(),a,A);this.rotate({yaw:h.yaw,pitch:h.pitch}),this.zoom(h.zoom)}setHigherContrast(t){this.renderer.renderer.toneMapping=t?3:0,this.renderer.renderer.toneMappingExposure=t?2:1,this.needsUpdate()}getTransitionDuration(){return this._transitionDuration}setTransitionDuration(t){if((t=parseFloat(t))<100||t>O)throw new Error("Invalid transition duration (should be between 100 and "+O+")");this._transitionDuration=t;const a=new CustomEvent("transition-duration-changed",{detail:{value:t}});this.dispatchEvent(a)}setPanorama(t,a){if(t.baseUrl.startsWith("data:"))return Promise.resolve();const onFailure=t=>{var a;return this.showErrorOverlay(t,null===(a=this._parent)||void 0===a?void 0:a._t.pnx.error_pic,!0)};try{return super.setPanorama(t,a).catch(onFailure)}catch(A){onFailure(A)}}showErrorOverlay(t,a,A){var h,g,m,v;null!==(h=this._parent)&&void 0!==h&&h.loader.isVisible()||!this.overlay.isVisible()?null===(g=this._parent)||void 0===g||g.loader.dismiss(t,a,A?()=>{var t;null===(t=this._parent)||void 0===t||t.loader.dismiss(),this.overlay.hide()}:void 0):(console.error(t),this.overlay.show({image:`<img style="width: 200px" src="${p}" alt="" />`,title:null===(m=this._parent)||void 0===m?void 0:m._t.pnx.error,text:a+"<br />"+(null===(v=this._parent)||void 0===v?void 0:v._t.pnx.error_click),dissmisable:A}))}playSequence(){this._sequencePlaying=!0,this.container.classList.add("pnx-psv-playing");const t=new Event("sequence-playing",{bubbles:!0,composed:!0});this.dispatchEvent(t);const nextPicturePlay=()=>{if(this._sequencePlaying){this.addEventListener("picture-loaded",(()=>{this._playTimer=setTimeout((()=>{nextPicturePlay()}),this.getTransitionDuration())}),{once:!0});try{this.goToNextPicture()}catch(t){this.stopSequence()}}};this.addEventListener("click",(()=>this.stopSequence())),nextPicturePlay()}stopSequence(){this._sequencePlaying=!1,this.container.classList.remove("pnx-psv-playing"),this._playTimer&&(clearTimeout(this._playTimer),delete this._playTimer),this.forceRefresh();const t=new Event("sequence-stopped",{bubbles:!0,composed:!0});this.dispatchEvent(t)}isSequencePlaying(){return this._sequencePlaying}toggleSequencePlaying(){this.isSequencePlaying()?this.stopSequence():this.playSequence()}getPicturesNavigation(){return this._picturesNavigation}setPicturesNavigation(t){"none"===t&&(t="pic"),this._picturesNavigation=t;const a=this.container.querySelector(".psv-virtual-tour-arrows");a&&(a.style.display="pic"==t?"none":null);const A=new CustomEvent("pictures-navigation-changed",{detail:{value:t}});this.dispatchEvent(A)}_picturesNavFilter(t){switch(this._picturesNavigation){case"seq":return["next","prev"].includes(t.rel);case"pic":case"none":return!1;default:return!0}}areAnnotationsVisible(){return this._annotationsVisible}getSelectedAnnotations(){return Object.keys(this._myMarkers.markers).filter((t=>{var a,A,h;return t.startsWith("annotation-")&&(null===(a=this._myMarkers.markers[t])||void 0===a||null===(A=a.config)||void 0===A||null===(h=A.data)||void 0===h?void 0:h.selected)})).map((t=>t.replace("annotation-","")))}toggleAllAnnotations(t){const a=this.getPictureMetadata(),A=this._annotationsVisible==t;if(!a)throw this._myMarkers.clearMarkers(),new Error("No picture currently selected");if(t){var h;let t=a.properties.annotations||[];0===(null===(h=t)||void 0===h?void 0:h.length)&&console.warn("No annotation available on picture",a.id),t=t.map((t=>{if(!a.properties["pers:interior_orientation"].sensor_array_dimensions)return console.warn("Picture lacks pers:interior_orientation.sensor_array_dimensions property, can't compute marker"),null;const A=t.shape.coordinates.map((t=>t.map((t=>{var A;const h=null===(A=a.panorama)||void 0===A?void 0:A.cropData,p={textureX:t[0]+((null===h||void 0===h?void 0:h.croppedX)||0),textureY:t[1]+((null===h||void 0===h?void 0:h.croppedY)||0)};return this.dataHelper.textureCoordsToSphericalCoords(p)}))));return{id:`annotation-${t.id}`,polygon:A,data:{id:t.id},className:"pnx-psv-annotation",svgStyle:{stroke:"var(--orange)",strokeWidth:"3px",fill:"var(--orange-transparent)",cursor:"pointer"},tooltip:this._parent._t.pnx.semantics_annotation_tooltip}})),this._myMarkers.setMarkers(t)}else this._myMarkers.clearMarkers();this._annotationsVisible=t,A||this.dispatchEvent(new CustomEvent("annotations-toggled",{detail:{visible:t}}))}focusOnAnnotation(t){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],A=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const h=this.getSelectedAnnotations();if(t&&1===h.length&&h[0]===t)return;this.areAnnotationsVisible()||this.toggleAllAnnotations(!0),this.unfocusAnnotation(!0);const p=`annotation-${t}`;if(this._myMarkers.markers[p]){if(this._myMarkers.updateMarker({id:p,svgStyle:{stroke:"var(--red)",strokeWidth:"3px",fill:"var(--red-transparent)"},data:{selected:!0,blockFocus:a}}),this._myMarkers.gotoMarker(p,0),this.zoom(65),!A){const a=new CustomEvent("annotation-focused",{detail:{annotationId:t}});this.dispatchEvent(a)}}else setTimeout((()=>this.focusOnAnnotation(t,a,A)),100)}unfocusAnnotation(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const A=this.getSelectedAnnotations();if(A.length>0){let h=0;A.forEach((t=>{var A,p,g;const m="annotation-"+t;a&&null!==(A=this._myMarkers.markers[m])&&void 0!==A&&null!==(p=A.config)&&void 0!==p&&null!==(g=p.data)&&void 0!==g&&g.blockFocus?h++:this._myMarkers.updateMarker({id:m,svgStyle:{stroke:"var(--orange)",strokeWidth:"3px",fill:"var(--orange-transparent)"},data:{selected:!1,blockFocus:!1}})})),!t&&h<A.length&&this.dispatchEvent(new Event("annotations-unfocused"))}}startDrawAnnotation(){this.toggleAllAnnotations(!1),this._drawingAnnotation=[],this._drawingMoves=0,this._myMarkers.addMarker({id:F,polygon:[{yaw:0,pitch:0},{yaw:0,pitch:0},{yaw:0,pitch:0}],svgStyle:{fill:q,stroke:Y,strokeWidth:"2px"},visible:!1}),this._myMarkers.addMarker({id:U,circle:5,position:{yaw:0,pitch:0},style:{cursor:"pointer"},svgStyle:{fill:W,stroke:G,strokeWidth:"3px"}}),this._myMarkers.addMarker({id:j,circle:5,position:{yaw:0,pitch:0},style:{cursor:"pointer"},svgStyle:{fill:W,stroke:G,strokeWidth:"3px"},visible:!1});const firstMove=t=>{const a=this.getPositionFromEvent(t);a&&this._myMarkers.markers[U]&&(this._myMarkers.updateMarker({id:U,position:a,style:{cursor:"grab"}}),2==this._drawingAnnotation.length&&this._myMarkers.markers[F]&&this._myMarkers.updateMarker({id:F,polygon:[a,{yaw:a.yaw,pitch:this._drawingAnnotation[1].pitch},this._drawingAnnotation[1],{yaw:this._drawingAnnotation[1].yaw,pitch:a.pitch}]}))},secMove=t=>{const a=this.getPositionFromEvent(t);a&&this._myMarkers.markers[j]&&(this._myMarkers.updateMarker({id:j,position:a,style:{cursor:"grab"}}),this._drawingAnnotation.length>=1&&this._myMarkers.markers[F]&&this._myMarkers.updateMarker({id:F,polygon:[this._drawingAnnotation[0],{yaw:this._drawingAnnotation[0].yaw,pitch:a.pitch},a,{yaw:a.yaw,pitch:this._drawingAnnotation[0].pitch}]}))};this._drawListeners=[firstMove,secMove],this.parent.addEventListener("mousemove",firstMove),this._drawingMoves=1,this._drawListenerClick=t=>{let a=!1;if(2!==this._drawingMoves&&t.marker.id===U?0==this._drawingAnnotation.length?(this._drawingAnnotation.push({yaw:t.marker.config.position.yaw,pitch:t.marker.config.position.pitch}),this.parent.removeEventListener("mousemove",firstMove),this._myMarkers.updateMarker({id:U,style:{cursor:"pointer"}}),this._myMarkers.updateMarker({id:j,visible:!0,position:{yaw:t.marker.config.position.yaw,pitch:t.marker.config.position.pitch}}),this._myMarkers.updateMarker({id:F,visible:!0}),this.parent.addEventListener("mousemove",secMove),this._drawingMoves=2):0===this._drawingMoves?(this.parent.addEventListener("mousemove",firstMove),this._drawingMoves=1):(this._drawingAnnotation[0]={yaw:t.marker.config.position.yaw,pitch:t.marker.config.position.pitch},this.parent.removeEventListener("mousemove",firstMove),this._myMarkers.updateMarker({id:U,style:{cursor:"pointer"}}),this._drawingMoves=0,a=!0):1!==this._drawingMoves&&t.marker.id===j&&(1==this._drawingAnnotation.length?(this._drawingAnnotation.push({yaw:t.marker.config.position.yaw,pitch:t.marker.config.position.pitch}),this.parent.removeEventListener("mousemove",secMove),this._myMarkers.updateMarker({id:j,style:{cursor:"pointer"}}),this._drawingMoves=0,a=!0):2===this._drawingMoves?(this._drawingAnnotation[1]={yaw:t.marker.config.position.yaw,pitch:t.marker.config.position.pitch},this.parent.removeEventListener("mousemove",secMove),this._myMarkers.updateMarker({id:j,style:{cursor:"pointer"}}),this._drawingMoves=0,a=!0):(this.parent.addEventListener("mousemove",secMove),this._drawingMoves=2)),a){var A,h;const t=this.dataHelper.sphericalCoordsToTextureCoords(this._drawingAnnotation[0]),a=this.dataHelper.sphericalCoordsToTextureCoords(this._drawingAnnotation[1]);let p=[t.textureX,t.textureY,a.textureX,a.textureY];const g=null===(A=this.getPictureMetadata())||void 0===A||null===(h=A.panorama)||void 0===h?void 0:h.cropData;if(g&&(p[0]-=g.croppedX,p[1]-=g.croppedY,p[2]-=g.croppedX,p[3]-=g.croppedY,(p[0]<0||p[0]>g.croppedWidth||p[1]<0||p[1]>g.croppedHeight||p[2]<0||p[2]>g.croppedWidth||p[3]<0||p[3]>g.croppedHeight)&&(p=null)),p[0]>=p[2]&&p[1]>=p[3]){let t=p[0],a=p[2],A=p[1];p=[a,p[3],t,A]}const m=new CustomEvent("annotation-drawn",{detail:{shape:p}});this.dispatchEvent(m)}},this._myMarkers.addEventListener("select-marker",this._drawListenerClick)}fixDrawAnnotation(){[U,j].forEach((t=>{try{this._myMarkers.removeMarker(t)}catch(a){}})),(this._drawListeners||[]).forEach((t=>this.parent.removeEventListener("mousemove",t))),this._myMarkers.removeEventListener("select-marker",this._drawListenerClick),this._myMarkers.updateMarker({id:F,svgStyle:{stroke:"var(--red)",strokeWidth:"3px",fill:"var(--red-transparent)",cursor:"pointer"}}),this._drawingMoves=0}stopDrawAnnotation(){[U,j,F].forEach((t=>{try{this._myMarkers.removeMarker(t)}catch(a){}})),(this._drawListeners||[]).forEach((t=>this.parent.removeEventListener("mousemove",t))),this._myMarkers.removeEventListener("select-marker",this._drawListenerClick),delete this._drawingMoves,this._drawingAnnotation=null}getPositionFromEvent(t){const a=this.container.getBoundingClientRect(),A=t.clientX-a.left,h=t.clientY-a.top,p=this.renderer.getIntersections({x:A,y:h}).find((t=>t.object.userData[v.aH.VIEWER_DATA]));if(p)return this.dataHelper.vector3ToSphericalCoords(p.point)}forceRefresh(){var t;const a=this._myVTour.getCurrentNode();if(a&&a.panorama.baseUrl!==(null===a||void 0===a||null===(t=a.panorama)||void 0===t?void 0:t.origBaseUrl)){const t=this.getZoomLevel(),A=this.getPosition();this._myVTour.state.currentNode=null,this._myVTour.setCurrentNode(a.id,{zoomTo:t,rotateTo:A,fadeIn:!1,speed:0,rotation:!1})}a&&a.panorama.rows>1&&this.adapter.__refresh()}}},4374:(t,a,A)=>{"use strict";A.d(a,{A:()=>Popup});var h=A(4542),p=A(5995),g=A(8591),m=A(6627);class Popup extends h.WF{constructor(){super(),this.visible=!1}connectedCallback(){super.connectedCallback(),this.addEventListener("click",(t=>{t.target===this&&this.close()})),document.addEventListener("keyup",(t=>{"Escape"===t.key&&this.visible&&this.close()}))}attributeChangedCallback(t,a,A){super.attributeChangedCallback(t,a,A),"visible"==t&&(""!==A&&!0!==A||this.dispatchEvent(new Event("open")))}close(){this.visible=!1,this.dispatchEvent(new Event("close"))}render(){return h.qy`
1631
+ `,Loader.properties={_mode:{state:!0},_label:{state:!0},_isLabelFun:{state:!0},visible:{type:Boolean,reflect:!0},"no-label":{type:Boolean},value:{type:Number}},customElements.define("pnx-loader",Loader)},9048:(t,a,A)=>{"use strict";A.d(a,{Ay:()=>Photo,LM:()=>D,Vf:()=>O,cS:()=>T});A(5003);var h=A(5975),p=A(2305),g=A(7343),m=A(508),v=(A(3961),A(1080),A(2710),A(1575),A(1545)),_=A(3348),E=A(4991),x=A(3727);const w={baseUrl:h,width:1280,cols:2,rows:1,tileUrl:()=>null},C={id:g.BASE_PANORAMA_ID,caption:"",panorama:w,links:[],gps:[0,0],sequence:{},sphereCorrection:{},horizontalFov:360,properties:{}},T=30,D=250,O=3e3,U="draw-annotation-1",j="draw-annotation-2",F="draw-annotation-r",G="rgb(224, 64, 251)",W="rgb(224, 64, 251, 0.5)",Y="rgb(123, 31, 162)",q="rgba(123, 31, 162, 0.5)";v.jM.useNewAnglesOrder=!0;class Photo extends v.jM{constructor(t,a){var A;let h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super({container:a,adapter:[x.A,{showErrorTile:!1,baseBlur:!1,resolution:t.isWidthSmall()?32:64,shouldGoFast:(null===h||void 0===h?void 0:h.shouldGoFast)||(()=>!1),useXmpData:!1}],withCredentials:t.api._getPSVWithCredentials(),requestHeaders:null===t||void 0===t||null===(A=t["fetch-options"])||void 0===A?void 0:A.headers,panorama:w,lang:t._t.psv,minFov:5,loadingTxt:"&nbsp;",navbar:null,rendererParameters:{preserveDrawingBuffer:!t.isWidthSmall()},plugins:[[_.$,{dataMode:"server",positionMode:"gps",renderMode:"3d",preload:!0,getNode:()=>{},transitionOptions:()=>{},arrowsPosition:{linkOverlapAngle:Math.PI/6}}],[E.b,{}]],...h}),this._parent=t,this._options=h,a.classList.add("pnx-psv"),this._shouldGoFast=(null===h||void 0===h?void 0:h.shouldGoFast)||(()=>!1),this._transitionDuration=(null===h||void 0===h?void 0:h.transitionDuration)||D,this._myVTour=this.getPlugin(_.$),this._myVTour.datasource.nodeResolver=this._getNodeFromAPI.bind(this),this._myVTour.config.transitionOptions=this._psvNodeTransition.bind(this),this._clearArrows=this._myVTour.arrowsRenderer.clear.bind(this._myVTour.arrowsRenderer),this._myVTour.arrowsRenderer.clear=()=>{},this._myMarkers=this.getPlugin(E.b),this._annotationsVisible=!0===this._options.displayAnnotations,this._drawingAnnotation=null,this._sequencePlaying=!1,this._picturesNavigation=this._options.picturesNavigation||"any",this._picturesSequences={},this._myVTour.addEventListener("enter-arrow",this._onEnterArrow.bind(this)),this._myVTour.addEventListener("leave-arrow",this._onLeaveArrow.bind(this)),this._myVTour.addEventListener("node-changed",this._onNodeChanged.bind(this)),this._myMarkers.addEventListener("select-marker",this._onSelectMarker.bind(this)),this.addEventListener("position-updated",this._onPositionUpdated.bind(this)),this.addEventListener("zoom-updated",this._onZoomUpdated.bind(this)),this.addEventListener("dblclick",this._onDoubleClick.bind(this)),this._parent.addEventListener("select",this._onSelect.bind(this)),this.loader.size=150,this.loader.color="rgba(61, 61, 61, 0.5)",this.loader.textColor="rgba(255, 255, 255, 0.7)",this.loader.border=5,this.loader.thickness=10,this.loader.canvas.setAttribute("viewBox","0 0 150 150"),this.loader.__updateContent(),this._options.position&&!this._parent.picture&&this.goToPosition(...this._options.position)}async _getNodeFromAPI(t){var a,A;if((0,g.isNullId)(t))return C;const h=await fetch(this._parent.api.getPictureMetadataUrl(t,this._picturesSequences[t]),this._parent.api._getFetchOptions());let p=await h.json();if(p.features&&(p=p.features.pop()),!p||0===Object.keys(p).length||!h.ok)throw this._parent.loader&&this._parent.loader.dismiss(!0,this._parent._t.pnx.error_pic),new Error("Picture with ID "+t+" was not found");this._picturesSequences[t]=p.collection;const v=(0,m.apiFeatureToPSVNode)(p,this._parent._t,this._parent._isInternetFast,this._picturesNavFilter.bind(this),this._parent.api.cleanResourceURL.bind(this._parent.api));var _,E;null!==v&&void 0!==v&&null!==(a=v.sequence)&&void 0!==a&&a.prevPic&&(this._picturesSequences[null===v||void 0===v||null===(_=v.sequence)||void 0===_?void 0:_.prevPic]=p.collection);null!==v&&void 0!==v&&null!==(A=v.sequence)&&void 0!==A&&A.nextPic&&(this._picturesSequences[null===v||void 0===v||null===(E=v.sequence)||void 0===E?void 0:E.nextPic]=p.collection);return v}_psvNodeTransition(t,a,A){var h,p,m;let v={};const _=this._shouldGoFast()?0:Math.min(D,this._transitionDuration),E=_>100,x=null!=(A||(null===a||void 0===a?void 0:a.links.find((a=>a.nodeId==t.id)))),w=a&&t.sequence.id===a.sequence.id,C=((null===a||void 0===a||null===(h=a.properties)||void 0===h?void 0:h["view:azimuth"])||0)*(Math.PI/180),O=((null===t||void 0===t||null===(p=t.properties)||void 0===p?void 0:p["view:azimuth"])||0)*(Math.PI/180),U=(0,g.getRelativeHeading)(t)*(Math.PI/180);this.setOption("maxFov",Math.min(3*t.horizontalFov/4,90));const j={showLoader:!1,effect:"none",speed:0,rotation:!1,rotateTo:{pitch:0,yaw:-U},zoomTo:T};if(360==t.horizontalFov)v=a?(0,g.getDistance)(a.gps,t.gps)>=.001?j:{speed:_,effect:x&&E?"fade":"none",rotation:x&&w&&E,rotateTo:this.getPosition()}:j;else if(w){const t=this.getPosition().yaw,A=a.horizontalFov*(Math.PI/180)/2,h=t<=A||t>=2*Math.PI-A,p=Math.abs(C-O)<=Math.PI/4;v={speed:_,effect:x&&p&&E?"fade":"none",rotation:x&&p&&E,rotateTo:h?this.getPosition():{pitch:0,yaw:0},zoomTo:h?this.getZoomLevel():T}}else v=Object.assign(j,{rotateTo:{pitch:0,yaw:0}});"fade"===v.effect&&v.speed>=150?setTimeout(this._clearArrows,v.speed-100):this._clearArrows();const F=new CustomEvent("picture-loading",{detail:{...Object.assign({},this.getXYZ(),v.rotateTo?{x:180*(O+v.rotateTo.yaw)/Math.PI}:null,v.zoomTo?{z:v.zoomTo}:null),picId:t.id,lon:t.gps[0],lat:t.gps[1],first:(null===(m=this._parent._initParams)||void 0===m?void 0:m.getParentPostInit().picture)==t.id}});return this.dispatchEvent(F),v}_onEnterArrow(t){const a=t.link,A=t.node;let h;A&&(h=360===A.horizontalFov?(this.getPictureOriginalHeading()+180*this.getPosition().yaw/Math.PI)%360:this.getPictureOriginalHeading());const p=new CustomEvent("picture-preview-started",{detail:{picId:a.nodeId,coordinates:a.gps,direction:h}});this.dispatchEvent(p)}_onLeaveArrow(t){const a=t.link,A=new CustomEvent("picture-preview-stopped",{detail:{picId:a.nodeId}});this.dispatchEvent(A)}_onPositionUpdated(t){let{position:a}=t;const A=(0,g.positionToXYZ)(a,this.getZoomLevel());A.x+=this.getPictureOriginalHeading(),A.x=A.x%360;const h=new CustomEvent("view-rotated",{detail:A});this.dispatchEvent(h),this._onTilesStartLoading()}_onZoomUpdated(t){let{zoomLevel:a}=t;const A=new CustomEvent("view-rotated",{detail:{...this.getXY(),z:a}});this.dispatchEvent(A),this._onTilesStartLoading()}_onDoubleClick(){this.unfocusAnnotation(!1,!0)}_onNodeChanged(t){for(let p of document.getElementsByClassName("pnx-psv-tour-arrows"))p.classList.remove("pnx-clicked");if(t.node.id){var a,A,h;const p=(null===(a=this._parent._initParams)||void 0===a?void 0:a.getParentPostInit().picture)==t.node.id;this._parent.select(null===(A=t.node)||void 0===A||null===(h=A.sequence)||void 0===h?void 0:h.id,t.node.id);const g=this.getPictureMetadata();if(!g)return void this.dispatchEvent(new CustomEvent("picture-loaded",{detail:{}}));this._prevSequence=g.sequence.id;const m=new CustomEvent("picture-loaded",{detail:{...this.getXYZ(),picId:t.node.id,lon:g.gps[0],lat:g.gps[1],first:p}});this.dispatchEvent(m),g.panorama.hdUrl?(this.setOption("downloadUrl",g.panorama.hdUrl),this.setOption("downloadName",t.node.id+".jpg")):this.setOption("downloadUrl",null),this._annotationsVisible&&this.toggleAllAnnotations(!0)}this._onTilesStartLoading()}_onSelectMarker(t){var a;if(t.marker&&null!==(a=t.marker.id)&&void 0!==a&&a.startsWith("annotation-")){if(this.getSelectedAnnotations().find((t=>{var a,A,h;return null===(a=this._myMarkers.markers["annotation-"+t])||void 0===a||null===(A=a.config)||void 0===A||null===(h=A.data)||void 0===h?void 0:h.blockFocus})))return;this.focusOnAnnotation(t.marker.data.id)}}_onTilesStartLoading(){this._tilesQueueTimer&&(clearInterval(this._tilesQueueTimer),delete this._tilesQueueTimer),this._tilesQueueTimer=setInterval((()=>{if(0===Object.keys(this.adapter.queue.tasks).length){if(this._myVTour.state.currentNode){const t=new CustomEvent("picture-tiles-loaded",{detail:{picId:this._myVTour.state.currentNode.id}});this.dispatchEvent(t)}clearInterval(this._tilesQueueTimer),delete this._tilesQueueTimer}}),100)}getPictureMetadata(){var t,a,A;return(0,g.isNullId)(null===(t=this._myVTour)||void 0===t||null===(a=t.state)||void 0===a||null===(A=a.currentNode)||void 0===A?void 0:A.id)?null:this._myVTour.state.currentNode?Object.assign({},this._myVTour.state.currentNode):null}getPictureId(){var t,a,A,h,p;const m=(null===(t=this._myVTour)||void 0===t||null===(a=t.state)||void 0===a?void 0:a.loadingNode)||(null===(A=this._myVTour)||void 0===A||null===(h=A.state)||void 0===h||null===(p=h.currentNode)||void 0===p?void 0:p.id);return(0,g.isNullId)(m)?null:m}_onSelect(t){t.detail.seqId&&(this._picturesSequences[t.detail.picId]=t.detail.seqId),t.detail.seqId&&!t.detail.picId?(this.loader.show(),this._parent.api.getSequenceItems(t.detail.seqId,null,null,1).then((a=>{var A;if((null===a||void 0===a||null===(A=a.features)||void 0===A?void 0:A.length)>0){const A=a.features[0].id;this._picturesSequences[A]=t.detail.seqId,this._parent.select(t.detail.seqId,A)}})).catch((t=>this.showErrorOverlay(t,this._parent._t.pnx.error_pic,!0)))):t.detail.picId?this.getPictureId()!==t.detail.picId&&(this.loader.show(),this._myVTour.setCurrentNode(t.detail.picId).catch((t=>{this.showErrorOverlay(t,this._parent._t.pnx.error_pic,!0)}))):(this._myVTour.setCurrentNode(null),this._myVTour.state.currentNode.id=null,this._myVTour.state.loadingNode=null)}goToNextPicture(){if(!this.getPictureMetadata())throw new Error("No picture currently selected");if("pic"==this._picturesNavigation)throw new Error("Pictures navigation is locked to current picture");const t=this.getPictureMetadata().sequence.nextPic;if(!t)throw new Error("No next picture available");this._parent.select(this.getPictureMetadata().sequence.id,t)}goToPrevPicture(){if(!this.getPictureMetadata())throw new Error("No picture currently selected");if("pic"==this._picturesNavigation)throw new Error("Pictures navigation is locked to current picture");const t=this.getPictureMetadata().sequence.prevPic;if(!t)throw new Error("No previous picture available");this._parent.select(this.getPictureMetadata().sequence.id,t)}async goToPosition(t,a){if("pic"==this._picturesNavigation)throw new Error("Pictures navigation is locked to current picture");return this._parent.api.getPicturesAroundCoordinates(t,a).then((t=>{if(t.features.length>0){const a=t.features.pop();return this._parent.select(null===a||void 0===a?void 0:a.collection,a.id),a.id}return Promise.reject(new Error("No picture found nearby given coordinates"))}))}getXY(){const t=(0,g.positionToXYZ)(this.getPosition());return t.x=(t.x+this.getPictureOriginalHeading())%360,t}getXYZ(){const t=this.getXY();return t.z=this.getZoomLevel(),t}getPictureOriginalHeading(){var t,a;return(null===(t=this.getPictureMetadata())||void 0===t||null===(a=t.properties)||void 0===a?void 0:a["view:azimuth"])||0}getPictureRelativeHeading(){return(0,g.getRelativeHeading)(this.getPictureMetadata())}clearPictureMetadataCache(){var t,a,A,h;const p=null===(t=this.getPictureMetadata())||void 0===t?void 0:t.id,g=null===(a=this.getPictureMetadata())||void 0===a||null===(A=a.sequence)||void 0===A?void 0:A.id;null===(h=this._myVTour.state.currentTooltip)||void 0===h||h.hide(),this._myVTour.state.currentTooltip=null,this._myVTour.state.currentNode=null,this._myVTour.state.preload={},this._myVTour.datasource.nodes={},p&&this._parent.select(g,p)}setXYZ(t,a,A){const h=(0,g.xyzToPosition)(t-this.getPictureOriginalHeading(),a,A);this.rotate({yaw:h.yaw,pitch:h.pitch}),this.zoom(h.zoom)}setHigherContrast(t){this.renderer.renderer.toneMapping=t?3:0,this.renderer.renderer.toneMappingExposure=t?2:1,this.needsUpdate()}getTransitionDuration(){return this._transitionDuration}setTransitionDuration(t){if((t=parseFloat(t))<100||t>O)throw new Error("Invalid transition duration (should be between 100 and "+O+")");this._transitionDuration=t;const a=new CustomEvent("transition-duration-changed",{detail:{value:t}});this.dispatchEvent(a)}setPanorama(t,a){if(t.baseUrl.startsWith("data:"))return Promise.resolve();const onFailure=t=>{var a;return this.showErrorOverlay(t,null===(a=this._parent)||void 0===a?void 0:a._t.pnx.error_pic,!0)};try{return super.setPanorama(t,a).catch(onFailure)}catch(A){onFailure(A)}}showErrorOverlay(t,a,A){var h,g,m,v;null!==(h=this._parent)&&void 0!==h&&h.loader.isVisible()||!this.overlay.isVisible()?null===(g=this._parent)||void 0===g||g.loader.dismiss(t,a,A?()=>{var t;null===(t=this._parent)||void 0===t||t.loader.dismiss(),this.overlay.hide()}:void 0):(console.error(t),this.overlay.show({image:`<img style="width: 200px" src="${p}" alt="" />`,title:null===(m=this._parent)||void 0===m?void 0:m._t.pnx.error,text:a+"<br />"+(null===(v=this._parent)||void 0===v?void 0:v._t.pnx.error_click),dissmisable:A}))}playSequence(){this._sequencePlaying=!0,this.container.classList.add("pnx-psv-playing");const t=new Event("sequence-playing",{bubbles:!0,composed:!0});this.dispatchEvent(t);const nextPicturePlay=()=>{if(this._sequencePlaying){this.addEventListener("picture-loaded",(()=>{this._playTimer=setTimeout((()=>{nextPicturePlay()}),this.getTransitionDuration())}),{once:!0});try{this.goToNextPicture()}catch(t){this.stopSequence()}}};this.addEventListener("click",(()=>this.stopSequence())),nextPicturePlay()}stopSequence(){this._sequencePlaying=!1,this.container.classList.remove("pnx-psv-playing"),this._playTimer&&(clearTimeout(this._playTimer),delete this._playTimer),this.forceRefresh();const t=new Event("sequence-stopped",{bubbles:!0,composed:!0});this.dispatchEvent(t)}isSequencePlaying(){return this._sequencePlaying}toggleSequencePlaying(){this.isSequencePlaying()?this.stopSequence():this.playSequence()}getPicturesNavigation(){return this._picturesNavigation}setPicturesNavigation(t){"none"===t&&(t="pic"),this._picturesNavigation=t;const a=this.container.querySelector(".psv-virtual-tour-arrows");a&&(a.style.display="pic"==t?"none":null);const A=new CustomEvent("pictures-navigation-changed",{detail:{value:t}});this.dispatchEvent(A)}_picturesNavFilter(t){switch(this._picturesNavigation){case"seq":return["next","prev"].includes(t.rel);case"pic":case"none":return!1;default:return!0}}areAnnotationsVisible(){return this._annotationsVisible}getSelectedAnnotations(){return Object.keys(this._myMarkers.markers).filter((t=>{var a,A,h;return t.startsWith("annotation-")&&(null===(a=this._myMarkers.markers[t])||void 0===a||null===(A=a.config)||void 0===A||null===(h=A.data)||void 0===h?void 0:h.selected)})).map((t=>t.replace("annotation-","")))}toggleAllAnnotations(t){const a=this.getPictureMetadata(),A=this._annotationsVisible==t;if(!a)throw this._myMarkers.clearMarkers(),new Error("No picture currently selected");if(t){var h;let t=a.properties.annotations||[];0===(null===(h=t)||void 0===h?void 0:h.length)&&console.warn("No annotation available on picture",a.id),t=t.map((t=>{if(!a.properties["pers:interior_orientation"].sensor_array_dimensions)return console.warn("Picture lacks pers:interior_orientation.sensor_array_dimensions property, can't compute marker"),null;const A=t.shape.coordinates.map((t=>t.map((t=>{var A;const h=null===(A=a.panorama)||void 0===A?void 0:A.cropData,p={textureX:t[0]+((null===h||void 0===h?void 0:h.croppedX)||0),textureY:t[1]+((null===h||void 0===h?void 0:h.croppedY)||0)};return this.dataHelper.textureCoordsToSphericalCoords(p)}))));return{id:`annotation-${t.id}`,polygon:A,data:{id:t.id},className:"pnx-psv-annotation",svgStyle:{stroke:"var(--orange)",strokeWidth:"3px",fill:"var(--orange-transparent)",cursor:"pointer"},tooltip:this._parent._t.pnx.semantics_annotation_tooltip}})),this._myMarkers.setMarkers(t)}else this._myMarkers.clearMarkers();this._annotationsVisible=t,A||this.dispatchEvent(new CustomEvent("annotations-toggled",{detail:{visible:t}}))}focusOnAnnotation(t){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],A=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const h=this.getSelectedAnnotations();if(t&&1===h.length&&h[0]===t)return;this.areAnnotationsVisible()||this.toggleAllAnnotations(!0),this.unfocusAnnotation(!0);const p=`annotation-${t}`;if(this._myMarkers.markers[p]){if(this._myMarkers.updateMarker({id:p,svgStyle:{stroke:"var(--red)",strokeWidth:"3px",fill:"var(--red-transparent)"},data:{selected:!0,blockFocus:a}}),this._myMarkers.gotoMarker(p,0),this.zoom(65),!A){const a=new CustomEvent("annotation-focused",{detail:{annotationId:t}});this.dispatchEvent(a)}}else setTimeout((()=>this.focusOnAnnotation(t,a,A)),100)}unfocusAnnotation(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const A=this.getSelectedAnnotations();if(A.length>0){let h=0;A.forEach((t=>{var A,p,g;const m="annotation-"+t;a&&null!==(A=this._myMarkers.markers[m])&&void 0!==A&&null!==(p=A.config)&&void 0!==p&&null!==(g=p.data)&&void 0!==g&&g.blockFocus?h++:this._myMarkers.updateMarker({id:m,svgStyle:{stroke:"var(--orange)",strokeWidth:"3px",fill:"var(--orange-transparent)"},data:{selected:!1,blockFocus:!1}})})),!t&&h<A.length&&this.dispatchEvent(new Event("annotations-unfocused"))}}startDrawAnnotation(){this.toggleAllAnnotations(!1),this._drawingAnnotation=[],this._drawingMoves=0,this._myMarkers.addMarker({id:F,polygon:[{yaw:0,pitch:0},{yaw:0,pitch:0},{yaw:0,pitch:0}],svgStyle:{fill:q,stroke:Y,strokeWidth:"2px"},visible:!1}),this._myMarkers.addMarker({id:U,circle:5,position:{yaw:0,pitch:0},style:{cursor:"pointer"},svgStyle:{fill:W,stroke:G,strokeWidth:"3px"}}),this._myMarkers.addMarker({id:j,circle:5,position:{yaw:0,pitch:0},style:{cursor:"pointer"},svgStyle:{fill:W,stroke:G,strokeWidth:"3px"},visible:!1});const firstMove=t=>{const a=this.getPositionFromEvent(t);a&&this._myMarkers.markers[U]&&(this._myMarkers.updateMarker({id:U,position:a,style:{cursor:"grab"}}),2==this._drawingAnnotation.length&&this._myMarkers.markers[F]&&this._myMarkers.updateMarker({id:F,polygon:[a,{yaw:a.yaw,pitch:this._drawingAnnotation[1].pitch},this._drawingAnnotation[1],{yaw:this._drawingAnnotation[1].yaw,pitch:a.pitch}]}))},secMove=t=>{const a=this.getPositionFromEvent(t);a&&this._myMarkers.markers[j]&&(this._myMarkers.updateMarker({id:j,position:a,style:{cursor:"grab"}}),this._drawingAnnotation.length>=1&&this._myMarkers.markers[F]&&this._myMarkers.updateMarker({id:F,polygon:[this._drawingAnnotation[0],{yaw:this._drawingAnnotation[0].yaw,pitch:a.pitch},a,{yaw:a.yaw,pitch:this._drawingAnnotation[0].pitch}]}))};this._drawListeners=[firstMove,secMove],this.parent.addEventListener("mousemove",firstMove),this._drawingMoves=1,this._drawListenerClick=t=>{let a=!1;if(2!==this._drawingMoves&&t.marker.id===U?0==this._drawingAnnotation.length?(this._drawingAnnotation.push({yaw:t.marker.config.position.yaw,pitch:t.marker.config.position.pitch}),this.parent.removeEventListener("mousemove",firstMove),this._myMarkers.updateMarker({id:U,style:{cursor:"pointer"}}),this._myMarkers.updateMarker({id:j,visible:!0,position:{yaw:t.marker.config.position.yaw,pitch:t.marker.config.position.pitch}}),this._myMarkers.updateMarker({id:F,visible:!0}),this.parent.addEventListener("mousemove",secMove),this._drawingMoves=2):0===this._drawingMoves?(this.parent.addEventListener("mousemove",firstMove),this._drawingMoves=1):(this._drawingAnnotation[0]={yaw:t.marker.config.position.yaw,pitch:t.marker.config.position.pitch},this.parent.removeEventListener("mousemove",firstMove),this._myMarkers.updateMarker({id:U,style:{cursor:"pointer"}}),this._drawingMoves=0,a=!0):1!==this._drawingMoves&&t.marker.id===j&&(1==this._drawingAnnotation.length?(this._drawingAnnotation.push({yaw:t.marker.config.position.yaw,pitch:t.marker.config.position.pitch}),this.parent.removeEventListener("mousemove",secMove),this._myMarkers.updateMarker({id:j,style:{cursor:"pointer"}}),this._drawingMoves=0,a=!0):2===this._drawingMoves?(this._drawingAnnotation[1]={yaw:t.marker.config.position.yaw,pitch:t.marker.config.position.pitch},this.parent.removeEventListener("mousemove",secMove),this._myMarkers.updateMarker({id:j,style:{cursor:"pointer"}}),this._drawingMoves=0,a=!0):(this.parent.addEventListener("mousemove",secMove),this._drawingMoves=2)),a){var A,h;const t=this.dataHelper.sphericalCoordsToTextureCoords(this._drawingAnnotation[0]),a=this.dataHelper.sphericalCoordsToTextureCoords(this._drawingAnnotation[1]);let p=[t.textureX,t.textureY,a.textureX,a.textureY];const g=null===(A=this.getPictureMetadata())||void 0===A||null===(h=A.panorama)||void 0===h?void 0:h.cropData;if(g&&(p[0]-=g.croppedX,p[1]-=g.croppedY,p[2]-=g.croppedX,p[3]-=g.croppedY,(p[0]<0||p[0]>g.croppedWidth||p[1]<0||p[1]>g.croppedHeight||p[2]<0||p[2]>g.croppedWidth||p[3]<0||p[3]>g.croppedHeight)&&(p=null)),p[0]>=p[2]&&p[1]>=p[3]){let t=p[0],a=p[2],A=p[1];p=[a,p[3],t,A]}const m=new CustomEvent("annotation-drawn",{detail:{shape:p}});this.dispatchEvent(m)}},this._myMarkers.addEventListener("select-marker",this._drawListenerClick)}fixDrawAnnotation(){[U,j].forEach((t=>{try{this._myMarkers.removeMarker(t)}catch(a){}})),(this._drawListeners||[]).forEach((t=>this.parent.removeEventListener("mousemove",t))),this._myMarkers.removeEventListener("select-marker",this._drawListenerClick),this._myMarkers.updateMarker({id:F,svgStyle:{stroke:"var(--red)",strokeWidth:"3px",fill:"var(--red-transparent)",cursor:"pointer"}}),this._drawingMoves=0}stopDrawAnnotation(){[U,j,F].forEach((t=>{try{this._myMarkers.removeMarker(t)}catch(a){}})),(this._drawListeners||[]).forEach((t=>this.parent.removeEventListener("mousemove",t))),this._myMarkers.removeEventListener("select-marker",this._drawListenerClick),delete this._drawingMoves,this._drawingAnnotation=null}getPositionFromEvent(t){const a=this.container.getBoundingClientRect(),A=t.clientX-a.left,h=t.clientY-a.top,p=this.renderer.getIntersections({x:A,y:h}).find((t=>t.object.userData[v.aH.VIEWER_DATA]));if(p)return this.dataHelper.vector3ToSphericalCoords(p.point)}forceRefresh(){var t;const a=this._myVTour.getCurrentNode();if(a&&a.panorama.baseUrl!==(null===a||void 0===a||null===(t=a.panorama)||void 0===t?void 0:t.origBaseUrl)){const t=this.getZoomLevel(),A=this.getPosition();this._myVTour.state.currentNode=null,this._myVTour.setCurrentNode(a.id,{zoomTo:t,rotateTo:A,fadeIn:!1,speed:0,rotation:!1})}a&&a.panorama.rows>1&&this.adapter.__refresh()}}},4374:(t,a,A)=>{"use strict";A.d(a,{A:()=>Popup});var h=A(4542),p=A(5995),g=A(8591),m=A(6627);class Popup extends h.WF{constructor(){super(),this.visible=!1}connectedCallback(){super.connectedCallback(),this.addEventListener("click",(t=>{t.target===this&&this.close()})),document.addEventListener("keyup",(t=>{"Escape"===t.key&&this.visible&&this.close()}))}attributeChangedCallback(t,a,A){super.attributeChangedCallback(t,a,A),"visible"==t&&(""!==A&&!0!==A||this.dispatchEvent(new Event("open")))}close(){this.visible=!1,this.dispatchEvent(new Event("close"))}render(){return h.qy`
1632
1632
  <div class="pnx-panel pnx-padded">
1633
1633
  <pnx-button
1634
1634
  class="btn-close"