define(["./Matrix2-ccd5b911","./combine-83860057","./AttributeCompression-1f045b73","./ComponentDatatype-93750d1a","./IndexDatatype-b7d979a6","./createTaskProcessorWorker","./RuntimeError-346a3079","./when-4bbc8319","./WebGLConstants-1c8239cc"],function(L,S,_,G,W,a,e,r,n){"use strict";var B=32767,O=new L.Cartographic,z=new L.Cartesian3;var H=new L.Rectangle,Y=new L.Ellipsoid,Z=new L.Cartesian3,j={min:void 0,max:void 0};var q=new L.Cartesian3,J=new L.Cartesian3,K=new L.Cartesian3,Q=new L.Cartesian3,V=new L.Cartesian3;return a(function(a,e){var r=new Uint16Array(a.positions),n=new Uint16Array(a.widths),t=new Uint32Array(a.counts),i=new Uint16Array(a.batchIds);!function(a){a=new Float64Array(a);var e=0;j.min=a[e++],j.max=a[e++],L.Rectangle.unpack(a,2,H),e+=L.Rectangle.packedLength,L.Ellipsoid.unpack(a,e,Y),e+=L.Ellipsoid.packedLength,L.Cartesian3.unpack(a,e,Z)}(a.packedBuffer);for(var s=Y,o=Z,u=function(a,e,r,n,t){var i=a.length/3,s=a.subarray(0,i),o=a.subarray(i,2*i),u=a.subarray(2*i,3*i);_.AttributeCompression.zigZagDeltaDecode(s,o,u);for(var c=new Float64Array(a.length),f=0;f<i;++f){var p=s[f],d=o[f],b=u[f],p=G.CesiumMath.lerp(e.west,e.east,p/B),d=G.CesiumMath.lerp(e.south,e.north,d/B),b=G.CesiumMath.lerp(r,n,b/B),b=L.Cartographic.fromRadians(p,d,b,O),b=t.cartographicToCartesian(b,z);L.Cartesian3.pack(b,c,3*f)}return c}(r,H,j.min,j.max,s),s=4*(r=u.length/3)-4,c=new Float32Array(3*s),f=new Float32Array(3*s),p=new Float32Array(3*s),d=new Float32Array(2*s),b=new Uint16Array(s),C=0,w=0,l=0,h=0,y=t.length,k=0;k<y;++k){for(var v,m=t[k],A=n[k],g=i[k],x=0;x<m;++x){0===x?(E=L.Cartesian3.unpack(u,3*h,q),D=L.Cartesian3.unpack(u,3*(h+1),J),v=L.Cartesian3.subtract(E,D,K),L.Cartesian3.add(E,v,v)):v=L.Cartesian3.unpack(u,3*(h+x-1),K);var D,E,I,P=L.Cartesian3.unpack(u,3*(h+x),Q);x===m-1?(D=L.Cartesian3.unpack(u,3*(h+m-1),q),E=L.Cartesian3.unpack(u,3*(h+m-2),J),I=L.Cartesian3.subtract(D,E,V),L.Cartesian3.add(D,I,I)):I=L.Cartesian3.unpack(u,3*(h+x+1),V),L.Cartesian3.subtract(v,o,v),L.Cartesian3.subtract(P,o,P),L.Cartesian3.subtract(I,o,I);for(var U=x===m-1?2:4,R=0===x?2:0;R<U;++R){L.Cartesian3.pack(P,c,C),L.Cartesian3.pack(v,f,C),L.Cartesian3.pack(I,p,C),C+=3;var T=R-2<0?-1:1;d[w++]=R%2*2-1,d[w++]=T*A,b[l++]=g}}h+=m}var F=W.IndexDatatype.createTypedArray(s,6*r-6),N=0,M=0,y=r-1;for(k=0;k<y;++k)F[M++]=N,F[M++]=N+2,F[M++]=N+1,F[M++]=N+1,F[M++]=N+2,F[M++]=N+3,N+=4;return e.push(c.buffer,f.buffer,p.buffer),e.push(d.buffer,b.buffer,F.buffer),r={indexDatatype:2===F.BYTES_PER_ELEMENT?W.IndexDatatype.UNSIGNED_SHORT:W.IndexDatatype.UNSIGNED_INT,currentPositions:c.buffer,previousPositions:f.buffer,nextPositions:p.buffer,expandAndWidth:d.buffer,batchIds:b.buffer,indices:F.buffer},a.keepDecodedPositions&&(a=function(a){for(var e=a.length,r=new Uint32Array(e+1),n=0,t=0;t<e;++t)r[t]=n,n+=a[t];return r[e]=n,r}(t),e.push(u.buffer,a.buffer),r=S.combine(r,{decodedPositions:u.buffer,decodedPositionOffsets:a.buffer})),r})});
