@camunda/copilot-chat 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/index.js +5424 -28
  3. package/dist/package.json +4 -2
  4. package/package.json +4 -2
  5. package/dist/ConversationHistoryPanel/ConversationHistoryPanel.d.ts +0 -19
  6. package/dist/ConversationHistoryPanel/ConversationHistoryPanel.d.ts.map +0 -1
  7. package/dist/ConversationHistoryPanel/ConversationHistoryRow.d.ts +0 -14
  8. package/dist/ConversationHistoryPanel/ConversationHistoryRow.d.ts.map +0 -1
  9. package/dist/ConversationHistoryPanel/index.d.ts +0 -2
  10. package/dist/ConversationHistoryPanel/index.d.ts.map +0 -1
  11. package/dist/CopilotChat.d.ts +0 -18
  12. package/dist/CopilotChat.d.ts.map +0 -1
  13. package/dist/CopilotSidecar.d.ts +0 -12
  14. package/dist/CopilotSidecar.d.ts.map +0 -1
  15. package/dist/apl-B2DGVGxc.mjs +0 -76
  16. package/dist/asciiarmor-2LVJmxlE.mjs +0 -34
  17. package/dist/asn1-jKiBa2Ya.mjs +0 -95
  18. package/dist/asterisk-DS281yxp.mjs +0 -271
  19. package/dist/clike-BMALKCNj.mjs +0 -620
  20. package/dist/clojure-CCKyeQKf.mjs +0 -800
  21. package/dist/cmake-CuaCgAKt.mjs +0 -28
  22. package/dist/cobol-BlTKFDRj.mjs +0 -72
  23. package/dist/codemirror-runtime-DN57DLqx.mjs +0 -14620
  24. package/dist/coffeescript-BVCvwO8I.mjs +0 -179
  25. package/dist/commonlisp-D_kxz07b.mjs +0 -75
  26. package/dist/crystal-D309uH6_.mjs +0 -217
  27. package/dist/css-BkF-NPzE.mjs +0 -1553
  28. package/dist/cypher-BMq4Fwjl.mjs +0 -68
  29. package/dist/d-BZcgY6La.mjs +0 -127
  30. package/dist/diff-Cg9d_RX2.mjs +0 -18
  31. package/dist/dockerfile-BmicwmnY.mjs +0 -194
  32. package/dist/dtd-CtLokQ-U.mjs +0 -84
  33. package/dist/dylan-QYeExnWK.mjs +0 -234
  34. package/dist/ebnf-DUPDuY4r.mjs +0 -78
  35. package/dist/ecl-CiXN-g_D.mjs +0 -121
  36. package/dist/eiffel-yQhjl4T1.mjs +0 -110
  37. package/dist/elm-CNT9vbN0.mjs +0 -108
  38. package/dist/erlang-CFOYdy9e.mjs +0 -487
  39. package/dist/factor-CYi8BYN3.mjs +0 -65
  40. package/dist/fcl-CPC2WYrI.mjs +0 -103
  41. package/dist/forth-BmxRyE9S.mjs +0 -60
  42. package/dist/fortran-9bvPyrOW.mjs +0 -442
  43. package/dist/gas-cpmYfFX2.mjs +0 -183
  44. package/dist/gherkin-CJuwpceU.mjs +0 -34
  45. package/dist/groovy-DZeT_VM-.mjs +0 -146
  46. package/dist/haskell-CxiO_7JL.mjs +0 -375
  47. package/dist/haxe-70NVW1pR.mjs +0 -359
  48. package/dist/hooks/index.d.ts +0 -7
  49. package/dist/hooks/index.d.ts.map +0 -1
  50. package/dist/hooks/useAgentAdapter.d.ts +0 -3
  51. package/dist/hooks/useAgentAdapter.d.ts.map +0 -1
  52. package/dist/hooks/useConversationLifecycle.d.ts +0 -16
  53. package/dist/hooks/useConversationLifecycle.d.ts.map +0 -1
  54. package/dist/hooks/useCopilotSidecar.d.ts +0 -6
  55. package/dist/hooks/useCopilotSidecar.d.ts.map +0 -1
  56. package/dist/hooks/useEventProcessing.d.ts +0 -26
  57. package/dist/hooks/useEventProcessing.d.ts.map +0 -1
  58. package/dist/hooks/useToolExecution.d.ts +0 -11
  59. package/dist/hooks/useToolExecution.d.ts.map +0 -1
  60. package/dist/hooks/useTransportSubscription.d.ts +0 -6
  61. package/dist/hooks/useTransportSubscription.d.ts.map +0 -1
  62. package/dist/http-D9LttvKF.mjs +0 -44
  63. package/dist/idl-B6TRFYjl.mjs +0 -947
  64. package/dist/index-61nyxvLt.mjs +0 -138
  65. package/dist/index-9DDv9i4k.mjs +0 -555
  66. package/dist/index-9LzGM3Tf.mjs +0 -101
  67. package/dist/index-B68tiRpB.mjs +0 -342
  68. package/dist/index-BFfuxTl0.mjs +0 -248
  69. package/dist/index-BN1g2LCp.mjs +0 -270
  70. package/dist/index-BZylef8t.mjs +0 -612
  71. package/dist/index-BsJOd3yN.mjs +0 -253
  72. package/dist/index-BvOoeB_X.mjs +0 -310
  73. package/dist/index-C2BPUXNG.mjs +0 -946
  74. package/dist/index-CNSMHaJL.mjs +0 -302
  75. package/dist/index-CWVsn7Ik.mjs +0 -1918
  76. package/dist/index-CYJusi0T.mjs +0 -565
  77. package/dist/index-CYMOKrFz.mjs +0 -157
  78. package/dist/index-Cu_bl2ol.mjs +0 -1307
  79. package/dist/index-Ddm1PyM_.mjs +0 -289
  80. package/dist/index-DfGa1EZ6.mjs +0 -960
  81. package/dist/index-FIfj5vEl.mjs +0 -94
  82. package/dist/index-K8lyX8F9.mjs +0 -76
  83. package/dist/index-TBOAg0OP.mjs +0 -21326
  84. package/dist/index-bxhTUN49.mjs +0 -74
  85. package/dist/index-mqjp_-mu.mjs +0 -59
  86. package/dist/index-snW0nLB3.mjs +0 -136
  87. package/dist/index.d.ts +0 -20
  88. package/dist/index.d.ts.map +0 -1
  89. package/dist/javascript-DOuB9oqA.mjs +0 -691
  90. package/dist/julia-DpvXAuO6.mjs +0 -241
  91. package/dist/layout/attachSidecarLayout.d.ts +0 -4
  92. package/dist/layout/attachSidecarLayout.d.ts.map +0 -1
  93. package/dist/layout/index.d.ts +0 -2
  94. package/dist/layout/index.d.ts.map +0 -1
  95. package/dist/layout/sidecarDom.d.ts +0 -10
  96. package/dist/layout/sidecarDom.d.ts.map +0 -1
  97. package/dist/layout/sidecarMediaQuery.d.ts +0 -3
  98. package/dist/layout/sidecarMediaQuery.d.ts.map +0 -1
  99. package/dist/layout/sidecarState.d.ts +0 -29
  100. package/dist/layout/sidecarState.d.ts.map +0 -1
  101. package/dist/layout/sidecarTypes.d.ts +0 -14
  102. package/dist/layout/sidecarTypes.d.ts.map +0 -1
  103. package/dist/livescript-CanGTf8u.mjs +0 -272
  104. package/dist/lua-XplVlWi_.mjs +0 -217
  105. package/dist/mathematica-jaRHnSxC.mjs +0 -35
  106. package/dist/mbox-BctzC1hL.mjs +0 -76
  107. package/dist/mirc-CFBPAOaF.mjs +0 -72
  108. package/dist/mllike-BSnXJBGA.mjs +0 -272
  109. package/dist/modelica-vUgVs--1.mjs +0 -93
  110. package/dist/mscgen-Cpl0NYLN.mjs +0 -104
  111. package/dist/mumps-CQoS1kWX.mjs +0 -25
  112. package/dist/nginx-zDPm3Z74.mjs +0 -89
  113. package/dist/nsis-DYWPgAyk.mjs +0 -62
  114. package/dist/ntriples-CsNjv2QF.mjs +0 -79
  115. package/dist/octave-C8PmmSRH.mjs +0 -143
  116. package/dist/oz-Ce8aN8oE.mjs +0 -151
  117. package/dist/pascal-De0D6mP7.mjs +0 -77
  118. package/dist/perl-B4bSCe1C.mjs +0 -915
  119. package/dist/pig-D24Z8EXi.mjs +0 -54
  120. package/dist/powershell-DkYVfTzP.mjs +0 -249
  121. package/dist/properties-Dn9wna3M.mjs +0 -26
  122. package/dist/protobuf-BPIjwpzm.mjs +0 -49
  123. package/dist/pug-Bz8aeT0D.mjs +0 -248
  124. package/dist/puppet-nyd4dhjf.mjs +0 -45
  125. package/dist/python-BkR3uSy8.mjs +0 -313
  126. package/dist/q-DyHZGnqm.mjs +0 -86
  127. package/dist/r-LKEuhEGI.mjs +0 -104
  128. package/dist/registry/index.d.ts +0 -2
  129. package/dist/registry/index.d.ts.map +0 -1
  130. package/dist/registry/toolDefinitions.d.ts +0 -10
  131. package/dist/registry/toolDefinitions.d.ts.map +0 -1
  132. package/dist/registry/toolRegistry.d.ts +0 -29
  133. package/dist/registry/toolRegistry.d.ts.map +0 -1
  134. package/dist/rpm-IznJm2Xc.mjs +0 -57
  135. package/dist/ruby-CcYfvIk6.mjs +0 -228
  136. package/dist/sas-7E8yHoCW.mjs +0 -105
  137. package/dist/scheme-DjibxsNh.mjs +0 -124
  138. package/dist/shell-C0C2sNA_.mjs +0 -182
  139. package/dist/sidecar-api.d.ts +0 -5
  140. package/dist/sidecar-api.d.ts.map +0 -1
  141. package/dist/sieve-Bwz7vjP5.mjs +0 -72
  142. package/dist/simple-mode-mNVtnu0l.mjs +0 -89
  143. package/dist/smalltalk-Bhddl2pB.mjs +0 -48
  144. package/dist/solr-BNlsLglM.mjs +0 -41
  145. package/dist/sparql-FarWu_Gb.mjs +0 -197
  146. package/dist/spreadsheet-C-cy4P5N.mjs +0 -49
  147. package/dist/sql-CfG5lQ3l.mjs +0 -282
  148. package/dist/stex-Du4h4KAU.mjs +0 -129
  149. package/dist/store/agentStore.d.ts +0 -27
  150. package/dist/store/agentStore.d.ts.map +0 -1
  151. package/dist/store/agentStoreEventProcessor.d.ts +0 -21
  152. package/dist/store/agentStoreEventProcessor.d.ts.map +0 -1
  153. package/dist/store/chatStore.d.ts +0 -36
  154. package/dist/store/chatStore.d.ts.map +0 -1
  155. package/dist/store/historyStore.d.ts +0 -25
  156. package/dist/store/historyStore.d.ts.map +0 -1
  157. package/dist/store/index.d.ts +0 -5
  158. package/dist/store/index.d.ts.map +0 -1
  159. package/dist/store/sidecarStore.d.ts +0 -9
  160. package/dist/store/sidecarStore.d.ts.map +0 -1
  161. package/dist/styles/ensureSidecarStyles.d.ts +0 -2
  162. package/dist/styles/ensureSidecarStyles.d.ts.map +0 -1
  163. package/dist/stylus-CAdqWld3.mjs +0 -250
  164. package/dist/swift-DSxqR9R6.mjs +0 -230
  165. package/dist/sync-ottB0RsS.mjs +0 -1251
  166. package/dist/table-runtime-eW_FiMnH.mjs +0 -3606
  167. package/dist/tcl-xfoLljhY.mjs +0 -81
  168. package/dist/test-setup.d.ts +0 -1
  169. package/dist/test-setup.d.ts.map +0 -1
  170. package/dist/textile-D1AWE-pc.mjs +0 -295
  171. package/dist/tiddlywiki-5wqsXtSk.mjs +0 -155
  172. package/dist/tiki-__Kn3CeS.mjs +0 -181
  173. package/dist/toml-DWAmxCjl.mjs +0 -58
  174. package/dist/tools/kapaAi/KapaSearchBridge.d.ts +0 -7
  175. package/dist/tools/kapaAi/KapaSearchBridge.d.ts.map +0 -1
  176. package/dist/tools/kapaAi/kapaSearchExecutor.d.ts +0 -35
  177. package/dist/tools/kapaAi/kapaSearchExecutor.d.ts.map +0 -1
  178. package/dist/tools/kapaAi/kapaSearchTool.d.ts +0 -24
  179. package/dist/tools/kapaAi/kapaSearchTool.d.ts.map +0 -1
  180. package/dist/troff-D2UO-fKf.mjs +0 -35
  181. package/dist/ttcn-Bsa4sfRm.mjs +0 -123
  182. package/dist/ttcn-cfg-Bac_acMi.mjs +0 -88
  183. package/dist/turtle-xwJUxoPV.mjs +0 -80
  184. package/dist/types/agentTypes.d.ts +0 -11
  185. package/dist/types/agentTypes.d.ts.map +0 -1
  186. package/dist/types/chatTypes.d.ts +0 -45
  187. package/dist/types/chatTypes.d.ts.map +0 -1
  188. package/dist/types/eventTypes.d.ts +0 -28
  189. package/dist/types/eventTypes.d.ts.map +0 -1
  190. package/dist/types/historyTypes.d.ts +0 -34
  191. package/dist/types/historyTypes.d.ts.map +0 -1
  192. package/dist/types/index.d.ts +0 -5
  193. package/dist/types/index.d.ts.map +0 -1
  194. package/dist/types/toolTypes.d.ts +0 -51
  195. package/dist/types/toolTypes.d.ts.map +0 -1
  196. package/dist/types/transportTypes.d.ts +0 -49
  197. package/dist/types/transportTypes.d.ts.map +0 -1
  198. package/dist/utils/eventHandlers.d.ts +0 -34
  199. package/dist/utils/eventHandlers.d.ts.map +0 -1
  200. package/dist/utils/eventPredicates.d.ts +0 -10
  201. package/dist/utils/eventPredicates.d.ts.map +0 -1
  202. package/dist/utils/index.d.ts +0 -7
  203. package/dist/utils/index.d.ts.map +0 -1
  204. package/dist/utils/mapConversationMessages.d.ts +0 -12
  205. package/dist/utils/mapConversationMessages.d.ts.map +0 -1
  206. package/dist/utils/parseToolArguments.d.ts +0 -6
  207. package/dist/utils/parseToolArguments.d.ts.map +0 -1
  208. package/dist/utils/statusLabels.d.ts +0 -3
  209. package/dist/utils/statusLabels.d.ts.map +0 -1
  210. package/dist/utils/thinkingBlockUtils.d.ts +0 -18
  211. package/dist/utils/thinkingBlockUtils.d.ts.map +0 -1
  212. package/dist/utils/toolResultFormatter.d.ts +0 -6
  213. package/dist/utils/toolResultFormatter.d.ts.map +0 -1
  214. package/dist/vb-c2kQGd6-.mjs +0 -74
  215. package/dist/vbscript-1f_Dhg5H.mjs +0 -324
  216. package/dist/velocity-DJd0pTTC.mjs +0 -96
  217. package/dist/verilog-CiS1jyi5.mjs +0 -262
  218. package/dist/vhdl-T9HkrbI2.mjs +0 -106
  219. package/dist/webidl-CjfDENEo.mjs +0 -155
  220. package/dist/xquery-Ct6lEb4B.mjs +0 -422
  221. package/dist/yacas-C0absKBh.mjs +0 -73
  222. package/dist/z80-Pki2zAjW.mjs +0 -61
