@northtalk/ts 0.2.0 → 0.4.0

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 (55) hide show
  1. package/README.md +16 -14
  2. package/{base64-DORMd3Hv.js → base64-Dtqaz_0A.js} +880 -409
  3. package/{binary-value-CEmh60GC.d.ts → binary-value-Bb6HPDtM.d.ts} +2 -2
  4. package/{capabilities-CH0FkRMq.js → capabilities-Bi5Qm6Fr.js} +39 -20
  5. package/{checker-Dc1jl2WH.js → checker-DMI4LiRm.js} +321 -112
  6. package/core-BzGUgjL6.d.ts +22 -0
  7. package/{debug-CQBxKnJB.d.ts → debug-C72o2pZy.d.ts} +506 -50
  8. package/debug.d.ts +3 -3
  9. package/debug.js +1 -1
  10. package/driver-ClV_UDEK.d.ts +63 -0
  11. package/driver.d.ts +2 -40
  12. package/driver.js +24 -4
  13. package/{encoding-nlrpj-Pb.js → encoding-C3Q7pIC9.js} +2 -2
  14. package/{engine-BGaJ9dAk.js → engine-BpdGfAND.js} +6 -6
  15. package/{engine-vbYInVYF.d.ts → engine-Dtby_FkE.d.ts} +3 -3
  16. package/{errors-LYJZ_c8h.js → errors-BKJES3Zu.js} +1060 -751
  17. package/{group-B742gg4T.js → group-vuUL2tq-.js} +6526 -1725
  18. package/http.d.ts +2 -2
  19. package/http.js +3 -3
  20. package/index-ByF5j53i.d.ts +779 -0
  21. package/index.d.ts +6 -651
  22. package/index.js +23 -15
  23. package/{http-capability-CSTkw1Yt.js → inline-grants-Cx0Z9XAt.js} +109 -24
  24. package/manifest-Dw-8Unmf.js +256 -0
  25. package/message-layer.d.ts +3 -3
  26. package/message-layer.js +2 -2
  27. package/notify.d.ts +2 -2
  28. package/notify.js +1 -1
  29. package/{objects-Db7IB5vQ.js → objects-BC4fS0vq.js} +1 -1
  30. package/{objects-DJ3QtCCs.d.ts → objects-Dnqor7Gn.d.ts} +12 -4
  31. package/{operation-promises-EgZXG5N_.js → operation-promises-ClA1BTaS.js} +10 -5
  32. package/package.json +2 -2
  33. package/{readers-CjJHKHvH.js → readers-B5e5bBrY.js} +2 -2
  34. package/{readers-BFPuosPk.d.ts → readers-DAFVvvq4.d.ts} +2 -2
  35. package/{request-pump-binary-DdY3X-yl.js → request-pump-binary-BjnyqXV5.js} +4 -4
  36. package/{router--71qvxtY.js → router-BCHEfs4x.js} +5 -5
  37. package/{router-Zhrw5l__.d.ts → router-BspOCPA0.d.ts} +3 -3
  38. package/session.d.ts +41 -3
  39. package/session.js +260 -179
  40. package/setup.d.ts +2 -2
  41. package/setup.js +4 -4
  42. package/sha256-9CGf5BS_.js +168 -0
  43. package/sqlite.d.ts +5 -5
  44. package/sqlite.js +27 -21
  45. package/{store-hJrRULMx.js → store-DTQa0lyE.js} +2 -2
  46. package/{store-capability-OZp4hXmj.js → store-capability-BxXgiRM7.js} +4 -4
  47. package/store.d.ts +3 -3
  48. package/store.js +2 -2
  49. package/{user-capability-BK4Asg7D.js → user-capability-5-IvCeZI.js} +5 -5
  50. package/wasm.d.ts +12 -8
  51. package/wasm.js +67 -39
  52. package/core-DptnvQT9.d.ts +0 -14
  53. package/manifest-BscyH_rW.d.ts +0 -70
  54. package/manifest-DjsxDSuB.js +0 -129
  55. package/sha256-B_kyYw3Z.js +0 -124
@@ -1,6 +1,6 @@
1
1
 
2
- import { $ as powerOf, $t as parseInstantText, A as listWithItem, At as mod, B as range, Bt as addMonths, Ct as decOf, Dt as formatDec, Et as divide, F as num, Ft as subtract, Gt as civilUs, Ht as civilDays, It as withinLimits, J as UnitError, K as text, Kt as dayOfYear, L as patternValue, Lt as DateRangeError, M as map, Mt as negate, N as mapWithEntry, Nt as powerInteger, O as list, Ot as integerOf, P as nothing, Pt as roundRatio, Q as parseUnit, R as quantity, Rt as US_PER_DAY, St as compareDec, T as instantOf, Tt as div, U as smallInteger, Ut as civilOfDays, Vt as checkInstant, W as smallNumber, Wt as civilOfUs, X as fromBase, Y as combine, Yt as isoWeek, Z as ownUnit, Zt as parseCivil, _ as dec, _t as simpleFold, b as extendList, bt as ArithmeticError, dt as characterBoundaries, en as weekday, et as sameDimension, f as bytesOf, ft as generalCategory, g as compareBytes, gt as scalarCount, h as civilOf, ht as normalizeNFC, j as literalDigits, jt as multiply, k as listValues, kt as isInteger, mt as lower, p as canonicalNumber, pt as isWhiteSpace, q as trimWhiteSpace, rt as unitText, tt as toBase, u as bool, ut as assertScalarText, v as decimalParts, vt as upper, wt as digitsOf, xt as add, y as displayText, z as quantityOf, zt as US_PER_SECOND } from "./errors-LYJZ_c8h.js";
3
- import { d as shapeDiagnostics, g as runTask, l as pathValue, o as diagnosticRecord, r as decodeShape } from "./capabilities-CH0FkRMq.js";
2
+ import { $ as textStorage, $t as weekday, A as listValues, At as negate, B as ownedMapPairs, Bt as civilDays, Ct as div, Dt as isInteger, E as instantOf, Et as integerOf, Ft as DateRangeError, Gt as dayOfYear, H as quantity, Ht as civilOfDays, I as mapWithEntry, It as US_PER_DAY, J as sliceText, Jt as isoWeek, L as nothing, Lt as US_PER_SECOND, M as literalDigits, Mt as roundRatio, N as map, Nt as subtract, Ot as mod, Pt as withinLimits, Q as text, Qt as parseInstantText, R as num, Rt as addMonths, St as digitsOf, Tt as formatDec, U as quantityOf, Ut as civilOfUs, V as patternValue, W as range, Wt as civilUs, X as smallNumber, Xt as parseCivil, Y as smallInteger, _ as concatText, _t as ArithmeticError, an as lower, at as parseUnit, b as displayText, bt as decOf, cn as simpleFold, ct as toBase, en as assertScalarText, et as trimWhiteSpace, f as bytesOf, g as compareBytes, h as civilOf, in as isWhiteSpace, it as ownUnit, j as listWithItem, jt as powerInteger, k as list, kt as multiply, ln as upper, nn as charactersAt, nt as combine, on as normalizeNFC, ot as powerOf, p as canonicalNumber, rn as generalCategory, rt as fromBase, sn as scalarCount, st as sameDimension, tn as characterBoundaries, tt as UnitError, u as bool, ut as unitText, v as dec, vt as add, wt as divide, x as extendList, xt as digitCount$1, y as decimalParts, yt as compareDec, zt as checkInstant } from "./errors-BKJES3Zu.js";
3
+ import { _ as runTask, d as shapeDiagnostics, l as pathValue, o as diagnosticRecord, r as decodeShape } from "./capabilities-Bi5Qm6Fr.js";
4
4
  //#region src/generated/machine.ts
