celldega 0.15.0-alpha.5 → 0.15.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "celldega",
3
- "version": "0.15.0-alpha.5",
3
+ "version": "0.15.0-alpha.6",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=16",
@@ -1759,7 +1759,7 @@ DECKGL_FILTER_COLOR(fragColor, geometry);
1759
1759
  if(bool(picking.isActive)){
1760
1760
  widthPixels.xy += pickingLineWidthExtraPixels;
1761
1761
  }
1762
- `),{...A,inject:{...A.inject||{},"vs:#decl":(A.inject?.["vs:#decl"]||"").concat("uniform float pickingLineWidthExtraPixels;")}}}draw(A){super.draw({...A,uniforms:{...A.uniforms,pickingLineWidthExtraPixels:this.props.pickingLineWidthExtraPixels}})}};ec.defaultProps=$DA;ec.layerName="EditablePathLayer";var ArA=[0,0,0,153],grA=[0,0,0,144],IrA=[0,0,0,255],BrA=[0,0,144,144],QrA=[144,144,144,255],CrA=[144,144,144,144],ErA=[192,0,0,255],irA=[0,0,0,128],orA=[124,0,192,255],trA=[255,255,255,255],erA=5,arA=3,srA=7,DrA=32*DN,H1=zE;function pt(g){return!g||typeof g!="function"?g:A=>g(rrA(A))}function rrA(g){return g.__source?g.__source.object:g.sourceFeature?g.sourceFeature.feature:g}function L1(g){switch(g.properties.editHandleType){case"existing":return ErA;case"snap-source":return orA;case"intermediate":default:return irA}}function nrA(g){return trA}function crA(g){switch(g.properties.editHandleType){case"existing":return erA;case"snap":return srA;case"intermediate":default:return arA}}var GrA={mode:H1,onEdit:()=>{},pickable:!0,pickingRadius:10,pickingDepth:5,fp64:!1,filled:!0,stroked:!0,lineWidthScale:DN,lineWidthMinPixels:1,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,pickingLineWidthExtraPixels:0,lineWidthUnits:"pixels",lineJointRounded:!1,lineCapRounded:!1,lineMiterLimit:4,pointRadiusScale:1,pointRadiusMinPixels:2,pointRadiusMaxPixels:Number.MAX_SAFE_INTEGER,getLineColor:(g,A,I)=>A?IrA:ArA,getFillColor:(g,A,I)=>A?BrA:grA,getRadius:g=>g&&g.properties&&g.properties.radius||g&&g.properties&&g.properties.size||1,getLineWidth:g=>g&&g.properties&&g.properties.lineWidth||3,getTentativeLineColor:g=>QrA,getTentativeFillColor:g=>CrA,getTentativeLineWidth:g=>g&&g.properties&&g.properties.lineWidth||3,editHandleType:"point",editHandlePointRadiusScale:1,editHandlePointOutline:!0,editHandlePointStrokeWidth:2,editHandlePointRadiusUnits:"pixels",editHandlePointRadiusMinPixels:4,editHandlePointRadiusMaxPixels:8,getEditHandlePointColor:L1,getEditHandlePointOutlineColor:nrA,getEditHandlePointRadius:crA,editHandleIconAtlas:null,editHandleIconMapping:null,editHandleIconSizeScale:1,editHandleIconSizeUnits:"pixels",getEditHandleIcon:g=>g.properties.editHandleType,getEditHandleIconSize:10,getEditHandleIconColor:L1,getEditHandleIconAngle:0,billboard:!0},wrA={view:bQ,modify:po,translate:new oc(new Rt),transform:new oc(new sN),scale:Pe,rotate:Oe,duplicate:T0,split:v0,extrude:j0,elevation:X0,drawPoint:z0,drawLineString:_0,drawPolygon:zE,drawRectangle:SD,drawSquare:AN,drawRectangleFromCenter:gN,drawSquareFromCenter:IN,drawCircleFromCenter:QN,drawCircleByBoundingBox:CN,drawEllipseByBoundingBox:EN,drawRectangleUsing3Points:iN,drawEllipseUsing3Points:oN,draw90DegreePolygon:tN,drawPolygonByDragging:eN},Yt=class extends tc{constructor(){super(...arguments);U(this,"state")}renderLayers(){let I=this.getSubLayerProps({id:"geojson",data:this.props.data,fp64:this.props.fp64,filled:this.props.filled,stroked:this.props.stroked,lineWidthScale:this.props.lineWidthScale,lineWidthMinPixels:this.props.lineWidthMinPixels,lineWidthMaxPixels:this.props.lineWidthMaxPixels,lineWidthUnits:this.props.lineWidthUnits,lineJointRounded:this.props.lineJointRounded,lineCapRounded:this.props.lineCapRounded,lineMiterLimit:this.props.lineMiterLimit,pointRadiusScale:this.props.pointRadiusScale,pointRadiusMinPixels:this.props.pointRadiusMinPixels,pointRadiusMaxPixels:this.props.pointRadiusMaxPixels,getLineColor:this.selectionAwareAccessor(this.props.getLineColor),getFillColor:this.selectionAwareAccessor(this.props.getFillColor),getPointRadius:this.selectionAwareAccessor(this.props.getRadius),getLineWidth:this.selectionAwareAccessor(this.props.getLineWidth),_subLayerProps:{linestrings:{billboard:this.props.billboard,updateTriggers:{all:[this.props.selectedFeatureIndexes,this.props.mode]}},"polygons-stroke":{billboard:this.props.billboard,pickingLineWidthExtraPixels:this.props.pickingLineWidthExtraPixels,type:ec,updateTriggers:{all:[this.props.selectedFeatureIndexes,this.props.mode]}}},updateTriggers:{getLineColor:[this.props.selectedFeatureIndexes,this.props.mode],getFillColor:[this.props.selectedFeatureIndexes,this.props.mode],getPointRadius:[this.props.selectedFeatureIndexes,this.props.mode],getLineWidth:[this.props.selectedFeatureIndexes,this.props.mode]}}),B=[new He(I)];return B=B.concat(this.createGuidesLayers(),this.createTooltipsLayers()),B}initializeState(){super.initializeState(),this.setState({selectedFeatures:[],editHandles:[]})}shouldUpdateState(I){return super.shouldUpdateState(I)||I.changeFlags.stateChanged}updateState({props:I,oldProps:B,changeFlags:Q,context:C}){if(super.updateState({oldProps:B,props:I,changeFlags:Q,context:C}),Q.propsOrDataChanged&&(Object.keys(B).length===0||I.mode!==B.mode)){let e;if(typeof I.mode=="function"){let a=I.mode;e=new a}else typeof I.mode=="string"?(e=wrA[I.mode],console.warn("Deprecated use of passing `mode` as a string. Pass the mode's class constructor instead.")):e=I.mode;e||(console.warn(`No mode configured for ${String(I.mode)}`),e=new H1),e!==this.state.mode&&this.setState({mode:e,cursor:null})}let E=[];if(Array.isArray(I.selectedFeatureIndexes)&&typeof I.data=="object"&&"features"in I.data){let o=I.data;E=I.selectedFeatureIndexes.map(e=>o.features[e])}this.setState({selectedFeatures:E})}getModeProps(I){return{modeConfig:I.modeConfig,data:I.data,selectedIndexes:I.selectedFeatureIndexes,lastPointerMoveEvent:this.state.lastPointerMoveEvent,cursor:this.state.cursor,onEdit:B=>{this.setNeedsUpdate(),I.onEdit(B)},onUpdateCursor:B=>{this.setState({cursor:B})}}}selectionAwareAccessor(I){return typeof I!="function"?I:B=>I(B,this.isFeatureSelected(B),this.props.mode)}isFeatureSelected(I){return!this.props.data||!this.props.selectedFeatureIndexes||!this.props.selectedFeatureIndexes.length?!1:this.state.selectedFeatures.includes(I)}getPickingInfo({info:I,sourceLayer:B}){return B.id.endsWith("guides")&&(I.isGuide=!0),I}_updateAutoHighlight(I){if(I?.sourceLayer)if(I.isGuide)for(let B of I.sourceLayer.getSubLayers())B.updateAutoHighlight(I);else I.sourceLayer.updateAutoHighlight(I)}createGuidesLayers(){let B=this.getActiveMode().getGuides(this.getModeProps(this.props));if(!B||!B.features.length)return[];let Q={linestrings:{billboard:this.props.billboard,autoHighlight:!1},"polygons-fill":{autoHighlight:!1},"polygons-stroke":{billboard:this.props.billboard}};return this.props.editHandleType==="icon"?Q["points-icon"]={type:Ta,iconAtlas:this.props.editHandleIconAtlas,iconMapping:this.props.editHandleIconMapping,sizeUnits:this.props.editHandleIconSizeUnits,sizeScale:this.props.editHandleIconSizeScale,getIcon:pt(this.props.getEditHandleIcon),getSize:pt(this.props.getEditHandleIconSize),getColor:pt(this.props.getEditHandleIconColor),getAngle:pt(this.props.getEditHandleIconAngle),billboard:this.props.billboard}:Q["points-circle"]={type:wQ,radiusScale:this.props.editHandlePointRadiusScale,stroked:this.props.editHandlePointOutline,getLineWidth:this.props.editHandlePointStrokeWidth,radiusUnits:this.props.editHandlePointRadiusUnits,radiusMinPixels:this.props.editHandlePointRadiusMinPixels,radiusMaxPixels:this.props.editHandlePointRadiusMaxPixels,getRadius:pt(this.props.getEditHandlePointRadius),getFillColor:pt(this.props.getEditHandlePointColor),getLineColor:pt(this.props.getEditHandlePointOutlineColor),billboard:this.props.billboard},[new He(this.getSubLayerProps({id:"guides",data:B,fp64:this.props.fp64,_subLayerProps:Q,lineWidthScale:this.props.lineWidthScale,lineWidthMinPixels:this.props.lineWidthMinPixels,lineWidthMaxPixels:this.props.lineWidthMaxPixels,lineWidthUnits:this.props.lineWidthUnits,lineJointRounded:this.props.lineJointRounded,lineCapRounded:this.props.lineCapRounded,lineMiterLimit:this.props.lineMiterLimit,getLineColor:pt(this.props.getTentativeLineColor),getLineWidth:pt(this.props.getTentativeLineWidth),getFillColor:pt(this.props.getTentativeFillColor),pointType:this.props.editHandleType==="icon"?"icon":"circle",iconAtlas:this.props.editHandleIconAtlas}))]}createTooltipsLayers(){let B=this.getActiveMode().getTooltips(this.getModeProps(this.props));return[new Le({getSize:DrA,...this.getSubLayerProps({id:"tooltips",data:B})})]}onLayerClick(I){this.getActiveMode().handleClick(I,this.getModeProps(this.props))}onLayerKeyUp(I){this.getActiveMode().handleKeyUp(I,this.getModeProps(this.props))}onStartDragging(I){this.getActiveMode().handleStartDragging(I,this.getModeProps(this.props))}onDragging(I){this.getActiveMode().handleDragging(I,this.getModeProps(this.props))}onStopDragging(I){this.getActiveMode().handleStopDragging(I,this.getModeProps(this.props))}onPointerMove(I){this.setState({lastPointerMoveEvent:I}),this.getActiveMode().handlePointerMove(I,this.getModeProps(this.props))}getCursor({isDragging:I}){if(this.state===null||this.state===void 0)return null;let{cursor:B}=this.state;return B||(B=I?"grabbing":"grab"),B}getActiveMode(){return this.state.mode}};U(Yt,"layerName","EditableGeoJsonLayer"),U(Yt,"defaultProps",GrA);var hrA=bQ,NrA=9;var $eg={mode:hrA,...Yt.defaultProps,data:[],selectedIndexes:[],filled:!1,stroked:!0,lineWidthScale:DN,lineWidthMinPixels:1,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,lineWidthUnits:"pixels",getHexagons:g=>g.hexIds,getEditedCluster:(g,A)=>A?{...A,hexIds:g}:{hexIds:g},resolution:NrA};var xM={NONE:null,RECTANGLE:"rectangle",POLYGON:"polygon"},tag={[xM.RECTANGLE]:SD,[xM.POLYGON]:zE},eag={[xM.RECTANGLE]:{dragToDraw:!0}},aag={selectionType:xM.RECTANGLE,layerIds:[],onSelect:()=>{}};function LD(g,A){return g==null||A==null?NaN:g<A?-1:g>A?1:g>=A?0:NaN}function cL(g,A){return g==null||A==null?NaN:A<g?-1:A>g?1:A>=g?0:NaN}function bM(g){let A,I,B;g.length!==2?(A=LD,I=(o,e)=>LD(g(o),e),B=(o,e)=>g(o)-e):(A=g===LD||g===cL?g:krA,I=g,B=g);function Q(o,e,a=0,D=o.length){if(a<D){if(A(e,e)!==0)return D;do{let n=a+D>>>1;I(o[n],e)<0?a=n+1:D=n}while(a<D)}return a}function C(o,e,a=0,D=o.length){if(a<D){if(A(e,e)!==0)return D;do{let n=a+D>>>1;I(o[n],e)<=0?a=n+1:D=n}while(a<D)}return a}function E(o,e,a=0,D=o.length){let n=Q(o,e,a,D-1);return n>a&&B(o[n-1],e)>-B(o[n],e)?n-1:n}return{left:Q,center:E,right:C}}function krA(){return 0}function GL(g){return g===null?NaN:+g}var f1=bM(LD),u1=f1.right,yrA=f1.left,FrA=bM(GL).center,wL=u1;var ac=class extends Map{constructor(A,I=MrA){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:I}}),A!=null)for(let[B,Q]of A)this.set(B,Q)}get(A){return super.get(m1(this,A))}has(A){return super.has(m1(this,A))}set(A,I){return super.set(lrA(this,A),I)}delete(A){return super.delete(RrA(this,A))}};function m1({_intern:g,_key:A},I){let B=A(I);return g.has(B)?g.get(B):I}function lrA({_intern:g,_key:A},I){let B=A(I);return g.has(B)?g.get(B):(g.set(B,I),I)}function RrA({_intern:g,_key:A},I){let B=A(I);return g.has(B)&&(I=g.get(B),g.delete(B)),I}function MrA(g){return g!==null&&typeof g=="object"?g.valueOf():g}var JrA=Math.sqrt(50),prA=Math.sqrt(10),YrA=Math.sqrt(2);function TM(g,A,I){let B=(A-g)/Math.max(0,I),Q=Math.floor(Math.log10(B)),C=B/Math.pow(10,Q),E=C>=JrA?10:C>=prA?5:C>=YrA?2:1,o,e,a;return Q<0?(a=Math.pow(10,-Q)/E,o=Math.round(g*a),e=Math.round(A*a),o/a<g&&++o,e/a>A&&--e,a=-a):(a=Math.pow(10,Q)*E,o=Math.round(g/a),e=Math.round(A/a),o*a<g&&++o,e*a>A&&--e),e<o&&.5<=I&&I<2?TM(g,A,I*2):[o,e,a]}function WM(g,A,I){if(A=+A,g=+g,I=+I,!(I>0))return[];if(g===A)return[g];let B=A<g,[Q,C,E]=B?TM(A,g,I):TM(g,A,I);if(!(C>=Q))return[];let o=C-Q+1,e=new Array(o);if(B)if(E<0)for(let a=0;a<o;++a)e[a]=(C-a)/-E;else for(let a=0;a<o;++a)e[a]=(C-a)*E;else if(E<0)for(let a=0;a<o;++a)e[a]=(Q+a)/-E;else for(let a=0;a<o;++a)e[a]=(Q+a)*E;return e}function rN(g,A,I){return A=+A,g=+g,I=+I,TM(g,A,I)[2]}function hL(g,A,I){A=+A,g=+g,I=+I;let B=A<g,Q=B?rN(A,g,I):rN(g,A,I);return(B?-1:1)*(Q<0?1/-Q:Q)}function bI(g,A){let I;if(A===void 0)for(let B of g)B!=null&&(I<B||I===void 0&&B>=B)&&(I=B);else{let B=-1;for(let Q of g)(Q=A(Q,++B,g))!=null&&(I<Q||I===void 0&&Q>=Q)&&(I=Q)}return I}function FQ(g,A){let I;if(A===void 0)for(let B of g)B!=null&&(I>B||I===void 0&&B>=B)&&(I=B);else{let B=-1;for(let Q of g)(Q=A(Q,++B,g))!=null&&(I>Q||I===void 0&&Q>=Q)&&(I=Q)}return I}function Ki(g,A,I){g=+g,A=+A,I=(Q=arguments.length)<2?(A=g,g=0,1):Q<3?1:+I;for(var B=-1,Q=Math.max(0,Math.ceil((A-g)/I))|0,C=new Array(Q);++B<Q;)C[B]=g+B*I;return C}var KrA={value:()=>{}};function b1(){for(var g=0,A=arguments.length,I={},B;g<A;++g){if(!(B=arguments[g]+"")||B in I||/[\s.]/.test(B))throw new Error("illegal type: "+B);I[B]=[]}return new ZM(I)}function ZM(g){this._=g}function drA(g,A){return g.trim().split(/^|\s+/).map(function(I){var B="",Q=I.indexOf(".");if(Q>=0&&(B=I.slice(Q+1),I=I.slice(0,Q)),I&&!A.hasOwnProperty(I))throw new Error("unknown type: "+I);return{type:I,name:B}})}ZM.prototype=b1.prototype={constructor:ZM,on:function(g,A){var I=this._,B=drA(g+"",I),Q,C=-1,E=B.length;if(arguments.length<2){for(;++C<E;)if((Q=(g=B[C]).type)&&(Q=qrA(I[Q],g.name)))return Q;return}if(A!=null&&typeof A!="function")throw new Error("invalid callback: "+A);for(;++C<E;)if(Q=(g=B[C]).type)I[Q]=x1(I[Q],g.name,A);else if(A==null)for(Q in I)I[Q]=x1(I[Q],g.name,null);return this},copy:function(){var g={},A=this._;for(var I in A)g[I]=A[I].slice();return new ZM(g)},call:function(g,A){if((Q=arguments.length-2)>0)for(var I=new Array(Q),B=0,Q,C;B<Q;++B)I[B]=arguments[B+2];if(!this._.hasOwnProperty(g))throw new Error("unknown type: "+g);for(C=this._[g],B=0,Q=C.length;B<Q;++B)C[B].value.apply(A,I)},apply:function(g,A,I){if(!this._.hasOwnProperty(g))throw new Error("unknown type: "+g);for(var B=this._[g],Q=0,C=B.length;Q<C;++Q)B[Q].value.apply(A,I)}};function qrA(g,A){for(var I=0,B=g.length,Q;I<B;++I)if((Q=g[I]).name===A)return Q.value}function x1(g,A,I){for(var B=0,Q=g.length;B<Q;++B)if(g[B].name===A){g[B]=KrA,g=g.slice(0,B).concat(g.slice(B+1));break}return I!=null&&g.push({name:A,value:I}),g}var NL=b1;var PM="http://www.w3.org/1999/xhtml",kL={svg:"http://www.w3.org/2000/svg",xhtml:PM,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ve(g){var A=g+="",I=A.indexOf(":");return I>=0&&(A=g.slice(0,I))!=="xmlns"&&(g=g.slice(I+1)),kL.hasOwnProperty(A)?{space:kL[A],local:g}:g}function UrA(g){return function(){var A=this.ownerDocument,I=this.namespaceURI;return I===PM&&A.documentElement.namespaceURI===PM?A.createElement(g):A.createElementNS(I,g)}}function SrA(g){return function(){return this.ownerDocument.createElementNS(g.space,g.local)}}function sc(g){var A=Ve(g);return(A.local?SrA:UrA)(A)}function LrA(){}function HD(g){return g==null?LrA:function(){return this.querySelector(g)}}function T1(g){typeof g!="function"&&(g=HD(g));for(var A=this._groups,I=A.length,B=new Array(I),Q=0;Q<I;++Q)for(var C=A[Q],E=C.length,o=B[Q]=new Array(E),e,a,D=0;D<E;++D)(e=C[D])&&(a=g.call(e,e.__data__,D,C))&&("__data__"in e&&(a.__data__=e.__data__),o[D]=a);return new jI(B,this._parents)}function nN(g){return g==null?[]:Array.isArray(g)?g:Array.from(g)}function HrA(){return[]}function cN(g){return g==null?HrA:function(){return this.querySelectorAll(g)}}function frA(g){return function(){return nN(g.apply(this,arguments))}}function W1(g){typeof g=="function"?g=frA(g):g=cN(g);for(var A=this._groups,I=A.length,B=[],Q=[],C=0;C<I;++C)for(var E=A[C],o=E.length,e,a=0;a<o;++a)(e=E[a])&&(B.push(g.call(e,e.__data__,a,E)),Q.push(e));return new jI(B,Q)}function GN(g){return function(){return this.matches(g)}}function OM(g){return function(A){return A.matches(g)}}var urA=Array.prototype.find;function mrA(g){return function(){return urA.call(this.children,g)}}function xrA(){return this.firstElementChild}function Z1(g){return this.select(g==null?xrA:mrA(typeof g=="function"?g:OM(g)))}var brA=Array.prototype.filter;function TrA(){return Array.from(this.children)}function WrA(g){return function(){return brA.call(this.children,g)}}function P1(g){return this.selectAll(g==null?TrA:WrA(typeof g=="function"?g:OM(g)))}function O1(g){typeof g!="function"&&(g=GN(g));for(var A=this._groups,I=A.length,B=new Array(I),Q=0;Q<I;++Q)for(var C=A[Q],E=C.length,o=B[Q]=[],e,a=0;a<E;++a)(e=C[a])&&g.call(e,e.__data__,a,C)&&o.push(e);return new jI(B,this._parents)}function VM(g){return new Array(g.length)}function V1(){return new jI(this._enter||this._groups.map(VM),this._parents)}function wN(g,A){this.ownerDocument=g.ownerDocument,this.namespaceURI=g.namespaceURI,this._next=null,this._parent=g,this.__data__=A}wN.prototype={constructor:wN,appendChild:function(g){return this._parent.insertBefore(g,this._next)},insertBefore:function(g,A){return this._parent.insertBefore(g,A)},querySelector:function(g){return this._parent.querySelector(g)},querySelectorAll:function(g){return this._parent.querySelectorAll(g)}};function v1(g){return function(){return g}}function ZrA(g,A,I,B,Q,C){for(var E=0,o,e=A.length,a=C.length;E<a;++E)(o=A[E])?(o.__data__=C[E],B[E]=o):I[E]=new wN(g,C[E]);for(;E<e;++E)(o=A[E])&&(Q[E]=o)}function PrA(g,A,I,B,Q,C,E){var o,e,a=new Map,D=A.length,n=C.length,G=new Array(D),w;for(o=0;o<D;++o)(e=A[o])&&(G[o]=w=E.call(e,e.__data__,o,A)+"",a.has(w)?Q[o]=e:a.set(w,e));for(o=0;o<n;++o)w=E.call(g,C[o],o,C)+"",(e=a.get(w))?(B[o]=e,e.__data__=C[o],a.delete(w)):I[o]=new wN(g,C[o]);for(o=0;o<D;++o)(e=A[o])&&a.get(G[o])===e&&(Q[o]=e)}function OrA(g){return g.__data__}function j1(g,A){if(!arguments.length)return Array.from(this,OrA);var I=A?PrA:ZrA,B=this._parents,Q=this._groups;typeof g!="function"&&(g=v1(g));for(var C=Q.length,E=new Array(C),o=new Array(C),e=new Array(C),a=0;a<C;++a){var D=B[a],n=Q[a],G=n.length,w=VrA(g.call(D,D&&D.__data__,a,B)),h=w.length,F=o[a]=new Array(h),N=E[a]=new Array(h),l=e[a]=new Array(G);I(D,n,F,N,l,w,A);for(var p=0,R=0,y,Y;p<h;++p)if(y=F[p]){for(p>=R&&(R=p+1);!(Y=N[R])&&++R<h;);y._next=Y||null}}return E=new jI(E,B),E._enter=o,E._exit=e,E}function VrA(g){return typeof g=="object"&&"length"in g?g:Array.from(g)}function X1(){return new jI(this._exit||this._groups.map(VM),this._parents)}function z1(g,A,I){var B=this.enter(),Q=this,C=this.exit();return typeof g=="function"?(B=g(B),B&&(B=B.selection())):B=B.append(g+""),A!=null&&(Q=A(Q),Q&&(Q=Q.selection())),I==null?C.remove():I(C),B&&Q?B.merge(Q).order():Q}function _1(g){for(var A=g.selection?g.selection():g,I=this._groups,B=A._groups,Q=I.length,C=B.length,E=Math.min(Q,C),o=new Array(Q),e=0;e<E;++e)for(var a=I[e],D=B[e],n=a.length,G=o[e]=new Array(n),w,h=0;h<n;++h)(w=a[h]||D[h])&&(G[h]=w);for(;e<Q;++e)o[e]=I[e];return new jI(o,this._parents)}function $1(){for(var g=this._groups,A=-1,I=g.length;++A<I;)for(var B=g[A],Q=B.length-1,C=B[Q],E;--Q>=0;)(E=B[Q])&&(C&&E.compareDocumentPosition(C)^4&&C.parentNode.insertBefore(E,C),C=E);return this}function AO(g){g||(g=vrA);function A(n,G){return n&&G?g(n.__data__,G.__data__):!n-!G}for(var I=this._groups,B=I.length,Q=new Array(B),C=0;C<B;++C){for(var E=I[C],o=E.length,e=Q[C]=new Array(o),a,D=0;D<o;++D)(a=E[D])&&(e[D]=a);e.sort(A)}return new jI(Q,this._parents).order()}function vrA(g,A){return g<A?-1:g>A?1:g>=A?0:NaN}function gO(){var g=arguments[0];return arguments[0]=this,g.apply(null,arguments),this}function IO(){return Array.from(this)}function BO(){for(var g=this._groups,A=0,I=g.length;A<I;++A)for(var B=g[A],Q=0,C=B.length;Q<C;++Q){var E=B[Q];if(E)return E}return null}function QO(){let g=0;for(let A of this)++g;return g}function CO(){return!this.node()}function EO(g){for(var A=this._groups,I=0,B=A.length;I<B;++I)for(var Q=A[I],C=0,E=Q.length,o;C<E;++C)(o=Q[C])&&g.call(o,o.__data__,C,Q);return this}function jrA(g){return function(){this.removeAttribute(g)}}function XrA(g){return function(){this.removeAttributeNS(g.space,g.local)}}function zrA(g,A){return function(){this.setAttribute(g,A)}}function _rA(g,A){return function(){this.setAttributeNS(g.space,g.local,A)}}function $rA(g,A){return function(){var I=A.apply(this,arguments);I==null?this.removeAttribute(g):this.setAttribute(g,I)}}function AnA(g,A){return function(){var I=A.apply(this,arguments);I==null?this.removeAttributeNS(g.space,g.local):this.setAttributeNS(g.space,g.local,I)}}function iO(g,A){var I=Ve(g);if(arguments.length<2){var B=this.node();return I.local?B.getAttributeNS(I.space,I.local):B.getAttribute(I)}return this.each((A==null?I.local?XrA:jrA:typeof A=="function"?I.local?AnA:$rA:I.local?_rA:zrA)(I,A))}function vM(g){return g.ownerDocument&&g.ownerDocument.defaultView||g.document&&g||g.defaultView}function gnA(g){return function(){this.style.removeProperty(g)}}function InA(g,A,I){return function(){this.style.setProperty(g,A,I)}}function BnA(g,A,I){return function(){var B=A.apply(this,arguments);B==null?this.style.removeProperty(g):this.style.setProperty(g,B,I)}}function oO(g,A,I){return arguments.length>1?this.each((A==null?gnA:typeof A=="function"?BnA:InA)(g,A,I??"")):os(this.node(),g)}function os(g,A){return g.style.getPropertyValue(A)||vM(g).getComputedStyle(g,null).getPropertyValue(A)}function QnA(g){return function(){delete this[g]}}function CnA(g,A){return function(){this[g]=A}}function EnA(g,A){return function(){var I=A.apply(this,arguments);I==null?delete this[g]:this[g]=I}}function tO(g,A){return arguments.length>1?this.each((A==null?QnA:typeof A=="function"?EnA:CnA)(g,A)):this.node()[g]}function eO(g){return g.trim().split(/^|\s+/)}function yL(g){return g.classList||new aO(g)}function aO(g){this._node=g,this._names=eO(g.getAttribute("class")||"")}aO.prototype={add:function(g){var A=this._names.indexOf(g);A<0&&(this._names.push(g),this._node.setAttribute("class",this._names.join(" ")))},remove:function(g){var A=this._names.indexOf(g);A>=0&&(this._names.splice(A,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(g){return this._names.indexOf(g)>=0}};function sO(g,A){for(var I=yL(g),B=-1,Q=A.length;++B<Q;)I.add(A[B])}function DO(g,A){for(var I=yL(g),B=-1,Q=A.length;++B<Q;)I.remove(A[B])}function inA(g){return function(){sO(this,g)}}function onA(g){return function(){DO(this,g)}}function tnA(g,A){return function(){(A.apply(this,arguments)?sO:DO)(this,g)}}function rO(g,A){var I=eO(g+"");if(arguments.length<2){for(var B=yL(this.node()),Q=-1,C=I.length;++Q<C;)if(!B.contains(I[Q]))return!1;return!0}return this.each((typeof A=="function"?tnA:A?inA:onA)(I,A))}function enA(){this.textContent=""}function anA(g){return function(){this.textContent=g}}function snA(g){return function(){var A=g.apply(this,arguments);this.textContent=A??""}}function nO(g){return arguments.length?this.each(g==null?enA:(typeof g=="function"?snA:anA)(g)):this.node().textContent}function DnA(){this.innerHTML=""}function rnA(g){return function(){this.innerHTML=g}}function nnA(g){return function(){var A=g.apply(this,arguments);this.innerHTML=A??""}}function cO(g){return arguments.length?this.each(g==null?DnA:(typeof g=="function"?nnA:rnA)(g)):this.node().innerHTML}function cnA(){this.nextSibling&&this.parentNode.appendChild(this)}function GO(){return this.each(cnA)}function GnA(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function wO(){return this.each(GnA)}function hO(g){var A=typeof g=="function"?g:sc(g);return this.select(function(){return this.appendChild(A.apply(this,arguments))})}function wnA(){return null}function NO(g,A){var I=typeof g=="function"?g:sc(g),B=A==null?wnA:typeof A=="function"?A:HD(A);return this.select(function(){return this.insertBefore(I.apply(this,arguments),B.apply(this,arguments)||null)})}function hnA(){var g=this.parentNode;g&&g.removeChild(this)}function kO(){return this.each(hnA)}function NnA(){var g=this.cloneNode(!1),A=this.parentNode;return A?A.insertBefore(g,this.nextSibling):g}function knA(){var g=this.cloneNode(!0),A=this.parentNode;return A?A.insertBefore(g,this.nextSibling):g}function yO(g){return this.select(g?knA:NnA)}function FO(g){return arguments.length?this.property("__data__",g):this.node().__data__}function ynA(g){return function(A){g.call(this,A,this.__data__)}}function FnA(g){return g.trim().split(/^|\s+/).map(function(A){var I="",B=A.indexOf(".");return B>=0&&(I=A.slice(B+1),A=A.slice(0,B)),{type:A,name:I}})}function lnA(g){return function(){var A=this.__on;if(A){for(var I=0,B=-1,Q=A.length,C;I<Q;++I)C=A[I],(!g.type||C.type===g.type)&&C.name===g.name?this.removeEventListener(C.type,C.listener,C.options):A[++B]=C;++B?A.length=B:delete this.__on}}}function RnA(g,A,I){return function(){var B=this.__on,Q,C=ynA(A);if(B){for(var E=0,o=B.length;E<o;++E)if((Q=B[E]).type===g.type&&Q.name===g.name){this.removeEventListener(Q.type,Q.listener,Q.options),this.addEventListener(Q.type,Q.listener=C,Q.options=I),Q.value=A;return}}this.addEventListener(g.type,C,I),Q={type:g.type,name:g.name,value:A,listener:C,options:I},B?B.push(Q):this.__on=[Q]}}function lO(g,A,I){var B=FnA(g+""),Q,C=B.length,E;if(arguments.length<2){var o=this.node().__on;if(o){for(var e=0,a=o.length,D;e<a;++e)for(Q=0,D=o[e];Q<C;++Q)if((E=B[Q]).type===D.type&&E.name===D.name)return D.value}return}for(o=A?RnA:lnA,Q=0;Q<C;++Q)this.each(o(B[Q],A,I));return this}function RO(g,A,I){var B=vM(g),Q=B.CustomEvent;typeof Q=="function"?Q=new Q(A,I):(Q=B.document.createEvent("Event"),I?(Q.initEvent(A,I.bubbles,I.cancelable),Q.detail=I.detail):Q.initEvent(A,!1,!1)),g.dispatchEvent(Q)}function MnA(g,A){return function(){return RO(this,g,A)}}function JnA(g,A){return function(){return RO(this,g,A.apply(this,arguments))}}function MO(g,A){return this.each((typeof A=="function"?JnA:MnA)(g,A))}function*JO(){for(var g=this._groups,A=0,I=g.length;A<I;++A)for(var B=g[A],Q=0,C=B.length,E;Q<C;++Q)(E=B[Q])&&(yield E)}var hN=[null];function jI(g,A){this._groups=g,this._parents=A}function pO(){return new jI([[document.documentElement]],hN)}function pnA(){return this}jI.prototype=pO.prototype={constructor:jI,select:T1,selectAll:W1,selectChild:Z1,selectChildren:P1,filter:O1,data:j1,enter:V1,exit:X1,join:z1,merge:_1,selection:pnA,order:$1,sort:AO,call:gO,nodes:IO,node:BO,size:QO,empty:CO,each:EO,attr:iO,style:oO,property:tO,classed:rO,text:nO,html:cO,raise:GO,lower:wO,append:hO,insert:NO,remove:kO,clone:yO,datum:FO,on:lO,dispatch:MO,[Symbol.iterator]:JO};var ve=pO;function gg(g){return typeof g=="string"?new jI([[document.querySelector(g)]],[document.documentElement]):new jI([[g]],hN)}function gE(g){return gg(sc(g).call(document.documentElement))}function FL(g){return typeof g=="string"?new jI([document.querySelectorAll(g)],[document.documentElement]):new jI([nN(g)],hN)}function jM(g,A,I){g.prototype=A.prototype=I,I.constructor=g}function lL(g,A){var I=Object.create(g.prototype);for(var B in A)I[B]=A[B];return I}function yN(){}var NN=.7,_M=1/NN,Dc="\\s*([+-]?\\d+)\\s*",kN="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Kt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",YnA=/^#([0-9a-f]{3,8})$/,KnA=new RegExp(`^rgb\\(${Dc},${Dc},${Dc}\\)$`),dnA=new RegExp(`^rgb\\(${Kt},${Kt},${Kt}\\)$`),qnA=new RegExp(`^rgba\\(${Dc},${Dc},${Dc},${kN}\\)$`),UnA=new RegExp(`^rgba\\(${Kt},${Kt},${Kt},${kN}\\)$`),SnA=new RegExp(`^hsl\\(${kN},${Kt},${Kt}\\)$`),LnA=new RegExp(`^hsla\\(${kN},${Kt},${Kt},${kN}\\)$`),YO={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};jM(yN,IE,{copy(g){return Object.assign(new this.constructor,this,g)},displayable(){return this.rgb().displayable()},hex:KO,formatHex:KO,formatHex8:HnA,formatHsl:fnA,formatRgb:dO,toString:dO});function KO(){return this.rgb().formatHex()}function HnA(){return this.rgb().formatHex8()}function fnA(){return fO(this).formatHsl()}function dO(){return this.rgb().formatRgb()}function IE(g){var A,I;return g=(g+"").trim().toLowerCase(),(A=YnA.exec(g))?(I=A[1].length,A=parseInt(A[1],16),I===6?qO(A):I===3?new pE(A>>8&15|A>>4&240,A>>4&15|A&240,(A&15)<<4|A&15,1):I===8?XM(A>>24&255,A>>16&255,A>>8&255,(A&255)/255):I===4?XM(A>>12&15|A>>8&240,A>>8&15|A>>4&240,A>>4&15|A&240,((A&15)<<4|A&15)/255):null):(A=KnA.exec(g))?new pE(A[1],A[2],A[3],1):(A=dnA.exec(g))?new pE(A[1]*255/100,A[2]*255/100,A[3]*255/100,1):(A=qnA.exec(g))?XM(A[1],A[2],A[3],A[4]):(A=UnA.exec(g))?XM(A[1]*255/100,A[2]*255/100,A[3]*255/100,A[4]):(A=SnA.exec(g))?LO(A[1],A[2]/100,A[3]/100,1):(A=LnA.exec(g))?LO(A[1],A[2]/100,A[3]/100,A[4]):YO.hasOwnProperty(g)?qO(YO[g]):g==="transparent"?new pE(NaN,NaN,NaN,0):null}function qO(g){return new pE(g>>16&255,g>>8&255,g&255,1)}function XM(g,A,I,B){return B<=0&&(g=A=I=NaN),new pE(g,A,I,B)}function unA(g){return g instanceof yN||(g=IE(g)),g?(g=g.rgb(),new pE(g.r,g.g,g.b,g.opacity)):new pE}function rc(g,A,I,B){return arguments.length===1?unA(g):new pE(g,A,I,B??1)}function pE(g,A,I,B){this.r=+g,this.g=+A,this.b=+I,this.opacity=+B}jM(pE,rc,lL(yN,{brighter(g){return g=g==null?_M:Math.pow(_M,g),new pE(this.r*g,this.g*g,this.b*g,this.opacity)},darker(g){return g=g==null?NN:Math.pow(NN,g),new pE(this.r*g,this.g*g,this.b*g,this.opacity)},rgb(){return this},clamp(){return new pE(uD(this.r),uD(this.g),uD(this.b),$M(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:UO,formatHex:UO,formatHex8:mnA,formatRgb:SO,toString:SO}));function UO(){return`#${fD(this.r)}${fD(this.g)}${fD(this.b)}`}function mnA(){return`#${fD(this.r)}${fD(this.g)}${fD(this.b)}${fD((isNaN(this.opacity)?1:this.opacity)*255)}`}function SO(){let g=$M(this.opacity);return`${g===1?"rgb(":"rgba("}${uD(this.r)}, ${uD(this.g)}, ${uD(this.b)}${g===1?")":`, ${g})`}`}function $M(g){return isNaN(g)?1:Math.max(0,Math.min(1,g))}function uD(g){return Math.max(0,Math.min(255,Math.round(g)||0))}function fD(g){return g=uD(g),(g<16?"0":"")+g.toString(16)}function LO(g,A,I,B){return B<=0?g=A=I=NaN:I<=0||I>=1?g=A=NaN:A<=0&&(g=NaN),new Yo(g,A,I,B)}function fO(g){if(g instanceof Yo)return new Yo(g.h,g.s,g.l,g.opacity);if(g instanceof yN||(g=IE(g)),!g)return new Yo;if(g instanceof Yo)return g;g=g.rgb();var A=g.r/255,I=g.g/255,B=g.b/255,Q=Math.min(A,I,B),C=Math.max(A,I,B),E=NaN,o=C-Q,e=(C+Q)/2;return o?(A===C?E=(I-B)/o+(I<B)*6:I===C?E=(B-A)/o+2:E=(A-I)/o+4,o/=e<.5?C+Q:2-C-Q,E*=60):o=e>0&&e<1?0:E,new Yo(E,o,e,g.opacity)}function uO(g,A,I,B){return arguments.length===1?fO(g):new Yo(g,A,I,B??1)}function Yo(g,A,I,B){this.h=+g,this.s=+A,this.l=+I,this.opacity=+B}jM(Yo,uO,lL(yN,{brighter(g){return g=g==null?_M:Math.pow(_M,g),new Yo(this.h,this.s,this.l*g,this.opacity)},darker(g){return g=g==null?NN:Math.pow(NN,g),new Yo(this.h,this.s,this.l*g,this.opacity)},rgb(){var g=this.h%360+(this.h<0)*360,A=isNaN(g)||isNaN(this.s)?0:this.s,I=this.l,B=I+(I<.5?I:1-I)*A,Q=2*I-B;return new pE(RL(g>=240?g-240:g+120,Q,B),RL(g,Q,B),RL(g<120?g+240:g-120,Q,B),this.opacity)},clamp(){return new Yo(HO(this.h),zM(this.s),zM(this.l),$M(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let g=$M(this.opacity);return`${g===1?"hsl(":"hsla("}${HO(this.h)}, ${zM(this.s)*100}%, ${zM(this.l)*100}%${g===1?")":`, ${g})`}`}}));function HO(g){return g=(g||0)%360,g<0?g+360:g}function zM(g){return Math.max(0,Math.min(1,g||0))}function RL(g,A,I){return(g<60?A+(I-A)*g/60:g<180?I:g<240?A+(I-A)*(240-g)/60:A)*255}function ML(g,A,I,B,Q){var C=g*g,E=C*g;return((1-3*g+3*C-E)*A+(4-6*C+3*E)*I+(1+3*g+3*C-3*E)*B+E*Q)/6}function xO(g){var A=g.length-1;return function(I){var B=I<=0?I=0:I>=1?(I=1,A-1):Math.floor(I*A),Q=g[B],C=g[B+1],E=B>0?g[B-1]:2*Q-C,o=B<A-1?g[B+2]:2*C-Q;return ML((I-B/A)*A,E,Q,C,o)}}function bO(g){var A=g.length;return function(I){var B=Math.floor(((I%=1)<0?++I:I)*A),Q=g[(B+A-1)%A],C=g[B%A],E=g[(B+1)%A],o=g[(B+2)%A];return ML((I-B/A)*A,Q,C,E,o)}}var FN=g=>()=>g;function xnA(g,A){return function(I){return g+I*A}}function bnA(g,A,I){return g=Math.pow(g,I),A=Math.pow(A,I)-g,I=1/I,function(B){return Math.pow(g+B*A,I)}}function TO(g){return(g=+g)==1?AJ:function(A,I){return I-A?bnA(A,I,g):FN(isNaN(A)?I:A)}}function AJ(g,A){var I=A-g;return I?xnA(g,I):FN(isNaN(g)?A:g)}var mD=function g(A){var I=TO(A);function B(Q,C){var E=I((Q=rc(Q)).r,(C=rc(C)).r),o=I(Q.g,C.g),e=I(Q.b,C.b),a=AJ(Q.opacity,C.opacity);return function(D){return Q.r=E(D),Q.g=o(D),Q.b=e(D),Q.opacity=a(D),Q+""}}return B.gamma=g,B}(1);function WO(g){return function(A){var I=A.length,B=new Array(I),Q=new Array(I),C=new Array(I),E,o;for(E=0;E<I;++E)o=rc(A[E]),B[E]=o.r||0,Q[E]=o.g||0,C[E]=o.b||0;return B=g(B),Q=g(Q),C=g(C),o.opacity=1,function(e){return o.r=B(e),o.g=Q(e),o.b=C(e),o+""}}}var TnA=WO(xO),WnA=WO(bO);function ZO(g,A){A||(A=[]);var I=g?Math.min(A.length,g.length):0,B=A.slice(),Q;return function(C){for(Q=0;Q<I;++Q)B[Q]=g[Q]*(1-C)+A[Q]*C;return B}}function PO(g){return ArrayBuffer.isView(g)&&!(g instanceof DataView)}function OO(g,A){var I=A?A.length:0,B=g?Math.min(I,g.length):0,Q=new Array(B),C=new Array(I),E;for(E=0;E<B;++E)Q[E]=xD(g[E],A[E]);for(;E<I;++E)C[E]=A[E];return function(o){for(E=0;E<B;++E)C[E]=Q[E](o);return C}}function VO(g,A){var I=new Date;return g=+g,A=+A,function(B){return I.setTime(g*(1-B)+A*B),I}}function WQ(g,A){return g=+g,A=+A,function(I){return g*(1-I)+A*I}}function vO(g,A){var I={},B={},Q;(g===null||typeof g!="object")&&(g={}),(A===null||typeof A!="object")&&(A={});for(Q in A)Q in g?I[Q]=xD(g[Q],A[Q]):B[Q]=A[Q];return function(C){for(Q in I)B[Q]=I[Q](C);return B}}var pL=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,JL=new RegExp(pL.source,"g");function ZnA(g){return function(){return g}}function PnA(g){return function(A){return g(A)+""}}function lN(g,A){var I=pL.lastIndex=JL.lastIndex=0,B,Q,C,E=-1,o=[],e=[];for(g=g+"",A=A+"";(B=pL.exec(g))&&(Q=JL.exec(A));)(C=Q.index)>I&&(C=A.slice(I,C),o[E]?o[E]+=C:o[++E]=C),(B=B[0])===(Q=Q[0])?o[E]?o[E]+=Q:o[++E]=Q:(o[++E]=null,e.push({i:E,x:WQ(B,Q)})),I=JL.lastIndex;return I<A.length&&(C=A.slice(I),o[E]?o[E]+=C:o[++E]=C),o.length<2?e[0]?PnA(e[0].x):ZnA(A):(A=e.length,function(a){for(var D=0,n;D<A;++D)o[(n=e[D]).i]=n.x(a);return o.join("")})}function xD(g,A){var I=typeof A,B;return A==null||I==="boolean"?FN(A):(I==="number"?WQ:I==="string"?(B=IE(A))?(A=B,mD):lN:A instanceof IE?mD:A instanceof Date?VO:PO(A)?ZO:Array.isArray(A)?OO:typeof A.valueOf!="function"&&typeof A.toString!="function"||isNaN(A)?vO:WQ)(g,A)}function YL(g,A){return g=+g,A=+A,function(I){return Math.round(g*(1-I)+A*I)}}var jO=180/Math.PI,gJ={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function KL(g,A,I,B,Q,C){var E,o,e;return(E=Math.sqrt(g*g+A*A))&&(g/=E,A/=E),(e=g*I+A*B)&&(I-=g*e,B-=A*e),(o=Math.sqrt(I*I+B*B))&&(I/=o,B/=o,e/=o),g*B<A*I&&(g=-g,A=-A,e=-e,E=-E),{translateX:Q,translateY:C,rotate:Math.atan2(A,g)*jO,skewX:Math.atan(e)*jO,scaleX:E,scaleY:o}}var IJ;function XO(g){let A=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(g+"");return A.isIdentity?gJ:KL(A.a,A.b,A.c,A.d,A.e,A.f)}function zO(g){return g==null?gJ:(IJ||(IJ=document.createElementNS("http://www.w3.org/2000/svg","g")),IJ.setAttribute("transform",g),(g=IJ.transform.baseVal.consolidate())?(g=g.matrix,KL(g.a,g.b,g.c,g.d,g.e,g.f)):gJ)}function _O(g,A,I,B){function Q(a){return a.length?a.pop()+" ":""}function C(a,D,n,G,w,h){if(a!==n||D!==G){var F=w.push("translate(",null,A,null,I);h.push({i:F-4,x:WQ(a,n)},{i:F-2,x:WQ(D,G)})}else(n||G)&&w.push("translate("+n+A+G+I)}function E(a,D,n,G){a!==D?(a-D>180?D+=360:D-a>180&&(a+=360),G.push({i:n.push(Q(n)+"rotate(",null,B)-2,x:WQ(a,D)})):D&&n.push(Q(n)+"rotate("+D+B)}function o(a,D,n,G){a!==D?G.push({i:n.push(Q(n)+"skewX(",null,B)-2,x:WQ(a,D)}):D&&n.push(Q(n)+"skewX("+D+B)}function e(a,D,n,G,w,h){if(a!==n||D!==G){var F=w.push(Q(w)+"scale(",null,",",null,")");h.push({i:F-4,x:WQ(a,n)},{i:F-2,x:WQ(D,G)})}else(n!==1||G!==1)&&w.push(Q(w)+"scale("+n+","+G+")")}return function(a,D){var n=[],G=[];return a=g(a),D=g(D),C(a.translateX,a.translateY,D.translateX,D.translateY,n,G),E(a.rotate,D.rotate,n,G),o(a.skewX,D.skewX,n,G),e(a.scaleX,a.scaleY,D.scaleX,D.scaleY,n,G),a=D=null,function(w){for(var h=-1,F=G.length,N;++h<F;)n[(N=G[h]).i]=N.x(w);return n.join("")}}}var dL=_O(XO,"px, ","px)","deg)"),qL=_O(zO,", ",")",")");var nc=0,MN=0,RN=0,AV=1e3,BJ,JN,QJ=0,bD=0,CJ=0,pN=typeof performance=="object"&&performance.now?performance:Date,gV=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(g){setTimeout(g,17)};function KN(){return bD||(gV(OnA),bD=pN.now()+CJ)}function OnA(){bD=0}function YN(){this._call=this._time=this._next=null}YN.prototype=EJ.prototype={constructor:YN,restart:function(g,A,I){if(typeof g!="function")throw new TypeError("callback is not a function");I=(I==null?KN():+I)+(A==null?0:+A),!this._next&&JN!==this&&(JN?JN._next=this:BJ=this,JN=this),this._call=g,this._time=I,UL()},stop:function(){this._call&&(this._call=null,this._time=1/0,UL())}};function EJ(g,A,I){var B=new YN;return B.restart(g,A,I),B}function IV(){KN(),++nc;for(var g=BJ,A;g;)(A=bD-g._time)>=0&&g._call.call(void 0,A),g=g._next;--nc}function $O(){bD=(QJ=pN.now())+CJ,nc=MN=0;try{IV()}finally{nc=0,vnA(),bD=0}}function VnA(){var g=pN.now(),A=g-QJ;A>AV&&(CJ-=A,QJ=g)}function vnA(){for(var g,A=BJ,I,B=1/0;A;)A._call?(B>A._time&&(B=A._time),g=A,A=A._next):(I=A._next,A._next=null,A=g?g._next=I:BJ=I);JN=g,UL(B)}function UL(g){if(!nc){MN&&(MN=clearTimeout(MN));var A=g-bD;A>24?(g<1/0&&(MN=setTimeout($O,g-pN.now()-CJ)),RN&&(RN=clearInterval(RN))):(RN||(QJ=pN.now(),RN=setInterval(VnA,AV)),nc=1,gV($O))}}function iJ(g,A,I){var B=new YN;return A=A==null?0:+A,B.restart(Q=>{B.stop(),g(Q+A)},A,I),B}var jnA=NL("start","end","cancel","interrupt"),XnA=[],CV=0,BV=1,tJ=2,oJ=3,QV=4,eJ=5,dN=6;function ts(g,A,I,B,Q,C){var E=g.__transition;if(!E)g.__transition={};else if(I in E)return;znA(g,I,{name:A,index:B,group:Q,on:jnA,tween:XnA,time:C.time,delay:C.delay,duration:C.duration,ease:C.ease,timer:null,state:CV})}function qN(g,A){var I=IQ(g,A);if(I.state>CV)throw new Error("too late; already scheduled");return I}function ZQ(g,A){var I=IQ(g,A);if(I.state>oJ)throw new Error("too late; already running");return I}function IQ(g,A){var I=g.__transition;if(!I||!(I=I[A]))throw new Error("transition not found");return I}function znA(g,A,I){var B=g.__transition,Q;B[A]=I,I.timer=EJ(C,0,I.time);function C(a){I.state=BV,I.timer.restart(E,I.delay,I.time),I.delay<=a&&E(a-I.delay)}function E(a){var D,n,G,w;if(I.state!==BV)return e();for(D in B)if(w=B[D],w.name===I.name){if(w.state===oJ)return iJ(E);w.state===QV?(w.state=dN,w.timer.stop(),w.on.call("interrupt",g,g.__data__,w.index,w.group),delete B[D]):+D<A&&(w.state=dN,w.timer.stop(),w.on.call("cancel",g,g.__data__,w.index,w.group),delete B[D])}if(iJ(function(){I.state===oJ&&(I.state=QV,I.timer.restart(o,I.delay,I.time),o(a))}),I.state=tJ,I.on.call("start",g,g.__data__,I.index,I.group),I.state===tJ){for(I.state=oJ,Q=new Array(G=I.tween.length),D=0,n=-1;D<G;++D)(w=I.tween[D].value.call(g,g.__data__,I.index,I.group))&&(Q[++n]=w);Q.length=n+1}}function o(a){for(var D=a<I.duration?I.ease.call(null,a/I.duration):(I.timer.restart(e),I.state=eJ,1),n=-1,G=Q.length;++n<G;)Q[n].call(g,D);I.state===eJ&&(I.on.call("end",g,g.__data__,I.index,I.group),e())}function e(){I.state=dN,I.timer.stop(),delete B[A];for(var a in B)return;delete g.__transition}}function aJ(g,A){var I=g.__transition,B,Q,C=!0,E;if(I){A=A==null?null:A+"";for(E in I){if((B=I[E]).name!==A){C=!1;continue}Q=B.state>tJ&&B.state<eJ,B.state=dN,B.timer.stop(),B.on.call(Q?"interrupt":"cancel",g,g.__data__,B.index,B.group),delete I[E]}C&&delete g.__transition}}function EV(g){return this.each(function(){aJ(this,g)})}function _nA(g,A){var I,B;return function(){var Q=ZQ(this,g),C=Q.tween;if(C!==I){B=I=C;for(var E=0,o=B.length;E<o;++E)if(B[E].name===A){B=B.slice(),B.splice(E,1);break}}Q.tween=B}}function $nA(g,A,I){var B,Q;if(typeof I!="function")throw new Error;return function(){var C=ZQ(this,g),E=C.tween;if(E!==B){Q=(B=E).slice();for(var o={name:A,value:I},e=0,a=Q.length;e<a;++e)if(Q[e].name===A){Q[e]=o;break}e===a&&Q.push(o)}C.tween=Q}}function iV(g,A){var I=this._id;if(g+="",arguments.length<2){for(var B=IQ(this.node(),I).tween,Q=0,C=B.length,E;Q<C;++Q)if((E=B[Q]).name===g)return E.value;return null}return this.each((A==null?_nA:$nA)(I,g,A))}function cc(g,A,I){var B=g._id;return g.each(function(){var Q=ZQ(this,B);(Q.value||(Q.value={}))[A]=I.apply(this,arguments)}),function(Q){return IQ(Q,B).value[A]}}function sJ(g,A){var I;return(typeof A=="number"?WQ:A instanceof IE?mD:(I=IE(A))?(A=I,mD):lN)(g,A)}function AcA(g){return function(){this.removeAttribute(g)}}function gcA(g){return function(){this.removeAttributeNS(g.space,g.local)}}function IcA(g,A,I){var B,Q=I+"",C;return function(){var E=this.getAttribute(g);return E===Q?null:E===B?C:C=A(B=E,I)}}function BcA(g,A,I){var B,Q=I+"",C;return function(){var E=this.getAttributeNS(g.space,g.local);return E===Q?null:E===B?C:C=A(B=E,I)}}function QcA(g,A,I){var B,Q,C;return function(){var E,o=I(this),e;return o==null?void this.removeAttribute(g):(E=this.getAttribute(g),e=o+"",E===e?null:E===B&&e===Q?C:(Q=e,C=A(B=E,o)))}}function CcA(g,A,I){var B,Q,C;return function(){var E,o=I(this),e;return o==null?void this.removeAttributeNS(g.space,g.local):(E=this.getAttributeNS(g.space,g.local),e=o+"",E===e?null:E===B&&e===Q?C:(Q=e,C=A(B=E,o)))}}function oV(g,A){var I=Ve(g),B=I==="transform"?qL:sJ;return this.attrTween(g,typeof A=="function"?(I.local?CcA:QcA)(I,B,cc(this,"attr."+g,A)):A==null?(I.local?gcA:AcA)(I):(I.local?BcA:IcA)(I,B,A))}function EcA(g,A){return function(I){this.setAttribute(g,A.call(this,I))}}function icA(g,A){return function(I){this.setAttributeNS(g.space,g.local,A.call(this,I))}}function ocA(g,A){var I,B;function Q(){var C=A.apply(this,arguments);return C!==B&&(I=(B=C)&&icA(g,C)),I}return Q._value=A,Q}function tcA(g,A){var I,B;function Q(){var C=A.apply(this,arguments);return C!==B&&(I=(B=C)&&EcA(g,C)),I}return Q._value=A,Q}function tV(g,A){var I="attr."+g;if(arguments.length<2)return(I=this.tween(I))&&I._value;if(A==null)return this.tween(I,null);if(typeof A!="function")throw new Error;var B=Ve(g);return this.tween(I,(B.local?ocA:tcA)(B,A))}function ecA(g,A){return function(){qN(this,g).delay=+A.apply(this,arguments)}}function acA(g,A){return A=+A,function(){qN(this,g).delay=A}}function eV(g){var A=this._id;return arguments.length?this.each((typeof g=="function"?ecA:acA)(A,g)):IQ(this.node(),A).delay}function scA(g,A){return function(){ZQ(this,g).duration=+A.apply(this,arguments)}}function DcA(g,A){return A=+A,function(){ZQ(this,g).duration=A}}function aV(g){var A=this._id;return arguments.length?this.each((typeof g=="function"?scA:DcA)(A,g)):IQ(this.node(),A).duration}function rcA(g,A){if(typeof A!="function")throw new Error;return function(){ZQ(this,g).ease=A}}function sV(g){var A=this._id;return arguments.length?this.each(rcA(A,g)):IQ(this.node(),A).ease}function ncA(g,A){return function(){var I=A.apply(this,arguments);if(typeof I!="function")throw new Error;ZQ(this,g).ease=I}}function DV(g){if(typeof g!="function")throw new Error;return this.each(ncA(this._id,g))}function rV(g){typeof g!="function"&&(g=GN(g));for(var A=this._groups,I=A.length,B=new Array(I),Q=0;Q<I;++Q)for(var C=A[Q],E=C.length,o=B[Q]=[],e,a=0;a<E;++a)(e=C[a])&&g.call(e,e.__data__,a,C)&&o.push(e);return new BE(B,this._parents,this._name,this._id)}function nV(g){if(g._id!==this._id)throw new Error;for(var A=this._groups,I=g._groups,B=A.length,Q=I.length,C=Math.min(B,Q),E=new Array(B),o=0;o<C;++o)for(var e=A[o],a=I[o],D=e.length,n=E[o]=new Array(D),G,w=0;w<D;++w)(G=e[w]||a[w])&&(n[w]=G);for(;o<B;++o)E[o]=A[o];return new BE(E,this._parents,this._name,this._id)}function ccA(g){return(g+"").trim().split(/^|\s+/).every(function(A){var I=A.indexOf(".");return I>=0&&(A=A.slice(0,I)),!A||A==="start"})}function GcA(g,A,I){var B,Q,C=ccA(A)?qN:ZQ;return function(){var E=C(this,g),o=E.on;o!==B&&(Q=(B=o).copy()).on(A,I),E.on=Q}}function cV(g,A){var I=this._id;return arguments.length<2?IQ(this.node(),I).on.on(g):this.each(GcA(I,g,A))}function wcA(g){return function(){var A=this.parentNode;for(var I in this.__transition)if(+I!==g)return;A&&A.removeChild(this)}}function GV(){return this.on("end.remove",wcA(this._id))}function wV(g){var A=this._name,I=this._id;typeof g!="function"&&(g=HD(g));for(var B=this._groups,Q=B.length,C=new Array(Q),E=0;E<Q;++E)for(var o=B[E],e=o.length,a=C[E]=new Array(e),D,n,G=0;G<e;++G)(D=o[G])&&(n=g.call(D,D.__data__,G,o))&&("__data__"in D&&(n.__data__=D.__data__),a[G]=n,ts(a[G],A,I,G,a,IQ(D,I)));return new BE(C,this._parents,A,I)}function hV(g){var A=this._name,I=this._id;typeof g!="function"&&(g=cN(g));for(var B=this._groups,Q=B.length,C=[],E=[],o=0;o<Q;++o)for(var e=B[o],a=e.length,D,n=0;n<a;++n)if(D=e[n]){for(var G=g.call(D,D.__data__,n,e),w,h=IQ(D,I),F=0,N=G.length;F<N;++F)(w=G[F])&&ts(w,A,I,F,G,h);C.push(G),E.push(D)}return new BE(C,E,A,I)}var hcA=ve.prototype.constructor;function NV(){return new hcA(this._groups,this._parents)}function NcA(g,A){var I,B,Q;return function(){var C=os(this,g),E=(this.style.removeProperty(g),os(this,g));return C===E?null:C===I&&E===B?Q:Q=A(I=C,B=E)}}function kV(g){return function(){this.style.removeProperty(g)}}function kcA(g,A,I){var B,Q=I+"",C;return function(){var E=os(this,g);return E===Q?null:E===B?C:C=A(B=E,I)}}function ycA(g,A,I){var B,Q,C;return function(){var E=os(this,g),o=I(this),e=o+"";return o==null&&(e=o=(this.style.removeProperty(g),os(this,g))),E===e?null:E===B&&e===Q?C:(Q=e,C=A(B=E,o))}}function FcA(g,A){var I,B,Q,C="style."+A,E="end."+C,o;return function(){var e=ZQ(this,g),a=e.on,D=e.value[C]==null?o||(o=kV(A)):void 0;(a!==I||Q!==D)&&(B=(I=a).copy()).on(E,Q=D),e.on=B}}function yV(g,A,I){var B=(g+="")=="transform"?dL:sJ;return A==null?this.styleTween(g,NcA(g,B)).on("end.style."+g,kV(g)):typeof A=="function"?this.styleTween(g,ycA(g,B,cc(this,"style."+g,A))).each(FcA(this._id,g)):this.styleTween(g,kcA(g,B,A),I).on("end.style."+g,null)}function lcA(g,A,I){return function(B){this.style.setProperty(g,A.call(this,B),I)}}function RcA(g,A,I){var B,Q;function C(){var E=A.apply(this,arguments);return E!==Q&&(B=(Q=E)&&lcA(g,E,I)),B}return C._value=A,C}function FV(g,A,I){var B="style."+(g+="");if(arguments.length<2)return(B=this.tween(B))&&B._value;if(A==null)return this.tween(B,null);if(typeof A!="function")throw new Error;return this.tween(B,RcA(g,A,I??""))}function McA(g){return function(){this.textContent=g}}function JcA(g){return function(){var A=g(this);this.textContent=A??""}}function lV(g){return this.tween("text",typeof g=="function"?JcA(cc(this,"text",g)):McA(g==null?"":g+""))}function pcA(g){return function(A){this.textContent=g.call(this,A)}}function YcA(g){var A,I;function B(){var Q=g.apply(this,arguments);return Q!==I&&(A=(I=Q)&&pcA(Q)),A}return B._value=g,B}function RV(g){var A="text";if(arguments.length<1)return(A=this.tween(A))&&A._value;if(g==null)return this.tween(A,null);if(typeof g!="function")throw new Error;return this.tween(A,YcA(g))}function MV(){for(var g=this._name,A=this._id,I=DJ(),B=this._groups,Q=B.length,C=0;C<Q;++C)for(var E=B[C],o=E.length,e,a=0;a<o;++a)if(e=E[a]){var D=IQ(e,A);ts(e,g,I,a,E,{time:D.time+D.delay+D.duration,delay:0,duration:D.duration,ease:D.ease})}return new BE(B,this._parents,g,I)}function JV(){var g,A,I=this,B=I._id,Q=I.size();return new Promise(function(C,E){var o={value:E},e={value:function(){--Q===0&&C()}};I.each(function(){var a=ZQ(this,B),D=a.on;D!==g&&(A=(g=D).copy(),A._.cancel.push(o),A._.interrupt.push(o),A._.end.push(e)),a.on=A}),Q===0&&C()})}var KcA=0;function BE(g,A,I,B){this._groups=g,this._parents=A,this._name=I,this._id=B}function pV(g){return ve().transition(g)}function DJ(){return++KcA}var je=ve.prototype;BE.prototype=pV.prototype={constructor:BE,select:wV,selectAll:hV,selectChild:je.selectChild,selectChildren:je.selectChildren,filter:rV,merge:nV,selection:NV,transition:MV,call:je.call,nodes:je.nodes,node:je.node,size:je.size,empty:je.empty,each:je.each,on:cV,attr:oV,attrTween:tV,style:yV,styleTween:FV,text:lV,textTween:RV,remove:GV,tween:iV,delay:eV,duration:aV,ease:sV,easeVarying:DV,end:JV,[Symbol.iterator]:je[Symbol.iterator]};function YE(g){return((g*=2)<=1?g*g*g:(g-=2)*g*g+2)/2}var dcA={time:null,delay:0,duration:250,ease:YE};function qcA(g,A){for(var I;!(I=g.__transition)||!(I=I[A]);)if(!(g=g.parentNode))throw new Error(`transition ${A} not found`);return I}function YV(g){var A,I;g instanceof BE?(A=g._id,g=g._name):(A=DJ(),(I=dcA).time=KN(),g=g==null?null:g+"");for(var B=this._groups,Q=B.length,C=0;C<Q;++C)for(var E=B[C],o=E.length,e,a=0;a<o;++a)(e=E[a])&&ts(e,g,A,a,E,I||qcA(e,A));return new BE(B,this._parents,g,A)}ve.prototype.interrupt=EV;ve.prototype.transition=YV;var{abs:Xwg,max:zwg,min:_wg}=Math;function KV(g){return[+g[0],+g[1]]}function UcA(g){return[KV(g[0]),KV(g[1])]}var $wg={name:"x",handles:["w","e"].map(SL),input:function(g,A){return g==null?null:[[+g[0],A[0][1]],[+g[1],A[1][1]]]},output:function(g){return g&&[g[0][0],g[1][0]]}},Ahg={name:"y",handles:["n","s"].map(SL),input:function(g,A){return g==null?null:[[A[0][0],+g[0]],[A[1][0],+g[1]]]},output:function(g){return g&&[g[0][1],g[1][1]]}},ghg={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(SL),input:function(g){return g==null?null:UcA(g)},output:function(g){return g}};function SL(g){return{type:g}}function dV(g){return Math.abs(g=Math.round(g))>=1e21?g.toLocaleString("en").replace(/,/g,""):g.toString(10)}function TD(g,A){if((I=(g=A?g.toExponential(A-1):g.toExponential()).indexOf("e"))<0)return null;var I,B=g.slice(0,I);return[B.length>1?B[0]+B.slice(2):B,+g.slice(I+1)]}function dt(g){return g=TD(Math.abs(g)),g?g[1]:NaN}function qV(g,A){return function(I,B){for(var Q=I.length,C=[],E=0,o=g[0],e=0;Q>0&&o>0&&(e+o+1>B&&(o=Math.max(1,B-e)),C.push(I.substring(Q-=o,Q+o)),!((e+=o+1)>B));)o=g[E=(E+1)%g.length];return C.reverse().join(A)}}function UV(g){return function(A){return A.replace(/[0-9]/g,function(I){return g[+I]})}}var ScA=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function es(g){if(!(A=ScA.exec(g)))throw new Error("invalid format: "+g);var A;return new rJ({fill:A[1],align:A[2],sign:A[3],symbol:A[4],zero:A[5],width:A[6],comma:A[7],precision:A[8]&&A[8].slice(1),trim:A[9],type:A[10]})}es.prototype=rJ.prototype;function rJ(g){this.fill=g.fill===void 0?" ":g.fill+"",this.align=g.align===void 0?">":g.align+"",this.sign=g.sign===void 0?"-":g.sign+"",this.symbol=g.symbol===void 0?"":g.symbol+"",this.zero=!!g.zero,this.width=g.width===void 0?void 0:+g.width,this.comma=!!g.comma,this.precision=g.precision===void 0?void 0:+g.precision,this.trim=!!g.trim,this.type=g.type===void 0?"":g.type+""}rJ.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function SV(g){A:for(var A=g.length,I=1,B=-1,Q;I<A;++I)switch(g[I]){case".":B=Q=I;break;case"0":B===0&&(B=I),Q=I;break;default:if(!+g[I])break A;B>0&&(B=0);break}return B>0?g.slice(0,B)+g.slice(Q+1):g}var LL;function LV(g,A){var I=TD(g,A);if(!I)return g+"";var B=I[0],Q=I[1],C=Q-(LL=Math.max(-8,Math.min(8,Math.floor(Q/3)))*3)+1,E=B.length;return C===E?B:C>E?B+new Array(C-E+1).join("0"):C>0?B.slice(0,C)+"."+B.slice(C):"0."+new Array(1-C).join("0")+TD(g,Math.max(0,A+C-1))[0]}function HL(g,A){var I=TD(g,A);if(!I)return g+"";var B=I[0],Q=I[1];return Q<0?"0."+new Array(-Q).join("0")+B:B.length>Q+1?B.slice(0,Q+1)+"."+B.slice(Q+1):B+new Array(Q-B.length+2).join("0")}var fL={"%":(g,A)=>(g*100).toFixed(A),b:g=>Math.round(g).toString(2),c:g=>g+"",d:dV,e:(g,A)=>g.toExponential(A),f:(g,A)=>g.toFixed(A),g:(g,A)=>g.toPrecision(A),o:g=>Math.round(g).toString(8),p:(g,A)=>HL(g*100,A),r:HL,s:LV,X:g=>Math.round(g).toString(16).toUpperCase(),x:g=>Math.round(g).toString(16)};function uL(g){return g}var HV=Array.prototype.map,fV=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function uV(g){var A=g.grouping===void 0||g.thousands===void 0?uL:qV(HV.call(g.grouping,Number),g.thousands+""),I=g.currency===void 0?"":g.currency[0]+"",B=g.currency===void 0?"":g.currency[1]+"",Q=g.decimal===void 0?".":g.decimal+"",C=g.numerals===void 0?uL:UV(HV.call(g.numerals,String)),E=g.percent===void 0?"%":g.percent+"",o=g.minus===void 0?"\u2212":g.minus+"",e=g.nan===void 0?"NaN":g.nan+"";function a(n){n=es(n);var G=n.fill,w=n.align,h=n.sign,F=n.symbol,N=n.zero,l=n.width,p=n.comma,R=n.precision,y=n.trim,Y=n.type;Y==="n"?(p=!0,Y="g"):fL[Y]||(R===void 0&&(R=12),y=!0,Y="g"),(N||G==="0"&&w==="=")&&(N=!0,G="0",w="=");var d=F==="$"?I:F==="#"&&/[boxX]/.test(Y)?"0"+Y.toLowerCase():"",f=F==="$"?B:/[%p]/.test(Y)?E:"",K=fL[Y],x=/[defgprs%]/.test(Y);R=R===void 0?6:/[gprs]/.test(Y)?Math.max(1,Math.min(21,R)):Math.max(0,Math.min(20,R));function u(P){var H=d,X=f,J,BA,cA;if(Y==="c")X=K(P)+X,P="";else{P=+P;var kA=P<0||1/P<0;if(P=isNaN(P)?e:K(Math.abs(P),R),y&&(P=SV(P)),kA&&+P==0&&h!=="+"&&(kA=!1),H=(kA?h==="("?h:o:h==="-"||h==="("?"":h)+H,X=(Y==="s"?fV[8+LL/3]:"")+X+(kA&&h==="("?")":""),x){for(J=-1,BA=P.length;++J<BA;)if(cA=P.charCodeAt(J),48>cA||cA>57){X=(cA===46?Q+P.slice(J+1):P.slice(J))+X,P=P.slice(0,J);break}}}p&&!N&&(P=A(P,1/0));var yA=H.length+P.length+X.length,MA=yA<l?new Array(l-yA+1).join(G):"";switch(p&&N&&(P=A(MA+P,MA.length?l-X.length:1/0),MA=""),w){case"<":P=H+P+X+MA;break;case"=":P=H+MA+P+X;break;case"^":P=MA.slice(0,yA=MA.length>>1)+H+P+X+MA.slice(yA);break;default:P=MA+H+P+X;break}return C(P)}return u.toString=function(){return n+""},u}function D(n,G){var w=a((n=es(n),n.type="f",n)),h=Math.max(-8,Math.min(8,Math.floor(dt(G)/3)))*3,F=Math.pow(10,-h),N=fV[8+h/3];return function(l){return w(F*l)+N}}return{format:a,formatPrefix:D}}var nJ,cJ,GJ;mL({thousands:",",grouping:[3],currency:["$",""]});function mL(g){return nJ=uV(g),cJ=nJ.format,GJ=nJ.formatPrefix,nJ}function xL(g){return Math.max(0,-dt(Math.abs(g)))}function bL(g,A){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(dt(A)/3)))*3-dt(Math.abs(g)))}function TL(g,A){return g=Math.abs(g),A=Math.abs(A)-g,Math.max(0,dt(A)-dt(g))+1}function WL(g){for(var A=-1,I=g.length,B,Q=g[I-1],C=0;++A<I;)B=Q,Q=g[A],C+=B[1]*Q[0]-B[0]*Q[1];return C/2}function Gc(g,A){switch(arguments.length){case 0:break;case 1:this.range(g);break;default:this.range(A).domain(g);break}return this}var mV=Symbol("implicit");function wJ(){var g=new ac,A=[],I=[],B=mV;function Q(C){let E=g.get(C);if(E===void 0){if(B!==mV)return B;g.set(C,E=A.push(C)-1)}return I[E%I.length]}return Q.domain=function(C){if(!arguments.length)return A.slice();A=[],g=new ac;for(let E of C)g.has(E)||g.set(E,A.push(E)-1);return Q},Q.range=function(C){return arguments.length?(I=Array.from(C),Q):I.slice()},Q.unknown=function(C){return arguments.length?(B=C,Q):B},Q.copy=function(){return wJ(A,I).unknown(B)},Gc.apply(Q,arguments),Q}function Ko(){var g=wJ().unknown(void 0),A=g.domain,I=g.range,B=0,Q=1,C,E,o=!1,e=0,a=0,D=.5;delete g.unknown;function n(){var G=A().length,w=Q<B,h=w?Q:B,F=w?B:Q;C=(F-h)/Math.max(1,G-e+a*2),o&&(C=Math.floor(C)),h+=(F-h-C*(G-e))*D,E=C*(1-e),o&&(h=Math.round(h),E=Math.round(E));var N=Ki(G).map(function(l){return h+C*l});return I(w?N.reverse():N)}return g.domain=function(G){return arguments.length?(A(G),n()):A()},g.range=function(G){return arguments.length?([B,Q]=G,B=+B,Q=+Q,n()):[B,Q]},g.rangeRound=function(G){return[B,Q]=G,B=+B,Q=+Q,o=!0,n()},g.bandwidth=function(){return E},g.step=function(){return C},g.round=function(G){return arguments.length?(o=!!G,n()):o},g.padding=function(G){return arguments.length?(e=Math.min(1,a=+G),n()):e},g.paddingInner=function(G){return arguments.length?(e=Math.min(1,G),n()):e},g.paddingOuter=function(G){return arguments.length?(a=+G,n()):a},g.align=function(G){return arguments.length?(D=Math.max(0,Math.min(1,G)),n()):D},g.copy=function(){return Ko(A(),[B,Q]).round(o).paddingInner(e).paddingOuter(a).align(D)},Gc.apply(n(),arguments)}function ZL(g){return function(){return g}}function PL(g){return+g}var xV=[0,1];function wc(g){return g}function OL(g,A){return(A-=g=+g)?function(I){return(I-g)/A}:ZL(isNaN(A)?NaN:.5)}function LcA(g,A){var I;return g>A&&(I=g,g=A,A=I),function(B){return Math.max(g,Math.min(A,B))}}function HcA(g,A,I){var B=g[0],Q=g[1],C=A[0],E=A[1];return Q<B?(B=OL(Q,B),C=I(E,C)):(B=OL(B,Q),C=I(C,E)),function(o){return C(B(o))}}function fcA(g,A,I){var B=Math.min(g.length,A.length)-1,Q=new Array(B),C=new Array(B),E=-1;for(g[B]<g[0]&&(g=g.slice().reverse(),A=A.slice().reverse());++E<B;)Q[E]=OL(g[E],g[E+1]),C[E]=I(A[E],A[E+1]);return function(o){var e=wL(g,o,1,B)-1;return C[e](Q[e](o))}}function bV(g,A){return A.domain(g.domain()).range(g.range()).interpolate(g.interpolate()).clamp(g.clamp()).unknown(g.unknown())}function ucA(){var g=xV,A=xV,I=xD,B,Q,C,E=wc,o,e,a;function D(){var G=Math.min(g.length,A.length);return E!==wc&&(E=LcA(g[0],g[G-1])),o=G>2?fcA:HcA,e=a=null,n}function n(G){return G==null||isNaN(G=+G)?C:(e||(e=o(g.map(B),A,I)))(B(E(G)))}return n.invert=function(G){return E(Q((a||(a=o(A,g.map(B),WQ)))(G)))},n.domain=function(G){return arguments.length?(g=Array.from(G,PL),D()):g.slice()},n.range=function(G){return arguments.length?(A=Array.from(G),D()):A.slice()},n.rangeRound=function(G){return A=Array.from(G),I=YL,D()},n.clamp=function(G){return arguments.length?(E=G?!0:wc,D()):E!==wc},n.interpolate=function(G){return arguments.length?(I=G,D()):I},n.unknown=function(G){return arguments.length?(C=G,n):C},function(G,w){return B=G,Q=w,D()}}function VL(){return ucA()(wc,wc)}function vL(g,A,I,B){var Q=hL(g,A,I),C;switch(B=es(B??",f"),B.type){case"s":{var E=Math.max(Math.abs(g),Math.abs(A));return B.precision==null&&!isNaN(C=bL(Q,E))&&(B.precision=C),GJ(B,E)}case"":case"e":case"g":case"p":case"r":{B.precision==null&&!isNaN(C=TL(Q,Math.max(Math.abs(g),Math.abs(A))))&&(B.precision=C-(B.type==="e"));break}case"f":case"%":{B.precision==null&&!isNaN(C=xL(Q))&&(B.precision=C-(B.type==="%")*2);break}}return cJ(B)}function mcA(g){var A=g.domain;return g.ticks=function(I){var B=A();return WM(B[0],B[B.length-1],I??10)},g.tickFormat=function(I,B){var Q=A();return vL(Q[0],Q[Q.length-1],I??10,B)},g.nice=function(I){I==null&&(I=10);var B=A(),Q=0,C=B.length-1,E=B[Q],o=B[C],e,a,D=10;for(o<E&&(a=E,E=o,o=a,a=Q,Q=C,C=a);D-- >0;){if(a=rN(E,o,I),a===e)return B[Q]=E,B[C]=o,A(B);if(a>0)E=Math.floor(E/a)*a,o=Math.ceil(o/a)*a;else if(a<0)E=Math.ceil(E*a)/a,o=Math.floor(o*a)/a;else break;e=a}return g},g}function qo(){var g=VL();return g.copy=function(){return bV(g,qo())},Gc.apply(g,arguments),mcA(g)}function as(g,A,I){this.k=g,this.x=A,this.y=I}as.prototype={constructor:as,scale:function(g){return g===1?this:new as(this.k*g,this.x,this.y)},translate:function(g,A){return g===0&A===0?this:new as(this.k,this.x+this.k*g,this.y+this.k*A)},apply:function(g){return[g[0]*this.k+this.x,g[1]*this.k+this.y]},applyX:function(g){return g*this.k+this.x},applyY:function(g){return g*this.k+this.y},invert:function(g){return[(g[0]-this.x)/this.k,(g[1]-this.y)/this.k]},invertX:function(g){return(g-this.x)/this.k},invertY:function(g){return(g-this.y)/this.k},rescaleX:function(g){return g.copy().domain(g.range().map(this.invertX,this).map(g.invert,g))},rescaleY:function(g){return g.copy().domain(g.range().map(this.invertY,this).map(g.invert,g))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var jL=new as(1,0,0);XL.prototype=as.prototype;function XL(g){for(;!g.__zoom;)if(!(g=g.parentNode))return jL;return g.__zoom}var hJ=(g,A,I,B,Q)=>{let C=Math.floor(g/Q),E=Math.floor(A/Q),o=Math.floor(I/Q),e=Math.floor(B/Q),a=[];for(let D=C;D<=E;D++)for(let n=o;n<=e;n++)a.push({tileX:D,tileY:n,name:`${D}_${n}`});return a};var aI=(g,A)=>{g.cat=A},NJ=(g,A,I)=>{g.cell_cats=A.getChild(I).toArray()},TV=(g,A)=>{g.cell_cats=A.map(I=>I==="nan"?null:I)},kJ=g=>{g.cell_names_array.forEach((A,I)=>{g.dict_cell_cats[A]=g.cell_cats[I]})},lI=(g,A,I)=>{g.reset_cat=A.length===g.selected_cats.length&&A.every((B,Q)=>B===g.selected_cats[Q]),g.selected_cats=g.reset_cat?[]:A,I.selected_cats.set(g.selected_cats)};var RI=(g,A,I)=>{let B=A.length===g.selected_genes.length&&A.every((Q,C)=>Q===g.selected_genes[C]);g.selected_genes=B?[]:A,I.selected_genes.set(g.selected_genes)},yJ=(g,A)=>{g.model&&typeof g.model.set=="function"&&(g.model.set("selected_genes",A),g.model.save_changes()),g.obs_store&&g.obs_store.selected_genes&&g.obs_store.selected_genes.set(A)};var WV=async(g,A,I,B=null)=>{let Q;if(g.get(A))Q=g.get(A);else try{let C=B!==null?await B.fetch(A):await fetch(A,I.fetch);if(!C.ok)throw new Error(`Network response was not ok: ${C.statusText}`);let E=await C.arrayBuffer();Q=ri(E),g.set(A,Q)}catch(C){gB(C,{context:`fetching or parsing Arrow data from ${A}`,url:A,logUnexpected:!0,throwOnAuth:!1}),Q=null}return Q};var FJ=async(g,A,I,B)=>Promise.all(A.map(Q=>WV(g,Q,I,B)));var ZV=g=>{let A=g.getChildAt(0);if(A.data[0].type.typeId===12){let I=A.data[0].valueOffsets,B=A.getChildAt(0).data[0].valueOffsets,C=A.getChildAt(0).getChildAt(0).getChildAt(0).data[0].values,E=new Int32Array(I.length);for(let e=0;e<E.length;++e)E[e]=B[I[e]];return{length:g.numRows,startIndices:E,attributes:{getPolygon:{value:C,size:2}}}}else return null};var PV=g=>{g=g.filter(I=>I!=null);let A={length:0,startIndices:new Int32Array,attributes:{getPolygon:{value:new Float64Array,size:2}}};return g.forEach((I,B)=>{A.length+=I.length;let Q=A.attributes.getPolygon.value.length/2,C=I.startIndices;if(B>0){C=new Int32Array(I.startIndices.length);for(let E=0;E<I.startIndices.length;E++)C[E]=I.startIndices[E]+Q}A.startIndices=new Int32Array([...A.startIndices,...C.slice(B>0?1:0)]),A.attributes.getPolygon.value=new Float64Array([...A.attributes.getPolygon.value,...I.attributes.getPolygon.value])}),A},OV=g=>{if(g.length===0)return null;let A=g[0];for(let I=1;I<g.length;I++)A=A.concat(g[I]);return A};var VV=g=>{let A=[],{startIndices:I,attributes:B}=g,Q=B.getPolygon.value,C=I.length-1;for(let E=0;E<C;++E){let o=I[E]*2,e=I[E+1]*2,a=[];for(let D=o;D<e;D+=2){let n=Q[D],G=Q[D+1];a.push([n,G])}A.push(a)}return A};var vV=async(g,A,I)=>{let B;I.seg.version==="default"?B=`${g}/cell_segmentation`:B=`${g}/cell_segmentation_${I.seg.version}`;let Q=A.map(D=>`${B}/cell_tile_${D.tileX}_${D.tileY}.parquet`),E=(await FJ(I.cache.cell,Q,zg,I.aws)).filter(D=>D!==null);I.vector_name_integer?I.cats.polygon_cell_names=E.flatMap(D=>Array.from(D.getChild("name").toArray()).map(G=>I.cats.nameMapping_inv[G])):I.cats.polygon_cell_names=E.flatMap(D=>Array.from(D.getChild("name").toArray()));let o=E.map(D=>ZV(D)),e=PV(o);return VV(e)};var xcA=(g,A,I)=>{let B=g.polygon_cell_names[I.index],Q=g.dict_cell_cats[B],C;Q in g.color_dict_cluster?C=g.color_dict_cluster[Q]:C=[0,0,255];let E=g.selected_cats.length===0||g.selected_cats.includes(Q)?255:50;return[...C,E]},lJ=g=>new No({id:"path-layer",data:[],pickable:!0,widthScale:3,widthMinPixels:1,getPath:I=>I,getColor:(I,B)=>xcA(g.cats,I,B),widthUnits:"pixels",...hQ(g.rotation)}),bcA=async(g,A,I,B,Q)=>{let C=Q.cats.polygon_cell_names[g.index],E=Q.cats.dict_cell_cats[C];Q.obs_store.deck_check.set({...Q.obs_store.deck_check.get(),cell_layer:!1,path_layer:!1,trx_layer:!1}),aI(Q.cats,"cluster"),lI(Q.cats,[E],Q.obs_store),RI(Q.genes,[],Q.obs_store)},RJ=async(g,A,I,B)=>{let Q=await vV(g,A,B);I.path_layer=I.path_layer.clone({data:Q}),B.layers_obj=I,B.obs_store.deck_check.set({...B.obs_store.deck_check.get(),path_data:!0})},MJ=(g,A,I)=>{A.path_layer=A.path_layer.clone({onClick:(B,Q)=>bcA(B,Q,g,A,I)})},hc=(g,A)=>{g.path_layer=g.path_layer.clone({visible:A})},WD=(g,A)=>{g.path_layer=g.path_layer.clone({pickable:A})};var ZB=async(g,A,I)=>{try{let Q=await(I!==null?await I.fetch(g):await fetch(g,A)).arrayBuffer();return ri(Q)}catch(B){return gB(B,{context:"loading arrow table data",url:g,logUnexpected:!0,throwOnAuth:!1}),[]}};function jV(g,A){let I=Math.log1p(g),B=Math.log1p(A);return I/B*255}var di=async(g,A,I,B,Q,C,E)=>{let o;Q==="default"?o=`${I}/cbg/${B}.parquet`:o=`${I}/cbg_${Q}/${B}.parquet`;let e=await ZB(o,zg.fetch,E),a=e.getChild("__index_level_0__").toArray(),D=e.getChild(B).toArray(),n=new Array(g.cell_names_array.length).fill(0),G=g.meta_cell_id_set&&g.meta_cell_id_set.size>0?g.meta_cell_id_set:null,w=new Set,h=new Set;a.forEach((F,N)=>{F=String(F);let l=Number(D[N]),p=Number(A.meta_gene[B].max);if(C)if(F in g.nameMapping_inv){let R=String(g.nameMapping_inv[F]);(!G||G.has(R))&&(n[F]=jV(l,p))}else h.add(F);else if(g.cell_name_to_index_map.has(F)){let R=g.cell_name_to_index_map.get(F);(!G||G.has(F))&&(n[R]=jV(l,p))}else w.add(F)}),w.size>0,h.size>0,g.cell_exp_array=n};var ss=g=>{try{let A=g.getChild("geometry").getChildAt(0).data.map(Q=>Q.values).reduce((Q,C)=>{let E=new Float64Array(Q.length+C.length);return E.set(Q),E.set(C,Q.length),E},new Float64Array(0)),I=A.length/g.numRows;return{length:g.numRows,attributes:{getPosition:{value:A,size:I}}}}catch(A){return gB(A,{context:"processing scatter data from arrow table",logUnexpected:!0,throwOnAuth:!1}),[]}};var XV=async(g,A,I)=>{let B=A.map(D=>`${g}/transcript_tiles/transcripts_tile_${D.tileX}_${D.tileY}.parquet`),C=(await FJ(I.cache.trx,B,zg,I.aws)).filter(D=>D!==null),E=OV(C),o=[];I.vector_name_integer?o=Array.from(E.getChild("name").toArray()).map(D=>I.genes.g_nameMapping_inv[D]):o=E.getChild("name").toArray(),I.genes.trx_names_array=o;let e=ss(E),a=e.attributes.getPosition.value;return I.combo_data.trx=I.genes.trx_names_array.map((D,n)=>({name:D,x:a[n*2],y:a[n*2+1]})),e};var TcA=async(g,A,I,B,Q)=>{let C=Q.genes.trx_names_array[g.index];if(!C)return;let o=C===Q.cats.cat?"cluster":C;aI(Q.cats,o),Q.obs_store.deck_check.set({...Q.obs_store.deck_check.get(),cell_layer:!1,trx_layer:!1}),RI(Q.genes,[C],Q.obs_store),lI(Q.cats,[C],Q.obs_store),await di(Q.cats,Q.genes,Q.global_base_url,C,Q.seg.version,Q.vector_name_integer,Q.aws)},JJ=g=>{let{genes:A}=g;return new wQ({id:"trx-layer",data:A.trx_data,pickable:!0,getFillColor:(B,Q)=>{let C=A.trx_names_array[Q.index],E=A.color_dict_gene[C],o=A.selected_genes.length===0||A.selected_genes.includes(C)?255:5;return[...E,o]},...hQ(g.rotation)})},pJ=(g,A,I)=>{A.trx_layer=A.trx_layer.clone({onClick:(B,Q)=>TcA(B,Q,g,A,I)})},YJ=async(g,A,I,B)=>{B.genes.trx_data=await XV(g,A,B),I.trx_layer=I.trx_layer.clone({data:B.genes.trx_data}),B.layers_obj=I,B.obs_store.deck_check.set({...B.obs_store.deck_check.get(),trx_layer:!0,trx_data:!0})},qt=(g,A)=>{g.trx_layer=g.trx_layer.clone({visible:A})},Nc=(g,A)=>{g.trx_layer=g.trx_layer.clone({getRadius:A})},ZD=(g,A)=>{g.trx_layer=g.trx_layer.clone({pickable:A})};var KJ=async({height:g,width:A,zoom:I,target:B},Q,C,E)=>{let o=E.close_up,{tile_size:e}=E.img.landscape_parameters,a=Math.pow(2,I),[D,n]=B,G=A/(2*a),w=g/(2*a);E.bounds={},E.bounds.min_x=D-G,E.bounds.max_x=D+G,E.bounds.min_y=n-w,E.bounds.max_y=n+w;let h=Q.viewManager.getViewports();if(!h||h.length===0)return;let F=(()=>{if(!E.rotation?.hasRotation)return E.bounds;let l=[[E.bounds.min_x,E.bounds.min_y],[E.bounds.min_x,E.bounds.max_y],[E.bounds.max_x,E.bounds.min_y],[E.bounds.max_x,E.bounds.max_y]].map(([y,Y])=>B4(y,Y,E.rotation)),p=l.map(([y])=>y),R=l.map(([,y])=>y);return{min_x:Math.min(...p),max_x:Math.max(...p),min_y:Math.min(...R),max_y:Math.max(...R)}})(),N=hJ(F.min_x,F.max_x,F.min_y,F.max_y,e);if(N.length<E.max_tiles_to_view){E.obs_store.deck_check.set({...E.obs_store.deck_check.get(),trx_data:!1,path_data:!1}),E.close_up=!0,await YJ(E.global_base_url,N,C,E),await RJ(E.global_base_url,N,C,E);let R=E.combo_data.trx.filter(f=>{if(!E.rotation?.hasRotation)return f.x>=E.bounds.min_x&&f.x<=E.bounds.max_x&&f.y>=E.bounds.min_y&&f.y<=E.bounds.max_y;let[K,x]=RU(f.x,f.y,E.rotation);return K>=E.bounds.min_x&&K<=E.bounds.max_x&&x>=E.bounds.min_y&&x<=E.bounds.max_y}).map(f=>f.name).reduce((f,K)=>{let x=f.find(u=>u.name===K);return x?x.value+=1:f.push({name:K,value:1}),f},[]).filter(f=>f.value>0).sort((f,K)=>K.value-f.value).slice(0,100);E.obs_store.new_gene_bar_data.set(R);let d=E.combo_data.cell.filter(f=>{if(!E.rotation?.hasRotation)return f.x>=E.bounds.min_x&&f.x<=E.bounds.max_x&&f.y>=E.bounds.min_y&&f.y<=E.bounds.max_y;let[K,x]=RU(f.x,f.y,E.rotation);return K>=E.bounds.min_x&&K<=E.bounds.max_x&&x>=E.bounds.min_y&&x<=E.bounds.max_y}).map(f=>f.cat).reduce((f,K)=>{let x=f.find(u=>u.name===K);return x?x.value+=1:f.push({name:K,value:1}),f},[]).filter(f=>f.value>0).sort((f,K)=>K.value-f.value);E.obs_store.new_cell_bar_data.set(d)}else o&&(E.obs_store.deck_check.set({...E.obs_store.deck_check.get(),trx_data:!1,path_data:!1}),E.close_up=!1,E.obs_store.deck_check.set({...E.obs_store.deck_check.get(),trx_data:!0,path_data:!0}),E.obs_store.new_gene_bar_data.set(E.genes.top_gene_counts),E.obs_store.new_cell_bar_data.set(E.cats.cluster_counts),E.containers.bar_gene.scrollTo({top:0,behavior:"smooth"}),E.containers.bar_cluster.scrollTo({top:0,behavior:"smooth"}));E.layers_obj=C};var zV=(g,A)=>{if(g.index===-1||!g.layer)return null;let I=A.cats.tile_cats_array[g.index];return A.tooltip_cat_cell=I,FL(".deck-tooltip").style("margin-top","75px"),{html:`<div>${I}</div>`}},_V=(g,A)=>{if(A.index===-1||!A.layer)return null;let I="",B="",Q="";if(A.layer.id.startsWith("cell-layer")||A.layer.id.startsWith("path-layer"))B=A.layer.id.startsWith("cell-layer")?g.cats.cell_names_array[A.index]:g.cats.polygon_cell_names[A.index],Q=g.cats.dict_cell_cats[B],I=`<div>cell: ${B}</div><div>cluster: ${Q}</div>`,g.tooltip_cat_cell=Q;else if(A.layer.id.startsWith("trx-layer"))B=g.genes.trx_names_array[A.index],I=`<div>transcript: ${B}</div>`;else if(A.layer.id.startsWith("nbhd-layer"))B=g.nbhd.feature_collection.features[A.index].properties.name,Q=g.nbhd.feature_collection.features[A.index].properties.cat,I=`<div>neighborhood: ${B}</div><div>category: ${Q}</div>`;else if(A.layer.id.startsWith("edit-layer")){let E=g.edit?.feature_collection?.features?.[A.index];E&&(B=E.properties.name||`nbhd_${A.index+1}`,Q=E.properties.cat||B,I=`<div>neighborhood: ${B}</div>`)}let C=g.root.querySelector(".deck-tooltip");if(C){C.style.marginTop="50px";let E=C.parentElement?.parentElement;E&&(E.style.position="unset")}return{html:I}};var kc=(g,A,I=!1)=>{let B;return function(...Q){let C=I&&!B;clearTimeout(B),B=setTimeout(()=>{B=null,I||g.apply(this,Q)},A),C&&g.apply(this,Q)}};var WcA=200,$V=kc(({viewState:g},A,I,B)=>(B.obs_store.umap_state.get()===!1&&KJ(g,A,I,B),B.scale_bar&&B.obs_store.scale_bar_view_state.set(g),typeof B.custom_callbacks.view_change=="function"&&B.custom_callbacks.view_change(g,B.close_up,I.trx_layer),g),WcA);var ZcA=({isDragging:g})=>g?"grabbing":"pointer",dJ=(g,A,I,B="")=>{let Q={doubleClickZoom:!1};return B==="point-cloud"&&(Q.type=Ue),new ma({parent:g,controller:Q,getCursor:ZcA,width:A,height:I})},qJ=(g,A)=>{g.setProps({views:A})},UJ=(g,A)=>{g.setProps({getTooltip:I=>_V(A,I)})},Av=(g,A,I)=>{g.setProps({onViewStateChange:B=>{$V(B,g,A,I)}})},gv=(g,A,I,B,Q,C,E=0,o=0)=>{let{center_x:e,center_y:a,center_z:D=0,ini_zoom:n}=C.spatial;A===0&&I===0&&B===0&&Q===0&&(A=e,I=a,B=D,Q=n);let G={target:[A,I,B],zoom:Q};C.img.landscape_parameters.technology==="point-cloud"&&(G.rotationOrbit=E,G.rotationX=o),g.setProps({initialViewState:G}),C.scale_bar&&C.obs_store.scale_bar_view_state.set(G)};var yc=g=>{let A=[0,0,0,255],{width:I,height:B}=g.dimensions;return new Pa({id:"background-layer",data:[{polygon:[[0,0],[I,0],[I,B],[0,B]]}],getPolygon:C=>C.polygon,getFillColor:A,pickable:!1,...hQ(g.rotation)})},SJ=(g,A)=>{g.background_layer=g.background_layer.clone({visible:A})};var LJ=(g,A)=>{g.cell_names_array=A.getChild("name").toArray();let I=g.cell_names_array.reduce((B,Q,C)=>(B[C]=Q,B),{});g.nameMapping_inv=I},HJ=g=>{g.cell_names_array.forEach((A,I)=>{A=String(A),g.cell_name_to_index_map.set(A,I)})};var _E=g=>(g=g.replace(/^#/,""),g.length===3&&(g=g.replace(/./g,"$&$&")),g.length===6?[0,2,4].map(A=>parseInt(g.substr(A,2),16)):[0,0,0]),PcA=g=>{if(!g||!Array.isArray(g)||g.length<3)return"#808080";let A=C=>Math.max(0,Math.min(255,Math.round(C))),I=A(g[0]).toString(16).padStart(2,"0"),B=A(g[1]).toString(16).padStart(2,"0"),Q=A(g[2]).toString(16).padStart(2,"0");return`#${I}${B}${Q}`},Fc=()=>{let g=Math.floor(Math.random()*256),A=Math.floor(Math.random()*256),I=Math.floor(Math.random()*256);return PcA([g,A,I])};var fJ=async(g,A,I,B)=>{let Q;I==="default"?Q=`${A}/meta_gene.parquet`:Q=`${A}/meta_gene_${I}.parquet`;let C=await ZB(Q,zg.fetch,B),E=[],o=[],e=C.getChild("__index_level_0__"),a=C.getChild("color");e&&a&&(E=e.toArray(),o=a.toArray()),E.forEach((D,n)=>{g.color_dict_gene[D]=_E(o[n])}),g.gene_names=E};var uJ=(g,A)=>{let I,B,Q,C;["Chromium","point-cloud"].includes(g.img.landscape_parameters.technology)?(I=0,B=1e4,Q=0,C=1e4):{x_min:I,x_max:B,y_min:Q,y_max:C}=g.spatial;let E=B-I,o=C-Q,e=Math.max(E,o),a=(B-I)/2,D=(C-Q)/2,n=FQ(A.map(Y=>Y.umap[0])),G=bI(A.map(Y=>Y.umap[0])),w=FQ(A.map(Y=>Y.umap[1])),h=bI(A.map(Y=>Y.umap[1])),F=G-n,N=h-w;A.forEach(Y=>{Y.umap[0]=(Y.umap[0]-n)/F*e,Y.umap[1]=(Y.umap[1]-w)/N*e}),n=FQ(A.map(Y=>Y.umap[0])),G=bI(A.map(Y=>Y.umap[0])),w=FQ(A.map(Y=>Y.umap[1])),h=bI(A.map(Y=>Y.umap[1]));let l=(G-n)/2,p=(h-w)/2,R=a-l,y=D-p;return A.forEach(Y=>{Y.umap[0]=Y.umap[0]+R,Y.umap[1]=Y.umap[1]+y}),A};var OcA=async(g,A,I,B,Q)=>{let C="ontouchstart"in window||navigator.maxTouchPoints>0,E;C?E=Q.cats.cell_cats[g.index]:E=Q.tooltip_cat_cell,aI(Q.cats,"cluster"),Q.obs_store.deck_check.set({...Q.obs_store.deck_check.get(),cell_layer:!1,path_layer:!1,trx_layer:!1}),lI(Q.cats,[E],Q.obs_store),RI(Q.genes,[],Q.obs_store)},Iv=(g,A,I,B)=>{let Q=A??new Set,C=Q.size>0,E=g.cell_names_array[B.index],o=C&&Q.has(E),e;if(g.cat==="cluster")try{let D=g.cell_cats[B.index],n=g.color_dict_cluster[D],G=g.selected_cats.length===0||g.selected_cats.includes(D)?255:10;Array.isArray(n)||(n=[0,0,0],G=0),e=[...n,G]}catch{e=[0,0,0,10]}else try{e=[255,0,0,g.cell_exp_array[B.index]]}catch{e=[255,0,0,10]}return C?o?[0,0,255,255]:[...e.slice(0,3),10]:e},mJ=async(g,A)=>{let I;A.seg.version==="default"?I=`${g}/cell_metadata.parquet`:I=`${g}/cell_metadata_${A.seg.version}.parquet`;let B=await ZB(I,zg.fetch,A.aws);if(LJ(A.cats,B),A.spatial.cell_scatter_data=ss(B),await fJ(A.genes,g,A.seg.version,A.aws),HJ(A.cats),A.cats.has_meta_cell){let h=A.cats.meta_cell_attr.indexOf(A.cats.inst_cell_attr);A.cats.cell_cats=A.cats.cell_names_array.map(F=>A.cats.meta_cell[F]?.[h]??"N.A.")}else{let h=await ZB(`${g}/cell_clusters${A.seg.version&&A.seg.version!=="default"?`_${A.seg.version}`:""}/cluster.parquet`,zg.fetch,A.aws);NJ(A.cats,h,"cluster")}kJ(A.cats);let Q=B.getChild("name").toArray(),C=A.spatial.cell_scatter_data.attributes.getPosition.value,E=A.spatial.cell_scatter_data.attributes.getPosition.size||2;A.combo_data.cell=Q.map((h,F)=>({name:h,cat:A.cats.dict_cell_cats[h],x:C[F*E],y:C[F*E+1],z:E===3?C[F*E+2]:0}));let o;if(A.umap.has_umap){let h=new Float64Array(A.cats.cell_names_array.flatMap(N=>{let l;return A.umap.umap[N]?l=A.umap.umap[N]:l=[0,0],l})),F=A.spatial.cell_scatter_data.length;o=Array.from({length:F},(N,l)=>({name:A.cats.cell_names_array[l],position:E===3?[C[l*E],C[l*E+1],C[l*E+2]]:[C[l*E],C[l*E+1]],umap:[h[l*2],h[l*2+1]]})),A.spatial.x_min=FQ(o.map(N=>N.position[0])),A.spatial.x_max=bI(o.map(N=>N.position[0])),A.spatial.y_min=FQ(o.map(N=>N.position[1])),A.spatial.y_max=bI(o.map(N=>N.position[1])),E===3&&(A.spatial.z_min=FQ(o.map(N=>N.position[2])),A.spatial.z_max=bI(o.map(N=>N.position[2]))),o=uJ(A,o)}else{let h=A.spatial.cell_scatter_data.length;o=Array.from({length:h},(F,N)=>({name:A.cats.cell_names_array[N],position:E===3?[C[N*E],C[N*E+1],C[N*E+2]]:[C[N*E],C[N*E+1]]})),A.spatial.x_min=FQ(o.map(F=>F.position[0])),A.spatial.x_max=bI(o.map(F=>F.position[0])),A.spatial.y_min=FQ(o.map(F=>F.position[1])),A.spatial.y_max=bI(o.map(F=>F.position[1])),E===3&&(A.spatial.z_min=FQ(o.map(F=>F.position[2])),A.spatial.z_max=bI(o.map(F=>F.position[2])))}A.spatial.center_x=(A.spatial.x_max+A.spatial.x_min)/2,A.spatial.center_y=(A.spatial.y_max+A.spatial.y_min)/2,E===3&&(A.spatial.center_z=(A.spatial.z_max+A.spatial.z_min)/2,A.spatial.data_depth=A.spatial.z_max-A.spatial.z_min),A.spatial.data_width=A.spatial.x_max-A.spatial.x_min,A.spatial.data_height=A.spatial.y_max-A.spatial.y_min;let e=A.root.clientWidth,a=A.root.clientHeight,D=A.root.clientWidth,n=A.containers.root_dim.height;A.spatial.scale_x=D/A.spatial.data_width,A.spatial.scale_y=n/A.spatial.data_height,A.spatial.scale=Math.min(A.spatial.scale_x,A.spatial.scale_y),A.img.landscape_parameters.technology!=="Chromium"?(A.spatial.ini_zoom=Math.log2(A.spatial.scale)*1.01,A.spatial.ini_x=A.spatial.center_x,A.spatial.ini_y=A.spatial.center_y,E===3&&(A.spatial.ini_z=A.spatial.center_z)):(A.spatial.ini_zoom=Math.log2(D/5e3)*.95,A.spatial.ini_x=5e3,A.spatial.ini_y=5e3),A.spatial.cell_scatter_data_objects=o;let G={getPosition:{duration:3e3,easing:YE}},w;return A.img.landscape_parameters.technology==="point-cloud"?w=new Pl({id:"cell-layer",sizeUnits:"meters",pointSize:5,pickable:!0,getColor:(h,F)=>Iv(A.cats,A.highlighted_cells,h,F),data:A.spatial.cell_scatter_data_objects,transitions:G,getPosition:h=>A.obs_store.umap_state.get()?h.umap:h.position,updateTriggers:{getPosition:[A.obs_store.umap_state.get()],getFillColor:[A.selection_token]},opacity:1,...hQ(A.rotation)}):w=new wQ({id:"cell-layer",radiusMinPixels:1,getRadius:5,pickable:!0,getFillColor:(h,F)=>Iv(A.cats,A.highlighted_cells,h,F),data:A.spatial.cell_scatter_data_objects,transitions:G,getPosition:h=>A.obs_store.umap_state.get()?h.umap:h.position,updateTriggers:{getPosition:[A.obs_store.umap_state.get()],getFillColor:[A.selection_token]},...hQ(A.rotation)}),w},xJ=(g,A,I)=>{A.cell_layer=A.cell_layer.clone({onClick:(B,Q)=>OcA(B,Q,g,A,I)})},PD=(g,A)=>{g.cell_layer=g.cell_layer.clone({visible:A})},VcA=2,Bv=(g,A,I)=>{I.img.landscape_parameters.technology==="point-cloud"?g.cell_layer=g.cell_layer.clone({pointSize:A/VcA}):g.cell_layer=g.cell_layer.clone({getRadius:A})},OD=(g,A)=>{g.cell_layer=g.cell_layer.clone({pickable:A})},Qv=(g,A,I)=>{A.cell_layer=A.cell_layer.clone({updateTriggers:{getPosition:[I.obs_store.umap_state.get()]}})};var vcA=(g,A,I=0,B="")=>{let{max_pyramid_zoom:Q}=g.img.landscape_parameters,C=5,E=`${A.button_name}-ds${I}${B?`-${B}`:""}`;return new YD({id:E,tileSize:g.dimensions.tileSize,refinementStrategy:"no-overlap",minZoom:-7,maxZoom:0,maxCacheSize:0,maxRequests:6,extent:[0,0,g.dimensions.width,g.dimensions.height],getTileData:h0(g.global_base_url,A.name,g.img.image_format,Q,zg,g.aws),renderSubLayers:HR(g.dimensions,A.color,C),...hQ(g.rotation)})},bJ=async(g,A=0)=>{let{image_info:I}=g.img,B=Date.now().toString(36);return I.length===1&&(I[0].name==="h_and_e"||I[0].name==="h&e")?[await Pn(g,I[0],A,B)]:I.map(C=>vcA(g,C,A,B))},TJ=(g,A)=>{g.image_layers=g.image_layers.map(I=>I.clone({visible:A}))},Cv=(g,A,I)=>{g.image_layers=g.image_layers.map(B=>B.id.startsWith(A)?B.clone({visible:I}):B)},Ev=(g,A,I,B,Q)=>{let C=Q[I];A.image_layers=A.image_layers.map(E=>E.id.startsWith(I)?E.clone({renderSubLayers:HR(g.dimensions,C,B),id:`${I}-${B}`}):E)},iv=async(g,A,I,B=null)=>{let{image_info:Q}=g.img,{max_pyramid_zoom:C,tile_size:E}=g.img.landscape_parameters,o=B||Date.now().toString(36),e=[],a=I/2,D=Math.max(E*3,I*.5);return console.log(`Yearbook: Creating image layers for ${A.length} portraits, data_size=${I.toFixed(0)}, padding=${D.toFixed(0)}`),A.forEach((n,G)=>{let w=[Math.max(0,n.x-a-D),Math.max(0,n.y-a-D),Math.min(g.dimensions.width,n.x+a+D),Math.min(g.dimensions.height,n.y+a+D)];Q.forEach(h=>{let N=`yb-${h.button_name}-p${G}-${o}`,l=new YD({id:N,tileSize:g.dimensions.tileSize,refinementStrategy:"no-overlap",minZoom:-7,maxZoom:0,maxCacheSize:50,maxRequests:6,extent:w,getTileData:h0(g.global_base_url,h.name,g.img.image_format,C,zg,g.aws),renderSubLayers:HR(g.dimensions,h.color,5),...hQ(g.rotation)});e.push(l)})}),console.log(`Yearbook: Created ${e.length} image layers total`),e};var zL=class extends wQ{getShaders(){let A=super.getShaders();return A.fs=`#version 300 es
1762
+ `),{...A,inject:{...A.inject||{},"vs:#decl":(A.inject?.["vs:#decl"]||"").concat("uniform float pickingLineWidthExtraPixels;")}}}draw(A){super.draw({...A,uniforms:{...A.uniforms,pickingLineWidthExtraPixels:this.props.pickingLineWidthExtraPixels}})}};ec.defaultProps=$DA;ec.layerName="EditablePathLayer";var ArA=[0,0,0,153],grA=[0,0,0,144],IrA=[0,0,0,255],BrA=[0,0,144,144],QrA=[144,144,144,255],CrA=[144,144,144,144],ErA=[192,0,0,255],irA=[0,0,0,128],orA=[124,0,192,255],trA=[255,255,255,255],erA=5,arA=3,srA=7,DrA=32*DN,H1=zE;function pt(g){return!g||typeof g!="function"?g:A=>g(rrA(A))}function rrA(g){return g.__source?g.__source.object:g.sourceFeature?g.sourceFeature.feature:g}function L1(g){switch(g.properties.editHandleType){case"existing":return ErA;case"snap-source":return orA;case"intermediate":default:return irA}}function nrA(g){return trA}function crA(g){switch(g.properties.editHandleType){case"existing":return erA;case"snap":return srA;case"intermediate":default:return arA}}var GrA={mode:H1,onEdit:()=>{},pickable:!0,pickingRadius:10,pickingDepth:5,fp64:!1,filled:!0,stroked:!0,lineWidthScale:DN,lineWidthMinPixels:1,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,pickingLineWidthExtraPixels:0,lineWidthUnits:"pixels",lineJointRounded:!1,lineCapRounded:!1,lineMiterLimit:4,pointRadiusScale:1,pointRadiusMinPixels:2,pointRadiusMaxPixels:Number.MAX_SAFE_INTEGER,getLineColor:(g,A,I)=>A?IrA:ArA,getFillColor:(g,A,I)=>A?BrA:grA,getRadius:g=>g&&g.properties&&g.properties.radius||g&&g.properties&&g.properties.size||1,getLineWidth:g=>g&&g.properties&&g.properties.lineWidth||3,getTentativeLineColor:g=>QrA,getTentativeFillColor:g=>CrA,getTentativeLineWidth:g=>g&&g.properties&&g.properties.lineWidth||3,editHandleType:"point",editHandlePointRadiusScale:1,editHandlePointOutline:!0,editHandlePointStrokeWidth:2,editHandlePointRadiusUnits:"pixels",editHandlePointRadiusMinPixels:4,editHandlePointRadiusMaxPixels:8,getEditHandlePointColor:L1,getEditHandlePointOutlineColor:nrA,getEditHandlePointRadius:crA,editHandleIconAtlas:null,editHandleIconMapping:null,editHandleIconSizeScale:1,editHandleIconSizeUnits:"pixels",getEditHandleIcon:g=>g.properties.editHandleType,getEditHandleIconSize:10,getEditHandleIconColor:L1,getEditHandleIconAngle:0,billboard:!0},wrA={view:bQ,modify:po,translate:new oc(new Rt),transform:new oc(new sN),scale:Pe,rotate:Oe,duplicate:T0,split:v0,extrude:j0,elevation:X0,drawPoint:z0,drawLineString:_0,drawPolygon:zE,drawRectangle:SD,drawSquare:AN,drawRectangleFromCenter:gN,drawSquareFromCenter:IN,drawCircleFromCenter:QN,drawCircleByBoundingBox:CN,drawEllipseByBoundingBox:EN,drawRectangleUsing3Points:iN,drawEllipseUsing3Points:oN,draw90DegreePolygon:tN,drawPolygonByDragging:eN},Yt=class extends tc{constructor(){super(...arguments);U(this,"state")}renderLayers(){let I=this.getSubLayerProps({id:"geojson",data:this.props.data,fp64:this.props.fp64,filled:this.props.filled,stroked:this.props.stroked,lineWidthScale:this.props.lineWidthScale,lineWidthMinPixels:this.props.lineWidthMinPixels,lineWidthMaxPixels:this.props.lineWidthMaxPixels,lineWidthUnits:this.props.lineWidthUnits,lineJointRounded:this.props.lineJointRounded,lineCapRounded:this.props.lineCapRounded,lineMiterLimit:this.props.lineMiterLimit,pointRadiusScale:this.props.pointRadiusScale,pointRadiusMinPixels:this.props.pointRadiusMinPixels,pointRadiusMaxPixels:this.props.pointRadiusMaxPixels,getLineColor:this.selectionAwareAccessor(this.props.getLineColor),getFillColor:this.selectionAwareAccessor(this.props.getFillColor),getPointRadius:this.selectionAwareAccessor(this.props.getRadius),getLineWidth:this.selectionAwareAccessor(this.props.getLineWidth),_subLayerProps:{linestrings:{billboard:this.props.billboard,updateTriggers:{all:[this.props.selectedFeatureIndexes,this.props.mode]}},"polygons-stroke":{billboard:this.props.billboard,pickingLineWidthExtraPixels:this.props.pickingLineWidthExtraPixels,type:ec,updateTriggers:{all:[this.props.selectedFeatureIndexes,this.props.mode]}}},updateTriggers:{getLineColor:[this.props.selectedFeatureIndexes,this.props.mode],getFillColor:[this.props.selectedFeatureIndexes,this.props.mode],getPointRadius:[this.props.selectedFeatureIndexes,this.props.mode],getLineWidth:[this.props.selectedFeatureIndexes,this.props.mode]}}),B=[new He(I)];return B=B.concat(this.createGuidesLayers(),this.createTooltipsLayers()),B}initializeState(){super.initializeState(),this.setState({selectedFeatures:[],editHandles:[]})}shouldUpdateState(I){return super.shouldUpdateState(I)||I.changeFlags.stateChanged}updateState({props:I,oldProps:B,changeFlags:Q,context:C}){if(super.updateState({oldProps:B,props:I,changeFlags:Q,context:C}),Q.propsOrDataChanged&&(Object.keys(B).length===0||I.mode!==B.mode)){let e;if(typeof I.mode=="function"){let a=I.mode;e=new a}else typeof I.mode=="string"?(e=wrA[I.mode],console.warn("Deprecated use of passing `mode` as a string. Pass the mode's class constructor instead.")):e=I.mode;e||(console.warn(`No mode configured for ${String(I.mode)}`),e=new H1),e!==this.state.mode&&this.setState({mode:e,cursor:null})}let E=[];if(Array.isArray(I.selectedFeatureIndexes)&&typeof I.data=="object"&&"features"in I.data){let o=I.data;E=I.selectedFeatureIndexes.map(e=>o.features[e])}this.setState({selectedFeatures:E})}getModeProps(I){return{modeConfig:I.modeConfig,data:I.data,selectedIndexes:I.selectedFeatureIndexes,lastPointerMoveEvent:this.state.lastPointerMoveEvent,cursor:this.state.cursor,onEdit:B=>{this.setNeedsUpdate(),I.onEdit(B)},onUpdateCursor:B=>{this.setState({cursor:B})}}}selectionAwareAccessor(I){return typeof I!="function"?I:B=>I(B,this.isFeatureSelected(B),this.props.mode)}isFeatureSelected(I){return!this.props.data||!this.props.selectedFeatureIndexes||!this.props.selectedFeatureIndexes.length?!1:this.state.selectedFeatures.includes(I)}getPickingInfo({info:I,sourceLayer:B}){return B.id.endsWith("guides")&&(I.isGuide=!0),I}_updateAutoHighlight(I){if(I?.sourceLayer)if(I.isGuide)for(let B of I.sourceLayer.getSubLayers())B.updateAutoHighlight(I);else I.sourceLayer.updateAutoHighlight(I)}createGuidesLayers(){let B=this.getActiveMode().getGuides(this.getModeProps(this.props));if(!B||!B.features.length)return[];let Q={linestrings:{billboard:this.props.billboard,autoHighlight:!1},"polygons-fill":{autoHighlight:!1},"polygons-stroke":{billboard:this.props.billboard}};return this.props.editHandleType==="icon"?Q["points-icon"]={type:Ta,iconAtlas:this.props.editHandleIconAtlas,iconMapping:this.props.editHandleIconMapping,sizeUnits:this.props.editHandleIconSizeUnits,sizeScale:this.props.editHandleIconSizeScale,getIcon:pt(this.props.getEditHandleIcon),getSize:pt(this.props.getEditHandleIconSize),getColor:pt(this.props.getEditHandleIconColor),getAngle:pt(this.props.getEditHandleIconAngle),billboard:this.props.billboard}:Q["points-circle"]={type:wQ,radiusScale:this.props.editHandlePointRadiusScale,stroked:this.props.editHandlePointOutline,getLineWidth:this.props.editHandlePointStrokeWidth,radiusUnits:this.props.editHandlePointRadiusUnits,radiusMinPixels:this.props.editHandlePointRadiusMinPixels,radiusMaxPixels:this.props.editHandlePointRadiusMaxPixels,getRadius:pt(this.props.getEditHandlePointRadius),getFillColor:pt(this.props.getEditHandlePointColor),getLineColor:pt(this.props.getEditHandlePointOutlineColor),billboard:this.props.billboard},[new He(this.getSubLayerProps({id:"guides",data:B,fp64:this.props.fp64,_subLayerProps:Q,lineWidthScale:this.props.lineWidthScale,lineWidthMinPixels:this.props.lineWidthMinPixels,lineWidthMaxPixels:this.props.lineWidthMaxPixels,lineWidthUnits:this.props.lineWidthUnits,lineJointRounded:this.props.lineJointRounded,lineCapRounded:this.props.lineCapRounded,lineMiterLimit:this.props.lineMiterLimit,getLineColor:pt(this.props.getTentativeLineColor),getLineWidth:pt(this.props.getTentativeLineWidth),getFillColor:pt(this.props.getTentativeFillColor),pointType:this.props.editHandleType==="icon"?"icon":"circle",iconAtlas:this.props.editHandleIconAtlas}))]}createTooltipsLayers(){let B=this.getActiveMode().getTooltips(this.getModeProps(this.props));return[new Le({getSize:DrA,...this.getSubLayerProps({id:"tooltips",data:B})})]}onLayerClick(I){this.getActiveMode().handleClick(I,this.getModeProps(this.props))}onLayerKeyUp(I){this.getActiveMode().handleKeyUp(I,this.getModeProps(this.props))}onStartDragging(I){this.getActiveMode().handleStartDragging(I,this.getModeProps(this.props))}onDragging(I){this.getActiveMode().handleDragging(I,this.getModeProps(this.props))}onStopDragging(I){this.getActiveMode().handleStopDragging(I,this.getModeProps(this.props))}onPointerMove(I){this.setState({lastPointerMoveEvent:I}),this.getActiveMode().handlePointerMove(I,this.getModeProps(this.props))}getCursor({isDragging:I}){if(this.state===null||this.state===void 0)return null;let{cursor:B}=this.state;return B||(B=I?"grabbing":"grab"),B}getActiveMode(){return this.state.mode}};U(Yt,"layerName","EditableGeoJsonLayer"),U(Yt,"defaultProps",GrA);var hrA=bQ,NrA=9;var $eg={mode:hrA,...Yt.defaultProps,data:[],selectedIndexes:[],filled:!1,stroked:!0,lineWidthScale:DN,lineWidthMinPixels:1,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,lineWidthUnits:"pixels",getHexagons:g=>g.hexIds,getEditedCluster:(g,A)=>A?{...A,hexIds:g}:{hexIds:g},resolution:NrA};var xM={NONE:null,RECTANGLE:"rectangle",POLYGON:"polygon"},tag={[xM.RECTANGLE]:SD,[xM.POLYGON]:zE},eag={[xM.RECTANGLE]:{dragToDraw:!0}},aag={selectionType:xM.RECTANGLE,layerIds:[],onSelect:()=>{}};function LD(g,A){return g==null||A==null?NaN:g<A?-1:g>A?1:g>=A?0:NaN}function cL(g,A){return g==null||A==null?NaN:A<g?-1:A>g?1:A>=g?0:NaN}function bM(g){let A,I,B;g.length!==2?(A=LD,I=(o,e)=>LD(g(o),e),B=(o,e)=>g(o)-e):(A=g===LD||g===cL?g:krA,I=g,B=g);function Q(o,e,a=0,D=o.length){if(a<D){if(A(e,e)!==0)return D;do{let n=a+D>>>1;I(o[n],e)<0?a=n+1:D=n}while(a<D)}return a}function C(o,e,a=0,D=o.length){if(a<D){if(A(e,e)!==0)return D;do{let n=a+D>>>1;I(o[n],e)<=0?a=n+1:D=n}while(a<D)}return a}function E(o,e,a=0,D=o.length){let n=Q(o,e,a,D-1);return n>a&&B(o[n-1],e)>-B(o[n],e)?n-1:n}return{left:Q,center:E,right:C}}function krA(){return 0}function GL(g){return g===null?NaN:+g}var f1=bM(LD),u1=f1.right,yrA=f1.left,FrA=bM(GL).center,wL=u1;var ac=class extends Map{constructor(A,I=MrA){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:I}}),A!=null)for(let[B,Q]of A)this.set(B,Q)}get(A){return super.get(m1(this,A))}has(A){return super.has(m1(this,A))}set(A,I){return super.set(lrA(this,A),I)}delete(A){return super.delete(RrA(this,A))}};function m1({_intern:g,_key:A},I){let B=A(I);return g.has(B)?g.get(B):I}function lrA({_intern:g,_key:A},I){let B=A(I);return g.has(B)?g.get(B):(g.set(B,I),I)}function RrA({_intern:g,_key:A},I){let B=A(I);return g.has(B)&&(I=g.get(B),g.delete(B)),I}function MrA(g){return g!==null&&typeof g=="object"?g.valueOf():g}var JrA=Math.sqrt(50),prA=Math.sqrt(10),YrA=Math.sqrt(2);function TM(g,A,I){let B=(A-g)/Math.max(0,I),Q=Math.floor(Math.log10(B)),C=B/Math.pow(10,Q),E=C>=JrA?10:C>=prA?5:C>=YrA?2:1,o,e,a;return Q<0?(a=Math.pow(10,-Q)/E,o=Math.round(g*a),e=Math.round(A*a),o/a<g&&++o,e/a>A&&--e,a=-a):(a=Math.pow(10,Q)*E,o=Math.round(g/a),e=Math.round(A/a),o*a<g&&++o,e*a>A&&--e),e<o&&.5<=I&&I<2?TM(g,A,I*2):[o,e,a]}function WM(g,A,I){if(A=+A,g=+g,I=+I,!(I>0))return[];if(g===A)return[g];let B=A<g,[Q,C,E]=B?TM(A,g,I):TM(g,A,I);if(!(C>=Q))return[];let o=C-Q+1,e=new Array(o);if(B)if(E<0)for(let a=0;a<o;++a)e[a]=(C-a)/-E;else for(let a=0;a<o;++a)e[a]=(C-a)*E;else if(E<0)for(let a=0;a<o;++a)e[a]=(Q+a)/-E;else for(let a=0;a<o;++a)e[a]=(Q+a)*E;return e}function rN(g,A,I){return A=+A,g=+g,I=+I,TM(g,A,I)[2]}function hL(g,A,I){A=+A,g=+g,I=+I;let B=A<g,Q=B?rN(A,g,I):rN(g,A,I);return(B?-1:1)*(Q<0?1/-Q:Q)}function bI(g,A){let I;if(A===void 0)for(let B of g)B!=null&&(I<B||I===void 0&&B>=B)&&(I=B);else{let B=-1;for(let Q of g)(Q=A(Q,++B,g))!=null&&(I<Q||I===void 0&&Q>=Q)&&(I=Q)}return I}function FQ(g,A){let I;if(A===void 0)for(let B of g)B!=null&&(I>B||I===void 0&&B>=B)&&(I=B);else{let B=-1;for(let Q of g)(Q=A(Q,++B,g))!=null&&(I>Q||I===void 0&&Q>=Q)&&(I=Q)}return I}function Ki(g,A,I){g=+g,A=+A,I=(Q=arguments.length)<2?(A=g,g=0,1):Q<3?1:+I;for(var B=-1,Q=Math.max(0,Math.ceil((A-g)/I))|0,C=new Array(Q);++B<Q;)C[B]=g+B*I;return C}var KrA={value:()=>{}};function b1(){for(var g=0,A=arguments.length,I={},B;g<A;++g){if(!(B=arguments[g]+"")||B in I||/[\s.]/.test(B))throw new Error("illegal type: "+B);I[B]=[]}return new ZM(I)}function ZM(g){this._=g}function drA(g,A){return g.trim().split(/^|\s+/).map(function(I){var B="",Q=I.indexOf(".");if(Q>=0&&(B=I.slice(Q+1),I=I.slice(0,Q)),I&&!A.hasOwnProperty(I))throw new Error("unknown type: "+I);return{type:I,name:B}})}ZM.prototype=b1.prototype={constructor:ZM,on:function(g,A){var I=this._,B=drA(g+"",I),Q,C=-1,E=B.length;if(arguments.length<2){for(;++C<E;)if((Q=(g=B[C]).type)&&(Q=qrA(I[Q],g.name)))return Q;return}if(A!=null&&typeof A!="function")throw new Error("invalid callback: "+A);for(;++C<E;)if(Q=(g=B[C]).type)I[Q]=x1(I[Q],g.name,A);else if(A==null)for(Q in I)I[Q]=x1(I[Q],g.name,null);return this},copy:function(){var g={},A=this._;for(var I in A)g[I]=A[I].slice();return new ZM(g)},call:function(g,A){if((Q=arguments.length-2)>0)for(var I=new Array(Q),B=0,Q,C;B<Q;++B)I[B]=arguments[B+2];if(!this._.hasOwnProperty(g))throw new Error("unknown type: "+g);for(C=this._[g],B=0,Q=C.length;B<Q;++B)C[B].value.apply(A,I)},apply:function(g,A,I){if(!this._.hasOwnProperty(g))throw new Error("unknown type: "+g);for(var B=this._[g],Q=0,C=B.length;Q<C;++Q)B[Q].value.apply(A,I)}};function qrA(g,A){for(var I=0,B=g.length,Q;I<B;++I)if((Q=g[I]).name===A)return Q.value}function x1(g,A,I){for(var B=0,Q=g.length;B<Q;++B)if(g[B].name===A){g[B]=KrA,g=g.slice(0,B).concat(g.slice(B+1));break}return I!=null&&g.push({name:A,value:I}),g}var NL=b1;var PM="http://www.w3.org/1999/xhtml",kL={svg:"http://www.w3.org/2000/svg",xhtml:PM,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ve(g){var A=g+="",I=A.indexOf(":");return I>=0&&(A=g.slice(0,I))!=="xmlns"&&(g=g.slice(I+1)),kL.hasOwnProperty(A)?{space:kL[A],local:g}:g}function UrA(g){return function(){var A=this.ownerDocument,I=this.namespaceURI;return I===PM&&A.documentElement.namespaceURI===PM?A.createElement(g):A.createElementNS(I,g)}}function SrA(g){return function(){return this.ownerDocument.createElementNS(g.space,g.local)}}function sc(g){var A=Ve(g);return(A.local?SrA:UrA)(A)}function LrA(){}function HD(g){return g==null?LrA:function(){return this.querySelector(g)}}function T1(g){typeof g!="function"&&(g=HD(g));for(var A=this._groups,I=A.length,B=new Array(I),Q=0;Q<I;++Q)for(var C=A[Q],E=C.length,o=B[Q]=new Array(E),e,a,D=0;D<E;++D)(e=C[D])&&(a=g.call(e,e.__data__,D,C))&&("__data__"in e&&(a.__data__=e.__data__),o[D]=a);return new jI(B,this._parents)}function nN(g){return g==null?[]:Array.isArray(g)?g:Array.from(g)}function HrA(){return[]}function cN(g){return g==null?HrA:function(){return this.querySelectorAll(g)}}function frA(g){return function(){return nN(g.apply(this,arguments))}}function W1(g){typeof g=="function"?g=frA(g):g=cN(g);for(var A=this._groups,I=A.length,B=[],Q=[],C=0;C<I;++C)for(var E=A[C],o=E.length,e,a=0;a<o;++a)(e=E[a])&&(B.push(g.call(e,e.__data__,a,E)),Q.push(e));return new jI(B,Q)}function GN(g){return function(){return this.matches(g)}}function OM(g){return function(A){return A.matches(g)}}var urA=Array.prototype.find;function mrA(g){return function(){return urA.call(this.children,g)}}function xrA(){return this.firstElementChild}function Z1(g){return this.select(g==null?xrA:mrA(typeof g=="function"?g:OM(g)))}var brA=Array.prototype.filter;function TrA(){return Array.from(this.children)}function WrA(g){return function(){return brA.call(this.children,g)}}function P1(g){return this.selectAll(g==null?TrA:WrA(typeof g=="function"?g:OM(g)))}function O1(g){typeof g!="function"&&(g=GN(g));for(var A=this._groups,I=A.length,B=new Array(I),Q=0;Q<I;++Q)for(var C=A[Q],E=C.length,o=B[Q]=[],e,a=0;a<E;++a)(e=C[a])&&g.call(e,e.__data__,a,C)&&o.push(e);return new jI(B,this._parents)}function VM(g){return new Array(g.length)}function V1(){return new jI(this._enter||this._groups.map(VM),this._parents)}function wN(g,A){this.ownerDocument=g.ownerDocument,this.namespaceURI=g.namespaceURI,this._next=null,this._parent=g,this.__data__=A}wN.prototype={constructor:wN,appendChild:function(g){return this._parent.insertBefore(g,this._next)},insertBefore:function(g,A){return this._parent.insertBefore(g,A)},querySelector:function(g){return this._parent.querySelector(g)},querySelectorAll:function(g){return this._parent.querySelectorAll(g)}};function v1(g){return function(){return g}}function ZrA(g,A,I,B,Q,C){for(var E=0,o,e=A.length,a=C.length;E<a;++E)(o=A[E])?(o.__data__=C[E],B[E]=o):I[E]=new wN(g,C[E]);for(;E<e;++E)(o=A[E])&&(Q[E]=o)}function PrA(g,A,I,B,Q,C,E){var o,e,a=new Map,D=A.length,n=C.length,G=new Array(D),w;for(o=0;o<D;++o)(e=A[o])&&(G[o]=w=E.call(e,e.__data__,o,A)+"",a.has(w)?Q[o]=e:a.set(w,e));for(o=0;o<n;++o)w=E.call(g,C[o],o,C)+"",(e=a.get(w))?(B[o]=e,e.__data__=C[o],a.delete(w)):I[o]=new wN(g,C[o]);for(o=0;o<D;++o)(e=A[o])&&a.get(G[o])===e&&(Q[o]=e)}function OrA(g){return g.__data__}function j1(g,A){if(!arguments.length)return Array.from(this,OrA);var I=A?PrA:ZrA,B=this._parents,Q=this._groups;typeof g!="function"&&(g=v1(g));for(var C=Q.length,E=new Array(C),o=new Array(C),e=new Array(C),a=0;a<C;++a){var D=B[a],n=Q[a],G=n.length,w=VrA(g.call(D,D&&D.__data__,a,B)),h=w.length,F=o[a]=new Array(h),N=E[a]=new Array(h),l=e[a]=new Array(G);I(D,n,F,N,l,w,A);for(var p=0,R=0,y,Y;p<h;++p)if(y=F[p]){for(p>=R&&(R=p+1);!(Y=N[R])&&++R<h;);y._next=Y||null}}return E=new jI(E,B),E._enter=o,E._exit=e,E}function VrA(g){return typeof g=="object"&&"length"in g?g:Array.from(g)}function X1(){return new jI(this._exit||this._groups.map(VM),this._parents)}function z1(g,A,I){var B=this.enter(),Q=this,C=this.exit();return typeof g=="function"?(B=g(B),B&&(B=B.selection())):B=B.append(g+""),A!=null&&(Q=A(Q),Q&&(Q=Q.selection())),I==null?C.remove():I(C),B&&Q?B.merge(Q).order():Q}function _1(g){for(var A=g.selection?g.selection():g,I=this._groups,B=A._groups,Q=I.length,C=B.length,E=Math.min(Q,C),o=new Array(Q),e=0;e<E;++e)for(var a=I[e],D=B[e],n=a.length,G=o[e]=new Array(n),w,h=0;h<n;++h)(w=a[h]||D[h])&&(G[h]=w);for(;e<Q;++e)o[e]=I[e];return new jI(o,this._parents)}function $1(){for(var g=this._groups,A=-1,I=g.length;++A<I;)for(var B=g[A],Q=B.length-1,C=B[Q],E;--Q>=0;)(E=B[Q])&&(C&&E.compareDocumentPosition(C)^4&&C.parentNode.insertBefore(E,C),C=E);return this}function AO(g){g||(g=vrA);function A(n,G){return n&&G?g(n.__data__,G.__data__):!n-!G}for(var I=this._groups,B=I.length,Q=new Array(B),C=0;C<B;++C){for(var E=I[C],o=E.length,e=Q[C]=new Array(o),a,D=0;D<o;++D)(a=E[D])&&(e[D]=a);e.sort(A)}return new jI(Q,this._parents).order()}function vrA(g,A){return g<A?-1:g>A?1:g>=A?0:NaN}function gO(){var g=arguments[0];return arguments[0]=this,g.apply(null,arguments),this}function IO(){return Array.from(this)}function BO(){for(var g=this._groups,A=0,I=g.length;A<I;++A)for(var B=g[A],Q=0,C=B.length;Q<C;++Q){var E=B[Q];if(E)return E}return null}function QO(){let g=0;for(let A of this)++g;return g}function CO(){return!this.node()}function EO(g){for(var A=this._groups,I=0,B=A.length;I<B;++I)for(var Q=A[I],C=0,E=Q.length,o;C<E;++C)(o=Q[C])&&g.call(o,o.__data__,C,Q);return this}function jrA(g){return function(){this.removeAttribute(g)}}function XrA(g){return function(){this.removeAttributeNS(g.space,g.local)}}function zrA(g,A){return function(){this.setAttribute(g,A)}}function _rA(g,A){return function(){this.setAttributeNS(g.space,g.local,A)}}function $rA(g,A){return function(){var I=A.apply(this,arguments);I==null?this.removeAttribute(g):this.setAttribute(g,I)}}function AnA(g,A){return function(){var I=A.apply(this,arguments);I==null?this.removeAttributeNS(g.space,g.local):this.setAttributeNS(g.space,g.local,I)}}function iO(g,A){var I=Ve(g);if(arguments.length<2){var B=this.node();return I.local?B.getAttributeNS(I.space,I.local):B.getAttribute(I)}return this.each((A==null?I.local?XrA:jrA:typeof A=="function"?I.local?AnA:$rA:I.local?_rA:zrA)(I,A))}function vM(g){return g.ownerDocument&&g.ownerDocument.defaultView||g.document&&g||g.defaultView}function gnA(g){return function(){this.style.removeProperty(g)}}function InA(g,A,I){return function(){this.style.setProperty(g,A,I)}}function BnA(g,A,I){return function(){var B=A.apply(this,arguments);B==null?this.style.removeProperty(g):this.style.setProperty(g,B,I)}}function oO(g,A,I){return arguments.length>1?this.each((A==null?gnA:typeof A=="function"?BnA:InA)(g,A,I??"")):os(this.node(),g)}function os(g,A){return g.style.getPropertyValue(A)||vM(g).getComputedStyle(g,null).getPropertyValue(A)}function QnA(g){return function(){delete this[g]}}function CnA(g,A){return function(){this[g]=A}}function EnA(g,A){return function(){var I=A.apply(this,arguments);I==null?delete this[g]:this[g]=I}}function tO(g,A){return arguments.length>1?this.each((A==null?QnA:typeof A=="function"?EnA:CnA)(g,A)):this.node()[g]}function eO(g){return g.trim().split(/^|\s+/)}function yL(g){return g.classList||new aO(g)}function aO(g){this._node=g,this._names=eO(g.getAttribute("class")||"")}aO.prototype={add:function(g){var A=this._names.indexOf(g);A<0&&(this._names.push(g),this._node.setAttribute("class",this._names.join(" ")))},remove:function(g){var A=this._names.indexOf(g);A>=0&&(this._names.splice(A,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(g){return this._names.indexOf(g)>=0}};function sO(g,A){for(var I=yL(g),B=-1,Q=A.length;++B<Q;)I.add(A[B])}function DO(g,A){for(var I=yL(g),B=-1,Q=A.length;++B<Q;)I.remove(A[B])}function inA(g){return function(){sO(this,g)}}function onA(g){return function(){DO(this,g)}}function tnA(g,A){return function(){(A.apply(this,arguments)?sO:DO)(this,g)}}function rO(g,A){var I=eO(g+"");if(arguments.length<2){for(var B=yL(this.node()),Q=-1,C=I.length;++Q<C;)if(!B.contains(I[Q]))return!1;return!0}return this.each((typeof A=="function"?tnA:A?inA:onA)(I,A))}function enA(){this.textContent=""}function anA(g){return function(){this.textContent=g}}function snA(g){return function(){var A=g.apply(this,arguments);this.textContent=A??""}}function nO(g){return arguments.length?this.each(g==null?enA:(typeof g=="function"?snA:anA)(g)):this.node().textContent}function DnA(){this.innerHTML=""}function rnA(g){return function(){this.innerHTML=g}}function nnA(g){return function(){var A=g.apply(this,arguments);this.innerHTML=A??""}}function cO(g){return arguments.length?this.each(g==null?DnA:(typeof g=="function"?nnA:rnA)(g)):this.node().innerHTML}function cnA(){this.nextSibling&&this.parentNode.appendChild(this)}function GO(){return this.each(cnA)}function GnA(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function wO(){return this.each(GnA)}function hO(g){var A=typeof g=="function"?g:sc(g);return this.select(function(){return this.appendChild(A.apply(this,arguments))})}function wnA(){return null}function NO(g,A){var I=typeof g=="function"?g:sc(g),B=A==null?wnA:typeof A=="function"?A:HD(A);return this.select(function(){return this.insertBefore(I.apply(this,arguments),B.apply(this,arguments)||null)})}function hnA(){var g=this.parentNode;g&&g.removeChild(this)}function kO(){return this.each(hnA)}function NnA(){var g=this.cloneNode(!1),A=this.parentNode;return A?A.insertBefore(g,this.nextSibling):g}function knA(){var g=this.cloneNode(!0),A=this.parentNode;return A?A.insertBefore(g,this.nextSibling):g}function yO(g){return this.select(g?knA:NnA)}function FO(g){return arguments.length?this.property("__data__",g):this.node().__data__}function ynA(g){return function(A){g.call(this,A,this.__data__)}}function FnA(g){return g.trim().split(/^|\s+/).map(function(A){var I="",B=A.indexOf(".");return B>=0&&(I=A.slice(B+1),A=A.slice(0,B)),{type:A,name:I}})}function lnA(g){return function(){var A=this.__on;if(A){for(var I=0,B=-1,Q=A.length,C;I<Q;++I)C=A[I],(!g.type||C.type===g.type)&&C.name===g.name?this.removeEventListener(C.type,C.listener,C.options):A[++B]=C;++B?A.length=B:delete this.__on}}}function RnA(g,A,I){return function(){var B=this.__on,Q,C=ynA(A);if(B){for(var E=0,o=B.length;E<o;++E)if((Q=B[E]).type===g.type&&Q.name===g.name){this.removeEventListener(Q.type,Q.listener,Q.options),this.addEventListener(Q.type,Q.listener=C,Q.options=I),Q.value=A;return}}this.addEventListener(g.type,C,I),Q={type:g.type,name:g.name,value:A,listener:C,options:I},B?B.push(Q):this.__on=[Q]}}function lO(g,A,I){var B=FnA(g+""),Q,C=B.length,E;if(arguments.length<2){var o=this.node().__on;if(o){for(var e=0,a=o.length,D;e<a;++e)for(Q=0,D=o[e];Q<C;++Q)if((E=B[Q]).type===D.type&&E.name===D.name)return D.value}return}for(o=A?RnA:lnA,Q=0;Q<C;++Q)this.each(o(B[Q],A,I));return this}function RO(g,A,I){var B=vM(g),Q=B.CustomEvent;typeof Q=="function"?Q=new Q(A,I):(Q=B.document.createEvent("Event"),I?(Q.initEvent(A,I.bubbles,I.cancelable),Q.detail=I.detail):Q.initEvent(A,!1,!1)),g.dispatchEvent(Q)}function MnA(g,A){return function(){return RO(this,g,A)}}function JnA(g,A){return function(){return RO(this,g,A.apply(this,arguments))}}function MO(g,A){return this.each((typeof A=="function"?JnA:MnA)(g,A))}function*JO(){for(var g=this._groups,A=0,I=g.length;A<I;++A)for(var B=g[A],Q=0,C=B.length,E;Q<C;++Q)(E=B[Q])&&(yield E)}var hN=[null];function jI(g,A){this._groups=g,this._parents=A}function pO(){return new jI([[document.documentElement]],hN)}function pnA(){return this}jI.prototype=pO.prototype={constructor:jI,select:T1,selectAll:W1,selectChild:Z1,selectChildren:P1,filter:O1,data:j1,enter:V1,exit:X1,join:z1,merge:_1,selection:pnA,order:$1,sort:AO,call:gO,nodes:IO,node:BO,size:QO,empty:CO,each:EO,attr:iO,style:oO,property:tO,classed:rO,text:nO,html:cO,raise:GO,lower:wO,append:hO,insert:NO,remove:kO,clone:yO,datum:FO,on:lO,dispatch:MO,[Symbol.iterator]:JO};var ve=pO;function gg(g){return typeof g=="string"?new jI([[document.querySelector(g)]],[document.documentElement]):new jI([[g]],hN)}function gE(g){return gg(sc(g).call(document.documentElement))}function FL(g){return typeof g=="string"?new jI([document.querySelectorAll(g)],[document.documentElement]):new jI([nN(g)],hN)}function jM(g,A,I){g.prototype=A.prototype=I,I.constructor=g}function lL(g,A){var I=Object.create(g.prototype);for(var B in A)I[B]=A[B];return I}function yN(){}var NN=.7,_M=1/NN,Dc="\\s*([+-]?\\d+)\\s*",kN="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Kt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",YnA=/^#([0-9a-f]{3,8})$/,KnA=new RegExp(`^rgb\\(${Dc},${Dc},${Dc}\\)$`),dnA=new RegExp(`^rgb\\(${Kt},${Kt},${Kt}\\)$`),qnA=new RegExp(`^rgba\\(${Dc},${Dc},${Dc},${kN}\\)$`),UnA=new RegExp(`^rgba\\(${Kt},${Kt},${Kt},${kN}\\)$`),SnA=new RegExp(`^hsl\\(${kN},${Kt},${Kt}\\)$`),LnA=new RegExp(`^hsla\\(${kN},${Kt},${Kt},${kN}\\)$`),YO={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};jM(yN,IE,{copy(g){return Object.assign(new this.constructor,this,g)},displayable(){return this.rgb().displayable()},hex:KO,formatHex:KO,formatHex8:HnA,formatHsl:fnA,formatRgb:dO,toString:dO});function KO(){return this.rgb().formatHex()}function HnA(){return this.rgb().formatHex8()}function fnA(){return fO(this).formatHsl()}function dO(){return this.rgb().formatRgb()}function IE(g){var A,I;return g=(g+"").trim().toLowerCase(),(A=YnA.exec(g))?(I=A[1].length,A=parseInt(A[1],16),I===6?qO(A):I===3?new pE(A>>8&15|A>>4&240,A>>4&15|A&240,(A&15)<<4|A&15,1):I===8?XM(A>>24&255,A>>16&255,A>>8&255,(A&255)/255):I===4?XM(A>>12&15|A>>8&240,A>>8&15|A>>4&240,A>>4&15|A&240,((A&15)<<4|A&15)/255):null):(A=KnA.exec(g))?new pE(A[1],A[2],A[3],1):(A=dnA.exec(g))?new pE(A[1]*255/100,A[2]*255/100,A[3]*255/100,1):(A=qnA.exec(g))?XM(A[1],A[2],A[3],A[4]):(A=UnA.exec(g))?XM(A[1]*255/100,A[2]*255/100,A[3]*255/100,A[4]):(A=SnA.exec(g))?LO(A[1],A[2]/100,A[3]/100,1):(A=LnA.exec(g))?LO(A[1],A[2]/100,A[3]/100,A[4]):YO.hasOwnProperty(g)?qO(YO[g]):g==="transparent"?new pE(NaN,NaN,NaN,0):null}function qO(g){return new pE(g>>16&255,g>>8&255,g&255,1)}function XM(g,A,I,B){return B<=0&&(g=A=I=NaN),new pE(g,A,I,B)}function unA(g){return g instanceof yN||(g=IE(g)),g?(g=g.rgb(),new pE(g.r,g.g,g.b,g.opacity)):new pE}function rc(g,A,I,B){return arguments.length===1?unA(g):new pE(g,A,I,B??1)}function pE(g,A,I,B){this.r=+g,this.g=+A,this.b=+I,this.opacity=+B}jM(pE,rc,lL(yN,{brighter(g){return g=g==null?_M:Math.pow(_M,g),new pE(this.r*g,this.g*g,this.b*g,this.opacity)},darker(g){return g=g==null?NN:Math.pow(NN,g),new pE(this.r*g,this.g*g,this.b*g,this.opacity)},rgb(){return this},clamp(){return new pE(uD(this.r),uD(this.g),uD(this.b),$M(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:UO,formatHex:UO,formatHex8:mnA,formatRgb:SO,toString:SO}));function UO(){return`#${fD(this.r)}${fD(this.g)}${fD(this.b)}`}function mnA(){return`#${fD(this.r)}${fD(this.g)}${fD(this.b)}${fD((isNaN(this.opacity)?1:this.opacity)*255)}`}function SO(){let g=$M(this.opacity);return`${g===1?"rgb(":"rgba("}${uD(this.r)}, ${uD(this.g)}, ${uD(this.b)}${g===1?")":`, ${g})`}`}function $M(g){return isNaN(g)?1:Math.max(0,Math.min(1,g))}function uD(g){return Math.max(0,Math.min(255,Math.round(g)||0))}function fD(g){return g=uD(g),(g<16?"0":"")+g.toString(16)}function LO(g,A,I,B){return B<=0?g=A=I=NaN:I<=0||I>=1?g=A=NaN:A<=0&&(g=NaN),new Yo(g,A,I,B)}function fO(g){if(g instanceof Yo)return new Yo(g.h,g.s,g.l,g.opacity);if(g instanceof yN||(g=IE(g)),!g)return new Yo;if(g instanceof Yo)return g;g=g.rgb();var A=g.r/255,I=g.g/255,B=g.b/255,Q=Math.min(A,I,B),C=Math.max(A,I,B),E=NaN,o=C-Q,e=(C+Q)/2;return o?(A===C?E=(I-B)/o+(I<B)*6:I===C?E=(B-A)/o+2:E=(A-I)/o+4,o/=e<.5?C+Q:2-C-Q,E*=60):o=e>0&&e<1?0:E,new Yo(E,o,e,g.opacity)}function uO(g,A,I,B){return arguments.length===1?fO(g):new Yo(g,A,I,B??1)}function Yo(g,A,I,B){this.h=+g,this.s=+A,this.l=+I,this.opacity=+B}jM(Yo,uO,lL(yN,{brighter(g){return g=g==null?_M:Math.pow(_M,g),new Yo(this.h,this.s,this.l*g,this.opacity)},darker(g){return g=g==null?NN:Math.pow(NN,g),new Yo(this.h,this.s,this.l*g,this.opacity)},rgb(){var g=this.h%360+(this.h<0)*360,A=isNaN(g)||isNaN(this.s)?0:this.s,I=this.l,B=I+(I<.5?I:1-I)*A,Q=2*I-B;return new pE(RL(g>=240?g-240:g+120,Q,B),RL(g,Q,B),RL(g<120?g+240:g-120,Q,B),this.opacity)},clamp(){return new Yo(HO(this.h),zM(this.s),zM(this.l),$M(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let g=$M(this.opacity);return`${g===1?"hsl(":"hsla("}${HO(this.h)}, ${zM(this.s)*100}%, ${zM(this.l)*100}%${g===1?")":`, ${g})`}`}}));function HO(g){return g=(g||0)%360,g<0?g+360:g}function zM(g){return Math.max(0,Math.min(1,g||0))}function RL(g,A,I){return(g<60?A+(I-A)*g/60:g<180?I:g<240?A+(I-A)*(240-g)/60:A)*255}function ML(g,A,I,B,Q){var C=g*g,E=C*g;return((1-3*g+3*C-E)*A+(4-6*C+3*E)*I+(1+3*g+3*C-3*E)*B+E*Q)/6}function xO(g){var A=g.length-1;return function(I){var B=I<=0?I=0:I>=1?(I=1,A-1):Math.floor(I*A),Q=g[B],C=g[B+1],E=B>0?g[B-1]:2*Q-C,o=B<A-1?g[B+2]:2*C-Q;return ML((I-B/A)*A,E,Q,C,o)}}function bO(g){var A=g.length;return function(I){var B=Math.floor(((I%=1)<0?++I:I)*A),Q=g[(B+A-1)%A],C=g[B%A],E=g[(B+1)%A],o=g[(B+2)%A];return ML((I-B/A)*A,Q,C,E,o)}}var FN=g=>()=>g;function xnA(g,A){return function(I){return g+I*A}}function bnA(g,A,I){return g=Math.pow(g,I),A=Math.pow(A,I)-g,I=1/I,function(B){return Math.pow(g+B*A,I)}}function TO(g){return(g=+g)==1?AJ:function(A,I){return I-A?bnA(A,I,g):FN(isNaN(A)?I:A)}}function AJ(g,A){var I=A-g;return I?xnA(g,I):FN(isNaN(g)?A:g)}var mD=function g(A){var I=TO(A);function B(Q,C){var E=I((Q=rc(Q)).r,(C=rc(C)).r),o=I(Q.g,C.g),e=I(Q.b,C.b),a=AJ(Q.opacity,C.opacity);return function(D){return Q.r=E(D),Q.g=o(D),Q.b=e(D),Q.opacity=a(D),Q+""}}return B.gamma=g,B}(1);function WO(g){return function(A){var I=A.length,B=new Array(I),Q=new Array(I),C=new Array(I),E,o;for(E=0;E<I;++E)o=rc(A[E]),B[E]=o.r||0,Q[E]=o.g||0,C[E]=o.b||0;return B=g(B),Q=g(Q),C=g(C),o.opacity=1,function(e){return o.r=B(e),o.g=Q(e),o.b=C(e),o+""}}}var TnA=WO(xO),WnA=WO(bO);function ZO(g,A){A||(A=[]);var I=g?Math.min(A.length,g.length):0,B=A.slice(),Q;return function(C){for(Q=0;Q<I;++Q)B[Q]=g[Q]*(1-C)+A[Q]*C;return B}}function PO(g){return ArrayBuffer.isView(g)&&!(g instanceof DataView)}function OO(g,A){var I=A?A.length:0,B=g?Math.min(I,g.length):0,Q=new Array(B),C=new Array(I),E;for(E=0;E<B;++E)Q[E]=xD(g[E],A[E]);for(;E<I;++E)C[E]=A[E];return function(o){for(E=0;E<B;++E)C[E]=Q[E](o);return C}}function VO(g,A){var I=new Date;return g=+g,A=+A,function(B){return I.setTime(g*(1-B)+A*B),I}}function WQ(g,A){return g=+g,A=+A,function(I){return g*(1-I)+A*I}}function vO(g,A){var I={},B={},Q;(g===null||typeof g!="object")&&(g={}),(A===null||typeof A!="object")&&(A={});for(Q in A)Q in g?I[Q]=xD(g[Q],A[Q]):B[Q]=A[Q];return function(C){for(Q in I)B[Q]=I[Q](C);return B}}var pL=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,JL=new RegExp(pL.source,"g");function ZnA(g){return function(){return g}}function PnA(g){return function(A){return g(A)+""}}function lN(g,A){var I=pL.lastIndex=JL.lastIndex=0,B,Q,C,E=-1,o=[],e=[];for(g=g+"",A=A+"";(B=pL.exec(g))&&(Q=JL.exec(A));)(C=Q.index)>I&&(C=A.slice(I,C),o[E]?o[E]+=C:o[++E]=C),(B=B[0])===(Q=Q[0])?o[E]?o[E]+=Q:o[++E]=Q:(o[++E]=null,e.push({i:E,x:WQ(B,Q)})),I=JL.lastIndex;return I<A.length&&(C=A.slice(I),o[E]?o[E]+=C:o[++E]=C),o.length<2?e[0]?PnA(e[0].x):ZnA(A):(A=e.length,function(a){for(var D=0,n;D<A;++D)o[(n=e[D]).i]=n.x(a);return o.join("")})}function xD(g,A){var I=typeof A,B;return A==null||I==="boolean"?FN(A):(I==="number"?WQ:I==="string"?(B=IE(A))?(A=B,mD):lN:A instanceof IE?mD:A instanceof Date?VO:PO(A)?ZO:Array.isArray(A)?OO:typeof A.valueOf!="function"&&typeof A.toString!="function"||isNaN(A)?vO:WQ)(g,A)}function YL(g,A){return g=+g,A=+A,function(I){return Math.round(g*(1-I)+A*I)}}var jO=180/Math.PI,gJ={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function KL(g,A,I,B,Q,C){var E,o,e;return(E=Math.sqrt(g*g+A*A))&&(g/=E,A/=E),(e=g*I+A*B)&&(I-=g*e,B-=A*e),(o=Math.sqrt(I*I+B*B))&&(I/=o,B/=o,e/=o),g*B<A*I&&(g=-g,A=-A,e=-e,E=-E),{translateX:Q,translateY:C,rotate:Math.atan2(A,g)*jO,skewX:Math.atan(e)*jO,scaleX:E,scaleY:o}}var IJ;function XO(g){let A=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(g+"");return A.isIdentity?gJ:KL(A.a,A.b,A.c,A.d,A.e,A.f)}function zO(g){return g==null?gJ:(IJ||(IJ=document.createElementNS("http://www.w3.org/2000/svg","g")),IJ.setAttribute("transform",g),(g=IJ.transform.baseVal.consolidate())?(g=g.matrix,KL(g.a,g.b,g.c,g.d,g.e,g.f)):gJ)}function _O(g,A,I,B){function Q(a){return a.length?a.pop()+" ":""}function C(a,D,n,G,w,h){if(a!==n||D!==G){var F=w.push("translate(",null,A,null,I);h.push({i:F-4,x:WQ(a,n)},{i:F-2,x:WQ(D,G)})}else(n||G)&&w.push("translate("+n+A+G+I)}function E(a,D,n,G){a!==D?(a-D>180?D+=360:D-a>180&&(a+=360),G.push({i:n.push(Q(n)+"rotate(",null,B)-2,x:WQ(a,D)})):D&&n.push(Q(n)+"rotate("+D+B)}function o(a,D,n,G){a!==D?G.push({i:n.push(Q(n)+"skewX(",null,B)-2,x:WQ(a,D)}):D&&n.push(Q(n)+"skewX("+D+B)}function e(a,D,n,G,w,h){if(a!==n||D!==G){var F=w.push(Q(w)+"scale(",null,",",null,")");h.push({i:F-4,x:WQ(a,n)},{i:F-2,x:WQ(D,G)})}else(n!==1||G!==1)&&w.push(Q(w)+"scale("+n+","+G+")")}return function(a,D){var n=[],G=[];return a=g(a),D=g(D),C(a.translateX,a.translateY,D.translateX,D.translateY,n,G),E(a.rotate,D.rotate,n,G),o(a.skewX,D.skewX,n,G),e(a.scaleX,a.scaleY,D.scaleX,D.scaleY,n,G),a=D=null,function(w){for(var h=-1,F=G.length,N;++h<F;)n[(N=G[h]).i]=N.x(w);return n.join("")}}}var dL=_O(XO,"px, ","px)","deg)"),qL=_O(zO,", ",")",")");var nc=0,MN=0,RN=0,AV=1e3,BJ,JN,QJ=0,bD=0,CJ=0,pN=typeof performance=="object"&&performance.now?performance:Date,gV=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(g){setTimeout(g,17)};function KN(){return bD||(gV(OnA),bD=pN.now()+CJ)}function OnA(){bD=0}function YN(){this._call=this._time=this._next=null}YN.prototype=EJ.prototype={constructor:YN,restart:function(g,A,I){if(typeof g!="function")throw new TypeError("callback is not a function");I=(I==null?KN():+I)+(A==null?0:+A),!this._next&&JN!==this&&(JN?JN._next=this:BJ=this,JN=this),this._call=g,this._time=I,UL()},stop:function(){this._call&&(this._call=null,this._time=1/0,UL())}};function EJ(g,A,I){var B=new YN;return B.restart(g,A,I),B}function IV(){KN(),++nc;for(var g=BJ,A;g;)(A=bD-g._time)>=0&&g._call.call(void 0,A),g=g._next;--nc}function $O(){bD=(QJ=pN.now())+CJ,nc=MN=0;try{IV()}finally{nc=0,vnA(),bD=0}}function VnA(){var g=pN.now(),A=g-QJ;A>AV&&(CJ-=A,QJ=g)}function vnA(){for(var g,A=BJ,I,B=1/0;A;)A._call?(B>A._time&&(B=A._time),g=A,A=A._next):(I=A._next,A._next=null,A=g?g._next=I:BJ=I);JN=g,UL(B)}function UL(g){if(!nc){MN&&(MN=clearTimeout(MN));var A=g-bD;A>24?(g<1/0&&(MN=setTimeout($O,g-pN.now()-CJ)),RN&&(RN=clearInterval(RN))):(RN||(QJ=pN.now(),RN=setInterval(VnA,AV)),nc=1,gV($O))}}function iJ(g,A,I){var B=new YN;return A=A==null?0:+A,B.restart(Q=>{B.stop(),g(Q+A)},A,I),B}var jnA=NL("start","end","cancel","interrupt"),XnA=[],CV=0,BV=1,tJ=2,oJ=3,QV=4,eJ=5,dN=6;function ts(g,A,I,B,Q,C){var E=g.__transition;if(!E)g.__transition={};else if(I in E)return;znA(g,I,{name:A,index:B,group:Q,on:jnA,tween:XnA,time:C.time,delay:C.delay,duration:C.duration,ease:C.ease,timer:null,state:CV})}function qN(g,A){var I=IQ(g,A);if(I.state>CV)throw new Error("too late; already scheduled");return I}function ZQ(g,A){var I=IQ(g,A);if(I.state>oJ)throw new Error("too late; already running");return I}function IQ(g,A){var I=g.__transition;if(!I||!(I=I[A]))throw new Error("transition not found");return I}function znA(g,A,I){var B=g.__transition,Q;B[A]=I,I.timer=EJ(C,0,I.time);function C(a){I.state=BV,I.timer.restart(E,I.delay,I.time),I.delay<=a&&E(a-I.delay)}function E(a){var D,n,G,w;if(I.state!==BV)return e();for(D in B)if(w=B[D],w.name===I.name){if(w.state===oJ)return iJ(E);w.state===QV?(w.state=dN,w.timer.stop(),w.on.call("interrupt",g,g.__data__,w.index,w.group),delete B[D]):+D<A&&(w.state=dN,w.timer.stop(),w.on.call("cancel",g,g.__data__,w.index,w.group),delete B[D])}if(iJ(function(){I.state===oJ&&(I.state=QV,I.timer.restart(o,I.delay,I.time),o(a))}),I.state=tJ,I.on.call("start",g,g.__data__,I.index,I.group),I.state===tJ){for(I.state=oJ,Q=new Array(G=I.tween.length),D=0,n=-1;D<G;++D)(w=I.tween[D].value.call(g,g.__data__,I.index,I.group))&&(Q[++n]=w);Q.length=n+1}}function o(a){for(var D=a<I.duration?I.ease.call(null,a/I.duration):(I.timer.restart(e),I.state=eJ,1),n=-1,G=Q.length;++n<G;)Q[n].call(g,D);I.state===eJ&&(I.on.call("end",g,g.__data__,I.index,I.group),e())}function e(){I.state=dN,I.timer.stop(),delete B[A];for(var a in B)return;delete g.__transition}}function aJ(g,A){var I=g.__transition,B,Q,C=!0,E;if(I){A=A==null?null:A+"";for(E in I){if((B=I[E]).name!==A){C=!1;continue}Q=B.state>tJ&&B.state<eJ,B.state=dN,B.timer.stop(),B.on.call(Q?"interrupt":"cancel",g,g.__data__,B.index,B.group),delete I[E]}C&&delete g.__transition}}function EV(g){return this.each(function(){aJ(this,g)})}function _nA(g,A){var I,B;return function(){var Q=ZQ(this,g),C=Q.tween;if(C!==I){B=I=C;for(var E=0,o=B.length;E<o;++E)if(B[E].name===A){B=B.slice(),B.splice(E,1);break}}Q.tween=B}}function $nA(g,A,I){var B,Q;if(typeof I!="function")throw new Error;return function(){var C=ZQ(this,g),E=C.tween;if(E!==B){Q=(B=E).slice();for(var o={name:A,value:I},e=0,a=Q.length;e<a;++e)if(Q[e].name===A){Q[e]=o;break}e===a&&Q.push(o)}C.tween=Q}}function iV(g,A){var I=this._id;if(g+="",arguments.length<2){for(var B=IQ(this.node(),I).tween,Q=0,C=B.length,E;Q<C;++Q)if((E=B[Q]).name===g)return E.value;return null}return this.each((A==null?_nA:$nA)(I,g,A))}function cc(g,A,I){var B=g._id;return g.each(function(){var Q=ZQ(this,B);(Q.value||(Q.value={}))[A]=I.apply(this,arguments)}),function(Q){return IQ(Q,B).value[A]}}function sJ(g,A){var I;return(typeof A=="number"?WQ:A instanceof IE?mD:(I=IE(A))?(A=I,mD):lN)(g,A)}function AcA(g){return function(){this.removeAttribute(g)}}function gcA(g){return function(){this.removeAttributeNS(g.space,g.local)}}function IcA(g,A,I){var B,Q=I+"",C;return function(){var E=this.getAttribute(g);return E===Q?null:E===B?C:C=A(B=E,I)}}function BcA(g,A,I){var B,Q=I+"",C;return function(){var E=this.getAttributeNS(g.space,g.local);return E===Q?null:E===B?C:C=A(B=E,I)}}function QcA(g,A,I){var B,Q,C;return function(){var E,o=I(this),e;return o==null?void this.removeAttribute(g):(E=this.getAttribute(g),e=o+"",E===e?null:E===B&&e===Q?C:(Q=e,C=A(B=E,o)))}}function CcA(g,A,I){var B,Q,C;return function(){var E,o=I(this),e;return o==null?void this.removeAttributeNS(g.space,g.local):(E=this.getAttributeNS(g.space,g.local),e=o+"",E===e?null:E===B&&e===Q?C:(Q=e,C=A(B=E,o)))}}function oV(g,A){var I=Ve(g),B=I==="transform"?qL:sJ;return this.attrTween(g,typeof A=="function"?(I.local?CcA:QcA)(I,B,cc(this,"attr."+g,A)):A==null?(I.local?gcA:AcA)(I):(I.local?BcA:IcA)(I,B,A))}function EcA(g,A){return function(I){this.setAttribute(g,A.call(this,I))}}function icA(g,A){return function(I){this.setAttributeNS(g.space,g.local,A.call(this,I))}}function ocA(g,A){var I,B;function Q(){var C=A.apply(this,arguments);return C!==B&&(I=(B=C)&&icA(g,C)),I}return Q._value=A,Q}function tcA(g,A){var I,B;function Q(){var C=A.apply(this,arguments);return C!==B&&(I=(B=C)&&EcA(g,C)),I}return Q._value=A,Q}function tV(g,A){var I="attr."+g;if(arguments.length<2)return(I=this.tween(I))&&I._value;if(A==null)return this.tween(I,null);if(typeof A!="function")throw new Error;var B=Ve(g);return this.tween(I,(B.local?ocA:tcA)(B,A))}function ecA(g,A){return function(){qN(this,g).delay=+A.apply(this,arguments)}}function acA(g,A){return A=+A,function(){qN(this,g).delay=A}}function eV(g){var A=this._id;return arguments.length?this.each((typeof g=="function"?ecA:acA)(A,g)):IQ(this.node(),A).delay}function scA(g,A){return function(){ZQ(this,g).duration=+A.apply(this,arguments)}}function DcA(g,A){return A=+A,function(){ZQ(this,g).duration=A}}function aV(g){var A=this._id;return arguments.length?this.each((typeof g=="function"?scA:DcA)(A,g)):IQ(this.node(),A).duration}function rcA(g,A){if(typeof A!="function")throw new Error;return function(){ZQ(this,g).ease=A}}function sV(g){var A=this._id;return arguments.length?this.each(rcA(A,g)):IQ(this.node(),A).ease}function ncA(g,A){return function(){var I=A.apply(this,arguments);if(typeof I!="function")throw new Error;ZQ(this,g).ease=I}}function DV(g){if(typeof g!="function")throw new Error;return this.each(ncA(this._id,g))}function rV(g){typeof g!="function"&&(g=GN(g));for(var A=this._groups,I=A.length,B=new Array(I),Q=0;Q<I;++Q)for(var C=A[Q],E=C.length,o=B[Q]=[],e,a=0;a<E;++a)(e=C[a])&&g.call(e,e.__data__,a,C)&&o.push(e);return new BE(B,this._parents,this._name,this._id)}function nV(g){if(g._id!==this._id)throw new Error;for(var A=this._groups,I=g._groups,B=A.length,Q=I.length,C=Math.min(B,Q),E=new Array(B),o=0;o<C;++o)for(var e=A[o],a=I[o],D=e.length,n=E[o]=new Array(D),G,w=0;w<D;++w)(G=e[w]||a[w])&&(n[w]=G);for(;o<B;++o)E[o]=A[o];return new BE(E,this._parents,this._name,this._id)}function ccA(g){return(g+"").trim().split(/^|\s+/).every(function(A){var I=A.indexOf(".");return I>=0&&(A=A.slice(0,I)),!A||A==="start"})}function GcA(g,A,I){var B,Q,C=ccA(A)?qN:ZQ;return function(){var E=C(this,g),o=E.on;o!==B&&(Q=(B=o).copy()).on(A,I),E.on=Q}}function cV(g,A){var I=this._id;return arguments.length<2?IQ(this.node(),I).on.on(g):this.each(GcA(I,g,A))}function wcA(g){return function(){var A=this.parentNode;for(var I in this.__transition)if(+I!==g)return;A&&A.removeChild(this)}}function GV(){return this.on("end.remove",wcA(this._id))}function wV(g){var A=this._name,I=this._id;typeof g!="function"&&(g=HD(g));for(var B=this._groups,Q=B.length,C=new Array(Q),E=0;E<Q;++E)for(var o=B[E],e=o.length,a=C[E]=new Array(e),D,n,G=0;G<e;++G)(D=o[G])&&(n=g.call(D,D.__data__,G,o))&&("__data__"in D&&(n.__data__=D.__data__),a[G]=n,ts(a[G],A,I,G,a,IQ(D,I)));return new BE(C,this._parents,A,I)}function hV(g){var A=this._name,I=this._id;typeof g!="function"&&(g=cN(g));for(var B=this._groups,Q=B.length,C=[],E=[],o=0;o<Q;++o)for(var e=B[o],a=e.length,D,n=0;n<a;++n)if(D=e[n]){for(var G=g.call(D,D.__data__,n,e),w,h=IQ(D,I),F=0,N=G.length;F<N;++F)(w=G[F])&&ts(w,A,I,F,G,h);C.push(G),E.push(D)}return new BE(C,E,A,I)}var hcA=ve.prototype.constructor;function NV(){return new hcA(this._groups,this._parents)}function NcA(g,A){var I,B,Q;return function(){var C=os(this,g),E=(this.style.removeProperty(g),os(this,g));return C===E?null:C===I&&E===B?Q:Q=A(I=C,B=E)}}function kV(g){return function(){this.style.removeProperty(g)}}function kcA(g,A,I){var B,Q=I+"",C;return function(){var E=os(this,g);return E===Q?null:E===B?C:C=A(B=E,I)}}function ycA(g,A,I){var B,Q,C;return function(){var E=os(this,g),o=I(this),e=o+"";return o==null&&(e=o=(this.style.removeProperty(g),os(this,g))),E===e?null:E===B&&e===Q?C:(Q=e,C=A(B=E,o))}}function FcA(g,A){var I,B,Q,C="style."+A,E="end."+C,o;return function(){var e=ZQ(this,g),a=e.on,D=e.value[C]==null?o||(o=kV(A)):void 0;(a!==I||Q!==D)&&(B=(I=a).copy()).on(E,Q=D),e.on=B}}function yV(g,A,I){var B=(g+="")=="transform"?dL:sJ;return A==null?this.styleTween(g,NcA(g,B)).on("end.style."+g,kV(g)):typeof A=="function"?this.styleTween(g,ycA(g,B,cc(this,"style."+g,A))).each(FcA(this._id,g)):this.styleTween(g,kcA(g,B,A),I).on("end.style."+g,null)}function lcA(g,A,I){return function(B){this.style.setProperty(g,A.call(this,B),I)}}function RcA(g,A,I){var B,Q;function C(){var E=A.apply(this,arguments);return E!==Q&&(B=(Q=E)&&lcA(g,E,I)),B}return C._value=A,C}function FV(g,A,I){var B="style."+(g+="");if(arguments.length<2)return(B=this.tween(B))&&B._value;if(A==null)return this.tween(B,null);if(typeof A!="function")throw new Error;return this.tween(B,RcA(g,A,I??""))}function McA(g){return function(){this.textContent=g}}function JcA(g){return function(){var A=g(this);this.textContent=A??""}}function lV(g){return this.tween("text",typeof g=="function"?JcA(cc(this,"text",g)):McA(g==null?"":g+""))}function pcA(g){return function(A){this.textContent=g.call(this,A)}}function YcA(g){var A,I;function B(){var Q=g.apply(this,arguments);return Q!==I&&(A=(I=Q)&&pcA(Q)),A}return B._value=g,B}function RV(g){var A="text";if(arguments.length<1)return(A=this.tween(A))&&A._value;if(g==null)return this.tween(A,null);if(typeof g!="function")throw new Error;return this.tween(A,YcA(g))}function MV(){for(var g=this._name,A=this._id,I=DJ(),B=this._groups,Q=B.length,C=0;C<Q;++C)for(var E=B[C],o=E.length,e,a=0;a<o;++a)if(e=E[a]){var D=IQ(e,A);ts(e,g,I,a,E,{time:D.time+D.delay+D.duration,delay:0,duration:D.duration,ease:D.ease})}return new BE(B,this._parents,g,I)}function JV(){var g,A,I=this,B=I._id,Q=I.size();return new Promise(function(C,E){var o={value:E},e={value:function(){--Q===0&&C()}};I.each(function(){var a=ZQ(this,B),D=a.on;D!==g&&(A=(g=D).copy(),A._.cancel.push(o),A._.interrupt.push(o),A._.end.push(e)),a.on=A}),Q===0&&C()})}var KcA=0;function BE(g,A,I,B){this._groups=g,this._parents=A,this._name=I,this._id=B}function pV(g){return ve().transition(g)}function DJ(){return++KcA}var je=ve.prototype;BE.prototype=pV.prototype={constructor:BE,select:wV,selectAll:hV,selectChild:je.selectChild,selectChildren:je.selectChildren,filter:rV,merge:nV,selection:NV,transition:MV,call:je.call,nodes:je.nodes,node:je.node,size:je.size,empty:je.empty,each:je.each,on:cV,attr:oV,attrTween:tV,style:yV,styleTween:FV,text:lV,textTween:RV,remove:GV,tween:iV,delay:eV,duration:aV,ease:sV,easeVarying:DV,end:JV,[Symbol.iterator]:je[Symbol.iterator]};function YE(g){return((g*=2)<=1?g*g*g:(g-=2)*g*g+2)/2}var dcA={time:null,delay:0,duration:250,ease:YE};function qcA(g,A){for(var I;!(I=g.__transition)||!(I=I[A]);)if(!(g=g.parentNode))throw new Error(`transition ${A} not found`);return I}function YV(g){var A,I;g instanceof BE?(A=g._id,g=g._name):(A=DJ(),(I=dcA).time=KN(),g=g==null?null:g+"");for(var B=this._groups,Q=B.length,C=0;C<Q;++C)for(var E=B[C],o=E.length,e,a=0;a<o;++a)(e=E[a])&&ts(e,g,A,a,E,I||qcA(e,A));return new BE(B,this._parents,g,A)}ve.prototype.interrupt=EV;ve.prototype.transition=YV;var{abs:Xwg,max:zwg,min:_wg}=Math;function KV(g){return[+g[0],+g[1]]}function UcA(g){return[KV(g[0]),KV(g[1])]}var $wg={name:"x",handles:["w","e"].map(SL),input:function(g,A){return g==null?null:[[+g[0],A[0][1]],[+g[1],A[1][1]]]},output:function(g){return g&&[g[0][0],g[1][0]]}},Ahg={name:"y",handles:["n","s"].map(SL),input:function(g,A){return g==null?null:[[A[0][0],+g[0]],[A[1][0],+g[1]]]},output:function(g){return g&&[g[0][1],g[1][1]]}},ghg={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(SL),input:function(g){return g==null?null:UcA(g)},output:function(g){return g}};function SL(g){return{type:g}}function dV(g){return Math.abs(g=Math.round(g))>=1e21?g.toLocaleString("en").replace(/,/g,""):g.toString(10)}function TD(g,A){if((I=(g=A?g.toExponential(A-1):g.toExponential()).indexOf("e"))<0)return null;var I,B=g.slice(0,I);return[B.length>1?B[0]+B.slice(2):B,+g.slice(I+1)]}function dt(g){return g=TD(Math.abs(g)),g?g[1]:NaN}function qV(g,A){return function(I,B){for(var Q=I.length,C=[],E=0,o=g[0],e=0;Q>0&&o>0&&(e+o+1>B&&(o=Math.max(1,B-e)),C.push(I.substring(Q-=o,Q+o)),!((e+=o+1)>B));)o=g[E=(E+1)%g.length];return C.reverse().join(A)}}function UV(g){return function(A){return A.replace(/[0-9]/g,function(I){return g[+I]})}}var ScA=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function es(g){if(!(A=ScA.exec(g)))throw new Error("invalid format: "+g);var A;return new rJ({fill:A[1],align:A[2],sign:A[3],symbol:A[4],zero:A[5],width:A[6],comma:A[7],precision:A[8]&&A[8].slice(1),trim:A[9],type:A[10]})}es.prototype=rJ.prototype;function rJ(g){this.fill=g.fill===void 0?" ":g.fill+"",this.align=g.align===void 0?">":g.align+"",this.sign=g.sign===void 0?"-":g.sign+"",this.symbol=g.symbol===void 0?"":g.symbol+"",this.zero=!!g.zero,this.width=g.width===void 0?void 0:+g.width,this.comma=!!g.comma,this.precision=g.precision===void 0?void 0:+g.precision,this.trim=!!g.trim,this.type=g.type===void 0?"":g.type+""}rJ.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function SV(g){A:for(var A=g.length,I=1,B=-1,Q;I<A;++I)switch(g[I]){case".":B=Q=I;break;case"0":B===0&&(B=I),Q=I;break;default:if(!+g[I])break A;B>0&&(B=0);break}return B>0?g.slice(0,B)+g.slice(Q+1):g}var LL;function LV(g,A){var I=TD(g,A);if(!I)return g+"";var B=I[0],Q=I[1],C=Q-(LL=Math.max(-8,Math.min(8,Math.floor(Q/3)))*3)+1,E=B.length;return C===E?B:C>E?B+new Array(C-E+1).join("0"):C>0?B.slice(0,C)+"."+B.slice(C):"0."+new Array(1-C).join("0")+TD(g,Math.max(0,A+C-1))[0]}function HL(g,A){var I=TD(g,A);if(!I)return g+"";var B=I[0],Q=I[1];return Q<0?"0."+new Array(-Q).join("0")+B:B.length>Q+1?B.slice(0,Q+1)+"."+B.slice(Q+1):B+new Array(Q-B.length+2).join("0")}var fL={"%":(g,A)=>(g*100).toFixed(A),b:g=>Math.round(g).toString(2),c:g=>g+"",d:dV,e:(g,A)=>g.toExponential(A),f:(g,A)=>g.toFixed(A),g:(g,A)=>g.toPrecision(A),o:g=>Math.round(g).toString(8),p:(g,A)=>HL(g*100,A),r:HL,s:LV,X:g=>Math.round(g).toString(16).toUpperCase(),x:g=>Math.round(g).toString(16)};function uL(g){return g}var HV=Array.prototype.map,fV=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function uV(g){var A=g.grouping===void 0||g.thousands===void 0?uL:qV(HV.call(g.grouping,Number),g.thousands+""),I=g.currency===void 0?"":g.currency[0]+"",B=g.currency===void 0?"":g.currency[1]+"",Q=g.decimal===void 0?".":g.decimal+"",C=g.numerals===void 0?uL:UV(HV.call(g.numerals,String)),E=g.percent===void 0?"%":g.percent+"",o=g.minus===void 0?"\u2212":g.minus+"",e=g.nan===void 0?"NaN":g.nan+"";function a(n){n=es(n);var G=n.fill,w=n.align,h=n.sign,F=n.symbol,N=n.zero,l=n.width,p=n.comma,R=n.precision,y=n.trim,Y=n.type;Y==="n"?(p=!0,Y="g"):fL[Y]||(R===void 0&&(R=12),y=!0,Y="g"),(N||G==="0"&&w==="=")&&(N=!0,G="0",w="=");var d=F==="$"?I:F==="#"&&/[boxX]/.test(Y)?"0"+Y.toLowerCase():"",f=F==="$"?B:/[%p]/.test(Y)?E:"",K=fL[Y],x=/[defgprs%]/.test(Y);R=R===void 0?6:/[gprs]/.test(Y)?Math.max(1,Math.min(21,R)):Math.max(0,Math.min(20,R));function u(P){var H=d,X=f,J,BA,cA;if(Y==="c")X=K(P)+X,P="";else{P=+P;var kA=P<0||1/P<0;if(P=isNaN(P)?e:K(Math.abs(P),R),y&&(P=SV(P)),kA&&+P==0&&h!=="+"&&(kA=!1),H=(kA?h==="("?h:o:h==="-"||h==="("?"":h)+H,X=(Y==="s"?fV[8+LL/3]:"")+X+(kA&&h==="("?")":""),x){for(J=-1,BA=P.length;++J<BA;)if(cA=P.charCodeAt(J),48>cA||cA>57){X=(cA===46?Q+P.slice(J+1):P.slice(J))+X,P=P.slice(0,J);break}}}p&&!N&&(P=A(P,1/0));var yA=H.length+P.length+X.length,MA=yA<l?new Array(l-yA+1).join(G):"";switch(p&&N&&(P=A(MA+P,MA.length?l-X.length:1/0),MA=""),w){case"<":P=H+P+X+MA;break;case"=":P=H+MA+P+X;break;case"^":P=MA.slice(0,yA=MA.length>>1)+H+P+X+MA.slice(yA);break;default:P=MA+H+P+X;break}return C(P)}return u.toString=function(){return n+""},u}function D(n,G){var w=a((n=es(n),n.type="f",n)),h=Math.max(-8,Math.min(8,Math.floor(dt(G)/3)))*3,F=Math.pow(10,-h),N=fV[8+h/3];return function(l){return w(F*l)+N}}return{format:a,formatPrefix:D}}var nJ,cJ,GJ;mL({thousands:",",grouping:[3],currency:["$",""]});function mL(g){return nJ=uV(g),cJ=nJ.format,GJ=nJ.formatPrefix,nJ}function xL(g){return Math.max(0,-dt(Math.abs(g)))}function bL(g,A){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(dt(A)/3)))*3-dt(Math.abs(g)))}function TL(g,A){return g=Math.abs(g),A=Math.abs(A)-g,Math.max(0,dt(A)-dt(g))+1}function WL(g){for(var A=-1,I=g.length,B,Q=g[I-1],C=0;++A<I;)B=Q,Q=g[A],C+=B[1]*Q[0]-B[0]*Q[1];return C/2}function Gc(g,A){switch(arguments.length){case 0:break;case 1:this.range(g);break;default:this.range(A).domain(g);break}return this}var mV=Symbol("implicit");function wJ(){var g=new ac,A=[],I=[],B=mV;function Q(C){let E=g.get(C);if(E===void 0){if(B!==mV)return B;g.set(C,E=A.push(C)-1)}return I[E%I.length]}return Q.domain=function(C){if(!arguments.length)return A.slice();A=[],g=new ac;for(let E of C)g.has(E)||g.set(E,A.push(E)-1);return Q},Q.range=function(C){return arguments.length?(I=Array.from(C),Q):I.slice()},Q.unknown=function(C){return arguments.length?(B=C,Q):B},Q.copy=function(){return wJ(A,I).unknown(B)},Gc.apply(Q,arguments),Q}function Ko(){var g=wJ().unknown(void 0),A=g.domain,I=g.range,B=0,Q=1,C,E,o=!1,e=0,a=0,D=.5;delete g.unknown;function n(){var G=A().length,w=Q<B,h=w?Q:B,F=w?B:Q;C=(F-h)/Math.max(1,G-e+a*2),o&&(C=Math.floor(C)),h+=(F-h-C*(G-e))*D,E=C*(1-e),o&&(h=Math.round(h),E=Math.round(E));var N=Ki(G).map(function(l){return h+C*l});return I(w?N.reverse():N)}return g.domain=function(G){return arguments.length?(A(G),n()):A()},g.range=function(G){return arguments.length?([B,Q]=G,B=+B,Q=+Q,n()):[B,Q]},g.rangeRound=function(G){return[B,Q]=G,B=+B,Q=+Q,o=!0,n()},g.bandwidth=function(){return E},g.step=function(){return C},g.round=function(G){return arguments.length?(o=!!G,n()):o},g.padding=function(G){return arguments.length?(e=Math.min(1,a=+G),n()):e},g.paddingInner=function(G){return arguments.length?(e=Math.min(1,G),n()):e},g.paddingOuter=function(G){return arguments.length?(a=+G,n()):a},g.align=function(G){return arguments.length?(D=Math.max(0,Math.min(1,G)),n()):D},g.copy=function(){return Ko(A(),[B,Q]).round(o).paddingInner(e).paddingOuter(a).align(D)},Gc.apply(n(),arguments)}function ZL(g){return function(){return g}}function PL(g){return+g}var xV=[0,1];function wc(g){return g}function OL(g,A){return(A-=g=+g)?function(I){return(I-g)/A}:ZL(isNaN(A)?NaN:.5)}function LcA(g,A){var I;return g>A&&(I=g,g=A,A=I),function(B){return Math.max(g,Math.min(A,B))}}function HcA(g,A,I){var B=g[0],Q=g[1],C=A[0],E=A[1];return Q<B?(B=OL(Q,B),C=I(E,C)):(B=OL(B,Q),C=I(C,E)),function(o){return C(B(o))}}function fcA(g,A,I){var B=Math.min(g.length,A.length)-1,Q=new Array(B),C=new Array(B),E=-1;for(g[B]<g[0]&&(g=g.slice().reverse(),A=A.slice().reverse());++E<B;)Q[E]=OL(g[E],g[E+1]),C[E]=I(A[E],A[E+1]);return function(o){var e=wL(g,o,1,B)-1;return C[e](Q[e](o))}}function bV(g,A){return A.domain(g.domain()).range(g.range()).interpolate(g.interpolate()).clamp(g.clamp()).unknown(g.unknown())}function ucA(){var g=xV,A=xV,I=xD,B,Q,C,E=wc,o,e,a;function D(){var G=Math.min(g.length,A.length);return E!==wc&&(E=LcA(g[0],g[G-1])),o=G>2?fcA:HcA,e=a=null,n}function n(G){return G==null||isNaN(G=+G)?C:(e||(e=o(g.map(B),A,I)))(B(E(G)))}return n.invert=function(G){return E(Q((a||(a=o(A,g.map(B),WQ)))(G)))},n.domain=function(G){return arguments.length?(g=Array.from(G,PL),D()):g.slice()},n.range=function(G){return arguments.length?(A=Array.from(G),D()):A.slice()},n.rangeRound=function(G){return A=Array.from(G),I=YL,D()},n.clamp=function(G){return arguments.length?(E=G?!0:wc,D()):E!==wc},n.interpolate=function(G){return arguments.length?(I=G,D()):I},n.unknown=function(G){return arguments.length?(C=G,n):C},function(G,w){return B=G,Q=w,D()}}function VL(){return ucA()(wc,wc)}function vL(g,A,I,B){var Q=hL(g,A,I),C;switch(B=es(B??",f"),B.type){case"s":{var E=Math.max(Math.abs(g),Math.abs(A));return B.precision==null&&!isNaN(C=bL(Q,E))&&(B.precision=C),GJ(B,E)}case"":case"e":case"g":case"p":case"r":{B.precision==null&&!isNaN(C=TL(Q,Math.max(Math.abs(g),Math.abs(A))))&&(B.precision=C-(B.type==="e"));break}case"f":case"%":{B.precision==null&&!isNaN(C=xL(Q))&&(B.precision=C-(B.type==="%")*2);break}}return cJ(B)}function mcA(g){var A=g.domain;return g.ticks=function(I){var B=A();return WM(B[0],B[B.length-1],I??10)},g.tickFormat=function(I,B){var Q=A();return vL(Q[0],Q[Q.length-1],I??10,B)},g.nice=function(I){I==null&&(I=10);var B=A(),Q=0,C=B.length-1,E=B[Q],o=B[C],e,a,D=10;for(o<E&&(a=E,E=o,o=a,a=Q,Q=C,C=a);D-- >0;){if(a=rN(E,o,I),a===e)return B[Q]=E,B[C]=o,A(B);if(a>0)E=Math.floor(E/a)*a,o=Math.ceil(o/a)*a;else if(a<0)E=Math.ceil(E*a)/a,o=Math.floor(o*a)/a;else break;e=a}return g},g}function qo(){var g=VL();return g.copy=function(){return bV(g,qo())},Gc.apply(g,arguments),mcA(g)}function as(g,A,I){this.k=g,this.x=A,this.y=I}as.prototype={constructor:as,scale:function(g){return g===1?this:new as(this.k*g,this.x,this.y)},translate:function(g,A){return g===0&A===0?this:new as(this.k,this.x+this.k*g,this.y+this.k*A)},apply:function(g){return[g[0]*this.k+this.x,g[1]*this.k+this.y]},applyX:function(g){return g*this.k+this.x},applyY:function(g){return g*this.k+this.y},invert:function(g){return[(g[0]-this.x)/this.k,(g[1]-this.y)/this.k]},invertX:function(g){return(g-this.x)/this.k},invertY:function(g){return(g-this.y)/this.k},rescaleX:function(g){return g.copy().domain(g.range().map(this.invertX,this).map(g.invert,g))},rescaleY:function(g){return g.copy().domain(g.range().map(this.invertY,this).map(g.invert,g))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var jL=new as(1,0,0);XL.prototype=as.prototype;function XL(g){for(;!g.__zoom;)if(!(g=g.parentNode))return jL;return g.__zoom}var hJ=(g,A,I,B,Q)=>{let C=Math.floor(g/Q),E=Math.floor(A/Q),o=Math.floor(I/Q),e=Math.floor(B/Q),a=[];for(let D=C;D<=E;D++)for(let n=o;n<=e;n++)a.push({tileX:D,tileY:n,name:`${D}_${n}`});return a};var aI=(g,A)=>{g.cat=A},NJ=(g,A,I)=>{g.cell_cats=A.getChild(I).toArray()},TV=(g,A)=>{g.cell_cats=A.map(I=>I==="nan"?null:I)},kJ=g=>{g.cell_names_array.forEach((A,I)=>{g.dict_cell_cats[A]=g.cell_cats[I]})},lI=(g,A,I)=>{g.reset_cat=A.length===g.selected_cats.length&&A.every((B,Q)=>B===g.selected_cats[Q]),g.selected_cats=g.reset_cat?[]:A,I.selected_cats.set(g.selected_cats)};var RI=(g,A,I)=>{let B=A.length===g.selected_genes.length&&A.every((Q,C)=>Q===g.selected_genes[C]);g.selected_genes=B?[]:A,I.selected_genes.set(g.selected_genes)},yJ=(g,A)=>{g.model&&typeof g.model.set=="function"&&(g.model.set("selected_genes",A),g.model.save_changes()),g.obs_store&&g.obs_store.selected_genes&&g.obs_store.selected_genes.set(A)};var WV=async(g,A,I,B=null)=>{let Q;if(g.get(A))Q=g.get(A);else try{let C=B!==null?await B.fetch(A):await fetch(A,I.fetch);if(!C.ok)throw new Error(`Network response was not ok: ${C.statusText}`);let E=await C.arrayBuffer();Q=ri(E),g.set(A,Q)}catch(C){gB(C,{context:`fetching or parsing Arrow data from ${A}`,url:A,logUnexpected:!0,throwOnAuth:!1}),Q=null}return Q};var FJ=async(g,A,I,B)=>Promise.all(A.map(Q=>WV(g,Q,I,B)));var ZV=g=>{let A=g.getChildAt(0);if(A.data[0].type.typeId===12){let I=A.data[0].valueOffsets,B=A.getChildAt(0).data[0].valueOffsets,C=A.getChildAt(0).getChildAt(0).getChildAt(0).data[0].values,E=new Int32Array(I.length);for(let e=0;e<E.length;++e)E[e]=B[I[e]];return{length:g.numRows,startIndices:E,attributes:{getPolygon:{value:C,size:2}}}}else return null};var PV=g=>{g=g.filter(I=>I!=null);let A={length:0,startIndices:new Int32Array,attributes:{getPolygon:{value:new Float64Array,size:2}}};return g.forEach((I,B)=>{A.length+=I.length;let Q=A.attributes.getPolygon.value.length/2,C=I.startIndices;if(B>0){C=new Int32Array(I.startIndices.length);for(let E=0;E<I.startIndices.length;E++)C[E]=I.startIndices[E]+Q}A.startIndices=new Int32Array([...A.startIndices,...C.slice(B>0?1:0)]),A.attributes.getPolygon.value=new Float64Array([...A.attributes.getPolygon.value,...I.attributes.getPolygon.value])}),A},OV=g=>{if(g.length===0)return null;let A=g[0];for(let I=1;I<g.length;I++)A=A.concat(g[I]);return A};var VV=g=>{let A=[],{startIndices:I,attributes:B}=g,Q=B.getPolygon.value,C=I.length-1;for(let E=0;E<C;++E){let o=I[E]*2,e=I[E+1]*2,a=[];for(let D=o;D<e;D+=2){let n=Q[D],G=Q[D+1];a.push([n,G])}A.push(a)}return A};var vV=async(g,A,I)=>{let B;I.seg.version==="default"?B=`${g}/cell_segmentation`:B=`${g}/cell_segmentation_${I.seg.version}`;let Q=A.map(D=>`${B}/cell_tile_${D.tileX}_${D.tileY}.parquet`),E=(await FJ(I.cache.cell,Q,zg,I.aws)).filter(D=>D!==null);I.vector_name_integer?I.cats.polygon_cell_names=E.flatMap(D=>Array.from(D.getChild("name").toArray()).map(G=>I.cats.nameMapping_inv[G])):I.cats.polygon_cell_names=E.flatMap(D=>Array.from(D.getChild("name").toArray()));let o=E.map(D=>ZV(D)),e=PV(o);return VV(e)};var xcA=(g,A,I)=>{let B=g.polygon_cell_names[I.index],Q=g.dict_cell_cats[B],C;Q in g.color_dict_cluster?C=g.color_dict_cluster[Q]:C=[0,0,255];let E=g.selected_cats.length===0||g.selected_cats.includes(Q)?255:50;return[...C,E]},lJ=g=>new No({id:"path-layer",data:[],pickable:!0,widthScale:3,widthMinPixels:1,getPath:I=>I,getColor:(I,B)=>xcA(g.cats,I,B),widthUnits:"pixels",...hQ(g.rotation)}),bcA=async(g,A,I,B,Q)=>{let C=Q.cats.polygon_cell_names[g.index],E=Q.cats.dict_cell_cats[C];Q.obs_store.deck_check.set({...Q.obs_store.deck_check.get(),cell_layer:!1,path_layer:!1,trx_layer:!1}),aI(Q.cats,"cluster"),lI(Q.cats,[E],Q.obs_store),RI(Q.genes,[],Q.obs_store)},RJ=async(g,A,I,B)=>{let Q=await vV(g,A,B);I.path_layer=I.path_layer.clone({data:Q}),B.layers_obj=I,B.obs_store.deck_check.set({...B.obs_store.deck_check.get(),path_data:!0})},MJ=(g,A,I)=>{A.path_layer=A.path_layer.clone({onClick:(B,Q)=>bcA(B,Q,g,A,I)})},hc=(g,A)=>{g.path_layer=g.path_layer.clone({visible:A})},WD=(g,A)=>{g.path_layer=g.path_layer.clone({pickable:A})};var ZB=async(g,A,I)=>{try{let Q=await(I!==null?await I.fetch(g):await fetch(g,A)).arrayBuffer();return ri(Q)}catch(B){return gB(B,{context:"loading arrow table data",url:g,logUnexpected:!0,throwOnAuth:!1}),[]}};function jV(g,A){let I=Math.log1p(g),B=Math.log1p(A);return I/B*255}var di=async(g,A,I,B,Q,C,E)=>{let o;Q==="default"?o=`${I}/cbg/${B}.parquet`:o=`${I}/cbg_${Q}/${B}.parquet`;let e=await ZB(o,zg.fetch,E),a=e.getChild("__index_level_0__").toArray(),D=e.getChild(B).toArray(),n=new Array(g.cell_names_array.length).fill(0),G=g.meta_cell_id_set&&g.meta_cell_id_set.size>0?g.meta_cell_id_set:null,w=new Set,h=new Set;a.forEach((F,N)=>{F=String(F);let l=Number(D[N]),p=Number(A.meta_gene[B].max);if(C)if(F in g.nameMapping_inv){let R=String(g.nameMapping_inv[F]);(!G||G.has(R))&&(n[F]=jV(l,p))}else h.add(F);else if(g.cell_name_to_index_map.has(F)){let R=g.cell_name_to_index_map.get(F);(!G||G.has(F))&&(n[R]=jV(l,p))}else w.add(F)}),w.size>0,h.size>0,g.cell_exp_array=n};var ss=g=>{try{let A=g.getChild("geometry").getChildAt(0).data.map(Q=>Q.values).reduce((Q,C)=>{let E=new Float64Array(Q.length+C.length);return E.set(Q),E.set(C,Q.length),E},new Float64Array(0)),I=A.length/g.numRows;return{length:g.numRows,attributes:{getPosition:{value:A,size:I}}}}catch(A){return gB(A,{context:"processing scatter data from arrow table",logUnexpected:!0,throwOnAuth:!1}),[]}};var XV=async(g,A,I)=>{let B=A.map(D=>`${g}/transcript_tiles/transcripts_tile_${D.tileX}_${D.tileY}.parquet`),C=(await FJ(I.cache.trx,B,zg,I.aws)).filter(D=>D!==null),E=OV(C),o=[];I.vector_name_integer?o=Array.from(E.getChild("name").toArray()).map(D=>I.genes.g_nameMapping_inv[D]):o=E.getChild("name").toArray(),I.genes.trx_names_array=o;let e=ss(E),a=e.attributes.getPosition.value;return I.combo_data.trx=I.genes.trx_names_array.map((D,n)=>({name:D,x:a[n*2],y:a[n*2+1]})),e};var TcA=async(g,A,I,B,Q)=>{let C=Q.genes.trx_names_array[g.index];if(!C)return;let o=C===Q.cats.cat?"cluster":C;aI(Q.cats,o),Q.obs_store.deck_check.set({...Q.obs_store.deck_check.get(),cell_layer:!1,trx_layer:!1}),RI(Q.genes,[C],Q.obs_store),lI(Q.cats,[C],Q.obs_store),await di(Q.cats,Q.genes,Q.global_base_url,C,Q.seg.version,Q.vector_name_integer,Q.aws)},JJ=g=>{let{genes:A}=g;return new wQ({id:"trx-layer",data:A.trx_data,pickable:!0,getFillColor:(B,Q)=>{let C=A.trx_names_array[Q.index],E=A.color_dict_gene[C],o=A.selected_genes.length===0||A.selected_genes.includes(C)?255:5;return[...E,o]},...hQ(g.rotation)})},pJ=(g,A,I)=>{A.trx_layer=A.trx_layer.clone({onClick:(B,Q)=>TcA(B,Q,g,A,I)})},YJ=async(g,A,I,B)=>{B.genes.trx_data=await XV(g,A,B),I.trx_layer=I.trx_layer.clone({data:B.genes.trx_data}),B.layers_obj=I,B.obs_store.deck_check.set({...B.obs_store.deck_check.get(),trx_layer:!0,trx_data:!0})},qt=(g,A)=>{g.trx_layer=g.trx_layer.clone({visible:A})},Nc=(g,A)=>{g.trx_layer=g.trx_layer.clone({getRadius:A})},ZD=(g,A)=>{g.trx_layer=g.trx_layer.clone({pickable:A})};var KJ=async({height:g,width:A,zoom:I,target:B},Q,C,E)=>{let o=E.close_up,{tile_size:e}=E.img.landscape_parameters,a=Math.pow(2,I),[D,n]=B,G=A/(2*a),w=g/(2*a);E.bounds={},E.bounds.min_x=D-G,E.bounds.max_x=D+G,E.bounds.min_y=n-w,E.bounds.max_y=n+w;let h=Q.viewManager.getViewports();if(!h||h.length===0)return;let F=(()=>{if(!E.rotation?.hasRotation)return E.bounds;let l=[[E.bounds.min_x,E.bounds.min_y],[E.bounds.min_x,E.bounds.max_y],[E.bounds.max_x,E.bounds.min_y],[E.bounds.max_x,E.bounds.max_y]].map(([y,Y])=>B4(y,Y,E.rotation)),p=l.map(([y])=>y),R=l.map(([,y])=>y);return{min_x:Math.min(...p),max_x:Math.max(...p),min_y:Math.min(...R),max_y:Math.max(...R)}})(),N=hJ(F.min_x,F.max_x,F.min_y,F.max_y,e);if(N.length<E.max_tiles_to_view){E.obs_store.deck_check.set({...E.obs_store.deck_check.get(),trx_data:!1,path_data:!1}),E.close_up=!0,await YJ(E.global_base_url,N,C,E),await RJ(E.global_base_url,N,C,E);let R=E.combo_data.trx.filter(f=>{if(!E.rotation?.hasRotation)return f.x>=E.bounds.min_x&&f.x<=E.bounds.max_x&&f.y>=E.bounds.min_y&&f.y<=E.bounds.max_y;let[K,x]=RU(f.x,f.y,E.rotation);return K>=E.bounds.min_x&&K<=E.bounds.max_x&&x>=E.bounds.min_y&&x<=E.bounds.max_y}).map(f=>f.name).reduce((f,K)=>{let x=f.find(u=>u.name===K);return x?x.value+=1:f.push({name:K,value:1}),f},[]).filter(f=>f.value>0).sort((f,K)=>K.value-f.value).slice(0,100);E.obs_store.new_gene_bar_data.set(R);let d=E.combo_data.cell.filter(f=>{if(!E.rotation?.hasRotation)return f.x>=E.bounds.min_x&&f.x<=E.bounds.max_x&&f.y>=E.bounds.min_y&&f.y<=E.bounds.max_y;let[K,x]=RU(f.x,f.y,E.rotation);return K>=E.bounds.min_x&&K<=E.bounds.max_x&&x>=E.bounds.min_y&&x<=E.bounds.max_y}).map(f=>f.cat).reduce((f,K)=>{let x=f.find(u=>u.name===K);return x?x.value+=1:f.push({name:K,value:1}),f},[]).filter(f=>f.value>0).sort((f,K)=>K.value-f.value);E.obs_store.new_cell_bar_data.set(d)}else o&&(E.obs_store.deck_check.set({...E.obs_store.deck_check.get(),trx_data:!1,path_data:!1}),E.close_up=!1,E.obs_store.deck_check.set({...E.obs_store.deck_check.get(),trx_data:!0,path_data:!0}),E.obs_store.new_gene_bar_data.set(E.genes.top_gene_counts),E.obs_store.new_cell_bar_data.set(E.cats.cluster_counts),E.containers.bar_gene.scrollTo({top:0,behavior:"smooth"}),E.containers.bar_cluster.scrollTo({top:0,behavior:"smooth"}));E.layers_obj=C};var zV=(g,A)=>{if(g.index===-1||!g.layer)return null;let I=A.cats.tile_cats_array[g.index];return A.tooltip_cat_cell=I,FL(".deck-tooltip").style("margin-top","75px"),{html:`<div>${I}</div>`}},_V=(g,A)=>{if(A.index===-1||!A.layer||g.edit?.mode==="sktch")return null;let I="",B="",Q="";if(A.layer.id.startsWith("cell-layer")||A.layer.id.startsWith("path-layer"))B=A.layer.id.startsWith("cell-layer")?g.cats.cell_names_array[A.index]:g.cats.polygon_cell_names[A.index],Q=g.cats.dict_cell_cats[B],I=`<div>cell: ${B}</div><div>cluster: ${Q}</div>`,g.tooltip_cat_cell=Q;else if(A.layer.id.startsWith("trx-layer"))B=g.genes.trx_names_array[A.index],I=`<div>transcript: ${B}</div>`;else if(A.layer.id.startsWith("nbhd-layer"))B=g.nbhd.feature_collection.features[A.index].properties.name,Q=g.nbhd.feature_collection.features[A.index].properties.cat,I=`<div>neighborhood: ${B}</div><div>category: ${Q}</div>`;else if(A.layer.id.startsWith("edit-layer")){let E=g.edit?.feature_collection?.features?.[A.index];E&&(B=E.properties.name||`nbhd_${A.index+1}`,Q=E.properties.cat||B,I=`<div>neighborhood: ${B}</div>`)}let C=g.root.querySelector(".deck-tooltip");if(C){C.style.marginTop="50px";let E=C.parentElement?.parentElement;E&&(E.style.position="unset")}return{html:I}};var kc=(g,A,I=!1)=>{let B;return function(...Q){let C=I&&!B;clearTimeout(B),B=setTimeout(()=>{B=null,I||g.apply(this,Q)},A),C&&g.apply(this,Q)}};var WcA=200,$V=kc(({viewState:g},A,I,B)=>(B.obs_store.umap_state.get()===!1&&KJ(g,A,I,B),B.scale_bar&&B.obs_store.scale_bar_view_state.set(g),typeof B.custom_callbacks.view_change=="function"&&B.custom_callbacks.view_change(g,B.close_up,I.trx_layer),g),WcA);var ZcA=({isDragging:g})=>g?"grabbing":"pointer",dJ=(g,A,I,B="")=>{let Q={doubleClickZoom:!1};return B==="point-cloud"&&(Q.type=Ue),new ma({parent:g,controller:Q,getCursor:ZcA,width:A,height:I})},qJ=(g,A)=>{g.setProps({views:A})},UJ=(g,A)=>{g.setProps({getTooltip:I=>_V(A,I)})},Av=(g,A,I)=>{g.setProps({onViewStateChange:B=>{$V(B,g,A,I)}})},gv=(g,A,I,B,Q,C,E=0,o=0)=>{let{center_x:e,center_y:a,center_z:D=0,ini_zoom:n}=C.spatial;A===0&&I===0&&B===0&&Q===0&&(A=e,I=a,B=D,Q=n);let G={target:[A,I,B],zoom:Q};C.img.landscape_parameters.technology==="point-cloud"&&(G.rotationOrbit=E,G.rotationX=o),g.setProps({initialViewState:G}),C.scale_bar&&C.obs_store.scale_bar_view_state.set(G)};var yc=g=>{let A=[0,0,0,255],{width:I,height:B}=g.dimensions;return new Pa({id:"background-layer",data:[{polygon:[[0,0],[I,0],[I,B],[0,B]]}],getPolygon:C=>C.polygon,getFillColor:A,pickable:!1,...hQ(g.rotation)})},SJ=(g,A)=>{g.background_layer=g.background_layer.clone({visible:A})};var LJ=(g,A)=>{g.cell_names_array=A.getChild("name").toArray();let I=g.cell_names_array.reduce((B,Q,C)=>(B[C]=Q,B),{});g.nameMapping_inv=I},HJ=g=>{g.cell_names_array.forEach((A,I)=>{A=String(A),g.cell_name_to_index_map.set(A,I)})};var _E=g=>(g=g.replace(/^#/,""),g.length===3&&(g=g.replace(/./g,"$&$&")),g.length===6?[0,2,4].map(A=>parseInt(g.substr(A,2),16)):[0,0,0]),PcA=g=>{if(!g||!Array.isArray(g)||g.length<3)return"#808080";let A=C=>Math.max(0,Math.min(255,Math.round(C))),I=A(g[0]).toString(16).padStart(2,"0"),B=A(g[1]).toString(16).padStart(2,"0"),Q=A(g[2]).toString(16).padStart(2,"0");return`#${I}${B}${Q}`},Fc=()=>{let g=Math.floor(Math.random()*256),A=Math.floor(Math.random()*256),I=Math.floor(Math.random()*256);return PcA([g,A,I])};var fJ=async(g,A,I,B)=>{let Q;I==="default"?Q=`${A}/meta_gene.parquet`:Q=`${A}/meta_gene_${I}.parquet`;let C=await ZB(Q,zg.fetch,B),E=[],o=[],e=C.getChild("__index_level_0__"),a=C.getChild("color");e&&a&&(E=e.toArray(),o=a.toArray()),E.forEach((D,n)=>{g.color_dict_gene[D]=_E(o[n])}),g.gene_names=E};var uJ=(g,A)=>{let I,B,Q,C;["Chromium","point-cloud"].includes(g.img.landscape_parameters.technology)?(I=0,B=1e4,Q=0,C=1e4):{x_min:I,x_max:B,y_min:Q,y_max:C}=g.spatial;let E=B-I,o=C-Q,e=Math.max(E,o),a=(B-I)/2,D=(C-Q)/2,n=FQ(A.map(Y=>Y.umap[0])),G=bI(A.map(Y=>Y.umap[0])),w=FQ(A.map(Y=>Y.umap[1])),h=bI(A.map(Y=>Y.umap[1])),F=G-n,N=h-w;A.forEach(Y=>{Y.umap[0]=(Y.umap[0]-n)/F*e,Y.umap[1]=(Y.umap[1]-w)/N*e}),n=FQ(A.map(Y=>Y.umap[0])),G=bI(A.map(Y=>Y.umap[0])),w=FQ(A.map(Y=>Y.umap[1])),h=bI(A.map(Y=>Y.umap[1]));let l=(G-n)/2,p=(h-w)/2,R=a-l,y=D-p;return A.forEach(Y=>{Y.umap[0]=Y.umap[0]+R,Y.umap[1]=Y.umap[1]+y}),A};var OcA=async(g,A,I,B,Q)=>{let C="ontouchstart"in window||navigator.maxTouchPoints>0,E;C?E=Q.cats.cell_cats[g.index]:E=Q.tooltip_cat_cell,aI(Q.cats,"cluster"),Q.obs_store.deck_check.set({...Q.obs_store.deck_check.get(),cell_layer:!1,path_layer:!1,trx_layer:!1}),lI(Q.cats,[E],Q.obs_store),RI(Q.genes,[],Q.obs_store)},Iv=(g,A,I,B)=>{let Q=A??new Set,C=Q.size>0,E=g.cell_names_array[B.index],o=C&&Q.has(E),e;if(g.cat==="cluster")try{let D=g.cell_cats[B.index],n=g.color_dict_cluster[D],G=g.selected_cats.length===0||g.selected_cats.includes(D)?255:10;Array.isArray(n)||(n=[0,0,0],G=0),e=[...n,G]}catch{e=[0,0,0,10]}else try{e=[255,0,0,g.cell_exp_array[B.index]]}catch{e=[255,0,0,10]}return C?o?[0,0,255,255]:[...e.slice(0,3),10]:e},mJ=async(g,A)=>{let I;A.seg.version==="default"?I=`${g}/cell_metadata.parquet`:I=`${g}/cell_metadata_${A.seg.version}.parquet`;let B=await ZB(I,zg.fetch,A.aws);if(LJ(A.cats,B),A.spatial.cell_scatter_data=ss(B),await fJ(A.genes,g,A.seg.version,A.aws),HJ(A.cats),A.cats.has_meta_cell){let h=A.cats.meta_cell_attr.indexOf(A.cats.inst_cell_attr);A.cats.cell_cats=A.cats.cell_names_array.map(F=>A.cats.meta_cell[F]?.[h]??"N.A.")}else{let h=await ZB(`${g}/cell_clusters${A.seg.version&&A.seg.version!=="default"?`_${A.seg.version}`:""}/cluster.parquet`,zg.fetch,A.aws);NJ(A.cats,h,"cluster")}kJ(A.cats);let Q=B.getChild("name").toArray(),C=A.spatial.cell_scatter_data.attributes.getPosition.value,E=A.spatial.cell_scatter_data.attributes.getPosition.size||2;A.combo_data.cell=Q.map((h,F)=>({name:h,cat:A.cats.dict_cell_cats[h],x:C[F*E],y:C[F*E+1],z:E===3?C[F*E+2]:0}));let o;if(A.umap.has_umap){let h=new Float64Array(A.cats.cell_names_array.flatMap(N=>{let l;return A.umap.umap[N]?l=A.umap.umap[N]:l=[0,0],l})),F=A.spatial.cell_scatter_data.length;o=Array.from({length:F},(N,l)=>({name:A.cats.cell_names_array[l],position:E===3?[C[l*E],C[l*E+1],C[l*E+2]]:[C[l*E],C[l*E+1]],umap:[h[l*2],h[l*2+1]]})),A.spatial.x_min=FQ(o.map(N=>N.position[0])),A.spatial.x_max=bI(o.map(N=>N.position[0])),A.spatial.y_min=FQ(o.map(N=>N.position[1])),A.spatial.y_max=bI(o.map(N=>N.position[1])),E===3&&(A.spatial.z_min=FQ(o.map(N=>N.position[2])),A.spatial.z_max=bI(o.map(N=>N.position[2]))),o=uJ(A,o)}else{let h=A.spatial.cell_scatter_data.length;o=Array.from({length:h},(F,N)=>({name:A.cats.cell_names_array[N],position:E===3?[C[N*E],C[N*E+1],C[N*E+2]]:[C[N*E],C[N*E+1]]})),A.spatial.x_min=FQ(o.map(F=>F.position[0])),A.spatial.x_max=bI(o.map(F=>F.position[0])),A.spatial.y_min=FQ(o.map(F=>F.position[1])),A.spatial.y_max=bI(o.map(F=>F.position[1])),E===3&&(A.spatial.z_min=FQ(o.map(F=>F.position[2])),A.spatial.z_max=bI(o.map(F=>F.position[2])))}A.spatial.center_x=(A.spatial.x_max+A.spatial.x_min)/2,A.spatial.center_y=(A.spatial.y_max+A.spatial.y_min)/2,E===3&&(A.spatial.center_z=(A.spatial.z_max+A.spatial.z_min)/2,A.spatial.data_depth=A.spatial.z_max-A.spatial.z_min),A.spatial.data_width=A.spatial.x_max-A.spatial.x_min,A.spatial.data_height=A.spatial.y_max-A.spatial.y_min;let e=A.root.clientWidth,a=A.root.clientHeight,D=A.root.clientWidth,n=A.containers.root_dim.height;A.spatial.scale_x=D/A.spatial.data_width,A.spatial.scale_y=n/A.spatial.data_height,A.spatial.scale=Math.min(A.spatial.scale_x,A.spatial.scale_y),A.img.landscape_parameters.technology!=="Chromium"?(A.spatial.ini_zoom=Math.log2(A.spatial.scale)*1.01,A.spatial.ini_x=A.spatial.center_x,A.spatial.ini_y=A.spatial.center_y,E===3&&(A.spatial.ini_z=A.spatial.center_z)):(A.spatial.ini_zoom=Math.log2(D/5e3)*.95,A.spatial.ini_x=5e3,A.spatial.ini_y=5e3),A.spatial.cell_scatter_data_objects=o;let G={getPosition:{duration:3e3,easing:YE}},w;return A.img.landscape_parameters.technology==="point-cloud"?w=new Pl({id:"cell-layer",sizeUnits:"meters",pointSize:5,pickable:!0,getColor:(h,F)=>Iv(A.cats,A.highlighted_cells,h,F),data:A.spatial.cell_scatter_data_objects,transitions:G,getPosition:h=>A.obs_store.umap_state.get()?h.umap:h.position,updateTriggers:{getPosition:[A.obs_store.umap_state.get()],getFillColor:[A.selection_token]},opacity:1,...hQ(A.rotation)}):w=new wQ({id:"cell-layer",radiusMinPixels:1,getRadius:5,pickable:!0,getFillColor:(h,F)=>Iv(A.cats,A.highlighted_cells,h,F),data:A.spatial.cell_scatter_data_objects,transitions:G,getPosition:h=>A.obs_store.umap_state.get()?h.umap:h.position,updateTriggers:{getPosition:[A.obs_store.umap_state.get()],getFillColor:[A.selection_token]},...hQ(A.rotation)}),w},xJ=(g,A,I)=>{A.cell_layer=A.cell_layer.clone({onClick:(B,Q)=>OcA(B,Q,g,A,I)})},PD=(g,A)=>{g.cell_layer=g.cell_layer.clone({visible:A})},VcA=2,Bv=(g,A,I)=>{I.img.landscape_parameters.technology==="point-cloud"?g.cell_layer=g.cell_layer.clone({pointSize:A/VcA}):g.cell_layer=g.cell_layer.clone({getRadius:A})},OD=(g,A)=>{g.cell_layer=g.cell_layer.clone({pickable:A})},Qv=(g,A,I)=>{A.cell_layer=A.cell_layer.clone({updateTriggers:{getPosition:[I.obs_store.umap_state.get()]}})};var vcA=(g,A,I=0,B="")=>{let{max_pyramid_zoom:Q}=g.img.landscape_parameters,C=5,E=`${A.button_name}-ds${I}${B?`-${B}`:""}`;return new YD({id:E,tileSize:g.dimensions.tileSize,refinementStrategy:"no-overlap",minZoom:-7,maxZoom:0,maxCacheSize:0,maxRequests:6,extent:[0,0,g.dimensions.width,g.dimensions.height],getTileData:h0(g.global_base_url,A.name,g.img.image_format,Q,zg,g.aws),renderSubLayers:HR(g.dimensions,A.color,C),...hQ(g.rotation)})},bJ=async(g,A=0)=>{let{image_info:I}=g.img,B=Date.now().toString(36);return I.length===1&&(I[0].name==="h_and_e"||I[0].name==="h&e")?[await Pn(g,I[0],A,B)]:I.map(C=>vcA(g,C,A,B))},TJ=(g,A)=>{g.image_layers=g.image_layers.map(I=>I.clone({visible:A}))},Cv=(g,A,I)=>{g.image_layers=g.image_layers.map(B=>B.id.startsWith(A)?B.clone({visible:I}):B)},Ev=(g,A,I,B,Q)=>{let C=Q[I];A.image_layers=A.image_layers.map(E=>E.id.startsWith(I)?E.clone({renderSubLayers:HR(g.dimensions,C,B),id:`${I}-${B}`}):E)},iv=async(g,A,I,B=null)=>{let{image_info:Q}=g.img,{max_pyramid_zoom:C,tile_size:E}=g.img.landscape_parameters,o=B||Date.now().toString(36),e=[],a=I/2,D=Math.max(E*3,I*.5);return console.log(`Yearbook: Creating image layers for ${A.length} portraits, data_size=${I.toFixed(0)}, padding=${D.toFixed(0)}`),A.forEach((n,G)=>{let w=[Math.max(0,n.x-a-D),Math.max(0,n.y-a-D),Math.min(g.dimensions.width,n.x+a+D),Math.min(g.dimensions.height,n.y+a+D)];Q.forEach(h=>{let N=`yb-${h.button_name}-p${G}-${o}`,l=new YD({id:N,tileSize:g.dimensions.tileSize,refinementStrategy:"no-overlap",minZoom:-7,maxZoom:0,maxCacheSize:50,maxRequests:6,extent:w,getTileData:h0(g.global_base_url,h.name,g.img.image_format,C,zg,g.aws),renderSubLayers:HR(g.dimensions,h.color,5),...hQ(g.rotation)});e.push(l)})}),console.log(`Yearbook: Created ${e.length} image layers total`),e};var zL=class extends wQ{getShaders(){let A=super.getShaders();return A.fs=`#version 300 es
1763
1763
  #define SHADER_NAME scatterplot-layer-fragment-shader
1764
1764
  precision highp float;
1765
1765
  in vec4 vFillColor;