From c7459081ddc22b5dc11e48a535f30be6e0759dca Mon Sep 17 00:00:00 2001
From: bherr2 "+ge+"
=-Ce&&d<=Ce},Ee.isSet=vT,Ee.isString=py,Ee.isSymbol=ca,Ee.isTypedArray=cf,Ee.isUndefined=function(d){return d===ee},Ee.isWeakMap=function(d){return Mr(d)&&$s(d)==B},Ee.isWeakSet=function(d){return Mr(d)&&"[object WeakSet]"==Ms(d)},Ee.join=function(d,f){return null==d?"":jh.call(d,f)},Ee.kebabCase=BT,Ee.last=sa,Ee.lastIndexOf=function(d,f,_){var F=null==d?0:d.length;if(!F)return-1;var ae=F;return _!==ee&&(ae=(ae=Jn(_))<0?Hr(F+ae,0):ms(ae,F-1)),f==f?function(at,It,Et){for(var un=Et+1;un--;)if(at[un]===It)return un;return un}(d,f,ae):Cd(d,Ac,ae,!0)},Ee.lowerCase=jT,Ee.lowerFirst=X2,Ee.lt=Bc,Ee.lte=gy,Ee.max=function(d){return d&&d.length?Yh(d,io,Fo):ee},Ee.maxBy=function(d,f){return d&&d.length?Yh(d,Fn(f,2),Fo):ee},Ee.mean=function(d){return Cs(d,io)},Ee.meanBy=function(d,f){return Cs(d,Fn(f,2))},Ee.min=function(d){return d&&d.length?Yh(d,io,Mv):ee},Ee.minBy=function(d,f){return d&&d.length?Yh(d,Fn(f,2),Mv):ee},Ee.stubArray=Vc,Ee.stubFalse=Fy,Ee.stubObject=function(){return{}},Ee.stubString=function(){return""},Ee.stubTrue=function(){return!0},Ee.multiply=aE,Ee.nth=function(d,f){return d&&d.length?xu(d,Jn(f)):ee},Ee.noConflict=function(){return zi._===this&&(zi._=d_),this},Ee.noop=Ny,Ee.now=Nu,Ee.pad=function(d,f,_){d=Gi(d);var F=(f=Jn(f))?Fh(d):0;if(!f||F>=f)return d;var ae=(f-F)/2;return kp(Ei(ae),_)+d+kp(jt(ae),_)},Ee.padEnd=function(d,f,_){d=Gi(d);var F=(f=Jn(f))?Fh(d):0;return f&&F
\n":"'+(Le?ge:ve(ge,!0))+"
\n"},lt.blockquote=function(ge){return""+(Le?ge:ve(ge,!0))+"
\n"+ge+"
\n"},lt.html=function(ge){return ge},lt.heading=function(ge,be,Le,ut){return this.options.headerIds?"
\n":"
\n"},lt.list=function(ge,be,Le){var ut=be?"ol":"ul";return"<"+ut+(be&&1!==Le?' start="'+Le+'"':"")+">\n"+ge+""+ut+">\n"},lt.listitem=function(ge){return"\n\n"+ge+"\n"+be+"
\n"},lt.tablerow=function(ge){return"\n"+ge+" \n"},lt.tablecell=function(ge,be){var Le=be.header?"th":"td";return(be.align?"<"+Le+' align="'+be.align+'">':"<"+Le+">")+ge+""+Le+">\n"},lt.strong=function(ge){return""+ge+""},lt.em=function(ge){return""+ge+""},lt.codespan=function(ge){return""+ge+"
"},lt.br=function(){return this.options.xhtml?"
":"
"},lt.del=function(ge){return""+ge+""},lt.link=function(ge,be,Le){if(null===(ge=pt(this.options.sanitize,this.options.baseUrl,ge)))return Le;var ut='"+Le+""},lt.image=function(ge,be,Le){if(null===(ge=pt(this.options.sanitize,this.options.baseUrl,ge)))return Le;var ut='":">")},lt.text=function(ge){return ge},rt}(),N=function(){function rt(){}var lt=rt.prototype;return lt.strong=function(ge){return ge},lt.em=function(ge){return ge},lt.codespan=function(ge){return ge},lt.del=function(ge){return ge},lt.html=function(ge){return ge},lt.text=function(ge){return ge},lt.link=function(ge,be,Le){return""+Le},lt.image=function(ge,be,Le){return""+Le},lt.br=function(){return""},rt}(),B=function(){function rt(){this.seen={}}var lt=rt.prototype;return lt.serialize=function(ge){return ge.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},lt.getNextSafeSlug=function(ge,be){var Le=ge,ut=0;if(this.seen.hasOwnProperty(Le)){ut=this.seen[ge];do{Le=ge+"-"+ ++ut}while(this.seen.hasOwnProperty(Le))}return be||(this.seen[ge]=ut,this.seen[Le]=0),Le},lt.slug=function(ge,be){void 0===be&&(be={});var Le=this.serialize(ge);return this.getNextSafeSlug(Le,be.dryrun)},rt}(),Re=L,Qe=N,St=B,Nt=dt.exports.defaults,On=te_unescape,Yn=je,Ti=function(){function rt(ht){this.options=ht||Nt,this.options.renderer=this.options.renderer||new Re,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Qe,this.slugger=new St}rt.parse=function(ge,be){return new rt(be).parse(ge)},rt.parseInline=function(ge,be){return new rt(be).parseInline(ge)};var lt=rt.prototype;return lt.parse=function(ge,be){void 0===be&&(be=!0);var ut,Ze,At,Mt,Dt,Xt,zn,ai,Nn,_n,$n,Cn,lr,cr,Xn,qi,xa,Zr,ie,Le="",fe=ge.length;for(ut=0;ut
"+el(At.message+"",!0)+"";throw At}}return Jt.options=Jt.setOptions=function(rt){return Bs(Jt.defaults,rt),Sa(Jt.defaults),Jt},Jt.getDefaults=kl,Jt.defaults=Es,Jt.use=function(){for(var rt=this,lt=arguments.length,ht=new Array(lt),ge=0;ge
"+el(ge.message+"",!0)+"";throw ge}},Jt.Parser=Ti,Jt.parser=Ti.parse,Jt.Renderer=Xr,Jt.TextRenderer=Ls,Jt.Lexer=Yn,Jt.lexer=Yn.lex,Jt.Tokenizer=wi,Jt.Slugger=gs,Jt.parse=Jt,Jt}()},369:(Ut,it,Je)=>{var yt=Je(284),ee=Je(830);function Tt(){this.clear()}Tt.prototype.clear=function(){this.items=[],this.offset=0,this.size=0},Tt.prototype.enqueue=function(dt){return this.items.push(dt),++this.size},Tt.prototype.dequeue=function(){if(this.size){var dt=this.items[this.offset];return 2*++this.offset>=this.items.length&&(this.items=this.items.slice(this.offset),this.offset=0),this.size--,dt}},Tt.prototype.peek=function(){if(this.size)return this.items[this.offset]},Tt.prototype.forEach=function(dt,Y){Y=arguments.length>1?Y:this;for(var Se=this.offset,he=0,W=this.items.length;Se
=l&&m.type===t)return g}if(r){const g=o[l];if(g&&Ma(g)&&g.type===t)return l}return null}function Fd(n,e,t,i){let r=n[t];const s=e.data;if(function(n){return n instanceof $h}(r)){const o=r;o.resolving&&function(n,e){throw new Ze("200",`Circular dependency in DI detected for ${n}`)}(Xt(s[t]));const a=Cp(o.canSeeViewProviders);o.resolving=!0;const l=o.injectImpl?Ca(o.injectImpl):null;Od(n,i,wn.Default);try{r=n[t]=o.factory(void 0,s,n,i),e.firstCreatePass&&t>=i.directiveStart&&function(n,e,t){const{ngOnChanges:i,ngOnInit:r,ngDoCheck:s}=e.type.prototype;if(i){const o=gv(e);(t.preOrderHooks||(t.preOrderHooks=[])).push(n,o),(t.preOrderCheckHooks||(t.preOrderCheckHooks=[])).push(n,o)}r&&(t.preOrderHooks||(t.preOrderHooks=[])).push(0-n,r),s&&((t.preOrderHooks||(t.preOrderHooks=[])).push(n,s),(t.preOrderCheckHooks||(t.preOrderCheckHooks=[])).push(n,s))}(t,s[t],e)}finally{null!==l&&Ca(l),Cp(a),o.resolving=!1,Po()}}return r}function Tp(n,e,t){return!!(t[e+(n>>5)]&1<0;){const t=n[--e];if("number"==typeof t&&t<0)return t}return 0})(a)!=l&&a.push(l),a.push(i,r,o)}}function Kw(n,e){null!==n.hostBindings&&n.hostBindings(1,e)}function Xw(n,e){e.flags|=2,(n.components||(n.components=[])).push(e.index)}function kT(n,e,t){if(t){if(e.exportAs)for(let i=0;it&&(o=Math.max(o,s-t)),o>0&&r.splice(0,o),r}}class tie{constructor(e,t){this.time=e,this.value=t}}function Ir(n,e){return"function"==typeof e?t=>t.pipe(Ir((i,r)=>je(n(i,r)).pipe(me((s,o)=>e(i,s,r,o))))):t=>t.lift(new nie(n))}class nie{constructor(e){this.project=e}call(e,t){return t.subscribe(new iie(e,this.project))}}class iie extends ve{constructor(e,t){super(e),this.project=t,this.index=0}_next(e){let t;const i=this.index++;try{t=this.project(e,i)}catch(r){return void this.destination.error(r)}this._innerSub(t)}_innerSub(e){const t=this.innerSubscription;t&&t.unsubscribe();const i=new _t(this),r=this.destination;r.add(i),this.innerSubscription=N(e,i),this.innerSubscription!==i&&r.add(this.innerSubscription)}_complete(){const{innerSubscription:e}=this;(!e||e.closed)&&super._complete(),this.unsubscribe()}_unsubscribe(){this.innerSubscription=void 0}notifyComplete(){this.innerSubscription=void 0,this.isStopped&&super._complete()}notifyNext(e){this.destination.next(e)}}const hS={schedule(n,e){const t=setTimeout(n,e);return()=>clearTimeout(t)},scheduleBeforeRender(n){if("undefined"==typeof window)return hS.schedule(n,0);if(void 0===window.requestAnimationFrame)return hS.schedule(n,16);const e=window.requestAnimationFrame(n);return()=>window.cancelAnimationFrame(e)}};let XD;function fie(n,e,t){let i=t;return function(n){return!!n&&n.nodeType===Node.ELEMENT_NODE}(n)&&e.some((r,s)=>!("*"===r||!function(n,e){if(!XD){const t=Element.prototype;XD=t.matches||t.matchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector}return n.nodeType===Node.ELEMENT_NODE&&XD.call(n,e)}(n,r)||(i=s,0))),i}class gie{constructor(e,t){this.componentFactory=t.get(wl).resolveComponentFactory(e)}create(e){return new mie(this.componentFactory,e)}}class mie{constructor(e,t){this.componentFactory=e,this.injector=t,this.eventEmitters=new kg(1),this.events=this.eventEmitters.pipe(Ir(i=>kn(...i))),this.componentRef=null,this.viewChangeDetectorRef=null,this.inputChanges=null,this.hasInputChanges=!1,this.implementsOnChanges=!1,this.scheduledChangeDetectionFn=null,this.scheduledDestroyFn=null,this.initialInputValues=new Map,this.unchangedInputs=new Set(this.componentFactory.inputs.map(({propName:i})=>i)),this.ngZone=this.injector.get(fn),this.elementZone="undefined"==typeof Zone?null:this.ngZone.run(()=>Zone.current)}connect(e){this.runInZone(()=>{if(null!==this.scheduledDestroyFn)return this.scheduledDestroyFn(),void(this.scheduledDestroyFn=null);null===this.componentRef&&this.initializeComponent(e)})}disconnect(){this.runInZone(()=>{null===this.componentRef||null!==this.scheduledDestroyFn||(this.scheduledDestroyFn=hS.schedule(()=>{null!==this.componentRef&&(this.componentRef.destroy(),this.componentRef=null,this.viewChangeDetectorRef=null)},10))})}getInputValue(e){return this.runInZone(()=>null===this.componentRef?this.initialInputValues.get(e):this.componentRef.instance[e])}setInputValue(e,t){this.runInZone(()=>{null!==this.componentRef?function(n,e){return n===e||n!=n&&e!=e}(t,this.getInputValue(e))&&(void 0!==t||!this.unchangedInputs.has(e))||(this.recordInputChange(e,t),this.unchangedInputs.delete(e),this.hasInputChanges=!0,this.componentRef.instance[e]=t,this.scheduleDetectChanges()):this.initialInputValues.set(e,t)})}initializeComponent(e){const t=Wn.create({providers:[],parent:this.injector}),i=function(n,e){const t=n.childNodes,i=e.map(()=>[]);let r=-1;e.some((s,o)=>"*"===s&&(r=o,!0));for(let s=0,o=t.length;s{const c={moduleParameters:t,uniforms:i,parameters:r,context:this.context};for(const u of this.props.extensions)u.draw.call(this,c,u);this.draw(c)})}finally{this.props=s}}getChangeFlags(){return this.internalState.changeFlags}setChangeFlags(t){const{changeFlags:i}=this.internalState;for(const s in t)if(t[s]){let o=!1;switch(s){case"dataChanged":Array.isArray(i[s])&&(i[s]=Array.isArray(t[s])?i[s].concat(t[s]):t[s],o=!0);default:i[s]||(i[s]=t[s],o=!0)}o&&To("layer.changeFlag",this,s,t)}const r=i.dataChanged||i.updateTriggersChanged||i.propsChanged||i.extensionsChanged;i.propsOrDataChanged=r,i.somethingChanged=r||t.viewportChanged||t.stateChanged}clearChangeFlags(){this.internalState.changeFlags={dataChanged:!1,propsChanged:!1,updateTriggersChanged:!1,viewportChanged:!1,stateChanged:!1,extensionsChanged:!1,propsOrDataChanged:!1,somethingChanged:!1}}diffProps(t,i){const r=function(n,e){const t=OU({newProps:n,oldProps:e,propTypes:WI(n),ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),i=function(n,e){if(null===e)return"oldProps is null, initial diff";let t=null;const{dataComparator:i,_dataDiff:r}=n;return i?i(n.data,e.data)||(t="Data comparator detected a change"):n.data!==e.data&&(t="A new data container was supplied"),t&&r&&(t=r(n.data,e.data)||t),t}(n,e);let r=!1;return i||(r=function(n,e){if(null===e)return"oldProps is null, initial diff";if("all"in n.updateTriggers&&RU(n,e,"all"))return{all:!0};const t={};let i=!1;for(const r in n.updateTriggers)"all"!==r&&RU(n,e,r)&&(t[r]=!0,i=t);return i}(n,e)),{dataChanged:i,propsChanged:t,updateTriggersChanged:r,extensionsChanged:Ple(n,e),transitionsChanged:Ole(n,e)}}(t,i);if(r.updateTriggersChanged)for(const s in r.updateTriggersChanged)r.updateTriggersChanged[s]&&this.invalidateAttribute(s);if(r.transitionsChanged)for(const s in r.transitionsChanged)this.internalState.uniformTransitions.add(s,i[s],t[s],t.transitions[s]);return this.setChangeFlags(r)}validateProps(){!function(n){const e=WI(n);for(const t in e){const i=e[t],{validate:r}=i;if(r&&!r(n[t],i))throw new Error("Invalid prop ".concat(t,": ").concat(n[t]))}}(this.props)}setModuleParameters(t){for(const i of this.getModels())i.updateModuleSettings(t)}updateAutoHighlight(t){this.props.autoHighlight&&this._updateAutoHighlight(t)}_updateAutoHighlight(t){const i={pickingSelectedColor:t.picked?t.color:null},{highlightColor:r}=this.props;t.picked&&"function"==typeof r&&(i.pickingHighlightColor=r(t)),this.setModuleParameters(i),this.setNeedsRedraw()}_updateModules({props:t,oldProps:i},r){const{autoHighlight:s,highlightedObjectIndex:o,highlightColor:a}=t;if(r||i.autoHighlight!==s||i.highlightedObjectIndex!==o||i.highlightColor!==a){const l={};s||(l.pickingSelectedColor=null),Array.isArray(a)&&(l.pickingHighlightColor=a),Number.isInteger(o)&&(l.pickingSelectedColor=o>=0?this.encodePickingColor(o):null),this.setModuleParameters(l)}}_getUpdateParams(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}_getNeedsRedraw(t){if(!this.internalState)return!1;let i=!1;i=i||this.internalState.needsRedraw&&this.id,this.internalState.needsRedraw=this.internalState.needsRedraw&&!t.clearRedrawFlags;const r=this.getAttributeManager(),s=r&&r.getNeedsRedraw(t);return i=i||s,i}_getAttributeManager(){return new Ele(this.context.gl,{id:this.props.id,stats:this.context.stats,timeline:this.context.timeline})}_initState(){pc(!this.internalState&&!this.state),pc(isFinite(this.props.coordinateSystem));const t=this._getAttributeManager();t&&t.addInstanced({instancePickingColors:{type:5121,size:3,noAlloc:!0,update:this.calculateInstancePickingColors}}),this.internalState=new uue({attributeManager:t,layer:this}),this.clearChangeFlags(),this.state={},Object.defineProperty(this.state,"attributeManager",{get:()=>(Ri.deprecated("layer.state.attributeManager","layer.getAttributeManager()"),t)}),this.internalState.layer=this,this.internalState.uniformTransitions=new Tle(this.context.timeline),this.internalState.onAsyncPropUpdated=this._onAsyncPropUpdated.bind(this),this.internalState.setAsyncProps(this.props)}_transferState(t){To("layer.matched",this,this===t);const{state:i,internalState:r}=t;this!==t&&(this.internalState=r,this.internalState.layer=this,this.state=i,this.internalState.setAsyncProps(this.props),this.diffProps(this.props,this.internalState.getOldProps()))}_onAsyncPropUpdated(){this.diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}}return n.layerName="Layer",n.defaultProps=Fde,n})(),Vz=(()=>{class n extends q0{get isComposite(){return!0}get isLoaded(){return super.isLoaded&&this.getSubLayers().every(t=>t.isLoaded)}getSubLayers(){return this.internalState&&this.internalState.subLayers||[]}initializeState(){}setState(t){super.setState(t),this.setNeedsUpdate()}getPickingInfo({info:t}){const{object:i}=t;return i&&i.__source&&i.__source.parent&&i.__source.parent.id===this.id&&(t.object=i.__source.object,t.index=i.__source.index),t}renderLayers(){return null}filterSubLayer(t){return!0}shouldRenderSubLayer(t,i){return i&&i.length}getSubLayerClass(t,i){const{_subLayerProps:r}=this.props;return r&&r[t]&&r[t].type||i}getSubLayerRow(t,i,r){return t.__source={parent:this,object:i,index:r},t}getSubLayerAccessor(t){if("function"==typeof t){const i={data:this.props.data,target:[]};return(r,s)=>r&&r.__source?(i.index=r.__source.index,t(r.__source.object,i)):t(r,s)}return t}getSubLayerProps(t={}){const{opacity:i,pickable:r,visible:s,parameters:o,getPolygonOffset:a,highlightedObjectIndex:l,autoHighlight:c,highlightColor:u,coordinateSystem:h,coordinateOrigin:p,wrapLongitude:g,positionFormat:m,modelMatrix:w,extensions:C,fetch:H,_subLayerProps:U}=this.props,de={opacity:i,pickable:r,visible:s,parameters:o,getPolygonOffset:a,highlightedObjectIndex:l,autoHighlight:c,highlightColor:u,coordinateSystem:h,coordinateOrigin:p,wrapLongitude:g,positionFormat:m,modelMatrix:w,extensions:C,fetch:H},Ae=U&&U[t.id],Pe=Ae&&Ae.updateTriggers,Be=t.id||"sublayer";if(Ae){const et=this.constructor._propTypes,wt=t.type?t.type._propTypes:{};for(const vt in Ae){const Ct=wt[vt]||et[vt];Ct&&"accessor"===Ct.type&&(Ae[vt]=this.getSubLayerAccessor(Ae[vt]))}}Object.assign(de,t,Ae),de.id="".concat(this.props.id,"-").concat(Be),de.updateTriggers=ot(ot({all:this.props.updateTriggers.all},t.updateTriggers),Pe);for(const et of C){const wt=et.getSubLayerProps.call(this,et);wt&&Object.assign(de,wt,{updateTriggers:Object.assign(de.updateTriggers,wt.updateTriggers)})}return de}_updateAutoHighlight(t){for(const i of this.getSubLayers())i.updateAutoHighlight(t)}_getAttributeManager(){return null}_renderLayers(){let{subLayers:t}=this.internalState;const i=!t||this.needsUpdate();i&&(t=this.renderLayers(),t=xI(t,Boolean),this.internalState.subLayers=t),To("compositeLayer.renderLayers",this,i,t);for(const r of t)r.parent=this}}return n.layerName="CompositeLayer",n})();const Lde=/([0-9]+\.?[0-9]*)(%|px)/;function KS(n){switch(typeof n){case"number":return{position:n,relative:!1};case"string":const e=n.match(Lde);if(e&&e.length>=3){const t="%"===e[2],i=parseFloat(e[1]);return{position:t?i/100:i,relative:t}}default:throw new Error("Could not parse position string ".concat(n))}}function XS(n,e){return n.relative?Math.round(n.position*e):n.position}function Y0(n,e){if(n===e)return!0;if(!n||!e)return!1;for(const t in n){const i=n[t],r=e[t];if(!(i===r||Array.isArray(i)&&Array.isArray(r)&&Y0(i,r)))return!1}return!0}class UO{constructor(e={}){const{id:t=null,x:i=0,y:r=0,width:s="100%",height:o="100%",projectionMatrix:a=null,fovy:l=50,near:c=.1,far:u=1e3,modelMatrix:h=null,viewportInstance:p=null,type:g=Jg}=e;pc(!p||p instanceof Jg),this.viewportInstance=p,this.id=t||this.constructor.displayName||"view",this.type=g,this.props=Sn(ot({},e),{id:this.id,projectionMatrix:a,fovy:l,near:c,far:u,modelMatrix:h}),this._parseDimensions({x:i,y:r,width:s,height:o}),this.equals=this.equals.bind(this),Object.seal(this)}equals(e){return this===e||(this.viewportInstance?e.viewportInstance&&this.viewportInstance.equals(e.viewportInstance):Y0(this.props,e.props))}makeViewport({width:e,height:t,viewState:i}){if(this.viewportInstance)return this.viewportInstance;i=this.filterViewState(i);const r=this.getDimensions({width:e,height:t});return this._getViewport(i,r)}getViewStateId(){switch(typeof this.props.viewState){case"string":return this.props.viewState;case"object":return this.props.viewState&&this.props.viewState.id;default:return this.id}}filterViewState(e){if(this.props.viewState&&"object"==typeof this.props.viewState){if(!this.props.viewState.id)return this.props.viewState;const t=ot({},e);for(const i in this.props.viewState)"id"!==i&&(t[i]=this.props.viewState[i]);return t}return e}getDimensions({width:e,height:t}){return{x:XS(this._x,e),y:XS(this._y,t),width:XS(this._width,e),height:XS(this._height,t)}}_getControllerProps(e){let t=this.props.controller;return t?!0===t?e:("function"==typeof t&&(t={type:t}),ot(ot({},e),t)):null}_getViewport(e,t){const{type:i}=this;return new i(ot(ot(ot({},e),this.props),t))}_parseDimensions({x:e,y:t,width:i,height:r}){this._x=KS(e),this._y=KS(t),this._width=KS(i),this._height=KS(r)}}const K0=()=>{},Uz={transitionEasing:n=>n,transitionInterruption:1,onTransitionStart:K0,onTransitionInterrupt:K0,onTransitionEnd:K0};class Bde{constructor(e,t={}){this.ControllerState=e,this.props=ot(ot({},Uz),t),this.propsInTransition=null,this.transition=new L0(t.timeline),this.onViewStateChange=t.onViewStateChange||K0,this.onStateChange=t.onStateChange||K0,this._onTransitionUpdate=this._onTransitionUpdate.bind(this)}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(e){let t=!1;const i=this.props;if(e=ot(ot({},Uz),e),this.props=e,this._shouldIgnoreViewportChange(i,e))return t;if(this._isTransitionEnabled(e)){const{interruption:r,endProps:s}=this.transition.settings,o=ot(ot({},i),2===r?s:this.propsInTransition||i);this._triggerTransition(o,e),t=!0}else this.transition.cancel();return t}updateTransition(){this.transition.update()}_isTransitionEnabled(e){const{transitionDuration:t,transitionInterpolator:i}=e;return(t>0||"auto"===t)&&Boolean(i)}_isUpdateDueToCurrentTransition(e){return!!this.transition.inProgress&&this.transition.settings.interpolator.arePropsEqual(e,this.propsInTransition)}_shouldIgnoreViewportChange(e,t){return this.transition.inProgress?3===this.transition.settings.interruption||this._isUpdateDueToCurrentTransition(t):!this._isTransitionEnabled(t)||t.transitionInterpolator.arePropsEqual(e,t)}_triggerTransition(e,t){const i=new this.ControllerState(e),r=new this.ControllerState(t).shortestPathFrom(i),{transitionInterpolator:s}=t,o=s.getDuration?s.getDuration(e,t):t.transitionDuration;if(0===o)return;const a=t.transitionInterpolator.initializeProps(e,r);this.propsInTransition={},this.duration=o,this.transition.start({duration:o,easing:t.transitionEasing,interpolator:t.transitionInterpolator,interruption:t.transitionInterruption,startProps:a.start,endProps:a.end,onStart:t.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(t.onTransitionInterrupt),onEnd:this._onTransitionEnd(t.onTransitionEnd)}),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(e){return t=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),e(t)}}_onTransitionUpdate(e){const{time:t,settings:{interpolator:i,startProps:r,endProps:s,duration:o,easing:a}}=e,l=a(t/o),c=i.interpolateProps(r,s,l);this.propsInTransition=new this.ControllerState(ot(ot({},this.props),c)).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})}}const zz=["longitude","latitude","zoom","bearing","pitch"],Vde=["longitude","latitude","zoom"];class Hz extends class{constructor(e={}){Array.isArray(e)&&(e={compare:e,extract:e,required:e});const{compare:t,extract:i,required:r}=e;this._propsToCompare=t,this._propsToExtract=i,this._requiredProps=r}arePropsEqual(e,t){for(const i of this._propsToCompare||Object.keys(t))if(!(i in e)||!(i in t)||!T0(e[i],t[i]))return!1;return!0}initializeProps(e,t){let i;if(this._propsToExtract){const r={},s={};for(const o of this._propsToExtract)r[o]=e[o],s[o]=t[o];i={start:r,end:s}}else i={start:e,end:t};return this._checkRequiredProps(i.start),this._checkRequiredProps(i.end),i}interpolateProps(e,t,i){return t}getDuration(e,t){return t.transitionDuration}_checkRequiredProps(e){!this._requiredProps||this._requiredProps.forEach(t=>{const i=e[t];pc(Number.isFinite(i)||Array.isArray(i),"".concat(t," is required for transition"))})}}{constructor(e={}){super((Array.isArray(e)?e:e.transitionProps)||{compare:zz,extract:zz,required:Vde}),this.opts=e}initializeProps(e,t){const i=super.initializeProps(e,t),{makeViewport:r,around:s}=this.opts;if(r&&s){const o=r(e),a=r(t),l=o.unproject(s);i.start.around=s,Object.assign(i.end,{around:a.project(l),aroundPosition:l,width:t.width,height:t.height})}return i}interpolateProps(e,t,i){const r={};for(const s of this._propsToExtract)r[s]=vS(e[s]||0,t[s]||0,i);if(t.aroundPosition){const s=this.opts.makeViewport(ot(ot({},t),r));Object.assign(r,s.panByPosition(t.aroundPosition,vS(e.around,t.around,i)))}return r}}const dh={transitionDuration:0},Ude={transitionDuration:300,transitionEasing:n=>n,transitionInterruption:1},ZS=n=>1-(1-n)*(1-n),tm_WHEEL=["wheel"],tm_PAN=["panstart","panmove","panend"],tm_PINCH=["pinchstart","pinchmove","pinchend"],tm_TRIPLE_PAN=["tripanstart","tripanmove","tripanend"],tm_DOUBLE_TAP=["doubletap"],tm_KEYBOARD=["keydown"];class zO{constructor(e,t={}){this.ControllerState=e,this.controllerState=null,this.controllerStateProps=null,this.eventManager=null,this.transitionManager=new Bde(e,Sn(ot({},t),{onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}));const i=this.linearTransitionProps;this._transition=i&&Sn(ot({},Ude),{transitionInterpolator:new Hz({transitionProps:i})}),this._events=null,this._interactionState={isDragging:!1},this._customEvents=[],this.onViewStateChange=null,this.onStateChange=null,this.handleEvent=this.handleEvent.bind(this),this.setProps(t)}get linearTransitionProps(){return null}set events(e){this.toggleEvents(this._customEvents,!1),this.toggleEvents(e,!0),this._customEvents=e,this.setProps(this.controllerStateProps)}finalize(){for(const e in this._events)this._events[e]&&this.eventManager.off(e,this.handleEvent);this.transitionManager.finalize()}handleEvent(e){const{ControllerState:t}=this;this.controllerState=new t(ot(ot({makeViewport:this.makeViewport},this.controllerStateProps),this._state));const i=this._eventStartBlocked;switch(e.type){case"panstart":return!i&&this._onPanStart(e);case"panmove":return this._onPan(e);case"panend":return this._onPanEnd(e);case"pinchstart":return!i&&this._onPinchStart(e);case"pinchmove":return this._onPinch(e);case"pinchend":return this._onPinchEnd(e);case"tripanstart":return!i&&this._onTriplePanStart(e);case"tripanmove":return this._onTriplePan(e);case"tripanend":return this._onTriplePanEnd(e);case"doubletap":return this._onDoubleTap(e);case"wheel":return this._onWheel(e);case"keydown":return this._onKeyDown(e);default:return!1}}getCenter(e){const{x:t,y:i}=this.controllerStateProps,{offsetCenter:r}=e;return[r.x-t,r.y-i]}isPointInBounds(e,t){const{width:i,height:r}=this.controllerStateProps;if(t&&t.handled)return!1;const s=e[0]>=0&&e[0]<=i&&e[1]>=0&&e[1]<=r;return s&&t&&t.stopPropagation(),s}isFunctionKeyPressed(e){const{srcEvent:t}=e;return Boolean(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}isDragging(){return this._interactionState.isDragging}blockEvents(e){const t=setTimeout(()=>{this._eventStartBlocked===t&&(this._eventStartBlocked=null)},e);this._eventStartBlocked=t}setProps(e){"onViewStateChange"in e&&(this.onViewStateChange=e.onViewStateChange),"onStateChange"in e&&(this.onStateChange=e.onStateChange),"makeViewport"in e&&(this.makeViewport=e.makeViewport),"dragMode"in e&&(this.dragMode=e.dragMode),this.controllerStateProps=e,"eventManager"in e&&this.eventManager!==e.eventManager&&(this.eventManager=e.eventManager,this._events={},this.toggleEvents(this._customEvents,!0)),"transitionInterpolator"in e||(e.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(e);let{inertia:t}=e;!0===t&&(t=300),this.inertia=t;const{scrollZoom:i=!0,dragPan:r=!0,dragRotate:s=!0,doubleClickZoom:o=!0,touchZoom:a=!0,touchRotate:l=!1,keyboard:c=!0}=e,u=Boolean(this.onViewStateChange);this.toggleEvents(tm_WHEEL,u&&i),this.toggleEvents(tm_PAN,u&&(r||s)),this.toggleEvents(tm_PINCH,u&&(a||l)),this.toggleEvents(tm_TRIPLE_PAN,u&&l),this.toggleEvents(tm_DOUBLE_TAP,u&&o),this.toggleEvents(tm_KEYBOARD,u&&c),this.scrollZoom=i,this.dragPan=r,this.dragRotate=s,this.doubleClickZoom=o,this.touchZoom=a,this.touchRotate=l,this.keyboard=c}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(e,t){this.eventManager&&e.forEach(i=>{this._events[i]!==t&&(this._events[i]=t,t?this.eventManager.on(i,this.handleEvent):this.eventManager.off(i,this.handleEvent))})}updateViewport(e,t={},i={}){const r=ot(ot({},e.getViewportProps()),t),s=this.controllerState!==e;if(this._state=e.getState(),this._setInteractionState(i),s){const o=this.controllerState?this.controllerState.getViewportProps():null;this.onViewStateChange&&this.onViewStateChange({viewState:r,interactionState:this._interactionState,oldViewState:o})}}_onTransition(e){this.onViewStateChange&&(e.interactionState=this._interactionState,this.onViewStateChange(e))}_setInteractionState(e){Object.assign(this._interactionState,e),this.onStateChange&&this.onStateChange(this._interactionState)}_onPanStart(e){const t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;let i=this.isFunctionKeyPressed(e)||e.rightButton;(this.invertPan||"pan"===this.dragMode)&&(i=!i);const r=this.controllerState[i?"panStart":"rotateStart"]({pos:t});return this._panMove=i,this.updateViewport(r,dh,{isDragging:!0}),!0}_onPan(e){return!!this.isDragging()&&(this._panMove?this._onPanMove(e):this._onPanRotate(e))}_onPanEnd(e){return!!this.isDragging()&&(this._panMove?this._onPanMoveEnd(e):this._onPanRotateEnd(e))}_onPanMove(e){if(!this.dragPan)return!1;const t=this.getCenter(e),i=this.controllerState.pan({pos:t});return this.updateViewport(i,dh,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(e){const{inertia:t}=this;if(this.dragPan&&t&&e.velocity){const i=this.getCenter(e),s=this.controllerState.pan({pos:[i[0]+e.velocityX*t/2,i[1]+e.velocityY*t/2]}).panEnd();this.updateViewport(s,Sn(ot({},this._getTransitionProps()),{transitionDuration:t,transitionEasing:ZS}),{isDragging:!1,isPanning:!0})}else{const i=this.controllerState.panEnd();this.updateViewport(i,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(e){if(!this.dragRotate)return!1;const t=this.getCenter(e),i=this.controllerState.rotate({pos:t});return this.updateViewport(i,dh,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(e){const{inertia:t}=this;if(this.dragRotate&&t&&e.velocity){const i=this.getCenter(e),s=this.controllerState.rotate({pos:[i[0]+e.velocityX*t/2,i[1]+e.velocityY*t/2]}).rotateEnd();this.updateViewport(s,Sn(ot({},this._getTransitionProps()),{transitionDuration:t,transitionEasing:ZS}),{isDragging:!1,isRotating:!0})}else{const i=this.controllerState.rotateEnd();this.updateViewport(i,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(e){if(!this.scrollZoom)return!1;e.preventDefault();const t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;const{speed:i=.01,smooth:r=!1}=this.scrollZoom,{delta:s}=e;let o=2/(1+Math.exp(-Math.abs(s*i)));s<0&&0!==o&&(o=1/o);const a=this.controllerState.zoom({pos:t,scale:o});return this.updateViewport(a,Sn(ot({},this._getTransitionProps({around:t})),{transitionDuration:r?250:1}),{isZooming:!0,isPanning:!0}),!0}_onTriplePanStart(e){const t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;const i=this.controllerState.rotateStart({pos:t});return this.updateViewport(i,dh,{isDragging:!0}),!0}_onTriplePan(e){if(!this.touchRotate||!this.isDragging())return!1;const t=this.getCenter(e);t[0]-=e.deltaX;const i=this.controllerState.rotate({pos:t});return this.updateViewport(i,dh,{isDragging:!0,isRotating:!0}),!0}_onTriplePanEnd(e){if(!this.isDragging())return!1;const{inertia:t}=this;if(this.touchRotate&&t&&e.velocityY){const i=this.getCenter(e),r=[i[0],i[1]+=e.velocityY*t/2],s=this.controllerState.rotate({pos:r});this.updateViewport(s,Sn(ot({},this._getTransitionProps()),{transitionDuration:t,transitionEasing:ZS}),{isDragging:!1,isRotating:!0}),this.blockEvents(t)}else{const i=this.controllerState.rotateEnd();this.updateViewport(i,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(e){const t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;const i=this.controllerState.zoomStart({pos:t}).rotateStart({pos:t});return this._startPinchRotation=e.rotation,this._lastPinchEvent=e,this.updateViewport(i,dh,{isDragging:!0}),!0}_onPinch(e){if(!this.touchZoom&&!this.touchRotate||!this.isDragging())return!1;let t=this.controllerState;if(this.touchZoom){const{scale:i}=e,r=this.getCenter(e);t=t.zoom({pos:r,scale:i})}if(this.touchRotate){const{rotation:i}=e;t=t.rotate({deltaAngleX:this._startPinchRotation-i})}return this.updateViewport(t,dh,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),this._lastPinchEvent=e,!0}_onPinchEnd(e){if(!this.isDragging())return!1;const{inertia:t,_lastPinchEvent:i}=this;if(this.touchZoom&&t&&i&&e.scale!==i.scale){const r=this.getCenter(e);let s=this.controllerState.rotateEnd();const o=Math.log2(e.scale),a=(o-Math.log2(i.scale))/(e.deltaTime-i.deltaTime),l=Math.pow(2,o+a*t/2);s=s.zoom({pos:r,scale:l}).zoomEnd(),this.updateViewport(s,Sn(ot({},this._getTransitionProps({around:r})),{transitionDuration:t,transitionEasing:ZS}),{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(t)}else{const r=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(r,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return this._startPinchRotation=null,this._lastPinchEvent=null,!0}_onDoubleTap(e){if(!this.doubleClickZoom)return!1;const t=this.getCenter(e);if(!this.isPointInBounds(t,e))return!1;const i=this.isFunctionKeyPressed(e),r=this.controllerState.zoom({pos:t,scale:i?.5:2});return this.updateViewport(r,this._getTransitionProps({around:t}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onKeyDown(e){if(!this.keyboard)return!1;const t=this.isFunctionKeyPressed(e),{zoomSpeed:i,moveSpeed:r,rotateSpeedX:s,rotateSpeedY:o}=this.keyboard,{controllerState:a}=this;let l;const c={};switch(e.srcEvent.code){case"Minus":l=t?a.zoomOut(i).zoomOut(i):a.zoomOut(i),c.isZooming=!0;break;case"Equal":l=t?a.zoomIn(i).zoomIn(i):a.zoomIn(i),c.isZooming=!0;break;case"ArrowLeft":t?(l=a.rotateLeft(s),c.isRotating=!0):(l=a.moveLeft(r),c.isPanning=!0);break;case"ArrowRight":t?(l=a.rotateRight(s),c.isRotating=!0):(l=a.moveRight(r),c.isPanning=!0);break;case"ArrowUp":t?(l=a.rotateUp(o),c.isRotating=!0):(l=a.moveUp(r),c.isPanning=!0);break;case"ArrowDown":t?(l=a.rotateDown(o),c.isRotating=!0):(l=a.moveDown(r),c.isPanning=!0);break;default:return!1}return this.updateViewport(l,this._getTransitionProps(),c),!0}_getTransitionProps(e){const{_transition:t}=this;return t?e?Sn(ot({},t),{transitionInterpolator:new Hz(Sn(ot({},e),{transitionProps:this.linearTransitionProps,makeViewport:this.controllerState.makeViewport}))}):t:dh}}class Gz{constructor(e){this._viewportProps=this._applyConstraints(e)}getViewportProps(){return this._viewportProps}getState(){return this._state}shortestPathFrom(e){return this._viewportProps}_applyConstraints(e){return e}}const hh_target=[0,0,0];class JS extends Gz{constructor({makeViewport:e,width:t,height:i,rotationX:r=0,rotationOrbit:s=0,target:o=hh_target,zoom:a=0,minRotationX:l=-90,maxRotationX:c=90,minZoom:u=-(1/0),maxZoom:h=Infinity,startPanPosition:p,startRotatePos:g,startRotationX:m,startRotationOrbit:w,startZoomPosition:C,startZoom:H}){super({width:t,height:i,rotationX:r,rotationOrbit:s,target:o,zoom:a,minRotationX:l,maxRotationX:c,minZoom:u,maxZoom:h}),this._state={startPanPosition:p,startRotatePos:g,startRotationX:m,startRotationOrbit:w,startZoomPosition:C,startZoom:H},this.makeViewport=e}panStart({pos:e}){return this._getUpdatedState({startPanPosition:this._unproject(e)})}pan({pos:e,startPosition:t}){const i=this._state.startPanPosition||t;if(!i)return this;const s=this.makeViewport(this._viewportProps).panByPosition(i,e);return this._getUpdatedState(s)}panEnd(){return this._getUpdatedState({startPanPosition:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startRotationX:this._viewportProps.rotationX,startRotationOrbit:this._viewportProps.rotationOrbit})}rotate({pos:e,deltaAngleX:t=0,deltaAngleY:i=0}){const{startRotatePos:r,startRotationX:s,startRotationOrbit:o}=this._state,{width:a,height:l}=this._viewportProps;if(!r||!Number.isFinite(s)||!Number.isFinite(o))return this;let c;if(e){let u=(e[0]-r[0])/a;(s<-90||s>90)&&(u*=-1),c={rotationX:s+(e[1]-r[1])/l*180,rotationOrbit:o+180*u}}else c={rotationX:s+i,rotationOrbit:o+t};return this._getUpdatedState(c)}rotateEnd(){return this._getUpdatedState({startRotationX:null,startRotationOrbit:null})}shortestPathFrom(e){const t=e.getViewportProps(),i=ot({},this._viewportProps),{rotationOrbit:r}=i;return Math.abs(r-t.rotationOrbit)>180&&(i.rotationOrbit=r<0?r+360:r-360),i}zoomStart({pos:e}){return this._getUpdatedState({startZoomPosition:this._unproject(e),startZoom:this._viewportProps.zoom})}zoom({pos:e,startPos:t,scale:i}){const{zoom:r}=this._viewportProps;let{startZoom:s,startZoomPosition:o}=this._state;Number.isFinite(s)||(s=r,o=this._unproject(t)||this._unproject(e));const a=this._calculateNewZoom({scale:i,startZoom:s}),l=this.makeViewport(Sn(ot({},this._viewportProps),{zoom:a}));return this._getUpdatedState(ot({zoom:a},l.panByPosition(o,e)))}zoomEnd(){return this._getUpdatedState({startZoomPosition:null,startZoom:null})}zoomIn(e=2){return this._getUpdatedState({zoom:this._calculateNewZoom({scale:e})})}zoomOut(e=2){return this._getUpdatedState({zoom:this._calculateNewZoom({scale:1/e})})}moveLeft(e=50){return this._panFromCenter([-e,0])}moveRight(e=50){return this._panFromCenter([e,0])}moveUp(e=50){return this._panFromCenter([0,-e])}moveDown(e=50){return this._panFromCenter([0,e])}rotateLeft(e=15){return this._getUpdatedState({rotationOrbit:this._viewportProps.rotationOrbit-e})}rotateRight(e=15){return this._getUpdatedState({rotationOrbit:this._viewportProps.rotationOrbit+e})}rotateUp(e=10){return this._getUpdatedState({rotationX:this._viewportProps.rotationX-e})}rotateDown(e=10){return this._getUpdatedState({rotationX:this._viewportProps.rotationX+e})}_unproject(e){const t=this.makeViewport(this._viewportProps);return e&&t.unproject(e)}_calculateNewZoom({scale:e,startZoom:t}){const{maxZoom:i,minZoom:r}=this._viewportProps;return Number.isFinite(t)||(t=this._viewportProps.zoom),Va(t+Math.log2(e),r,i)}_panFromCenter(e){const{width:t,height:i,target:r}=this._viewportProps;return this.pan({startPosition:r,pos:[t/2+e[0],i/2+e[1]]})}_getUpdatedState(e){return new JS(ot(ot(ot({},this._viewportProps),this._state),e))}_applyConstraints(e){const{maxZoom:t,minZoom:i,zoom:r,maxRotationX:s,minRotationX:o,rotationOrbit:a}=e;return e.zoom=Va(r,i,t),e.rotationX=Va(e.rotationX,o,s),(a<-180||a>180)&&(e.rotationOrbit=function(n,e){const t=n%360;return t<0?360+t:t}(a+180)-180),e}}class Hde extends zO{constructor(e){super(JS,e)}get linearTransitionProps(){return["target","zoom","rotationX","rotationOrbit"]}}class Gde extends zO{constructor(e){e.dragMode=e.dragMode||"pan",super(JS,e)}_onPanRotate(e){return!1}get linearTransitionProps(){return["target","zoom"]}}const $de=(new qn).lookAt({eye:[0,0,1]});function Wde({width:n,height:e,near:t,far:i}){return n=n||1,e=e||1,(new qn).ortho({left:-n/2,right:n/2,bottom:-e/2,top:e/2,near:t,far:i})}class qde extends Jg{constructor(e){const{width:t,height:i,near:r=.1,far:s=1e3,zoom:o=0,target:a=[0,0,0],flipY:l=!0}=e,c=Math.pow(2,o);super(Sn(ot({},e),{longitude:null,position:a,viewMatrix:$de.clone().scale([c,c*(l?-1:1),c]),projectionMatrix:Wde({width:t,height:i,near:r,far:s}),zoom:o}))}panByPosition(e,t){const r=VS([],e,VU([],j0(t,this.pixelUnprojectionMatrix)));return{target:VS([],this.center,r)}}}let Yde=(()=>{class n extends UO{constructor(t){super(Sn(ot({},t),{type:qde}))}get controller(){return this._getControllerProps({type:Gde})}}return n.displayName="OrthographicView",n})();const ex=Math.PI/180;function Kde({height:n,fovy:e,orbitAxis:t,rotationX:i,rotationOrbit:r,zoom:s}){const o=.5/Math.tan(e*ex/2),a="Z"===t?[0,0,1]:[0,1,0],l="Z"===t?[0,-o,0]:[0,0,o],c=(new qn).lookAt({eye:l,up:a});c.rotateX(i*ex),"Z"===t?c.rotateZ(r*ex):c.rotateY(r*ex);const u=Math.pow(2,s)/(n||1);return c.scale(u),c}class Xde extends Jg{constructor(e){const{height:t,fovy:i,orbitAxis:r,target:s=[0,0,0],rotationX:o=0,rotationOrbit:a=0,zoom:l=0}=e;super(Sn(ot({},e),{longitude:null,viewMatrix:Kde({height:t,fovy:i,orbitAxis:r,rotationX:o,rotationOrbit:a,zoom:l}),fovy:i,position:s,zoom:l})),this.projectedCenter=this.project(this.center)}unproject(e,{topLeft:t=!0}={}){const[i,r,s=this.projectedCenter[2]]=e,o=t?r:this.height-r,[a,l,c]=j0([i,o,s],this.pixelUnprojectionMatrix);return[a,l,c]}panByPosition(e,t){const i=this.project(e);return{target:this.unproject([this.width/2+i[0]-t[0],this.height/2+i[1]-t[1],this.projectedCenter[2]])}}}let Qde=(()=>{class n extends UO{constructor(t={}){const{orbitAxis:i="Z"}=t;super(Sn(ot({},t),{orbitAxis:i,type:Xde}))}get controller(){return this._getControllerProps({type:Hde})}}return n.displayName="OrbitView",n})();const Zde=[255,255,255],Jde=1;let ehe=0;class $z{constructor(e={}){const{color:t=Zde}=e,{intensity:i=Jde}=e;this.id=e.id||"ambient-".concat(ehe++),this.color=t,this.intensity=i,this.type="ambient"}}const the=[255,255,255],nhe=1,ihe=[0,0,-1];let rhe=0;class Wz{constructor(e={}){const{color:t=the}=e,{intensity:i=nhe}=e,{direction:r=ihe}=e,{_shadow:s=!1}=e;this.id=e.id||"directional-".concat(rhe++),this.color=t,this.intensity=i,this.type="directional",this.direction=new Ao(r).normalize().toArray(),this.shadow=s}getProjectedLight(){return this}}class qz{constructor(e={}){const{id:t="effect"}=e;this.id=t,this.props=ot({},e)}preRender(){}getModuleParameters(){}cleanup(){}}class HO extends class{constructor(e,t={}){const{id:i="pass"}=t;this.id=i,this.gl=e,this.props=ot({},t)}setProps(e){Object.assign(this.props,e)}render(){}cleanup(){}}{render(e){return $u(this.gl,{framebuffer:e.target}),this._drawLayers(e)}_drawLayers(e){const{viewports:t,views:i,onViewportActive:r,clearCanvas:s=!0}=e;e.pass=e.pass||"unknown";const o=this.gl;s&&function(n){$u(n,{viewport:[0,0,n.drawingBufferWidth,n.drawingBufferHeight]}),n.clear(16640)}(o);const a=[];for(const l of t){const c=l.viewport||l,u=i&&i[c.id];r(c);const h=this._getDrawLayerParams(c,e);e.view=u;const p=c.subViewports||[c];for(const g of p){e.viewport=g;const m=this._drawLayersInViewport(o,e,h);a.push(m)}}return a}_getDrawLayerParams(e,{layers:t,pass:i,layerFilter:r,effects:s,moduleParameters:o}){const a=[],l=Yz(),c={viewport:e,isPicking:i.startsWith("picking"),renderPass:i};for(let u=0;u0){const s=1/r;this.x*=s,this.y*=s,this.z*=s}else this.x=0,this.y=0,this.z=0;return r}unit(e=new le){const t=this.x,i=this.y,r=this.z;let s=Math.sqrt(t*t+i*i+r*r);return s>0?(s=1/s,e.x=t*s,e.y=i*s,e.z=r*s):(e.x=1,e.y=0,e.z=0),e}length(){const e=this.x,t=this.y,i=this.z;return Math.sqrt(e*e+t*t+i*i)}lengthSquared(){return this.dot(this)}distanceTo(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z;return Math.sqrt((s-t)*(s-t)+(o-i)*(o-i)+(a-r)*(a-r))}distanceSquared(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z;return(s-t)*(s-t)+(o-i)*(o-i)+(a-r)*(a-r)}scale(e,t=new le){const r=this.y,s=this.z;return t.x=e*this.x,t.y=e*r,t.z=e*s,t}vmul(e,t=new le){return t.x=e.x*this.x,t.y=e.y*this.y,t.z=e.z*this.z,t}addScaledVector(e,t,i=new le){return i.x=this.x+e*t.x,i.y=this.y+e*t.y,i.z=this.z+e*t.z,i}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}isZero(){return 0===this.x&&0===this.y&&0===this.z}negate(e=new le){return e.x=-this.x,e.y=-this.y,e.z=-this.z,e}tangents(e,t){const i=this.length();if(i>0){const r=rye,s=1/i;r.set(this.x*s,this.y*s,this.z*s);const o=sye;Math.abs(r.x)<.9?(o.set(1,0,0),r.cross(o,e)):(o.set(0,1,0),r.cross(o,e)),r.cross(e,t)}else e.set(1,0,0),t.set(0,1,0)}toString(){return this.x+","+this.y+","+this.z}toArray(){return[this.x,this.y,this.z]}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}lerp(e,t,i){const r=this.x,s=this.y,o=this.z;i.x=r+(e.x-r)*t,i.y=s+(e.y-s)*t,i.z=o+(e.z-o)*t}almostEquals(e,t=1e-6){return!(Math.abs(this.x-e.x)>t||Math.abs(this.y-e.y)>t||Math.abs(this.z-e.z)>t)}almostZero(e=1e-6){return!(Math.abs(this.x)>e||Math.abs(this.y)>e||Math.abs(this.z)>e)}isAntiparallelTo(e,t){return this.negate(Z5),Z5.almostEquals(e,t)}clone(){return new le(this.x,this.y,this.z)}}le.ZERO=void 0,le.UNIT_X=void 0,le.UNIT_Y=void 0,le.UNIT_Z=void 0,le.ZERO=new le(0,0,0),le.UNIT_X=new le(1,0,0),le.UNIT_Y=new le(0,1,0),le.UNIT_Z=new le(0,0,1);const rye=new le,sye=new le,Z5=new le;class gr{constructor(e={}){this.lowerBound=void 0,this.upperBound=void 0,this.lowerBound=new le,this.upperBound=new le,e.lowerBound&&this.lowerBound.copy(e.lowerBound),e.upperBound&&this.upperBound.copy(e.upperBound)}setFromPoints(e,t,i,r){const s=this.lowerBound,o=this.upperBound,a=i;s.copy(e[0]),a&&a.vmult(s,s),o.copy(s);for(let l=1;lDate.now()-n}var Hf=Je(517);class Br extends se{constructor(e){super(),this._value=e}get value(){return this.getValue()}_subscribe(e){const t=super._subscribe(e);return t&&!t.closed&&e.next(this._value),t}getValue(){if(this.hasError)throw this.thrownError;if(this.closed)throw new $;return this._value}next(e){super.next(this._value=e)}}function fm(n,e,t){e||(e=new qn(qn.IDENTITY));const i=new qn(qn.IDENTITY);if(!n)return!0;if(n.matrix)i.copy(n.matrix);else{if(i.identity(),n.translation&&i.translate(n.translation),n.rotation){const s=new qn(qn.IDENTITY).fromQuaternion(n.rotation);i.multiplyRight(s)}n.scale&&i.scale(n.scale)}const r=new qn(e).multiplyRight(i);if(!1===t(n,r,e))return!1;for(const s of n.nodes||n.children||[])if(!1===fm(s,r,t))return!1;return!0}function i6(){Pz([M5,cm])}function r6(n,e){var t;const i=null===(t=e.nodes)||void 0===t?void 0:t.find(r=>r.name===n);if(i){let r=!1;for(const s of e.scenes)r||fm(s,new qn(qn.IDENTITY),(o,a)=>o!==i||(o.matrix=a,o.translation=void 0,o.rotation=void 0,o.scale=void 0,r=!0,!1));return e.scene={id:n,name:n,nodes:[i]},e.scenes=[e.scene],{scene:e.scene,scenes:e.scenes}}return e}function oN(n,e){return Li(this,void 0,void 0,function*(){const t=n.scenegraph;let i;i=e?e[t]||(e[t]=fetch(t).then(s=>s.blob())):fetch(t);const r=yield YS(i,cm,{DracoLoader:OR,gltf:{decompressMeshes:!0,postProcess:!0}});return r.nodes||console.log("WARNING: Empty Scene",t,r),r6(n.scenegraphNode,r)})}function Wve(n,e){return Li(this,void 0,void 0,function*(){return r6(n,yield e)})}function aN(n,e,t){if(e&&0!==e.length){let i;switch(t.geometry){case"sphere":i=new $_e;break;case"cone":i=new K_e;break;case"cylinder":i=new X_e;break;case"cube":default:i=new nye}return new Ege(Object.assign({id:n,pickable:!0,autoHighlight:!1,highlightColor:[30,136,229,255],coordinateSystem:Ui.CARTESIAN,data:e,mesh:i,wireframe:!1,getTransformMatrix:r=>r.transformMatrix,getColor:r=>r.color||[255,255,255,229.5]},t))}}function s6(n,e,t){if(e&&0!==e.length)return new hge(Object.assign({id:n,pickable:!0,data:e.map(i=>Object.assign(Object.assign({},i),{position:new qn(i.transformMatrix).getTranslation()})),getText:i=>i.text,getPosition:i=>i.position,getColor:i=>i.color},t))}let Yve=(()=>{class n extends Vz{initializeState(){const{data:t}=this.props;this.setState({data:null!=t?t:[],zoomOpacity:.8,doCollisions:!1}),i6()}renderLayers(){var t,i;const r=this.state,s={sphere:[],cone:[],cylinder:[],cube:[],text:[],wireframe:[],scenegraph:[]};for(const l of r.data){const c=null!==(t=l.geometry)&&void 0!==t?t:"cube";l.scenegraph?s.scenegraph.push(l):void 0!==s[c]&&s[c].push(l)}const o={};for(const l of s.scenegraph)l.scenegraph&&l.scenegraphNode&&!Object.prototype.hasOwnProperty.call(o,l.scenegraph)&&(o[l.scenegraph]=oN({scenegraph:l.scenegraph},n.gltfCache));const a=[];for(const[l,c]of Object.entries(s))if("scenegraph"===l)for(const u of c)a.push(new G_e({id:"models-"+u["@id"],opacity:u.zoomBasedOpacity?r.zoomOpacity:void 0!==u.opacity?u.opacity:1,pickable:!u.unpickable,coordinateSystem:Ui.CARTESIAN,data:[u],scenegraph:u.scenegraphNode?Wve(u.scenegraphNode,o[u.scenegraph]):u.scenegraph,_lighting:u._lighting,getTransformMatrix:u.transformMatrix,getColor:null!==(i=u.color)&&void 0!==i?i:[0,255,0,127.5],parameters:{depthMask:!u.zoomBasedOpacity&&(void 0===u.opacity||1===u.opacity)}}));else"text"===l?(a.push(s6("text",c.filter(u=>u.unpickable),{pickable:!1})),a.push(s6("textPickable",c.filter(u=>!u.unpickable),{pickable:!0}))):"wireframe"===l?a.push(aN(l,c,{wireframe:!0,pickable:!1,geometry:l})):(a.push(aN(l,c.filter(u=>u.unpickable),{wireframe:!1,pickable:!1,geometry:l})),a.push(aN(`${l}Pickable`,c.filter(u=>!u.unpickable),{wireframe:!1,pickable:!0,geometry:l})));return r.doCollisions&&function(n){Li(this,void 0,void 0,function*(){console.log("Starting Collisioning");const e=n.filter(o=>!o.scenegraph&&"wireframe"!==o.geometry).map(o=>{const a=new qn(o.transformMatrix),l=a.transformAsPoint([-1,-1,-1],[]),c=a.transformAsPoint([1,1,1],[]);return{"@id":o["@id"],name:o.tooltip,entityId:o.entityId,bbox:new gr({lowerBound:new le(...l.map((u,h)=>Math.min(u,c[h]))),upperBound:new le(...c.map((u,h)=>Math.max(u,l[h])))})}}),t=[];for(const o of n.filter(a=>!!a.scenegraph)){const a=yield W0(o.scenegraph,cm,{DracoLoader:OR,decompress:!0,postProcess:!0});for(const l of a.scenes)fm(l,new qn(o.transformMatrix),(c,u)=>{if(c.mesh&&c.mesh.primitives&&c.mesh.primitives.length>0)for(const h of c.mesh.primitives)if(h.attributes.POSITION&&h.attributes.POSITION.min){const p=u.transformAsPoint(h.attributes.POSITION.min,[]),g=u.transformAsPoint(h.attributes.POSITION.max,[]);t.push({"@id":o["@id"],name:c.name,entityId:o.entityId,bbox:new gr({lowerBound:new le(...p.map((m,w)=>Math.min(m,g[w]))),upperBound:new le(...g.map((m,w)=>Math.max(m,p[w])))}),gltf:a})}return!0})}const i=[],r=[];for(const o of e){const a=[];for(const l of t)o.bbox.overlaps(l.bbox)&&a.push({"@id":l["@id"],name:l.name});a.length>0?i.push({"@id":o.entityId,name:o.name,hits:a}):r.push(o)}console.log({sourceBoxes:e,targetBoxes:t,report:i,sad:r,maxHits:Math.max(...i.map(o=>o.hits.length))});const s=[];for(const o of i){s.push({"Tissue ID":o["@id"],"Tissue Name":o.name,"Hit ID":"","Hit Name":""});for(const a of o.hits)s.push({"Tissue ID":o["@id"],"Tissue Name":o.name,"Hit ID":a["@id"],"Hit Name":a.name})}return console.log(s),i})}(r.data),a.filter(l=>!!l)}getPickingInfo(t){return t.info}}return n.layerName="BodyUILayer",n.gltfCache={},n})();function o6(n,e=[]){for(const t of n.nodes||n.children||[])e.push(t.name),o6(t,e);return e}let Xve=(()=>{class n{constructor(t){var i,r,s,o,a;this.deckProps=t,this.bodyUILayer=new Yve({}),this.nodeClickSubject=new se,this.nodeHoverStartSubject=new se,this.nodeHoverStopSubject=new se,this.sceneRotationSubject=new Br([0,0]),this.nodeDragStartSubject=new se,this.nodeDragSubject=new se,this.nodeDragEndSubject=new se,this.nodeClick$=this.nodeClickSubject.pipe(Es()),this.nodeHoverStart$=this.nodeHoverStartSubject.pipe(Es()),this.nodeHoverStop$=this.nodeHoverStopSubject.pipe(Es()),this.sceneRotation$=this.sceneRotationSubject.pipe(Es()),this.nodeDragStart$=this.nodeDragStartSubject.pipe(Es()),this.nodeDrag$=this.nodeDragSubject.pipe(Es()),this.nodeDragEnd$=this.nodeDragEndSubject.pipe(Es());const l=Object.assign(Object.assign({},t),{views:["orthographic"===t.camera?new Yde({flipY:!1,near:-1e3}):new Qde({orbitAxis:"Y"})],controller:void 0===t.interactive||t.interactive,layers:[this.bodyUILayer],onHover:this._onHover,onClick:this._onClick,onViewStateChange:this._onViewStateChange,onDragStart:this._onDragStart,onDrag:this._onDrag,onDragEnd:this._onDragEnd,getCursor:c=>{var u;return null!==(u=this.cursor)&&void 0!==u?u:c.isDragging?"grabbing":"grab"}});t.legacyLighting&&(l.effects=[new WO({ambientLight:new $z({color:[255,255,255],intensity:10})})]),this.deck=new sx(l),this.deck.setProps({viewState:{orbitAxis:"Y",minRotationX:null!==(i=t.minRotationX)&&void 0!==i?i:-15,maxRotationX:null!==(r=t.maxRotationX)&&void 0!==r?r:15,target:null!==(s=t.target)&&void 0!==s?s:[.5,.5,0],rotationX:0,rotationOrbit:null!==(o=t.rotation)&&void 0!==o?o:0,zoom:null!==(a=t.zoom)&&void 0!==a?a:9.5,camera:t.camera}}),t.rotation&&this.sceneRotationSubject.next([t.rotation,0])}initialize(){return Li(this,void 0,void 0,function*(){for(;!this.bodyUILayer.state;)yield new Promise(t=>{setTimeout(t,200)})})}finalize(){this.deck.finalize()}setScene(t){if((null==t?void 0:t.length)>0){let i=this.bodyUILayer.state.zoomOpacity,r=!1;for(const s of t)s.zoomToOnLoad&&(this.zoomTo(s),r=!0);i=r?.05:i,this.deckProps.debugSceneNodeProcessing?this.debugSceneNodeProcessing(t,i):this.bodyUILayer.setState({data:t,zoomOpacity:i})}}debugSceneNodeProcessing(t,i){const r="https://hubmapconsortium.github.io/ccf-3d-reference-object-library/VH_Female/United/VHF_United_Color.glb",s=new qn([.076,0,0,0,0,.076,16875389974302382e-33,0,0,-16875389974302382e-33,.076,0,.49,.034,.11,1]);(function(n,e,t){return Li(this,void 0,void 0,function*(){i6();const i=yield oN({scenegraph:n,scenegraphNode:"VHF_Kidney_L_Low1"}),r={},s=[];for(const o of i.scenes)fm(o,e=new qn(e||qn.IDENTITY),(a,l)=>{const c={"@id":a.name||a.id,"@type":"ProcessedNode",transformMatrix:new qn(l),geometry:"wireframe",node:a};if(s.push({"@id":`GLTF:${c["@id"]}`,"@type":"GLTFNode",scenegraph:n,scenegraphNode:c["@id"],transformMatrix:new qn(e||qn.IDENTITY),tooltip:a.name||a.id,color:[255,255,255,255],_lighting:"pbr",zoomBasedOpacity:!0,node:a}),a.mesh&&a.mesh.primitives&&a.mesh.primitives.length>0)for(const u of a.mesh.primitives)if(u.attributes.POSITION&&u.attributes.POSITION.min){const h=l.transformAsPoint(u.attributes.POSITION.min,[]),p=l.transformAsPoint(u.attributes.POSITION.max,[]);c.bbox=new gr({lowerBound:new le(...h.map((g,m)=>Math.min(g,p[m]))),upperBound:new le(...p.map((g,m)=>Math.max(g,h[m])))})}return r[c["@id"]]=c,!0});for(const o of Object.values(r).filter(a=>!a.bbox)){for(const a of o6(o.node).map(l=>r[l]).filter(l=>l.bbox))o.bbox?o.bbox.extend(a.bbox):o.bbox=a.bbox.clone();o.bbox||delete r[o["@id"]]}for(const o of Object.values(r)){const a=o.bbox.lowerBound,u=(o.size=o.bbox.upperBound.clone().vsub(a)).clone().vmul(new le(.5,.5,.5)),h=o.center=a.clone().vadd(u);o.transformMatrix=new qn(qn.IDENTITY).translate(h.toArray()).scale(u.toArray())}for(const o of s)r[o["@id"]]=o;return r})})(r,s).then(o=>{console.log("results",o),console.log("data",t),(t=t.concat(Object.values(o))).push({"@id":"TEST","@type":"TEST",scenegraph:r,scenegraphNode:"VHF_Kidney_R_Low",transformMatrix:s,color:[255,255,255,200],_lighting:"pbr",zoomBasedOpacity:!1}),this.bodyUILayer.setState({data:t,zoomOpacity:i})})}zoomTo(t){const i=new qn(t.transformMatrix);this.deck.setProps({viewState:Object.assign(Object.assign({},this.deck.props.viewState),{target:i.getTranslation(),rotationX:0,rotationOrbit:0,zoom:11.5})})}setRotation(t){this.deck.setProps({viewState:Object.assign(Object.assign({},this.deck.props.viewState),{rotationOrbit:t})})}setRotationX(t){this.deck.setProps({viewState:Object.assign(Object.assign({},this.deck.props.viewState),{rotationX:t})})}setZoom(t){this.deck.setProps({viewState:Object.assign(Object.assign({},this.deck.props.viewState),{zoom:t})})}setTarget(t){this.deck.setProps({viewState:Object.assign(Object.assign({},this.deck.props.viewState),{target:t})})}setInteractive(t){this.deck.setProps({controller:t})}_onHover(t){const{lastHovered:i}=this;this.cursor=t.picked?"pointer":void 0,t.picked&&t.object&&t.object["@id"]?i!==t.object&&(i&&this.nodeHoverStopSubject.next(i),this.lastHovered=t.object,this.nodeHoverStartSubject.next(t.object)):i&&(this.nodeHoverStopSubject.next(i),this.lastHovered=void 0)}_onClick(t,i){var r,s;t.picked&&t.object&&t.object["@id"]&&this.nodeClickSubject.next({node:t.object,ctrlClick:null!==(s=null===(r=null==i?void 0:i.srcEvent)||void 0===r?void 0:r.ctrlKey)&&void 0!==s?s:void 0})}_onViewStateChange(t){var i;if(null===(i=t.interactionState)||void 0===i?void 0:i.isZooming){const r=this.bodyUILayer.state,s=Math.min(Math.max(1-(t.viewState.zoom-8.9)/2,.05),1);r.zoomOpacity!==s&&this.bodyUILayer.setState({data:r.data,zoomOpacity:s})}this.deck.setProps({viewState:Object.assign({},t.viewState)}),this.sceneRotationSubject.next([t.viewState.rotationOrbit,t.viewState.rotationX])}_onDragStart(t,i){this._dragEvent(t,i,this.nodeDragStartSubject)}_onDrag(t,i){this._dragEvent(t,i,this.nodeDragSubject)}_onDragEnd(t,i){this._dragEvent(t,i,this.nodeDragEndSubject)}_dragEvent(t,i,r){var s;(null===(s=null==t?void 0:t.object)||void 0===s?void 0:s["@id"])&&r.next({node:t.object,info:t,e:i})}}return or([Hf.ZP],n.prototype,"_onHover",null),or([Hf.ZP],n.prototype,"_onClick",null),or([Hf.ZP],n.prototype,"_onViewStateChange",null),or([Hf.ZP],n.prototype,"_onDragStart",null),or([Hf.ZP],n.prototype,"_onDrag",null),or([Hf.ZP],n.prototype,"_onDragEnd",null),n})();function Qve(n,e){return n===e}function Zve(n,e,t){if(null===e||null===t||e.length!==t.length)return!1;const i=e.length;for(let r=0;r(i&&i.providers||[]).some(s=>s&&s.provide&&"MockNgModuleResolver"===s.provide.name||!1))});let lN=(()=>{class n{constructor(){this.bootstrap$=new kg(1)}get appBootstrapped$(){return this.bootstrap$.asObservable()}bootstrap(){this.bootstrap$.next(!0),this.bootstrap$.complete()}}return n.\u0275fac=function(t){return new(t||n)},n.\u0275prov=We({token:n,factory:n.\u0275fac}),n})();const cN=new Ht("INITIAL_STATE_TOKEN");let twe=(()=>{class n{static set(t){this.value=t}static pop(){const t=this.value;return this.value={},t}}return n.value={},n})();const a6=new Ht("Internals.StateContextFactory"),l6=new Ht("Internals.StateFactory");function hb(...n){if(1===n.length){const e=n[0];if(P(e))return Tx(e,null);if(Q(e)&&Object.getPrototypeOf(e)===Object.prototype){const t=Object.keys(e);return Tx(t.map(i=>e[i]),t)}}if("function"==typeof n[n.length-1]){const e=n.pop();return Tx(n=1===n.length&&P(n[0])?n[0]:n,null).pipe(me(t=>e(...t)))}return Tx(n,null)}function Tx(n,e){return new I(t=>{const i=n.length;if(0===i)return void t.complete();const r=new Array(i);let s=0,o=0;for(let a=0;a{c||(c=!0,o++),r[a]=u},error:u=>t.error(u),complete:()=>{s++,(s===i||!c)&&(o===i&&t.next(e?e.reduce((u,h,p)=>(u[h]=r[p],u),{}):r),t.complete())}}))}})}function Ji(n,e){return function(i){return i.lift(new nwe(n,e))}}class nwe{constructor(e,t){this.predicate=e,this.thisArg=t}call(e,t){return t.subscribe(new iwe(e,this.predicate,this.thisArg))}}class iwe extends y{constructor(e,t,i){super(e),this.predicate=t,this.thisArg=i,this.count=0}_next(e){let t;try{t=this.predicate.call(this.thisArg,e,this.count++)}catch(i){return void this.destination.error(i)}t&&this.destination.next(e)}}function $a(n,e,t){let i;return i=n&&"object"==typeof n?n:{bufferSize:n,windowTime:e,refCount:!1,scheduler:t},r=>r.lift(function({bufferSize:n=Number.POSITIVE_INFINITY,windowTime:e=Number.POSITIVE_INFINITY,refCount:t,scheduler:i}){let r,o,s=0,a=!1,l=!1;return function(u){let h;s++,!r||a?(a=!1,r=new kg(n,e,i),h=r.subscribe(this),o=u.subscribe({next(p){r.next(p)},error(p){a=!0,r.error(p)},complete(){l=!0,o=void 0,r.complete()}}),l&&(o=void 0)):h=r.subscribe(this),this.add(()=>{s--,h.unsubscribe(),h=void 0,o&&!l&&t&&0===s&&(o.unsubscribe(),o=void 0,r=void 0)})}}(i))}const c6=(()=>{function n(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return n.prototype=Object.create(Error.prototype),n})();function Yi(n){return e=>0===n?uS():e.lift(new swe(n))}class swe{constructor(e){if(this.total=e,this.total<0)throw new c6}call(e,t){return t.subscribe(new owe(e,this.total))}}class owe extends y{constructor(e,t){super(e),this.total=t,this.count=0}_next(e){const t=this.total,i=++this.count;i<=t&&(this.destination.next(e),i===t&&(this.destination.complete(),this.unsubscribe()))}}function u6(n,e){return e?t=>t.pipe(u6((i,r)=>je(n(i,r)).pipe(me((s,o)=>e(i,s,r,o))))):t=>t.lift(new awe(n))}class awe{constructor(e){this.project=e}call(e,t){return t.subscribe(new lwe(e,this.project))}}class lwe extends ve{constructor(e,t){super(e),this.project=t,this.hasSubscription=!1,this.hasCompleted=!1,this.index=0}_next(e){this.hasSubscription||this.tryNext(e)}tryNext(e){let t;const i=this.index++;try{t=this.project(e,i)}catch(r){return void this.destination.error(r)}this.hasSubscription=!0,this._innerSub(t)}_innerSub(e){const t=new _t(this),i=this.destination;i.add(t);const r=N(e,t);r!==t&&i.add(r)}_complete(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete(),this.unsubscribe()}notifyNext(e){this.destination.next(e)}notifyError(e){this.destination.error(e)}notifyComplete(){this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()}}function Mx(n=null){return e=>e.lift(new cwe(n))}class cwe{constructor(e){this.defaultValue=e}call(e,t){return t.subscribe(new uwe(e,this.defaultValue))}}class uwe extends y{constructor(e,t){super(e),this.defaultValue=t,this.isEmpty=!0}_next(e){this.isEmpty=!1,this.destination.next(e)}_complete(){this.isEmpty&&this.destination.next(this.defaultValue),this.destination.complete()}}function bc(n){return function(t){const i=new dwe(n),r=t.lift(i);return i.caught=r}}class dwe{constructor(e){this.selector=e}call(e,t){return t.subscribe(new hwe(e,this.selector,this.caught))}}class hwe extends ve{constructor(e,t,i){super(e),this.selector=t,this.caught=i}error(e){if(!this.isStopped){let t;try{t=this.selector(e,this.caught)}catch(s){return void super.error(s)}this._unsubscribeAndRecycle();const i=new _t(this);this.add(i);const r=N(t,i);r!==i&&this.add(r)}}}function mr(n){return e=>e.lift(new fwe(n))}class fwe{constructor(e){this.notifier=e}call(e,t){const i=new pwe(e),r=N(this.notifier,new _t(i));return r&&!i.seenValue?(i.add(r),t.subscribe(i)):i}}class pwe extends ve{constructor(e){super(e),this.seenValue=!1}notifyNext(){this.seenValue=!0,this.complete()}notifyComplete(){}}function _h(){}function Yr(n,e,t){return function(r){return r.lift(new gwe(n,e,t))}}class gwe{constructor(e,t,i){this.nextOrObserver=e,this.error=t,this.complete=i}call(e,t){return t.subscribe(new mwe(e,this.nextOrObserver,this.error,this.complete))}}class mwe extends y{constructor(e,t,i,r){super(e),this._tapNext=_h,this._tapError=_h,this._tapComplete=_h,this._tapError=i||_h,this._tapComplete=r||_h,Y(t)?(this._context=this,this._tapNext=t):t&&(this._context=t,this._tapNext=t.next||_h,this._tapError=t.error||_h,this._tapComplete=t.complete||_h)}_next(e){try{this._tapNext.call(this._context,e)}catch(t){return void this.destination.error(t)}this.destination.next(e)}_error(e){try{this._tapError.call(this._context,e)}catch(t){return void this.destination.error(t)}this.destination.error(e)}_complete(){try{this._tapComplete.call(this._context)}catch(e){return void this.destination.error(e)}return this.destination.complete()}}function rd(n,e){return t=>t.lift(new _we(n,e))}class _we{constructor(e,t){this.compare=e,this.keySelector=t}call(e,t){return t.subscribe(new ywe(e,this.compare,this.keySelector))}}class ywe extends y{constructor(e,t,i){super(e),this.keySelector=i,this.hasKey=!1,"function"==typeof t&&(this.compare=t)}compare(e,t){return e===t}_next(e){let t;try{const{keySelector:r}=this;t=r?r(e):e}catch(r){return this.destination.error(r)}let i=!1;if(this.hasKey)try{const{compare:r}=this;i=r(this.key,t)}catch(r){return this.destination.error(r)}else this.hasKey=!0;i||(this.key=t,this.destination.next(e))}}const Wa={STATE_NAME:n=>`${n} is not a valid state name. It needs to be a valid object property name.`,STATE_NAME_PROPERTY:()=>"States must register a 'name' property",STATE_UNIQUE:(n,e,t)=>`State name '${n}' from ${e} already exists in ${t}`,STATE_DECORATOR:()=>"States must be decorated with @State() decorator",INCORRECT_PRODUCTION:()=>"Angular is running in production mode but NGXS is still running in the development mode!\nPlease set developmentMode to false on the NgxsModule options when in production mode.\nNgxsModule.forRoot(states, { developmentMode: !environment.production })",INCORRECT_DEVELOPMENT:()=>"RECOMMENDATION: Set developmentMode to true on the NgxsModule when Angular is running in development mode.\nNgxsModule.forRoot(states, { developmentMode: !environment.production })",SELECT_FACTORY_NOT_CONNECTED:()=>"You have forgotten to import the NGXS module!",ACTION_DECORATOR:()=>"@Action() decorator cannot be used with static methods",SELECTOR_DECORATOR:()=>"Selectors only work on methods",ZONE_WARNING:()=>"Your application was bootstrapped with nooped zone and your execution strategy requires an actual NgZone!\nPlease set the value of the executionStrategy property to NoopNgxsExecutionStrategy.\nNgxsModule.forRoot(states, { executionStrategy: NoopNgxsExecutionStrategy })",PATCHING_ARRAY:()=>"Patching arrays is not supported.",PATCHING_PRIMITIVE:()=>"Patching primitives is not supported.",UNDECORATED_STATE_IN_IVY:n=>`'${n}' class should be decorated with @Injectable() right after the @State() decorator`};let d6=(()=>{class n{constructor(t,i){this._ngZone=t,this._platformId=i,this.verifyZoneIsNotNooped(this._ngZone)}enter(t){return function(n){return"server"===n}(this._platformId)?this.runInsideAngular(t):this.runOutsideAngular(t)}leave(t){return this.runInsideAngular(t)}runInsideAngular(t){return fn.isInAngularZone()?t():this._ngZone.run(t)}runOutsideAngular(t){return fn.isInAngularZone()?this._ngZone.runOutsideAngular(t):t()}verifyZoneIsNotNooped(t){t instanceof fn||console.warn(Wa.ZONE_WARNING())}}return n.\u0275fac=function(t){return new(t||n)(Oe(fn),Oe(Wc))},n.\u0275prov=We({token:n,factory:n.\u0275fac}),n})();const h6=new Ht("ROOT_STATE_TOKEN"),f6=new Ht("FEATURE_STATE_TOKEN"),p6=new Ht("NGXS_PLUGINS"),g6=new Ht("NG_TEST_MODE"),m6=new Ht("NG_DEV_MODE"),sd="NGXS_META",_6="NGXS_OPTIONS_META",uN="NGXS_SELECTOR_META";let Gf=(()=>{class n{constructor(){this.defaultsState={},this.selectorOptions={injectContainerState:!0,suppressErrors:!0},this.compatibility={strictContentSecurityPolicy:!1},this.executionStrategy=d6}}return n.\u0275fac=function(t){return new(t||n)},n.\u0275prov=We({token:n,factory:n.\u0275fac}),n})();class bwe{constructor(e,t,i){this.previousValue=e,this.currentValue=t,this.firstChange=i}}const y6=new Ht("NGXS_EXECUTION_STRATEGY");function $f(n){return n.constructor&&n.constructor.type?n.constructor.type:n.type}const b6=(n,e,t)=>{n=Object.assign({},n);const i=e.split("."),r=i.length-1;return i.reduce((s,o,a)=>(s[o]=a===r?t:Array.isArray(s[o])?s[o].slice():Object.assign({},s[o]),s&&s[o]),n),n},Dx=(n,e)=>e.split(".").reduce((t,i)=>t&&t[i],n),dN=n=>n&&"object"==typeof n&&!Array.isArray(n),hN=(n,...e)=>{if(!e.length)return n;const t=e.shift();if(dN(n)&&dN(t))for(const i in t)dN(t[i])?(n[i]||Object.assign(n,{[i]:{}}),hN(n[i],t[i])):Object.assign(n,{[i]:t[i]});return hN(n,...e)};function fN(n){if(!n.hasOwnProperty(sd)){const e={name:null,actions:{},defaults:{},path:null,makeRootSelector:t=>t.getStateGetter(e.name),children:[]};Object.defineProperty(n,sd,{value:e})}return fb(n)}function fb(n){return n[sd]}function gN(n){return n[uN]}function v6(n,e){return e&&e.compatibility&&e.compatibility.strictContentSecurityPolicy?function(n){const e=n.slice();return t=>e.reduce((i,r)=>i&&i[r],t)}(n):function(n){const e=n;let t="store."+e[0],i=0;const r=e.length;let s=t;for(;++i0?super.requestAsyncId(e,t,i):(e.actions.push(this),e.scheduled||(e.scheduled=T$.setImmediate(e.flush.bind(e,null))))}recycleAsyncId(e,t,i=0){if(null!==i&&i>0||null===i&&this.delay>0)return super.recycleAsyncId(e,t,i);0===e.actions.length&&(T$.clearImmediate(t),e.scheduled=void 0)}});function Tm(n){return!!n&&(n instanceof I||"function"==typeof n.lift&&"function"==typeof n.subscribe)}class qCe{constructor(e){this.durationSelector=e}call(e,t){return t.subscribe(new YCe(e,this.durationSelector))}}class YCe extends ve{constructor(e,t){super(e),this.durationSelector=t,this.hasValue=!1}_next(e){if(this.value=e,this.hasValue=!0,!this.throttled){let t;try{const{durationSelector:r}=this;t=r(e)}catch(r){return this.destination.error(r)}const i=N(t,new _t(this));!i||i.closed?this.clearThrottle():this.add(this.throttled=i)}}clearThrottle(){const{value:e,hasValue:t,throttled:i}=this;i&&(this.remove(i),this.throttled=void 0,i.unsubscribe()),t&&(this.value=void 0,this.hasValue=!1,this.destination.next(e))}notifyNext(){this.clearThrottle()}notifyComplete(){this.clearThrottle()}}function M$(n){return!P(n)&&n-parseFloat(n)+1>=0}function XCe(n){const{index:e,period:t,subscriber:i}=n;if(i.next(e),!i.closed){if(-1===t)return i.complete();n.index=e+1,this.schedule(n,t)}}function TC(n,e=Qx){return function(n){return function(t){return t.lift(new qCe(n))}}(()=>function(n=0,e,t){let i=-1;return M$(e)?i=Number(e)<1?1:Number(e):Ce(e)&&(t=e),Ce(t)||(t=Qx),new I(r=>{const s=M$(n)?n:+n-t.now();return t.schedule(XCe,s,{index:0,period:i,subscriber:r})})}(n,e))}let I$=(()=>{class n{constructor(){this._listeners=[]}notify(t,i){for(let r of this._listeners)r(t,i)}listen(t){return this._listeners.push(t),()=>{this._listeners=this._listeners.filter(i=>t!==i)}}ngOnDestroy(){this._listeners=[]}}return n.\u0275fac=function(t){return new(t||n)},n.\u0275prov=We({factory:function(){return new n},token:n,providedIn:"root"}),n})(),Mm=(()=>{class n{constructor(t,i,r){this._ngZone=t,this._platform=i,this._scrolled=new se,this._globalSubscription=null,this._scrolledCount=0,this.scrollContainers=new Map,this._document=r}register(t){this.scrollContainers.has(t)||this.scrollContainers.set(t,t.elementScrolled().subscribe(()=>this._scrolled.next(t)))}deregister(t){const i=this.scrollContainers.get(t);i&&(i.unsubscribe(),this.scrollContainers.delete(t))}scrolled(t=20){return this._platform.isBrowser?new I(i=>{this._globalSubscription||this._addGlobalListener();const r=t>0?this._scrolled.pipe(TC(t)).subscribe(i):this._scrolled.subscribe(i);return this._scrolledCount++,()=>{r.unsubscribe(),this._scrolledCount--,this._scrolledCount||this._removeGlobalListener()}}):dn()}ngOnDestroy(){this._removeGlobalListener(),this.scrollContainers.forEach((t,i)=>this.deregister(i)),this._scrolled.complete()}ancestorScrolled(t,i){const r=this.getAncestorScrollContainers(t);return this.scrolled(i).pipe(Ji(s=>!s||r.indexOf(s)>-1))}getAncestorScrollContainers(t){const i=[];return this.scrollContainers.forEach((r,s)=>{this._scrollableContainsElement(s,t)&&i.push(s)}),i}_getWindow(){return this._document.defaultView||window}_scrollableContainsElement(t,i){let r=ad(i),s=t.getElementRef().nativeElement;do{if(r==s)return!0}while(r=r.parentElement);return!1}_addGlobalListener(){this._globalSubscription=this._ngZone.runOutsideAngular(()=>hd(this._getWindow().document,"scroll").subscribe(()=>this._scrolled.next()))}_removeGlobalListener(){this._globalSubscription&&(this._globalSubscription.unsubscribe(),this._globalSubscription=null)}}return n.\u0275fac=function(t){return new(t||n)(Oe(fn),Oe(er),Oe(hn,8))},n.\u0275prov=We({factory:function(){return new n(Oe(fn),Oe(er),Oe(hn,8))},token:n,providedIn:"root"}),n})(),Dm=(()=>{class n{constructor(t,i,r){this._platform=t,this._change=new se,this._changeListener=s=>{this._change.next(s)},this._document=r,i.runOutsideAngular(()=>{if(t.isBrowser){const s=this._getWindow();s.addEventListener("resize",this._changeListener),s.addEventListener("orientationchange",this._changeListener)}this.change().subscribe(()=>this._viewportSize=null)})}ngOnDestroy(){if(this._platform.isBrowser){const t=this._getWindow();t.removeEventListener("resize",this._changeListener),t.removeEventListener("orientationchange",this._changeListener)}this._change.complete()}getViewportSize(){this._viewportSize||this._updateViewportSize();const t={width:this._viewportSize.width,height:this._viewportSize.height};return this._platform.isBrowser||(this._viewportSize=null),t}getViewportRect(){const t=this.getViewportScrollPosition(),{width:i,height:r}=this.getViewportSize();return{top:t.top,left:t.left,bottom:t.top+r,right:t.left+i,height:r,width:i}}getViewportScrollPosition(){if(!this._platform.isBrowser)return{top:0,left:0};const t=this._document,i=this._getWindow(),r=t.documentElement,s=r.getBoundingClientRect();return{top:-s.top||t.body.scrollTop||i.scrollY||r.scrollTop||0,left:-s.left||t.body.scrollLeft||i.scrollX||r.scrollLeft||0}}change(t=20){return t>0?this._change.pipe(TC(t)):this._change}_getWindow(){return this._document.defaultView||window}_updateViewportSize(){const t=this._getWindow();this._viewportSize=this._platform.isBrowser?{width:t.innerWidth,height:t.innerHeight}:{width:0,height:0}}}return n.\u0275fac=function(t){return new(t||n)(Oe(er),Oe(fn),Oe(hn,8))},n.\u0275prov=We({factory:function(){return new n(Oe(er),Oe(fn),Oe(hn,8))},token:n,providedIn:"root"}),n})();class OP{attach(e){return this._attachedHost=e,e.attach(this)}detach(){let e=this._attachedHost;null!=e&&(this._attachedHost=null,e.detach())}get isAttached(){return null!=this._attachedHost}setAttachedHost(e){this._attachedHost=e}}class DC extends OP{constructor(e,t,i,r){super(),this.component=e,this.viewContainerRef=t,this.injector=i,this.componentFactoryResolver=r}}class Im extends OP{constructor(e,t,i){super(),this.templateRef=e,this.viewContainerRef=t,this.context=i}get origin(){return this.templateRef.elementRef}attach(e,t=this.context){return this.context=t,super.attach(e)}detach(){return this.context=void 0,super.detach()}}class f1e extends OP{constructor(e){super(),this.element=e instanceof vn?e.nativeElement:e}}class IC{constructor(){this._isDisposed=!1,this.attachDomPortal=null}hasAttached(){return!!this._attachedPortal}attach(e){return e instanceof DC?(this._attachedPortal=e,this.attachComponentPortal(e)):e instanceof Im?(this._attachedPortal=e,this.attachTemplatePortal(e)):this.attachDomPortal&&e instanceof f1e?(this._attachedPortal=e,this.attachDomPortal(e)):void 0}detach(){this._attachedPortal&&(this._attachedPortal.setAttachedHost(null),this._attachedPortal=null),this._invokeDisposeFn()}dispose(){this.hasAttached()&&this.detach(),this._invokeDisposeFn(),this._isDisposed=!0}setDisposeFn(e){this._disposeFn=e}_invokeDisposeFn(){this._disposeFn&&(this._disposeFn(),this._disposeFn=null)}}class p1e extends IC{constructor(e,t,i,r,s){super(),this.outletElement=e,this._componentFactoryResolver=t,this._appRef=i,this._defaultInjector=r,this.attachDomPortal=o=>{const a=o.element,l=this._document.createComment("dom-portal");a.parentNode.insertBefore(l,a),this.outletElement.appendChild(a),this._attachedPortal=o,super.setDisposeFn(()=>{l.parentNode&&l.parentNode.replaceChild(a,l)})},this._document=s}attachComponentPortal(e){const i=(e.componentFactoryResolver||this._componentFactoryResolver).resolveComponentFactory(e.component);let r;return e.viewContainerRef?(r=e.viewContainerRef.createComponent(i,e.viewContainerRef.length,e.injector||e.viewContainerRef.injector),this.setDisposeFn(()=>r.destroy())):(r=i.create(e.injector||this._defaultInjector),this._appRef.attachView(r.hostView),this.setDisposeFn(()=>{this._appRef.detachView(r.hostView),r.destroy()})),this.outletElement.appendChild(this._getComponentRootNode(r)),this._attachedPortal=e,r}attachTemplatePortal(e){let t=e.viewContainerRef,i=t.createEmbeddedView(e.templateRef,e.context);return i.rootNodes.forEach(r=>this.outletElement.appendChild(r)),i.detectChanges(),this.setDisposeFn(()=>{let r=t.indexOf(i);-1!==r&&t.remove(r)}),this._attachedPortal=e,i}dispose(){super.dispose(),null!=this.outletElement.parentNode&&this.outletElement.parentNode.removeChild(this.outletElement)}_getComponentRootNode(e){return e.hostView.rootNodes[0]}}let tp=(()=>{class n extends IC{constructor(t,i,r){super(),this._componentFactoryResolver=t,this._viewContainerRef=i,this._isInitialized=!1,this.attached=new sn,this.attachDomPortal=s=>{const o=s.element,a=this._document.createComment("dom-portal");s.setAttachedHost(this),o.parentNode.insertBefore(a,o),this._getRootNode().appendChild(o),this._attachedPortal=s,super.setDisposeFn(()=>{a.parentNode&&a.parentNode.replaceChild(o,a)})},this._document=r}get portal(){return this._attachedPortal}set portal(t){this.hasAttached()&&!t&&!this._isInitialized||(this.hasAttached()&&super.detach(),t&&super.attach(t),this._attachedPortal=t)}get attachedRef(){return this._attachedRef}ngOnInit(){this._isInitialized=!0}ngOnDestroy(){super.dispose(),this._attachedPortal=null,this._attachedRef=null}attachComponentPortal(t){t.setAttachedHost(this);const i=null!=t.viewContainerRef?t.viewContainerRef:this._viewContainerRef,s=(t.componentFactoryResolver||this._componentFactoryResolver).resolveComponentFactory(t.component),o=i.createComponent(s,i.length,t.injector||i.injector);return i!==this._viewContainerRef&&this._getRootNode().appendChild(o.hostView.rootNodes[0]),super.setDisposeFn(()=>o.destroy()),this._attachedPortal=t,this._attachedRef=o,this.attached.emit(o),o}attachTemplatePortal(t){t.setAttachedHost(this);const i=this._viewContainerRef.createEmbeddedView(t.templateRef,t.context);return super.setDisposeFn(()=>this._viewContainerRef.clear()),this._attachedPortal=t,this._attachedRef=i,this.attached.emit(i),i}_getRootNode(){const t=this._viewContainerRef.element.nativeElement;return t.nodeType===t.ELEMENT_NODE?t:t.parentNode}}return n.\u0275fac=function(t){return new(t||n)(xe(wl),xe(Ns),xe(hn))},n.\u0275dir=Rt({type:n,selectors:[["","cdkPortalOutlet",""]],inputs:{portal:["cdkPortalOutlet","portal"]},outputs:{attached:"attached"},exportAs:["cdkPortalOutlet"],features:[xn]}),n})();const L$=BH();class y1e{constructor(e,t){this._viewportRuler=e,this._previousHTMLStyles={top:"",left:""},this._isEnabled=!1,this._document=t}attach(){}enable(){if(this._canBeEnabled()){const e=this._document.documentElement;this._previousScrollPosition=this._viewportRuler.getViewportScrollPosition(),this._previousHTMLStyles.left=e.style.left||"",this._previousHTMLStyles.top=e.style.top||"",e.style.left=vs(-this._previousScrollPosition.left),e.style.top=vs(-this._previousScrollPosition.top),e.classList.add("cdk-global-scrollblock"),this._isEnabled=!0}}disable(){if(this._isEnabled){const e=this._document.documentElement,i=e.style,r=this._document.body.style,s=i.scrollBehavior||"",o=r.scrollBehavior||"";this._isEnabled=!1,i.left=this._previousHTMLStyles.left,i.top=this._previousHTMLStyles.top,e.classList.remove("cdk-global-scrollblock"),L$&&(i.scrollBehavior=r.scrollBehavior="auto"),window.scroll(this._previousScrollPosition.left,this._previousScrollPosition.top),L$&&(i.scrollBehavior=s,r.scrollBehavior=o)}}_canBeEnabled(){if(this._document.documentElement.classList.contains("cdk-global-scrollblock")||this._isEnabled)return!1;const t=this._document.body,i=this._viewportRuler.getViewportSize();return t.scrollHeight>i.height||t.scrollWidth>i.width}}class b1e{constructor(e,t,i,r){this._scrollDispatcher=e,this._ngZone=t,this._viewportRuler=i,this._config=r,this._scrollSubscription=null,this._detach=()=>{this.disable(),this._overlayRef.hasAttached()&&this._ngZone.run(()=>this._overlayRef.detach())}}attach(e){this._overlayRef=e}enable(){if(this._scrollSubscription)return;const e=this._scrollDispatcher.scrolled(0);this._config&&this._config.threshold&&this._config.threshold>1?(this._initialScrollPosition=this._viewportRuler.getViewportScrollPosition().top,this._scrollSubscription=e.subscribe(()=>{const t=this._viewportRuler.getViewportScrollPosition().top;Math.abs(t-this._initialScrollPosition)>this._config.threshold?this._detach():this._overlayRef.updatePosition()})):this._scrollSubscription=e.subscribe(this._detach)}disable(){this._scrollSubscription&&(this._scrollSubscription.unsubscribe(),this._scrollSubscription=null)}detach(){this.disable(),this._overlayRef=null}}class B${enable(){}disable(){}attach(){}}function RP(n,e){return e.some(t=>n.bottom