5
5
  const instructions = [
6
6
  {
@@ -107,6 +107,14 @@ const instructions = [
107
107
  "pushes": 0,
108
108
  "suspends": false
109
109
  },
110
+ {
111
+ "name": "hold",
112
+ "cost": "jump",
113
+ "operands": [],
114
+ "pops": 0,
115
+ "pushes": 0,
116
+ "suspends": false
117
+ },
110
118
  {
111
119
  "name": "branch-not-nothing",
112
120
  "cost": "branch",
@@ -396,6 +404,14 @@ const instructions = [
396
404
  "pushes": 1,
397
405
  "suspends": false
398
406
  },
407
+ {
408
+ "name": "list-elements",
409
+ "cost": "list-elements",
410
+ "operands": [],
411
+ "pops": 1,
412
+ "pushes": 1,
413
+ "suspends": false
414
+ },
399
415
  {
400
416
  "name": "property",
401
417
  "cost": "property",
@@ -1242,6 +1258,7 @@ const errorMessages = {
1242
1258
  "out of domain": "{value} is outside the domain of {function}",
1243
1259
  "out of range": "{value} is out of range for {field}",
1244
1260
  "can't decode": "Invalid {format} at Character {offset}",
1261
+ "can't patch": "JSON Patch operation {index} ({op} at {path}) failed: {reason}",
1245
1262
  "unknown zone": "Unknown time zone {zone}",
1246
1263
  "ambiguous time": "{civil} is ambiguous, or doesn't exist, in {zone}",
1247
1264
  "bad locale": "{locale} isn't a well-formed locale tag",
@@ -1813,6 +1830,26 @@ const costModel = {
1813
1830
  ]],
1814
1831
  "alloc": []
1815
1832
  },
1833
+ {
1834
+ "key": "list-elements",
1835
+ "fuel": [[
1836
+ 0,
1837
+ 0,
1838
+ 3,
1839
+ 1
1840
+ ], [
1841
+ 7,
1842
+ 2,
1843
+ 1,
1844
+ 1
1845
+ ]],
1846
+ "alloc": [[
1847
+ 1,
1848
+ 2,
1849
+ 1,
1850
+ 1
1851
+ ]]
1852
+ },
1816
1853
  {
1817
1854
  "key": "property",
1818
1855
  "fuel": [
@@ -3198,10 +3235,7 @@ const costSubject = {
3198
3235
  };
3199
3236
  //#endregion
3200
3237
  //#region src/text.ts
3201
- const characters = (s) => {
3202
- const boundaries = characterBoundaries(s);
3203
- return boundaries.slice(0, -1).map((from, i) => s.slice(from, boundaries[i + 1]));
3204
- };
3238
+ const characters = (s) => charactersAt(s, characterBoundaries(s));
3205
3239
  const compareText = (a, b, ignoringCase = false) => {
3206
3240
  assertScalarText(a);
3207
3241
  assertScalarText(b);
@@ -3421,422 +3455,846 @@ const disassemble = (unit) => {
3421
3455
  //#endregion
3422
3456
  //#region src/generated/costs.ts
3423
3457
  const makeCostRates = (measure) => [
3424
- (m) => ({
3425
- fuel: 1,
3458
+ (m, into = {
3459
+ fuel: 0,
3426
3460
  alloc: 0
3427
- }),
3428
- (m) => ({
3429
- fuel: 1,
3461
+ }) => {
3462
+ into.fuel = 1;
3463
+ into.alloc = 0;
3464
+ return into;
3465
+ },
3466
+ (m, into = {
3467
+ fuel: 0,
3430
3468
  alloc: 0
3431
- }),
3432
- (m) => ({
3433
- fuel: 1,
3469
+ }) => {
3470
+ into.fuel = 1;
3471
+ into.alloc = 0;
3472
+ return into;
3473
+ },
3474
+ (m, into = {
3475
+ fuel: 0,
3434
3476
  alloc: 0
3435
- }),
3436
- (m) => ({
3437
- fuel: 2,
3477
+ }) => {
3478
+ into.fuel = 1;
3479
+ into.alloc = 0;
3480
+ return into;
3481
+ },
3482
+ (m, into = {
3483
+ fuel: 0,
3438
3484
  alloc: 0
3439
- }),
3440
- (m) => ({
3441
- fuel: 1,
3485
+ }) => {
3486
+ into.fuel = 2;
3487
+ into.alloc = 0;
3488
+ return into;
3489
+ },
3490
+ (m, into = {
3491
+ fuel: 0,
3442
3492
  alloc: 0
3443
- }),
3444
- (m) => ({
3445
- fuel: 1,
3493
+ }) => {
3494
+ into.fuel = 1;
3495
+ into.alloc = 0;
3496
+ return into;
3497
+ },
3498
+ (m, into = {
3499
+ fuel: 0,
3446
3500
  alloc: 0
3447
- }),
3448
- (m) => ({
3449
- fuel: 2,
3450
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3451
- }),
3452
- (m) => ({
3453
- fuel: 3 + Math.ceil(1 * measure(9, m.result) / 8),
3454
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3455
- }),
3456
- (m) => ({
3457
- fuel: 8 + Math.ceil(2 * measure(9, m.result) / 1),
3458
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3459
- }),
3460
- (m) => ({
3461
- fuel: 3 + Math.ceil(1 * measure(4, m.result) / 16),
3462
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3463
- }),
3464
- (m) => ({
3465
- fuel: 2 + Math.ceil(1 * (m.scanned ?? 0) / 16),
3501
+ }) => {
3502
+ into.fuel = 1;
3503
+ into.alloc = 0;
3504
+ return into;
3505
+ },
3506
+ (m, into = {
3507
+ fuel: 0,
3466
3508
  alloc: 0
3467
- }),
3468
- (m) => ({
3469
- fuel: 2 + Math.ceil(1 * (m.scanned ?? 0) / 1),
3509
+ }) => {
3510
+ into.fuel = 2;
3511
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3512
+ return into;
3513
+ },
3514
+ (m, into = {
3515
+ fuel: 0,
3470
3516
  alloc: 0
3471
- }),
3472
- (m) => ({
3473
- fuel: 4 + Math.ceil(1 * measure(4, m.input) / 8) + Math.ceil(1 * measure(4, m.result) / 8),
3474
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3475
- }),
3476
- (m) => ({
3477
- fuel: 4 + Math.ceil(1 * (m.steps ?? 0) / 1),
3517
+ }) => {
3518
+ into.fuel = 3 + Math.ceil(1 * measure(9, m.result) / 8);
3519
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3520
+ return into;
3521
+ },
3522
+ (m, into = {
3523
+ fuel: 0,
3478
3524
  alloc: 0
3479
- }),
3480
- (m) => ({
3481
- fuel: 3,
3525
+ }) => {
3526
+ into.fuel = 8 + Math.ceil(2 * measure(9, m.result) / 1);
3527
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3528
+ return into;
3529
+ },
3530
+ (m, into = {
3531
+ fuel: 0,
3482
3532
  alloc: 0
3483
- }),
3484
- (m) => ({
3485
- fuel: 3 + Math.ceil(1 * measure(4, m.input) / 8),
3533
+ }) => {
3534
+ into.fuel = 3 + Math.ceil(1 * measure(4, m.result) / 16);
3535
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3536
+ return into;
3537
+ },
3538
+ (m, into = {
3539
+ fuel: 0,
3486
3540
  alloc: 0
3487
- }),
3488
- (m) => ({
3489
- fuel: 3,
3541
+ }) => {
3542
+ into.fuel = 2 + Math.ceil(1 * (m.scanned ?? 0) / 16);
3543
+ into.alloc = 0;
3544
+ return into;
3545
+ },
3546
+ (m, into = {
3547
+ fuel: 0,
3490
3548
  alloc: 0
3491
- }),
3492
- (m) => ({
3493
- fuel: 3 + Math.ceil(1 * measure(4, m.input) / 8) + Math.ceil(1 * measure(7, m.result) / 1),
3494
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3495
- }),
3496
- (m) => ({
3497
- fuel: 3 + Math.ceil(1 * (m.scanned ?? 0) / 8),
3498
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3499
- }),
3500
- (m) => ({
3501
- fuel: 4 + Math.ceil(1 * measure(4, m.result) / 8) + Math.ceil(1 * measure(7, m.result) / 8),
3502
- alloc: Math.ceil(1 * (m.inputSize ?? measure(1, m.input)) / 1)
3503
- }),
3504
- (m) => ({
3505
- fuel: 4 + Math.ceil(1 * measure(8, m.result) / 16),
3506
- alloc: 8 + Math.ceil(1 * (m.inputSize ?? measure(1, m.input)) / 1)
3507
- }),
3508
- (m) => ({
3509
- fuel: 3 + Math.ceil(1 * measure(4, m.result) / 16),
3510
- alloc: 8 + Math.ceil(1 * (m.inputSize ?? measure(1, m.input)) / 1)
3511
- }),
3512
- (m) => ({
3513
- fuel: 10 + Math.ceil(1 * (m.inputSize ?? measure(1, m.input)) / 32),
3549
+ }) => {
3550
+ into.fuel = 2 + Math.ceil(1 * (m.scanned ?? 0) / 1);
3551
+ into.alloc = 0;
3552
+ return into;
3553
+ },
3554
+ (m, into = {
3555
+ fuel: 0,
3514
3556
  alloc: 0
3515
- }),
3516
- (m) => ({
3517
- fuel: 2 + Math.ceil(1 * (m.count ?? 0) / 1) + Math.ceil(1 * measure(7, m.result) / 16),
3518
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3519
- }),
3520
- (m) => ({
3521
- fuel: 2 + Math.ceil(2 * (m.count ?? 0) / 1),
3522
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3523
- }),
3524
- (m) => ({
3525
- fuel: 20 + Math.ceil(2 * measure(12, m.result) / 1),
3526
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3527
- }),
3528
- (m) => ({
3529
- fuel: 3 + Math.ceil(1 * measure(6, m.input) / 8),
3530
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3531
- }),
3532
- (m) => ({
3533
- fuel: 6 + Math.ceil(1 * (m.steps ?? 0) / 1),
3534
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3535
- }),
3536
- (m) => ({
3537
- fuel: 2,
3538
- alloc: 24
3539
- }),
3540
- (m) => ({
3541
- fuel: 2,
3557
+ }) => {
3558
+ into.fuel = 4 + Math.ceil(1 * measure(4, m.input) / 8) + Math.ceil(1 * measure(4, m.result) / 8);
3559
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3560
+ return into;
3561
+ },
3562
+ (m, into = {
3563
+ fuel: 0,
3542
3564
  alloc: 0
3543
- }),
3544
- (m) => ({
3545
- fuel: 4 + Math.ceil(1 * (m.count ?? 0) / 1),
3546
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3547
- }),
3548
- (m) => ({
3549
- fuel: 8,
3565
+ }) => {
3566
+ into.fuel = 4 + Math.ceil(1 * (m.steps ?? 0) / 1);
3567
+ into.alloc = 0;
3568
+ return into;
3569
+ },
3570
+ (m, into = {
3571
+ fuel: 0,
3550
3572
  alloc: 0
3551
- }),
3552
- (m) => ({
3553
- fuel: 1,
3573
+ }) => {
3574
+ into.fuel = 3;
3575
+ into.alloc = 0;
3576
+ return into;
3577
+ },
3578
+ (m, into = {
3579
+ fuel: 0,
3554
3580
  alloc: 0
3555
- }),
3556
- (m) => ({
3557
- fuel: 4,
3581
+ }) => {
3582
+ into.fuel = 3 + Math.ceil(1 * measure(4, m.input) / 8);
3583
+ into.alloc = 0;
3584
+ return into;
3585
+ },
3586
+ (m, into = {
3587
+ fuel: 0,
3558
3588
  alloc: 0
3559
- }),
3560
- (m) => ({
3561
- fuel: 2,
3589
+ }) => {
3590
+ into.fuel = 3;
3591
+ into.alloc = 0;
3592
+ return into;
3593
+ },
3594
+ (m, into = {
3595
+ fuel: 0,
3562
3596
  alloc: 0
3563
- }),
3564
- (m) => ({
3565
- fuel: 1,
3597
+ }) => {
3598
+ into.fuel = 3 + Math.ceil(1 * measure(7, m.result) / 1);
3599
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3600
+ return into;
3601
+ },
3602
+ (m, into = {
3603
+ fuel: 0,
3566
3604
  alloc: 0
3567
- }),
3568
- (m) => ({
3569
- fuel: 2 + Math.ceil(1 * measure(6, m.result) / 8) + Math.ceil(1 * measure(4, m.result) / 8),
3570
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3571
- }),
3572
- (m) => ({
3573
- fuel: 10,
3574
- alloc: 48
3575
- }),
3576
- (m) => ({
3577
- fuel: Math.ceil(4 * (m.frames ?? 0) / 1),
3605
+ }) => {
3606
+ into.fuel = 3 + Math.ceil(1 * measure(4, m.input) / 8) + Math.ceil(1 * measure(7, m.result) / 1);
3607
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3608
+ return into;
3609
+ },
3610
+ (m, into = {
3611
+ fuel: 0,
3578
3612
  alloc: 0
3579
- }),
3580
- (m) => ({
3581
- fuel: 10 + Math.ceil(1 * (m.declared ?? 0) / 1) + Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 32),
3582
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3583
- }),
3584
- (m) => ({
3585
- fuel: 20 + Math.ceil(1 * (m.inputSize ?? measure(1, m.input)) / 32),
3586
- alloc: Math.ceil(1 * (m.inputSize ?? measure(1, m.input)) / 1)
3587
- }),
3588
- (m) => ({
3589
- fuel: 10,
3613
+ }) => {
3614
+ into.fuel = 3 + Math.ceil(1 * (m.scanned ?? 0) / 8);
3615
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3616
+ return into;
3617
+ },
3618
+ (m, into = {
3619
+ fuel: 0,
3590
3620
  alloc: 0
3591
- }),
3592
- (m) => ({
3593
- fuel: 10 + Math.ceil(1 * (m.steps ?? 0) / 1),
3594
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3595
- }),
3596
- (m) => ({
3597
- fuel: 2,
3598
- alloc: 40
3599
- }),
3600
- (m) => ({
3601
- fuel: 4 + Math.ceil(1 * (m.scanned ?? 0) / 1),
3621
+ }) => {
3622
+ into.fuel = 4 + Math.ceil(1 * measure(4, m.result) / 8) + Math.ceil(1 * measure(7, m.result) / 8);
3623
+ into.alloc = Math.ceil(1 * (m.inputSize ?? measure(1, m.input)) / 1);
3624
+ return into;
3625
+ },
3626
+ (m, into = {
3627
+ fuel: 0,
3602
3628
  alloc: 0
3603
- }),
3604
- (m) => ({
3605
- fuel: 4 + Math.ceil(1 * (m.scanned ?? 0) / 1),
3629
+ }) => {
3630
+ into.fuel = 4 + Math.ceil(1 * measure(8, m.result) / 16);
3631
+ into.alloc = 8 + Math.ceil(1 * (m.inputSize ?? measure(1, m.input)) / 1);
3632
+ return into;
3633
+ },
3634
+ (m, into = {
3635
+ fuel: 0,
3606
3636
  alloc: 0
3607
- }),
3608
- (m) => ({
3609
- fuel: 3,
3637
+ }) => {
3638
+ into.fuel = 3 + Math.ceil(1 * measure(4, m.result) / 16);
3639
+ into.alloc = 8 + Math.ceil(1 * (m.inputSize ?? measure(1, m.input)) / 1);
3640
+ return into;
3641
+ },
3642
+ (m, into = {
3643
+ fuel: 0,
3610
3644
  alloc: 0
3611
- }),
3612
- (m) => ({
3613
- fuel: 4,
3614
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3615
- }),
3616
- (m) => ({
3617
- fuel: 4 + Math.ceil(1 * measure(4, m.x?.[0]) / 4) + Math.ceil(1 * measure(4, m.result) / 8),
3618
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3619
- }),
3620
- (m) => ({
3621
- fuel: 4 + Math.ceil(1 * measure(4, m.x?.[0]) / 4) + Math.ceil(1 * measure(4, m.result) / 8),
3622
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3623
- }),
3624
- (m) => ({
3625
- fuel: 4 + Math.ceil(1 * (m.steps ?? 0) / 1),
3645
+ }) => {
3646
+ into.fuel = 10 + Math.ceil(1 * (m.inputSize ?? measure(1, m.input)) / 32);
3647
+ into.alloc = 0;
3648
+ return into;
3649
+ },
3650
+ (m, into = {
3651
+ fuel: 0,
3626
3652
  alloc: 0
3627
- }),
3628
- (m) => ({
3629
- fuel: 2,
3653
+ }) => {
3654
+ into.fuel = 2 + Math.ceil(1 * (m.count ?? 0) / 1) + Math.ceil(1 * measure(7, m.result) / 16);
3655
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3656
+ return into;
3657
+ },
3658
+ (m, into = {
3659
+ fuel: 0,
3630
3660
  alloc: 0
3631
- }),
3632
- (m) => ({
3633
- fuel: 2,
3634
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3635
- }),
3636
- (m) => ({
3637
- fuel: 2,
3661
+ }) => {
3662
+ into.fuel = 2 + Math.ceil(2 * (m.count ?? 0) / 1);
3663
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3664
+ return into;
3665
+ },
3666
+ (m, into = {
3667
+ fuel: 0,
3638
3668
  alloc: 0
3639
- }),
3640
- (m) => ({
3641
- fuel: 2,
3669
+ }) => {
3670
+ into.fuel = 20 + Math.ceil(2 * measure(12, m.result) / 1);
3671
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3672
+ return into;
3673
+ },
3674
+ (m, into = {
3675
+ fuel: 0,
3642
3676
  alloc: 0
3643
- }),
3644
- (m) => ({
3645
- fuel: 2,
3646
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3647
- }),
3648
- (m) => ({
3649
- fuel: 4 + Math.ceil(1 * (m.scanned ?? 0) / 1),
3677
+ }) => {
3678
+ into.fuel = 3 + Math.ceil(1 * measure(6, m.input) / 8);
3679
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3680
+ return into;
3681
+ },
3682
+ (m, into = {
3683
+ fuel: 0,
3650
3684
  alloc: 0
3651
- }),
3652
- (m) => ({
3653
- fuel: 4 + Math.ceil(1 * (m.scanned ?? 0) / 1),
3685
+ }) => {
3686
+ into.fuel = 6 + Math.ceil(1 * (m.steps ?? 0) / 1);
3687
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3688
+ return into;
3689
+ },
3690
+ (m, into = {
3691
+ fuel: 0,
3654
3692
  alloc: 0
3655
- }),
3656
- (m) => ({
3657
- fuel: 4 + Math.ceil(1 * (m.scanned ?? 0) / 1),
3658
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3659
- }),
3660
- (m) => ({
3661
- fuel: 2,
3662
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3663
- }),
3664
- (m) => ({
3665
- fuel: 2,
3666
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3667
- }),
3668
- (m) => ({
3669
- fuel: 3,
3670
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3671
- }),
3672
- (m) => ({
3673
- fuel: 3 + Math.ceil(1 * measure(9, m.x?.[0]) / 8),
3674
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3675
- }),
3676
- (m) => ({
3677
- fuel: 3 + Math.ceil(1 * measure(9, m.x?.[0]) / 8),
3678
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3679
- }),
3680
- (m) => ({
3681
- fuel: 3 + Math.ceil(1 * measure(9, m.x?.[0]) / 8),
3682
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3683
- }),
3684
- (m) => ({
3685
- fuel: 5 + Math.ceil(1 * measure(9, m.result) / 8),
3686
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3687
- }),
3688
- (m) => ({
3689
- fuel: 60,
3690
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3691
- }),
3692
- (m) => ({
3693
- fuel: 60,
3694
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3695
- }),
3696
- (m) => ({
3697
- fuel: 60,
3698
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3699
- }),
3700
- (m) => ({
3701
- fuel: 60,
3702
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3703
- }),
3704
- (m) => ({
3705
- fuel: 60,
3706
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3707
- }),
3708
- (m) => ({
3709
- fuel: 60,
3710
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3711
- }),
3712
- (m) => ({
3713
- fuel: 60,
3714
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3715
- }),
3716
- (m) => ({
3717
- fuel: 60,
3718
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3719
- }),
3720
- (m) => ({
3721
- fuel: 60,
3722
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3723
- }),
3724
- (m) => ({
3725
- fuel: 60,
3726
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3727
- }),
3728
- (m) => ({
3729
- fuel: 60,
3730
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3731
- }),
3732
- (m) => ({
3733
- fuel: 60,
3734
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3735
- }),
3736
- (m) => ({
3737
- fuel: 60,
3738
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3739
- }),
3740
- (m) => ({
3741
- fuel: 60,
3742
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3743
- }),
3744
- (m) => ({
3745
- fuel: 4,
3746
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3747
- }),
3748
- (m) => ({
3749
- fuel: 8,
3750
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3751
- }),
3752
- (m) => ({
3753
- fuel: 8,
3754
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3755
- }),
3756
- (m) => ({
3757
- fuel: 8,
3758
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3759
- }),
3760
- (m) => ({
3761
- fuel: 8,
3762
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3763
- }),
3764
- (m) => ({
3765
- fuel: 3,
3693
+ }) => {
3694
+ into.fuel = 2;
3695
+ into.alloc = 24;
3696
+ return into;
3697
+ },
3698
+ (m, into = {
3699
+ fuel: 0,
3766
3700
  alloc: 0
3767
- }),
3768
- (m) => ({
3769
- fuel: 3,
3701
+ }) => {
3702
+ into.fuel = 2;
3703
+ into.alloc = 0;
3704
+ return into;
3705
+ },
3706
+ (m, into = {
3707
+ fuel: 0,
3770
3708
  alloc: 0
3771
- }),
3772
- (m) => ({
3773
- fuel: 3,
3709
+ }) => {
3710
+ into.fuel = 4 + Math.ceil(1 * (m.count ?? 0) / 1);
3711
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3712
+ return into;
3713
+ },
3714
+ (m, into = {
3715
+ fuel: 0,
3774
3716
  alloc: 0
3775
- }),
3776
- (m) => ({
3777
- fuel: 3,
3717
+ }) => {
3718
+ into.fuel = 8;
3719
+ into.alloc = 0;
3720
+ return into;
3721
+ },
3722
+ (m, into = {
3723
+ fuel: 0,
3778
3724
  alloc: 0
3779
- }),
3780
- (m) => ({
3781
- fuel: 3,
3725
+ }) => {
3726
+ into.fuel = 1;
3727
+ into.alloc = 0;
3728
+ return into;
3729
+ },
3730
+ (m, into = {
3731
+ fuel: 0,
3782
3732
  alloc: 0
3783
- }),
3784
- (m) => ({
3785
- fuel: 3,
3733
+ }) => {
3734
+ into.fuel = 4;
3735
+ into.alloc = 0;
3736
+ return into;
3737
+ },
3738
+ (m, into = {
3739
+ fuel: 0,
3786
3740
  alloc: 0
3787
- }),
3788
- (m) => ({
3789
- fuel: 3,
3741
+ }) => {
3742
+ into.fuel = 2;
3743
+ into.alloc = 0;
3744
+ return into;
3745
+ },
3746
+ (m, into = {
3747
+ fuel: 0,
3790
3748
  alloc: 0
3791
- }),
3792
- (m) => ({
3793
- fuel: 4,
3749
+ }) => {
3750
+ into.fuel = 1;
3751
+ into.alloc = 0;
3752
+ return into;
3753
+ },
3754
+ (m, into = {
3755
+ fuel: 0,
3794
3756
  alloc: 0
3795
- }),
3796
- (m) => ({
3797
- fuel: 4,
3757
+ }) => {
3758
+ into.fuel = 2 + Math.ceil(1 * measure(6, m.result) / 8) + Math.ceil(1 * measure(4, m.result) / 8);
3759
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3760
+ return into;
3761
+ },
3762
+ (m, into = {
3763
+ fuel: 0,
3798
3764
  alloc: 0
3799
- }),
3800
- (m) => ({
3801
- fuel: 6,
3765
+ }) => {
3766
+ into.fuel = 10;
3767
+ into.alloc = 48;
3768
+ return into;
3769
+ },
3770
+ (m, into = {
3771
+ fuel: 0,
3802
3772
  alloc: 0
3803
- }),
3804
- (m) => ({
3805
- fuel: 6,
3773
+ }) => {
3774
+ into.fuel = Math.ceil(4 * (m.frames ?? 0) / 1);
3775
+ into.alloc = 0;
3776
+ return into;
3777
+ },
3778
+ (m, into = {
3779
+ fuel: 0,
3806
3780
  alloc: 0
3807
- }),
3808
- (m) => ({
3809
- fuel: 2,
3781
+ }) => {
3782
+ into.fuel = 10 + Math.ceil(1 * (m.declared ?? 0) / 1) + Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 32);
3783
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3784
+ return into;
3785
+ },
3786
+ (m, into = {
3787
+ fuel: 0,
3810
3788
  alloc: 0
3811
- }),
3812
- (m) => ({
3813
- fuel: 10,
3814
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3815
- }),
3816
- (m) => ({
3817
- fuel: 10,
3818
- alloc: Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1)
3819
- }),
3820
- (m) => ({
3821
- fuel: 1,
3789
+ }) => {
3790
+ into.fuel = 20 + Math.ceil(1 * (m.inputSize ?? measure(1, m.input)) / 32);
3791
+ into.alloc = Math.ceil(1 * (m.inputSize ?? measure(1, m.input)) / 1);
3792
+ return into;
3793
+ },
3794
+ (m, into = {
3795
+ fuel: 0,
3822
3796
  alloc: 0
3823
- }),
3824
- (m) => ({
3825
- fuel: 1,
3797
+ }) => {
3798
+ into.fuel = 10;
3799
+ into.alloc = 0;
3800
+ return into;
3801
+ },
3802
+ (m, into = {
3803
+ fuel: 0,
3826
3804
  alloc: 0
3827
- }),
3828
- (m) => ({
3829
- fuel: 8 + Math.ceil(1 * (m.count ?? 0) / 1),
3805
+ }) => {
3806
+ into.fuel = 10 + Math.ceil(1 * (m.steps ?? 0) / 1);
3807
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3808
+ return into;
3809
+ },
3810
+ (m, into = {
3811
+ fuel: 0,
3830
3812
  alloc: 0
3831
- }),
3832
- (m) => ({
3833
- fuel: 3 + Math.ceil(1 * measure(5, m.x?.[0]) / 16),
3813
+ }) => {
3814
+ into.fuel = 2;
3815
+ into.alloc = 40;
3816
+ return into;
3817
+ },
3818
+ (m, into = {
3819
+ fuel: 0,
3834
3820
  alloc: 0
3835
- }),
3836
- (m) => ({
3837
- fuel: Math.ceil(4 * (m.frames ?? 0) / 1),
3821
+ }) => {
3822
+ into.fuel = 4 + Math.ceil(1 * (m.scanned ?? 0) / 1);
3823
+ into.alloc = 0;
3824
+ return into;
3825
+ },
3826
+ (m, into = {
3827
+ fuel: 0,
3828
+ alloc: 0
3829
+ }) => {
3830
+ into.fuel = 4 + Math.ceil(1 * (m.scanned ?? 0) / 1);
3831
+ into.alloc = 0;
3832
+ return into;
3833
+ },
3834
+ (m, into = {
3835
+ fuel: 0,
3836
+ alloc: 0
3837
+ }) => {
3838
+ into.fuel = 3;
3839
+ into.alloc = 0;
3840
+ return into;
3841
+ },
3842
+ (m, into = {
3843
+ fuel: 0,
3844
+ alloc: 0
3845
+ }) => {
3846
+ into.fuel = 4;
3847
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3848
+ return into;
3849
+ },
3850
+ (m, into = {
3851
+ fuel: 0,
3852
+ alloc: 0
3853
+ }) => {
3854
+ into.fuel = 4 + Math.ceil(1 * measure(4, m.x?.[0]) / 4) + Math.ceil(1 * measure(4, m.result) / 8);
3855
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3856
+ return into;
3857
+ },
3858
+ (m, into = {
3859
+ fuel: 0,
3860
+ alloc: 0
3861
+ }) => {
3862
+ into.fuel = 4 + Math.ceil(1 * measure(4, m.x?.[0]) / 4) + Math.ceil(1 * measure(4, m.result) / 8);
3863
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3864
+ return into;
3865
+ },
3866
+ (m, into = {
3867
+ fuel: 0,
3868
+ alloc: 0
3869
+ }) => {
3870
+ into.fuel = 4 + Math.ceil(1 * (m.steps ?? 0) / 1);
3871
+ into.alloc = 0;
3872
+ return into;
3873
+ },
3874
+ (m, into = {
3875
+ fuel: 0,
3876
+ alloc: 0
3877
+ }) => {
3878
+ into.fuel = 2;
3879
+ into.alloc = 0;
3880
+ return into;
3881
+ },
3882
+ (m, into = {
3883
+ fuel: 0,
3884
+ alloc: 0
3885
+ }) => {
3886
+ into.fuel = 2;
3887
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3888
+ return into;
3889
+ },
3890
+ (m, into = {
3891
+ fuel: 0,
3892
+ alloc: 0
3893
+ }) => {
3894
+ into.fuel = 2;
3895
+ into.alloc = 0;
3896
+ return into;
3897
+ },
3898
+ (m, into = {
3899
+ fuel: 0,
3900
+ alloc: 0
3901
+ }) => {
3902
+ into.fuel = 2;
3903
+ into.alloc = 0;
3904
+ return into;
3905
+ },
3906
+ (m, into = {
3907
+ fuel: 0,
3908
+ alloc: 0
3909
+ }) => {
3910
+ into.fuel = 2;
3911
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3912
+ return into;
3913
+ },
3914
+ (m, into = {
3915
+ fuel: 0,
3916
+ alloc: 0
3917
+ }) => {
3918
+ into.fuel = 4 + Math.ceil(1 * (m.scanned ?? 0) / 1);
3919
+ into.alloc = 0;
3920
+ return into;
3921
+ },
3922
+ (m, into = {
3923
+ fuel: 0,
3924
+ alloc: 0
3925
+ }) => {
3926
+ into.fuel = 4 + Math.ceil(1 * (m.scanned ?? 0) / 1);
3927
+ into.alloc = 0;
3928
+ return into;
3929
+ },
3930
+ (m, into = {
3931
+ fuel: 0,
3932
+ alloc: 0
3933
+ }) => {
3934
+ into.fuel = 4 + Math.ceil(1 * (m.scanned ?? 0) / 1);
3935
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3936
+ return into;
3937
+ },
3938
+ (m, into = {
3939
+ fuel: 0,
3940
+ alloc: 0
3941
+ }) => {
3942
+ into.fuel = 2;
3943
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3944
+ return into;
3945
+ },
3946
+ (m, into = {
3947
+ fuel: 0,
3948
+ alloc: 0
3949
+ }) => {
3950
+ into.fuel = 2;
3951
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3952
+ return into;
3953
+ },
3954
+ (m, into = {
3955
+ fuel: 0,
3956
+ alloc: 0
3957
+ }) => {
3958
+ into.fuel = 3;
3959
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3960
+ return into;
3961
+ },
3962
+ (m, into = {
3963
+ fuel: 0,
3964
+ alloc: 0
3965
+ }) => {
3966
+ into.fuel = 3 + Math.ceil(1 * measure(9, m.x?.[0]) / 8);
3967
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3968
+ return into;
3969
+ },
3970
+ (m, into = {
3971
+ fuel: 0,
3972
+ alloc: 0
3973
+ }) => {
3974
+ into.fuel = 3 + Math.ceil(1 * measure(9, m.x?.[0]) / 8);
3975
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3976
+ return into;
3977
+ },
3978
+ (m, into = {
3979
+ fuel: 0,
3980
+ alloc: 0
3981
+ }) => {
3982
+ into.fuel = 3 + Math.ceil(1 * measure(9, m.x?.[0]) / 8);
3983
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3984
+ return into;
3985
+ },
3986
+ (m, into = {
3987
+ fuel: 0,
3988
+ alloc: 0
3989
+ }) => {
3990
+ into.fuel = 5 + Math.ceil(1 * measure(9, m.result) / 8);
3991
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
3992
+ return into;
3993
+ },
3994
+ (m, into = {
3995
+ fuel: 0,
3996
+ alloc: 0
3997
+ }) => {
3998
+ into.fuel = 60;
3999
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4000
+ return into;
4001
+ },
4002
+ (m, into = {
4003
+ fuel: 0,
4004
+ alloc: 0
4005
+ }) => {
4006
+ into.fuel = 60;
4007
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4008
+ return into;
4009
+ },
4010
+ (m, into = {
4011
+ fuel: 0,
3838
4012
  alloc: 0
3839
- })
4013
+ }) => {
4014
+ into.fuel = 60;
4015
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4016
+ return into;
4017
+ },
4018
+ (m, into = {
4019
+ fuel: 0,
4020
+ alloc: 0
4021
+ }) => {
4022
+ into.fuel = 60;
4023
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4024
+ return into;
4025
+ },
4026
+ (m, into = {
4027
+ fuel: 0,
4028
+ alloc: 0
4029
+ }) => {
4030
+ into.fuel = 60;
4031
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4032
+ return into;
4033
+ },
4034
+ (m, into = {
4035
+ fuel: 0,
4036
+ alloc: 0
4037
+ }) => {
4038
+ into.fuel = 60;
4039
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4040
+ return into;
4041
+ },
4042
+ (m, into = {
4043
+ fuel: 0,
4044
+ alloc: 0
4045
+ }) => {
4046
+ into.fuel = 60;
4047
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4048
+ return into;
4049
+ },
4050
+ (m, into = {
4051
+ fuel: 0,
4052
+ alloc: 0
4053
+ }) => {
4054
+ into.fuel = 60;
4055
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4056
+ return into;
4057
+ },
4058
+ (m, into = {
4059
+ fuel: 0,
4060
+ alloc: 0
4061
+ }) => {
4062
+ into.fuel = 60;
4063
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4064
+ return into;
4065
+ },
4066
+ (m, into = {
4067
+ fuel: 0,
4068
+ alloc: 0
4069
+ }) => {
4070
+ into.fuel = 60;
4071
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4072
+ return into;
4073
+ },
4074
+ (m, into = {
4075
+ fuel: 0,
4076
+ alloc: 0
4077
+ }) => {
4078
+ into.fuel = 60;
4079
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4080
+ return into;
4081
+ },
4082
+ (m, into = {
4083
+ fuel: 0,
4084
+ alloc: 0
4085
+ }) => {
4086
+ into.fuel = 60;
4087
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4088
+ return into;
4089
+ },
4090
+ (m, into = {
4091
+ fuel: 0,
4092
+ alloc: 0
4093
+ }) => {
4094
+ into.fuel = 60;
4095
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4096
+ return into;
4097
+ },
4098
+ (m, into = {
4099
+ fuel: 0,
4100
+ alloc: 0
4101
+ }) => {
4102
+ into.fuel = 60;
4103
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4104
+ return into;
4105
+ },
4106
+ (m, into = {
4107
+ fuel: 0,
4108
+ alloc: 0
4109
+ }) => {
4110
+ into.fuel = 4;
4111
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4112
+ return into;
4113
+ },
4114
+ (m, into = {
4115
+ fuel: 0,
4116
+ alloc: 0
4117
+ }) => {
4118
+ into.fuel = 8;
4119
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4120
+ return into;
4121
+ },
4122
+ (m, into = {
4123
+ fuel: 0,
4124
+ alloc: 0
4125
+ }) => {
4126
+ into.fuel = 8;
4127
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4128
+ return into;
4129
+ },
4130
+ (m, into = {
4131
+ fuel: 0,
4132
+ alloc: 0
4133
+ }) => {
4134
+ into.fuel = 8;
4135
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4136
+ return into;
4137
+ },
4138
+ (m, into = {
4139
+ fuel: 0,
4140
+ alloc: 0
4141
+ }) => {
4142
+ into.fuel = 8;
4143
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4144
+ return into;
4145
+ },
4146
+ (m, into = {
4147
+ fuel: 0,
4148
+ alloc: 0
4149
+ }) => {
4150
+ into.fuel = 3;
4151
+ into.alloc = 0;
4152
+ return into;
4153
+ },
4154
+ (m, into = {
4155
+ fuel: 0,
4156
+ alloc: 0
4157
+ }) => {
4158
+ into.fuel = 3;
4159
+ into.alloc = 0;
4160
+ return into;
4161
+ },
4162
+ (m, into = {
4163
+ fuel: 0,
4164
+ alloc: 0
4165
+ }) => {
4166
+ into.fuel = 3;
4167
+ into.alloc = 0;
4168
+ return into;
4169
+ },
4170
+ (m, into = {
4171
+ fuel: 0,
4172
+ alloc: 0
4173
+ }) => {
4174
+ into.fuel = 3;
4175
+ into.alloc = 0;
4176
+ return into;
4177
+ },
4178
+ (m, into = {
4179
+ fuel: 0,
4180
+ alloc: 0
4181
+ }) => {
4182
+ into.fuel = 3;
4183
+ into.alloc = 0;
4184
+ return into;
4185
+ },
4186
+ (m, into = {
4187
+ fuel: 0,
4188
+ alloc: 0
4189
+ }) => {
4190
+ into.fuel = 3;
4191
+ into.alloc = 0;
4192
+ return into;
4193
+ },
4194
+ (m, into = {
4195
+ fuel: 0,
4196
+ alloc: 0
4197
+ }) => {
4198
+ into.fuel = 3;
4199
+ into.alloc = 0;
4200
+ return into;
4201
+ },
4202
+ (m, into = {
4203
+ fuel: 0,
4204
+ alloc: 0
4205
+ }) => {
4206
+ into.fuel = 4;
4207
+ into.alloc = 0;
4208
+ return into;
4209
+ },
4210
+ (m, into = {
4211
+ fuel: 0,
4212
+ alloc: 0
4213
+ }) => {
4214
+ into.fuel = 4;
4215
+ into.alloc = 0;
4216
+ return into;
4217
+ },
4218
+ (m, into = {
4219
+ fuel: 0,
4220
+ alloc: 0
4221
+ }) => {
4222
+ into.fuel = 6;
4223
+ into.alloc = 0;
4224
+ return into;
4225
+ },
4226
+ (m, into = {
4227
+ fuel: 0,
4228
+ alloc: 0
4229
+ }) => {
4230
+ into.fuel = 6;
4231
+ into.alloc = 0;
4232
+ return into;
4233
+ },
4234
+ (m, into = {
4235
+ fuel: 0,
4236
+ alloc: 0
4237
+ }) => {
4238
+ into.fuel = 2;
4239
+ into.alloc = 0;
4240
+ return into;
4241
+ },
4242
+ (m, into = {
4243
+ fuel: 0,
4244
+ alloc: 0
4245
+ }) => {
4246
+ into.fuel = 10;
4247
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4248
+ return into;
4249
+ },
4250
+ (m, into = {
4251
+ fuel: 0,
4252
+ alloc: 0
4253
+ }) => {
4254
+ into.fuel = 10;
4255
+ into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
4256
+ return into;
4257
+ },
4258
+ (m, into = {
4259
+ fuel: 0,
4260
+ alloc: 0
4261
+ }) => {
4262
+ into.fuel = 1;
4263
+ into.alloc = 0;
4264
+ return into;
4265
+ },
4266
+ (m, into = {
4267
+ fuel: 0,
4268
+ alloc: 0
4269
+ }) => {
4270
+ into.fuel = 1;
4271
+ into.alloc = 0;
4272
+ return into;
4273
+ },
4274
+ (m, into = {
4275
+ fuel: 0,
4276
+ alloc: 0
4277
+ }) => {
4278
+ into.fuel = 8 + Math.ceil(1 * (m.count ?? 0) / 1);
4279
+ into.alloc = 0;
4280
+ return into;
4281
+ },
4282
+ (m, into = {
4283
+ fuel: 0,
4284
+ alloc: 0
4285
+ }) => {
4286
+ into.fuel = 3 + Math.ceil(1 * measure(5, m.x?.[0]) / 16);
4287
+ into.alloc = 0;
4288
+ return into;
4289
+ },
4290
+ (m, into = {
4291
+ fuel: 0,
4292
+ alloc: 0
4293
+ }) => {
4294
+ into.fuel = Math.ceil(4 * (m.frames ?? 0) / 1);
4295
+ into.alloc = 0;
4296
+ return into;
4297
+ }
3840
4298
  ];
3841
4299
  const leafSize = (v, measure) => {
3842
4300
  switch (v.kind) {
@@ -3856,6 +4314,13 @@ const leafSize = (v, measure) => {
3856
4314
  };
3857
4315
  //#endregion
3858
4316
  //#region src/costs.ts
4317
+ /** Clears every count and subject so `m` can measure the next instruction. */
4318
+ const resetMeasured = (m) => {
4319
+ m.count = m.declared = m.frames = m.inputSize = void 0;
4320
+ m.resultSize = m.scanned = m.steps = void 0;
4321
+ m.input = m.result = void 0;
4322
+ m.x = void 0;
4323
+ };
3859
4324
  const rates = costModel.rates;
3860
4325
  const rateIndex = new Map(rates.map(({ key }, i) => [key, i]));
3861
4326
  const sizes = new Map(Object.entries(costModel.sizes));
@@ -3871,9 +4336,9 @@ const measureOf = (measure, v) => {
3871
4336
  switch (measure) {
3872
4337
  case SIZE: return sizeOf(v);
3873
4338
  case CONTENTS: return contentsOf(v);
3874
- case CHARACTERS: return v.kind === "text" ? characters(v.asText()).length : 0;
4339
+ case CHARACTERS: return v.kind === "text" ? textStorage(v).characterCount : 0;
3875
4340
  case SCALARS: return v.kind === "text" ? scalarCount(v.asText()) : 0;
3876
- case UTF8: return v.kind === "text" ? encoder.encode(v.asText()).length : 0;
4341
+ case UTF8: return v.kind === "text" ? textStorage(v).utf8Length : 0;
3877
4342
  case ITEMS: return itemsOf(v);
3878
4343
  case ENTRIES: return v.kind === "map" ? v.mapSize : 0;
3879
4344
  case DIGITS: {
@@ -3938,7 +4403,7 @@ const contentsOf = (v) => {
3938
4403
  case "map": {
3939
4404
  const cached = knownContents.get(v);
3940
4405
  if (cached !== void 0) return cached;
3941
- const total = v.mapPairs().reduce((sum, [key, value]) => sum + 16 + encoder.encode(key).length + sizeOf(value), 0);
4406
+ const total = ownedMapPairs(v).reduce((sum, [key, value]) => sum + 16 + encoder.encode(key).length + sizeOf(value), 0);
3942
4407
  knownContents.set(v, total);
3943
4408
  return total;
3944
4409
  }
@@ -3956,6 +4421,15 @@ const cacheListExtension = (result, current, part, all) => {
3956
4421
  knownContents.set(result, contents);
3957
4422
  known.set(result, partSize("list", result.length, contents));
3958
4423
  };
4424
+ /** The part of a map's contents its keys add, one term per key. */
4425
+ const keysContents = (keys) => keys.reduce((sum, key) => sum + 16 + encoder.encode(key).length, 0);
4426
+ /** Seed a newly built List's or map's size from the values it was built of. */
4427
+ const cacheBuild = (result, items, keys) => {
4428
+ let contents = keys;
4429
+ for (const item of items) contents += sizeOf(item);
4430
+ knownContents.set(result, contents);
4431
+ known.set(result, partSize(result.kind, result.kind === "map" ? result.mapSize : result.length, contents));
4432
+ };
3959
4433
  /** Seed the logical sizes of point edits from their retained collection. */
3960
4434
  const cacheMapWrite = (result, current, key, part) => {
3961
4435
  if (result === current) return;
@@ -4004,7 +4478,7 @@ const sizeOf = (v) => {
4004
4478
  const childrenOf = (v) => {
4005
4479
  switch (v.kind) {
4006
4480
  case "list": return Array.from({ length: v.length }, (_, i) => v.index(i + 1));
4007
- case "map": return v.entries().map(([, value]) => value);
4481
+ case "map": return ownedMapPairs(v).map(([, value]) => value);
4008
4482
  case "range": {
4009
4483
  const { from, to } = v.asRange();
4010
4484
  return [from, to];
@@ -4029,11 +4503,11 @@ const compiledRates = makeCostRates(measureOf);
4029
4503
  const fixedRates = () => rates.map(({ alloc, fuel }, i) => [...alloc, ...fuel].every((term) => term[0] === CONSTANT) ? compiledRates[i](noCounts) : void 0);
4030
4504
  /** A Cost Model key's rate, an index that `charge` takes, or -1 if none. */
4031
4505
  const rateOf = (key) => rateIndex.get(key) ?? -1;
4032
- /** A rate's Fuel and allocation, over what the instruction worked on. */
4033
- const charge = (rate, measured = noCounts) => {
4506
+ /** A rate's Fuel and allocation. `into` lets a Run reuse its private scratch. */
4507
+ const charge = (rate, measured = noCounts, into) => {
4034
4508
  const compiled = compiledRates[rate];
4035
4509
  if (!compiled) throw new Error(`No Cost Model rate ${rate}`);
4036
- return compiled(measured);
4510
+ return compiled(measured, into);
4037
4511
  };
4038
4512
  //#endregion
4039
4513
  //#region src/floats.ts
@@ -4048,7 +4522,7 @@ const BINARY32 = {
4048
4522
  bias: 127
4049
4523
  };
4050
4524
  const pow10 = (n) => 10n ** BigInt(n);
4051
- const digitCount$1 = (n) => n === 0n ? 0 : n.toString().length;
4525
+ const digitCount = (n) => n === 0n ? 0 : n.toString().length;
4052
4526
  const bitLength$1 = (n) => n === 0n ? 0 : n.toString(2).length;
4053
4527
  const binary = (m, e) => e >= 0 ? {
4054
4528
  num: m << BigInt(e),
@@ -4077,7 +4551,7 @@ const distance = (a, b) => {
4077
4551
  };
4078
4552
  };
4079
4553
  const log10Floor = (v) => {
4080
- const guess = digitCount$1(v.num) - digitCount$1(v.den);
4554
+ const guess = digitCount(v.num) - digitCount(v.den);
4081
4555
  return compare(v, decimal(1n, guess)) >= 0 ? guess : guess - 1;
4082
4556
  };
4083
4557
  const readBits = (b, little) => {
@@ -4195,10 +4669,9 @@ const ONE$1 = {
4195
4669
  };
4196
4670
  const ten = (n) => 10n ** BigInt(n);
4197
4671
  const abs = (n) => n < 0n ? -n : n;
4198
- const digitCount = (n) => n === 0n ? 0 : abs(n).toString().length;
4199
4672
  const bitLength = (n) => n === 0n ? 0 : n.toString(2).length;
4200
4673
  const signedOf = (x) => x.negative ? -x.coefficient : x.coefficient;
4201
- const magnitude = (x) => digitCount(x.coefficient) + x.exponent;
4674
+ const magnitude = (x) => digitCount$1(x.coefficient) + x.exponent;
4202
4675
  const fixed = (x, q) => q + x.exponent >= 0 ? signedOf(x) * ten(q + x.exponent) : signedOf(x) / ten(-q - x.exponent);
4203
4676
  const isqrt = (n) => {
4204
4677
  if (n < 2n) return n;
@@ -4353,7 +4826,7 @@ const settle = (approx) => {
4353
4826
  const ERR = 1000n;
4354
4827
  const expScaled = (w, q) => {
4355
4828
  const k = BigInt(Math.floor(Number(w / ten(q - 6)) / 1e6 / Math.LN10));
4356
- const g = q + digitCount(k) + 2;
4829
+ const g = q + digitCount$1(abs(k)) + 2;
4357
4830
  const r = (w * ten(g - q) - k * ln10(g)) / ten(g - q);
4358
4831
  return {
4359
4832
  v: expFixed(r, q),
@@ -4363,10 +4836,10 @@ const expScaled = (w, q) => {
4363
4836
  };
4364
4837
  const lnScaled = (x, q) => {
4365
4838
  const n = BigInt(magnitude(x) - 1);
4366
- const g = q + digitCount(n) + 2;
4839
+ const g = q + digitCount$1(abs(n)) + 2;
4367
4840
  const m = fixed({
4368
4841
  ...x,
4369
- exponent: 1 - digitCount(x.coefficient)
4842
+ exponent: 1 - digitCount$1(x.coefficient)
4370
4843
  }, g);
4371
4844
  return (lnFixed(m, g) + n * ln10(g)) / ten(g - q);
4372
4845
  };
@@ -4376,7 +4849,7 @@ const sqrt = (x) => {
4376
4849
  const odd = x.exponent % 2 !== 0;
4377
4850
  const c = odd ? x.coefficient * 10n : x.coefficient;
4378
4851
  const e = odd ? x.exponent - 1 : x.exponent;
4379
- const j = Math.max(0, Math.ceil((72 - digitCount(c)) / 2));
4852
+ const j = Math.max(0, Math.ceil((72 - digitCount$1(c)) / 2));
4380
4853
  const n = c * ten(2 * j);
4381
4854
  const s = isqrt(n);
4382
4855
  const scale = e / 2 - j;
@@ -5583,7 +6056,7 @@ const negated = (a) => {
5583
6056
  if (q) return inUnit(negate(numberOf(q)), q.unit);
5584
6057
  return numberValue(negate(numberOperand(a)));
5585
6058
  };
5586
- const concat = (a, b) => text(textForm(a) + textForm(b));
6059
+ const concat = (a, b) => concatText(a.kind === "text" ? a : text(textForm(a)), b.kind === "text" ? b : text(textForm(b)));
5587
6060
  const makeRange = (a, b) => {
5588
6061
  if (a.kind !== "number" && a.kind !== "quantity") throw wrongKind("number", a);
5589
6062
  if (b.kind !== a.kind) throw wrongKind(a.kind, b);
@@ -5740,7 +6213,7 @@ const texts = (xs) => listValues(xs.map((x) => text(x)));
5740
6213
  const property = (name, v, delimiter = null) => {
5741
6214
  switch (name) {
5742
6215
  case "length":
5743
- if (v.kind === "text") return integerValue(BigInt(characters(textOf(v)).length));
6216
+ if (v.kind === "text") return integerValue(BigInt(textStorage(v).characterCount));
5744
6217
  if (v.kind === "list") return integerValue(BigInt(v.length));
5745
6218
  if (v.kind === "map") return integerValue(BigInt(v.mapSize));
5746
6219
  if (isIntegerRange(v)) return integerValue(BigInt(itemsOf(v)));
@@ -5752,7 +6225,7 @@ const property = (name, v, delimiter = null) => {
5752
6225
  return listValues(v.entries().map(([k, value]) => name === "keys" ? text(k) : value));
5753
6226
  case "items": {
5754
6227
  const d = delimiterText(delimiter);
5755
- if (v.kind === "text") return texts(spans(textOf(v), "item", d).map((s) => s.text));
6228
+ if (v.kind === "text") return listValues(spans(textOf(v), "item", d, textStorage(v).characters).map((s) => sliceText(v, s.from, s.to)));
5756
6229
  if (v.kind === "list") return v;
5757
6230
  if (isIntegerRange(v)) return listValues(integersOf(v));
5758
6231
  throw wrongKind("list", v);
@@ -5762,7 +6235,7 @@ const property = (name, v, delimiter = null) => {
5762
6235
  case "characters":
5763
6236
  case "code points":
5764
6237
  if (v.kind !== "text") throw wrongKind("text", v);
5765
- return texts(spans(textOf(v), singular(name)).map((s) => s.text));
6238
+ return name === "code points" ? texts(spans(textOf(v), "code point").map((s) => s.text)) : listValues(spans(textOf(v), singular(name), ",", textStorage(v).characters).map((s) => sliceText(v, s.from, s.to)));
5766
6239
  case "bytes": return listValues(Array.from(bytesOperand(v), (x) => integerValue(BigInt(x))));
5767
6240
  }
5768
6241
  throw new Error(`unknown property ${name}`);
@@ -5771,7 +6244,7 @@ const singular = (name) => name === "code points" ? "code point" : name.slice(0,
5771
6244
  const delimiterText = (d) => {
5772
6245
  if (d === null) return ",";
5773
6246
  if (d.kind !== "text") throw wrongKind("text", d);
5774
- if (!characters(textOf(d)).length) throw outOfRange("delimiter", d);
6247
+ if (!textOf(d).length) throw outOfRange("delimiter", d);
5775
6248
  return textOf(d);
5776
6249
  };
5777
6250
  const isLineBreak = (ch) => ch === "\n" || ch === "\r" || ch === "\r\n";
@@ -5868,7 +6341,6 @@ const textKinds = /* @__PURE__ */ new Set([
5868
6341
  "item",
5869
6342
  "code point"
5870
6343
  ]);
5871
- const needsCharacterBoundaries = /[^\u0000-\u007f]|\r\n/;
5872
6344
  /** One chunk level read, with `scanned`: the units from the start to the chunk's end. */
5873
6345
  const chunkGet = (kind, indexValue, whole, delimiter) => {
5874
6346
  const index = indexOf(indexValue);
@@ -5876,18 +6348,17 @@ const chunkGet = (kind, indexValue, whole, delimiter) => {
5876
6348
  const s = textOf(whole);
5877
6349
  const d = delimiterText(delimiter);
5878
6350
  if (kind === "character") {
5879
- const boundaries = needsCharacterBoundaries.test(s) ? characterBoundaries(s) : null;
5880
- const units = boundaries ? boundaries.length - 1 : s.length;
6351
+ const units = textStorage(whole).characterCount;
5881
6352
  const at = covered(index, units);
5882
6353
  return at ? {
5883
- result: text(s.slice(boundaries ? boundaries[at[0] - 1] : at[0] - 1, boundaries ? boundaries[at[1]] : at[1])),
6354
+ result: sliceText(whole, at[0] - 1, at[1]),
5884
6355
  scanned: at[1]
5885
6356
  } : {
5886
6357
  result: text(""),
5887
6358
  scanned: units
5888
6359
  };
5889
6360
  }
5890
- const cs = kind === "code point" ? Array.from(s) : characters(s);
6361
+ const cs = kind === "code point" ? Array.from(s) : textStorage(whole).characters;
5891
6362
  const units = cs.length;
5892
6363
  if (kind === "code point") {
5893
6364
  const at = covered(index, units);
@@ -5906,7 +6377,7 @@ const chunkGet = (kind, indexValue, whole, delimiter) => {
5906
6377
  scanned: units
5907
6378
  };
5908
6379
  return {
5909
- result: text(cs.slice(chunks[at[0] - 1].from, chunks[at[1] - 1].to).join("")),
6380
+ result: sliceText(whole, chunks[at[0] - 1].from, chunks[at[1] - 1].to),
5910
6381
  scanned: chunks[at[1] - 1].to
5911
6382
  };
5912
6383
  }
@@ -5941,7 +6412,7 @@ const chunkGet = (kind, indexValue, whole, delimiter) => {
5941
6412
  /** Whether a chunk is there, for `delete`'s tests. */
5942
6413
  const chunkThere = (kind, indexValue, whole, delimiter) => {
5943
6414
  const index = indexOf(indexValue);
5944
- const n = whole.kind === "text" && textKinds.has(kind) ? spans(textOf(whole), kind, delimiterText(delimiter)).length : kind === "item" && whole.kind === "list" ? whole.length : kind === "item" && isIntegerRange(whole) ? itemsOf(whole) : kind === "byte" ? bytesOperand(whole).length : -1;
6415
+ const n = whole.kind === "text" && textKinds.has(kind) ? spans(textOf(whole), kind, delimiterText(delimiter), textStorage(whole).characters).length : kind === "item" && whole.kind === "list" ? whole.length : kind === "item" && isIntegerRange(whole) ? itemsOf(whole) : kind === "byte" ? bytesOperand(whole).length : -1;
5945
6416
  if (n < 0) throw wrongKind(kind === "item" ? "list" : "text", whole);
5946
6417
  return covered(index, n) !== null;
5947
6418
  };
@@ -5961,7 +6432,7 @@ const chunkSet = (kind, indexValue, whole, part, delimiter) => {
5961
6432
  if (whole.kind === "text" && textKinds.has(kind)) {
5962
6433
  const d = delimiterText(delimiter);
5963
6434
  let s = textOf(whole);
5964
- let chunks = spans(s, kind, d);
6435
+ let chunks = spans(s, kind, d, textStorage(whole).characters);
5965
6436
  const n = chunks.length;
5966
6437
  const a = fromEnd(index.from, n);
5967
6438
  const b = fromEnd(index.to, n);
@@ -5969,7 +6440,7 @@ const chunkSet = (kind, indexValue, whole, part, delimiter) => {
5969
6440
  if (b > BigInt(n)) {
5970
6441
  if (kind !== "item" && kind !== "line") throw writeOutOfRange(kind, index);
5971
6442
  const pad = kind === "line" ? "\n" : d;
5972
- const cs = characters(s);
6443
+ const cs = textStorage(whole).characters;
5973
6444
  const ends = kind === "line" && cs.length > 0 && isLineBreak(cs.at(-1)) || kind === "item" && s.length > 0 && s.endsWith(d);
5974
6445
  const count = Number(b) - n - 1 + (s === "" || ends ? 0 : 1);
5975
6446
  s += pad.repeat(count);
@@ -5978,7 +6449,7 @@ const chunkSet = (kind, indexValue, whole, part, delimiter) => {
5978
6449
  }
5979
6450
  const lo = Number(a);
5980
6451
  const hi = Number(b);
5981
- const units = kind === "code point" ? Array.from(s) : characters(s);
6452
+ const units = kind === "code point" ? Array.from(s) : s === textOf(whole) ? textStorage(whole).characters : characters(s);
5982
6453
  const from = chunks[lo - 1].from;
5983
6454
  const to = hi <= chunks.length ? chunks[hi - 1].to : units.length;
5984
6455
  return text(units.slice(0, from).join("") + textForm(part) + units.slice(to).join(""));
@@ -6034,7 +6505,7 @@ const chunkDelete = (kind, indexValue, whole, delimiter) => {
6034
6505
  const chunks = spans(s, kind, delimiterText(delimiter));
6035
6506
  const at = covered(index, chunks.length);
6036
6507
  if (!at) return whole;
6037
- const units = kind === "code point" ? Array.from(s) : characters(s);
6508
+ const units = kind === "code point" ? Array.from(s) : textStorage(whole).characters;
6038
6509
  let from = chunks[at[0] - 1].from;
6039
6510
  let to = chunks[at[1] - 1].to;
6040
6511
  if (kind === "word" || kind === "line" || kind === "item") {
@@ -6082,7 +6553,7 @@ const appendTo = (current, e, op) => {
6082
6553
  cacheListExtension(result, current, e, all);
6083
6554
  return result;
6084
6555
  }
6085
- if (current.kind === "text") return text(after ? textOf(current) + textForm(e) : textForm(e) + textOf(current));
6556
+ if (current.kind === "text") return after ? concat(current, e) : concat(e, current);
6086
6557
  throw wrongKind("text", current);
6087
6558
  };
6088
6559
  const folded = /* @__PURE__ */ new WeakMap();
@@ -6184,7 +6655,7 @@ const splice = (template, values) => {
6184
6655
  };
6185
6656
  const subjectText = (s) => {
6186
6657
  if (s.kind !== "text") throw wrongKind("text", s);
6187
- return characters(textOf(s));
6658
+ return textStorage(s).characters;
6188
6659
  };
6189
6660
  const byteUnits = (b) => Array.from(b, (x) => String.fromCodePoint(57344 + x));
6190
6661
  /** `contains`, `begins with`, `ends with` and `matches`, with their `steps`. */
@@ -6618,4 +7089,4 @@ const fromBase64 = (s) => {
6618
7089
  return toBase64(out) === s ? out : void 0;
6619
7090
  };
6620
7091
  //#endregion
6621
- export { instructionSpec as $, matchesOf as A, smallOf as B, integerValue as C, makePatternValue as D, keyText as E, property as F, charge as G, textForm as H, randomBound as I, rateOf as J, fixedRates as K, search as L, negated as M, outOfRange as N, makeRange as O, prepareConversion as P, functionHead as Q, setKey as R, hasKey as S, isKind as T, waitUs as U, splice as V, wrongKind as W, arityOf as X, sizeOf as Y, disassemble as Z, convert as _, appendTo as a, splicesOf as at, equals as b, builtinDefaults as c, costModel as ct, chunkDelete as d, limitDefaults as dt, opcodes as et, chunkGet as f, reservedErrorKeys as ft, concat as g, comparison as h, ScriptError as i, quantityText as it, member as j, matchCaptures as k, byteOf as l, errorMessages as lt, chunkThere as m, toBase64 as n, numberText as nt, arithmetic as o, textDisplay as ot, chunkSet as p, partSize as q, NotImplementedError as r, patternSource as rt, builtin as s, compareText as st, fromBase64 as t, capturesOf$1 as tt, canConvert as u, languageVersion as ut, decodeUtf8 as v, isEmpty as w, getKey as x, deleteKey as y, smallArithmetic as z };
7092
+ export { sizeOf as $, matchesOf as A, smallOf as B, integerValue as C, makePatternValue as D, keyText as E, property as F, wrongKind as G, subjectText as H, randomBound as I, fixedRates as J, cacheBuild as K, search as L, negated as M, outOfRange as N, makeRange as O, prepareConversion as P, resetMeasured as Q, setKey as R, hasKey as S, isKind as T, textForm as U, splice as V, waitUs as W, partSize as X, keysContents as Y, rateOf as Z, convert as _, appendTo as a, capturesOf$1 as at, equals as b, builtinDefaults as c, quantityText as ct, chunkDelete as d, compareText as dt, arityOf as et, chunkGet as f, costModel as ft, concat as g, reservedErrorKeys as gt, comparison as h, limitDefaults as ht, ScriptError as i, opcodes as it, member as j, matchCaptures as k, byteOf as l, splicesOf as lt, chunkThere as m, languageVersion as mt, toBase64 as n, functionHead as nt, arithmetic as o, numberText as ot, chunkSet as p, errorMessages as pt, charge as q, NotImplementedError as r, instructionSpec as rt, builtin as s, patternSource as st, fromBase64 as t, disassemble as tt, canConvert as u, textDisplay as ut, decodeUtf8 as v, isEmpty as w, getKey as x, deleteKey as y, smallArithmetic as z };