text: import{r as e,s as t}from"./vendor.d9ce5f39.js";import{h as r}from"./PooledRBush.60d20fb8.js";import{_ as o}from"./georeference.ee88f962.js";import"./quickselect.c0fda8e0.js";import"./quat.b9d69b87.js";import"./vec4.d028c393.js";import"./vec33.6044102f.js";import"./BufferView.77b40d9f.js";class n{async createIndex(t,o){const n=new Array;if(!t.vertexAttributes||!t.vertexAttributes.position)return new r;const s=this.createMeshData(t),a=e(o)?await o.invoke("createIndexThread",s,{transferList:n}):this.createIndexThread(s).result;return this.createPooledRBush().fromJSON(a)}createIndexThread(e){const t=new Float64Array(e.position),r=this.createPooledRBush();return e.components?this.createIndexComponentsThread(r,t,e.components.map((e=>new Uint32Array(e)))):this.createIndexAllThread(r,t)}createIndexAllThread(e,t){const r=new Array(t.length/9);let o=0;for(let n=0;n<t.length;n+=9)r[o++]=s(t,n+0,n+3,n+6);return e.load(r),{result:e.toJSON()}}createIndexComponentsThread(e,t,r){let o=0;for(const s of r)o+=s.length/3;const n=new Array(o);let a=0;for(const i of r)for(let e=0;e<i.length;e+=3)n[a++]=s(t,3*i[e+0],3*i[e+1],3*i[e+2]);return e.load(n),{result:e.toJSON()}}createMeshData(e){const t=(e.transform?o({position:e.vertexAttributes.position,normal:null,tangent:null},e.transform,e.spatialReference).position:e.vertexAttributes.position).buffer;return!e.components||e.components.some((e=>!e.faces))?{position:t}:{position:t,components:e.components.map((e=>e.faces))}}createPooledRBush(){return new r(9,t("csp-restrictions")?e=>e:[".minX",".minY",".maxX",".maxY"])}}function s(e,t,r,o){return{minX:Math.min(e[t+0],e[r+0],e[o+0]),maxX:Math.max(e[t+0],e[r+0],e[o+0]),minY:Math.min(e[t+1],e[r+1],e[o+1]),maxY:Math.max(e[t+1],e[r+1],e[o+1]),p0:[e[t+0],e[t+1],e[t+2]],p1:[e[r+0],e[r+1],e[r+2]],p2:[e[o+0],e[o+1],e[o+2]]}}export default n;export{n as ElevationSamplerWorker};
  