figpack-spike-sorting 0.1.8__tar.gz → 0.1.9__tar.gz

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.
Files changed (31) hide show
  1. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/PKG-INFO +1 -1
  2. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/__init__.py +1 -1
  3. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/figpack_spike_sorting.js +1 -1
  4. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting.egg-info/PKG-INFO +1 -1
  5. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/setup.py +1 -1
  6. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/README.md +0 -0
  7. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/spike_sorting_extension.py +0 -0
  8. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/style.css +0 -0
  9. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/views/AutocorrelogramItem.py +0 -0
  10. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/views/Autocorrelograms.py +0 -0
  11. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/views/AverageWaveforms.py +0 -0
  12. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/views/CrossCorrelogramItem.py +0 -0
  13. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/views/CrossCorrelograms.py +0 -0
  14. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/views/RasterPlot.py +0 -0
  15. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/views/RasterPlotItem.py +0 -0
  16. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/views/SortingCuration.py +0 -0
  17. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/views/SpikeAmplitudes.py +0 -0
  18. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/views/SpikeAmplitudesItem.py +0 -0
  19. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/views/TiledImage.py +0 -0
  20. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/views/UnitLocations.py +0 -0
  21. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/views/UnitMetricsGraph.py +0 -0
  22. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/views/UnitSimilarityScore.py +0 -0
  23. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/views/UnitsTable.py +0 -0
  24. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/views/UnitsTableColumn.py +0 -0
  25. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/views/UnitsTableRow.py +0 -0
  26. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting/views/__init__.py +0 -0
  27. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting.egg-info/SOURCES.txt +0 -0
  28. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting.egg-info/dependency_links.txt +0 -0
  29. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting.egg-info/requires.txt +0 -0
  30. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/figpack_spike_sorting.egg-info/top_level.txt +0 -0
  31. {figpack_spike_sorting-0.1.8 → figpack_spike_sorting-0.1.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: figpack_spike_sorting
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: Spike Sorting specific extension for figpack
5
5
  Home-page: https://github.com/flatironinstitute/figpack
6
6
  Author: figpack contributors
@@ -2,4 +2,4 @@
2
2
  figpack_spike_sorting - Spike Sorting specific extension for figpack
3
3
  """
4
4
 
5
- __version__ = "0.1.8"
5
+ __version__ = "0.1.9"
@@ -2769,4 +2769,4 @@ fragColor = vFillColor;
2769
2769
  }
2770
2770
  DECKGL_FILTER_COLOR(fragColor, geometry);
2771
2771
  }
2772
- `,Cae={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,borderRadius:{type:"object",value:0},padding:{type:"array",value:[0,0,0,0]},getPosition:{type:"accessor",value:t=>t.position},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},getBoundingRect:{type:"accessor",value:[0,0,0,0]},getFillColor:{type:"accessor",value:[0,0,0,255]},getLineColor:{type:"accessor",value:[0,0,0,255]},getLineWidth:{type:"accessor",value:1}};class vx extends Ui{getShaders(){return super.getShaders({vs:Aae,fs:Eae,modules:[Gl,tc,Tae]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceSizes:{size:1,transition:!0,accessor:"getSize",defaultValue:1},instanceAngles:{size:1,transition:!0,accessor:"getAngle"},instanceRects:{size:4,accessor:"getBoundingRect"},instancePixelOffsets:{size:2,transition:!0,accessor:"getPixelOffset"},instanceFillColors:{size:4,transition:!0,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:4,transition:!0,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}updateState(e){super.updateState(e);const{changeFlags:n}=e;n.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){const{billboard:n,sizeScale:r,sizeUnits:i,sizeMinPixels:s,sizeMaxPixels:o,getLineWidth:a}=this.props;let{padding:l,borderRadius:c}=this.props;l.length<4&&(l=[l[0],l[1],l[0],l[1]]),Array.isArray(c)||(c=[c,c,c,c]);const u=this.state.model,f={billboard:n,stroked:!!a,borderRadius:c,padding:l,sizeUnits:ms[i],sizeScale:r,sizeMinPixels:s,sizeMaxPixels:o};u.shaderInputs.setProps({textBackground:f}),u.draw(this.context.renderPass)}_getModel(){const e=[0,0,1,0,0,1,1,1];return new Qr(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new sc({topology:"triangle-strip",vertexCount:4,attributes:{positions:{size:2,value:new Float32Array(e)}}}),isInstanced:!0})}}vx.defaultProps=Cae,vx.layerName="TextBackgroundLayer";const vO={start:1,middle:0,end:-1},_O={top:1,center:0,bottom:-1},_x=[0,0,0,255],Dae={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,background:!1,getBackgroundColor:{type:"accessor",value:[255,255,255,255]},getBorderColor:{type:"accessor",value:_x},getBorderWidth:{type:"accessor",value:0},backgroundBorderRadius:{type:"object",value:0},backgroundPadding:{type:"array",value:[0,0,0,0]},characterSet:{type:"object",value:yc.characterSet},fontFamily:yc.fontFamily,fontWeight:yc.fontWeight,lineHeight:1,outlineWidth:{type:"number",value:0,min:0},outlineColor:{type:"color",value:_x},fontSettings:{type:"object",value:{},compare:1},wordBreak:"break-word",maxWidth:{type:"number",value:-1},getText:{type:"accessor",value:t=>t.text},getPosition:{type:"accessor",value:t=>t.position},getColor:{type:"accessor",value:_x},getSize:{type:"accessor",value:32},getAngle:{type:"accessor",value:0},getTextAnchor:{type:"accessor",value:"middle"},getAlignmentBaseline:{type:"accessor",value:"center"},getPixelOffset:{type:"accessor",value:[0,0]},backgroundColor:{deprecatedFor:["background","getBackgroundColor"]}};class bx extends lm{constructor(){super(...arguments),this.getBoundingRect=(e,n)=>{let{size:[r,i]}=this.transformParagraph(e,n);const{fontSize:s}=this.state.fontAtlasManager.props;r/=s,i/=s;const{getTextAnchor:o,getAlignmentBaseline:a}=this.props,l=vO[typeof o=="function"?o(e,n):o],c=_O[typeof a=="function"?a(e,n):a];return[(l-1)*r/2,(c-1)*i/2,r,i]},this.getIconOffsets=(e,n)=>{const{getTextAnchor:r,getAlignmentBaseline:i}=this.props,{x:s,y:o,rowWidth:a,size:[l,c]}=this.transformParagraph(e,n),u=vO[typeof r=="function"?r(e,n):r],f=_O[typeof i=="function"?i(e,n):i],h=s.length,d=new Array(h*2);let g=0;for(let p=0;p<h;p++){const _=(1-u)*(l-a[p])/2;d[g++]=(u-1)*l/2+_+s[p],d[g++]=(f-1)*c/2+o[p]}return d}}initializeState(){this.state={styleVersion:0,fontAtlasManager:new Sae},this.props.maxWidth>0&&He.once(1,"v8.9 breaking change: TextLayer maxWidth is now relative to text size")()}updateState(e){const{props:n,oldProps:r,changeFlags:i}=e;(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getText))&&this._updateText(),(this._updateFontAtlas()||n.lineHeight!==r.lineHeight||n.wordBreak!==r.wordBreak||n.maxWidth!==r.maxWidth)&&this.setState({styleVersion:this.state.styleVersion+1})}getPickingInfo({info:e}){return e.object=e.index>=0?this.props.data[e.index]:null,e}_updateFontAtlas(){const{fontSettings:e,fontFamily:n,fontWeight:r}=this.props,{fontAtlasManager:i,characterSet:s}=this.state,o={...e,characterSet:s,fontFamily:n,fontWeight:r};if(!i.mapping)return i.setProps(o),!0;for(const a in o)if(o[a]!==i.props[a])return i.setProps(o),!0;return!1}_updateText(){const{data:e,characterSet:n}=this.props,r=e.attributes?.getText;let{getText:i}=this.props,s=e.startIndices,o;const a=n==="auto"&&new Set;if(r&&s){const{texts:l,characterCount:c}=vae({...ArrayBuffer.isView(r)?{value:r}:r,length:e.length,startIndices:s,characterSet:a});o=c,i=(u,{index:f})=>l[f]}else{const{iterable:l,objectInfo:c}=im(e);s=[0],o=0;for(const u of l){c.index++;const f=Array.from(i(u,c)||"");a&&f.forEach(a.add,a),o+=f.length,s.push(o)}}this.setState({getText:i,startIndices:s,numInstances:o,characterSet:a||n})}transformParagraph(e,n){const{fontAtlasManager:r}=this.state,i=r.mapping,s=this.state.getText,{wordBreak:o,lineHeight:a,maxWidth:l}=this.props,c=s(e,n)||"";return yae(c,a,o,l*r.props.fontSize,i)}renderLayers(){const{startIndices:e,numInstances:n,getText:r,fontAtlasManager:{scale:i,atlas:s,mapping:o},styleVersion:a}=this.state,{data:l,_dataDiff:c,getPosition:u,getColor:f,getSize:h,getAngle:d,getPixelOffset:g,getBackgroundColor:p,getBorderColor:_,getBorderWidth:m,backgroundBorderRadius:v,backgroundPadding:y,background:b,billboard:w,fontSettings:x,outlineWidth:T,outlineColor:E,sizeScale:A,sizeUnits:C,sizeMinPixels:M,sizeMaxPixels:S,transitions:P,updateTriggers:R}=this.props,k=this.getSubLayerClass("characters",yx),O=this.getSubLayerClass("background",vx);return[b&&new O({getFillColor:p,getLineColor:_,getLineWidth:m,borderRadius:v,padding:y,getPosition:u,getSize:h,getAngle:d,getPixelOffset:g,billboard:w,sizeScale:A,sizeUnits:C,sizeMinPixels:M,sizeMaxPixels:S,transitions:P&&{getPosition:P.getPosition,getAngle:P.getAngle,getSize:P.getSize,getFillColor:P.getBackgroundColor,getLineColor:P.getBorderColor,getLineWidth:P.getBorderWidth,getPixelOffset:P.getPixelOffset}},this.getSubLayerProps({id:"background",updateTriggers:{getPosition:R.getPosition,getAngle:R.getAngle,getSize:R.getSize,getFillColor:R.getBackgroundColor,getLineColor:R.getBorderColor,getLineWidth:R.getBorderWidth,getPixelOffset:R.getPixelOffset,getBoundingRect:{getText:R.getText,getTextAnchor:R.getTextAnchor,getAlignmentBaseline:R.getAlignmentBaseline,styleVersion:a}}}),{data:l.attributes&&l.attributes.background?{length:l.length,attributes:l.attributes.background}:l,_dataDiff:c,autoHighlight:!1,getBoundingRect:this.getBoundingRect}),new k({sdf:x.sdf,smoothing:Number.isFinite(x.smoothing)?x.smoothing:yc.smoothing,outlineWidth:T/(x.radius||yc.radius),outlineColor:E,iconAtlas:s,iconMapping:o,getPosition:u,getColor:f,getSize:h,getAngle:d,getPixelOffset:g,billboard:w,sizeScale:A*i,sizeUnits:C,sizeMinPixels:M*i,sizeMaxPixels:S*i,transitions:P&&{getPosition:P.getPosition,getAngle:P.getAngle,getColor:P.getColor,getSize:P.getSize,getPixelOffset:P.getPixelOffset}},this.getSubLayerProps({id:"characters",updateTriggers:{all:R.getText,getPosition:R.getPosition,getAngle:R.getAngle,getColor:R.getColor,getSize:R.getSize,getPixelOffset:R.getPixelOffset,getIconOffsets:{getTextAnchor:R.getTextAnchor,getAlignmentBaseline:R.getAlignmentBaseline,styleVersion:a}}}),{data:l,_dataDiff:c,startIndices:e,numInstances:n,getIconOffsets:this.getIconOffsets,getIcon:r})]}static set fontAtlasCacheLimit(e){wae(e)}}bx.defaultProps=Dae,bx.layerName="TextLayer";const xm={circle:{type:ix,props:{filled:"filled",stroked:"stroked",lineWidthMaxPixels:"lineWidthMaxPixels",lineWidthMinPixels:"lineWidthMinPixels",lineWidthScale:"lineWidthScale",lineWidthUnits:"lineWidthUnits",pointRadiusMaxPixels:"radiusMaxPixels",pointRadiusMinPixels:"radiusMinPixels",pointRadiusScale:"radiusScale",pointRadiusUnits:"radiusUnits",pointAntialiasing:"antialiasing",pointBillboard:"billboard",getFillColor:"getFillColor",getLineColor:"getLineColor",getLineWidth:"getLineWidth",getPointRadius:"getRadius"}},icon:{type:cm,props:{iconAtlas:"iconAtlas",iconMapping:"iconMapping",iconSizeMaxPixels:"sizeMaxPixels",iconSizeMinPixels:"sizeMinPixels",iconSizeScale:"sizeScale",iconSizeUnits:"sizeUnits",iconAlphaCutoff:"alphaCutoff",iconBillboard:"billboard",getIcon:"getIcon",getIconAngle:"getAngle",getIconColor:"getColor",getIconPixelOffset:"getPixelOffset",getIconSize:"getSize"}},text:{type:bx,props:{textSizeMaxPixels:"sizeMaxPixels",textSizeMinPixels:"sizeMinPixels",textSizeScale:"sizeScale",textSizeUnits:"sizeUnits",textBackground:"background",textBackgroundPadding:"backgroundPadding",textFontFamily:"fontFamily",textFontWeight:"fontWeight",textLineHeight:"lineHeight",textMaxWidth:"maxWidth",textOutlineColor:"outlineColor",textOutlineWidth:"outlineWidth",textWordBreak:"wordBreak",textCharacterSet:"characterSet",textBillboard:"billboard",textFontSettings:"fontSettings",getText:"getText",getTextAngle:"getAngle",getTextColor:"getColor",getTextPixelOffset:"getPixelOffset",getTextSize:"getSize",getTextAnchor:"getTextAnchor",getTextAlignmentBaseline:"getAlignmentBaseline",getTextBackgroundColor:"getBackgroundColor",getTextBorderColor:"getBorderColor",getTextBorderWidth:"getBorderWidth"}}},wm={type:cx,props:{lineWidthUnits:"widthUnits",lineWidthScale:"widthScale",lineWidthMinPixels:"widthMinPixels",lineWidthMaxPixels:"widthMaxPixels",lineJointRounded:"jointRounded",lineCapRounded:"capRounded",lineMiterLimit:"miterLimit",lineBillboard:"billboard",getLineColor:"getColor",getLineWidth:"getWidth"}},xx={type:gx,props:{extruded:"extruded",filled:"filled",wireframe:"wireframe",elevationScale:"elevationScale",material:"material",_full3d:"_full3d",getElevation:"getElevation",getFillColor:"getFillColor",getLineColor:"getLineColor"}};function kf({type:t,props:e}){const n={};for(const r in e)n[r]=t.defaultProps[e[r]];return n}function wx(t,e){const{transitions:n,updateTriggers:r}=t.props,i={updateTriggers:{},transitions:n&&{getPosition:n.geometry}};for(const s in e){const o=e[s];let a=t.props[s];s.startsWith("get")&&(a=t.getSubLayerAccessor(a),i.updateTriggers[o]=r[s],n&&(i.transitions[o]=n[s])),i[o]=a}return i}function Mae(t){if(Array.isArray(t))return t;switch(He.assert(t.type,"GeoJSON does not have type"),t.type){case"Feature":return[t];case"FeatureCollection":return He.assert(Array.isArray(t.features),"GeoJSON does not have features array"),t.features;default:return[{geometry:t}]}}function bO(t,e,n={}){const r={pointFeatures:[],lineFeatures:[],polygonFeatures:[],polygonOutlineFeatures:[]},{startRow:i=0,endRow:s=t.length}=n;for(let o=i;o<s;o++){const a=t[o],{geometry:l}=a;if(l)if(l.type==="GeometryCollection"){He.assert(Array.isArray(l.geometries),"GeoJSON does not have geometries array");const{geometries:c}=l;for(let u=0;u<c.length;u++){const f=c[u];xO(f,r,e,a,o)}}else xO(l,r,e,a,o)}return r}function xO(t,e,n,r,i){const{type:s,coordinates:o}=t,{pointFeatures:a,lineFeatures:l,polygonFeatures:c,polygonOutlineFeatures:u}=e;if(!Iae(s,o)){He.warn(`${s} coordinates are malformed`)();return}switch(s){case"Point":a.push(n({geometry:t},r,i));break;case"MultiPoint":o.forEach(f=>{a.push(n({geometry:{type:"Point",coordinates:f}},r,i))});break;case"LineString":l.push(n({geometry:t},r,i));break;case"MultiLineString":o.forEach(f=>{l.push(n({geometry:{type:"LineString",coordinates:f}},r,i))});break;case"Polygon":c.push(n({geometry:t},r,i)),o.forEach(f=>{u.push(n({geometry:{type:"LineString",coordinates:f}},r,i))});break;case"MultiPolygon":o.forEach(f=>{c.push(n({geometry:{type:"Polygon",coordinates:f}},r,i)),f.forEach(h=>{u.push(n({geometry:{type:"LineString",coordinates:h}},r,i))})});break}}const Rae={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function Iae(t,e){let n=Rae[t];for(He.assert(n,`Unknown GeoJSON type ${t}`);e&&--n>0;)e=e[0];return e&&Number.isFinite(e[0])}function wO(){return{points:{},lines:{},polygons:{},polygonsOutline:{}}}function Sm(t){return t.geometry.coordinates}function Pae(t,e){const n=wO(),{pointFeatures:r,lineFeatures:i,polygonFeatures:s,polygonOutlineFeatures:o}=t;return n.points.data=r,n.points._dataDiff=e.pointFeatures&&(()=>e.pointFeatures),n.points.getPosition=Sm,n.lines.data=i,n.lines._dataDiff=e.lineFeatures&&(()=>e.lineFeatures),n.lines.getPath=Sm,n.polygons.data=s,n.polygons._dataDiff=e.polygonFeatures&&(()=>e.polygonFeatures),n.polygons.getPolygon=Sm,n.polygonsOutline.data=o,n.polygonsOutline._dataDiff=e.polygonOutlineFeatures&&(()=>e.polygonOutlineFeatures),n.polygonsOutline.getPath=Sm,n}function Oae(t,e){const n=wO(),{points:r,lines:i,polygons:s}=t,o=sae(t,e);n.points.data={length:r.positions.value.length/r.positions.size,attributes:{...r.attributes,getPosition:r.positions,instancePickingColors:{size:4,value:o.points}},properties:r.properties,numericProps:r.numericProps,featureIds:r.featureIds},n.lines.data={length:i.pathIndices.value.length-1,startIndices:i.pathIndices.value,attributes:{...i.attributes,getPath:i.positions,instancePickingColors:{size:4,value:o.lines}},properties:i.properties,numericProps:i.numericProps,featureIds:i.featureIds},n.lines._pathType="open";const a=s.positions.value.length/s.positions.size,l=Array(a).fill(1);for(const c of s.primitivePolygonIndices.value)l[c-1]=0;return n.polygons.data={length:s.polygonIndices.value.length-1,startIndices:s.polygonIndices.value,attributes:{...s.attributes,getPolygon:s.positions,instanceVertexValid:{size:1,value:new Uint16Array(l)},pickingColors:{size:4,value:o.polygons}},properties:s.properties,numericProps:s.numericProps,featureIds:s.featureIds},n.polygons._normalize=!1,s.triangles&&(n.polygons.data.attributes.indices=s.triangles.value),n.polygonsOutline.data={length:s.primitivePolygonIndices.value.length-1,startIndices:s.primitivePolygonIndices.value,attributes:{...s.attributes,getPath:s.positions,instancePickingColors:{size:4,value:o.polygons}},properties:s.properties,numericProps:s.numericProps,featureIds:s.featureIds},n.polygonsOutline._pathType="open",n}const Nae=["points","linestrings","polygons"],Fae={...kf(xm.circle),...kf(xm.icon),...kf(xm.text),...kf(wm),...kf(xx),stroked:!0,filled:!0,extruded:!1,wireframe:!1,_full3d:!1,iconAtlas:{type:"object",value:null},iconMapping:{type:"object",value:{}},getIcon:{type:"accessor",value:t=>t.properties.icon},getText:{type:"accessor",value:t=>t.properties.text},pointType:"circle",getRadius:{deprecatedFor:"getPointRadius"}};class Sx extends lm{initializeState(){this.state={layerProps:{},features:{},featuresDiff:{}}}updateState({props:e,changeFlags:n}){if(!n.dataChanged)return;const{data:r}=this.props,i=r&&"points"in r&&"polygons"in r&&"lines"in r;this.setState({binary:i}),i?this._updateStateBinary({props:e,changeFlags:n}):this._updateStateJSON({props:e,changeFlags:n})}_updateStateBinary({props:e,changeFlags:n}){const r=Oae(e.data,this.encodePickingColor);this.setState({layerProps:r})}_updateStateJSON({props:e,changeFlags:n}){const r=Mae(e.data),i=this.getSubLayerRow.bind(this);let s={};const o={};if(Array.isArray(n.dataChanged)){const l=this.state.features;for(const c in l)s[c]=l[c].slice(),o[c]=[];for(const c of n.dataChanged){const u=bO(r,i,c);for(const f in l)o[f].push(nae({data:s[f],getIndex:h=>h.__source.index,dataRange:c,replace:u[f]}))}}else s=bO(r,i);const a=Pae(s,o);this.setState({features:s,featuresDiff:o,layerProps:a})}getPickingInfo(e){const n=super.getPickingInfo(e),{index:r,sourceLayer:i}=n;return n.featureType=Nae.find(s=>i.id.startsWith(`${this.id}-${s}-`)),r>=0&&i.id.startsWith(`${this.id}-points-text`)&&this.state.binary&&(n.index=this.props.data.points.globalFeatureIds.value[r]),n}_updateAutoHighlight(e){const n=`${this.id}-points-`,r=e.featureType==="points";for(const i of this.getSubLayers())i.id.startsWith(n)===r&&i.updateAutoHighlight(e)}_renderPolygonLayer(){const{extruded:e,wireframe:n}=this.props,{layerProps:r}=this.state,i="polygons-fill",s=this.shouldRenderSubLayer(i,r.polygons?.data)&&this.getSubLayerClass(i,xx.type);if(s){const o=wx(this,xx.props),a=e&&n;return a||delete o.getLineColor,o.updateTriggers.lineColors=a,new s(o,this.getSubLayerProps({id:i,updateTriggers:o.updateTriggers}),r.polygons)}return null}_renderLineLayers(){const{extruded:e,stroked:n}=this.props,{layerProps:r}=this.state,i="polygons-stroke",s="linestrings",o=!e&&n&&this.shouldRenderSubLayer(i,r.polygonsOutline?.data)&&this.getSubLayerClass(i,wm.type),a=this.shouldRenderSubLayer(s,r.lines?.data)&&this.getSubLayerClass(s,wm.type);if(o||a){const l=wx(this,wm.props);return[o&&new o(l,this.getSubLayerProps({id:i,updateTriggers:l.updateTriggers}),r.polygonsOutline),a&&new a(l,this.getSubLayerProps({id:s,updateTriggers:l.updateTriggers}),r.lines)]}return null}_renderPointLayers(){const{pointType:e}=this.props,{layerProps:n,binary:r}=this.state;let{highlightedObjectIndex:i}=this.props;!r&&Number.isFinite(i)&&(i=n.points.data.findIndex(a=>a.__source.index===i));const s=new Set(e.split("+")),o=[];for(const a of s){const l=`points-${a}`,c=xm[a],u=c&&this.shouldRenderSubLayer(l,n.points?.data)&&this.getSubLayerClass(l,c.type);if(u){const f=wx(this,c.props);let h=n.points;if(a==="text"&&r){const{instancePickingColors:d,...g}=h.data.attributes;h={...h,data:{...h.data,attributes:g}}}o.push(new u(f,this.getSubLayerProps({id:l,updateTriggers:f.updateTriggers,highlightedObjectIndex:i}),h))}}return o}renderLayers(){const{extruded:e}=this.props,n=this._renderPolygonLayer(),r=this._renderLineLayers(),i=this._renderPointLayers();return[!e&&n,r,i,e&&n]}getSubLayerAccessor(e){const{binary:n}=this.state;return!n||typeof e!="function"?super.getSubLayerAccessor(e):(r,i)=>{const{data:s,index:o}=i,a=rae(s,o);return e(a,i)}}}Sx.layerName="GeoJsonLayer",Sx.defaultProps=Fae;class Bae{constructor(e){this.index=e,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(e){this._bbox||(this._bbox=e,"west"in e?this.boundingBox=[[e.west,e.south],[e.east,e.north]]:this.boundingBox=[[e.left,e.top],[e.right,e.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return!!this._loader&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){const e=this.content?this.content.byteLength:0;return Number.isFinite(e)||console.error("byteLength not defined in tile data"),e}async _loadData({getData:e,requestScheduler:n,onLoad:r,onError:i}){const{index:s,id:o,bbox:a,userData:l,zoom:c}=this,u=this._loaderId;this._abortController=new AbortController;const{signal:f}=this._abortController,h=await n.scheduleRequest(this,p=>p.isSelected?1:-1);if(!h){this._isCancelled=!0;return}if(this._isCancelled){h.done();return}let d=null,g;try{d=await e({index:s,id:o,bbox:a,userData:l,zoom:c,signal:f})}catch(p){g=p||!0}finally{h.done()}if(u===this._loaderId){if(this._loader=void 0,this.content=d,this._isCancelled&&!d){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,g?i(g,this):r(this)}}loadData(e){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(e),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}}const jn={OUTSIDE:-1,INTERSECTING:0,INSIDE:1},SO=new Ae,kae=new Ae;class Tx{constructor(e=[0,0,0],n=[0,0,0],r){r=r||SO.copy(e).add(n).scale(.5),this.center=new Ae(r),this.halfDiagonal=new Ae(n).subtract(this.center),this.minimum=new Ae(e),this.maximum=new Ae(n)}clone(){return new Tx(this.minimum,this.maximum,this.center)}equals(e){return this===e||!!e&&this.minimum.equals(e.minimum)&&this.maximum.equals(e.maximum)}transform(e){return this.center.transformAsPoint(e),this.halfDiagonal.transform(e),this.minimum.transform(e),this.maximum.transform(e),this}intersectPlane(e){const{halfDiagonal:n}=this,r=kae.from(e.normal),i=n.x*Math.abs(r.x)+n.y*Math.abs(r.y)+n.z*Math.abs(r.z),s=this.center.dot(r)+e.distance;return s-i>0?jn.INSIDE:s+i<0?jn.OUTSIDE:jn.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){const n=SO.from(e).subtract(this.center),{halfDiagonal:r}=this;let i=0,s;return s=Math.abs(n.x)-r.x,s>0&&(i+=s*s),s=Math.abs(n.y)-r.y,s>0&&(i+=s*s),s=Math.abs(n.z)-r.z,s>0&&(i+=s*s),i}}const Uf=new Ae,TO=new Ae;class Ax{constructor(e=[0,0,0],n=0){this.radius=-0,this.center=new Ae,this.fromCenterRadius(e,n)}fromCenterRadius(e,n){return this.center.from(e),this.radius=n,this}fromCornerPoints(e,n){return n=Uf.from(n),this.center=new Ae().from(e).add(n).scale(.5),this.radius=this.center.distance(n),this}equals(e){return this===e||!!e&&this.center.equals(e.center)&&this.radius===e.radius}clone(){return new Ax(this.center,this.radius)}union(e){const n=this.center,r=this.radius,i=e.center,s=e.radius,o=Uf.copy(i).subtract(n),a=o.magnitude();if(r>=a+s)return this.clone();if(s>=a+r)return e.clone();const l=(r+a+s)*.5;return TO.copy(o).scale((-r+l)/a).add(n),this.center.copy(TO),this.radius=l,this}expand(e){const r=Uf.from(e).subtract(this.center).magnitude();return r>this.radius&&(this.radius=r),this}transform(e){this.center.transform(e);const n=rQ(Uf,e);return this.radius=Math.max(n[0],Math.max(n[1],n[2]))*this.radius,this}distanceSquaredTo(e){const n=this.distanceTo(e);return n*n}distanceTo(e){const r=Uf.from(e).subtract(this.center);return Math.max(0,r.len()-this.radius)}intersectPlane(e){const n=this.center,r=this.radius,s=e.normal.dot(n)+e.distance;return s<-r?jn.OUTSIDE:s<r?jn.INTERSECTING:jn.INSIDE}}const Uae=new Ae,Lae=new Ae,Tm=new Ae,Am=new Ae,Em=new Ae,zae=new Ae,$ae=new Ae,_s={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8};class Ex{constructor(e=[0,0,0],n=[0,0,0,0,0,0,0,0,0]){this.center=new Ae().from(e),this.halfAxes=new In(n)}get halfSize(){const e=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new Ae(e).len(),new Ae(n).len(),new Ae(r).len()]}get quaternion(){const e=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),i=new Ae(e).normalize(),s=new Ae(n).normalize(),o=new Ae(r).normalize();return new uI().fromMatrix3(new In([...i,...s,...o]))}fromCenterHalfSizeQuaternion(e,n,r){const i=new uI(r),s=new In().fromQuaternion(i);return s[0]=s[0]*n[0],s[1]=s[1]*n[0],s[2]=s[2]*n[0],s[3]=s[3]*n[1],s[4]=s[4]*n[1],s[5]=s[5]*n[1],s[6]=s[6]*n[2],s[7]=s[7]*n[2],s[8]=s[8]*n[2],this.center=new Ae().from(e),this.halfAxes=s,this}clone(){return new Ex(this.center,this.halfAxes)}equals(e){return this===e||!!e&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)}getBoundingSphere(e=new Ax){const n=this.halfAxes,r=n.getColumn(0,Tm),i=n.getColumn(1,Am),s=n.getColumn(2,Em),o=Uae.copy(r).add(i).add(s);return e.center.copy(this.center),e.radius=o.magnitude(),e}intersectPlane(e){const n=this.center,r=e.normal,i=this.halfAxes,s=r.x,o=r.y,a=r.z,l=Math.abs(s*i[_s.COLUMN0ROW0]+o*i[_s.COLUMN0ROW1]+a*i[_s.COLUMN0ROW2])+Math.abs(s*i[_s.COLUMN1ROW0]+o*i[_s.COLUMN1ROW1]+a*i[_s.COLUMN1ROW2])+Math.abs(s*i[_s.COLUMN2ROW0]+o*i[_s.COLUMN2ROW1]+a*i[_s.COLUMN2ROW2]),c=r.dot(n)+e.distance;return c<=-l?jn.OUTSIDE:c>=l?jn.INSIDE:jn.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){const n=Lae.from(e).subtract(this.center),r=this.halfAxes,i=r.getColumn(0,Tm),s=r.getColumn(1,Am),o=r.getColumn(2,Em),a=i.magnitude(),l=s.magnitude(),c=o.magnitude();i.normalize(),s.normalize(),o.normalize();let u=0,f;return f=Math.abs(n.dot(i))-a,f>0&&(u+=f*f),f=Math.abs(n.dot(s))-l,f>0&&(u+=f*f),f=Math.abs(n.dot(o))-c,f>0&&(u+=f*f),u}computePlaneDistances(e,n,r=[-0,-0]){let i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;const o=this.center,a=this.halfAxes,l=a.getColumn(0,Tm),c=a.getColumn(1,Am),u=a.getColumn(2,Em),f=zae.copy(l).add(c).add(u).add(o),h=$ae.copy(f).subtract(e);let d=n.dot(h);return i=Math.min(d,i),s=Math.max(d,s),f.copy(o).add(l).add(c).subtract(u),h.copy(f).subtract(e),d=n.dot(h),i=Math.min(d,i),s=Math.max(d,s),f.copy(o).add(l).subtract(c).add(u),h.copy(f).subtract(e),d=n.dot(h),i=Math.min(d,i),s=Math.max(d,s),f.copy(o).add(l).subtract(c).subtract(u),h.copy(f).subtract(e),d=n.dot(h),i=Math.min(d,i),s=Math.max(d,s),o.copy(f).subtract(l).add(c).add(u),h.copy(f).subtract(e),d=n.dot(h),i=Math.min(d,i),s=Math.max(d,s),o.copy(f).subtract(l).add(c).subtract(u),h.copy(f).subtract(e),d=n.dot(h),i=Math.min(d,i),s=Math.max(d,s),o.copy(f).subtract(l).subtract(c).add(u),h.copy(f).subtract(e),d=n.dot(h),i=Math.min(d,i),s=Math.max(d,s),o.copy(f).subtract(l).subtract(c).subtract(u),h.copy(f).subtract(e),d=n.dot(h),i=Math.min(d,i),s=Math.max(d,s),r[0]=i,r[1]=s,r}transform(e){this.center.transformAsPoint(e);const n=this.halfAxes.getColumn(0,Tm);n.transformAsPoint(e);const r=this.halfAxes.getColumn(1,Am);r.transformAsPoint(e);const i=this.halfAxes.getColumn(2,Em);return i.transformAsPoint(e),this.halfAxes=new In([...n,...r,...i]),this}getTransform(){throw new Error("not implemented")}}const AO=new Ae,EO=new Ae;class Lf{constructor(e=[0,0,1],n=0){this.normal=new Ae,this.distance=-0,this.fromNormalDistance(e,n)}fromNormalDistance(e,n){return df(Number.isFinite(n)),this.normal.from(e).normalize(),this.distance=n,this}fromPointNormal(e,n){e=AO.from(e),this.normal.from(n).normalize();const r=-this.normal.dot(e);return this.distance=r,this}fromCoefficients(e,n,r,i){return this.normal.set(e,n,r),df(gs(this.normal.len(),1)),this.distance=i,this}clone(){return new Lf(this.normal,this.distance)}equals(e){return gs(this.distance,e.distance)&&gs(this.normal,e.normal)}getPointDistance(e){return this.normal.dot(e)+this.distance}transform(e){const n=EO.copy(this.normal).transformAsVector(e).normalize(),r=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(r,n)}projectPointOntoPlane(e,n=[0,0,0]){const r=AO.from(e),i=this.getPointDistance(r),s=EO.copy(this.normal).scale(i);return r.subtract(s).to(n)}}const CO=[new Ae([1,0,0]),new Ae([0,1,0]),new Ae([0,0,1])],DO=new Ae,Vae=new Ae;class bs{constructor(e=[]){this.planes=e}fromBoundingSphere(e){this.planes.length=2*CO.length;const n=e.center,r=e.radius;let i=0;for(const s of CO){let o=this.planes[i],a=this.planes[i+1];o||(o=this.planes[i]=new Lf),a||(a=this.planes[i+1]=new Lf);const l=DO.copy(s).scale(-r).add(n);o.fromPointNormal(l,s);const c=DO.copy(s).scale(r).add(n),u=Vae.copy(s).negate();a.fromPointNormal(c,u),i+=2}return this}computeVisibility(e){let n=jn.INSIDE;for(const r of this.planes)switch(e.intersectPlane(r)){case jn.OUTSIDE:return jn.OUTSIDE;case jn.INTERSECTING:n=jn.INTERSECTING;break}return n}computeVisibilityWithPlaneMask(e,n){if(df(Number.isFinite(n),"parentPlaneMask is required."),n===bs.MASK_OUTSIDE||n===bs.MASK_INSIDE)return n;let r=bs.MASK_INSIDE;const i=this.planes;for(let s=0;s<this.planes.length;++s){const o=s<31?1<<s:0;if(s<31&&!(n&o))continue;const a=i[s],l=e.intersectPlane(a);if(l===jn.OUTSIDE)return bs.MASK_OUTSIDE;l===jn.INTERSECTING&&(r|=o)}return r}}bs.MASK_OUTSIDE=4294967295,bs.MASK_INSIDE=0,bs.MASK_INDETERMINATE=2147483647,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae;const Li=new In,jae=new In,Hae=new In,Cm=new In,MO=new In;function Wae(t,e={}){const n=$Q,r=10;let i=0,s=0;const o=jae,a=Hae;o.identity(),a.copy(t);const l=n*Xae(a);for(;s<r&&qae(a)>l;)Yae(a,Cm),MO.copy(Cm).transpose(),a.multiplyRight(Cm),a.multiplyLeft(MO),o.multiplyRight(Cm),++i>2&&(++s,i=0);return e.unitary=o.toTarget(e.unitary),e.diagonal=a.toTarget(e.diagonal),e}function Xae(t){let e=0;for(let n=0;n<9;++n){const r=t[n];e+=r*r}return Math.sqrt(e)}const Cx=[1,0,0],Dx=[2,2,1];function qae(t){let e=0;for(let n=0;n<3;++n){const r=t[Li.getElementIndex(Dx[n],Cx[n])];e+=2*r*r}return Math.sqrt(e)}function Yae(t,e){const n=zQ;let r=0,i=1;for(let c=0;c<3;++c){const u=Math.abs(t[Li.getElementIndex(Dx[c],Cx[c])]);u>r&&(i=c,r=u)}const s=Cx[i],o=Dx[i];let a=1,l=0;if(Math.abs(t[Li.getElementIndex(o,s)])>n){const c=t[Li.getElementIndex(o,o)],u=t[Li.getElementIndex(s,s)],f=t[Li.getElementIndex(o,s)],h=(c-u)/2/f;let d;h<0?d=-1/(-h+Math.sqrt(1+h*h)):d=1/(h+Math.sqrt(1+h*h)),a=1/Math.sqrt(1+d*d),l=d*a}return In.IDENTITY.to(e),e[Li.getElementIndex(s,s)]=e[Li.getElementIndex(o,o)]=a,e[Li.getElementIndex(o,s)]=l,e[Li.getElementIndex(s,o)]=-l,e}const bo=new Ae,Kae=new Ae,Zae=new Ae,Gae=new Ae,Qae=new Ae,Jae=new In,ele={diagonal:new In,unitary:new In};function tle(t,e=new Ex){if(!t||t.length===0)return e.halfAxes=new In([0,0,0,0,0,0,0,0,0]),e.center=new Ae,e;const n=t.length,r=new Ae(0,0,0);for(const A of t)r.add(A);const i=1/n;r.multiplyByScalar(i);let s=0,o=0,a=0,l=0,c=0,u=0;for(const A of t){const C=bo.copy(A).subtract(r);s+=C.x*C.x,o+=C.x*C.y,a+=C.x*C.z,l+=C.y*C.y,c+=C.y*C.z,u+=C.z*C.z}s*=i,o*=i,a*=i,l*=i,c*=i,u*=i;const f=Jae;f[0]=s,f[1]=o,f[2]=a,f[3]=o,f[4]=l,f[5]=c,f[6]=a,f[7]=c,f[8]=u;const{unitary:h}=Wae(f,ele),d=e.halfAxes.copy(h);let g=d.getColumn(0,Zae),p=d.getColumn(1,Gae),_=d.getColumn(2,Qae),m=-Number.MAX_VALUE,v=-Number.MAX_VALUE,y=-Number.MAX_VALUE,b=Number.MAX_VALUE,w=Number.MAX_VALUE,x=Number.MAX_VALUE;for(const A of t)bo.copy(A),m=Math.max(bo.dot(g),m),v=Math.max(bo.dot(p),v),y=Math.max(bo.dot(_),y),b=Math.min(bo.dot(g),b),w=Math.min(bo.dot(p),w),x=Math.min(bo.dot(_),x);g=g.multiplyByScalar(.5*(b+m)),p=p.multiplyByScalar(.5*(w+v)),_=_.multiplyByScalar(.5*(x+y)),e.center.copy(g).add(p).add(_);const T=Kae.set(m-b,v-w,y-x).multiplyByScalar(.5),E=new In([T[0],0,0,0,T[1],0,0,0,T[2]]);return e.halfAxes.multiplyRight(E),e}const vc=512,RO=3,IO=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],PO=IO.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),nle=PO.concat([[.25,.5],[.75,.5]]);class _c{constructor(e,n,r){this.x=e,this.y=n,this.z=r}get children(){if(!this._children){const e=this.x*2,n=this.y*2,r=this.z+1;this._children=[new _c(e,n,r),new _c(e,n+1,r),new _c(e+1,n,r),new _c(e+1,n+1,r)]}return this._children}update(e){const{viewport:n,cullingVolume:r,elevationBounds:i,minZ:s,maxZ:o,bounds:a,offset:l,project:c}=e,u=this.getBoundingVolume(i,l,c);if(a&&!this.insideBounds(a)||r.computeVisibility(u)<0)return!1;if(!this.childVisible){let{z:h}=this;if(h<o&&h>=s){const d=u.distanceTo(n.cameraPosition)*n.scale/n.height;h+=Math.floor(Math.log2(d))}if(h>=o)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(const h of this.children)h.update(e);return!0}getSelected(e=[]){if(this.selected&&e.push(this),this._children)for(const n of this._children)n.getSelected(e);return e}insideBounds([e,n,r,i]){const s=Math.pow(2,this.z),o=vc/s;return this.x*o<r&&this.y*o<i&&(this.x+1)*o>e&&(this.y+1)*o>n}getBoundingVolume(e,n,r){if(r){const l=this.z<1?nle:this.z<2?PO:IO,c=[];for(const u of l){const f=Px(this.x+u[0],this.y+u[1],this.z);f[2]=e[0],c.push(r(f)),e[0]!==e[1]&&(f[2]=e[1],c.push(r(f)))}return tle(c)}const i=Math.pow(2,this.z),s=vc/i,o=this.x*s+n*vc,a=vc-(this.y+1)*s;return new Tx([o,a,e[0]],[o+s,a+s,e[1]])}}function rle(t,e,n,r){const i=t instanceof M1&&t.resolution?t.projectPosition:null,s=Object.values(t.getFrustumPlanes()).map(({normal:d,distance:g})=>new Lf(d.clone().negate(),g)),o=new bs(s),a=t.distanceScales.unitsPerMeter[2],l=n&&n[0]*a||0,c=n&&n[1]*a||0,u=t instanceof ho&&t.pitch<=60?e:0;if(r){const[d,g,p,_]=r,m=fo([d,_]),v=fo([p,g]);r=[m[0],vc-m[1],v[0],vc-v[1]]}const f=new _c(0,0,0),h={viewport:t,project:i,cullingVolume:o,elevationBounds:[l,c],minZ:u,maxZ:e,bounds:r,offset:0};if(f.update(h),t instanceof ho&&t.subViewports&&t.subViewports.length>1){for(h.offset=-1;f.update(h)&&!(--h.offset<-RO););for(h.offset=1;f.update(h)&&!(++h.offset>RO););}return f.getSelected()}const xs=512,ile=[-1/0,-1/0,1/0,1/0],sle={equal:(t,e)=>{if(t===e)return!0;if(!Array.isArray(t)||!Array.isArray(e))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}};function Mx(t,e){const n=[e.transformAsPoint([t[0],t[1]]),e.transformAsPoint([t[2],t[1]]),e.transformAsPoint([t[0],t[3]]),e.transformAsPoint([t[2],t[3]])];return[Math.min(...n.map(i=>i[0])),Math.min(...n.map(i=>i[1])),Math.max(...n.map(i=>i[0])),Math.max(...n.map(i=>i[1]))]}function ole(t){return Math.abs(t.split("").reduce((e,n)=>(e<<5)-e+n.charCodeAt(0)|0,0))}function ale(t,e){if(!t||!t.length)return null;const{index:n,id:r}=e;if(Array.isArray(t)){const s=ole(r)%t.length;t=t[s]}let i=t;for(const s of Object.keys(n)){const o=new RegExp(`{${s}}`,"g");i=i.replace(o,String(n[s]))}return Number.isInteger(n.y)&&Number.isInteger(n.z)&&(i=i.replace(/\{-y\}/g,String(Math.pow(2,n.z)-n.y-1))),i}function lle(t,e,n){let r;return r=t.getBounds(),t.isGeospatial?[Math.max(r[0],n[0]),Math.max(r[1],n[1]),Math.min(r[2],n[2]),Math.min(r[3],n[3])]:[Math.max(Math.min(r[0],n[2]),n[0]),Math.max(Math.min(r[1],n[3]),n[1]),Math.min(Math.max(r[2],n[0]),n[2]),Math.min(Math.max(r[3],n[1]),n[3])]}function cle({viewport:t,z:e,cullRect:n}){return(t.subViewports||[t]).map(i=>Rx(i,e||0,n))}function Rx(t,e,n){if(!Array.isArray(e)){const s=n.x-t.x,o=n.y-t.y,{width:a,height:l}=n,c={targetZ:e},u=t.unproject([s,o],c),f=t.unproject([s+a,o],c),h=t.unproject([s,o+l],c),d=t.unproject([s+a,o+l],c);return[Math.min(u[0],f[0],h[0],d[0]),Math.min(u[1],f[1],h[1],d[1]),Math.max(u[0],f[0],h[0],d[0]),Math.max(u[1],f[1],h[1],d[1])]}const r=Rx(t,e[0],n),i=Rx(t,e[1],n);return[Math.min(r[0],i[0]),Math.min(r[1],i[1]),Math.max(r[2],i[2]),Math.max(r[3],i[3])]}function ule(t,e,n){return n?Mx(t,n).map(i=>i*e/xs):t.map(r=>r*e/xs)}function Ix(t,e){return Math.pow(2,t)*xs/e}function Px(t,e,n){const r=Ix(n,xs),i=t/r*360-180,s=Math.PI-2*Math.PI*e/r,o=180/Math.PI*Math.atan(.5*(Math.exp(s)-Math.exp(-s)));return[i,o]}function OO(t,e,n,r){const i=Ix(n,r);return[t/i*xs,e/i*xs]}function fle(t,e,n,r,i=xs){if(t.isGeospatial){const[c,u]=Px(e,n,r),[f,h]=Px(e+1,n+1,r);return{west:c,north:u,east:f,south:h}}const[s,o]=OO(e,n,r,i),[a,l]=OO(e+1,n+1,r,i);return{left:s,top:o,right:a,bottom:l}}function hle(t,e,n,r,i){const s=lle(t,null,r),o=Ix(e,n),[a,l,c,u]=ule(s,o,i),f=[];for(let h=Math.floor(a);h<c;h++)for(let d=Math.floor(l);d<u;d++)f.push({x:h,y:d,z:e});return f}function dle({viewport:t,maxZoom:e,minZoom:n,zRange:r,extent:i,tileSize:s=xs,modelMatrix:o,modelMatrixInverse:a,zoomOffset:l=0}){let c=t.isGeospatial?Math.round(t.zoom+Math.log2(xs/s))+l:Math.ceil(t.zoom)+l;if(typeof n=="number"&&Number.isFinite(n)&&c<n){if(!i)return[];c=n}typeof e=="number"&&Number.isFinite(e)&&c>e&&(c=e);let u=i;return o&&a&&i&&!t.isGeospatial&&(u=Mx(i,o)),t.isGeospatial?rle(t,c,r,i):hle(t,c,s,u||ile,a)}function ple(t){let e={},n;return r=>{for(const i in r)if(!gle(r[i],e[i])){n=t(r),e=r;break}return n}}function gle(t,e){if(t===e)return!0;if(Array.isArray(t)){const n=t.length;if(!e||e.length!==n)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}return!1}const NO=1,Dm=2,mle="never",yle="no-overlap",Ox="best-available",vle=5,_le={[Ox]:wle,[yle]:Sle,[mle]:()=>{}},ble={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}};class xle{constructor(e){this._getCullBounds=ple(cle),this.opts={...ble,...e},this.setOptions(this.opts),this.onTileLoad=n=>{this.opts.onTileLoad?.(n),this.opts.maxCacheByteSize!==null&&(this._cacheByteSize+=n.byteLength,this._resizeCache())},this._requestScheduler=new Iq({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new gn,this._modelMatrixInverse=new gn}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(e=>e.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(e=>e.needsReload)}setOptions(e){Object.assign(this.opts,e),Number.isFinite(e.maxZoom)&&(this._maxZoom=Math.floor(e.maxZoom)),Number.isFinite(e.minZoom)&&(this._minZoom=Math.ceil(e.minZoom))}finalize(){for(const e of this._cache.values())e.isLoading&&e.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(const e of this._cache.keys()){const n=this._cache.get(e);!this._selectedTiles||!this._selectedTiles.includes(n)?this._cache.delete(e):n.setNeedsReload()}}update(e,{zRange:n,modelMatrix:r}={zRange:null,modelMatrix:null}){const i=r?new gn(r):new gn,s=!i.equals(this._modelMatrix);if(!this._viewport||!e.equals(this._viewport)||!gs(this._zRange,n)||s){s&&(this._modelMatrixInverse=i.clone().invert(),this._modelMatrix=i),this._viewport=e,this._zRange=n;const a=this.getTileIndices({viewport:e,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:n,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=a.map(l=>this._getTile(l,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(a=>this._getTile(a.index,!0)));const o=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),o&&this._frameNumber++,this._frameNumber}isTileVisible(e,n,r){if(!e.isVisible)return!1;if(n&&this._viewport){const i=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:n});let{bbox:s}=e;for(const[o,a,l,c]of i){let u;if("west"in s)u=s.west<l&&s.east>o&&s.south<c&&s.north>a;else{if(r&&!gn.IDENTITY.equals(r)){const[d,g,p,_]=Mx([s.left,s.top,s.right,s.bottom],r);s={left:d,top:g,right:p,bottom:_}}const f=Math.min(s.top,s.bottom),h=Math.max(s.top,s.bottom);u=s.left<l&&s.right>o&&f<c&&h>a}if(u)return!0}return!1}return!0}getTileIndices({viewport:e,maxZoom:n,minZoom:r,zRange:i,modelMatrix:s,modelMatrixInverse:o}){const{tileSize:a,extent:l,zoomOffset:c}=this.opts;return dle({viewport:e,maxZoom:n,minZoom:r,zRange:i,tileSize:a,extent:l,modelMatrix:s,modelMatrixInverse:o,zoomOffset:c})}getTileId(e){return`${e.x}-${e.y}-${e.z}`}getTileZoom(e){return e.z}getTileMetadata(e){const{tileSize:n}=this.opts;return{bbox:fle(this._viewport,e.x,e.y,e.z,n)}}getParentIndex(e){const n=Math.floor(e.x/2),r=Math.floor(e.y/2),i=e.z-1;return{x:n,y:r,z:i}}updateTileStates(){const e=this.opts.refinementStrategy||Ox,n=new Array(this._cache.size);let r=0;for(const i of this._cache.values())n[r++]=i.isVisible,i.isSelected=!1,i.isVisible=!1;for(const i of this._selectedTiles)i.isSelected=!0,i.isVisible=!0;(typeof e=="function"?e:_le[e])(Array.from(this._cache.values())),r=0;for(const i of this._cache.values())if(n[r++]!==i.isVisible)return!0;return!1}_pruneRequests(){const{maxRequests:e=0}=this.opts,n=[];let r=0;for(const i of this._cache.values())i.isLoading&&(r++,!i.isSelected&&!i.isVisible&&n.push(i));for(;e>0&&r>e&&n.length>0;)n.shift().abort(),r--}_rebuildTree(){const{_cache:e}=this;for(const n of e.values())n.parent=null,n.children&&(n.children.length=0);for(const n of e.values()){const r=this._getNearestAncestor(n);n.parent=r,r?.children&&r.children.push(n)}}_resizeCache(){const{_cache:e,opts:n}=this,r=n.maxCacheSize??(n.maxCacheByteSize!==null?1/0:vle*this.selectedTiles.length),i=n.maxCacheByteSize??1/0;if(e.size>r||this._cacheByteSize>i){for(const[o,a]of e)if(!a.isVisible&&!a.isSelected&&(this._cacheByteSize-=n.maxCacheByteSize!==null?a.byteLength:0,e.delete(o),this.opts.onTileUnload?.(a)),e.size<=r&&this._cacheByteSize<=i)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((o,a)=>o.zoom-a.zoom),this._dirty=!1)}_getTile(e,n){const r=this.getTileId(e);let i=this._cache.get(r),s=!1;return!i&&n?(i=new Bae(e),Object.assign(i,this.getTileMetadata(i.index)),Object.assign(i,{id:r,zoom:this.getTileZoom(i.index)}),s=!0,this._cache.set(r,i),this._dirty=!0):i&&i.needsReload&&(s=!0),i&&s&&i.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),i}_getNearestAncestor(e){const{_minZoom:n=0}=this;let r=e.index;for(;this.getTileZoom(r)>n;){r=this.getParentIndex(r);const i=this._getTile(r);if(i)return i}return null}}function wle(t){for(const e of t)e.state=0;for(const e of t)e.isSelected&&!FO(e)&&Nx(e);for(const e of t)e.isVisible=!!(e.state&Dm)}function Sle(t){for(const n of t)n.state=0;for(const n of t)n.isSelected&&FO(n);const e=Array.from(t).sort((n,r)=>n.zoom-r.zoom);for(const n of e)if(n.isVisible=!!(n.state&Dm),n.children&&(n.isVisible||n.state&NO))for(const r of n.children)r.state=NO;else n.isSelected&&Nx(n)}function FO(t){let e=t;for(;e;){if(e.isLoaded||e.content)return e.state|=Dm,!0;e=e.parent}return!1}function Nx(t){for(const e of t.children)e.isLoaded||e.content?e.state|=Dm:Nx(e)}const Tle={TilesetClass:xle,data:{type:"data",value:[]},dataComparator:sle.equal,renderSubLayers:{type:"function",value:t=>new Sx(t)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:t=>{}},onTileUnload:{type:"function",value:t=>{}},onTileError:{type:"function",value:t=>console.error(t)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:Ox,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0};class Fx extends lm{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return!!this.state?.tileset?.selectedTiles?.every(e=>e.isLoaded&&e.layers&&e.layers.every(n=>n.isLoaded))}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState({changeFlags:e}){let{tileset:n}=this.state;const r=e.propsOrDataChanged||e.updateTriggersChanged,i=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getTileData);n?r&&(n.setOptions(this._getTilesetOptions()),i?n.reloadAll():n.tiles.forEach(s=>{s.layers=null})):(n=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:n})),this._updateTileset()}_getTilesetOptions(){const{tileSize:e,maxCacheSize:n,maxCacheByteSize:r,refinementStrategy:i,extent:s,maxZoom:o,minZoom:a,maxRequests:l,debounceTime:c,zoomOffset:u}=this.props;return{maxCacheSize:n,maxCacheByteSize:r,maxZoom:o,minZoom:a,tileSize:e,refinementStrategy:i,extent:s,maxRequests:l,debounceTime:c,zoomOffset:u,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){const e=this.state.tileset,{zRange:n,modelMatrix:r}=this.props,i=e.update(this.context.viewport,{zRange:n,modelMatrix:r}),{isLoaded:s}=e,o=this.state.isLoaded!==s,a=this.state.frameNumber!==i;s&&(o||a)&&this._onViewportLoad(),a&&this.setState({frameNumber:i}),this.state.isLoaded=s}_onViewportLoad(){const{tileset:e}=this.state,{onViewportLoad:n}=this.props;n&&n(e.selectedTiles)}_onTileLoad(e){this.props.onTileLoad(e),e.layers=null,this.setNeedsUpdate()}_onTileError(e,n){this.props.onTileError(e),n.layers=null,this.setNeedsUpdate()}_onTileUnload(e){this.props.onTileUnload(e)}getTileData(e){const{data:n,getTileData:r,fetch:i}=this.props,{signal:s}=e;return e.url=typeof n=="string"||Array.isArray(n)?ale(n,e):null,r?r(e):i&&e.url?i(e.url,{propName:"data",layer:this,signal:s}):null}renderSubLayers(e){return this.props.renderSubLayers(e)}getSubLayerPropsByTile(e){return null}getPickingInfo(e){const n=e.sourceLayer,r=n.props.tile,i=e.info;return i.picked&&(i.tile=r),i.sourceTile=r,i.sourceTileSubLayer=n,i}_updateAutoHighlight(e){e.sourceTileSubLayer.updateAutoHighlight(e)}renderLayers(){return this.state.tileset.tiles.map(e=>{const n=this.getSubLayerPropsByTile(e);if(!(!e.isLoaded&&!e.content))if(e.layers)n&&e.layers[0]&&Object.keys(n).some(r=>e.layers[0].props[r]!==n[r])&&(e.layers=e.layers.map(r=>r.clone(n)));else{const r=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:e.id,updateTriggers:this.props.updateTriggers}),data:e.content,_offset:0,tile:e});e.layers=Kg(r,Boolean).map(i=>i.clone({tile:e,...n}))}return e.layers})}filterSubLayer({layer:e,cullRect:n}){const{tile:r}=e.props,{modelMatrix:i}=this.props;return this.state.tileset.isTileVisible(r,n,i?new gn(i):null)}}Fx.defaultProps=Tle,Fx.layerName="TileLayer";const Ale=typeof window<"u"?D.useLayoutEffect:D.useEffect;function Mm(t,e){for(;t;){if(t===e)return!0;t=Object.getPrototypeOf(t)}return!1}const Ele={position:"absolute",zIndex:-1};function BO(t,e){if(typeof t=="function")return t(e);if(Array.isArray(t))return t.map(n=>BO(n,e));if(Rm(t)){if(Cle(t))return e.style=Ele,D.cloneElement(t,e);if(Dle(t))return D.cloneElement(t,e)}return t}function Rm(t){return t&&typeof t=="object"&&"type"in t||!1}function Cle(t){return t.props?.mapStyle}function Dle(t){const e=t.type;return e&&e.deckGLViewProps}function Bx(t){if(typeof t=="function")return D.createElement(ya,{},t);if(Array.isArray(t))return t.map(Bx);if(Rm(t)){if(t.type===D.Fragment)return Bx(t.props.children);if(Mm(t.type,ya))return t}return t}function Mle({children:t,layers:e=[],views:n=null}){const r=[],i=[],s={};return D.Children.forEach(Bx(t),o=>{if(Rm(o)){const a=o.type;if(Mm(a,Ui)){const l=Rle(a,o.props);i.push(l)}else r.push(o);if(Mm(a,ya)&&a!==ya&&o.props.id){const l=new a(o.props);s[l.id]=l}}else o&&r.push(o)}),Object.keys(s).length>0&&(Array.isArray(n)?n.forEach(o=>{s[o.id]=o}):n&&(s[n.id]=n),n=Object.values(s)),e=i.length>0?[...i,...e]:e,{layers:e,children:r,views:n}}function Rle(t,e){const n={},r=t.defaultProps||{};for(const i in e)r[i]!==e[i]&&(n[i]=e[i]);return new t(n)}const Ile=D.createContext();function Ple({children:t,deck:e,ContextProvider:n=Ile.Provider}){const{viewManager:r}=e||{};if(!r||!r.views.length)return[];const i={},s=r.views[0].id;for(const o of t){let a=s,l=o;Rm(o)&&Mm(o.type,ya)&&(a=o.props.id||s,l=o.props.children);const c=r.getViewport(a),u=r.getViewState(a);if(c){u.padding=c.padding;const{x:f,y:h,width:d,height:g}=c;l=BO(l,{x:f,y:h,width:d,height:g,viewport:c,viewState:u}),i[a]||(i[a]={viewport:c,children:[]}),i[a].children.push(l)}}return Object.keys(i).map(o=>{const{viewport:a,children:l}=i[o],{x:c,y:u,width:f,height:h}=a,d={position:"absolute",left:c,top:u,width:f,height:h},g=`view-${o}`,p=D.createElement("div",{key:g,id:g,style:d},...l),_={deck:e,viewport:a,container:e.canvas.offsetParent,eventManager:e.eventManager,onViewStateChange:v=>{v.viewId=o,e._onViewStateChange(v)},widgets:[]},m=`view-${o}-context`;return D.createElement(n,{key:m,value:_},p)})}const Ole={mixBlendMode:null};function Nle({width:t,height:e,style:n}){const r={position:"absolute",zIndex:0,left:0,top:0,width:t,height:e},i={left:0,top:0};if(n)for(const s in n)s in Ole?i[s]=n[s]:r[s]=n[s];return{containerStyle:r,canvasStyle:i}}function Fle(t){return{get deck(){return t.deck},pickObject:e=>t.deck.pickObject(e),pickMultipleObjects:e=>t.deck.pickMultipleObjects(e),pickObjects:e=>t.deck.pickObjects(e)}}function kO(t){t.redrawReason&&(t.deck._drawLayers(t.redrawReason),t.redrawReason=null)}function Ble(t,e,n){const r=new e({...n,_customRender:n.deviceProps?.adapters?.[0]?.type==="webgpu"?void 0:i=>{t.redrawReason=i;const s=r.getViewports();t.lastRenderedViewports!==s?t.forceUpdate():kO(t)}});return r}function kle(t,e){const[n,r]=D.useState(0),s=D.useRef({control:null,version:n,forceUpdate:()=>r(w=>w+1)}).current,o=D.useRef(null),a=D.useRef(null),l=D.useMemo(()=>Mle(t),[t.layers,t.views,t.children]);let c=!0;const u=w=>c&&t.viewState?(s.viewStateUpdateRequested=w,null):(s.viewStateUpdateRequested=null,t.onViewStateChange?.(w)),f=w=>{c?s.interactionStateUpdateRequested=w:(s.interactionStateUpdateRequested=null,t.onInteractionStateChange?.(w))},h=D.useMemo(()=>{const w={widgets:[],...t,style:null,width:"100%",height:"100%",parent:o.current,canvas:a.current,layers:l.layers,views:l.views,onViewStateChange:u,onInteractionStateChange:f};return delete w._customRender,s.deck&&s.deck.setProps(w),w},[t]);D.useEffect(()=>{const w=t.Deck||K1;return s.deck=Ble(s,w,{...h,parent:o.current,canvas:a.current}),()=>s.deck?.finalize()},[]),Ale(()=>{kO(s);const{viewStateUpdateRequested:w,interactionStateUpdateRequested:x}=s;w&&u(w),x&&f(x),s.deck?.isInitialized&&s.deck.redraw("Initial render")}),D.useImperativeHandle(e,()=>Fle(s),[]);const d=s.deck&&s.deck.isInitialized?s.deck.getViewports():void 0,{ContextProvider:g,width:p="100%",height:_="100%",id:m,style:v}=t,{containerStyle:y,canvasStyle:b}=D.useMemo(()=>Nle({width:p,height:_,style:v}),[p,_,v]);if(!s.viewStateUpdateRequested&&s.lastRenderedViewports===d||s.version!==n){s.lastRenderedViewports=d,s.version=n;const w=Ple({children:l.children,deck:s.deck,ContextProvider:g}),x=D.createElement("canvas",{key:"canvas",id:m||"deckgl-overlay",ref:a,style:b});s.control=D.createElement("div",{id:`${m||"deckgl"}-wrapper`,ref:o,style:y},[x,w])}return c=!1,s.control}const Ule=D.forwardRef(kle),Lle=({zarrGroup:t,width:e,height:n})=>{const[r,i]=D.useState([]),[s,o]=D.useState(!0),[a,l]=D.useState(null),[c,u]=D.useState(0);D.useEffect(()=>{(async()=>{try{const p=t.attrs,_=p.num_layers,m=p.tile_size,v=[];for(let y=0;y<_;y++){const b=await t.getGroup(`layer_${y}`);if(!b)throw new Error(`Layer ${y} not found`);const w=b.attrs,x=w.label,T=w.width,E=w.height,A=w.num_zoom_levels,C=await b.getGroup("tiles");if(!C)throw new Error(`Tiles group not found for layer ${y}`);const M=C.datasets,S={};for(const P of M){const R=await C.getDatasetData(P.name,{});R&&(S[P.name]=R)}v.push({label:x,width:T,height:E,tileSize:m,numZoomLevels:A,tiles:S})}i(v),o(!1)}catch(p){console.error("Error loading tiled image:",p),l(p instanceof Error?p.message:"Failed to load data"),o(!1)}})()},[t]);const f=D.useMemo(()=>{if(r.length===0)return null;const g=r[0],{numZoomLevels:p,width:_,height:m}=g,v=-Math.floor(Math.min(p-1,Math.log2(Math.max(_,m))-8));return{ortho:{target:[_/2,m/2,0],zoom:v}}},[r]),h=D.useMemo(()=>r.map((g,p)=>{const{tileSize:_,width:m,height:v,numZoomLevels:y,tiles:b}=g;return new Fx({id:`TileLayer-${p}`,pickable:!0,tileSize:_,autoHighlight:!0,highlightColor:[255,255,255,20],minZoom:-7,maxZoom:0,coordinateSystem:qe.CARTESIAN,extent:[0,0,m,v],getTileData:async({index:w})=>{const{x,y:T,z:E}=w,A=`${y+E}_${x}_${T}`,C=b[A];if(!C)throw new Error(`Unable to find tile: ${A}`);const M=new Blob([C],{type:"image/jpeg"}),S=URL.createObjectURL(M);return new Promise((P,R)=>{const k=new Image;k.onload=()=>{P(k),URL.revokeObjectURL(S)},k.onerror=()=>{URL.revokeObjectURL(S),R(new Error(`Failed to load image for tile ${A}`))},k.src=S})},renderSubLayers:w=>{const{bbox:{left:x,bottom:T,right:E,top:A}}=w.tile;return new rx(w,{data:void 0,image:w.data,bounds:[Yt(x,0,m),Yt(T,0,v),Yt(E,0,m),Yt(A,0,v)]})},visible:c===p})}),[r,c]),d=D.useMemo(()=>[new TP({id:"ortho"})],[]);return s?I.jsx("div",{style:{width:e,height:n,display:"flex",alignItems:"center",justifyContent:"center"},children:"Loading tiled image..."}):a?I.jsxs("div",{style:{width:e,height:n,display:"flex",alignItems:"center",justifyContent:"center",color:"red"},children:["Error: ",a]}):r.length===0||!f?I.jsx("div",{style:{width:e,height:n,display:"flex",alignItems:"center",justifyContent:"center"},children:"No layers to display"}):I.jsxs("div",{style:{position:"absolute",width:e,height:n},children:[r.length>1&&I.jsxs("div",{style:{position:"absolute",left:10,top:10,zIndex:1,background:"rgba(255, 255, 255, 0.9)",padding:"10px",borderRadius:"4px",boxShadow:"0 2px 4px rgba(0,0,0,0.2)"},children:[I.jsx("div",{style:{marginBottom:"5px",fontWeight:"bold"},children:"Layers:"}),r.map((g,p)=>I.jsx("div",{style:{marginBottom:"3px"},children:I.jsxs("label",{style:{cursor:"pointer",display:"flex",alignItems:"center"},children:[I.jsx("input",{type:"radio",name:"layer",checked:c===p,onChange:()=>u(p),style:{marginRight:"5px"}}),g.label]})},p))]}),I.jsx(Ule,{views:d,layers:h,initialViewState:f,controller:!0})]})},UO=()=>{const t={current:{}},e=[];return{stateRef:t,dispatch:i=>{t.current=UF(t.current,i),e.forEach(s=>{s(t.current)})},onChange:i=>(e.push(i),()=>{const s=e.indexOf(i);s>=0&&e.splice(s,1)}),createNew:UO}},LO=()=>{const t={current:d3},e=[];return{stateRef:t,dispatch:i=>{t.current=fB(t.current,i),e.forEach(s=>{s(t.current)})},onChange:i=>(e.push(i),()=>{const s=e.indexOf(i);s>=0&&e.splice(s,1)}),createNew:LO}},zO=()=>{const t={current:{}},e=[];return{stateRef:t,dispatch:i=>{t.current=Kp(t.current,i),e.forEach(s=>{s(t.current)})},onChange:i=>(e.push(i),()=>{const s=e.indexOf(i);s>=0&&e.splice(s,1)}),createNew:zO}},zle=({zarrGroup:t,width:e,height:n,onResize:r,onDataChange:i,contexts:s,component:o})=>{const[a,l]=D.useState(e),[c,u]=D.useState(n),[f,h]=D.useState(t);return D.useEffect(()=>{r((d,g)=>{l(d),u(g)}),i(d=>{h(d)})},[r,i]),I.jsx(o,{zarrGroup:f,width:a,height:c,contexts:s})},$le=t=>e=>{const{container:n,zarrGroup:r,width:i,height:s,onResize:o,onDataChange:a,contexts:l}=e;kF.createRoot(n).render(I.jsx(zle,{zarrGroup:r,width:i,height:s,onResize:o,onDataChange:a,contexts:l,component:t}))};(()=>{const t=[{name:"spike_sorting.Autocorrelograms",component:IH},{name:"spike_sorting.AverageWaveforms",component:bW},{name:"spike_sorting.CrossCorrelograms",component:SW},{name:"spike_sorting.RasterPlot",component:iX},{name:"spike_sorting.SpikeAmplitudes",component:aX},{name:"spike_sorting.UnitLocations",component:gX},{name:"spike_sorting.UnitMetricsGraph",component:VX},{name:"spike_sorting.UnitsTable",component:VH},{name:"spike_sorting.SortingCuration",component:zH},{name:"spike_sorting.TiledImage",component:Lle}],e=window.figpack_p1.registerFPViewComponent;for(const i of t)e({name:i.name,render:$le(i.component)});const n=window.figpack_p1.registerFPViewContextCreator;n({name:"unitSelection",create:LO}),n({name:"unitMetricSelection",create:UO}),n({name:"sortingCuration",create:zO});const r=window.figpack_p1.registerFPExtension;r({name:"figpack-spike-sorting"})})()})();
2772
+ `,Cae={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,borderRadius:{type:"object",value:0},padding:{type:"array",value:[0,0,0,0]},getPosition:{type:"accessor",value:t=>t.position},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},getBoundingRect:{type:"accessor",value:[0,0,0,0]},getFillColor:{type:"accessor",value:[0,0,0,255]},getLineColor:{type:"accessor",value:[0,0,0,255]},getLineWidth:{type:"accessor",value:1}};class vx extends Ui{getShaders(){return super.getShaders({vs:Aae,fs:Eae,modules:[Gl,tc,Tae]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceSizes:{size:1,transition:!0,accessor:"getSize",defaultValue:1},instanceAngles:{size:1,transition:!0,accessor:"getAngle"},instanceRects:{size:4,accessor:"getBoundingRect"},instancePixelOffsets:{size:2,transition:!0,accessor:"getPixelOffset"},instanceFillColors:{size:4,transition:!0,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:4,transition:!0,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}updateState(e){super.updateState(e);const{changeFlags:n}=e;n.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){const{billboard:n,sizeScale:r,sizeUnits:i,sizeMinPixels:s,sizeMaxPixels:o,getLineWidth:a}=this.props;let{padding:l,borderRadius:c}=this.props;l.length<4&&(l=[l[0],l[1],l[0],l[1]]),Array.isArray(c)||(c=[c,c,c,c]);const u=this.state.model,f={billboard:n,stroked:!!a,borderRadius:c,padding:l,sizeUnits:ms[i],sizeScale:r,sizeMinPixels:s,sizeMaxPixels:o};u.shaderInputs.setProps({textBackground:f}),u.draw(this.context.renderPass)}_getModel(){const e=[0,0,1,0,0,1,1,1];return new Qr(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new sc({topology:"triangle-strip",vertexCount:4,attributes:{positions:{size:2,value:new Float32Array(e)}}}),isInstanced:!0})}}vx.defaultProps=Cae,vx.layerName="TextBackgroundLayer";const vO={start:1,middle:0,end:-1},_O={top:1,center:0,bottom:-1},_x=[0,0,0,255],Dae={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,background:!1,getBackgroundColor:{type:"accessor",value:[255,255,255,255]},getBorderColor:{type:"accessor",value:_x},getBorderWidth:{type:"accessor",value:0},backgroundBorderRadius:{type:"object",value:0},backgroundPadding:{type:"array",value:[0,0,0,0]},characterSet:{type:"object",value:yc.characterSet},fontFamily:yc.fontFamily,fontWeight:yc.fontWeight,lineHeight:1,outlineWidth:{type:"number",value:0,min:0},outlineColor:{type:"color",value:_x},fontSettings:{type:"object",value:{},compare:1},wordBreak:"break-word",maxWidth:{type:"number",value:-1},getText:{type:"accessor",value:t=>t.text},getPosition:{type:"accessor",value:t=>t.position},getColor:{type:"accessor",value:_x},getSize:{type:"accessor",value:32},getAngle:{type:"accessor",value:0},getTextAnchor:{type:"accessor",value:"middle"},getAlignmentBaseline:{type:"accessor",value:"center"},getPixelOffset:{type:"accessor",value:[0,0]},backgroundColor:{deprecatedFor:["background","getBackgroundColor"]}};class bx extends lm{constructor(){super(...arguments),this.getBoundingRect=(e,n)=>{let{size:[r,i]}=this.transformParagraph(e,n);const{fontSize:s}=this.state.fontAtlasManager.props;r/=s,i/=s;const{getTextAnchor:o,getAlignmentBaseline:a}=this.props,l=vO[typeof o=="function"?o(e,n):o],c=_O[typeof a=="function"?a(e,n):a];return[(l-1)*r/2,(c-1)*i/2,r,i]},this.getIconOffsets=(e,n)=>{const{getTextAnchor:r,getAlignmentBaseline:i}=this.props,{x:s,y:o,rowWidth:a,size:[l,c]}=this.transformParagraph(e,n),u=vO[typeof r=="function"?r(e,n):r],f=_O[typeof i=="function"?i(e,n):i],h=s.length,d=new Array(h*2);let g=0;for(let p=0;p<h;p++){const _=(1-u)*(l-a[p])/2;d[g++]=(u-1)*l/2+_+s[p],d[g++]=(f-1)*c/2+o[p]}return d}}initializeState(){this.state={styleVersion:0,fontAtlasManager:new Sae},this.props.maxWidth>0&&He.once(1,"v8.9 breaking change: TextLayer maxWidth is now relative to text size")()}updateState(e){const{props:n,oldProps:r,changeFlags:i}=e;(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getText))&&this._updateText(),(this._updateFontAtlas()||n.lineHeight!==r.lineHeight||n.wordBreak!==r.wordBreak||n.maxWidth!==r.maxWidth)&&this.setState({styleVersion:this.state.styleVersion+1})}getPickingInfo({info:e}){return e.object=e.index>=0?this.props.data[e.index]:null,e}_updateFontAtlas(){const{fontSettings:e,fontFamily:n,fontWeight:r}=this.props,{fontAtlasManager:i,characterSet:s}=this.state,o={...e,characterSet:s,fontFamily:n,fontWeight:r};if(!i.mapping)return i.setProps(o),!0;for(const a in o)if(o[a]!==i.props[a])return i.setProps(o),!0;return!1}_updateText(){const{data:e,characterSet:n}=this.props,r=e.attributes?.getText;let{getText:i}=this.props,s=e.startIndices,o;const a=n==="auto"&&new Set;if(r&&s){const{texts:l,characterCount:c}=vae({...ArrayBuffer.isView(r)?{value:r}:r,length:e.length,startIndices:s,characterSet:a});o=c,i=(u,{index:f})=>l[f]}else{const{iterable:l,objectInfo:c}=im(e);s=[0],o=0;for(const u of l){c.index++;const f=Array.from(i(u,c)||"");a&&f.forEach(a.add,a),o+=f.length,s.push(o)}}this.setState({getText:i,startIndices:s,numInstances:o,characterSet:a||n})}transformParagraph(e,n){const{fontAtlasManager:r}=this.state,i=r.mapping,s=this.state.getText,{wordBreak:o,lineHeight:a,maxWidth:l}=this.props,c=s(e,n)||"";return yae(c,a,o,l*r.props.fontSize,i)}renderLayers(){const{startIndices:e,numInstances:n,getText:r,fontAtlasManager:{scale:i,atlas:s,mapping:o},styleVersion:a}=this.state,{data:l,_dataDiff:c,getPosition:u,getColor:f,getSize:h,getAngle:d,getPixelOffset:g,getBackgroundColor:p,getBorderColor:_,getBorderWidth:m,backgroundBorderRadius:v,backgroundPadding:y,background:b,billboard:w,fontSettings:x,outlineWidth:T,outlineColor:E,sizeScale:A,sizeUnits:C,sizeMinPixels:M,sizeMaxPixels:S,transitions:P,updateTriggers:R}=this.props,k=this.getSubLayerClass("characters",yx),O=this.getSubLayerClass("background",vx);return[b&&new O({getFillColor:p,getLineColor:_,getLineWidth:m,borderRadius:v,padding:y,getPosition:u,getSize:h,getAngle:d,getPixelOffset:g,billboard:w,sizeScale:A,sizeUnits:C,sizeMinPixels:M,sizeMaxPixels:S,transitions:P&&{getPosition:P.getPosition,getAngle:P.getAngle,getSize:P.getSize,getFillColor:P.getBackgroundColor,getLineColor:P.getBorderColor,getLineWidth:P.getBorderWidth,getPixelOffset:P.getPixelOffset}},this.getSubLayerProps({id:"background",updateTriggers:{getPosition:R.getPosition,getAngle:R.getAngle,getSize:R.getSize,getFillColor:R.getBackgroundColor,getLineColor:R.getBorderColor,getLineWidth:R.getBorderWidth,getPixelOffset:R.getPixelOffset,getBoundingRect:{getText:R.getText,getTextAnchor:R.getTextAnchor,getAlignmentBaseline:R.getAlignmentBaseline,styleVersion:a}}}),{data:l.attributes&&l.attributes.background?{length:l.length,attributes:l.attributes.background}:l,_dataDiff:c,autoHighlight:!1,getBoundingRect:this.getBoundingRect}),new k({sdf:x.sdf,smoothing:Number.isFinite(x.smoothing)?x.smoothing:yc.smoothing,outlineWidth:T/(x.radius||yc.radius),outlineColor:E,iconAtlas:s,iconMapping:o,getPosition:u,getColor:f,getSize:h,getAngle:d,getPixelOffset:g,billboard:w,sizeScale:A*i,sizeUnits:C,sizeMinPixels:M*i,sizeMaxPixels:S*i,transitions:P&&{getPosition:P.getPosition,getAngle:P.getAngle,getColor:P.getColor,getSize:P.getSize,getPixelOffset:P.getPixelOffset}},this.getSubLayerProps({id:"characters",updateTriggers:{all:R.getText,getPosition:R.getPosition,getAngle:R.getAngle,getColor:R.getColor,getSize:R.getSize,getPixelOffset:R.getPixelOffset,getIconOffsets:{getTextAnchor:R.getTextAnchor,getAlignmentBaseline:R.getAlignmentBaseline,styleVersion:a}}}),{data:l,_dataDiff:c,startIndices:e,numInstances:n,getIconOffsets:this.getIconOffsets,getIcon:r})]}static set fontAtlasCacheLimit(e){wae(e)}}bx.defaultProps=Dae,bx.layerName="TextLayer";const xm={circle:{type:ix,props:{filled:"filled",stroked:"stroked",lineWidthMaxPixels:"lineWidthMaxPixels",lineWidthMinPixels:"lineWidthMinPixels",lineWidthScale:"lineWidthScale",lineWidthUnits:"lineWidthUnits",pointRadiusMaxPixels:"radiusMaxPixels",pointRadiusMinPixels:"radiusMinPixels",pointRadiusScale:"radiusScale",pointRadiusUnits:"radiusUnits",pointAntialiasing:"antialiasing",pointBillboard:"billboard",getFillColor:"getFillColor",getLineColor:"getLineColor",getLineWidth:"getLineWidth",getPointRadius:"getRadius"}},icon:{type:cm,props:{iconAtlas:"iconAtlas",iconMapping:"iconMapping",iconSizeMaxPixels:"sizeMaxPixels",iconSizeMinPixels:"sizeMinPixels",iconSizeScale:"sizeScale",iconSizeUnits:"sizeUnits",iconAlphaCutoff:"alphaCutoff",iconBillboard:"billboard",getIcon:"getIcon",getIconAngle:"getAngle",getIconColor:"getColor",getIconPixelOffset:"getPixelOffset",getIconSize:"getSize"}},text:{type:bx,props:{textSizeMaxPixels:"sizeMaxPixels",textSizeMinPixels:"sizeMinPixels",textSizeScale:"sizeScale",textSizeUnits:"sizeUnits",textBackground:"background",textBackgroundPadding:"backgroundPadding",textFontFamily:"fontFamily",textFontWeight:"fontWeight",textLineHeight:"lineHeight",textMaxWidth:"maxWidth",textOutlineColor:"outlineColor",textOutlineWidth:"outlineWidth",textWordBreak:"wordBreak",textCharacterSet:"characterSet",textBillboard:"billboard",textFontSettings:"fontSettings",getText:"getText",getTextAngle:"getAngle",getTextColor:"getColor",getTextPixelOffset:"getPixelOffset",getTextSize:"getSize",getTextAnchor:"getTextAnchor",getTextAlignmentBaseline:"getAlignmentBaseline",getTextBackgroundColor:"getBackgroundColor",getTextBorderColor:"getBorderColor",getTextBorderWidth:"getBorderWidth"}}},wm={type:cx,props:{lineWidthUnits:"widthUnits",lineWidthScale:"widthScale",lineWidthMinPixels:"widthMinPixels",lineWidthMaxPixels:"widthMaxPixels",lineJointRounded:"jointRounded",lineCapRounded:"capRounded",lineMiterLimit:"miterLimit",lineBillboard:"billboard",getLineColor:"getColor",getLineWidth:"getWidth"}},xx={type:gx,props:{extruded:"extruded",filled:"filled",wireframe:"wireframe",elevationScale:"elevationScale",material:"material",_full3d:"_full3d",getElevation:"getElevation",getFillColor:"getFillColor",getLineColor:"getLineColor"}};function kf({type:t,props:e}){const n={};for(const r in e)n[r]=t.defaultProps[e[r]];return n}function wx(t,e){const{transitions:n,updateTriggers:r}=t.props,i={updateTriggers:{},transitions:n&&{getPosition:n.geometry}};for(const s in e){const o=e[s];let a=t.props[s];s.startsWith("get")&&(a=t.getSubLayerAccessor(a),i.updateTriggers[o]=r[s],n&&(i.transitions[o]=n[s])),i[o]=a}return i}function Mae(t){if(Array.isArray(t))return t;switch(He.assert(t.type,"GeoJSON does not have type"),t.type){case"Feature":return[t];case"FeatureCollection":return He.assert(Array.isArray(t.features),"GeoJSON does not have features array"),t.features;default:return[{geometry:t}]}}function bO(t,e,n={}){const r={pointFeatures:[],lineFeatures:[],polygonFeatures:[],polygonOutlineFeatures:[]},{startRow:i=0,endRow:s=t.length}=n;for(let o=i;o<s;o++){const a=t[o],{geometry:l}=a;if(l)if(l.type==="GeometryCollection"){He.assert(Array.isArray(l.geometries),"GeoJSON does not have geometries array");const{geometries:c}=l;for(let u=0;u<c.length;u++){const f=c[u];xO(f,r,e,a,o)}}else xO(l,r,e,a,o)}return r}function xO(t,e,n,r,i){const{type:s,coordinates:o}=t,{pointFeatures:a,lineFeatures:l,polygonFeatures:c,polygonOutlineFeatures:u}=e;if(!Iae(s,o)){He.warn(`${s} coordinates are malformed`)();return}switch(s){case"Point":a.push(n({geometry:t},r,i));break;case"MultiPoint":o.forEach(f=>{a.push(n({geometry:{type:"Point",coordinates:f}},r,i))});break;case"LineString":l.push(n({geometry:t},r,i));break;case"MultiLineString":o.forEach(f=>{l.push(n({geometry:{type:"LineString",coordinates:f}},r,i))});break;case"Polygon":c.push(n({geometry:t},r,i)),o.forEach(f=>{u.push(n({geometry:{type:"LineString",coordinates:f}},r,i))});break;case"MultiPolygon":o.forEach(f=>{c.push(n({geometry:{type:"Polygon",coordinates:f}},r,i)),f.forEach(h=>{u.push(n({geometry:{type:"LineString",coordinates:h}},r,i))})});break}}const Rae={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function Iae(t,e){let n=Rae[t];for(He.assert(n,`Unknown GeoJSON type ${t}`);e&&--n>0;)e=e[0];return e&&Number.isFinite(e[0])}function wO(){return{points:{},lines:{},polygons:{},polygonsOutline:{}}}function Sm(t){return t.geometry.coordinates}function Pae(t,e){const n=wO(),{pointFeatures:r,lineFeatures:i,polygonFeatures:s,polygonOutlineFeatures:o}=t;return n.points.data=r,n.points._dataDiff=e.pointFeatures&&(()=>e.pointFeatures),n.points.getPosition=Sm,n.lines.data=i,n.lines._dataDiff=e.lineFeatures&&(()=>e.lineFeatures),n.lines.getPath=Sm,n.polygons.data=s,n.polygons._dataDiff=e.polygonFeatures&&(()=>e.polygonFeatures),n.polygons.getPolygon=Sm,n.polygonsOutline.data=o,n.polygonsOutline._dataDiff=e.polygonOutlineFeatures&&(()=>e.polygonOutlineFeatures),n.polygonsOutline.getPath=Sm,n}function Oae(t,e){const n=wO(),{points:r,lines:i,polygons:s}=t,o=sae(t,e);n.points.data={length:r.positions.value.length/r.positions.size,attributes:{...r.attributes,getPosition:r.positions,instancePickingColors:{size:4,value:o.points}},properties:r.properties,numericProps:r.numericProps,featureIds:r.featureIds},n.lines.data={length:i.pathIndices.value.length-1,startIndices:i.pathIndices.value,attributes:{...i.attributes,getPath:i.positions,instancePickingColors:{size:4,value:o.lines}},properties:i.properties,numericProps:i.numericProps,featureIds:i.featureIds},n.lines._pathType="open";const a=s.positions.value.length/s.positions.size,l=Array(a).fill(1);for(const c of s.primitivePolygonIndices.value)l[c-1]=0;return n.polygons.data={length:s.polygonIndices.value.length-1,startIndices:s.polygonIndices.value,attributes:{...s.attributes,getPolygon:s.positions,instanceVertexValid:{size:1,value:new Uint16Array(l)},pickingColors:{size:4,value:o.polygons}},properties:s.properties,numericProps:s.numericProps,featureIds:s.featureIds},n.polygons._normalize=!1,s.triangles&&(n.polygons.data.attributes.indices=s.triangles.value),n.polygonsOutline.data={length:s.primitivePolygonIndices.value.length-1,startIndices:s.primitivePolygonIndices.value,attributes:{...s.attributes,getPath:s.positions,instancePickingColors:{size:4,value:o.polygons}},properties:s.properties,numericProps:s.numericProps,featureIds:s.featureIds},n.polygonsOutline._pathType="open",n}const Nae=["points","linestrings","polygons"],Fae={...kf(xm.circle),...kf(xm.icon),...kf(xm.text),...kf(wm),...kf(xx),stroked:!0,filled:!0,extruded:!1,wireframe:!1,_full3d:!1,iconAtlas:{type:"object",value:null},iconMapping:{type:"object",value:{}},getIcon:{type:"accessor",value:t=>t.properties.icon},getText:{type:"accessor",value:t=>t.properties.text},pointType:"circle",getRadius:{deprecatedFor:"getPointRadius"}};class Sx extends lm{initializeState(){this.state={layerProps:{},features:{},featuresDiff:{}}}updateState({props:e,changeFlags:n}){if(!n.dataChanged)return;const{data:r}=this.props,i=r&&"points"in r&&"polygons"in r&&"lines"in r;this.setState({binary:i}),i?this._updateStateBinary({props:e,changeFlags:n}):this._updateStateJSON({props:e,changeFlags:n})}_updateStateBinary({props:e,changeFlags:n}){const r=Oae(e.data,this.encodePickingColor);this.setState({layerProps:r})}_updateStateJSON({props:e,changeFlags:n}){const r=Mae(e.data),i=this.getSubLayerRow.bind(this);let s={};const o={};if(Array.isArray(n.dataChanged)){const l=this.state.features;for(const c in l)s[c]=l[c].slice(),o[c]=[];for(const c of n.dataChanged){const u=bO(r,i,c);for(const f in l)o[f].push(nae({data:s[f],getIndex:h=>h.__source.index,dataRange:c,replace:u[f]}))}}else s=bO(r,i);const a=Pae(s,o);this.setState({features:s,featuresDiff:o,layerProps:a})}getPickingInfo(e){const n=super.getPickingInfo(e),{index:r,sourceLayer:i}=n;return n.featureType=Nae.find(s=>i.id.startsWith(`${this.id}-${s}-`)),r>=0&&i.id.startsWith(`${this.id}-points-text`)&&this.state.binary&&(n.index=this.props.data.points.globalFeatureIds.value[r]),n}_updateAutoHighlight(e){const n=`${this.id}-points-`,r=e.featureType==="points";for(const i of this.getSubLayers())i.id.startsWith(n)===r&&i.updateAutoHighlight(e)}_renderPolygonLayer(){const{extruded:e,wireframe:n}=this.props,{layerProps:r}=this.state,i="polygons-fill",s=this.shouldRenderSubLayer(i,r.polygons?.data)&&this.getSubLayerClass(i,xx.type);if(s){const o=wx(this,xx.props),a=e&&n;return a||delete o.getLineColor,o.updateTriggers.lineColors=a,new s(o,this.getSubLayerProps({id:i,updateTriggers:o.updateTriggers}),r.polygons)}return null}_renderLineLayers(){const{extruded:e,stroked:n}=this.props,{layerProps:r}=this.state,i="polygons-stroke",s="linestrings",o=!e&&n&&this.shouldRenderSubLayer(i,r.polygonsOutline?.data)&&this.getSubLayerClass(i,wm.type),a=this.shouldRenderSubLayer(s,r.lines?.data)&&this.getSubLayerClass(s,wm.type);if(o||a){const l=wx(this,wm.props);return[o&&new o(l,this.getSubLayerProps({id:i,updateTriggers:l.updateTriggers}),r.polygonsOutline),a&&new a(l,this.getSubLayerProps({id:s,updateTriggers:l.updateTriggers}),r.lines)]}return null}_renderPointLayers(){const{pointType:e}=this.props,{layerProps:n,binary:r}=this.state;let{highlightedObjectIndex:i}=this.props;!r&&Number.isFinite(i)&&(i=n.points.data.findIndex(a=>a.__source.index===i));const s=new Set(e.split("+")),o=[];for(const a of s){const l=`points-${a}`,c=xm[a],u=c&&this.shouldRenderSubLayer(l,n.points?.data)&&this.getSubLayerClass(l,c.type);if(u){const f=wx(this,c.props);let h=n.points;if(a==="text"&&r){const{instancePickingColors:d,...g}=h.data.attributes;h={...h,data:{...h.data,attributes:g}}}o.push(new u(f,this.getSubLayerProps({id:l,updateTriggers:f.updateTriggers,highlightedObjectIndex:i}),h))}}return o}renderLayers(){const{extruded:e}=this.props,n=this._renderPolygonLayer(),r=this._renderLineLayers(),i=this._renderPointLayers();return[!e&&n,r,i,e&&n]}getSubLayerAccessor(e){const{binary:n}=this.state;return!n||typeof e!="function"?super.getSubLayerAccessor(e):(r,i)=>{const{data:s,index:o}=i,a=rae(s,o);return e(a,i)}}}Sx.layerName="GeoJsonLayer",Sx.defaultProps=Fae;class Bae{constructor(e){this.index=e,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(e){this._bbox||(this._bbox=e,"west"in e?this.boundingBox=[[e.west,e.south],[e.east,e.north]]:this.boundingBox=[[e.left,e.top],[e.right,e.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return!!this._loader&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){const e=this.content?this.content.byteLength:0;return Number.isFinite(e)||console.error("byteLength not defined in tile data"),e}async _loadData({getData:e,requestScheduler:n,onLoad:r,onError:i}){const{index:s,id:o,bbox:a,userData:l,zoom:c}=this,u=this._loaderId;this._abortController=new AbortController;const{signal:f}=this._abortController,h=await n.scheduleRequest(this,p=>p.isSelected?1:-1);if(!h){this._isCancelled=!0;return}if(this._isCancelled){h.done();return}let d=null,g;try{d=await e({index:s,id:o,bbox:a,userData:l,zoom:c,signal:f})}catch(p){g=p||!0}finally{h.done()}if(u===this._loaderId){if(this._loader=void 0,this.content=d,this._isCancelled&&!d){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,g?i(g,this):r(this)}}loadData(e){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(e),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}}const jn={OUTSIDE:-1,INTERSECTING:0,INSIDE:1},SO=new Ae,kae=new Ae;class Tx{constructor(e=[0,0,0],n=[0,0,0],r){r=r||SO.copy(e).add(n).scale(.5),this.center=new Ae(r),this.halfDiagonal=new Ae(n).subtract(this.center),this.minimum=new Ae(e),this.maximum=new Ae(n)}clone(){return new Tx(this.minimum,this.maximum,this.center)}equals(e){return this===e||!!e&&this.minimum.equals(e.minimum)&&this.maximum.equals(e.maximum)}transform(e){return this.center.transformAsPoint(e),this.halfDiagonal.transform(e),this.minimum.transform(e),this.maximum.transform(e),this}intersectPlane(e){const{halfDiagonal:n}=this,r=kae.from(e.normal),i=n.x*Math.abs(r.x)+n.y*Math.abs(r.y)+n.z*Math.abs(r.z),s=this.center.dot(r)+e.distance;return s-i>0?jn.INSIDE:s+i<0?jn.OUTSIDE:jn.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){const n=SO.from(e).subtract(this.center),{halfDiagonal:r}=this;let i=0,s;return s=Math.abs(n.x)-r.x,s>0&&(i+=s*s),s=Math.abs(n.y)-r.y,s>0&&(i+=s*s),s=Math.abs(n.z)-r.z,s>0&&(i+=s*s),i}}const Uf=new Ae,TO=new Ae;class Ax{constructor(e=[0,0,0],n=0){this.radius=-0,this.center=new Ae,this.fromCenterRadius(e,n)}fromCenterRadius(e,n){return this.center.from(e),this.radius=n,this}fromCornerPoints(e,n){return n=Uf.from(n),this.center=new Ae().from(e).add(n).scale(.5),this.radius=this.center.distance(n),this}equals(e){return this===e||!!e&&this.center.equals(e.center)&&this.radius===e.radius}clone(){return new Ax(this.center,this.radius)}union(e){const n=this.center,r=this.radius,i=e.center,s=e.radius,o=Uf.copy(i).subtract(n),a=o.magnitude();if(r>=a+s)return this.clone();if(s>=a+r)return e.clone();const l=(r+a+s)*.5;return TO.copy(o).scale((-r+l)/a).add(n),this.center.copy(TO),this.radius=l,this}expand(e){const r=Uf.from(e).subtract(this.center).magnitude();return r>this.radius&&(this.radius=r),this}transform(e){this.center.transform(e);const n=rQ(Uf,e);return this.radius=Math.max(n[0],Math.max(n[1],n[2]))*this.radius,this}distanceSquaredTo(e){const n=this.distanceTo(e);return n*n}distanceTo(e){const r=Uf.from(e).subtract(this.center);return Math.max(0,r.len()-this.radius)}intersectPlane(e){const n=this.center,r=this.radius,s=e.normal.dot(n)+e.distance;return s<-r?jn.OUTSIDE:s<r?jn.INTERSECTING:jn.INSIDE}}const Uae=new Ae,Lae=new Ae,Tm=new Ae,Am=new Ae,Em=new Ae,zae=new Ae,$ae=new Ae,_s={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8};class Ex{constructor(e=[0,0,0],n=[0,0,0,0,0,0,0,0,0]){this.center=new Ae().from(e),this.halfAxes=new In(n)}get halfSize(){const e=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new Ae(e).len(),new Ae(n).len(),new Ae(r).len()]}get quaternion(){const e=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),i=new Ae(e).normalize(),s=new Ae(n).normalize(),o=new Ae(r).normalize();return new uI().fromMatrix3(new In([...i,...s,...o]))}fromCenterHalfSizeQuaternion(e,n,r){const i=new uI(r),s=new In().fromQuaternion(i);return s[0]=s[0]*n[0],s[1]=s[1]*n[0],s[2]=s[2]*n[0],s[3]=s[3]*n[1],s[4]=s[4]*n[1],s[5]=s[5]*n[1],s[6]=s[6]*n[2],s[7]=s[7]*n[2],s[8]=s[8]*n[2],this.center=new Ae().from(e),this.halfAxes=s,this}clone(){return new Ex(this.center,this.halfAxes)}equals(e){return this===e||!!e&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)}getBoundingSphere(e=new Ax){const n=this.halfAxes,r=n.getColumn(0,Tm),i=n.getColumn(1,Am),s=n.getColumn(2,Em),o=Uae.copy(r).add(i).add(s);return e.center.copy(this.center),e.radius=o.magnitude(),e}intersectPlane(e){const n=this.center,r=e.normal,i=this.halfAxes,s=r.x,o=r.y,a=r.z,l=Math.abs(s*i[_s.COLUMN0ROW0]+o*i[_s.COLUMN0ROW1]+a*i[_s.COLUMN0ROW2])+Math.abs(s*i[_s.COLUMN1ROW0]+o*i[_s.COLUMN1ROW1]+a*i[_s.COLUMN1ROW2])+Math.abs(s*i[_s.COLUMN2ROW0]+o*i[_s.COLUMN2ROW1]+a*i[_s.COLUMN2ROW2]),c=r.dot(n)+e.distance;return c<=-l?jn.OUTSIDE:c>=l?jn.INSIDE:jn.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){const n=Lae.from(e).subtract(this.center),r=this.halfAxes,i=r.getColumn(0,Tm),s=r.getColumn(1,Am),o=r.getColumn(2,Em),a=i.magnitude(),l=s.magnitude(),c=o.magnitude();i.normalize(),s.normalize(),o.normalize();let u=0,f;return f=Math.abs(n.dot(i))-a,f>0&&(u+=f*f),f=Math.abs(n.dot(s))-l,f>0&&(u+=f*f),f=Math.abs(n.dot(o))-c,f>0&&(u+=f*f),u}computePlaneDistances(e,n,r=[-0,-0]){let i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;const o=this.center,a=this.halfAxes,l=a.getColumn(0,Tm),c=a.getColumn(1,Am),u=a.getColumn(2,Em),f=zae.copy(l).add(c).add(u).add(o),h=$ae.copy(f).subtract(e);let d=n.dot(h);return i=Math.min(d,i),s=Math.max(d,s),f.copy(o).add(l).add(c).subtract(u),h.copy(f).subtract(e),d=n.dot(h),i=Math.min(d,i),s=Math.max(d,s),f.copy(o).add(l).subtract(c).add(u),h.copy(f).subtract(e),d=n.dot(h),i=Math.min(d,i),s=Math.max(d,s),f.copy(o).add(l).subtract(c).subtract(u),h.copy(f).subtract(e),d=n.dot(h),i=Math.min(d,i),s=Math.max(d,s),o.copy(f).subtract(l).add(c).add(u),h.copy(f).subtract(e),d=n.dot(h),i=Math.min(d,i),s=Math.max(d,s),o.copy(f).subtract(l).add(c).subtract(u),h.copy(f).subtract(e),d=n.dot(h),i=Math.min(d,i),s=Math.max(d,s),o.copy(f).subtract(l).subtract(c).add(u),h.copy(f).subtract(e),d=n.dot(h),i=Math.min(d,i),s=Math.max(d,s),o.copy(f).subtract(l).subtract(c).subtract(u),h.copy(f).subtract(e),d=n.dot(h),i=Math.min(d,i),s=Math.max(d,s),r[0]=i,r[1]=s,r}transform(e){this.center.transformAsPoint(e);const n=this.halfAxes.getColumn(0,Tm);n.transformAsPoint(e);const r=this.halfAxes.getColumn(1,Am);r.transformAsPoint(e);const i=this.halfAxes.getColumn(2,Em);return i.transformAsPoint(e),this.halfAxes=new In([...n,...r,...i]),this}getTransform(){throw new Error("not implemented")}}const AO=new Ae,EO=new Ae;class Lf{constructor(e=[0,0,1],n=0){this.normal=new Ae,this.distance=-0,this.fromNormalDistance(e,n)}fromNormalDistance(e,n){return df(Number.isFinite(n)),this.normal.from(e).normalize(),this.distance=n,this}fromPointNormal(e,n){e=AO.from(e),this.normal.from(n).normalize();const r=-this.normal.dot(e);return this.distance=r,this}fromCoefficients(e,n,r,i){return this.normal.set(e,n,r),df(gs(this.normal.len(),1)),this.distance=i,this}clone(){return new Lf(this.normal,this.distance)}equals(e){return gs(this.distance,e.distance)&&gs(this.normal,e.normal)}getPointDistance(e){return this.normal.dot(e)+this.distance}transform(e){const n=EO.copy(this.normal).transformAsVector(e).normalize(),r=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(r,n)}projectPointOntoPlane(e,n=[0,0,0]){const r=AO.from(e),i=this.getPointDistance(r),s=EO.copy(this.normal).scale(i);return r.subtract(s).to(n)}}const CO=[new Ae([1,0,0]),new Ae([0,1,0]),new Ae([0,0,1])],DO=new Ae,Vae=new Ae;class bs{constructor(e=[]){this.planes=e}fromBoundingSphere(e){this.planes.length=2*CO.length;const n=e.center,r=e.radius;let i=0;for(const s of CO){let o=this.planes[i],a=this.planes[i+1];o||(o=this.planes[i]=new Lf),a||(a=this.planes[i+1]=new Lf);const l=DO.copy(s).scale(-r).add(n);o.fromPointNormal(l,s);const c=DO.copy(s).scale(r).add(n),u=Vae.copy(s).negate();a.fromPointNormal(c,u),i+=2}return this}computeVisibility(e){let n=jn.INSIDE;for(const r of this.planes)switch(e.intersectPlane(r)){case jn.OUTSIDE:return jn.OUTSIDE;case jn.INTERSECTING:n=jn.INTERSECTING;break}return n}computeVisibilityWithPlaneMask(e,n){if(df(Number.isFinite(n),"parentPlaneMask is required."),n===bs.MASK_OUTSIDE||n===bs.MASK_INSIDE)return n;let r=bs.MASK_INSIDE;const i=this.planes;for(let s=0;s<this.planes.length;++s){const o=s<31?1<<s:0;if(s<31&&!(n&o))continue;const a=i[s],l=e.intersectPlane(a);if(l===jn.OUTSIDE)return bs.MASK_OUTSIDE;l===jn.INTERSECTING&&(r|=o)}return r}}bs.MASK_OUTSIDE=4294967295,bs.MASK_INSIDE=0,bs.MASK_INDETERMINATE=2147483647,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae;const Li=new In,jae=new In,Hae=new In,Cm=new In,MO=new In;function Wae(t,e={}){const n=$Q,r=10;let i=0,s=0;const o=jae,a=Hae;o.identity(),a.copy(t);const l=n*Xae(a);for(;s<r&&qae(a)>l;)Yae(a,Cm),MO.copy(Cm).transpose(),a.multiplyRight(Cm),a.multiplyLeft(MO),o.multiplyRight(Cm),++i>2&&(++s,i=0);return e.unitary=o.toTarget(e.unitary),e.diagonal=a.toTarget(e.diagonal),e}function Xae(t){let e=0;for(let n=0;n<9;++n){const r=t[n];e+=r*r}return Math.sqrt(e)}const Cx=[1,0,0],Dx=[2,2,1];function qae(t){let e=0;for(let n=0;n<3;++n){const r=t[Li.getElementIndex(Dx[n],Cx[n])];e+=2*r*r}return Math.sqrt(e)}function Yae(t,e){const n=zQ;let r=0,i=1;for(let c=0;c<3;++c){const u=Math.abs(t[Li.getElementIndex(Dx[c],Cx[c])]);u>r&&(i=c,r=u)}const s=Cx[i],o=Dx[i];let a=1,l=0;if(Math.abs(t[Li.getElementIndex(o,s)])>n){const c=t[Li.getElementIndex(o,o)],u=t[Li.getElementIndex(s,s)],f=t[Li.getElementIndex(o,s)],h=(c-u)/2/f;let d;h<0?d=-1/(-h+Math.sqrt(1+h*h)):d=1/(h+Math.sqrt(1+h*h)),a=1/Math.sqrt(1+d*d),l=d*a}return In.IDENTITY.to(e),e[Li.getElementIndex(s,s)]=e[Li.getElementIndex(o,o)]=a,e[Li.getElementIndex(o,s)]=l,e[Li.getElementIndex(s,o)]=-l,e}const bo=new Ae,Kae=new Ae,Zae=new Ae,Gae=new Ae,Qae=new Ae,Jae=new In,ele={diagonal:new In,unitary:new In};function tle(t,e=new Ex){if(!t||t.length===0)return e.halfAxes=new In([0,0,0,0,0,0,0,0,0]),e.center=new Ae,e;const n=t.length,r=new Ae(0,0,0);for(const A of t)r.add(A);const i=1/n;r.multiplyByScalar(i);let s=0,o=0,a=0,l=0,c=0,u=0;for(const A of t){const C=bo.copy(A).subtract(r);s+=C.x*C.x,o+=C.x*C.y,a+=C.x*C.z,l+=C.y*C.y,c+=C.y*C.z,u+=C.z*C.z}s*=i,o*=i,a*=i,l*=i,c*=i,u*=i;const f=Jae;f[0]=s,f[1]=o,f[2]=a,f[3]=o,f[4]=l,f[5]=c,f[6]=a,f[7]=c,f[8]=u;const{unitary:h}=Wae(f,ele),d=e.halfAxes.copy(h);let g=d.getColumn(0,Zae),p=d.getColumn(1,Gae),_=d.getColumn(2,Qae),m=-Number.MAX_VALUE,v=-Number.MAX_VALUE,y=-Number.MAX_VALUE,b=Number.MAX_VALUE,w=Number.MAX_VALUE,x=Number.MAX_VALUE;for(const A of t)bo.copy(A),m=Math.max(bo.dot(g),m),v=Math.max(bo.dot(p),v),y=Math.max(bo.dot(_),y),b=Math.min(bo.dot(g),b),w=Math.min(bo.dot(p),w),x=Math.min(bo.dot(_),x);g=g.multiplyByScalar(.5*(b+m)),p=p.multiplyByScalar(.5*(w+v)),_=_.multiplyByScalar(.5*(x+y)),e.center.copy(g).add(p).add(_);const T=Kae.set(m-b,v-w,y-x).multiplyByScalar(.5),E=new In([T[0],0,0,0,T[1],0,0,0,T[2]]);return e.halfAxes.multiplyRight(E),e}const vc=512,RO=3,IO=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],PO=IO.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),nle=PO.concat([[.25,.5],[.75,.5]]);class _c{constructor(e,n,r){this.x=e,this.y=n,this.z=r}get children(){if(!this._children){const e=this.x*2,n=this.y*2,r=this.z+1;this._children=[new _c(e,n,r),new _c(e,n+1,r),new _c(e+1,n,r),new _c(e+1,n+1,r)]}return this._children}update(e){const{viewport:n,cullingVolume:r,elevationBounds:i,minZ:s,maxZ:o,bounds:a,offset:l,project:c}=e,u=this.getBoundingVolume(i,l,c);if(a&&!this.insideBounds(a)||r.computeVisibility(u)<0)return!1;if(!this.childVisible){let{z:h}=this;if(h<o&&h>=s){const d=u.distanceTo(n.cameraPosition)*n.scale/n.height;h+=Math.floor(Math.log2(d))}if(h>=o)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(const h of this.children)h.update(e);return!0}getSelected(e=[]){if(this.selected&&e.push(this),this._children)for(const n of this._children)n.getSelected(e);return e}insideBounds([e,n,r,i]){const s=Math.pow(2,this.z),o=vc/s;return this.x*o<r&&this.y*o<i&&(this.x+1)*o>e&&(this.y+1)*o>n}getBoundingVolume(e,n,r){if(r){const l=this.z<1?nle:this.z<2?PO:IO,c=[];for(const u of l){const f=Px(this.x+u[0],this.y+u[1],this.z);f[2]=e[0],c.push(r(f)),e[0]!==e[1]&&(f[2]=e[1],c.push(r(f)))}return tle(c)}const i=Math.pow(2,this.z),s=vc/i,o=this.x*s+n*vc,a=vc-(this.y+1)*s;return new Tx([o,a,e[0]],[o+s,a+s,e[1]])}}function rle(t,e,n,r){const i=t instanceof M1&&t.resolution?t.projectPosition:null,s=Object.values(t.getFrustumPlanes()).map(({normal:d,distance:g})=>new Lf(d.clone().negate(),g)),o=new bs(s),a=t.distanceScales.unitsPerMeter[2],l=n&&n[0]*a||0,c=n&&n[1]*a||0,u=t instanceof ho&&t.pitch<=60?e:0;if(r){const[d,g,p,_]=r,m=fo([d,_]),v=fo([p,g]);r=[m[0],vc-m[1],v[0],vc-v[1]]}const f=new _c(0,0,0),h={viewport:t,project:i,cullingVolume:o,elevationBounds:[l,c],minZ:u,maxZ:e,bounds:r,offset:0};if(f.update(h),t instanceof ho&&t.subViewports&&t.subViewports.length>1){for(h.offset=-1;f.update(h)&&!(--h.offset<-RO););for(h.offset=1;f.update(h)&&!(++h.offset>RO););}return f.getSelected()}const xs=512,ile=[-1/0,-1/0,1/0,1/0],sle={equal:(t,e)=>{if(t===e)return!0;if(!Array.isArray(t)||!Array.isArray(e))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}};function Mx(t,e){const n=[e.transformAsPoint([t[0],t[1]]),e.transformAsPoint([t[2],t[1]]),e.transformAsPoint([t[0],t[3]]),e.transformAsPoint([t[2],t[3]])];return[Math.min(...n.map(i=>i[0])),Math.min(...n.map(i=>i[1])),Math.max(...n.map(i=>i[0])),Math.max(...n.map(i=>i[1]))]}function ole(t){return Math.abs(t.split("").reduce((e,n)=>(e<<5)-e+n.charCodeAt(0)|0,0))}function ale(t,e){if(!t||!t.length)return null;const{index:n,id:r}=e;if(Array.isArray(t)){const s=ole(r)%t.length;t=t[s]}let i=t;for(const s of Object.keys(n)){const o=new RegExp(`{${s}}`,"g");i=i.replace(o,String(n[s]))}return Number.isInteger(n.y)&&Number.isInteger(n.z)&&(i=i.replace(/\{-y\}/g,String(Math.pow(2,n.z)-n.y-1))),i}function lle(t,e,n){let r;return r=t.getBounds(),t.isGeospatial?[Math.max(r[0],n[0]),Math.max(r[1],n[1]),Math.min(r[2],n[2]),Math.min(r[3],n[3])]:[Math.max(Math.min(r[0],n[2]),n[0]),Math.max(Math.min(r[1],n[3]),n[1]),Math.min(Math.max(r[2],n[0]),n[2]),Math.min(Math.max(r[3],n[1]),n[3])]}function cle({viewport:t,z:e,cullRect:n}){return(t.subViewports||[t]).map(i=>Rx(i,e||0,n))}function Rx(t,e,n){if(!Array.isArray(e)){const s=n.x-t.x,o=n.y-t.y,{width:a,height:l}=n,c={targetZ:e},u=t.unproject([s,o],c),f=t.unproject([s+a,o],c),h=t.unproject([s,o+l],c),d=t.unproject([s+a,o+l],c);return[Math.min(u[0],f[0],h[0],d[0]),Math.min(u[1],f[1],h[1],d[1]),Math.max(u[0],f[0],h[0],d[0]),Math.max(u[1],f[1],h[1],d[1])]}const r=Rx(t,e[0],n),i=Rx(t,e[1],n);return[Math.min(r[0],i[0]),Math.min(r[1],i[1]),Math.max(r[2],i[2]),Math.max(r[3],i[3])]}function ule(t,e,n){return n?Mx(t,n).map(i=>i*e/xs):t.map(r=>r*e/xs)}function Ix(t,e){return Math.pow(2,t)*xs/e}function Px(t,e,n){const r=Ix(n,xs),i=t/r*360-180,s=Math.PI-2*Math.PI*e/r,o=180/Math.PI*Math.atan(.5*(Math.exp(s)-Math.exp(-s)));return[i,o]}function OO(t,e,n,r){const i=Ix(n,r);return[t/i*xs,e/i*xs]}function fle(t,e,n,r,i=xs){if(t.isGeospatial){const[c,u]=Px(e,n,r),[f,h]=Px(e+1,n+1,r);return{west:c,north:u,east:f,south:h}}const[s,o]=OO(e,n,r,i),[a,l]=OO(e+1,n+1,r,i);return{left:s,top:o,right:a,bottom:l}}function hle(t,e,n,r,i){const s=lle(t,null,r),o=Ix(e,n),[a,l,c,u]=ule(s,o,i),f=[];for(let h=Math.floor(a);h<c;h++)for(let d=Math.floor(l);d<u;d++)f.push({x:h,y:d,z:e});return f}function dle({viewport:t,maxZoom:e,minZoom:n,zRange:r,extent:i,tileSize:s=xs,modelMatrix:o,modelMatrixInverse:a,zoomOffset:l=0}){let c=t.isGeospatial?Math.round(t.zoom+Math.log2(xs/s))+l:Math.ceil(t.zoom)+l;if(typeof n=="number"&&Number.isFinite(n)&&c<n){if(!i)return[];c=n}typeof e=="number"&&Number.isFinite(e)&&c>e&&(c=e);let u=i;return o&&a&&i&&!t.isGeospatial&&(u=Mx(i,o)),t.isGeospatial?rle(t,c,r,i):hle(t,c,s,u||ile,a)}function ple(t){let e={},n;return r=>{for(const i in r)if(!gle(r[i],e[i])){n=t(r),e=r;break}return n}}function gle(t,e){if(t===e)return!0;if(Array.isArray(t)){const n=t.length;if(!e||e.length!==n)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}return!1}const NO=1,Dm=2,mle="never",yle="no-overlap",Ox="best-available",vle=5,_le={[Ox]:wle,[yle]:Sle,[mle]:()=>{}},ble={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}};class xle{constructor(e){this._getCullBounds=ple(cle),this.opts={...ble,...e},this.setOptions(this.opts),this.onTileLoad=n=>{this.opts.onTileLoad?.(n),this.opts.maxCacheByteSize!==null&&(this._cacheByteSize+=n.byteLength,this._resizeCache())},this._requestScheduler=new Iq({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new gn,this._modelMatrixInverse=new gn}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(e=>e.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(e=>e.needsReload)}setOptions(e){Object.assign(this.opts,e),Number.isFinite(e.maxZoom)&&(this._maxZoom=Math.floor(e.maxZoom)),Number.isFinite(e.minZoom)&&(this._minZoom=Math.ceil(e.minZoom))}finalize(){for(const e of this._cache.values())e.isLoading&&e.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(const e of this._cache.keys()){const n=this._cache.get(e);!this._selectedTiles||!this._selectedTiles.includes(n)?this._cache.delete(e):n.setNeedsReload()}}update(e,{zRange:n,modelMatrix:r}={zRange:null,modelMatrix:null}){const i=r?new gn(r):new gn,s=!i.equals(this._modelMatrix);if(!this._viewport||!e.equals(this._viewport)||!gs(this._zRange,n)||s){s&&(this._modelMatrixInverse=i.clone().invert(),this._modelMatrix=i),this._viewport=e,this._zRange=n;const a=this.getTileIndices({viewport:e,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:n,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=a.map(l=>this._getTile(l,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(a=>this._getTile(a.index,!0)));const o=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),o&&this._frameNumber++,this._frameNumber}isTileVisible(e,n,r){if(!e.isVisible)return!1;if(n&&this._viewport){const i=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:n});let{bbox:s}=e;for(const[o,a,l,c]of i){let u;if("west"in s)u=s.west<l&&s.east>o&&s.south<c&&s.north>a;else{if(r&&!gn.IDENTITY.equals(r)){const[d,g,p,_]=Mx([s.left,s.top,s.right,s.bottom],r);s={left:d,top:g,right:p,bottom:_}}const f=Math.min(s.top,s.bottom),h=Math.max(s.top,s.bottom);u=s.left<l&&s.right>o&&f<c&&h>a}if(u)return!0}return!1}return!0}getTileIndices({viewport:e,maxZoom:n,minZoom:r,zRange:i,modelMatrix:s,modelMatrixInverse:o}){const{tileSize:a,extent:l,zoomOffset:c}=this.opts;return dle({viewport:e,maxZoom:n,minZoom:r,zRange:i,tileSize:a,extent:l,modelMatrix:s,modelMatrixInverse:o,zoomOffset:c})}getTileId(e){return`${e.x}-${e.y}-${e.z}`}getTileZoom(e){return e.z}getTileMetadata(e){const{tileSize:n}=this.opts;return{bbox:fle(this._viewport,e.x,e.y,e.z,n)}}getParentIndex(e){const n=Math.floor(e.x/2),r=Math.floor(e.y/2),i=e.z-1;return{x:n,y:r,z:i}}updateTileStates(){const e=this.opts.refinementStrategy||Ox,n=new Array(this._cache.size);let r=0;for(const i of this._cache.values())n[r++]=i.isVisible,i.isSelected=!1,i.isVisible=!1;for(const i of this._selectedTiles)i.isSelected=!0,i.isVisible=!0;(typeof e=="function"?e:_le[e])(Array.from(this._cache.values())),r=0;for(const i of this._cache.values())if(n[r++]!==i.isVisible)return!0;return!1}_pruneRequests(){const{maxRequests:e=0}=this.opts,n=[];let r=0;for(const i of this._cache.values())i.isLoading&&(r++,!i.isSelected&&!i.isVisible&&n.push(i));for(;e>0&&r>e&&n.length>0;)n.shift().abort(),r--}_rebuildTree(){const{_cache:e}=this;for(const n of e.values())n.parent=null,n.children&&(n.children.length=0);for(const n of e.values()){const r=this._getNearestAncestor(n);n.parent=r,r?.children&&r.children.push(n)}}_resizeCache(){const{_cache:e,opts:n}=this,r=n.maxCacheSize??(n.maxCacheByteSize!==null?1/0:vle*this.selectedTiles.length),i=n.maxCacheByteSize??1/0;if(e.size>r||this._cacheByteSize>i){for(const[o,a]of e)if(!a.isVisible&&!a.isSelected&&(this._cacheByteSize-=n.maxCacheByteSize!==null?a.byteLength:0,e.delete(o),this.opts.onTileUnload?.(a)),e.size<=r&&this._cacheByteSize<=i)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((o,a)=>o.zoom-a.zoom),this._dirty=!1)}_getTile(e,n){const r=this.getTileId(e);let i=this._cache.get(r),s=!1;return!i&&n?(i=new Bae(e),Object.assign(i,this.getTileMetadata(i.index)),Object.assign(i,{id:r,zoom:this.getTileZoom(i.index)}),s=!0,this._cache.set(r,i),this._dirty=!0):i&&i.needsReload&&(s=!0),i&&s&&i.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),i}_getNearestAncestor(e){const{_minZoom:n=0}=this;let r=e.index;for(;this.getTileZoom(r)>n;){r=this.getParentIndex(r);const i=this._getTile(r);if(i)return i}return null}}function wle(t){for(const e of t)e.state=0;for(const e of t)e.isSelected&&!FO(e)&&Nx(e);for(const e of t)e.isVisible=!!(e.state&Dm)}function Sle(t){for(const n of t)n.state=0;for(const n of t)n.isSelected&&FO(n);const e=Array.from(t).sort((n,r)=>n.zoom-r.zoom);for(const n of e)if(n.isVisible=!!(n.state&Dm),n.children&&(n.isVisible||n.state&NO))for(const r of n.children)r.state=NO;else n.isSelected&&Nx(n)}function FO(t){let e=t;for(;e;){if(e.isLoaded||e.content)return e.state|=Dm,!0;e=e.parent}return!1}function Nx(t){for(const e of t.children)e.isLoaded||e.content?e.state|=Dm:Nx(e)}const Tle={TilesetClass:xle,data:{type:"data",value:[]},dataComparator:sle.equal,renderSubLayers:{type:"function",value:t=>new Sx(t)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:t=>{}},onTileUnload:{type:"function",value:t=>{}},onTileError:{type:"function",value:t=>console.error(t)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:Ox,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0};class Fx extends lm{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return!!this.state?.tileset?.selectedTiles?.every(e=>e.isLoaded&&e.layers&&e.layers.every(n=>n.isLoaded))}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState({changeFlags:e}){let{tileset:n}=this.state;const r=e.propsOrDataChanged||e.updateTriggersChanged,i=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getTileData);n?r&&(n.setOptions(this._getTilesetOptions()),i?n.reloadAll():n.tiles.forEach(s=>{s.layers=null})):(n=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:n})),this._updateTileset()}_getTilesetOptions(){const{tileSize:e,maxCacheSize:n,maxCacheByteSize:r,refinementStrategy:i,extent:s,maxZoom:o,minZoom:a,maxRequests:l,debounceTime:c,zoomOffset:u}=this.props;return{maxCacheSize:n,maxCacheByteSize:r,maxZoom:o,minZoom:a,tileSize:e,refinementStrategy:i,extent:s,maxRequests:l,debounceTime:c,zoomOffset:u,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){const e=this.state.tileset,{zRange:n,modelMatrix:r}=this.props,i=e.update(this.context.viewport,{zRange:n,modelMatrix:r}),{isLoaded:s}=e,o=this.state.isLoaded!==s,a=this.state.frameNumber!==i;s&&(o||a)&&this._onViewportLoad(),a&&this.setState({frameNumber:i}),this.state.isLoaded=s}_onViewportLoad(){const{tileset:e}=this.state,{onViewportLoad:n}=this.props;n&&n(e.selectedTiles)}_onTileLoad(e){this.props.onTileLoad(e),e.layers=null,this.setNeedsUpdate()}_onTileError(e,n){this.props.onTileError(e),n.layers=null,this.setNeedsUpdate()}_onTileUnload(e){this.props.onTileUnload(e)}getTileData(e){const{data:n,getTileData:r,fetch:i}=this.props,{signal:s}=e;return e.url=typeof n=="string"||Array.isArray(n)?ale(n,e):null,r?r(e):i&&e.url?i(e.url,{propName:"data",layer:this,signal:s}):null}renderSubLayers(e){return this.props.renderSubLayers(e)}getSubLayerPropsByTile(e){return null}getPickingInfo(e){const n=e.sourceLayer,r=n.props.tile,i=e.info;return i.picked&&(i.tile=r),i.sourceTile=r,i.sourceTileSubLayer=n,i}_updateAutoHighlight(e){e.sourceTileSubLayer.updateAutoHighlight(e)}renderLayers(){return this.state.tileset.tiles.map(e=>{const n=this.getSubLayerPropsByTile(e);if(!(!e.isLoaded&&!e.content))if(e.layers)n&&e.layers[0]&&Object.keys(n).some(r=>e.layers[0].props[r]!==n[r])&&(e.layers=e.layers.map(r=>r.clone(n)));else{const r=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:e.id,updateTriggers:this.props.updateTriggers}),data:e.content,_offset:0,tile:e});e.layers=Kg(r,Boolean).map(i=>i.clone({tile:e,...n}))}return e.layers})}filterSubLayer({layer:e,cullRect:n}){const{tile:r}=e.props,{modelMatrix:i}=this.props;return this.state.tileset.isTileVisible(r,n,i?new gn(i):null)}}Fx.defaultProps=Tle,Fx.layerName="TileLayer";const Ale=typeof window<"u"?D.useLayoutEffect:D.useEffect;function Mm(t,e){for(;t;){if(t===e)return!0;t=Object.getPrototypeOf(t)}return!1}const Ele={position:"absolute",zIndex:-1};function BO(t,e){if(typeof t=="function")return t(e);if(Array.isArray(t))return t.map(n=>BO(n,e));if(Rm(t)){if(Cle(t))return e.style=Ele,D.cloneElement(t,e);if(Dle(t))return D.cloneElement(t,e)}return t}function Rm(t){return t&&typeof t=="object"&&"type"in t||!1}function Cle(t){return t.props?.mapStyle}function Dle(t){const e=t.type;return e&&e.deckGLViewProps}function Bx(t){if(typeof t=="function")return D.createElement(ya,{},t);if(Array.isArray(t))return t.map(Bx);if(Rm(t)){if(t.type===D.Fragment)return Bx(t.props.children);if(Mm(t.type,ya))return t}return t}function Mle({children:t,layers:e=[],views:n=null}){const r=[],i=[],s={};return D.Children.forEach(Bx(t),o=>{if(Rm(o)){const a=o.type;if(Mm(a,Ui)){const l=Rle(a,o.props);i.push(l)}else r.push(o);if(Mm(a,ya)&&a!==ya&&o.props.id){const l=new a(o.props);s[l.id]=l}}else o&&r.push(o)}),Object.keys(s).length>0&&(Array.isArray(n)?n.forEach(o=>{s[o.id]=o}):n&&(s[n.id]=n),n=Object.values(s)),e=i.length>0?[...i,...e]:e,{layers:e,children:r,views:n}}function Rle(t,e){const n={},r=t.defaultProps||{};for(const i in e)r[i]!==e[i]&&(n[i]=e[i]);return new t(n)}const Ile=D.createContext();function Ple({children:t,deck:e,ContextProvider:n=Ile.Provider}){const{viewManager:r}=e||{};if(!r||!r.views.length)return[];const i={},s=r.views[0].id;for(const o of t){let a=s,l=o;Rm(o)&&Mm(o.type,ya)&&(a=o.props.id||s,l=o.props.children);const c=r.getViewport(a),u=r.getViewState(a);if(c){u.padding=c.padding;const{x:f,y:h,width:d,height:g}=c;l=BO(l,{x:f,y:h,width:d,height:g,viewport:c,viewState:u}),i[a]||(i[a]={viewport:c,children:[]}),i[a].children.push(l)}}return Object.keys(i).map(o=>{const{viewport:a,children:l}=i[o],{x:c,y:u,width:f,height:h}=a,d={position:"absolute",left:c,top:u,width:f,height:h},g=`view-${o}`,p=D.createElement("div",{key:g,id:g,style:d},...l),_={deck:e,viewport:a,container:e.canvas.offsetParent,eventManager:e.eventManager,onViewStateChange:v=>{v.viewId=o,e._onViewStateChange(v)},widgets:[]},m=`view-${o}-context`;return D.createElement(n,{key:m,value:_},p)})}const Ole={mixBlendMode:null};function Nle({width:t,height:e,style:n}){const r={position:"absolute",zIndex:0,left:0,top:0,width:t,height:e},i={left:0,top:0};if(n)for(const s in n)s in Ole?i[s]=n[s]:r[s]=n[s];return{containerStyle:r,canvasStyle:i}}function Fle(t){return{get deck(){return t.deck},pickObject:e=>t.deck.pickObject(e),pickMultipleObjects:e=>t.deck.pickMultipleObjects(e),pickObjects:e=>t.deck.pickObjects(e)}}function kO(t){t.redrawReason&&(t.deck._drawLayers(t.redrawReason),t.redrawReason=null)}function Ble(t,e,n){const r=new e({...n,_customRender:n.deviceProps?.adapters?.[0]?.type==="webgpu"?void 0:i=>{t.redrawReason=i;const s=r.getViewports();t.lastRenderedViewports!==s?t.forceUpdate():kO(t)}});return r}function kle(t,e){const[n,r]=D.useState(0),s=D.useRef({control:null,version:n,forceUpdate:()=>r(w=>w+1)}).current,o=D.useRef(null),a=D.useRef(null),l=D.useMemo(()=>Mle(t),[t.layers,t.views,t.children]);let c=!0;const u=w=>c&&t.viewState?(s.viewStateUpdateRequested=w,null):(s.viewStateUpdateRequested=null,t.onViewStateChange?.(w)),f=w=>{c?s.interactionStateUpdateRequested=w:(s.interactionStateUpdateRequested=null,t.onInteractionStateChange?.(w))},h=D.useMemo(()=>{const w={widgets:[],...t,style:null,width:"100%",height:"100%",parent:o.current,canvas:a.current,layers:l.layers,views:l.views,onViewStateChange:u,onInteractionStateChange:f};return delete w._customRender,s.deck&&s.deck.setProps(w),w},[t]);D.useEffect(()=>{const w=t.Deck||K1;return s.deck=Ble(s,w,{...h,parent:o.current,canvas:a.current}),()=>s.deck?.finalize()},[]),Ale(()=>{kO(s);const{viewStateUpdateRequested:w,interactionStateUpdateRequested:x}=s;w&&u(w),x&&f(x),s.deck?.isInitialized&&s.deck.redraw("Initial render")}),D.useImperativeHandle(e,()=>Fle(s),[]);const d=s.deck&&s.deck.isInitialized?s.deck.getViewports():void 0,{ContextProvider:g,width:p="100%",height:_="100%",id:m,style:v}=t,{containerStyle:y,canvasStyle:b}=D.useMemo(()=>Nle({width:p,height:_,style:v}),[p,_,v]);if(!s.viewStateUpdateRequested&&s.lastRenderedViewports===d||s.version!==n){s.lastRenderedViewports=d,s.version=n;const w=Ple({children:l.children,deck:s.deck,ContextProvider:g}),x=D.createElement("canvas",{key:"canvas",id:m||"deckgl-overlay",ref:a,style:b});s.control=D.createElement("div",{id:`${m||"deckgl"}-wrapper`,ref:o,style:y},[x,w])}return c=!1,s.control}const Ule=D.forwardRef(kle),Lle=({zarrGroup:t,width:e,height:n})=>{const[r,i]=D.useState([]),[s,o]=D.useState(!0),[a,l]=D.useState(null),[c,u]=D.useState(0);D.useEffect(()=>{(async()=>{try{const p=t.attrs,_=p.num_layers,m=p.tile_size,v=[];for(let y=0;y<_;y++){const b=await t.getGroup(`layer_${y}`);if(!b)throw new Error(`Layer ${y} not found`);const w=b.attrs,x=w.label,T=w.width,E=w.height,A=w.num_zoom_levels,C=await b.getGroup("tiles");if(!C)throw new Error(`Tiles group not found for layer ${y}`);v.push({label:x,width:T,height:E,tileSize:m,numZoomLevels:A,tilesGroup:C})}i(v),o(!1)}catch(p){console.error("Error loading tiled image:",p),l(p instanceof Error?p.message:"Failed to load data"),o(!1)}})()},[t]);const f=D.useMemo(()=>{if(r.length===0)return null;const g=r[0],{numZoomLevels:p,width:_,height:m}=g,v=-Math.floor(Math.min(p-1,Math.log2(Math.max(_,m))-8));return{ortho:{target:[_/2,m/2,0],zoom:v}}},[r]),h=D.useMemo(()=>r.map((g,p)=>{const{tileSize:_,width:m,height:v,numZoomLevels:y,tilesGroup:b}=g;return new Fx({id:`TileLayer-${p}`,pickable:!0,tileSize:_,autoHighlight:!0,highlightColor:[255,255,255,20],minZoom:-7,maxZoom:0,coordinateSystem:qe.CARTESIAN,extent:[0,0,m,v],getTileData:async({index:w})=>{const{x,y:T,z:E}=w,A=`${y+E}_${x}_${T}`,C=await b.getDatasetData(A,{});if(!C)throw new Error(`Unable to find tile: ${A}`);const M=new Blob([C],{type:"image/jpeg"}),S=URL.createObjectURL(M);return new Promise((P,R)=>{const k=new Image;k.onload=()=>{P(k),URL.revokeObjectURL(S)},k.onerror=()=>{URL.revokeObjectURL(S),R(new Error(`Failed to load image for tile ${A}`))},k.src=S})},renderSubLayers:w=>{const{bbox:{left:x,bottom:T,right:E,top:A}}=w.tile;return new rx(w,{data:void 0,image:w.data,bounds:[Yt(x,0,m),Yt(T,0,v),Yt(E,0,m),Yt(A,0,v)]})},visible:c===p})}),[r,c]),d=D.useMemo(()=>[new TP({id:"ortho"})],[]);return s?I.jsx("div",{style:{width:e,height:n,display:"flex",alignItems:"center",justifyContent:"center"},children:"Loading tiled image..."}):a?I.jsxs("div",{style:{width:e,height:n,display:"flex",alignItems:"center",justifyContent:"center",color:"red"},children:["Error: ",a]}):r.length===0||!f?I.jsx("div",{style:{width:e,height:n,display:"flex",alignItems:"center",justifyContent:"center"},children:"No layers to display"}):I.jsxs("div",{style:{position:"absolute",width:e,height:n},children:[r.length>1&&I.jsxs("div",{style:{position:"absolute",left:10,top:10,zIndex:1,background:"rgba(255, 255, 255, 0.9)",padding:"10px",borderRadius:"4px",boxShadow:"0 2px 4px rgba(0,0,0,0.2)"},children:[I.jsx("div",{style:{marginBottom:"5px",fontWeight:"bold"},children:"Layers:"}),r.map((g,p)=>I.jsx("div",{style:{marginBottom:"3px"},children:I.jsxs("label",{style:{cursor:"pointer",display:"flex",alignItems:"center"},children:[I.jsx("input",{type:"radio",name:"layer",checked:c===p,onChange:()=>u(p),style:{marginRight:"5px"}}),g.label]})},p))]}),I.jsx(Ule,{views:d,layers:h,initialViewState:f,controller:!0})]})},UO=()=>{const t={current:{}},e=[];return{stateRef:t,dispatch:i=>{t.current=UF(t.current,i),e.forEach(s=>{s(t.current)})},onChange:i=>(e.push(i),()=>{const s=e.indexOf(i);s>=0&&e.splice(s,1)}),createNew:UO}},LO=()=>{const t={current:d3},e=[];return{stateRef:t,dispatch:i=>{t.current=fB(t.current,i),e.forEach(s=>{s(t.current)})},onChange:i=>(e.push(i),()=>{const s=e.indexOf(i);s>=0&&e.splice(s,1)}),createNew:LO}},zO=()=>{const t={current:{}},e=[];return{stateRef:t,dispatch:i=>{t.current=Kp(t.current,i),e.forEach(s=>{s(t.current)})},onChange:i=>(e.push(i),()=>{const s=e.indexOf(i);s>=0&&e.splice(s,1)}),createNew:zO}},zle=({zarrGroup:t,width:e,height:n,onResize:r,onDataChange:i,contexts:s,component:o})=>{const[a,l]=D.useState(e),[c,u]=D.useState(n),[f,h]=D.useState(t);return D.useEffect(()=>{r((d,g)=>{l(d),u(g)}),i(d=>{h(d)})},[r,i]),I.jsx(o,{zarrGroup:f,width:a,height:c,contexts:s})},$le=t=>e=>{const{container:n,zarrGroup:r,width:i,height:s,onResize:o,onDataChange:a,contexts:l}=e;kF.createRoot(n).render(I.jsx(zle,{zarrGroup:r,width:i,height:s,onResize:o,onDataChange:a,contexts:l,component:t}))};(()=>{const t=[{name:"spike_sorting.Autocorrelograms",component:IH},{name:"spike_sorting.AverageWaveforms",component:bW},{name:"spike_sorting.CrossCorrelograms",component:SW},{name:"spike_sorting.RasterPlot",component:iX},{name:"spike_sorting.SpikeAmplitudes",component:aX},{name:"spike_sorting.UnitLocations",component:gX},{name:"spike_sorting.UnitMetricsGraph",component:VX},{name:"spike_sorting.UnitsTable",component:VH},{name:"spike_sorting.SortingCuration",component:zH},{name:"spike_sorting.TiledImage",component:Lle}],e=window.figpack_p1.registerFPViewComponent;for(const i of t)e({name:i.name,render:$le(i.component)});const n=window.figpack_p1.registerFPViewContextCreator;n({name:"unitSelection",create:LO}),n({name:"unitMetricSelection",create:UO}),n({name:"sortingCuration",create:zO});const r=window.figpack_p1.registerFPExtension;r({name:"figpack-spike-sorting"})})()})();
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: figpack_spike_sorting
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: Spike Sorting specific extension for figpack
5
5
  Home-page: https://github.com/flatironinstitute/figpack
6
6
  Author: figpack contributors
@@ -17,7 +17,7 @@ def read_readme():
17
17
 
18
18
  setup(
19
19
  name="figpack_spike_sorting",
20
- version="0.1.8",
20
+ version="0.1.9",
21
21
  description="Spike Sorting specific extension for figpack",
22
22
  long_description=read_readme(),
23
23
  long_description_content_type="text/markdown",