{"version":3,"file":"ktx-parse.modern.js","sources":["../src/constants.ts","../src/container.ts","../src/buffer-reader.ts","../src/constants-internal.ts","../src/util.ts","../src/read.ts","../src/write.ts"],"sourcesContent":["///////////////////////////////////////////////////\n// KTX2 Header.\n///////////////////////////////////////////////////\n\nexport const KHR_SUPERCOMPRESSION_NONE = 0;\nexport const KHR_SUPERCOMPRESSION_BASISLZ = 1;\nexport const KHR_SUPERCOMPRESSION_ZSTD = 2;\nexport const KHR_SUPERCOMPRESSION_ZLIB = 3;\n\nexport type Supercompression =\n\t| typeof KHR_SUPERCOMPRESSION_NONE\n\t| typeof KHR_SUPERCOMPRESSION_BASISLZ\n\t| typeof KHR_SUPERCOMPRESSION_ZSTD\n\t| typeof KHR_SUPERCOMPRESSION_ZLIB;\n\n///////////////////////////////////////////////////\n// Data Format Descriptor (DFD).\n///////////////////////////////////////////////////\n\nexport const KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT = 0;\nexport const KHR_DF_VENDORID_KHRONOS = 0;\nexport const KHR_DF_VERSION = 2;\n\nexport const KHR_DF_MODEL_UNSPECIFIED = 0;\nexport const KHR_DF_MODEL_RGBSDA = 1;\n// ...\nexport const KHR_DF_MODEL_ETC1 = 160;\nexport const KHR_DF_MODEL_ETC2 = 161;\nexport const KHR_DF_MODEL_ASTC = 162;\nexport const KHR_DF_MODEL_ETC1S = 163;\nexport const KHR_DF_MODEL_UASTC = 166;\n\nexport const KHR_DF_FLAG_ALPHA_STRAIGHT = 0;\nexport const KHR_DF_FLAG_ALPHA_PREMULTIPLIED = 1;\n\nexport const KHR_DF_TRANSFER_UNSPECIFIED = 0;\nexport const KHR_DF_TRANSFER_LINEAR = 1;\nexport const KHR_DF_TRANSFER_SRGB = 2;\nexport const KHR_DF_TRANSFER_ITU = 3;\nexport const KHR_DF_TRANSFER_NTSC = 4;\nexport const KHR_DF_TRANSFER_SLOG = 5;\nexport const KHR_DF_TRANSFER_SLOG2 = 6;\nexport const KHR_DF_TRANSFER_BT1886 = 7;\nexport const KHR_DF_TRANSFER_HLG_OETF = 8;\nexport const KHR_DF_TRANSFER_HLG_EOTF = 9;\nexport const KHR_DF_TRANSFER_PQ_EOTF = 10;\nexport const KHR_DF_TRANSFER_PQ_OETF = 11;\nexport const KHR_DF_TRANSFER_DCIP3 = 12;\nexport const KHR_DF_TRANSFER_PAL_OETF = 13;\nexport const KHR_DF_TRANSFER_PAL625_EOTF = 14;\nexport const KHR_DF_TRANSFER_ST240 = 15;\nexport const KHR_DF_TRANSFER_ACESCC = 16;\nexport const KHR_DF_TRANSFER_ACESCCT = 17;\nexport const KHR_DF_TRANSFER_ADOBERGB = 18;\n\nexport type Transfer =\n\t| typeof KHR_DF_TRANSFER_UNSPECIFIED\n\t| typeof KHR_DF_TRANSFER_LINEAR\n\t| typeof KHR_DF_TRANSFER_SRGB\n\t| typeof KHR_DF_TRANSFER_ITU\n\t| typeof KHR_DF_TRANSFER_NTSC\n\t| typeof KHR_DF_TRANSFER_SLOG\n\t| typeof KHR_DF_TRANSFER_SLOG2\n\t| typeof KHR_DF_TRANSFER_BT1886\n\t| typeof KHR_DF_TRANSFER_HLG_OETF\n\t| typeof KHR_DF_TRANSFER_HLG_EOTF\n\t| typeof KHR_DF_TRANSFER_PQ_EOTF\n\t| typeof KHR_DF_TRANSFER_PQ_OETF\n\t| typeof KHR_DF_TRANSFER_DCIP3\n\t| typeof KHR_DF_TRANSFER_PAL_OETF\n\t| typeof KHR_DF_TRANSFER_PAL625_EOTF\n\t| typeof KHR_DF_TRANSFER_ST240\n\t| typeof KHR_DF_TRANSFER_ACESCC\n\t| typeof KHR_DF_TRANSFER_ACESCCT\n\t| typeof KHR_DF_TRANSFER_ADOBERGB;\n\nexport const KHR_DF_PRIMARIES_UNSPECIFIED = 0;\nexport const KHR_DF_PRIMARIES_BT709 = 1;\nexport const KHR_DF_PRIMARIES_BT601_EBU = 2;\nexport const KHR_DF_PRIMARIES_BT601_SMPTE = 3;\nexport const KHR_DF_PRIMARIES_BT2020 = 4;\nexport const KHR_DF_PRIMARIES_CIEXYZ = 5;\nexport const KHR_DF_PRIMARIES_ACES = 6;\nexport const KHR_DF_PRIMARIES_ACESCC = 7;\nexport const KHR_DF_PRIMARIES_NTSC1953 = 8;\nexport const KHR_DF_PRIMARIES_PAL525 = 9;\nexport const KHR_DF_PRIMARIES_DISPLAYP3 = 10;\nexport const KHR_DF_PRIMARIES_ADOBERGB = 11;\n\nexport type Primaries =\n\t| typeof KHR_DF_PRIMARIES_UNSPECIFIED\n\t| typeof KHR_DF_PRIMARIES_BT709\n\t| typeof KHR_DF_PRIMARIES_BT601_EBU\n\t| typeof KHR_DF_PRIMARIES_BT601_SMPTE\n\t| typeof KHR_DF_PRIMARIES_BT2020\n\t| typeof KHR_DF_PRIMARIES_CIEXYZ\n\t| typeof KHR_DF_PRIMARIES_ACES\n\t| typeof KHR_DF_PRIMARIES_ACESCC\n\t| typeof KHR_DF_PRIMARIES_NTSC1953\n\t| typeof KHR_DF_PRIMARIES_PAL525\n\t| typeof KHR_DF_PRIMARIES_DISPLAYP3\n\t| typeof KHR_DF_PRIMARIES_ADOBERGB;\n\nexport const KHR_DF_CHANNEL_RGBSDA_RED = 0;\nexport const KHR_DF_CHANNEL_RGBSDA_GREEN = 1;\nexport const KHR_DF_CHANNEL_RGBSDA_BLUE = 2;\nexport const KHR_DF_CHANNEL_RGBSDA_STENCIL = 13;\nexport const KHR_DF_CHANNEL_RGBSDA_DEPTH = 14;\nexport const KHR_DF_CHANNEL_RGBSDA_ALPHA = 15;\n\nexport type Channel =\n\t| typeof KHR_DF_CHANNEL_RGBSDA_RED\n\t| typeof KHR_DF_CHANNEL_RGBSDA_GREEN\n\t| typeof KHR_DF_CHANNEL_RGBSDA_BLUE\n\t| typeof KHR_DF_CHANNEL_RGBSDA_STENCIL\n\t| typeof KHR_DF_CHANNEL_RGBSDA_DEPTH\n\t| typeof KHR_DF_CHANNEL_RGBSDA_ALPHA;\n\nexport const KHR_DF_SAMPLE_DATATYPE_FLOAT = 0x80;\nexport const KHR_DF_SAMPLE_DATATYPE_SIGNED = 0x40;\nexport const KHR_DF_SAMPLE_DATATYPE_EXPONENT = 0x20;\nexport const KHR_DF_SAMPLE_DATATYPE_LINEAR = 0x10;\n\nexport type SampleDatatype =\n\t| typeof KHR_DF_SAMPLE_DATATYPE_FLOAT\n\t| typeof KHR_DF_SAMPLE_DATATYPE_SIGNED\n\t| typeof KHR_DF_SAMPLE_DATATYPE_EXPONENT\n\t| typeof KHR_DF_SAMPLE_DATATYPE_LINEAR;\n\n///////////////////////////////////////////////////\n// VK FORMAT.\n///////////////////////////////////////////////////\n\nexport const VK_FORMAT_UNDEFINED = 0;\nexport const VK_FORMAT_R4G4_UNORM_PACK8 = 1;\nexport const VK_FORMAT_R4G4B4A4_UNORM_PACK16 = 2;\nexport const VK_FORMAT_B4G4R4A4_UNORM_PACK16 = 3;\nexport const VK_FORMAT_R5G6B5_UNORM_PACK16 = 4;\nexport const VK_FORMAT_B5G6R5_UNORM_PACK16 = 5;\nexport const VK_FORMAT_R5G5B5A1_UNORM_PACK16 = 6;\nexport const VK_FORMAT_B5G5R5A1_UNORM_PACK16 = 7;\nexport const VK_FORMAT_A1R5G5B5_UNORM_PACK16 = 8;\nexport const VK_FORMAT_R8_UNORM = 9;\nexport const VK_FORMAT_R8_SNORM = 10;\nexport const VK_FORMAT_R8_UINT = 13;\nexport const VK_FORMAT_R8_SINT = 14;\nexport const VK_FORMAT_R8_SRGB = 15;\nexport const VK_FORMAT_R8G8_UNORM = 16;\nexport const VK_FORMAT_R8G8_SNORM = 17;\nexport const VK_FORMAT_R8G8_UINT = 20;\nexport const VK_FORMAT_R8G8_SINT = 21;\nexport const VK_FORMAT_R8G8_SRGB = 22;\nexport const VK_FORMAT_R8G8B8_UNORM = 23;\nexport const VK_FORMAT_R8G8B8_SNORM = 24;\nexport const VK_FORMAT_R8G8B8_UINT = 27;\nexport const VK_FORMAT_R8G8B8_SINT = 28;\nexport const VK_FORMAT_R8G8B8_SRGB = 29;\nexport const VK_FORMAT_B8G8R8_UNORM = 30;\nexport const VK_FORMAT_B8G8R8_SNORM = 31;\nexport const VK_FORMAT_B8G8R8_UINT = 34;\nexport const VK_FORMAT_B8G8R8_SINT = 35;\nexport const VK_FORMAT_B8G8R8_SRGB = 36;\nexport const VK_FORMAT_R8G8B8A8_UNORM = 37;\nexport const VK_FORMAT_R8G8B8A8_SNORM = 38;\nexport const VK_FORMAT_R8G8B8A8_UINT = 41;\nexport const VK_FORMAT_R8G8B8A8_SINT = 42;\nexport const VK_FORMAT_R8G8B8A8_SRGB = 43;\nexport const VK_FORMAT_B8G8R8A8_UNORM = 44;\nexport const VK_FORMAT_B8G8R8A8_SNORM = 45;\nexport const VK_FORMAT_B8G8R8A8_UINT = 48;\nexport const VK_FORMAT_B8G8R8A8_SINT = 49;\nexport const VK_FORMAT_B8G8R8A8_SRGB = 50;\nexport const VK_FORMAT_A2R10G10B10_UNORM_PACK32 = 58;\nexport const VK_FORMAT_A2R10G10B10_SNORM_PACK32 = 59;\nexport const VK_FORMAT_A2R10G10B10_UINT_PACK32 = 62;\nexport const VK_FORMAT_A2R10G10B10_SINT_PACK32 = 63;\nexport const VK_FORMAT_A2B10G10R10_UNORM_PACK32 = 64;\nexport const VK_FORMAT_A2B10G10R10_SNORM_PACK32 = 65;\nexport const VK_FORMAT_A2B10G10R10_UINT_PACK32 = 68;\nexport const VK_FORMAT_A2B10G10R10_SINT_PACK32 = 69;\nexport const VK_FORMAT_R16_UNORM = 70;\nexport const VK_FORMAT_R16_SNORM = 71;\nexport const VK_FORMAT_R16_UINT = 74;\nexport const VK_FORMAT_R16_SINT = 75;\nexport const VK_FORMAT_R16_SFLOAT = 76;\nexport const VK_FORMAT_R16G16_UNORM = 77;\nexport const VK_FORMAT_R16G16_SNORM = 78;\nexport const VK_FORMAT_R16G16_UINT = 81;\nexport const VK_FORMAT_R16G16_SINT = 82;\nexport const VK_FORMAT_R16G16_SFLOAT = 83;\nexport const VK_FORMAT_R16G16B16_UNORM = 84;\nexport const VK_FORMAT_R16G16B16_SNORM = 85;\nexport const VK_FORMAT_R16G16B16_UINT = 88;\nexport const VK_FORMAT_R16G16B16_SINT = 89;\nexport const VK_FORMAT_R16G16B16_SFLOAT = 90;\nexport const VK_FORMAT_R16G16B16A16_UNORM = 91;\nexport const VK_FORMAT_R16G16B16A16_SNORM = 92;\nexport const VK_FORMAT_R16G16B16A16_UINT = 95;\nexport const VK_FORMAT_R16G16B16A16_SINT = 96;\nexport const VK_FORMAT_R16G16B16A16_SFLOAT = 97;\nexport const VK_FORMAT_R32_UINT = 98;\nexport const VK_FORMAT_R32_SINT = 99;\nexport const VK_FORMAT_R32_SFLOAT = 100;\nexport const VK_FORMAT_R32G32_UINT = 101;\nexport const VK_FORMAT_R32G32_SINT = 102;\nexport const VK_FORMAT_R32G32_SFLOAT = 103;\nexport const VK_FORMAT_R32G32B32_UINT = 104;\nexport const VK_FORMAT_R32G32B32_SINT = 105;\nexport const VK_FORMAT_R32G32B32_SFLOAT = 106;\nexport const VK_FORMAT_R32G32B32A32_UINT = 107;\nexport const VK_FORMAT_R32G32B32A32_SINT = 108;\nexport const VK_FORMAT_R32G32B32A32_SFLOAT = 109;\nexport const VK_FORMAT_R64_UINT = 110;\nexport const VK_FORMAT_R64_SINT = 111;\nexport const VK_FORMAT_R64_SFLOAT = 112;\nexport const VK_FORMAT_R64G64_UINT = 113;\nexport const VK_FORMAT_R64G64_SINT = 114;\nexport const VK_FORMAT_R64G64_SFLOAT = 115;\nexport const VK_FORMAT_R64G64B64_UINT = 116;\nexport const VK_FORMAT_R64G64B64_SINT = 117;\nexport const VK_FORMAT_R64G64B64_SFLOAT = 118;\nexport const VK_FORMAT_R64G64B64A64_UINT = 119;\nexport const VK_FORMAT_R64G64B64A64_SINT = 120;\nexport const VK_FORMAT_R64G64B64A64_SFLOAT = 121;\nexport const VK_FORMAT_B10G11R11_UFLOAT_PACK32 = 122;\nexport const VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = 123;\nexport const VK_FORMAT_D16_UNORM = 124;\nexport const VK_FORMAT_X8_D24_UNORM_PACK32 = 125;\nexport const VK_FORMAT_D32_SFLOAT = 126;\nexport const VK_FORMAT_S8_UINT = 127;\nexport const VK_FORMAT_D16_UNORM_S8_UINT = 128;\nexport const VK_FORMAT_D24_UNORM_S8_UINT = 129;\nexport const VK_FORMAT_D32_SFLOAT_S8_UINT = 130;\nexport const VK_FORMAT_BC1_RGB_UNORM_BLOCK = 131;\nexport const VK_FORMAT_BC1_RGB_SRGB_BLOCK = 132;\nexport const VK_FORMAT_BC1_RGBA_UNORM_BLOCK = 133;\nexport const VK_FORMAT_BC1_RGBA_SRGB_BLOCK = 134;\nexport const VK_FORMAT_BC2_UNORM_BLOCK = 135;\nexport const VK_FORMAT_BC2_SRGB_BLOCK = 136;\nexport const VK_FORMAT_BC3_UNORM_BLOCK = 137;\nexport const VK_FORMAT_BC3_SRGB_BLOCK = 138;\nexport const VK_FORMAT_BC4_UNORM_BLOCK = 139;\nexport const VK_FORMAT_BC4_SNORM_BLOCK = 140;\nexport const VK_FORMAT_BC5_UNORM_BLOCK = 141;\nexport const VK_FORMAT_BC5_SNORM_BLOCK = 142;\nexport const VK_FORMAT_BC6H_UFLOAT_BLOCK = 143;\nexport const VK_FORMAT_BC6H_SFLOAT_BLOCK = 144;\nexport const VK_FORMAT_BC7_UNORM_BLOCK = 145;\nexport const VK_FORMAT_BC7_SRGB_BLOCK = 146;\nexport const VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = 147;\nexport const VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = 148;\nexport const VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = 149;\nexport const VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = 150;\nexport const VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = 151;\nexport const VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = 152;\nexport const VK_FORMAT_EAC_R11_UNORM_BLOCK = 153;\nexport const VK_FORMAT_EAC_R11_SNORM_BLOCK = 154;\nexport const VK_FORMAT_EAC_R11G11_UNORM_BLOCK = 155;\nexport const VK_FORMAT_EAC_R11G11_SNORM_BLOCK = 156;\nexport const VK_FORMAT_ASTC_4x4_UNORM_BLOCK = 157;\nexport const VK_FORMAT_ASTC_4x4_SRGB_BLOCK = 158;\nexport const VK_FORMAT_ASTC_5x4_UNORM_BLOCK = 159;\nexport const VK_FORMAT_ASTC_5x4_SRGB_BLOCK = 160;\nexport const VK_FORMAT_ASTC_5x5_UNORM_BLOCK = 161;\nexport const VK_FORMAT_ASTC_5x5_SRGB_BLOCK = 162;\nexport const VK_FORMAT_ASTC_6x5_UNORM_BLOCK = 163;\nexport const VK_FORMAT_ASTC_6x5_SRGB_BLOCK = 164;\nexport const VK_FORMAT_ASTC_6x6_UNORM_BLOCK = 165;\nexport const VK_FORMAT_ASTC_6x6_SRGB_BLOCK = 166;\nexport const VK_FORMAT_ASTC_8x5_UNORM_BLOCK = 167;\nexport const VK_FORMAT_ASTC_8x5_SRGB_BLOCK = 168;\nexport const VK_FORMAT_ASTC_8x6_UNORM_BLOCK = 169;\nexport const VK_FORMAT_ASTC_8x6_SRGB_BLOCK = 170;\nexport const VK_FORMAT_ASTC_8x8_UNORM_BLOCK = 171;\nexport const VK_FORMAT_ASTC_8x8_SRGB_BLOCK = 172;\nexport const VK_FORMAT_ASTC_10x5_UNORM_BLOCK = 173;\nexport const VK_FORMAT_ASTC_10x5_SRGB_BLOCK = 174;\nexport const VK_FORMAT_ASTC_10x6_UNORM_BLOCK = 175;\nexport const VK_FORMAT_ASTC_10x6_SRGB_BLOCK = 176;\nexport const VK_FORMAT_ASTC_10x8_UNORM_BLOCK = 177;\nexport const VK_FORMAT_ASTC_10x8_SRGB_BLOCK = 178;\nexport const VK_FORMAT_ASTC_10x10_UNORM_BLOCK = 179;\nexport const VK_FORMAT_ASTC_10x10_SRGB_BLOCK = 180;\nexport const VK_FORMAT_ASTC_12x10_UNORM_BLOCK = 181;\nexport const VK_FORMAT_ASTC_12x10_SRGB_BLOCK = 182;\nexport const VK_FORMAT_ASTC_12x12_UNORM_BLOCK = 183;\nexport const VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184;\nexport const VK_FORMAT_R10X6_UNORM_PACK16 = 1000156007;\nexport const VK_FORMAT_R10X6G10X6_UNORM_2PACK16 = 1000156008;\nexport const VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16 = 1000156009;\nexport const VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16 = 1000156010;\nexport const VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16 = 1000156011;\nexport const VK_FORMAT_R12X4_UNORM_PACK16 = 1000156017;\nexport const VK_FORMAT_R12X4G12X4_UNORM_2PACK16 = 1000156018;\nexport const VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16 = 1000156019;\nexport const VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16 = 1000156020;\nexport const VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16 = 1000156021;\nexport const VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG = 1000054000;\nexport const VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG = 1000054001;\nexport const VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG = 1000054002;\nexport const VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG = 1000054003;\nexport const VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG = 1000054004;\nexport const VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = 1000054005;\nexport const VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = 1000054006;\nexport const VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = 1000054007;\nexport const VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT = 1000066000;\nexport const VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT = 1000066001;\nexport const VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT = 1000066002;\nexport const VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT = 1000066003;\nexport const VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT = 1000066004;\nexport const VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT = 1000066005;\nexport const VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT = 1000066006;\nexport const VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT = 1000066007;\nexport const VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT = 1000066008;\nexport const VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT = 1000066009;\nexport const VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT = 1000066010;\nexport const VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT = 1000066011;\nexport const VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT = 1000066012;\nexport const VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT = 1000066013;\nexport const VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT = 1000340000;\nexport const VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT = 1000340001;\n\nexport type VKFormat =\n\t| typeof VK_FORMAT_UNDEFINED\n\t| typeof VK_FORMAT_R4G4_UNORM_PACK8\n\t| typeof VK_FORMAT_R4G4B4A4_UNORM_PACK16\n\t| typeof VK_FORMAT_B4G4R4A4_UNORM_PACK16\n\t| typeof VK_FORMAT_R5G6B5_UNORM_PACK16\n\t| typeof VK_FORMAT_B5G6R5_UNORM_PACK16\n\t| typeof VK_FORMAT_R5G5B5A1_UNORM_PACK16\n\t| typeof VK_FORMAT_B5G5R5A1_UNORM_PACK16\n\t| typeof VK_FORMAT_A1R5G5B5_UNORM_PACK16\n\t| typeof VK_FORMAT_R8_UNORM\n\t| typeof VK_FORMAT_R8_SNORM\n\t| typeof VK_FORMAT_R8_UINT\n\t| typeof VK_FORMAT_R8_SINT\n\t| typeof VK_FORMAT_R8_SRGB\n\t| typeof VK_FORMAT_R8G8_UNORM\n\t| typeof VK_FORMAT_R8G8_SNORM\n\t| typeof VK_FORMAT_R8G8_UINT\n\t| typeof VK_FORMAT_R8G8_SINT\n\t| typeof VK_FORMAT_R8G8_SRGB\n\t| typeof VK_FORMAT_R8G8B8_UNORM\n\t| typeof VK_FORMAT_R8G8B8_SNORM\n\t| typeof VK_FORMAT_R8G8B8_UINT\n\t| typeof VK_FORMAT_R8G8B8_SINT\n\t| typeof VK_FORMAT_R8G8B8_SRGB\n\t| typeof VK_FORMAT_B8G8R8_UNORM\n\t| typeof VK_FORMAT_B8G8R8_SNORM\n\t| typeof VK_FORMAT_B8G8R8_UINT\n\t| typeof VK_FORMAT_B8G8R8_SINT\n\t| typeof VK_FORMAT_B8G8R8_SRGB\n\t| typeof VK_FORMAT_R8G8B8A8_UNORM\n\t| typeof VK_FORMAT_R8G8B8A8_SNORM\n\t| typeof VK_FORMAT_R8G8B8A8_UINT\n\t| typeof VK_FORMAT_R8G8B8A8_SINT\n\t| typeof VK_FORMAT_R8G8B8A8_SRGB\n\t| typeof VK_FORMAT_B8G8R8A8_UNORM\n\t| typeof VK_FORMAT_B8G8R8A8_SNORM\n\t| typeof VK_FORMAT_B8G8R8A8_UINT\n\t| typeof VK_FORMAT_B8G8R8A8_SINT\n\t| typeof VK_FORMAT_B8G8R8A8_SRGB\n\t| typeof VK_FORMAT_A2R10G10B10_UNORM_PACK32\n\t| typeof VK_FORMAT_A2R10G10B10_SNORM_PACK32\n\t| typeof VK_FORMAT_A2R10G10B10_UINT_PACK32\n\t| typeof VK_FORMAT_A2R10G10B10_SINT_PACK32\n\t| typeof VK_FORMAT_A2B10G10R10_UNORM_PACK32\n\t| typeof VK_FORMAT_A2B10G10R10_SNORM_PACK32\n\t| typeof VK_FORMAT_A2B10G10R10_UINT_PACK32\n\t| typeof VK_FORMAT_A2B10G10R10_SINT_PACK32\n\t| typeof VK_FORMAT_R16_UNORM\n\t| typeof VK_FORMAT_R16_SNORM\n\t| typeof VK_FORMAT_R16_UINT\n\t| typeof VK_FORMAT_R16_SINT\n\t| typeof VK_FORMAT_R16_SFLOAT\n\t| typeof VK_FORMAT_R16G16_UNORM\n\t| typeof VK_FORMAT_R16G16_SNORM\n\t| typeof VK_FORMAT_R16G16_UINT\n\t| typeof VK_FORMAT_R16G16_SINT\n\t| typeof VK_FORMAT_R16G16_SFLOAT\n\t| typeof VK_FORMAT_R16G16B16_UNORM\n\t| typeof VK_FORMAT_R16G16B16_SNORM\n\t| typeof VK_FORMAT_R16G16B16_UINT\n\t| typeof VK_FORMAT_R16G16B16_SINT\n\t| typeof VK_FORMAT_R16G16B16_SFLOAT\n\t| typeof VK_FORMAT_R16G16B16A16_UNORM\n\t| typeof VK_FORMAT_R16G16B16A16_SNORM\n\t| typeof VK_FORMAT_R16G16B16A16_UINT\n\t| typeof VK_FORMAT_R16G16B16A16_SINT\n\t| typeof VK_FORMAT_R16G16B16A16_SFLOAT\n\t| typeof VK_FORMAT_R32_UINT\n\t| typeof VK_FORMAT_R32_SINT\n\t| typeof VK_FORMAT_R32_SFLOAT\n\t| typeof VK_FORMAT_R32G32_UINT\n\t| typeof VK_FORMAT_R32G32_SINT\n\t| typeof VK_FORMAT_R32G32_SFLOAT\n\t| typeof VK_FORMAT_R32G32B32_UINT\n\t| typeof VK_FORMAT_R32G32B32_SINT\n\t| typeof VK_FORMAT_R32G32B32_SFLOAT\n\t| typeof VK_FORMAT_R32G32B32A32_UINT\n\t| typeof VK_FORMAT_R32G32B32A32_SINT\n\t| typeof VK_FORMAT_R32G32B32A32_SFLOAT\n\t| typeof VK_FORMAT_R64_UINT\n\t| typeof VK_FORMAT_R64_SINT\n\t| typeof VK_FORMAT_R64_SFLOAT\n\t| typeof VK_FORMAT_R64G64_UINT\n\t| typeof VK_FORMAT_R64G64_SINT\n\t| typeof VK_FORMAT_R64G64_SFLOAT\n\t| typeof VK_FORMAT_R64G64B64_UINT\n\t| typeof VK_FORMAT_R64G64B64_SINT\n\t| typeof VK_FORMAT_R64G64B64_SFLOAT\n\t| typeof VK_FORMAT_R64G64B64A64_UINT\n\t| typeof VK_FORMAT_R64G64B64A64_SINT\n\t| typeof VK_FORMAT_R64G64B64A64_SFLOAT\n\t| typeof VK_FORMAT_B10G11R11_UFLOAT_PACK32\n\t| typeof VK_FORMAT_E5B9G9R9_UFLOAT_PACK32\n\t| typeof VK_FORMAT_D16_UNORM\n\t| typeof VK_FORMAT_X8_D24_UNORM_PACK32\n\t| typeof VK_FORMAT_D32_SFLOAT\n\t| typeof VK_FORMAT_S8_UINT\n\t| typeof VK_FORMAT_D16_UNORM_S8_UINT\n\t| typeof VK_FORMAT_D24_UNORM_S8_UINT\n\t| typeof VK_FORMAT_D32_SFLOAT_S8_UINT\n\t| typeof VK_FORMAT_BC1_RGB_UNORM_BLOCK\n\t| typeof VK_FORMAT_BC1_RGB_SRGB_BLOCK\n\t| typeof VK_FORMAT_BC1_RGBA_UNORM_BLOCK\n\t| typeof VK_FORMAT_BC1_RGBA_SRGB_BLOCK\n\t| typeof VK_FORMAT_BC2_UNORM_BLOCK\n\t| typeof VK_FORMAT_BC2_SRGB_BLOCK\n\t| typeof VK_FORMAT_BC3_UNORM_BLOCK\n\t| typeof VK_FORMAT_BC3_SRGB_BLOCK\n\t| typeof VK_FORMAT_BC4_UNORM_BLOCK\n\t| typeof VK_FORMAT_BC4_SNORM_BLOCK\n\t| typeof VK_FORMAT_BC5_UNORM_BLOCK\n\t| typeof VK_FORMAT_BC5_SNORM_BLOCK\n\t| typeof VK_FORMAT_BC6H_UFLOAT_BLOCK\n\t| typeof VK_FORMAT_BC6H_SFLOAT_BLOCK\n\t| typeof VK_FORMAT_BC7_UNORM_BLOCK\n\t| typeof VK_FORMAT_BC7_SRGB_BLOCK\n\t| typeof VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK\n\t| typeof VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK\n\t| typeof VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK\n\t| typeof VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK\n\t| typeof VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK\n\t| typeof VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK\n\t| typeof VK_FORMAT_EAC_R11_UNORM_BLOCK\n\t| typeof VK_FORMAT_EAC_R11_SNORM_BLOCK\n\t| typeof VK_FORMAT_EAC_R11G11_UNORM_BLOCK\n\t| typeof VK_FORMAT_EAC_R11G11_SNORM_BLOCK\n\t| typeof VK_FORMAT_ASTC_4x4_UNORM_BLOCK\n\t| typeof VK_FORMAT_ASTC_4x4_SRGB_BLOCK\n\t| typeof VK_FORMAT_ASTC_5x4_UNORM_BLOCK\n\t| typeof VK_FORMAT_ASTC_5x4_SRGB_BLOCK\n\t| typeof VK_FORMAT_ASTC_5x5_UNORM_BLOCK\n\t| typeof VK_FORMAT_ASTC_5x5_SRGB_BLOCK\n\t| typeof VK_FORMAT_ASTC_6x5_UNORM_BLOCK\n\t| typeof VK_FORMAT_ASTC_6x5_SRGB_BLOCK\n\t| typeof VK_FORMAT_ASTC_6x6_UNORM_BLOCK\n\t| typeof VK_FORMAT_ASTC_6x6_SRGB_BLOCK\n\t| typeof VK_FORMAT_ASTC_8x5_UNORM_BLOCK\n\t| typeof VK_FORMAT_ASTC_8x5_SRGB_BLOCK\n\t| typeof VK_FORMAT_ASTC_8x6_UNORM_BLOCK\n\t| typeof VK_FORMAT_ASTC_8x6_SRGB_BLOCK\n\t| typeof VK_FORMAT_ASTC_8x8_UNORM_BLOCK\n\t| typeof VK_FORMAT_ASTC_8x8_SRGB_BLOCK\n\t| typeof VK_FORMAT_ASTC_10x5_UNORM_BLOCK\n\t| typeof VK_FORMAT_ASTC_10x5_SRGB_BLOCK\n\t| typeof VK_FORMAT_ASTC_10x6_UNORM_BLOCK\n\t| typeof VK_FORMAT_ASTC_10x6_SRGB_BLOCK\n\t| typeof VK_FORMAT_ASTC_10x8_UNORM_BLOCK\n\t| typeof VK_FORMAT_ASTC_10x8_SRGB_BLOCK\n\t| typeof VK_FORMAT_ASTC_10x10_UNORM_BLOCK\n\t| typeof VK_FORMAT_ASTC_10x10_SRGB_BLOCK\n\t| typeof VK_FORMAT_ASTC_12x10_UNORM_BLOCK\n\t| typeof VK_FORMAT_ASTC_12x10_SRGB_BLOCK\n\t| typeof VK_FORMAT_ASTC_12x12_UNORM_BLOCK\n\t| typeof VK_FORMAT_ASTC_12x12_SRGB_BLOCK\n\t| typeof VK_FORMAT_R10X6_UNORM_PACK16\n\t| typeof VK_FORMAT_R10X6G10X6_UNORM_2PACK16\n\t| typeof VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16\n\t| typeof VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16\n\t| typeof VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16\n\t| typeof VK_FORMAT_R12X4_UNORM_PACK16\n\t| typeof VK_FORMAT_R12X4G12X4_UNORM_2PACK16\n\t| typeof VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16\n\t| typeof VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16\n\t| typeof VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16\n\t| typeof VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG\n\t| typeof VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG\n\t| typeof VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG\n\t| typeof VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG\n\t| typeof VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG\n\t| typeof VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG\n\t| typeof VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG\n\t| typeof VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG\n\t| typeof VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT\n\t| typeof VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT\n\t| typeof VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT\n\t| typeof VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT\n\t| typeof VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT\n\t| typeof VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT\n\t| typeof VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT\n\t| typeof VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT\n\t| typeof VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT\n\t| typeof VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT\n\t| typeof VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT\n\t| typeof VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT\n\t| typeof VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT\n\t| typeof VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT\n\t| typeof VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT\n\t| typeof VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT;\n","import {\n\tKHR_DF_FLAG_ALPHA_STRAIGHT,\n\tKHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT,\n\tKHR_DF_MODEL_UNSPECIFIED,\n\tKHR_DF_PRIMARIES_BT709,\n\tKHR_DF_TRANSFER_SRGB,\n\tKHR_DF_VENDORID_KHRONOS,\n\tKHR_DF_VERSION,\n\tKHR_SUPERCOMPRESSION_NONE,\n\tSupercompression,\n\tVKFormat,\n\tVK_FORMAT_UNDEFINED,\n} from './constants.js';\n\n/**\n * Represents an unpacked KTX 2.0 texture container. Data for individual mip levels are stored in\n * the `.levels` array, typically compressed in Basis Universal formats. Additional properties\n * provide metadata required to process, transcode, and upload these textures.\n */\nexport class KTX2Container {\n\t/**\n\t * Specifies the image format using Vulkan VkFormat enum values. When using Basis Universal\n\t * texture formats, `vkFormat` must be VK_FORMAT_UNDEFINED.\n\t */\n\tpublic vkFormat: VKFormat = VK_FORMAT_UNDEFINED;\n\n\t/**\n\t * Size of the data type in bytes used to upload the data to a graphics API. When `vkFormat` is\n\t * VK_FORMAT_UNDEFINED, `typeSize` must be 1.\n\t */\n\tpublic typeSize = 1;\n\n\t/** Width of the texture image for level 0, in pixels. */\n\tpublic pixelWidth = 0;\n\n\t/** Height of the texture image for level 0, in pixels. */\n\tpublic pixelHeight = 0;\n\n\t/** Depth of the texture image for level 0, in pixels (3D textures only). */\n\tpublic pixelDepth = 0;\n\n\t/** Number of array elements (array textures only). */\n\tpublic layerCount = 0;\n\n\t/**\n\t * Number of cubemap faces. For cubemaps and cubemap arrays, `faceCount` must be 6. For all\n\t * other textures, `faceCount` must be 1. Cubemap faces are stored in +X, -X, +Y, -Y, +Z, -Z\n\t * order.\n\t */\n\tpublic faceCount = 1;\n\n\t/** Indicates which supercompression scheme has been applied to mip level images, if any. */\n\tpublic supercompressionScheme: Supercompression = KHR_SUPERCOMPRESSION_NONE;\n\n\t/** Mip levels, ordered largest (original) to smallest (~1px). */\n\tpublic levels: KTX2Level[] = [];\n\n\t/** Data Format Descriptor. */\n\tpublic dataFormatDescriptor: KTX2DataFormatDescriptorBasicFormat[] = [\n\t\t{\n\t\t\tvendorId: KHR_DF_VENDORID_KHRONOS,\n\t\t\tdescriptorType: KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT,\n\t\t\tdescriptorBlockSize: 0,\n\t\t\tversionNumber: KHR_DF_VERSION,\n\t\t\tcolorModel: KHR_DF_MODEL_UNSPECIFIED,\n\t\t\tcolorPrimaries: KHR_DF_PRIMARIES_BT709,\n\t\t\ttransferFunction: KHR_DF_TRANSFER_SRGB,\n\t\t\tflags: KHR_DF_FLAG_ALPHA_STRAIGHT,\n\t\t\ttexelBlockDimension: [0, 0, 0, 0],\n\t\t\tbytesPlane: [0, 0, 0, 0, 0, 0, 0, 0],\n\t\t\tsamples: [],\n\t\t},\n\t];\n\n\t/** Key/Value Data. */\n\tpublic keyValue: { [key: string]: string | Uint8Array } = {};\n\n\t/** Supercompression Global Data. */\n\tpublic globalData: KTX2GlobalDataBasisLZ | null = null;\n}\n\n///////////////////////////////////////////////////\n// Mip Levels.\n///////////////////////////////////////////////////\n\nexport interface KTX2Level {\n\t/** Compressed data of the mip level. */\n\tlevelData: Uint8Array;\n\n\t/**\n\t * Size of the mip level after reflation from supercompression, if applicable. When\n\t * `supercompressionType` is BASISLZ, `uncompressedByteLength` must be 0. When\n\t * `supercompressionType` is `NONE`, `uncompressedByteLength` must match the `levelData` byte\n\t * length.\n\t *\n\t * _**NOTICE:** this implies that for formats such as UASTC, `uncompressedByteLength` may\n\t * indicate size after ZSTD reflation (and of transcoded ASTC data), but does _not_ indicate\n\t * size of decoded RGBA32 pixels._\n\t */\n\tuncompressedByteLength: number;\n}\n\n///////////////////////////////////////////////////\n// Data Format Descriptor (DFD).\n///////////////////////////////////////////////////\n\nexport interface KTX2DataFormatDescriptorBasicFormat {\n\tvendorId: number;\n\tdescriptorType: number;\n\tversionNumber: number;\n\t/** @deprecated Inferred. */\n\tdescriptorBlockSize: number;\n\tcolorModel: number;\n\tcolorPrimaries: number;\n\ttransferFunction: number;\n\tflags: number;\n\ttexelBlockDimension: [number, number, number, number];\n\tbytesPlane: [number, number, number, number, number, number, number, number];\n\tsamples: KTX2BasicFormatSample[];\n}\n\nexport interface KTX2BasicFormatSample {\n\tbitOffset: number;\n\tbitLength: number;\n\t/** @deprecated Renamed to 'channelType'. */\n\tchannelID?: number;\n\tchannelType: number;\n\tsamplePosition: number[];\n\tsampleLower: number;\n\tsampleUpper: number;\n}\n\n///////////////////////////////////////////////////\n// Supercompression Global Data.\n///////////////////////////////////////////////////\n\nexport interface KTX2GlobalDataBasisLZ {\n\tendpointCount: number;\n\tselectorCount: number;\n\timageDescs: KTX2GlobalDataBasisLZImageDesc[];\n\tendpointsData: Uint8Array;\n\tselectorsData: Uint8Array;\n\ttablesData: Uint8Array;\n\textendedData: Uint8Array;\n}\n\ninterface KTX2GlobalDataBasisLZImageDesc {\n\timageFlags: number;\n\trgbSliceByteOffset: number;\n\trgbSliceByteLength: number;\n\talphaSliceByteOffset: number;\n\talphaSliceByteLength: number;\n}\n","export class BufferReader {\n\tprivate _dataView: DataView;\n\tprivate _littleEndian: boolean;\n\tpublic _offset: number;\n\n\tconstructor(data: Uint8Array, byteOffset: number, byteLength: number, littleEndian: boolean) {\n\t\tthis._dataView = new DataView(data.buffer, data.byteOffset + byteOffset, byteLength);\n\t\tthis._littleEndian = littleEndian;\n\t\tthis._offset = 0;\n\t}\n\n\t_nextUint8() {\n\t\tconst value = this._dataView.getUint8(this._offset);\n\t\tthis._offset += 1;\n\t\treturn value;\n\t}\n\n\t_nextUint16() {\n\t\tconst value = this._dataView.getUint16(this._offset, this._littleEndian);\n\t\tthis._offset += 2;\n\t\treturn value;\n\t}\n\n\t_nextUint32() {\n\t\tconst value = this._dataView.getUint32(this._offset, this._littleEndian);\n\t\tthis._offset += 4;\n\t\treturn value;\n\t}\n\n\t_nextUint64() {\n\t\tconst left = this._dataView.getUint32(this._offset, this._littleEndian);\n\t\tconst right = this._dataView.getUint32(this._offset + 4, this._littleEndian);\n\t\t// TODO(cleanup): Just test this...\n\t\t// const value = this._littleEndian ? left + (2 ** 32 * right) : (2 ** 32 * left) + right;\n\t\tconst value = left + 2 ** 32 * right;\n\t\tthis._offset += 8;\n\t\treturn value;\n\t}\n\n\t_nextInt32() {\n\t\tconst value = this._dataView.getInt32(this._offset, this._littleEndian);\n\t\tthis._offset += 4;\n\t\treturn value;\n\t}\n\n\t_nextUint8Array(len: number) {\n\t\tconst value = new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + this._offset, len);\n\t\tthis._offset += len;\n\t\treturn value;\n\t}\n\n\t_skip(bytes: number) {\n\t\tthis._offset += bytes;\n\t\treturn this;\n\t}\n\n\t_scan(maxByteLength: number, term = 0x00): Uint8Array {\n\t\tconst byteOffset = this._offset;\n\t\tlet byteLength = 0;\n\t\twhile (this._dataView.getUint8(this._offset) !== term && byteLength < maxByteLength) {\n\t\t\tbyteLength++;\n\t\t\tthis._offset++;\n\t\t}\n\n\t\tif (byteLength < maxByteLength) this._offset++;\n\n\t\treturn new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + byteOffset, byteLength);\n\t}\n}\n","///////////////////////////////////////////////////\n// Common.\n///////////////////////////////////////////////////\n\n// Injected at compile time, from $npm_package_version.\ndeclare const PACKAGE_VERSION: string;\n\nexport const KTX_WRITER = `KTX-Parse v${PACKAGE_VERSION}`;\n\nexport const NUL = new Uint8Array([0x00]);\n\nexport type vec3 = [number, number, number];\nexport type vec2 = [number, number, number];\n\n///////////////////////////////////////////////////\n// KTX2 Header.\n///////////////////////////////////////////////////\n\nexport const KTX2_ID = [\n\t// '´', 'K', 'T', 'X', '2', '0', 'ª', '\\r', '\\n', '\\x1A', '\\n'\n\t0xab, 0x4b, 0x54, 0x58, 0x20, 0x32, 0x30, 0xbb, 0x0d, 0x0a, 0x1a, 0x0a,\n];\n\nexport const HEADER_BYTE_LENGTH = 68; // 13 * 4 + 2 * 8\n","import { vec3 } from './constants-internal.js';\nimport {\n\tVKFormat,\n\tVK_FORMAT_ASTC_10x10_SRGB_BLOCK,\n\tVK_FORMAT_ASTC_10x10_UNORM_BLOCK,\n\tVK_FORMAT_ASTC_10x5_SRGB_BLOCK,\n\tVK_FORMAT_ASTC_10x5_UNORM_BLOCK,\n\tVK_FORMAT_ASTC_10x6_SRGB_BLOCK,\n\tVK_FORMAT_ASTC_10x6_UNORM_BLOCK,\n\tVK_FORMAT_ASTC_10x8_SRGB_BLOCK,\n\tVK_FORMAT_ASTC_10x8_UNORM_BLOCK,\n\tVK_FORMAT_ASTC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_PVRTC2_4BPP_SRGB_BLOCK_IMG,\n\tVK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG,\n\tVK_FORMAT_UNDEFINED,\n} from './constants.js';\nimport type { KTX2Container } from './container.js';\n\n/** Encodes text to an ArrayBuffer. */\nexport function encodeText(text: string): Uint8Array {\n\treturn new TextEncoder().encode(text);\n}\n\n/** Decodes an ArrayBuffer to text. */\nexport function decodeText(buffer: Uint8Array): string {\n\treturn new TextDecoder().decode(buffer);\n}\n\n/** Concatenates N ArrayBuffers. */\nexport function concat(buffers: (ArrayBuffer | Uint8Array)[]): Uint8Array {\n\tlet totalByteLength = 0;\n\tfor (const buffer of buffers) {\n\t\ttotalByteLength += buffer.byteLength;\n\t}\n\n\tconst result = new Uint8Array(totalByteLength);\n\tlet byteOffset = 0;\n\n\tfor (const buffer of buffers) {\n\t\tresult.set(new Uint8Array(buffer), byteOffset);\n\t\tbyteOffset += buffer.byteLength;\n\t}\n\n\treturn result;\n}\n\n/** Returns the least common multiple (LCM) for two positive integers. */\nexport function leastCommonMultiple(a: number, b: number): number {\n\tconst max = Math.max(a, b);\n\tconst min = Math.min(a, b);\n\tlet lcm = max;\n\n\twhile (lcm % min !== 0) {\n\t\tlcm += max;\n\t}\n\n\treturn lcm;\n}\n\n/**\n * Returns amount of padding, in bytes, required to pad a value V to N-byte\n * boundaries. Both V and N must be positive integers.\n */\nexport function getPadding(v: number, n = 4): number {\n\treturn Math.ceil(v / n) * n - v;\n}\n\n/** Returns byte length per texel block. */\nexport function getBlockByteLength(container: KTX2Container): number {\n\treturn container.levels[0].levelData.byteLength / getBlockCount(container, 0);\n}\n\n/**\n * Returns total number of blocks for given level. For VK_FORMAT_UNDEFINED, DFD is required.\n *\n * References:\n * - https://github.khronos.org/KTX-Specification/ktxspec.v2.html#levelImages\n */\nexport function getBlockCount(container: KTX2Container, levelIndex: number): number {\n\tlet blockCount = 1;\n\n\tconst pixelDimensions = [container.pixelWidth, container.pixelHeight, container.pixelDepth];\n\tconst blockDimensions = getBlockDimensions(container);\n\n\tfor (let i = 0; i < 3; i++) {\n\t\tif (pixelDimensions[i] > 0) {\n\t\t\tconst dimBlockCount = Math.ceil(\n\t\t\t\tMath.floor(pixelDimensions[i] * Math.pow(2, -levelIndex)) / blockDimensions[i],\n\t\t\t);\n\t\t\tblockCount *= Math.max(1, dimBlockCount);\n\t\t}\n\t}\n\n\tif (container.layerCount > 0) {\n\t\tblockCount *= container.layerCount;\n\t}\n\n\tif (container.faceCount > 0) {\n\t\tblockCount *= container.faceCount;\n\t}\n\n\treturn blockCount;\n}\n\n/**\n * Given a KTX2 container, returns block dimensions as [width, height, depth]. Requires valid DFD.\n */\nexport function getBlockDimensions(container: KTX2Container): vec3 {\n\tconst [x, y, z] = container.dataFormatDescriptor[0].texelBlockDimension;\n\treturn [x + 1, y + 1, z + 1];\n}\n\n/**\n * Given `vkFormat`, returns block dimensions as [width, height, depth]. Does not support\n * VK_FORMAT_UNDEFINED.\n *\n * References:\n * - https://github.khronos.org/KTX-Specification/ktxspec.v2.html#_mippadding\n * - https://registry.khronos.org/vulkan/specs/1.2-extensions/html/vkspec.html#formats-compatibility\n */\nexport function getBlockDimensionsByVKFormat(vkFormat: VKFormat): vec3 {\n\tif (vkFormat === VK_FORMAT_UNDEFINED) {\n\t\tthrow new Error('Unknown block dimensions for VK_FORMAT_UNDEFINED.');\n\t} else if (vkFormat >= VK_FORMAT_BC1_RGB_UNORM_BLOCK && vkFormat <= VK_FORMAT_BC7_SRGB_BLOCK) {\n\t\treturn [4, 4, 1];\n\t} else if (vkFormat >= VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK && vkFormat <= VK_FORMAT_EAC_R11G11_SNORM_BLOCK) {\n\t\treturn [4, 4, 1];\n\t} else if (vkFormat === VK_FORMAT_ASTC_4x4_UNORM_BLOCK || vkFormat === VK_FORMAT_ASTC_4x4_SRGB_BLOCK) {\n\t\treturn [4, 4, 1];\n\t} else if (vkFormat === VK_FORMAT_ASTC_5x4_UNORM_BLOCK || vkFormat === VK_FORMAT_ASTC_5x4_SRGB_BLOCK) {\n\t\treturn [5, 4, 1];\n\t} else if (vkFormat === VK_FORMAT_ASTC_5x5_UNORM_BLOCK || vkFormat === VK_FORMAT_ASTC_5x5_SRGB_BLOCK) {\n\t\treturn [5, 5, 1];\n\t} else if (vkFormat === VK_FORMAT_ASTC_6x5_UNORM_BLOCK || vkFormat === VK_FORMAT_ASTC_6x5_SRGB_BLOCK) {\n\t\treturn [6, 5, 1];\n\t} else if (vkFormat === VK_FORMAT_ASTC_6x6_UNORM_BLOCK || vkFormat === VK_FORMAT_ASTC_6x6_SRGB_BLOCK) {\n\t\treturn [6, 6, 1];\n\t} else if (vkFormat === VK_FORMAT_ASTC_8x5_UNORM_BLOCK || vkFormat === VK_FORMAT_ASTC_8x5_SRGB_BLOCK) {\n\t\treturn [8, 5, 1];\n\t} else if (vkFormat === VK_FORMAT_ASTC_8x6_UNORM_BLOCK || vkFormat === VK_FORMAT_ASTC_8x6_SRGB_BLOCK) {\n\t\treturn [8, 6, 1];\n\t} else if (vkFormat === VK_FORMAT_ASTC_8x8_UNORM_BLOCK || vkFormat === VK_FORMAT_ASTC_8x8_SRGB_BLOCK) {\n\t\treturn [8, 8, 1];\n\t} else if (vkFormat === VK_FORMAT_ASTC_10x5_UNORM_BLOCK || vkFormat === VK_FORMAT_ASTC_10x5_SRGB_BLOCK) {\n\t\treturn [10, 5, 1];\n\t} else if (vkFormat === VK_FORMAT_ASTC_10x6_UNORM_BLOCK || vkFormat === VK_FORMAT_ASTC_10x6_SRGB_BLOCK) {\n\t\treturn [10, 6, 1];\n\t} else if (vkFormat === VK_FORMAT_ASTC_10x8_UNORM_BLOCK || vkFormat === VK_FORMAT_ASTC_10x8_SRGB_BLOCK) {\n\t\treturn [10, 8, 1];\n\t} else if (vkFormat === VK_FORMAT_ASTC_10x10_UNORM_BLOCK || vkFormat === VK_FORMAT_ASTC_10x10_SRGB_BLOCK) {\n\t\treturn [10, 10, 1];\n\t} else if (vkFormat === VK_FORMAT_ASTC_12x10_UNORM_BLOCK || vkFormat === VK_FORMAT_ASTC_12x10_SRGB_BLOCK) {\n\t\treturn [12, 10, 1];\n\t} else if (vkFormat === VK_FORMAT_ASTC_12x12_UNORM_BLOCK || vkFormat === VK_FORMAT_ASTC_12x12_SRGB_BLOCK) {\n\t\treturn [12, 12, 1];\n\t} else if (\n\t\tvkFormat === VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG ||\n\t\tvkFormat === VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG ||\n\t\tvkFormat === VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG ||\n\t\tvkFormat === VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG\n\t) {\n\t\treturn [8, 4, 1];\n\t} else if (\n\t\tvkFormat === VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG ||\n\t\tvkFormat === VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG ||\n\t\tvkFormat === VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG ||\n\t\tvkFormat === VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG\n\t) {\n\t\treturn [4, 4, 1];\n\t} else {\n\t\treturn [1, 1, 1];\n\t}\n}\n","import { BufferReader } from './buffer-reader.js';\nimport { KHR_DF_SAMPLE_DATATYPE_SIGNED, Supercompression, VKFormat } from './constants.js';\nimport { KTX2_ID } from './constants-internal.js';\nimport { KTX2Container, KTX2DataFormatDescriptorBasicFormat } from './container.js';\nimport { decodeText } from './util.js';\n\n/**\n * Parses a KTX 2.0 file, returning an unpacked {@link KTX2Container} instance with all associated\n * data. The container's mip levels and other binary data are pointers into the original file, not\n * copies, so the original file should not be overwritten after reading.\n *\n * @param data Bytes of KTX 2.0 file, as Uint8Array or Buffer.\n */\nexport function read(data: Uint8Array): KTX2Container {\n\t///////////////////////////////////////////////////\n\t// KTX 2.0 Identifier.\n\t///////////////////////////////////////////////////\n\n\tconst id = new Uint8Array(data.buffer, data.byteOffset, KTX2_ID.length);\n\tif (\n\t\tid[0] !== KTX2_ID[0] || // '´'\n\t\tid[1] !== KTX2_ID[1] || // 'K'\n\t\tid[2] !== KTX2_ID[2] || // 'T'\n\t\tid[3] !== KTX2_ID[3] || // 'X'\n\t\tid[4] !== KTX2_ID[4] || // ' '\n\t\tid[5] !== KTX2_ID[5] || // '2'\n\t\tid[6] !== KTX2_ID[6] || // '0'\n\t\tid[7] !== KTX2_ID[7] || // 'ª'\n\t\tid[8] !== KTX2_ID[8] || // '\\r'\n\t\tid[9] !== KTX2_ID[9] || // '\\n'\n\t\tid[10] !== KTX2_ID[10] || // '\\x1A'\n\t\tid[11] !== KTX2_ID[11] // '\\n'\n\t) {\n\t\tthrow new Error('Missing KTX 2.0 identifier.');\n\t}\n\n\tconst container = new KTX2Container();\n\n\t///////////////////////////////////////////////////\n\t// Header.\n\t///////////////////////////////////////////////////\n\n\tconst headerByteLength = 17 * Uint32Array.BYTES_PER_ELEMENT;\n\tconst headerReader = new BufferReader(data, KTX2_ID.length, headerByteLength, true);\n\n\tcontainer.vkFormat = headerReader._nextUint32() as VKFormat;\n\tcontainer.typeSize = headerReader._nextUint32();\n\tcontainer.pixelWidth = headerReader._nextUint32();\n\tcontainer.pixelHeight = headerReader._nextUint32();\n\tcontainer.pixelDepth = headerReader._nextUint32();\n\tcontainer.layerCount = headerReader._nextUint32();\n\tcontainer.faceCount = headerReader._nextUint32();\n\n\tconst levelCount = headerReader._nextUint32();\n\n\tcontainer.supercompressionScheme = headerReader._nextUint32() as Supercompression;\n\n\tconst dfdByteOffset = headerReader._nextUint32();\n\tconst dfdByteLength = headerReader._nextUint32();\n\tconst kvdByteOffset = headerReader._nextUint32();\n\tconst kvdByteLength = headerReader._nextUint32();\n\tconst sgdByteOffset = headerReader._nextUint64();\n\tconst sgdByteLength = headerReader._nextUint64();\n\n\t///////////////////////////////////////////////////\n\t// Level Index.\n\t///////////////////////////////////////////////////\n\n\tconst levelByteLength = levelCount * 3 * 8;\n\tconst levelReader = new BufferReader(data, KTX2_ID.length + headerByteLength, levelByteLength, true);\n\n\tfor (let i = 0; i < levelCount; i++) {\n\t\tcontainer.levels.push({\n\t\t\tlevelData: new Uint8Array(\n\t\t\t\tdata.buffer,\n\t\t\t\tdata.byteOffset + levelReader._nextUint64(),\n\t\t\t\tlevelReader._nextUint64(),\n\t\t\t),\n\t\t\tuncompressedByteLength: levelReader._nextUint64(),\n\t\t});\n\t}\n\n\t///////////////////////////////////////////////////\n\t// Data Format Descriptor (DFD).\n\t///////////////////////////////////////////////////\n\n\tconst dfdReader = new BufferReader(data, dfdByteOffset, dfdByteLength, true);\n\n\tconst dfd: KTX2DataFormatDescriptorBasicFormat = {\n\t\tvendorId: dfdReader._skip(4 /* totalSize */)._nextUint16(),\n\t\tdescriptorType: dfdReader._nextUint16(),\n\t\tversionNumber: dfdReader._nextUint16(),\n\t\tdescriptorBlockSize: dfdReader._nextUint16(),\n\t\tcolorModel: dfdReader._nextUint8(),\n\t\tcolorPrimaries: dfdReader._nextUint8(),\n\t\ttransferFunction: dfdReader._nextUint8(),\n\t\tflags: dfdReader._nextUint8(),\n\t\ttexelBlockDimension: [\n\t\t\tdfdReader._nextUint8(),\n\t\t\tdfdReader._nextUint8(),\n\t\t\tdfdReader._nextUint8(),\n\t\t\tdfdReader._nextUint8(),\n\t\t],\n\t\tbytesPlane: [\n\t\t\tdfdReader._nextUint8(),\n\t\t\tdfdReader._nextUint8(),\n\t\t\tdfdReader._nextUint8(),\n\t\t\tdfdReader._nextUint8(),\n\t\t\tdfdReader._nextUint8(),\n\t\t\tdfdReader._nextUint8(),\n\t\t\tdfdReader._nextUint8(),\n\t\t\tdfdReader._nextUint8(),\n\t\t],\n\t\tsamples: [],\n\t};\n\n\tconst sampleStart = 6;\n\tconst sampleWords = 4;\n\tconst numSamples = (dfd.descriptorBlockSize / 4 - sampleStart) / sampleWords;\n\n\tfor (let i = 0; i < numSamples; i++) {\n\t\tconst sample = {\n\t\t\tbitOffset: dfdReader._nextUint16(),\n\t\t\tbitLength: dfdReader._nextUint8(),\n\t\t\tchannelType: dfdReader._nextUint8(),\n\t\t\tsamplePosition: [\n\t\t\t\tdfdReader._nextUint8(),\n\t\t\t\tdfdReader._nextUint8(),\n\t\t\t\tdfdReader._nextUint8(),\n\t\t\t\tdfdReader._nextUint8(),\n\t\t\t],\n\t\t\tsampleLower: -Infinity,\n\t\t\tsampleUpper: Infinity,\n\t\t};\n\n\t\tif (sample.channelType & KHR_DF_SAMPLE_DATATYPE_SIGNED) {\n\t\t\tsample.sampleLower = dfdReader._nextInt32();\n\t\t\tsample.sampleUpper = dfdReader._nextInt32();\n\t\t} else {\n\t\t\tsample.sampleLower = dfdReader._nextUint32();\n\t\t\tsample.sampleUpper = dfdReader._nextUint32();\n\t\t}\n\n\t\tdfd.samples[i] = sample;\n\t}\n\n\tcontainer.dataFormatDescriptor.length = 0;\n\tcontainer.dataFormatDescriptor.push(dfd);\n\n\t///////////////////////////////////////////////////\n\t// Key/Value Data (KVD).\n\t///////////////////////////////////////////////////\n\n\tconst kvdReader = new BufferReader(data, kvdByteOffset, kvdByteLength, true);\n\n\twhile (kvdReader._offset < kvdByteLength) {\n\t\tconst keyValueByteLength = kvdReader._nextUint32();\n\t\tconst keyData = kvdReader._scan(keyValueByteLength);\n\t\tconst key = decodeText(keyData);\n\n\t\tcontainer.keyValue[key] = kvdReader._nextUint8Array(keyValueByteLength - keyData.byteLength - 1);\n\n\t\tif (key.match(/^ktx/i)) {\n\t\t\tconst text = decodeText(container.keyValue[key] as Uint8Array);\n\t\t\tcontainer.keyValue[key] = text.substring(0, text.lastIndexOf('\\x00'));\n\t\t}\n\n\t\tconst kvPadding = keyValueByteLength % 4 ? 4 - (keyValueByteLength % 4) : 0; // align(4)\n\t\t// 4-byte alignment.\n\t\tkvdReader._skip(kvPadding);\n\t}\n\n\t///////////////////////////////////////////////////\n\t// Supercompression Global Data (SGD).\n\t///////////////////////////////////////////////////\n\n\tif (sgdByteLength <= 0) return container;\n\n\tconst sgdReader = new BufferReader(data, sgdByteOffset, sgdByteLength, true);\n\n\tconst endpointCount = sgdReader._nextUint16();\n\tconst selectorCount = sgdReader._nextUint16();\n\tconst endpointsByteLength = sgdReader._nextUint32();\n\tconst selectorsByteLength = sgdReader._nextUint32();\n\tconst tablesByteLength = sgdReader._nextUint32();\n\tconst extendedByteLength = sgdReader._nextUint32();\n\n\tconst imageDescs = [];\n\tfor (let i = 0; i < levelCount; i++) {\n\t\timageDescs.push({\n\t\t\timageFlags: sgdReader._nextUint32(),\n\t\t\trgbSliceByteOffset: sgdReader._nextUint32(),\n\t\t\trgbSliceByteLength: sgdReader._nextUint32(),\n\t\t\talphaSliceByteOffset: sgdReader._nextUint32(),\n\t\t\talphaSliceByteLength: sgdReader._nextUint32(),\n\t\t});\n\t}\n\n\tconst endpointsByteOffset = sgdByteOffset + sgdReader._offset;\n\tconst selectorsByteOffset = endpointsByteOffset + endpointsByteLength;\n\tconst tablesByteOffset = selectorsByteOffset + selectorsByteLength;\n\tconst extendedByteOffset = tablesByteOffset + tablesByteLength;\n\n\tconst endpointsData = new Uint8Array(data.buffer, data.byteOffset + endpointsByteOffset, endpointsByteLength);\n\tconst selectorsData = new Uint8Array(data.buffer, data.byteOffset + selectorsByteOffset, selectorsByteLength);\n\tconst tablesData = new Uint8Array(data.buffer, data.byteOffset + tablesByteOffset, tablesByteLength);\n\tconst extendedData = new Uint8Array(data.buffer, data.byteOffset + extendedByteOffset, extendedByteLength);\n\n\tcontainer.globalData = {\n\t\tendpointCount,\n\t\tselectorCount,\n\t\timageDescs,\n\t\tendpointsData,\n\t\tselectorsData,\n\t\ttablesData,\n\t\textendedData,\n\t};\n\n\treturn container;\n}\n","import { HEADER_BYTE_LENGTH, KTX2_ID, KTX_WRITER, NUL } from './constants-internal.js';\nimport {\n\tKHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT,\n\tKHR_DF_SAMPLE_DATATYPE_SIGNED,\n\tKHR_SUPERCOMPRESSION_NONE,\n} from './constants.js';\nimport { KTX2Container } from './container.js';\nimport { concat, encodeText, getBlockByteLength, getPadding, leastCommonMultiple } from './util.js';\n\ninterface WriteOptions {\n\tkeepWriter?: boolean;\n}\nconst DEFAULT_OPTIONS: WriteOptions = { keepWriter: false };\n\n/**\n * Serializes a {@link KTX2Container} instance to a KTX 2.0 file. Mip levels and other binary data\n * are copied into the resulting Uint8Array, so the original container can safely be edited or\n * destroyed after it is serialized.\n *\n * Options:\n * - keepWriter: If true, 'KTXWriter' key/value field is written as provided by the container.\n * \t\tOtherwise, a string for the current ktx-parse version is generated. Default: false.\n *\n * @param container\n * @param options\n */\nexport function write(container: KTX2Container, options: WriteOptions = {}): Uint8Array {\n\toptions = { ...DEFAULT_OPTIONS, ...options };\n\n\t///////////////////////////////////////////////////\n\t// Supercompression Global Data (SGD).\n\t///////////////////////////////////////////////////\n\n\tlet sgdBuffer = new ArrayBuffer(0);\n\tif (container.globalData) {\n\t\tconst sgdHeaderBuffer = new ArrayBuffer(20 + container.globalData.imageDescs.length * 5 * 4);\n\t\tconst sgdHeaderView = new DataView(sgdHeaderBuffer);\n\t\tsgdHeaderView.setUint16(0, container.globalData.endpointCount, true);\n\t\tsgdHeaderView.setUint16(2, container.globalData.selectorCount, true);\n\t\tsgdHeaderView.setUint32(4, container.globalData.endpointsData.byteLength, true);\n\t\tsgdHeaderView.setUint32(8, container.globalData.selectorsData.byteLength, true);\n\t\tsgdHeaderView.setUint32(12, container.globalData.tablesData.byteLength, true);\n\t\tsgdHeaderView.setUint32(16, container.globalData.extendedData.byteLength, true);\n\n\t\tfor (let i = 0; i < container.globalData.imageDescs.length; i++) {\n\t\t\tconst imageDesc = container.globalData.imageDescs[i];\n\t\t\tsgdHeaderView.setUint32(20 + i * 5 * 4 + 0, imageDesc.imageFlags, true);\n\t\t\tsgdHeaderView.setUint32(20 + i * 5 * 4 + 4, imageDesc.rgbSliceByteOffset, true);\n\t\t\tsgdHeaderView.setUint32(20 + i * 5 * 4 + 8, imageDesc.rgbSliceByteLength, true);\n\t\t\tsgdHeaderView.setUint32(20 + i * 5 * 4 + 12, imageDesc.alphaSliceByteOffset, true);\n\t\t\tsgdHeaderView.setUint32(20 + i * 5 * 4 + 16, imageDesc.alphaSliceByteLength, true);\n\t\t}\n\n\t\tsgdBuffer = concat([\n\t\t\tsgdHeaderBuffer,\n\t\t\tcontainer.globalData.endpointsData,\n\t\t\tcontainer.globalData.selectorsData,\n\t\t\tcontainer.globalData.tablesData,\n\t\t\tcontainer.globalData.extendedData,\n\t\t]);\n\t}\n\n\t///////////////////////////////////////////////////\n\t// Key/Value Data (KVD).\n\t///////////////////////////////////////////////////\n\n\tconst keyValueData: Uint8Array[] = [];\n\tlet keyValue = container.keyValue;\n\n\tif (!options.keepWriter) {\n\t\tkeyValue = { ...container.keyValue, KTXwriter: KTX_WRITER };\n\t}\n\n\tfor (const key in keyValue) {\n\t\tconst value = keyValue[key];\n\t\tconst keyData = encodeText(key);\n\t\tconst valueData = typeof value === 'string' ? concat([encodeText(value), NUL]) : value;\n\t\tconst kvByteLength = keyData.byteLength + 1 + valueData.byteLength;\n\t\tconst kvPadding = getPadding(kvByteLength, 4); // align(4)\n\t\tkeyValueData.push(\n\t\t\tconcat([\n\t\t\t\tnew Uint32Array([kvByteLength]),\n\t\t\t\tkeyData,\n\t\t\t\tNUL,\n\t\t\t\tvalueData,\n\t\t\t\tnew Uint8Array(kvPadding).fill(0x00), // align(4)\n\t\t\t]),\n\t\t);\n\t}\n\n\tconst kvdBuffer = concat(keyValueData);\n\n\t///////////////////////////////////////////////////\n\t// Data Format Descriptor (DFD).\n\t///////////////////////////////////////////////////\n\n\tif (\n\t\tcontainer.dataFormatDescriptor.length !== 1 ||\n\t\tcontainer.dataFormatDescriptor[0].descriptorType !== KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT\n\t) {\n\t\tthrow new Error('Only BASICFORMAT Data Format Descriptor output supported.');\n\t}\n\n\tconst dfd = container.dataFormatDescriptor[0];\n\n\tconst dfdBuffer = new ArrayBuffer(28 + dfd.samples.length * 16);\n\tconst dfdView = new DataView(dfdBuffer);\n\tconst descriptorBlockSize = 24 + dfd.samples.length * 16;\n\n\tdfdView.setUint32(0, dfdBuffer.byteLength, true);\n\tdfdView.setUint16(4, dfd.vendorId, true);\n\tdfdView.setUint16(6, dfd.descriptorType, true);\n\tdfdView.setUint16(8, dfd.versionNumber, true);\n\tdfdView.setUint16(10, descriptorBlockSize, true);\n\n\tdfdView.setUint8(12, dfd.colorModel);\n\tdfdView.setUint8(13, dfd.colorPrimaries);\n\tdfdView.setUint8(14, dfd.transferFunction);\n\tdfdView.setUint8(15, dfd.flags);\n\n\tif (!Array.isArray(dfd.texelBlockDimension)) {\n\t\tthrow new Error('texelBlockDimension is now an array. For dimensionality `d`, set `d - 1`.');\n\t}\n\n\tdfdView.setUint8(16, dfd.texelBlockDimension[0]);\n\tdfdView.setUint8(17, dfd.texelBlockDimension[1]);\n\tdfdView.setUint8(18, dfd.texelBlockDimension[2]);\n\tdfdView.setUint8(19, dfd.texelBlockDimension[3]);\n\n\tfor (let i = 0; i < 8; i++) dfdView.setUint8(20 + i, dfd.bytesPlane[i]);\n\n\tfor (let i = 0; i < dfd.samples.length; i++) {\n\t\tconst sample = dfd.samples[i];\n\t\tconst sampleByteOffset = 28 + i * 16;\n\n\t\tif (sample.channelID) {\n\t\t\tthrow new Error('channelID has been renamed to channelType.');\n\t\t}\n\n\t\tdfdView.setUint16(sampleByteOffset + 0, sample.bitOffset, true);\n\t\tdfdView.setUint8(sampleByteOffset + 2, sample.bitLength);\n\t\tdfdView.setUint8(sampleByteOffset + 3, sample.channelType);\n\n\t\tdfdView.setUint8(sampleByteOffset + 4, sample.samplePosition[0]);\n\t\tdfdView.setUint8(sampleByteOffset + 5, sample.samplePosition[1]);\n\t\tdfdView.setUint8(sampleByteOffset + 6, sample.samplePosition[2]);\n\t\tdfdView.setUint8(sampleByteOffset + 7, sample.samplePosition[3]);\n\n\t\tif (sample.channelType & KHR_DF_SAMPLE_DATATYPE_SIGNED) {\n\t\t\tdfdView.setInt32(sampleByteOffset + 8, sample.sampleLower, true);\n\t\t\tdfdView.setInt32(sampleByteOffset + 12, sample.sampleUpper, true);\n\t\t} else {\n\t\t\tdfdView.setUint32(sampleByteOffset + 8, sample.sampleLower, true);\n\t\t\tdfdView.setUint32(sampleByteOffset + 12, sample.sampleUpper, true);\n\t\t}\n\t}\n\n\t///////////////////////////////////////////////////\n\t// Data alignment.\n\t///////////////////////////////////////////////////\n\n\tconst dfdByteOffset = KTX2_ID.length + HEADER_BYTE_LENGTH + container.levels.length * 3 * 8;\n\tconst kvdByteOffset = dfdByteOffset + dfdBuffer.byteLength;\n\tlet sgdByteOffset = sgdBuffer.byteLength > 0 ? kvdByteOffset + kvdBuffer.byteLength : 0;\n\tif (sgdByteOffset % 8) sgdByteOffset += 8 - (sgdByteOffset % 8); // align(8)\n\n\t///////////////////////////////////////////////////\n\t// Level Index.\n\t///////////////////////////////////////////////////\n\n\tconst levelData: Uint8Array[] = [];\n\tconst levelIndex = new DataView(new ArrayBuffer(container.levels.length * 3 * 8));\n\tconst levelDataByteOffsets = new Uint32Array(container.levels.length);\n\n\tlet levelAlign = 0;\n\tif (container.supercompressionScheme === KHR_SUPERCOMPRESSION_NONE) {\n\t\tlevelAlign = leastCommonMultiple(getBlockByteLength(container), 4);\n\t}\n\n\t// Level data is ordered small → large.\n\tlet levelDataByteOffset = (sgdByteOffset || kvdByteOffset + kvdBuffer.byteLength) + sgdBuffer.byteLength;\n\tfor (let i = container.levels.length - 1; i >= 0; i--) {\n\t\t// Level padding.\n\t\tif (levelDataByteOffset % levelAlign) {\n\t\t\tconst paddingBytes = getPadding(levelDataByteOffset, levelAlign);\n\t\t\tlevelData.push(new Uint8Array(paddingBytes));\n\t\t\tlevelDataByteOffset += paddingBytes;\n\t\t}\n\n\t\t// Level data.\n\t\tconst level = container.levels[i];\n\t\tlevelData.push(level.levelData);\n\t\tlevelDataByteOffsets[i] = levelDataByteOffset;\n\t\tlevelDataByteOffset += level.levelData.byteLength;\n\t}\n\n\t// Level index is ordered large → small.\n\tfor (let i = 0; i < container.levels.length; i++) {\n\t\tconst level = container.levels[i];\n\t\tlevelIndex.setBigUint64(i * 24 + 0, BigInt(levelDataByteOffsets[i]), true);\n\t\tlevelIndex.setBigUint64(i * 24 + 8, BigInt(level.levelData.byteLength), true);\n\t\tlevelIndex.setBigUint64(i * 24 + 16, BigInt(level.uncompressedByteLength), true);\n\t}\n\n\t///////////////////////////////////////////////////\n\t// Header.\n\t///////////////////////////////////////////////////\n\n\tconst headerBuffer = new ArrayBuffer(HEADER_BYTE_LENGTH);\n\tconst headerView = new DataView(headerBuffer);\n\theaderView.setUint32(0, container.vkFormat, true);\n\theaderView.setUint32(4, container.typeSize, true);\n\theaderView.setUint32(8, container.pixelWidth, true);\n\theaderView.setUint32(12, container.pixelHeight, true);\n\theaderView.setUint32(16, container.pixelDepth, true);\n\theaderView.setUint32(20, container.layerCount, true);\n\theaderView.setUint32(24, container.faceCount, true);\n\theaderView.setUint32(28, container.levels.length, true);\n\theaderView.setUint32(32, container.supercompressionScheme, true);\n\n\theaderView.setUint32(36, dfdByteOffset, true);\n\theaderView.setUint32(40, dfdBuffer.byteLength, true);\n\theaderView.setUint32(44, kvdByteOffset, true);\n\theaderView.setUint32(48, kvdBuffer.byteLength, true);\n\theaderView.setBigUint64(52, BigInt(sgdBuffer.byteLength > 0 ? sgdByteOffset : 0), true);\n\theaderView.setBigUint64(60, BigInt(sgdBuffer.byteLength), true);\n\n\t///////////////////////////////////////////////////\n\t// Compose.\n\t///////////////////////////////////////////////////\n\n\treturn new Uint8Array(\n\t\tconcat([\n\t\t\tnew Uint8Array(KTX2_ID).buffer,\n\t\t\theaderBuffer,\n\t\t\tlevelIndex.buffer,\n\t\t\tdfdBuffer,\n\t\t\tkvdBuffer,\n\t\t\tsgdByteOffset > 0\n\t\t\t\t? new ArrayBuffer(sgdByteOffset - (kvdByteOffset + kvdBuffer.byteLength)) // align(8)\n\t\t\t\t: new ArrayBuffer(0),\n\t\t\tsgdBuffer,\n\t\t\t...levelData,\n\t\t]),\n\t);\n}\n"],"names":["KHR_SUPERCOMPRESSION_NONE","KHR_SUPERCOMPRESSION_BASISLZ","KHR_SUPERCOMPRESSION_ZSTD","KHR_SUPERCOMPRESSION_ZLIB","KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT","KHR_DF_VENDORID_KHRONOS","KHR_DF_VERSION","KHR_DF_MODEL_UNSPECIFIED","KHR_DF_MODEL_RGBSDA","KHR_DF_MODEL_ETC1","KHR_DF_MODEL_ETC2","KHR_DF_MODEL_ASTC","KHR_DF_MODEL_ETC1S","KHR_DF_MODEL_UASTC","KHR_DF_FLAG_ALPHA_STRAIGHT","KHR_DF_FLAG_ALPHA_PREMULTIPLIED","KHR_DF_TRANSFER_UNSPECIFIED","KHR_DF_TRANSFER_LINEAR","KHR_DF_TRANSFER_SRGB","KHR_DF_TRANSFER_ITU","KHR_DF_TRANSFER_NTSC","KHR_DF_TRANSFER_SLOG","KHR_DF_TRANSFER_SLOG2","KHR_DF_TRANSFER_BT1886","KHR_DF_TRANSFER_HLG_OETF","KHR_DF_TRANSFER_HLG_EOTF","KHR_DF_TRANSFER_PQ_EOTF","KHR_DF_TRANSFER_PQ_OETF","KHR_DF_TRANSFER_DCIP3","KHR_DF_TRANSFER_PAL_OETF","KHR_DF_TRANSFER_PAL625_EOTF","KHR_DF_TRANSFER_ST240","KHR_DF_TRANSFER_ACESCC","KHR_DF_TRANSFER_ACESCCT","KHR_DF_TRANSFER_ADOBERGB","KHR_DF_PRIMARIES_UNSPECIFIED","KHR_DF_PRIMARIES_BT709","KHR_DF_PRIMARIES_BT601_EBU","KHR_DF_PRIMARIES_BT601_SMPTE","KHR_DF_PRIMARIES_BT2020","KHR_DF_PRIMARIES_CIEXYZ","KHR_DF_PRIMARIES_ACES","KHR_DF_PRIMARIES_ACESCC","KHR_DF_PRIMARIES_NTSC1953","KHR_DF_PRIMARIES_PAL525","KHR_DF_PRIMARIES_DISPLAYP3","KHR_DF_PRIMARIES_ADOBERGB","KHR_DF_CHANNEL_RGBSDA_RED","KHR_DF_CHANNEL_RGBSDA_GREEN","KHR_DF_CHANNEL_RGBSDA_BLUE","KHR_DF_CHANNEL_RGBSDA_STENCIL","KHR_DF_CHANNEL_RGBSDA_DEPTH","KHR_DF_CHANNEL_RGBSDA_ALPHA","KHR_DF_SAMPLE_DATATYPE_FLOAT","KHR_DF_SAMPLE_DATATYPE_SIGNED","KHR_DF_SAMPLE_DATATYPE_EXPONENT","KHR_DF_SAMPLE_DATATYPE_LINEAR","VK_FORMAT_UNDEFINED","VK_FORMAT_R4G4_UNORM_PACK8","VK_FORMAT_R4G4B4A4_UNORM_PACK16","VK_FORMAT_B4G4R4A4_UNORM_PACK16","VK_FORMAT_R5G6B5_UNORM_PACK16","VK_FORMAT_B5G6R5_UNORM_PACK16","VK_FORMAT_R5G5B5A1_UNORM_PACK16","VK_FORMAT_B5G5R5A1_UNORM_PACK16","VK_FORMAT_A1R5G5B5_UNORM_PACK16","VK_FORMAT_R8_UNORM","VK_FORMAT_R8_SNORM","VK_FORMAT_R8_UINT","VK_FORMAT_R8_SINT","VK_FORMAT_R8_SRGB","VK_FORMAT_R8G8_UNORM","VK_FORMAT_R8G8_SNORM","VK_FORMAT_R8G8_UINT","VK_FORMAT_R8G8_SINT","VK_FORMAT_R8G8_SRGB","VK_FORMAT_R8G8B8_UNORM","VK_FORMAT_R8G8B8_SNORM","VK_FORMAT_R8G8B8_UINT","VK_FORMAT_R8G8B8_SINT","VK_FORMAT_R8G8B8_SRGB","VK_FORMAT_B8G8R8_UNORM","VK_FORMAT_B8G8R8_SNORM","VK_FORMAT_B8G8R8_UINT","VK_FORMAT_B8G8R8_SINT","VK_FORMAT_B8G8R8_SRGB","VK_FORMAT_R8G8B8A8_UNORM","VK_FORMAT_R8G8B8A8_SNORM","VK_FORMAT_R8G8B8A8_UINT","VK_FORMAT_R8G8B8A8_SINT","VK_FORMAT_R8G8B8A8_SRGB","VK_FORMAT_B8G8R8A8_UNORM","VK_FORMAT_B8G8R8A8_SNORM","VK_FORMAT_B8G8R8A8_UINT","VK_FORMAT_B8G8R8A8_SINT","VK_FORMAT_B8G8R8A8_SRGB","VK_FORMAT_A2R10G10B10_UNORM_PACK32","VK_FORMAT_A2R10G10B10_SNORM_PACK32","VK_FORMAT_A2R10G10B10_UINT_PACK32","VK_FORMAT_A2R10G10B10_SINT_PACK32","VK_FORMAT_A2B10G10R10_UNORM_PACK32","VK_FORMAT_A2B10G10R10_SNORM_PACK32","VK_FORMAT_A2B10G10R10_UINT_PACK32","VK_FORMAT_A2B10G10R10_SINT_PACK32","VK_FORMAT_R16_UNORM","VK_FORMAT_R16_SNORM","VK_FORMAT_R16_UINT","VK_FORMAT_R16_SINT","VK_FORMAT_R16_SFLOAT","VK_FORMAT_R16G16_UNORM","VK_FORMAT_R16G16_SNORM","VK_FORMAT_R16G16_UINT","VK_FORMAT_R16G16_SINT","VK_FORMAT_R16G16_SFLOAT","VK_FORMAT_R16G16B16_UNORM","VK_FORMAT_R16G16B16_SNORM","VK_FORMAT_R16G16B16_UINT","VK_FORMAT_R16G16B16_SINT","VK_FORMAT_R16G16B16_SFLOAT","VK_FORMAT_R16G16B16A16_UNORM","VK_FORMAT_R16G16B16A16_SNORM","VK_FORMAT_R16G16B16A16_UINT","VK_FORMAT_R16G16B16A16_SINT","VK_FORMAT_R16G16B16A16_SFLOAT","VK_FORMAT_R32_UINT","VK_FORMAT_R32_SINT","VK_FORMAT_R32_SFLOAT","VK_FORMAT_R32G32_UINT","VK_FORMAT_R32G32_SINT","VK_FORMAT_R32G32_SFLOAT","VK_FORMAT_R32G32B32_UINT","VK_FORMAT_R32G32B32_SINT","VK_FORMAT_R32G32B32_SFLOAT","VK_FORMAT_R32G32B32A32_UINT","VK_FORMAT_R32G32B32A32_SINT","VK_FORMAT_R32G32B32A32_SFLOAT","VK_FORMAT_R64_UINT","VK_FORMAT_R64_SINT","VK_FORMAT_R64_SFLOAT","VK_FORMAT_R64G64_UINT","VK_FORMAT_R64G64_SINT","VK_FORMAT_R64G64_SFLOAT","VK_FORMAT_R64G64B64_UINT","VK_FORMAT_R64G64B64_SINT","VK_FORMAT_R64G64B64_SFLOAT","VK_FORMAT_R64G64B64A64_UINT","VK_FORMAT_R64G64B64A64_SINT","VK_FORMAT_R64G64B64A64_SFLOAT","VK_FORMAT_B10G11R11_UFLOAT_PACK32","VK_FORMAT_E5B9G9R9_UFLOAT_PACK32","VK_FORMAT_D16_UNORM","VK_FORMAT_X8_D24_UNORM_PACK32","VK_FORMAT_D32_SFLOAT","VK_FORMAT_S8_UINT","VK_FORMAT_D16_UNORM_S8_UINT","VK_FORMAT_D24_UNORM_S8_UINT","VK_FORMAT_D32_SFLOAT_S8_UINT","VK_FORMAT_BC1_RGB_UNORM_BLOCK","VK_FORMAT_BC1_RGB_SRGB_BLOCK","VK_FORMAT_BC1_RGBA_UNORM_BLOCK","VK_FORMAT_BC1_RGBA_SRGB_BLOCK","VK_FORMAT_BC2_UNORM_BLOCK","VK_FORMAT_BC2_SRGB_BLOCK","VK_FORMAT_BC3_UNORM_BLOCK","VK_FORMAT_BC3_SRGB_BLOCK","VK_FORMAT_BC4_UNORM_BLOCK","VK_FORMAT_BC4_SNORM_BLOCK","VK_FORMAT_BC5_UNORM_BLOCK","VK_FORMAT_BC5_SNORM_BLOCK","VK_FORMAT_BC6H_UFLOAT_BLOCK","VK_FORMAT_BC6H_SFLOAT_BLOCK","VK_FORMAT_BC7_UNORM_BLOCK","VK_FORMAT_BC7_SRGB_BLOCK","VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK","VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK","VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK","VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK","VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK","VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK","VK_FORMAT_EAC_R11_UNORM_BLOCK","VK_FORMAT_EAC_R11_SNORM_BLOCK","VK_FORMAT_EAC_R11G11_UNORM_BLOCK","VK_FORMAT_EAC_R11G11_SNORM_BLOCK","VK_FORMAT_ASTC_4x4_UNORM_BLOCK","VK_FORMAT_ASTC_4x4_SRGB_BLOCK","VK_FORMAT_ASTC_5x4_UNORM_BLOCK","VK_FORMAT_ASTC_5x4_SRGB_BLOCK","VK_FORMAT_ASTC_5x5_UNORM_BLOCK","VK_FORMAT_ASTC_5x5_SRGB_BLOCK","VK_FORMAT_ASTC_6x5_UNORM_BLOCK","VK_FORMAT_ASTC_6x5_SRGB_BLOCK","VK_FORMAT_ASTC_6x6_UNORM_BLOCK","VK_FORMAT_ASTC_6x6_SRGB_BLOCK","VK_FORMAT_ASTC_8x5_UNORM_BLOCK","VK_FORMAT_ASTC_8x5_SRGB_BLOCK","VK_FORMAT_ASTC_8x6_UNORM_BLOCK","VK_FORMAT_ASTC_8x6_SRGB_BLOCK","VK_FORMAT_ASTC_8x8_UNORM_BLOCK","VK_FORMAT_ASTC_8x8_SRGB_BLOCK","VK_FORMAT_ASTC_10x5_UNORM_BLOCK","VK_FORMAT_ASTC_10x5_SRGB_BLOCK","VK_FORMAT_ASTC_10x6_UNORM_BLOCK","VK_FORMAT_ASTC_10x6_SRGB_BLOCK","VK_FORMAT_ASTC_10x8_UNORM_BLOCK","VK_FORMAT_ASTC_10x8_SRGB_BLOCK","VK_FORMAT_ASTC_10x10_UNORM_BLOCK","VK_FORMAT_ASTC_10x10_SRGB_BLOCK","VK_FORMAT_ASTC_12x10_UNORM_BLOCK","VK_FORMAT_ASTC_12x10_SRGB_BLOCK","VK_FORMAT_ASTC_12x12_UNORM_BLOCK","VK_FORMAT_ASTC_12x12_SRGB_BLOCK","VK_FORMAT_R10X6_UNORM_PACK16","VK_FORMAT_R10X6G10X6_UNORM_2PACK16","VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16","VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16","VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16","VK_FORMAT_R12X4_UNORM_PACK16","VK_FORMAT_R12X4G12X4_UNORM_2PACK16","VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16","VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16","VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16","VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG","VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG","VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG","VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG","VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG","VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG","VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG","VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG","VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT","VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT","VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT","VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT","VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT","VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT","VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT","VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT","VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT","VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT","VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT","VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT","VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT","VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT","VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT","VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT","KTX2Container","constructor","vkFormat","typeSize","pixelWidth","pixelHeight","pixelDepth","layerCount","faceCount","supercompressionScheme","levels","dataFormatDescriptor","vendorId","descriptorType","descriptorBlockSize","versionNumber","colorModel","colorPrimaries","transferFunction","flags","texelBlockDimension","bytesPlane","samples","keyValue","globalData","BufferReader","data","byteOffset","byteLength","littleEndian","_dataView","_littleEndian","_offset","DataView","buffer","_nextUint8","value","getUint8","_nextUint16","getUint16","_nextUint32","getUint32","_nextUint64","left","right","_nextInt32","getInt32","_nextUint8Array","len","Uint8Array","_skip","bytes","_scan","maxByteLength","term","KTX_WRITER","NUL","KTX2_ID","HEADER_BYTE_LENGTH","encodeText","text","TextEncoder","encode","decodeText","TextDecoder","decode","concat","buffers","totalByteLength","result","set","leastCommonMultiple","a","b","max","Math","min","lcm","getPadding","v","n","ceil","getBlockByteLength","container","levelData","getBlockCount","levelIndex","blockCount","pixelDimensions","blockDimensions","getBlockDimensions","i","dimBlockCount","floor","pow","x","y","z","read","id","length","Error","headerByteLength","Uint32Array","BYTES_PER_ELEMENT","headerReader","levelCount","dfdByteOffset","dfdByteLength","kvdByteOffset","kvdByteLength","sgdByteOffset","sgdByteLength","levelByteLength","levelReader","push","uncompressedByteLength","dfdReader","dfd","sampleStart","sampleWords","numSamples","sample","bitOffset","bitLength","channelType","samplePosition","sampleLower","Infinity","sampleUpper","kvdReader","keyValueByteLength","keyData","key","match","substring","lastIndexOf","kvPadding","sgdReader","endpointCount","selectorCount","endpointsByteLength","selectorsByteLength","tablesByteLength","extendedByteLength","imageDescs","imageFlags","rgbSliceByteOffset","rgbSliceByteLength","alphaSliceByteOffset","alphaSliceByteLength","endpointsByteOffset","selectorsByteOffset","tablesByteOffset","extendedByteOffset","endpointsData","selectorsData","tablesData","extendedData","DEFAULT_OPTIONS","keepWriter","write","options","_extends","sgdBuffer","ArrayBuffer","sgdHeaderBuffer","sgdHeaderView","setUint16","setUint32","imageDesc","keyValueData","KTXwriter","valueData","kvByteLength","fill","kvdBuffer","dfdBuffer","dfdView","setUint8","Array","isArray","sampleByteOffset","channelID","setInt32","levelDataByteOffsets","levelAlign","levelDataByteOffset","paddingBytes","level","setBigUint64","BigInt","headerBuffer","headerView"],"mappings":"AAAA;AACA;AACA;AAEO,MAAMA,yBAAyB,GAAG,EAAC;AACnC,MAAMC,4BAA4B,GAAG,EAAC;AACtC,MAAMC,yBAAyB,GAAG,EAAC;AACnC,MAAMC,yBAAyB,GAAG,EAAC;AAQ1C;AACA;AACA;AAEO,MAAMC,qCAAqC,GAAG,EAAC;AAC/C,MAAMC,uBAAuB,GAAG,EAAC;AACjC,MAAMC,cAAc,GAAG,EAAC;AAExB,MAAMC,wBAAwB,GAAG,EAAC;AAClC,MAAMC,mBAAmB,GAAG,EAAC;AACpC;AACO,MAAMC,iBAAiB,GAAG,IAAG;AAC7B,MAAMC,iBAAiB,GAAG,IAAG;AAC7B,MAAMC,iBAAiB,GAAG,IAAG;AAC7B,MAAMC,kBAAkB,GAAG,IAAG;AAC9B,MAAMC,kBAAkB,GAAG,IAAG;AAE9B,MAAMC,0BAA0B,GAAG,EAAC;AACpC,MAAMC,+BAA+B,GAAG,EAAC;AAEzC,MAAMC,2BAA2B,GAAG,EAAC;AACrC,MAAMC,sBAAsB,GAAG,EAAC;AAChC,MAAMC,oBAAoB,GAAG,EAAC;AAC9B,MAAMC,mBAAmB,GAAG,EAAC;AAC7B,MAAMC,oBAAoB,GAAG,EAAC;AAC9B,MAAMC,oBAAoB,GAAG,EAAC;AAC9B,MAAMC,qBAAqB,GAAG,EAAC;AAC/B,MAAMC,sBAAsB,GAAG,EAAC;AAChC,MAAMC,wBAAwB,GAAG,EAAC;AAClC,MAAMC,wBAAwB,GAAG,EAAC;AAClC,MAAMC,uBAAuB,GAAG,GAAE;AAClC,MAAMC,uBAAu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