chunk-ZBREIOZ2.js 154 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780
  1. import {
  2. a as a2,
  3. i,
  4. l as l3,
  5. o,
  6. r as r2,
  7. s as s3,
  8. u
  9. } from "./chunk-EE6TL7XD.js";
  10. import {
  11. p as p2,
  12. v,
  13. y,
  14. z
  15. } from "./chunk-EGVIPYN2.js";
  16. import {
  17. l as l2
  18. } from "./chunk-7XXXCK2A.js";
  19. import {
  20. a
  21. } from "./chunk-MXB2XLKV.js";
  22. import {
  23. M2 as M,
  24. j2 as j
  25. } from "./chunk-ECW2QABR.js";
  26. import {
  27. k2 as k
  28. } from "./chunk-MRJEICT6.js";
  29. import {
  30. d,
  31. e,
  32. l3 as l,
  33. n2 as n
  34. } from "./chunk-Y3WMVFTW.js";
  35. import {
  36. m,
  37. p
  38. } from "./chunk-ULGDPLM2.js";
  39. import {
  40. s,
  41. s3 as s2
  42. } from "./chunk-EMJ4ZSM2.js";
  43. import {
  44. e as e2,
  45. r,
  46. t
  47. } from "./chunk-GZT4BVFP.js";
  48. // node_modules/@arcgis/core/chunks/Zlib.js
  49. var t2;
  50. var e3;
  51. var r3;
  52. var i2 = { exports: {} };
  53. e3 = i2, (t2 = function() {
  54. function t7() {
  55. this.pos = 0, this.bufferLength = 0, this.eof = false, this.buffer = null;
  56. }
  57. return t7.prototype = { ensureBuffer: function(t8) {
  58. var e8 = this.buffer, r11 = e8 ? e8.byteLength : 0;
  59. if (t8 < r11)
  60. return e8;
  61. for (var i10 = 512; i10 < t8; )
  62. i10 <<= 1;
  63. for (var s10 = new Uint8Array(i10), f6 = 0; f6 < r11; ++f6)
  64. s10[f6] = e8[f6];
  65. return this.buffer = s10;
  66. }, getByte: function() {
  67. for (var t8 = this.pos; this.bufferLength <= t8; ) {
  68. if (this.eof)
  69. return null;
  70. this.readBlock();
  71. }
  72. return this.buffer[this.pos++];
  73. }, getBytes: function(t8) {
  74. var e8 = this.pos;
  75. if (t8) {
  76. this.ensureBuffer(e8 + t8);
  77. for (var r11 = e8 + t8; !this.eof && this.bufferLength < r11; )
  78. this.readBlock();
  79. var i10 = this.bufferLength;
  80. r11 > i10 && (r11 = i10);
  81. } else {
  82. for (; !this.eof; )
  83. this.readBlock();
  84. r11 = this.bufferLength;
  85. }
  86. return this.pos = r11, this.buffer.subarray(e8, r11);
  87. }, lookChar: function() {
  88. for (var t8 = this.pos; this.bufferLength <= t8; ) {
  89. if (this.eof)
  90. return null;
  91. this.readBlock();
  92. }
  93. return String.fromCharCode(this.buffer[this.pos]);
  94. }, getChar: function() {
  95. for (var t8 = this.pos; this.bufferLength <= t8; ) {
  96. if (this.eof)
  97. return null;
  98. this.readBlock();
  99. }
  100. return String.fromCharCode(this.buffer[this.pos++]);
  101. }, makeSubStream: function(t8, e8, r11) {
  102. for (var i10 = t8 + e8; this.bufferLength <= i10 && !this.eof; )
  103. this.readBlock();
  104. return new Stream(this.buffer, t8, e8, r11);
  105. }, skip: function(t8) {
  106. t8 || (t8 = 1), this.pos += t8;
  107. }, reset: function() {
  108. this.pos = 0;
  109. } }, t7;
  110. }(), r3 = function() {
  111. if (!self || !self.Uint32Array)
  112. return null;
  113. var e8 = new Uint32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), r11 = new Uint32Array([3, 4, 5, 6, 7, 8, 9, 10, 65547, 65549, 65551, 65553, 131091, 131095, 131099, 131103, 196643, 196651, 196659, 196667, 262211, 262227, 262243, 262259, 327811, 327843, 327875, 327907, 258, 258, 258]), i10 = new Uint32Array([1, 2, 3, 4, 65541, 65543, 131081, 131085, 196625, 196633, 262177, 262193, 327745, 327777, 393345, 393409, 459009, 459137, 524801, 525057, 590849, 591361, 657409, 658433, 724993, 727041, 794625, 798721, 868353, 876545]), s10 = [new Uint32Array([459008, 524368, 524304, 524568, 459024, 524400, 524336, 590016, 459016, 524384, 524320, 589984, 524288, 524416, 524352, 590048, 459012, 524376, 524312, 589968, 459028, 524408, 524344, 590032, 459020, 524392, 524328, 59e4, 524296, 524424, 524360, 590064, 459010, 524372, 524308, 524572, 459026, 524404, 524340, 590024, 459018, 524388, 524324, 589992, 524292, 524420, 524356, 590056, 459014, 524380, 524316, 589976, 459030, 524412, 524348, 590040, 459022, 524396, 524332, 590008, 524300, 524428, 524364, 590072, 459009, 524370, 524306, 524570, 459025, 524402, 524338, 590020, 459017, 524386, 524322, 589988, 524290, 524418, 524354, 590052, 459013, 524378, 524314, 589972, 459029, 524410, 524346, 590036, 459021, 524394, 524330, 590004, 524298, 524426, 524362, 590068, 459011, 524374, 524310, 524574, 459027, 524406, 524342, 590028, 459019, 524390, 524326, 589996, 524294, 524422, 524358, 590060, 459015, 524382, 524318, 589980, 459031, 524414, 524350, 590044, 459023, 524398, 524334, 590012, 524302, 524430, 524366, 590076, 459008, 524369, 524305, 524569, 459024, 524401, 524337, 590018, 459016, 524385, 524321, 589986, 524289, 524417, 524353, 590050, 459012, 524377, 524313, 589970, 459028, 524409, 524345, 590034, 459020, 524393, 524329, 590002, 524297, 524425, 524361, 590066, 459010, 524373, 524309, 524573, 459026, 524405, 524341, 590026, 459018, 524389, 524325, 589994, 524293, 524421, 524357, 590058, 459014, 524381, 524317, 589978, 459030, 524413, 524349, 590042, 459022, 524397, 524333, 590010, 524301, 524429, 524365, 590074, 459009, 524371, 524307, 524571, 459025, 524403, 524339, 590022, 459017, 524387, 524323, 589990, 524291, 524419, 524355, 590054, 459013, 524379, 524315, 589974, 459029, 524411, 524347, 590038, 459021, 524395, 524331, 590006, 524299, 524427, 524363, 590070, 459011, 524375, 524311, 524575, 459027, 524407, 524343, 590030, 459019, 524391, 524327, 589998, 524295, 524423, 524359, 590062, 459015, 524383, 524319, 589982, 459031, 524415, 524351, 590046, 459023, 524399, 524335, 590014, 524303, 524431, 524367, 590078, 459008, 524368, 524304, 524568, 459024, 524400, 524336, 590017, 459016, 524384, 524320, 589985, 524288, 524416, 524352, 590049, 459012, 524376, 524312, 589969, 459028, 524408, 524344, 590033, 459020, 524392, 524328, 590001, 524296, 524424, 524360, 590065, 459010, 524372, 524308, 524572, 459026, 524404, 524340, 590025, 459018, 524388, 524324, 589993, 524292, 524420, 524356, 590057, 459014, 524380, 524316, 589977, 459030, 524412, 524348, 590041, 459022, 524396, 524332, 590009, 524300, 524428, 524364, 590073, 459009, 524370, 524306, 524570, 459025, 524402, 524338, 590021, 459017, 524386, 524322, 589989, 524290, 524418, 524354, 590053, 459013, 524378, 524314, 589973, 459029, 524410, 524346, 590037, 459021, 524394, 524330, 590005, 524298, 524426, 524362, 590069, 459011, 524374, 524310, 524574, 459027, 524406, 524342, 590029, 459019, 524390, 524326, 589997, 524294, 524422, 524358, 590061, 459015, 524382, 524318, 589981, 459031, 524414, 524350, 590045, 459023, 524398, 524334, 590013, 524302, 524430, 524366, 590077, 459008, 524369, 524305, 524569, 459024, 524401, 524337, 590019, 459016, 524385, 524321, 589987, 524289, 524417, 524353, 590051, 459012, 524377, 524313, 589971, 459028, 524409, 524345, 590035, 459020, 524393, 524329, 590003, 524297, 524425, 524361, 590067, 459010, 524373, 524309, 524573, 459026, 524405, 524341, 590027, 459018, 524389, 524325, 589995, 524293, 524421, 524357, 590059, 459014, 524381, 524317, 589979, 459030, 524413, 524349, 590043, 459022, 524397, 524333, 590011, 524301, 524429, 524365, 590075, 459009, 524371, 524307, 524571, 459025, 524403, 524339, 590023, 459017, 524387, 524323, 589991, 524291, 524419, 524355, 590055, 459013, 524379, 524315, 589975, 459029, 524411, 524347, 590039, 459021, 524395, 524331, 590007, 524299, 524427, 524363, 590071, 459011, 524375, 524311, 524575, 459027, 524407, 524343, 590031, 459019, 524391, 524327, 589999, 524295, 524423, 524359, 590063, 459015, 524383, 524319, 589983, 459031, 524415, 524351, 590047, 459023, 524399, 524335, 590015, 524303, 524431, 524367, 590079]), 9], f6 = [new Uint32Array([327680, 327696, 327688, 327704, 327684, 327700, 327692, 327708, 327682, 327698, 327690, 327706, 327686, 327702, 327694, 0, 327681, 327697, 327689, 327705, 327685, 327701, 327693, 327709, 327683, 327699, 327691, 327707, 327687, 327703, 327695, 0]), 5];
  114. function o7(t7) {
  115. throw new Error(t7);
  116. }
  117. function n9(e9) {
  118. var r12 = 0, i11 = e9[r12++], s11 = e9[r12++];
  119. i11 != -1 && s11 != -1 || o7("Invalid header in flate stream"), (15 & i11) != 8 && o7("Unknown compression method in flate stream"), ((i11 << 8) + s11) % 31 != 0 && o7("Bad FCHECK in flate stream"), 32 & s11 && o7("FDICT bit set in flate stream"), this.bytes = e9, this.bytesPos = r12, this.codeSize = 0, this.codeBuf = 0, t2.call(this);
  120. }
  121. return n9.prototype = Object.create(t2.prototype), n9.prototype.getBits = function(t7) {
  122. for (var e9, r12 = this.codeSize, i11 = this.codeBuf, s11 = this.bytes, f7 = this.bytesPos; r12 < t7; )
  123. (e9 = s11[f7++]) === void 0 && o7("Bad encoding in flate stream"), i11 |= e9 << r12, r12 += 8;
  124. return e9 = i11 & (1 << t7) - 1, this.codeBuf = i11 >> t7, this.codeSize = r12 -= t7, this.bytesPos = f7, e9;
  125. }, n9.prototype.getCode = function(t7) {
  126. for (var e9 = t7[0], r12 = t7[1], i11 = this.codeSize, s11 = this.codeBuf, f7 = this.bytes, n10 = this.bytesPos; i11 < r12; ) {
  127. var h4;
  128. (h4 = f7[n10++]) === void 0 && o7("Bad encoding in flate stream"), s11 |= h4 << i11, i11 += 8;
  129. }
  130. var a9 = e9[s11 & (1 << r12) - 1], u7 = a9 >> 16, l6 = 65535 & a9;
  131. return (i11 == 0 || i11 < u7 || u7 == 0) && o7("Bad encoding in flate stream"), this.codeBuf = s11 >> u7, this.codeSize = i11 - u7, this.bytesPos = n10, l6;
  132. }, n9.prototype.generateHuffmanTable = function(t7) {
  133. for (var e9 = t7.length, r12 = 0, i11 = 0; i11 < e9; ++i11)
  134. t7[i11] > r12 && (r12 = t7[i11]);
  135. for (var s11 = 1 << r12, f7 = new Uint32Array(s11), o8 = 1, n10 = 0, h4 = 2; o8 <= r12; ++o8, n10 <<= 1, h4 <<= 1)
  136. for (var a9 = 0; a9 < e9; ++a9)
  137. if (t7[a9] == o8) {
  138. var u7 = 0, l6 = n10;
  139. for (i11 = 0; i11 < o8; ++i11)
  140. u7 = u7 << 1 | 1 & l6, l6 >>= 1;
  141. for (i11 = u7; i11 < s11; i11 += h4)
  142. f7[i11] = o8 << 16 | a9;
  143. ++n10;
  144. }
  145. return [f7, r12];
  146. }, n9.prototype.readBlock = function() {
  147. function t7(t8, e9, r12, i11, s11) {
  148. for (var f7 = t8.getBits(r12) + i11; f7-- > 0; )
  149. e9[b3++] = s11;
  150. }
  151. var n10 = this.getBits(3);
  152. if (1 & n10 && (this.eof = true), (n10 >>= 1) != 0) {
  153. var h4, a9;
  154. if (n10 == 1)
  155. h4 = s10, a9 = f6;
  156. else if (n10 == 2) {
  157. for (var u7 = this.getBits(5) + 257, l6 = this.getBits(5) + 1, c5 = this.getBits(4) + 4, d5 = Array(e8.length), b3 = 0; b3 < c5; )
  158. d5[e8[b3++]] = this.getBits(3);
  159. for (var v4 = this.generateHuffmanTable(d5), g5 = 0, B2 = (b3 = 0, u7 + l6), p6 = new Array(B2); b3 < B2; ) {
  160. var y4 = this.getCode(v4);
  161. y4 == 16 ? t7(this, p6, 2, 3, g5) : y4 == 17 ? t7(this, p6, 3, 3, g5 = 0) : y4 == 18 ? t7(this, p6, 7, 11, g5 = 0) : p6[b3++] = g5 = y4;
  162. }
  163. h4 = this.generateHuffmanTable(p6.slice(0, u7)), a9 = this.generateHuffmanTable(p6.slice(u7, B2));
  164. } else
  165. o7("Unknown block type in flate stream");
  166. for (var m6 = (x4 = this.buffer) ? x4.length : 0, k4 = this.bufferLength; ; ) {
  167. var w3 = this.getCode(h4);
  168. if (w3 < 256)
  169. k4 + 1 >= m6 && (m6 = (x4 = this.ensureBuffer(k4 + 1)).length), x4[k4++] = w3;
  170. else {
  171. if (w3 == 256)
  172. return void (this.bufferLength = k4);
  173. var C4 = (w3 = r11[w3 -= 257]) >> 16;
  174. C4 > 0 && (C4 = this.getBits(C4)), g5 = (65535 & w3) + C4, w3 = this.getCode(a9), (C4 = (w3 = i10[w3]) >> 16) > 0 && (C4 = this.getBits(C4));
  175. var L3 = (65535 & w3) + C4;
  176. k4 + g5 >= m6 && (m6 = (x4 = this.ensureBuffer(k4 + g5)).length);
  177. for (var S4 = 0; S4 < g5; ++S4, ++k4)
  178. x4[k4] = x4[k4 - L3];
  179. }
  180. }
  181. } else {
  182. var A3, U4 = this.bytes, P3 = this.bytesPos;
  183. (A3 = U4[P3++]) === void 0 && o7("Bad block header in flate stream");
  184. var z2 = A3;
  185. (A3 = U4[P3++]) === void 0 && o7("Bad block header in flate stream"), z2 |= A3 << 8, (A3 = U4[P3++]) === void 0 && o7("Bad block header in flate stream");
  186. var H = A3;
  187. (A3 = U4[P3++]) === void 0 && o7("Bad block header in flate stream"), (H |= A3 << 8) != (65535 & ~z2) && o7("Bad uncompressed block length in flate stream"), this.codeBuf = 0, this.codeSize = 0;
  188. var T4 = this.bufferLength, x4 = this.ensureBuffer(T4 + z2), E3 = T4 + z2;
  189. this.bufferLength = E3;
  190. for (var F = T4; F < E3; ++F) {
  191. if ((A3 = U4[P3++]) === void 0) {
  192. this.eof = true;
  193. break;
  194. }
  195. x4[F] = A3;
  196. }
  197. this.bytesPos = P3;
  198. }
  199. }, n9;
  200. }()) !== void 0 && (e3.exports = r3);
  201. var s4 = i2.exports;
  202. // node_modules/@arcgis/core/layers/support/rasterFormats/ImageCanvasDecoder.js
  203. var i3 = class {
  204. constructor(t7) {
  205. t7 && (this.canvas = t7.canvas, this.ctx = t7.ctx || t7.canvas && t7.canvas.getContext("2d"));
  206. }
  207. decode(n9, r11, s10) {
  208. if (!n9 || n9.byteLength < 10)
  209. throw new s2("imagecanvasdecoder: decode", "required a valid encoded data as input.");
  210. let { width: c5, height: h4, format: o7 } = r11;
  211. const { applyJpegMask: d5 } = r11;
  212. if (d5 && (!c5 || !h4))
  213. throw new s2("imagecanvasdecoder: decode", "image width and height are needed to apply jpeg mask directly to canvas");
  214. return new Promise((t7, l6) => {
  215. let g5 = null;
  216. o7 === "jpg" && d5 && (g5 = i3._getMask(n9, { width: c5, height: h4 }));
  217. const w3 = new Blob([new Uint8Array(n9)], { type: "image/" + o7 == "jpg" ? "jpeg" : o7 }), v4 = URL.createObjectURL(w3), m6 = new Image();
  218. let p6;
  219. m6.src = v4, m6.onload = () => {
  220. if (URL.revokeObjectURL(v4), p(s10))
  221. return void l6(m());
  222. c5 = m6.width, h4 = m6.height, this.canvas ? (this.canvas.width === c5 && this.canvas.height === h4 || (this.canvas.width = c5, this.canvas.height = h4), this.ctx.clearRect(0, 0, c5, h4)) : (this.canvas = document.createElement("canvas"), this.canvas.width = c5, this.canvas.height = h4, this.ctx = this.canvas.getContext("2d")), this.ctx.drawImage(m6, 0, 0);
  223. const n10 = this.ctx.getImageData(0, 0, c5, h4);
  224. let i10;
  225. if (p6 = n10.data, r11.renderOnCanvas) {
  226. if (g5)
  227. for (i10 = 0; i10 < g5.length; i10++)
  228. g5[i10] ? p6[4 * i10 + 3] = 255 : p6[4 * i10 + 3] = 0;
  229. return this.ctx.putImageData(n10, 0, 0), void t7(null);
  230. }
  231. const o8 = c5 * h4, d6 = new Uint8Array(o8), w4 = new Uint8Array(o8), f6 = new Uint8Array(o8);
  232. if (g5)
  233. for (i10 = 0; i10 < o8; i10++)
  234. d6[i10] = p6[4 * i10], w4[i10] = p6[4 * i10 + 1], f6[i10] = p6[4 * i10 + 2];
  235. else
  236. for (g5 = new Uint8Array(o8), i10 = 0; i10 < o8; i10++)
  237. d6[i10] = p6[4 * i10], w4[i10] = p6[4 * i10 + 1], f6[i10] = p6[4 * i10 + 2], g5[i10] = p6[4 * i10 + 3];
  238. t7({ width: c5, height: h4, pixels: [d6, w4, f6], mask: g5, pixelType: "u8" });
  239. }, m6.onerror = () => {
  240. URL.revokeObjectURL(v4), l6("cannot load image");
  241. };
  242. });
  243. }
  244. static _getMask(t7, e8) {
  245. let a9 = null;
  246. try {
  247. const i10 = new Uint8Array(t7), r11 = Math.ceil(i10.length / 2);
  248. let s10 = 0;
  249. const c5 = i10.length - 2;
  250. for (s10 = r11; s10 < c5 && (i10[s10] !== 255 || i10[s10 + 1] !== 217); s10++)
  251. ;
  252. if (s10 += 2, s10 < i10.length - 1) {
  253. const t8 = new s4(i10.subarray(s10)).getBytes();
  254. a9 = new Uint8Array(e8.width * e8.height);
  255. let r12 = 0;
  256. for (let e9 = 0; e9 < t8.length; e9++)
  257. for (let n9 = 7; n9 >= 0; n9--)
  258. a9[r12++] = t8[e9] >> n9 & 1;
  259. }
  260. } catch (i10) {
  261. }
  262. return a9;
  263. }
  264. };
  265. // node_modules/@arcgis/core/chunks/Jpg.js
  266. var e4;
  267. var n2;
  268. var r4;
  269. var o2 = { exports: {} };
  270. e4 = o2, n2 = function() {
  271. var e8 = function() {
  272. function e9(e10) {
  273. this.message = "JPEG error: " + e10;
  274. }
  275. return e9.prototype = new Error(), e9.prototype.name = "JpegError", e9.constructor = e9, e9;
  276. }();
  277. return function() {
  278. if (!self || !self.Uint8ClampedArray)
  279. return null;
  280. var n9 = new Uint8Array([0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63]), r11 = 4017, o7 = 799, a9 = 3406, t7 = 2276, i10 = 1567, s10 = 3784, c5 = 5793, f6 = 2896;
  281. function l6() {
  282. this.decodeTransform = null, this.colorTransform = -1;
  283. }
  284. function u7(e9, n10) {
  285. for (var r12, o8, a10 = 0, t8 = [], i11 = 16; i11 > 0 && !e9[i11 - 1]; )
  286. i11--;
  287. t8.push({ children: [], index: 0 });
  288. var s11, c6 = t8[0];
  289. for (r12 = 0; r12 < i11; r12++) {
  290. for (o8 = 0; o8 < e9[r12]; o8++) {
  291. for ((c6 = t8.pop()).children[c6.index] = n10[a10]; c6.index > 0; )
  292. c6 = t8.pop();
  293. for (c6.index++, t8.push(c6); t8.length <= r12; )
  294. t8.push(s11 = { children: [], index: 0 }), c6.children[c6.index] = s11.children, c6 = s11;
  295. a10++;
  296. }
  297. r12 + 1 < i11 && (t8.push(s11 = { children: [], index: 0 }), c6.children[c6.index] = s11.children, c6 = s11);
  298. }
  299. return t8[0].children;
  300. }
  301. function h4(e9, n10, r12) {
  302. return 64 * ((e9.blocksPerLine + 1) * n10 + r12);
  303. }
  304. function v4(r12, o8, a10, t8, i11, s11, c6, f7, l7) {
  305. var u8 = a10.mcusPerLine, v5 = a10.progressive, m7 = o8, d6 = 0, p6 = 0;
  306. function k4() {
  307. if (p6 > 0)
  308. return p6--, d6 >> p6 & 1;
  309. if ((d6 = r12[o8++]) === 255) {
  310. var n10 = r12[o8++];
  311. if (n10)
  312. throw new e8("unexpected marker " + (d6 << 8 | n10).toString(16));
  313. }
  314. return p6 = 7, d6 >>> 7;
  315. }
  316. function g5(n10) {
  317. for (var r13 = n10; ; ) {
  318. if (typeof (r13 = r13[k4()]) == "number")
  319. return r13;
  320. if (typeof r13 != "object")
  321. throw new e8("invalid huffman sequence");
  322. }
  323. }
  324. function C4(e9) {
  325. for (var n10 = 0; e9 > 0; )
  326. n10 = n10 << 1 | k4(), e9--;
  327. return n10;
  328. }
  329. function w3(e9) {
  330. if (e9 === 1)
  331. return k4() === 1 ? 1 : -1;
  332. var n10 = C4(e9);
  333. return n10 >= 1 << e9 - 1 ? n10 : n10 + (-1 << e9) + 1;
  334. }
  335. function x4(e9, r13) {
  336. var o9 = g5(e9.huffmanTableDC), a11 = o9 === 0 ? 0 : w3(o9);
  337. e9.blockData[r13] = e9.pred += a11;
  338. for (var t9 = 1; t9 < 64; ) {
  339. var i12 = g5(e9.huffmanTableAC), s12 = 15 & i12, c7 = i12 >> 4;
  340. if (s12 !== 0) {
  341. var f8 = n9[t9 += c7];
  342. e9.blockData[r13 + f8] = w3(s12), t9++;
  343. } else {
  344. if (c7 < 15)
  345. break;
  346. t9 += 16;
  347. }
  348. }
  349. }
  350. function y4(e9, n10) {
  351. var r13 = g5(e9.huffmanTableDC), o9 = r13 === 0 ? 0 : w3(r13) << l7;
  352. e9.blockData[n10] = e9.pred += o9;
  353. }
  354. function D4(e9, n10) {
  355. e9.blockData[n10] |= k4() << l7;
  356. }
  357. var T4 = 0;
  358. function P3(e9, r13) {
  359. if (T4 > 0)
  360. T4--;
  361. else
  362. for (var o9 = s11, a11 = c6; o9 <= a11; ) {
  363. var t9 = g5(e9.huffmanTableAC), i12 = 15 & t9, f8 = t9 >> 4;
  364. if (i12 !== 0) {
  365. var u9 = n9[o9 += f8];
  366. e9.blockData[r13 + u9] = w3(i12) * (1 << l7), o9++;
  367. } else {
  368. if (f8 < 15) {
  369. T4 = C4(f8) + (1 << f8) - 1;
  370. break;
  371. }
  372. o9 += 16;
  373. }
  374. }
  375. }
  376. var L3, A3 = 0;
  377. function _3(r13, o9) {
  378. for (var a11, t9, i12 = s11, f8 = c6, u9 = 0; i12 <= f8; ) {
  379. var h5 = n9[i12];
  380. switch (A3) {
  381. case 0:
  382. if (u9 = (t9 = g5(r13.huffmanTableAC)) >> 4, (a11 = 15 & t9) == 0)
  383. u9 < 15 ? (T4 = C4(u9) + (1 << u9), A3 = 4) : (u9 = 16, A3 = 1);
  384. else {
  385. if (a11 !== 1)
  386. throw new e8("invalid ACn encoding");
  387. L3 = w3(a11), A3 = u9 ? 2 : 3;
  388. }
  389. continue;
  390. case 1:
  391. case 2:
  392. r13.blockData[o9 + h5] ? r13.blockData[o9 + h5] += k4() << l7 : --u9 == 0 && (A3 = A3 === 2 ? 3 : 0);
  393. break;
  394. case 3:
  395. r13.blockData[o9 + h5] ? r13.blockData[o9 + h5] += k4() << l7 : (r13.blockData[o9 + h5] = L3 << l7, A3 = 0);
  396. break;
  397. case 4:
  398. r13.blockData[o9 + h5] && (r13.blockData[o9 + h5] += k4() << l7);
  399. }
  400. i12++;
  401. }
  402. A3 === 4 && --T4 == 0 && (A3 = 0);
  403. }
  404. function U4(e9, n10, r13, o9, a11) {
  405. var t9 = r13 % u8;
  406. n10(e9, h4(e9, (r13 / u8 | 0) * e9.v + o9, t9 * e9.h + a11));
  407. }
  408. function z2(e9, n10, r13) {
  409. n10(e9, h4(e9, r13 / e9.blocksPerLine | 0, r13 % e9.blocksPerLine));
  410. }
  411. var I3, M3, Y, q, S4, R3, H = t8.length;
  412. R3 = v5 ? s11 === 0 ? f7 === 0 ? y4 : D4 : f7 === 0 ? P3 : _3 : x4;
  413. var E3, J, V2, j2, B2 = 0;
  414. for (J = H === 1 ? t8[0].blocksPerLine * t8[0].blocksPerColumn : u8 * a10.mcusPerColumn; B2 < J; ) {
  415. var N2 = i11 ? Math.min(J - B2, i11) : J;
  416. for (M3 = 0; M3 < H; M3++)
  417. t8[M3].pred = 0;
  418. if (T4 = 0, H === 1)
  419. for (I3 = t8[0], S4 = 0; S4 < N2; S4++)
  420. z2(I3, R3, B2), B2++;
  421. else
  422. for (S4 = 0; S4 < N2; S4++) {
  423. for (M3 = 0; M3 < H; M3++)
  424. for (V2 = (I3 = t8[M3]).h, j2 = I3.v, Y = 0; Y < j2; Y++)
  425. for (q = 0; q < V2; q++)
  426. U4(I3, R3, B2, Y, q);
  427. B2++;
  428. }
  429. p6 = 0, (E3 = b3(r12, o8)) && E3.invalid && (console.log("decodeScan - unexpected MCU data, next marker is: " + E3.invalid), o8 = E3.offset);
  430. var G2 = E3 && E3.marker;
  431. if (!G2 || G2 <= 65280)
  432. throw new e8("marker was not found");
  433. if (!(G2 >= 65488 && G2 <= 65495))
  434. break;
  435. o8 += 2;
  436. }
  437. return (E3 = b3(r12, o8)) && E3.invalid && (console.log("decodeScan - unexpected Scan data, next marker is: " + E3.invalid), o8 = E3.offset), o8 - m7;
  438. }
  439. function m6(n10, l7, u8) {
  440. var h5, v5, m7, d6, b4, p6, k4, g5, C4, w3, x4, y4, D4, T4, P3, L3, A3, _3 = n10.quantizationTable, U4 = n10.blockData;
  441. if (!_3)
  442. throw new e8("missing required Quantization Table.");
  443. for (var z2 = 0; z2 < 64; z2 += 8)
  444. C4 = U4[l7 + z2], w3 = U4[l7 + z2 + 1], x4 = U4[l7 + z2 + 2], y4 = U4[l7 + z2 + 3], D4 = U4[l7 + z2 + 4], T4 = U4[l7 + z2 + 5], P3 = U4[l7 + z2 + 6], L3 = U4[l7 + z2 + 7], C4 *= _3[z2], (w3 | x4 | y4 | D4 | T4 | P3 | L3) != 0 ? (w3 *= _3[z2 + 1], x4 *= _3[z2 + 2], y4 *= _3[z2 + 3], D4 *= _3[z2 + 4], T4 *= _3[z2 + 5], P3 *= _3[z2 + 6], L3 *= _3[z2 + 7], v5 = (h5 = (h5 = c5 * C4 + 128 >> 8) + (v5 = c5 * D4 + 128 >> 8) + 1 >> 1) - v5, A3 = (m7 = x4) * s10 + (d6 = P3) * i10 + 128 >> 8, m7 = m7 * i10 - d6 * s10 + 128 >> 8, k4 = (b4 = (b4 = f6 * (w3 - L3) + 128 >> 8) + (k4 = T4 << 4) + 1 >> 1) - k4, p6 = (g5 = (g5 = f6 * (w3 + L3) + 128 >> 8) + (p6 = y4 << 4) + 1 >> 1) - p6, d6 = (h5 = h5 + (d6 = A3) + 1 >> 1) - d6, m7 = (v5 = v5 + m7 + 1 >> 1) - m7, A3 = b4 * t7 + g5 * a9 + 2048 >> 12, b4 = b4 * a9 - g5 * t7 + 2048 >> 12, g5 = A3, A3 = p6 * o7 + k4 * r11 + 2048 >> 12, p6 = p6 * r11 - k4 * o7 + 2048 >> 12, k4 = A3, u8[z2] = h5 + g5, u8[z2 + 7] = h5 - g5, u8[z2 + 1] = v5 + k4, u8[z2 + 6] = v5 - k4, u8[z2 + 2] = m7 + p6, u8[z2 + 5] = m7 - p6, u8[z2 + 3] = d6 + b4, u8[z2 + 4] = d6 - b4) : (A3 = c5 * C4 + 512 >> 10, u8[z2] = A3, u8[z2 + 1] = A3, u8[z2 + 2] = A3, u8[z2 + 3] = A3, u8[z2 + 4] = A3, u8[z2 + 5] = A3, u8[z2 + 6] = A3, u8[z2 + 7] = A3);
  445. for (var I3 = 0; I3 < 8; ++I3)
  446. C4 = u8[I3], ((w3 = u8[I3 + 8]) | (x4 = u8[I3 + 16]) | (y4 = u8[I3 + 24]) | (D4 = u8[I3 + 32]) | (T4 = u8[I3 + 40]) | (P3 = u8[I3 + 48]) | (L3 = u8[I3 + 56])) != 0 ? (v5 = (h5 = 4112 + ((h5 = c5 * C4 + 2048 >> 12) + (v5 = c5 * D4 + 2048 >> 12) + 1 >> 1)) - v5, A3 = (m7 = x4) * s10 + (d6 = P3) * i10 + 2048 >> 12, m7 = m7 * i10 - d6 * s10 + 2048 >> 12, d6 = A3, k4 = (b4 = (b4 = f6 * (w3 - L3) + 2048 >> 12) + (k4 = T4) + 1 >> 1) - k4, p6 = (g5 = (g5 = f6 * (w3 + L3) + 2048 >> 12) + (p6 = y4) + 1 >> 1) - p6, A3 = b4 * t7 + g5 * a9 + 2048 >> 12, b4 = b4 * a9 - g5 * t7 + 2048 >> 12, g5 = A3, A3 = p6 * o7 + k4 * r11 + 2048 >> 12, p6 = p6 * r11 - k4 * o7 + 2048 >> 12, C4 = (C4 = (h5 = h5 + d6 + 1 >> 1) + g5) < 16 ? 0 : C4 >= 4080 ? 255 : C4 >> 4, w3 = (w3 = (v5 = v5 + m7 + 1 >> 1) + (k4 = A3)) < 16 ? 0 : w3 >= 4080 ? 255 : w3 >> 4, x4 = (x4 = (m7 = v5 - m7) + p6) < 16 ? 0 : x4 >= 4080 ? 255 : x4 >> 4, y4 = (y4 = (d6 = h5 - d6) + b4) < 16 ? 0 : y4 >= 4080 ? 255 : y4 >> 4, D4 = (D4 = d6 - b4) < 16 ? 0 : D4 >= 4080 ? 255 : D4 >> 4, T4 = (T4 = m7 - p6) < 16 ? 0 : T4 >= 4080 ? 255 : T4 >> 4, P3 = (P3 = v5 - k4) < 16 ? 0 : P3 >= 4080 ? 255 : P3 >> 4, L3 = (L3 = h5 - g5) < 16 ? 0 : L3 >= 4080 ? 255 : L3 >> 4, U4[l7 + I3] = C4, U4[l7 + I3 + 8] = w3, U4[l7 + I3 + 16] = x4, U4[l7 + I3 + 24] = y4, U4[l7 + I3 + 32] = D4, U4[l7 + I3 + 40] = T4, U4[l7 + I3 + 48] = P3, U4[l7 + I3 + 56] = L3) : (A3 = (A3 = c5 * C4 + 8192 >> 14) < -2040 ? 0 : A3 >= 2024 ? 255 : A3 + 2056 >> 4, U4[l7 + I3] = A3, U4[l7 + I3 + 8] = A3, U4[l7 + I3 + 16] = A3, U4[l7 + I3 + 24] = A3, U4[l7 + I3 + 32] = A3, U4[l7 + I3 + 40] = A3, U4[l7 + I3 + 48] = A3, U4[l7 + I3 + 56] = A3);
  447. }
  448. function d5(e9, n10) {
  449. for (var r12 = n10.blocksPerLine, o8 = n10.blocksPerColumn, a10 = new Int16Array(64), t8 = 0; t8 < o8; t8++)
  450. for (var i11 = 0; i11 < r12; i11++)
  451. m6(n10, h4(n10, t8, i11), a10);
  452. return n10.blockData;
  453. }
  454. function b3(e9, n10, r12) {
  455. function o8(n11) {
  456. return e9[n11] << 8 | e9[n11 + 1];
  457. }
  458. var a10 = e9.length - 1, t8 = r12 < n10 ? r12 : n10;
  459. if (n10 >= a10)
  460. return null;
  461. var i11 = o8(n10);
  462. if (i11 >= 65472 && i11 <= 65534)
  463. return { invalid: null, marker: i11, offset: n10 };
  464. for (var s11 = o8(t8); !(s11 >= 65472 && s11 <= 65534); ) {
  465. if (++t8 >= a10)
  466. return null;
  467. s11 = o8(t8);
  468. }
  469. return { invalid: i11.toString(16), marker: s11, offset: t8 };
  470. }
  471. return l6.prototype = { parse: function(r12) {
  472. function o8() {
  473. var e9 = r12[c6] << 8 | r12[c6 + 1];
  474. return c6 += 2, e9;
  475. }
  476. function a10() {
  477. var e9 = o8(), n10 = c6 + e9 - 2, a11 = b3(r12, n10, c6);
  478. a11 && a11.invalid && (console.log("readDataBlock - incorrect length, next marker is: " + a11.invalid), n10 = a11.offset);
  479. var t9 = r12.subarray(c6, n10);
  480. return c6 += t9.length, t9;
  481. }
  482. function t8(e9) {
  483. for (var n10 = Math.ceil(e9.samplesPerLine / 8 / e9.maxH), r13 = Math.ceil(e9.scanLines / 8 / e9.maxV), o9 = 0; o9 < e9.components.length; o9++) {
  484. H = e9.components[o9];
  485. var a11 = Math.ceil(Math.ceil(e9.samplesPerLine / 8) * H.h / e9.maxH), t9 = Math.ceil(Math.ceil(e9.scanLines / 8) * H.v / e9.maxV), i12 = n10 * H.h, s12 = r13 * H.v * 64 * (i12 + 1);
  486. H.blockData = new Int16Array(s12), H.blocksPerLine = a11, H.blocksPerColumn = t9;
  487. }
  488. e9.mcusPerLine = n10, e9.mcusPerColumn = r13;
  489. }
  490. var i11, s11, c6 = 0, f7 = null, l7 = null, h5 = [], m7 = [], p6 = [], k4 = o8();
  491. if (k4 !== 65496)
  492. throw new e8("SOI not found");
  493. for (k4 = o8(); k4 !== 65497; ) {
  494. var g5, C4, w3;
  495. switch (k4) {
  496. case 65504:
  497. case 65505:
  498. case 65506:
  499. case 65507:
  500. case 65508:
  501. case 65509:
  502. case 65510:
  503. case 65511:
  504. case 65512:
  505. case 65513:
  506. case 65514:
  507. case 65515:
  508. case 65516:
  509. case 65517:
  510. case 65518:
  511. case 65519:
  512. case 65534:
  513. var x4 = a10();
  514. k4 === 65504 && x4[0] === 74 && x4[1] === 70 && x4[2] === 73 && x4[3] === 70 && x4[4] === 0 && (f7 = { version: { major: x4[5], minor: x4[6] }, densityUnits: x4[7], xDensity: x4[8] << 8 | x4[9], yDensity: x4[10] << 8 | x4[11], thumbWidth: x4[12], thumbHeight: x4[13], thumbData: x4.subarray(14, 14 + 3 * x4[12] * x4[13]) }), k4 === 65518 && x4[0] === 65 && x4[1] === 100 && x4[2] === 111 && x4[3] === 98 && x4[4] === 101 && (l7 = { version: x4[5] << 8 | x4[6], flags0: x4[7] << 8 | x4[8], flags1: x4[9] << 8 | x4[10], transformCode: x4[11] });
  515. break;
  516. case 65499:
  517. for (var y4 = o8() + c6 - 2; c6 < y4; ) {
  518. var D4 = r12[c6++], T4 = new Uint16Array(64);
  519. if (D4 >> 4 == 0)
  520. for (C4 = 0; C4 < 64; C4++)
  521. T4[n9[C4]] = r12[c6++];
  522. else {
  523. if (D4 >> 4 != 1)
  524. throw new e8("DQT - invalid table spec");
  525. for (C4 = 0; C4 < 64; C4++)
  526. T4[n9[C4]] = o8();
  527. }
  528. h5[15 & D4] = T4;
  529. }
  530. break;
  531. case 65472:
  532. case 65473:
  533. case 65474:
  534. if (i11)
  535. throw new e8("Only single frame JPEGs supported");
  536. o8(), (i11 = {}).extended = k4 === 65473, i11.progressive = k4 === 65474, i11.precision = r12[c6++], i11.scanLines = o8(), i11.samplesPerLine = o8(), i11.components = [], i11.componentIds = {};
  537. var P3, L3 = r12[c6++], A3 = 0, _3 = 0;
  538. for (g5 = 0; g5 < L3; g5++) {
  539. P3 = r12[c6];
  540. var U4 = r12[c6 + 1] >> 4, z2 = 15 & r12[c6 + 1];
  541. A3 < U4 && (A3 = U4), _3 < z2 && (_3 = z2);
  542. var I3 = r12[c6 + 2];
  543. w3 = i11.components.push({ h: U4, v: z2, quantizationId: I3, quantizationTable: null }), i11.componentIds[P3] = w3 - 1, c6 += 3;
  544. }
  545. i11.maxH = A3, i11.maxV = _3, t8(i11);
  546. break;
  547. case 65476:
  548. var M3 = o8();
  549. for (g5 = 2; g5 < M3; ) {
  550. var Y = r12[c6++], q = new Uint8Array(16), S4 = 0;
  551. for (C4 = 0; C4 < 16; C4++, c6++)
  552. S4 += q[C4] = r12[c6];
  553. var R3 = new Uint8Array(S4);
  554. for (C4 = 0; C4 < S4; C4++, c6++)
  555. R3[C4] = r12[c6];
  556. g5 += 17 + S4, (Y >> 4 == 0 ? p6 : m7)[15 & Y] = u7(q, R3);
  557. }
  558. break;
  559. case 65501:
  560. o8(), s11 = o8();
  561. break;
  562. case 65498:
  563. o8();
  564. var H, E3 = r12[c6++], J = [];
  565. for (g5 = 0; g5 < E3; g5++) {
  566. var V2 = i11.componentIds[r12[c6++]];
  567. H = i11.components[V2];
  568. var j2 = r12[c6++];
  569. H.huffmanTableDC = p6[j2 >> 4], H.huffmanTableAC = m7[15 & j2], J.push(H);
  570. }
  571. var B2 = r12[c6++], N2 = r12[c6++], G2 = r12[c6++], O3 = v4(r12, c6, i11, J, s11, B2, N2, G2 >> 4, 15 & G2);
  572. c6 += O3;
  573. break;
  574. case 65535:
  575. r12[c6] !== 255 && c6--;
  576. break;
  577. default:
  578. if (r12[c6 - 3] === 255 && r12[c6 - 2] >= 192 && r12[c6 - 2] <= 254) {
  579. c6 -= 3;
  580. break;
  581. }
  582. throw new e8("unknown marker " + k4.toString(16));
  583. }
  584. k4 = o8();
  585. }
  586. for (this.width = i11.samplesPerLine, this.height = i11.scanLines, this.jfif = f7, this.eof = c6, this.adobe = l7, this.components = [], g5 = 0; g5 < i11.components.length; g5++) {
  587. var Q = h5[(H = i11.components[g5]).quantizationId];
  588. Q && (H.quantizationTable = Q), this.components.push({ output: d5(i11, H), scaleX: H.h / i11.maxH, scaleY: H.v / i11.maxV, blocksPerLine: H.blocksPerLine, blocksPerColumn: H.blocksPerColumn });
  589. }
  590. this.numComponents = this.components.length;
  591. }, _getLinearizedBlockData: function(e9, n10) {
  592. var r12, o8, a10, t8, i11, s11, c6, f7, l7, u8, h5, v5 = this.width / e9, m7 = this.height / n10, d6 = 0, b4 = this.components.length, p6 = e9 * n10 * b4, k4 = new Uint8ClampedArray(p6), g5 = new Uint32Array(e9), C4 = 4294967288;
  593. for (c6 = 0; c6 < b4; c6++) {
  594. for (o8 = (r12 = this.components[c6]).scaleX * v5, a10 = r12.scaleY * m7, d6 = c6, h5 = r12.output, t8 = r12.blocksPerLine + 1 << 3, i11 = 0; i11 < e9; i11++)
  595. f7 = 0 | i11 * o8, g5[i11] = (f7 & C4) << 3 | 7 & f7;
  596. for (s11 = 0; s11 < n10; s11++)
  597. for (u8 = t8 * ((f7 = 0 | s11 * a10) & C4) | (7 & f7) << 3, i11 = 0; i11 < e9; i11++)
  598. k4[d6] = h5[u8 + g5[i11]], d6 += b4;
  599. }
  600. var w3 = this.decodeTransform;
  601. if (w3)
  602. for (c6 = 0; c6 < p6; )
  603. for (f7 = 0, l7 = 0; f7 < b4; f7++, c6++, l7 += 2)
  604. k4[c6] = (k4[c6] * w3[l7] >> 8) + w3[l7 + 1];
  605. return k4;
  606. }, _isColorConversionNeeded: function() {
  607. return this.adobe ? !!this.adobe.transformCode : this.numComponents === 3 ? this.colorTransform !== 0 : this.colorTransform === 1;
  608. }, _convertYccToRgb: function(e9) {
  609. for (var n10, r12, o8, a10 = 0, t8 = e9.length; a10 < t8; a10 += 3)
  610. n10 = e9[a10], r12 = e9[a10 + 1], o8 = e9[a10 + 2], e9[a10] = n10 - 179.456 + 1.402 * o8, e9[a10 + 1] = n10 + 135.459 - 0.344 * r12 - 0.714 * o8, e9[a10 + 2] = n10 - 226.816 + 1.772 * r12;
  611. return e9;
  612. }, _convertYcckToRgb: function(e9) {
  613. for (var n10, r12, o8, a10, t8 = 0, i11 = 0, s11 = e9.length; i11 < s11; i11 += 4)
  614. n10 = e9[i11], r12 = e9[i11 + 1], o8 = e9[i11 + 2], a10 = e9[i11 + 3], e9[t8++] = r12 * (-660635669420364e-19 * r12 + 437130475926232e-18 * o8 - 54080610064599e-18 * n10 + 48449797120281e-17 * a10 - 0.154362151871126) - 122.67195406894 + o8 * (-957964378445773e-18 * o8 + 817076911346625e-18 * n10 - 0.00477271405408747 * a10 + 1.53380253221734) + n10 * (961250184130688e-18 * n10 - 0.00266257332283933 * a10 + 0.48357088451265) + a10 * (-336197177618394e-18 * a10 + 0.484791561490776), e9[t8++] = 107.268039397724 + r12 * (219927104525741e-19 * r12 - 640992018297945e-18 * o8 + 659397001245577e-18 * n10 + 426105652938837e-18 * a10 - 0.176491792462875) + o8 * (-778269941513683e-18 * o8 + 0.00130872261408275 * n10 + 770482631801132e-18 * a10 - 0.151051492775562) + n10 * (0.00126935368114843 * n10 - 0.00265090189010898 * a10 + 0.25802910206845) + a10 * (-318913117588328e-18 * a10 - 0.213742400323665), e9[t8++] = r12 * (-570115196973677e-18 * r12 - 263409051004589e-19 * o8 + 0.0020741088115012 * n10 - 0.00288260236853442 * a10 + 0.814272968359295) - 20.810012546947 + o8 * (-153496057440975e-19 * o8 - 132689043961446e-18 * n10 + 560833691242812e-18 * a10 - 0.195152027534049) + n10 * (0.00174418132927582 * n10 - 0.00255243321439347 * a10 + 0.116935020465145) + a10 * (-343531996510555e-18 * a10 + 0.24165260232407);
  615. return e9;
  616. }, _convertYcckToCmyk: function(e9) {
  617. for (var n10, r12, o8, a10 = 0, t8 = e9.length; a10 < t8; a10 += 4)
  618. n10 = e9[a10], r12 = e9[a10 + 1], o8 = e9[a10 + 2], e9[a10] = 434.456 - n10 - 1.402 * o8, e9[a10 + 1] = 119.541 - n10 + 0.344 * r12 + 0.714 * o8, e9[a10 + 2] = 481.816 - n10 - 1.772 * r12;
  619. return e9;
  620. }, _convertCmykToRgb: function(e9) {
  621. for (var n10, r12, o8, a10, t8 = 0, i11 = 1 / 255, s11 = 0, c6 = e9.length; s11 < c6; s11 += 4)
  622. n10 = e9[s11] * i11, r12 = e9[s11 + 1] * i11, o8 = e9[s11 + 2] * i11, a10 = e9[s11 + 3] * i11, e9[t8++] = 255 + n10 * (-4.387332384609988 * n10 + 54.48615194189176 * r12 + 18.82290502165302 * o8 + 212.25662451639585 * a10 - 285.2331026137004) + r12 * (1.7149763477362134 * r12 - 5.6096736904047315 * o8 - 17.873870861415444 * a10 - 5.497006427196366) + o8 * (-2.5217340131683033 * o8 - 21.248923337353073 * a10 + 17.5119270841813) - a10 * (21.86122147463605 * a10 + 189.48180835922747), e9[t8++] = 255 + n10 * (8.841041422036149 * n10 + 60.118027045597366 * r12 + 6.871425592049007 * o8 + 31.159100130055922 * a10 - 79.2970844816548) + r12 * (-15.310361306967817 * r12 + 17.575251261109482 * o8 + 131.35250912493976 * a10 - 190.9453302588951) + o8 * (4.444339102852739 * o8 + 9.8632861493405 * a10 - 24.86741582555878) - a10 * (20.737325471181034 * a10 + 187.80453709719578), e9[t8++] = 255 + n10 * (0.8842522430003296 * n10 + 8.078677503112928 * r12 + 30.89978309703729 * o8 - 0.23883238689178934 * a10 - 14.183576799673286) + r12 * (10.49593273432072 * r12 + 63.02378494754052 * o8 + 50.606957656360734 * a10 - 112.23884253719248) + o8 * (0.03296041114873217 * o8 + 115.60384449646641 * a10 - 193.58209356861505) - a10 * (22.33816807309886 * a10 + 180.12613974708367);
  623. return e9;
  624. }, getData: function(n10, r12, o8) {
  625. if (this.numComponents > 4)
  626. throw new e8("Unsupported color mode");
  627. var a10 = this._getLinearizedBlockData(n10, r12);
  628. if (this.numComponents === 1 && o8) {
  629. for (var t8 = a10.length, i11 = new Uint8ClampedArray(3 * t8), s11 = 0, c6 = 0; c6 < t8; c6++) {
  630. var f7 = a10[c6];
  631. i11[s11++] = f7, i11[s11++] = f7, i11[s11++] = f7;
  632. }
  633. return i11;
  634. }
  635. if (this.numComponents === 3 && this._isColorConversionNeeded())
  636. return this._convertYccToRgb(a10);
  637. if (this.numComponents === 4) {
  638. if (this._isColorConversionNeeded())
  639. return o8 ? this._convertYcckToRgb(a10) : this._convertYcckToCmyk(a10);
  640. if (o8)
  641. return this._convertCmykToRgb(a10);
  642. }
  643. return a10;
  644. } }, l6;
  645. }();
  646. }, (r4 = n2()) !== void 0 && (e4.exports = r4);
  647. var a3 = o2.exports;
  648. // node_modules/@arcgis/core/layers/support/rasterFormats/JpgPlus.js
  649. var n3 = class {
  650. static decode(n9, r11 = false) {
  651. const s10 = new Uint8Array(n9), o7 = new a3();
  652. o7.parse(s10);
  653. const { width: a9, height: i10, numComponents: l6, eof: h4 } = o7, c5 = o7.getData(a9, i10, true);
  654. let f6;
  655. const g5 = a9 * i10;
  656. let p6 = 0, u7 = 0, m6 = 0;
  657. if (!r11 && h4 < s10.length - 1)
  658. try {
  659. const t7 = new s4(s10.subarray(h4)).getBytes();
  660. f6 = new Uint8Array(g5);
  661. let n10 = 0;
  662. for (p6 = 0; p6 < t7.length; p6++)
  663. for (m6 = 7; m6 >= 0; m6--)
  664. f6[n10++] = t7[p6] >> m6 & 1;
  665. } catch {
  666. }
  667. let w3, y4 = null;
  668. if (l6 === 1 && c5.length === a9 * i10)
  669. y4 = [c5, c5, c5];
  670. else {
  671. for (y4 = [], p6 = 0; p6 < 3; p6++)
  672. w3 = new Uint8Array(g5), y4.push(w3);
  673. for (m6 = 0, u7 = 0; u7 < g5; u7++)
  674. for (p6 = 0; p6 < 3; p6++)
  675. y4[p6][u7] = c5[m6++];
  676. }
  677. return { width: a9, height: i10, pixels: y4, mask: f6 };
  678. }
  679. };
  680. // node_modules/@arcgis/core/layers/support/rasterFormats/Lerc.js
  681. var t3 = [{ pixelType: "S8", size: 1, ctor: Int8Array, range: [-128, 128] }, { pixelType: "U8", size: 1, ctor: Uint8Array, range: [0, 255] }, { pixelType: "S16", size: 2, ctor: Int16Array, range: [-32768, 32767] }, { pixelType: "U16", size: 2, ctor: Uint16Array, range: [0, 65536] }, { pixelType: "S32", size: 4, ctor: Int32Array, range: [-2147483648, 2147483647] }, { pixelType: "U32", size: 4, ctor: Uint32Array, range: [0, 4294967296] }, { pixelType: "F32", size: 4, ctor: Float32Array, range: [-34027999387901484e22, 34027999387901484e22] }, { pixelType: "F64", size: 8, ctor: Float64Array, range: [-17976931348623157e292, 17976931348623157e292] }];
  682. var n4 = null;
  683. var r5 = false;
  684. function a4() {
  685. return n4 || (n4 = import("./lerc-wasm-4BPBJWUK.js").then((e8) => e8.l).then(({ default: t7 }) => t7({ locateFile: (t8) => a(`esri/layers/support/rasterFormats/${t8}`) })).then((e8) => {
  686. u2(e8), r5 = true;
  687. }), n4);
  688. }
  689. var i4 = { getBlobInfo: null, decode: null };
  690. function o3(e8) {
  691. return 16 + (e8 >> 3 << 3);
  692. }
  693. function s5(e8, t7, n9) {
  694. n9.set(e8.slice(t7, t7 + n9.length));
  695. }
  696. function u2(e8) {
  697. const { _malloc: n9, _free: r11, _lerc_getBlobInfo: a9, _lerc_getDataRanges: l6, _lerc_decode_4D: u7, asm: f6 } = e8;
  698. let c5;
  699. const y4 = Object.values(f6).find((t7) => t7 && "buffer" in t7 && t7.buffer === e8.HEAPU8.buffer), p6 = (e9) => {
  700. const t7 = e9.map((e10) => o3(e10)), r12 = t7.reduce((e10, t8) => e10 + t8), a10 = n9(r12);
  701. c5 = new Uint8Array(y4.buffer);
  702. let l7 = t7[0];
  703. t7[0] = a10;
  704. for (let n10 = 1; n10 < t7.length; n10++) {
  705. const e10 = t7[n10];
  706. t7[n10] = t7[n10 - 1] + l7, l7 = e10;
  707. }
  708. return t7;
  709. };
  710. i4.getBlobInfo = (e9) => {
  711. const t7 = 12, n10 = 3, i10 = new Uint8Array(4 * t7), o7 = new Uint8Array(8 * n10), [u8, f7, h4] = p6([e9.length, i10.length, o7.length]);
  712. c5.set(e9, u8), c5.set(i10, f7), c5.set(o7, h4);
  713. let g5 = a9(u8, e9.length, f7, h4, t7, n10);
  714. if (g5)
  715. throw r11(u8), `lerc-getBlobInfo: error code is ${g5}`;
  716. c5 = new Uint8Array(y4.buffer), s5(c5, f7, i10), s5(c5, h4, o7);
  717. const d5 = new Uint32Array(i10.buffer), b3 = new Float64Array(o7.buffer), [m6, A3, w3, U4, x4, T4, C4, V2, z2, , D4] = d5, F = { version: m6, dimCount: w3, width: U4, height: x4, validPixelCount: C4, bandCount: T4, blobSize: V2, maskCount: z2, dataType: A3, minValue: b3[0], maxValue: b3[1], maxZerror: b3[2], statistics: [], bandCountWithNoData: D4 };
  718. if (D4)
  719. return F;
  720. if (w3 === 1 && T4 === 1)
  721. return r11(u8), F.statistics.push({ minValue: b3[0], maxValue: b3[1] }), F;
  722. const I3 = w3 * T4 * 8, _3 = new Uint8Array(I3), k4 = new Uint8Array(I3);
  723. let B2 = u8, v4 = 0, S4 = 0, O3 = false;
  724. if (c5.byteLength < u8 + 2 * I3 ? (r11(u8), O3 = true, [B2, v4, S4] = p6([e9.length, I3, I3]), c5.set(e9, B2)) : [v4, S4] = p6([I3, I3]), c5.set(_3, v4), c5.set(k4, S4), g5 = l6(B2, e9.length, w3, T4, v4, S4), g5)
  725. throw r11(B2), O3 || r11(v4), `lerc-getDataRanges: error code is ${g5}`;
  726. c5 = new Uint8Array(y4.buffer), s5(c5, v4, _3), s5(c5, S4, k4);
  727. const $ = new Float64Array(_3.buffer), j2 = new Float64Array(k4.buffer), M3 = F.statistics;
  728. for (let r12 = 0; r12 < T4; r12++)
  729. if (w3 > 1) {
  730. const e10 = $.slice(r12 * w3, (r12 + 1) * w3), t8 = j2.slice(r12 * w3, (r12 + 1) * w3), n11 = Math.min.apply(null, e10), a10 = Math.max.apply(null, t8);
  731. M3.push({ minValue: n11, maxValue: a10, dimStats: { minValues: e10, maxValues: t8 } });
  732. } else
  733. M3.push({ minValue: $[r12], maxValue: j2[r12] });
  734. return r11(B2), O3 || r11(v4), F;
  735. }, i4.decode = (e9, n10) => {
  736. const { maskCount: a10, dimCount: l7, bandCount: i10, width: o7, height: f7, dataType: h4, bandCountWithNoData: g5 } = n10, d5 = t3[h4], b3 = o7 * f7, m6 = new Uint8Array(b3 * i10), A3 = b3 * l7 * i10 * d5.size, w3 = new Uint8Array(A3), U4 = new Uint8Array(i10), x4 = new Uint8Array(8 * i10), [T4, C4, V2, z2, D4] = p6([e9.length, m6.length, w3.length, U4.length, x4.length]);
  737. c5.set(e9, T4), c5.set(m6, C4), c5.set(w3, V2), c5.set(U4, z2), c5.set(x4, D4);
  738. const F = u7(T4, e9.length, a10, C4, l7, o7, f7, i10, h4, V2, z2, D4);
  739. if (F)
  740. throw r11(T4), `lerc-decode: error code is ${F}`;
  741. c5 = new Uint8Array(y4.buffer), s5(c5, V2, w3), s5(c5, C4, m6);
  742. let I3 = null;
  743. if (g5) {
  744. s5(c5, z2, U4), s5(c5, D4, x4), I3 = [];
  745. const e10 = new Float64Array(x4.buffer);
  746. for (let t7 = 0; t7 < U4.length; t7++)
  747. I3.push(U4[t7] ? e10[t7] : null);
  748. }
  749. return r11(T4), { data: w3, maskData: m6, noDataValues: I3 };
  750. };
  751. }
  752. function f(e8, t7, n9, r11, a9) {
  753. if (n9 < 2)
  754. return e8;
  755. const l6 = new r11(t7 * n9);
  756. if (a9)
  757. for (let i10 = 0, o7 = 0; i10 < t7; i10++)
  758. for (let r12 = 0, a10 = i10; r12 < n9; r12++, a10 += t7)
  759. l6[a10] = e8[o7++];
  760. else
  761. for (let i10 = 0, o7 = 0; i10 < t7; i10++)
  762. for (let r12 = 0, a10 = i10; r12 < n9; r12++, a10 += t7)
  763. l6[o7++] = e8[a10];
  764. return l6;
  765. }
  766. function c(e8, n9 = {}) {
  767. const r11 = n9.inputOffset ?? 0, a9 = e8 instanceof Uint8Array ? e8.subarray(r11) : new Uint8Array(e8, r11), l6 = i4.getBlobInfo(a9), { data: o7, maskData: s10 } = i4.decode(a9, l6), { width: u7, height: c5, bandCount: y4, dimCount: p6, dataType: h4, maskCount: g5, statistics: d5 } = l6, b3 = t3[h4], m6 = new b3.ctor(o7.buffer), A3 = [], w3 = [], U4 = u7 * c5, x4 = U4 * p6;
  768. for (let t7 = 0; t7 < y4; t7++) {
  769. const e9 = m6.subarray(t7 * x4, (t7 + 1) * x4);
  770. if (n9.returnPixelInterleavedDims)
  771. A3.push(e9);
  772. else {
  773. const t8 = f(e9, U4, p6, b3.ctor, true);
  774. A3.push(t8);
  775. }
  776. w3.push(s10.subarray(t7 * x4, (t7 + 1) * x4));
  777. }
  778. const T4 = g5 === 0 ? null : g5 === 1 ? w3[0] : new Uint8Array(U4);
  779. if (g5 > 1) {
  780. T4.set(w3[0]);
  781. for (let e9 = 1; e9 < w3.length; e9++) {
  782. const t7 = w3[e9];
  783. for (let e10 = 0; e10 < U4; e10++)
  784. T4[e10] = T4[e10] & t7[e10];
  785. }
  786. }
  787. const { noDataValue: C4 } = n9, V2 = C4 != null && b3.range[0] <= C4 && b3.range[1] >= C4;
  788. if (g5 > 0 && V2)
  789. for (let t7 = 0; t7 < y4; t7++) {
  790. const e9 = A3[t7], n10 = w3[t7] || T4;
  791. for (let t8 = 0; t8 < U4; t8++)
  792. n10[t8] === 0 && (e9[t8] = C4);
  793. }
  794. const z2 = g5 === y4 && y4 > 1 ? w3 : null;
  795. return { width: u7, height: c5, bandCount: y4, pixelType: n9.pixelType && l6.version === 0 ? n9.pixelType : b3.pixelType, dimCount: p6, statistics: d5, pixels: A3, mask: T4, bandMasks: z2 };
  796. }
  797. // node_modules/@arcgis/core/layers/support/rasterFormats/Lzw.js
  798. function e5(e8, n9, t7, r11 = true) {
  799. if (n9 % 4 != 0 || t7 % 4 != 0) {
  800. const i10 = new ArrayBuffer(4 * Math.ceil(t7 / 4)), l6 = new Uint8Array(i10), o7 = new Uint8Array(e8, n9, t7);
  801. if (r11)
  802. for (let e9 = 0; e9 < l6.length; e9 += 4)
  803. l6[e9] = o7[e9 + 3], l6[e9 + 1] = o7[e9 + 2], l6[e9 + 2] = o7[e9 + 1], l6[e9 + 3] = o7[e9];
  804. else
  805. l6.set(o7);
  806. return new Uint32Array(l6.buffer);
  807. }
  808. if (r11) {
  809. const r12 = new Uint8Array(e8, n9, t7), i10 = new Uint8Array(r12.length);
  810. for (let e9 = 0; e9 < i10.length; e9 += 4)
  811. i10[e9] = r12[e9 + 3], i10[e9 + 1] = r12[e9 + 2], i10[e9 + 2] = r12[e9 + 1], i10[e9 + 3] = r12[e9];
  812. return new Uint32Array(i10.buffer);
  813. }
  814. return new Uint32Array(e8, n9, t7 / 4);
  815. }
  816. function n5() {
  817. const e8 = [];
  818. for (let n9 = 0; n9 <= 257; n9++)
  819. e8[n9] = [n9];
  820. return e8;
  821. }
  822. function t4(e8, n9) {
  823. for (let t7 = 0; t7 < n9.length; t7++)
  824. e8.push(n9[t7]);
  825. }
  826. var r6 = new Set();
  827. function i5(i10, l6, o7, f6 = true) {
  828. const s10 = e5(i10, l6, o7, f6);
  829. let a9 = 9, c5 = n5(), u7 = 32, h4 = c5.length, d5 = [], g5 = 1, w3 = s10[0], y4 = 0;
  830. const A3 = s10.length, U4 = 8 * (4 * A3 - o7), p6 = [];
  831. for (; w3 != null; ) {
  832. if (u7 >= a9)
  833. u7 -= a9, y4 = w3 >>> 32 - a9, w3 <<= a9;
  834. else {
  835. y4 = w3 >>> 32 - u7, w3 = s10[g5++];
  836. const e9 = a9 - u7;
  837. u7 = 32 - e9, y4 = (y4 << e9) + (w3 >>> u7), w3 <<= e9;
  838. }
  839. if (y4 === 257)
  840. break;
  841. if (y4 === 256) {
  842. a9 = 9, c5 = n5(), h4 = c5.length, d5 = [];
  843. continue;
  844. }
  845. const e8 = c5[y4];
  846. if (e8 == null) {
  847. if (y4 > c5.length)
  848. throw "data integrity issue: code does not exist on code page";
  849. d5.push(d5[0]), c5[h4++] = d5.slice(), t4(p6, d5);
  850. } else
  851. t4(p6, e8), d5.push(e8[0]), d5.length > 1 && (c5[h4++] = d5.slice()), d5 = e8.slice();
  852. if (r6.has(h4) && a9++, u7 === 0 && (w3 = s10[g5++], u7 = 32), g5 > A3 || g5 === A3 && u7 <= U4)
  853. break;
  854. }
  855. return new Uint8Array(p6);
  856. }
  857. r6.add(511), r6.add(1023), r6.add(2047), r6.add(4095), r6.add(8191);
  858. // node_modules/@arcgis/core/layers/support/rasterFormats/Raw.js
  859. var e6 = (e8, r11) => {
  860. const a9 = r11.width * r11.height, n9 = r11.pixelType;
  861. return Math.floor(e8.byteLength / (a9 * t5(n9)));
  862. };
  863. var t5 = (e8) => {
  864. let t7 = 1;
  865. switch (e8) {
  866. case Uint8Array:
  867. case Int8Array:
  868. t7 = 1;
  869. break;
  870. case Uint16Array:
  871. case Int16Array:
  872. t7 = 2;
  873. break;
  874. case Uint32Array:
  875. case Int32Array:
  876. case Float32Array:
  877. t7 = 4;
  878. break;
  879. case Float64Array:
  880. t7 = 8;
  881. }
  882. return t7;
  883. };
  884. var r7 = (e8, t7) => {
  885. if (8 * e8.byteLength < t7)
  886. return null;
  887. const r11 = new Uint8Array(e8, 0, Math.ceil(t7 / 8)), a9 = new Uint8Array(t7);
  888. let n9 = 0, s10 = 0, i10 = 0, h4 = 0;
  889. for (i10 = 0; i10 < r11.length - 1; i10++)
  890. for (s10 = r11[i10], h4 = 7; h4 >= 0; h4--)
  891. a9[n9++] = s10 >> h4 & 1;
  892. for (h4 = 7; n9 < t7 - 1; )
  893. s10 = r11[r11.length - 1], a9[n9++] = s10 >> h4 & 1, h4--;
  894. return a9;
  895. };
  896. var a5 = class {
  897. static decode(a9, n9) {
  898. const s10 = n9.pixelType, i10 = [], h4 = n9.width * n9.height, l6 = e6(a9, n9), { bandIds: c5, format: y4 } = n9, o7 = c5 && c5.length || e6(a9, n9), b3 = a9.byteLength - a9.byteLength % (h4 * t5(s10)), f6 = new s10(a9, 0, h4 * l6);
  899. let g5, u7, A3, p6, d5;
  900. if (y4 === "bip")
  901. for (g5 = 0; g5 < o7; g5++) {
  902. for (p6 = new s10(h4), d5 = c5 ? c5[g5] : g5, u7 = 0; u7 < h4; u7++)
  903. p6[u7] = f6[u7 * l6 + d5];
  904. i10.push(p6);
  905. }
  906. else if (y4 === "bsq")
  907. for (g5 = 0; g5 < o7; g5++)
  908. d5 = c5 ? c5[g5] : g5, i10.push(f6.subarray(d5 * h4, (d5 + 1) * h4));
  909. return b3 < a9.byteLength - 1 && (A3 = r7(a9.slice(b3), h4)), { pixels: i10, mask: A3 };
  910. }
  911. };
  912. // node_modules/@arcgis/core/layers/support/rasterDatasets/byteStreamUtils.js
  913. function r8(r11, t7) {
  914. let n9 = 0, o7 = "", e8 = 0, f6 = 0;
  915. const c5 = r11.length;
  916. for (; n9 < c5; )
  917. f6 = r11[n9++], e8 = f6 >> 4, e8 < 8 ? e8 = 1 : e8 === 15 ? (e8 = 4, f6 = (7 & f6) << 18 | (63 & r11[n9++]) << 12 | (63 & r11[n9++]) << 6 | 63 & r11[n9++]) : e8 === 14 ? (e8 = 3, f6 = (15 & f6) << 12 | (63 & r11[n9++]) << 6 | 63 & r11[n9++]) : (e8 = 2, f6 = (31 & f6) << 6 | 63 & r11[n9++]), (f6 !== 0 || t7) && (o7 += String.fromCharCode(f6));
  918. return o7;
  919. }
  920. // node_modules/@arcgis/core/layers/support/rasterFormats/TiffTags.js
  921. var e7 = (() => {
  922. const e8 = [];
  923. return e8[254] = "NEWSUBFILETYPE", e8[255] = "SUBFILETYPE", e8[256] = "IMAGEWIDTH", e8[257] = "IMAGELENGTH", e8[258] = "BITSPERSAMPLE", e8[259] = "COMPRESSION", e8[262] = "PHOTOMETRICINTERPRETATION", e8[263] = "THRESHHOLDING", e8[264] = "CELLWIDTH", e8[265] = "CELLLENGTH", e8[266] = "FILLORDER", e8[269] = "DOCUMENTNAME", e8[270] = "IMAGEDESCRIPTION", e8[271] = "MAKE", e8[272] = "MODEL", e8[273] = "STRIPOFFSETS", e8[274] = "ORIENTATION", e8[277] = "SAMPLESPERPIXEL", e8[278] = "ROWSPERSTRIP", e8[279] = "STRIPBYTECOUNTS", e8[280] = "MINSAMPLEVALUE", e8[281] = "MAXSAMPLEVALUE", e8[282] = "XRESOLUTION", e8[283] = "YRESOLUTION", e8[284] = "PLANARCONFIGURATION", e8[285] = "PAGENAME", e8[286] = "XPOSITION", e8[287] = "YPOSITION", e8[288] = "FREEOFFSETS", e8[289] = "FREEBYTECOUNTS", e8[290] = "GRAYRESPONSEUNIT", e8[291] = "GRAYRESPONSECURVE", e8[292] = "T4OPTIONS", e8[293] = "T6OPTIONS", e8[296] = "RESOLUTIONUNIT", e8[297] = "PAGENUMBER", e8[300] = "COLORRESPONSEUNIT", e8[301] = "TRANSFERFUNCTION", e8[305] = "SOFTWARE", e8[306] = "DATETIME", e8[315] = "ARTIST", e8[316] = "HOSTCOMPUTER", e8[317] = "PREDICTOR", e8[318] = "WHITEPOINT", e8[319] = "PRIMARYCHROMATICITIES", e8[320] = "COLORMAP", e8[321] = "HALFTONEHINTS", e8[322] = "TILEWIDTH", e8[323] = "TILELENGTH", e8[324] = "TILEOFFSETS", e8[325] = "TILEBYTECOUNTS", e8[326] = "BADFAXLINES", e8[327] = "CLEANFAXDATA", e8[328] = "CONSECUTIVEBADFAXLINES", e8[330] = "SUBIFD", e8[332] = "INKSET", e8[333] = "INKNAMES", e8[334] = "NUMBEROFINKS", e8[336] = "DOTRANGE", e8[337] = "TARGETPRINTER", e8[338] = "EXTRASAMPLES", e8[339] = "SAMPLEFORMAT", e8[340] = "SMINSAMPLEVALUE", e8[341] = "SMAXSAMPLEVALUE", e8[342] = "TRANSFERRANGE", e8[347] = "JPEGTABLES", e8[512] = "JPEGPROC", e8[513] = "JPEGIFOFFSET", e8[514] = "JPEGIFBYTECOUNT", e8[515] = "JPEGRESTARTINTERVAL", e8[517] = "JPEGLOSSLESSPREDICTORS", e8[518] = "JPEGPOINTTRANSFORM", e8[519] = "JPEGQTABLES", e8[520] = "JPEGDCTABLES", e8[521] = "JPEGACTABLES", e8[529] = "YCBCRCOEFFICIENTS", e8[530] = "YCBCRSUBSAMPLING", e8[531] = "YCBCRPOSITIONING", e8[532] = "REFERENCEBLACKWHITE", e8[700] = "XMP", e8[33550] = "GEOPIXELSCALE", e8[33922] = "GEOTIEPOINTS", e8[33432] = "COPYRIGHT", e8[42112] = "GDAL_METADATA", e8[42113] = "GDAL_NODATA", e8[50844] = "RPCCOEFFICIENT", e8[34264] = "GEOTRANSMATRIX", e8[34735] = "GEOKEYDIRECTORY", e8[34736] = "GEODOUBLEPARAMS", e8[34737] = "GEOASCIIPARAMS", e8[34665] = "EXIFIFD", e8[34853] = "GPSIFD", e8[40965] = "INTEROPERABILITYIFD", e8;
  924. })();
  925. var i6 = (() => {
  926. const i10 = [].concat(e7);
  927. return i10[36864] = "ExifVersion", i10[40960] = "FlashpixVersion", i10[40961] = "ColorSpace", i10[42240] = "Gamma", i10[37121] = "ComponentsConfiguration", i10[37122] = "CompressedBitsPerPixel", i10[40962] = "PixelXDimension", i10[40963] = "PixelYDimension", i10[37500] = "MakerNote", i10[37510] = "UserComment", i10[40964] = "RelatedSoundFile", i10[36867] = "DateTimeOriginal", i10[36868] = "DateTimeDigitized", i10[36880] = "OffsetTime", i10[36881] = "OffsetTimeOriginal", i10[36882] = "OffsetTimeDigitized", i10[37520] = "SubSecTime", i10[37521] = "SubSecTimeOriginal", i10[37522] = "SubSecTimeDigitized", i10[37888] = "Temperature", i10[37889] = "Humidity", i10[37890] = "Pressure", i10[37891] = "WaterDepth", i10[37892] = "Acceleration", i10[37893] = "CameraElevationAngle", i10[42016] = "ImageUniqueID", i10[42032] = "CameraOwnerName", i10[42033] = "BodySerialNumber", i10[42034] = "LensSpecification", i10[42035] = "LensMake", i10[42036] = "LensModel", i10[42037] = "LensSerialNumber", i10[33434] = "ExposureTime", i10[33437] = "FNumber", i10[34850] = "ExposureProgram", i10[34852] = "SpectralSensitivity", i10[34855] = "PhotographicSensitivity", i10[34856] = "OECF", i10[34864] = "SensitivityType", i10[34865] = "StandardOutputSensitivity", i10[34866] = "RecommendedExposureIndex", i10[34867] = "ISOSpeed", i10[34868] = "ISOSpeedLatitudeyyy", i10[34869] = "ISOSpeedLatitudezzz", i10[37377] = "ShutterSpeedValue", i10[37378] = "ApertureValue", i10[37379] = "BrightnessValue", i10[37380] = "ExposureBiasValue", i10[37381] = "MaxApertureValue", i10[37382] = "SubjectDistance", i10[37383] = "MeteringMode", i10[37384] = "LightSource", i10[37385] = "Flash", i10[37386] = "FocalLength", i10[37396] = "SubjectArea", i10[41483] = "FlashEnergy", i10[41484] = "SpatialFrequencyResponse", i10[41486] = "FocalPlaneXResolution", i10[41487] = "FocalPlaneYResolution", i10[41488] = "FocalPlaneResolutionUnit", i10[41492] = "SubjectLocation", i10[41493] = "ExposureIndex", i10[41495] = "SensingMethod", i10[41728] = "FileSource", i10[41729] = "SceneType", i10[41730] = "CFAPattern", i10[41985] = "CustomRendered", i10[41986] = "ExposureMode", i10[41987] = "WhiteBalance", i10[41988] = "DigitalZoomRatio", i10[41989] = "FocalLengthIn35mmFilm", i10[41990] = "SceneCaptureType", i10[41991] = "GainControl", i10[41992] = "Contrast", i10[41993] = "Saturation", i10[41994] = "Sharpness", i10[41995] = "DeviceSettingDescription", i10[41996] = "SubjectDistanceRange", i10;
  928. })();
  929. var t6 = ["GPSVersionID", "GPSLatitudeRef", "GPSLatitude", "GPSLongitudeRef", "GPSLongitude", "GPSAltitudeRef", "GPSAltitude", "GPSTimeStamp", "GPSSatellites", "GPSStatus", "GPSMeasureMode", "GPSDOP", "GPSSpeedRef", "GPSSpeed", "GPSTrackRef", "GPSTrack", "GPSImgDirectionRef", "GPSImgDirection", "GPSMapDatum", "GPSDestLatitudeRef", "GPSDestLatitude", "GPSDestLongitudeRef", "GPSDestLongitude", "GPSDestBearingRef", "GPSDestBearing", "GPSDestDistanceRef", "GPSDestDistance", "GPSProcessingMethod", "GPSAreaInformation", "GPSDateStamp", "GPSDifferential", "GPSHPositioningError"];
  930. var o4 = (() => {
  931. const e8 = [];
  932. return e8[1024] = "GTModelTypeGeoKey", e8[1025] = "GTRasterTypeGeoKey", e8[1026] = "GTCitationGeoKey", e8[2048] = "GeographicTypeGeoKey", e8[2049] = "GeogCitationGeoKey", e8[2050] = "GeogGeodeticDatumGeoKey", e8[2051] = "GeogPrimeMeridianGeoKey", e8[2052] = "GeogLinearUnitsGeoKey", e8[2053] = "GeogLinearUnitSizeGeoKey", e8[2054] = "GeogAngularUnitsGeoKey", e8[2055] = "GeogAngularUnitSizeGeoKey", e8[2056] = "GeogEllipsoidGeoKey", e8[2057] = "GeogSemiMajorAxisGeoKey", e8[2058] = "GeogSemiMinorAxisGeoKey", e8[2059] = "GeogInvFlatteningGeoKey", e8[2061] = "GeogPrimeMeridianLongGeoKey", e8[2060] = "GeogAzimuthUnitsGeoKey", e8[3072] = "ProjectedCSTypeGeoKey", e8[3073] = "PCSCitationGeoKey", e8[3074] = "ProjectionGeoKey", e8[3075] = "ProjCoordTransGeoKey", e8[3076] = "ProjLinearUnitsGeoKey", e8[3077] = "ProjLinearUnitSizeGeoKey", e8[3078] = "ProjStdParallel1GeoKey", e8[3079] = "ProjStdParallel2GeoKey", e8[3080] = "ProjNatOriginLongGeoKey", e8[3081] = "ProjNatOriginLatGeoKey", e8[3082] = "ProjFalseEastingGeoKey", e8[3083] = "ProjFalseNorthingGeoKey", e8[3084] = "ProjFalseOriginLongGeoKey", e8[3085] = "ProjFalseOriginLatGeoKey", e8[3086] = "ProjFalseOriginEastingGeoKey", e8[3087] = "ProjFalseOriginNorthingGeoKey", e8[3088] = "ProjCenterLongGeoKey", e8[3090] = "ProjCenterEastingGeoKey", e8[3091] = "ProjCenterNorthingGeoKey", e8[3092] = "ProjScaleAtNatOriginGeoKey", e8[3093] = "ProjScaleAtCenterGeoKey", e8[3094] = "ProjAzimuthAngleGeoKey", e8[3095] = "ProjStraightVertPoleLongGeoKey", e8[4096] = "VerticalCSTypeGeoKey", e8[4097] = "VerticalCitationGeoKey", e8[4098] = "VerticalDatumGeoKey", e8[4099] = "VerticalUnitsGeoKey", e8;
  933. })();
  934. var S = (i10, t7) => {
  935. let o7 = (t7 || e7)[i10];
  936. return o7 === void 0 && (o7 = "unknown" + String(i10)), o7;
  937. };
  938. var E = new Map();
  939. E.set("EXIFIFD", i6), E.set("GPSIFD", t6);
  940. var n6 = { TIFF_TAGS: e7, ifdTags: E, GEO_KEYS: o4, getTagName: S };
  941. // node_modules/@arcgis/core/layers/support/rasterFormats/utils.js
  942. var r9 = (() => {
  943. const r11 = new ArrayBuffer(4), n9 = new Uint8Array(r11);
  944. return new Uint32Array(r11)[0] = 1, n9[0] === 1;
  945. })();
  946. // node_modules/@arcgis/core/layers/support/rasterFormats/TiffDecoder.js
  947. var o5 = [0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, -1, -1, -1, 8, 8, 8];
  948. var f2 = 4294967296;
  949. var c2 = new Set([1, 5, 6, 7, 8, 34712, 34887]);
  950. function u3(e8, t7) {
  951. let n9 = "unknown";
  952. return e8 === 3 ? n9 = "f32" : e8 === 1 ? t7 === 1 ? n9 = "u1" : t7 === 2 ? n9 = "u2" : t7 === 4 ? n9 = "u4" : t7 <= 8 ? n9 = "u8" : t7 <= 16 ? n9 = "u16" : t7 <= 32 && (n9 = "u32") : e8 === 2 && (t7 <= 8 ? n9 = "s8" : t7 <= 16 ? n9 = "s16" : t7 <= 32 && (n9 = "s32")), n9;
  953. }
  954. function h(e8) {
  955. let t7 = null;
  956. switch (e8 ? e8.toLowerCase() : "f32") {
  957. case "u1":
  958. case "u2":
  959. case "u4":
  960. case "u8":
  961. t7 = Uint8Array;
  962. break;
  963. case "u16":
  964. t7 = Uint16Array;
  965. break;
  966. case "u32":
  967. t7 = Uint32Array;
  968. break;
  969. case "s8":
  970. t7 = Int8Array;
  971. break;
  972. case "s16":
  973. t7 = Int16Array;
  974. break;
  975. case "s32":
  976. t7 = Int32Array;
  977. break;
  978. default:
  979. t7 = Float32Array;
  980. }
  981. return t7;
  982. }
  983. function g(e8, t7) {
  984. return { x: t7[0] * e8.x + t7[1] * e8.y + t7[2], y: t7[3] * e8.x + t7[4] * e8.y + t7[5] };
  985. }
  986. function w(e8, t7) {
  987. return e8.get(t7)?.values;
  988. }
  989. function p3(e8, t7) {
  990. return e8.get(t7)?.values;
  991. }
  992. function d2(e8, t7) {
  993. return e8.get(t7)?.values[0];
  994. }
  995. function I(e8, t7) {
  996. return e8.get(t7)?.values[0];
  997. }
  998. function T(e8, t7, n9, a9 = 0, i10 = n6.TIFF_TAGS, r11 = 4) {
  999. const l6 = r11 === 8, o7 = l6 ? U(new DataView(e8, n9, 8), 0, t7) : new DataView(e8, n9, 2).getUint16(0, t7), f6 = 4 + 2 * r11, c5 = l6 ? 8 : 2, u7 = c5 + o7 * f6;
  1000. if (n9 + u7 > e8.byteLength)
  1001. return { success: false, ifd: null, nextIFD: null, requiredBufferSize: u7 };
  1002. const h4 = n9 + u7 + 4 <= e8.byteLength ? P(new DataView(e8, n9 + u7, r11 === 8 ? 8 : 4), 0, t7, r11 === 8) : null, g5 = n9 + c5, w3 = new Map();
  1003. let p6, d5, I3, T4, E3, y4, m6;
  1004. for (let A3 = 0; A3 < o7; A3++) {
  1005. d5 = new DataView(e8, g5 + f6 * A3, f6), I3 = d5.getUint16(0, t7), E3 = d5.getUint16(2, t7), T4 = n6.getTagName(I3, i10);
  1006. const n10 = [];
  1007. r11 === 2 ? (y4 = d5.getUint16(4, t7), m6 = d5.getUint16(6, t7)) : r11 === 4 ? (y4 = d5.getUint32(4, t7), m6 = d5.getUint32(8, t7)) : r11 === 8 && (y4 = P(d5, 4, t7, true), m6 = P(d5, 12, t7, true), n10.push(d5.getUint32(12, t7)), n10.push(d5.getUint32(16, t7))), p6 = { id: I3, type: E3, valueCount: y4, valueOffset: m6, valueOffsets: n10, values: null }, x(e8, t7, p6, a9, false, r11), w3.set(T4, p6);
  1008. }
  1009. return { success: true, ifd: w3, nextIFD: h4, requiredBufferSize: u7 };
  1010. }
  1011. var E2 = (e8, t7) => c(e8, { inputOffset: t7 }).pixels[0];
  1012. async function y2(e8, a9, s10, o7, f6) {
  1013. const c5 = r9 === a9, g5 = I(s10, "BITSPERSAMPLE"), w3 = u3(I(s10, "SAMPLEFORMAT") ?? 1, g5), p6 = I(s10, "COMPRESSION") ?? 1, d5 = h(w3);
  1014. let T4, y4, m6, A3, S4, M3, x4;
  1015. if (p6 === 34887)
  1016. return await a4(), E2(e8, o7);
  1017. if (p6 === 1)
  1018. m6 = e8.slice(o7, o7 + f6), A3 = new Uint8Array(m6);
  1019. else if (p6 === 8 || p6 === 32946)
  1020. A3 = new Uint8Array(e8, o7, f6), M3 = new s4(A3), x4 = M3.getBytes(), m6 = new ArrayBuffer(x4.length), A3 = new Uint8Array(m6), A3.set(x4);
  1021. else if (p6 === 6) {
  1022. A3 = new Uint8Array(e8, o7, f6);
  1023. const n9 = new a3();
  1024. n9.parse(A3);
  1025. const a10 = n9.getData(n9.width, n9.height, true);
  1026. m6 = new ArrayBuffer(a10.length), A3 = new Uint8Array(m6), A3.set(a10);
  1027. } else if (p6 === 7) {
  1028. const n9 = s10.get("JPEGTABLES").values, a10 = n9.length - 2;
  1029. A3 = new Uint8Array(a10 + f6 - 2);
  1030. for (let e9 = 0; e9 < a10; e9++)
  1031. A3[e9] = n9[e9];
  1032. const i10 = new Uint8Array(e8, o7 + 2, f6 - 2);
  1033. for (let e9 = 0; e9 < i10.length; e9++)
  1034. A3[a10 + e9] = i10[e9];
  1035. const r11 = new a3();
  1036. r11.parse(A3);
  1037. const l6 = r11.getData(r11.width, r11.height, true);
  1038. m6 = new ArrayBuffer(l6.length), A3 = new Uint8Array(m6), A3.set(l6);
  1039. } else
  1040. p6 === 5 && (A3 = i5(e8, o7, f6, a9), m6 = A3.buffer);
  1041. if (w3 === "u8" || w3 === "s8" || c5)
  1042. y4 = new d5(m6);
  1043. else {
  1044. switch (m6 = new ArrayBuffer(A3.length), S4 = new Uint8Array(m6), w3) {
  1045. case "u16":
  1046. case "s16":
  1047. for (T4 = 0; T4 < A3.length; T4 += 2)
  1048. S4[T4] = A3[T4 + 1], S4[T4 + 1] = A3[T4];
  1049. break;
  1050. case "u32":
  1051. case "s32":
  1052. case "f32":
  1053. for (T4 = 0; T4 < A3.length; T4 += 4)
  1054. S4[T4] = A3[T4 + 3], S4[T4 + 1] = A3[T4 + 2], S4[T4 + 2] = A3[T4 + 1], S4[T4 + 3] = A3[T4];
  1055. }
  1056. y4 = new d5(m6);
  1057. }
  1058. return y4;
  1059. }
  1060. async function m2(e8, t7, n9) {
  1061. const a9 = p3(n9, "TILEOFFSETS");
  1062. if (a9 === void 0)
  1063. return null;
  1064. const i10 = p3(n9, "TILEBYTECOUNTS"), { width: s10, height: r11, pixelType: l6, tileWidth: o7, tileHeight: f6 } = b([n9]), c5 = D(n9, t7), u7 = t7.planes, g5 = s10 * r11, w3 = I(n9, "BITSPERSAMPLE"), d5 = (I(n9, "COMPRESSION") ?? 1) === 34887, T4 = h(l6), E3 = [];
  1065. for (let h4 = 0; h4 < u7; h4++)
  1066. E3.push(new T4(g5));
  1067. let m6, A3, S4, M3, x4, O3, U4, L3, P3, N2, k4, G2, R3;
  1068. const C4 = Math.ceil(s10 / o7);
  1069. if (w3 % 8 == 0) {
  1070. if (d5 && c5 && u7 > 1) {
  1071. const l7 = Math.round(a9.length / u7);
  1072. for (m6 = 0; m6 < l7; m6++) {
  1073. O3 = Math.floor(m6 / C4) * f6, U4 = m6 % C4 * o7, L3 = O3 * s10 + U4;
  1074. for (let l8 = 0; l8 < u7; l8++) {
  1075. const c6 = m6 * u7 + l8;
  1076. if (i10[c6] !== 0)
  1077. for (S4 = await y2(e8, t7.littleEndian, n9, a9[c6], i10[c6]), N2 = 0, P3 = L3, G2 = Math.min(o7, s10 - U4), k4 = Math.min(f6, r11 - O3), R3 = E3[l8], M3 = 0; M3 < k4; M3++)
  1078. for (P3 = L3 + M3 * s10, N2 = M3 * o7, x4 = 0; x4 < G2; x4++, P3++, N2++)
  1079. R3[P3] = S4[N2];
  1080. }
  1081. }
  1082. } else
  1083. for (m6 = 0; m6 < a9.length; m6++)
  1084. if (i10[m6] !== 0)
  1085. for (O3 = Math.floor(m6 / C4) * f6, U4 = m6 % C4 * o7, L3 = O3 * s10 + U4, S4 = await y2(e8, t7.littleEndian, n9, a9[m6], i10[m6]), N2 = 0, P3 = L3, G2 = Math.min(o7, s10 - U4), k4 = Math.min(f6, r11 - O3), A3 = 0; A3 < u7; A3++)
  1086. if (R3 = E3[A3], c5 || d5)
  1087. for (M3 = 0; M3 < k4; M3++)
  1088. for (P3 = L3 + M3 * s10, N2 = o7 * f6 * A3 + M3 * o7, x4 = 0; x4 < G2; x4++, P3++, N2++)
  1089. R3[P3] = S4[N2];
  1090. else
  1091. for (M3 = 0; M3 < k4; M3++)
  1092. for (P3 = L3 + M3 * s10, N2 = M3 * o7 * u7 + A3, x4 = 0; x4 < G2; x4++, P3++, N2 += u7)
  1093. R3[P3] = S4[N2];
  1094. }
  1095. return { width: s10, height: r11, pixelType: l6, pixels: E3 };
  1096. }
  1097. var A = (e8, n9, a9) => {
  1098. const s10 = r9 === n9.littleEndian, o7 = p3(a9, "STRIPOFFSETS");
  1099. if (o7 === void 0)
  1100. return null;
  1101. const { width: f6, height: c5, pixelType: u7 } = b([a9]), g5 = n9.planes, w3 = f6 * c5, d5 = I(a9, "BITSPERSAMPLE"), T4 = h(u7), E3 = new T4(w3 * g5), y4 = p3(a9, "STRIPBYTECOUNTS"), m6 = I(a9, "ROWSPERSTRIP"), A3 = I(a9, "COMPRESSION") ?? 1;
  1102. let S4, M3, x4, D4, O3, U4, L3, P3, N2, k4, G2, R3 = m6;
  1103. if (d5 % 8 == 0)
  1104. for (S4 = 0; S4 < o7.length; S4++) {
  1105. if (O3 = S4 * (m6 * f6) * g5, R3 = (S4 + 1) * m6 > c5 ? c5 - S4 * m6 : m6, u7 === "u8" || u7 === "s8" || s10) {
  1106. if (A3 === 8 || A3 === 32946)
  1107. L3 = new Uint8Array(e8, o7[S4], y4[S4]), k4 = new s4(L3), G2 = k4.getBytes(), U4 = new ArrayBuffer(G2.length), L3 = new Uint8Array(U4), L3.set(G2), L3.length !== R3 * f6 * g5 * d5 / 8 && console.log("strip byte counts is different than expected");
  1108. else if (A3 === 6) {
  1109. L3 = new Uint8Array(e8, o7[S4], y4[S4]);
  1110. const n10 = new a3();
  1111. n10.parse(L3);
  1112. const a10 = n10.getData(n10.width, n10.height, true);
  1113. U4 = new ArrayBuffer(a10.length), L3 = new Uint8Array(U4), L3.set(a10);
  1114. } else
  1115. A3 === 5 ? (L3 = i5(e8, o7[S4], y4[S4], n9.littleEndian), U4 = L3.buffer) : A3 === 1 && (y4[S4] !== R3 * f6 * g5 * d5 / 8 && console.log("strip byte counts is different than expected"), U4 = e8.slice(o7[S4], o7[S4] + y4[S4]));
  1116. D4 = new T4(U4);
  1117. } else {
  1118. switch (A3 === 6 || A3 === 8 || A3 === 32946 ? (L3 = new Uint8Array(e8, o7[S4], y4[S4]), k4 = new s4(L3), L3 = k4.getBytes(), U4 = new ArrayBuffer(L3.length), P3 = new Uint8Array(U4), L3.length !== R3 * f6 * g5 * d5 / 8 && console.log("strip byte counts is different than expected")) : A3 === 1 && (y4[S4] !== R3 * f6 * g5 * d5 / 8 && console.log("strip byte counts is different than expected"), U4 = new ArrayBuffer(y4[S4]), L3 = new Uint8Array(e8, o7[S4], y4[S4]), P3 = new Uint8Array(U4)), u7) {
  1119. case "u16":
  1120. case "s16":
  1121. for (x4 = 0; x4 < L3.length; x4 += 2)
  1122. P3[x4] = L3[x4 + 1], P3[x4 + 1] = L3[x4];
  1123. break;
  1124. case "u32":
  1125. case "s32":
  1126. case "f32":
  1127. for (x4 = 0; x4 < L3.length; x4 += 4)
  1128. P3[x4] = L3[x4 + 3], P3[x4 + 1] = L3[x4 + 2], P3[x4 + 2] = L3[x4 + 1], P3[x4 + 3] = L3[x4];
  1129. }
  1130. D4 = new T4(U4);
  1131. }
  1132. E3.set(D4, O3);
  1133. }
  1134. const C4 = [];
  1135. if (g5 === 1)
  1136. C4.push(E3);
  1137. else
  1138. for (S4 = 0; S4 < g5; S4++) {
  1139. for (N2 = new T4(w3), M3 = 0; M3 < w3; M3++)
  1140. N2[M3] = E3[M3 * g5 + S4];
  1141. C4.push(N2);
  1142. }
  1143. return { width: f6, height: c5, pixelType: u7, pixels: C4 };
  1144. };
  1145. var S2 = (e8, t7, n9) => {
  1146. if (!(e8 && e8.length > 0 && t7 && n9))
  1147. return null;
  1148. let a9, i10, s10;
  1149. const r11 = e8[0].length, l6 = e8.length, o7 = new Uint8Array(r11);
  1150. for (let f6 = 0; f6 < l6; f6++)
  1151. if (a9 = e8[f6], i10 = t7[f6], s10 = n9[f6], f6 === 0)
  1152. for (let e9 = 0; e9 < r11; e9++)
  1153. o7[e9] = a9[e9] < i10 || a9[e9] > s10 ? 0 : 1;
  1154. else
  1155. for (let e9 = 0; e9 < r11; e9++)
  1156. o7[e9] && (o7[e9] = a9[e9] < i10 || a9[e9] > s10 ? 0 : 1);
  1157. return o7;
  1158. };
  1159. var M2 = (e8) => {
  1160. if (!e8)
  1161. return null;
  1162. const t7 = e8.match(/<Item(.*?)Item>/gi);
  1163. if (!t7 || t7.length === 0)
  1164. return null;
  1165. const n9 = new Map();
  1166. let a9, i10, s10, r11, l6;
  1167. for (let I3 = 0; I3 < t7.length; I3++)
  1168. a9 = t7[I3], i10 = a9.slice("<Item ".length, a9.indexOf(">")), r11 = a9.indexOf("sample="), r11 > -1 && (l6 = a9.slice(r11 + 'sample="'.length, a9.indexOf('"', r11 + 'sample="'.length))), r11 = a9.indexOf("name="), r11 > -1 && (i10 = a9.slice(r11 + 'name="'.length, a9.indexOf('"', r11 + 'name="'.length))), i10 && (s10 = a9.slice(a9.indexOf(">") + 1, a9.indexOf("</Item>")).trim(), l6 != null ? n9.has(i10) ? n9.get(i10)[l6] = s10 : n9.set(i10, [s10]) : n9.set(i10, s10)), l6 = null;
  1169. const o7 = n9.get("STATISTICS_MINIMUM"), f6 = n9.get("STATISTICS_MAXIMUM"), c5 = n9.get("STATISTICS_MEAN"), u7 = n9.get("STATISTICS_STDDEV");
  1170. let h4 = null;
  1171. if (o7 && f6) {
  1172. h4 = [];
  1173. for (let e9 = 0; e9 < o7.length; e9++)
  1174. h4.push({ min: parseFloat(o7[e9]), max: parseFloat(f6[e9]), avg: c5 && parseFloat(c5[e9]), stddev: u7 && parseFloat(u7[e9]) });
  1175. }
  1176. const g5 = n9.get("BandName"), w3 = n9.get("WavelengthMin"), p6 = n9.get("WavelengthMax");
  1177. let d5 = null;
  1178. if (g5) {
  1179. d5 = [];
  1180. for (let e9 = 0; e9 < g5.length; e9++)
  1181. d5.push({ BandName: g5[e9], WavelengthMin: w3 && parseFloat(w3[e9]), WavelengthMax: p6 && parseFloat(p6[e9]) });
  1182. }
  1183. return { statistics: h4, bandProperties: d5, dataType: n9.get("DataType"), rawMetadata: n9 };
  1184. };
  1185. function x(e8, t7, n9, a9 = 0, i10 = false, s10 = 4) {
  1186. if (n9.values)
  1187. return true;
  1188. const r11 = n9.type, l6 = n9.valueCount;
  1189. let c5 = n9.valueOffset, u7 = [];
  1190. const h4 = o5[r11], g5 = 8 * h4, w3 = l6 * h4, p6 = l6 * o5[r11] * 8;
  1191. let d5, I3;
  1192. const T4 = s10 === 8 ? 64 : 32, E3 = n9.valueOffsets;
  1193. if (p6 > T4) {
  1194. if (w3 > (i10 ? e8.byteLength : e8 ? e8.byteLength - c5 + a9 : 0))
  1195. return n9.offlineOffsetSize = [c5, w3], n9.values = null, false;
  1196. }
  1197. if (p6 <= T4) {
  1198. if (!t7)
  1199. if (T4 <= 32)
  1200. c5 >>>= 32 - p6;
  1201. else {
  1202. const e9 = E3?.length ? E3[0] : c5 >>> 0, t8 = E3?.length ? E3[1] : Math.round((c5 - e9) / f2);
  1203. p6 <= 32 ? (c5 = e9 >>> 32 - p6, E3[0] = c5) : (c5 = e9 * 2 ** (32 - p6) + (t8 >>> 32 - p6), E3[0] = e9, E3[1] = t8 >>> 32 - p6);
  1204. }
  1205. if (l6 === 1 && g5 === T4)
  1206. u7 = [c5];
  1207. else if (T4 === 64) {
  1208. const e9 = E3?.length ? E3[0] : c5 >>> 0, t8 = E3?.length ? E3[1] : Math.round((c5 - e9) / f2);
  1209. let n10 = e9, a10 = 32;
  1210. for (I3 = 1; I3 <= l6; I3++) {
  1211. const e10 = 32 - g5 * I3 % 32;
  1212. if (a10 < g5) {
  1213. const i11 = n10 << e10 >>> 32 - a10, s11 = t8 << 32 - a10 >>> 32 - a10;
  1214. n10 = t8, u7.push(i11 + s11 * 2 ** (g5 - a10)), a10 -= 32 - (g5 - a10);
  1215. } else
  1216. u7.push(n10 << e10 >>> 32 - g5), a10 -= g5;
  1217. a10 === 0 && (a10 = 32, n10 = t8);
  1218. }
  1219. } else
  1220. for (I3 = 1; I3 <= l6; I3++) {
  1221. const e9 = 32 - g5 * I3;
  1222. u7.push(c5 << e9 >>> 32 - g5);
  1223. }
  1224. } else {
  1225. c5 -= a9, i10 && (c5 = 0);
  1226. for (let n10 = c5; n10 < c5 + w3; n10 += h4) {
  1227. switch (r11) {
  1228. case 1:
  1229. case 2:
  1230. case 7:
  1231. d5 = new DataView(e8, n10, 1).getUint8(0);
  1232. break;
  1233. case 3:
  1234. d5 = new DataView(e8, n10, 2).getUint16(0, t7);
  1235. break;
  1236. case 4:
  1237. case 13:
  1238. d5 = new DataView(e8, n10, 4).getUint32(0, t7);
  1239. break;
  1240. case 5:
  1241. d5 = new DataView(e8, n10, 4).getUint32(0, t7) / new DataView(e8, n10 + 4, 4).getUint32(0, t7);
  1242. break;
  1243. case 6:
  1244. d5 = new DataView(e8, n10, 1).getInt8(0);
  1245. break;
  1246. case 8:
  1247. d5 = new DataView(e8, n10, 2).getInt16(0, t7);
  1248. break;
  1249. case 9:
  1250. d5 = new DataView(e8, n10, 4).getInt32(0, t7);
  1251. break;
  1252. case 10:
  1253. d5 = new DataView(e8, n10, 4).getInt32(0, t7) / new DataView(e8, n10 + 4, 4).getInt32(0, t7);
  1254. break;
  1255. case 11:
  1256. d5 = new DataView(e8, n10, 4).getFloat32(0, t7);
  1257. break;
  1258. case 12:
  1259. d5 = new DataView(e8, n10, 8).getFloat64(0, t7);
  1260. break;
  1261. case 16:
  1262. case 18:
  1263. d5 = U(new DataView(e8, n10, 8), 0, t7);
  1264. break;
  1265. case 17:
  1266. d5 = L(new DataView(e8, n10, 8), 0, t7);
  1267. break;
  1268. default:
  1269. d5 = null;
  1270. }
  1271. u7.push(d5);
  1272. }
  1273. }
  1274. if (r11 === 2) {
  1275. let e9 = "";
  1276. const t8 = u7;
  1277. for (u7 = [], I3 = 0; I3 < t8.length; I3++)
  1278. t8[I3] === 0 && e9 !== "" ? (u7.push(e9), e9 = "") : e9 += String.fromCharCode(t8[I3]);
  1279. e9 === "" && u7.length !== 0 || u7.push(e9);
  1280. }
  1281. return n9.values = u7, true;
  1282. }
  1283. function b(e8) {
  1284. const t7 = e8[0], n9 = I(t7, "TILEWIDTH"), a9 = I(t7, "TILELENGTH"), i10 = I(t7, "IMAGEWIDTH"), s10 = I(t7, "IMAGELENGTH"), r11 = I(t7, "BITSPERSAMPLE"), l6 = I(t7, "SAMPLESPERPIXEL"), o7 = I(t7, "SAMPLEFORMAT") ?? 1, f6 = u3(o7, r11), h4 = D(t7), T4 = w(t7, "GDAL_NODATA");
  1285. let E3;
  1286. T4?.length && (E3 = T4.map((e9) => parseFloat(e9)), E3.some((e9) => isNaN(e9)) && (E3 = null));
  1287. const y4 = I(t7, "COMPRESSION") ?? 1;
  1288. let m6;
  1289. switch (y4) {
  1290. case 1:
  1291. m6 = "NONE";
  1292. break;
  1293. case 2:
  1294. case 3:
  1295. case 4:
  1296. case 32771:
  1297. m6 = "CCITT";
  1298. break;
  1299. case 5:
  1300. m6 = "LZW";
  1301. break;
  1302. case 6:
  1303. case 7:
  1304. m6 = "JPEG";
  1305. break;
  1306. case 32773:
  1307. m6 = "PACKBITS";
  1308. break;
  1309. case 8:
  1310. case 32946:
  1311. m6 = "DEFLATE";
  1312. break;
  1313. case 34712:
  1314. m6 = "JPEG2000";
  1315. break;
  1316. case 34887:
  1317. m6 = "LERC";
  1318. break;
  1319. default:
  1320. m6 = String(y4);
  1321. }
  1322. let A3 = true, S4 = "";
  1323. c2.has(y4) || (A3 = false, S4 += "unsupported tag compression " + y4), o7 > 3 && (A3 = false, S4 += "unsupported tag sampleFormat " + o7), r11 % 8 != 0 && (A3 = false, S4 += "unsupported tag bitsPerSample " + r11);
  1324. const x4 = d2(t7, "GEOASCIIPARAMS");
  1325. let b3;
  1326. if (x4) {
  1327. const e9 = x4.split("|").find((e10) => e10.includes("ESRI PE String = ")), t8 = e9 ? e9.replace("ESRI PE String = ", "") : "";
  1328. b3 = t8.startsWith("COMPD_CS") || t8.startsWith("PROJCS") || t8.startsWith("GEOGCS") ? { wkid: null, wkt: t8 } : null;
  1329. }
  1330. const O3 = p3(t7, "GEOTIEPOINTS"), U4 = p3(t7, "GEOPIXELSCALE"), L3 = p3(t7, "GEOTRANSMATRIX"), P3 = t7.has("GEOKEYDIRECTORY") ? t7.get("GEOKEYDIRECTORY").data : null;
  1331. let N2, k4, R3 = false;
  1332. if (P3) {
  1333. R3 = I(P3, "GTRasterTypeGeoKey") === 2;
  1334. const e9 = I(P3, "GTModelTypeGeoKey");
  1335. if (e9 === 2) {
  1336. const e10 = I(P3, "GeographicTypeGeoKey");
  1337. e10 >= 1024 && e10 <= 32766 && (b3 = { wkid: e10 });
  1338. } else if (e9 === 1) {
  1339. const e10 = I(P3, "ProjectedCSTypeGeoKey");
  1340. e10 >= 1024 && e10 <= 32766 && (b3 = { wkid: e10 });
  1341. }
  1342. }
  1343. if (U4 && O3 && O3.length >= 6 ? (N2 = [U4[0], 0, O3[3] - O3[0] * U4[0], 0, -Math.abs(U4[1]), O3[4] - O3[1] * U4[1]], R3 && (N2[2] -= 0.5 * N2[0] + 0.5 * N2[1], N2[5] -= 0.5 * N2[3] + 0.5 * N2[4])) : L3 && L3.length === 16 && (N2 = R3 ? [L3[0], L3[1], L3[3] - 0.5 * L3[0], L3[4], L3[5], L3[7] - 0.5 * L3[5]] : [L3[0], L3[1], L3[3], L3[4], L3[5], L3[7]]), N2) {
  1344. const e9 = [{ x: 0, y: s10 }, { x: 0, y: 0 }, { x: i10, y: s10 }, { x: i10, y: 0 }];
  1345. let t8, n10 = Number.POSITIVE_INFINITY, a10 = Number.POSITIVE_INFINITY, r12 = Number.NEGATIVE_INFINITY, l7 = Number.NEGATIVE_INFINITY;
  1346. for (let i11 = 0; i11 < e9.length; i11++)
  1347. t8 = g(e9[i11], N2), n10 = t8.x > n10 ? n10 : t8.x, r12 = t8.x < r12 ? r12 : t8.x, a10 = t8.y > a10 ? a10 : t8.y, l7 = t8.y < l7 ? l7 : t8.y;
  1348. k4 = { xmin: n10, xmax: r12, ymin: a10, ymax: l7, spatialReference: b3 };
  1349. } else
  1350. k4 = { xmin: -0.5, ymin: 0.5 - s10, xmax: i10 - 0.5, ymax: 0.5, spatialReference: b3 };
  1351. const C4 = e8.filter((e9) => d2(e9, "NEWSUBFILETYPE") === 1);
  1352. let v4, F, B2, V2, W;
  1353. if (C4.length > 0) {
  1354. v4 = Math.round(Math.log(i10 / I(C4[0], "IMAGEWIDTH")) / Math.LN2);
  1355. const e9 = C4[C4.length - 1];
  1356. F = Math.round(Math.log(i10 / I(e9, "IMAGEWIDTH")) / Math.LN2), B2 = I(e9, "TILEWIDTH"), V2 = I(e9, "TILELENGTH");
  1357. }
  1358. B2 = F > 0 ? B2 || n9 : null, V2 = F > 0 ? V2 || a9 : null, n9 && (W = [{ maxCol: Math.ceil(i10 / n9) - 1, maxRow: Math.ceil(s10 / a9) - 1, minRow: 0, minCol: 0 }], C4.forEach((e9) => {
  1359. W.push({ maxCol: Math.ceil(I(e9, "IMAGEWIDTH") / I(e9, "TILEWIDTH")) - 1, maxRow: Math.ceil(I(e9, "IMAGELENGTH") / I(e9, "TILELENGTH")) - 1, minRow: 0, minCol: 0 });
  1360. }));
  1361. const H = d2(e8[0], "GDAL_METADATA"), Y = M2(H);
  1362. return S4 += " " + G({ width: i10, height: s10, tileWidth: n9, tileHeight: a9, planes: l6, ifds: e8 }), { width: i10, height: s10, tileWidth: n9, tileHeight: a9, planes: l6, isBSQ: h4, pixelType: f6, compression: m6, noData: E3, isSupported: A3, message: S4, extent: k4, affine: U4 ? null : N2, firstPyramidLevel: v4, maximumPyramidLevel: F, pyramidBlockWidth: B2, pyramidBlockHeight: V2, tileBoundary: W, metadata: Y };
  1363. }
  1364. function D(e8, t7) {
  1365. const n9 = w(e8, "PLANARCONFIGURATION");
  1366. return n9 ? n9[0] === 2 : !!t7 && t7.isBSQ;
  1367. }
  1368. function O(e8) {
  1369. const { littleEndian: t7, isBigTiff: n9, firstIFD: a9 } = N(e8);
  1370. let i10 = a9;
  1371. const r11 = [];
  1372. do {
  1373. const a10 = k2(e8, t7, i10, 0, n6.TIFF_TAGS, n9 ? 8 : 4);
  1374. if (!a10.success)
  1375. break;
  1376. r11.push(a10.ifd), i10 = a10.nextIFD;
  1377. } while (i10 > 0);
  1378. return { ...b(r11), littleEndian: t7, isBigTiff: n9, ifds: r11 };
  1379. }
  1380. function U(e8, t7, n9) {
  1381. const a9 = e8.getUint32(t7, n9), i10 = e8.getUint32(t7 + 4, n9);
  1382. return n9 ? i10 * f2 + a9 : a9 * f2 + i10;
  1383. }
  1384. function L(e8, t7, n9) {
  1385. let a9 = n9 ? e8.getInt32(t7, n9) : e8.getUint32(t7, n9), i10 = n9 ? e8.getUint32(t7 + 4, n9) : e8.getInt32(t7 + 4, n9);
  1386. const s10 = (n9 ? a9 : i10) >= 0 ? 1 : -1;
  1387. n9 ? a9 *= s10 : i10 *= s10;
  1388. return s10 * (n9 ? i10 * f2 + a9 : a9 * f2 + i10);
  1389. }
  1390. function P(e8, t7, n9, a9) {
  1391. return a9 ? U(e8, t7, n9) : e8.getUint32(t7, n9);
  1392. }
  1393. function N(e8) {
  1394. const t7 = new DataView(e8, 0, 16), n9 = t7.getUint16(0, false);
  1395. let a9 = null;
  1396. if (n9 === 18761)
  1397. a9 = true;
  1398. else {
  1399. if (n9 !== 19789)
  1400. throw "unexpected endianess byte";
  1401. a9 = false;
  1402. }
  1403. const i10 = t7.getUint16(2, a9);
  1404. if (i10 !== 42 && i10 !== 43)
  1405. throw "unexpected tiff identifier";
  1406. let s10 = 4;
  1407. const r11 = i10 === 43;
  1408. if (r11) {
  1409. const e9 = t7.getUint16(s10, a9);
  1410. if (s10 += 2, e9 !== 8)
  1411. throw "unsupported bigtiff version";
  1412. if (t7.getUint16(s10, a9) !== 0)
  1413. throw "unsupported bigtiff version";
  1414. s10 += 2;
  1415. }
  1416. return { littleEndian: a9, isBigTiff: r11, firstIFD: P(t7, s10, a9, r11) };
  1417. }
  1418. function k2(t7, n9, a9, i10 = 0, r11 = n6.TIFF_TAGS, l6 = 4) {
  1419. const o7 = T(t7, n9, a9, i10, r11, l6);
  1420. let f6;
  1421. const c5 = o7.ifd;
  1422. if (c5) {
  1423. if (n6.ifdTags.forEach((e8, a10) => {
  1424. c5.has(a10) && (f6 = c5.get(a10), f6.data = T(t7, n9, f6.valueOffset - i10, i10, e8).ifd);
  1425. }), c5.has("GEOKEYDIRECTORY")) {
  1426. f6 = c5.get("GEOKEYDIRECTORY");
  1427. const e8 = f6.values;
  1428. if (e8 && e8.length > 4) {
  1429. const a10 = e8[0] + "." + e8[1] + "." + e8[2];
  1430. f6.data = T(t7, n9, f6.valueOffset + 6 - i10, i10, n6.GEO_KEYS, 2).ifd, f6.data && f6.data.set("GEOTIFFVersion", { id: 0, type: 2, valueCount: 1, valueOffset: null, values: [a10] });
  1431. }
  1432. }
  1433. if (c5.has("XMP")) {
  1434. f6 = c5.get("XMP");
  1435. const t8 = f6.values;
  1436. typeof t8[0] == "number" && f6.type === 7 && (f6.values = [r8(new Uint8Array(t8))]);
  1437. }
  1438. }
  1439. return o7;
  1440. }
  1441. function G(e8) {
  1442. const { width: t7, height: n9, tileHeight: a9, tileWidth: i10 } = e8, s10 = e8.planes, r11 = i10 ? i10 * a9 : t7 * n9, l6 = I(e8.ifds[0], "BITSPERSAMPLE");
  1443. let o7 = "";
  1444. return r11 * s10 > 2 ** 30 / (l6 > 8 ? l6 / 8 : 1) && (o7 = i10 ? "tiled tiff exceeding 1 gigabits per tile is not supported" : "scanline tiff exceeding 1 gigabits is not supported"), o7;
  1445. }
  1446. async function R(e8, t7) {
  1447. const { headerInfo: n9, ifd: a9, offsets: i10, sizes: s10 } = t7, r11 = [];
  1448. for (let h4 = 0; h4 < i10.length; h4++) {
  1449. const t8 = await y2(e8, n9.littleEndian, a9, i10[h4], s10[h4] || e8.byteLength);
  1450. r11.push(t8);
  1451. }
  1452. const l6 = D(a9, n9), { pixelType: o7, planes: f6 } = n9, c5 = h(o7), u7 = I(a9, "TILEWIDTH"), g5 = I(a9, "TILELENGTH"), w3 = I(a9, "COMPRESSION") ?? 1, p6 = u7 * g5;
  1453. let d5;
  1454. const T4 = [];
  1455. let E3 = r11[0];
  1456. const m6 = w3 === 34887;
  1457. for (let h4 = 0; h4 < f6; h4++) {
  1458. if (d5 = new c5(p6), l6 && m6) {
  1459. if (E3 = r11[h4], E3.length)
  1460. for (let e9 = 0; e9 < p6; e9++)
  1461. d5[e9] = E3[h4][e9 + h4];
  1462. } else if (E3.length)
  1463. if (l6 || m6 && !l6)
  1464. d5 = E3.slice(p6 * h4, p6 * (h4 + 1));
  1465. else
  1466. for (let e9 = 0; e9 < p6; e9++)
  1467. d5[e9] = E3[e9 * f6 + h4];
  1468. T4.push(d5);
  1469. }
  1470. const A3 = n9.noData ? n9.noData[0] : t7.noDataValue, M3 = n9.metadata ? n9.metadata.statistics : null, x4 = M3 ? M3.map((e9) => e9.min) : null, b3 = M3 ? M3.map((e9) => e9.max) : null;
  1471. let O3, U4;
  1472. if (A3 != null)
  1473. if (O3 = new Uint8Array(p6), Math.abs(A3) > 1e24)
  1474. for (U4 = 0; U4 < p6; U4++)
  1475. Math.abs((T4[0][U4] - A3) / A3) < 1e-6 ? O3[U4] = 0 : O3[U4] = 1;
  1476. else
  1477. for (U4 = 0; U4 < p6; U4++)
  1478. T4[0][U4] === A3 ? O3[U4] = 0 : O3[U4] = 1;
  1479. else
  1480. x4 && b3 && t7.applyMinMaxConstraint && (O3 = S2(T4, x4, b3));
  1481. return { pixelType: o7, width: u7, height: g5, pixels: T4, mask: O3, noDataValue: A3 };
  1482. }
  1483. async function C(e8, t7 = {}) {
  1484. const n9 = t7.pyramidLevel || 0, a9 = t7.headerInfo || O(e8), { ifds: i10, noData: s10 } = a9;
  1485. if (i10.length === 0)
  1486. throw "no valid image file directory";
  1487. const r11 = G(a9);
  1488. if (r11)
  1489. throw r11;
  1490. let l6, o7;
  1491. const f6 = n9 === -1 ? i10[i10.length - 1] : i10[n9], c5 = s10 ? s10[0] : t7.noDataValue;
  1492. if (o7 = a9.tileWidth ? await m2(e8, a9, f6) : await A(e8, a9, f6), c5 !== null) {
  1493. if (o7.mask = new Uint8Array(o7.width * o7.height), Math.abs(c5) > 1e24)
  1494. for (l6 = 0; l6 < o7.width * o7.height; l6++)
  1495. Math.abs((o7.pixels[0][l6] - c5) / c5) < 1e-6 ? o7.mask[l6] = 0 : o7.mask[l6] = 1;
  1496. else
  1497. for (l6 = 0; l6 < o7.width * o7.height; l6++)
  1498. o7.pixels[0][l6] === c5 ? o7.mask[l6] = 0 : o7.mask[l6] = 1;
  1499. o7.noDataValue = c5;
  1500. }
  1501. return o7;
  1502. }
  1503. // node_modules/@arcgis/core/layers/support/rasterFormats/RasterCodec.js
  1504. var d3 = function(t7) {
  1505. var e8, i10, a9, s10, r11, n9;
  1506. function h4(t8) {
  1507. var e9, i11, a10, s11, r12, n10, o7, h5, c5, p6, l6, d5, u7;
  1508. for (this.data = t8, this.pos = 8, this.palette = [], this.imgData = [], this.transparency = {}, this.animation = null, this.text = {}, r12 = null; ; ) {
  1509. switch (e9 = this.readUInt32(), h5 = function() {
  1510. var t9, e10;
  1511. for (e10 = [], t9 = 0; t9 < 4; ++t9)
  1512. e10.push(String.fromCharCode(this.data[this.pos++]));
  1513. return e10;
  1514. }.call(this).join(""), h5) {
  1515. case "IHDR":
  1516. this.width = this.readUInt32(), this.height = this.readUInt32(), this.bits = this.data[this.pos++], this.colorType = this.data[this.pos++], this.compressionMethod = this.data[this.pos++], this.filterMethod = this.data[this.pos++], this.interlaceMethod = this.data[this.pos++];
  1517. break;
  1518. case "acTL":
  1519. this.animation = { numFrames: this.readUInt32(), numPlays: this.readUInt32() || 1 / 0, frames: [] };
  1520. break;
  1521. case "PLTE":
  1522. this.palette = this.read(e9);
  1523. break;
  1524. case "fcTL":
  1525. r12 && this.animation.frames.push(r12), this.pos += 4, r12 = { width: this.readUInt32(), height: this.readUInt32(), xOffset: this.readUInt32(), yOffset: this.readUInt32() }, s11 = this.readUInt16(), a10 = this.readUInt16() || 100, r12.delay = 1e3 * s11 / a10, r12.disposeOp = this.data[this.pos++], r12.blendOp = this.data[this.pos++], r12.data = [];
  1526. break;
  1527. case "IDAT":
  1528. case "fdAT":
  1529. for (h5 === "fdAT" && (this.pos += 4, e9 -= 4), t8 = (r12 != null ? r12.data : void 0) || this.imgData, l6 = 0; 0 <= e9 ? l6 < e9 : l6 > e9; 0 <= e9 ? ++l6 : --l6)
  1530. t8.push(this.data[this.pos++]);
  1531. break;
  1532. case "tRNS":
  1533. switch (this.transparency = {}, this.colorType) {
  1534. case 3:
  1535. if (this.transparency.indexed = this.read(e9), (c5 = 255 - this.transparency.indexed.length) > 0)
  1536. for (d5 = 0; 0 <= c5 ? d5 < c5 : d5 > c5; 0 <= c5 ? ++d5 : --d5)
  1537. this.transparency.indexed.push(255);
  1538. break;
  1539. case 0:
  1540. this.transparency.grayscale = this.read(e9)[0];
  1541. break;
  1542. case 2:
  1543. this.transparency.rgb = this.read(e9);
  1544. }
  1545. break;
  1546. case "tEXt":
  1547. n10 = (p6 = this.read(e9)).indexOf(0), o7 = String.fromCharCode.apply(String, p6.slice(0, n10)), this.text[o7] = String.fromCharCode.apply(String, p6.slice(n10 + 1));
  1548. break;
  1549. case "IEND":
  1550. return r12 && this.animation.frames.push(r12), this.colors = function() {
  1551. switch (this.colorType) {
  1552. case 0:
  1553. case 3:
  1554. case 4:
  1555. return 1;
  1556. case 2:
  1557. case 6:
  1558. return 3;
  1559. }
  1560. }.call(this), this.hasAlphaChannel = (u7 = this.colorType) === 4 || u7 === 6, i11 = this.colors + (this.hasAlphaChannel ? 1 : 0), this.pixelBitlength = this.bits * i11, this.colorSpace = function() {
  1561. switch (this.colors) {
  1562. case 1:
  1563. return "DeviceGray";
  1564. case 3:
  1565. return "DeviceRGB";
  1566. }
  1567. }.call(this), void (this.imgData = new Uint8Array(this.imgData));
  1568. default:
  1569. this.pos += e9;
  1570. }
  1571. if (this.pos += 4, this.pos > this.data.length)
  1572. throw new Error("Incomplete or corrupt PNG file");
  1573. }
  1574. }
  1575. return h4.load = function(t8, e9, i11) {
  1576. var a10;
  1577. return typeof e9 == "function" && (i11 = e9), (a10 = new XMLHttpRequest()).open("GET", t8, true), a10.responseType = "arraybuffer", a10.onload = function() {
  1578. var t9;
  1579. return t9 = new h4(new Uint8Array(a10.response || a10.mozResponseArrayBuffer)), typeof (e9 != null ? e9.getContext : void 0) == "function" && t9.render(e9), typeof i11 == "function" ? i11(t9) : void 0;
  1580. }, a10.send(null);
  1581. }, i10 = 1, a9 = 2, e8 = 0, h4.prototype.read = function(t8) {
  1582. var e9, i11;
  1583. for (i11 = [], e9 = 0; 0 <= t8 ? e9 < t8 : e9 > t8; 0 <= t8 ? ++e9 : --e9)
  1584. i11.push(this.data[this.pos++]);
  1585. return i11;
  1586. }, h4.prototype.readUInt32 = function() {
  1587. return this.data[this.pos++] << 24 | this.data[this.pos++] << 16 | this.data[this.pos++] << 8 | this.data[this.pos++];
  1588. }, h4.prototype.readUInt16 = function() {
  1589. return this.data[this.pos++] << 8 | this.data[this.pos++];
  1590. }, h4.prototype.decodePixels = function(t8) {
  1591. var e9, i11, a10, s11, r12, n10, h5, c5, p6, l6, d5, u7, f6, m6, g5, w3, y4, x4, b3, k4, T4, U4, I3;
  1592. if (t8 == null && (t8 = this.imgData), t8.length === 0)
  1593. return new Uint8Array(0);
  1594. for (t8 = (t8 = new s4(t8)).getBytes(), w3 = (u7 = this.pixelBitlength / 8) * this.width, f6 = new Uint8Array(w3 * this.height), n10 = t8.length, g5 = 0, m6 = 0, i11 = 0; m6 < n10; ) {
  1595. switch (t8[m6++]) {
  1596. case 0:
  1597. for (s11 = b3 = 0; b3 < w3; s11 = b3 += 1)
  1598. f6[i11++] = t8[m6++];
  1599. break;
  1600. case 1:
  1601. for (s11 = k4 = 0; k4 < w3; s11 = k4 += 1)
  1602. e9 = t8[m6++], r12 = s11 < u7 ? 0 : f6[i11 - u7], f6[i11++] = (e9 + r12) % 256;
  1603. break;
  1604. case 2:
  1605. for (s11 = T4 = 0; T4 < w3; s11 = T4 += 1)
  1606. e9 = t8[m6++], a10 = (s11 - s11 % u7) / u7, y4 = g5 && f6[(g5 - 1) * w3 + a10 * u7 + s11 % u7], f6[i11++] = (y4 + e9) % 256;
  1607. break;
  1608. case 3:
  1609. for (s11 = U4 = 0; U4 < w3; s11 = U4 += 1)
  1610. e9 = t8[m6++], a10 = (s11 - s11 % u7) / u7, r12 = s11 < u7 ? 0 : f6[i11 - u7], y4 = g5 && f6[(g5 - 1) * w3 + a10 * u7 + s11 % u7], f6[i11++] = (e9 + Math.floor((r12 + y4) / 2)) % 256;
  1611. break;
  1612. case 4:
  1613. for (s11 = I3 = 0; I3 < w3; s11 = I3 += 1)
  1614. e9 = t8[m6++], a10 = (s11 - s11 % u7) / u7, r12 = s11 < u7 ? 0 : f6[i11 - u7], g5 === 0 ? y4 = x4 = 0 : (y4 = f6[(g5 - 1) * w3 + a10 * u7 + s11 % u7], x4 = a10 && f6[(g5 - 1) * w3 + (a10 - 1) * u7 + s11 % u7]), h5 = r12 + y4 - x4, c5 = Math.abs(h5 - r12), l6 = Math.abs(h5 - y4), d5 = Math.abs(h5 - x4), p6 = c5 <= l6 && c5 <= d5 ? r12 : l6 <= d5 ? y4 : x4, f6[i11++] = (e9 + p6) % 256;
  1615. break;
  1616. default:
  1617. throw new Error("Invalid filter algorithm: " + t8[m6 - 1]);
  1618. }
  1619. g5++;
  1620. }
  1621. return f6;
  1622. }, h4.prototype.decodePalette = function() {
  1623. var t8, e9, i11, a10, s11, r12, n10, o7, h5;
  1624. for (i11 = this.palette, r12 = this.transparency.indexed || [], s11 = new Uint8Array((r12.length || 0) + i11.length), a10 = 0, i11.length, t8 = 0, e9 = n10 = 0, o7 = i11.length; n10 < o7; e9 = n10 += 3)
  1625. s11[a10++] = i11[e9], s11[a10++] = i11[e9 + 1], s11[a10++] = i11[e9 + 2], s11[a10++] = (h5 = r12[t8++]) != null ? h5 : 255;
  1626. return s11;
  1627. }, h4.prototype.copyToImageData = function(t8, e9) {
  1628. var i11, a10, s11, r12, n10, o7, h5, c5, p6, l6, d5;
  1629. if (a10 = this.colors, p6 = null, i11 = this.hasAlphaChannel, this.palette.length && (p6 = (d5 = this._decodedPalette) != null ? d5 : this._decodedPalette = this.decodePalette(), a10 = 4, i11 = true), c5 = (s11 = t8.data || t8).length, n10 = p6 || e9, r12 = o7 = 0, a10 === 1)
  1630. for (; r12 < c5; )
  1631. h5 = p6 ? 4 * e9[r12 / 4] : o7, l6 = n10[h5++], s11[r12++] = l6, s11[r12++] = l6, s11[r12++] = l6, s11[r12++] = i11 ? n10[h5++] : this.transparency.grayscale && this.transparency.grayscale === l6 ? 0 : 255, o7 = h5;
  1632. else
  1633. for (; r12 < c5; )
  1634. h5 = p6 ? 4 * e9[r12 / 4] : o7, s11[r12++] = n10[h5++], s11[r12++] = n10[h5++], s11[r12++] = n10[h5++], s11[r12++] = i11 ? n10[h5++] : this.transparency.rgb && this.transparency.rgb[1] === n10[h5 - 3] && this.transparency.rgb[3] === n10[h5 - 2] && this.transparency.rgb[5] === n10[h5 - 1] ? 0 : 255, o7 = h5;
  1635. }, h4.prototype.decode = function() {
  1636. var t8;
  1637. return t8 = new Uint8Array(this.width * this.height * 4), this.copyToImageData(t8, this.decodePixels()), t8;
  1638. }, r11 = t7.document && t7.document.createElement("canvas"), n9 = r11 && r11.getContext("2d"), s10 = function(t8) {
  1639. var e9;
  1640. return n9.width = t8.width, n9.height = t8.height, n9.clearRect(0, 0, t8.width, t8.height), n9.putImageData(t8, 0, 0), (e9 = new Image()).src = r11.toDataURL(), e9;
  1641. }, h4.prototype.decodeFrames = function(t8) {
  1642. var e9, i11, a10, r12, n10, o7, h5, c5;
  1643. if (this.animation) {
  1644. for (c5 = [], i11 = n10 = 0, o7 = (h5 = this.animation.frames).length; n10 < o7; i11 = ++n10)
  1645. e9 = h5[i11], a10 = t8.createImageData(e9.width, e9.height), r12 = this.decodePixels(new Uint8Array(e9.data)), this.copyToImageData(a10, r12), e9.imageData = a10, c5.push(e9.image = s10(a10));
  1646. return c5;
  1647. }
  1648. }, h4.prototype.renderFrame = function(t8, s11) {
  1649. var r12, n10, o7;
  1650. return r12 = (n10 = this.animation.frames)[s11], o7 = n10[s11 - 1], s11 === 0 && t8.clearRect(0, 0, this.width, this.height), (o7 != null ? o7.disposeOp : void 0) === i10 ? t8.clearRect(o7.xOffset, o7.yOffset, o7.width, o7.height) : (o7 != null ? o7.disposeOp : void 0) === a9 && t8.putImageData(o7.imageData, o7.xOffset, o7.yOffset), r12.blendOp === e8 && t8.clearRect(r12.xOffset, r12.yOffset, r12.width, r12.height), t8.drawImage(r12.image, r12.xOffset, r12.yOffset);
  1651. }, h4.prototype.animate = function(t8) {
  1652. var e9, i11, a10, s11, r12, n10, o7 = this;
  1653. return i11 = 0, n10 = this.animation, s11 = n10.numFrames, a10 = n10.frames, r12 = n10.numPlays, (e9 = function() {
  1654. var n11, h5;
  1655. if (n11 = i11++ % s11, h5 = a10[n11], o7.renderFrame(t8, n11), s11 > 1 && i11 / s11 < r12)
  1656. return o7.animation._timeout = setTimeout(e9, h5.delay);
  1657. })();
  1658. }, h4.prototype.stopAnimation = function() {
  1659. var t8;
  1660. return clearTimeout((t8 = this.animation) != null ? t8._timeout : void 0);
  1661. }, h4.prototype.render = function(t8) {
  1662. var e9, i11;
  1663. return t8._png && t8._png.stopAnimation(), t8._png = this, t8.width = this.width, t8.height = this.height, e9 = t8.getContext("2d"), this.animation ? (this.decodeFrames(e9), this.animate(e9)) : (i11 = e9.createImageData(this.width, this.height), this.copyToImageData(i11, this.decodePixels()), e9.putImageData(i11, 0, 0));
  1664. }, h4;
  1665. }(self);
  1666. var u4 = new Set(["jpg", "png", "bmp", "gif"]);
  1667. var f3 = new Set(["S8", "U8", "S16", "U16", "S32", "U32", "F32", "F64"]);
  1668. async function m3(i10, a9) {
  1669. if (!r9)
  1670. throw new s2("rasterCoded:decode", "lerc decoder is not supported on big endian platform");
  1671. await a4();
  1672. const { offset: n9, noDataValue: o7 } = a9;
  1673. let h4 = a9.pixelType?.toUpperCase();
  1674. h4 && !f3.has(h4) && (h4 = null);
  1675. const { width: c5, height: p6, pixelType: d5, statistics: u7, pixels: m6, mask: g5 } = c(i10, { inputOffset: n9, noDataValue: o7, pixelType: h4, returnPixelInterleavedDims: a9.returnPixelInterleavedDims });
  1676. return new u({ width: c5, height: p6, pixelType: d5.toLowerCase(), pixels: m6, mask: g5, statistics: u7 });
  1677. }
  1678. async function g2(t7, i10) {
  1679. const a9 = await C(t7, i10), s10 = new u({ width: a9.width, height: a9.height, pixels: a9.pixels, pixelType: a9.pixelType.toLowerCase(), mask: a9.mask, statistics: null });
  1680. return s10.updateStatistics(), s10;
  1681. }
  1682. async function w2(t7, i10) {
  1683. const a9 = await R(t7, i10.customOptions), s10 = new u({ width: a9.width, height: a9.height, pixels: a9.pixels, pixelType: a9.pixelType.toLowerCase(), mask: a9.mask, statistics: null });
  1684. return s10.updateStatistics(), s10;
  1685. }
  1686. function y3(t7, i10) {
  1687. const a9 = i10.pixelType || "u8", s10 = u.getPixelArrayConstructor(a9), r11 = a9 === "u8" ? t7 : new s10(t7.buffer), n9 = [], o7 = i10.planes || 1;
  1688. if (o7 === 1)
  1689. n9.push(r11);
  1690. else
  1691. for (let e8 = 0; e8 < o7; e8++) {
  1692. const a10 = (i10.width || 1) * (i10.height || t7.length), h5 = new s10(a10);
  1693. for (let t8 = 0; t8 < a10; t8++)
  1694. h5[t8] = r11[t8 * o7 + e8];
  1695. n9.push(h5);
  1696. }
  1697. const h4 = new u({ width: i10.width || 1, height: i10.height || t7.length, pixels: n9, pixelType: a9, statistics: null });
  1698. return h4.updateStatistics(), h4;
  1699. }
  1700. function x2(t7, e8) {
  1701. return y3(new s4(new Uint8Array(t7)).getBytes(), e8);
  1702. }
  1703. function b2(t7, e8) {
  1704. return y3(i5(t7, e8.offset, e8.eof, !e8.isInputBigEndian), e8);
  1705. }
  1706. function k3(t7, i10, a9) {
  1707. const { pixelTypeCtor: s10 } = A2(i10.pixelType), r11 = (0, a5.decode)(t7, { width: i10.width, height: i10.height, pixelType: s10, format: a9 }), n9 = new u({ width: i10.width, height: i10.height, pixels: r11.pixels, pixelType: i10.pixelType, mask: r11.mask, statistics: null });
  1708. return n9.updateStatistics(), n9;
  1709. }
  1710. function T2(t7, i10) {
  1711. const s10 = n3.decode(t7, i10.hasNoZlibMask), r11 = new u({ width: s10.width, height: s10.height, pixels: s10.pixels, pixelType: "U8", mask: s10.mask, statistics: null });
  1712. return r11.updateStatistics(), r11;
  1713. }
  1714. function U2(t7, i10) {
  1715. const a9 = new Uint8Array(t7), s10 = new d3(a9), { width: r11, height: n9 } = i10, o7 = r11 * n9, h4 = s10.decode();
  1716. let c5, p6 = 0, l6 = 0;
  1717. const u7 = new Uint8Array(o7);
  1718. for (p6 = 0; p6 < o7; p6++)
  1719. u7[p6] = h4[4 * p6 + 3];
  1720. const f6 = new u({ width: r11, height: n9, pixels: [], pixelType: "U8", mask: u7, statistics: [] });
  1721. for (p6 = 0; p6 < 3; p6++) {
  1722. for (c5 = new Uint8Array(o7), l6 = 0; l6 < o7; l6++)
  1723. c5[l6] = h4[4 * l6 + p6];
  1724. f6.addData({ pixels: c5 });
  1725. }
  1726. return f6.updateStatistics(), f6;
  1727. }
  1728. async function I2(t7, a9, s10, r11) {
  1729. const n9 = new i3(), o7 = { applyJpegMask: false, format: a9, ...s10 }, h4 = await n9.decode(t7, o7, r11), c5 = new u(h4);
  1730. return c5.updateStatistics(), c5;
  1731. }
  1732. function v2(e8) {
  1733. if (e8 == null)
  1734. throw new s2("rasterCodec:decode", "parameter encodeddata is required.");
  1735. const i10 = new Uint8Array(e8, 0, 10);
  1736. let a9 = "";
  1737. return i10[0] === 255 && i10[1] === 216 ? a9 = "jpg" : i10[0] === 137 && i10[1] === 80 && i10[2] === 78 && i10[3] === 71 ? a9 = "png" : i10[0] === 67 && i10[1] === 110 && i10[2] === 116 && i10[3] === 90 && i10[4] === 73 && i10[5] === 109 && i10[6] === 97 && i10[7] === 103 && i10[8] === 101 && i10[9] === 32 ? a9 = "lerc" : i10[0] === 76 && i10[1] === 101 && i10[2] === 114 && i10[3] === 99 && i10[4] === 50 && i10[5] === 32 ? a9 = "lerc2" : i10[0] === 73 && i10[1] === 73 && i10[2] === 42 && i10[3] === 0 || i10[0] === 77 && i10[1] === 77 && i10[2] === 0 && i10[3] === 42 || i10[0] === 73 && i10[1] === 73 && i10[2] === 43 && i10[3] === 0 || i10[0] === 77 && i10[1] === 77 && i10[2] === 0 && i10[3] === 43 ? a9 = "tiff" : i10[0] === 71 && i10[1] === 73 && i10[2] === 70 ? a9 = "gif" : i10[0] === 66 && i10[1] === 77 ? a9 = "bmp" : String.fromCharCode.apply(null, i10).toLowerCase().includes("error") && (a9 = "error"), a9;
  1738. }
  1739. function C2(e8) {
  1740. let i10 = null;
  1741. switch (e8) {
  1742. case "lerc":
  1743. case "lerc2":
  1744. i10 = m3;
  1745. break;
  1746. case "jpg":
  1747. i10 = T2;
  1748. break;
  1749. case "png":
  1750. i10 = U2;
  1751. break;
  1752. case "bsq":
  1753. case "bip":
  1754. i10 = (t7, i11) => k3(t7, i11, e8);
  1755. break;
  1756. case "tiff":
  1757. i10 = g2;
  1758. break;
  1759. case "deflate":
  1760. i10 = x2;
  1761. break;
  1762. case "lzw":
  1763. i10 = b2;
  1764. break;
  1765. case "error":
  1766. i10 = () => {
  1767. throw new s2("rasterCodec:decode", "input data contains error");
  1768. };
  1769. break;
  1770. default:
  1771. i10 = () => {
  1772. throw new s2("rasterCodec:decode", "unsupported raster format");
  1773. };
  1774. }
  1775. return i10;
  1776. }
  1777. function A2(t7) {
  1778. let e8 = null, i10 = null;
  1779. switch (t7 ? t7.toLowerCase() : "f32") {
  1780. case "u1":
  1781. case "u2":
  1782. case "u4":
  1783. case "u8":
  1784. i10 = 255, e8 = Uint8Array;
  1785. break;
  1786. case "u16":
  1787. i10 = i10 || 65535, e8 = Uint16Array;
  1788. break;
  1789. case "u32":
  1790. i10 = i10 || 2 ** 32 - 1, e8 = Uint32Array;
  1791. break;
  1792. case "s8":
  1793. i10 = i10 || -128, e8 = Int8Array;
  1794. break;
  1795. case "s16":
  1796. i10 = i10 || -32768, e8 = Int16Array;
  1797. break;
  1798. case "s32":
  1799. i10 = i10 || 0 - 2 ** 31, e8 = Int32Array;
  1800. break;
  1801. default:
  1802. e8 = Float32Array;
  1803. }
  1804. return { pixelTypeCtor: e8, noDataValue: i10 };
  1805. }
  1806. function D2(t7, i10 = 1) {
  1807. if (!t7)
  1808. return;
  1809. const { pixels: a9, width: s10, height: r11, mask: n9 } = t7;
  1810. if (!a9 || a9.length === 0)
  1811. return;
  1812. const o7 = a9.length, h4 = s10 - 1, c5 = r11 - 1, p6 = [];
  1813. let l6, d5, u7, f6, m6, g5, w3;
  1814. const y4 = u.getPixelArrayConstructor(t7.pixelType);
  1815. if (i10 === 0) {
  1816. for (l6 = 0; l6 < o7; l6++) {
  1817. for (m6 = a9[l6], g5 = new y4(h4 * c5), d5 = 0; d5 < c5; d5++)
  1818. for (f6 = d5 * s10, u7 = 0; u7 < h4; u7++)
  1819. g5[d5 * h4 + u7] = m6[f6 + u7];
  1820. p6.push(g5);
  1821. }
  1822. if (n9)
  1823. for (w3 = new Uint8Array(h4 * c5), d5 = 0; d5 < c5; d5++)
  1824. for (f6 = d5 * s10, u7 = 0; u7 < h4; u7++)
  1825. w3[d5 * h4 + u7] = n9[f6 + u7];
  1826. } else {
  1827. for (l6 = 0; l6 < o7; l6++) {
  1828. for (m6 = a9[l6], g5 = new y4(h4 * c5), d5 = 0; d5 < c5; d5++)
  1829. for (f6 = d5 * s10, u7 = 0; u7 < h4; u7++)
  1830. g5[d5 * h4 + u7] = (m6[f6 + u7] + m6[f6 + u7 + 1] + m6[f6 + s10 + u7] + m6[f6 + s10 + u7 + 1]) / 4;
  1831. p6.push(g5);
  1832. }
  1833. if (n9)
  1834. for (w3 = new Uint8Array(h4 * c5), d5 = 0; d5 < c5; d5++)
  1835. for (f6 = d5 * s10, u7 = 0; u7 < h4; u7++)
  1836. w3[d5 * h4 + u7] = Math.min.apply(null, [n9[f6 + u7], n9[f6 + u7 + 1], n9[f6 + s10 + u7], n9[f6 + s10 + u7 + 1]]);
  1837. }
  1838. t7.width = h4, t7.height = c5, t7.mask = w3, t7.pixels = p6;
  1839. }
  1840. function P2(t7) {
  1841. let e8 = v2(t7);
  1842. return e8 === "lerc2" ? e8 = "lerc" : e8 === "error" && (e8 = ""), e8;
  1843. }
  1844. async function S3(e8, i10 = {}, a9) {
  1845. if (e8 == null)
  1846. throw new s2("rasterCodec:decode", "missing encodeddata parameter.");
  1847. let s10, r11, n9 = i10.format && i10.format.toLowerCase();
  1848. if (!(n9 !== "bsq" && n9 !== "bip" || i10.width != null && i10.height != null))
  1849. throw new s2("rasterCodec:decode", "requires width and height in options parameter.");
  1850. return n9 === "tiff" && i10.customOptions ? w2(e8, i10) : ((!n9 || n9 !== "bsq" && n9 !== "bip" && n9 !== "deflate" && n9 !== "lzw") && (n9 = v2(e8)), i10.useCanvas && u4.has(n9) ? r11 = await I2(e8, n9, i10, a9) : (s10 = C2(n9), i10.isPoint && ((i10 = { ...i10 }).width++, i10.height++), r11 = await s10(e8, i10), i10.isPoint && D2(r11)), r11);
  1851. }
  1852. // node_modules/@arcgis/core/layers/support/rasterFunctions/stretchUtils.js
  1853. var i7 = { u1: [0, 1], u2: [0, 3], u4: [0, 15], u8: [0, 255], s8: [-128, 127], u16: [0, 65535], s16: [-32768, 32767], u32: [0, 4294967295], s32: [-2147483648, 2147483647], f32: [-34e38, 34e38], f64: [-Number.MAX_VALUE, Number.MAX_VALUE] };
  1854. var s6 = 1;
  1855. var o6 = [0.299, 0.587, 0.114];
  1856. function r10(t7, n9 = 256) {
  1857. n9 = Math.min(n9, 256);
  1858. const { size: e8, counts: i10 } = t7, s10 = new Uint8Array(e8), o7 = i10.reduce((t8, e9) => t8 + e9 / n9, 0);
  1859. let r11 = 0, a9 = 0, f6 = 0, l6 = o7;
  1860. for (let u7 = 0; u7 < e8; u7++)
  1861. if (f6 += i10[u7], !(u7 < e8 - 1 && f6 + i10[u7 + 1] < l6)) {
  1862. for (; r11 < n9 - 1 && l6 < f6; )
  1863. r11++, l6 += o7;
  1864. for (let t8 = a9; t8 <= u7; t8++)
  1865. s10[t8] = r11;
  1866. a9 = u7 + 1;
  1867. }
  1868. for (let u7 = a9; u7 < e8; u7++)
  1869. s10[u7] = n9 - 1;
  1870. return s10;
  1871. }
  1872. function a6(t7) {
  1873. const { minCutOff: n9, maxCutOff: e8, gamma: i10, pixelType: s10 } = t7, o7 = t7.outMin || 0, r11 = t7.outMax || 255;
  1874. if (!["u8", "u16", "s8", "s16"].includes(s10))
  1875. return null;
  1876. const a9 = n9.length;
  1877. let l6, u7, m6 = 0;
  1878. s10 === "s8" ? m6 = -127 : s10 === "s16" && (m6 = -32767);
  1879. let c5 = 256;
  1880. ["u16", "s16"].includes(s10) && (c5 = 65536);
  1881. const h4 = [], g5 = r11 - o7;
  1882. for (l6 = 0; l6 < a9; l6++)
  1883. h4[l6] = e8[l6] - n9[l6], e8[l6], n9[l6];
  1884. const x4 = i10 && i10.length >= a9, M3 = [];
  1885. if (x4)
  1886. for (l6 = 0; l6 < a9; l6++)
  1887. i10[l6] > 1 ? i10[l6] > 2 ? M3[l6] = 6.5 + (i10[l6] - 2) ** 2.5 : M3[l6] = 6.5 + 100 * (2 - i10[l6]) ** 4 : M3[l6] = 1;
  1888. let p6;
  1889. const d5 = [];
  1890. let b3, O3, y4;
  1891. if (x4)
  1892. for (l6 = 0; l6 < a9; l6++) {
  1893. for (y4 = [], u7 = 0; u7 < c5; u7++)
  1894. b3 = u7 + m6, p6 = (b3 - n9[l6]) / h4[l6], O3 = 1, i10[l6] > 1 && (O3 -= (1 / g5) ** (p6 * M3[l6])), b3 < e8[l6] && b3 > n9[l6] ? y4[u7] = Math.floor(O3 * g5 * p6 ** (1 / i10[l6])) + o7 : b3 >= e8[l6] ? y4[u7] = r11 : y4[u7] = o7;
  1895. d5[l6] = y4;
  1896. }
  1897. else
  1898. for (l6 = 0; l6 < a9; l6++) {
  1899. for (y4 = [], u7 = 0; u7 < c5; u7++)
  1900. b3 = u7 + m6, b3 <= n9[l6] ? y4[u7] = o7 : b3 >= e8[l6] ? y4[u7] = r11 : y4[u7] = Math.floor((b3 - n9[l6]) / h4[l6] * g5) + o7;
  1901. d5[l6] = y4;
  1902. }
  1903. if (t7.contrastOffset != null) {
  1904. const n10 = f4(t7.contrastOffset, t7.brightnessOffset);
  1905. for (l6 = 0; l6 < a9; l6++)
  1906. for (y4 = d5[l6], u7 = 0; u7 < c5; u7++)
  1907. y4[u7] = n10[y4[u7]];
  1908. }
  1909. return { lut: d5, offset: m6 };
  1910. }
  1911. function f4(t7, n9) {
  1912. const e8 = Math.min(Math.max(t7, -100), 100), i10 = Math.min(Math.max(n9, -100), 100), s10 = 255, o7 = 128;
  1913. let r11, a9;
  1914. const f6 = new Uint8Array(256);
  1915. for (r11 = 0; r11 < 256; r11++)
  1916. e8 > 0 && e8 < 100 ? a9 = (200 * r11 - 100 * s10 + 2 * s10 * i10) / (2 * (100 - e8)) + o7 : e8 <= 0 && e8 > -100 ? a9 = (200 * r11 - 100 * s10 + 2 * s10 * i10) * (100 + e8) / 2e4 + o7 : e8 === 100 ? (a9 = 200 * r11 - 100 * s10 + (s10 + 1) * (100 - e8) + 2 * s10 * i10, a9 = a9 > 0 ? s10 : 0) : e8 === -100 && (a9 = o7), f6[r11] = a9 > s10 ? s10 : a9 < 0 ? 0 : a9;
  1917. return f6;
  1918. }
  1919. function l4(t7, n9, e8) {
  1920. const i10 = [];
  1921. for (let s10 = 0; s10 < n9.length; s10++) {
  1922. let r11 = 0, a9 = 0, f6 = 0;
  1923. "min" in n9[s10] ? { min: r11, max: a9, avg: f6 } = n9[s10] : [r11, a9, f6] = n9[s10];
  1924. let l6 = f6;
  1925. t7 !== "u8" && (l6 = 255 * (l6 - r11) / (a9 - r11)), e8 && (l6 *= o6[s10]), i10.push(u5(l6));
  1926. }
  1927. return i10;
  1928. }
  1929. function u5(t7) {
  1930. if (t7 <= 0 || t7 >= 255)
  1931. return s6;
  1932. let n9 = 0;
  1933. t7 !== 150 && (n9 = t7 <= 150 ? 45 * Math.cos(0.01047 * t7) : 17 * Math.sin(0.021 * t7));
  1934. const e8 = 255, i10 = t7 + n9, o7 = Math.log(t7 / e8), r11 = Math.log(i10 / e8);
  1935. if (r11 === 0)
  1936. return s6;
  1937. const a9 = o7 / r11;
  1938. return isNaN(a9) ? s6 : Math.min(9.9, Math.max(0.01, a9));
  1939. }
  1940. function m4(n9) {
  1941. if (t(n9) || !n9.pixels?.length)
  1942. return null;
  1943. n9.statistics || n9.updateStatistics();
  1944. const { pixels: e8, mask: i10, pixelType: s10, statistics: o7 } = n9, r11 = n9.width * n9.height, a9 = e8.length;
  1945. let f6, l6, u7, m6, c5;
  1946. const h4 = [], g5 = [];
  1947. let x4, M3, p6, d5, b3, O3, y4, C4, z2, A3;
  1948. const k4 = 256;
  1949. for (m6 = 0; m6 < a9; m6++) {
  1950. if (x4 = new Uint32Array(k4), p6 = e8[m6], s10 === "u8")
  1951. if (f6 = -0.5, l6 = 255.5, i10)
  1952. for (c5 = 0; c5 < r11; c5++)
  1953. i10[c5] && x4[p6[c5]]++;
  1954. else
  1955. for (c5 = 0; c5 < r11; c5++)
  1956. x4[p6[c5]]++;
  1957. else {
  1958. if (f6 = o7[m6].minValue, l6 = o7[m6].maxValue, u7 = (l6 - f6) / k4, M3 = new Uint32Array(k4 + 1), i10)
  1959. for (c5 = 0; c5 < r11; c5++)
  1960. i10[c5] && M3[Math.floor((p6[c5] - f6) / u7)]++;
  1961. else
  1962. for (c5 = 0; c5 < r11; c5++)
  1963. M3[Math.floor((p6[c5] - f6) / u7)]++;
  1964. for (c5 = 0; c5 < 255; c5++)
  1965. x4[c5] = M3[c5];
  1966. x4[255] = M3[255] + M3[256];
  1967. }
  1968. for (h4.push({ min: f6, max: l6, size: k4, counts: x4 }), d5 = 0, b3 = 0, C4 = 0, c5 = 0; c5 < k4; c5++)
  1969. d5 += x4[c5], b3 += c5 * x4[c5];
  1970. for (z2 = b3 / d5, c5 = 0; c5 < k4; c5++)
  1971. C4 += x4[c5] * (c5 - z2) ** 2;
  1972. A3 = Math.sqrt(C4 / (d5 - 1)), u7 = (l6 - f6) / k4, O3 = (z2 + 0.5) * u7 + f6, y4 = A3 * u7, g5.push({ min: f6, max: l6, avg: O3, stddev: y4 });
  1973. }
  1974. return { statistics: g5, histograms: h4 };
  1975. }
  1976. function c3(t7) {
  1977. const n9 = [];
  1978. for (let e8 = 0; e8 < t7.length; e8++) {
  1979. const { min: i10, max: s10, size: o7, counts: r11 } = t7[e8];
  1980. let a9 = 0, f6 = 0;
  1981. for (let t8 = 0; t8 < o7; t8++)
  1982. a9 += r11[t8], f6 += t8 * r11[t8];
  1983. const l6 = f6 / a9;
  1984. let u7 = 0;
  1985. for (let t8 = 0; t8 < o7; t8++)
  1986. u7 += r11[t8] * (t8 - l6) ** 2;
  1987. const m6 = (s10 - i10) / o7, c5 = (l6 + 0.5) * m6 + i10, h4 = Math.sqrt(u7 / (a9 - 1)) * m6;
  1988. n9.push({ min: i10, max: s10, avg: c5, stddev: h4 });
  1989. }
  1990. return n9;
  1991. }
  1992. function h2(t7, s10) {
  1993. const { pixelBlock: o7, bandIds: a9, returnHistogramLut: f6, rasterInfo: l6 } = s10;
  1994. let u7, c5, h4 = t7.stretchType;
  1995. if (t7.dra)
  1996. if (h4 === "minMax" && r(o7) && o7.statistics)
  1997. u7 = o7.statistics.map((t8) => [t8.minValue, t8.maxValue, 0, 0]);
  1998. else {
  1999. const t8 = m4(o7);
  2000. u7 = r(t8) ? t8.statistics : null, c5 = r(t8) ? t8.histograms : null;
  2001. }
  2002. else
  2003. u7 = t7.statistics?.length > 0 ? t7.statistics : e2(l6.statistics), c5 = t7.histograms || e2(l6.histograms);
  2004. h4 !== "percentClip" && h4 !== "histogramEqualization" || c5?.length || (h4 = "minMax");
  2005. const x4 = u7?.length || c5?.length || l6.bandCount, M3 = [], p6 = [];
  2006. let d5, b3, O3, y4, C4, z2, A3, k4, v4, w3, U4, L3;
  2007. switch (u7 && !Array.isArray(u7[0]) && (u7 = u7.map((t8) => [t8.min, t8.max, t8.avg, t8.stddev])), h4) {
  2008. case "none":
  2009. {
  2010. const t8 = i7[l6.pixelType] || i7.f32;
  2011. for (k4 = 0; k4 < x4; k4++)
  2012. M3[k4] = t8[0], p6[k4] = t8[1];
  2013. }
  2014. break;
  2015. case "minMax":
  2016. for (k4 = 0; k4 < x4; k4++)
  2017. M3[k4] = u7[k4][0], p6[k4] = u7[k4][1];
  2018. break;
  2019. case "standardDeviation":
  2020. for (k4 = 0; k4 < x4; k4++)
  2021. M3[k4] = u7[k4][2] - t7.numberOfStandardDeviations * u7[k4][3], p6[k4] = u7[k4][2] + t7.numberOfStandardDeviations * u7[k4][3], M3[k4] < u7[k4][0] && (M3[k4] = u7[k4][0]), p6[k4] > u7[k4][1] && (p6[k4] = u7[k4][1]);
  2022. break;
  2023. case "histogramEqualization":
  2024. for (k4 = 0; k4 < x4; k4++)
  2025. M3[k4] = c5[k4].min, p6[k4] = c5[k4].max;
  2026. break;
  2027. case "percentClip":
  2028. for (k4 = 0; k4 < c5.length; k4++) {
  2029. for (d5 = c5[k4], C4 = new Uint32Array(d5.size), y4 = [...d5.counts], y4.length >= 20 && (y4[0] = y4[1] = y4[2] = y4[y4.length - 1] = y4[y4.length - 2] = 0), O3 = 0, b3 = (d5.max - d5.min) / d5.size, A3 = d5.min === -0.5 && b3 === 1 ? 0.5 : 0, v4 = 0; v4 < d5.size; v4++)
  2030. O3 += y4[v4], C4[v4] = O3;
  2031. for (z2 = (t7.minPercent || 0) * O3 / 100, v4 = 0; v4 < d5.size; v4++)
  2032. if (C4[v4] > z2) {
  2033. M3[k4] = d5.min + b3 * (v4 + A3);
  2034. break;
  2035. }
  2036. for (z2 = (1 - (t7.maxPercent || 0) / 100) * O3, v4 = d5.size - 2; v4 >= 0; v4--)
  2037. if (C4[v4] < z2) {
  2038. p6[k4] = d5.min + b3 * (v4 + 2 - A3);
  2039. break;
  2040. }
  2041. }
  2042. break;
  2043. default:
  2044. for (k4 = 0; k4 < x4; k4++)
  2045. M3[k4] = u7[k4][0], p6[k4] = u7[k4][1];
  2046. }
  2047. h4 === "histogramEqualization" ? (U4 = c5[0].size || 256, w3 = 0, f6 && (L3 = c5.map((t8) => r10(t8)))) : (U4 = t7.max || 255, w3 = t7.min || 0);
  2048. return g3({ minCutOff: M3, maxCutOff: p6, outMax: U4, outMin: w3, histogramLut: L3 }, a9);
  2049. }
  2050. function g3(t7, n9) {
  2051. if (n9 == null || n9.length === 0)
  2052. return t7;
  2053. const e8 = Math.max.apply(null, n9), { minCutOff: i10, maxCutOff: s10, outMin: o7, outMax: r11, histogramLut: a9 } = t7;
  2054. return i10.length === n9.length || i10.length <= e8 ? t7 : { minCutOff: n9.map((t8) => i10[t8]), maxCutOff: n9.map((t8) => s10[t8]), histogramLut: a9 ? n9.map((t8) => a9[t8]) : null, outMin: o7, outMax: r11 };
  2055. }
  2056. function x3(n9, e8) {
  2057. if (t(n9) || !n9.pixels?.length)
  2058. return n9;
  2059. const i10 = n9.clone(), { pixels: s10, mask: o7 } = i10, { minCutOff: r11, maxCutOff: a9, gamma: f6 } = e8, l6 = e8.outMin || 0, u7 = e8.outMax || 255, m6 = i10.width * i10.height, c5 = s10.length;
  2060. let h4, g5, x4, M3, p6;
  2061. const d5 = u7 - l6, b3 = [];
  2062. for (h4 = 0; h4 < c5; h4++)
  2063. b3[h4] = a9[h4] - r11[h4], a9[h4], r11[h4];
  2064. const O3 = f6 && f6.length >= c5, y4 = [];
  2065. if (O3)
  2066. for (h4 = 0; h4 < c5; h4++)
  2067. f6[h4] > 1 ? f6[h4] > 2 ? y4[h4] = 6.5 + (f6[h4] - 2) ** 2.5 : y4[h4] = 6.5 + 100 * (2 - f6[h4]) ** 4 : y4[h4] = 1;
  2068. if (O3)
  2069. if (o7 != null) {
  2070. for (g5 = 0; g5 < m6; g5++)
  2071. if (o7[g5])
  2072. for (h4 = 0; h4 < c5; h4++)
  2073. x4 = s10[h4][g5], p6 = (x4 - r11[h4]) / b3[h4], M3 = 1, f6[h4] > 1 && (M3 -= (1 / d5) ** (p6 * y4[h4])), x4 < a9[h4] && x4 > r11[h4] ? s10[h4][g5] = Math.floor(M3 * d5 * p6 ** (1 / f6[h4])) + l6 : x4 >= a9[h4] ? s10[h4][g5] = u7 : s10[h4][g5] = l6;
  2074. } else
  2075. for (g5 = 0; g5 < m6; g5++)
  2076. for (h4 = 0; h4 < c5; h4++)
  2077. x4 = s10[h4][g5], p6 = (x4 - r11[h4]) / b3[h4], M3 = 1, f6[h4] > 1 && (M3 -= (1 / d5) ** (p6 * y4[h4])), x4 < a9[h4] && x4 > r11[h4] ? s10[h4][g5] = Math.floor(M3 * d5 * p6 ** (1 / f6[h4])) + l6 : x4 >= a9[h4] ? s10[h4][g5] = u7 : s10[h4][g5] = l6;
  2078. else if (o7 != null) {
  2079. for (g5 = 0; g5 < m6; g5++)
  2080. if (o7[g5])
  2081. for (h4 = 0; h4 < c5; h4++)
  2082. x4 = s10[h4][g5], x4 < a9[h4] && x4 > r11[h4] ? s10[h4][g5] = Math.floor((x4 - r11[h4]) / b3[h4] * d5) + l6 : x4 >= a9[h4] ? s10[h4][g5] = u7 : s10[h4][g5] = l6;
  2083. } else
  2084. for (g5 = 0; g5 < m6; g5++)
  2085. for (h4 = 0; h4 < c5; h4++)
  2086. x4 = s10[h4][g5], x4 < a9[h4] && x4 > r11[h4] ? s10[h4][g5] = Math.floor((x4 - r11[h4]) / b3[h4] * d5) + l6 : x4 >= a9[h4] ? s10[h4][g5] = u7 : s10[h4][g5] = l6;
  2087. return i10.pixelType = "u8", i10.updateStatistics(), i10;
  2088. }
  2089. // node_modules/@arcgis/core/layers/support/RasterStorageInfo.js
  2090. var s7 = class extends l {
  2091. constructor() {
  2092. super(...arguments), this.blockWidth = void 0, this.blockHeight = void 0, this.compression = null, this.origin = null, this.firstPyramidLevel = null, this.maximumPyramidLevel = null, this.pyramidScalingFactor = 2, this.pyramidBlockWidth = null, this.pyramidBlockHeight = null, this.isVirtualTileInfo = false, this.tileInfo = null, this.transposeInfo = null, this.blockBoundary = null;
  2093. }
  2094. };
  2095. e([d({ type: Number, json: { write: true } })], s7.prototype, "blockWidth", void 0), e([d({ type: Number, json: { write: true } })], s7.prototype, "blockHeight", void 0), e([d({ type: String, json: { write: true } })], s7.prototype, "compression", void 0), e([d({ type: j, json: { write: true } })], s7.prototype, "origin", void 0), e([d({ type: Number, json: { write: true } })], s7.prototype, "firstPyramidLevel", void 0), e([d({ type: Number, json: { write: true } })], s7.prototype, "maximumPyramidLevel", void 0), e([d({ json: { write: true } })], s7.prototype, "pyramidResolutions", void 0), e([d({ type: Number, json: { write: true } })], s7.prototype, "pyramidScalingFactor", void 0), e([d({ type: Number, json: { write: true } })], s7.prototype, "pyramidBlockWidth", void 0), e([d({ type: Number, json: { write: true } })], s7.prototype, "pyramidBlockHeight", void 0), e([d({ type: Boolean, json: { write: true } })], s7.prototype, "isVirtualTileInfo", void 0), e([d({ json: { write: true } })], s7.prototype, "tileInfo", void 0), e([d()], s7.prototype, "transposeInfo", void 0), e([d()], s7.prototype, "blockBoundary", void 0), s7 = e([n("esri.layers.support.RasterStorageInfo")], s7);
  2096. var p4 = s7;
  2097. // node_modules/@arcgis/core/layers/support/RasterInfo.js
  2098. var a7 = class extends l {
  2099. constructor(t7) {
  2100. super(t7), this.attributeTable = null, this.bandCount = null, this.colormap = null, this.extent = null, this.format = void 0, this.height = null, this.width = null, this.histograms = null, this.keyProperties = {}, this.multidimensionalInfo = null, this.noDataValue = null, this.pixelSize = null, this.pixelType = null, this.isPseudoSpatialReference = false, this.spatialReference = null, this.statistics = null, this.storageInfo = null, this.transform = null;
  2101. }
  2102. get dataType() {
  2103. const t7 = this.keyProperties?.DataType?.toLowerCase() ?? "generic";
  2104. return t7 === "stdtime" ? "standard-time" : t7;
  2105. }
  2106. get nativeExtent() {
  2107. return this._get("nativeExtent") || this.extent;
  2108. }
  2109. set nativeExtent(t7) {
  2110. t7 && this._set("nativeExtent", t7);
  2111. }
  2112. get nativePixelSize() {
  2113. if (t(this.transform) || !this.transform.affectsPixelSize)
  2114. return this.pixelSize;
  2115. const t7 = this.nativeExtent;
  2116. return { x: t7.width / this.width, y: t7.height / this.height };
  2117. }
  2118. get hasMultidimensionalTranspose() {
  2119. return !!this.storageInfo?.transposeInfo;
  2120. }
  2121. };
  2122. e([d({ json: { write: true } })], a7.prototype, "attributeTable", void 0), e([d({ json: { write: true } })], a7.prototype, "bandCount", void 0), e([d({ json: { write: true } })], a7.prototype, "colormap", void 0), e([d({ type: String, readOnly: true })], a7.prototype, "dataType", null), e([d({ type: M, json: { write: true } })], a7.prototype, "extent", void 0), e([d({ type: M, json: { write: true } })], a7.prototype, "nativeExtent", null), e([d({ json: { write: true } })], a7.prototype, "nativePixelSize", null), e([d({ json: { write: true } })], a7.prototype, "format", void 0), e([d({ json: { write: true } })], a7.prototype, "height", void 0), e([d({ json: { write: true } })], a7.prototype, "width", void 0), e([d({ json: { write: true } })], a7.prototype, "hasMultidimensionalTranspose", null), e([d({ json: { write: true } })], a7.prototype, "histograms", void 0), e([d({ json: { write: true } })], a7.prototype, "keyProperties", void 0), e([d({ json: { write: true } })], a7.prototype, "multidimensionalInfo", void 0), e([d({ json: { write: true } })], a7.prototype, "noDataValue", void 0), e([d({ json: { write: true } })], a7.prototype, "pixelSize", void 0), e([d({ json: { write: true } })], a7.prototype, "pixelType", void 0), e([d()], a7.prototype, "isPseudoSpatialReference", void 0), e([d({ type: k, json: { write: true } })], a7.prototype, "spatialReference", void 0), e([d({ json: { write: true } })], a7.prototype, "statistics", void 0), e([d({ type: p4, json: { write: true } })], a7.prototype, "storageInfo", void 0), e([d({ json: { write: true } })], a7.prototype, "transform", void 0), a7 = e([n("esri.layers.support.RasterInfo")], a7);
  2123. var l5 = a7;
  2124. // node_modules/@arcgis/core/layers/support/rasterFunctions/surfaceUtils.js
  2125. function i8(t7) {
  2126. let { altitude: e8, azimuth: i10 } = t7;
  2127. const { hillshadeType: s10, pixelSizePower: n9, pixelSizeFactor: a9, scalingType: l6, isGCS: o7, resolution: r11 } = t7, c5 = s10 === "multi-directional" ? 2 * t7.zFactor : t7.zFactor, { x: h4, y: f6 } = r11;
  2128. let u7 = c5 / (8 * h4), d5 = c5 / (8 * f6);
  2129. if (o7 && c5 > 1e-3 && (u7 /= 111e3, d5 /= 111e3), l6 === "adjusted")
  2130. if (o7) {
  2131. const t8 = 111e3 * h4, e9 = 111e3 * f6;
  2132. u7 = (c5 + t8 ** n9 * a9) / (8 * t8), d5 = (c5 + e9 ** n9 * a9) / (8 * e9);
  2133. } else
  2134. u7 = (c5 + h4 ** n9 * a9) / (8 * h4), d5 = (c5 + f6 ** n9 * a9) / (8 * f6);
  2135. let p6 = (90 - e8) * Math.PI / 180, m6 = Math.cos(p6), M3 = (360 - i10 + 90) * Math.PI / 180, x4 = Math.sin(p6) * Math.cos(M3), A3 = Math.sin(p6) * Math.sin(M3);
  2136. const w3 = [315, 270, 225, 360, 180, 0], y4 = [60, 60, 60, 60, 60, 90], g5 = new Float32Array([3, 5, 3, 2, 1, 4]), Z = g5.reduce((t8, e9) => t8 + e9), k4 = g5.map((t8) => t8 / Z), P3 = s10 === "multi-directional" ? w3.length : 1, F = new Float32Array(6), b3 = new Float32Array(6), C4 = new Float32Array(6);
  2137. if (s10 === "multi-directional")
  2138. for (let U4 = 0; U4 < P3; U4++)
  2139. e8 = y4[U4], i10 = w3[U4], p6 = (90 - e8) * Math.PI / 180, m6 = Math.cos(p6), M3 = (360 - i10 + 90) * Math.PI / 180, x4 = Math.sin(p6) * Math.cos(M3), A3 = Math.sin(p6) * Math.sin(M3), F[U4] = m6, b3[U4] = x4, C4[U4] = A3;
  2140. else
  2141. F.fill(m6), b3.fill(x4), C4.fill(A3);
  2142. return { resolution: r11, factor: [u7, d5], sinZcosA: x4, sinZsinA: A3, cosZ: m6, sinZcosAs: b3, sinZsinAs: C4, cosZs: F, weights: k4, hillshadeType: ["traditional", "multi-directional"].indexOf(s10) };
  2143. }
  2144. function s8(s10, n9) {
  2145. if (!i(s10))
  2146. return s10;
  2147. const { width: a9, height: l6, mask: o7 } = s10, r11 = new Uint8Array(a9 * l6);
  2148. o7 && r11.set(o7);
  2149. const { factor: c5, sinZcosA: h4, sinZsinA: f6, cosZ: u7, sinZcosAs: d5, sinZsinAs: p6, cosZs: m6, weights: M3 } = i8(n9), [x4, A3] = c5, { hillshadeType: w3 } = n9, y4 = s10.pixels[0], g5 = new Uint8Array(a9 * l6);
  2150. let Z, k4, P3, F, b3, C4, U4, z2;
  2151. const T4 = 1;
  2152. for (let t7 = T4; t7 < l6 - T4; t7++) {
  2153. const e8 = t7 * a9;
  2154. for (let t8 = T4; t8 < a9 - T4; t8++) {
  2155. if (o7 && !o7[e8 + t8]) {
  2156. g5[e8 + t8] = 0;
  2157. continue;
  2158. }
  2159. let i10 = 8;
  2160. if (o7 && (i10 = o7[e8 - a9 + t8 - 1] + o7[e8 - a9 + t8] + o7[e8 - a9 + t8 + 1] + o7[e8 + t8 - 1] + o7[e8 + t8 + 1] + o7[e8 + a9 + t8 - 1] + o7[e8 + a9 + t8] + o7[e8 + a9 + t8 + 1], i10 < 7)) {
  2161. g5[e8 + t8] = 0, r11[e8 + t8] = 0;
  2162. continue;
  2163. }
  2164. i10 === 7 ? (Z = o7[e8 - a9 + t8 - 1] ? y4[e8 - a9 + t8 - 1] : y4[e8 + t8], k4 = o7[e8 - a9 + t8] ? y4[e8 - a9 + t8] : y4[e8 + t8], P3 = o7[e8 - a9 + t8 + 1] ? y4[e8 - a9 + t8 + 1] : y4[e8 + t8], F = o7[e8 + t8 - 1] ? y4[e8 + t8 - 1] : y4[e8 + t8], b3 = o7[e8 + t8 + 1] ? y4[e8 + t8 + 1] : y4[e8 + t8], C4 = o7[e8 + a9 + t8 - 1] ? y4[e8 + a9 + t8 - 1] : y4[e8 + t8], U4 = o7[e8 + a9 + t8] ? y4[e8 + a9 + t8] : y4[e8 + t8], z2 = o7[e8 + a9 + t8 + 1] ? y4[e8 + a9 + t8 + 1] : y4[e8 + t8]) : (Z = y4[e8 - a9 + t8 - 1], k4 = y4[e8 - a9 + t8], P3 = y4[e8 - a9 + t8 + 1], F = y4[e8 + t8 - 1], b3 = y4[e8 + t8 + 1], C4 = y4[e8 + a9 + t8 - 1], U4 = y4[e8 + a9 + t8], z2 = y4[e8 + a9 + t8 + 1]);
  2165. const s11 = (P3 + b3 + b3 + z2 - (Z + F + F + C4)) * x4, n10 = (C4 + U4 + U4 + z2 - (Z + k4 + k4 + P3)) * A3, l7 = Math.sqrt(1 + s11 * s11 + n10 * n10);
  2166. let c6 = 0;
  2167. if (w3 === "traditional") {
  2168. let t9 = 255 * (u7 + f6 * n10 - h4 * s11) / l7;
  2169. t9 < 0 && (t9 = 0), c6 = t9;
  2170. } else {
  2171. const t9 = p6.length;
  2172. for (let e9 = 0; e9 < t9; e9++) {
  2173. let t10 = 255 * (m6[e9] + p6[e9] * n10 - d5[e9] * s11) / l7;
  2174. t10 < 0 && (t10 = 0), c6 += t10 * M3[e9];
  2175. }
  2176. }
  2177. g5[e8 + t8] = 255 & c6;
  2178. }
  2179. }
  2180. for (let t7 = 0; t7 < l6; t7++)
  2181. g5[t7 * a9] = g5[t7 * a9 + 1], g5[(t7 + 1) * a9 - 1] = g5[(t7 + 1) * a9 - 2];
  2182. for (let t7 = 1; t7 < a9 - 1; t7++)
  2183. g5[t7] = g5[t7 + a9], g5[t7 + (l6 - 1) * a9] = g5[t7 + (l6 - 2) * a9];
  2184. return new u({ width: a9, height: l6, pixels: [g5], mask: o7 ? r11 : null, pixelType: "u8", validPixelCount: s10.validPixelCount, statistics: [{ minValue: 0, maxValue: 255 }] });
  2185. }
  2186. function n7(t7, i10, s10, n9) {
  2187. if (!i(t7) || !i(i10))
  2188. return;
  2189. const { min: a9, max: l6 } = n9, o7 = t7.pixels[0], { pixels: r11, mask: c5 } = i10, h4 = r11[0], f6 = 255.00001 / (l6 - a9), u7 = new Uint8ClampedArray(h4.length), d5 = new Uint8ClampedArray(h4.length), p6 = new Uint8ClampedArray(h4.length), m6 = s10.length - 1;
  2190. for (let e8 = 0; e8 < h4.length; e8++) {
  2191. if (c5 && c5[e8] === 0)
  2192. continue;
  2193. const t8 = Math.floor((h4[e8] - a9) * f6), [i11, n10] = s10[t8 < 0 ? 0 : t8 > m6 ? m6 : t8], l7 = o7[e8], r12 = l7 * n10, M3 = r12 * (1 - Math.abs(i11 % 2 - 1)), x4 = l7 - r12;
  2194. switch (Math.floor(i11)) {
  2195. case 0:
  2196. u7[e8] = r12 + x4, d5[e8] = M3 + x4, p6[e8] = x4;
  2197. break;
  2198. case 1:
  2199. u7[e8] = M3 + x4, d5[e8] = r12 + x4, p6[e8] = x4;
  2200. break;
  2201. case 2:
  2202. u7[e8] = x4, d5[e8] = r12 + x4, p6[e8] = M3 + x4;
  2203. break;
  2204. case 3:
  2205. u7[e8] = x4, d5[e8] = M3 + x4, p6[e8] = r12 + x4;
  2206. break;
  2207. case 4:
  2208. u7[e8] = M3 + x4, d5[e8] = x4, p6[e8] = r12 + x4;
  2209. break;
  2210. case 5:
  2211. case 6:
  2212. u7[e8] = r12 + x4, d5[e8] = x4, p6[e8] = M3 + x4;
  2213. }
  2214. }
  2215. t7.pixels = [u7, d5, p6], t7.updateStatistics();
  2216. }
  2217. // node_modules/@arcgis/core/renderers/support/colorRampUtils.js
  2218. var i9 = [{ id: "aspect_predefined", type: "multipart", colorRamps: [{ fromColor: [190, 190, 190], toColor: [255, 45, 8] }, { fromColor: [255, 45, 8], toColor: [255, 181, 61] }, { fromColor: [255, 181, 61], toColor: [255, 254, 52] }, { fromColor: [255, 254, 52], toColor: [0, 251, 50] }, { fromColor: [0, 251, 50], toColor: [255, 254, 52] }, { fromColor: [0, 253, 255], toColor: [0, 181, 255] }, { fromColor: [0, 181, 255], toColor: [26, 35, 253] }, { fromColor: [26, 35, 253], toColor: [255, 57, 251] }, { fromColor: [255, 57, 251], toColor: [255, 45, 8] }] }, { id: "blackToWhite_predefined", fromColor: [0, 0, 0], toColor: [255, 255, 255] }, { id: "blueBright_predefined", fromColor: [204, 204, 255], toColor: [0, 0, 224] }, { id: "blueLightToDark_predefined", fromColor: [211, 229, 232], toColor: [46, 100, 140] }, { id: "blueGreenBright_predefined", fromColor: [203, 245, 234], toColor: [48, 207, 146] }, { id: "blueGreenLightToDark_predefined", fromColor: [216, 242, 237], toColor: [21, 79, 74] }, { id: "brownLightToDark_predefined", fromColor: [240, 236, 170], toColor: [102, 72, 48] }, { id: "brownToBlueGreenDivergingBright_predefined", type: "multipart", colorRamps: [{ fromColor: [156, 85, 31], toColor: [255, 255, 191] }, { fromColor: [255, 255, 191], toColor: [33, 130, 145] }] }, { id: "brownToBlueGreenDivergingDark_predefined", type: "multipart", colorRamps: [{ fromColor: [110, 70, 45], toColor: [204, 204, 102] }, { fromColor: [204, 204, 102], toColor: [48, 100, 102] }] }, { id: "coefficientBias_predefined", fromColor: [214, 214, 255], toColor: [0, 57, 148] }, { id: "coldToHotDiverging_predefined", type: "multipart", colorRamps: [{ fromColor: [69, 117, 181], toColor: [255, 255, 191] }, { fromColor: [255, 255, 191], toColor: [214, 47, 39] }] }, { id: "conditionNumber_predefined", type: "multipart", colorRamps: [{ fromColor: [0, 97, 0], toColor: [255, 255, 0] }, { fromColor: [255, 255, 0], toColor: [255, 34, 0] }] }, { id: "cyanToPurple_predefined", type: "multipart", colorRamps: [{ fromColor: [0, 245, 245], toColor: [0, 0, 245] }, { fromColor: [0, 0, 245], toColor: [245, 0, 245] }] }, { id: "cyanLightToBlueDark_predefined", type: "multipart", colorRamps: [{ fromColor: [182, 237, 240], toColor: [31, 131, 224] }, { fromColor: [31, 131, 224], toColor: [9, 9, 145] }] }, { id: "distance_predefined", fromColor: [255, 200, 0], toColor: [0, 0, 255] }, { id: "elevation1_predefined", type: "multipart", colorRamps: [{ fromColor: [175, 240, 233], toColor: [255, 255, 179] }, { fromColor: [255, 255, 179], toColor: [0, 128, 64] }, { fromColor: [0, 128, 64], toColor: [252, 186, 3] }, { fromColor: [252, 186, 3], toColor: [128, 0, 0] }, { fromColor: [120, 0, 0], toColor: [105, 48, 13] }, { fromColor: [105, 48, 13], toColor: [171, 171, 171] }, { fromColor: [171, 171, 171], toColor: [255, 252, 255] }] }, { id: "elevation2_predefined", type: "multipart", colorRamps: [{ fromColor: [118, 219, 211], toColor: [255, 255, 199] }, { fromColor: [255, 255, 199], toColor: [255, 255, 128] }, { fromColor: [255, 255, 128], toColor: [217, 194, 121] }, { fromColor: [217, 194, 121], toColor: [135, 96, 38] }, { fromColor: [135, 96, 38], toColor: [150, 150, 181] }, { fromColor: [150, 150, 181], toColor: [181, 150, 181] }, { fromColor: [181, 150, 181], toColor: [255, 252, 255] }] }, { id: "errors_predefined", fromColor: [255, 235, 214], toColor: [196, 10, 10] }, { id: "grayLightToDark_predefined", fromColor: [219, 219, 219], toColor: [69, 69, 69] }, { id: "greenBright_predefined", fromColor: [204, 255, 204], toColor: [14, 204, 14] }, { id: "greenLightToDark_predefined", fromColor: [220, 245, 233], toColor: [34, 102, 51] }, { id: "greenToBlue_predefined", type: "multipart", colorRamps: [{ fromColor: [32, 204, 16], toColor: [0, 242, 242] }, { fromColor: [0, 242, 242], toColor: [2, 33, 227] }] }, { id: "orangeBright_predefined", fromColor: [255, 235, 204], toColor: [240, 118, 5] }, { id: "orangeLightToDark_predefined", fromColor: [250, 233, 212], toColor: [171, 65, 36] }, { id: "partialSpectrum_predefined", type: "multipart", colorRamps: [{ fromColor: [242, 241, 162], toColor: [255, 255, 0] }, { fromColor: [255, 255, 0], toColor: [255, 0, 0] }, { fromColor: [252, 3, 69], toColor: [176, 7, 237] }, { fromColor: [176, 7, 237], toColor: [2, 29, 173] }] }, { id: "partialSpectrum1Diverging_predefined", type: "multipart", colorRamps: [{ fromColor: [135, 38, 38], toColor: [240, 149, 12] }, { fromColor: [240, 149, 12], toColor: [255, 255, 191] }, { fromColor: [255, 255, 191], toColor: [74, 80, 181] }, { fromColor: [74, 80, 181], toColor: [39, 32, 122] }] }, { id: "partialSpectrum2Diverging_predefined", type: "multipart", colorRamps: [{ fromColor: [115, 77, 42], toColor: [201, 137, 52] }, { fromColor: [201, 137, 52], toColor: [255, 255, 191] }, { fromColor: [255, 255, 191], toColor: [91, 63, 176] }, { fromColor: [91, 63, 176], toColor: [81, 13, 97] }] }, { id: "pinkToYellowGreenDivergingBright_predefined", type: "multipart", colorRamps: [{ fromColor: [158, 30, 113], toColor: [255, 255, 191] }, { fromColor: [255, 255, 191], toColor: [99, 110, 45] }] }, { id: "pinkToYellowGreenDivergingDark_predefined", type: "multipart", colorRamps: [{ fromColor: [97, 47, 73], toColor: [204, 204, 102] }, { fromColor: [204, 204, 102], toColor: [22, 59, 15] }] }, { id: "precipitation_predefined", type: "multipart", colorRamps: [{ fromColor: [194, 82, 60], toColor: [237, 161, 19] }, { fromColor: [237, 161, 19], toColor: [255, 255, 0] }, { fromColor: [255, 255, 0], toColor: [0, 219, 0] }, { fromColor: [0, 219, 0], toColor: [32, 153, 143] }, { fromColor: [32, 153, 143], toColor: [11, 44, 122] }] }, { id: "prediction_predefined", type: "multipart", colorRamps: [{ fromColor: [40, 146, 199], toColor: [250, 250, 100] }, { fromColor: [250, 250, 100], toColor: [232, 16, 20] }] }, { id: "purpleBright_predefined", fromColor: [255, 204, 255], toColor: [199, 0, 199] }, { id: "purpleToGreenDivergingBright_predefined", type: "multipart", colorRamps: [{ fromColor: [77, 32, 150], toColor: [255, 255, 191] }, { fromColor: [255, 255, 191], toColor: [20, 122, 11] }] }, { id: "purpleToGreenDivergingDark_predefined", type: "multipart", colorRamps: [{ fromColor: [67, 14, 89], toColor: [204, 204, 102] }, { fromColor: [204, 204, 102], toColor: [24, 79, 15] }] }, { id: "purpleBlueBright_predefined", fromColor: [223, 184, 230], toColor: [112, 12, 242] }, { id: "purpleBlueLightToDark_predefined", fromColor: [229, 213, 242], toColor: [93, 44, 112] }, { id: "purpleRedBright_predefined", fromColor: [255, 204, 225], toColor: [199, 0, 99] }, { id: "purpleRedLightToDark_predefined", fromColor: [250, 215, 246], toColor: [143, 17, 57] }, { id: "redBright_predefined", fromColor: [255, 204, 204], toColor: [219, 0, 0] }, { id: "redLightToDark_predefined", fromColor: [255, 224, 224], toColor: [143, 10, 10] }, { id: "redToBlueDivergingBright_predefined", type: "multipart", colorRamps: [{ fromColor: [196, 69, 57], toColor: [255, 255, 191] }, { fromColor: [255, 255, 191], toColor: [48, 95, 207] }] }, { id: "redToBlueDivergingDark_predefined", type: "multipart", colorRamps: [{ fromColor: [107, 13, 13], toColor: [204, 204, 102] }, { fromColor: [204, 204, 102], toColor: [13, 53, 97] }] }, { id: "redToGreen_predefined", type: "multipart", colorRamps: [{ fromColor: [245, 0, 0], toColor: [245, 245, 0] }, { fromColor: [245, 245, 0], toColor: [0, 245, 0] }] }, { id: "redToGreenDivergingBright_predefined", type: "multipart", colorRamps: [{ fromColor: [186, 20, 20], toColor: [255, 255, 191] }, { fromColor: [255, 255, 191], toColor: [54, 145, 33] }] }, { id: "redToGreenDivergingDark_predefined", type: "multipart", colorRamps: [{ fromColor: [97, 21, 13], toColor: [204, 204, 102] }, { fromColor: [204, 204, 102], toColor: [16, 69, 16] }] }, { id: "slope_predefined", type: "multipart", colorRamps: [{ fromColor: [56, 168, 0], toColor: [255, 255, 0] }, { fromColor: [255, 255, 0], toColor: [255, 0, 0] }] }, { id: "spectrumFullBright_predefined", type: "multipart", colorRamps: [{ fromColor: [255, 0, 0], toColor: [255, 255, 0] }, { fromColor: [255, 255, 0], toColor: [0, 255, 255] }, { fromColor: [0, 255, 255], toColor: [0, 0, 255] }] }, { id: "spectrumFullDark_predefined", type: "multipart", colorRamps: [{ fromColor: [153, 0, 0], toColor: [153, 153, 0] }, { fromColor: [153, 153, 0], toColor: [0, 153, 153] }, { fromColor: [0, 153, 153], toColor: [0, 0, 153] }] }, { id: "spectrumFullLight_predefined", type: "multipart", colorRamps: [{ fromColor: [255, 153, 153], toColor: [255, 255, 153] }, { fromColor: [255, 255, 153], toColor: [153, 255, 255] }, { fromColor: [153, 255, 255], toColor: [153, 153, 255] }] }, { id: "surface_predefined", type: "multipart", colorRamps: [{ fromColor: [112, 153, 89], toColor: [242, 238, 162] }, { fromColor: [242, 238, 162], toColor: [242, 206, 133] }, { fromColor: [242, 206, 133], toColor: [194, 140, 124] }, { fromColor: [194, 140, 124], toColor: [255, 242, 255] }] }, { id: "temperature_predefined", type: "multipart", colorRamps: [{ fromColor: [255, 252, 255], toColor: [255, 0, 255] }, { fromColor: [255, 0, 255], toColor: [0, 0, 255] }, { fromColor: [0, 0, 255], toColor: [0, 255, 255] }, { fromColor: [0, 255, 255], toColor: [0, 255, 0] }, { fromColor: [0, 255, 0], toColor: [255, 255, 0] }, { fromColor: [255, 255, 0], toColor: [255, 128, 0] }, { fromColor: [255, 128, 0], toColor: [128, 0, 0] }] }, { id: "whiteToBlack_predefined", fromColor: [255, 255, 255], toColor: [0, 0, 0] }, { id: "yellowToDarkRed_predefined", type: "multipart", colorRamps: [{ fromColor: [255, 255, 128], toColor: [242, 167, 46] }, { fromColor: [242, 167, 46], toColor: [107, 0, 0] }] }, { id: "yellowToGreenToDarkBlue_predefined", type: "multipart", colorRamps: [{ fromColor: [255, 255, 128], toColor: [56, 224, 9] }, { fromColor: [56, 224, 9], toColor: [26, 147, 171] }, { fromColor: [26, 147, 171], toColor: [12, 16, 120] }] }, { id: "yellowToRed_predefined", fromColor: [245, 245, 0], toColor: [255, 0, 0] }, { id: "yellowGreenBright_predefined", fromColor: [236, 252, 204], toColor: [157, 204, 16] }, { id: "yellowGreenLightToDark_predefined", fromColor: [215, 240, 175], toColor: [96, 107, 45] }];
  2219. var n8 = { aspect_predefined: "Aspect", blackToWhite_predefined: "Black to White", blueBright_predefined: "Blue Bright", blueLightToDark_predefined: "Blue Light to Dark", blueGreenBright_predefined: "Blue-Green Bright", blueGreenLightToDark_predefined: "Blue-Green Light to Dark", brownLightToDark_predefined: "Brown Light to Dark", brownToBlueGreenDivergingBright_predefined: "Brown to Blue Green Diverging, Bright", brownToBlueGreenDivergingDark_predefined: "Brown to Blue Green Diverging, Dark", coefficientBias_predefined: "Coefficient Bias", coldToHotDiverging_predefined: "Cold to Hot Diverging", conditionNumber_predefined: "Condition Number", cyanToPurple_predefined: "Cyan to Purple", cyanLightToBlueDark_predefined: "Cyan-Light to Blue-Dark", distance_predefined: "Distance", elevation1_predefined: "Elevation #1", elevation2_predefined: "Elevation #2", errors_predefined: "Errors", grayLightToDark_predefined: "Gray Light to Dark", greenBright_predefined: "Green Bright", greenLightToDark_predefined: "Green Light to Dark", greenToBlue_predefined: "Green to Blue", orangeBright_predefined: "Orange Bright", orangeLightToDark_predefined: "Orange Light to Dark", partialSpectrum_predefined: "Partial Spectrum", partialSpectrum1Diverging_predefined: "Partial Spectrum 1 Diverging", partialSpectrum2Diverging_predefined: "Partial Spectrum 2 Diverging", pinkToYellowGreenDivergingBright_predefined: "Pink to YellowGreen Diverging, Bright", pinkToYellowGreenDivergingDark_predefined: "Pink to YellowGreen Diverging, Dark", precipitation_predefined: "Precipitation", prediction_predefined: "Prediction", purpleBright_predefined: "Purple Bright", purpleToGreenDivergingBright_predefined: "Purple to Green Diverging, Bright", purpleToGreenDivergingDark_predefined: "Purple to Green Diverging, Dark", purpleBlueBright_predefined: "Purple-Blue Bright", purpleBlueLightToDark_predefined: "Purple-Blue Light to Dark", purpleRedBright_predefined: "Purple-Red Bright", purpleRedLightToDark_predefined: "Purple-Red Light to Dark", redBright_predefined: "Red Bright", redLightToDark_predefined: "Red Light to Dark", redToBlueDivergingBright_predefined: "Red to Blue Diverging, Bright", redToBlueDivergingDark_predefined: "Red to Blue Diverging, Dark", redToGreen_predefined: "Red to Green", redToGreenDivergingBright_predefined: "Red to Green Diverging, Bright", redToGreenDivergingDark_predefined: "Red to Green Diverging, Dark", slope_predefined: "Slope", spectrumFullBright_predefined: "Spectrum-Full Bright", spectrumFullDark_predefined: "Spectrum-Full Dark", spectrumFullLight_predefined: "Spectrum-Full Light", surface_predefined: "Surface", temperature_predefined: "Temperature", whiteToBlack_predefined: "White to Black", yellowToDarkRed_predefined: "Yellow to Dark Red", yellowToGreenToDarkBlue_predefined: "Yellow to Green to Dark Blue", yellowToRed_predefined: "Yellow to Red", yellowGreenBright_predefined: "Yellow-Green Bright", yellowGreenLightToDark_predefined: "Yellow-Green Light to Dark" };
  2220. function d4(o7, r11) {
  2221. if (!o7 || !r11 || o7.length !== r11.length)
  2222. return false;
  2223. for (let e8 = 0; e8 < o7.length; e8++)
  2224. if (o7[e8] > r11[e8] + 2 || o7[e8] < r11[e8] - 2)
  2225. return false;
  2226. return true;
  2227. }
  2228. function p5(r11, e8) {
  2229. if (!r11)
  2230. return;
  2231. const t7 = e8 || i9;
  2232. let l6, n9 = null;
  2233. return r11.type === "algorithmic" ? t7.some((o7) => {
  2234. if (d4(r11.fromColor.toRgb(), o7.fromColor) && d4(r11.toColor.toRgb(), o7.toColor))
  2235. return n9 = o7.id, true;
  2236. }) : r11.type === "multipart" && t7.some((e9) => {
  2237. if (r11.colorRamps && e9.colorRamps && r11.colorRamps.length === e9.colorRamps.length && (l6 = r11.colorRamps, !e9.colorRamps.some((r12, e10) => {
  2238. if (!d4(l6[e10].fromColor.toRgb(), new l2(r12.fromColor).toRgb()) || !d4(l6[e10].toColor.toRgb(), new l2(r12.toColor).toRgb()))
  2239. return true;
  2240. }))) {
  2241. if (n9)
  2242. return true;
  2243. n9 = e9.id;
  2244. }
  2245. }), n9;
  2246. }
  2247. function f5(o7) {
  2248. const r11 = p5(o7);
  2249. return r11 ? n8[r11] : null;
  2250. }
  2251. function C3(o7) {
  2252. const r11 = (o7 = o7 || {}).numColors || 256, e8 = o7.distanceOffset || 0, t7 = o7.isCustomInterval != null ? o7.isCustomInterval : o7.distanceInterval !== null && o7.distanceInterval !== 1 / (r11 - 1), l6 = o7.distanceInterval || 1 / (r11 - 1);
  2253. return { ...o7, numColors: r11, distanceOffset: e8, interpolateAlpha: !!o7.interpolateAlpha, distanceInterval: l6, isCustomInterval: t7, weights: o7.weights };
  2254. }
  2255. function a8(o7, r11, e8) {
  2256. const { numColors: t7, distanceOffset: l6, distanceInterval: i10, isCustomInterval: n9 } = C3(e8), d5 = o7.s === 0, p6 = r11.s === 0;
  2257. let f6 = o7.h, a9 = r11.h;
  2258. d5 && !p6 ? f6 = a9 : p6 && !d5 && (r11 = { ...r11, h: f6 }, a9 = f6);
  2259. let m6, u7 = Math.abs(a9 - f6);
  2260. const g5 = 360;
  2261. u7 < g5 / 2 ? m6 = (a9 - f6) * i10 : (u7 = g5 - u7, m6 = f6 > a9 ? u7 * i10 : -u7 * i10);
  2262. const s10 = (r11.s - o7.s) * i10, c5 = (r11.v - o7.v) * i10;
  2263. let { s: h4, v: _3 } = o7, D4 = f6;
  2264. if (l6) {
  2265. const o8 = l6 / i10;
  2266. D4 = (D4 + o8 * m6 + g5) % g5, h4 += o8 * s10, _3 += o8 * c5;
  2267. }
  2268. const B2 = [];
  2269. for (let C4 = 0; C4 < t7 - 1; C4++)
  2270. B2.push({ h: D4, s: h4, v: _3 }), D4 = (D4 + m6 + g5) % g5, h4 += s10, _3 += c5;
  2271. return B2.push(n9 ? { h: D4, s: h4, v: _3 } : r11), B2;
  2272. }
  2273. function m5(o7, r11, e8) {
  2274. const { numColors: t7, distanceOffset: l6, distanceInterval: i10, isCustomInterval: n9 } = C3(e8);
  2275. let { l: d5, a: p6, b: f6 } = o7;
  2276. const a9 = (r11.l - d5) * i10, m6 = (r11.a - p6) * i10, u7 = (r11.b - f6) * i10, g5 = [];
  2277. if (l6) {
  2278. const o8 = l6 / i10;
  2279. d5 += o8 * a9, p6 += o8 * m6, f6 += o8 * u7;
  2280. }
  2281. for (let C4 = 0; C4 < t7 - 1; C4++)
  2282. g5.push({ l: d5, a: p6, b: f6 }), d5 += a9, p6 += m6, f6 += u7;
  2283. return g5.push(n9 ? { l: d5, a: p6, b: f6 } : r11), g5;
  2284. }
  2285. function u6(o7, r11, e8) {
  2286. const { numColors: t7, distanceOffset: l6, distanceInterval: i10, isCustomInterval: n9 } = C3(e8), d5 = o7.h, p6 = r11.h, f6 = 2 * Math.PI;
  2287. let a9;
  2288. if (d5 <= p6) {
  2289. const o8 = p6 - d5, r12 = p6 - d5 - f6;
  2290. a9 = Math.abs(r12) < Math.abs(o8) ? r12 : o8;
  2291. } else {
  2292. const o8 = p6 + f6 - d5, r12 = p6 - d5;
  2293. a9 = Math.abs(r12) < Math.abs(o8) ? r12 : o8;
  2294. }
  2295. const m6 = a9 * i10, u7 = (r11.l - o7.l) * i10, g5 = (r11.c - o7.c) * i10;
  2296. let { l: s10, c: c5, h: h4 } = o7;
  2297. if (l6) {
  2298. const o8 = l6 / i10;
  2299. s10 += o8 * u7, c5 += o8 * g5, h4 = (h4 + o8 * m6 + f6) % f6;
  2300. }
  2301. const _3 = [];
  2302. for (let C4 = 0; C4 < t7 - 1; C4++)
  2303. _3.push({ l: s10, c: c5, h: h4 }), s10 += u7, c5 += g5, h4 = (h4 + m6 + f6) % f6;
  2304. return _3.push(n9 ? { l: s10, c: c5, h: h4 } : r11), _3;
  2305. }
  2306. function g4(o7, i10) {
  2307. let { fromColor: n9, toColor: d5 } = o7;
  2308. n9.length === 3 && (n9 = n9.concat([255])), d5.length === 3 && (d5 = d5.concat([255]));
  2309. const p6 = o7.algorithm || "esriCIELabAlgorithm", { numColors: f6, distanceOffset: g5, isCustomInterval: s10, interpolateAlpha: c5 } = C3(i10);
  2310. if (f6 === 1 && g5 === 0)
  2311. return [n9];
  2312. if (f6 === 2 && g5 === 0 && !s10)
  2313. return [n9, d5];
  2314. const h4 = { r: n9[0], g: n9[1], b: n9[2] }, _3 = { r: d5[0], g: d5[1], b: d5[2] }, D4 = p6 === "esriCIELabAlgorithm" ? m5(z(h4), z(_3), i10) : p6 === "esriHSVAlgorithm" ? a8(y(h4), y(_3), i10) : u6(v(h4), v(_3), i10), B2 = [], R3 = n9[3] ?? 255, k4 = ((d5[3] ?? 255) - R3) / (f6 - 1);
  2315. for (let r11 = 0; r11 < f6; r11++) {
  2316. const { r: o8, g: e8, b: t7 } = p2(D4[r11]), i11 = c5 ? Math.round(R3 + k4 * r11) : 255;
  2317. B2.push([o8, e8, t7, i11]);
  2318. }
  2319. return B2;
  2320. }
  2321. function s9(o7, r11) {
  2322. const { numColors: e8, interpolateAlpha: t7 } = C3(r11);
  2323. let l6 = r11?.weights;
  2324. const { colorRamps: i10 } = o7;
  2325. if (l6) {
  2326. const o8 = l6.reduce((o9, r12) => o9 + r12);
  2327. l6 = l6.map((r12) => r12 / o8);
  2328. } else {
  2329. l6 = [];
  2330. for (let o8 = 0; o8 < i10.length; o8++)
  2331. l6[o8] = 1 / i10.length;
  2332. }
  2333. const n9 = [];
  2334. let d5 = 0, p6 = 0;
  2335. const f6 = 1 / (e8 - 1);
  2336. let a9 = false;
  2337. for (let C4 = 0; C4 < i10.length; C4++) {
  2338. let o8 = a9 ? 0 : d5 * f6 - p6, r12 = C4 === i10.length - 1 ? e8 - 1 - d5 : (l6[C4] - o8) / f6;
  2339. if (a9 = Math.ceil(r12) === r12, r12 = Math.ceil(r12), r12 === 0)
  2340. continue;
  2341. o8 /= l6[C4];
  2342. const m7 = g4(i10[C4], { numColors: r12, interpolateAlpha: t7, distanceOffset: o8, distanceInterval: f6 / l6[C4] });
  2343. d5 += m7.length, n9.push(...m7), p6 += l6[C4];
  2344. }
  2345. const m6 = [...i10[i10.length - 1].toColor];
  2346. return m6.length === 3 && m6.push(255), n9.push(m6), n9;
  2347. }
  2348. function c4(o7, r11 = 256, e8 = false) {
  2349. const t7 = "toJSON" in o7 ? o7.toJSON() : o7, l6 = { numColors: r11, interpolateAlpha: e8 };
  2350. return t7.type === "multipart" ? s9(t7, l6) : g4(t7, l6);
  2351. }
  2352. function h3(o7, r11 = 256, e8 = false) {
  2353. const t7 = c4(o7, r11, e8);
  2354. return t7.forEach((o8, r12) => {
  2355. o8.unshift(r12), e8 || o8.pop();
  2356. }), t7;
  2357. }
  2358. function _(o7) {
  2359. const r11 = f5(o7);
  2360. if (o7) {
  2361. if (o7.type === "algorithmic")
  2362. return { ...D3(o7), Name: r11 };
  2363. if (o7.colorRamps) {
  2364. const e8 = o7.colorRamps.map(D3);
  2365. return { type: "MultiPartColorRamp", NumColorRamps: e8.length, ArrayOfColorRamp: e8, Name: r11 };
  2366. }
  2367. }
  2368. }
  2369. function D3(o7) {
  2370. if (!o7)
  2371. return;
  2372. return { Algorithm: o7.toJSON()?.Algorithm || "esriHSVAlgorithm", type: "AlgorithmicColorRamp", FromColor: B(o7.fromColor), ToColor: B(o7.toColor) };
  2373. }
  2374. function B(o7) {
  2375. const e8 = y(o7);
  2376. return { type: "HsvColor", Hue: e8.h, Saturation: e8.s, Value: e8.v, AlphaValue: 255 };
  2377. }
  2378. function R2(o7) {
  2379. const r11 = o7.reverse().map((o8) => {
  2380. const r12 = o8.toString(16);
  2381. return r12.length < 2 ? "0" + r12 : r12;
  2382. });
  2383. return 4294967295 & Number.parseInt(r11.join(""), 16);
  2384. }
  2385. // node_modules/@arcgis/core/renderers/support/RasterSymbolizer.js
  2386. var _2 = s.getLogger("esri.renderers.support.RasterSymbolizer");
  2387. function L2(e8, t7) {
  2388. const { attributeTable: r11, bandCount: s10 } = e8;
  2389. if (t(r11) || s10 > 1)
  2390. return false;
  2391. if (t7) {
  2392. if (r11.fields.find((e9) => e9.name.toLowerCase() === t7.toLowerCase()) == null)
  2393. return false;
  2394. }
  2395. return true;
  2396. }
  2397. function V(e8) {
  2398. const { bandCount: t7, dataType: r11, pixelType: s10 } = e8;
  2399. return r11 === "elevation" || r11 === "generic" && t7 === 1 && (s10 === "s16" || s10 === "f32" || s10 === "f64");
  2400. }
  2401. function v3(e8) {
  2402. const { bandCount: t7, colormap: r11 } = e8;
  2403. return r(r11) && r11.length && t7 === 1;
  2404. }
  2405. var O2 = class extends l {
  2406. constructor(e8) {
  2407. super(e8);
  2408. }
  2409. bind() {
  2410. const { rendererJSON: e8 } = this;
  2411. if (!e8)
  2412. return { success: false };
  2413. let t7;
  2414. switch (this.lookup = { rendererJSON: {} }, e8.type) {
  2415. case "uniqueValue":
  2416. t7 = this._updateUVRenderer(e8);
  2417. break;
  2418. case "rasterColormap":
  2419. t7 = this._updateColormapRenderer(e8);
  2420. break;
  2421. case "rasterStretch":
  2422. t7 = this._updateStretchRenderer(e8);
  2423. break;
  2424. case "classBreaks":
  2425. t7 = this._updateClassBreaksRenderer(e8);
  2426. break;
  2427. case "rasterShadedRelief":
  2428. t7 = this._updateShadedReliefRenderer(e8);
  2429. break;
  2430. case "vectorField":
  2431. t7 = this._updateVectorFieldRenderer();
  2432. break;
  2433. case "flowRenderer":
  2434. t7 = this._updateFlowRenderer();
  2435. }
  2436. return t7;
  2437. }
  2438. symbolize(e8) {
  2439. let t7 = e8 && e8.pixelBlock;
  2440. if (!T3(t7))
  2441. return t7;
  2442. if (e8.simpleStretchParams && this.rendererJSON.type === "rasterStretch")
  2443. return this.simpleStretch(t7, e8.simpleStretchParams);
  2444. try {
  2445. let r11;
  2446. switch (t7.pixels.length > 3 && (t7 = l3(t7, [0, 1, 2])), this.rendererJSON.type) {
  2447. case "uniqueValue":
  2448. case "rasterColormap":
  2449. r11 = this._symbolizeColormap(t7);
  2450. break;
  2451. case "classBreaks":
  2452. r11 = this._symbolizeClassBreaks(t7);
  2453. break;
  2454. case "rasterStretch":
  2455. r11 = this._symbolizeStretch(t7, e8.bandIds);
  2456. break;
  2457. case "rasterShadedRelief": {
  2458. const { extent: s10 } = e8, o7 = s10.spatialReference.isGeographic, a9 = { x: (s10.xmax - s10.xmin) / t7.width, y: (s10.ymax - s10.ymin) / t7.height };
  2459. r11 = this._symbolizeShadedRelief(t7, { isGCS: o7, resolution: a9 });
  2460. break;
  2461. }
  2462. }
  2463. return r11;
  2464. } catch (r11) {
  2465. return _2.error("symbolize", r11.message), t7;
  2466. }
  2467. }
  2468. simpleStretch(e8, t7) {
  2469. if (!T3(e8))
  2470. return e8;
  2471. try {
  2472. return e8.pixels.length > 3 && (e8 = l3(e8, [0, 1, 2])), x3(e8, t7);
  2473. } catch (r11) {
  2474. return _2.error("symbolize", r11.message), e8;
  2475. }
  2476. }
  2477. generateWebGLParameters(e8) {
  2478. if (["uniqueValue", "rasterColormap", "classBreaks"].includes(this.rendererJSON.type)) {
  2479. const { indexedColormap: e9, offset: t8 } = this.lookup?.colormapLut || {};
  2480. return { colormap: e9, colormapOffset: t8, type: "lut" };
  2481. }
  2482. const { pixelBlock: t7, isGCS: r11, resolution: s10, bandIds: o7 } = e8, { rendererJSON: a9 } = this;
  2483. return a9.type === "rasterStretch" ? this._generateStretchWebGLParams(t7, a9, o7) : a9.type === "rasterShadedRelief" ? this._generateShadedReliefWebGLParams(a9, r11, s10) : a9.type === "vectorField" ? this._generateVectorFieldWebGLParams(a9) : null;
  2484. }
  2485. _isLUTChanged(e8) {
  2486. if (!this.lookup || !this.lookup.rendererJSON)
  2487. return true;
  2488. if ("colorRamp" in this.rendererJSON) {
  2489. const t7 = this.rendererJSON.colorRamp;
  2490. return e8 ? JSON.stringify(t7) !== JSON.stringify(this.lookup.rendererJSON.colorRamp) : (this.rendererJSON, this.lookup.rendererJSON, JSON.stringify(this.rendererJSON) !== JSON.stringify(this.lookup.rendererJSON));
  2491. }
  2492. return JSON.stringify(this.rendererJSON) !== JSON.stringify(this.lookup.rendererJSON);
  2493. }
  2494. _symbolizeColormap(e8) {
  2495. if (this._isLUTChanged()) {
  2496. if (!this.bind().success)
  2497. return e8;
  2498. }
  2499. return r2(e8, this.lookup.colormapLut);
  2500. }
  2501. _symbolizeClassBreaks(e8) {
  2502. const { canUseIndexedLUT: t7 } = this._analyzeClassBreaks(this.rendererJSON);
  2503. if (this._isLUTChanged()) {
  2504. if (!this.bind().success)
  2505. return e8;
  2506. }
  2507. return t7 ? r2(e8, this.lookup.colormapLut) : a2(e8, this.lookup.remapLut);
  2508. }
  2509. _symbolizeStretch(e8, t7) {
  2510. const { rasterInfo: r11 } = this, { pixelType: s10, bandCount: a9 } = r11, n9 = this.rendererJSON, i10 = ["u8", "u16", "s8", "s16"].includes(s10);
  2511. let l6, u7;
  2512. const { dra: c5 } = n9, { gamma: p6 } = this.lookup;
  2513. if (n9.stretchType === "histogramEqualization") {
  2514. const s11 = c5 ? null : this.lookup.histogramLut, o7 = h2(n9, { rasterInfo: r11, pixelBlock: e8, bandIds: t7, returnHistogramLut: !s11 }), a10 = x3(e8, { ...o7, gamma: p6 });
  2515. u7 = s3(a10, { lut: c5 ? o7.histogramLut : s11, offset: 0 });
  2516. } else if (i10) {
  2517. if (c5) {
  2518. const o7 = h2(n9, { rasterInfo: r11, pixelBlock: e8, bandIds: t7 });
  2519. l6 = a6({ pixelType: s10, ...o7, gamma: p6 });
  2520. } else if (this._isLUTChanged()) {
  2521. if (!this.bind().success)
  2522. return e8;
  2523. l6 = this.lookup ? this.lookup.stretchLut : null;
  2524. } else
  2525. l6 = this.lookup ? this.lookup.stretchLut : null;
  2526. if (!l6)
  2527. return e8;
  2528. a9 > 1 && t7?.length === e2(e8)?.pixels.length && l6?.lut.length === a9 && (l6 = { lut: t7.map((e9) => l6.lut[e9]), offset: l6.offset }), u7 = s3(e8, l6);
  2529. } else {
  2530. const s11 = h2(n9, { rasterInfo: r11, pixelBlock: e8, bandIds: t7 });
  2531. u7 = x3(e8, { ...s11, gamma: p6 });
  2532. }
  2533. if (n9.colorRamp) {
  2534. if (this._isLUTChanged(true)) {
  2535. if (!this.bind().success)
  2536. return e8;
  2537. }
  2538. u7 = r2(u7, this.lookup.colormapLut);
  2539. }
  2540. return u7;
  2541. }
  2542. _symbolizeShadedRelief(e8, t7) {
  2543. const r11 = this.rendererJSON, s10 = { ...r11, ...t7 }, a9 = s8(e8, s10);
  2544. if (!r11.colorRamp)
  2545. return a9;
  2546. let n9;
  2547. if (this._isLUTChanged(true)) {
  2548. if (!this.bind().success)
  2549. return a9;
  2550. n9 = this.lookup ? this.lookup.hsvMap : null;
  2551. } else
  2552. n9 = this.lookup ? this.lookup.hsvMap : null;
  2553. if (!n9)
  2554. return a9;
  2555. const i10 = e2(this.rasterInfo.statistics)?.[0] ?? { min: 0, max: 8e3 };
  2556. return n7(a9, e8, n9, i10), a9;
  2557. }
  2558. _isVectorFieldData() {
  2559. const { bandCount: e8, dataType: t7 } = this.rasterInfo;
  2560. return e8 === 2 && (t7 === "vector-magdir" || t7 === "vector-uv");
  2561. }
  2562. _updateVectorFieldRenderer() {
  2563. return this._isVectorFieldData() ? { success: true } : { success: false, error: `Unsupported data type "${this.rasterInfo.dataType}"; VectorFieldRenderer only supports "vector-magdir" and "vector-uv".` };
  2564. }
  2565. _updateFlowRenderer() {
  2566. return this._isVectorFieldData() ? { success: true } : { success: false, error: `Unsupported data type "${this.rasterInfo.dataType}"; FlowRenderer only supports "vector-magdir" and "vector-uv".` };
  2567. }
  2568. _updateUVRenderer(e8) {
  2569. const { bandCount: t7, attributeTable: r11, pixelType: s10 } = this.rasterInfo, o7 = e8.field1;
  2570. if (!o7)
  2571. return { success: false, error: "Unsupported renderer; missing UniqueValueRenderer.field." };
  2572. const a9 = e8.defaultSymbol, n9 = t7 === 1 && ["u8", "s8"].includes(s10);
  2573. if (!L2(this.rasterInfo, o7) && !n9)
  2574. return { success: false, error: "Unsupported data; UniqueValueRenderer is only supported on single band data with a valid raster attribute table." };
  2575. const i10 = [];
  2576. if (r11) {
  2577. const t8 = r11.fields.find((e9) => e9.name.toLowerCase() === "value");
  2578. if (!t8)
  2579. return { success: false, error: "Unsupported data; the data's raster attribute table does not have a value field." };
  2580. r11.features.forEach((r12) => {
  2581. const s11 = e8.uniqueValueInfos.find((e9) => String(e9.value) === String(r12.attributes[o7]))?.symbol?.color;
  2582. s11 ? i10.push([r12.attributes[t8.name]].concat(s11)) : a9 && i10.push([r12.attributes[t8.name]].concat(a9.color));
  2583. });
  2584. } else {
  2585. if (o7.toLowerCase() !== "value")
  2586. return { success: false, error: 'Unsupported renderer; UniqueValueRenderer.field must be "Value" when raster attribute table is not availalbe.' };
  2587. e8.uniqueValueInfos.forEach((e9) => {
  2588. const t8 = e9?.symbol?.color;
  2589. t8 ? i10.push([parseInt("" + e9.value, 10)].concat(t8)) : a9 && i10.push([parseInt("" + e9.value, 10)].concat(a9.color));
  2590. });
  2591. }
  2592. if (i10.length === 0)
  2593. return { success: false, error: "Invalid UniqueValueRenderer. Cannot find matching records in the raster attribute table." };
  2594. const l6 = o({ colormap: i10 });
  2595. return this.lookup = { rendererJSON: e8, colormapLut: l6 }, this.canRenderInWebGL = true, { success: true };
  2596. }
  2597. _updateColormapRenderer(e8) {
  2598. if (!v3(this.rasterInfo))
  2599. return { success: false, error: "Unsupported data; the data source does not have a colormap." };
  2600. const t7 = e8.colormapInfos.map((e9) => [e9.value].concat(e9.color)).sort((e9, t8) => e9[0] - t8[0]);
  2601. if (!t7 || t7.length === 0)
  2602. return { success: false, error: "Unsupported renderer; ColormapRenderer must have meaningful colormapInfos." };
  2603. const r11 = o({ colormap: t7 });
  2604. return this.lookup = { rendererJSON: e8, colormapLut: r11 }, this.canRenderInWebGL = true, { success: true };
  2605. }
  2606. _updateShadedReliefRenderer(e8) {
  2607. if (!V(this.rasterInfo))
  2608. return { success: false, error: `Unsupported data type "${this.rasterInfo.dataType}"; ShadedReliefRenderer only supports "elevation", or single band float/s16 data.` };
  2609. if (e8.colorRamp) {
  2610. const r11 = h3(e8.colorRamp, 256, true), s10 = o({ colormap: r11 }), o7 = [], a9 = s10.indexedColormap;
  2611. for (let e9 = 0; e9 < a9.length; e9 += 4) {
  2612. const r12 = y({ r: a9[e9], g: a9[e9 + 1], b: a9[e9 + 2] });
  2613. o7.push([r12.h / 60, r12.s / 100, 255 * r12.v / 100]);
  2614. }
  2615. this.lookup = { rendererJSON: e8, colormapLut: s10, hsvMap: o7 };
  2616. } else
  2617. this.lookup = null;
  2618. return this.canRenderInWebGL = true, { success: true };
  2619. }
  2620. _analyzeClassBreaks(e8) {
  2621. const { attributeTable: t7, pixelType: r11 } = this.rasterInfo, s10 = r(t7) ? t7.fields.find((e9) => e9.name.toLowerCase() === "value") : null, o7 = r(t7) ? t7.fields.find((t8) => t8.name.toLowerCase() === e8.field.toLowerCase()) : null, n9 = s10 != null && o7 !== null;
  2622. return { canUseIndexedLUT: ["u8", "u16", "s8", "s16"].includes(r11) || n9, tableValueField: s10, tableBreakField: o7 };
  2623. }
  2624. _updateClassBreaksRenderer(e8) {
  2625. const { attributeTable: t7 } = this.rasterInfo, { canUseIndexedLUT: r11, tableValueField: s10, tableBreakField: o7 } = this._analyzeClassBreaks(e8), a9 = e8.classBreakInfos;
  2626. if (!a9?.length)
  2627. return { success: false, error: "Unsupported renderer; missing or invalid ClassBreaksRenderer.classBreakInfos." };
  2628. const n9 = a9.sort((e9, t8) => e9.classMaxValue - t8.classMaxValue), i10 = n9[n9.length - 1];
  2629. let l6 = e8.minValue;
  2630. if (!r11) {
  2631. const t8 = [];
  2632. for (let e9 = 0; e9 < n9.length; e9++)
  2633. t8.push({ value: n9[e9].classMinValue ?? l6, mappedColor: n9[e9].symbol.color }), l6 = n9[e9].classMaxValue;
  2634. return t8.push({ value: i10.classMaxValue, mappedColor: i10.symbol.color }), this.lookup = { rendererJSON: e8, remapLut: t8 }, this.canRenderInWebGL = false, { success: true };
  2635. }
  2636. const u7 = [];
  2637. if (s10 != null && o7 !== null && s10 !== o7) {
  2638. const r12 = s10.name, a10 = o7.name, i11 = n9[n9.length - 1], { classMaxValue: c6 } = i11;
  2639. l6 = e8.minValue;
  2640. for (const e9 of t7.features) {
  2641. const t8 = e9.attributes[r12], s11 = e9.attributes[a10], o8 = s11 === c6 ? i11 : s11 < l6 ? null : n9.find(({ classMaxValue: e10 }) => e10 > s11);
  2642. o8 && u7.push([t8].concat(o8.symbol.color));
  2643. }
  2644. } else {
  2645. l6 = Math.floor(e8.minValue);
  2646. for (let e9 = 0; e9 < n9.length; e9++) {
  2647. const t8 = n9[e9];
  2648. for (let e10 = l6; e10 < t8.classMaxValue; e10++)
  2649. u7.push([e10].concat(t8.symbol.color));
  2650. l6 = Math.ceil(t8.classMaxValue);
  2651. }
  2652. i10.classMaxValue === l6 && u7.push([i10.classMaxValue].concat(i10.symbol.color));
  2653. }
  2654. const c5 = o({ colormap: u7, fillUnspecified: false });
  2655. return this.lookup = { rendererJSON: e8, colormapLut: c5 }, this.canRenderInWebGL = true, { success: true };
  2656. }
  2657. _isHistogramRequired(e8) {
  2658. return e8 === "percentClip" || e8 === "histogramEqualization";
  2659. }
  2660. _isValidRasterStatistics(e8) {
  2661. return r(e8) && e8.length > 0 && e8[0].min != null && e8[0].max != null;
  2662. }
  2663. _updateStretchRenderer(e8) {
  2664. let { stretchType: t7, dra: r11 } = e8;
  2665. if (!(t7 === "none" || e8.statistics?.length || this._isValidRasterStatistics(this.rasterInfo.statistics) || r11))
  2666. return { success: false, error: "Unsupported renderer; StretchRenderer.statistics is required when dynamic range adjustment is not used." };
  2667. const s10 = e2(e8.histograms || this.rasterInfo.histograms);
  2668. !this._isHistogramRequired(e8.stretchType) || s10?.length || r11 || (t7 = "minMax");
  2669. const { computeGamma: a9, useGamma: n9, colorRamp: i10 } = e8;
  2670. let { gamma: l6 } = e8;
  2671. if (n9 && a9 && !l6?.length) {
  2672. const t8 = e8.statistics?.length ? e8.statistics : e2(this.rasterInfo.statistics);
  2673. l6 = l4(this.rasterInfo.pixelType, t8);
  2674. }
  2675. const u7 = this.rasterInfo.pixelType, c5 = !r11 && ["u8", "u16", "s8", "s16"].includes(u7);
  2676. if (t7 === "histogramEqualization") {
  2677. const t8 = s10.map((e9) => r10(e9));
  2678. this.lookup = { rendererJSON: e8, histogramLut: t8 };
  2679. } else if (c5) {
  2680. const t8 = h2(e8, { rasterInfo: this.rasterInfo }), r12 = a6({ pixelType: u7, ...t8, gamma: n9 ? l6 : null });
  2681. this.lookup = { rendererJSON: e8, stretchLut: r12 };
  2682. }
  2683. if (i10) {
  2684. const t8 = h3(i10, 256, true);
  2685. this.lookup || (this.lookup = { rendererJSON: e8 }), this.lookup.colormapLut = o({ colormap: t8 }), this.lookup.rendererJSON = e8;
  2686. }
  2687. return this.lookup.gamma = n9 && l6?.length ? l6 : null, this.canRenderInWebGL = true, { success: true };
  2688. }
  2689. _generateStretchWebGLParams(e8, t7, r11) {
  2690. let s10 = null, o7 = null;
  2691. const n9 = this.lookup && this.lookup.colormapLut;
  2692. t7.colorRamp && n9 && (s10 = n9.indexedColormap, o7 = n9.offset), t7.stretchType === "histogramEqualization" && (t7 = { ...t7, stretchType: "minMax" });
  2693. const { gamma: i10 } = this.lookup, l6 = !!(t7.useGamma && i10 && i10.some((e9) => e9 !== 1)), { minCutOff: u7, maxCutOff: c5, outMin: p6, outMax: d5 } = h2(t7, { rasterInfo: this.rasterInfo, pixelBlock: e8, bandIds: r11 });
  2694. let h4 = 0;
  2695. r(e8) && (h4 = e8.getPlaneCount(), h4 === 2 && ((e8 = e8.clone()).statistics = [e8.statistics[0]], e8.pixels = [e8.pixels[0]]));
  2696. const m6 = Math.min(3, r11?.length || h4 || this.rasterInfo.bandCount), f6 = new Float32Array(m6), b3 = s10 || l6 ? 1 : 255;
  2697. let g5;
  2698. for (g5 = 0; g5 < m6; g5++)
  2699. f6[g5] = (d5 - p6) / (c5[g5] - u7[g5]) / b3;
  2700. const S4 = new Float32Array(m6);
  2701. if (l6)
  2702. for (g5 = 0; g5 < m6; g5++)
  2703. i10[g5] > 1 ? i10[g5] > 2 ? S4[g5] = 6.5 + (i10[g5] - 2) ** 2.5 : S4[g5] = 6.5 + 100 * (2 - i10[g5]) ** 4 : S4[g5] = 1;
  2704. return { bandCount: m6, outMin: p6 / b3, outMax: d5 / b3, minCutOff: u7, maxCutOff: c5, factor: f6, useGamma: l6, gamma: l6 ? i10 : [1, 1, 1], gammaCorrection: l6 ? S4 : [1, 1, 1], colormap: s10, colormapOffset: o7, stretchType: t7.stretchType, type: "stretch" };
  2705. }
  2706. _generateShadedReliefWebGLParams(e8, t7, r11) {
  2707. let s10 = null, a9 = null;
  2708. const n9 = this.lookup && this.lookup.colormapLut;
  2709. e8.colorRamp && n9 && (s10 = n9.indexedColormap, a9 = n9.offset);
  2710. const i10 = { ...e8, isGCS: t7, resolution: r11 }, l6 = i8(i10), u7 = e2(this.rasterInfo.statistics)?.[0];
  2711. return { ...l6, minValue: u7?.min ?? 0, maxValue: u7?.max ?? 8e3, hillshadeType: e8.hillshadeType === "traditional" ? 0 : 1, type: "hillshade", colormap: s10, colormapOffset: a9 };
  2712. }
  2713. _generateVectorFieldWebGLParams(e8) {
  2714. const { style: t7, inputUnit: r11, outputUnit: s10, visualVariables: o7, symbolTileSize: n9, flowRepresentation: i10 } = e8;
  2715. let l6;
  2716. const u7 = this.rasterInfo.statistics?.[0].min ?? 0, c5 = this.rasterInfo.statistics?.[0].max ?? 50, p6 = o7?.find((e9) => e9.type === "sizeInfo") ?? { type: "sizeInfo", field: "Magnitude", maxDataValue: c5, maxSize: 0.8 * n9, minDataValue: u7, minSize: 0.2 * n9 }, d5 = p6.minDataValue ?? u7, h4 = p6.maxDataValue ?? c5, m6 = r(p6.maxSize) && r(p6.minSize) ? [p6.minSize / n9, p6.maxSize / n9] : [0.2, 0.8];
  2717. if (t7 === "wind_speed") {
  2718. const e9 = (m6[0] + m6[1]) / 2;
  2719. m6[0] = m6[1] = e9;
  2720. }
  2721. const f6 = r(d5) && r(h4) ? [d5, h4] : null;
  2722. if (t7 === "classified_arrow")
  2723. if (r(d5) && r(h4) && r(p6)) {
  2724. l6 = [];
  2725. const e9 = (p6.maxDataValue - p6.minDataValue) / 5;
  2726. for (let t8 = 0; t8 < 6; t8++)
  2727. l6.push(p6.minDataValue + e9 * t8);
  2728. } else
  2729. l6 = [0, 1e-6, 3.5, 7, 10.5, 14];
  2730. const b3 = i10 === "flow_to" === (t7 === "ocean_current_kn" || t7 === "ocean_current_m") ? 0 : Math.PI, y4 = o7?.find((e9) => e9.type === "rotationInfo");
  2731. return { breakValues: l6, dataRange: f6, inputUnit: r11, outputUnit: s10, symbolTileSize: n9, symbolPercentRange: m6, style: t7 || "single_arrow", rotation: b3, rotationType: this.rasterInfo.storageInfo?.tileInfo && this.rasterInfo.dataType === "vector-uv" ? "geographic" : y4?.rotationType || e8.rotationType, type: "vectorField" };
  2732. }
  2733. };
  2734. function T3(e8) {
  2735. return i(e8) && e8.validPixelCount !== 0;
  2736. }
  2737. e([d({ json: { write: true } })], O2.prototype, "rendererJSON", void 0), e([d({ type: l5, json: { write: true } })], O2.prototype, "rasterInfo", void 0), e([d({ json: { write: true } })], O2.prototype, "lookup", void 0), e([d()], O2.prototype, "canRenderInWebGL", void 0), O2 = e([n("esri.renderers.support.RasterSymbolizer")], O2);
  2738. var U3 = O2;
  2739. export {
  2740. i9 as i,
  2741. f5 as f,
  2742. h3 as h,
  2743. _,
  2744. R2 as R,
  2745. p4 as p,
  2746. l5 as l,
  2747. r8 as r,
  2748. n6 as n,
  2749. r9 as r2,
  2750. x,
  2751. b,
  2752. D,
  2753. N,
  2754. k2 as k,
  2755. P2 as P,
  2756. S3 as S,
  2757. m4 as m,
  2758. c3 as c,
  2759. U3 as U
  2760. };
  2761. //# sourceMappingURL=chunk-ZBREIOZ2.js.map