/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{assert as r}from"../../lib/Util.js";import{DataType as t}from"../../../../webgl/enums.js";class e{constructor(r){this.bufferConstructor=r,this.dataType=r===Uint8Array?t.UNSIGNED_BYTE:r===Uint16Array?t.UNSIGNED_SHORT:t.UNSIGNED_INT}get stride(){return this.bufferConstructor.BYTES_PER_ELEMENT}createView(r,t){return new this.bufferConstructor(r,t)}}const n=new e(Uint8Array),i=new e(Uint16Array),s=new e(Uint32Array);function u(e){switch(e){case t.UNSIGNED_BYTE:return n;case t.UNSIGNED_SHORT:return i;case t.UNSIGNED_INT:case void 0:case null:return s;default:r(!1,`Invalid dataType ${e}`)}}function a(r){return u(r).stride}function o(r){return null==r?s:r<255?n:r<65535?i:s}export{e as IndexLayout,u as getIndexLayoutForDataType,o as getIndexLayoutForMaxIndex,a as getStrideForDataType};
