chunk-PK35UGFJ.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. import {
  2. e
  3. } from "./chunk-WSRBH7BF.js";
  4. import {
  5. a
  6. } from "./chunk-GZT4BVFP.js";
  7. // node_modules/@arcgis/core/core/pbf.js
  8. var i;
  9. !function(t) {
  10. t[t.varint = 0] = "varint", t[t.fixed64 = 1] = "fixed64", t[t.delimited = 2] = "delimited", t[t.fixed32 = 5] = "fixed32", t[t.unknown = 99] = "unknown";
  11. }(i || (i = {}));
  12. var s = 4294967296;
  13. var r = new TextDecoder("utf-8");
  14. var n = a("safari") || a("ios") ? 6 : a("ff") ? 12 : 32;
  15. var a2 = class {
  16. constructor(t, e2, s2 = 0, r2 = t ? t.byteLength : 0) {
  17. this._tag = 0, this._dataType = i.unknown, this._init(t, e2, s2, r2);
  18. }
  19. _init(t, e2, i2, s2) {
  20. this._data = t, this._dataView = e2, this._pos = i2, this._end = s2;
  21. }
  22. clone() {
  23. return new a2(this._data, this._dataView, this._pos, this._end);
  24. }
  25. pos() {
  26. return this._pos;
  27. }
  28. move(t) {
  29. this._pos = t;
  30. }
  31. nextTag(t) {
  32. for (; ; ) {
  33. if (this._pos === this._end)
  34. return false;
  35. const e2 = this._decodeVarint();
  36. if (this._tag = e2 >> 3, this._dataType = 7 & e2, !t || t === this._tag)
  37. break;
  38. this.skip();
  39. }
  40. return true;
  41. }
  42. next() {
  43. if (this._pos === this._end)
  44. return false;
  45. const t = this._decodeVarint();
  46. return this._tag = t >> 3, this._dataType = 7 & t, true;
  47. }
  48. empty() {
  49. return this._pos >= this._end;
  50. }
  51. tag() {
  52. return this._tag;
  53. }
  54. getInt32() {
  55. return this._decodeVarint();
  56. }
  57. getInt64() {
  58. return this._decodeVarint();
  59. }
  60. getUInt32() {
  61. let t = 4294967295;
  62. return t = (127 & this._data[this._pos]) >>> 0, this._data[this._pos++] < 128 ? t : (t = (t | (127 & this._data[this._pos]) << 7) >>> 0, this._data[this._pos++] < 128 ? t : (t = (t | (127 & this._data[this._pos]) << 14) >>> 0, this._data[this._pos++] < 128 ? t : (t = (t | (127 & this._data[this._pos]) << 21) >>> 0, this._data[this._pos++] < 128 ? t : (t = (t | (15 & this._data[this._pos]) << 28) >>> 0, this._data[this._pos++] < 128 ? t : void 0))));
  63. }
  64. getUInt64() {
  65. return this._decodeVarint();
  66. }
  67. getSInt32() {
  68. const t = this.getUInt32();
  69. return t >>> 1 ^ -(1 & t) | 0;
  70. }
  71. getSInt64() {
  72. return this._decodeSVarint();
  73. }
  74. getBool() {
  75. const t = this._data[this._pos] !== 0;
  76. return this._skip(1), t;
  77. }
  78. getEnum() {
  79. return this._decodeVarint();
  80. }
  81. getFixed64() {
  82. const t = this._dataView, e2 = this._pos, i2 = t.getUint32(e2, true) + t.getUint32(e2 + 4, true) * s;
  83. return this._skip(8), i2;
  84. }
  85. getSFixed64() {
  86. const t = this._dataView, e2 = this._pos, i2 = t.getUint32(e2, true) + t.getInt32(e2 + 4, true) * s;
  87. return this._skip(8), i2;
  88. }
  89. getDouble() {
  90. const t = this._dataView.getFloat64(this._pos, true);
  91. return this._skip(8), t;
  92. }
  93. getFixed32() {
  94. const t = this._dataView.getUint32(this._pos, true);
  95. return this._skip(4), t;
  96. }
  97. getSFixed32() {
  98. const t = this._dataView.getInt32(this._pos, true);
  99. return this._skip(4), t;
  100. }
  101. getFloat() {
  102. const t = this._dataView.getFloat32(this._pos, true);
  103. return this._skip(4), t;
  104. }
  105. getString() {
  106. const t = this._getLength(), e2 = this._pos, i2 = this._toString(this._data, e2, e2 + t);
  107. return this._skip(t), i2;
  108. }
  109. getBytes() {
  110. const t = this._getLength(), e2 = this._pos, i2 = this._toBytes(this._data, e2, e2 + t);
  111. return this._skip(t), i2;
  112. }
  113. getLength() {
  114. return this._getLengthUnsafe();
  115. }
  116. processMessageWithArgs(t, e2, i2, s2) {
  117. const r2 = this.getMessage(), n2 = t(r2, e2, i2, s2);
  118. return r2.release(), n2;
  119. }
  120. processMessage(t) {
  121. const e2 = this.getMessage(), i2 = t(e2);
  122. return e2.release(), i2;
  123. }
  124. getMessage() {
  125. const t = this._getLength(), e2 = a2.pool.acquire();
  126. return e2._init(this._data, this._dataView, this._pos, this._pos + t), this._skip(t), e2;
  127. }
  128. release() {
  129. a2.pool.release(this);
  130. }
  131. dataType() {
  132. return this._dataType;
  133. }
  134. skip() {
  135. switch (this._dataType) {
  136. case i.varint:
  137. this._decodeVarint();
  138. break;
  139. case i.fixed64:
  140. this._skip(8);
  141. break;
  142. case i.delimited:
  143. this._skip(this._getLength());
  144. break;
  145. case i.fixed32:
  146. this._skip(4);
  147. break;
  148. default:
  149. throw new Error("Invalid data type!");
  150. }
  151. }
  152. skipLen(t) {
  153. this._skip(t);
  154. }
  155. _skip(t) {
  156. if (this._pos + t > this._end)
  157. throw new Error("Attempt to skip past the end of buffer!");
  158. this._pos += t;
  159. }
  160. _decodeVarint() {
  161. const t = this._data;
  162. let e2, i2 = this._pos, s2 = 0;
  163. if (this._end - i2 >= 10)
  164. do {
  165. if (e2 = t[i2++], s2 |= 127 & e2, (128 & e2) == 0)
  166. break;
  167. if (e2 = t[i2++], s2 |= (127 & e2) << 7, (128 & e2) == 0)
  168. break;
  169. if (e2 = t[i2++], s2 |= (127 & e2) << 14, (128 & e2) == 0)
  170. break;
  171. if (e2 = t[i2++], s2 |= (127 & e2) << 21, (128 & e2) == 0)
  172. break;
  173. if (e2 = t[i2++], s2 += 268435456 * (127 & e2), (128 & e2) == 0)
  174. break;
  175. if (e2 = t[i2++], s2 += 34359738368 * (127 & e2), (128 & e2) == 0)
  176. break;
  177. if (e2 = t[i2++], s2 += 4398046511104 * (127 & e2), (128 & e2) == 0)
  178. break;
  179. if (e2 = t[i2++], s2 += 562949953421312 * (127 & e2), (128 & e2) == 0)
  180. break;
  181. if (e2 = t[i2++], s2 += 72057594037927940 * (127 & e2), (128 & e2) == 0)
  182. break;
  183. if (e2 = t[i2++], s2 += 9223372036854776e3 * (127 & e2), (128 & e2) == 0)
  184. break;
  185. throw new Error("Varint too long!");
  186. } while (0);
  187. else {
  188. let r2 = 1;
  189. for (; i2 !== this._end && (e2 = t[i2], (128 & e2) != 0); )
  190. ++i2, s2 += (127 & e2) * r2, r2 *= 128;
  191. if (i2 === this._end)
  192. throw new Error("Varint overrun!");
  193. ++i2, s2 += e2 * r2;
  194. }
  195. return this._pos = i2, s2;
  196. }
  197. _decodeSVarint() {
  198. const t = this._decodeVarint();
  199. return t % 2 ? -(t + 1) / 2 : t / 2;
  200. }
  201. _getLength() {
  202. if (this._dataType !== i.delimited)
  203. throw new Error("Not a delimited data type!");
  204. return this._decodeVarint();
  205. }
  206. _getLengthUnsafe() {
  207. return this.getUInt32();
  208. }
  209. _toString(t, e2, i2) {
  210. if ((i2 = Math.min(this._end, i2)) - e2 > n) {
  211. const s3 = t.subarray(e2, i2);
  212. return r.decode(s3);
  213. }
  214. let s2 = "", a3 = "";
  215. for (let r2 = e2; r2 < i2; ++r2) {
  216. const e3 = t[r2];
  217. 128 & e3 ? a3 += "%" + e3.toString(16) : (s2 += decodeURIComponent(a3) + String.fromCharCode(e3), a3 = "");
  218. }
  219. return a3.length && (s2 += decodeURIComponent(a3)), s2;
  220. }
  221. _toBytes(t, e2, i2) {
  222. return i2 = Math.min(this._end, i2), new Uint8Array(t.buffer, e2, i2 - e2);
  223. }
  224. };
  225. a2.pool = new e(a2, null, (t) => {
  226. t._data = null, t._dataView = null;
  227. });
  228. export {
  229. a2 as a
  230. };
  231. //# sourceMappingURL=chunk-PK35UGFJ.js.map