@@ -1,1251 +0,0 @@
1
- var W = typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {}, E = [], m = [], gr = typeof Uint8Array < "u" ? Uint8Array : Array, L = !1;
2
- function G() {
3
- L = !0;
4
- for (var n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", r = 0, e = n.length; r < e; ++r)
5
- E[r] = n[r], m[n.charCodeAt(r)] = r;
6
- m[45] = 62, m[95] = 63;
7
- }
8
- function yr(n) {
9
- L || G();
10
- var r, e, i, t, o, u, c = n.length;
11
- if (c % 4 > 0)
12
- throw new Error("Invalid string. Length must be a multiple of 4");
13
- o = n[c - 2] === "=" ? 2 : n[c - 1] === "=" ? 1 : 0, u = new gr(c * 3 / 4 - o), i = o > 0 ? c - 4 : c;
14
- var a = 0;
15
- for (r = 0, e = 0; r < i; r += 4, e += 3)
16
- t = m[n.charCodeAt(r)] << 18 | m[n.charCodeAt(r + 1)] << 12 | m[n.charCodeAt(r + 2)] << 6 | m[n.charCodeAt(r + 3)], u[a++] = t >> 16 & 255, u[a++] = t >> 8 & 255, u[a++] = t & 255;
17
- return o === 2 ? (t = m[n.charCodeAt(r)] << 2 | m[n.charCodeAt(r + 1)] >> 4, u[a++] = t & 255) : o === 1 && (t = m[n.charCodeAt(r)] << 10 | m[n.charCodeAt(r + 1)] << 4 | m[n.charCodeAt(r + 2)] >> 2, u[a++] = t >> 8 & 255, u[a++] = t & 255), u;
18
- }
19
- function mr(n) {
20
- return E[n >> 18 & 63] + E[n >> 12 & 63] + E[n >> 6 & 63] + E[n & 63];
21
- }
22
- function Er(n, r, e) {
23
- for (var i, t = [], o = r; o < e; o += 3)
24
- i = (n[o] << 16) + (n[o + 1] << 8) + n[o + 2], t.push(mr(i));
25
- return t.join("");
26
- }
27
- function Q(n) {
28
- L || G();
29
- for (var r, e = n.length, i = e % 3, t = "", o = [], u = 16383, c = 0, a = e - i; c < a; c += u)
30
- o.push(Er(n, c, c + u > a ? a : c + u));
31
- return i === 1 ? (r = n[e - 1], t += E[r >> 2], t += E[r << 4 & 63], t += "==") : i === 2 && (r = (n[e - 2] << 8) + n[e - 1], t += E[r >> 10], t += E[r >> 4 & 63], t += E[r << 2 & 63], t += "="), o.push(t), o.join("");
32
- }
33
- function N(n, r, e, i, t) {
34
- var o, u, c = t * 8 - i - 1, a = (1 << c) - 1, l = a >> 1, h = -7, s = e ? t - 1 : 0, x = e ? -1 : 1, d = n[r + s];
35
- for (s += x, o = d & (1 << -h) - 1, d >>= -h, h += c; h > 0; o = o * 256 + n[r + s], s += x, h -= 8)
36
- ;
37
- for (u = o & (1 << -h) - 1, o >>= -h, h += i; h > 0; u = u * 256 + n[r + s], s += x, h -= 8)
38
- ;
39
- if (o === 0)
40
- o = 1 - l;
41
- else {
42
- if (o === a)
43
- return u ? NaN : (d ? -1 : 1) * (1 / 0);
44
- u = u + Math.pow(2, i), o = o - l;
45
- }
46
- return (d ? -1 : 1) * u * Math.pow(2, o - i);
47
- }
48
- function H(n, r, e, i, t, o) {
49
- var u, c, a, l = o * 8 - t - 1, h = (1 << l) - 1, s = h >> 1, x = t === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, d = i ? 0 : o - 1, w = i ? 1 : -1, y = r < 0 || r === 0 && 1 / r < 0 ? 1 : 0;
50
- for (r = Math.abs(r), isNaN(r) || r === 1 / 0 ? (c = isNaN(r) ? 1 : 0, u = h) : (u = Math.floor(Math.log(r) / Math.LN2), r * (a = Math.pow(2, -u)) < 1 && (u--, a *= 2), u + s >= 1 ? r += x / a : r += x * Math.pow(2, 1 - s), r * a >= 2 && (u++, a /= 2), u + s >= h ? (c = 0, u = h) : u + s >= 1 ? (c = (r * a - 1) * Math.pow(2, t), u = u + s) : (c = r * Math.pow(2, s - 1) * Math.pow(2, t), u = 0)); t >= 8; n[e + d] = c & 255, d += w, c /= 256, t -= 8)
51
- ;
52
- for (u = u << t | c, l += t; l > 0; n[e + d] = u & 255, d += w, u /= 256, l -= 8)
53
- ;
54
- n[e + d - w] |= y * 128;
55
- }
56
- var _r = {}.toString, K = Array.isArray || function(n) {
57
- return _r.call(n) == "[object Array]";
58
- }, Ar = 50;
59
- f.TYPED_ARRAY_SUPPORT = W.TYPED_ARRAY_SUPPORT !== void 0 ? W.TYPED_ARRAY_SUPPORT : !0;
60
- P();
61
- function P() {
62
- return f.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823;
63
- }
64
- function A(n, r) {
65
- if (P() < r)
66
- throw new RangeError("Invalid typed array length");
67
- return f.TYPED_ARRAY_SUPPORT ? (n = new Uint8Array(r), n.__proto__ = f.prototype) : (n === null && (n = new f(r)), n.length = r), n;
68
- }
69
- function f(n, r, e) {
70
- if (!f.TYPED_ARRAY_SUPPORT && !(this instanceof f))
71
- return new f(n, r, e);
72
- if (typeof n == "number") {
73
- if (typeof r == "string")
74
- throw new Error(
75
- "If encoding is specified then the first argument must be a string"
76
- );
77
- return $(this, n);
78
- }
79
- return X(this, n, r, e);
80
- }
81
- f.poolSize = 8192;
82
- f._augment = function(n) {
83
- return n.__proto__ = f.prototype, n;
84
- };
85
- function X(n, r, e, i) {
86
- if (typeof r == "number")
87
- throw new TypeError('"value" argument must not be a number');
88
- return typeof ArrayBuffer < "u" && r instanceof ArrayBuffer ? Rr(n, r, e, i) : typeof r == "string" ? Ir(n, r, e) : Tr(n, r);
89
- }
90
- f.from = function(n, r, e) {
91
- return X(null, n, r, e);
92
- };
93
- f.TYPED_ARRAY_SUPPORT && (f.prototype.__proto__ = Uint8Array.prototype, f.__proto__ = Uint8Array, typeof Symbol < "u" && Symbol.species && f[Symbol.species]);
94
- function Z(n) {
95
- if (typeof n != "number")
96
- throw new TypeError('"size" argument must be a number');
97
- if (n < 0)
98
- throw new RangeError('"size" argument must not be negative');
99
- }
100
- function Fr(n, r, e, i) {
101
- return Z(r), r <= 0 ? A(n, r) : e !== void 0 ? typeof i == "string" ? A(n, r).fill(e, i) : A(n, r).fill(e) : A(n, r);
102
- }
103
- f.alloc = function(n, r, e) {
104
- return Fr(null, n, r, e);
105
- };
106
- function $(n, r) {
107
- if (Z(r), n = A(n, r < 0 ? 0 : J(r) | 0), !f.TYPED_ARRAY_SUPPORT)
108
- for (var e = 0; e < r; ++e)
109
- n[e] = 0;
110
- return n;
111
- }
112
- f.allocUnsafe = function(n) {
113
- return $(null, n);
114
- };
115
- f.allocUnsafeSlow = function(n) {
116
- return $(null, n);
117
- };
118
- function Ir(n, r, e) {
119
- if ((typeof e != "string" || e === "") && (e = "utf8"), !f.isEncoding(e))
120
- throw new TypeError('"encoding" must be a valid string encoding');
121
- var i = rr(r, e) | 0;
122
- n = A(n, i);
123
- var t = n.write(r, e);
124
- return t !== i && (n = n.slice(0, t)), n;
125
- }
126
- function v(n, r) {
127
- var e = r.length < 0 ? 0 : J(r.length) | 0;
128
- n = A(n, e);
129
- for (var i = 0; i < e; i += 1)
130
- n[i] = r[i] & 255;
131
- return n;
132
- }
133
- function Rr(n, r, e, i) {
134
- if (r.byteLength, e < 0 || r.byteLength < e)
135
- throw new RangeError("'offset' is out of bounds");
136
- if (r.byteLength < e + (i || 0))
137
- throw new RangeError("'length' is out of bounds");
138
- return e === void 0 && i === void 0 ? r = new Uint8Array(r) : i === void 0 ? r = new Uint8Array(r, e) : r = new Uint8Array(r, e, i), f.TYPED_ARRAY_SUPPORT ? (n = r, n.__proto__ = f.prototype) : n = v(n, r), n;
139
- }
140
- function Tr(n, r) {
141
- if (_(r)) {
142
- var e = J(r.length) | 0;
143
- return n = A(n, e), n.length === 0 || r.copy(n, 0, 0, e), n;
144
- }
145
- if (r) {
146
- if (typeof ArrayBuffer < "u" && r.buffer instanceof ArrayBuffer || "length" in r)
147
- return typeof r.length != "number" || Wr(r.length) ? A(n, 0) : v(n, r);
148
- if (r.type === "Buffer" && K(r.data))
149
- return v(n, r.data);
150
- }
151
- throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");
152
- }
153
- function J(n) {
154
- if (n >= P())
155
- throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + P().toString(16) + " bytes");
156
- return n | 0;
157
- }
158
- f.isBuffer = T;
159
- function _(n) {
160
- return !!(n != null && n._isBuffer);
161
- }
162
- f.compare = function(r, e) {
163
- if (!_(r) || !_(e))
164
- throw new TypeError("Arguments must be Buffers");
165
- if (r === e) return 0;
166
- for (var i = r.length, t = e.length, o = 0, u = Math.min(i, t); o < u; ++o)
167
- if (r[o] !== e[o]) {
168
- i = r[o], t = e[o];
169
- break;
170
- }
171
- return i < t ? -1 : t < i ? 1 : 0;
172
- };
173
- f.isEncoding = function(r) {
174
- switch (String(r).toLowerCase()) {
175
- case "hex":
176
- case "utf8":
177
- case "utf-8":
178
- case "ascii":
179
- case "latin1":
180
- case "binary":
181
- case "base64":
182
- case "ucs2":
183
- case "ucs-2":
184
- case "utf16le":
185
- case "utf-16le":
186
- return !0;
187
- default:
188
- return !1;
189
- }
190
- };
191
- f.concat = function(r, e) {
192
- if (!K(r))
193
- throw new TypeError('"list" argument must be an Array of Buffers');
194
- if (r.length === 0)
195
- return f.alloc(0);
196
- var i;
197
- if (e === void 0)
198
- for (e = 0, i = 0; i < r.length; ++i)
199
- e += r[i].length;
200
- var t = f.allocUnsafe(e), o = 0;
201
- for (i = 0; i < r.length; ++i) {
202
- var u = r[i];
203
- if (!_(u))
204
- throw new TypeError('"list" argument must be an Array of Buffers');
205
- u.copy(t, o), o += u.length;
206
- }
207
- return t;
208
- };
209
- function rr(n, r) {
210
- if (_(n))
211
- return n.length;
212
- if (typeof ArrayBuffer < "u" && typeof ArrayBuffer.isView == "function" && (ArrayBuffer.isView(n) || n instanceof ArrayBuffer))
213
- return n.byteLength;
214
- typeof n != "string" && (n = "" + n);
215
- var e = n.length;
216
- if (e === 0) return 0;
217
- for (var i = !1; ; )
218
- switch (r) {
219
- case "ascii":
220
- case "latin1":
221
- case "binary":
222
- return e;
223
- case "utf8":
224
- case "utf-8":
225
- case void 0:
226
- return Y(n).length;
227
- case "ucs2":
228
- case "ucs-2":
229
- case "utf16le":
230
- case "utf-16le":
231
- return e * 2;
232
- case "hex":
233
- return e >>> 1;
234
- case "base64":
235
- return fr(n).length;
236
- default:
237
- if (i) return Y(n).length;
238
- r = ("" + r).toLowerCase(), i = !0;
239
- }
240
- }
241
- f.byteLength = rr;
242
- function Sr(n, r, e) {
243
- var i = !1;
244
- if ((r === void 0 || r < 0) && (r = 0), r > this.length || ((e === void 0 || e > this.length) && (e = this.length), e <= 0) || (e >>>= 0, r >>>= 0, e <= r))
245
- return "";
246
- for (n || (n = "utf8"); ; )
247
- switch (n) {
248
- case "hex":
249
- return br(this, r, e);
250
- case "utf8":
251
- case "utf-8":
252
- return ir(this, r, e);
253
- case "ascii":
254
- return Or(this, r, e);
255
- case "latin1":
256
- case "binary":
257
- return qr(this, r, e);
258
- case "base64":
259
- return Yr(this, r, e);
260
- case "ucs2":
261
- case "ucs-2":
262
- case "utf16le":
263
- case "utf-16le":
264
- return Mr(this, r, e);
265
- default:
266
- if (i) throw new TypeError("Unknown encoding: " + n);
267
- n = (n + "").toLowerCase(), i = !0;
268
- }
269
- }
270
- f.prototype._isBuffer = !0;
271
- function I(n, r, e) {
272
- var i = n[r];
273
- n[r] = n[e], n[e] = i;
274
- }
275
- f.prototype.swap16 = function() {
276
- var r = this.length;
277
- if (r % 2 !== 0)
278
- throw new RangeError("Buffer size must be a multiple of 16-bits");
279
- for (var e = 0; e < r; e += 2)
280
- I(this, e, e + 1);
281
- return this;
282
- };
283
- f.prototype.swap32 = function() {
284
- var r = this.length;
285
- if (r % 4 !== 0)
286
- throw new RangeError("Buffer size must be a multiple of 32-bits");
287
- for (var e = 0; e < r; e += 4)
288
- I(this, e, e + 3), I(this, e + 1, e + 2);
289
- return this;
290
- };
291
- f.prototype.swap64 = function() {
292
- var r = this.length;
293
- if (r % 8 !== 0)
294
- throw new RangeError("Buffer size must be a multiple of 64-bits");
295
- for (var e = 0; e < r; e += 8)
296
- I(this, e, e + 7), I(this, e + 1, e + 6), I(this, e + 2, e + 5), I(this, e + 3, e + 4);
297
- return this;
298
- };
299
- f.prototype.toString = function() {
300
- var r = this.length | 0;
301
- return r === 0 ? "" : arguments.length === 0 ? ir(this, 0, r) : Sr.apply(this, arguments);
302
- };
303
- f.prototype.equals = function(r) {
304
- if (!_(r)) throw new TypeError("Argument must be a Buffer");
305
- return this === r ? !0 : f.compare(this, r) === 0;
306
- };
307
- f.prototype.inspect = function() {
308
- var r = "", e = Ar;
309
- return this.length > 0 && (r = this.toString("hex", 0, e).match(/.{2}/g).join(" "), this.length > e && (r += " ... ")), "<Buffer " + r + ">";
310
- };
311
- f.prototype.compare = function(r, e, i, t, o) {
312
- if (!_(r))
313
- throw new TypeError("Argument must be a Buffer");
314
- if (e === void 0 && (e = 0), i === void 0 && (i = r ? r.length : 0), t === void 0 && (t = 0), o === void 0 && (o = this.length), e < 0 || i > r.length || t < 0 || o > this.length)
315
- throw new RangeError("out of range index");
316
- if (t >= o && e >= i)
317
- return 0;
318
- if (t >= o)
319
- return -1;
320
- if (e >= i)
321
- return 1;
322
- if (e >>>= 0, i >>>= 0, t >>>= 0, o >>>= 0, this === r) return 0;
323
- for (var u = o - t, c = i - e, a = Math.min(u, c), l = this.slice(t, o), h = r.slice(e, i), s = 0; s < a; ++s)
324
- if (l[s] !== h[s]) {
325
- u = l[s], c = h[s];
326
- break;
327
- }
328
- return u < c ? -1 : c < u ? 1 : 0;
329
- };
330
- function er(n, r, e, i, t) {
331
- if (n.length === 0) return -1;
332
- if (typeof e == "string" ? (i = e, e = 0) : e > 2147483647 ? e = 2147483647 : e < -2147483648 && (e = -2147483648), e = +e, isNaN(e) && (e = t ? 0 : n.length - 1), e < 0 && (e = n.length + e), e >= n.length) {
333
- if (t) return -1;
334
- e = n.length - 1;
335
- } else if (e < 0)
336
- if (t) e = 0;
337
- else return -1;
338
- if (typeof r == "string" && (r = f.from(r, i)), _(r))
339
- return r.length === 0 ? -1 : j(n, r, e, i, t);
340
- if (typeof r == "number")
341
- return r = r & 255, f.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf == "function" ? t ? Uint8Array.prototype.indexOf.call(n, r, e) : Uint8Array.prototype.lastIndexOf.call(n, r, e) : j(n, [r], e, i, t);
342
- throw new TypeError("val must be string, number or Buffer");
343
- }
344
- function j(n, r, e, i, t) {
345
- var o = 1, u = n.length, c = r.length;
346
- if (i !== void 0 && (i = String(i).toLowerCase(), i === "ucs2" || i === "ucs-2" || i === "utf16le" || i === "utf-16le")) {
347
- if (n.length < 2 || r.length < 2)
348
- return -1;
349
- o = 2, u /= 2, c /= 2, e /= 2;
350
- }
351
- function a(d, w) {
352
- return o === 1 ? d[w] : d.readUInt16BE(w * o);
353
- }
354
- var l;
355
- if (t) {
356
- var h = -1;
357
- for (l = e; l < u; l++)
358
- if (a(n, l) === a(r, h === -1 ? 0 : l - h)) {
359
- if (h === -1 && (h = l), l - h + 1 === c) return h * o;
360
- } else
361
- h !== -1 && (l -= l - h), h = -1;
362
- } else
363
- for (e + c > u && (e = u - c), l = e; l >= 0; l--) {
364
- for (var s = !0, x = 0; x < c; x++)
365
- if (a(n, l + x) !== a(r, x)) {
366
- s = !1;
367
- break;
368
- }
369
- if (s) return l;
370
- }
371
- return -1;
372
- }
373
- f.prototype.includes = function(r, e, i) {
374
- return this.indexOf(r, e, i) !== -1;
375
- };
376
- f.prototype.indexOf = function(r, e, i) {
377
- return er(this, r, e, i, !0);
378
- };
379
- f.prototype.lastIndexOf = function(r, e, i) {
380
- return er(this, r, e, i, !1);
381
- };
382
- function Ur(n, r, e, i) {
383
- e = Number(e) || 0;
384
- var t = n.length - e;
385
- i ? (i = Number(i), i > t && (i = t)) : i = t;
386
- var o = r.length;
387
- if (o % 2 !== 0) throw new TypeError("Invalid hex string");
388
- i > o / 2 && (i = o / 2);
389
- for (var u = 0; u < i; ++u) {
390
- var c = parseInt(r.substr(u * 2, 2), 16);
391
- if (isNaN(c)) return u;
392
- n[e + u] = c;
393
- }
394
- return u;
395
- }
396
- function Br(n, r, e, i) {
397
- return b(Y(r, n.length - e), n, e, i);
398
- }
399
- function nr(n, r, e, i) {
400
- return b(Jr(r), n, e, i);
401
- }
402
- function Dr(n, r, e, i) {
403
- return nr(n, r, e, i);
404
- }
405
- function Cr(n, r, e, i) {
406
- return b(fr(r), n, e, i);
407
- }
408
- function Pr(n, r, e, i) {
409
- return b(Vr(r, n.length - e), n, e, i);
410
- }
411
- f.prototype.write = function(r, e, i, t) {
412
- if (e === void 0)
413
- t = "utf8", i = this.length, e = 0;
414
- else if (i === void 0 && typeof e == "string")
415
- t = e, i = this.length, e = 0;
416
- else if (isFinite(e))
417
- e = e | 0, isFinite(i) ? (i = i | 0, t === void 0 && (t = "utf8")) : (t = i, i = void 0);
418
- else
419
- throw new Error(
420
- "Buffer.write(string, encoding, offset[, length]) is no longer supported"
421
- );
422
- var o = this.length - e;
423
- if ((i === void 0 || i > o) && (i = o), r.length > 0 && (i < 0 || e < 0) || e > this.length)
424
- throw new RangeError("Attempt to write outside buffer bounds");
425
- t || (t = "utf8");
426
- for (var u = !1; ; )
427
- switch (t) {
428
- case "hex":
429
- return Ur(this, r, e, i);
430
- case "utf8":
431
- case "utf-8":
432
- return Br(this, r, e, i);
433
- case "ascii":
434
- return nr(this, r, e, i);
435
- case "latin1":
436
- case "binary":
437
- return Dr(this, r, e, i);
438
- case "base64":
439
- return Cr(this, r, e, i);
440
- case "ucs2":
441
- case "ucs-2":
442
- case "utf16le":
443
- case "utf-16le":
444
- return Pr(this, r, e, i);
445
- default:
446
- if (u) throw new TypeError("Unknown encoding: " + t);
447
- t = ("" + t).toLowerCase(), u = !0;
448
- }
449
- };
450
- f.prototype.toJSON = function() {
451
- return {
452
- type: "Buffer",
453
- data: Array.prototype.slice.call(this._arr || this, 0)
454
- };
455
- };
456
- function Yr(n, r, e) {
457
- return r === 0 && e === n.length ? Q(n) : Q(n.slice(r, e));
458
- }
459
- function ir(n, r, e) {
460
- e = Math.min(n.length, e);
461
- for (var i = [], t = r; t < e; ) {
462
- var o = n[t], u = null, c = o > 239 ? 4 : o > 223 ? 3 : o > 191 ? 2 : 1;
463
- if (t + c <= e) {
464
- var a, l, h, s;
465
- switch (c) {
466
- case 1:
467
- o < 128 && (u = o);
468
- break;
469
- case 2:
470
- a = n[t + 1], (a & 192) === 128 && (s = (o & 31) << 6 | a & 63, s > 127 && (u = s));
471
- break;
472
- case 3:
473
- a = n[t + 1], l = n[t + 2], (a & 192) === 128 && (l & 192) === 128 && (s = (o & 15) << 12 | (a & 63) << 6 | l & 63, s > 2047 && (s < 55296 || s > 57343) && (u = s));
474
- break;
475
- case 4:
476
- a = n[t + 1], l = n[t + 2], h = n[t + 3], (a & 192) === 128 && (l & 192) === 128 && (h & 192) === 128 && (s = (o & 15) << 18 | (a & 63) << 12 | (l & 63) << 6 | h & 63, s > 65535 && s < 1114112 && (u = s));
477
- }
478
- }
479
- u === null ? (u = 65533, c = 1) : u > 65535 && (u -= 65536, i.push(u >>> 10 & 1023 | 55296), u = 56320 | u & 1023), i.push(u), t += c;
480
- }
481
- return Nr(i);
482
- }
483
- var z = 4096;
484
- function Nr(n) {
485
- var r = n.length;
486
- if (r <= z)
487
- return String.fromCharCode.apply(String, n);
488
- for (var e = "", i = 0; i < r; )
489
- e += String.fromCharCode.apply(
490
- String,
491
- n.slice(i, i += z)
492
- );
493
- return e;
494
- }
495
- function Or(n, r, e) {
496
- var i = "";
497
- e = Math.min(n.length, e);
498
- for (var t = r; t < e; ++t)
499
- i += String.fromCharCode(n[t] & 127);
500
- return i;
501
- }
502
- function qr(n, r, e) {
503
- var i = "";
504
- e = Math.min(n.length, e);
505
- for (var t = r; t < e; ++t)
506
- i += String.fromCharCode(n[t]);
507
- return i;
508
- }
509
- function br(n, r, e) {
510
- var i = n.length;
511
- (!r || r < 0) && (r = 0), (!e || e < 0 || e > i) && (e = i);
512
- for (var t = "", o = r; o < e; ++o)
513
- t += $r(n[o]);
514
- return t;
515
- }
516
- function Mr(n, r, e) {
517
- for (var i = n.slice(r, e), t = "", o = 0; o < i.length; o += 2)
518
- t += String.fromCharCode(i[o] + i[o + 1] * 256);
519
- return t;
520
- }
521
- f.prototype.slice = function(r, e) {
522
- var i = this.length;
523
- r = ~~r, e = e === void 0 ? i : ~~e, r < 0 ? (r += i, r < 0 && (r = 0)) : r > i && (r = i), e < 0 ? (e += i, e < 0 && (e = 0)) : e > i && (e = i), e < r && (e = r);
524
- var t;
525
- if (f.TYPED_ARRAY_SUPPORT)
526
- t = this.subarray(r, e), t.__proto__ = f.prototype;
527
- else {
528
- var o = e - r;
529
- t = new f(o, void 0);
530
- for (var u = 0; u < o; ++u)
531
- t[u] = this[u + r];
532
- }
533
- return t;
534
- };
535
- function p(n, r, e) {
536
- if (n % 1 !== 0 || n < 0) throw new RangeError("offset is not uint");
537
- if (n + r > e) throw new RangeError("Trying to access beyond buffer length");
538
- }
539
- f.prototype.readUIntLE = function(r, e, i) {
540
- r = r | 0, e = e | 0, i || p(r, e, this.length);
541
- for (var t = this[r], o = 1, u = 0; ++u < e && (o *= 256); )
542
- t += this[r + u] * o;
543
- return t;
544
- };
545
- f.prototype.readUIntBE = function(r, e, i) {
546
- r = r | 0, e = e | 0, i || p(r, e, this.length);
547
- for (var t = this[r + --e], o = 1; e > 0 && (o *= 256); )
548
- t += this[r + --e] * o;
549
- return t;
550
- };
551
- f.prototype.readUInt8 = function(r, e) {
552
- return e || p(r, 1, this.length), this[r];
553
- };
554
- f.prototype.readUInt16LE = function(r, e) {
555
- return e || p(r, 2, this.length), this[r] | this[r + 1] << 8;
556
- };
557
- f.prototype.readUInt16BE = function(r, e) {
558
- return e || p(r, 2, this.length), this[r] << 8 | this[r + 1];
559
- };
560
- f.prototype.readUInt32LE = function(r, e) {
561
- return e || p(r, 4, this.length), (this[r] | this[r + 1] << 8 | this[r + 2] << 16) + this[r + 3] * 16777216;
562
- };
563
- f.prototype.readUInt32BE = function(r, e) {
564
- return e || p(r, 4, this.length), this[r] * 16777216 + (this[r + 1] << 16 | this[r + 2] << 8 | this[r + 3]);
565
- };
566
- f.prototype.readIntLE = function(r, e, i) {
567
- r = r | 0, e = e | 0, i || p(r, e, this.length);
568
- for (var t = this[r], o = 1, u = 0; ++u < e && (o *= 256); )
569
- t += this[r + u] * o;
570
- return o *= 128, t >= o && (t -= Math.pow(2, 8 * e)), t;
571
- };
572
- f.prototype.readIntBE = function(r, e, i) {
573
- r = r | 0, e = e | 0, i || p(r, e, this.length);
574
- for (var t = e, o = 1, u = this[r + --t]; t > 0 && (o *= 256); )
575
- u += this[r + --t] * o;
576
- return o *= 128, u >= o && (u -= Math.pow(2, 8 * e)), u;
577
- };
578
- f.prototype.readInt8 = function(r, e) {
579
- return e || p(r, 1, this.length), this[r] & 128 ? (255 - this[r] + 1) * -1 : this[r];
580
- };
581
- f.prototype.readInt16LE = function(r, e) {
582
- e || p(r, 2, this.length);
583
- var i = this[r] | this[r + 1] << 8;
584
- return i & 32768 ? i | 4294901760 : i;
585
- };
586
- f.prototype.readInt16BE = function(r, e) {
587
- e || p(r, 2, this.length);
588
- var i = this[r + 1] | this[r] << 8;
589
- return i & 32768 ? i | 4294901760 : i;
590
- };
591
- f.prototype.readInt32LE = function(r, e) {
592
- return e || p(r, 4, this.length), this[r] | this[r + 1] << 8 | this[r + 2] << 16 | this[r + 3] << 24;
593
- };
594
- f.prototype.readInt32BE = function(r, e) {
595
- return e || p(r, 4, this.length), this[r] << 24 | this[r + 1] << 16 | this[r + 2] << 8 | this[r + 3];
596
- };
597
- f.prototype.readFloatLE = function(r, e) {
598
- return e || p(r, 4, this.length), N(this, r, !0, 23, 4);
599
- };
600
- f.prototype.readFloatBE = function(r, e) {
601
- return e || p(r, 4, this.length), N(this, r, !1, 23, 4);
602
- };
603
- f.prototype.readDoubleLE = function(r, e) {
604
- return e || p(r, 8, this.length), N(this, r, !0, 52, 8);
605
- };
606
- f.prototype.readDoubleBE = function(r, e) {
607
- return e || p(r, 8, this.length), N(this, r, !1, 52, 8);
608
- };
609
- function g(n, r, e, i, t, o) {
610
- if (!_(n)) throw new TypeError('"buffer" argument must be a Buffer instance');
611
- if (r > t || r < o) throw new RangeError('"value" argument is out of bounds');
612
- if (e + i > n.length) throw new RangeError("Index out of range");
613
- }
614
- f.prototype.writeUIntLE = function(r, e, i, t) {
615
- if (r = +r, e = e | 0, i = i | 0, !t) {
616
- var o = Math.pow(2, 8 * i) - 1;
617
- g(this, r, e, i, o, 0);
618
- }
619
- var u = 1, c = 0;
620
- for (this[e] = r & 255; ++c < i && (u *= 256); )
621
- this[e + c] = r / u & 255;
622
- return e + i;
623
- };
624
- f.prototype.writeUIntBE = function(r, e, i, t) {
625
- if (r = +r, e = e | 0, i = i | 0, !t) {
626
- var o = Math.pow(2, 8 * i) - 1;
627
- g(this, r, e, i, o, 0);
628
- }
629
- var u = i - 1, c = 1;
630
- for (this[e + u] = r & 255; --u >= 0 && (c *= 256); )
631
- this[e + u] = r / c & 255;
632
- return e + i;
633
- };
634
- f.prototype.writeUInt8 = function(r, e, i) {
635
- return r = +r, e = e | 0, i || g(this, r, e, 1, 255, 0), f.TYPED_ARRAY_SUPPORT || (r = Math.floor(r)), this[e] = r & 255, e + 1;
636
- };
637
- function O(n, r, e, i) {
638
- r < 0 && (r = 65535 + r + 1);
639
- for (var t = 0, o = Math.min(n.length - e, 2); t < o; ++t)
640
- n[e + t] = (r & 255 << 8 * (i ? t : 1 - t)) >>> (i ? t : 1 - t) * 8;
641
- }
642
- f.prototype.writeUInt16LE = function(r, e, i) {
643
- return r = +r, e = e | 0, i || g(this, r, e, 2, 65535, 0), f.TYPED_ARRAY_SUPPORT ? (this[e] = r & 255, this[e + 1] = r >>> 8) : O(this, r, e, !0), e + 2;
644
- };
645
- f.prototype.writeUInt16BE = function(r, e, i) {
646
- return r = +r, e = e | 0, i || g(this, r, e, 2, 65535, 0), f.TYPED_ARRAY_SUPPORT ? (this[e] = r >>> 8, this[e + 1] = r & 255) : O(this, r, e, !1), e + 2;
647
- };
648
- function q(n, r, e, i) {
649
- r < 0 && (r = 4294967295 + r + 1);
650
- for (var t = 0, o = Math.min(n.length - e, 4); t < o; ++t)
651
- n[e + t] = r >>> (i ? t : 3 - t) * 8 & 255;
652
- }
653
- f.prototype.writeUInt32LE = function(r, e, i) {
654
- return r = +r, e = e | 0, i || g(this, r, e, 4, 4294967295, 0), f.TYPED_ARRAY_SUPPORT ? (this[e + 3] = r >>> 24, this[e + 2] = r >>> 16, this[e + 1] = r >>> 8, this[e] = r & 255) : q(this, r, e, !0), e + 4;
655
- };
656
- f.prototype.writeUInt32BE = function(r, e, i) {
657
- return r = +r, e = e | 0, i || g(this, r, e, 4, 4294967295, 0), f.TYPED_ARRAY_SUPPORT ? (this[e] = r >>> 24, this[e + 1] = r >>> 16, this[e + 2] = r >>> 8, this[e + 3] = r & 255) : q(this, r, e, !1), e + 4;
658
- };
659
- f.prototype.writeIntLE = function(r, e, i, t) {
660
- if (r = +r, e = e | 0, !t) {
661
- var o = Math.pow(2, 8 * i - 1);
662
- g(this, r, e, i, o - 1, -o);
663
- }
664
- var u = 0, c = 1, a = 0;
665
- for (this[e] = r & 255; ++u < i && (c *= 256); )
666
- r < 0 && a === 0 && this[e + u - 1] !== 0 && (a = 1), this[e + u] = (r / c >> 0) - a & 255;
667
- return e + i;
668
- };
669
- f.prototype.writeIntBE = function(r, e, i, t) {
670
- if (r = +r, e = e | 0, !t) {
671
- var o = Math.pow(2, 8 * i - 1);
672
- g(this, r, e, i, o - 1, -o);
673
- }
674
- var u = i - 1, c = 1, a = 0;
675
- for (this[e + u] = r & 255; --u >= 0 && (c *= 256); )
676
- r < 0 && a === 0 && this[e + u + 1] !== 0 && (a = 1), this[e + u] = (r / c >> 0) - a & 255;
677
- return e + i;
678
- };
679
- f.prototype.writeInt8 = function(r, e, i) {
680
- return r = +r, e = e | 0, i || g(this, r, e, 1, 127, -128), f.TYPED_ARRAY_SUPPORT || (r = Math.floor(r)), r < 0 && (r = 255 + r + 1), this[e] = r & 255, e + 1;
681
- };
682
- f.prototype.writeInt16LE = function(r, e, i) {
683
- return r = +r, e = e | 0, i || g(this, r, e, 2, 32767, -32768), f.TYPED_ARRAY_SUPPORT ? (this[e] = r & 255, this[e + 1] = r >>> 8) : O(this, r, e, !0), e + 2;
684
- };
685
- f.prototype.writeInt16BE = function(r, e, i) {
686
- return r = +r, e = e | 0, i || g(this, r, e, 2, 32767, -32768), f.TYPED_ARRAY_SUPPORT ? (this[e] = r >>> 8, this[e + 1] = r & 255) : O(this, r, e, !1), e + 2;
687
- };
688
- f.prototype.writeInt32LE = function(r, e, i) {
689
- return r = +r, e = e | 0, i || g(this, r, e, 4, 2147483647, -2147483648), f.TYPED_ARRAY_SUPPORT ? (this[e] = r & 255, this[e + 1] = r >>> 8, this[e + 2] = r >>> 16, this[e + 3] = r >>> 24) : q(this, r, e, !0), e + 4;
690
- };
691
- f.prototype.writeInt32BE = function(r, e, i) {
692
- return r = +r, e = e | 0, i || g(this, r, e, 4, 2147483647, -2147483648), r < 0 && (r = 4294967295 + r + 1), f.TYPED_ARRAY_SUPPORT ? (this[e] = r >>> 24, this[e + 1] = r >>> 16, this[e + 2] = r >>> 8, this[e + 3] = r & 255) : q(this, r, e, !1), e + 4;
693
- };
694
- function tr(n, r, e, i, t, o) {
695
- if (e + i > n.length) throw new RangeError("Index out of range");
696
- if (e < 0) throw new RangeError("Index out of range");
697
- }
698
- function or(n, r, e, i, t) {
699
- return t || tr(n, r, e, 4), H(n, r, e, i, 23, 4), e + 4;
700
- }
701
- f.prototype.writeFloatLE = function(r, e, i) {
702
- return or(this, r, e, !0, i);
703
- };
704
- f.prototype.writeFloatBE = function(r, e, i) {
705
- return or(this, r, e, !1, i);
706
- };
707
- function ur(n, r, e, i, t) {
708
- return t || tr(n, r, e, 8), H(n, r, e, i, 52, 8), e + 8;
709
- }
710
- f.prototype.writeDoubleLE = function(r, e, i) {
711
- return ur(this, r, e, !0, i);
712
- };
713
- f.prototype.writeDoubleBE = function(r, e, i) {
714
- return ur(this, r, e, !1, i);
715
- };
716
- f.prototype.copy = function(r, e, i, t) {
717
- if (i || (i = 0), !t && t !== 0 && (t = this.length), e >= r.length && (e = r.length), e || (e = 0), t > 0 && t < i && (t = i), t === i || r.length === 0 || this.length === 0) return 0;
718
- if (e < 0)
719
- throw new RangeError("targetStart out of bounds");
720
- if (i < 0 || i >= this.length) throw new RangeError("sourceStart out of bounds");
721
- if (t < 0) throw new RangeError("sourceEnd out of bounds");
722
- t > this.length && (t = this.length), r.length - e < t - i && (t = r.length - e + i);
723
- var o = t - i, u;
724
- if (this === r && i < e && e < t)
725
- for (u = o - 1; u >= 0; --u)
726
- r[u + e] = this[u + i];
727
- else if (o < 1e3 || !f.TYPED_ARRAY_SUPPORT)
728
- for (u = 0; u < o; ++u)
729
- r[u + e] = this[u + i];
730
- else
731
- Uint8Array.prototype.set.call(
732
- r,
733
- this.subarray(i, i + o),
734
- e
735
- );
736
- return o;
737
- };
738
- f.prototype.fill = function(r, e, i, t) {
739
- if (typeof r == "string") {
740
- if (typeof e == "string" ? (t = e, e = 0, i = this.length) : typeof i == "string" && (t = i, i = this.length), r.length === 1) {
741
- var o = r.charCodeAt(0);
742
- o < 256 && (r = o);
743
- }
744
- if (t !== void 0 && typeof t != "string")
745
- throw new TypeError("encoding must be a string");
746
- if (typeof t == "string" && !f.isEncoding(t))
747
- throw new TypeError("Unknown encoding: " + t);
748
- } else typeof r == "number" && (r = r & 255);
749
- if (e < 0 || this.length < e || this.length < i)
750
- throw new RangeError("Out of range index");
751
- if (i <= e)
752
- return this;
753
- e = e >>> 0, i = i === void 0 ? this.length : i >>> 0, r || (r = 0);
754
- var u;
755
- if (typeof r == "number")
756
- for (u = e; u < i; ++u)
757
- this[u] = r;
758
- else {
759
- var c = _(r) ? r : Y(new f(r, t).toString()), a = c.length;
760
- for (u = 0; u < i - e; ++u)
761
- this[u + e] = c[u % a];
762
- }
763
- return this;
764
- };
765
- var kr = /[^+\/0-9A-Za-z-_]/g;
766
- function vr(n) {
767
- if (n = Lr(n).replace(kr, ""), n.length < 2) return "";
768
- for (; n.length % 4 !== 0; )
769
- n = n + "=";
770
- return n;
771
- }
772
- function Lr(n) {
773
- return n.trim ? n.trim() : n.replace(/^\s+|\s+$/g, "");
774
- }
775
- function $r(n) {
776
- return n < 16 ? "0" + n.toString(16) : n.toString(16);
777
- }
778
- function Y(n, r) {
779
- r = r || 1 / 0;
780
- for (var e, i = n.length, t = null, o = [], u = 0; u < i; ++u) {
781
- if (e = n.charCodeAt(u), e > 55295 && e < 57344) {
782
- if (!t) {
783
- if (e > 56319) {
784
- (r -= 3) > -1 && o.push(239, 191, 189);
785
- continue;
786
- } else if (u + 1 === i) {
787
- (r -= 3) > -1 && o.push(239, 191, 189);
788
- continue;
789
- }
790
- t = e;
791
- continue;
792
- }
793
- if (e < 56320) {
794
- (r -= 3) > -1 && o.push(239, 191, 189), t = e;
795
- continue;
796
- }
797
- e = (t - 55296 << 10 | e - 56320) + 65536;
798
- } else t && (r -= 3) > -1 && o.push(239, 191, 189);
799
- if (t = null, e < 128) {
800
- if ((r -= 1) < 0) break;
801
- o.push(e);
802
- } else if (e < 2048) {
803
- if ((r -= 2) < 0) break;
804
- o.push(
805
- e >> 6 | 192,
806
- e & 63 | 128
807
- );
808
- } else if (e < 65536) {
809
- if ((r -= 3) < 0) break;
810
- o.push(
811
- e >> 12 | 224,
812
- e >> 6 & 63 | 128,
813
- e & 63 | 128
814
- );
815
- } else if (e < 1114112) {
816
- if ((r -= 4) < 0) break;
817
- o.push(
818
- e >> 18 | 240,
819
- e >> 12 & 63 | 128,
820
- e >> 6 & 63 | 128,
821
- e & 63 | 128
822
- );
823
- } else
824
- throw new Error("Invalid code point");
825
- }
826
- return o;
827
- }
828
- function Jr(n) {
829
- for (var r = [], e = 0; e < n.length; ++e)
830
- r.push(n.charCodeAt(e) & 255);
831
- return r;
832
- }
833
- function Vr(n, r) {
834
- for (var e, i, t, o = [], u = 0; u < n.length && !((r -= 2) < 0); ++u)
835
- e = n.charCodeAt(u), i = e >> 8, t = e % 256, o.push(t), o.push(i);
836
- return o;
837
- }
838
- function fr(n) {
839
- return yr(vr(n));
840
- }
841
- function b(n, r, e, i) {
842
- for (var t = 0; t < i && !(t + e >= r.length || t >= n.length); ++t)
843
- r[t + e] = n[t];
844
- return t;
845
- }
846
- function Wr(n) {
847
- return n !== n;
848
- }
849
- function T(n) {
850
- return n != null && (!!n._isBuffer || sr(n) || Qr(n));
851
- }
852
- function sr(n) {
853
- return !!n.constructor && typeof n.constructor.isBuffer == "function" && n.constructor.isBuffer(n);
854
- }
855
- function Qr(n) {
856
- return typeof n.readFloatLE == "function" && typeof n.slice == "function" && sr(n.slice(0, 0));
857
- }
858
- const jr = 46, zr = /\\(\\)?/g, Gr = RegExp(
859
- // Match anything that isn't a dot or bracket.
860
- `[^.[\\]]+|\\[(?:([^"'][^[]*)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))`,
861
- "g"
862
- ), Hr = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Kr = /^\w*$/, Xr = function(n) {
863
- return Object.prototype.toString.call(n);
864
- }, cr = function(n) {
865
- const r = typeof n;
866
- return r === "symbol" || r === "object" && n && Xr(n) === "[object Symbol]";
867
- }, Zr = function(n, r) {
868
- if (Array.isArray(n))
869
- return !1;
870
- const e = typeof n;
871
- return e === "number" || e === "symbol" || e === "boolean" || !n || cr(n) ? !0 : Kr.test(n) || !Hr.test(n) || r != null && n in Object(r);
872
- }, re = function(n) {
873
- const r = [];
874
- return n.charCodeAt(0) === jr && r.push(""), n.replace(Gr, function(e, i, t, o) {
875
- let u = e;
876
- t ? u = o.replace(zr, "$1") : i && (u = i.trim()), r.push(u);
877
- }), r;
878
- }, ee = function(n, r) {
879
- return Array.isArray(n) ? n : Zr(n, r) ? [n] : re(n);
880
- }, ne = function(n) {
881
- if (typeof n == "string" || cr(n)) return n;
882
- const r = `${n}`;
883
- return r == "0" && 1 / n == -INFINITY ? "-0" : r;
884
- }, ie = function(n, r) {
885
- r = ee(r, n);
886
- let e = 0;
887
- const i = r.length;
888
- for (; n != null && e < i; )
889
- n = n[ne(r[e++])];
890
- return e && e === i ? n : void 0;
891
- }, te = function(n) {
892
- return typeof n == "object" && n !== null && !Array.isArray(n);
893
- }, ar = function(n) {
894
- if (n == null)
895
- return [void 0, void 0];
896
- if (typeof n != "object")
897
- return [Error('Invalid option "columns": expect an array or an object')];
898
- if (Array.isArray(n)) {
899
- const r = [];
900
- for (const e of n)
901
- if (typeof e == "string")
902
- r.push({
903
- key: e,
904
- header: e
905
- });
906
- else if (typeof e == "object" && e !== null && !Array.isArray(e)) {
907
- if (!e.key)
908
- return [
909
- Error('Invalid column definition: property "key" is required')
910
- ];
911
- e.header === void 0 && (e.header = e.key), r.push(e);
912
- } else
913
- return [
914
- Error("Invalid column definition: expect a string or an object")
915
- ];
916
- n = r;
917
- } else {
918
- const r = [];
919
- for (const e in n)
920
- r.push({
921
- key: e,
922
- header: n[e]
923
- });
924
- n = r;
925
- }
926
- return [void 0, n];
927
- };
928
- class S extends Error {
929
- constructor(r, e, ...i) {
930
- Array.isArray(e) && (e = e.join(" ")), super(e), Error.captureStackTrace !== void 0 && Error.captureStackTrace(this, S), this.code = r;
931
- for (const t of i)
932
- for (const o in t) {
933
- const u = t[o];
934
- this[o] = T(u) ? u.toString() : u == null ? u : JSON.parse(JSON.stringify(u));
935
- }
936
- }
937
- }
938
- const oe = function(n) {
939
- return n.replace(/([A-Z])/g, function(r, e) {
940
- return "_" + e.toLowerCase();
941
- });
942
- }, lr = function(n) {
943
- const r = {};
944
- for (const t in n)
945
- r[oe(t)] = n[t];
946
- if (r.bom === void 0 || r.bom === null || r.bom === !1)
947
- r.bom = !1;
948
- else if (r.bom !== !0)
949
- return [
950
- new S("CSV_OPTION_BOOLEAN_INVALID_TYPE", [
951
- "option `bom` is optional and must be a boolean value,",
952
- `got ${JSON.stringify(r.bom)}`
953
- ])
954
- ];
955
- if (r.delimiter === void 0 || r.delimiter === null)
956
- r.delimiter = ",";
957
- else if (T(r.delimiter))
958
- r.delimiter = r.delimiter.toString();
959
- else if (typeof r.delimiter != "string")
960
- return [
961
- new S("CSV_OPTION_DELIMITER_INVALID_TYPE", [
962
- "option `delimiter` must be a buffer or a string,",
963
- `got ${JSON.stringify(r.delimiter)}`
964
- ])
965
- ];
966
- if (r.quote === void 0 || r.quote === null)
967
- r.quote = '"';
968
- else if (r.quote === !0)
969
- r.quote = '"';
970
- else if (r.quote === !1)
971
- r.quote = "";
972
- else if (T(r.quote))
973
- r.quote = r.quote.toString();
974
- else if (typeof r.quote != "string")
975
- return [
976
- new S("CSV_OPTION_QUOTE_INVALID_TYPE", [
977
- "option `quote` must be a boolean, a buffer or a string,",
978
- `got ${JSON.stringify(r.quote)}`
979
- ])
980
- ];
981
- if ((r.quoted === void 0 || r.quoted === null) && (r.quoted = !1), r.escape_formulas === void 0 || r.escape_formulas === null)
982
- r.escape_formulas = !1;
983
- else if (typeof r.escape_formulas != "boolean")
984
- return [
985
- new S("CSV_OPTION_ESCAPE_FORMULAS_INVALID_TYPE", [
986
- "option `escape_formulas` must be a boolean,",
987
- `got ${JSON.stringify(r.escape_formulas)}`
988
- ])
989
- ];
990
- if ((r.quoted_empty === void 0 || r.quoted_empty === null) && (r.quoted_empty = void 0), r.quoted_match === void 0 || r.quoted_match === null || r.quoted_match === !1 ? r.quoted_match = null : Array.isArray(r.quoted_match) || (r.quoted_match = [r.quoted_match]), r.quoted_match)
991
- for (const t of r.quoted_match) {
992
- const o = typeof t == "string", u = t instanceof RegExp;
993
- if (!o && !u)
994
- return [
995
- Error(
996
- `Invalid Option: quoted_match must be a string or a regex, got ${JSON.stringify(t)}`
997
- )
998
- ];
999
- }
1000
- if ((r.quoted_string === void 0 || r.quoted_string === null) && (r.quoted_string = !1), (r.eof === void 0 || r.eof === null) && (r.eof = !0), r.escape === void 0 || r.escape === null)
1001
- r.escape = '"';
1002
- else if (T(r.escape))
1003
- r.escape = r.escape.toString();
1004
- else if (typeof r.escape != "string")
1005
- return [
1006
- Error(
1007
- `Invalid Option: escape must be a buffer or a string, got ${JSON.stringify(r.escape)}`
1008
- )
1009
- ];
1010
- if (r.escape.length > 1)
1011
- return [
1012
- Error(
1013
- `Invalid Option: escape must be one character, got ${r.escape.length} characters`
1014
- )
1015
- ];
1016
- (r.header === void 0 || r.header === null) && (r.header = !1);
1017
- const [e, i] = ar(r.columns);
1018
- if (e !== void 0) return [e];
1019
- if (r.columns = i, (r.quoted === void 0 || r.quoted === null) && (r.quoted = !1), (r.cast === void 0 || r.cast === null) && (r.cast = {}), (r.cast.bigint === void 0 || r.cast.bigint === null) && (r.cast.bigint = (t) => "" + t), (r.cast.boolean === void 0 || r.cast.boolean === null) && (r.cast.boolean = (t) => t ? "1" : ""), (r.cast.date === void 0 || r.cast.date === null) && (r.cast.date = (t) => "" + t.getTime()), (r.cast.number === void 0 || r.cast.number === null) && (r.cast.number = (t) => "" + t), (r.cast.object === void 0 || r.cast.object === null) && (r.cast.object = (t) => JSON.stringify(t)), (r.cast.string === void 0 || r.cast.string === null) && (r.cast.string = function(t) {
1020
- return t;
1021
- }), r.on_record !== void 0 && typeof r.on_record != "function")
1022
- return [Error('Invalid Option: "on_record" must be a function.')];
1023
- if (r.record_delimiter === void 0 || r.record_delimiter === null)
1024
- r.record_delimiter = `
1025
- `;
1026
- else if (T(r.record_delimiter))
1027
- r.record_delimiter = r.record_delimiter.toString();
1028
- else if (typeof r.record_delimiter != "string")
1029
- return [
1030
- Error(
1031
- `Invalid Option: record_delimiter must be a buffer or a string, got ${JSON.stringify(r.record_delimiter)}`
1032
- )
1033
- ];
1034
- switch (r.record_delimiter) {
1035
- case "unix":
1036
- r.record_delimiter = `
1037
- `;
1038
- break;
1039
- case "mac":
1040
- r.record_delimiter = "\r";
1041
- break;
1042
- case "windows":
1043
- r.record_delimiter = `\r
1044
- `;
1045
- break;
1046
- case "ascii":
1047
- r.record_delimiter = "";
1048
- break;
1049
- case "unicode":
1050
- r.record_delimiter = "\u2028";
1051
- break;
1052
- }
1053
- return [void 0, r];
1054
- }, ue = f.from([239, 187, 191]), fe = function(n, r, e) {
1055
- return {
1056
- options: n,
1057
- state: r,
1058
- info: e,
1059
- __transform: function(i, t) {
1060
- if (!Array.isArray(i) && typeof i != "object")
1061
- return Error(
1062
- `Invalid Record: expect an array or an object, got ${JSON.stringify(i)}`
1063
- );
1064
- if (this.info.records === 0) {
1065
- if (Array.isArray(i)) {
1066
- if (this.options.header === !0 && this.options.columns === void 0)
1067
- return Error(
1068
- "Undiscoverable Columns: header option requires column option or object records"
1069
- );
1070
- } else if (this.options.columns === void 0) {
1071
- const [c, a] = ar(Object.keys(i));
1072
- if (c) return;
1073
- this.options.columns = a;
1074
- }
1075
- }
1076
- if (this.info.records === 0) {
1077
- this.bom(t);
1078
- const c = this.headers(t);
1079
- if (c) return c;
1080
- }
1081
- try {
1082
- this.options.on_record && this.options.on_record(i, this.info.records);
1083
- } catch (c) {
1084
- return c;
1085
- }
1086
- let o, u;
1087
- if (this.options.eof) {
1088
- if ([o, u] = this.stringify(i), o) return o;
1089
- if (u === void 0)
1090
- return;
1091
- u = u + this.options.record_delimiter;
1092
- } else {
1093
- if ([o, u] = this.stringify(i), o) return o;
1094
- if (u === void 0)
1095
- return;
1096
- (this.options.header || this.info.records) && (u = this.options.record_delimiter + u);
1097
- }
1098
- this.info.records++, t(u);
1099
- },
1100
- stringify: function(i, t = !1) {
1101
- if (typeof i != "object")
1102
- return [void 0, i];
1103
- const { columns: o } = this.options, u = [];
1104
- if (Array.isArray(i)) {
1105
- o && i.splice(o.length);
1106
- for (let a = 0; a < i.length; a++) {
1107
- const l = i[a], [h, s] = this.__cast(l, {
1108
- index: a,
1109
- column: a,
1110
- records: this.info.records,
1111
- header: t
1112
- });
1113
- if (h) return [h];
1114
- u[a] = [s, l];
1115
- }
1116
- } else
1117
- for (let a = 0; a < o.length; a++) {
1118
- const l = ie(i, o[a].key), [h, s] = this.__cast(l, {
1119
- index: a,
1120
- column: o[a].key,
1121
- records: this.info.records,
1122
- header: t
1123
- });
1124
- if (h) return [h];
1125
- u[a] = [s, l];
1126
- }
1127
- let c = "";
1128
- for (let a = 0; a < u.length; a++) {
1129
- let l, h, [s, x] = u[a];
1130
- if (typeof s == "string")
1131
- l = this.options;
1132
- else if (te(s)) {
1133
- if (l = s, s = l.value, delete l.value, typeof s != "string" && s !== void 0 && s !== null && h)
1134
- return [
1135
- Error(
1136
- `Invalid Casting Value: returned value must return a string, null or undefined, got ${JSON.stringify(s)}`
1137
- )
1138
- ];
1139
- if (l = { ...this.options, ...l }, [h, l] = lr(l), h !== void 0)
1140
- return [h];
1141
- } else if (s == null)
1142
- l = this.options;
1143
- else
1144
- return [
1145
- Error(
1146
- `Invalid Casting Value: returned value must return a string, an object, null or undefined, got ${JSON.stringify(s)}`
1147
- )
1148
- ];
1149
- const {
1150
- delimiter: d,
1151
- escape: w,
1152
- quote: y,
1153
- quoted: hr,
1154
- quoted_empty: B,
1155
- quoted_string: M,
1156
- quoted_match: D,
1157
- record_delimiter: pr,
1158
- escape_formulas: dr
1159
- } = l;
1160
- if (s === "" && x === "") {
1161
- let R = D && D.filter((U) => typeof U == "string" ? s.indexOf(U) !== -1 : U.test(s));
1162
- R = R && R.length > 0, (R || B === !0 || M === !0 && B !== !1) === !0 && (s = y + s + y), c += s;
1163
- } else if (s) {
1164
- if (typeof s != "string")
1165
- return [
1166
- Error(
1167
- `Formatter must return a string, null or undefined, got ${JSON.stringify(s)}`
1168
- )
1169
- ];
1170
- const R = d.length && s.indexOf(d) >= 0, k = y !== "" && s.indexOf(y) >= 0, U = s.indexOf(w) >= 0 && w !== y, wr = s.indexOf(pr) >= 0, xr = M && typeof x == "string";
1171
- let C = D && D.filter((F) => typeof F == "string" ? s.indexOf(F) !== -1 : F.test(s));
1172
- if (C = C && C.length > 0, dr)
1173
- switch (s[0]) {
1174
- case "=":
1175
- case "+":
1176
- case "-":
1177
- case "@":
1178
- case " ":
1179
- case "\r":
1180
- case "=":
1181
- // Unicode '='
1182
- case "+":
1183
- // Unicode '+'
1184
- case "-":
1185
- // Unicode '-'
1186
- case "@":
1187
- s = `'${s}`;
1188
- break;
1189
- }
1190
- const V = k === !0 || R || wr || hr || xr || C;
1191
- if (V === !0 && U === !0) {
1192
- const F = w === "\\" ? new RegExp(w + w, "g") : new RegExp(w, "g");
1193
- s = s.replace(F, w + w);
1194
- }
1195
- if (k === !0) {
1196
- const F = new RegExp(y, "g");
1197
- s = s.replace(F, w + y);
1198
- }
1199
- V === !0 && (s = y + s + y), c += s;
1200
- } else (B === !0 || x === "" && M === !0 && B !== !1) && (c += y + y);
1201
- a !== u.length - 1 && (c += d);
1202
- }
1203
- return [void 0, c];
1204
- },
1205
- bom: function(i) {
1206
- this.options.bom === !0 && i(ue);
1207
- },
1208
- headers: function(i) {
1209
- if (this.options.header === !1 || this.options.columns === void 0)
1210
- return;
1211
- let t, o = this.options.columns.map((u) => u.header);
1212
- if (this.options.eof ? ([t, o] = this.stringify(o, !0), o += this.options.record_delimiter) : [t, o] = this.stringify(o), t) return t;
1213
- i(o);
1214
- },
1215
- __cast: function(i, t) {
1216
- const o = typeof i;
1217
- try {
1218
- return o === "string" ? [void 0, this.options.cast.string(i, t)] : o === "bigint" ? [void 0, this.options.cast.bigint(i, t)] : o === "number" ? [void 0, this.options.cast.number(i, t)] : o === "boolean" ? [void 0, this.options.cast.boolean(i, t)] : i instanceof Date ? [void 0, this.options.cast.date(i, t)] : o === "object" && i !== null ? [void 0, this.options.cast.object(i, t)] : [void 0, i, i];
1219
- } catch (u) {
1220
- return [u];
1221
- }
1222
- }
1223
- };
1224
- }, se = function(n, r = {}) {
1225
- const e = [], [i, t] = lr(r);
1226
- if (i !== void 0) throw i;
1227
- const c = fe(t, {
1228
- stop: !1
1229
- }, {
1230
- records: 0
1231
- });
1232
- for (const a of n) {
1233
- const l = c.__transform(a, function(h) {
1234
- e.push(h);
1235
- });
1236
- if (l !== void 0) throw l;
1237
- }
1238
- if (e.length === 0) {
1239
- c.bom((l) => {
1240
- e.push(l);
1241
- });
1242
- const a = c.headers((l) => {
1243
- e.push(l);
1244
- });
1245
- if (a !== void 0) throw a;
1246
- }
1247
- return e.join("");
1248
- };
1249
- export {
1250
- se as stringify
1251
- };