peachsim 0.1.2605 → 0.1.2606

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 (135) hide show
  1. package/dist-lib/agent-daemon-client.cjs +1 -1
  2. package/dist-lib/agent-events.cjs +1 -1
  3. package/dist-lib/attached-projects.cjs +1 -1
  4. package/dist-lib/auth/shared-session.cjs +1 -1
  5. package/dist-lib/backend-origin.cjs +1 -1
  6. package/dist-lib/beta.cjs +1 -1
  7. package/dist-lib/beta.mjs +2 -2
  8. package/dist-lib/bridge-constants.cjs +1 -1
  9. package/dist-lib/bridge-contract-input.cjs +1 -1
  10. package/dist-lib/bridge-contract-input.mjs +5 -5
  11. package/dist-lib/bridge-contract.cjs +1 -1
  12. package/dist-lib/bridge-contract.mjs +3 -3
  13. package/dist-lib/bundle-channel.cjs +711 -264
  14. package/dist-lib/capture-contract.cjs +1 -1
  15. package/dist-lib/capture-contract.mjs +3 -3
  16. package/dist-lib/cloud-contract.cjs +1 -1
  17. package/dist-lib/cloud-contract.mjs +3 -3
  18. package/dist-lib/cloud-test-args.cjs +1 -1
  19. package/dist-lib/cloud-test-args.mjs +2 -2
  20. package/dist-lib/cloud.cjs +1 -1
  21. package/dist-lib/cloud.mjs +7 -7
  22. package/dist-lib/config.cjs +1 -1
  23. package/dist-lib/config.mjs +5 -5
  24. package/dist-lib/detox/index.cjs +1 -1
  25. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  26. package/dist-lib/esm-chunks/{acorn-UNOYFUKI.mjs → acorn-UL7Z3WUQ.mjs} +3 -3
  27. package/dist-lib/esm-chunks/chunk-25LYRBSX.mjs +326 -0
  28. package/dist-lib/esm-chunks/{chunk-3XUIDCBF.mjs → chunk-34CIYRB7.mjs} +4 -4
  29. package/dist-lib/esm-chunks/{chunk-RJCM34J7.mjs → chunk-5ANQR24T.mjs} +1 -1
  30. package/dist-lib/esm-chunks/{chunk-GT54N3GG.mjs → chunk-5JMW5G3U.mjs} +1 -1
  31. package/dist-lib/esm-chunks/{chunk-YO756PYQ.mjs → chunk-66ESCMV3.mjs} +14 -16
  32. package/dist-lib/esm-chunks/{chunk-O55DZ2EL.mjs → chunk-B7AXR7WA.mjs} +1 -1
  33. package/dist-lib/esm-chunks/{chunk-M4G5YUO7.mjs → chunk-CPMK3DA6.mjs} +3 -3
  34. package/dist-lib/esm-chunks/{chunk-AYHTHFG4.mjs → chunk-E2TASYAA.mjs} +1 -1
  35. package/dist-lib/esm-chunks/{chunk-WSRPZF7M.mjs → chunk-EXB4QSQI.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-WB2EBX5Q.mjs → chunk-KWLQDES2.mjs} +1 -1
  37. package/dist-lib/esm-chunks/chunk-L7FPUZZO.mjs +32 -0
  38. package/dist-lib/esm-chunks/{chunk-FXONOT2L.mjs → chunk-MBCSJQRY.mjs} +1 -1
  39. package/dist-lib/esm-chunks/{chunk-LFN7VAPB.mjs → chunk-O6NRI4T2.mjs} +1 -1
  40. package/dist-lib/esm-chunks/{chunk-HHS4A7GI.mjs → chunk-O6ZNRBLB.mjs} +1 -1
  41. package/dist-lib/esm-chunks/{chunk-B54SPDLA.mjs → chunk-OB5XSLW6.mjs} +1 -1
  42. package/dist-lib/esm-chunks/{chunk-UPUOCALX.mjs → chunk-PLOV7VQQ.mjs} +1 -1
  43. package/dist-lib/esm-chunks/{chunk-M3V4F5OV.mjs → chunk-QFASF6EH.mjs} +5 -5
  44. package/dist-lib/esm-chunks/{chunk-7K33ENH6.mjs → chunk-RTPUFY2K.mjs} +5 -5
  45. package/dist-lib/esm-chunks/{chunk-VRQPEROV.mjs → chunk-TVICD24H.mjs} +1 -1
  46. package/dist-lib/esm-chunks/{chunk-AST6VA7D.mjs → chunk-VTZJPPTE.mjs} +1 -1
  47. package/dist-lib/esm-chunks/{chunk-LG76KUUO.mjs → chunk-WJKACRMG.mjs} +1 -1
  48. package/dist-lib/esm-chunks/{chunk-6TE7WLSF.mjs → chunk-XUWYWP35.mjs} +1 -1
  49. package/dist-lib/esm-chunks/{metro-layout-parser-YRBZCLVD.mjs → metro-layout-parser-OMUFYOJI.mjs} +3 -3
  50. package/dist-lib/esm-chunks/{swift-package-prebuilt-S7KR6TKE.mjs → swift-package-prebuilt-X7EZCX34.mjs} +10 -10
  51. package/dist-lib/esm-chunks/{swift-sdk-app-module-3JNA7PCB.mjs → swift-sdk-app-module-E3IF2XPD.mjs} +14 -14
  52. package/dist-lib/esm-chunks/{swift-sdk-image-3P4IUP2A.mjs → swift-sdk-image-57YYLNU6.mjs} +14 -14
  53. package/dist-lib/esm-chunks/{swift-sdk-image-producer-EA2RYBM4.mjs → swift-sdk-image-producer-DZOZTTDZ.mjs} +4 -4
  54. package/dist-lib/expo-swift-bundle.cjs +710 -263
  55. package/dist-lib/expo-swift-metadata.cjs +1 -1
  56. package/dist-lib/expo-swift-metadata.mjs +7 -7
  57. package/dist-lib/home-paths.cjs +1 -1
  58. package/dist-lib/host/bridge-host.cjs +724 -277
  59. package/dist-lib/host/fetch-proxy-handler.cjs +43 -37
  60. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  61. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
  62. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  63. package/dist-lib/host/websocket-proxy.cjs +1 -1
  64. package/dist-lib/index.cjs +1 -1
  65. package/dist-lib/kotlin-host.cjs +1 -1
  66. package/dist-lib/menu.cjs +1 -1
  67. package/dist-lib/menu.mjs +3 -3
  68. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  69. package/dist-lib/metro-fingerprint-registry.mjs +3 -3
  70. package/dist-lib/metro-production-bundle.cjs +1 -1
  71. package/dist-lib/metro-production-bundle.mjs +4 -4
  72. package/dist-lib/native-app-identity-project.cjs +537 -246
  73. package/dist-lib/native-app-identity-project.mjs +218 -1828
  74. package/dist-lib/native-app-identity.cjs +1 -1
  75. package/dist-lib/native-app-identity.mjs +6 -6
  76. package/dist-lib/native-firebase-metadata.cjs +1 -1
  77. package/dist-lib/native-firebase-metadata.mjs +3 -3
  78. package/dist-lib/pdfium-raster.cjs +1 -1
  79. package/dist-lib/pdfium-raster.mjs +2 -2
  80. package/dist-lib/plist.cjs +327 -15
  81. package/dist-lib/plist.mjs +13 -5
  82. package/dist-lib/profiles.cjs +1 -1
  83. package/dist-lib/public-brand.cjs +1 -1
  84. package/dist-lib/public-origins-lib-esm.json +82 -129
  85. package/dist-lib/public-origins-lib.json +69 -140
  86. package/dist-lib/react-native-host-modules.cjs +1 -1
  87. package/dist-lib/react-native-host-modules.mjs +2 -2
  88. package/dist-lib/reap-browser.cjs +1 -1
  89. package/dist-lib/scripts/dev-server-scanner.cjs +211 -3
  90. package/dist-lib/sdk.cjs +1 -1
  91. package/dist-lib/sdk.mjs +8 -8
  92. package/dist-lib/skills.cjs +740 -293
  93. package/dist-lib/swift-compile.cjs +3 -5
  94. package/dist-lib/swift-compile.mjs +10 -10
  95. package/dist-lib/swift-package.cjs +1 -1
  96. package/dist-lib/swift-package.mjs +3 -3
  97. package/dist-lib/swift-submit.cjs +1 -1
  98. package/dist-lib/swift-submit.mjs +6 -6
  99. package/dist-lib/swift-svg-raster.cjs +1 -1
  100. package/dist-lib/swift-svg-raster.mjs +2 -2
  101. package/dist-lib/swift-toolchain.cjs +1 -1
  102. package/dist-lib/swift.cjs +1 -1
  103. package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
  104. package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
  105. package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
  106. package/dist-lib/vendor/acorn.cjs +1 -1
  107. package/dist-lib/vendor/magic-string.cjs +1 -1
  108. package/dist-lib/vendor/stream-json.cjs +1 -1
  109. package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
  110. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
  111. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
  112. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
  113. package/dist-lib/vendor/sucrase.cjs +1 -1
  114. package/dist-lib/vendor/terser.cjs +1 -1
  115. package/dist-lib/vendor/valibot.cjs +1 -1
  116. package/dist-lib/vendor/ws.cjs +1 -1
  117. package/dist-lib/vendor/zod.cjs +1 -1
  118. package/dist-lib/worklet-executable.cjs +1 -1
  119. package/dist-lib/worklet-executable.mjs +3 -3
  120. package/package.json +1 -6
  121. package/src/bazel-project.ts +1 -1
  122. package/src/expo-native-prebuilt.ts +1 -1
  123. package/src/expo-workspace-exclusion.ts +1 -1
  124. package/src/gitignore.ts +175 -0
  125. package/src/intent-definition/plist-reader.ts +22 -168
  126. package/src/plist-bytes.ts +144 -2
  127. package/src/plist.ts +359 -2
  128. package/src/swift-compile.ts +4 -6
  129. package/src/xcode-project.ts +1 -1
  130. package/dist-lib/esm-chunks/chunk-OW4VRQKO.mjs +0 -10993
  131. package/dist-lib/esm-chunks/chunk-ZSHGFGW7.mjs +0 -65
  132. package/dist-lib/vendor/@xmldom/xmldom.cjs +0 -6481
  133. package/dist-lib/vendor/bplist-parser.cjs +0 -1589
  134. package/dist-lib/vendor/ignore.cjs +0 -455
  135. package/dist-lib/vendor/plist.cjs +0 -10978
