@actual-app/api 26.2.0-nightly.20260120 → 26.2.0-nightly.20260122

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.
@@ -116590,7 +116590,7 @@ app$f.events.on("sync", ({ type: type2 }) => {
116590
116590
  }
116591
116591
  }
116592
116592
  });
116593
- async function createScheduleList(templates, current_month, category) {
116593
+ async function createScheduleList(templates, current_month, category, currency) {
116594
116594
  const t2 = [];
116595
116595
  const errors2 = [];
116596
116596
  for (const template of templates) {
@@ -116599,10 +116599,21 @@ async function createScheduleList(templates, current_month, category) {
116599
116599
  const conditions = rule.serialize().conditions;
116600
116600
  const { date: dateConditions, amount: amountCondition } = extractScheduleConds(conditions);
116601
116601
  let scheduleAmount = amountCondition.op === "isbetween" ? Math.round(amountCondition.value.num1 + amountCondition.value.num2) / 2 : amountCondition.value;
116602
- if (template.adjustment) {
116603
- const adjustmentFactor = 1 + template.adjustment / 100;
116604
- scheduleAmount = Math.round(scheduleAmount * adjustmentFactor);
116602
+ if (template.adjustment !== void 0 && template.adjustmentType) {
116603
+ switch (template.adjustmentType) {
116604
+ case "percent": {
116605
+ const adjustmentFactor = 1 + template.adjustment / 100;
116606
+ scheduleAmount = scheduleAmount * adjustmentFactor;
116607
+ break;
116608
+ }
116609
+ case "fixed": {
116610
+ const sign22 = scheduleAmount < 0 ? -1 : 1;
116611
+ scheduleAmount += sign22 * amountToInteger(template.adjustment, currency.decimalPlaces);
116612
+ break;
116613
+ }
116614
+ }
116605
116615
  }
116616
+ scheduleAmount = Math.round(scheduleAmount);
116606
116617
  const { amount: postRuleAmount, subtransactions } = rule.execActions({
116607
116618
  amount: scheduleAmount,
116608
116619
  category: category.id,
@@ -116726,9 +116737,9 @@ function getSinkingTotal(t2) {
116726
116737
  }
116727
116738
  return total;
116728
116739
  }
116729
- async function runSchedule(template_lines, current_month, balance, remainder, last_month_balance, to_budget, errors2, category) {
116740
+ async function runSchedule(template_lines, current_month, balance, remainder, last_month_balance, to_budget, errors2, category, currency) {
116730
116741
  const scheduleTemplates = template_lines.filter((t22) => t22.type === "schedule");
116731
- const t2 = await createScheduleList(scheduleTemplates, current_month, category);
116742
+ const t2 = await createScheduleList(scheduleTemplates, current_month, category, currency);
116732
116743
  errors2 = errors2.concat(t2.errors);
116733
116744
  const isPayMonthOf = (c) => c.full || (c.target_frequency === "monthly" || !c.target_frequency) && c.target_interval === 1 && c.num_months === 0 || c.target_frequency === "weekly" && c.target_interval <= 4 || c.target_frequency === "daily" && c.target_interval <= 31 || isReflectBudget();
116734
116745
  const isSubMonthly = (c) => c.target_frequency === "weekly" || c.target_frequency === "daily";
@@ -116868,34 +116879,34 @@ function peg$parse(input, options) {
116868
116879
  const peg$c5 = "]";
116869
116880
  const peg$c6 = "increase";
116870
116881
  const peg$c7 = "decrease";
116871
- const peg$c8 = "month";
116872
- const peg$c9 = "year";
116873
- const peg$c10 = "years";
116874
- const peg$c11 = "per week starting";
116875
- const peg$c12 = "per day";
116876
- const peg$c13 = "previous";
116877
- const peg$c14 = "day";
116878
- const peg$c15 = "days";
116879
- const peg$c16 = "spend";
116880
- const peg$c17 = "from";
116881
- const peg$c18 = "week";
116882
- const peg$c19 = "weeks";
116883
- const peg$c20 = "by";
116884
- const peg$c21 = "of";
116885
- const peg$c22 = "repeat";
116886
- const peg$c23 = "every";
116887
- const peg$c24 = "starting";
116888
- const peg$c25 = "up";
116889
- const peg$c26 = "to";
116890
- const peg$c27 = "hold";
116891
- const peg$c28 = "schedule";
116892
- const peg$c29 = "full";
116893
- const peg$c30 = "-";
116894
- const peg$c31 = "remainder";
116895
- const peg$c32 = "#template";
116896
- const peg$c33 = "#goal";
116897
- const peg$c34 = ".";
116898
- const peg$c35 = "%";
116882
+ const peg$c8 = ".";
116883
+ const peg$c9 = "%";
116884
+ const peg$c10 = "month";
116885
+ const peg$c11 = "year";
116886
+ const peg$c12 = "years";
116887
+ const peg$c13 = "per week starting";
116888
+ const peg$c14 = "per day";
116889
+ const peg$c15 = "previous";
116890
+ const peg$c16 = "day";
116891
+ const peg$c17 = "days";
116892
+ const peg$c18 = "spend";
116893
+ const peg$c19 = "from";
116894
+ const peg$c20 = "week";
116895
+ const peg$c21 = "weeks";
116896
+ const peg$c22 = "by";
116897
+ const peg$c23 = "of";
116898
+ const peg$c24 = "repeat";
116899
+ const peg$c25 = "every";
116900
+ const peg$c26 = "starting";
116901
+ const peg$c27 = "up";
116902
+ const peg$c28 = "to";
116903
+ const peg$c29 = "hold";
116904
+ const peg$c30 = "schedule";
116905
+ const peg$c31 = "full";
116906
+ const peg$c32 = "-";
116907
+ const peg$c33 = "remainder";
116908
+ const peg$c34 = "#template";
116909
+ const peg$c35 = "#goal";
116899
116910
  const peg$r0 = /^[ \t]/;
116900
116911
  const peg$r1 = /^[0-9]/;
116901
116912
  const peg$r2 = /^[1-9]/;
@@ -116910,43 +116921,43 @@ function peg$parse(input, options) {
116910
116921
  const peg$e5 = peg$literalExpectation("]", false);
116911
116922
  const peg$e6 = peg$literalExpectation("increase", true);
116912
116923
  const peg$e7 = peg$literalExpectation("decrease", true);
116913
- const peg$e8 = peg$otherExpectation("repeat interval");
116914
- const peg$e9 = peg$literalExpectation("month", true);
116915
- const peg$e10 = peg$literalExpectation("year", true);
116916
- const peg$e11 = peg$literalExpectation("years", true);
116917
- const peg$e12 = peg$literalExpectation("per week starting", true);
116918
- const peg$e13 = peg$literalExpectation("per day", true);
116919
- const peg$e14 = peg$literalExpectation("previous", true);
116920
- const peg$e15 = peg$literalExpectation("day", true);
116921
- const peg$e16 = peg$literalExpectation("days", true);
116922
- const peg$e17 = peg$literalExpectation("spend", true);
116923
- const peg$e18 = peg$literalExpectation("from", true);
116924
- const peg$e19 = peg$literalExpectation("week", true);
116925
- const peg$e20 = peg$literalExpectation("weeks", true);
116926
- const peg$e21 = peg$literalExpectation("by", true);
116927
- const peg$e22 = peg$literalExpectation("of", true);
116928
- const peg$e23 = peg$literalExpectation("repeat", true);
116929
- const peg$e24 = peg$literalExpectation("every", true);
116930
- const peg$e25 = peg$literalExpectation("starting", true);
116931
- const peg$e26 = peg$literalExpectation("up", true);
116932
- const peg$e27 = peg$literalExpectation("to", true);
116933
- const peg$e28 = peg$literalExpectation("hold", true);
116934
- const peg$e29 = peg$literalExpectation("schedule", true);
116935
- const peg$e30 = peg$literalExpectation("full", true);
116936
- const peg$e31 = peg$literalExpectation("-", true);
116937
- const peg$e32 = peg$literalExpectation("remainder", true);
116938
- const peg$e33 = peg$literalExpectation("#template", false);
116939
- const peg$e34 = peg$literalExpectation("#goal", true);
116940
- const peg$e35 = peg$classExpectation([" ", " "], false, false, false);
116941
- const peg$e36 = peg$otherExpectation("digit");
116942
- const peg$e37 = peg$classExpectation([["0", "9"]], false, false, false);
116943
- const peg$e38 = peg$otherExpectation("number");
116944
- const peg$e39 = peg$classExpectation([["1", "9"]], false, false, false);
116945
- const peg$e40 = peg$otherExpectation("amount");
116946
- const peg$e41 = peg$literalExpectation("-", false);
116947
- const peg$e42 = peg$literalExpectation(".", false);
116948
- const peg$e43 = peg$otherExpectation("percentage");
116949
- const peg$e44 = peg$literalExpectation("%", false);
116924
+ const peg$e8 = peg$literalExpectation(".", false);
116925
+ const peg$e9 = peg$literalExpectation("%", false);
116926
+ const peg$e10 = peg$otherExpectation("repeat interval");
116927
+ const peg$e11 = peg$literalExpectation("month", true);
116928
+ const peg$e12 = peg$literalExpectation("year", true);
116929
+ const peg$e13 = peg$literalExpectation("years", true);
116930
+ const peg$e14 = peg$literalExpectation("per week starting", true);
116931
+ const peg$e15 = peg$literalExpectation("per day", true);
116932
+ const peg$e16 = peg$literalExpectation("previous", true);
116933
+ const peg$e17 = peg$literalExpectation("day", true);
116934
+ const peg$e18 = peg$literalExpectation("days", true);
116935
+ const peg$e19 = peg$literalExpectation("spend", true);
116936
+ const peg$e20 = peg$literalExpectation("from", true);
116937
+ const peg$e21 = peg$literalExpectation("week", true);
116938
+ const peg$e22 = peg$literalExpectation("weeks", true);
116939
+ const peg$e23 = peg$literalExpectation("by", true);
116940
+ const peg$e24 = peg$literalExpectation("of", true);
116941
+ const peg$e25 = peg$literalExpectation("repeat", true);
116942
+ const peg$e26 = peg$literalExpectation("every", true);
116943
+ const peg$e27 = peg$literalExpectation("starting", true);
116944
+ const peg$e28 = peg$literalExpectation("up", true);
116945
+ const peg$e29 = peg$literalExpectation("to", true);
116946
+ const peg$e30 = peg$literalExpectation("hold", true);
116947
+ const peg$e31 = peg$literalExpectation("schedule", true);
116948
+ const peg$e32 = peg$literalExpectation("full", true);
116949
+ const peg$e33 = peg$literalExpectation("-", true);
116950
+ const peg$e34 = peg$literalExpectation("remainder", true);
116951
+ const peg$e35 = peg$literalExpectation("#template", false);
116952
+ const peg$e36 = peg$literalExpectation("#goal", true);
116953
+ const peg$e37 = peg$classExpectation([" ", " "], false, false, false);
116954
+ const peg$e38 = peg$otherExpectation("digit");
116955
+ const peg$e39 = peg$classExpectation([["0", "9"]], false, false, false);
116956
+ const peg$e40 = peg$otherExpectation("number");
116957
+ const peg$e41 = peg$classExpectation([["1", "9"]], false, false, false);
116958
+ const peg$e42 = peg$otherExpectation("amount");
116959
+ const peg$e43 = peg$literalExpectation("-", false);
116960
+ const peg$e44 = peg$otherExpectation("percentage");
116950
116961
  const peg$e45 = peg$otherExpectation("year");
116951
116962
  const peg$e46 = peg$otherExpectation("month");
116952
116963
  const peg$e47 = peg$otherExpectation("day");
@@ -116980,13 +116991,13 @@ function peg$parse(input, options) {
116980
116991
  return { type: "simple", monthly: null, limit, priority: template.priority, directive: template.directive };
116981
116992
  }
116982
116993
  function peg$f5(template, schedule, full, name, modifiers) {
116983
- return { type: "schedule", name: name.trim(), priority: template.priority, directive: template.directive, full, adjustment: modifiers?.adjustment };
116994
+ return { type: "schedule", name: name.trim(), priority: template.priority, directive: template.directive, full, adjustment: modifiers?.adjustment, adjustmentType: modifiers?.adjustmentType };
116984
116995
  }
116985
116996
  function peg$f6(template, remainder, limit) {
116986
116997
  return { type: "remainder", priority: null, directive: template.directive, weight: remainder, limit };
116987
116998
  }
116988
- function peg$f7(template, amount) {
116989
- return { type: "average", numMonths: +amount, priority: template.priority, directive: template.directive };
116999
+ function peg$f7(template, amount, modifiers) {
117000
+ return { type: "average", numMonths: +amount, priority: template.priority, directive: template.directive, adjustment: modifiers?.adjustment, adjustmentType: modifiers?.adjustmentType };
116990
117001
  }
116991
117002
  function peg$f8(template, lookBack, limit) {
116992
117003
  return { type: "copy", priority: template.priority, directive: template.directive, lookBack: +lookBack, limit };
@@ -116999,96 +117010,102 @@ function peg$parse(input, options) {
116999
117010
  }
117000
117011
  function peg$f11(op, value) {
117001
117012
  const multiplier = op.toLowerCase() === "increase" ? 1 : -1;
117002
- return { adjustment: multiplier * +value };
117013
+ return { adjustment: multiplier * +value.value, adjustmentType: value.type };
117014
+ }
117015
+ function peg$f12(value) {
117016
+ return { value, type: "percent" };
117003
117017
  }
117004
- function peg$f12() {
117018
+ function peg$f13(value) {
117019
+ return { value, type: "fixed" };
117020
+ }
117021
+ function peg$f14() {
117005
117022
  return { annual: false };
117006
117023
  }
117007
- function peg$f13(months) {
117024
+ function peg$f15(months) {
117008
117025
  return { annual: false, repeat: +months };
117009
117026
  }
117010
- function peg$f14() {
117027
+ function peg$f16() {
117011
117028
  return { annual: true };
117012
117029
  }
117013
- function peg$f15(years) {
117030
+ function peg$f17(years) {
117014
117031
  return { annual: true, repeat: +years };
117015
117032
  }
117016
- function peg$f16(amount, start, hold) {
117033
+ function peg$f18(amount, start, hold) {
117017
117034
  return { amount, hold, period: "weekly", start };
117018
117035
  }
117019
- function peg$f17(amount, hold) {
117036
+ function peg$f19(amount, hold) {
117020
117037
  return { amount, hold, period: "daily", start: null };
117021
117038
  }
117022
- function peg$f18(amount, hold) {
117039
+ function peg$f20(amount, hold) {
117023
117040
  return { amount, hold, period: "monthly", start: null };
117024
117041
  }
117025
- function peg$f19(percent) {
117042
+ function peg$f21(percent) {
117026
117043
  return { percent, prev: true };
117027
117044
  }
117028
- function peg$f20(percent) {
117045
+ function peg$f22(percent) {
117029
117046
  return { percent, prev: false };
117030
117047
  }
117031
- function peg$f21() {
117048
+ function peg$f23() {
117032
117049
  return { period: "day", amount: 1 };
117033
117050
  }
117034
- function peg$f22(n) {
117051
+ function peg$f24(n) {
117035
117052
  return { period: "day", amount: +n };
117036
117053
  }
117037
- function peg$f23() {
117054
+ function peg$f25() {
117038
117055
  return { period: "week", amount: 1 };
117039
117056
  }
117040
- function peg$f24(n) {
117057
+ function peg$f26(n) {
117041
117058
  return { period: "week", amount: +n };
117042
117059
  }
117043
- function peg$f25(n) {
117060
+ function peg$f27(n) {
117044
117061
  return { period: "month", amount: +n };
117045
117062
  }
117046
- function peg$f26() {
117063
+ function peg$f28() {
117047
117064
  return { period: "year", amount: 1 };
117048
117065
  }
117049
- function peg$f27(n) {
117066
+ function peg$f29(n) {
117050
117067
  return { period: "year", amount: +n };
117051
117068
  }
117052
- function peg$f28(month) {
117069
+ function peg$f30(month) {
117053
117070
  return month;
117054
117071
  }
117055
- function peg$f29() {
117072
+ function peg$f31() {
117056
117073
  return true;
117057
117074
  }
117058
- function peg$f30() {
117075
+ function peg$f32() {
117059
117076
  return text();
117060
117077
  }
117061
- function peg$f31() {
117078
+ function peg$f33() {
117062
117079
  return true;
117063
117080
  }
117064
- function peg$f32(number2) {
117081
+ function peg$f34(number2) {
117065
117082
  return number2;
117066
117083
  }
117067
- function peg$f33(weight) {
117084
+ function peg$f35(weight) {
117068
117085
  return +weight || 1;
117069
117086
  }
117070
- function peg$f34(priority) {
117087
+ function peg$f36(priority) {
117071
117088
  return { priority: +priority, directive: "template" };
117072
117089
  }
117073
- function peg$f35() {
117090
+ function peg$f37() {
117074
117091
  return "goal";
117075
117092
  }
117076
- function peg$f36() {
117093
+ function peg$f38() {
117077
117094
  return text();
117078
117095
  }
117079
- function peg$f37(amount) {
117096
+ function peg$f39(amount) {
117080
117097
  return +amount;
117081
117098
  }
117082
- function peg$f38(percent) {
117099
+ function peg$f40(percent) {
117083
117100
  return percent;
117084
117101
  }
117085
- function peg$f39(symbol) {
117102
+ function peg$f41(symbol) {
117086
117103
  return new RegExp("\\p{Sc}", "u").test(symbol);
117087
117104
  }
117088
- function peg$f40() {
117105
+ function peg$f42() {
117089
117106
  return text().trim();
117090
117107
  }
117091
- function peg$f41() {
117108
+ function peg$f43() {
117092
117109
  return text();
117093
117110
  }
117094
117111
  let peg$currPos = options.peg$currPos | 0;
@@ -117470,8 +117487,12 @@ function peg$parse(input, options) {
117470
117487
  if (s7 === peg$FAILED) {
117471
117488
  s7 = null;
117472
117489
  }
117490
+ s8 = peg$parsemodifiers();
117491
+ if (s8 === peg$FAILED) {
117492
+ s8 = null;
117493
+ }
117473
117494
  peg$savedPos = s0;
117474
- s0 = peg$f7(s1, s5);
117495
+ s0 = peg$f7(s1, s5, s8);
117475
117496
  }
117476
117497
  else {
117477
117498
  peg$currPos = s0;
@@ -117647,7 +117668,7 @@ function peg$parse(input, options) {
117647
117668
  }
117648
117669
  if (s1 !== peg$FAILED) {
117649
117670
  peg$parse_();
117650
- s3 = peg$parsepercent();
117671
+ s3 = peg$parsepercentOrNumber();
117651
117672
  if (s3 !== peg$FAILED) {
117652
117673
  peg$savedPos = s0;
117653
117674
  s0 = peg$f11(s1, s3);
@@ -117663,23 +117684,187 @@ function peg$parse(input, options) {
117663
117684
  }
117664
117685
  return s0;
117665
117686
  }
117687
+ function peg$parsepercentOrNumber() {
117688
+ let s0, s1, s2, s3, s4, s5, s6, s7;
117689
+ s0 = peg$currPos;
117690
+ s1 = peg$currPos;
117691
+ s2 = peg$currPos;
117692
+ s3 = [];
117693
+ s4 = peg$parsed();
117694
+ if (s4 !== peg$FAILED) {
117695
+ while (s4 !== peg$FAILED) {
117696
+ s3.push(s4);
117697
+ s4 = peg$parsed();
117698
+ }
117699
+ }
117700
+ else {
117701
+ s3 = peg$FAILED;
117702
+ }
117703
+ if (s3 !== peg$FAILED) {
117704
+ s4 = peg$currPos;
117705
+ if (input.charCodeAt(peg$currPos) === 46) {
117706
+ s5 = peg$c8;
117707
+ peg$currPos++;
117708
+ }
117709
+ else {
117710
+ s5 = peg$FAILED;
117711
+ if (peg$silentFails === 0) {
117712
+ peg$fail(peg$e8);
117713
+ }
117714
+ }
117715
+ if (s5 !== peg$FAILED) {
117716
+ s6 = [];
117717
+ s7 = peg$parsed();
117718
+ if (s7 !== peg$FAILED) {
117719
+ while (s7 !== peg$FAILED) {
117720
+ s6.push(s7);
117721
+ s7 = peg$parsed();
117722
+ }
117723
+ }
117724
+ else {
117725
+ s6 = peg$FAILED;
117726
+ }
117727
+ if (s6 === peg$FAILED) {
117728
+ s6 = null;
117729
+ }
117730
+ s5 = [s5, s6];
117731
+ s4 = s5;
117732
+ }
117733
+ else {
117734
+ peg$currPos = s4;
117735
+ s4 = peg$FAILED;
117736
+ }
117737
+ if (s4 === peg$FAILED) {
117738
+ s4 = null;
117739
+ }
117740
+ s3 = [s3, s4];
117741
+ s2 = s3;
117742
+ }
117743
+ else {
117744
+ peg$currPos = s2;
117745
+ s2 = peg$FAILED;
117746
+ }
117747
+ if (s2 !== peg$FAILED) {
117748
+ s1 = input.substring(s1, peg$currPos);
117749
+ }
117750
+ else {
117751
+ s1 = s2;
117752
+ }
117753
+ if (s1 !== peg$FAILED) {
117754
+ s2 = peg$parse_();
117755
+ if (input.charCodeAt(peg$currPos) === 37) {
117756
+ s3 = peg$c9;
117757
+ peg$currPos++;
117758
+ }
117759
+ else {
117760
+ s3 = peg$FAILED;
117761
+ if (peg$silentFails === 0) {
117762
+ peg$fail(peg$e9);
117763
+ }
117764
+ }
117765
+ if (s3 !== peg$FAILED) {
117766
+ peg$savedPos = s0;
117767
+ s0 = peg$f12(s1);
117768
+ }
117769
+ else {
117770
+ peg$currPos = s0;
117771
+ s0 = peg$FAILED;
117772
+ }
117773
+ }
117774
+ else {
117775
+ peg$currPos = s0;
117776
+ s0 = peg$FAILED;
117777
+ }
117778
+ if (s0 === peg$FAILED) {
117779
+ s0 = peg$currPos;
117780
+ s1 = peg$currPos;
117781
+ s2 = peg$currPos;
117782
+ s3 = [];
117783
+ s4 = peg$parsed();
117784
+ if (s4 !== peg$FAILED) {
117785
+ while (s4 !== peg$FAILED) {
117786
+ s3.push(s4);
117787
+ s4 = peg$parsed();
117788
+ }
117789
+ }
117790
+ else {
117791
+ s3 = peg$FAILED;
117792
+ }
117793
+ if (s3 !== peg$FAILED) {
117794
+ s4 = peg$currPos;
117795
+ if (input.charCodeAt(peg$currPos) === 46) {
117796
+ s5 = peg$c8;
117797
+ peg$currPos++;
117798
+ }
117799
+ else {
117800
+ s5 = peg$FAILED;
117801
+ if (peg$silentFails === 0) {
117802
+ peg$fail(peg$e8);
117803
+ }
117804
+ }
117805
+ if (s5 !== peg$FAILED) {
117806
+ s6 = [];
117807
+ s7 = peg$parsed();
117808
+ if (s7 !== peg$FAILED) {
117809
+ while (s7 !== peg$FAILED) {
117810
+ s6.push(s7);
117811
+ s7 = peg$parsed();
117812
+ }
117813
+ }
117814
+ else {
117815
+ s6 = peg$FAILED;
117816
+ }
117817
+ if (s6 === peg$FAILED) {
117818
+ s6 = null;
117819
+ }
117820
+ s5 = [s5, s6];
117821
+ s4 = s5;
117822
+ }
117823
+ else {
117824
+ peg$currPos = s4;
117825
+ s4 = peg$FAILED;
117826
+ }
117827
+ if (s4 === peg$FAILED) {
117828
+ s4 = null;
117829
+ }
117830
+ s3 = [s3, s4];
117831
+ s2 = s3;
117832
+ }
117833
+ else {
117834
+ peg$currPos = s2;
117835
+ s2 = peg$FAILED;
117836
+ }
117837
+ if (s2 !== peg$FAILED) {
117838
+ s1 = input.substring(s1, peg$currPos);
117839
+ }
117840
+ else {
117841
+ s1 = s2;
117842
+ }
117843
+ if (s1 !== peg$FAILED) {
117844
+ peg$savedPos = s0;
117845
+ s1 = peg$f13(s1);
117846
+ }
117847
+ s0 = s1;
117848
+ }
117849
+ return s0;
117850
+ }
117666
117851
  function peg$parserepeat() {
117667
117852
  let s0, s1, s3;
117668
117853
  peg$silentFails++;
117669
117854
  s0 = peg$currPos;
117670
117855
  s1 = input.substr(peg$currPos, 5);
117671
- if (s1.toLowerCase() === peg$c8) {
117856
+ if (s1.toLowerCase() === peg$c10) {
117672
117857
  peg$currPos += 5;
117673
117858
  }
117674
117859
  else {
117675
117860
  s1 = peg$FAILED;
117676
117861
  if (peg$silentFails === 0) {
117677
- peg$fail(peg$e9);
117862
+ peg$fail(peg$e11);
117678
117863
  }
117679
117864
  }
117680
117865
  if (s1 !== peg$FAILED) {
117681
117866
  peg$savedPos = s0;
117682
- s1 = peg$f12();
117867
+ s1 = peg$f14();
117683
117868
  }
117684
117869
  s0 = s1;
117685
117870
  if (s0 === peg$FAILED) {
@@ -117699,7 +117884,7 @@ function peg$parse(input, options) {
117699
117884
  }
117700
117885
  if (s3 !== peg$FAILED) {
117701
117886
  peg$savedPos = s0;
117702
- s0 = peg$f13(s1);
117887
+ s0 = peg$f15(s1);
117703
117888
  }
117704
117889
  else {
117705
117890
  peg$currPos = s0;
@@ -117713,18 +117898,18 @@ function peg$parse(input, options) {
117713
117898
  if (s0 === peg$FAILED) {
117714
117899
  s0 = peg$currPos;
117715
117900
  s1 = input.substr(peg$currPos, 4);
117716
- if (s1.toLowerCase() === peg$c9) {
117901
+ if (s1.toLowerCase() === peg$c11) {
117717
117902
  peg$currPos += 4;
117718
117903
  }
117719
117904
  else {
117720
117905
  s1 = peg$FAILED;
117721
117906
  if (peg$silentFails === 0) {
117722
- peg$fail(peg$e10);
117907
+ peg$fail(peg$e12);
117723
117908
  }
117724
117909
  }
117725
117910
  if (s1 !== peg$FAILED) {
117726
117911
  peg$savedPos = s0;
117727
- s1 = peg$f14();
117912
+ s1 = peg$f16();
117728
117913
  }
117729
117914
  s0 = s1;
117730
117915
  if (s0 === peg$FAILED) {
@@ -117733,18 +117918,18 @@ function peg$parse(input, options) {
117733
117918
  if (s1 !== peg$FAILED) {
117734
117919
  peg$parse_();
117735
117920
  s3 = input.substr(peg$currPos, 5);
117736
- if (s3.toLowerCase() === peg$c10) {
117921
+ if (s3.toLowerCase() === peg$c12) {
117737
117922
  peg$currPos += 5;
117738
117923
  }
117739
117924
  else {
117740
117925
  s3 = peg$FAILED;
117741
117926
  if (peg$silentFails === 0) {
117742
- peg$fail(peg$e11);
117927
+ peg$fail(peg$e13);
117743
117928
  }
117744
117929
  }
117745
117930
  if (s3 !== peg$FAILED) {
117746
117931
  peg$savedPos = s0;
117747
- s0 = peg$f15(s1);
117932
+ s0 = peg$f17(s1);
117748
117933
  }
117749
117934
  else {
117750
117935
  peg$currPos = s0;
@@ -117762,7 +117947,7 @@ function peg$parse(input, options) {
117762
117947
  if (s0 === peg$FAILED) {
117763
117948
  s1 = peg$FAILED;
117764
117949
  if (peg$silentFails === 0) {
117765
- peg$fail(peg$e8);
117950
+ peg$fail(peg$e10);
117766
117951
  }
117767
117952
  }
117768
117953
  return s0;
@@ -117778,13 +117963,13 @@ function peg$parse(input, options) {
117778
117963
  if (s4 !== peg$FAILED) {
117779
117964
  peg$parse_();
117780
117965
  s6 = input.substr(peg$currPos, 17);
117781
- if (s6.toLowerCase() === peg$c11) {
117966
+ if (s6.toLowerCase() === peg$c13) {
117782
117967
  peg$currPos += 17;
117783
117968
  }
117784
117969
  else {
117785
117970
  s6 = peg$FAILED;
117786
117971
  if (peg$silentFails === 0) {
117787
- peg$fail(peg$e12);
117972
+ peg$fail(peg$e14);
117788
117973
  }
117789
117974
  }
117790
117975
  if (s6 !== peg$FAILED) {
@@ -117797,7 +117982,7 @@ function peg$parse(input, options) {
117797
117982
  s10 = null;
117798
117983
  }
117799
117984
  peg$savedPos = s0;
117800
- s0 = peg$f16(s4, s8, s10);
117985
+ s0 = peg$f18(s4, s8, s10);
117801
117986
  }
117802
117987
  else {
117803
117988
  peg$currPos = s0;
@@ -117828,13 +118013,13 @@ function peg$parse(input, options) {
117828
118013
  if (s4 !== peg$FAILED) {
117829
118014
  peg$parse_();
117830
118015
  s6 = input.substr(peg$currPos, 7);
117831
- if (s6.toLowerCase() === peg$c12) {
118016
+ if (s6.toLowerCase() === peg$c14) {
117832
118017
  peg$currPos += 7;
117833
118018
  }
117834
118019
  else {
117835
118020
  s6 = peg$FAILED;
117836
118021
  if (peg$silentFails === 0) {
117837
- peg$fail(peg$e13);
118022
+ peg$fail(peg$e15);
117838
118023
  }
117839
118024
  }
117840
118025
  if (s6 !== peg$FAILED) {
@@ -117844,7 +118029,7 @@ function peg$parse(input, options) {
117844
118029
  s8 = null;
117845
118030
  }
117846
118031
  peg$savedPos = s0;
117847
- s0 = peg$f17(s4, s8);
118032
+ s0 = peg$f19(s4, s8);
117848
118033
  }
117849
118034
  else {
117850
118035
  peg$currPos = s0;
@@ -117874,7 +118059,7 @@ function peg$parse(input, options) {
117874
118059
  s6 = null;
117875
118060
  }
117876
118061
  peg$savedPos = s0;
117877
- s0 = peg$f18(s4, s6);
118062
+ s0 = peg$f20(s4, s6);
117878
118063
  }
117879
118064
  else {
117880
118065
  peg$currPos = s0;
@@ -117899,19 +118084,19 @@ function peg$parse(input, options) {
117899
118084
  if (s3 !== peg$FAILED) {
117900
118085
  peg$parse_();
117901
118086
  s5 = input.substr(peg$currPos, 8);
117902
- if (s5.toLowerCase() === peg$c13) {
118087
+ if (s5.toLowerCase() === peg$c15) {
117903
118088
  peg$currPos += 8;
117904
118089
  }
117905
118090
  else {
117906
118091
  s5 = peg$FAILED;
117907
118092
  if (peg$silentFails === 0) {
117908
- peg$fail(peg$e14);
118093
+ peg$fail(peg$e16);
117909
118094
  }
117910
118095
  }
117911
118096
  if (s5 !== peg$FAILED) {
117912
118097
  peg$parse_();
117913
118098
  peg$savedPos = s0;
117914
- s0 = peg$f19(s1);
118099
+ s0 = peg$f21(s1);
117915
118100
  }
117916
118101
  else {
117917
118102
  peg$currPos = s0;
@@ -117936,7 +118121,7 @@ function peg$parse(input, options) {
117936
118121
  if (s3 !== peg$FAILED) {
117937
118122
  peg$parse_();
117938
118123
  peg$savedPos = s0;
117939
- s0 = peg$f20(s1);
118124
+ s0 = peg$f22(s1);
117940
118125
  }
117941
118126
  else {
117942
118127
  peg$currPos = s0;
@@ -117954,18 +118139,18 @@ function peg$parse(input, options) {
117954
118139
  let s0, s1, s3;
117955
118140
  s0 = peg$currPos;
117956
118141
  s1 = input.substr(peg$currPos, 3);
117957
- if (s1.toLowerCase() === peg$c14) {
118142
+ if (s1.toLowerCase() === peg$c16) {
117958
118143
  peg$currPos += 3;
117959
118144
  }
117960
118145
  else {
117961
118146
  s1 = peg$FAILED;
117962
118147
  if (peg$silentFails === 0) {
117963
- peg$fail(peg$e15);
118148
+ peg$fail(peg$e17);
117964
118149
  }
117965
118150
  }
117966
118151
  if (s1 !== peg$FAILED) {
117967
118152
  peg$savedPos = s0;
117968
- s1 = peg$f21();
118153
+ s1 = peg$f23();
117969
118154
  }
117970
118155
  s0 = s1;
117971
118156
  if (s0 === peg$FAILED) {
@@ -117974,19 +118159,19 @@ function peg$parse(input, options) {
117974
118159
  if (s1 !== peg$FAILED) {
117975
118160
  peg$parse_();
117976
118161
  s3 = input.substr(peg$currPos, 4);
117977
- if (s3.toLowerCase() === peg$c15) {
118162
+ if (s3.toLowerCase() === peg$c17) {
117978
118163
  peg$currPos += 4;
117979
118164
  }
117980
118165
  else {
117981
118166
  s3 = peg$FAILED;
117982
118167
  if (peg$silentFails === 0) {
117983
- peg$fail(peg$e16);
118168
+ peg$fail(peg$e18);
117984
118169
  }
117985
118170
  }
117986
118171
  if (s3 !== peg$FAILED) {
117987
118172
  peg$parse_();
117988
118173
  peg$savedPos = s0;
117989
- s0 = peg$f22(s1);
118174
+ s0 = peg$f24(s1);
117990
118175
  }
117991
118176
  else {
117992
118177
  peg$currPos = s0;
@@ -118003,7 +118188,7 @@ function peg$parse(input, options) {
118003
118188
  if (s1 !== peg$FAILED) {
118004
118189
  peg$parse_();
118005
118190
  peg$savedPos = s0;
118006
- s0 = peg$f23();
118191
+ s0 = peg$f25();
118007
118192
  }
118008
118193
  else {
118009
118194
  peg$currPos = s0;
@@ -118017,7 +118202,7 @@ function peg$parse(input, options) {
118017
118202
  s3 = peg$parseweeks();
118018
118203
  if (s3 !== peg$FAILED) {
118019
118204
  peg$savedPos = s0;
118020
- s0 = peg$f24(s1);
118205
+ s0 = peg$f26(s1);
118021
118206
  }
118022
118207
  else {
118023
118208
  peg$currPos = s0;
@@ -118046,7 +118231,7 @@ function peg$parse(input, options) {
118046
118231
  if (s3 !== peg$FAILED) {
118047
118232
  peg$parse_();
118048
118233
  peg$savedPos = s0;
118049
- s0 = peg$f25(s1);
118234
+ s0 = peg$f27(s1);
118050
118235
  }
118051
118236
  else {
118052
118237
  peg$currPos = s0;
@@ -118060,19 +118245,19 @@ function peg$parse(input, options) {
118060
118245
  if (s0 === peg$FAILED) {
118061
118246
  s0 = peg$currPos;
118062
118247
  s1 = input.substr(peg$currPos, 4);
118063
- if (s1.toLowerCase() === peg$c9) {
118248
+ if (s1.toLowerCase() === peg$c11) {
118064
118249
  peg$currPos += 4;
118065
118250
  }
118066
118251
  else {
118067
118252
  s1 = peg$FAILED;
118068
118253
  if (peg$silentFails === 0) {
118069
- peg$fail(peg$e10);
118254
+ peg$fail(peg$e12);
118070
118255
  }
118071
118256
  }
118072
118257
  if (s1 !== peg$FAILED) {
118073
118258
  peg$parse_();
118074
118259
  peg$savedPos = s0;
118075
- s0 = peg$f26();
118260
+ s0 = peg$f28();
118076
118261
  }
118077
118262
  else {
118078
118263
  peg$currPos = s0;
@@ -118084,19 +118269,19 @@ function peg$parse(input, options) {
118084
118269
  if (s1 !== peg$FAILED) {
118085
118270
  peg$parse_();
118086
118271
  s3 = input.substr(peg$currPos, 5);
118087
- if (s3.toLowerCase() === peg$c10) {
118272
+ if (s3.toLowerCase() === peg$c12) {
118088
118273
  peg$currPos += 5;
118089
118274
  }
118090
118275
  else {
118091
118276
  s3 = peg$FAILED;
118092
118277
  if (peg$silentFails === 0) {
118093
- peg$fail(peg$e11);
118278
+ peg$fail(peg$e13);
118094
118279
  }
118095
118280
  }
118096
118281
  if (s3 !== peg$FAILED) {
118097
118282
  peg$parse_();
118098
118283
  peg$savedPos = s0;
118099
- s0 = peg$f27(s1);
118284
+ s0 = peg$f29(s1);
118100
118285
  }
118101
118286
  else {
118102
118287
  peg$currPos = s0;
@@ -118120,25 +118305,25 @@ function peg$parse(input, options) {
118120
118305
  s0 = peg$currPos;
118121
118306
  peg$parse_();
118122
118307
  s2 = input.substr(peg$currPos, 5);
118123
- if (s2.toLowerCase() === peg$c16) {
118308
+ if (s2.toLowerCase() === peg$c18) {
118124
118309
  peg$currPos += 5;
118125
118310
  }
118126
118311
  else {
118127
118312
  s2 = peg$FAILED;
118128
118313
  if (peg$silentFails === 0) {
118129
- peg$fail(peg$e17);
118314
+ peg$fail(peg$e19);
118130
118315
  }
118131
118316
  }
118132
118317
  if (s2 !== peg$FAILED) {
118133
118318
  peg$parse_();
118134
118319
  s4 = input.substr(peg$currPos, 4);
118135
- if (s4.toLowerCase() === peg$c17) {
118320
+ if (s4.toLowerCase() === peg$c19) {
118136
118321
  peg$currPos += 4;
118137
118322
  }
118138
118323
  else {
118139
118324
  s4 = peg$FAILED;
118140
118325
  if (peg$silentFails === 0) {
118141
- peg$fail(peg$e18);
118326
+ peg$fail(peg$e20);
118142
118327
  }
118143
118328
  }
118144
118329
  if (s4 !== peg$FAILED) {
@@ -118146,7 +118331,7 @@ function peg$parse(input, options) {
118146
118331
  s6 = peg$parsemonth();
118147
118332
  if (s6 !== peg$FAILED) {
118148
118333
  peg$savedPos = s0;
118149
- s0 = peg$f28(s6);
118334
+ s0 = peg$f30(s6);
118150
118335
  }
118151
118336
  else {
118152
118337
  peg$currPos = s0;
@@ -118167,13 +118352,13 @@ function peg$parse(input, options) {
118167
118352
  function peg$parseweek() {
118168
118353
  let s0;
118169
118354
  s0 = input.substr(peg$currPos, 4);
118170
- if (s0.toLowerCase() === peg$c18) {
118355
+ if (s0.toLowerCase() === peg$c20) {
118171
118356
  peg$currPos += 4;
118172
118357
  }
118173
118358
  else {
118174
118359
  s0 = peg$FAILED;
118175
118360
  if (peg$silentFails === 0) {
118176
- peg$fail(peg$e19);
118361
+ peg$fail(peg$e21);
118177
118362
  }
118178
118363
  }
118179
118364
  return s0;
@@ -118181,13 +118366,13 @@ function peg$parse(input, options) {
118181
118366
  function peg$parseweeks() {
118182
118367
  let s0;
118183
118368
  s0 = input.substr(peg$currPos, 5);
118184
- if (s0.toLowerCase() === peg$c19) {
118369
+ if (s0.toLowerCase() === peg$c21) {
118185
118370
  peg$currPos += 5;
118186
118371
  }
118187
118372
  else {
118188
118373
  s0 = peg$FAILED;
118189
118374
  if (peg$silentFails === 0) {
118190
- peg$fail(peg$e20);
118375
+ peg$fail(peg$e22);
118191
118376
  }
118192
118377
  }
118193
118378
  return s0;
@@ -118195,13 +118380,13 @@ function peg$parse(input, options) {
118195
118380
  function peg$parseby() {
118196
118381
  let s0;
118197
118382
  s0 = input.substr(peg$currPos, 2);
118198
- if (s0.toLowerCase() === peg$c20) {
118383
+ if (s0.toLowerCase() === peg$c22) {
118199
118384
  peg$currPos += 2;
118200
118385
  }
118201
118386
  else {
118202
118387
  s0 = peg$FAILED;
118203
118388
  if (peg$silentFails === 0) {
118204
- peg$fail(peg$e21);
118389
+ peg$fail(peg$e23);
118205
118390
  }
118206
118391
  }
118207
118392
  return s0;
@@ -118209,13 +118394,13 @@ function peg$parse(input, options) {
118209
118394
  function peg$parseof() {
118210
118395
  let s0;
118211
118396
  s0 = input.substr(peg$currPos, 2);
118212
- if (s0.toLowerCase() === peg$c21) {
118397
+ if (s0.toLowerCase() === peg$c23) {
118213
118398
  peg$currPos += 2;
118214
118399
  }
118215
118400
  else {
118216
118401
  s0 = peg$FAILED;
118217
118402
  if (peg$silentFails === 0) {
118218
- peg$fail(peg$e22);
118403
+ peg$fail(peg$e24);
118219
118404
  }
118220
118405
  }
118221
118406
  return s0;
@@ -118224,25 +118409,25 @@ function peg$parse(input, options) {
118224
118409
  let s0, s1, s2, s3;
118225
118410
  s0 = peg$currPos;
118226
118411
  s1 = input.substr(peg$currPos, 6);
118227
- if (s1.toLowerCase() === peg$c22) {
118412
+ if (s1.toLowerCase() === peg$c24) {
118228
118413
  peg$currPos += 6;
118229
118414
  }
118230
118415
  else {
118231
118416
  s1 = peg$FAILED;
118232
118417
  if (peg$silentFails === 0) {
118233
- peg$fail(peg$e23);
118418
+ peg$fail(peg$e25);
118234
118419
  }
118235
118420
  }
118236
118421
  if (s1 !== peg$FAILED) {
118237
118422
  s2 = peg$parse_();
118238
118423
  s3 = input.substr(peg$currPos, 5);
118239
- if (s3.toLowerCase() === peg$c23) {
118424
+ if (s3.toLowerCase() === peg$c25) {
118240
118425
  peg$currPos += 5;
118241
118426
  }
118242
118427
  else {
118243
118428
  s3 = peg$FAILED;
118244
118429
  if (peg$silentFails === 0) {
118245
- peg$fail(peg$e24);
118430
+ peg$fail(peg$e26);
118246
118431
  }
118247
118432
  }
118248
118433
  if (s3 !== peg$FAILED) {
@@ -118263,13 +118448,13 @@ function peg$parse(input, options) {
118263
118448
  function peg$parsestarting() {
118264
118449
  let s0;
118265
118450
  s0 = input.substr(peg$currPos, 8);
118266
- if (s0.toLowerCase() === peg$c24) {
118451
+ if (s0.toLowerCase() === peg$c26) {
118267
118452
  peg$currPos += 8;
118268
118453
  }
118269
118454
  else {
118270
118455
  s0 = peg$FAILED;
118271
118456
  if (peg$silentFails === 0) {
118272
- peg$fail(peg$e25);
118457
+ peg$fail(peg$e27);
118273
118458
  }
118274
118459
  }
118275
118460
  return s0;
@@ -118278,25 +118463,25 @@ function peg$parse(input, options) {
118278
118463
  let s0, s1, s2, s3;
118279
118464
  s0 = peg$currPos;
118280
118465
  s1 = input.substr(peg$currPos, 2);
118281
- if (s1.toLowerCase() === peg$c25) {
118466
+ if (s1.toLowerCase() === peg$c27) {
118282
118467
  peg$currPos += 2;
118283
118468
  }
118284
118469
  else {
118285
118470
  s1 = peg$FAILED;
118286
118471
  if (peg$silentFails === 0) {
118287
- peg$fail(peg$e26);
118472
+ peg$fail(peg$e28);
118288
118473
  }
118289
118474
  }
118290
118475
  if (s1 !== peg$FAILED) {
118291
118476
  s2 = peg$parse_();
118292
118477
  s3 = input.substr(peg$currPos, 2);
118293
- if (s3.toLowerCase() === peg$c26) {
118478
+ if (s3.toLowerCase() === peg$c28) {
118294
118479
  peg$currPos += 2;
118295
118480
  }
118296
118481
  else {
118297
118482
  s3 = peg$FAILED;
118298
118483
  if (peg$silentFails === 0) {
118299
- peg$fail(peg$e27);
118484
+ peg$fail(peg$e29);
118300
118485
  }
118301
118486
  }
118302
118487
  if (s3 !== peg$FAILED) {
@@ -118318,18 +118503,18 @@ function peg$parse(input, options) {
118318
118503
  let s0, s1;
118319
118504
  s0 = peg$currPos;
118320
118505
  s1 = input.substr(peg$currPos, 4);
118321
- if (s1.toLowerCase() === peg$c27) {
118506
+ if (s1.toLowerCase() === peg$c29) {
118322
118507
  peg$currPos += 4;
118323
118508
  }
118324
118509
  else {
118325
118510
  s1 = peg$FAILED;
118326
118511
  if (peg$silentFails === 0) {
118327
- peg$fail(peg$e28);
118512
+ peg$fail(peg$e30);
118328
118513
  }
118329
118514
  }
118330
118515
  if (s1 !== peg$FAILED) {
118331
118516
  peg$savedPos = s0;
118332
- s1 = peg$f29();
118517
+ s1 = peg$f31();
118333
118518
  }
118334
118519
  s0 = s1;
118335
118520
  return s0;
@@ -118338,18 +118523,18 @@ function peg$parse(input, options) {
118338
118523
  let s0, s1;
118339
118524
  s0 = peg$currPos;
118340
118525
  s1 = input.substr(peg$currPos, 8);
118341
- if (s1.toLowerCase() === peg$c28) {
118526
+ if (s1.toLowerCase() === peg$c30) {
118342
118527
  peg$currPos += 8;
118343
118528
  }
118344
118529
  else {
118345
118530
  s1 = peg$FAILED;
118346
118531
  if (peg$silentFails === 0) {
118347
- peg$fail(peg$e29);
118532
+ peg$fail(peg$e31);
118348
118533
  }
118349
118534
  }
118350
118535
  if (s1 !== peg$FAILED) {
118351
118536
  peg$savedPos = s0;
118352
- s1 = peg$f30();
118537
+ s1 = peg$f32();
118353
118538
  }
118354
118539
  s0 = s1;
118355
118540
  return s0;
@@ -118358,19 +118543,19 @@ function peg$parse(input, options) {
118358
118543
  let s0, s1;
118359
118544
  s0 = peg$currPos;
118360
118545
  s1 = input.substr(peg$currPos, 4);
118361
- if (s1.toLowerCase() === peg$c29) {
118546
+ if (s1.toLowerCase() === peg$c31) {
118362
118547
  peg$currPos += 4;
118363
118548
  }
118364
118549
  else {
118365
118550
  s1 = peg$FAILED;
118366
118551
  if (peg$silentFails === 0) {
118367
- peg$fail(peg$e30);
118552
+ peg$fail(peg$e32);
118368
118553
  }
118369
118554
  }
118370
118555
  if (s1 !== peg$FAILED) {
118371
118556
  peg$parse_();
118372
118557
  peg$savedPos = s0;
118373
- s0 = peg$f31();
118558
+ s0 = peg$f33();
118374
118559
  }
118375
118560
  else {
118376
118561
  peg$currPos = s0;
@@ -118382,20 +118567,20 @@ function peg$parse(input, options) {
118382
118567
  let s0, s1, s2;
118383
118568
  s0 = peg$currPos;
118384
118569
  s1 = input.charAt(peg$currPos);
118385
- if (s1.toLowerCase() === peg$c30) {
118570
+ if (s1.toLowerCase() === peg$c32) {
118386
118571
  peg$currPos++;
118387
118572
  }
118388
118573
  else {
118389
118574
  s1 = peg$FAILED;
118390
118575
  if (peg$silentFails === 0) {
118391
- peg$fail(peg$e31);
118576
+ peg$fail(peg$e33);
118392
118577
  }
118393
118578
  }
118394
118579
  if (s1 !== peg$FAILED) {
118395
118580
  s2 = peg$parsenumber();
118396
118581
  if (s2 !== peg$FAILED) {
118397
118582
  peg$savedPos = s0;
118398
- s0 = peg$f32(s2);
118583
+ s0 = peg$f34(s2);
118399
118584
  }
118400
118585
  else {
118401
118586
  peg$currPos = s0;
@@ -118412,13 +118597,13 @@ function peg$parse(input, options) {
118412
118597
  let s0, s1, s3;
118413
118598
  s0 = peg$currPos;
118414
118599
  s1 = input.substr(peg$currPos, 9);
118415
- if (s1.toLowerCase() === peg$c31) {
118600
+ if (s1.toLowerCase() === peg$c33) {
118416
118601
  peg$currPos += 9;
118417
118602
  }
118418
118603
  else {
118419
118604
  s1 = peg$FAILED;
118420
118605
  if (peg$silentFails === 0) {
118421
- peg$fail(peg$e32);
118606
+ peg$fail(peg$e34);
118422
118607
  }
118423
118608
  }
118424
118609
  if (s1 !== peg$FAILED) {
@@ -118428,7 +118613,7 @@ function peg$parse(input, options) {
118428
118613
  s3 = null;
118429
118614
  }
118430
118615
  peg$savedPos = s0;
118431
- s0 = peg$f33(s3);
118616
+ s0 = peg$f35(s3);
118432
118617
  }
118433
118618
  else {
118434
118619
  peg$currPos = s0;
@@ -118439,14 +118624,14 @@ function peg$parse(input, options) {
118439
118624
  function peg$parsetemplate() {
118440
118625
  let s0, s1, s2;
118441
118626
  s0 = peg$currPos;
118442
- if (input.substr(peg$currPos, 9) === peg$c32) {
118443
- s1 = peg$c32;
118627
+ if (input.substr(peg$currPos, 9) === peg$c34) {
118628
+ s1 = peg$c34;
118444
118629
  peg$currPos += 9;
118445
118630
  }
118446
118631
  else {
118447
118632
  s1 = peg$FAILED;
118448
118633
  if (peg$silentFails === 0) {
118449
- peg$fail(peg$e33);
118634
+ peg$fail(peg$e35);
118450
118635
  }
118451
118636
  }
118452
118637
  if (s1 !== peg$FAILED) {
@@ -118455,7 +118640,7 @@ function peg$parse(input, options) {
118455
118640
  s2 = null;
118456
118641
  }
118457
118642
  peg$savedPos = s0;
118458
- s0 = peg$f34(s2);
118643
+ s0 = peg$f36(s2);
118459
118644
  }
118460
118645
  else {
118461
118646
  peg$currPos = s0;
@@ -118467,18 +118652,18 @@ function peg$parse(input, options) {
118467
118652
  let s0, s1;
118468
118653
  s0 = peg$currPos;
118469
118654
  s1 = input.substr(peg$currPos, 5);
118470
- if (s1.toLowerCase() === peg$c33) {
118655
+ if (s1.toLowerCase() === peg$c35) {
118471
118656
  peg$currPos += 5;
118472
118657
  }
118473
118658
  else {
118474
118659
  s1 = peg$FAILED;
118475
118660
  if (peg$silentFails === 0) {
118476
- peg$fail(peg$e34);
118661
+ peg$fail(peg$e36);
118477
118662
  }
118478
118663
  }
118479
118664
  if (s1 !== peg$FAILED) {
118480
118665
  peg$savedPos = s0;
118481
- s1 = peg$f35();
118666
+ s1 = peg$f37();
118482
118667
  }
118483
118668
  s0 = s1;
118484
118669
  return s0;
@@ -118495,7 +118680,7 @@ function peg$parse(input, options) {
118495
118680
  else {
118496
118681
  s2 = peg$FAILED;
118497
118682
  if (peg$silentFails === 0) {
118498
- peg$fail(peg$e35);
118683
+ peg$fail(peg$e37);
118499
118684
  }
118500
118685
  }
118501
118686
  while (s2 !== peg$FAILED) {
@@ -118507,12 +118692,12 @@ function peg$parse(input, options) {
118507
118692
  else {
118508
118693
  s2 = peg$FAILED;
118509
118694
  if (peg$silentFails === 0) {
118510
- peg$fail(peg$e35);
118695
+ peg$fail(peg$e37);
118511
118696
  }
118512
118697
  }
118513
118698
  }
118514
118699
  peg$savedPos = s0;
118515
- s1 = peg$f36();
118700
+ s1 = peg$f38();
118516
118701
  s0 = s1;
118517
118702
  peg$silentFails--;
118518
118703
  return s0;
@@ -118527,13 +118712,13 @@ function peg$parse(input, options) {
118527
118712
  else {
118528
118713
  s0 = peg$FAILED;
118529
118714
  if (peg$silentFails === 0) {
118530
- peg$fail(peg$e37);
118715
+ peg$fail(peg$e39);
118531
118716
  }
118532
118717
  }
118533
118718
  peg$silentFails--;
118534
118719
  if (s0 === peg$FAILED) {
118535
118720
  if (peg$silentFails === 0) {
118536
- peg$fail(peg$e36);
118721
+ peg$fail(peg$e38);
118537
118722
  }
118538
118723
  }
118539
118724
  return s0;
@@ -118563,7 +118748,7 @@ function peg$parse(input, options) {
118563
118748
  if (s0 === peg$FAILED) {
118564
118749
  s1 = peg$FAILED;
118565
118750
  if (peg$silentFails === 0) {
118566
- peg$fail(peg$e38);
118751
+ peg$fail(peg$e40);
118567
118752
  }
118568
118753
  }
118569
118754
  return s0;
@@ -118579,7 +118764,7 @@ function peg$parse(input, options) {
118579
118764
  else {
118580
118765
  s2 = peg$FAILED;
118581
118766
  if (peg$silentFails === 0) {
118582
- peg$fail(peg$e39);
118767
+ peg$fail(peg$e41);
118583
118768
  }
118584
118769
  }
118585
118770
  if (s2 !== peg$FAILED) {
@@ -118591,7 +118776,7 @@ function peg$parse(input, options) {
118591
118776
  else {
118592
118777
  s4 = peg$FAILED;
118593
118778
  if (peg$silentFails === 0) {
118594
- peg$fail(peg$e37);
118779
+ peg$fail(peg$e39);
118595
118780
  }
118596
118781
  }
118597
118782
  while (s4 !== peg$FAILED) {
@@ -118603,7 +118788,7 @@ function peg$parse(input, options) {
118603
118788
  else {
118604
118789
  s4 = peg$FAILED;
118605
118790
  if (peg$silentFails === 0) {
118606
- peg$fail(peg$e37);
118791
+ peg$fail(peg$e39);
118607
118792
  }
118608
118793
  }
118609
118794
  }
@@ -118631,13 +118816,13 @@ function peg$parse(input, options) {
118631
118816
  s3 = peg$currPos;
118632
118817
  s4 = peg$currPos;
118633
118818
  if (input.charCodeAt(peg$currPos) === 45) {
118634
- s5 = peg$c30;
118819
+ s5 = peg$c32;
118635
118820
  peg$currPos++;
118636
118821
  }
118637
118822
  else {
118638
118823
  s5 = peg$FAILED;
118639
118824
  if (peg$silentFails === 0) {
118640
- peg$fail(peg$e41);
118825
+ peg$fail(peg$e43);
118641
118826
  }
118642
118827
  }
118643
118828
  if (s5 === peg$FAILED) {
@@ -118657,13 +118842,13 @@ function peg$parse(input, options) {
118657
118842
  if (s6 !== peg$FAILED) {
118658
118843
  s7 = peg$currPos;
118659
118844
  if (input.charCodeAt(peg$currPos) === 46) {
118660
- s8 = peg$c34;
118845
+ s8 = peg$c8;
118661
118846
  peg$currPos++;
118662
118847
  }
118663
118848
  else {
118664
118849
  s8 = peg$FAILED;
118665
118850
  if (peg$silentFails === 0) {
118666
- peg$fail(peg$e42);
118851
+ peg$fail(peg$e8);
118667
118852
  }
118668
118853
  }
118669
118854
  if (s8 !== peg$FAILED) {
@@ -118709,7 +118894,7 @@ function peg$parse(input, options) {
118709
118894
  }
118710
118895
  if (s3 !== peg$FAILED) {
118711
118896
  peg$savedPos = s0;
118712
- s0 = peg$f37(s3);
118897
+ s0 = peg$f39(s3);
118713
118898
  }
118714
118899
  else {
118715
118900
  peg$currPos = s0;
@@ -118718,7 +118903,7 @@ function peg$parse(input, options) {
118718
118903
  peg$silentFails--;
118719
118904
  if (s0 === peg$FAILED) {
118720
118905
  if (peg$silentFails === 0) {
118721
- peg$fail(peg$e40);
118906
+ peg$fail(peg$e42);
118722
118907
  }
118723
118908
  }
118724
118909
  return s0;
@@ -118743,13 +118928,13 @@ function peg$parse(input, options) {
118743
118928
  if (s3 !== peg$FAILED) {
118744
118929
  s4 = peg$currPos;
118745
118930
  if (input.charCodeAt(peg$currPos) === 46) {
118746
- s5 = peg$c34;
118931
+ s5 = peg$c8;
118747
118932
  peg$currPos++;
118748
118933
  }
118749
118934
  else {
118750
118935
  s5 = peg$FAILED;
118751
118936
  if (peg$silentFails === 0) {
118752
- peg$fail(peg$e42);
118937
+ peg$fail(peg$e8);
118753
118938
  }
118754
118939
  }
118755
118940
  if (s5 !== peg$FAILED) {
@@ -118793,18 +118978,18 @@ function peg$parse(input, options) {
118793
118978
  if (s1 !== peg$FAILED) {
118794
118979
  s2 = peg$parse_();
118795
118980
  if (input.charCodeAt(peg$currPos) === 37) {
118796
- s3 = peg$c35;
118981
+ s3 = peg$c9;
118797
118982
  peg$currPos++;
118798
118983
  }
118799
118984
  else {
118800
118985
  s3 = peg$FAILED;
118801
118986
  if (peg$silentFails === 0) {
118802
- peg$fail(peg$e44);
118987
+ peg$fail(peg$e9);
118803
118988
  }
118804
118989
  }
118805
118990
  if (s3 !== peg$FAILED) {
118806
118991
  peg$savedPos = s0;
118807
- s0 = peg$f38(s1);
118992
+ s0 = peg$f40(s1);
118808
118993
  }
118809
118994
  else {
118810
118995
  peg$currPos = s0;
@@ -118819,7 +119004,7 @@ function peg$parse(input, options) {
118819
119004
  if (s0 === peg$FAILED) {
118820
119005
  s1 = peg$FAILED;
118821
119006
  if (peg$silentFails === 0) {
118822
- peg$fail(peg$e43);
119007
+ peg$fail(peg$e44);
118823
119008
  }
118824
119009
  }
118825
119010
  return s0;
@@ -118882,13 +119067,13 @@ function peg$parse(input, options) {
118882
119067
  s2 = peg$parseyear();
118883
119068
  if (s2 !== peg$FAILED) {
118884
119069
  if (input.charCodeAt(peg$currPos) === 45) {
118885
- s3 = peg$c30;
119070
+ s3 = peg$c32;
118886
119071
  peg$currPos++;
118887
119072
  }
118888
119073
  else {
118889
119074
  s3 = peg$FAILED;
118890
119075
  if (peg$silentFails === 0) {
118891
- peg$fail(peg$e41);
119076
+ peg$fail(peg$e43);
118892
119077
  }
118893
119078
  }
118894
119079
  if (s3 !== peg$FAILED) {
@@ -118976,13 +119161,13 @@ function peg$parse(input, options) {
118976
119161
  s2 = peg$parsemonth();
118977
119162
  if (s2 !== peg$FAILED) {
118978
119163
  if (input.charCodeAt(peg$currPos) === 45) {
118979
- s3 = peg$c30;
119164
+ s3 = peg$c32;
118980
119165
  peg$currPos++;
118981
119166
  }
118982
119167
  else {
118983
119168
  s3 = peg$FAILED;
118984
119169
  if (peg$silentFails === 0) {
118985
- peg$fail(peg$e41);
119170
+ peg$fail(peg$e43);
118986
119171
  }
118987
119172
  }
118988
119173
  if (s3 !== peg$FAILED) {
@@ -119029,7 +119214,7 @@ function peg$parse(input, options) {
119029
119214
  }
119030
119215
  if (s1 !== peg$FAILED) {
119031
119216
  peg$savedPos = peg$currPos;
119032
- s2 = peg$f39(s1);
119217
+ s2 = peg$f41(s1);
119033
119218
  if (s2) {
119034
119219
  s2 = void 0;
119035
119220
  }
@@ -119322,7 +119507,7 @@ function peg$parse(input, options) {
119322
119507
  }
119323
119508
  if (s1 !== peg$FAILED) {
119324
119509
  peg$savedPos = s0;
119325
- s1 = peg$f40();
119510
+ s1 = peg$f42();
119326
119511
  }
119327
119512
  s0 = s1;
119328
119513
  return s0;
@@ -119369,7 +119554,7 @@ function peg$parse(input, options) {
119369
119554
  }
119370
119555
  if (s1 !== peg$FAILED) {
119371
119556
  peg$savedPos = s0;
119372
- s1 = peg$f41();
119557
+ s1 = peg$f43();
119373
119558
  }
119374
119559
  s0 = s1;
119375
119560
  peg$silentFails--;
@@ -119464,9 +119649,13 @@ async function getCategoriesWithTemplates() {
119464
119649
  }
119465
119650
  try {
119466
119651
  const parsedTemplate = peg$parse(trimmedLine);
119467
- if (parsedTemplate.type === "schedule" && parsedTemplate.adjustment !== void 0) {
119468
- if (parsedTemplate.adjustment <= -100 || parsedTemplate.adjustment > 1e3) {
119469
- throw new Error(`Invalid adjustment percentage (${parsedTemplate.adjustment}%). Must be between -100% and 1000%`);
119652
+ if ((parsedTemplate.type === "average" || parsedTemplate.type === "schedule") && parsedTemplate.adjustment !== void 0) {
119653
+ if (parsedTemplate.adjustmentType === "percent") {
119654
+ if (parsedTemplate.adjustment <= -100 || parsedTemplate.adjustment > 1e3) {
119655
+ throw new Error(`Invalid adjustment percentage (${parsedTemplate.adjustment}%). Must be between -100% and 1000%`);
119656
+ }
119657
+ }
119658
+ else if (parsedTemplate.adjustmentType === "fixed") {
119470
119659
  }
119471
119660
  }
119472
119661
  parsedTemplates.push(parsedTemplate);
@@ -119521,7 +119710,8 @@ async function unparse(templates) {
119521
119710
  const adj = template.adjustment;
119522
119711
  const op = adj >= 0 ? "increase" : "decrease";
119523
119712
  const val2 = Math.abs(adj);
119524
- result += ` [${op} ${val2}%]`;
119713
+ const type2 = template.adjustmentType === "percent" ? "%" : "";
119714
+ result += ` [${op} ${val2}${type2}]`;
119525
119715
  }
119526
119716
  return result;
119527
119717
  }
@@ -119562,7 +119752,15 @@ async function unparse(templates) {
119562
119752
  return result;
119563
119753
  }
119564
119754
  case "average": {
119565
- return `${prefix} average ${template.numMonths} months`;
119755
+ let result = `${prefix} average ${template.numMonths} months`;
119756
+ if (template.adjustment !== void 0) {
119757
+ const adj = template.adjustment;
119758
+ const op = adj >= 0 ? "increase" : "decrease";
119759
+ const val2 = Math.abs(adj);
119760
+ const type2 = template.adjustmentType === "percent" ? "%" : "";
119761
+ result += ` [${op} ${val2}${type2}]`;
119762
+ }
119763
+ return result;
119566
119764
  }
119567
119765
  case "copy": {
119568
119766
  const result = `${prefix} copy from ${template.lookBack} months ago`;
@@ -119754,7 +119952,7 @@ class CategoryTemplateContext {
119754
119952
  case "schedule": {
119755
119953
  if (!scheduleFlag) {
119756
119954
  const budgeted = this.fromLastMonth + toBudget;
119757
- const ret = await runSchedule(t2, this.month, budgeted, remainder, this.fromLastMonth, toBudget, [], this.category);
119955
+ const ret = await runSchedule(t2, this.month, budgeted, remainder, this.fromLastMonth, toBudget, [], this.category, this.currency);
119758
119956
  newBudget = ret.to_budget - toBudget;
119759
119957
  remainder = ret.remainder;
119760
119958
  scheduleFlag = true;
@@ -120104,7 +120302,21 @@ class CategoryTemplateContext {
120104
120302
  const sheetName = sheetForMonth(subMonths(templateContext.month, i));
120105
120303
  sum2 += await getSheetValue(sheetName, `sum-amount-${templateContext.category.id}`);
120106
120304
  }
120107
- return -Math.round(sum2 / template.numMonths);
120305
+ let average = -(sum2 / template.numMonths);
120306
+ if (template.adjustment !== void 0 && template.adjustmentType) {
120307
+ switch (template.adjustmentType) {
120308
+ case "percent": {
120309
+ const adjustmentFactor = 1 + template.adjustment / 100;
120310
+ average = adjustmentFactor * average;
120311
+ break;
120312
+ }
120313
+ case "fixed": {
120314
+ average += amountToInteger(template.adjustment, templateContext.currency.decimalPlaces);
120315
+ break;
120316
+ }
120317
+ }
120318
+ }
120319
+ return Math.round(average);
120108
120320
  }
120109
120321
  static runBy(templateContext) {
120110
120322
  const byTemplates = templateContext.templates.filter((t2) => t2.type === "by");