/*! For license information please see 7813.js.LICENSE.txt */
"use strict";(self.webpackChunkmp_webgl=self.webpackChunkmp_webgl||[]).push([[7813],{20014:(e,t,s)=>{s.d(t,{g:()=>a,l:()=>o});var i=s(92475);class o extends i.E{constructor(e,t){super(e),this.pinchDelta=t}}class a extends i.E{constructor(e,t,s){super(e),this.pinchDelta=t,this.timeSinceLastMove=s}}},44667:(e,t,s)=>{s.d(t,{s:()=>o});var i=s(92475);class o extends i.E{constructor(e,t,s){super(e),this.position=t,this.delta=s}}},60043:(e,t,s)=>{s.d(t,{k:()=>o});var i=s(49586);class o extends i.T{constructor(e,t,s){super(),this.key=e,this.state=t,this.modifiers=s}}},31285:(e,t,s)=>{s.d(t,{A:()=>o});var i=s(7478);class o extends i.QB{constructor(e){super(),this.zoomLevel=e}}},37813:(e,t,s)=>{s.r(t),s.d(t,{default:()=>T});var i=s(64882),o=s(71687),a=s(44667),r=s(20014),n=s(60043),h=s(71397),l=s(28337),c=s(10459),m=s(12767),u=s(99583),d=s(12837),p=s(3249),w=s(53172),D=s(46771);const g=.1,z=.7,v=2,b=3,y=1.1;var S=s(31285),k=s(76318);class T extends i.n{constructor(){super(...arguments),this.name="zoom-controls",this.uhQuality={},this.config={enabled:!0}}async init(e,t){this.config.enabled=!!e.enabled,this.sweepTilingModule=await t.getModuleBySymbol(o.qD),this.config.enabled&&await this.registerControls(t),this.engine=t,this.cameraModule=await t.getModuleBySymbol(o.jh),this.cameraData=await t.market.waitForData(c.M),this.viewmodeData=await t.market.waitForData(u.X),this.sweepData=await t.market.waitForData(d.A)}async registerControls(e){e.getModuleBySymbol(o.mL).then((e=>{this.bindings.push(e.registerHandler(a.s,(e=>this.zoomByInput(this.scrollToZoomDelta(e))))),this.bindings.push(e.registerHandler(r.l,(e=>this.zoomByInput(this.pinchToZoomDelta(e))))),this.bindings.push(e.registerHandler(n.k,(e=>this.keyHandler(e))))}))}zoomTo(e){const t=this.cameraData.zoom();if(!this.validateViewmode())return t;const s=this.sweepData.state.currentSweep,{currentSweepObject:i}=this.sweepData;if(i&&this.checkTilingZoomLevels(e,i),(e=(0,p.qE)(e,z,this.getMaxZoom(s)))!==t){const t=(0,w.H)(this.cameraData.baseFovY/e),s=m.Bv.near,i=m.Bv.far;this.cameraModule.getCameraControllerForViewport().updateCameraProjection((new D.k).makePerspectiveFov(t,this.cameraData.aspect(),s,i))}return this.engine.broadcast(new S.A(e)),e}checkTilingZoomLevels(e,t){if(e>=y&&this.zoomedSweep!==t){this.zoomedSweep=t;this.sweepTilingModule.enableZooming(!0,t.id)?this.uhQuality[t.id]=!0:(this.uhQuality[t.id]=!1,this.zoomedSweep=void 0)}else e<y&&this.zoomedSweep&&this.zoomedSweep===t&&(this.sweepTilingModule.enableZooming(!1,this.zoomedSweep.id),this.zoomedSweep=void 0)}getMaxZoom(e){return this.uhQuality[null!=e?e:"none"]?b:v}zoomIn(e){return this.zoomBy(e)}zoomOut(e){return this.zoomBy(-e)}zoomReset(){return this.zoomTo(1)}zoomBy(e){const t=this.cameraData.zoom();return this.validateViewmode()?this.zoomTo(t+e):t}validateViewmode(){return this.viewmodeData.isInside()&&this.cameraData.canTransition()}scrollToZoomDelta(e){return-Math.sign(e.delta.y)*g}pinchToZoomDelta(e){return e.pinchDelta*(v-z)}zoomByInput(e){const t=this.cameraData.zoom();if(!this.validateViewmode())return t;const s=this.sweepData.state.currentSweep,i=(0,p.qE)(t+e,z,this.getMaxZoom(s));return this.zoomTo(i)}keyHandler(e){if(e.state===l.$.DOWN)switch(e.key){case h.D.PLUSEQUALS:this.zoomByInput(g);break;case h.D.DASHUNDERSCORE:this.zoomByInput(-g);break;case h.D.OPENBRACKET:this.zoomTo(1)}}getMaxZoomAvailable(){if(!this.sweepData.currentSweepObject)return v;return this.sweepData.currentSweepObject.availableResolution(k.MF.ULTRAHIGH)>=k.MF.ULTRAHIGH?b:v}}},28337:(e,t,s)=>{var i;s.d(t,{$:()=>i}),function(e){e[e.DOWN=0]="DOWN",e[e.PRESSED=1]="PRESSED",e[e.UP=2]="UP"}(i||(i={}))}}]);