@@ -1,24 +1,24 @@
1
- /*! peach v0.1.2605 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2606 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  import {
3
3
  swiftNativePin
4
- } from "./esm-chunks/chunk-7K33ENH6.mjs";
5
- import "./esm-chunks/chunk-AYHTHFG4.mjs";
6
- import "./esm-chunks/chunk-WSRPZF7M.mjs";
4
+ } from "./esm-chunks/chunk-RTPUFY2K.mjs";
5
+ import "./esm-chunks/chunk-E2TASYAA.mjs";
6
+ import "./esm-chunks/chunk-EXB4QSQI.mjs";
7
7
  import {
8
8
  NATIVE_GRAPH_SDK_VERSION,
9
9
  cacheDir
10
- } from "./esm-chunks/chunk-YO756PYQ.mjs";
10
+ } from "./esm-chunks/chunk-66ESCMV3.mjs";
11
11
  import {
12
12
  privateSwiftRelease,
13
13
  swiftEnvironment,
14
14
  swiftToolchainBin
15
- } from "./esm-chunks/chunk-B54SPDLA.mjs";
16
- import "./esm-chunks/chunk-LG76KUUO.mjs";
15
+ } from "./esm-chunks/chunk-OB5XSLW6.mjs";
16
+ import "./esm-chunks/chunk-WJKACRMG.mjs";
17
17
  import {
18
18
  SWIFT_OBJCXX_LANGUAGE_FLAG,
19
19
  isSwiftNativeTranslationUnit,
20
20
  moduleMapName
21
- } from "./esm-chunks/chunk-GT54N3GG.mjs";
21
+ } from "./esm-chunks/chunk-5JMW5G3U.mjs";
22
22
  import {
23
23
  androidMergedResourceValuesDirectory,
24
24
  extractNativeAppIdentityFromFiles,
@@ -36,1627 +36,161 @@ import {
36
36
  xcodeBuildFileBuildsForIos,
37
37
  xcodePathResolver,
38
38
  xcodeTargetMemberVisitor
39
- } from "./esm-chunks/chunk-3XUIDCBF.mjs";
40
- import "./esm-chunks/chunk-FXONOT2L.mjs";
39
+ } from "./esm-chunks/chunk-34CIYRB7.mjs";
40
+ import "./esm-chunks/chunk-MBCSJQRY.mjs";
41
41
  import {
42
+ buildPlist,
43
+ parsePlist,
42
44
  parsePlistSource,
43
- require_lib,
44
- require_plist
45
- } from "./esm-chunks/chunk-OW4VRQKO.mjs";
46
- import "./esm-chunks/chunk-HHS4A7GI.mjs";
47
- import "./esm-chunks/chunk-6TE7WLSF.mjs";
48
- import "./esm-chunks/chunk-O55DZ2EL.mjs";
45
+ parseXmlPlist
46
+ } from "./esm-chunks/chunk-25LYRBSX.mjs";
47
+ import "./esm-chunks/chunk-O6ZNRBLB.mjs";
48
+ import "./esm-chunks/chunk-XUWYWP35.mjs";
49
+ import "./esm-chunks/chunk-B7AXR7WA.mjs";
49
50
  import {
50
51
  isRecord
51
- } from "./esm-chunks/chunk-VRQPEROV.mjs";
52
+ } from "./esm-chunks/chunk-TVICD24H.mjs";
52
53
  import {
53
- __commonJS,
54
- __publicField,
55
- __require,
56
- __toESM
57
- } from "./esm-chunks/chunk-ZSHGFGW7.mjs";
54
+ __publicField
55
+ } from "./esm-chunks/chunk-L7FPUZZO.mjs";
58
56
 
59
- // ../../node_modules/big-integer/BigInteger.js
60
- var require_BigInteger = __commonJS({
61
- "../../node_modules/big-integer/BigInteger.js"(exports, module) {
62
- var bigInt = (function(undefined2) {
63
- "use strict";
64
- var BASE = 1e7, LOG_BASE = 7, MAX_INT = 9007199254740992, MAX_INT_ARR = smallToArray(MAX_INT), DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz";
65
- var supportsNativeBigInt = typeof BigInt === "function";
66
- function Integer(v, radix, alphabet, caseSensitive) {
67
- if (typeof v === "undefined") return Integer[0];
68
- if (typeof radix !== "undefined") return +radix === 10 && !alphabet ? parseValue(v) : parseBase(v, radix, alphabet, caseSensitive);
69
- return parseValue(v);
70
- }
71
- function BigInteger(value, sign) {
72
- this.value = value;
73
- this.sign = sign;
74
- this.isSmall = false;
75
- }
76
- BigInteger.prototype = Object.create(Integer.prototype);
77
- function SmallInteger(value) {
78
- this.value = value;
79
- this.sign = value < 0;
80
- this.isSmall = true;
81
- }
82
- SmallInteger.prototype = Object.create(Integer.prototype);
83
- function NativeBigInt(value) {
84
- this.value = value;
85
- }
86
- NativeBigInt.prototype = Object.create(Integer.prototype);
87
- function isPrecise(n) {
88
- return -MAX_INT < n && n < MAX_INT;
89
- }
90
- function smallToArray(n) {
91
- if (n < 1e7)
92
- return [n];
93
- if (n < 1e14)
94
- return [n % 1e7, Math.floor(n / 1e7)];
95
- return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)];
96
- }
97
- function arrayToSmall(arr) {
98
- trim(arr);
99
- var length = arr.length;
100
- if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) {
101
- switch (length) {
102
- case 0:
103
- return 0;
104
- case 1:
105
- return arr[0];
106
- case 2:
107
- return arr[0] + arr[1] * BASE;
108
- default:
109
- return arr[0] + (arr[1] + arr[2] * BASE) * BASE;
110
- }
111
- }
112
- return arr;
113
- }
114
- function trim(v) {
115
- var i2 = v.length;
116
- while (v[--i2] === 0) ;
117
- v.length = i2 + 1;
118
- }
119
- function createArray(length) {
120
- var x = new Array(length);
121
- var i2 = -1;
122
- while (++i2 < length) {
123
- x[i2] = 0;
124
- }
125
- return x;
126
- }
127
- function truncate(n) {
128
- if (n > 0) return Math.floor(n);
129
- return Math.ceil(n);
130
- }
131
- function add(a, b) {
132
- var l_a = a.length, l_b = b.length, r = new Array(l_a), carry = 0, base = BASE, sum, i2;
133
- for (i2 = 0; i2 < l_b; i2++) {
134
- sum = a[i2] + b[i2] + carry;
135
- carry = sum >= base ? 1 : 0;
136
- r[i2] = sum - carry * base;
137
- }
138
- while (i2 < l_a) {
139
- sum = a[i2] + carry;
140
- carry = sum === base ? 1 : 0;
141
- r[i2++] = sum - carry * base;
142
- }
143
- if (carry > 0) r.push(carry);
144
- return r;
145
- }
146
- function addAny(a, b) {
147
- if (a.length >= b.length) return add(a, b);
148
- return add(b, a);
149
- }
150
- function addSmall(a, carry) {
151
- var l = a.length, r = new Array(l), base = BASE, sum, i2;
152
- for (i2 = 0; i2 < l; i2++) {
153
- sum = a[i2] - base + carry;
154
- carry = Math.floor(sum / base);
155
- r[i2] = sum - carry * base;
156
- carry += 1;
157
- }
158
- while (carry > 0) {
159
- r[i2++] = carry % base;
160
- carry = Math.floor(carry / base);
161
- }
162
- return r;
163
- }
164
- BigInteger.prototype.add = function(v) {
165
- var n = parseValue(v);
166
- if (this.sign !== n.sign) {
167
- return this.subtract(n.negate());
168
- }
169
- var a = this.value, b = n.value;
170
- if (n.isSmall) {
171
- return new BigInteger(addSmall(a, Math.abs(b)), this.sign);
172
- }
173
- return new BigInteger(addAny(a, b), this.sign);
174
- };
175
- BigInteger.prototype.plus = BigInteger.prototype.add;
176
- SmallInteger.prototype.add = function(v) {
177
- var n = parseValue(v);
178
- var a = this.value;
179
- if (a < 0 !== n.sign) {
180
- return this.subtract(n.negate());
181
- }
182
- var b = n.value;
183
- if (n.isSmall) {
184
- if (isPrecise(a + b)) return new SmallInteger(a + b);
185
- b = smallToArray(Math.abs(b));
186
- }
187
- return new BigInteger(addSmall(b, Math.abs(a)), a < 0);
188
- };
189
- SmallInteger.prototype.plus = SmallInteger.prototype.add;
190
- NativeBigInt.prototype.add = function(v) {
191
- return new NativeBigInt(this.value + parseValue(v).value);
192
- };
193
- NativeBigInt.prototype.plus = NativeBigInt.prototype.add;
194
- function subtract(a, b) {
195
- var a_l = a.length, b_l = b.length, r = new Array(a_l), borrow = 0, base = BASE, i2, difference;
196
- for (i2 = 0; i2 < b_l; i2++) {
197
- difference = a[i2] - borrow - b[i2];
198
- if (difference < 0) {
199
- difference += base;
200
- borrow = 1;
201
- } else borrow = 0;
202
- r[i2] = difference;
203
- }
204
- for (i2 = b_l; i2 < a_l; i2++) {
205
- difference = a[i2] - borrow;
206
- if (difference < 0) difference += base;
207
- else {
208
- r[i2++] = difference;
209
- break;
210
- }
211
- r[i2] = difference;
212
- }
213
- for (; i2 < a_l; i2++) {
214
- r[i2] = a[i2];
215
- }
216
- trim(r);
217
- return r;
218
- }
219
- function subtractAny(a, b, sign) {
220
- var value;
221
- if (compareAbs(a, b) >= 0) {
222
- value = subtract(a, b);
223
- } else {
224
- value = subtract(b, a);
225
- sign = !sign;
226
- }
227
- value = arrayToSmall(value);
228
- if (typeof value === "number") {
229
- if (sign) value = -value;
230
- return new SmallInteger(value);
231
- }
232
- return new BigInteger(value, sign);
233
- }
234
- function subtractSmall(a, b, sign) {
235
- var l = a.length, r = new Array(l), carry = -b, base = BASE, i2, difference;
236
- for (i2 = 0; i2 < l; i2++) {
237
- difference = a[i2] + carry;
238
- carry = Math.floor(difference / base);
239
- difference %= base;
240
- r[i2] = difference < 0 ? difference + base : difference;
241
- }
242
- r = arrayToSmall(r);
243
- if (typeof r === "number") {
244
- if (sign) r = -r;
245
- return new SmallInteger(r);
246
- }
247
- return new BigInteger(r, sign);
248
- }
249
- BigInteger.prototype.subtract = function(v) {
250
- var n = parseValue(v);
251
- if (this.sign !== n.sign) {
252
- return this.add(n.negate());
253
- }
254
- var a = this.value, b = n.value;
255
- if (n.isSmall)
256
- return subtractSmall(a, Math.abs(b), this.sign);
257
- return subtractAny(a, b, this.sign);
258
- };
259
- BigInteger.prototype.minus = BigInteger.prototype.subtract;
260
- SmallInteger.prototype.subtract = function(v) {
261
- var n = parseValue(v);
262
- var a = this.value;
263
- if (a < 0 !== n.sign) {
264
- return this.add(n.negate());
265
- }
266
- var b = n.value;
267
- if (n.isSmall) {
268
- return new SmallInteger(a - b);
269
- }
270
- return subtractSmall(b, Math.abs(a), a >= 0);
271
- };
272
- SmallInteger.prototype.minus = SmallInteger.prototype.subtract;
273
- NativeBigInt.prototype.subtract = function(v) {
274
- return new NativeBigInt(this.value - parseValue(v).value);
275
- };
276
- NativeBigInt.prototype.minus = NativeBigInt.prototype.subtract;
277
- BigInteger.prototype.negate = function() {
278
- return new BigInteger(this.value, !this.sign);
279
- };
280
- SmallInteger.prototype.negate = function() {
281
- var sign = this.sign;
282
- var small = new SmallInteger(-this.value);
283
- small.sign = !sign;
284
- return small;
285
- };
286
- NativeBigInt.prototype.negate = function() {
287
- return new NativeBigInt(-this.value);
288
- };
289
- BigInteger.prototype.abs = function() {
290
- return new BigInteger(this.value, false);
291
- };
292
- SmallInteger.prototype.abs = function() {
293
- return new SmallInteger(Math.abs(this.value));
294
- };
295
- NativeBigInt.prototype.abs = function() {
296
- return new NativeBigInt(this.value >= 0 ? this.value : -this.value);
297
- };
298
- function multiplyLong(a, b) {
299
- var a_l = a.length, b_l = b.length, l = a_l + b_l, r = createArray(l), base = BASE, product, carry, i2, a_i, b_j;
300
- for (i2 = 0; i2 < a_l; ++i2) {
301
- a_i = a[i2];
302
- for (var j = 0; j < b_l; ++j) {
303
- b_j = b[j];
304
- product = a_i * b_j + r[i2 + j];
305
- carry = Math.floor(product / base);
306
- r[i2 + j] = product - carry * base;
307
- r[i2 + j + 1] += carry;
308
- }
309
- }
310
- trim(r);
311
- return r;
312
- }
313
- function multiplySmall(a, b) {
314
- var l = a.length, r = new Array(l), base = BASE, carry = 0, product, i2;
315
- for (i2 = 0; i2 < l; i2++) {
316
- product = a[i2] * b + carry;
317
- carry = Math.floor(product / base);
318
- r[i2] = product - carry * base;
319
- }
320
- while (carry > 0) {
321
- r[i2++] = carry % base;
322
- carry = Math.floor(carry / base);
323
- }
324
- return r;
325
- }
326
- function shiftLeft(x, n) {
327
- var r = [];
328
- while (n-- > 0) r.push(0);
329
- return r.concat(x);
330
- }
331
- function multiplyKaratsuba(x, y) {
332
- var n = Math.max(x.length, y.length);
333
- if (n <= 30) return multiplyLong(x, y);
334
- n = Math.ceil(n / 2);
335
- var b = x.slice(n), a = x.slice(0, n), d = y.slice(n), c = y.slice(0, n);
336
- var ac = multiplyKaratsuba(a, c), bd = multiplyKaratsuba(b, d), abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d));
337
- var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)), shiftLeft(bd, 2 * n));
338
- trim(product);
339
- return product;
340
- }
341
- function useKaratsuba(l1, l2) {
342
- return -0.012 * l1 - 0.012 * l2 + 15e-6 * l1 * l2 > 0;
343
- }
344
- BigInteger.prototype.multiply = function(v) {
345
- var n = parseValue(v), a = this.value, b = n.value, sign = this.sign !== n.sign, abs;
346
- if (n.isSmall) {
347
- if (b === 0) return Integer[0];
348
- if (b === 1) return this;
349
- if (b === -1) return this.negate();
350
- abs = Math.abs(b);
351
- if (abs < BASE) {
352
- return new BigInteger(multiplySmall(a, abs), sign);
353
- }
354
- b = smallToArray(abs);
355
- }
356
- if (useKaratsuba(a.length, b.length))
357
- return new BigInteger(multiplyKaratsuba(a, b), sign);
358
- return new BigInteger(multiplyLong(a, b), sign);
359
- };
360
- BigInteger.prototype.times = BigInteger.prototype.multiply;
361
- function multiplySmallAndArray(a, b, sign) {
362
- if (a < BASE) {
363
- return new BigInteger(multiplySmall(b, a), sign);
364
- }
365
- return new BigInteger(multiplyLong(b, smallToArray(a)), sign);
366
- }
367
- SmallInteger.prototype._multiplyBySmall = function(a) {
368
- if (isPrecise(a.value * this.value)) {
369
- return new SmallInteger(a.value * this.value);
370
- }
371
- return multiplySmallAndArray(Math.abs(a.value), smallToArray(Math.abs(this.value)), this.sign !== a.sign);
372
- };
373
- BigInteger.prototype._multiplyBySmall = function(a) {
374
- if (a.value === 0) return Integer[0];
375
- if (a.value === 1) return this;
376
- if (a.value === -1) return this.negate();
377
- return multiplySmallAndArray(Math.abs(a.value), this.value, this.sign !== a.sign);
378
- };
379
- SmallInteger.prototype.multiply = function(v) {
380
- return parseValue(v)._multiplyBySmall(this);
381
- };
382
- SmallInteger.prototype.times = SmallInteger.prototype.multiply;
383
- NativeBigInt.prototype.multiply = function(v) {
384
- return new NativeBigInt(this.value * parseValue(v).value);
385
- };
386
- NativeBigInt.prototype.times = NativeBigInt.prototype.multiply;
387
- function square(a) {
388
- var l = a.length, r = createArray(l + l), base = BASE, product, carry, i2, a_i, a_j;
389
- for (i2 = 0; i2 < l; i2++) {
390
- a_i = a[i2];
391
- carry = 0 - a_i * a_i;
392
- for (var j = i2; j < l; j++) {
393
- a_j = a[j];
394
- product = 2 * (a_i * a_j) + r[i2 + j] + carry;
395
- carry = Math.floor(product / base);
396
- r[i2 + j] = product - carry * base;
397
- }
398
- r[i2 + l] = carry;
399
- }
400
- trim(r);
401
- return r;
402
- }
403
- BigInteger.prototype.square = function() {
404
- return new BigInteger(square(this.value), false);
405
- };
406
- SmallInteger.prototype.square = function() {
407
- var value = this.value * this.value;
408
- if (isPrecise(value)) return new SmallInteger(value);
409
- return new BigInteger(square(smallToArray(Math.abs(this.value))), false);
410
- };
411
- NativeBigInt.prototype.square = function(v) {
412
- return new NativeBigInt(this.value * this.value);
413
- };
414
- function divMod1(a, b) {
415
- var a_l = a.length, b_l = b.length, base = BASE, result = createArray(b.length), divisorMostSignificantDigit = b[b_l - 1], lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)), remainder = multiplySmall(a, lambda), divisor = multiplySmall(b, lambda), quotientDigit, shift, carry, borrow, i2, l, q;
416
- if (remainder.length <= a_l) remainder.push(0);
417
- divisor.push(0);
418
- divisorMostSignificantDigit = divisor[b_l - 1];
419
- for (shift = a_l - b_l; shift >= 0; shift--) {
420
- quotientDigit = base - 1;
421
- if (remainder[shift + b_l] !== divisorMostSignificantDigit) {
422
- quotientDigit = Math.floor((remainder[shift + b_l] * base + remainder[shift + b_l - 1]) / divisorMostSignificantDigit);
423
- }
424
- carry = 0;
425
- borrow = 0;
426
- l = divisor.length;
427
- for (i2 = 0; i2 < l; i2++) {
428
- carry += quotientDigit * divisor[i2];
429
- q = Math.floor(carry / base);
430
- borrow += remainder[shift + i2] - (carry - q * base);
431
- carry = q;
432
- if (borrow < 0) {
433
- remainder[shift + i2] = borrow + base;
434
- borrow = -1;
435
- } else {
436
- remainder[shift + i2] = borrow;
437
- borrow = 0;
438
- }
439
- }
440
- while (borrow !== 0) {
441
- quotientDigit -= 1;
442
- carry = 0;
443
- for (i2 = 0; i2 < l; i2++) {
444
- carry += remainder[shift + i2] - base + divisor[i2];
445
- if (carry < 0) {
446
- remainder[shift + i2] = carry + base;
447
- carry = 0;
448
- } else {
449
- remainder[shift + i2] = carry;
450
- carry = 1;
451
- }
452
- }
453
- borrow += carry;
454
- }
455
- result[shift] = quotientDigit;
456
- }
457
- remainder = divModSmall(remainder, lambda)[0];
458
- return [arrayToSmall(result), arrayToSmall(remainder)];
459
- }
460
- function divMod2(a, b) {
461
- var a_l = a.length, b_l = b.length, result = [], part = [], base = BASE, guess, xlen, highx, highy, check;
462
- while (a_l) {
463
- part.unshift(a[--a_l]);
464
- trim(part);
465
- if (compareAbs(part, b) < 0) {
466
- result.push(0);
467
- continue;
468
- }
469
- xlen = part.length;
470
- highx = part[xlen - 1] * base + part[xlen - 2];
471
- highy = b[b_l - 1] * base + b[b_l - 2];
472
- if (xlen > b_l) {
473
- highx = (highx + 1) * base;
474
- }
475
- guess = Math.ceil(highx / highy);
476
- do {
477
- check = multiplySmall(b, guess);
478
- if (compareAbs(check, part) <= 0) break;
479
- guess--;
480
- } while (guess);
481
- result.push(guess);
482
- part = subtract(part, check);
483
- }
484
- result.reverse();
485
- return [arrayToSmall(result), arrayToSmall(part)];
486
- }
487
- function divModSmall(value, lambda) {
488
- var length = value.length, quotient = createArray(length), base = BASE, i2, q, remainder, divisor;
489
- remainder = 0;
490
- for (i2 = length - 1; i2 >= 0; --i2) {
491
- divisor = remainder * base + value[i2];
492
- q = truncate(divisor / lambda);
493
- remainder = divisor - q * lambda;
494
- quotient[i2] = q | 0;
495
- }
496
- return [quotient, remainder | 0];
497
- }
498
- function divModAny(self, v) {
499
- var value, n = parseValue(v);
500
- if (supportsNativeBigInt) {
501
- return [new NativeBigInt(self.value / n.value), new NativeBigInt(self.value % n.value)];
502
- }
503
- var a = self.value, b = n.value;
504
- var quotient;
505
- if (b === 0) throw new Error("Cannot divide by zero");
506
- if (self.isSmall) {
507
- if (n.isSmall) {
508
- return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)];
509
- }
510
- return [Integer[0], self];
511
- }
512
- if (n.isSmall) {
513
- if (b === 1) return [self, Integer[0]];
514
- if (b == -1) return [self.negate(), Integer[0]];
515
- var abs = Math.abs(b);
516
- if (abs < BASE) {
517
- value = divModSmall(a, abs);
518
- quotient = arrayToSmall(value[0]);
519
- var remainder = value[1];
520
- if (self.sign) remainder = -remainder;
521
- if (typeof quotient === "number") {
522
- if (self.sign !== n.sign) quotient = -quotient;
523
- return [new SmallInteger(quotient), new SmallInteger(remainder)];
524
- }
525
- return [new BigInteger(quotient, self.sign !== n.sign), new SmallInteger(remainder)];
526
- }
527
- b = smallToArray(abs);
528
- }
529
- var comparison = compareAbs(a, b);
530
- if (comparison === -1) return [Integer[0], self];
531
- if (comparison === 0) return [Integer[self.sign === n.sign ? 1 : -1], Integer[0]];
532
- if (a.length + b.length <= 200)
533
- value = divMod1(a, b);
534
- else value = divMod2(a, b);
535
- quotient = value[0];
536
- var qSign = self.sign !== n.sign, mod = value[1], mSign = self.sign;
537
- if (typeof quotient === "number") {
538
- if (qSign) quotient = -quotient;
539
- quotient = new SmallInteger(quotient);
540
- } else quotient = new BigInteger(quotient, qSign);
541
- if (typeof mod === "number") {
542
- if (mSign) mod = -mod;
543
- mod = new SmallInteger(mod);
544
- } else mod = new BigInteger(mod, mSign);
545
- return [quotient, mod];
546
- }
547
- BigInteger.prototype.divmod = function(v) {
548
- var result = divModAny(this, v);
549
- return {
550
- quotient: result[0],
551
- remainder: result[1]
552
- };
553
- };
554
- NativeBigInt.prototype.divmod = SmallInteger.prototype.divmod = BigInteger.prototype.divmod;
555
- BigInteger.prototype.divide = function(v) {
556
- return divModAny(this, v)[0];
557
- };
558
- NativeBigInt.prototype.over = NativeBigInt.prototype.divide = function(v) {
559
- return new NativeBigInt(this.value / parseValue(v).value);
560
- };
561
- SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide;
562
- BigInteger.prototype.mod = function(v) {
563
- return divModAny(this, v)[1];
564
- };
565
- NativeBigInt.prototype.mod = NativeBigInt.prototype.remainder = function(v) {
566
- return new NativeBigInt(this.value % parseValue(v).value);
567
- };
568
- SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod;
569
- BigInteger.prototype.pow = function(v) {
570
- var n = parseValue(v), a = this.value, b = n.value, value, x, y;
571
- if (b === 0) return Integer[1];
572
- if (a === 0) return Integer[0];
573
- if (a === 1) return Integer[1];
574
- if (a === -1) return n.isEven() ? Integer[1] : Integer[-1];
575
- if (n.sign) {
576
- return Integer[0];
577
- }
578
- if (!n.isSmall) throw new Error("The exponent " + n.toString() + " is too large.");
579
- if (this.isSmall) {
580
- if (isPrecise(value = Math.pow(a, b)))
581
- return new SmallInteger(truncate(value));
582
- }
583
- x = this;
584
- y = Integer[1];
585
- while (true) {
586
- if (b & true) {
587
- y = y.times(x);
588
- --b;
589
- }
590
- if (b === 0) break;
591
- b /= 2;
592
- x = x.square();
593
- }
594
- return y;
595
- };
596
- SmallInteger.prototype.pow = BigInteger.prototype.pow;
597
- NativeBigInt.prototype.pow = function(v) {
598
- var n = parseValue(v);
599
- var a = this.value, b = n.value;
600
- var _0 = BigInt(0), _1 = BigInt(1), _2 = BigInt(2);
601
- if (b === _0) return Integer[1];
602
- if (a === _0) return Integer[0];
603
- if (a === _1) return Integer[1];
604
- if (a === BigInt(-1)) return n.isEven() ? Integer[1] : Integer[-1];
605
- if (n.isNegative()) return new NativeBigInt(_0);
606
- var x = this;
607
- var y = Integer[1];
608
- while (true) {
609
- if ((b & _1) === _1) {
610
- y = y.times(x);
611
- --b;
612
- }
613
- if (b === _0) break;
614
- b /= _2;
615
- x = x.square();
616
- }
617
- return y;
618
- };
619
- BigInteger.prototype.modPow = function(exp, mod) {
620
- exp = parseValue(exp);
621
- mod = parseValue(mod);
622
- if (mod.isZero()) throw new Error("Cannot take modPow with modulus 0");
623
- var r = Integer[1], base = this.mod(mod);
624
- if (exp.isNegative()) {
625
- exp = exp.multiply(Integer[-1]);
626
- base = base.modInv(mod);
627
- }
628
- while (exp.isPositive()) {
629
- if (base.isZero()) return Integer[0];
630
- if (exp.isOdd()) r = r.multiply(base).mod(mod);
631
- exp = exp.divide(2);
632
- base = base.square().mod(mod);
633
- }
634
- return r;
635
- };
636
- NativeBigInt.prototype.modPow = SmallInteger.prototype.modPow = BigInteger.prototype.modPow;
637
- function compareAbs(a, b) {
638
- if (a.length !== b.length) {
639
- return a.length > b.length ? 1 : -1;
640
- }
641
- for (var i2 = a.length - 1; i2 >= 0; i2--) {
642
- if (a[i2] !== b[i2]) return a[i2] > b[i2] ? 1 : -1;
643
- }
644
- return 0;
645
- }
646
- BigInteger.prototype.compareAbs = function(v) {
647
- var n = parseValue(v), a = this.value, b = n.value;
648
- if (n.isSmall) return 1;
649
- return compareAbs(a, b);
650
- };
651
- SmallInteger.prototype.compareAbs = function(v) {
652
- var n = parseValue(v), a = Math.abs(this.value), b = n.value;
653
- if (n.isSmall) {
654
- b = Math.abs(b);
655
- return a === b ? 0 : a > b ? 1 : -1;
656
- }
657
- return -1;
658
- };
659
- NativeBigInt.prototype.compareAbs = function(v) {
660
- var a = this.value;
661
- var b = parseValue(v).value;
662
- a = a >= 0 ? a : -a;
663
- b = b >= 0 ? b : -b;
664
- return a === b ? 0 : a > b ? 1 : -1;
665
- };
666
- BigInteger.prototype.compare = function(v) {
667
- if (v === Infinity) {
668
- return -1;
669
- }
670
- if (v === -Infinity) {
671
- return 1;
672
- }
673
- var n = parseValue(v), a = this.value, b = n.value;
674
- if (this.sign !== n.sign) {
675
- return n.sign ? 1 : -1;
676
- }
677
- if (n.isSmall) {
678
- return this.sign ? -1 : 1;
679
- }
680
- return compareAbs(a, b) * (this.sign ? -1 : 1);
681
- };
682
- BigInteger.prototype.compareTo = BigInteger.prototype.compare;
683
- SmallInteger.prototype.compare = function(v) {
684
- if (v === Infinity) {
685
- return -1;
686
- }
687
- if (v === -Infinity) {
688
- return 1;
689
- }
690
- var n = parseValue(v), a = this.value, b = n.value;
691
- if (n.isSmall) {
692
- return a == b ? 0 : a > b ? 1 : -1;
693
- }
694
- if (a < 0 !== n.sign) {
695
- return a < 0 ? -1 : 1;
696
- }
697
- return a < 0 ? 1 : -1;
698
- };
699
- SmallInteger.prototype.compareTo = SmallInteger.prototype.compare;
700
- NativeBigInt.prototype.compare = function(v) {
701
- if (v === Infinity) {
702
- return -1;
703
- }
704
- if (v === -Infinity) {
705
- return 1;
706
- }
707
- var a = this.value;
708
- var b = parseValue(v).value;
709
- return a === b ? 0 : a > b ? 1 : -1;
710
- };
711
- NativeBigInt.prototype.compareTo = NativeBigInt.prototype.compare;
712
- BigInteger.prototype.equals = function(v) {
713
- return this.compare(v) === 0;
714
- };
715
- NativeBigInt.prototype.eq = NativeBigInt.prototype.equals = SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals;
716
- BigInteger.prototype.notEquals = function(v) {
717
- return this.compare(v) !== 0;
718
- };
719
- NativeBigInt.prototype.neq = NativeBigInt.prototype.notEquals = SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals;
720
- BigInteger.prototype.greater = function(v) {
721
- return this.compare(v) > 0;
722
- };
723
- NativeBigInt.prototype.gt = NativeBigInt.prototype.greater = SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater;
724
- BigInteger.prototype.lesser = function(v) {
725
- return this.compare(v) < 0;
726
- };
727
- NativeBigInt.prototype.lt = NativeBigInt.prototype.lesser = SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser;
728
- BigInteger.prototype.greaterOrEquals = function(v) {
729
- return this.compare(v) >= 0;
730
- };
731
- NativeBigInt.prototype.geq = NativeBigInt.prototype.greaterOrEquals = SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals;
732
- BigInteger.prototype.lesserOrEquals = function(v) {
733
- return this.compare(v) <= 0;
734
- };
735
- NativeBigInt.prototype.leq = NativeBigInt.prototype.lesserOrEquals = SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals;
736
- BigInteger.prototype.isEven = function() {
737
- return (this.value[0] & 1) === 0;
738
- };
739
- SmallInteger.prototype.isEven = function() {
740
- return (this.value & 1) === 0;
741
- };
742
- NativeBigInt.prototype.isEven = function() {
743
- return (this.value & BigInt(1)) === BigInt(0);
744
- };
745
- BigInteger.prototype.isOdd = function() {
746
- return (this.value[0] & 1) === 1;
747
- };
748
- SmallInteger.prototype.isOdd = function() {
749
- return (this.value & 1) === 1;
750
- };
751
- NativeBigInt.prototype.isOdd = function() {
752
- return (this.value & BigInt(1)) === BigInt(1);
753
- };
754
- BigInteger.prototype.isPositive = function() {
755
- return !this.sign;
756
- };
757
- SmallInteger.prototype.isPositive = function() {
758
- return this.value > 0;
759
- };
760
- NativeBigInt.prototype.isPositive = SmallInteger.prototype.isPositive;
761
- BigInteger.prototype.isNegative = function() {
762
- return this.sign;
763
- };
764
- SmallInteger.prototype.isNegative = function() {
765
- return this.value < 0;
766
- };
767
- NativeBigInt.prototype.isNegative = SmallInteger.prototype.isNegative;
768
- BigInteger.prototype.isUnit = function() {
769
- return false;
770
- };
771
- SmallInteger.prototype.isUnit = function() {
772
- return Math.abs(this.value) === 1;
773
- };
774
- NativeBigInt.prototype.isUnit = function() {
775
- return this.abs().value === BigInt(1);
776
- };
777
- BigInteger.prototype.isZero = function() {
778
- return false;
779
- };
780
- SmallInteger.prototype.isZero = function() {
781
- return this.value === 0;
782
- };
783
- NativeBigInt.prototype.isZero = function() {
784
- return this.value === BigInt(0);
785
- };
786
- BigInteger.prototype.isDivisibleBy = function(v) {
787
- var n = parseValue(v);
788
- if (n.isZero()) return false;
789
- if (n.isUnit()) return true;
790
- if (n.compareAbs(2) === 0) return this.isEven();
791
- return this.mod(n).isZero();
792
- };
793
- NativeBigInt.prototype.isDivisibleBy = SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy;
794
- function isBasicPrime(v) {
795
- var n = v.abs();
796
- if (n.isUnit()) return false;
797
- if (n.equals(2) || n.equals(3) || n.equals(5)) return true;
798
- if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false;
799
- if (n.lesser(49)) return true;
800
- }
801
- function millerRabinTest(n, a) {
802
- var nPrev = n.prev(), b = nPrev, r = 0, d, t, i2, x;
803
- while (b.isEven()) b = b.divide(2), r++;
804
- next: for (i2 = 0; i2 < a.length; i2++) {
805
- if (n.lesser(a[i2])) continue;
806
- x = bigInt(a[i2]).modPow(b, n);
807
- if (x.isUnit() || x.equals(nPrev)) continue;
808
- for (d = r - 1; d != 0; d--) {
809
- x = x.square().mod(n);
810
- if (x.isUnit()) return false;
811
- if (x.equals(nPrev)) continue next;
812
- }
813
- return false;
814
- }
815
- return true;
816
- }
817
- BigInteger.prototype.isPrime = function(strict) {
818
- var isPrime = isBasicPrime(this);
819
- if (isPrime !== undefined2) return isPrime;
820
- var n = this.abs();
821
- var bits = n.bitLength();
822
- if (bits <= 64)
823
- return millerRabinTest(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]);
824
- var logN = Math.log(2) * bits.toJSNumber();
825
- var t = Math.ceil(strict === true ? 2 * Math.pow(logN, 2) : logN);
826
- for (var a = [], i2 = 0; i2 < t; i2++) {
827
- a.push(bigInt(i2 + 2));
828
- }
829
- return millerRabinTest(n, a);
830
- };
831
- NativeBigInt.prototype.isPrime = SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;
832
- BigInteger.prototype.isProbablePrime = function(iterations, rng) {
833
- var isPrime = isBasicPrime(this);
834
- if (isPrime !== undefined2) return isPrime;
835
- var n = this.abs();
836
- var t = iterations === undefined2 ? 5 : iterations;
837
- for (var a = [], i2 = 0; i2 < t; i2++) {
838
- a.push(bigInt.randBetween(2, n.minus(2), rng));
839
- }
840
- return millerRabinTest(n, a);
841
- };
842
- NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;
843
- BigInteger.prototype.modInv = function(n) {
844
- var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR;
845
- while (!newR.isZero()) {
846
- q = r.divide(newR);
847
- lastT = t;
848
- lastR = r;
849
- t = newT;
850
- r = newR;
851
- newT = lastT.subtract(q.multiply(newT));
852
- newR = lastR.subtract(q.multiply(newR));
853
- }
854
- if (!r.isUnit()) throw new Error(this.toString() + " and " + n.toString() + " are not co-prime");
855
- if (t.compare(0) === -1) {
856
- t = t.add(n);
857
- }
858
- if (this.isNegative()) {
859
- return t.negate();
860
- }
861
- return t;
862
- };
863
- NativeBigInt.prototype.modInv = SmallInteger.prototype.modInv = BigInteger.prototype.modInv;
864
- BigInteger.prototype.next = function() {
865
- var value = this.value;
866
- if (this.sign) {
867
- return subtractSmall(value, 1, this.sign);
868
- }
869
- return new BigInteger(addSmall(value, 1), this.sign);
870
- };
871
- SmallInteger.prototype.next = function() {
872
- var value = this.value;
873
- if (value + 1 < MAX_INT) return new SmallInteger(value + 1);
874
- return new BigInteger(MAX_INT_ARR, false);
875
- };
876
- NativeBigInt.prototype.next = function() {
877
- return new NativeBigInt(this.value + BigInt(1));
878
- };
879
- BigInteger.prototype.prev = function() {
880
- var value = this.value;
881
- if (this.sign) {
882
- return new BigInteger(addSmall(value, 1), true);
883
- }
884
- return subtractSmall(value, 1, this.sign);
885
- };
886
- SmallInteger.prototype.prev = function() {
887
- var value = this.value;
888
- if (value - 1 > -MAX_INT) return new SmallInteger(value - 1);
889
- return new BigInteger(MAX_INT_ARR, true);
890
- };
891
- NativeBigInt.prototype.prev = function() {
892
- return new NativeBigInt(this.value - BigInt(1));
893
- };
894
- var powersOfTwo = [1];
895
- while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE) powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);
896
- var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1];
897
- function shift_isSmall(n) {
898
- return Math.abs(n) <= BASE;
899
- }
900
- BigInteger.prototype.shiftLeft = function(v) {
901
- var n = parseValue(v).toJSNumber();
902
- if (!shift_isSmall(n)) {
903
- throw new Error(String(n) + " is too large for shifting.");
904
- }
905
- if (n < 0) return this.shiftRight(-n);
906
- var result = this;
907
- if (result.isZero()) return result;
908
- while (n >= powers2Length) {
909
- result = result.multiply(highestPower2);
910
- n -= powers2Length - 1;
911
- }
912
- return result.multiply(powersOfTwo[n]);
913
- };
914
- NativeBigInt.prototype.shiftLeft = SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft;
915
- BigInteger.prototype.shiftRight = function(v) {
916
- var remQuo;
917
- var n = parseValue(v).toJSNumber();
918
- if (!shift_isSmall(n)) {
919
- throw new Error(String(n) + " is too large for shifting.");
920
- }
921
- if (n < 0) return this.shiftLeft(-n);
922
- var result = this;
923
- while (n >= powers2Length) {
924
- if (result.isZero() || result.isNegative() && result.isUnit()) return result;
925
- remQuo = divModAny(result, highestPower2);
926
- result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];
927
- n -= powers2Length - 1;
928
- }
929
- remQuo = divModAny(result, powersOfTwo[n]);
930
- return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];
931
- };
932
- NativeBigInt.prototype.shiftRight = SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight;
933
- function bitwise(x, y, fn) {
934
- y = parseValue(y);
935
- var xSign = x.isNegative(), ySign = y.isNegative();
936
- var xRem = xSign ? x.not() : x, yRem = ySign ? y.not() : y;
937
- var xDigit = 0, yDigit = 0;
938
- var xDivMod = null, yDivMod = null;
939
- var result = [];
940
- while (!xRem.isZero() || !yRem.isZero()) {
941
- xDivMod = divModAny(xRem, highestPower2);
942
- xDigit = xDivMod[1].toJSNumber();
943
- if (xSign) {
944
- xDigit = highestPower2 - 1 - xDigit;
945
- }
946
- yDivMod = divModAny(yRem, highestPower2);
947
- yDigit = yDivMod[1].toJSNumber();
948
- if (ySign) {
949
- yDigit = highestPower2 - 1 - yDigit;
950
- }
951
- xRem = xDivMod[0];
952
- yRem = yDivMod[0];
953
- result.push(fn(xDigit, yDigit));
954
- }
955
- var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0);
956
- for (var i2 = result.length - 1; i2 >= 0; i2 -= 1) {
957
- sum = sum.multiply(highestPower2).add(bigInt(result[i2]));
958
- }
959
- return sum;
960
- }
961
- BigInteger.prototype.not = function() {
962
- return this.negate().prev();
963
- };
964
- NativeBigInt.prototype.not = SmallInteger.prototype.not = BigInteger.prototype.not;
965
- BigInteger.prototype.and = function(n) {
966
- return bitwise(this, n, function(a, b) {
967
- return a & b;
968
- });
969
- };
970
- NativeBigInt.prototype.and = SmallInteger.prototype.and = BigInteger.prototype.and;
971
- BigInteger.prototype.or = function(n) {
972
- return bitwise(this, n, function(a, b) {
973
- return a | b;
974
- });
975
- };
976
- NativeBigInt.prototype.or = SmallInteger.prototype.or = BigInteger.prototype.or;
977
- BigInteger.prototype.xor = function(n) {
978
- return bitwise(this, n, function(a, b) {
979
- return a ^ b;
980
- });
981
- };
982
- NativeBigInt.prototype.xor = SmallInteger.prototype.xor = BigInteger.prototype.xor;
983
- var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE & -BASE) * (BASE & -BASE) | LOBMASK_I;
984
- function roughLOB(n) {
985
- var v = n.value, x = typeof v === "number" ? v | LOBMASK_I : typeof v === "bigint" ? v | BigInt(LOBMASK_I) : v[0] + v[1] * BASE | LOBMASK_BI;
986
- return x & -x;
987
- }
988
- function integerLogarithm(value, base) {
989
- if (base.compareTo(value) <= 0) {
990
- var tmp = integerLogarithm(value, base.square(base));
991
- var p = tmp.p;
992
- var e = tmp.e;
993
- var t = p.multiply(base);
994
- return t.compareTo(value) <= 0 ? { p: t, e: e * 2 + 1 } : { p, e: e * 2 };
995
- }
996
- return { p: bigInt(1), e: 0 };
997
- }
998
- BigInteger.prototype.bitLength = function() {
999
- var n = this;
1000
- if (n.compareTo(bigInt(0)) < 0) {
1001
- n = n.negate().subtract(bigInt(1));
1002
- }
1003
- if (n.compareTo(bigInt(0)) === 0) {
1004
- return bigInt(0);
1005
- }
1006
- return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1));
1007
- };
1008
- NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength;
1009
- function max(a, b) {
1010
- a = parseValue(a);
1011
- b = parseValue(b);
1012
- return a.greater(b) ? a : b;
1013
- }
1014
- function min(a, b) {
1015
- a = parseValue(a);
1016
- b = parseValue(b);
1017
- return a.lesser(b) ? a : b;
1018
- }
1019
- function gcd(a, b) {
1020
- a = parseValue(a).abs();
1021
- b = parseValue(b).abs();
1022
- if (a.equals(b)) return a;
1023
- if (a.isZero()) return b;
1024
- if (b.isZero()) return a;
1025
- var c = Integer[1], d, t;
1026
- while (a.isEven() && b.isEven()) {
1027
- d = min(roughLOB(a), roughLOB(b));
1028
- a = a.divide(d);
1029
- b = b.divide(d);
1030
- c = c.multiply(d);
1031
- }
1032
- while (a.isEven()) {
1033
- a = a.divide(roughLOB(a));
1034
- }
1035
- do {
1036
- while (b.isEven()) {
1037
- b = b.divide(roughLOB(b));
1038
- }
1039
- if (a.greater(b)) {
1040
- t = b;
1041
- b = a;
1042
- a = t;
1043
- }
1044
- b = b.subtract(a);
1045
- } while (!b.isZero());
1046
- return c.isUnit() ? a : a.multiply(c);
1047
- }
1048
- function lcm(a, b) {
1049
- a = parseValue(a).abs();
1050
- b = parseValue(b).abs();
1051
- return a.divide(gcd(a, b)).multiply(b);
1052
- }
1053
- function randBetween(a, b, rng) {
1054
- a = parseValue(a);
1055
- b = parseValue(b);
1056
- var usedRNG = rng || Math.random;
1057
- var low = min(a, b), high = max(a, b);
1058
- var range = high.subtract(low).add(1);
1059
- if (range.isSmall) return low.add(Math.floor(usedRNG() * range));
1060
- var digits = toBase(range, BASE).value;
1061
- var result = [], restricted = true;
1062
- for (var i2 = 0; i2 < digits.length; i2++) {
1063
- var top = restricted ? digits[i2] + (i2 + 1 < digits.length ? digits[i2 + 1] / BASE : 0) : BASE;
1064
- var digit = truncate(usedRNG() * top);
1065
- result.push(digit);
1066
- if (digit < digits[i2]) restricted = false;
1067
- }
1068
- return low.add(Integer.fromArray(result, BASE, false));
1069
- }
1070
- var parseBase = function(text2, base, alphabet, caseSensitive) {
1071
- alphabet = alphabet || DEFAULT_ALPHABET;
1072
- text2 = String(text2);
1073
- if (!caseSensitive) {
1074
- text2 = text2.toLowerCase();
1075
- alphabet = alphabet.toLowerCase();
1076
- }
1077
- var length = text2.length;
1078
- var i2;
1079
- var absBase = Math.abs(base);
1080
- var alphabetValues = {};
1081
- for (i2 = 0; i2 < alphabet.length; i2++) {
1082
- alphabetValues[alphabet[i2]] = i2;
1083
- }
1084
- for (i2 = 0; i2 < length; i2++) {
1085
- var c = text2[i2];
1086
- if (c === "-") continue;
1087
- if (c in alphabetValues) {
1088
- if (alphabetValues[c] >= absBase) {
1089
- if (c === "1" && absBase === 1) continue;
1090
- throw new Error(c + " is not a valid digit in base " + base + ".");
1091
- }
1092
- }
1093
- }
1094
- base = parseValue(base);
1095
- var digits = [];
1096
- var isNegative = text2[0] === "-";
1097
- for (i2 = isNegative ? 1 : 0; i2 < text2.length; i2++) {
1098
- var c = text2[i2];
1099
- if (c in alphabetValues) digits.push(parseValue(alphabetValues[c]));
1100
- else if (c === "<") {
1101
- var start = i2;
1102
- do {
1103
- i2++;
1104
- } while (text2[i2] !== ">" && i2 < text2.length);
1105
- digits.push(parseValue(text2.slice(start + 1, i2)));
1106
- } else throw new Error(c + " is not a valid character");
1107
- }
1108
- return parseBaseFromArray(digits, base, isNegative);
1109
- };
1110
- function parseBaseFromArray(digits, base, isNegative) {
1111
- var val = Integer[0], pow = Integer[1], i2;
1112
- for (i2 = digits.length - 1; i2 >= 0; i2--) {
1113
- val = val.add(digits[i2].times(pow));
1114
- pow = pow.times(base);
1115
- }
1116
- return isNegative ? val.negate() : val;
1117
- }
1118
- function stringify(digit, alphabet) {
1119
- alphabet = alphabet || DEFAULT_ALPHABET;
1120
- if (digit < alphabet.length) {
1121
- return alphabet[digit];
1122
- }
1123
- return "<" + digit + ">";
1124
- }
1125
- function toBase(n, base) {
1126
- base = bigInt(base);
1127
- if (base.isZero()) {
1128
- if (n.isZero()) return { value: [0], isNegative: false };
1129
- throw new Error("Cannot convert nonzero numbers to base 0.");
1130
- }
1131
- if (base.equals(-1)) {
1132
- if (n.isZero()) return { value: [0], isNegative: false };
1133
- if (n.isNegative())
1134
- return {
1135
- value: [].concat.apply(
1136
- [],
1137
- Array.apply(null, Array(-n.toJSNumber())).map(Array.prototype.valueOf, [1, 0])
1138
- ),
1139
- isNegative: false
1140
- };
1141
- var arr = Array.apply(null, Array(n.toJSNumber() - 1)).map(Array.prototype.valueOf, [0, 1]);
1142
- arr.unshift([1]);
1143
- return {
1144
- value: [].concat.apply([], arr),
1145
- isNegative: false
1146
- };
1147
- }
1148
- var neg = false;
1149
- if (n.isNegative() && base.isPositive()) {
1150
- neg = true;
1151
- n = n.abs();
1152
- }
1153
- if (base.isUnit()) {
1154
- if (n.isZero()) return { value: [0], isNegative: false };
1155
- return {
1156
- value: Array.apply(null, Array(n.toJSNumber())).map(Number.prototype.valueOf, 1),
1157
- isNegative: neg
1158
- };
1159
- }
1160
- var out = [];
1161
- var left = n, divmod;
1162
- while (left.isNegative() || left.compareAbs(base) >= 0) {
1163
- divmod = left.divmod(base);
1164
- left = divmod.quotient;
1165
- var digit = divmod.remainder;
1166
- if (digit.isNegative()) {
1167
- digit = base.minus(digit).abs();
1168
- left = left.next();
1169
- }
1170
- out.push(digit.toJSNumber());
1171
- }
1172
- out.push(left.toJSNumber());
1173
- return { value: out.reverse(), isNegative: neg };
1174
- }
1175
- function toBaseString(n, base, alphabet) {
1176
- var arr = toBase(n, base);
1177
- return (arr.isNegative ? "-" : "") + arr.value.map(function(x) {
1178
- return stringify(x, alphabet);
1179
- }).join("");
1180
- }
1181
- BigInteger.prototype.toArray = function(radix) {
1182
- return toBase(this, radix);
1183
- };
1184
- SmallInteger.prototype.toArray = function(radix) {
1185
- return toBase(this, radix);
1186
- };
1187
- NativeBigInt.prototype.toArray = function(radix) {
1188
- return toBase(this, radix);
1189
- };
1190
- BigInteger.prototype.toString = function(radix, alphabet) {
1191
- if (radix === undefined2) radix = 10;
1192
- if (radix !== 10 || alphabet) return toBaseString(this, radix, alphabet);
1193
- var v = this.value, l = v.length, str2 = String(v[--l]), zeros = "0000000", digit;
1194
- while (--l >= 0) {
1195
- digit = String(v[l]);
1196
- str2 += zeros.slice(digit.length) + digit;
1197
- }
1198
- var sign = this.sign ? "-" : "";
1199
- return sign + str2;
1200
- };
1201
- SmallInteger.prototype.toString = function(radix, alphabet) {
1202
- if (radix === undefined2) radix = 10;
1203
- if (radix != 10 || alphabet) return toBaseString(this, radix, alphabet);
1204
- return String(this.value);
1205
- };
1206
- NativeBigInt.prototype.toString = SmallInteger.prototype.toString;
1207
- NativeBigInt.prototype.toJSON = BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function() {
1208
- return this.toString();
1209
- };
1210
- BigInteger.prototype.valueOf = function() {
1211
- return parseInt(this.toString(), 10);
1212
- };
1213
- BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf;
1214
- SmallInteger.prototype.valueOf = function() {
1215
- return this.value;
1216
- };
1217
- SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;
1218
- NativeBigInt.prototype.valueOf = NativeBigInt.prototype.toJSNumber = function() {
1219
- return parseInt(this.toString(), 10);
1220
- };
1221
- function parseStringValue(v) {
1222
- if (isPrecise(+v)) {
1223
- var x = +v;
1224
- if (x === truncate(x))
1225
- return supportsNativeBigInt ? new NativeBigInt(BigInt(x)) : new SmallInteger(x);
1226
- throw new Error("Invalid integer: " + v);
1227
- }
1228
- var sign = v[0] === "-";
1229
- if (sign) v = v.slice(1);
1230
- var split = v.split(/e/i);
1231
- if (split.length > 2) throw new Error("Invalid integer: " + split.join("e"));
1232
- if (split.length === 2) {
1233
- var exp = split[1];
1234
- if (exp[0] === "+") exp = exp.slice(1);
1235
- exp = +exp;
1236
- if (exp !== truncate(exp) || !isPrecise(exp)) throw new Error("Invalid integer: " + exp + " is not a valid exponent.");
1237
- var text2 = split[0];
1238
- var decimalPlace = text2.indexOf(".");
1239
- if (decimalPlace >= 0) {
1240
- exp -= text2.length - decimalPlace - 1;
1241
- text2 = text2.slice(0, decimalPlace) + text2.slice(decimalPlace + 1);
1242
- }
1243
- if (exp < 0) throw new Error("Cannot include negative exponent part for integers");
1244
- text2 += new Array(exp + 1).join("0");
1245
- v = text2;
1246
- }
1247
- var isValid = /^([0-9][0-9]*)$/.test(v);
1248
- if (!isValid) throw new Error("Invalid integer: " + v);
1249
- if (supportsNativeBigInt) {
1250
- return new NativeBigInt(BigInt(sign ? "-" + v : v));
1251
- }
1252
- var r = [], max2 = v.length, l = LOG_BASE, min2 = max2 - l;
1253
- while (max2 > 0) {
1254
- r.push(+v.slice(min2, max2));
1255
- min2 -= l;
1256
- if (min2 < 0) min2 = 0;
1257
- max2 -= l;
1258
- }
1259
- trim(r);
1260
- return new BigInteger(r, sign);
1261
- }
1262
- function parseNumberValue(v) {
1263
- if (supportsNativeBigInt) {
1264
- return new NativeBigInt(BigInt(v));
1265
- }
1266
- if (isPrecise(v)) {
1267
- if (v !== truncate(v)) throw new Error(v + " is not an integer.");
1268
- return new SmallInteger(v);
1269
- }
1270
- return parseStringValue(v.toString());
1271
- }
1272
- function parseValue(v) {
1273
- if (typeof v === "number") {
1274
- return parseNumberValue(v);
1275
- }
1276
- if (typeof v === "string") {
1277
- return parseStringValue(v);
1278
- }
1279
- if (typeof v === "bigint") {
1280
- return new NativeBigInt(v);
1281
- }
1282
- return v;
1283
- }
1284
- for (var i = 0; i < 1e3; i++) {
1285
- Integer[i] = parseValue(i);
1286
- if (i > 0) Integer[-i] = parseValue(-i);
1287
- }
1288
- Integer.one = Integer[1];
1289
- Integer.zero = Integer[0];
1290
- Integer.minusOne = Integer[-1];
1291
- Integer.max = max;
1292
- Integer.min = min;
1293
- Integer.gcd = gcd;
1294
- Integer.lcm = lcm;
1295
- Integer.isInstance = function(x) {
1296
- return x instanceof BigInteger || x instanceof SmallInteger || x instanceof NativeBigInt;
1297
- };
1298
- Integer.randBetween = randBetween;
1299
- Integer.fromArray = function(digits, base, isNegative) {
1300
- return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative);
1301
- };
1302
- return Integer;
1303
- })();
1304
- if (typeof module !== "undefined" && module.hasOwnProperty("exports")) {
1305
- module.exports = bigInt;
1306
- }
1307
- if (typeof define === "function" && define.amd) {
1308
- define(function() {
1309
- return bigInt;
1310
- });
57
+ // src/native-app-identity-project.ts
58
+ import fs7 from "node:fs";
59
+ import { createRequire as createRequire2 } from "node:module";
60
+ import path7 from "node:path";
61
+
62
+ // src/plist-bytes.ts
63
+ import assert from "node:assert/strict";
64
+ function defaultInteger(value) {
65
+ return value >= BigInt(Number.MIN_SAFE_INTEGER) && value <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(value) : value;
66
+ }
67
+ function parseBinaryPlist(source, options2 = {}) {
68
+ const bytes = Buffer.isBuffer(source) ? source : Buffer.from(source);
69
+ assert(bytes.length >= 40, "binary plist is too short");
70
+ assert(bytes.toString("ascii", 0, 8) === "bplist00", "invalid binary plist header");
71
+ const trailer = bytes.length - 32;
72
+ const offsetWidth = bytes[trailer + 6];
73
+ const refWidth = bytes[trailer + 7];
74
+ assert(offsetWidth > 0 && offsetWidth <= 8 && refWidth > 0 && refWidth <= 8);
75
+ const count = Number(bytes.readBigUInt64BE(trailer + 8));
76
+ const root = Number(bytes.readBigUInt64BE(trailer + 16));
77
+ const table = Number(bytes.readBigUInt64BE(trailer + 24));
78
+ assert(
79
+ table >= 8 && table < trailer && count > 0 && count <= (trailer - table) / offsetWidth
80
+ );
81
+ const unsigned = (at, width) => {
82
+ assert(at >= 8 && at + width <= trailer);
83
+ let result = 0n;
84
+ for (let i = at; i < at + width; i++) result = result * 256n + BigInt(bytes[i]);
85
+ return result;
86
+ };
87
+ const cache = /* @__PURE__ */ new Map();
88
+ const visiting = /* @__PURE__ */ new Set();
89
+ const visit = (ref) => {
90
+ assert(ref >= 0 && ref < count && !visiting.has(ref));
91
+ if (cache.has(ref)) return cache.get(ref);
92
+ visiting.add(ref);
93
+ const at = Number(unsigned(table + ref * offsetWidth, offsetWidth));
94
+ assert(at >= 8 && at < table);
95
+ const marker = bytes[at];
96
+ const type = marker >> 4;
97
+ let length = marker & 15;
98
+ let data = at + 1;
99
+ if (length === 15 && [4, 5, 6, 7, 10, 12, 13].includes(type)) {
100
+ assert(data < table && bytes[data] >> 4 === 1);
101
+ const width = 2 ** (bytes[data] & 15);
102
+ assert(width <= 8 && data + 1 + width <= table);
103
+ length = Number(unsigned(data + 1, width));
104
+ data += 1 + width;
1311
105
  }
1312
- }
1313
- });
1314
-
1315
- // ../../node_modules/bplist-parser/bplistParser.js
1316
- var require_bplistParser = __commonJS({
1317
- "../../node_modules/bplist-parser/bplistParser.js"(exports) {
1318
- "use strict";
1319
- var fs8 = __require("fs");
1320
- var bigInt = require_BigInteger();
1321
- var debug = false;
1322
- exports.maxObjectSize = 100 * 1e3 * 1e3;
1323
- exports.maxObjectCount = 32768;
1324
- var EPOCH = 9783072e5;
1325
- var UID = exports.UID = function(id) {
1326
- this.UID = id;
1327
- };
1328
- exports.parseFile = function(fileNameOrBuffer, callback) {
1329
- return new Promise(function(resolve, reject) {
1330
- function tryParseBuffer(buffer) {
1331
- let err = null;
1332
- let result;
1333
- try {
1334
- result = parseBuffer(buffer);
1335
- resolve(result);
1336
- } catch (ex) {
1337
- err = ex;
1338
- reject(err);
1339
- } finally {
1340
- if (callback) callback(err, result);
1341
- }
1342
- }
1343
- if (Buffer.isBuffer(fileNameOrBuffer)) {
1344
- return tryParseBuffer(fileNameOrBuffer);
1345
- }
1346
- fs8.readFile(fileNameOrBuffer, function(err, data) {
1347
- if (err) {
1348
- reject(err);
1349
- return callback(err);
1350
- }
1351
- tryParseBuffer(data);
1352
- });
1353
- });
106
+ const end = (size) => {
107
+ assert(Number.isSafeInteger(size) && data + size <= table);
108
+ return data + size;
1354
109
  };
1355
- exports.parseFileSync = function(fileNameOrBuffer) {
1356
- if (!Buffer.isBuffer(fileNameOrBuffer)) {
1357
- fileNameOrBuffer = fs8.readFileSync(fileNameOrBuffer);
1358
- }
1359
- return parseBuffer(fileNameOrBuffer);
110
+ const references = (total) => {
111
+ end(total * refWidth);
112
+ return Array.from(
113
+ { length: total },
114
+ (_, i) => visit(Number(unsigned(data + i * refWidth, refWidth)))
115
+ );
1360
116
  };
1361
- var parseBuffer = exports.parseBuffer = function(buffer) {
1362
- const header = buffer.slice(0, "bplist".length).toString("utf8");
1363
- if (header !== "bplist") {
1364
- throw new Error("Invalid binary plist. Expected 'bplist' at offset 0.");
1365
- }
1366
- const trailer = buffer.slice(buffer.length - 32, buffer.length);
1367
- const offsetSize = trailer.readUInt8(6);
1368
- if (debug) {
1369
- console.log("offsetSize: " + offsetSize);
1370
- }
1371
- const objectRefSize = trailer.readUInt8(7);
1372
- if (debug) {
1373
- console.log("objectRefSize: " + objectRefSize);
1374
- }
1375
- const numObjects = readUInt64BE(trailer, 8);
1376
- if (debug) {
1377
- console.log("numObjects: " + numObjects);
1378
- }
1379
- const topObject = readUInt64BE(trailer, 16);
1380
- if (debug) {
1381
- console.log("topObject: " + topObject);
1382
- }
1383
- const offsetTableOffset = readUInt64BE(trailer, 24);
1384
- if (debug) {
1385
- console.log("offsetTableOffset: " + offsetTableOffset);
1386
- }
1387
- if (numObjects > exports.maxObjectCount) {
1388
- throw new Error("maxObjectCount exceeded");
1389
- }
1390
- const offsetTable = [];
1391
- for (let i = 0; i < numObjects; i++) {
1392
- const offsetBytes = buffer.slice(offsetTableOffset + i * offsetSize, offsetTableOffset + (i + 1) * offsetSize);
1393
- offsetTable[i] = readUInt(offsetBytes, 0);
1394
- if (debug) {
1395
- console.log("Offset for Object #" + i + " is " + offsetTable[i] + " [" + offsetTable[i].toString(16) + "]");
117
+ let value;
118
+ switch (type) {
119
+ case 0:
120
+ if (!options2.strict && marker === 0) {
121
+ value = null;
122
+ break;
1396
123
  }
124
+ assert(marker === 8 || marker === 9);
125
+ value = marker === 9;
126
+ break;
127
+ case 1: {
128
+ const size = 2 ** length;
129
+ assert(size <= 16);
130
+ end(size);
131
+ const raw = unsigned(data, size);
132
+ const signed = size >= 8 ? BigInt.asIntN(size * 8, raw) : raw;
133
+ value = options2.onInteger ? options2.onInteger(signed) : defaultInteger(signed);
134
+ break;
1397
135
  }
1398
- function parseObject(tableOffset) {
1399
- const offset = offsetTable[tableOffset];
1400
- const type = buffer[offset];
1401
- const objType = (type & 240) >> 4;
1402
- const objInfo = type & 15;
1403
- switch (objType) {
1404
- case 0:
1405
- return parseSimple();
1406
- case 1:
1407
- return parseInteger();
1408
- case 8:
1409
- return parseUID();
1410
- case 2:
1411
- return parseReal();
1412
- case 3:
1413
- return parseDate();
1414
- case 4:
1415
- return parseData();
1416
- case 5:
1417
- return parsePlistString();
1418
- case 6:
1419
- return parsePlistString(true);
1420
- case 10:
1421
- return parseArray();
1422
- case 13:
1423
- return parseDictionary();
1424
- default:
1425
- throw new Error("Unhandled type 0x" + objType.toString(16));
1426
- }
1427
- function parseSimple() {
1428
- switch (objInfo) {
1429
- case 0:
1430
- return null;
1431
- case 8:
1432
- return false;
1433
- case 9:
1434
- return true;
1435
- case 15:
1436
- return null;
1437
- default:
1438
- throw new Error("Unhandled simple type 0x" + objType.toString(16));
1439
- }
1440
- }
1441
- function bufferToHexString(buffer2) {
1442
- let str2 = "";
1443
- let i;
1444
- for (i = 0; i < buffer2.length; i++) {
1445
- if (buffer2[i] != 0) {
1446
- break;
1447
- }
1448
- }
1449
- for (; i < buffer2.length; i++) {
1450
- const part = "00" + buffer2[i].toString(16);
1451
- str2 += part.substr(part.length - 2);
1452
- }
1453
- return str2;
1454
- }
1455
- function parseInteger() {
1456
- const length = Math.pow(2, objInfo);
1457
- if (length < exports.maxObjectSize) {
1458
- const data = buffer.slice(offset + 1, offset + 1 + length);
1459
- if (length === 16) {
1460
- const str2 = bufferToHexString(data);
1461
- return bigInt(str2, 16);
1462
- }
1463
- return data.reduce((acc, curr) => {
1464
- acc <<= 8;
1465
- acc |= curr & 255;
1466
- return acc;
1467
- });
1468
- }
1469
- throw new Error("Too little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
1470
- }
1471
- function parseUID() {
1472
- const length = objInfo + 1;
1473
- if (length < exports.maxObjectSize) {
1474
- return new UID(readUInt(buffer.slice(offset + 1, offset + 1 + length)));
1475
- }
1476
- throw new Error("Too little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
1477
- }
1478
- function parseReal() {
1479
- const length = Math.pow(2, objInfo);
1480
- if (length < exports.maxObjectSize) {
1481
- const realBuffer = buffer.slice(offset + 1, offset + 1 + length);
1482
- if (length === 4) {
1483
- return realBuffer.readFloatBE(0);
1484
- }
1485
- if (length === 8) {
1486
- return realBuffer.readDoubleBE(0);
1487
- }
1488
- } else {
1489
- throw new Error("Too little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
1490
- }
1491
- }
1492
- function parseDate() {
1493
- if (objInfo != 3) {
1494
- console.error("Unknown date type :" + objInfo + ". Parsing anyway...");
1495
- }
1496
- const dateBuffer = buffer.slice(offset + 1, offset + 9);
1497
- return new Date(EPOCH + 1e3 * dateBuffer.readDoubleBE(0));
1498
- }
1499
- function parseData() {
1500
- let dataoffset = 1;
1501
- let length = objInfo;
1502
- if (objInfo == 15) {
1503
- const int_type = buffer[offset + 1];
1504
- const intType = (int_type & 240) / 16;
1505
- if (intType != 1) {
1506
- console.error("0x4: UNEXPECTED LENGTH-INT TYPE! " + intType);
1507
- }
1508
- const intInfo = int_type & 15;
1509
- const intLength = Math.pow(2, intInfo);
1510
- dataoffset = 2 + intLength;
1511
- if (intLength < 3) {
1512
- length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
1513
- } else {
1514
- length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
1515
- }
1516
- }
1517
- if (length < exports.maxObjectSize) {
1518
- return buffer.slice(offset + dataoffset, offset + dataoffset + length);
1519
- }
1520
- throw new Error("Too little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
1521
- }
1522
- function parsePlistString(isUtf16) {
1523
- isUtf16 = isUtf16 || 0;
1524
- let enc = "utf8";
1525
- let length = objInfo;
1526
- let stroffset = 1;
1527
- if (objInfo == 15) {
1528
- const int_type = buffer[offset + 1];
1529
- const intType = (int_type & 240) / 16;
1530
- if (intType != 1) {
1531
- console.error("UNEXPECTED LENGTH-INT TYPE! " + intType);
1532
- }
1533
- const intInfo = int_type & 15;
1534
- const intLength = Math.pow(2, intInfo);
1535
- stroffset = 2 + intLength;
1536
- if (intLength < 3) {
1537
- length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
1538
- } else {
1539
- length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
1540
- }
1541
- }
1542
- length *= isUtf16 + 1;
1543
- if (length < exports.maxObjectSize) {
1544
- let plistString = Buffer.from(buffer.slice(offset + stroffset, offset + stroffset + length));
1545
- if (isUtf16) {
1546
- plistString = swapBytes(plistString);
1547
- enc = "ucs2";
1548
- }
1549
- return plistString.toString(enc);
1550
- }
1551
- throw new Error("Too little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
1552
- }
1553
- function parseArray() {
1554
- let length = objInfo;
1555
- let arrayoffset = 1;
1556
- if (objInfo == 15) {
1557
- const int_type = buffer[offset + 1];
1558
- const intType = (int_type & 240) / 16;
1559
- if (intType != 1) {
1560
- console.error("0xa: UNEXPECTED LENGTH-INT TYPE! " + intType);
1561
- }
1562
- const intInfo = int_type & 15;
1563
- const intLength = Math.pow(2, intInfo);
1564
- arrayoffset = 2 + intLength;
1565
- if (intLength < 3) {
1566
- length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
1567
- } else {
1568
- length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
1569
- }
1570
- }
1571
- if (length * objectRefSize > exports.maxObjectSize) {
1572
- throw new Error("Too little heap space available!");
1573
- }
1574
- const array2 = [];
1575
- for (let i = 0; i < length; i++) {
1576
- const objRef = readUInt(buffer.slice(offset + arrayoffset + i * objectRefSize, offset + arrayoffset + (i + 1) * objectRefSize));
1577
- array2[i] = parseObject(objRef);
1578
- }
1579
- return array2;
1580
- }
1581
- function parseDictionary() {
1582
- let length = objInfo;
1583
- let dictoffset = 1;
1584
- if (objInfo == 15) {
1585
- const int_type = buffer[offset + 1];
1586
- const intType = (int_type & 240) / 16;
1587
- if (intType != 1) {
1588
- console.error("0xD: UNEXPECTED LENGTH-INT TYPE! " + intType);
1589
- }
1590
- const intInfo = int_type & 15;
1591
- const intLength = Math.pow(2, intInfo);
1592
- dictoffset = 2 + intLength;
1593
- if (intLength < 3) {
1594
- length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
1595
- } else {
1596
- length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
1597
- }
1598
- }
1599
- if (length * 2 * objectRefSize > exports.maxObjectSize) {
1600
- throw new Error("Too little heap space available!");
1601
- }
1602
- if (debug) {
1603
- console.log("Parsing dictionary #" + tableOffset);
1604
- }
1605
- const dict = {};
1606
- for (let i = 0; i < length; i++) {
1607
- const keyRef = readUInt(buffer.slice(offset + dictoffset + i * objectRefSize, offset + dictoffset + (i + 1) * objectRefSize));
1608
- const valRef = readUInt(buffer.slice(offset + dictoffset + length * objectRefSize + i * objectRefSize, offset + dictoffset + length * objectRefSize + (i + 1) * objectRefSize));
1609
- const key = parseObject(keyRef);
1610
- const val = parseObject(valRef);
1611
- if (debug) {
1612
- console.log(" DICT #" + tableOffset + ": Mapped " + key + " to " + val);
1613
- }
1614
- dict[key] = val;
1615
- }
1616
- return dict;
1617
- }
136
+ case 2: {
137
+ assert(length === 2 || length === 3);
138
+ end(2 ** length);
139
+ const real = length === 2 ? bytes.readFloatBE(data) : bytes.readDoubleBE(data);
140
+ value = options2.onReal ? options2.onReal(real) : real;
141
+ break;
1618
142
  }
1619
- return [parseObject(topObject)];
1620
- };
1621
- function readUInt(buffer, start) {
1622
- start = start || 0;
1623
- let l = 0;
1624
- for (let i = start; i < buffer.length; i++) {
1625
- l <<= 8;
1626
- l |= buffer[i] & 255;
143
+ case 3:
144
+ assert(length === 3);
145
+ end(8);
146
+ value = new Date(Date.UTC(2001, 0, 1) + bytes.readDoubleBE(data) * 1e3);
147
+ break;
148
+ case 4:
149
+ value = bytes.subarray(data, end(length));
150
+ break;
151
+ case 5:
152
+ value = bytes.toString("ascii", data, end(length));
153
+ break;
154
+ case 6:
155
+ value = Buffer.from(bytes.subarray(data, end(length * 2))).swap16().toString("utf16le");
156
+ break;
157
+ case 7:
158
+ value = bytes.toString("utf8", data, end(length));
159
+ break;
160
+ case 8: {
161
+ if (options2.strict) throw new Error(`unsupported binary plist type ${type}`);
162
+ const size = length + 1;
163
+ assert(size >= 1 && size <= 8);
164
+ end(size);
165
+ value = { UID: Number(unsigned(data, size)) };
166
+ break;
1627
167
  }
1628
- return l;
1629
- }
1630
- function readUInt64BE(buffer, start) {
1631
- const data = buffer.slice(start, start + 8);
1632
- return data.readUInt32BE(4, 8);
1633
- }
1634
- function swapBytes(buffer) {
1635
- const len = buffer.length;
1636
- for (let i = 0; i < len; i += 2) {
1637
- const a = buffer[i];
1638
- buffer[i] = buffer[i + 1];
1639
- buffer[i + 1] = a;
168
+ case 10:
169
+ case 12:
170
+ value = references(length);
171
+ break;
172
+ case 13: {
173
+ const elements = references(length * 2);
174
+ const keys = elements.slice(0, length);
175
+ assert(keys.every((key) => typeof key === "string"));
176
+ value = Object.fromEntries(keys.map((key, i) => [key, elements[length + i]]));
177
+ break;
1640
178
  }
1641
- return buffer;
179
+ default:
180
+ throw new Error(`unsupported binary plist type ${type}`);
1642
181
  }
1643
- }
1644
- });
1645
-
1646
- // src/native-app-identity-project.ts
1647
- import fs7 from "node:fs";
1648
- import { createRequire as createRequire2 } from "node:module";
1649
- import path7 from "node:path";
1650
-
1651
- // src/plist-bytes.ts
1652
- var import_bplist_parser = __toESM(require_bplistParser(), 1);
182
+ visiting.delete(ref);
183
+ cache.set(ref, value);
184
+ return value;
185
+ };
186
+ return visit(root);
187
+ }
1653
188
  function parsePlistBytes(source, parseXml = parsePlistSource) {
1654
189
  const bytes = Buffer.from(source);
1655
- return bytes.subarray(0, 8).toString("ascii") === "bplist00" ? import_bplist_parser.default.parseBuffer(bytes)[0] : parseXml(bytes.toString("utf8"));
190
+ return bytes.subarray(0, 8).toString("ascii") === "bplist00" ? parseBinaryPlist(bytes) : parseXml(bytes.toString("utf8"));
1656
191
  }
1657
192
 
1658
193
  // src/xcode-project.ts
1659
- var import_plist3 = __toESM(require_plist(), 1);
1660
194
  import { execFileSync as execFileSync3, spawnSync } from "node:child_process";
1661
195
  import { createHash as createHash8 } from "node:crypto";
1662
196
  import fs6 from "node:fs";
@@ -1664,7 +198,6 @@ import { createRequire } from "node:module";
1664
198
  import path6 from "node:path";
1665
199
 
1666
200
  // src/bazel-project.ts
1667
- var import_plist2 = __toESM(require_plist(), 1);
1668
201
  import { execFileSync } from "node:child_process";
1669
202
  import { createHash } from "node:crypto";
1670
203
  import fs from "node:fs";
@@ -2102,7 +635,7 @@ function readBazelAppTarget(buildFile, targetName, configurationName, options2 =
2102
635
  const packageName = rule.attrs.get("package_name")?.value;
2103
636
  const importer = [
2104
637
  ...includes.flatMap((dir) => ["-Xcc", `-I${dir}`]),
2105
- ...inherited.flatMap((value) => value.defines).flatMap((define2) => ["-Xcc", `-D${define2}`]),
638
+ ...inherited.flatMap((value) => value.defines).flatMap((define) => ["-Xcc", `-D${define}`]),
2106
639
  // rules_swift hands swift each clang dependency's module map
2107
640
  ...[...new Set(inherited.flatMap((value) => value.moduleMaps))].flatMap((map) => [
2108
641
  "-Xcc",
@@ -2162,7 +695,7 @@ ${published.map(
2162
695
  if (!fs.existsSync(moduleMap) || fs.readFileSync(moduleMap, "utf8") !== text2)
2163
696
  fs.writeFileSync(moduleMap, text2);
2164
697
  const clangDefines = [...debug ? ["DEBUG=1"] : [], ...defines].map(
2165
- (define2) => `-D${define2}`
698
+ (define) => `-D${define}`
2166
699
  );
2167
700
  return {
2168
701
  ...base,
@@ -2446,7 +979,7 @@ ${published.map(
2446
979
  const contents = new Map([
2447
980
  [
2448
981
  "Info.plist",
2449
- import_plist2.default.build({
982
+ buildPlist({
2450
983
  AvailableLibraries: [
2451
984
  {
2452
985
  LibraryIdentifier: "ios-arm64-simulator",
@@ -2531,7 +1064,7 @@ ${published.map(
2531
1064
  const infoPlistReady = infoPlistFiles.every((file) => fs.existsSync(file));
2532
1065
  const info = {};
2533
1066
  for (const file of infoPlistReady ? infoPlistFiles : []) {
2534
- const fragment = import_plist2.default.parse(fs.readFileSync(file, "utf8"));
1067
+ const fragment = parsePlist(fs.readFileSync(file, "utf8"));
2535
1068
  if (!fragment || typeof fragment !== "object" || Array.isArray(fragment) || fragment instanceof Date || Buffer.isBuffer(fragment))
2536
1069
  throw new Error(`${file} is not a plist dictionary`);
2537
1070
  for (const [key, value] of Object.entries(fragment)) {
@@ -2600,7 +1133,7 @@ ${published.map(
2600
1133
  rootDir: root,
2601
1134
  projectFiles: buildFiles.sort(),
2602
1135
  projectDirs: [root],
2603
- infoPlist: infoPlistReady ? import_plist2.default.build(info) : null,
1136
+ infoPlist: infoPlistReady ? buildPlist(info) : null,
2604
1137
  infoPlistFile: null,
2605
1138
  postBundleScripts: [],
2606
1139
  appIconName: "",
@@ -2999,7 +1532,7 @@ import { join as join3, relative, sep } from "node:path";
2999
1532
  import { createHash as createHash3 } from "node:crypto";
3000
1533
  import { readFileSync } from "node:fs";
3001
1534
  import { join } from "node:path";
3002
- var swiftCoverageProvenance = true ? JSON.parse('{"swift-coverage/indexdump.ts":"0d82d8eeb96bf377f409ea7e33274c341a710c0e071f6b6e17571a23d8d92412","swift-coverage/indexing.ts":"633ccf19eec1f382a8847d0ee1dca42a2792a3c60aafd43622ed5152b09b8272","swift-coverage/types.ts":"bd8fae54ea6c53e110cd8a5d7b57c1d532dd0166e09fdaea63c4f270c3780dd1","swift-coverage/source.ts":"c151758a9f67631bc61473c375df0dc017da6902a34533b2cf4fc4fd7d19b6ee","swift-coverage/package.ts":"1f0068be7461fa7c5a7a891faf318f305cbed2e94c19667ba76627f7e5be260b","swift-coverage/xcode.ts":"d6a3228567a46c6d5280895383093889d9b868958a117881061bdd74729a225f","swift-coverage/xcode-assets.ts":"d98d6294b359528f7733b26db6f80f554782354faa235605f9562be4ad98b8a3","swift-coverage/xcode-asset-symbols.ts":"1b2a67733bc9d139b351466270205452a6172140bc25080d72619e2952c44671","swift-coverage/xcode-bridging.ts":"33184be8c5daf6646aa5a1276a4e15531f1be27b7c26f56550e0fbb1fc678a11","swift-coverage/xcode-packages.ts":"5c83f56357d880243ab485b260d23abd0094583ffa2287dac6e9e7eb18c3673d","swift-coverage/xcode-strings.ts":"facdbeb9de6bb12da4ab4954553edfaadd0e486f1181443138be70c3d8396236","swift-coverage/reader.ts":"da559b67ecd1161dea70c980b5f98f2c55af3550f0714479100fa5e9e813625c","swift-coverage/provenance.ts":"f5039c16e63c6129e22b71203f58982c68cef6e282a4f236b93da28edd39c108","swift-package-manifest.ts":"c64b677c93e48d61c71b371d887e9db8506c32ef968ed50d9468de1f67fe5d8d","swift-package.ts":"05c6cf101fbc944f6684a70db0a9c5aede846b2f0482a6b4a5a0abed737d4658","swift-source-file.ts":"8becce5e73b76a61d9d202c1ecfb39b1238e9bbf0e77841f1c51c98fa9ac7bd3","swift-toolchain.ts":"4f54e110f6f2f72da6d20ca6fc1a10c7dbd0cd462b7dd3959351e107c4aa7548","home-paths.ts":"d1606390f0e8e50f0ff72544eadb3d49dfabf08e004c1218f2998c36fb8995dd","xcode-header-search.ts":"c72b724fc497e4cf603c355f86eb3c07c929ad299758cffbc6ff88ed241654c6","xcode-project.ts":"81f36daeda9ac5c81a5631fdcab42fb12d09a74705915b8861f404d0db2e01c5","xcode-target-members.ts":"96f6a9f5567a4fbd9806252229b35b9a451a112b20f70f8c20189ffd428815fd","xcode-json-project.ts":"df6d6db28e0c8cfdf1f480e1e32d35f12c9cf1936642d5dda923889fb18a8fd6","openstep-plist.ts":"da11f86885ef1e25979ad989f332195c113c4b7a43f108e8d36646973430b81b"}') : swiftCoverageSourceDigests(join(import.meta.dirname, ".."));
1535
+ var swiftCoverageProvenance = true ? JSON.parse('{"swift-coverage/indexdump.ts":"0d82d8eeb96bf377f409ea7e33274c341a710c0e071f6b6e17571a23d8d92412","swift-coverage/indexing.ts":"633ccf19eec1f382a8847d0ee1dca42a2792a3c60aafd43622ed5152b09b8272","swift-coverage/types.ts":"bd8fae54ea6c53e110cd8a5d7b57c1d532dd0166e09fdaea63c4f270c3780dd1","swift-coverage/source.ts":"c151758a9f67631bc61473c375df0dc017da6902a34533b2cf4fc4fd7d19b6ee","swift-coverage/package.ts":"1f0068be7461fa7c5a7a891faf318f305cbed2e94c19667ba76627f7e5be260b","swift-coverage/xcode.ts":"d6a3228567a46c6d5280895383093889d9b868958a117881061bdd74729a225f","swift-coverage/xcode-assets.ts":"d98d6294b359528f7733b26db6f80f554782354faa235605f9562be4ad98b8a3","swift-coverage/xcode-asset-symbols.ts":"1b2a67733bc9d139b351466270205452a6172140bc25080d72619e2952c44671","swift-coverage/xcode-bridging.ts":"33184be8c5daf6646aa5a1276a4e15531f1be27b7c26f56550e0fbb1fc678a11","swift-coverage/xcode-packages.ts":"5c83f56357d880243ab485b260d23abd0094583ffa2287dac6e9e7eb18c3673d","swift-coverage/xcode-strings.ts":"facdbeb9de6bb12da4ab4954553edfaadd0e486f1181443138be70c3d8396236","swift-coverage/reader.ts":"da559b67ecd1161dea70c980b5f98f2c55af3550f0714479100fa5e9e813625c","swift-coverage/provenance.ts":"f5039c16e63c6129e22b71203f58982c68cef6e282a4f236b93da28edd39c108","swift-package-manifest.ts":"c64b677c93e48d61c71b371d887e9db8506c32ef968ed50d9468de1f67fe5d8d","swift-package.ts":"05c6cf101fbc944f6684a70db0a9c5aede846b2f0482a6b4a5a0abed737d4658","swift-source-file.ts":"8becce5e73b76a61d9d202c1ecfb39b1238e9bbf0e77841f1c51c98fa9ac7bd3","swift-toolchain.ts":"4f54e110f6f2f72da6d20ca6fc1a10c7dbd0cd462b7dd3959351e107c4aa7548","home-paths.ts":"d1606390f0e8e50f0ff72544eadb3d49dfabf08e004c1218f2998c36fb8995dd","xcode-header-search.ts":"c72b724fc497e4cf603c355f86eb3c07c929ad299758cffbc6ff88ed241654c6","xcode-project.ts":"fe50b74f53082e75bb32393ada42bbbcb0ff982024a026b4b673f2004dd404d8","xcode-target-members.ts":"96f6a9f5567a4fbd9806252229b35b9a451a112b20f70f8c20189ffd428815fd","xcode-json-project.ts":"df6d6db28e0c8cfdf1f480e1e32d35f12c9cf1936642d5dda923889fb18a8fd6","openstep-plist.ts":"da11f86885ef1e25979ad989f332195c113c4b7a43f108e8d36646973430b81b"}') : swiftCoverageSourceDigests(join(import.meta.dirname, ".."));
3003
1536
 
3004
1537
  // src/swift-coverage/xcode-asset-symbols.ts
3005
1538
  import { existsSync, readdirSync, readFileSync as readFileSync2 } from "node:fs";
@@ -3211,7 +1744,7 @@ import fs5 from "node:fs";
3211
1744
  import path4 from "node:path";
3212
1745
 
3213
1746
  // src/intent-definition/fields.ts
3214
- import assert from "node:assert/strict";
1747
+ import assert2 from "node:assert/strict";
3215
1748
 
3216
1749
  // src/intent-definition/system-types.ts
3217
1750
  var systemEnumHashes = /* @__PURE__ */ new Map([
@@ -3501,13 +2034,13 @@ function intentModelVersion(value) {
3501
2034
  return value === "1.0" || value === "1.1" ? value : "1.2";
3502
2035
  }
3503
2036
  function modelList(value, key) {
3504
- assert(value && typeof value === "object");
2037
+ assert2(value && typeof value === "object");
3505
2038
  const entries = Reflect.get(value, key) ?? [];
3506
- assert(Array.isArray(entries));
2039
+ assert2(Array.isArray(entries));
3507
2040
  return entries;
3508
2041
  }
3509
2042
  function identifier(value) {
3510
- assert(
2043
+ assert2(
3511
2044
  typeof value === "string" && /^[_\p{ID_Start}][_\p{ID_Continue}]*$/u.test(value),
3512
2045
  `invalid intent identifier ${String(value)}`
3513
2046
  );
@@ -3515,18 +2048,18 @@ function identifier(value) {
3515
2048
  }
3516
2049
  function intentClassIdentifier(value) {
3517
2050
  const name = identifier(value);
3518
- assert(/^[A-Za-z_0-9]+$/.test(name), `invalid intent class name ${name}`);
2051
+ assert2(/^[A-Za-z_0-9]+$/.test(name), `invalid intent class name ${name}`);
3519
2052
  return name;
3520
2053
  }
3521
2054
  function readSwiftField(value, key, customTypes) {
3522
- assert(value && typeof value === "object");
2055
+ assert2(value && typeof value === "object");
3523
2056
  const get = (property) => Reflect.get(value, key + property);
3524
2057
  const name = identifier(get("Name"));
3525
2058
  let kind = intentParameterKind(get("Type"));
3526
2059
  let enumeration = get("EnumType");
3527
2060
  let object = get("ObjectType");
3528
- assert(enumeration === void 0 || kind === "Integer");
3529
- assert(object === void 0 || kind === "Object");
2061
+ assert2(enumeration === void 0 || kind === "Integer");
2062
+ assert2(object === void 0 || kind === "Object");
3530
2063
  const custom = enumeration ?? object;
3531
2064
  let customName;
3532
2065
  if (custom !== void 0) {
@@ -3541,7 +2074,7 @@ function readSwiftField(value, key, customTypes) {
3541
2074
  }
3542
2075
  } else {
3543
2076
  customName = customTypes.get(name2);
3544
- assert(customName, "unknown intent parameter type: " + name2);
2077
+ assert2(customName, "unknown intent parameter type: " + name2);
3545
2078
  }
3546
2079
  }
3547
2080
  const type = types.get(kind);
@@ -3551,7 +2084,7 @@ function readSwiftField(value, key, customTypes) {
3551
2084
  const valueType = multiple ? `[${array2}]` : base;
3552
2085
  const resolves = get("SupportsResolution") === true;
3553
2086
  const explicitReasons = modelList(value, key + "UnsupportedReasons").map((entry) => {
3554
- assert(entry && typeof entry === "object");
2087
+ assert2(entry && typeof entry === "object");
3555
2088
  return identifier(Reflect.get(entry, key + "UnsupportedReasonCode"));
3556
2089
  });
3557
2090
  const defaults = resolves && !customName ? defaultUnsupportedReasons(kind) : [];
@@ -3642,7 +2175,7 @@ fatalError()
3642
2175
  }
3643
2176
  function customObjectFields(definition, customTypes) {
3644
2177
  return modelList(definition, "INTypeProperties").filter((entry) => {
3645
- assert(entry && typeof entry === "object");
2178
+ assert2(entry && typeof entry === "object");
3646
2179
  return Reflect.get(entry, "INTypePropertyDefault") !== true;
3647
2180
  }).map((entry) => {
3648
2181
  const field = readSwiftField(entry, "INTypeProperty", customTypes);
@@ -3651,11 +2184,11 @@ function customObjectFields(definition, customTypes) {
3651
2184
  }
3652
2185
 
3653
2186
  // src/intent-definition/metadata.ts
3654
- import assert3 from "node:assert/strict";
2187
+ import assert4 from "node:assert/strict";
3655
2188
  import { createHash as createHash6 } from "node:crypto";
3656
2189
 
3657
2190
  // src/intent-definition/hash-input.ts
3658
- import assert2 from "node:assert/strict";
2191
+ import assert3 from "node:assert/strict";
3659
2192
  var IntentReal = class {
3660
2193
  constructor(value) {
3661
2194
  this.value = value;
@@ -3689,7 +2222,7 @@ function intentHashInput(root, propertyTypes = []) {
3689
2222
  integer(18, BigInt(value.length));
3690
2223
  for (const item of value) append(item);
3691
2224
  } else {
3692
- assert2(
2225
+ assert3(
3693
2226
  value && typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype
3694
2227
  );
3695
2228
  const keys = Object.keys(value).sort();
@@ -3800,7 +2333,7 @@ var widgetArraySizes = {
3800
2333
  };
3801
2334
  function normalizedEnums(input) {
3802
2335
  return modelList(input, "INEnums").map((value) => {
3803
- assert3(dictionary(value));
2336
+ assert4(dictionary(value));
3804
2337
  return {
3805
2338
  ...value,
3806
2339
  INEnumName: intentClassIdentifier(value.INEnumName),
@@ -3818,7 +2351,7 @@ function localizationIdentifier(field, key) {
3818
2351
  }
3819
2352
  function normalizedMetadata(type, source, field) {
3820
2353
  const defaults = typeMetadata.get(type) ?? {};
3821
- assert3(source === void 0 || dictionary(source));
2354
+ assert4(source === void 0 || dictionary(source));
3822
2355
  const metadata = source ? { ...source } : Object.fromEntries(
3823
2356
  Object.entries(defaults).map(([key, value]) => {
3824
2357
  const qualified = `INIntentParameterMetadata${key}`;
@@ -3847,7 +2380,7 @@ var defaultReasonMessages = /* @__PURE__ */ new Map([
3847
2380
  function normalizedReasons(parameter, kind, field) {
3848
2381
  const reasons = /* @__PURE__ */ new Map();
3849
2382
  for (const reason of modelList(parameter, "INIntentParameterUnsupportedReasons")) {
3850
- assert3(dictionary(reason));
2383
+ assert4(dictionary(reason));
3851
2384
  const code = identifier(reason.INIntentParameterUnsupportedReasonCode);
3852
2385
  const text2 = reason.INIntentParameterUnsupportedReasonFormatString;
3853
2386
  reasons.set(
@@ -3884,17 +2417,17 @@ function compileIntentMetadata(input, enums, prefix) {
3884
2417
  }
3885
2418
  const objectHashes = /* @__PURE__ */ new Map();
3886
2419
  for (const declaration of modelList(input, "INTypes")) {
3887
- assert3(dictionary(declaration) && typeof declaration.INTypeName === "string");
2420
+ assert4(dictionary(declaration) && typeof declaration.INTypeName === "string");
3888
2421
  objectHashes.set(declaration.INTypeName, intentSipHash(intentHashInput(declaration)));
3889
2422
  }
3890
2423
  const intents = modelList(input, "INIntents").map((value) => {
3891
- assert3(dictionary(value));
2424
+ assert4(dictionary(value));
3892
2425
  const name = intentClassIdentifier(value.INIntentName);
3893
2426
  const system = value.INIntentType === "System";
3894
2427
  const propertyTypes = [];
3895
2428
  const parameters = modelList(value, "INIntentParameters").map(
3896
2429
  (parameter, position) => {
3897
- assert3(dictionary(parameter));
2430
+ assert4(dictionary(parameter));
3898
2431
  const enumName = parameter.INIntentParameterEnumType;
3899
2432
  const objectName = parameter.INIntentParameterObjectType;
3900
2433
  const reference = enumName ?? objectName;
@@ -3921,7 +2454,7 @@ function compileIntentMetadata(input, enums, prefix) {
3921
2454
  }
3922
2455
  } else {
3923
2456
  const localHash = hashes.get(typeName);
3924
- assert3(localHash !== void 0, `unknown intent parameter type: ${typeName}`);
2457
+ assert4(localHash !== void 0, `unknown intent parameter type: ${typeName}`);
3925
2458
  hash2 = localHash;
3926
2459
  }
3927
2460
  }
@@ -3947,7 +2480,7 @@ function compileIntentMetadata(input, enums, prefix) {
3947
2480
  if (parameter.INIntentParameterSupportsMultipleValues && parameter.INIntentParameterFixedSizeArray) {
3948
2481
  const sizes = /* @__PURE__ */ new Map();
3949
2482
  for (const size of modelList(parameter, "INIntentParameterArraySizes")) {
3950
- assert3(
2483
+ assert4(
3951
2484
  dictionary(size) && typeof size.INIntentParameterArraySizeSizeClass === "string"
3952
2485
  );
3953
2486
  sizes.set(size.INIntentParameterArraySizeSizeClass, size);
@@ -4071,7 +2604,7 @@ function formatPlistReal(value) {
4071
2604
  return `${sign}${digits.slice(0, point)}.${digits.slice(point)}`;
4072
2605
  }
4073
2606
  function writeIntentDefinition(input, prefix) {
4074
- assert3(dictionary(input));
2607
+ assert4(dictionary(input));
4075
2608
  const escape = (text2) => text2.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
4076
2609
  const lines = [
4077
2610
  '<?xml version="1.0" encoding="UTF-8"?>',
@@ -4108,7 +2641,7 @@ function writeIntentDefinition(input, prefix) {
4108
2641
  lines.push(`${indent}</array>`);
4109
2642
  }
4110
2643
  } else {
4111
- assert3(dictionary(value));
2644
+ assert4(dictionary(value));
4112
2645
  const keys = Object.keys(value).sort();
4113
2646
  if (keys.length === 0) lines.push(`${indent}<dict/>`);
4114
2647
  else {
@@ -4142,186 +2675,43 @@ function writeIntentDefinition(input, prefix) {
4142
2675
  }
4143
2676
 
4144
2677
  // src/intent-definition/plist-reader.ts
4145
- var import_xmldom = __toESM(require_lib(), 1);
4146
- import assert4 from "node:assert/strict";
2678
+ import assert5 from "node:assert/strict";
4147
2679
  function safeNumber(value) {
4148
2680
  return value >= BigInt(Number.MIN_SAFE_INTEGER) && value <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(value) : value;
4149
2681
  }
4150
2682
  function xmlPlist(bytes) {
4151
2683
  const encoding = bytes[0] === 255 && bytes[1] === 254 ? "utf-16le" : bytes[0] === 254 && bytes[1] === 255 ? "utf-16be" : "utf-8";
4152
2684
  const text2 = new TextDecoder(encoding, { fatal: true }).decode(bytes);
4153
- const document = new import_xmldom.DOMParser({
4154
- onError(_level, message) {
4155
- throw new Error(message);
4156
- }
4157
- }).parseFromString(text2, "application/xml");
4158
- const children = (element) => Array.from(element.children);
4159
- const contents = (element) => {
4160
- assert4(element.children.length === 0);
4161
- return element.textContent ?? "";
4162
- };
4163
- const visit = (element) => {
4164
- switch (element.tagName) {
4165
- case "dict": {
4166
- const entries = children(element);
4167
- assert4(entries.length % 2 === 0);
4168
- const pairs = [];
4169
- for (let i = 0; i < entries.length; i += 2) {
4170
- const key = entries[i];
4171
- assert4(key.tagName === "key");
4172
- pairs.push([contents(key), visit(entries[i + 1])]);
4173
- }
4174
- return Object.fromEntries(pairs);
4175
- }
4176
- case "array":
4177
- return children(element).map(visit);
4178
- case "string":
4179
- return contents(element);
4180
- case "integer": {
4181
- const value = contents(element).trim();
4182
- assert4(value.length > 0);
4183
- return safeNumber(BigInt(value));
4184
- }
4185
- case "real": {
4186
- const value = contents(element).trim();
4187
- assert4(value.length > 0);
4188
- return new IntentReal(
4189
- /^[+-]?inf(?:inity)?$/i.test(value) ? value.startsWith("-") ? -Infinity : Infinity : Number(value)
4190
- );
4191
- }
4192
- case "true":
4193
- return true;
4194
- case "false":
4195
- return false;
4196
- case "data":
4197
- return Buffer.from(contents(element), "base64");
4198
- case "date":
4199
- return new Date(contents(element));
4200
- default:
4201
- throw new Error(`unsupported plist element ${element.tagName}`);
4202
- }
4203
- };
4204
- const plist3 = document.documentElement;
4205
- assert4(plist3?.tagName === "plist" && plist3.children.length === 1);
4206
- return visit(plist3.children[0]);
4207
- }
4208
- function binaryPlist2(bytes) {
4209
- assert4(bytes.length >= 40);
4210
- const trailer = bytes.length - 32;
4211
- const offsetWidth = bytes[trailer + 6];
4212
- const refWidth = bytes[trailer + 7];
4213
- assert4(offsetWidth > 0 && offsetWidth <= 8 && refWidth > 0 && refWidth <= 8);
4214
- const count = Number(bytes.readBigUInt64BE(trailer + 8));
4215
- const root = Number(bytes.readBigUInt64BE(trailer + 16));
4216
- const table = Number(bytes.readBigUInt64BE(trailer + 24));
4217
- assert4(
4218
- table >= 8 && table < trailer && count > 0 && count <= (trailer - table) / offsetWidth
4219
- );
4220
- const unsigned = (at, width) => {
4221
- assert4(at >= 8 && at + width <= trailer);
4222
- let result = 0n;
4223
- for (let i = at; i < at + width; i++) result = result * 256n + BigInt(bytes[i]);
4224
- return result;
4225
- };
4226
- const cache = /* @__PURE__ */ new Map();
4227
- const visiting = /* @__PURE__ */ new Set();
4228
- const visit = (ref) => {
4229
- assert4(ref >= 0 && ref < count && !visiting.has(ref));
4230
- if (cache.has(ref)) return cache.get(ref);
4231
- visiting.add(ref);
4232
- const at = Number(unsigned(table + ref * offsetWidth, offsetWidth));
4233
- assert4(at >= 8 && at < table);
4234
- const marker = bytes[at];
4235
- const type = marker >> 4;
4236
- let length = marker & 15;
4237
- let data = at + 1;
4238
- if (length === 15 && [4, 5, 6, 7, 10, 13].includes(type)) {
4239
- assert4(data < table && bytes[data] >> 4 === 1);
4240
- const width = 2 ** (bytes[data] & 15);
4241
- assert4(width <= 8 && data + 1 + width <= table);
4242
- length = Number(unsigned(data + 1, width));
4243
- data += 1 + width;
4244
- }
4245
- const end = (size) => {
4246
- assert4(Number.isSafeInteger(size) && data + size <= table);
4247
- return data + size;
4248
- };
4249
- const references = (total) => {
4250
- end(total * refWidth);
4251
- return Array.from(
4252
- { length: total },
4253
- (_, i) => visit(Number(unsigned(data + i * refWidth, refWidth)))
2685
+ return parseXmlPlist(text2, {
2686
+ strict: true,
2687
+ onInteger(raw) {
2688
+ assert5(raw.length > 0);
2689
+ return safeNumber(BigInt(raw));
2690
+ },
2691
+ onReal(raw) {
2692
+ assert5(raw.length > 0);
2693
+ return new IntentReal(
2694
+ /^[+-]?inf(?:inity)?$/i.test(raw) ? raw.startsWith("-") ? -Infinity : Infinity : Number(raw)
4254
2695
  );
4255
- };
4256
- let value;
4257
- switch (type) {
4258
- case 0:
4259
- assert4(marker === 8 || marker === 9);
4260
- value = marker === 9;
4261
- break;
4262
- case 1: {
4263
- const size = 2 ** length;
4264
- assert4(size <= 16);
4265
- end(size);
4266
- const integer = unsigned(data, size);
4267
- value = safeNumber(size >= 8 ? BigInt.asIntN(size * 8, integer) : integer);
4268
- break;
4269
- }
4270
- case 2:
4271
- assert4(length === 2 || length === 3);
4272
- end(2 ** length);
4273
- value = new IntentReal(
4274
- length === 2 ? bytes.readFloatBE(data) : bytes.readDoubleBE(data)
4275
- );
4276
- break;
4277
- case 3:
4278
- assert4(length === 3);
4279
- end(8);
4280
- value = new Date(Date.UTC(2001, 0, 1) + bytes.readDoubleBE(data) * 1e3);
4281
- break;
4282
- case 4:
4283
- value = bytes.subarray(data, end(length));
4284
- break;
4285
- case 5:
4286
- value = bytes.toString("ascii", data, end(length));
4287
- break;
4288
- case 6:
4289
- value = Buffer.from(bytes.subarray(data, end(length * 2))).swap16().toString("utf16le");
4290
- break;
4291
- case 7:
4292
- value = bytes.toString("utf8", data, end(length));
4293
- break;
4294
- case 10:
4295
- value = references(length);
4296
- break;
4297
- case 13: {
4298
- const elements = references(length * 2);
4299
- const keys = elements.slice(0, length);
4300
- assert4(keys.every((key) => typeof key === "string"));
4301
- value = Object.fromEntries(keys.map((key, i) => [key, elements[length + i]]));
4302
- break;
4303
- }
4304
- default:
4305
- throw new Error(`unsupported binary plist type ${type}`);
4306
2696
  }
4307
- visiting.delete(ref);
4308
- cache.set(ref, value);
4309
- return value;
4310
- };
4311
- return visit(root);
2697
+ });
4312
2698
  }
4313
2699
  function parseIntentPlist(bytes) {
4314
- return bytes.toString("ascii", 0, 8) === "bplist00" ? binaryPlist2(bytes) : xmlPlist(bytes);
2700
+ return bytes.toString("ascii", 0, 8) === "bplist00" ? parseBinaryPlist(bytes, {
2701
+ strict: true,
2702
+ onInteger: safeNumber,
2703
+ onReal: (value) => new IntentReal(value)
2704
+ }) : xmlPlist(bytes);
4315
2705
  }
4316
2706
 
4317
2707
  // src/intent-definition/source.ts
4318
- import assert8 from "node:assert/strict";
2708
+ import assert9 from "node:assert/strict";
4319
2709
 
4320
2710
  // src/intent-definition/objective-c.ts
4321
- import assert6 from "node:assert/strict";
2711
+ import assert7 from "node:assert/strict";
4322
2712
 
4323
2713
  // src/intent-definition/response.ts
4324
- import assert5 from "node:assert/strict";
2714
+ import assert6 from "node:assert/strict";
4325
2715
  var responseCodes = [
4326
2716
  "unspecified",
4327
2717
  "ready",
@@ -4337,10 +2727,10 @@ function readIntentResponse(definition, customTypes) {
4337
2727
  );
4338
2728
  const definitions = new Map(
4339
2729
  modelList(definition, "INIntentResponseCodes").map((entry) => {
4340
- assert5(entry && typeof entry === "object");
2730
+ assert6(entry && typeof entry === "object");
4341
2731
  const name = identifier(Reflect.get(entry, "INIntentResponseCodeName"));
4342
2732
  const message = Reflect.get(entry, "INIntentResponseCodeFormatString");
4343
- assert5(message === void 0 || typeof message === "string");
2733
+ assert6(message === void 0 || typeof message === "string");
4344
2734
  const referenced = new Set(
4345
2735
  [
4346
2736
  ...String(message ?? "").matchAll(
@@ -4351,7 +2741,7 @@ function readIntentResponse(definition, customTypes) {
4351
2741
  const names = [...referenced].sort();
4352
2742
  const parameters = names.map((name2) => {
4353
2743
  const field = fields.find((field2) => field2.name === name2);
4354
- assert5(field, "unknown intent response field " + name2);
2744
+ assert6(field, "unknown intent response field " + name2);
4355
2745
  return field;
4356
2746
  });
4357
2747
  return [
@@ -4417,7 +2807,7 @@ var array = (element) => `NSArray<${element}> *`;
4417
2807
  function objcAvailability(swift) {
4418
2808
  if (!swift) return "";
4419
2809
  const version = /^@available\(iOS ([\d.]+), macOS ([\d.]+), watchOS ([\d.]+), \*\)$/.exec(swift);
4420
- assert6(version);
2810
+ assert7(version);
4421
2811
  return ` API_AVAILABLE(ios(${version[1]}), macos(${version[2]}), watchos(${version[3]}))`;
4422
2812
  }
4423
2813
  function objcElement(field) {
@@ -4446,7 +2836,7 @@ function headerImports(fields, visibility, module) {
4446
2836
  return [...imports].join("\n");
4447
2837
  }
4448
2838
  function objcIntentSource(name, prefix, definition, customTypes, version, visibility, module) {
4449
- assert6(definition && typeof definition === "object");
2839
+ assert7(definition && typeof definition === "object");
4450
2840
  const klass = prefix + name + "Intent";
4451
2841
  const response = klass + "Response";
4452
2842
  const attr = hidden(visibility);
@@ -4485,7 +2875,7 @@ function objcIntentSource(name, prefix, definition, customTypes, version, visibi
4485
2875
  };
4486
2876
  const constructors = [...definitions].filter(([, definition2]) => definition2.parameters.length > 0).map(([code, { parameters: parameters2, availability }]) => {
4487
2877
  const [first, ...rest] = parameters2;
4488
- assert6(first);
2878
+ assert7(first);
4489
2879
  const selector = `${code}IntentResponseWith${upper(first.name)}:(${objcType(first)})${first.name}` + rest.map((field) => ` ${field.name}:(${objcType(field)})${field.name}`).join("");
4490
2880
  return {
4491
2881
  code,
@@ -4583,15 +2973,15 @@ ${reasons.map(
4583
2973
  return { header, implementation };
4584
2974
  }
4585
2975
  function objcEnumSource(definition, label, prefix, visibility) {
4586
- assert6(definition && typeof definition === "object");
2976
+ assert7(definition && typeof definition === "object");
4587
2977
  const name = prefix + label;
4588
2978
  const attr = hidden(visibility);
4589
2979
  const bases = [attr, available].filter(Boolean).join(" ");
4590
2980
  const cases = modelList(definition, "INEnumValues").map((entry) => {
4591
- assert6(entry && typeof entry === "object");
2981
+ assert7(entry && typeof entry === "object");
4592
2982
  const value = identifier(Reflect.get(entry, "INEnumValueName"));
4593
2983
  const index = Reflect.get(entry, "INEnumValueIndex") ?? 0;
4594
- assert6(typeof index === "number" && Number.isSafeInteger(index));
2984
+ assert7(typeof index === "number" && Number.isSafeInteger(index));
4595
2985
  return ` ${name}${upper(value)} = ${index}`;
4596
2986
  });
4597
2987
  const success = `+ (instancetype)successWithResolved${label}:(${name})resolvedValue`;
@@ -4677,9 +3067,9 @@ ${confirm} {
4677
3067
  }
4678
3068
 
4679
3069
  // src/intent-definition/swift.ts
4680
- import assert7 from "node:assert/strict";
3070
+ import assert8 from "node:assert/strict";
4681
3071
  function swiftIntentSource(name, prefix, definition, customTypes, version, access) {
4682
- assert7(definition && typeof definition === "object");
3072
+ assert8(definition && typeof definition === "object");
4683
3073
  const klass = `${prefix}${name}Intent`;
4684
3074
  const response = `${klass}Response`;
4685
3075
  const parameters = modelList(definition, "INIntentParameters").map(
@@ -4783,17 +3173,17 @@ ${access} class func unsupported(forReason reason: ${base}UnsupportedReason) ->
4783
3173
 
4784
3174
  // src/intent-definition/source.ts
4785
3175
  function swiftEnumSource(definition, visibility, prefix = "") {
4786
- assert8(definition && typeof definition === "object");
3176
+ assert9(definition && typeof definition === "object");
4787
3177
  const unprefixed = identifier(Reflect.get(definition, "INEnumName"));
4788
3178
  const name = prefix + unprefixed;
4789
3179
  const values = Reflect.get(definition, "INEnumValues");
4790
- assert8(Array.isArray(values));
3180
+ assert9(Array.isArray(values));
4791
3181
  const access = visibility === "project" ? "internal" : "public";
4792
3182
  const cases = values.map((entry) => {
4793
- assert8(entry && typeof entry === "object");
3183
+ assert9(entry && typeof entry === "object");
4794
3184
  const name2 = identifier(Reflect.get(entry, "INEnumValueName"));
4795
3185
  const index = Reflect.get(entry, "INEnumValueIndex") ?? 0;
4796
- assert8(typeof index === "number" && Number.isSafeInteger(index));
3186
+ assert9(typeof index === "number" && Number.isSafeInteger(index));
4797
3187
  return ` case \`${name2}\` = ${index}`;
4798
3188
  });
4799
3189
  return `#if canImport(Intents)
@@ -4818,7 +3208,7 @@ ${access} class ${name}ResolutionResult: INEnumResolutionResult {
4818
3208
  `;
4819
3209
  }
4820
3210
  function emitIntentSource(definition, prefix, visibility, language, module) {
4821
- assert8(definition && typeof definition === "object");
3211
+ assert9(definition && typeof definition === "object");
4822
3212
  const intents = modelList(definition, "INIntents");
4823
3213
  const types2 = modelList(definition, "INTypes");
4824
3214
  const enums = modelList(definition, "INEnums");
@@ -4828,7 +3218,7 @@ function emitIntentSource(definition, prefix, visibility, language, module) {
4828
3218
  intentModelVersion(Reflect.get(definition, "INIntentDefinitionModelVersion"))
4829
3219
  );
4830
3220
  const nameOf = (entry, key) => {
4831
- assert8(entry && typeof entry === "object");
3221
+ assert9(entry && typeof entry === "object");
4832
3222
  return identifier(Reflect.get(entry, key));
4833
3223
  };
4834
3224
  const typeNames = types2.map((type) => nameOf(type, "INTypeName"));
@@ -4868,7 +3258,7 @@ function emitIntentSource(definition, prefix, visibility, language, module) {
4868
3258
  });
4869
3259
  }
4870
3260
  for (const intent of intents) {
4871
- assert8(intent && typeof intent === "object");
3261
+ assert9(intent && typeof intent === "object");
4872
3262
  if (Reflect.get(intent, "INIntentType") === "System") continue;
4873
3263
  const name = identifier(Reflect.get(intent, "INIntentName"));
4874
3264
  const filename = `${prefix}${name}Intent`;
@@ -5642,7 +4032,7 @@ function expandValue(value, settings) {
5642
4032
  return value;
5643
4033
  }
5644
4034
  function processedInfoPlist(name, file, settings, settingKeys) {
5645
- const source = file ? import_plist3.default.parse(fs6.readFileSync(file, "utf8")) : {};
4035
+ const source = file ? parsePlist(fs6.readFileSync(file, "utf8")) : {};
5646
4036
  if (!source || typeof source !== "object" || Array.isArray(source) || source instanceof Date || Buffer.isBuffer(source))
5647
4037
  throw new Error(`${name} Info.plist must contain a dictionary`);
5648
4038
  const info = {};
@@ -6217,7 +4607,7 @@ ${output}`
6217
4607
  );
6218
4608
  let launchName = settings("INFOPLIST_KEY_UILaunchStoryboardName");
6219
4609
  if (process.platform !== "darwin" && !launchName && infoPlistOutput && fs6.existsSync(infoPlistOutput)) {
6220
- const info = import_plist3.default.parse(fs6.readFileSync(infoPlistOutput, "utf8"));
4610
+ const info = parsePlist(fs6.readFileSync(infoPlistOutput, "utf8"));
6221
4611
  const declared = isRecord(info) ? info.UILaunchStoryboardName : void 0;
6222
4612
  if (typeof declared === "string") launchName = expand(declared, settings);
6223
4613
  }
@@ -7251,7 +5641,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
7251
5641
  }
7252
5642
  return {
7253
5643
  ref,
7254
- framework: Object.assign(module2, { frameworkInfoPlist: import_plist3.default.build(info2) })
5644
+ framework: Object.assign(module2, { frameworkInfoPlist: buildPlist(info2) })
7255
5645
  };
7256
5646
  });
7257
5647
  const frameworks = frameworkTargets.map(({ framework }) => framework);
@@ -7318,9 +5708,9 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
7318
5708
  path: bundlePath,
7319
5709
  ...product ? {
7320
5710
  resources: product.module.resources,
7321
- infoPlist: import_plist3.default.build(
5711
+ infoPlist: buildPlist(
7322
5712
  expandValue(
7323
- import_plist3.default.parse(fs6.readFileSync(infoFile, "utf8")),
5713
+ parsePlist(fs6.readFileSync(infoFile, "utf8")),
7324
5714
  product.productSettings
7325
5715
  )
7326
5716
  )
@@ -7342,7 +5732,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
7342
5732
  settingKeys
7343
5733
  );
7344
5734
  const bundleIdentifier = productSettings("PRODUCT_BUNDLE_IDENTIFIER") || (typeof info.CFBundleIdentifier === "string" ? info.CFBundleIdentifier : "");
7345
- const entitlements = entitlementsFile ? import_plist3.default.parse(fs6.readFileSync(entitlementsFile, "utf8")) : void 0;
5735
+ const entitlements = entitlementsFile ? parsePlist(fs6.readFileSync(entitlementsFile, "utf8")) : void 0;
7346
5736
  const keychainAccessGroups = entitlementsFile ? readKeychainAccessGroups(
7347
5737
  entitlements,
7348
5738
  (value) => expand(value, (key) => {
@@ -7688,7 +6078,7 @@ function readXcodeAppTarget(input, targetName, configurationName, options2 = {})
7688
6078
  ].sort(),
7689
6079
  projectDirs: [...new Set(used.map((project) => project.projectDir))].sort(),
7690
6080
  appIconName: settings("ASSETCATALOG_COMPILER_APPICON_NAME"),
7691
- infoPlist: infoPlistPending ? null : import_plist3.default.build(info),
6081
+ infoPlist: infoPlistPending ? null : buildPlist(info),
7692
6082
  infoPlistFile,
7693
6083
  ...keychainAccessGroups === void 0 ? {} : { keychainAccessGroups },
7694
6084
  siriEntitled: readSiriEntitlement(entitlements),