@arcgis/core 5.2.0-next.8 → 5.2.0-next.9

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 (58) hide show
  1. package/applications/SceneViewer/layerUtils.d.ts +9 -1
  2. package/applications/SceneViewer/layerUtils.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/434c1dd3f48e6f0802fc.js +1 -0
  5. package/assets/esri/core/workers/chunks/{09d0e430c66788a2626f.js → 4a20f7a0700fd14a129f.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{a9a1293b1d5302fb3b54.js → 8103d06f760a2c79773d.js} +2 -2
  7. package/assets/esri/core/workers/chunks/{0f3654c8157ec8f22869.js → b895674c0550826ecb28.js} +3 -3
  8. package/assets/esri/core/workers/chunks/c80fc1b3048e8d58a1f8.js +1 -0
  9. package/assets/esri/core/workers/chunks/{6c6396bfcdab12e68deb.js → dd920a6f6422fa213eba.js} +1 -1
  10. package/chunks/GaussianSplatComposition.glsl.js +1 -1
  11. package/chunks/GlobalIllumination.glsl.js +1 -1
  12. package/chunks/OITBlend.glsl.js +3 -3
  13. package/chunks/OITBlendEmission.glsl.js +2 -2
  14. package/chunks/OITDimOpaque.glsl.js +2 -2
  15. package/chunks/SlicePlaneMaterial.glsl.js +4 -4
  16. package/config.js +1 -1
  17. package/core/has.js +1 -1
  18. package/interfaces.d.ts +1 -0
  19. package/kernel.js +1 -1
  20. package/layers/ParquetLayer.d.ts +22 -2
  21. package/layers/graphics/sources/parquet/UrlsFileProvider.js +1 -1
  22. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  23. package/layers/support/GeometryEncodingLocation.d.ts +1 -1
  24. package/layers/support/GeometryEncodingWkb.d.ts +3 -2
  25. package/layers/support/ParquetFilesData.d.ts +13 -3
  26. package/layers/support/ParquetPortalItemData.d.ts +12 -1
  27. package/layers/support/arcgisLayers.js +1 -1
  28. package/package.json +1 -1
  29. package/rest/support/Query.d.ts +1 -0
  30. package/support/revision.js +1 -1
  31. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  32. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  33. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  34. package/views/3d/terrain/TerrainRenderer.js +1 -1
  35. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  36. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  37. package/views/3d/webgl-engine/collections/Component/RenderSubmitSystem.js +1 -1
  38. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  39. package/views/3d/webgl-engine/core/shaderLibrary/util/EmissionDimming.glsl.js +1 -1
  40. package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
  41. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  42. package/views/3d/webgl-engine/effects/emissive/emissions.js +1 -1
  43. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  44. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  45. package/views/3d/webgl-engine/effects/transparency/OITBlendTechniqueConfiguration.js +1 -1
  46. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  47. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  48. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  49. package/views/3d/webgl-engine/lib/RendererBase.js +1 -1
  50. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  51. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  52. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  53. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +2 -2
  54. package/views/3d/webgl-engine/shaders/SlicePlaneMaterial.glsl.js +1 -1
  55. package/views/webgl/RenderingContext.js +1 -1
  56. package/views/webgl/renderState.js +1 -1
  57. package/assets/esri/core/workers/chunks/2c9ba638d1f31c82f9f5.js +0 -1
  58. package/assets/esri/core/workers/chunks/3b15933f65f59625a650.js +0 -1
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[4257],{9775(t,e,s){s.d(e,{A:()=>n});var i=s(62788),r=s(95488);class n{constructor(t=t=>t.values().next().value){this._peeker=t,this._observable=new r.I,this._items=new Set}get length(){return(0,i.gc)(this._observable),this._items.size}clear(){0!==this.length&&(this._items.clear(),this._observable.notify())}last(){if(0===this.length)return;let t;for(t of this._items);return t}peek(){if(0!==this.length)return this._peeker(this._items)}push(t){this.contains(t)||(this._items.add(t),this._observable.notify())}contains(t){return(0,i.gc)(this._observable),this._items.has(t)}pop(){if(0===this.length)return;const t=this.peek();return this._items.delete(t),this._observable.notify(),t}popLast(){if(0===this.length)return;const t=this.last();return this._items.delete(t),this._observable.notify(),t}remove(t){this.contains(t)&&(this._items.delete(t),this._observable.notify())}filter(t){const e=this.length;return this._items.forEach(e=>{t(e)||this._items.delete(e)}),e!==this._items.size&&this._observable.notify(),this}*[Symbol.iterator](){(0,i.gc)(this._observable),yield*this._items}}},36745(t,e,s){s.d(e,{z:()=>o});var i=s(4718),r=s(51118),n=s(60408),a=s(92722);class o{static fromOptimized(t,e,s=1){return(new h).initialize(t,e,s)}static fromJSON(t){const[e,s]=l(t),i=(0,n.Pv)(t),r=(0,n.W0)(t);return(new c).initialize(e,s,i,r,1)}static fromOptimizedCIM(t,e,s=1){return(new p).initialize(t,e,s)}static fromJSONCIM(t,e=1){const[s,i]=l(t),r=(0,n.Pv)(t),a=(0,n.W0)(t);return(new d).initialize(s,i,r,a,e)}static fromFeatureSetReader(t){const e=t.readGeometryForDisplay(),s=t.geometryType;return e&&s?this.fromOptimized(e,s):null}static fromFeatureSetReaderCIM(t){const e=t.readGeometryForDisplay(),s=t.geometryType;return e&&s?this.fromOptimizedCIM(e,s):null}static createEmptyOptimized(t,e=!1,s=!1,i=1){return(new p).initialize(new a.A([],[],e,s),t,i)}static createEmptyJSON(t,e=!1,s=!1){return(new c).initialize([],t,e,s,1)}static createEmptyOptimizedCIM(t,e=!1,s=!1,i=1){return(new p).initialize(new a.A([],[],e,s),t,i)}static createEmptyJSONCIM(t,e=!1,s=!1,i=1){return(new d).initialize([],t,e,s,i)}asJSON(){const t=(0,r.x)(this),{hasZ:e,hasM:s}=this;return"esriGeometryEnvelope"===this.geometryType?{xmin:t[0][0][0],ymin:t[0][0][1],xmax:t[0][2][0],ymax:t[0][2][1]}:"esriGeometryMultipoint"===this.geometryType?{points:t.flat(),hasZ:e,hasM:s}:"esriGeometryPoint"===this.geometryType?{x:t[0][0][0],y:t[0][0][1],z:e?t[0][0][2]:void 0,m:s?t[0][0][e?3:2]:void 0}:"esriGeometryPolygon"===this.geometryType?{rings:t,hasZ:e,hasM:s}:{paths:t,hasZ:e,hasM:s}}getCurrentRingArea(){if(this.pathSize<3)return 0;let t,e,s=0;if(this.seekPathStart(),!this.nextPoint())return 0;t=this.x,e=this.y;const i=t,r=e;for(;this.nextPoint();)s+=(t-this.x)*(e+this.y),t=this.x,e=this.y;return s+=(t-i)*(e+r),-.5*s}invertY(){this.yFactor*=-1}}class h extends o{constructor(){super(...arguments),this._end=-1}get hasZ(){return this._geometry?.hasZ}get hasM(){return this._geometry?.hasM}initialize(t,e,s){return this.geometryType=e,this._stride=t.stride,this._geometry=t,this._pathIndex=-1,this._pathOffset=0,this._pointOffset=-this._stride,this._end=-1,this.yFactor=s,this}reset(){this.initialize(this._geometry,this.geometryType,this.yFactor)}seekPath(t){if(t>=0&&t<this.totalSize){if(this._pathIndex<t)for(;this._pathIndex<t&&this.nextPath(););else if(this._pathIndex>t)for(;this._pathIndex>t&&this.prevPath(););return!0}return!1}seekPathStart(){this._pointOffset=this._pathOffset-this._stride}seekPathEnd(){this._pointOffset=this._end}seekInPath(t){const e=this._pathOffset+t*this._stride;return e>=0&&e<this._end&&(this._pointOffset=e,!0)}nextPoint(){return(this._pointOffset+=this._stride)<this._end}prevPoint(){return(this._pointOffset-=this._stride)>=this._pathOffset}nextPath(){return!(this.pathIndex>=this.totalSize-1||(this._pathIndex>=0&&(this._pathOffset+=this._stride*this.pathSize),this._pathIndex++,this._pointOffset=this._pathOffset-this._stride,this._end=this._pointOffset+this._stride+this._stride*this.pathSize,0))}prevPath(){return!(this.pathIndex<=0||(this._pathIndex--,this._end=this._pathOffset,this._pathOffset-=this._stride*this.pathSize,this._pointOffset=this._pathOffset-this._stride,0))}getCurrentPath(){const t=this._end,e=this._geometry.coords,s=this._pathOffset;return(new h).initialize(new a.A([this.pathSize],e.slice(s,t),this.hasZ,this.hasM),this.geometryType,this.yFactor)}pathLength(){const t=this._end,e=this._stride,s=this._geometry.coords;let i=0;for(let r=this._pathOffset+e;r<t;r+=e){const t=s[r-e],n=s[r-e+1],a=s[r]-t,o=s[r+1]-n;i+=Math.sqrt(a*a+o*o)}return i}startPath(){this._geometry.lengths.push(0)}pushPath(t){this.startPath(),this.pushPoints(t)}pushPoint(t){for(let e=0;e<this._stride;++e)this._geometry.coords.push(t[e]);this._geometry.lengths[this.totalSize-1]++}pushXY(t,e){this._geometry.coords.push(t,e),this._geometry.lengths[this.totalSize-1]++}pushPoints(t){for(const e of t)for(let t=0;t<this._stride;++t)this._geometry.coords.push(e[t]);this._geometry.lengths[this.totalSize-1]+=t.length}pushCursor(t){const e=t.asOptimized();this._geometry.coords.push(...e.coords),this._geometry.lengths.push(...e.lengths)}asOptimized(){const t=this._geometry.clone();if(1!==this.yFactor)for(let e=1;e<t.coords.length;e+=this._stride)t.coords[e]*=this.yFactor;return"esriGeometryPoint"===this.geometryType&&(t.lengths.length=0),t}isClosed(){const t=this._geometry.coords,e=this._pathOffset,s=this._end-this._stride;for(let i=0;i<this._stride;i++)if(t[e+i]!==t[s+i])return!1;return!0}clone(){return(new h).initialize(this._geometry.clone(),this.geometryType,this.yFactor)}get totalPoints(){return this._geometry.isPoint?1:this._geometry.lengths.reduce((t,e)=>t+e)}get pathSize(){const{lengths:t}=this._geometry;return this._geometry.isPoint?1:this._pathIndex<0||this._pathIndex>t.length-1?0:t[this._pathIndex]}get totalSize(){return this._geometry.isPoint?1:this._geometry.lengths.length}get x(){return this._geometry.coords[this._pointOffset]}set x(t){this._geometry.coords[this._pointOffset]=t}get y(){return this.yFactor*this._geometry.coords[this._pointOffset+1]}set y(t){this._geometry.coords[this._pointOffset+1]=this.yFactor*t}get z(){return this._geometry.coords[this._pointOffset+2]}set z(t){this._geometry.coords[this._pointOffset+2]=t}get m(){const t=this.hasZ?3:2;return this._geometry.coords[this._pointOffset+t]}set m(t){this._geometry.coords[this._pointOffset+3]=t}get pathIndex(){return this._pathIndex}get _coordIndex(){return this._pointOffset/this._stride}}function u(t){const e=[t.x,t.y];return t.z&&e.push(t.z),t.m&&e.push(t.m),e}function l(t){return(0,n.Bi)(t)?[t.rings,"esriGeometryPolygon"]:(0,n.Rg)(t)?[t.paths,"esriGeometryPolyline"]:(0,n.U9)(t)?[[t.points],"esriGeometryMultipoint"]:(0,n.ZC)(t)?[[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]],"esriGeometryEnvelope"]:(0,n.fT)(t)?[[[u(t)]],"esriGeometryPoint"]:[[],"esriGeometryPolyline"]}class c extends o{initialize(t,e,s,i,r){return this._paths=t,this.geometryType=e,this.hasZ=s,this.hasM=i,this._pathIndex=this._pointIndex=-1,this.yFactor=r,this._mIndex=this.hasZ?3:2,this}reset(){this._pathIndex=this._pointIndex=-1}seekPath(t){return this._pathIndex=t,this._pointIndex=-1,t>=0&&t<this.totalSize&&(this._currentPath=this._paths[t],!0)}seekPathStart(){this._pointIndex=-1}seekPathEnd(){this._pointIndex=this._currentPath.length}seekInPath(t){return t>=0&&t<this._currentPath.length&&(this._pointIndex=t,this._currentPoint=this._currentPath[this._pointIndex],!0)}nextPoint(){return this._currentPoint=this._currentPath[++this._pointIndex],this._pointIndex<this._currentPath.length}prevPoint(){return this._currentPoint=this._currentPath[--this._pointIndex],this._pointIndex>=0}nextPath(){return this._pointIndex=-1,this._currentPath=this._paths[++this._pathIndex],this._pathIndex<this.totalSize}prevPath(){return this.pathIndex>0&&(this._pointIndex=-1,this._pathIndex--,this._currentPath=this._paths[this._pathIndex],!0)}pathLength(){const t=this._currentPath.length,e=this._currentPath;let s=0;for(let i=1;i<t;i++){const t=e[i-1],r=e[i],n=t[0],a=t[1],o=r[0]-n,h=r[1]-a;s+=Math.sqrt(o*o+h*h)}return s}startPath(){this._paths.push([])}getCurrentPath(){return(new c).initialize([this._currentPath],this.geometryType,this.hasZ,this.hasM,this.yFactor)}pushPath(t){this._paths.push(t)}pushPoint(t){this._paths[this.totalSize-1].push(t)}pushXY(t,e){this._paths[this.totalSize-1].push([t,e])}pushPoints(t){this._paths[this.totalSize-1].push(...t)}pushCursor(t){const e=(0,r.x)(t);for(const t of e)this.pushPath(t)}asOptimized(){const{hasZ:t,hasM:e}=this,s=new a.A([],[],t,e),{coords:i,lengths:r}=s;if("esriGeometryPoint"===this.geometryType)i.push(...this._paths[0][0]),r.length=0;else for(const s of this._paths){for(const r of s)i.push(r[0]),i.push(r[1]*this.yFactor),t&&i.push(r[2]),e&&i.push(r[this._mIndex]);r.push(s.length)}return s}isClosed(){const t=this._currentPath[0],e=this._currentPath[this._currentPath.length-1];for(let s=0;s<t.length;s++)if(t[s]!==e[s])return!1;return!0}clone(){return(new c).initialize((0,i.o8)(this._paths),this.geometryType,this.hasZ,this.hasM,this.yFactor)}get totalPoints(){return this._paths.map(t=>t.length).reduce((t,e)=>t+e)}get pathSize(){return this._pathIndex<0||this._pathIndex>this.totalSize-1?-1:this._paths[this._pathIndex].length}get totalSize(){return this._paths.length}get x(){return this._currentPoint[0]}set x(t){this._currentPoint[0]=t}get y(){return this.yFactor*this._currentPoint[1]}set y(t){this._currentPoint[1]=this.yFactor*t}get z(){return this._currentPoint[2]}set z(t){this._currentPoint[2]=t}get m(){return this._currentPoint[this._mIndex]}set m(t){this._currentPoint[this._mIndex]=t}get pathIndex(){return this._pathIndex}}class p extends h{initialize(t,e,s){return super.initialize(t,e,s),this._controlPoints||(this._controlPoints=this._controlPoints=new Array(this.totalSize).fill(void 0).map(t=>new Set)),this}startPath(){super.startPath(),this._controlPoints.push(new Set)}clone(){const t=(new p).initialize(this._geometry.clone(),this.geometryType,this.yFactor);return t._controlPoints=this._controlPoints,t}setControlPoint(){this._controlPoints[this.pathIndex].add(this._coordIndex)}getControlPoint(){return this._controlPoints[this.pathIndex].has(this._coordIndex)}setControlPointAt(t){this._controlPoints[this.pathIndex].add(t)}getControlPointAt(t){return this._controlPoints[this.pathIndex].has(t)}}class d extends c{initialize(t,e,s,i,r){return super.initialize(t,e,s,i,r)}clone(){return(new d).initialize((0,i.o8)(this._paths),this.geometryType,this.hasZ,this.hasM,this.yFactor)}setControlPoint(){this._paths[this.pathIndex][this._pointIndex][4]=1}getControlPoint(){return 1===this._paths[this.pathIndex][this._pointIndex][4]}setControlPointAt(t){this._paths[this.pathIndex][t][4]=1}getControlPointAt(t){return 1===this._paths[this.pathIndex][t][4]}}},32011(t,e,s){s.d(e,{d:()=>h});var i=s(19419),r=s(537),n=s(12359),a=s(95108),o=s(12176);function h(t){if(0===t.totalSize)return null;const e=(0,r.z8)(t);if(!e)return null;const s=4*(Math.abs(e[0])+Math.abs(e[2])+Math.abs(e[1])+Math.abs(e[3])+1)*222045e-19;let a=0,o=0;t.reset();for(let e=0;t.nextPath();e++){const s=t.getCurrentRingArea();s>o&&(o=s,a=e)}if(t.seekPath(a),0===t.pathSize)return null;t.seekPathStart();const h=(0,r.B$)(t);if(Math.abs(o)<=2*s*s)return[(h[0]+h[2])/2,(h[1]+h[3])/2];t.seekPathStart();const p=(0,n.w2)(t,(0,i.vt)());if(null===p)return null;if(t.totalPoints<4)return p;const d=[[NaN,NaN],[NaN,NaN],[NaN,NaN],[NaN,NaN]],f=[NaN,NaN,NaN,NaN],g=[NaN,NaN,NaN,NaN];let x=!1,w=l(p,t,!0);0===w.distance&&(x=!0,d[0][0]=p[0],d[0][1]=p[1],w=l(p,t,!1)),f[0]=w.distance,g[0]=0;const I=[NaN,NaN];let P=!1,S=.25,N=-1,F=NaN;do{if(F=NaN,d[1]=c(t,_(h[0],h[2],S),0,e),isNaN(d[1][0])||isNaN(d[1][1])||(w=l(d[1],t,!1),F=w.distance),!isNaN(F)&&F>s&&u(d[1],t))P=!0,f[1]=F,g[1]=y(d[1],p);else if(!isNaN(F)&&F>N&&(N=F,I[0]=d[1][0],I[1]=d[1][1]),S-=.01,S<.1){if(!(N>=0))break;P=!0,f[1]=N,d[1][0]=I[0],d[1][1]=I[1],g[1]=y(d[1],p)}}while(!P);P=!1,S=.5,N=-1;let v=.01,O=1;do{if(F=NaN,d[2]=c(t,_(h[0],h[2],S),0,e),isNaN(d[2][0])||isNaN(d[2][1])||(w=l(d[2],t,!1),F=w.distance),!isNaN(F)&&F>s&&u(d[2],t))P=!0,f[2]=F,g[2]=y(d[2],p);else if(!isNaN(F)&&F>N)N=F,I[0]=d[2][0],I[1]=d[2][1];else if(F>N&&(N=F,I[0]=d[2][0],I[1]=d[2][1]),S=.5+v*O,v+=.01,O*=-1,S<.3||S>.7){if(!(N>=0))break;P=!0,f[2]=N,d[2][0]=I[0],d[2][1]=I[1],g[2]=y(d[2],p)}}while(!P);P=!1,S=.75,N=-1;do{if(F=NaN,d[3]=c(t,_(h[0],h[2],S),0,e),isNaN(d[3][0])||isNaN(d[3][1])||(w=l(d[3],t,!1),F=w.distance),!isNaN(F)&&F>s&&u(d[3],t))P=!0,f[3]=F,g[3]=y(d[3],p);else if(F>N&&(N=F,I[0]=d[3][0],I[1]=d[3][1]),S+=.01,S>.9){if(!(N>=0))break;P=!0,f[3]=N,d[3][0]=I[0],d[3][1]=I[1],g[3]=y(d[3],p)}}while(!P);const z=[0,1,2,3],C=x?0:1;let b;for(let t=C;t<4;t++)for(let t=C;t<3;t++){const e=g[t],s=g[t+1];m(e,s)>0&&(b=z[t],z[t]=z[t+1],z[t+1]=b,g[t]=s,g[t+1]=e)}let R=C,E=0,q=0;for(let t=C;t<4;t++){switch(t){case 0:q=2*f[z[t]];break;case 1:q=1.66666666*f[z[t]];break;case 2:q=1.33333333*f[z[t]];break;case 3:q=f[z[t]]}q>E&&(E=q,R=z[t])}return d[R]}function u(t,e){let s,i,r,n,a=0;for(e.reset();e.nextPath()&&e.nextPoint();)for(s=e.x,i=e.y;e.nextPoint();s=r,i=n)r=e.x,n=e.y,i>t[1]!=n>t[1]&&((r-s)*(t[1]-i)-(n-i)*(t[0]-s)>0?a++:a--);return 0!==a}function l(t,e,s){if(s&&u(t,e))return{coord:t,distance:0};let i=1/0,r=0,n=0,o=[0,0],h=[0,0];const l=[0,0];for(e.reset();e.nextPath()&&e.nextPoint();)if(!(e.pathSize<2))for(o[0]=e.x,o[1]=e.y;e.nextPoint();o=h){h=[e.x,e.y],(0,a.gR)(l,t,o,h);const s=y(t,l);s<i&&(i=s,r=l[0],n=l[1])}return{coord:[r,n],distance:Math.sqrt(i)}}function c(t,e,s,r){const n=[e,0];let a=1/0,h=1/0,u=!1,l=!1;const c=[[e,r[1]-1],[e,r[3]+1]],f=[0,0],_=[0,0],y=[0,0],m=[[0,0],[0,0]],g=(0,i.vt)();for(t.reset();t.nextPath()&&t.nextPoint();)if(!(t.pathSize<2))for(m[0][0]=t.x,m[0][1]=t.y;t.nextPoint();m[0][0]=m[1][0],m[0][1]=m[1][1]){if(m[1][0]=t.x,m[1][1]=t.y,null===p(g,m))continue;if(_[0]=c[0][0],_[1]=c[0][1],y[0]=c[1][0],y[1]=c[1][1],0===d(g,_,y))continue;if(!(0,o.Ql)(c[0],c[1],m[0],m[1],f))continue;const e=f[1];a>h?e<a&&(a=e,u=!0):e<h&&(h=e,l=!0)}return u&&l?n[1]=(a+h)/2:n[0]=n[1]=NaN,n}function p(t,e){if(e.length<2)return null;t||(t=(0,i.vt)());const[s,r]=e[0],[n,a]=e[1];return t[0]=Math.min(s,n),t[1]=Math.min(r,a),t[2]=Math.max(s,n),t[3]=Math.max(r,a),t}function d(t,e,s){let i=f(e,t),r=f(s,t);const n=t[0],a=t[1],o=t[2],h=t[3];if(i&r)return 0;if(!(i|r))return 4;const u=(i?1:0)|(r?2:0);do{const u=s[0]-e[0],l=s[1]-e[1];if(u>l)3&i?(1&i?(e[1]+=l*(n-e[0])/u,e[0]=n):(e[1]+=l*(o-e[0])/u,e[0]=o),i=f(e,t)):3&r?(1&r?(s[1]+=l*(n-s[0])/u,s[0]=n):(s[1]+=l*(o-s[0])/u,s[0]=o),r=f(s,t)):i?(4&i?(e[0]+=u*(a-e[1])/l,e[1]=a):(e[0]+=u*(h-e[1])/l,e[1]=h),i=f(e,t)):(4&r?(s[0]+=u*(a-s[1])/l,s[1]=a):(s[0]+=u*(h-s[1])/l,s[1]=h),r=f(s,t));else if(12&i?(4&i?(e[0]+=u*(a-e[1])/l,e[1]=a):(e[0]+=u*(h-e[1])/l,e[1]=h),i=f(e,t)):12&r?(4&r?(s[0]+=u*(a-s[1])/l,s[1]=a):(s[0]+=u*(h-s[1])/l,s[1]=h),r=f(s,t)):i?(1&i?(e[1]+=l*(n-e[0])/u,e[0]=n):(e[1]+=l*(o-e[0])/u,e[0]=o),i=f(e,t)):(1&r?(s[1]+=l*(n-s[0])/u,s[0]=n):(s[1]+=l*(o-s[0])/u,s[0]=o),r=f(s,t)),i&r)return 0}while(i|r);return u}function f(t,e){return(t[0]<e[0]?1:0)|(t[0]>e[2]?1:0)<<1|(t[1]<e[1]?1:0)<<2|(t[1]>e[3]?1:0)<<3}function _(t,e,s){return t+(e-t)*s}function y(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function m(t,e){if(t<e)return-1;if(t>e)return 1;if(t===e)return 0;const s=isNaN(t),i=isNaN(e);return s<i?-1:s>i?1:0}},6557(t,e,s){s.r(e),s.d(e,{default:()=>G});var i=s(5482),r=s(21818),n=s(49186),a=s(44208),o=s(53966),h=s(17676),u=s(563),l=s(39516),c=s(16930),p=s(70328),d=s(75752),f=s(99352),_=s(8384),y=s(58727),m=s(90951),g=s(64714),x=s(17754),w=s(20437),I=s(95466),P=s(50639),S=s(42760),N=s(39412),F=s(30661),v=s(28923),O=s(44320),z=s(35258),C=s(16630);const b=new F.Z,R="__OBJECTID",E=new TextDecoder,q=8e3;class T{constructor(t,e){this._files=t,this._createFileStream=e,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(t){for(await this._fill(t);this._pending.size>0;){(0,h.Te)(t),await this._fill(t);const e=await A(this._pending);if(this._pending.delete(e.read),this._resolvedCount++,null!=e.chunk)return e.chunk}return null}async _fill(t){for(this._removeDone();this._pending.size<8;){const e=this._getOrCreateNextStream(t);if(null==e)return;this._pending.add(e.read(t))}}_getOrCreateNextStream(t){const e=this._resolvedCount>=8?8:2;if(this._fileIndex<this._files.length&&this._streams.length<e){const e=this._files[this._fileIndex++],s=new M(e.id,this._createFileStream(e,t));return this._streams.push(s),s}return this._getNextStream()}_getNextStream(){const t=this._streams.length;for(let e=0;e<t;e++){const s=(this._streamIndex+e)%t,i=this._streams[s];if(i.canRead)return this._streamIndex=(s+1)%t,i}return null}_removeDone(){let t=this._streamIndex;for(let e=this._streams.length-1;e>=0;e--)this._streams[e].done&&(this._streams.splice(e,1),e<t&&t--);this._streamIndex=this._streams.length>0?t%this._streams.length:0}}function A(t){return Promise.race(Array.from(t,async t=>({read:t,chunk:await t})))}class M{constructor(t,e){this._fileId=t,this._stream=e,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&0===this._readCount}async read(t){this._readCount++;try{const e=await this._stream,s=await e.next(t);return null==s?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:s}}finally{this._readCount--}}}class G{constructor(){this._queue=new u.QueueProcessor({concurrency:4,process:(t,e)=>this._executeQuery(t,e)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={}}async load(t){const e=t.spatialReference?c.A.fromJSON(t.spatialReference):void 0;if(e&&!e.isWGS84&&!e.isWebMercator)throw new n.A("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");this._customParameters=t.customParameters,this._provider=(0,m.M)(t.provider,null,()=>this._customParameters);const s=await this._provider.getMetadata(),i=await(0,S.nc)(s,{fields:t.fields?.map(t=>w.A.fromJSON(t)),geometryEncoding:t.geometryEncoding?(0,P.G)(t.geometryEncoding):null,geometryType:t.geometryType?(0,S.hG)(t.geometryType):null,displayOptimization:t.displayOptimization,spatialReference:e});if(!i.fields)throw new n.A("parquet:unsupported","Fields must be defined");let r;if(i.spatialReference&&i.geometryType){if(!i.spatialReference)throw new n.A("parquet:unsupported","SpatialReference must be defined");if(!i.spatialReference.isGeographic&&!i.spatialReference.isWebMercator)throw new n.A("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");i.spatialReference.isGeographic&&!i.spatialReference.isWGS84&&(o.A.getLogger("parquet:unsupported-projection").warn("Found a geographic projection that is not WGS84. Handling as WGS84.",{spatialReference:i.spatialReference}),i.spatialReference=c.A.WGS84),r={geometry:i.geometryEncoding?{geometryType:(0,S.sA)(i.geometryType),spatialReference:i.spatialReference.toJSON(),encoding:i.geometryEncoding.toJSON()}:null,displayOptimization:i.displayOptimization}}this.setCustomParameters(t.customParameters),this._displayOptimization=i.displayOptimization,await this._provider.updateGeometryInfo(r),this._capabilities=W(await this._getFileStatistics());const a=await this._provider.getFiles();if(!a.length)return{layerDefinition:{},capabilities:W(null)};const h=await a[0].file;i.file=h;const{fields:u}=i;if(null==u)throw new n.A("parquet-layer:missing-metadata","Unable to create parquet source: cannot infer fields",u);u.push(new w.A({name:R,type:"oid",alias:R}));for(const t of u){const e=h.getColumnId(t.name);null!=e&&(this._indexMap[t.name]=e)}const l=new I.A(u.map(t=>t.toJSON()));this._fieldsIndex=l;const p=(0,S.sA)(i.geometryType??"point");return this._metadata=z.i.createFeature({fieldsIndex:l.toJSON(),geometryType:p,hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:"rowId"},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:i.spatialReference,outSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:p,featureIdInfo:{type:"object-id",fieldName:"rowId"},hasM:!1,hasZ:!1,spatialReference:i.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=s?.extent?s.extent:await this._tryDeriveParquetFullExtent(i),{capabilities:this._capabilities,layerDefinition:{fields:i.fields?.map(t=>t.toJSON()),drawingInfo:(0,g.F0)(p),extent:this._fullExtent??void 0,geometryType:p,geometryEncoding:i.geometryEncoding?.toJSON(),displayOptimization:i.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(const{handle:t}of this._streams.values())t.remove();this._streams.clear()}setCustomParameters(t){this._customParameters=t}getIndexMap(){return this._indexMap}async updateFileProvider(t){this._provider=(0,m.M)(t,this._provider.getGeometryInfo(),()=>this._customParameters)}async queryFeatures(t,e){return this._validateQuery(t),function(t){return!!(t.objectIds?.length||t.outStatistics||t.orderByFields?.length||t.returnDistinctValues)}(t)||(t.resultRecordCount=t.resultRecordCount?Math.min(t.resultRecordCount,q):q,t.resultOffset=t.resultOffset??0),(t.outStatistics||t.returnDistinctValues)&&(t.returnGeometry=void 0),(await this._enqueueQuery(t,e)).createQueryResponse()}async queryFeatureCount(t,e){const s=await(0,y.T2)(t,null,this._queryEngineParams.spatialReference);return this._validateQuery(s),k(s)?(s.outFields=void 0,s.returnGeometry=void 0,(await this._enqueueQuery(s,e)).createQueryResponseForCount()):this._getFeatureCount()}async queryObjectIds(t,e){const s=await(0,y.T2)(t,null,this._queryEngineParams.spatialReference);return this._validateQuery(s),k(s)?(s.resultRecordCount=s.resultRecordCount?Math.min(s.resultRecordCount,8e3):8e3,s.resultOffset=s.resultOffset??0,s.returnGeometry=void 0,s.outFields=void 0,(await this._enqueueQuery(s,e)).items.map(t=>t.getObjectId())):Array.from({length:await this._getFeatureCount()},(t,e)=>e)}async queryExtent(t,e){const s=await(0,y.T2)(t,null,this._queryEngineParams.spatialReference);if(this._validateQuery(s),this._fullExtent&&!k(s))return{count:await this._getFeatureCount(),extent:this._fullExtent};const i=(0,r.z)(this._metadata.spatialReference);s.returnGeometry=!0,s.outFields=void 0;const n=(0,p.hZ)((0,p.vt)(),p.qv),a=(0,p.vt)(),o=await this._enqueueQuery(s,e);let h=0;for(const t of o.items)t.getBounds(a)&&((0,p.RF)(n,a),h+=1);return{count:h,extent:(0,d.Wc)(n,i,s.outSR?(0,r.z)(s.outSR):i.toJSON(),i,!1)}}async queryStream(t,e){if(!e.signal)throw new Error("InternalError: AbortSignal must be passed");const s=await this._getCandidateFiles(t),i=new T(s,async(e,s)=>{const i=await e.file,r=await this._createParquetQuery(i,t);return i.executeQuery(r,s)}),r=this._streamIdCounter++,n=(0,h.NY)(e.signal,t=>{const e=this._streams.get(r);null!=e&&(e.handle.remove(),this._streams.delete(r))});return this._streams.set(r,{stream:i,handle:n}),r}async getStreamNext(t,e){if(!e.signal)throw new Error("InternalError: AbortSignal must be passed");const s=this._streams.get(t);if(!s)return{result:null};const i=await s.stream.next(e.signal);if(null==i)return s.handle.remove(),this._streams.delete(t),{result:null};const r=i.chunk.serialize().buffer,n={fileId:i.fileId,buffer:r};return r instanceof ArrayBuffer?{result:n,transferList:[r]}:{result:n}}async createPatch(t,e,s,i,r){if(!r.signal)throw new Error("InternalError: AbortSignal must be passed");const n=await this._getFileInfoById(t),a=await n.file;return(await a.createChunkPatch(e,s,i,r.signal)).serialize().buffer}async _getCandidateFiles(t){const e=await this._provider.getFiles(),s=await this._getSpatialFilePruning(t);if(null==s)return e;const i=e.filter(t=>this._mayIncludeFileForSpatialPruning(t,s));return"xz"===s.type?function(t,e){return t.slice().sort((t,s)=>{const i=D(t,e),r=D(s,e);return i===r?0:i<r?-1:1})}(i,s):i}async _getSpatialFilePruning(t){if("tile"!==t.type)return null;const e=this._displayOptimization,s=e?.index;if(null==s)return null;const i=t.outSpatialReference.wkid;if(null==s.wkid||null==i)return null;const r=s.wkid,n=await(0,N.N)();switch(s.type){case"xz":return{type:"xz",fieldName:s.code,intersects:(e,a)=>n.queryIntersectsXZStatistics(s.fullExtent,t.extent,i,r,20,e,a)};case"z":return{type:"xy",xFieldName:s.xColumn,yFieldName:s.yColumn,intersects:(e,s,a,o)=>n.queryIntersectsXYStatistics(t.extent,i,r,e,s,a,o)}}}_mayIncludeFileForSpatialPruning(t,e){switch(e.type){case"xz":{const s=B(t,e);return null==s||function(t,e){const s=Z(t.minValue),i=Z(t.maxValue);return null==s||null==i||e.intersects(s,i)}(s,e)}case"xy":{const{xStatistics:s,yStatistics:i}=function(t,e){return{xStatistics:t.statistics.statistics.get(e.xFieldName)??null,yStatistics:t.statistics.statistics.get(e.yFieldName)??null}}(t,e);return null==s||null==i||function(t,e,s){const i=Z(t.minValue),r=Z(t.maxValue),n=Z(e.minValue),a=Z(e.maxValue);return null==i||null==r||null==n||null==a||s.intersects(i,r,n,a)}(s,i,e)}}}async _tryDeriveParquetFullExtent(t){if(!t.spatialReference)return null;if(null==this._fullExtent&&"location"===t.geometryEncoding?.type){const e=await this._provider.getFiles(),{xField:s,yField:r}=t.geometryEncoding,n=(0,p.hZ)((0,p.vt)(),p.qv);for(const t of e){const e=await t.file;for(const t of e.rowGroups()){const e={stack:[],error:void 0,hasError:!1};try{const a=(0,i.mS)(e,t.columnDescriptorForAttribute(s),!1),o=(0,i.mS)(e,t.columnDescriptorForAttribute(r),!1),h=[a.minValue(),o.minValue(),a.maxValue(),o.maxValue()];(0,p.DC)(n,h),t.free()}catch(t){e.error=t,e.hasError=!0}finally{(0,i.hk)(e)}}}return{xmin:n[0],ymin:n[1],xmax:n[3],ymax:n[4],spatialReference:t.spatialReference?.toJSON()}}return null}async _getFileInfoById(t){const e=await this._provider.getFiles();for(const s of e)if(s.id===t)return s;throw new Error(`InternalError: File ${t} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(t){return(await this._getFileInfoById(t)).file}async _createParquetQuery(t,e){const s=(await(0,N.N)()).Query.new();return"tile"===e.type&&(s.setExtent(e.extent),s.setQuantizationTransform(e.transform),s.setScale(e.scale)),s.setOutFields(e.outFields.filter(t=>null!=this._indexMap[t])),s.setOutSpatialReference(e.outSpatialReference.wkid),s.setReturnGeometry(e.returnGeometry),e.where&&await this._setWhereClause(s,t,e.where),s}async _getFeatureCount(){return(await this._provider.getFiles()).map(t=>t.statistics.rowCount).reduce((t,e)=>t+e,0)}async _getByteLength(){return(await this._provider.getFiles()).map(t=>t.statistics.byteSize).reduce((t,e)=>t+e,0)}_validateQuery(t){if(!this._capabilities.query.supportsStatistics&&t.outStatistics)throw new n.A("parquet:unsupported","Statistics queries are not supported",{query:t});if(!this._capabilities.query.supportsOrderBy&&t.orderByFields?.length)throw new n.A("parquet:unsupported","Queries using orderBy are not supported",{query:t});if(!this._capabilities.query.supportsDistinct&&t.returnDistinctValues)throw new n.A("parquet:unsupported","Queries using returnDistinctValues are not supported",{query:t})}async _setWhereClause(t,e,s){const i=this._indexMap,r=this._fieldsIndex,a={getAttribute(t,s){const n=e.readAttribute(t.rowGroup,t.row,i[s]);if(null==n)return null;const a=r.get(s);return"esriFieldTypeString"===a.type||"esriFieldTypeDateOnly"===a.type||"esriFieldTypeTimeOnly"===a.type||"esriFieldTypeTimestampOffset"===a.type?E.decode(n):n}},o=await(0,l.GP)(s,this._fieldsIndex);if(!o.isStandardized)throw new n.A("sql-parse-error","expression is not standardized");t.setWhere(s),t.setWhereEvaluator((t,e)=>o.testFeatureCompiled({rowGroup:t,row:e},a,null)),t.setWhereFields(o.fieldNames)}async*_fetchChunks(t,e){const s=await(0,N.N)(),i=await this._provider.getFiles();for(const r of i){const i=await r.file,n=s.Query.new();n.setOutFields(t.fields),n.setReturnGeometry(t.returnGeometry),t.where&&await this._setWhereClause(n,i,t.where);const a=await i.executeQuery(n),o=[],u=a.next(e);for(let t=0;t<4;t++)o.push(a.next(e));let l=await u;for(;null!=l;){(0,h.Te)(e);const t=new C.s(this._metadata,this._indexMap,l,r.id),s=Q([new v.j(t,null,0,!1)],this._queryEngineParams),i=o.shift();o.push(a.next(e)),yield s,l=await i}}}_enqueueQuery(t,e){return this._queue.push(t,e)}async _executeQuery(t,e){const s=await this._getReadParams(t);if(t.where=void 0,t.objectIds?.length){const s=new Map;for(const e of t.objectIds){const t=(0,x.wY)(e),i=(0,x.gE)(e);let r=s.get(t);r||(r=[],s.set(t,r)),r.push(i)}const i=[];for(const[r,n]of s.entries()){const s=await this._executeFileIdQuery(t,r,n,e);for(const t of s)i.push(t)}return new _.G(i,t,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:b,featureIdInfo:this._queryEngineParams.featureIdInfo})}let i=t.resultRecordCount??await this._getFeatureCount(),r=t.resultOffset??0;t.resultRecordCount=void 0,t.resultOffset=void 0;const n=[];for await(const a of this._fetchChunks(s,e)){const s=await a.executeQueryForOpaqueFeatures(t,e);if(s.length>r){const e=s.slice(r,Math.min(r+i,s.length));for(const t of e)n.push(t);if(r=0,i-=e.length,0===i)return new _.G(n,t,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:b,featureIdInfo:this._queryEngineParams.featureIdInfo})}else r-=s.length}return new _.G(n,t,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:b,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(t,e,s,i){const r=await this._getReadParams(t),n=(await(0,N.N)()).Query.new();n.setOutFields(r.fields),n.setReturnGeometry(r.returnGeometry),n.setIds(new Uint32Array(s));const a=await this._getFile(e),o=await a.executeQuery(n,i);let h=await o.next(i),u=0;const l=[];for(;null!=h;){const t=new C.s(this._metadata,this._indexMap,h,e),s=new v.j(t,null,u++,!1);l.push(s),h=await o.next(i)}return Q(l,this._queryEngineParams).executeQueryForOpaqueFeatures(t,i)}async _getReadParams(t){const e=new Set;if(t.outStatistics)for(const s of t.outStatistics)null!=s.onStatisticField&&e.add(s.onStatisticField);if(t.outFields)for(const s of t.outFields)e.add(s);return{fields:(e.has("*")?this._fieldsIndex.fields.map(t=>t.name):Array.from(e)).filter(t=>null!=this._indexMap[t]),returnGeometry:!!t.returnGeometry||!!t.geometry,where:t.where}}}function k(t){for(const e in t){const s=e;switch(s){case"resultOffset":case"resultRecordCount":case"aggregateIds":case"distance":case"gdbVersion":case"geometry":case"having":case"timeExtent":case"objectIds":case"historicMoment":case"where":return null!=t[s]}}return!1}function Q(t,e){const s=new O.I;for(const e of t)s.insert(e);return new d.do({...e,featureStore:s})}function B(t,e){return t.statistics.statistics.get(e.fieldName)??null}function D(t,e){const s=B(t,e);if(null==s)return Number.POSITIVE_INFINITY;const i=Z(s.minValue),r=Z(s.maxValue);return null==i||null==r||r<i?Number.POSITIVE_INFINITY:r-i}function Z(t){return"number"==typeof t&&Number.isFinite(t)?t:null}function W(t){const e=t?.featureCount;let s=!1;return null!=e&&e<(0,a.A)("parquetlayer-full-query-feature-count")&&(s=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:!1,supportsTrueCurve:!1,supportsZ:!1},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{...f.F,maxRecordCount:q,supportsDistinct:s,supportsOrderBy:s,supportsStatistics:s,supportsSpatialAggregationStatistics:s,supportedSpatialAggregationStatistics:{envelope:s,centroid:s,convexHull:s}},queryAttributeBins:s?f.P:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[2760],{90951(e,t,n){n.d(t,{M:()=>k});var r=n(11254),s=n(5482),i=n(44208),a=n(563),o=n(84952);function l(e){const t=new Map;for(const n of e.files){const e=c(n);t.set(n.name,e)}return t}function c(e){const t=new Map;for(const n of e.statistics??[]){const e=n.column.at(-1);null!=e&&t.set(e,{minValue:n.minValue,maxValue:n.maxValue,nullCount:n.nullCount??0,distinctCount:n.distinctCount??null})}return new u(0,0,t)}class u{static fromFile(e){const t=e.numRows(),n=e.byteLength(),r=new Map;for(const t of e.getColumnDescriptors()){const e=t.minValue(),n=t.maxValue(),s=t.distinctCount(),i=t.nullCount();null!=e&&null!=n&&null!=s&&null!=i&&r.set(t.name(),{minValue:e,maxValue:n,distinctCount:s,nullCount:i}),t.free()}return new u(t,n,r)}constructor(e,t,n){this.rowCount=e,this.byteSize=t,this.statistics=n}}var p=n(49186),d=n(54625),y=n(39412);const h=new Set(["uncompressed","snappy","gzip"]),f=new Set(["esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeBigInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeLong"]);function m(e,t){switch(t){case"esriGeometryPoint":return e.GeometryType.Point;case"esriGeometryPolygon":case"polygon":return e.GeometryType.Polygon;case"esriGeometryPolyline":case"polyline":return e.GeometryType.Polyline;case"esriGeometryMultipoint":case"multipoint":return e.GeometryType.Multipoint;default:throw new p.A("parquet",`Found unexpected GeometryType: ${t}`)}}function g(e,t){const n=e.GeometryInfo.new();t.geometry&&n.setGeometry(function(e,t){const n=t.encoding,r=m(e,t.geometryType),s=t.spatialReference.wkid;if(null==s)throw new Error("InternalError: Wkid must be defined.");switch(n.type){case"wkb":return e.GeometryField.fromWkb(n.field,s,r);case"location":{const{yField:t,xField:i}=n;return e.GeometryField.fromLocation(t,i,s,r)}}}(e,t.geometry));const r=t.displayOptimization;if(r){const{index:t,parentColumn:s}=r,i=e=>null!=s?[s,e].join("."):e;if("z"===t.type){const r=e.DisplayOptimizationZBuilder.new();r.setCodeField(i(t.code)),r.setXColumn(i(t.xColumn)),r.setYColumn(i(t.yColumn)),r.setCooordinatePrecision(t.coordinatePrecision),r.setFullExtent(t.fullExtent),r.setSpatialReference(t.wkid,t.wkt),r.setHasZ(!!t.zColumn),r.setHasM(!!t.mColumn),n.setOptmizationZ(r)}if("xz"===t.type){const r=m(e,t.geometryType),s=e.DisplayOptimizationXZBuilder.new();s.setCodeField(i(t.code)),s.setEncoding(t.encoding),s.setFullExtent(t.fullExtent),s.setGeometryType(r),s.setSpatialReference(t.wkid,t.wkt),s.setMaxLevel(t.maxLevel),s.setHasZ(t.hasZ??!1),s.setHasM(t.hasM??!1);for(const n of t.levels??[]){const[t,r]=n.transform.translate,[a,o]=n.transform.scale,l=new Float64Array([t,r]),c=new Float64Array([a,o]),u=i(n.column);s.addLevel(e.MultiscaleGeometryField.new(n.level,n.scale,u,l,c))}n.setOptmizationXZ(s)}}return n}async function w(e,t){const n=await(0,y.N)(),r=t.geometryInfo?g(n,t.geometryInfo):null,s=t.provider.fetchRange.bind(t.provider),i=t.provider.fetchLength.bind(t.provider);try{return await n.ParquetFile.fromUrl(e,s,i,r)}catch(e){throw new p.A("parquet","Failed to parse file",{error:e})}}function _(e){for(const t of e.compressionCodecs())if(!h.has(t))throw new p.A("parquet:unsupported",`Compression codec ${t} is unsupported. Must be of type ${Array.from(h).join(",")}`)}function F(e,t){if(null!=e){const t=e.primary_column;return{type:"wkb",field:t,orientation:"counterclockwise"===e.columns[t].orientation?"counter-clockwise":null}}const n=function(e){const t=e.map(e=>e.toLowerCase());return{longitudeFieldName:e[t.indexOf(d.A0.find(e=>t.includes(e)))],latitudeFieldName:e[t.indexOf(d.bD.find(e=>t.includes(e)))]}}(t.filter(e=>f.has(e.type)).map(e=>e.name));return n.latitudeFieldName&&n.longitudeFieldName?{type:"location",xField:n.longitudeFieldName,yField:n.latitudeFieldName}:null}function C(e){switch(e){case"Point":return"esriGeometryPoint";case"Polygon":case"MultiPolygon":return"esriGeometryPolygon";case"LineString":return"esriGeometryPolyline";case"MultiPoint":return"esriGeometryMultipoint";default:return null}}function b(e){switch(e.toLowerCase()){case"polygon":return"polygon";case"polyline":return"polyline";case"multipoint":return"multipoint";default:throw new p.A("parquet:unsupported",`Geometry type ${e} is unsupported`)}}function x(e,t,n){if(!n)return null;const r=e?e.columns[e.primary_column]:null,s=r?.bbox;if(s)switch(s.length){case 4:return{xmin:s[0],ymin:s[1],xmax:s[2],ymax:s[3],spatialReference:n};case 6:return{xmin:s[0],ymin:s[1],xmax:s[3],ymax:s[4],spatialReference:n};default:throw new p.A("parquet:protocol-violation","Invalid Geoparquet file. BoundingBox size must be 4 or 6.",{bbox:s})}const i=t?.index.fullExtent;return i?{...i,spatialReference:n}:null}class q{static async create(e,t,n,r,s){if(!s){const s=await w(n,{geometryInfo:e,provider:t}),i=u.fromFile(s);return new q(e,t,n,r,i,Promise.resolve(s))}return new q(e,t,n,r,s,null)}constructor(e,t,n,r,s,i){this._geometryInfo=e,this._provider=t,this.url=n,this.id=r,this.statistics=s,this._file=i}destroy(){null!=this._file&&this._file.then(e=>e.free())}get file(){return null==this._file&&(this._file=w(this.url,{geometryInfo:this._geometryInfo,provider:this._provider})),this._file}}const v="_spatial.json",P=new a.QueueProcessor({concurrency:12,process:async e=>{const{data:t}=await(0,r.A)(e.url,e.options);return t}});class A{constructor(e,t=()=>{}){this._geometryInfo=e,this._getCustomParameters=t}async destroy(){await this.clear()}async clear(){if(this._infos){const e=await this._infos;for(const t of e.values())t.destroy();e.clear(),this._infos=null}}async getMetadata(){const e={stack:[],error:void 0,hasError:!1};try{const t=(await this._getParquetFileNames()).at(0);return t?function(e){_(e);const t=function(e){return e.fields(!1).map(e=>({name:e.name,alias:e.name,type:e.type}))}(e),n=function(e){const t=e.keyValueMetadata("geo");return null!=t?JSON.parse(t):null}(e),r=function(e){if(e.keyValueMetadata("esri"))throw new p.A("parquet:unsupported","File was created using an unsupported experimental display index. Please regenerate the file.");const t=e.keyValueMetadata("geodisplay");if(null!=t)return JSON.parse(t);const n=e.keyValueMetadata("org.apache.spark.sql.parquet.row.metadata");if(null!=n){const e=JSON.parse(n);for(const t of e.fields)if(null!=t.metadata&&"type"in t.metadata&&("xz"===t.metadata.type||"z"===t.metadata.type)){const e={parentColumn:t.name,index:t.metadata};if("xz"===e.index.type&&(e.index.geometryType=b(e.index.geometryType),"esri-pbf"===e.index.encoding&&(e.index.encoding="esriPBF"),"esriPBF"!==e.index.encoding))throw new p.A("parquet:unsupported",`Encoding for display index must be of type esriPBF, but found ${e.index.encoding}`);return e}}return null}(e),s=F(n,t);let i,a;if(s)switch(s.type){case"location":a={wkid:4326},i="esriGeometryPoint";break;case"wkb":if(n){const e=n.primary_column,t=n.columns[e];i=function(e){const{geometry_types:t}=e,n=new Set;for(const e of t){const t=C(e);t&&n.add(t)}if(n.size>1)throw new p.A("parquet:unsupported","Parquet mixed geometry types are not supported",{geometryTypes:n});return 1===n.size?n.values().next().value:void 0}(t),a=function(e){const t=e.crs?.id?.code;return t&&"number"==typeof t?{wkid:t}:void 0}(t)}}if(r){const e=r.index;!a&&e.wkid&&(a={wkid:e.wkid}),i||(i="z"===e.type?"esriGeometryPoint":function(e){switch(e){case"polygon":return"esriGeometryPolygon";case"polyline":return"esriGeometryPolyline";case"multipoint":return"esriGeometryMultipoint"}}(e.geometryType))}return{geoMetadata:n,displayOptimization:r,geometryEncoding:s,geometryInfo:a&&i?{geometry:s?{geometryType:i,spatialReference:a,encoding:s}:null,displayOptimization:r}:null,geometryType:i,spatialReference:a,extent:x(n,r,a),fields:t}}((0,s.mS)(e,await w(t,{provider:this}),!1)):null}catch(t){e.error=t,e.hasError=!0}finally{(0,s.hk)(e)}}getGeometryInfo(){return this._geometryInfo}async getFiles(){const e=await this._getInfoMap();return Array.from(e.values())}async updateGeometryInfo(e){if(this._geometryInfo)throw new Error("GeometryInfo already set");await this.clear(),this._geometryInfo=e}async fetchLength(e){const{byteLength:t,cacheTag:n}=await this._fetchLengthAndTag(e);if(!(0,i.A)("parquetlayer-cache-enabled"))return t;try{await this._createOrResetCache(e,n)}catch(e){}return t}async fetchRange(e,t,n,r){if(!(0,i.A)("parquetlayer-cache-enabled"))return this._fetchRange(e,t,n,r);const s=new URL(this._getCacheFileName(e));s.searchParams.append("range",`${t}-${n}`);try{const i=await this._openCache(e),a=await i.match(s);if(a)return await a.arrayBuffer();const o=await this._fetchRange(e,t,n,r);return await i.put(s,new Response(o,{headers:{"Content-Type":"application/octet-stream","Content-Length":o.byteLength.toString()}})),o}catch(s){return this._fetchRange(e,t,n,r)}}_getCacheFileName(e){return e}async _requestStatistics(e){const{data:t}=await(0,r.A)(e,{responseType:"json",query:this._getCustomParameters()});return t}async _fetchRange(e,t,n,r){const s={url:e,options:{responseType:"array-buffer",query:this._getCustomParameters()??{},cacheMode:"no-store",useQueue:!0,headers:{range:`bytes=${t}-${n}`}}};return P.push(s)}async _fetchLengthAndTag(e){if((0,o.w8)(e)){const{data:t}=await(0,r.A)(e,{responseType:"blob"});return{byteLength:t.size,cacheTag:null}}const t=await this._requestHead(e),n=t.headers.get("Content-Length");if(null==n)throw new Error("Unable to parse content length");const s=t.headers.get("etag")??t.headers.get("Last-Modified");return{byteLength:parseInt(n,10),cacheTag:s}}async _getInfoMap(){return this._infos||(this._infos=this._fetchParquetFiles()),this._infos}async _updateParquetFileInfos(e){const t=await this._getInfoMap(),n=new Set(e);for(const e of n)if(!t.get(e)){const n=t.size,r=await q.create(this.getGeometryInfo(),this,e,n,null);t.set(e,r)}for(const e of t.keys())if(!n.has(e))throw new Error("Deletion not supported")}async _getFileStatistics(e){this._statistics||(this._statistics=this._fetchStatistics());const t=await this._statistics,n=function(e){return e.split(/[?#]/)[0].split("/").at(-1)??e}(e);return t.get(n)}async _fetchParquetFiles(){const e=(await this._getParquetFileNames()).map(async(e,t)=>{const n=t,r=await this._getFileStatistics(e);return q.create(this.getGeometryInfo(),this,e,n,r)}),t=await Promise.all(e),n=new Map;for(const e of t)n.set(e.url,e);return n}async _fetchStatistics(){const e=await this._getStatisticsFileName();if(null==e)return new Map;const t=await this._resolveFileUrl(e);return l(await this._requestStatistics(t))}async _requestHead(e){const{data:t}=await(0,r.A)(e,{responseType:"native",method:"head",query:this._getCustomParameters()});return t}async _openCache(e){return caches.open(this._getCacheName(e))}_getCacheName(e){return`parquet.v1:${this._getCacheFileName(e)}`}async _createOrResetCache(e,t){const n=this._getCacheName(e),r=new URL(this._getCacheFileName(e));if(r.searchParams.append("metadata","true"),null==t)return void await caches.delete(n);let s=await caches.open(n);const i=await s.match(r),a=await(i?.json());a?.tag!==t&&(await caches.delete(n),s=await caches.open(n));const o=JSON.stringify({tag:t});await s.put(r,new Response(o,{headers:{"Content-Type":"application/json","Content-Length":o.length.toString()}}))}}function R(e){const t=e.split(/[?#]/)[0];return t===v||t.endsWith(v)}var U=n(39131);class T extends A{constructor(e,t,n){super(t,n),this._schema=e,this._isAgol=!!(0,U.py)(this._schema.itemUrl)}async update(e){throw new Error("Unsupported")}async _getParquetFileNames(){return[`${this._baseUrl}/data`]}async _getStatisticsFileName(){return null}_getCacheFileName(e){return`${this._baseUrl}/data`}async _resolveFileUrl(e){return this._resolvedUrl||(this._resolvedUrl=this._fetchResolvedUrl()),this._resolvedUrl}async _fetchLengthAndTag(e){const t=await super._fetchLengthAndTag(e);return t.cacheTag=this._schema.modified.getTime().toString(),t}async _fetchRange(e,t,n,r){try{const s=await this._resolveFileUrl(e);return await super._fetchRange(s,t,n,r)}catch{this._resolvedUrl=null}const s=await this._resolveFileUrl(e);return super._fetchRange(s,t,n,r)}get _baseUrl(){return this._schema.itemCdnUrl??this._schema.itemUrl}async _fetchResolvedUrl(){return this._isAgol?(await(0,r.A)(`${this._baseUrl}/data`,{query:{signedurl:!0,expiration:9,f:"json"}})).data.signedUrl:`${this._baseUrl}/data`}}class G extends A{constructor(e,t,n){super(t,n),this._schema=e}get _baseUrl(){return this._schema.itemCdnUrl??this._schema.itemUrl}async update(e){throw new Error("Unsupported")}async _getParquetFileNames(){const e=await this._getResources();return Array.from(e.keys()).filter(e=>e.endsWith(".parquet"))}async _getStatisticsFileName(){const e=await this._getResources();return Array.from(e.keys()).find(R)??null}_getCacheFileName(e){return`${this._baseUrl}/resources/${e}`}async _resolveFileUrl(e){const t=await this._getResource(e);return t.signedUrl?t.signedUrl:`${this._baseUrl}/resources/${e}`}async _fetchLengthAndTag(e){const t=await this._getResource(e),n=this._schema.itemMetadata.modified.getTime().toString();return{byteLength:t.size,cacheTag:n}}async _fetchRange(e,t,n,r){try{const s=await this._resolveFileUrl(e);return await super._fetchRange(s,t,n,r)}catch{this._invalidate()}const s=await this._resolveFileUrl(e);return super._fetchRange(s,t,n,r)}_invalidate(){this._resources=null}async _getResources(){return this._resources||(this._resources=this._fetchResources()),await this._resources}async _getResource(e){const t=(await this._getResources()).get(e);if(!t)throw new Error(`Resource ${e} not found.`);return t}async _fetchResources(){const e=new Map;let t=1;const n=function(e){const t=e.split("/").filter(Boolean),n=t.indexOf("resources");if(-1===n||n===t.length-1)throw new Error(`URL does not contain a resources directory name: ${e}`);return`${t.slice(n+1).map(e=>decodeURIComponent(e)).join("/")}/`}(this._schema.itemMetadata.url);for(;-1!==t;){const s=await(0,r.A)(`${this._baseUrl}/resources`,{query:{f:"json",start:t,num:100}});for(const t of s.data.resources)t.resource.startsWith(n)&&e.set(t.resource,t);t=s.data.nextStart}return e}}class M extends A{constructor(e,t=null,n=()=>{}){super(t,n),this._schema=e}async update(e){await this._updateParquetFileInfos(await this._getParquetFileNames()),this._schema=e}async _resolveFileUrl(e){return e}async _getParquetFileNames(){return this._schema.urls.filter(e=>e.startsWith("blob:")||e.endsWith(".parquet"))}async _getStatisticsFileName(){return this._schema.urls.find(R)??null}}function k(e,t,n){switch(e.type){case"urls":return new M(e,t,n);case"portal-parquet-file":return new T(e,t,n);case"portal-parquet-layer":return new G(e,t,n)}}},34582(e,t,n){n.d(t,{A:()=>o});var r=n(5482),s=n(69540),i=n(25482),a=n(91429);let o=class extends((0,s.OU)(i.o)){constructor(e){super(e),this.type="wkb",this.field=null}};(0,r.Cg)([(0,a.MZ)({type:["wkb"],nonNullable:!0,readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],o.prototype,"type",void 0),(0,r.Cg)([(0,a.MZ)({type:["counter-clockwise"],json:{write:!0}})],o.prototype,"orientation",void 0),(0,r.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],o.prototype,"field",void 0),o=(0,r.Cg)([(0,a.$K)("esri.layers.support.GeometryEncodingWkb")],o)},56370(e,t,n){n.d(t,{A:()=>d});var r=n(5482),s=n(69540),i=n(7762),a=n(49186),o=n(25482),l=n(91429),c=n(64108),u=n(97159),p=n(43937);let d=class extends((0,o.T)(s.Pw)){constructor(e){super(e),this.type="files",this.urls=new i.A}writeUrls(e,t,n,r){const s=e.toArray().map(e=>(0,u.t)(e,r)).filter(e=>!!e);s.length?t.urls=s:r.messages?.push(new a.A("parquet-layer:missing-urls","Missing or empty 'urls'",{data:this}))}};(0,r.Cg)([(0,l.MZ)({type:["files"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],d.prototype,"type",void 0),(0,r.Cg)([(0,l.MZ)({type:i.A.ofType(String),json:{write:{isRequired:!0}}})],d.prototype,"urls",void 0),(0,r.Cg)([(0,p.K)("urls")],d.prototype,"writeUrls",null),d=(0,r.Cg)([(0,c.$)("esri.layers.support.ParquetFilesData")],d)},50639(e,t,n){n.d(t,{G:()=>i});var r=n(9075),s=n(34582);function i(e){switch(e.type){case"wkb":return s.A.fromJSON(e);case"location":return r.A.fromJSON(e)}}},42760(e,t,n){n.d(t,{Dt:()=>y,hG:()=>p,nc:()=>d,sA:()=>u,ye:()=>c}),n(7762);var r=n(49186),s=n(66552),i=n(16930),a=(n(90951),n(20437)),o=n(30524),l=n(50639);n(56370);const c=new s.J({esriGeometryPoint:"point",esriGeometryPolygon:"polygon",esriGeometryPolyline:"polyline",esriGeometryMultipoint:"multipoint"});function u(e){return c.toJSON(e)}function p(e){return c.fromJSON(e)}async function d(e,t){if(t.geometryType&&t.spatialReference&&t.geometryEncoding&&t.fields)return t;if(!e)throw new r.A("parquet:bad-input","No metadata found");const n={...t};if(null==n.fields&&(n.fields=e.fields.map(e=>a.A.fromJSON(e))),null!=n.geometryEncoding){const e=n.geometryEncoding;switch(e.type){case"wkb":{const t=n.fields.find(t=>t.name===e.field);if(!t)throw new r.A("parquet:unsupported",`Geometry encoding references field ${e.field} which does not exist`);if("blob"!==t.type)throw new r.A("parquet:unsupported",`Invalid field type for geometry encoding. Found ${t.type} but expected 'blob'`);break}case"location":for(const t of[e.xField,e.yField])if(null!=t){const e=n.fields.find(e=>e.name===t);if(!e)throw new r.A("parquet:unsupported",`Geometry encoding references field ${t} which does not exist`);if(!(0,o.WA)(e))throw new r.A("parquet:unsupported",`Invalid field type for location geometry encoding. Found ${e.type} but expected a numeric`)}}}return null==n.geometryEncoding&&(n.geometryEncoding=e.geometryEncoding?(0,l.G)(e.geometryEncoding):null),n.fields=function(e,t){const n=t.geoMetadata;if(null==n)return e;const r=new Set(Object.keys(n.columns));return e.filter(e=>!r.has(e.name))}(n.fields,e),e.displayOptimization&&(n.displayOptimization=e.displayOptimization),!n.geometryType&&e.geometryType&&(n.geometryType=p(e.geometryType)),!n.spatialReference&&e.spatialReference&&(n.spatialReference=i.A.fromJSON(e.spatialReference)),n}async function y(e,t){switch(e.type){case"files":return{type:"urls",urls:e.urls.toArray()};case"portal-item":{const n=await e.portalItem.load(t);switch(n.type){case"Apache Parquet":return{type:"portal-parquet-file",itemUrl:n.itemUrl,itemCdnUrl:n.itemCdnUrl,modified:n.modified,size:n.size};case"Parquet layer":case"Parquet Layer":case"Parquet feature layer":case"Parquet Feature Layer":if(!n.url)throw new r.A("parquet:bad-item",`Item of type ${n.type} must have a url defined`,n);return{type:"portal-parquet-layer",itemUrl:n.itemUrl,itemCdnUrl:n.itemCdnUrl,itemMetadata:{modified:n.modified,url:n.url}};default:throw new r.A("parquet:bad-item",`Item of type ${n.type} is not supported`,n)}}}}}}]);
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[2760],{90951(e,t,n){n.d(t,{M:()=>k});var r=n(11254),s=n(5482),i=n(44208),a=n(563),o=n(84952);function l(e){const t=new Map;for(const n of e.files){const e=c(n);t.set(n.name,e)}return t}function c(e){const t=new Map;for(const n of e.statistics??[]){const e=n.column.at(-1);null!=e&&t.set(e,{minValue:n.minValue,maxValue:n.maxValue,nullCount:n.nullCount??0,distinctCount:n.distinctCount??null})}return new u(0,0,t)}class u{static fromFile(e){const t=e.numRows(),n=e.byteLength(),r=new Map;for(const t of e.getColumnDescriptors()){const e=t.minValue(),n=t.maxValue(),s=t.distinctCount(),i=t.nullCount();null!=e&&null!=n&&null!=s&&null!=i&&r.set(t.name(),{minValue:e,maxValue:n,distinctCount:s,nullCount:i}),t.free()}return new u(t,n,r)}constructor(e,t,n){this.rowCount=e,this.byteSize=t,this.statistics=n}}var d=n(49186),p=n(54625),y=n(39412);const h=new Set(["uncompressed","snappy","gzip"]),f=new Set(["esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeBigInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeLong"]);function m(e,t){switch(t){case"esriGeometryPoint":return e.GeometryType.Point;case"esriGeometryPolygon":case"polygon":return e.GeometryType.Polygon;case"esriGeometryPolyline":case"polyline":return e.GeometryType.Polyline;case"esriGeometryMultipoint":case"multipoint":return e.GeometryType.Multipoint;default:throw new d.A("parquet",`Found unexpected GeometryType: ${t}`)}}function g(e,t){const n=e.GeometryInfo.new();t.geometry&&n.setGeometry(function(e,t){const n=t.encoding,r=m(e,t.geometryType),s=t.spatialReference.wkid;if(null==s)throw new Error("InternalError: Wkid must be defined.");switch(n.type){case"wkb":return e.GeometryField.fromWkb(n.field,s,r);case"location":{const{yField:t,xField:i}=n;return e.GeometryField.fromLocation(t,i,s,r)}}}(e,t.geometry));const r=t.displayOptimization;if(r){const{index:t,parentColumn:s}=r,i=e=>null!=s?[s,e].join("."):e;if("z"===t.type){const r=e.DisplayOptimizationZBuilder.new();r.setCodeField(i(t.code)),r.setXColumn(i(t.xColumn)),r.setYColumn(i(t.yColumn)),r.setCooordinatePrecision(t.coordinatePrecision),r.setFullExtent(t.fullExtent),r.setSpatialReference(t.wkid,t.wkt),r.setHasZ(!!t.zColumn),r.setHasM(!!t.mColumn),n.setOptmizationZ(r)}if("xz"===t.type){const r=m(e,t.geometryType),s=e.DisplayOptimizationXZBuilder.new();s.setCodeField(i(t.code)),s.setEncoding(t.encoding),s.setFullExtent(t.fullExtent),s.setGeometryType(r),s.setSpatialReference(t.wkid,t.wkt),s.setMaxLevel(t.maxLevel),s.setHasZ(t.hasZ??!1),s.setHasM(t.hasM??!1);for(const n of t.levels??[]){const[t,r]=n.transform.translate,[a,o]=n.transform.scale,l=new Float64Array([t,r]),c=new Float64Array([a,o]),u=i(n.column);s.addLevel(e.MultiscaleGeometryField.new(n.level,n.scale,u,l,c))}n.setOptmizationXZ(s)}}return n}async function w(e,t){const n=await(0,y.N)(),r=t.geometryInfo?g(n,t.geometryInfo):null,s=t.provider.fetchRange.bind(t.provider),i=t.provider.fetchLength.bind(t.provider);try{return await n.ParquetFile.fromUrl(e,s,i,r)}catch(e){throw new d.A("parquet","Failed to parse file",{error:e})}}function _(e){for(const t of e.compressionCodecs())if(!h.has(t))throw new d.A("parquet:unsupported",`Compression codec ${t} is unsupported. Must be of type ${Array.from(h).join(",")}`)}function F(e,t){if(null!=e){const t=e.primary_column;return{type:"wkb",field:t,orientation:"counterclockwise"===e.columns[t].orientation?"counter-clockwise":null}}const n=function(e){const t=e.map(e=>e.toLowerCase());return{longitudeFieldName:e[t.indexOf(p.A0.find(e=>t.includes(e)))],latitudeFieldName:e[t.indexOf(p.bD.find(e=>t.includes(e)))]}}(t.filter(e=>f.has(e.type)).map(e=>e.name));return n.latitudeFieldName&&n.longitudeFieldName?{type:"location",xField:n.longitudeFieldName,yField:n.latitudeFieldName}:null}function C(e){switch(e){case"Point":return"esriGeometryPoint";case"Polygon":case"MultiPolygon":return"esriGeometryPolygon";case"LineString":return"esriGeometryPolyline";case"MultiPoint":return"esriGeometryMultipoint";default:return null}}function b(e){switch(e.toLowerCase()){case"polygon":return"polygon";case"polyline":return"polyline";case"multipoint":return"multipoint";default:throw new d.A("parquet:unsupported",`Geometry type ${e} is unsupported`)}}function x(e,t,n){if(!n)return null;const r=e?e.columns[e.primary_column]:null,s=r?.bbox;if(s)switch(s.length){case 4:return{xmin:s[0],ymin:s[1],xmax:s[2],ymax:s[3],spatialReference:n};case 6:return{xmin:s[0],ymin:s[1],xmax:s[3],ymax:s[4],spatialReference:n};default:throw new d.A("parquet:protocol-violation","Invalid Geoparquet file. BoundingBox size must be 4 or 6.",{bbox:s})}const i=t?.index.fullExtent;return i?{...i,spatialReference:n}:null}class v{static async create(e,t,n,r,s){if(!s){const s=await w(n,{geometryInfo:e,provider:t}),i=u.fromFile(s);return new v(e,t,n,r,i,Promise.resolve(s))}return new v(e,t,n,r,s,null)}constructor(e,t,n,r,s,i){this._geometryInfo=e,this._provider=t,this.url=n,this.id=r,this.statistics=s,this._file=i}destroy(){null!=this._file&&this._file.then(e=>e.free())}get file(){return null==this._file&&(this._file=w(this.url,{geometryInfo:this._geometryInfo,provider:this._provider})),this._file}}const q="_spatial.json",P=new a.QueueProcessor({concurrency:12,process:async e=>{const{data:t}=await(0,r.A)(e.url,e.options);return t}});class A{constructor(e,t=()=>{}){this._geometryInfo=e,this._getCustomParameters=t}async destroy(){await this.clear()}async clear(){if(this._infos){const e=await this._infos;for(const t of e.values())t.destroy();e.clear(),this._infos=null}}async getMetadata(){const e={stack:[],error:void 0,hasError:!1};try{const t=(await this._getParquetFileNames()).at(0);return t?function(e){_(e);const t=function(e){return e.fields(!1).map(e=>({name:e.name,alias:e.name,type:e.type}))}(e),n=function(e){const t=e.keyValueMetadata("geo");return null!=t?JSON.parse(t):null}(e),r=function(e){if(e.keyValueMetadata("esri"))throw new d.A("parquet:unsupported","File was created using an unsupported experimental display index. Please regenerate the file.");const t=e.keyValueMetadata("geodisplay");if(null!=t)return JSON.parse(t);const n=e.keyValueMetadata("org.apache.spark.sql.parquet.row.metadata");if(null!=n){const e=JSON.parse(n);for(const t of e.fields)if(null!=t.metadata&&"type"in t.metadata&&("xz"===t.metadata.type||"z"===t.metadata.type)){const e={parentColumn:t.name,index:t.metadata};if("xz"===e.index.type&&(e.index.geometryType=b(e.index.geometryType),"esri-pbf"===e.index.encoding&&(e.index.encoding="esriPBF"),"esriPBF"!==e.index.encoding))throw new d.A("parquet:unsupported",`Encoding for display index must be of type esriPBF, but found ${e.index.encoding}`);return e}}return null}(e),s=F(n,t);let i,a;if(s)switch(s.type){case"location":a={wkid:4326},i="esriGeometryPoint";break;case"wkb":if(n){const e=n.primary_column,t=n.columns[e];i=function(e){const{geometry_types:t}=e,n=new Set;for(const e of t){const t=C(e);t&&n.add(t)}if(n.size>1)throw new d.A("parquet:unsupported","Parquet mixed geometry types are not supported",{geometryTypes:n});return 1===n.size?n.values().next().value:void 0}(t),a=function(e){const t=e.crs?.id?.code;return t&&"number"==typeof t?{wkid:t}:void 0}(t)}}if(r){const e=r.index;!a&&e.wkid&&(a={wkid:e.wkid}),i||(i="z"===e.type?"esriGeometryPoint":function(e){switch(e){case"polygon":return"esriGeometryPolygon";case"polyline":return"esriGeometryPolyline";case"multipoint":return"esriGeometryMultipoint"}}(e.geometryType))}return{geoMetadata:n,displayOptimization:r,geometryEncoding:s,geometryInfo:a&&i?{geometry:s?{geometryType:i,spatialReference:a,encoding:s}:null,displayOptimization:r}:null,geometryType:i,spatialReference:a,extent:x(n,r,a),fields:t}}((0,s.mS)(e,await w(t,{provider:this}),!1)):null}catch(t){e.error=t,e.hasError=!0}finally{(0,s.hk)(e)}}getGeometryInfo(){return this._geometryInfo}async getFiles(){const e=await this._getInfoMap();return Array.from(e.values())}async updateGeometryInfo(e){if(this._geometryInfo)throw new Error("GeometryInfo already set");await this.clear(),this._geometryInfo=e}async fetchLength(e){const{byteLength:t,cacheTag:n}=await this._fetchLengthAndTag(e);if(!(0,i.A)("parquetlayer-cache-enabled"))return t;try{await this._createOrResetCache(e,n)}catch(e){}return t}async fetchRange(e,t,n,r){if(!(0,i.A)("parquetlayer-cache-enabled"))return this._fetchRange(e,t,n,r);const s=new URL(this._getCacheFileName(e));s.searchParams.append("range",`${t}-${n}`);try{const i=await this._openCache(e),a=await i.match(s);if(a)return await a.arrayBuffer();const o=await this._fetchRange(e,t,n,r);return await i.put(s,new Response(o,{headers:{"Content-Type":"application/octet-stream","Content-Length":o.byteLength.toString()}})),o}catch(s){return this._fetchRange(e,t,n,r)}}_getCacheFileName(e){return e}async _requestStatistics(e){const{data:t}=await(0,r.A)(e,{responseType:"json",query:this._getCustomParameters()});return t}async _fetchRange(e,t,n,r){const s={url:e,options:{responseType:"array-buffer",query:this._getCustomParameters()??{},cacheMode:"no-store",useQueue:!0,headers:{range:`bytes=${t}-${n}`}}};return P.push(s)}async _fetchLengthAndTag(e){if((0,o.w8)(e)){const{data:t}=await(0,r.A)(e,{responseType:"blob"});return{byteLength:t.size,cacheTag:null}}const t=await this._requestHead(e),n=t.headers.get("Content-Length");if(null==n)throw new Error("Unable to parse content length");const s=t.headers.get("etag")??t.headers.get("Last-Modified");return{byteLength:parseInt(n,10),cacheTag:s}}async _getInfoMap(){return this._infos||(this._infos=this._fetchParquetFiles()),this._infos}async _updateParquetFileInfos(e){const t=await this._getInfoMap(),n=new Set(e);for(const e of n)if(!t.get(e)){const n=t.size,r=await v.create(this.getGeometryInfo(),this,e,n,null);t.set(e,r)}for(const e of t.keys())if(!n.has(e))throw new Error("Deletion not supported")}async _getFileStatistics(e){this._statistics||(this._statistics=this._fetchStatistics());const t=await this._statistics,n=function(e){return e.split(/[?#]/)[0].split("/").at(-1)??e}(e);return t.get(n)}async _fetchParquetFiles(){const e=(await this._getParquetFileNames()).map(async(e,t)=>{const n=t,r=await this._getFileStatistics(e);return v.create(this.getGeometryInfo(),this,e,n,r)}),t=await Promise.all(e),n=new Map;for(const e of t)n.set(e.url,e);return n}async _fetchStatistics(){const e=await this._getStatisticsFileName();if(null==e)return new Map;const t=await this._resolveFileUrl(e);return l(await this._requestStatistics(t))}async _requestHead(e){const{data:t}=await(0,r.A)(e,{responseType:"native",method:"head",query:this._getCustomParameters()});return t}async _openCache(e){return caches.open(this._getCacheName(e))}_getCacheName(e){return`parquet.v1:${this._getCacheFileName(e)}`}async _createOrResetCache(e,t){const n=this._getCacheName(e),r=new URL(this._getCacheFileName(e));if(r.searchParams.append("metadata","true"),null==t)return void await caches.delete(n);let s=await caches.open(n);const i=await s.match(r),a=await(i?.json());a?.tag!==t&&(await caches.delete(n),s=await caches.open(n));const o=JSON.stringify({tag:t});await s.put(r,new Response(o,{headers:{"Content-Type":"application/json","Content-Length":o.length.toString()}}))}}function R(e){const t=e.split(/[?#]/)[0];return t===q||t.endsWith(q)}var U=n(39131);class T extends A{constructor(e,t,n){super(t,n),this._schema=e,this._isAgol=!!(0,U.py)(this._schema.itemUrl)}async update(e){throw new Error("Unsupported")}async _getParquetFileNames(){return[`${this._baseUrl}/data`]}async _getStatisticsFileName(){return null}_getCacheFileName(e){return`${this._baseUrl}/data`}async _resolveFileUrl(e){return this._resolvedUrl||(this._resolvedUrl=this._fetchResolvedUrl()),this._resolvedUrl}async _fetchLengthAndTag(e){const t=await super._fetchLengthAndTag(e);return t.cacheTag=this._schema.modified.getTime().toString(),t}async _fetchRange(e,t,n,r){try{const s=await this._resolveFileUrl(e);return await super._fetchRange(s,t,n,r)}catch{this._resolvedUrl=null}const s=await this._resolveFileUrl(e);return super._fetchRange(s,t,n,r)}get _baseUrl(){return this._schema.itemCdnUrl??this._schema.itemUrl}async _fetchResolvedUrl(){return this._isAgol?(await(0,r.A)(`${this._baseUrl}/data`,{query:{signedurl:!0,expiration:9,f:"json"}})).data.signedUrl:`${this._baseUrl}/data`}}class G extends A{constructor(e,t,n){super(t,n),this._schema=e}get _baseUrl(){return this._schema.itemCdnUrl??this._schema.itemUrl}async update(e){throw new Error("Unsupported")}async _getParquetFileNames(){const e=await this._getResources();return Array.from(e.keys()).filter(e=>e.endsWith(".parquet"))}async _getStatisticsFileName(){const e=await this._getResources();return Array.from(e.keys()).find(R)??null}_getCacheFileName(e){return`${this._baseUrl}/resources/${e}`}async _resolveFileUrl(e){const t=await this._getResource(e);return t.signedUrl?t.signedUrl:`${this._baseUrl}/resources/${e}`}async _fetchLengthAndTag(e){const t=await this._getResource(e),n=this._schema.itemMetadata.modified.getTime().toString();return{byteLength:t.size,cacheTag:n}}async _fetchRange(e,t,n,r){try{const s=await this._resolveFileUrl(e);return await super._fetchRange(s,t,n,r)}catch{this._invalidate()}const s=await this._resolveFileUrl(e);return super._fetchRange(s,t,n,r)}_invalidate(){this._resources=null}async _getResources(){return this._resources||(this._resources=this._fetchResources()),await this._resources}async _getResource(e){const t=(await this._getResources()).get(e);if(!t)throw new Error(`Resource ${e} not found.`);return t}async _fetchResources(){const e=new Map;let t=1;const n=function(e){const t=e.split("/").filter(Boolean),n=t.indexOf("resources");if(-1===n||n===t.length-1)throw new Error(`URL does not contain a resources directory name: ${e}`);return`${t.slice(n+1).map(e=>decodeURIComponent(e)).join("/")}/`}(this._schema.itemMetadata.url);for(;-1!==t;){const s=await(0,r.A)(`${this._baseUrl}/resources`,{query:{f:"json",start:t,num:100}});for(const t of s.data.resources)t.resource.startsWith(n)&&e.set(t.resource,t);t=s.data.nextStart}return e}}class M extends A{constructor(e,t=null,n=()=>{}){super(t,n),this._schema=e}async update(e){await this._updateParquetFileInfos(await this._getParquetFileNames()),this._schema=e}async _resolveFileUrl(e){return e}async _getParquetFileNames(){return this._schema.urls.filter(e=>!e.endsWith(".json"))}async _getStatisticsFileName(){return this._schema.urls.find(R)??null}}function k(e,t,n){switch(e.type){case"urls":return new M(e,t,n);case"portal-parquet-file":return new T(e,t,n);case"portal-parquet-layer":return new G(e,t,n)}}},34582(e,t,n){n.d(t,{A:()=>o});var r=n(5482),s=n(69540),i=n(25482),a=n(91429);let o=class extends((0,s.OU)(i.o)){constructor(e){super(e),this.type="wkb",this.field=null}};(0,r.Cg)([(0,a.MZ)({type:["wkb"],nonNullable:!0,readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],o.prototype,"type",void 0),(0,r.Cg)([(0,a.MZ)({type:["counter-clockwise"],json:{write:!0}})],o.prototype,"orientation",void 0),(0,r.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],o.prototype,"field",void 0),o=(0,r.Cg)([(0,a.$K)("esri.layers.support.GeometryEncodingWkb")],o)},56370(e,t,n){n.d(t,{A:()=>p});var r=n(5482),s=n(69540),i=n(7762),a=n(49186),o=n(25482),l=n(91429),c=n(64108),u=n(97159),d=n(43937);let p=class extends((0,o.T)(s.Pw)){constructor(e){super(e),this.type="files",this.urls=new i.A}writeUrls(e,t,n,r){const s=e.toArray().map(e=>(0,u.t)(e,r)).filter(e=>!!e);s.length?t.urls=s:r.messages?.push(new a.A("parquet-layer:missing-urls","Missing or empty 'urls'",{data:this}))}};(0,r.Cg)([(0,l.MZ)({type:["files"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],p.prototype,"type",void 0),(0,r.Cg)([(0,l.MZ)({type:i.A.ofType(String),json:{write:{isRequired:!0}}})],p.prototype,"urls",void 0),(0,r.Cg)([(0,d.K)("urls")],p.prototype,"writeUrls",null),p=(0,r.Cg)([(0,c.$)("esri.layers.support.ParquetFilesData")],p)},50639(e,t,n){n.d(t,{G:()=>i});var r=n(9075),s=n(34582);function i(e){switch(e.type){case"wkb":return s.A.fromJSON(e);case"location":return r.A.fromJSON(e)}}},42760(e,t,n){n.d(t,{Dt:()=>y,hG:()=>d,nc:()=>p,sA:()=>u,ye:()=>c}),n(7762);var r=n(49186),s=n(66552),i=n(16930),a=(n(90951),n(20437)),o=n(30524),l=n(50639);n(56370);const c=new s.J({esriGeometryPoint:"point",esriGeometryPolygon:"polygon",esriGeometryPolyline:"polyline",esriGeometryMultipoint:"multipoint"});function u(e){return c.toJSON(e)}function d(e){return c.fromJSON(e)}async function p(e,t){if(t.geometryType&&t.spatialReference&&t.geometryEncoding&&t.fields)return t;if(!e)throw new r.A("parquet:bad-input","No metadata found");const n={...t};if(null==n.fields&&(n.fields=e.fields.map(e=>a.A.fromJSON(e))),null!=n.geometryEncoding){const e=n.geometryEncoding;switch(e.type){case"wkb":{const t=n.fields.find(t=>t.name===e.field);if(!t)throw new r.A("parquet:unsupported",`Geometry encoding references field ${e.field} which does not exist`);if("blob"!==t.type)throw new r.A("parquet:unsupported",`Invalid field type for geometry encoding. Found ${t.type} but expected 'blob'`);break}case"location":for(const t of[e.xField,e.yField])if(null!=t){const e=n.fields.find(e=>e.name===t);if(!e)throw new r.A("parquet:unsupported",`Geometry encoding references field ${t} which does not exist`);if(!(0,o.WA)(e))throw new r.A("parquet:unsupported",`Invalid field type for location geometry encoding. Found ${e.type} but expected a numeric`)}}}return null==n.geometryEncoding&&(n.geometryEncoding=e.geometryEncoding?(0,l.G)(e.geometryEncoding):null),n.fields=function(e,t){const n=t.geoMetadata;if(null==n)return e;const r=new Set(Object.keys(n.columns));return e.filter(e=>!r.has(e.name))}(n.fields,e),e.displayOptimization&&(n.displayOptimization=e.displayOptimization),!n.geometryType&&e.geometryType&&(n.geometryType=d(e.geometryType)),!n.spatialReference&&e.spatialReference&&(n.spatialReference=i.A.fromJSON(e.spatialReference)),n}async function y(e,t){switch(e.type){case"files":return{type:"urls",urls:e.urls.toArray()};case"portal-item":{const n=await e.portalItem.load(t);switch(n.type){case"Apache Parquet":return{type:"portal-parquet-file",itemUrl:n.itemUrl,itemCdnUrl:n.itemCdnUrl,modified:n.modified,size:n.size};case"Parquet layer":case"Parquet Layer":case"Parquet feature layer":case"Parquet Feature Layer":if(!n.url)throw new r.A("parquet:bad-item",`Item of type ${n.type} must have a url defined`,n);return{type:"portal-parquet-layer",itemUrl:n.itemUrl,itemCdnUrl:n.itemCdnUrl,itemMetadata:{modified:n.modified,url:n.url}};default:throw new r.A("parquet:bad-item",`Item of type ${n.type} is not supported`,n)}}}}}}]);
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{EmissionDimming as o}from"../views/3d/webgl-engine/core/shaderLibrary/util/EmissionDimming.glsl.js";import{If as s,glsl as r}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DPassUniform as i}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{NoParameters as t}from"../views/webgl/NoParameters.js";import{ShaderBuilder as a}from"../views/webgl/ShaderBuilder.js";class l extends t{}function n(t){const l=new a;l.include(e);const{hasEmission:n}=t,m=l.fragment;return n&&m.include(o),m.uniforms.add(new i("colorTexture",e=>e.color),new i("splatOutputColor",e=>e.splatColor)),n&&m.uniforms.add(new i("emissionTexture",e=>e.emission)),l.outputs.add("fragColor","vec4",0),n&&l.outputs.add("fragEmission","vec4",1),l.fragment.main.add(r`
2
+ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{emissionDimming as o}from"../views/3d/webgl-engine/core/shaderLibrary/util/EmissionDimming.glsl.js";import{If as s,glsl as r}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DPassUniform as i}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{NoParameters as t}from"../views/webgl/NoParameters.js";import{ShaderBuilder as a}from"../views/webgl/ShaderBuilder.js";class l extends t{}function n(t){const l=new a;l.include(e);const{hasEmission:n}=t,m=l.fragment;return n&&m.include(o),m.uniforms.add(new i("colorTexture",e=>e.color),new i("splatOutputColor",e=>e.splatColor)),n&&m.uniforms.add(new i("emissionTexture",e=>e.emission)),l.outputs.add("fragColor","vec4",0),n&&l.outputs.add("fragEmission","vec4",1),l.fragment.main.add(r`
3
3
  vec4 color = texture(colorTexture, uv);
4
4
  vec4 splatColor = texture(splatOutputColor, uv);
5
5
 
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{ReadDepthLastFrame as a}from"../views/3d/webgl-engine/core/shaderLibrary/output/ReadDepthLastFrame.glsl.js";import{Gamma as t}from"../views/3d/webgl-engine/core/shaderLibrary/shading/Gamma.glsl.js";import{addMainLightDirection as r}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{ScreenSpaceRayMarching as o}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js";import{CameraSpace as i}from"../views/3d/webgl-engine/core/shaderLibrary/util/CameraSpace.glsl.js";import{FloatPassUniform as l}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as n,If as s}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Matrix4BindUniform as c}from"../views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js";import{Texture2DBindUniform as m}from"../views/3d/webgl-engine/core/shaderModules/Texture2DBindUniform.js";import{Texture2DPassUniform as h}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{GlobalIlluminationColorQuantization as u}from"../views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationColorQuantization.glsl.js";import{ColorAttachment1 as d}from"../views/webgl/enums.js";import{NoParameters as p}from"../views/webgl/NoParameters.js";import{ShaderBuilder as g}from"../views/webgl/ShaderBuilder.js";const f=.01,x=.008,v=.002,M=.5,y=.02,b=.1,w=.008,W=.012,D=.008,S=40,R=.095,F=.008,j=60,I=2,B=.0039,C=.25,z=.15,G=25,P=.15,T=.5,E=1,$=1,L=16;class O extends p{constructor(){super(...arguments),this.projScale=1,this.scaleGlobalIllumination=1,this.accumulatedFrames=0,this.temporalSampleFrame=0,this.rayMarchMinReach=P,this.rayMarchMaxReach=T,this.rayMarchWorldReach=G,this.rayMarchMinReachEmissionWeight=E,this.rayMarchMaxReachEmissionWeight=$,this.rayMarchMaxSteps=L,this.colorBleedWeight=z}}function V(p){const z=new g,G=z.fragment;return z.include(e),z.include(i),r(G),G.include(a),G.include(t),G.include(u),z.include(o,p),G.uniforms.add(new h("normalMap",e=>e.normalTexture),new h("depthMap",e=>e.depthTexture),new h("lastFrameColorTexture",(e,a)=>a.reprojection.lastFrameColor?.getTexture()),new h("lastFrameDepthTexture",(e,a)=>a.reprojection.lastFrameDepth?.attachment),new m("lastFrameGlobalIlluminationTexture",e=>e.globalIllumination?.getTexture()),new m("lastFrameGlobalIlluminationWeightTexture",e=>e.globalIllumination?.getTexture(d)),new c("reprojectionViewMatrix",e=>e.reprojection.viewMatrix),new c("view",e=>e.camera.viewMatrix),new l("accumulatedFrames",e=>e.accumulatedFrames),new l("temporalSampleFrame",e=>e.temporalSampleFrame),new l("scaleGlobalIllumination",e=>e.scaleGlobalIllumination)),G.uniforms.add(new l("rayMarchMinReach",e=>e.rayMarchMinReach),new l("rayMarchMaxReach",e=>e.rayMarchMaxReach),new l("rayMarchWorldReach",e=>e.rayMarchWorldReach),new l("rayMarchMinReachEmissionWeight",e=>e.rayMarchMinReachEmissionWeight),new l("rayMarchMaxReachEmissionWeight",e=>e.rayMarchMaxReachEmissionWeight),new l("rayMarchMaxSteps",e=>e.rayMarchMaxSteps),new l("colorBleedWeight",e=>e.colorBleedWeight)),p.hasEmission&&G.uniforms.add(new h("lastFrameEmissionTexture",(e,a)=>a.reprojection.lastFrameEmission?.attachment)),G.code.add(n`
2
+ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{ReadDepthLastFrame as a}from"../views/3d/webgl-engine/core/shaderLibrary/output/ReadDepthLastFrame.glsl.js";import{Gamma as t}from"../views/3d/webgl-engine/core/shaderLibrary/shading/Gamma.glsl.js";import{addMainLightDirection as r}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{ScreenSpaceRayMarching as o}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js";import{CameraSpace as i}from"../views/3d/webgl-engine/core/shaderLibrary/util/CameraSpace.glsl.js";import{FloatPassUniform as l}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as n,If as s}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Matrix4BindUniform as c}from"../views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js";import{Texture2DBindUniform as m}from"../views/3d/webgl-engine/core/shaderModules/Texture2DBindUniform.js";import{Texture2DPassUniform as h}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{GlobalIlluminationColorQuantization as u}from"../views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationColorQuantization.glsl.js";import{ColorAttachment1 as d}from"../views/webgl/enums.js";import{NoParameters as p}from"../views/webgl/NoParameters.js";import{ShaderBuilder as g}from"../views/webgl/ShaderBuilder.js";const f=.01,x=.008,v=.002,M=.5,y=.02,b=.1,w=.008,W=.012,D=.008,S=40,R=.095,F=.008,j=60,I=2,B=.0039,C=.25,z=.15,G=25,P=.15,T=.5,E=1,$=1,L=16;class O extends p{constructor(){super(...arguments),this.projScale=1,this.scaleGlobalIllumination=1,this.accumulatedFrames=0,this.temporalSampleFrame=0,this.rayMarchMinReach=P,this.rayMarchMaxReach=T,this.rayMarchWorldReach=G,this.rayMarchMinReachEmissionWeight=E,this.rayMarchMaxReachEmissionWeight=$,this.rayMarchMaxSteps=L,this.colorBleedWeight=z}}function V(p){const z=new g,G=z.fragment;return z.include(e),z.include(i),r(G),G.include(a),G.include(t),G.include(u),z.include(o,p),G.uniforms.add(new h("normalMap",e=>e.normalTexture),new h("depthMap",e=>e.depthTexture),new m("lastFrameColorTexture",e=>e.reprojection.lastFrameColor?.getTexture()),new m("lastFrameDepthTexture",e=>e.reprojection.lastFrameDepth?.attachment),new m("lastFrameGlobalIlluminationTexture",e=>e.globalIllumination?.getTexture()),new m("lastFrameGlobalIlluminationWeightTexture",e=>e.globalIllumination?.getTexture(d)),new c("reprojectionViewMatrix",e=>e.reprojection.viewMatrix),new c("view",e=>e.camera.viewMatrix),new l("accumulatedFrames",e=>e.accumulatedFrames),new l("temporalSampleFrame",e=>e.temporalSampleFrame),new l("scaleGlobalIllumination",e=>e.scaleGlobalIllumination)),G.uniforms.add(new l("rayMarchMinReach",e=>e.rayMarchMinReach),new l("rayMarchMaxReach",e=>e.rayMarchMaxReach),new l("rayMarchWorldReach",e=>e.rayMarchWorldReach),new l("rayMarchMinReachEmissionWeight",e=>e.rayMarchMinReachEmissionWeight),new l("rayMarchMaxReachEmissionWeight",e=>e.rayMarchMaxReachEmissionWeight),new l("rayMarchMaxSteps",e=>e.rayMarchMaxSteps),new l("colorBleedWeight",e=>e.colorBleedWeight)),p.hasEmission&&G.uniforms.add(new m("lastFrameEmissionTexture",e=>e.reprojection.lastFrameEmission?.attachment)),G.code.add(n`
3
3
  float computeIdleColorBlendWeight(float accumulatedFrames) {
4
4
  float idleColorBlendProgress = clamp(
5
5
  accumulatedFrames / ${n.float(S)},
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{If as r,glsl as o}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DPassUniform as a}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{O as t}from"./OITDimOpaque.glsl.js";import{alphaCutoff as l}from"../views/3d/webgl-engine/shaders/alphaCutoff.glsl.js";import{oitResolution as n}from"../views/3d/webgl-engine/shaders/oitResolution.glsl.js";import{ShaderBuilder as c}from"../views/webgl/ShaderBuilder.js";class s extends t{}function u(t){const s=new c;s.include(e);const{frontFaceMask:u,computeHudOcclusion:f,useFloatBlend:i}=t,{fragment:d,outputs:g}=s;d.include(n,t),d.include(l),d.uniforms.add(new a("colorTexture",e=>e.colorTexture),new a("alphaTexture",e=>e.alphaTexture),new a("frontFaceTexture",e=>e.frontFaceTexture));let p=0;return g.add("fragColor","vec4",p++),f&&g.add("fragOcclusion","vec4",p++),d.main.add(o`
2
+ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{If as r,glsl as o}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DPassUniform as a}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{O as t}from"./OITDimOpaque.glsl.js";import{alphaCutoff as l}from"../views/3d/webgl-engine/shaders/alphaCutoff.glsl.js";import{oitResolution as n}from"../views/3d/webgl-engine/shaders/oitResolution.glsl.js";import{ShaderBuilder as s}from"../views/webgl/ShaderBuilder.js";class c extends t{}function u(t){const c=new s;c.include(e);const{frontFaceMask:u,computeHudOcclusion:f,hasOpaqueEmission:i,useFloatBlend:d}=t,{fragment:g,outputs:p}=c;g.include(n,t),g.include(l);let m=0;return p.add("fragColor","vec4",m++),i&&m++,f&&p.add("fragOcclusion","vec4",m++),g.uniforms.add(new a("colorTexture",e=>e.colorTexture),new a("alphaTexture",e=>e.alphaTexture),new a("frontFaceTexture",e=>e.frontFaceTexture)),g.main.add(o`
3
3
  float srcAlpha = texture(alphaTexture, uv).r * floatBlendInputScale;
4
4
  ${r(f,"fragOcclusion = vec4(1.0, 0.0, 0.0, 1.0);")}
5
5
 
@@ -17,9 +17,9 @@ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/Scr
17
17
  `)}
18
18
 
19
19
  vec4 srcColor = texture(colorTexture, uv);
20
- ${r(!i,"float frontWeight = srcAlpha * floatBlendOutputScale;\n frontWeight = clamp((frontWeight - 0.9) * 10.0, 0.0, 1.0);\n\n float toAlpha = (1.0 + frontFace.a) * 0.5;\n frontFace.a = mix(frontFace.a, toAlpha, frontWeight);")}
20
+ ${r(!d,"float frontWeight = srcAlpha * floatBlendOutputScale;\n frontWeight = clamp((frontWeight - 0.9) * 10.0, 0.0, 1.0);\n\n float toAlpha = (1.0 + frontFace.a) * 0.5;\n frontFace.a = mix(frontFace.a, toAlpha, frontWeight);")}
21
21
  vec3 backColor = srcColor.rgb * floatBlendInputScale / srcAlpha;
22
22
  fragColor = vec4(mix(backColor, frontFace.rgb, frontFace.a), 1.0 - srcColor.a);
23
23
 
24
24
  ${r(f,"fragOcclusion.r = pow(srcColor.a, 0.5);")}
25
- `),s}const f=Object.freeze(Object.defineProperty({__proto__:null,OITBlendPassParameters:s,build:u},Symbol.toStringTag,{value:"Module"}));export{s as O,f as a,u as b};
25
+ `),c}const f=Object.freeze(Object.defineProperty({__proto__:null,OITBlendPassParameters:c,build:u},Symbol.toStringTag,{value:"Module"}));export{c as O,f as a,u as b};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{If as t,glsl as r}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DPassUniform as o}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{O as s}from"./OITDimOpaque.glsl.js";import{alphaCutoff as n}from"../views/3d/webgl-engine/shaders/alphaCutoff.glsl.js";import{oitResolution as a}from"../views/3d/webgl-engine/shaders/oitResolution.glsl.js";import{ShaderBuilder as i}from"../views/webgl/ShaderBuilder.js";class l extends s{}function c(s){const l=new i;l.include(e);const{fragment:c,outputs:u}=l,{useFloatBlend:m}=s;return c.include(a,s),c.include(n),c.uniforms.add(new o("colorTexture",e=>e.colorTexture),new o("alphaTexture",e=>e.alphaTexture),new o("frontFaceTexture",e=>e.frontFaceTexture),new o("emissionTexture",e=>e.emissionTexture),new o("emissionFrontFaceTexture",e=>e.emissionFrontFaceTexture)),u.add("fragEmission","vec4",1),c.main.add(r`
2
+ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{If as t,glsl as r}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DPassUniform as o}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{O as s}from"./OITDimOpaque.glsl.js";import{alphaCutoff as n}from"../views/3d/webgl-engine/shaders/alphaCutoff.glsl.js";import{oitResolution as a}from"../views/3d/webgl-engine/shaders/oitResolution.glsl.js";import{ShaderBuilder as i}from"../views/webgl/ShaderBuilder.js";class l extends s{}function c(s){const l=new i;l.include(e);const{fragment:c,outputs:u}=l,{useFloatBlend:m}=s;return c.include(a,s),c.include(n),c.uniforms.add(new o("colorTexture",e=>e.colorTexture),new o("alphaTexture",e=>e.alphaTexture),new o("emissionTexture",e=>e.emissionTexture),new o("frontFaceTexture",e=>e.frontFaceTexture),new o("frontFaceEmissionTexture",e=>e.frontFaceEmissionTexture)),u.add("fragEmission","vec4",1),c.main.add(r`
3
3
  float srcAlpha = texture(alphaTexture, uv).r * floatBlendInputScale;
4
4
  if(srcAlpha < alphaCutoff) {
5
5
  fragEmission = vec4(0.0);
@@ -11,7 +11,7 @@ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/Scr
11
11
 
12
12
  vec4 emission = texture(emissionTexture, uv);
13
13
  emission.rgb *= floatBlendInputScale;
14
- vec4 emissionFrontFace = texture(emissionFrontFaceTexture, uv);
14
+ vec4 emissionFrontFace = texture(frontFaceEmissionTexture, uv);
15
15
  emissionFrontFace.rgb *= floatBlendInputScale;
16
16
 
17
17
  // Modulate transparent emitter by front faces. This case is important for surfaces which contain emitter and
@@ -1,10 +1,10 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{EmissionDimming as r}from"../views/3d/webgl-engine/core/shaderLibrary/util/EmissionDimming.glsl.js";import{glsl as s}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DPassUniform as o}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{alphaCutoff as i}from"../views/3d/webgl-engine/shaders/alphaCutoff.glsl.js";import{oitResolution as l}from"../views/3d/webgl-engine/shaders/oitResolution.glsl.js";import{NoParameters as a}from"../views/webgl/NoParameters.js";import{ShaderBuilder as n}from"../views/webgl/ShaderBuilder.js";class t extends a{}function m(a){const t=new n;t.include(e);const{fragment:m,outputs:u}=t;return m.include(r),m.include(l,a),m.include(i),m.uniforms.add(new o("colorTexture",e=>e.colorTexture),new o("alphaTexture",e=>e.alphaTexture)),u.add("fragEmission","vec4",1),m.main.add(s`float srcAlpha = texture(alphaTexture, uv).r * floatBlendInputScale;
2
+ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{emissionDimming as r}from"../views/3d/webgl-engine/core/shaderLibrary/util/EmissionDimming.glsl.js";import{glsl as s}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DPassUniform as o}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{alphaCutoff as i}from"../views/3d/webgl-engine/shaders/alphaCutoff.glsl.js";import{oitResolution as l}from"../views/3d/webgl-engine/shaders/oitResolution.glsl.js";import{NoParameters as a}from"../views/webgl/NoParameters.js";import{ShaderBuilder as n}from"../views/webgl/ShaderBuilder.js";class t extends a{}function m(a){const t=new n;t.include(e);const{fragment:m,outputs:u}=t;return u.add("fragEmission","vec4",1),m.include(r),m.include(l,a),m.include(i),m.uniforms.add(new o("colorTexture",e=>e.colorTexture),new o("alphaTexture",e=>e.alphaTexture)).main.add(s`float srcAlpha = texture(alphaTexture, uv).r * floatBlendInputScale;
3
3
  if(srcAlpha < alphaCutoff) {
4
4
  fragEmission = vec4(1.0);
5
5
  return;
6
6
  }
7
7
  vec4 srcColor = texture(colorTexture, uv);
8
8
  srcColor.rgb *= floatBlendInputScale / srcAlpha;
9
- vec3 dimming = emissionDimming(srcColor.rgb, 1.0 - srcColor.a);
9
+ vec3 dimming = emissionDimming(srcColor.rgb, srcColor.a);
10
10
  fragEmission = vec4(dimming, 0.0);`),t}const u=Object.freeze(Object.defineProperty({__proto__:null,OITDimOpaquePassParameters:t,build:m},Symbol.toStringTag,{value:"Module"}));export{t as O,u as a,m as b};
@@ -1,6 +1,6 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{ColorConversion as e}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{addProjViewLocalOrigin as i}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float4PassUniform as r}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatPassUniform as o}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as l,If as d}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{outputColorHighlightOLID as a}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js";import{ShaderBuilder as g}from"../views/webgl/ShaderBuilder.js";function t(t){const s=new g,{vertex:n,fragment:u,attributes:p,varyings:c}=s;return i(n,t),s.include(a,t),u.include(e),p.add("position","vec3"),p.add("uv0","vec2"),c.add("vUV","vec2"),n.main.add(l`vUV = uv0;
3
- gl_Position = proj * view * vec4(position, 1.0);`),u.uniforms.add(new r("backgroundColor",e=>e.backgroundColor),new r("gridColor",e=>e.gridColor),new o("gridWidth",e=>e.gridWidth)).main.add(l`
2
+ import{ColorConversion as e}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{addProjViewLocalOrigin as i}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float4PassUniform as r}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatPassUniform as o}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as l,If as d}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{alphaCutoff as a}from"../views/3d/webgl-engine/shaders/alphaCutoff.glsl.js";import{outputColorHighlightOLID as s}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js";import{ShaderBuilder as g}from"../views/webgl/ShaderBuilder.js";function t(t){const n=new g,{vertex:u,fragment:p,attributes:c,varyings:v}=n;return i(u,t),n.include(s,t),p.include(a),p.include(e),c.add("position","vec3"),c.add("uv0","vec2"),v.add("vUV","vec2"),u.main.add(l`vUV = uv0;
3
+ gl_Position = proj * view * vec4(position, 1.0);`),p.uniforms.add(new r("backgroundColor",e=>e.backgroundColor),new r("gridColor",e=>e.gridColor),new o("gridWidth",e=>e.gridWidth)).main.add(l`
4
4
  const float LINE_WIDTH = 1.0;
5
5
 
6
6
  vec2 uvScaled = vUV * gridWidth;
@@ -18,5 +18,5 @@ gl_Position = proj * view * vec4(position, 1.0);`),u.uniforms.add(new r("backgro
18
18
  vec4 finalColor =
19
19
  premultiplyAlpha(backgroundColor) * (1.0 - gridAlpha) +
20
20
  premultiplyAlpha(vec4(gridColor.rgb, gridAlpha));
21
- ${d(t.emissionDimmingPass,"if (finalColor.a > 0.0) { finalColor.rgb /= finalColor.a; }")}
22
- outputColorHighlightOLID(finalColor, finalColor.rgb);`),s}const s=Object.freeze(Object.defineProperty({__proto__:null,build:t},Symbol.toStringTag,{value:"Module"}));export{s as S,t as b};
21
+ ${d(t.emissionDimmingPass,"if (finalColor.a > alphaCutoff) { finalColor.rgb /= finalColor.a; }")}
22
+ outputColorHighlightOLID(finalColor, finalColor.rgb);`),n}const n=Object.freeze(Object.defineProperty({__proto__:null,build:t},Symbol.toStringTag,{value:"Module"}));export{n as S,t as b};
package/config.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.2.0-next.8";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
2
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.2.0-next.9";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
package/core/has.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- const e=globalThis,a={...e.esriConfig?.has};function has(d){return"function"==typeof a[d]?a[d]=a[d](e):a[d]}has.add=(e,d,r,t)=>{(t||void 0===a[e])&&(a[e]=d),r&&has(e)},has.cache=a,has.add("big-integer-warning-enabled",!0),has.add("esri-deprecation-warnings",!0),has.add("esri-tests-disable-screenshots",!1),has.add("esri-tests-use-full-window",!1),has.add("esri-tests-post-to-influx",!0),has.add("esri-cim-animations-enable-status","enabled"),has.add("esri-cim-animations-spotlight",!1),has.add("esri-cim-animations-freeze-time",!1),(()=>{has.add("host-webworker",void 0!==e.WorkerGlobalScope&&self instanceof e.WorkerGlobalScope);const a="undefined"!=typeof window&&"undefined"!=typeof location&&"undefined"!=typeof document&&window.location===location&&window.document===document;if(has.add("host-browser",a),has.add("host-node",!("object"!=typeof e.process||!e.process.versions?.node||!e.process.versions.v8)),has.add("dom",a),has("host-browser")){const e=navigator,a=e.userAgent,d=e.appVersion,r=parseFloat(d);if(has.add("wp",parseFloat(a.split("Windows Phone")[1])||void 0),has.add("msapp",parseFloat(a.split("MSAppHost/")[1])||void 0),has.add("khtml",d.includes("Konqueror")?r:void 0),has.add("edge",parseFloat(a.split("Edge/")[1])||void 0),has.add("opr",parseFloat(a.split("OPR/")[1])||void 0),has.add("webkit",!has("wp")&&!has("edge")&&parseFloat(a.split("WebKit/")[1])||void 0),has.add("chrome",!has("edge")&&!has("opr")&&parseFloat(a.split("Chrome/")[1])||void 0),has.add("android",!has("wp")&&parseFloat(a.split("Android ")[1])||void 0),has.add("safari",!d.includes("Safari")||has("wp")||has("chrome")||has("android")||has("edge")||has("opr")?void 0:parseFloat(d.split("Version/")[1])),has.add("mac",d.includes("Macintosh")),!has("wp")&&/(iPhone|iPod|iPad)/.test(a)){const e=RegExp.$1.replace(/P/,"p"),d=/OS ([\d_]+)/.test(a)?RegExp.$1:"1",r=parseFloat(d.replace(/_/,".").replaceAll("_",""));has.add(e,r),has.add("ios",r)}has("webkit")||(!a.includes("Gecko")||has("wp")||has("khtml")||has("edge")||has.add("mozilla",r),has("mozilla")&&has.add("ff",parseFloat(a.split("Firefox/")[1]||a.split("Minefield/")[1])||void 0))}})(),(()=>{if(e.navigator){const e=navigator.userAgent,a=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini|IEMobile/i.test(e),d=/iPhone/i.test(e);a&&has.add("esri-mobile",a),d&&has.add("esri-iPhone",d),has.add("esri-geolocation",!!navigator.geolocation)}has.add("esri-wasm","WebAssembly"in e),has.add("esri-performance-mode-frames-between-render",20),has.add("esri-force-performance-mode",!1),has.add("esri-shared-array-buffer",()=>{const a="SharedArrayBuffer"in e,d=!1===e.crossOriginIsolated;return a&&!d}),has.add("wasm-simd",()=>{const e=[0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11];return WebAssembly.validate(new Uint8Array(e))}),has.add("esri-atomics","Atomics"in e),has.add("esri-workers","Worker"in e),has.add("web-feat:cache","caches"in e),has.add("esri-workers-arraybuffer-transfer",!has("safari")||Number(has("safari"))>=12),has.add("min-workers-pool-size",2),has.add("max-workers-pool-size",has("esri-mobile")?3:8),has.add("featurelayer-simplify-thresholds",[.5,.5,.5,.5]),has.add("featurelayer-simplify-payload-size-factors",[1,1,4]),has.add("featurelayer-animation-enabled",!0),has.add("featurelayer-hybrid-tile-enabled",!0),has.add("featurelayer-snapshot-enabled",!0),has.add("featurelayer-snapshot-initial-tolerance",0),has.add("featurelayer-snapshot-point-min-threshold",8e4),has.add("featurelayer-snapshot-point-max-threshold",4e5),has.add("featurelayer-snapshot-multipoint-min-threshold",2e4),has.add("featurelayer-snapshot-multipoint-max-threshold",1e5),has.add("featurelayer-snapshot-polygon-min-threshold",2e3),has.add("featurelayer-snapshot-polygon-max-threshold",2e3),has.add("featurelayer-snapshot-polyline-min-threshold",2e3),has.add("featurelayer-snapshot-polyline-max-threshold",2e3),has.add("featurelayer-snapshot-max-vertex-count",25e4),has.add("featurelayer-snapshot-non-hosted-exceedslimit-enabled",!0),has.add("featurelayer-snapshot-concurrency",4),has.add("featurelayer-snapshot-allow-editable",!1),has.add("featurelayer-snapshot-coverage",.1),has.add("featurelayer-query-max-depth",4),has.add("featurelayer-query-max-page-size",8e3),has.add("featurelayer-query-pausing-enabled",!1),has.add("featurelayer-query-tile-concurrency",4),has.add("featurelayer-query-tile-max-features",6e5),has.add("featurelayer-advanced-symbols",!1),has.add("featurelayer-pbf",!0),has.add("featurelayer-pbf-statistics",!1),has.add("featurelayer-pbf-true-curves",!0),has.add("feature-layers-workers",!0),has.add("feature-polyline-generalization-factor",1),has.add("featurelayer-relative-time-queries-enabled",!0),has.add("featurelayer-relative-time-queries-bin-window-public",1),has.add("featurelayer-relative-time-queries-bin-window-private",60),has.add("parquetlayer-full-query-feature-count",2e4),has.add("parquetlayer-hittest-max-feature-count",1),has.add("parquetlayer-persistence-enabled",!1),has.add("parquetlayer-cache-enabled",!0),has.add("mapview-transitions-duration",200),has.add("mapview-essential-goto-duration",200),has.add("mapview-srswitch-adjust-rotation-scale-threshold",24e6),has.add("mapserver-pbf-version-support",10.81),has.add("mapservice-popup-identify-max-tolerance",20),has.add("request-queue-concurrency-global",50),has.add("request-queue-concurrency-hosted",16),has.add("request-queue-concurrency-non-hosted",10),has.add("curve-densification-coarse-segments",128),has.add("curve-densification-max-segments",2e3),has.add("curve-densification-min-segments",3),has.add("curve-densification-pixel-deviation",.5),has.add("view-readyState-waiting-delay",1e3),has.add("gradient-depth-bias",.01),has.add("gradient-depth-epsilon",1e-8),has.add("enable-feature:analysis-drawtool-line-of-sight",!1),has.add("enable-feature:analysis-drawtool-line-of-sight-placement-visuals",!1),has.add("enable-feature:esri-compress-textures",!0),has.add("enable-feature:analysis-new-viewshed-tool",!1),has.add("enable-feature:basemap-groundlayers",!0),has.add("enable-feature:im-shading",!0),has.add("enable-feature:im-vertex-normals",!0),!has("host-webworker")&&has("host-browser")&&(has.add("esri-csp-restrictions",()=>{try{new Function}catch{return!0}return!1}),has.add("esri-url-encodes-apostrophe",()=>{const e=window.document.createElement("a");return e.href="?'",e.href.includes("?%27")}))})();export{has as default};
2
+ const e=globalThis,a={...e.esriConfig?.has};function has(d){return"function"==typeof a[d]?a[d]=a[d](e):a[d]}has.add=(e,d,r,t)=>{(t||void 0===a[e])&&(a[e]=d),r&&has(e)},has.cache=a,has.add("big-integer-warning-enabled",!0),has.add("esri-deprecation-warnings",!0),has.add("esri-tests-disable-screenshots",!1),has.add("esri-tests-use-full-window",!1),has.add("esri-tests-post-to-influx",!0),has.add("esri-cim-animations-enable-status","enabled"),has.add("esri-cim-animations-spotlight",!1),has.add("esri-cim-animations-freeze-time",!1),(()=>{has.add("host-webworker",void 0!==e.WorkerGlobalScope&&self instanceof e.WorkerGlobalScope);const a="undefined"!=typeof window&&"undefined"!=typeof location&&"undefined"!=typeof document&&window.location===location&&window.document===document;if(has.add("host-browser",a),has.add("host-node",!("object"!=typeof e.process||!e.process.versions?.node||!e.process.versions.v8)),has.add("dom",a),has("host-browser")){const e=navigator,a=e.userAgent,d=e.appVersion,r=parseFloat(d);if(has.add("wp",parseFloat(a.split("Windows Phone")[1])||void 0),has.add("msapp",parseFloat(a.split("MSAppHost/")[1])||void 0),has.add("khtml",d.includes("Konqueror")?r:void 0),has.add("edge",parseFloat(a.split("Edge/")[1])||void 0),has.add("opr",parseFloat(a.split("OPR/")[1])||void 0),has.add("webkit",!has("wp")&&!has("edge")&&parseFloat(a.split("WebKit/")[1])||void 0),has.add("chrome",!has("edge")&&!has("opr")&&parseFloat(a.split("Chrome/")[1])||void 0),has.add("android",!has("wp")&&parseFloat(a.split("Android ")[1])||void 0),has.add("safari",!d.includes("Safari")||has("wp")||has("chrome")||has("android")||has("edge")||has("opr")?void 0:parseFloat(d.split("Version/")[1])),has.add("mac",d.includes("Macintosh")),!has("wp")&&/(iPhone|iPod|iPad)/.test(a)){const e=RegExp.$1.replace(/P/,"p"),d=/OS ([\d_]+)/.test(a)?RegExp.$1:"1",r=parseFloat(d.replace(/_/,".").replaceAll("_",""));has.add(e,r),has.add("ios",r)}has("webkit")||(!a.includes("Gecko")||has("wp")||has("khtml")||has("edge")||has.add("mozilla",r),has("mozilla")&&has.add("ff",parseFloat(a.split("Firefox/")[1]||a.split("Minefield/")[1])||void 0))}})(),(()=>{if(e.navigator){const e=navigator.userAgent,a=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini|IEMobile/i.test(e),d=/iPhone/i.test(e);a&&has.add("esri-mobile",a),d&&has.add("esri-iPhone",d),has.add("esri-geolocation",!!navigator.geolocation)}has.add("esri-wasm","WebAssembly"in e),has.add("esri-performance-mode-frames-between-render",20),has.add("esri-force-performance-mode",!1),has.add("esri-shared-array-buffer",()=>{const a="SharedArrayBuffer"in e,d=!1===e.crossOriginIsolated;return a&&!d}),has.add("wasm-simd",()=>{const e=[0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11];return WebAssembly.validate(new Uint8Array(e))}),has.add("esri-atomics","Atomics"in e),has.add("esri-workers","Worker"in e),has.add("web-feat:cache","caches"in e),has.add("esri-workers-arraybuffer-transfer",!has("safari")||Number(has("safari"))>=12),has.add("min-workers-pool-size",2),has.add("max-workers-pool-size",has("esri-mobile")?3:8),has.add("featurelayer-simplify-thresholds",[.5,.5,.5,.5]),has.add("featurelayer-simplify-payload-size-factors",[1,1,4]),has.add("featurelayer-animation-enabled",!0),has.add("featurelayer-hybrid-tile-enabled",!0),has.add("featurelayer-snapshot-enabled",!0),has.add("featurelayer-snapshot-initial-tolerance",0),has.add("featurelayer-snapshot-point-min-threshold",8e4),has.add("featurelayer-snapshot-point-max-threshold",4e5),has.add("featurelayer-snapshot-multipoint-min-threshold",2e4),has.add("featurelayer-snapshot-multipoint-max-threshold",1e5),has.add("featurelayer-snapshot-polygon-min-threshold",2e3),has.add("featurelayer-snapshot-polygon-max-threshold",2e3),has.add("featurelayer-snapshot-polyline-min-threshold",2e3),has.add("featurelayer-snapshot-polyline-max-threshold",2e3),has.add("featurelayer-snapshot-max-vertex-count",25e4),has.add("featurelayer-snapshot-non-hosted-exceedslimit-enabled",!0),has.add("featurelayer-snapshot-concurrency",4),has.add("featurelayer-snapshot-allow-editable",!1),has.add("featurelayer-snapshot-coverage",.1),has.add("featurelayer-query-max-depth",4),has.add("featurelayer-query-max-page-size",8e3),has.add("featurelayer-query-pausing-enabled",!1),has.add("featurelayer-query-tile-concurrency",4),has.add("featurelayer-query-tile-max-features",6e5),has.add("featurelayer-advanced-symbols",!1),has.add("featurelayer-pbf",!0),has.add("featurelayer-pbf-statistics",!1),has.add("featurelayer-pbf-true-curves",!0),has.add("feature-layers-workers",!0),has.add("feature-polyline-generalization-factor",1),has.add("featurelayer-relative-time-queries-enabled",!0),has.add("featurelayer-relative-time-queries-bin-window-public",1),has.add("featurelayer-relative-time-queries-bin-window-private",60),has.add("parquetlayer-full-query-feature-count",5e5),has.add("parquetlayer-persistence-enabled",!1),has.add("parquetlayer-cache-enabled",!0),has.add("mapview-transitions-duration",200),has.add("mapview-essential-goto-duration",200),has.add("mapview-srswitch-adjust-rotation-scale-threshold",24e6),has.add("mapserver-pbf-version-support",10.81),has.add("mapservice-popup-identify-max-tolerance",20),has.add("request-queue-concurrency-global",50),has.add("request-queue-concurrency-hosted",16),has.add("request-queue-concurrency-non-hosted",10),has.add("curve-densification-coarse-segments",128),has.add("curve-densification-max-segments",2e3),has.add("curve-densification-min-segments",3),has.add("curve-densification-pixel-deviation",.5),has.add("view-readyState-waiting-delay",1e3),has.add("gradient-depth-bias",.01),has.add("gradient-depth-epsilon",1e-8),has.add("enable-feature:analysis-drawtool-line-of-sight",!1),has.add("enable-feature:analysis-drawtool-line-of-sight-placement-visuals",!1),has.add("enable-feature:esri-compress-textures",!0),has.add("enable-feature:analysis-new-viewshed-tool",!1),has.add("enable-feature:basemap-groundlayers",!0),has.add("enable-feature:im-shading",!0),has.add("enable-feature:im-vertex-normals",!0),!has("host-webworker")&&has("host-browser")&&(has.add("esri-csp-restrictions",()=>{try{new Function}catch{return!0}return!1}),has.add("esri-url-encodes-apostrophe",()=>{const e=window.document.createElement("a");return e.href="?'",e.href.includes("?%27")}))})();export{has as default};
package/interfaces.d.ts CHANGED
@@ -1061,6 +1061,7 @@ declare namespace __esri {
1061
1061
  interface SceneViewerLayerUtils {
1062
1062
  revertLayerProperty: typeof import("./applications/SceneViewer/layerUtils.js").revertLayerProperty;
1063
1063
  originOfLayerProperty: typeof import("./applications/SceneViewer/layerUtils.js").originOfLayerProperty;
1064
+ isGaussianSplat3DTiles: typeof import("./applications/SceneViewer/layerUtils.js").isGaussianSplat3DTiles;
1064
1065
  }
1065
1066
 
1066
1067
  export const SceneViewerLayerUtils: SceneViewerLayerUtils;
package/kernel.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.8",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
2
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.9",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
@@ -46,7 +46,8 @@ import type { LayerProperties } from "./Layer.js";
46
46
 
47
47
  export interface ParquetLayerProperties extends LayerProperties, CustomParametersMixinProperties, OperationalLayerProperties, ScaleRangeLayerProperties, OrderedLayerProperties, BlendLayerProperties, FeatureEffectLayerProperties, FeatureReductionLayerProperties, Partial<Pick<ParquetLayer, "copyright" | "definitionExpression" | "geometryType" | "labelsVisible" | "legendEnabled" | "outFields" | "popupEnabled">> {
48
48
  /**
49
- * The data backing the layer.
49
+ * The data source for the ParquetLayer. Set this property to [parquet files](https://developers.arcgis.com/javascript/latest/references/core/layers/support/ParquetFilesData/)
50
+ * or a [portal item](https://developers.arcgis.com/javascript/latest/references/core/layers/support/ParquetPortalItemData/) to define which Parquet content the layer loads.
50
51
  *
51
52
  * @since 5.1
52
53
  * @example
@@ -59,6 +60,15 @@ export interface ParquetLayerProperties extends LayerProperties, CustomParameter
59
60
  * ]
60
61
  * })
61
62
  * });
63
+ * @example
64
+ * // Create a parquet layer from arcgis online portal item
65
+ * const layer = new ParquetLayer({
66
+ * data: new ParquetPortalItemData({
67
+ * portalItem: {
68
+ * id: "6ab6f959c1684eb5a54db91644a89747",
69
+ * },
70
+ * }),
71
+ * });
62
72
  */
63
73
  data?: (ParquetFilesDataProperties | (ParquetPortalItemDataProperties & { type: "portal-item" })) | null;
64
74
  /**
@@ -317,7 +327,8 @@ export default class ParquetLayer extends ParquetLayerSuperclass {
317
327
  /** Copyright information for the layer. */
318
328
  accessor copyright: string | null | undefined;
319
329
  /**
320
- * The data backing the layer.
330
+ * The data source for the ParquetLayer. Set this property to [parquet files](https://developers.arcgis.com/javascript/latest/references/core/layers/support/ParquetFilesData/)
331
+ * or a [portal item](https://developers.arcgis.com/javascript/latest/references/core/layers/support/ParquetPortalItemData/) to define which Parquet content the layer loads.
321
332
  *
322
333
  * @since 5.1
323
334
  * @example
@@ -330,6 +341,15 @@ export default class ParquetLayer extends ParquetLayerSuperclass {
330
341
  * ]
331
342
  * })
332
343
  * });
344
+ * @example
345
+ * // Create a parquet layer from arcgis online portal item
346
+ * const layer = new ParquetLayer({
347
+ * data: new ParquetPortalItemData({
348
+ * portalItem: {
349
+ * id: "6ab6f959c1684eb5a54db91644a89747",
350
+ * },
351
+ * }),
352
+ * });
333
353
  */
334
354
  get data(): ParquetDataUnion | null | undefined;
335
355
  set data(value: (ParquetFilesDataProperties | (ParquetPortalItemDataProperties & { type: "portal-item" })) | null | undefined);
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{FileProvider as e,isStatisticsFileName as t}from"./FileProvider.js";class s extends e{constructor(e,t=null,s=()=>{}){super(t,s),this._schema=e}async update(e){await this._updateParquetFileInfos(await this._getParquetFileNames()),this._schema=e}async _resolveFileUrl(e){return e}async _getParquetFileNames(){return this._schema.urls.filter(e=>e.startsWith("blob:")||e.endsWith(".parquet"))}async _getStatisticsFileName(){return this._schema.urls.find(t)??null}}export{s as UrlsFileProvider};
2
+ import{FileProvider as e,isStatisticsFileName as s}from"./FileProvider.js";class t extends e{constructor(e,s=null,t=()=>{}){super(s,t),this._schema=e}async update(e){await this._updateParquetFileInfos(await this._getParquetFileNames()),this._schema=e}async _resolveFileUrl(e){return e}async _getParquetFileNames(){return this._schema.urls.filter(e=>!e.endsWith(".json"))}async _getStatisticsFileName(){return this._schema.urls.find(s)??null}}export{t as UrlsFileProvider};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as r}from"../../../../core/compilerUtils.js";import s from"../../../../core/Error.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{onAbortOrThrow as a,throwIfAborted as n}from"../../../../core/promiseUtils.js";import{QueueProcessor as o}from"../../../../core/QueueProcessor.js";import{parseWhereClause as u}from"../../../../core/sql.js";import l from"../../../../geometry/SpatialReference.js";import{set as p,create as c,expandWithAABB as d,expandWithRect as f,negativeInfinity as m}from"../../../../geometry/support/aaBoundingBox.js";import{getQueryResultExtent as h,QueryEngine as y}from"../../data/QueryEngine.js";import{QueryEngineResult as g}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as _}from"../../data/queryUtils.js";import{createFileProvider as w}from"../parquet/createFileProvider.js";import{createDrawingInfo as x}from"./clientSideDefaults.js";import{getParquetFileId as F,getParquetRowId as I}from"./parquetIdUtils.js";import S from"../../../support/Field.js";import R from"../../../support/FieldsIndex.js";import{fromParquetGeometryEncodingJSON as C}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as v,fromParquetJSONGeometryType as q,toParquetJSONGeometryType as E}from"../../../support/parquetUtils.js";import{loadParquetModule as O}from"../../../../libs/parquet/loadParquetModule.js";import{FeatureStoreQueryAdapter as b}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as P}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as Q}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as T}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as j}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const M=new b,A=4,G="__OBJECTID",N=new TextDecoder,B=8,D=2,z=20;class k{constructor(e,t){this._files=e,this._createFileStream=t,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(e){for(await this._fill(e);this._pending.size>0;){n(e),await this._fill(e);const t=await V(this._pending);if(this._pending.delete(t.read),this._resolvedCount++,null!=t.chunk)return t.chunk}return null}async _fill(e){for(this._removeDone();this._pending.size<B;){const t=this._getOrCreateNextStream(e);if(null==t)return;this._pending.add(t.read(e))}}_getOrCreateNextStream(e){const t=this._resolvedCount>=B?B:D;if(this._fileIndex<this._files.length&&this._streams.length<t){const t=this._files[this._fileIndex++],r=new W(t.id,this._createFileStream(t,e));return this._streams.push(r),r}return this._getNextStream()}_getNextStream(){const e=this._streams.length;for(let t=0;t<e;t++){const r=(this._streamIndex+t)%e,s=this._streams[r];if(s.canRead)return this._streamIndex=(r+1)%e,s}return null}_removeDone(){let e=this._streamIndex;for(let t=this._streams.length-1;t>=0;t--)this._streams[t].done&&(this._streams.splice(t,1),t<e&&e--);this._streamIndex=this._streams.length>0?e%this._streams.length:0}}function V(e){return Promise.race(Array.from(e,async e=>({read:e,chunk:await e})))}class W{constructor(e,t){this._fileId=e,this._stream=t,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&0===this._readCount}async read(e){this._readCount++;try{const t=await this._stream,r=await t.next(e);return null==r?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:r}}finally{this._readCount--}}}class U{constructor(){this._queue=new o({concurrency:A,process:(e,t)=>this._executeQuery(e,t)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={}}async load(e){const t=e.spatialReference?l.fromJSON(e.spatialReference):void 0;if(t&&!t.isWGS84&&!t.isWebMercator)throw new s("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");this._customParameters=e.customParameters,this._provider=w(e.provider,null,()=>this._customParameters);const r=await this._provider.getMetadata(),a=await v(r,{fields:e.fields?.map(e=>S.fromJSON(e)),geometryEncoding:e.geometryEncoding?C(e.geometryEncoding):null,geometryType:e.geometryType?q(e.geometryType):null,displayOptimization:e.displayOptimization,spatialReference:t});if(!a.fields)throw new s("parquet:unsupported","Fields must be defined");let n;if(a.spatialReference&&a.geometryType){if(!a.spatialReference)throw new s("parquet:unsupported","SpatialReference must be defined");if(!a.spatialReference.isGeographic&&!a.spatialReference.isWebMercator)throw new s("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");a.spatialReference.isGeographic&&!a.spatialReference.isWGS84&&(i.getLogger("parquet:unsupported-projection").warn("Found a geographic projection that is not WGS84. Handling as WGS84.",{spatialReference:a.spatialReference}),a.spatialReference=l.WGS84),n={geometry:a.geometryEncoding?{geometryType:E(a.geometryType),spatialReference:a.spatialReference.toJSON(),encoding:a.geometryEncoding.toJSON()}:null,displayOptimization:a.displayOptimization}}this.setCustomParameters(e.customParameters),this._displayOptimization=a.displayOptimization,await this._provider.updateGeometryInfo(n),this._capabilities=te(await this._getFileStatistics());const o=await this._provider.getFiles();if(!o.length)return{layerDefinition:{},capabilities:te(null)};const u=await o[0].file;a.file=u;const{fields:p}=a;if(null==p)throw new s("parquet-layer:missing-metadata","Unable to create parquet source: cannot infer fields",p);p.push(new S({name:G,type:"oid",alias:G}));for(const s of p){const e=u.getColumnId(s.name);null!=e&&(this._indexMap[s.name]=e)}const c=new R(p.map(e=>e.toJSON()));this._fieldsIndex=c;const d=E(a.geometryType??"point");return this._metadata=T.createFeature({fieldsIndex:c.toJSON(),geometryType:d,hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:"rowId"},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:a.spatialReference,outSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:d,featureIdInfo:{type:"object-id",fieldName:"rowId"},hasM:!1,hasZ:!1,spatialReference:a.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=r?.extent?r.extent:await this._tryDeriveParquetFullExtent(a),{capabilities:this._capabilities,layerDefinition:{fields:a.fields?.map(e=>e.toJSON()),drawingInfo:x(d),extent:this._fullExtent??void 0,geometryType:d,geometryEncoding:a.geometryEncoding?.toJSON(),displayOptimization:a.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(const{handle:e}of this._streams.values())e.remove();this._streams.clear()}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async updateFileProvider(e){this._provider=w(e,this._provider.getGeometryInfo(),()=>this._customParameters)}async queryFeatures(e,t){this._validateQuery(e),re(e)||(e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,8e3):8e3,e.resultOffset=e.resultOffset??0),(e.outStatistics||e.returnDistinctValues)&&(e.returnGeometry=void 0);return(await this._enqueueQuery(e,t)).createQueryResponse()}async queryFeatureCount(e,t){const r=await _(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),!J(r))return this._getFeatureCount();r.outFields=void 0,r.returnGeometry=void 0;return(await this._enqueueQuery(r,t)).createQueryResponseForCount()}async queryObjectIds(e,t){const r=await _(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),!J(r))return Array.from({length:await this._getFeatureCount()},(e,t)=>t);r.resultRecordCount=r.resultRecordCount?Math.min(r.resultRecordCount,8e3):8e3,r.resultOffset=r.resultOffset??0,r.returnGeometry=void 0,r.outFields=void 0;return(await this._enqueueQuery(r,t)).items.map(e=>e.getObjectId())}async queryExtent(e,t){const s=await _(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(s),this._fullExtent&&!J(s))return{count:await this._getFeatureCount(),extent:this._fullExtent};const i=r(this._metadata.spatialReference);s.returnGeometry=!0,s.outFields=void 0;const a=p(c(),m),n=c(),o=await this._enqueueQuery(s,t);let u=0;for(const r of o.items)r.getBounds(n)&&(d(a,n),u+=1);return{count:u,extent:h(a,i,s.outSR?r(s.outSR):i.toJSON(),i,!1)}}async queryStream(e,t){if(!t.signal)throw new Error("InternalError: AbortSignal must be passed");const r=await this._getCandidateFiles(e),s=new k(r,async(t,r)=>{const s=await t.file,i=await this._createParquetQuery(s,e);return s.executeQuery(i,r)}),i=this._streamIdCounter++,n=a(t.signal,e=>{const t=this._streams.get(i);null!=t&&(t.handle.remove(),this._streams.delete(i))});return this._streams.set(i,{stream:s,handle:n}),i}async getStreamNext(e,t){if(!t.signal)throw new Error("InternalError: AbortSignal must be passed");const r=this._streams.get(e);if(!r)return{result:null};const s=await r.stream.next(t.signal);if(null==s)return r.handle.remove(),this._streams.delete(e),{result:null};const i=s.chunk.serialize().buffer,a={fileId:s.fileId,buffer:i};return i instanceof ArrayBuffer?{result:a,transferList:[i]}:{result:a}}async createPatch(e,t,r,s,i){if(!i.signal)throw new Error("InternalError: AbortSignal must be passed");const a=await this._getFileInfoById(e),n=await a.file;return(await n.createChunkPatch(t,r,s,i.signal)).serialize().buffer}async _getCandidateFiles(e){const t=await this._provider.getFiles(),r=await this._getSpatialFilePruning(e);if(null==r)return t;const s=t.filter(e=>this._mayIncludeFileForSpatialPruning(e,r));return"xz"===r.type?Z(s,r):s}async _getSpatialFilePruning(e){if("tile"!==e.type)return null;const t=this._displayOptimization,r=t?.index;if(null==r)return null;const s=e.outSpatialReference.wkid;if(null==r.wkid||null==s)return null;const i=r.wkid,a=await O();switch(r.type){case"xz":return{type:"xz",fieldName:r.code,intersects:(t,n)=>a.queryIntersectsXZStatistics(r.fullExtent,e.extent,s,i,z,t,n)};case"z":return{type:"xy",xFieldName:r.xColumn,yFieldName:r.yColumn,intersects:(t,r,n,o)=>a.queryIntersectsXYStatistics(e.extent,s,i,t,r,n,o)}}}_mayIncludeFileForSpatialPruning(e,t){switch(t.type){case"xz":{const r=L(e,t);return null==r||$(r,t)}case"xy":{const{xStatistics:r,yStatistics:s}=X(e,t);return null==r||null==s||K(r,s,t)}}}async _tryDeriveParquetFullExtent(r){if(!r.spatialReference)return null;if(null==this._fullExtent&&"location"===r.geometryEncoding?.type){const i=await this._provider.getFiles(),{xField:a,yField:n}=r.geometryEncoding,o=p(c(),m);for(const r of i){const i=await r.file;for(const r of i.rowGroups()){const i={stack:[],error:void 0,hasError:!1};try{const t=e(i,r.columnDescriptorForAttribute(a),!1),s=e(i,r.columnDescriptorForAttribute(n),!1),u=[t.minValue(),s.minValue(),t.maxValue(),s.maxValue()];f(o,u),r.free()}catch(s){i.error=s,i.hasError=!0}finally{t(i)}}}return{xmin:o[0],ymin:o[1],xmax:o[3],ymax:o[4],spatialReference:r.spatialReference?.toJSON()}}return null}async _getFileInfoById(e){const t=await this._provider.getFiles();for(const r of t)if(r.id===e)return r;throw new Error(`InternalError: File ${e} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(e){return(await this._getFileInfoById(e)).file}async _createParquetQuery(e,t){const r=(await O()).Query.new();return"tile"===t.type&&(r.setExtent(t.extent),r.setQuantizationTransform(t.transform),r.setScale(t.scale)),r.setOutFields(t.outFields.filter(e=>null!=this._indexMap[e])),r.setOutSpatialReference(t.outSpatialReference.wkid),r.setReturnGeometry(t.returnGeometry),t.where&&await this._setWhereClause(r,e,t.where),r}async _getFeatureCount(){return(await this._provider.getFiles()).map(e=>e.statistics.rowCount).reduce((e,t)=>e+t,0)}async _getByteLength(){return(await this._provider.getFiles()).map(e=>e.statistics.byteSize).reduce((e,t)=>e+t,0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new s("parquet:unsupported","Statistics queries are not supported",{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new s("parquet:unsupported","Queries using orderBy are not supported",{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new s("parquet:unsupported","Queries using returnDistinctValues are not supported",{query:e})}async _setWhereClause(e,t,r){const i=this._indexMap,a=this._fieldsIndex,n={getAttribute(e,r){const s=t.readAttribute(e.rowGroup,e.row,i[r]);if(null==s)return null;const n=a.get(r);return"esriFieldTypeString"===n.type||"esriFieldTypeDateOnly"===n.type||"esriFieldTypeTimeOnly"===n.type||"esriFieldTypeTimestampOffset"===n.type?N.decode(s):s}},o=await u(r,this._fieldsIndex);if(!o.isStandardized)throw new s("sql-parse-error","expression is not standardized");const l=(e,t)=>o.testFeatureCompiled({rowGroup:e,row:t},n,null);e.setWhere(r),e.setWhereEvaluator(l),e.setWhereFields(o.fieldNames)}async*_fetchChunks(e,t){const r=await O(),s=await this._provider.getFiles();for(const i of s){const s=await i.file,a=r.Query.new();a.setOutFields(e.fields),a.setReturnGeometry(e.returnGeometry),e.where&&await this._setWhereClause(a,s,e.where);const o=await s.executeQuery(a),u=[],l=o.next(t);for(let e=0;e<A;e++)u.push(o.next(t));let p=await l;for(;null!=p;){n(t);const e=new j(this._metadata,this._indexMap,p,i.id),r=H([new P(e,null,0,!1)],this._queryEngineParams),s=u.shift();u.push(o.next(t)),yield r,p=await s}}}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){const r=await this._getReadParams(e);if(e.where=void 0,e.objectIds?.length){const r=new Map;for(const t of e.objectIds){const e=F(t),s=I(t);let i=r.get(e);i||(i=[],r.set(e,i)),i.push(s)}const s=[];for(const[i,a]of r.entries()){const r=await this._executeFileIdQuery(e,i,a,t);for(const e of r)s.push(e)}return new g(s,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:M,featureIdInfo:this._queryEngineParams.featureIdInfo})}let s=e.resultRecordCount??await this._getFeatureCount(),i=e.resultOffset??0;e.resultRecordCount=void 0,e.resultOffset=void 0;const a=[];for await(const n of this._fetchChunks(r,t)){const r=await n.executeQueryForOpaqueFeatures(e,t);if(r.length>i){const t=r.slice(i,Math.min(i+s,r.length));for(const e of t)a.push(e);if(i=0,s-=t.length,0===s)return new g(a,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:M,featureIdInfo:this._queryEngineParams.featureIdInfo})}else i-=r.length}return new g(a,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:M,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,r,s){const i=await this._getReadParams(e),a=(await O()).Query.new();a.setOutFields(i.fields),a.setReturnGeometry(i.returnGeometry),a.setIds(new Uint32Array(r));const n=await this._getFile(t),o=await n.executeQuery(a,s);let u=await o.next(s),l=0;const p=[];for(;null!=u;){const e=new j(this._metadata,this._indexMap,u,t),r=new P(e,null,l++,!1);p.push(r),u=await o.next(s)}return H(p,this._queryEngineParams).executeQueryForOpaqueFeatures(e,s)}async _getReadParams(e){const t=new Set;if(e.outStatistics)for(const r of e.outStatistics)null!=r.onStatisticField&&t.add(r.onStatisticField);if(e.outFields)for(const r of e.outFields)t.add(r);return{fields:(t.has("*")?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>null!=this._indexMap[e]),returnGeometry:!!e.returnGeometry||!!e.geometry,where:e.where}}}function J(e){for(const t in e){const r=t;switch(r){case"resultOffset":case"resultRecordCount":case"aggregateIds":case"distance":case"gdbVersion":case"geometry":case"having":case"timeExtent":case"objectIds":case"historicMoment":case"where":return null!=e[r]}}return!1}function H(e,t){const r=new Q;for(const s of e)r.insert(s);return new y({...t,featureStore:r})}function L(e,t){return e.statistics.statistics.get(t.fieldName)??null}function Z(e,t){return e.slice().sort((e,r)=>{const s=Y(e,t),i=Y(r,t);return s===i?0:s<i?-1:1})}function Y(e,t){const r=L(e,t);if(null==r)return Number.POSITIVE_INFINITY;const s=ee(r.minValue),i=ee(r.maxValue);return null==s||null==i||i<s?Number.POSITIVE_INFINITY:i-s}function X(e,t){return{xStatistics:e.statistics.statistics.get(t.xFieldName)??null,yStatistics:e.statistics.statistics.get(t.yFieldName)??null}}function $(e,t){const r=ee(e.minValue),s=ee(e.maxValue);return null==r||null==s||t.intersects(r,s)}function K(e,t,r){const s=ee(e.minValue),i=ee(e.maxValue),a=ee(t.minValue),n=ee(t.maxValue);return null==s||null==i||null==a||null==n||r.intersects(s,i,a,n)}function ee(e){return"number"==typeof e&&Number.isFinite(e)?e:null}function te(e){const t=e?.featureCount;let r=!1;return null!=t&&t<has("parquetlayer-full-query-feature-count")&&(r=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:!1,supportsTrueCurve:!1,supportsZ:!1},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:8e3,maxRecordCountFactor:void 0,maxUniqueIDCount:void 0,relativeTimeBinWindow:void 0,standardMaxRecordCount:void 0,standardMaxRecordCountNoGeometry:void 0,supportsStatisticsAggregatedIds:!1,supportsCacheHint:!1,supportsCentroid:!0,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDisjointSpatialRelationship:!1,supportsDistance:!1,supportsOutDistance:!1,supportsDistinct:r,supportsExtent:!1,supportsFormatPBF:!1,supportsFormatPBFWithCurves:!1,supportsGeometryProperties:!1,supportsHavingClause:!1,supportsHistoricMoment:!1,supportsMaxRecordCountFactor:!1,supportsOrderBy:r,supportsPagination:!0,supportsPaginationOnAggregatedQueries:!1,supportsPercentileStatistics:!1,supportsQuantization:!0,supportsQuantizationEditMode:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsReturnExceededLimitGeometries:!1,supportsStandardizedQueriesOnly:!1,supportsTopFeaturesQuery:!1,supportsStatistics:r,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsCompactGeometry:!1,supportsSqlExpression:!1,supportsTrueCurve:!1,tileMaxRecordCount:void 0},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}function re(e){return!!(e.objectIds?.length||e.outStatistics||e.orderByFields?.length||e.returnDistinctValues)}export{U as default};
2
+ import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as r}from"../../../../core/compilerUtils.js";import s from"../../../../core/Error.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{onAbortOrThrow as a,throwIfAborted as n}from"../../../../core/promiseUtils.js";import{QueueProcessor as o}from"../../../../core/QueueProcessor.js";import{parseWhereClause as u}from"../../../../core/sql.js";import l from"../../../../geometry/SpatialReference.js";import{set as p,create as c,expandWithAABB as d,expandWithRect as f,negativeInfinity as m}from"../../../../geometry/support/aaBoundingBox.js";import{getQueryResultExtent as h,QueryEngine as y}from"../../data/QueryEngine.js";import{queryBinsCapabilities as g,queryCapabilities as _}from"../../data/QueryEngineCapabilities.js";import{QueryEngineResult as w}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as x}from"../../data/queryUtils.js";import{createFileProvider as I}from"../parquet/createFileProvider.js";import{createDrawingInfo as F}from"./clientSideDefaults.js";import{getParquetFileId as S,getParquetRowId as R}from"./parquetIdUtils.js";import q from"../../../support/Field.js";import v from"../../../support/FieldsIndex.js";import{fromParquetGeometryEncodingJSON as C}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as E,fromParquetJSONGeometryType as O,toParquetJSONGeometryType as b}from"../../../support/parquetUtils.js";import{loadParquetModule as P}from"../../../../libs/parquet/loadParquetModule.js";import{FeatureStoreQueryAdapter as Q}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as T}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as j}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as N}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as A}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const M=new Q,B=4,G="__OBJECTID",D=new TextDecoder,z=8e3,k=8,V=2,W=20;class U{constructor(e,t){this._files=e,this._createFileStream=t,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(e){for(await this._fill(e);this._pending.size>0;){n(e),await this._fill(e);const t=await J(this._pending);if(this._pending.delete(t.read),this._resolvedCount++,null!=t.chunk)return t.chunk}return null}async _fill(e){for(this._removeDone();this._pending.size<k;){const t=this._getOrCreateNextStream(e);if(null==t)return;this._pending.add(t.read(e))}}_getOrCreateNextStream(e){const t=this._resolvedCount>=k?k:V;if(this._fileIndex<this._files.length&&this._streams.length<t){const t=this._files[this._fileIndex++],r=new Z(t.id,this._createFileStream(t,e));return this._streams.push(r),r}return this._getNextStream()}_getNextStream(){const e=this._streams.length;for(let t=0;t<e;t++){const r=(this._streamIndex+t)%e,s=this._streams[r];if(s.canRead)return this._streamIndex=(r+1)%e,s}return null}_removeDone(){let e=this._streamIndex;for(let t=this._streams.length-1;t>=0;t--)this._streams[t].done&&(this._streams.splice(t,1),t<e&&e--);this._streamIndex=this._streams.length>0?e%this._streams.length:0}}function J(e){return Promise.race(Array.from(e,async e=>({read:e,chunk:await e})))}class Z{constructor(e,t){this._fileId=e,this._stream=t,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&0===this._readCount}async read(e){this._readCount++;try{const t=await this._stream,r=await t.next(e);return null==r?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:r}}finally{this._readCount--}}}class L{constructor(){this._queue=new o({concurrency:B,process:(e,t)=>this._executeQuery(e,t)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={}}async load(e){const t=e.spatialReference?l.fromJSON(e.spatialReference):void 0;if(t&&!t.isWGS84&&!t.isWebMercator)throw new s("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");this._customParameters=e.customParameters,this._provider=I(e.provider,null,()=>this._customParameters);const r=await this._provider.getMetadata(),a=await E(r,{fields:e.fields?.map(e=>q.fromJSON(e)),geometryEncoding:e.geometryEncoding?C(e.geometryEncoding):null,geometryType:e.geometryType?O(e.geometryType):null,displayOptimization:e.displayOptimization,spatialReference:t});if(!a.fields)throw new s("parquet:unsupported","Fields must be defined");let n;if(a.spatialReference&&a.geometryType){if(!a.spatialReference)throw new s("parquet:unsupported","SpatialReference must be defined");if(!a.spatialReference.isGeographic&&!a.spatialReference.isWebMercator)throw new s("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");a.spatialReference.isGeographic&&!a.spatialReference.isWGS84&&(i.getLogger("parquet:unsupported-projection").warn("Found a geographic projection that is not WGS84. Handling as WGS84.",{spatialReference:a.spatialReference}),a.spatialReference=l.WGS84),n={geometry:a.geometryEncoding?{geometryType:b(a.geometryType),spatialReference:a.spatialReference.toJSON(),encoding:a.geometryEncoding.toJSON()}:null,displayOptimization:a.displayOptimization}}this.setCustomParameters(e.customParameters),this._displayOptimization=a.displayOptimization,await this._provider.updateGeometryInfo(n),this._capabilities=ie(await this._getFileStatistics());const o=await this._provider.getFiles();if(!o.length)return{layerDefinition:{},capabilities:ie(null)};const u=await o[0].file;a.file=u;const{fields:p}=a;if(null==p)throw new s("parquet-layer:missing-metadata","Unable to create parquet source: cannot infer fields",p);p.push(new q({name:G,type:"oid",alias:G}));for(const s of p){const e=u.getColumnId(s.name);null!=e&&(this._indexMap[s.name]=e)}const c=new v(p.map(e=>e.toJSON()));this._fieldsIndex=c;const d=b(a.geometryType??"point");return this._metadata=N.createFeature({fieldsIndex:c.toJSON(),geometryType:d,hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:"rowId"},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:a.spatialReference,outSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:d,featureIdInfo:{type:"object-id",fieldName:"rowId"},hasM:!1,hasZ:!1,spatialReference:a.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=r?.extent?r.extent:await this._tryDeriveParquetFullExtent(a),{capabilities:this._capabilities,layerDefinition:{fields:a.fields?.map(e=>e.toJSON()),drawingInfo:F(d),extent:this._fullExtent??void 0,geometryType:d,geometryEncoding:a.geometryEncoding?.toJSON(),displayOptimization:a.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(const{handle:e}of this._streams.values())e.remove();this._streams.clear()}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async updateFileProvider(e){this._provider=I(e,this._provider.getGeometryInfo(),()=>this._customParameters)}async queryFeatures(e,t){this._validateQuery(e),ae(e)||(e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,z):z,e.resultOffset=e.resultOffset??0),(e.outStatistics||e.returnDistinctValues)&&(e.returnGeometry=void 0);return(await this._enqueueQuery(e,t)).createQueryResponse()}async queryFeatureCount(e,t){const r=await x(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),!H(r))return this._getFeatureCount();r.outFields=void 0,r.returnGeometry=void 0;return(await this._enqueueQuery(r,t)).createQueryResponseForCount()}async queryObjectIds(e,t){const r=await x(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),!H(r))return Array.from({length:await this._getFeatureCount()},(e,t)=>t);r.resultRecordCount=r.resultRecordCount?Math.min(r.resultRecordCount,8e3):8e3,r.resultOffset=r.resultOffset??0,r.returnGeometry=void 0,r.outFields=void 0;return(await this._enqueueQuery(r,t)).items.map(e=>e.getObjectId())}async queryExtent(e,t){const s=await x(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(s),this._fullExtent&&!H(s))return{count:await this._getFeatureCount(),extent:this._fullExtent};const i=r(this._metadata.spatialReference);s.returnGeometry=!0,s.outFields=void 0;const a=p(c(),m),n=c(),o=await this._enqueueQuery(s,t);let u=0;for(const r of o.items)r.getBounds(n)&&(d(a,n),u+=1);return{count:u,extent:h(a,i,s.outSR?r(s.outSR):i.toJSON(),i,!1)}}async queryStream(e,t){if(!t.signal)throw new Error("InternalError: AbortSignal must be passed");const r=await this._getCandidateFiles(e),s=new U(r,async(t,r)=>{const s=await t.file,i=await this._createParquetQuery(s,e);return s.executeQuery(i,r)}),i=this._streamIdCounter++,n=a(t.signal,e=>{const t=this._streams.get(i);null!=t&&(t.handle.remove(),this._streams.delete(i))});return this._streams.set(i,{stream:s,handle:n}),i}async getStreamNext(e,t){if(!t.signal)throw new Error("InternalError: AbortSignal must be passed");const r=this._streams.get(e);if(!r)return{result:null};const s=await r.stream.next(t.signal);if(null==s)return r.handle.remove(),this._streams.delete(e),{result:null};const i=s.chunk.serialize().buffer,a={fileId:s.fileId,buffer:i};return i instanceof ArrayBuffer?{result:a,transferList:[i]}:{result:a}}async createPatch(e,t,r,s,i){if(!i.signal)throw new Error("InternalError: AbortSignal must be passed");const a=await this._getFileInfoById(e),n=await a.file;return(await n.createChunkPatch(t,r,s,i.signal)).serialize().buffer}async _getCandidateFiles(e){const t=await this._provider.getFiles(),r=await this._getSpatialFilePruning(e);if(null==r)return t;const s=t.filter(e=>this._mayIncludeFileForSpatialPruning(e,r));return"xz"===r.type?$(s,r):s}async _getSpatialFilePruning(e){if("tile"!==e.type)return null;const t=this._displayOptimization,r=t?.index;if(null==r)return null;const s=e.outSpatialReference.wkid;if(null==r.wkid||null==s)return null;const i=r.wkid,a=await P();switch(r.type){case"xz":return{type:"xz",fieldName:r.code,intersects:(t,n)=>a.queryIntersectsXZStatistics(r.fullExtent,e.extent,s,i,W,t,n)};case"z":return{type:"xy",xFieldName:r.xColumn,yFieldName:r.yColumn,intersects:(t,r,n,o)=>a.queryIntersectsXYStatistics(e.extent,s,i,t,r,n,o)}}}_mayIncludeFileForSpatialPruning(e,t){switch(t.type){case"xz":{const r=X(e,t);return null==r||te(r,t)}case"xy":{const{xStatistics:r,yStatistics:s}=ee(e,t);return null==r||null==s||re(r,s,t)}}}async _tryDeriveParquetFullExtent(r){if(!r.spatialReference)return null;if(null==this._fullExtent&&"location"===r.geometryEncoding?.type){const i=await this._provider.getFiles(),{xField:a,yField:n}=r.geometryEncoding,o=p(c(),m);for(const r of i){const i=await r.file;for(const r of i.rowGroups()){const i={stack:[],error:void 0,hasError:!1};try{const t=e(i,r.columnDescriptorForAttribute(a),!1),s=e(i,r.columnDescriptorForAttribute(n),!1),u=[t.minValue(),s.minValue(),t.maxValue(),s.maxValue()];f(o,u),r.free()}catch(s){i.error=s,i.hasError=!0}finally{t(i)}}}return{xmin:o[0],ymin:o[1],xmax:o[3],ymax:o[4],spatialReference:r.spatialReference?.toJSON()}}return null}async _getFileInfoById(e){const t=await this._provider.getFiles();for(const r of t)if(r.id===e)return r;throw new Error(`InternalError: File ${e} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(e){return(await this._getFileInfoById(e)).file}async _createParquetQuery(e,t){const r=(await P()).Query.new();return"tile"===t.type&&(r.setExtent(t.extent),r.setQuantizationTransform(t.transform),r.setScale(t.scale)),r.setOutFields(t.outFields.filter(e=>null!=this._indexMap[e])),r.setOutSpatialReference(t.outSpatialReference.wkid),r.setReturnGeometry(t.returnGeometry),t.where&&await this._setWhereClause(r,e,t.where),r}async _getFeatureCount(){return(await this._provider.getFiles()).map(e=>e.statistics.rowCount).reduce((e,t)=>e+t,0)}async _getByteLength(){return(await this._provider.getFiles()).map(e=>e.statistics.byteSize).reduce((e,t)=>e+t,0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new s("parquet:unsupported","Statistics queries are not supported",{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new s("parquet:unsupported","Queries using orderBy are not supported",{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new s("parquet:unsupported","Queries using returnDistinctValues are not supported",{query:e})}async _setWhereClause(e,t,r){const i=this._indexMap,a=this._fieldsIndex,n={getAttribute(e,r){const s=t.readAttribute(e.rowGroup,e.row,i[r]);if(null==s)return null;const n=a.get(r);return"esriFieldTypeString"===n.type||"esriFieldTypeDateOnly"===n.type||"esriFieldTypeTimeOnly"===n.type||"esriFieldTypeTimestampOffset"===n.type?D.decode(s):s}},o=await u(r,this._fieldsIndex);if(!o.isStandardized)throw new s("sql-parse-error","expression is not standardized");const l=(e,t)=>o.testFeatureCompiled({rowGroup:e,row:t},n,null);e.setWhere(r),e.setWhereEvaluator(l),e.setWhereFields(o.fieldNames)}async*_fetchChunks(e,t){const r=await P(),s=await this._provider.getFiles();for(const i of s){const s=await i.file,a=r.Query.new();a.setOutFields(e.fields),a.setReturnGeometry(e.returnGeometry),e.where&&await this._setWhereClause(a,s,e.where);const o=await s.executeQuery(a),u=[],l=o.next(t);for(let e=0;e<B;e++)u.push(o.next(t));let p=await l;for(;null!=p;){n(t);const e=new A(this._metadata,this._indexMap,p,i.id),r=Y([new T(e,null,0,!1)],this._queryEngineParams),s=u.shift();u.push(o.next(t)),yield r,p=await s}}}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){const r=await this._getReadParams(e);if(e.where=void 0,e.objectIds?.length){const r=new Map;for(const t of e.objectIds){const e=S(t),s=R(t);let i=r.get(e);i||(i=[],r.set(e,i)),i.push(s)}const s=[];for(const[i,a]of r.entries()){const r=await this._executeFileIdQuery(e,i,a,t);for(const e of r)s.push(e)}return new w(s,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:M,featureIdInfo:this._queryEngineParams.featureIdInfo})}let s=e.resultRecordCount??await this._getFeatureCount(),i=e.resultOffset??0;e.resultRecordCount=void 0,e.resultOffset=void 0;const a=[];for await(const n of this._fetchChunks(r,t)){const r=await n.executeQueryForOpaqueFeatures(e,t);if(r.length>i){const t=r.slice(i,Math.min(i+s,r.length));for(const e of t)a.push(e);if(i=0,s-=t.length,0===s)return new w(a,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:M,featureIdInfo:this._queryEngineParams.featureIdInfo})}else i-=r.length}return new w(a,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:M,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,r,s){const i=await this._getReadParams(e),a=(await P()).Query.new();a.setOutFields(i.fields),a.setReturnGeometry(i.returnGeometry),a.setIds(new Uint32Array(r));const n=await this._getFile(t),o=await n.executeQuery(a,s);let u=await o.next(s),l=0;const p=[];for(;null!=u;){const e=new A(this._metadata,this._indexMap,u,t),r=new T(e,null,l++,!1);p.push(r),u=await o.next(s)}return Y(p,this._queryEngineParams).executeQueryForOpaqueFeatures(e,s)}async _getReadParams(e){const t=new Set;if(e.outStatistics)for(const r of e.outStatistics)null!=r.onStatisticField&&t.add(r.onStatisticField);if(e.outFields)for(const r of e.outFields)t.add(r);return{fields:(t.has("*")?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>null!=this._indexMap[e]),returnGeometry:!!e.returnGeometry||!!e.geometry,where:e.where}}}function H(e){for(const t in e){const r=t;switch(r){case"resultOffset":case"resultRecordCount":case"aggregateIds":case"distance":case"gdbVersion":case"geometry":case"having":case"timeExtent":case"objectIds":case"historicMoment":case"where":return null!=e[r]}}return!1}function Y(e,t){const r=new j;for(const s of e)r.insert(s);return new y({...t,featureStore:r})}function X(e,t){return e.statistics.statistics.get(t.fieldName)??null}function $(e,t){return e.slice().sort((e,r)=>{const s=K(e,t),i=K(r,t);return s===i?0:s<i?-1:1})}function K(e,t){const r=X(e,t);if(null==r)return Number.POSITIVE_INFINITY;const s=se(r.minValue),i=se(r.maxValue);return null==s||null==i||i<s?Number.POSITIVE_INFINITY:i-s}function ee(e,t){return{xStatistics:e.statistics.statistics.get(t.xFieldName)??null,yStatistics:e.statistics.statistics.get(t.yFieldName)??null}}function te(e,t){const r=se(e.minValue),s=se(e.maxValue);return null==r||null==s||t.intersects(r,s)}function re(e,t,r){const s=se(e.minValue),i=se(e.maxValue),a=se(t.minValue),n=se(t.maxValue);return null==s||null==i||null==a||null==n||r.intersects(s,i,a,n)}function se(e){return"number"==typeof e&&Number.isFinite(e)?e:null}function ie(e){const t=e?.featureCount;let r=!1;return null!=t&&t<has("parquetlayer-full-query-feature-count")&&(r=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:!1,supportsTrueCurve:!1,supportsZ:!1},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{..._,maxRecordCount:z,supportsDistinct:r,supportsOrderBy:r,supportsStatistics:r,supportsSpatialAggregationStatistics:r,supportedSpatialAggregationStatistics:{envelope:r,centroid:r,convexHull:r}},queryAttributeBins:r?g:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}function ae(e){return!!(e.objectIds?.length||e.outStatistics||e.orderByFields?.length||e.returnDistinctValues)}export{L as default};
@@ -11,7 +11,7 @@ export interface GeometryEncodingLocationProperties extends Partial<Pick<Geometr
11
11
  * For other coordinate field names, set the [xField](https://developers.arcgis.com/javascript/latest/references/core/layers/support/GeometryEncodingLocation/#xField) and [yField](https://developers.arcgis.com/javascript/latest/references/core/layers/support/GeometryEncodingLocation/#yField) properties to the names of the fields
12
12
  * containing the latitude and longitude values respectively.
13
13
  *
14
- * @since 4.33
14
+ * @since 5.1
15
15
  * @see [ParquetLayer.geometryEncoding](https://developers.arcgis.com/javascript/latest/references/core/layers/ParquetLayer/#geometryEncoding)
16
16
  * @see [getParquetLayerInfo()](https://developers.arcgis.com/javascript/latest/references/core/layers/support/parquetUtils/#getParquetLayerInfo)
17
17
  */
@@ -1,13 +1,14 @@
1
1
  import type { ClonableMixin } from "../../core/Clonable.js";
2
2
  import type { JSONSupport } from "../../core/JSONSupport.js";
3
3
 
4
- /** @since 5.0 */
4
+ /** @since 5.1 */
5
5
  export interface GeometryEncodingWkbProperties extends Partial<Pick<GeometryEncodingWkb, "field" | "orientation">> {}
6
6
 
7
7
  /**
8
8
  * Well-Known Binary (WKB) is a binary format used to encode geometries in a column.
9
9
  *
10
- * @since 4.33
10
+ * @beta
11
+ * @since 5.1
11
12
  * @see [ParquetLayer.geometryEncoding](https://developers.arcgis.com/javascript/latest/references/core/layers/ParquetLayer/#geometryEncoding)
12
13
  * @see [getParquetLayerInfo()](https://developers.arcgis.com/javascript/latest/references/core/layers/support/parquetUtils/#getParquetLayerInfo)
13
14
  */