@gomusdev/web-components 1.54.2 → 1.55.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.
@@ -3502,20 +3502,20 @@ function if_block(node, fn, elseif = false) {
3502
3502
  }
3503
3503
  var branches = new BranchManager(node);
3504
3504
  var flags2 = elseif ? EFFECT_TRANSPARENT : 0;
3505
- function update_branch(condition, fn2) {
3505
+ function update_branch(condition2, fn2) {
3506
3506
  if (hydrating) {
3507
3507
  const is_else = read_hydration_instruction(node) === HYDRATION_START_ELSE;
3508
- if (condition === is_else) {
3508
+ if (condition2 === is_else) {
3509
3509
  var anchor = skip_nodes();
3510
3510
  set_hydrate_node(anchor);
3511
3511
  branches.anchor = anchor;
3512
3512
  set_hydrating(false);
3513
- branches.ensure(condition, fn2);
3513
+ branches.ensure(condition2, fn2);
3514
3514
  set_hydrating(true);
3515
3515
  return;
3516
3516
  }
3517
3517
  }
3518
- branches.ensure(condition, fn2);
3518
+ branches.ensure(condition2, fn2);
3519
3519
  }
3520
3520
  block(() => {
3521
3521
  var has_branch = false;
@@ -5633,7 +5633,7 @@ const sort = (array2, getter, desc = false) => {
5633
5633
  const dsc = (a2, b) => getter(b) - getter(a2);
5634
5634
  return array2.slice().sort(desc === true ? dsc : asc);
5635
5635
  };
5636
- function min$1(array2, getter) {
5636
+ function min$2(array2, getter) {
5637
5637
  const get2 = ((v) => v);
5638
5638
  return boil(array2, (a2, b) => get2(a2) < get2(b) ? a2 : b);
5639
5639
  }
@@ -5928,8 +5928,8 @@ class ZodError extends Error {
5928
5928
  constructor(issues) {
5929
5929
  super();
5930
5930
  this.issues = [];
5931
- this.addIssue = (sub) => {
5932
- this.issues = [...this.issues, sub];
5931
+ this.addIssue = (sub2) => {
5932
+ this.issues = [...this.issues, sub2];
5933
5933
  };
5934
5934
  this.addIssues = (subs = []) => {
5935
5935
  this.issues = [...this.issues, ...subs];
@@ -5999,12 +5999,12 @@ class ZodError extends Error {
5999
5999
  flatten(mapper = (issue2) => issue2.message) {
6000
6000
  const fieldErrors = {};
6001
6001
  const formErrors = [];
6002
- for (const sub of this.issues) {
6003
- if (sub.path.length > 0) {
6004
- fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
6005
- fieldErrors[sub.path[0]].push(mapper(sub));
6002
+ for (const sub2 of this.issues) {
6003
+ if (sub2.path.length > 0) {
6004
+ fieldErrors[sub2.path[0]] = fieldErrors[sub2.path[0]] || [];
6005
+ fieldErrors[sub2.path[0]].push(mapper(sub2));
6006
6006
  } else {
6007
- formErrors.push(mapper(sub));
6007
+ formErrors.push(mapper(sub2));
6008
6008
  }
6009
6009
  }
6010
6010
  return { formErrors, fieldErrors };
@@ -10398,9 +10398,9 @@ function $735220c2d4774dd3$var$cycleValue(value, amount, min2, max2, round2 = fa
10398
10398
  if (round2) {
10399
10399
  value += Math.sign(amount);
10400
10400
  if (value < min2) value = max2;
10401
- let div = Math.abs(amount);
10402
- if (amount > 0) value = Math.ceil(value / div) * div;
10403
- else value = Math.floor(value / div) * div;
10401
+ let div2 = Math.abs(amount);
10402
+ if (amount > 0) value = Math.ceil(value / div2) * div2;
10403
+ else value = Math.floor(value / div2) * div2;
10404
10404
  if (value > max2) value = min2;
10405
10405
  } else {
10406
10406
  value += amount;
@@ -10561,12 +10561,12 @@ function $fae977aafc393c5c$export$4223de14708adc63(date2) {
10561
10561
  return `${$fae977aafc393c5c$export$60dfd74aa96791bd(date2)}T${$fae977aafc393c5c$export$f59dee82248f5ad4(date2)}`;
10562
10562
  }
10563
10563
  function $fae977aafc393c5c$var$offsetToString(offset2) {
10564
- let sign = Math.sign(offset2) < 0 ? "-" : "+";
10564
+ let sign2 = Math.sign(offset2) < 0 ? "-" : "+";
10565
10565
  offset2 = Math.abs(offset2);
10566
10566
  let offsetHours = Math.floor(offset2 / 36e5);
10567
10567
  let offsetMinutes = Math.floor(offset2 % 36e5 / 6e4);
10568
10568
  let offsetSeconds = Math.floor(offset2 % 36e5 % 6e4 / 1e3);
10569
- let stringOffset = `${sign}${String(offsetHours).padStart(2, "0")}:${String(offsetMinutes).padStart(2, "0")}`;
10569
+ let stringOffset = `${sign2}${String(offsetHours).padStart(2, "0")}:${String(offsetMinutes).padStart(2, "0")}`;
10570
10570
  if (offsetSeconds !== 0) stringOffset += `:${String(offsetSeconds).padStart(2, "0")}`;
10571
10571
  return stringOffset;
10572
10572
  }
@@ -11147,11 +11147,11 @@ function createQuotaManager(quotas) {
11147
11147
  );
11148
11148
  },
11149
11149
  ticketCapacity(ticketId, timeslot) {
11150
- const minCap = min$1(this.filterBy({ timeslot, ticketId }).map((x) => x.capacity)) ?? 0;
11150
+ const minCap = min$2(this.filterBy({ timeslot, ticketId }).map((x) => x.capacity)) ?? 0;
11151
11151
  return minCap + this.getPrecartItemQuantity(ticketId);
11152
11152
  },
11153
11153
  totalCapacity(ticketId, timeslot) {
11154
- const totalCap = min$1(this.filterBy({ timeslot, ticketId }).map((x) => x.totalCapacity)) ?? 0;
11154
+ const totalCap = min$2(this.filterBy({ timeslot, ticketId }).map((x) => x.totalCapacity)) ?? 0;
11155
11155
  return totalCap;
11156
11156
  },
11157
11157
  timeslotsOn(date2) {
@@ -13274,12 +13274,12 @@ const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error }
13274
13274
  function flattenError(error, mapper = (issue2) => issue2.message) {
13275
13275
  const fieldErrors = {};
13276
13276
  const formErrors = [];
13277
- for (const sub of error.issues) {
13278
- if (sub.path.length > 0) {
13279
- fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
13280
- fieldErrors[sub.path[0]].push(mapper(sub));
13277
+ for (const sub2 of error.issues) {
13278
+ if (sub2.path.length > 0) {
13279
+ fieldErrors[sub2.path[0]] = fieldErrors[sub2.path[0]] || [];
13280
+ fieldErrors[sub2.path[0]].push(mapper(sub2));
13281
13281
  } else {
13282
- formErrors.push(mapper(sub));
13282
+ formErrors.push(mapper(sub2));
13283
13283
  }
13284
13284
  }
13285
13285
  return { formErrors, fieldErrors };
@@ -17620,15 +17620,15 @@ function DonationCampaign($$anchor, $$props) {
17620
17620
  flushSync();
17621
17621
  }
17622
17622
  };
17623
- var div = root$9();
17623
+ var div2 = root$9();
17624
17624
  let classes;
17625
- div.__click = () => goDonation.selectCampaign(campaign());
17626
- div.__keydown = (e) => {
17625
+ div2.__click = () => goDonation.selectCampaign(campaign());
17626
+ div2.__keydown = (e) => {
17627
17627
  if (e.key === "Enter") {
17628
17628
  goDonation.selectCampaign(campaign());
17629
17629
  }
17630
17630
  };
17631
- var div_1 = child(div);
17631
+ var div_1 = child(div2);
17632
17632
  var node = child(div_1);
17633
17633
  {
17634
17634
  var consequent = ($$anchor2) => {
@@ -17651,13 +17651,13 @@ function DonationCampaign($$anchor, $$props) {
17651
17651
  var text_1 = child(p_1, true);
17652
17652
  reset(p_1);
17653
17653
  reset(div_2);
17654
- reset(div);
17654
+ reset(div2);
17655
17655
  template_effect(() => {
17656
- classes = set_class(div, 1, "go-donation-campaign", null, classes, { selected: goDonation.campaign?.id === campaign()?.id });
17656
+ classes = set_class(div2, 1, "go-donation-campaign", null, classes, { selected: goDonation.campaign?.id === campaign()?.id });
17657
17657
  set_text(text2, get$2(translations)["donations.headline"]);
17658
17658
  set_text(text_1, get$2(translations)["donations.shop.info"]);
17659
17659
  });
17660
- append($$anchor, div);
17660
+ append($$anchor, div2);
17661
17661
  return pop($$exports);
17662
17662
  }
17663
17663
  delegate(["click", "keydown"]);
@@ -17708,8 +17708,8 @@ function DonationSelector($$anchor, $$props) {
17708
17708
  form.reportValidity();
17709
17709
  }
17710
17710
  }
17711
- var div = root$8();
17712
- var h3 = child(div);
17711
+ var div2 = root$8();
17712
+ var h3 = child(div2);
17713
17713
  var text2 = child(h3, true);
17714
17714
  reset(h3);
17715
17715
  var div_1 = sibling(h3, 2);
@@ -17760,9 +17760,9 @@ function DonationSelector($$anchor, $$props) {
17760
17760
  if (goDonation.campaign?.free_donations) $$render(consequent);
17761
17761
  });
17762
17762
  }
17763
- reset(div);
17763
+ reset(div2);
17764
17764
  template_effect(($0) => set_text(text2, $0), [() => shop.t("donations.selection.title")]);
17765
- append($$anchor, div);
17765
+ append($$anchor, div2);
17766
17766
  pop();
17767
17767
  }
17768
17768
  delegate(["click", "input"]);
@@ -17780,8 +17780,8 @@ function Donations($$anchor, $$props) {
17780
17780
  var node = first_child(fragment);
17781
17781
  {
17782
17782
  var consequent_1 = ($$anchor2) => {
17783
- var div = root_1$e();
17784
- var node_1 = child(div);
17783
+ var div2 = root_1$e();
17784
+ var node_1 = child(div2);
17785
17785
  each(node_1, 1, () => shop?.donations?.campaigns, (campaign) => campaign.id, ($$anchor3, campaign) => {
17786
17786
  DonationCampaign($$anchor3, {
17787
17787
  get campaign() {
@@ -17812,7 +17812,7 @@ function Donations($$anchor, $$props) {
17812
17812
  var text_1 = child(button_1, true);
17813
17813
  reset(button_1);
17814
17814
  reset(div_1);
17815
- reset(div);
17815
+ reset(div2);
17816
17816
  template_effect(
17817
17817
  ($0, $1) => {
17818
17818
  set_text(text2, $0);
@@ -17824,7 +17824,7 @@ function Donations($$anchor, $$props) {
17824
17824
  () => shop.t("donations.actions.addToCart")
17825
17825
  ]
17826
17826
  );
17827
- append($$anchor2, div);
17827
+ append($$anchor2, div2);
17828
17828
  };
17829
17829
  if_block(node, ($$render) => {
17830
17830
  if (shop.donations && shop.donations.campaigns) $$render(consequent_1);
@@ -18786,7 +18786,7 @@ function isNode$1(node) {
18786
18786
  function isShadowRoot$1(node) {
18787
18787
  return isNode$1(node) && node.nodeType === DOCUMENT_FRAGMENT_NODE && "host" in node;
18788
18788
  }
18789
- function contains(parent, child2) {
18789
+ function contains$1(parent, child2) {
18790
18790
  if (!parent || !child2)
18791
18791
  return false;
18792
18792
  if (!isHTMLElement$2(parent) || !isHTMLElement$2(child2))
@@ -18907,17 +18907,17 @@ function attachRef(ref, onChange) {
18907
18907
  }
18908
18908
  };
18909
18909
  }
18910
- function boolToStr(condition) {
18911
- return condition ? "true" : "false";
18910
+ function boolToStr(condition2) {
18911
+ return condition2 ? "true" : "false";
18912
18912
  }
18913
- function boolToStrTrueOrUndef(condition) {
18914
- return condition ? "true" : void 0;
18913
+ function boolToStrTrueOrUndef(condition2) {
18914
+ return condition2 ? "true" : void 0;
18915
18915
  }
18916
- function boolToEmptyStrOrUndef(condition) {
18917
- return condition ? "" : void 0;
18916
+ function boolToEmptyStrOrUndef(condition2) {
18917
+ return condition2 ? "" : void 0;
18918
18918
  }
18919
- function getDataOpenClosed(condition) {
18920
- return condition ? "open" : "closed";
18919
+ function getDataOpenClosed(condition2) {
18920
+ return condition2 ? "open" : "closed";
18921
18921
  }
18922
18922
  class BitsAttrs {
18923
18923
  #variant;
@@ -20252,7 +20252,7 @@ class TextSelectionLayerState {
20252
20252
  const node = this.opts.ref.current;
20253
20253
  const target = e.target;
20254
20254
  if (!isHTMLElement$1(node) || !isHTMLElement$1(target) || !this.opts.enabled.current) return;
20255
- if (!isHighestLayer(this) || !contains(node, target)) return;
20255
+ if (!isHighestLayer(this) || !contains$1(node, target)) return;
20256
20256
  this.opts.onPointerDown.current(e);
20257
20257
  if (e.defaultPrevented) return;
20258
20258
  this.#unsubSelectionLock = preventTextSelectionOverflow(node, this.domContext.getDocument().body);
@@ -20568,12 +20568,12 @@ function initAnnouncer(doc) {
20568
20568
  return log;
20569
20569
  };
20570
20570
  if (!isHTMLElement$1(el)) {
20571
- const div = doc.createElement("div");
20572
- div.style.cssText = srOnlyStylesString;
20573
- div.setAttribute("data-bits-announcer", "");
20574
- div.appendChild(createLog("assertive"));
20575
- div.appendChild(createLog("polite"));
20576
- el = div;
20571
+ const div2 = doc.createElement("div");
20572
+ div2.style.cssText = srOnlyStylesString;
20573
+ div2.setAttribute("data-bits-announcer", "");
20574
+ div2.appendChild(createLog("assertive"));
20575
+ div2.appendChild(createLog("polite"));
20576
+ el = div2;
20577
20577
  doc.body.insertBefore(el, doc.body.firstChild);
20578
20578
  }
20579
20579
  const getLog = (kind) => {
@@ -21203,13 +21203,13 @@ function setDescription(props) {
21203
21203
  const valueString = formatter.selectedDate(value);
21204
21204
  const el = doc.getElementById(id);
21205
21205
  if (!el) {
21206
- const div = doc.createElement("div");
21207
- div.style.cssText = styleToString({
21206
+ const div2 = doc.createElement("div");
21207
+ div2.style.cssText = styleToString({
21208
21208
  display: "none"
21209
21209
  });
21210
- div.id = id;
21211
- div.innerText = `Selected Date: ${valueString}`;
21212
- doc.body.appendChild(div);
21210
+ div2.id = id;
21211
+ div2.innerText = `Selected Date: ${valueString}`;
21212
+ doc.body.appendChild(div2);
21213
21213
  } else {
21214
21214
  el.innerText = `Selected Date: ${valueString}`;
21215
21215
  }
@@ -21479,7 +21479,7 @@ function setPlaceholderToNodeValue(node, placeholder) {
21479
21479
  }
21480
21480
  function shiftCalendarFocus({
21481
21481
  node,
21482
- add,
21482
+ add: add2,
21483
21483
  placeholder,
21484
21484
  calendarNode,
21485
21485
  isPrevButtonDisabled,
@@ -21490,7 +21490,7 @@ function shiftCalendarFocus({
21490
21490
  const candidateCells = getSelectableCells(calendarNode);
21491
21491
  if (!candidateCells.length) return;
21492
21492
  const index2 = candidateCells.indexOf(node);
21493
- const nextIndex = index2 + add;
21493
+ const nextIndex = index2 + add2;
21494
21494
  if (isValidIndex(nextIndex, candidateCells)) {
21495
21495
  const nextCell = candidateCells[nextIndex];
21496
21496
  setPlaceholderToNodeValue(nextCell, placeholder);
@@ -21547,9 +21547,9 @@ function handleCalendarKeydown({ event: event2, handleCellClick, shiftFocus, pla
21547
21547
  [ARROW_RIGHT]: 1
21548
21548
  };
21549
21549
  if (ARROW_KEYS.includes(event2.key)) {
21550
- const add = kbdFocusMap[event2.key];
21551
- if (add !== void 0) {
21552
- shiftFocus(currentCell, add);
21550
+ const add2 = kbdFocusMap[event2.key];
21551
+ if (add2 !== void 0) {
21552
+ shiftFocus(currentCell, add2);
21553
21553
  }
21554
21554
  }
21555
21555
  if (SELECT_KEYS.includes(event2.key)) {
@@ -21635,8 +21635,8 @@ function useMonthViewOptionsSync(props) {
21635
21635
  }
21636
21636
  function createAccessibleHeading({ calendarNode, label, accessibleHeadingId }) {
21637
21637
  const doc = getDocument(calendarNode);
21638
- const div = doc.createElement("div");
21639
- div.style.cssText = styleToString({
21638
+ const div2 = doc.createElement("div");
21639
+ div2.style.cssText = styleToString({
21640
21640
  border: "0px",
21641
21641
  clip: "rect(0px, 0px, 0px, 0px)",
21642
21642
  clipPath: "inset(50%)",
@@ -21653,12 +21653,12 @@ function createAccessibleHeading({ calendarNode, label, accessibleHeadingId }) {
21653
21653
  h2.id = accessibleHeadingId;
21654
21654
  h2.role = "heading";
21655
21655
  h2.ariaLevel = "2";
21656
- calendarNode.insertBefore(div, calendarNode.firstChild);
21657
- div.appendChild(h2);
21656
+ calendarNode.insertBefore(div2, calendarNode.firstChild);
21657
+ div2.appendChild(h2);
21658
21658
  return () => {
21659
21659
  const h22 = doc.getElementById(accessibleHeadingId);
21660
21660
  if (!h22) return;
21661
- div.parentElement?.removeChild(div);
21661
+ div2.parentElement?.removeChild(div2);
21662
21662
  h22.remove();
21663
21663
  };
21664
21664
  }
@@ -22137,10 +22137,10 @@ class CalendarRootState {
22137
22137
  }
22138
22138
  return $14e0f24ef4ac5c92$export$ea39ec197993aef0(value, date2);
22139
22139
  }
22140
- shiftFocus(node, add) {
22140
+ shiftFocus(node, add2) {
22141
22141
  return shiftCalendarFocus({
22142
22142
  node,
22143
- add,
22143
+ add: add2,
22144
22144
  placeholder: this.opts.placeholder,
22145
22145
  calendarNode: this.opts.ref.current,
22146
22146
  isPrevButtonDisabled: this.isPrevButtonDisabled,
@@ -23016,12 +23016,12 @@ function Calendar$1($$anchor, $$props) {
23016
23016
  append($$anchor2, fragment_1);
23017
23017
  };
23018
23018
  var alternate = ($$anchor2) => {
23019
- var div = root_2$n();
23020
- attribute_effect(div, () => ({ ...get$2(mergedProps) }));
23021
- var node_2 = child(div);
23019
+ var div2 = root_2$n();
23020
+ attribute_effect(div2, () => ({ ...get$2(mergedProps) }));
23021
+ var node_2 = child(div2);
23022
23022
  snippet(node_2, () => children() ?? noop$1, () => rootState.snippetProps);
23023
- reset(div);
23024
- append($$anchor2, div);
23023
+ reset(div2);
23024
+ append($$anchor2, div2);
23025
23025
  };
23026
23026
  if_block(node, ($$render) => {
23027
23027
  if (child$1()) $$render(consequent);
@@ -23129,9 +23129,9 @@ function Calendar_day($$anchor, $$props) {
23129
23129
  append($$anchor2, fragment_1);
23130
23130
  };
23131
23131
  var alternate_1 = ($$anchor2) => {
23132
- var div = root_2$m();
23133
- attribute_effect(div, () => ({ ...get$2(mergedProps) }));
23134
- var node_2 = child(div);
23132
+ var div2 = root_2$m();
23133
+ attribute_effect(div2, () => ({ ...get$2(mergedProps) }));
23134
+ var node_2 = child(div2);
23135
23135
  {
23136
23136
  var consequent_1 = ($$anchor3) => {
23137
23137
  var fragment_2 = comment();
@@ -23149,8 +23149,8 @@ function Calendar_day($$anchor, $$props) {
23149
23149
  else $$render(alternate, false);
23150
23150
  });
23151
23151
  }
23152
- reset(div);
23153
- append($$anchor2, div);
23152
+ reset(div2);
23153
+ append($$anchor2, div2);
23154
23154
  };
23155
23155
  if_block(node, ($$render) => {
23156
23156
  if (child$1()) $$render(consequent);
@@ -23782,9 +23782,9 @@ function Calendar_heading($$anchor, $$props) {
23782
23782
  append($$anchor2, fragment_1);
23783
23783
  };
23784
23784
  var alternate_1 = ($$anchor2) => {
23785
- var div = root_2$e();
23786
- attribute_effect(div, () => ({ ...get$2(mergedProps) }));
23787
- var node_2 = child(div);
23785
+ var div2 = root_2$e();
23786
+ attribute_effect(div2, () => ({ ...get$2(mergedProps) }));
23787
+ var node_2 = child(div2);
23788
23788
  {
23789
23789
  var consequent_1 = ($$anchor3) => {
23790
23790
  var fragment_2 = comment();
@@ -23802,8 +23802,8 @@ function Calendar_heading($$anchor, $$props) {
23802
23802
  else $$render(alternate, false);
23803
23803
  });
23804
23804
  }
23805
- reset(div);
23806
- append($$anchor2, div);
23805
+ reset(div2);
23806
+ append($$anchor2, div2);
23807
23807
  };
23808
23808
  if_block(node, ($$render) => {
23809
23809
  if (child$1()) $$render(consequent);
@@ -24023,8 +24023,8 @@ function Hidden_input($$anchor, $$props) {
24023
24023
  }
24024
24024
  create_custom_element(Hidden_input, { value: {} }, [], [], { mode: "open" });
24025
24025
  const sides = ["top", "right", "bottom", "left"];
24026
- const min = Math.min;
24027
- const max = Math.max;
24026
+ const min$1 = Math.min;
24027
+ const max$1 = Math.max;
24028
24028
  const round = Math.round;
24029
24029
  const floor = Math.floor;
24030
24030
  const createCoords = (v) => ({
@@ -24042,9 +24042,9 @@ const oppositeAlignmentMap = {
24042
24042
  end: "start"
24043
24043
  };
24044
24044
  function clamp(start, value, end) {
24045
- return max(start, min(value, end));
24045
+ return max$1(start, min$1(value, end));
24046
24046
  }
24047
- function evaluate(value, param) {
24047
+ function evaluate$1(value, param) {
24048
24048
  return typeof value === "function" ? value(param) : value;
24049
24049
  }
24050
24050
  function getSide$1(placement) {
@@ -24226,7 +24226,7 @@ async function detectOverflow(state2, options) {
24226
24226
  elementContext = "floating",
24227
24227
  altBoundary = false,
24228
24228
  padding = 0
24229
- } = evaluate(options, state2);
24229
+ } = evaluate$1(options, state2);
24230
24230
  const paddingObject = getPaddingObject(padding);
24231
24231
  const altContext = elementContext === "floating" ? "reference" : "floating";
24232
24232
  const element = elements[altBoundary ? altContext : elementContext];
@@ -24366,7 +24366,7 @@ const arrow$1 = (options) => ({
24366
24366
  const {
24367
24367
  element,
24368
24368
  padding = 0
24369
- } = evaluate(options, state2) || {};
24369
+ } = evaluate$1(options, state2) || {};
24370
24370
  if (element == null) {
24371
24371
  return {};
24372
24372
  }
@@ -24391,14 +24391,14 @@ const arrow$1 = (options) => ({
24391
24391
  }
24392
24392
  const centerToReference = endDiff / 2 - startDiff / 2;
24393
24393
  const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
24394
- const minPadding = min(paddingObject[minProp], largestPossiblePadding);
24395
- const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
24396
- const min$12 = minPadding;
24394
+ const minPadding = min$1(paddingObject[minProp], largestPossiblePadding);
24395
+ const maxPadding = min$1(paddingObject[maxProp], largestPossiblePadding);
24396
+ const min$1$1 = minPadding;
24397
24397
  const max2 = clientSize - arrowDimensions[length] - maxPadding;
24398
24398
  const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
24399
- const offset2 = clamp(min$12, center, max2);
24400
- const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$12 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
24401
- const alignmentOffset = shouldAddOffset ? center < min$12 ? center - min$12 : center - max2 : 0;
24399
+ const offset2 = clamp(min$1$1, center, max2);
24400
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
24401
+ const alignmentOffset = shouldAddOffset ? center < min$1$1 ? center - min$1$1 : center - max2 : 0;
24402
24402
  return {
24403
24403
  [axis]: coords[axis] + alignmentOffset,
24404
24404
  data: {
@@ -24437,7 +24437,7 @@ const flip$1 = function(options) {
24437
24437
  fallbackAxisSideDirection = "none",
24438
24438
  flipAlignment = true,
24439
24439
  ...detectOverflowOptions
24440
- } = evaluate(options, state2);
24440
+ } = evaluate$1(options, state2);
24441
24441
  if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
24442
24442
  return {};
24443
24443
  }
@@ -24547,7 +24547,7 @@ const hide$1 = function(options) {
24547
24547
  const {
24548
24548
  strategy = "referenceHidden",
24549
24549
  ...detectOverflowOptions
24550
- } = evaluate(options, state2);
24550
+ } = evaluate$1(options, state2);
24551
24551
  switch (strategy) {
24552
24552
  case "referenceHidden": {
24553
24553
  const overflow = await platform2.detectOverflow(state2, {
@@ -24595,7 +24595,7 @@ async function convertValueToCoords(state2, options) {
24595
24595
  const isVertical = getSideAxis(placement) === "y";
24596
24596
  const mainAxisMulti = originSides.has(side) ? -1 : 1;
24597
24597
  const crossAxisMulti = rtl && isVertical ? -1 : 1;
24598
- const rawValue = evaluate(options, state2);
24598
+ const rawValue = evaluate$1(options, state2);
24599
24599
  let {
24600
24600
  mainAxis,
24601
24601
  crossAxis,
@@ -24680,7 +24680,7 @@ const shift$1 = function(options) {
24680
24680
  }
24681
24681
  },
24682
24682
  ...detectOverflowOptions
24683
- } = evaluate(options, state2);
24683
+ } = evaluate$1(options, state2);
24684
24684
  const coords = {
24685
24685
  x,
24686
24686
  y
@@ -24741,7 +24741,7 @@ const limitShift$1 = function(options) {
24741
24741
  offset: offset2 = 0,
24742
24742
  mainAxis: checkMainAxis = true,
24743
24743
  crossAxis: checkCrossAxis = true
24744
- } = evaluate(options, state2);
24744
+ } = evaluate$1(options, state2);
24745
24745
  const coords = {
24746
24746
  x,
24747
24747
  y
@@ -24750,7 +24750,7 @@ const limitShift$1 = function(options) {
24750
24750
  const mainAxis = getOppositeAxis(crossAxis);
24751
24751
  let mainAxisCoord = coords[mainAxis];
24752
24752
  let crossAxisCoord = coords[crossAxis];
24753
- const rawOffset = evaluate(offset2, state2);
24753
+ const rawOffset = evaluate$1(offset2, state2);
24754
24754
  const computedOffset = typeof rawOffset === "number" ? {
24755
24755
  mainAxis: rawOffset,
24756
24756
  crossAxis: 0
@@ -24807,7 +24807,7 @@ const size$1 = function(options) {
24807
24807
  apply = () => {
24808
24808
  },
24809
24809
  ...detectOverflowOptions
24810
- } = evaluate(options, state2);
24810
+ } = evaluate$1(options, state2);
24811
24811
  const overflow = await platform2.detectOverflow(state2, detectOverflowOptions);
24812
24812
  const side = getSide$1(placement);
24813
24813
  const alignment = getAlignment(placement);
@@ -24827,8 +24827,8 @@ const size$1 = function(options) {
24827
24827
  }
24828
24828
  const maximumClippingHeight = height - overflow.top - overflow.bottom;
24829
24829
  const maximumClippingWidth = width - overflow.left - overflow.right;
24830
- const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
24831
- const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
24830
+ const overflowAvailableHeight = min$1(height - overflow[heightSide], maximumClippingHeight);
24831
+ const overflowAvailableWidth = min$1(width - overflow[widthSide], maximumClippingWidth);
24832
24832
  const noShift = !state2.middlewareData.shift;
24833
24833
  let availableHeight = overflowAvailableHeight;
24834
24834
  let availableWidth = overflowAvailableWidth;
@@ -24839,14 +24839,14 @@ const size$1 = function(options) {
24839
24839
  availableHeight = maximumClippingHeight;
24840
24840
  }
24841
24841
  if (noShift && !alignment) {
24842
- const xMin = max(overflow.left, 0);
24843
- const xMax = max(overflow.right, 0);
24844
- const yMin = max(overflow.top, 0);
24845
- const yMax = max(overflow.bottom, 0);
24842
+ const xMin = max$1(overflow.left, 0);
24843
+ const xMax = max$1(overflow.right, 0);
24844
+ const yMin = max$1(overflow.top, 0);
24845
+ const yMax = max$1(overflow.bottom, 0);
24846
24846
  if (isYAxis) {
24847
- availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
24847
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$1(overflow.left, overflow.right));
24848
24848
  } else {
24849
- availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
24849
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$1(overflow.top, overflow.bottom));
24850
24850
  }
24851
24851
  }
24852
24852
  await apply({
@@ -25196,12 +25196,12 @@ function getDocumentRect(element) {
25196
25196
  const html2 = getDocumentElement(element);
25197
25197
  const scroll = getNodeScroll(element);
25198
25198
  const body = element.ownerDocument.body;
25199
- const width = max(html2.scrollWidth, html2.clientWidth, body.scrollWidth, body.clientWidth);
25200
- const height = max(html2.scrollHeight, html2.clientHeight, body.scrollHeight, body.clientHeight);
25199
+ const width = max$1(html2.scrollWidth, html2.clientWidth, body.scrollWidth, body.clientWidth);
25200
+ const height = max$1(html2.scrollHeight, html2.clientHeight, body.scrollHeight, body.clientHeight);
25201
25201
  let x = -scroll.scrollLeft + getWindowScrollBarX(element);
25202
25202
  const y = -scroll.scrollTop;
25203
25203
  if (getComputedStyle$1(body).direction === "rtl") {
25204
- x += max(html2.clientWidth, body.clientWidth) - width;
25204
+ x += max$1(html2.clientWidth, body.clientWidth) - width;
25205
25205
  }
25206
25206
  return {
25207
25207
  width,
@@ -25329,10 +25329,10 @@ function getClippingRect(_ref) {
25329
25329
  const firstClippingAncestor = clippingAncestors[0];
25330
25330
  const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
25331
25331
  const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
25332
- accRect.top = max(rect.top, accRect.top);
25333
- accRect.right = min(rect.right, accRect.right);
25334
- accRect.bottom = min(rect.bottom, accRect.bottom);
25335
- accRect.left = max(rect.left, accRect.left);
25332
+ accRect.top = max$1(rect.top, accRect.top);
25333
+ accRect.right = min$1(rect.right, accRect.right);
25334
+ accRect.bottom = min$1(rect.bottom, accRect.bottom);
25335
+ accRect.left = max$1(rect.left, accRect.left);
25336
25336
  return accRect;
25337
25337
  }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
25338
25338
  return {
@@ -25500,7 +25500,7 @@ function observeMove(element, onMove) {
25500
25500
  const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
25501
25501
  const options = {
25502
25502
  rootMargin,
25503
- threshold: max(0, min(1, threshold)) || 1
25503
+ threshold: max$1(0, min$1(1, threshold)) || 1
25504
25504
  };
25505
25505
  let isFirstUpdate = true;
25506
25506
  function handleObserve(entries) {
@@ -29303,12 +29303,12 @@ function Date_field_input($$anchor, $$props) {
29303
29303
  append($$anchor2, fragment_1);
29304
29304
  };
29305
29305
  var alternate = ($$anchor2) => {
29306
- var div = root_2$a();
29307
- attribute_effect(div, () => ({ ...get$2(mergedProps) }));
29308
- var node_2 = child(div);
29306
+ var div2 = root_2$a();
29307
+ attribute_effect(div2, () => ({ ...get$2(mergedProps) }));
29308
+ var node_2 = child(div2);
29309
29309
  snippet(node_2, () => children() ?? noop$1, () => ({ segments: inputState.root.segmentContents }));
29310
- reset(div);
29311
- append($$anchor2, div);
29310
+ reset(div2);
29311
+ append($$anchor2, div2);
29312
29312
  };
29313
29313
  if_block(node, ($$render) => {
29314
29314
  if (child$1()) $$render(consequent);
@@ -29380,12 +29380,12 @@ function Date_field_label($$anchor, $$props) {
29380
29380
  append($$anchor2, fragment_1);
29381
29381
  };
29382
29382
  var alternate = ($$anchor2) => {
29383
- var div = root_2$9();
29384
- attribute_effect(div, () => ({ ...get$2(mergedProps) }));
29385
- var node_2 = child(div);
29383
+ var div2 = root_2$9();
29384
+ attribute_effect(div2, () => ({ ...get$2(mergedProps) }));
29385
+ var node_2 = child(div2);
29386
29386
  snippet(node_2, () => children() ?? noop$1);
29387
- reset(div);
29388
- append($$anchor2, div);
29387
+ reset(div2);
29388
+ append($$anchor2, div2);
29389
29389
  };
29390
29390
  if_block(node, ($$render) => {
29391
29391
  if (child$1()) $$render(consequent);
@@ -30583,12 +30583,12 @@ function Date_picker_calendar($$anchor, $$props) {
30583
30583
  append($$anchor2, fragment_1);
30584
30584
  };
30585
30585
  var alternate = ($$anchor2) => {
30586
- var div = root_2$7();
30587
- attribute_effect(div, () => ({ ...get$2(mergedProps) }));
30588
- var node_2 = child(div);
30586
+ var div2 = root_2$7();
30587
+ attribute_effect(div2, () => ({ ...get$2(mergedProps) }));
30588
+ var node_2 = child(div2);
30589
30589
  snippet(node_2, () => children() ?? noop$1, () => calendarState.snippetProps);
30590
- reset(div);
30591
- append($$anchor2, div);
30590
+ reset(div2);
30591
+ append($$anchor2, div2);
30592
30592
  };
30593
30593
  if_block(node, ($$render) => {
30594
30594
  if (child$1()) $$render(consequent);
@@ -30749,15 +30749,15 @@ function Popover_content($$anchor, $$props) {
30749
30749
  append($$anchor4, fragment_3);
30750
30750
  };
30751
30751
  var alternate = ($$anchor4) => {
30752
- var div = root_4$5();
30753
- attribute_effect(div, () => ({ ...wrapperProps() }));
30754
- var div_1 = child(div);
30752
+ var div2 = root_4$5();
30753
+ attribute_effect(div2, () => ({ ...wrapperProps() }));
30754
+ var div_1 = child(div2);
30755
30755
  attribute_effect(div_1, () => ({ ...get$2(finalProps) }));
30756
30756
  var node_3 = child(div_1);
30757
30757
  snippet(node_3, () => children() ?? noop$1);
30758
30758
  reset(div_1);
30759
- reset(div);
30760
- append($$anchor4, div);
30759
+ reset(div2);
30760
+ append($$anchor4, div2);
30761
30761
  };
30762
30762
  if_block(node_1, ($$render) => {
30763
30763
  if (child$1()) $$render(consequent);
@@ -32026,8 +32026,8 @@ function ErrorsFeedback($$anchor, $$props) {
32026
32026
  $$props.$$host.classList.toggle("go-feedback", true);
32027
32027
  $$props.$$host.setAttribute("data-num-errors", get$2(numErrors).toString());
32028
32028
  });
32029
- var div = root$5();
32030
- var p2 = child(div);
32029
+ var div2 = root$5();
32030
+ var p2 = child(div2);
32031
32031
  var node = child(p2);
32032
32032
  {
32033
32033
  var consequent = ($$anchor2) => {
@@ -32075,18 +32075,18 @@ function ErrorsFeedback($$anchor, $$props) {
32075
32075
  if (get$2(details) && isArray(get$2(details).apiErrors) && get$2(details).apiErrors.length > 0) $$render(consequent_2);
32076
32076
  });
32077
32077
  }
32078
- reset(div);
32079
- append($$anchor, div);
32078
+ reset(div2);
32079
+ append($$anchor, div2);
32080
32080
  pop();
32081
32081
  }
32082
32082
  customElements.define("go-errors-feedback", create_custom_element(ErrorsFeedback, {}, [], []));
32083
32083
  var root$4 = /* @__PURE__ */ from_html(`<div class="go-form-feedback"><!></div>`);
32084
32084
  function FormFeedback($$anchor, $$props) {
32085
- var div = root$4();
32086
- var node = child(div);
32085
+ var div2 = root$4();
32086
+ var node = child(div2);
32087
32087
  slot(node, $$props, "default", {});
32088
- reset(div);
32089
- append($$anchor, div);
32088
+ reset(div2);
32089
+ append($$anchor, div2);
32090
32090
  }
32091
32091
  customElements.define("go-form-feedback", create_custom_element(FormFeedback, {}, ["default"], []));
32092
32092
  function Submit($$anchor, $$props) {
@@ -32123,15 +32123,15 @@ function SuccessFeedback($$anchor, $$props) {
32123
32123
  var node = first_child(fragment);
32124
32124
  {
32125
32125
  var consequent = ($$anchor2) => {
32126
- var div = root_1$7();
32126
+ var div2 = root_1$7();
32127
32127
  let classes;
32128
- var text2 = child(div, true);
32129
- reset(div);
32128
+ var text2 = child(div2, true);
32129
+ reset(div2);
32130
32130
  template_effect(() => {
32131
- classes = set_class(div, 1, "go-success-feedback go-feedback", null, classes, { "is-successful": get$2(details).successMessage });
32131
+ classes = set_class(div2, 1, "go-success-feedback go-feedback", null, classes, { "is-successful": get$2(details).successMessage });
32132
32132
  set_text(text2, get$2(details)?.successMessage);
32133
32133
  });
32134
- append($$anchor2, div);
32134
+ append($$anchor2, div2);
32135
32135
  };
32136
32136
  if_block(node, ($$render) => {
32137
32137
  if (get$2(details)?.successMessage) $$render(consequent);
@@ -32141,10 +32141,1684 @@ function SuccessFeedback($$anchor, $$props) {
32141
32141
  pop();
32142
32142
  }
32143
32143
  customElements.define("go-success-feedback", create_custom_element(SuccessFeedback, {}, [], []));
32144
+ var INUMBER = "INUMBER";
32145
+ var IOP1 = "IOP1";
32146
+ var IOP2 = "IOP2";
32147
+ var IOP3 = "IOP3";
32148
+ var IVAR = "IVAR";
32149
+ var IVARNAME = "IVARNAME";
32150
+ var IFUNCALL = "IFUNCALL";
32151
+ var IFUNDEF = "IFUNDEF";
32152
+ var IEXPR = "IEXPR";
32153
+ var IEXPREVAL = "IEXPREVAL";
32154
+ var IMEMBER = "IMEMBER";
32155
+ var IENDSTATEMENT = "IENDSTATEMENT";
32156
+ var IARRAY = "IARRAY";
32157
+ function Instruction(type, value) {
32158
+ this.type = type;
32159
+ this.value = value !== void 0 && value !== null ? value : 0;
32160
+ }
32161
+ Instruction.prototype.toString = function() {
32162
+ switch (this.type) {
32163
+ case INUMBER:
32164
+ case IOP1:
32165
+ case IOP2:
32166
+ case IOP3:
32167
+ case IVAR:
32168
+ case IVARNAME:
32169
+ case IENDSTATEMENT:
32170
+ return this.value;
32171
+ case IFUNCALL:
32172
+ return "CALL " + this.value;
32173
+ case IFUNDEF:
32174
+ return "DEF " + this.value;
32175
+ case IARRAY:
32176
+ return "ARRAY " + this.value;
32177
+ case IMEMBER:
32178
+ return "." + this.value;
32179
+ default:
32180
+ return "Invalid Instruction";
32181
+ }
32182
+ };
32183
+ function unaryInstruction(value) {
32184
+ return new Instruction(IOP1, value);
32185
+ }
32186
+ function binaryInstruction(value) {
32187
+ return new Instruction(IOP2, value);
32188
+ }
32189
+ function ternaryInstruction(value) {
32190
+ return new Instruction(IOP3, value);
32191
+ }
32192
+ function simplify(tokens, unaryOps, binaryOps, ternaryOps, values) {
32193
+ var nstack = [];
32194
+ var newexpression = [];
32195
+ var n1, n2, n3;
32196
+ var f;
32197
+ for (var i = 0; i < tokens.length; i++) {
32198
+ var item = tokens[i];
32199
+ var type = item.type;
32200
+ if (type === INUMBER || type === IVARNAME) {
32201
+ if (Array.isArray(item.value)) {
32202
+ nstack.push.apply(nstack, simplify(item.value.map(function(x) {
32203
+ return new Instruction(INUMBER, x);
32204
+ }).concat(new Instruction(IARRAY, item.value.length)), unaryOps, binaryOps, ternaryOps, values));
32205
+ } else {
32206
+ nstack.push(item);
32207
+ }
32208
+ } else if (type === IVAR && values.hasOwnProperty(item.value)) {
32209
+ item = new Instruction(INUMBER, values[item.value]);
32210
+ nstack.push(item);
32211
+ } else if (type === IOP2 && nstack.length > 1) {
32212
+ n2 = nstack.pop();
32213
+ n1 = nstack.pop();
32214
+ f = binaryOps[item.value];
32215
+ item = new Instruction(INUMBER, f(n1.value, n2.value));
32216
+ nstack.push(item);
32217
+ } else if (type === IOP3 && nstack.length > 2) {
32218
+ n3 = nstack.pop();
32219
+ n2 = nstack.pop();
32220
+ n1 = nstack.pop();
32221
+ if (item.value === "?") {
32222
+ nstack.push(n1.value ? n2.value : n3.value);
32223
+ } else {
32224
+ f = ternaryOps[item.value];
32225
+ item = new Instruction(INUMBER, f(n1.value, n2.value, n3.value));
32226
+ nstack.push(item);
32227
+ }
32228
+ } else if (type === IOP1 && nstack.length > 0) {
32229
+ n1 = nstack.pop();
32230
+ f = unaryOps[item.value];
32231
+ item = new Instruction(INUMBER, f(n1.value));
32232
+ nstack.push(item);
32233
+ } else if (type === IEXPR) {
32234
+ while (nstack.length > 0) {
32235
+ newexpression.push(nstack.shift());
32236
+ }
32237
+ newexpression.push(new Instruction(IEXPR, simplify(item.value, unaryOps, binaryOps, ternaryOps, values)));
32238
+ } else if (type === IMEMBER && nstack.length > 0) {
32239
+ n1 = nstack.pop();
32240
+ nstack.push(new Instruction(INUMBER, n1.value[item.value]));
32241
+ } else {
32242
+ while (nstack.length > 0) {
32243
+ newexpression.push(nstack.shift());
32244
+ }
32245
+ newexpression.push(item);
32246
+ }
32247
+ }
32248
+ while (nstack.length > 0) {
32249
+ newexpression.push(nstack.shift());
32250
+ }
32251
+ return newexpression;
32252
+ }
32253
+ function substitute(tokens, variable, expr) {
32254
+ var newexpression = [];
32255
+ for (var i = 0; i < tokens.length; i++) {
32256
+ var item = tokens[i];
32257
+ var type = item.type;
32258
+ if (type === IVAR && item.value === variable) {
32259
+ for (var j = 0; j < expr.tokens.length; j++) {
32260
+ var expritem = expr.tokens[j];
32261
+ var replitem;
32262
+ if (expritem.type === IOP1) {
32263
+ replitem = unaryInstruction(expritem.value);
32264
+ } else if (expritem.type === IOP2) {
32265
+ replitem = binaryInstruction(expritem.value);
32266
+ } else if (expritem.type === IOP3) {
32267
+ replitem = ternaryInstruction(expritem.value);
32268
+ } else {
32269
+ replitem = new Instruction(expritem.type, expritem.value);
32270
+ }
32271
+ newexpression.push(replitem);
32272
+ }
32273
+ } else if (type === IEXPR) {
32274
+ newexpression.push(new Instruction(IEXPR, substitute(item.value, variable, expr)));
32275
+ } else {
32276
+ newexpression.push(item);
32277
+ }
32278
+ }
32279
+ return newexpression;
32280
+ }
32281
+ function evaluate(tokens, expr, values) {
32282
+ var nstack = [];
32283
+ var n1, n2, n3;
32284
+ var f, args, argCount;
32285
+ if (isExpressionEvaluator(tokens)) {
32286
+ return resolveExpression(tokens, values);
32287
+ }
32288
+ var numTokens = tokens.length;
32289
+ for (var i = 0; i < numTokens; i++) {
32290
+ var item = tokens[i];
32291
+ var type = item.type;
32292
+ if (type === INUMBER || type === IVARNAME) {
32293
+ nstack.push(item.value);
32294
+ } else if (type === IOP2) {
32295
+ n2 = nstack.pop();
32296
+ n1 = nstack.pop();
32297
+ if (item.value === "and") {
32298
+ nstack.push(n1 ? !!evaluate(n2, expr, values) : false);
32299
+ } else if (item.value === "or") {
32300
+ nstack.push(n1 ? true : !!evaluate(n2, expr, values));
32301
+ } else if (item.value === "=") {
32302
+ f = expr.binaryOps[item.value];
32303
+ nstack.push(f(n1, evaluate(n2, expr, values), values));
32304
+ } else {
32305
+ f = expr.binaryOps[item.value];
32306
+ nstack.push(f(resolveExpression(n1, values), resolveExpression(n2, values)));
32307
+ }
32308
+ } else if (type === IOP3) {
32309
+ n3 = nstack.pop();
32310
+ n2 = nstack.pop();
32311
+ n1 = nstack.pop();
32312
+ if (item.value === "?") {
32313
+ nstack.push(evaluate(n1 ? n2 : n3, expr, values));
32314
+ } else {
32315
+ f = expr.ternaryOps[item.value];
32316
+ nstack.push(f(resolveExpression(n1, values), resolveExpression(n2, values), resolveExpression(n3, values)));
32317
+ }
32318
+ } else if (type === IVAR) {
32319
+ if (item.value in expr.functions) {
32320
+ nstack.push(expr.functions[item.value]);
32321
+ } else if (item.value in expr.unaryOps && expr.parser.isOperatorEnabled(item.value)) {
32322
+ nstack.push(expr.unaryOps[item.value]);
32323
+ } else {
32324
+ var v = values[item.value];
32325
+ if (v !== void 0) {
32326
+ nstack.push(v);
32327
+ } else {
32328
+ throw new Error("undefined variable: " + item.value);
32329
+ }
32330
+ }
32331
+ } else if (type === IOP1) {
32332
+ n1 = nstack.pop();
32333
+ f = expr.unaryOps[item.value];
32334
+ nstack.push(f(resolveExpression(n1, values)));
32335
+ } else if (type === IFUNCALL) {
32336
+ argCount = item.value;
32337
+ args = [];
32338
+ while (argCount-- > 0) {
32339
+ args.unshift(resolveExpression(nstack.pop(), values));
32340
+ }
32341
+ f = nstack.pop();
32342
+ if (f.apply && f.call) {
32343
+ nstack.push(f.apply(void 0, args));
32344
+ } else {
32345
+ throw new Error(f + " is not a function");
32346
+ }
32347
+ } else if (type === IFUNDEF) {
32348
+ nstack.push((function() {
32349
+ var n22 = nstack.pop();
32350
+ var args2 = [];
32351
+ var argCount2 = item.value;
32352
+ while (argCount2-- > 0) {
32353
+ args2.unshift(nstack.pop());
32354
+ }
32355
+ var n12 = nstack.pop();
32356
+ var f2 = function() {
32357
+ var scope = Object.assign({}, values);
32358
+ for (var i2 = 0, len = args2.length; i2 < len; i2++) {
32359
+ scope[args2[i2]] = arguments[i2];
32360
+ }
32361
+ return evaluate(n22, expr, scope);
32362
+ };
32363
+ Object.defineProperty(f2, "name", {
32364
+ value: n12,
32365
+ writable: false
32366
+ });
32367
+ values[n12] = f2;
32368
+ return f2;
32369
+ })());
32370
+ } else if (type === IEXPR) {
32371
+ nstack.push(createExpressionEvaluator(item, expr));
32372
+ } else if (type === IEXPREVAL) {
32373
+ nstack.push(item);
32374
+ } else if (type === IMEMBER) {
32375
+ n1 = nstack.pop();
32376
+ nstack.push(n1[item.value]);
32377
+ } else if (type === IENDSTATEMENT) {
32378
+ nstack.pop();
32379
+ } else if (type === IARRAY) {
32380
+ argCount = item.value;
32381
+ args = [];
32382
+ while (argCount-- > 0) {
32383
+ args.unshift(nstack.pop());
32384
+ }
32385
+ nstack.push(args);
32386
+ } else {
32387
+ throw new Error("invalid Expression");
32388
+ }
32389
+ }
32390
+ if (nstack.length > 1) {
32391
+ throw new Error("invalid Expression (parity)");
32392
+ }
32393
+ return nstack[0] === 0 ? 0 : resolveExpression(nstack[0], values);
32394
+ }
32395
+ function createExpressionEvaluator(token, expr, values) {
32396
+ if (isExpressionEvaluator(token)) return token;
32397
+ return {
32398
+ type: IEXPREVAL,
32399
+ value: function(scope) {
32400
+ return evaluate(token.value, expr, scope);
32401
+ }
32402
+ };
32403
+ }
32404
+ function isExpressionEvaluator(n) {
32405
+ return n && n.type === IEXPREVAL;
32406
+ }
32407
+ function resolveExpression(n, values) {
32408
+ return isExpressionEvaluator(n) ? n.value(values) : n;
32409
+ }
32410
+ function expressionToString(tokens, toJS) {
32411
+ var nstack = [];
32412
+ var n1, n2, n3;
32413
+ var f, args, argCount;
32414
+ for (var i = 0; i < tokens.length; i++) {
32415
+ var item = tokens[i];
32416
+ var type = item.type;
32417
+ if (type === INUMBER) {
32418
+ if (typeof item.value === "number" && item.value < 0) {
32419
+ nstack.push("(" + item.value + ")");
32420
+ } else if (Array.isArray(item.value)) {
32421
+ nstack.push("[" + item.value.map(escapeValue).join(", ") + "]");
32422
+ } else {
32423
+ nstack.push(escapeValue(item.value));
32424
+ }
32425
+ } else if (type === IOP2) {
32426
+ n2 = nstack.pop();
32427
+ n1 = nstack.pop();
32428
+ f = item.value;
32429
+ if (toJS) {
32430
+ if (f === "^") {
32431
+ nstack.push("Math.pow(" + n1 + ", " + n2 + ")");
32432
+ } else if (f === "and") {
32433
+ nstack.push("(!!" + n1 + " && !!" + n2 + ")");
32434
+ } else if (f === "or") {
32435
+ nstack.push("(!!" + n1 + " || !!" + n2 + ")");
32436
+ } else if (f === "||") {
32437
+ nstack.push("(function(a,b){ return Array.isArray(a) && Array.isArray(b) ? a.concat(b) : String(a) + String(b); }((" + n1 + "),(" + n2 + ")))");
32438
+ } else if (f === "==") {
32439
+ nstack.push("(" + n1 + " === " + n2 + ")");
32440
+ } else if (f === "!=") {
32441
+ nstack.push("(" + n1 + " !== " + n2 + ")");
32442
+ } else if (f === "[") {
32443
+ nstack.push(n1 + "[(" + n2 + ") | 0]");
32444
+ } else {
32445
+ nstack.push("(" + n1 + " " + f + " " + n2 + ")");
32446
+ }
32447
+ } else {
32448
+ if (f === "[") {
32449
+ nstack.push(n1 + "[" + n2 + "]");
32450
+ } else {
32451
+ nstack.push("(" + n1 + " " + f + " " + n2 + ")");
32452
+ }
32453
+ }
32454
+ } else if (type === IOP3) {
32455
+ n3 = nstack.pop();
32456
+ n2 = nstack.pop();
32457
+ n1 = nstack.pop();
32458
+ f = item.value;
32459
+ if (f === "?") {
32460
+ nstack.push("(" + n1 + " ? " + n2 + " : " + n3 + ")");
32461
+ } else {
32462
+ throw new Error("invalid Expression");
32463
+ }
32464
+ } else if (type === IVAR || type === IVARNAME) {
32465
+ nstack.push(item.value);
32466
+ } else if (type === IOP1) {
32467
+ n1 = nstack.pop();
32468
+ f = item.value;
32469
+ if (f === "-" || f === "+") {
32470
+ nstack.push("(" + f + n1 + ")");
32471
+ } else if (toJS) {
32472
+ if (f === "not") {
32473
+ nstack.push("(!" + n1 + ")");
32474
+ } else if (f === "!") {
32475
+ nstack.push("fac(" + n1 + ")");
32476
+ } else {
32477
+ nstack.push(f + "(" + n1 + ")");
32478
+ }
32479
+ } else if (f === "!") {
32480
+ nstack.push("(" + n1 + "!)");
32481
+ } else {
32482
+ nstack.push("(" + f + " " + n1 + ")");
32483
+ }
32484
+ } else if (type === IFUNCALL) {
32485
+ argCount = item.value;
32486
+ args = [];
32487
+ while (argCount-- > 0) {
32488
+ args.unshift(nstack.pop());
32489
+ }
32490
+ f = nstack.pop();
32491
+ nstack.push(f + "(" + args.join(", ") + ")");
32492
+ } else if (type === IFUNDEF) {
32493
+ n2 = nstack.pop();
32494
+ argCount = item.value;
32495
+ args = [];
32496
+ while (argCount-- > 0) {
32497
+ args.unshift(nstack.pop());
32498
+ }
32499
+ n1 = nstack.pop();
32500
+ if (toJS) {
32501
+ nstack.push("(" + n1 + " = function(" + args.join(", ") + ") { return " + n2 + " })");
32502
+ } else {
32503
+ nstack.push("(" + n1 + "(" + args.join(", ") + ") = " + n2 + ")");
32504
+ }
32505
+ } else if (type === IMEMBER) {
32506
+ n1 = nstack.pop();
32507
+ nstack.push(n1 + "." + item.value);
32508
+ } else if (type === IARRAY) {
32509
+ argCount = item.value;
32510
+ args = [];
32511
+ while (argCount-- > 0) {
32512
+ args.unshift(nstack.pop());
32513
+ }
32514
+ nstack.push("[" + args.join(", ") + "]");
32515
+ } else if (type === IEXPR) {
32516
+ nstack.push("(" + expressionToString(item.value, toJS) + ")");
32517
+ } else if (type === IENDSTATEMENT) ;
32518
+ else {
32519
+ throw new Error("invalid Expression");
32520
+ }
32521
+ }
32522
+ if (nstack.length > 1) {
32523
+ if (toJS) {
32524
+ nstack = [nstack.join(",")];
32525
+ } else {
32526
+ nstack = [nstack.join(";")];
32527
+ }
32528
+ }
32529
+ return String(nstack[0]);
32530
+ }
32531
+ function escapeValue(v) {
32532
+ if (typeof v === "string") {
32533
+ return JSON.stringify(v).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
32534
+ }
32535
+ return v;
32536
+ }
32537
+ function contains(array2, obj) {
32538
+ for (var i = 0; i < array2.length; i++) {
32539
+ if (array2[i] === obj) {
32540
+ return true;
32541
+ }
32542
+ }
32543
+ return false;
32544
+ }
32545
+ function getSymbols(tokens, symbols, options) {
32546
+ options = options || {};
32547
+ var withMembers = !!options.withMembers;
32548
+ var prevVar = null;
32549
+ for (var i = 0; i < tokens.length; i++) {
32550
+ var item = tokens[i];
32551
+ if (item.type === IVAR || item.type === IVARNAME) {
32552
+ if (!withMembers && !contains(symbols, item.value)) {
32553
+ symbols.push(item.value);
32554
+ } else if (prevVar !== null) {
32555
+ if (!contains(symbols, prevVar)) {
32556
+ symbols.push(prevVar);
32557
+ }
32558
+ prevVar = item.value;
32559
+ } else {
32560
+ prevVar = item.value;
32561
+ }
32562
+ } else if (item.type === IMEMBER && withMembers && prevVar !== null) {
32563
+ prevVar += "." + item.value;
32564
+ } else if (item.type === IEXPR) {
32565
+ getSymbols(item.value, symbols, options);
32566
+ } else if (prevVar !== null) {
32567
+ if (!contains(symbols, prevVar)) {
32568
+ symbols.push(prevVar);
32569
+ }
32570
+ prevVar = null;
32571
+ }
32572
+ }
32573
+ if (prevVar !== null && !contains(symbols, prevVar)) {
32574
+ symbols.push(prevVar);
32575
+ }
32576
+ }
32577
+ function Expression(tokens, parser2) {
32578
+ this.tokens = tokens;
32579
+ this.parser = parser2;
32580
+ this.unaryOps = parser2.unaryOps;
32581
+ this.binaryOps = parser2.binaryOps;
32582
+ this.ternaryOps = parser2.ternaryOps;
32583
+ this.functions = parser2.functions;
32584
+ }
32585
+ Expression.prototype.simplify = function(values) {
32586
+ values = values || {};
32587
+ return new Expression(simplify(this.tokens, this.unaryOps, this.binaryOps, this.ternaryOps, values), this.parser);
32588
+ };
32589
+ Expression.prototype.substitute = function(variable, expr) {
32590
+ if (!(expr instanceof Expression)) {
32591
+ expr = this.parser.parse(String(expr));
32592
+ }
32593
+ return new Expression(substitute(this.tokens, variable, expr), this.parser);
32594
+ };
32595
+ Expression.prototype.evaluate = function(values) {
32596
+ values = values || {};
32597
+ return evaluate(this.tokens, this, values);
32598
+ };
32599
+ Expression.prototype.toString = function() {
32600
+ return expressionToString(this.tokens, false);
32601
+ };
32602
+ Expression.prototype.symbols = function(options) {
32603
+ options = options || {};
32604
+ var vars = [];
32605
+ getSymbols(this.tokens, vars, options);
32606
+ return vars;
32607
+ };
32608
+ Expression.prototype.variables = function(options) {
32609
+ options = options || {};
32610
+ var vars = [];
32611
+ getSymbols(this.tokens, vars, options);
32612
+ var functions = this.functions;
32613
+ return vars.filter(function(name) {
32614
+ return !(name in functions);
32615
+ });
32616
+ };
32617
+ Expression.prototype.toJSFunction = function(param, variables) {
32618
+ var expr = this;
32619
+ var f = new Function(param, "with(this.functions) with (this.ternaryOps) with (this.binaryOps) with (this.unaryOps) { return " + expressionToString(this.simplify(variables).tokens, true) + "; }");
32620
+ return function() {
32621
+ return f.apply(expr, arguments);
32622
+ };
32623
+ };
32624
+ var TEOF = "TEOF";
32625
+ var TOP = "TOP";
32626
+ var TNUMBER = "TNUMBER";
32627
+ var TSTRING = "TSTRING";
32628
+ var TPAREN = "TPAREN";
32629
+ var TBRACKET = "TBRACKET";
32630
+ var TCOMMA = "TCOMMA";
32631
+ var TNAME = "TNAME";
32632
+ var TSEMICOLON = "TSEMICOLON";
32633
+ function Token(type, value, index2) {
32634
+ this.type = type;
32635
+ this.value = value;
32636
+ this.index = index2;
32637
+ }
32638
+ Token.prototype.toString = function() {
32639
+ return this.type + ": " + this.value;
32640
+ };
32641
+ function TokenStream(parser2, expression) {
32642
+ this.pos = 0;
32643
+ this.current = null;
32644
+ this.unaryOps = parser2.unaryOps;
32645
+ this.binaryOps = parser2.binaryOps;
32646
+ this.ternaryOps = parser2.ternaryOps;
32647
+ this.consts = parser2.consts;
32648
+ this.expression = expression;
32649
+ this.savedPosition = 0;
32650
+ this.savedCurrent = null;
32651
+ this.options = parser2.options;
32652
+ this.parser = parser2;
32653
+ }
32654
+ TokenStream.prototype.newToken = function(type, value, pos) {
32655
+ return new Token(type, value, pos != null ? pos : this.pos);
32656
+ };
32657
+ TokenStream.prototype.save = function() {
32658
+ this.savedPosition = this.pos;
32659
+ this.savedCurrent = this.current;
32660
+ };
32661
+ TokenStream.prototype.restore = function() {
32662
+ this.pos = this.savedPosition;
32663
+ this.current = this.savedCurrent;
32664
+ };
32665
+ TokenStream.prototype.next = function() {
32666
+ if (this.pos >= this.expression.length) {
32667
+ return this.newToken(TEOF, "EOF");
32668
+ }
32669
+ if (this.isWhitespace() || this.isComment()) {
32670
+ return this.next();
32671
+ } else if (this.isRadixInteger() || this.isNumber() || this.isOperator() || this.isString() || this.isParen() || this.isBracket() || this.isComma() || this.isSemicolon() || this.isNamedOp() || this.isConst() || this.isName()) {
32672
+ return this.current;
32673
+ } else {
32674
+ this.parseError('Unknown character "' + this.expression.charAt(this.pos) + '"');
32675
+ }
32676
+ };
32677
+ TokenStream.prototype.isString = function() {
32678
+ var r2 = false;
32679
+ var startPos = this.pos;
32680
+ var quote = this.expression.charAt(startPos);
32681
+ if (quote === "'" || quote === '"') {
32682
+ var index2 = this.expression.indexOf(quote, startPos + 1);
32683
+ while (index2 >= 0 && this.pos < this.expression.length) {
32684
+ this.pos = index2 + 1;
32685
+ if (this.expression.charAt(index2 - 1) !== "\\") {
32686
+ var rawString = this.expression.substring(startPos + 1, index2);
32687
+ this.current = this.newToken(TSTRING, this.unescape(rawString), startPos);
32688
+ r2 = true;
32689
+ break;
32690
+ }
32691
+ index2 = this.expression.indexOf(quote, index2 + 1);
32692
+ }
32693
+ }
32694
+ return r2;
32695
+ };
32696
+ TokenStream.prototype.isParen = function() {
32697
+ var c = this.expression.charAt(this.pos);
32698
+ if (c === "(" || c === ")") {
32699
+ this.current = this.newToken(TPAREN, c);
32700
+ this.pos++;
32701
+ return true;
32702
+ }
32703
+ return false;
32704
+ };
32705
+ TokenStream.prototype.isBracket = function() {
32706
+ var c = this.expression.charAt(this.pos);
32707
+ if ((c === "[" || c === "]") && this.isOperatorEnabled("[")) {
32708
+ this.current = this.newToken(TBRACKET, c);
32709
+ this.pos++;
32710
+ return true;
32711
+ }
32712
+ return false;
32713
+ };
32714
+ TokenStream.prototype.isComma = function() {
32715
+ var c = this.expression.charAt(this.pos);
32716
+ if (c === ",") {
32717
+ this.current = this.newToken(TCOMMA, ",");
32718
+ this.pos++;
32719
+ return true;
32720
+ }
32721
+ return false;
32722
+ };
32723
+ TokenStream.prototype.isSemicolon = function() {
32724
+ var c = this.expression.charAt(this.pos);
32725
+ if (c === ";") {
32726
+ this.current = this.newToken(TSEMICOLON, ";");
32727
+ this.pos++;
32728
+ return true;
32729
+ }
32730
+ return false;
32731
+ };
32732
+ TokenStream.prototype.isConst = function() {
32733
+ var startPos = this.pos;
32734
+ var i = startPos;
32735
+ for (; i < this.expression.length; i++) {
32736
+ var c = this.expression.charAt(i);
32737
+ if (c.toUpperCase() === c.toLowerCase()) {
32738
+ if (i === this.pos || c !== "_" && c !== "." && (c < "0" || c > "9")) {
32739
+ break;
32740
+ }
32741
+ }
32742
+ }
32743
+ if (i > startPos) {
32744
+ var str = this.expression.substring(startPos, i);
32745
+ if (str in this.consts) {
32746
+ this.current = this.newToken(TNUMBER, this.consts[str]);
32747
+ this.pos += str.length;
32748
+ return true;
32749
+ }
32750
+ }
32751
+ return false;
32752
+ };
32753
+ TokenStream.prototype.isNamedOp = function() {
32754
+ var startPos = this.pos;
32755
+ var i = startPos;
32756
+ for (; i < this.expression.length; i++) {
32757
+ var c = this.expression.charAt(i);
32758
+ if (c.toUpperCase() === c.toLowerCase()) {
32759
+ if (i === this.pos || c !== "_" && (c < "0" || c > "9")) {
32760
+ break;
32761
+ }
32762
+ }
32763
+ }
32764
+ if (i > startPos) {
32765
+ var str = this.expression.substring(startPos, i);
32766
+ if (this.isOperatorEnabled(str) && (str in this.binaryOps || str in this.unaryOps || str in this.ternaryOps)) {
32767
+ this.current = this.newToken(TOP, str);
32768
+ this.pos += str.length;
32769
+ return true;
32770
+ }
32771
+ }
32772
+ return false;
32773
+ };
32774
+ TokenStream.prototype.isName = function() {
32775
+ var startPos = this.pos;
32776
+ var i = startPos;
32777
+ var hasLetter = false;
32778
+ for (; i < this.expression.length; i++) {
32779
+ var c = this.expression.charAt(i);
32780
+ if (c.toUpperCase() === c.toLowerCase()) {
32781
+ if (i === this.pos && (c === "$" || c === "_")) {
32782
+ if (c === "_") {
32783
+ hasLetter = true;
32784
+ }
32785
+ continue;
32786
+ } else if (i === this.pos || !hasLetter || c !== "_" && (c < "0" || c > "9")) {
32787
+ break;
32788
+ }
32789
+ } else {
32790
+ hasLetter = true;
32791
+ }
32792
+ }
32793
+ if (hasLetter) {
32794
+ var str = this.expression.substring(startPos, i);
32795
+ this.current = this.newToken(TNAME, str);
32796
+ this.pos += str.length;
32797
+ return true;
32798
+ }
32799
+ return false;
32800
+ };
32801
+ TokenStream.prototype.isWhitespace = function() {
32802
+ var r2 = false;
32803
+ var c = this.expression.charAt(this.pos);
32804
+ while (c === " " || c === " " || c === "\n" || c === "\r") {
32805
+ r2 = true;
32806
+ this.pos++;
32807
+ if (this.pos >= this.expression.length) {
32808
+ break;
32809
+ }
32810
+ c = this.expression.charAt(this.pos);
32811
+ }
32812
+ return r2;
32813
+ };
32814
+ var codePointPattern = /^[0-9a-f]{4}$/i;
32815
+ TokenStream.prototype.unescape = function(v) {
32816
+ var index2 = v.indexOf("\\");
32817
+ if (index2 < 0) {
32818
+ return v;
32819
+ }
32820
+ var buffer = v.substring(0, index2);
32821
+ while (index2 >= 0) {
32822
+ var c = v.charAt(++index2);
32823
+ switch (c) {
32824
+ case "'":
32825
+ buffer += "'";
32826
+ break;
32827
+ case '"':
32828
+ buffer += '"';
32829
+ break;
32830
+ case "\\":
32831
+ buffer += "\\";
32832
+ break;
32833
+ case "/":
32834
+ buffer += "/";
32835
+ break;
32836
+ case "b":
32837
+ buffer += "\b";
32838
+ break;
32839
+ case "f":
32840
+ buffer += "\f";
32841
+ break;
32842
+ case "n":
32843
+ buffer += "\n";
32844
+ break;
32845
+ case "r":
32846
+ buffer += "\r";
32847
+ break;
32848
+ case "t":
32849
+ buffer += " ";
32850
+ break;
32851
+ case "u":
32852
+ var codePoint = v.substring(index2 + 1, index2 + 5);
32853
+ if (!codePointPattern.test(codePoint)) {
32854
+ this.parseError("Illegal escape sequence: \\u" + codePoint);
32855
+ }
32856
+ buffer += String.fromCharCode(parseInt(codePoint, 16));
32857
+ index2 += 4;
32858
+ break;
32859
+ default:
32860
+ throw this.parseError('Illegal escape sequence: "\\' + c + '"');
32861
+ }
32862
+ ++index2;
32863
+ var backslash = v.indexOf("\\", index2);
32864
+ buffer += v.substring(index2, backslash < 0 ? v.length : backslash);
32865
+ index2 = backslash;
32866
+ }
32867
+ return buffer;
32868
+ };
32869
+ TokenStream.prototype.isComment = function() {
32870
+ var c = this.expression.charAt(this.pos);
32871
+ if (c === "/" && this.expression.charAt(this.pos + 1) === "*") {
32872
+ this.pos = this.expression.indexOf("*/", this.pos) + 2;
32873
+ if (this.pos === 1) {
32874
+ this.pos = this.expression.length;
32875
+ }
32876
+ return true;
32877
+ }
32878
+ return false;
32879
+ };
32880
+ TokenStream.prototype.isRadixInteger = function() {
32881
+ var pos = this.pos;
32882
+ if (pos >= this.expression.length - 2 || this.expression.charAt(pos) !== "0") {
32883
+ return false;
32884
+ }
32885
+ ++pos;
32886
+ var radix;
32887
+ var validDigit;
32888
+ if (this.expression.charAt(pos) === "x") {
32889
+ radix = 16;
32890
+ validDigit = /^[0-9a-f]$/i;
32891
+ ++pos;
32892
+ } else if (this.expression.charAt(pos) === "b") {
32893
+ radix = 2;
32894
+ validDigit = /^[01]$/i;
32895
+ ++pos;
32896
+ } else {
32897
+ return false;
32898
+ }
32899
+ var valid = false;
32900
+ var startPos = pos;
32901
+ while (pos < this.expression.length) {
32902
+ var c = this.expression.charAt(pos);
32903
+ if (validDigit.test(c)) {
32904
+ pos++;
32905
+ valid = true;
32906
+ } else {
32907
+ break;
32908
+ }
32909
+ }
32910
+ if (valid) {
32911
+ this.current = this.newToken(TNUMBER, parseInt(this.expression.substring(startPos, pos), radix));
32912
+ this.pos = pos;
32913
+ }
32914
+ return valid;
32915
+ };
32916
+ TokenStream.prototype.isNumber = function() {
32917
+ var valid = false;
32918
+ var pos = this.pos;
32919
+ var startPos = pos;
32920
+ var resetPos = pos;
32921
+ var foundDot = false;
32922
+ var foundDigits = false;
32923
+ var c;
32924
+ while (pos < this.expression.length) {
32925
+ c = this.expression.charAt(pos);
32926
+ if (c >= "0" && c <= "9" || !foundDot && c === ".") {
32927
+ if (c === ".") {
32928
+ foundDot = true;
32929
+ } else {
32930
+ foundDigits = true;
32931
+ }
32932
+ pos++;
32933
+ valid = foundDigits;
32934
+ } else {
32935
+ break;
32936
+ }
32937
+ }
32938
+ if (valid) {
32939
+ resetPos = pos;
32940
+ }
32941
+ if (c === "e" || c === "E") {
32942
+ pos++;
32943
+ var acceptSign = true;
32944
+ var validExponent = false;
32945
+ while (pos < this.expression.length) {
32946
+ c = this.expression.charAt(pos);
32947
+ if (acceptSign && (c === "+" || c === "-")) {
32948
+ acceptSign = false;
32949
+ } else if (c >= "0" && c <= "9") {
32950
+ validExponent = true;
32951
+ acceptSign = false;
32952
+ } else {
32953
+ break;
32954
+ }
32955
+ pos++;
32956
+ }
32957
+ if (!validExponent) {
32958
+ pos = resetPos;
32959
+ }
32960
+ }
32961
+ if (valid) {
32962
+ this.current = this.newToken(TNUMBER, parseFloat(this.expression.substring(startPos, pos)));
32963
+ this.pos = pos;
32964
+ } else {
32965
+ this.pos = resetPos;
32966
+ }
32967
+ return valid;
32968
+ };
32969
+ TokenStream.prototype.isOperator = function() {
32970
+ var startPos = this.pos;
32971
+ var c = this.expression.charAt(this.pos);
32972
+ if (c === "+" || c === "-" || c === "*" || c === "/" || c === "%" || c === "^" || c === "?" || c === ":" || c === ".") {
32973
+ this.current = this.newToken(TOP, c);
32974
+ } else if (c === "∙" || c === "•") {
32975
+ this.current = this.newToken(TOP, "*");
32976
+ } else if (c === ">") {
32977
+ if (this.expression.charAt(this.pos + 1) === "=") {
32978
+ this.current = this.newToken(TOP, ">=");
32979
+ this.pos++;
32980
+ } else {
32981
+ this.current = this.newToken(TOP, ">");
32982
+ }
32983
+ } else if (c === "<") {
32984
+ if (this.expression.charAt(this.pos + 1) === "=") {
32985
+ this.current = this.newToken(TOP, "<=");
32986
+ this.pos++;
32987
+ } else {
32988
+ this.current = this.newToken(TOP, "<");
32989
+ }
32990
+ } else if (c === "|") {
32991
+ if (this.expression.charAt(this.pos + 1) === "|") {
32992
+ this.current = this.newToken(TOP, "||");
32993
+ this.pos++;
32994
+ } else {
32995
+ return false;
32996
+ }
32997
+ } else if (c === "=") {
32998
+ if (this.expression.charAt(this.pos + 1) === "=") {
32999
+ this.current = this.newToken(TOP, "==");
33000
+ this.pos++;
33001
+ } else {
33002
+ this.current = this.newToken(TOP, c);
33003
+ }
33004
+ } else if (c === "!") {
33005
+ if (this.expression.charAt(this.pos + 1) === "=") {
33006
+ this.current = this.newToken(TOP, "!=");
33007
+ this.pos++;
33008
+ } else {
33009
+ this.current = this.newToken(TOP, c);
33010
+ }
33011
+ } else {
33012
+ return false;
33013
+ }
33014
+ this.pos++;
33015
+ if (this.isOperatorEnabled(this.current.value)) {
33016
+ return true;
33017
+ } else {
33018
+ this.pos = startPos;
33019
+ return false;
33020
+ }
33021
+ };
33022
+ TokenStream.prototype.isOperatorEnabled = function(op) {
33023
+ return this.parser.isOperatorEnabled(op);
33024
+ };
33025
+ TokenStream.prototype.getCoordinates = function() {
33026
+ var line = 0;
33027
+ var column;
33028
+ var newline = -1;
33029
+ do {
33030
+ line++;
33031
+ column = this.pos - newline;
33032
+ newline = this.expression.indexOf("\n", newline + 1);
33033
+ } while (newline >= 0 && newline < this.pos);
33034
+ return {
33035
+ line,
33036
+ column
33037
+ };
33038
+ };
33039
+ TokenStream.prototype.parseError = function(msg) {
33040
+ var coords = this.getCoordinates();
33041
+ throw new Error("parse error [" + coords.line + ":" + coords.column + "]: " + msg);
33042
+ };
33043
+ function ParserState(parser2, tokenStream, options) {
33044
+ this.parser = parser2;
33045
+ this.tokens = tokenStream;
33046
+ this.current = null;
33047
+ this.nextToken = null;
33048
+ this.next();
33049
+ this.savedCurrent = null;
33050
+ this.savedNextToken = null;
33051
+ this.allowMemberAccess = options.allowMemberAccess !== false;
33052
+ }
33053
+ ParserState.prototype.next = function() {
33054
+ this.current = this.nextToken;
33055
+ return this.nextToken = this.tokens.next();
33056
+ };
33057
+ ParserState.prototype.tokenMatches = function(token, value) {
33058
+ if (typeof value === "undefined") {
33059
+ return true;
33060
+ } else if (Array.isArray(value)) {
33061
+ return contains(value, token.value);
33062
+ } else if (typeof value === "function") {
33063
+ return value(token);
33064
+ } else {
33065
+ return token.value === value;
33066
+ }
33067
+ };
33068
+ ParserState.prototype.save = function() {
33069
+ this.savedCurrent = this.current;
33070
+ this.savedNextToken = this.nextToken;
33071
+ this.tokens.save();
33072
+ };
33073
+ ParserState.prototype.restore = function() {
33074
+ this.tokens.restore();
33075
+ this.current = this.savedCurrent;
33076
+ this.nextToken = this.savedNextToken;
33077
+ };
33078
+ ParserState.prototype.accept = function(type, value) {
33079
+ if (this.nextToken.type === type && this.tokenMatches(this.nextToken, value)) {
33080
+ this.next();
33081
+ return true;
33082
+ }
33083
+ return false;
33084
+ };
33085
+ ParserState.prototype.expect = function(type, value) {
33086
+ if (!this.accept(type, value)) {
33087
+ var coords = this.tokens.getCoordinates();
33088
+ throw new Error("parse error [" + coords.line + ":" + coords.column + "]: Expected " + (value || type));
33089
+ }
33090
+ };
33091
+ ParserState.prototype.parseAtom = function(instr) {
33092
+ var unaryOps = this.tokens.unaryOps;
33093
+ function isPrefixOperator(token) {
33094
+ return token.value in unaryOps;
33095
+ }
33096
+ if (this.accept(TNAME) || this.accept(TOP, isPrefixOperator)) {
33097
+ instr.push(new Instruction(IVAR, this.current.value));
33098
+ } else if (this.accept(TNUMBER)) {
33099
+ instr.push(new Instruction(INUMBER, this.current.value));
33100
+ } else if (this.accept(TSTRING)) {
33101
+ instr.push(new Instruction(INUMBER, this.current.value));
33102
+ } else if (this.accept(TPAREN, "(")) {
33103
+ this.parseExpression(instr);
33104
+ this.expect(TPAREN, ")");
33105
+ } else if (this.accept(TBRACKET, "[")) {
33106
+ if (this.accept(TBRACKET, "]")) {
33107
+ instr.push(new Instruction(IARRAY, 0));
33108
+ } else {
33109
+ var argCount = this.parseArrayList(instr);
33110
+ instr.push(new Instruction(IARRAY, argCount));
33111
+ }
33112
+ } else {
33113
+ throw new Error("unexpected " + this.nextToken);
33114
+ }
33115
+ };
33116
+ ParserState.prototype.parseExpression = function(instr) {
33117
+ var exprInstr = [];
33118
+ if (this.parseUntilEndStatement(instr, exprInstr)) {
33119
+ return;
33120
+ }
33121
+ this.parseVariableAssignmentExpression(exprInstr);
33122
+ if (this.parseUntilEndStatement(instr, exprInstr)) {
33123
+ return;
33124
+ }
33125
+ this.pushExpression(instr, exprInstr);
33126
+ };
33127
+ ParserState.prototype.pushExpression = function(instr, exprInstr) {
33128
+ for (var i = 0, len = exprInstr.length; i < len; i++) {
33129
+ instr.push(exprInstr[i]);
33130
+ }
33131
+ };
33132
+ ParserState.prototype.parseUntilEndStatement = function(instr, exprInstr) {
33133
+ if (!this.accept(TSEMICOLON)) return false;
33134
+ if (this.nextToken && this.nextToken.type !== TEOF && !(this.nextToken.type === TPAREN && this.nextToken.value === ")")) {
33135
+ exprInstr.push(new Instruction(IENDSTATEMENT));
33136
+ }
33137
+ if (this.nextToken.type !== TEOF) {
33138
+ this.parseExpression(exprInstr);
33139
+ }
33140
+ instr.push(new Instruction(IEXPR, exprInstr));
33141
+ return true;
33142
+ };
33143
+ ParserState.prototype.parseArrayList = function(instr) {
33144
+ var argCount = 0;
33145
+ while (!this.accept(TBRACKET, "]")) {
33146
+ this.parseExpression(instr);
33147
+ ++argCount;
33148
+ while (this.accept(TCOMMA)) {
33149
+ this.parseExpression(instr);
33150
+ ++argCount;
33151
+ }
33152
+ }
33153
+ return argCount;
33154
+ };
33155
+ ParserState.prototype.parseVariableAssignmentExpression = function(instr) {
33156
+ this.parseConditionalExpression(instr);
33157
+ while (this.accept(TOP, "=")) {
33158
+ var varName = instr.pop();
33159
+ var varValue = [];
33160
+ var lastInstrIndex = instr.length - 1;
33161
+ if (varName.type === IFUNCALL) {
33162
+ if (!this.tokens.isOperatorEnabled("()=")) {
33163
+ throw new Error("function definition is not permitted");
33164
+ }
33165
+ for (var i = 0, len = varName.value + 1; i < len; i++) {
33166
+ var index2 = lastInstrIndex - i;
33167
+ if (instr[index2].type === IVAR) {
33168
+ instr[index2] = new Instruction(IVARNAME, instr[index2].value);
33169
+ }
33170
+ }
33171
+ this.parseVariableAssignmentExpression(varValue);
33172
+ instr.push(new Instruction(IEXPR, varValue));
33173
+ instr.push(new Instruction(IFUNDEF, varName.value));
33174
+ continue;
33175
+ }
33176
+ if (varName.type !== IVAR && varName.type !== IMEMBER) {
33177
+ throw new Error("expected variable for assignment");
33178
+ }
33179
+ this.parseVariableAssignmentExpression(varValue);
33180
+ instr.push(new Instruction(IVARNAME, varName.value));
33181
+ instr.push(new Instruction(IEXPR, varValue));
33182
+ instr.push(binaryInstruction("="));
33183
+ }
33184
+ };
33185
+ ParserState.prototype.parseConditionalExpression = function(instr) {
33186
+ this.parseOrExpression(instr);
33187
+ while (this.accept(TOP, "?")) {
33188
+ var trueBranch = [];
33189
+ var falseBranch = [];
33190
+ this.parseConditionalExpression(trueBranch);
33191
+ this.expect(TOP, ":");
33192
+ this.parseConditionalExpression(falseBranch);
33193
+ instr.push(new Instruction(IEXPR, trueBranch));
33194
+ instr.push(new Instruction(IEXPR, falseBranch));
33195
+ instr.push(ternaryInstruction("?"));
33196
+ }
33197
+ };
33198
+ ParserState.prototype.parseOrExpression = function(instr) {
33199
+ this.parseAndExpression(instr);
33200
+ while (this.accept(TOP, "or")) {
33201
+ var falseBranch = [];
33202
+ this.parseAndExpression(falseBranch);
33203
+ instr.push(new Instruction(IEXPR, falseBranch));
33204
+ instr.push(binaryInstruction("or"));
33205
+ }
33206
+ };
33207
+ ParserState.prototype.parseAndExpression = function(instr) {
33208
+ this.parseComparison(instr);
33209
+ while (this.accept(TOP, "and")) {
33210
+ var trueBranch = [];
33211
+ this.parseComparison(trueBranch);
33212
+ instr.push(new Instruction(IEXPR, trueBranch));
33213
+ instr.push(binaryInstruction("and"));
33214
+ }
33215
+ };
33216
+ var COMPARISON_OPERATORS = ["==", "!=", "<", "<=", ">=", ">", "in"];
33217
+ ParserState.prototype.parseComparison = function(instr) {
33218
+ this.parseAddSub(instr);
33219
+ while (this.accept(TOP, COMPARISON_OPERATORS)) {
33220
+ var op = this.current;
33221
+ this.parseAddSub(instr);
33222
+ instr.push(binaryInstruction(op.value));
33223
+ }
33224
+ };
33225
+ var ADD_SUB_OPERATORS = ["+", "-", "||"];
33226
+ ParserState.prototype.parseAddSub = function(instr) {
33227
+ this.parseTerm(instr);
33228
+ while (this.accept(TOP, ADD_SUB_OPERATORS)) {
33229
+ var op = this.current;
33230
+ this.parseTerm(instr);
33231
+ instr.push(binaryInstruction(op.value));
33232
+ }
33233
+ };
33234
+ var TERM_OPERATORS = ["*", "/", "%"];
33235
+ ParserState.prototype.parseTerm = function(instr) {
33236
+ this.parseFactor(instr);
33237
+ while (this.accept(TOP, TERM_OPERATORS)) {
33238
+ var op = this.current;
33239
+ this.parseFactor(instr);
33240
+ instr.push(binaryInstruction(op.value));
33241
+ }
33242
+ };
33243
+ ParserState.prototype.parseFactor = function(instr) {
33244
+ var unaryOps = this.tokens.unaryOps;
33245
+ function isPrefixOperator(token) {
33246
+ return token.value in unaryOps;
33247
+ }
33248
+ this.save();
33249
+ if (this.accept(TOP, isPrefixOperator)) {
33250
+ if (this.current.value !== "-" && this.current.value !== "+") {
33251
+ if (this.nextToken.type === TPAREN && this.nextToken.value === "(") {
33252
+ this.restore();
33253
+ this.parseExponential(instr);
33254
+ return;
33255
+ } else if (this.nextToken.type === TSEMICOLON || this.nextToken.type === TCOMMA || this.nextToken.type === TEOF || this.nextToken.type === TPAREN && this.nextToken.value === ")") {
33256
+ this.restore();
33257
+ this.parseAtom(instr);
33258
+ return;
33259
+ }
33260
+ }
33261
+ var op = this.current;
33262
+ this.parseFactor(instr);
33263
+ instr.push(unaryInstruction(op.value));
33264
+ } else {
33265
+ this.parseExponential(instr);
33266
+ }
33267
+ };
33268
+ ParserState.prototype.parseExponential = function(instr) {
33269
+ this.parsePostfixExpression(instr);
33270
+ while (this.accept(TOP, "^")) {
33271
+ this.parseFactor(instr);
33272
+ instr.push(binaryInstruction("^"));
33273
+ }
33274
+ };
33275
+ ParserState.prototype.parsePostfixExpression = function(instr) {
33276
+ this.parseFunctionCall(instr);
33277
+ while (this.accept(TOP, "!")) {
33278
+ instr.push(unaryInstruction("!"));
33279
+ }
33280
+ };
33281
+ ParserState.prototype.parseFunctionCall = function(instr) {
33282
+ var unaryOps = this.tokens.unaryOps;
33283
+ function isPrefixOperator(token) {
33284
+ return token.value in unaryOps;
33285
+ }
33286
+ if (this.accept(TOP, isPrefixOperator)) {
33287
+ var op = this.current;
33288
+ this.parseAtom(instr);
33289
+ instr.push(unaryInstruction(op.value));
33290
+ } else {
33291
+ this.parseMemberExpression(instr);
33292
+ while (this.accept(TPAREN, "(")) {
33293
+ if (this.accept(TPAREN, ")")) {
33294
+ instr.push(new Instruction(IFUNCALL, 0));
33295
+ } else {
33296
+ var argCount = this.parseArgumentList(instr);
33297
+ instr.push(new Instruction(IFUNCALL, argCount));
33298
+ }
33299
+ }
33300
+ }
33301
+ };
33302
+ ParserState.prototype.parseArgumentList = function(instr) {
33303
+ var argCount = 0;
33304
+ while (!this.accept(TPAREN, ")")) {
33305
+ this.parseExpression(instr);
33306
+ ++argCount;
33307
+ while (this.accept(TCOMMA)) {
33308
+ this.parseExpression(instr);
33309
+ ++argCount;
33310
+ }
33311
+ }
33312
+ return argCount;
33313
+ };
33314
+ ParserState.prototype.parseMemberExpression = function(instr) {
33315
+ this.parseAtom(instr);
33316
+ while (this.accept(TOP, ".") || this.accept(TBRACKET, "[")) {
33317
+ var op = this.current;
33318
+ if (op.value === ".") {
33319
+ if (!this.allowMemberAccess) {
33320
+ throw new Error('unexpected ".", member access is not permitted');
33321
+ }
33322
+ this.expect(TNAME);
33323
+ instr.push(new Instruction(IMEMBER, this.current.value));
33324
+ } else if (op.value === "[") {
33325
+ if (!this.tokens.isOperatorEnabled("[")) {
33326
+ throw new Error('unexpected "[]", arrays are disabled');
33327
+ }
33328
+ this.parseExpression(instr);
33329
+ this.expect(TBRACKET, "]");
33330
+ instr.push(binaryInstruction("["));
33331
+ } else {
33332
+ throw new Error("unexpected symbol: " + op.value);
33333
+ }
33334
+ }
33335
+ };
33336
+ function add(a2, b) {
33337
+ return Number(a2) + Number(b);
33338
+ }
33339
+ function sub(a2, b) {
33340
+ return a2 - b;
33341
+ }
33342
+ function mul(a2, b) {
33343
+ return a2 * b;
33344
+ }
33345
+ function div(a2, b) {
33346
+ return a2 / b;
33347
+ }
33348
+ function mod(a2, b) {
33349
+ return a2 % b;
33350
+ }
33351
+ function concat(a2, b) {
33352
+ if (Array.isArray(a2) && Array.isArray(b)) {
33353
+ return a2.concat(b);
33354
+ }
33355
+ return "" + a2 + b;
33356
+ }
33357
+ function equal(a2, b) {
33358
+ return a2 === b;
33359
+ }
33360
+ function notEqual(a2, b) {
33361
+ return a2 !== b;
33362
+ }
33363
+ function greaterThan(a2, b) {
33364
+ return a2 > b;
33365
+ }
33366
+ function lessThan(a2, b) {
33367
+ return a2 < b;
33368
+ }
33369
+ function greaterThanEqual(a2, b) {
33370
+ return a2 >= b;
33371
+ }
33372
+ function lessThanEqual(a2, b) {
33373
+ return a2 <= b;
33374
+ }
33375
+ function andOperator(a2, b) {
33376
+ return Boolean(a2 && b);
33377
+ }
33378
+ function orOperator(a2, b) {
33379
+ return Boolean(a2 || b);
33380
+ }
33381
+ function inOperator(a2, b) {
33382
+ return contains(b, a2);
33383
+ }
33384
+ function sinh(a2) {
33385
+ return (Math.exp(a2) - Math.exp(-a2)) / 2;
33386
+ }
33387
+ function cosh(a2) {
33388
+ return (Math.exp(a2) + Math.exp(-a2)) / 2;
33389
+ }
33390
+ function tanh(a2) {
33391
+ if (a2 === Infinity) return 1;
33392
+ if (a2 === -Infinity) return -1;
33393
+ return (Math.exp(a2) - Math.exp(-a2)) / (Math.exp(a2) + Math.exp(-a2));
33394
+ }
33395
+ function asinh(a2) {
33396
+ if (a2 === -Infinity) return a2;
33397
+ return Math.log(a2 + Math.sqrt(a2 * a2 + 1));
33398
+ }
33399
+ function acosh(a2) {
33400
+ return Math.log(a2 + Math.sqrt(a2 * a2 - 1));
33401
+ }
33402
+ function atanh(a2) {
33403
+ return Math.log((1 + a2) / (1 - a2)) / 2;
33404
+ }
33405
+ function log10(a2) {
33406
+ return Math.log(a2) * Math.LOG10E;
33407
+ }
33408
+ function neg(a2) {
33409
+ return -a2;
33410
+ }
33411
+ function not(a2) {
33412
+ return !a2;
33413
+ }
33414
+ function trunc(a2) {
33415
+ return a2 < 0 ? Math.ceil(a2) : Math.floor(a2);
33416
+ }
33417
+ function random(a2) {
33418
+ return Math.random() * (a2 || 1);
33419
+ }
33420
+ function factorial(a2) {
33421
+ return gamma(a2 + 1);
33422
+ }
33423
+ function isInteger(value) {
33424
+ return isFinite(value) && value === Math.round(value);
33425
+ }
33426
+ var GAMMA_G = 4.7421875;
33427
+ var GAMMA_P = [
33428
+ 0.9999999999999971,
33429
+ 57.15623566586292,
33430
+ -59.59796035547549,
33431
+ 14.136097974741746,
33432
+ -0.4919138160976202,
33433
+ 3399464998481189e-20,
33434
+ 4652362892704858e-20,
33435
+ -9837447530487956e-20,
33436
+ 1580887032249125e-19,
33437
+ -21026444172410488e-20,
33438
+ 21743961811521265e-20,
33439
+ -1643181065367639e-19,
33440
+ 8441822398385275e-20,
33441
+ -26190838401581408e-21,
33442
+ 36899182659531625e-22
33443
+ ];
33444
+ function gamma(n) {
33445
+ var t, x;
33446
+ if (isInteger(n)) {
33447
+ if (n <= 0) {
33448
+ return isFinite(n) ? Infinity : NaN;
33449
+ }
33450
+ if (n > 171) {
33451
+ return Infinity;
33452
+ }
33453
+ var value = n - 2;
33454
+ var res = n - 1;
33455
+ while (value > 1) {
33456
+ res *= value;
33457
+ value--;
33458
+ }
33459
+ if (res === 0) {
33460
+ res = 1;
33461
+ }
33462
+ return res;
33463
+ }
33464
+ if (n < 0.5) {
33465
+ return Math.PI / (Math.sin(Math.PI * n) * gamma(1 - n));
33466
+ }
33467
+ if (n >= 171.35) {
33468
+ return Infinity;
33469
+ }
33470
+ if (n > 85) {
33471
+ var twoN = n * n;
33472
+ var threeN = twoN * n;
33473
+ var fourN = threeN * n;
33474
+ var fiveN = fourN * n;
33475
+ return Math.sqrt(2 * Math.PI / n) * Math.pow(n / Math.E, n) * (1 + 1 / (12 * n) + 1 / (288 * twoN) - 139 / (51840 * threeN) - 571 / (2488320 * fourN) + 163879 / (209018880 * fiveN) + 5246819 / (75246796800 * fiveN * n));
33476
+ }
33477
+ --n;
33478
+ x = GAMMA_P[0];
33479
+ for (var i = 1; i < GAMMA_P.length; ++i) {
33480
+ x += GAMMA_P[i] / (n + i);
33481
+ }
33482
+ t = n + GAMMA_G + 0.5;
33483
+ return Math.sqrt(2 * Math.PI) * Math.pow(t, n + 0.5) * Math.exp(-t) * x;
33484
+ }
33485
+ function stringOrArrayLength(s) {
33486
+ if (Array.isArray(s)) {
33487
+ return s.length;
33488
+ }
33489
+ return String(s).length;
33490
+ }
33491
+ function hypot() {
33492
+ var sum2 = 0;
33493
+ var larg = 0;
33494
+ for (var i = 0; i < arguments.length; i++) {
33495
+ var arg = Math.abs(arguments[i]);
33496
+ var div2;
33497
+ if (larg < arg) {
33498
+ div2 = larg / arg;
33499
+ sum2 = sum2 * div2 * div2 + 1;
33500
+ larg = arg;
33501
+ } else if (arg > 0) {
33502
+ div2 = arg / larg;
33503
+ sum2 += div2 * div2;
33504
+ } else {
33505
+ sum2 += arg;
33506
+ }
33507
+ }
33508
+ return larg === Infinity ? Infinity : larg * Math.sqrt(sum2);
33509
+ }
33510
+ function condition(cond, yep, nope) {
33511
+ return cond ? yep : nope;
33512
+ }
33513
+ function roundTo(value, exp) {
33514
+ if (typeof exp === "undefined" || +exp === 0) {
33515
+ return Math.round(value);
33516
+ }
33517
+ value = +value;
33518
+ exp = -+exp;
33519
+ if (isNaN(value) || !(typeof exp === "number" && exp % 1 === 0)) {
33520
+ return NaN;
33521
+ }
33522
+ value = value.toString().split("e");
33523
+ value = Math.round(+(value[0] + "e" + (value[1] ? +value[1] - exp : -exp)));
33524
+ value = value.toString().split("e");
33525
+ return +(value[0] + "e" + (value[1] ? +value[1] + exp : exp));
33526
+ }
33527
+ function setVar(name, value, variables) {
33528
+ if (variables) variables[name] = value;
33529
+ return value;
33530
+ }
33531
+ function arrayIndex(array2, index2) {
33532
+ return array2[index2 | 0];
33533
+ }
33534
+ function max(array2) {
33535
+ if (arguments.length === 1 && Array.isArray(array2)) {
33536
+ return Math.max.apply(Math, array2);
33537
+ } else {
33538
+ return Math.max.apply(Math, arguments);
33539
+ }
33540
+ }
33541
+ function min(array2) {
33542
+ if (arguments.length === 1 && Array.isArray(array2)) {
33543
+ return Math.min.apply(Math, array2);
33544
+ } else {
33545
+ return Math.min.apply(Math, arguments);
33546
+ }
33547
+ }
33548
+ function arrayMap(f, a2) {
33549
+ if (typeof f !== "function") {
33550
+ throw new Error("First argument to map is not a function");
33551
+ }
33552
+ if (!Array.isArray(a2)) {
33553
+ throw new Error("Second argument to map is not an array");
33554
+ }
33555
+ return a2.map(function(x, i) {
33556
+ return f(x, i);
33557
+ });
33558
+ }
33559
+ function arrayFold(f, init2, a2) {
33560
+ if (typeof f !== "function") {
33561
+ throw new Error("First argument to fold is not a function");
33562
+ }
33563
+ if (!Array.isArray(a2)) {
33564
+ throw new Error("Second argument to fold is not an array");
33565
+ }
33566
+ return a2.reduce(function(acc, x, i) {
33567
+ return f(acc, x, i);
33568
+ }, init2);
33569
+ }
33570
+ function arrayFilter(f, a2) {
33571
+ if (typeof f !== "function") {
33572
+ throw new Error("First argument to filter is not a function");
33573
+ }
33574
+ if (!Array.isArray(a2)) {
33575
+ throw new Error("Second argument to filter is not an array");
33576
+ }
33577
+ return a2.filter(function(x, i) {
33578
+ return f(x, i);
33579
+ });
33580
+ }
33581
+ function stringOrArrayIndexOf(target, s) {
33582
+ if (!(Array.isArray(s) || typeof s === "string")) {
33583
+ throw new Error("Second argument to indexOf is not a string or array");
33584
+ }
33585
+ return s.indexOf(target);
33586
+ }
33587
+ function arrayJoin(sep, a2) {
33588
+ if (!Array.isArray(a2)) {
33589
+ throw new Error("Second argument to join is not an array");
33590
+ }
33591
+ return a2.join(sep);
33592
+ }
33593
+ function sign(x) {
33594
+ return (x > 0) - (x < 0) || +x;
33595
+ }
33596
+ var ONE_THIRD = 1 / 3;
33597
+ function cbrt(x) {
33598
+ return x < 0 ? -Math.pow(-x, ONE_THIRD) : Math.pow(x, ONE_THIRD);
33599
+ }
33600
+ function expm1(x) {
33601
+ return Math.exp(x) - 1;
33602
+ }
33603
+ function log1p(x) {
33604
+ return Math.log(1 + x);
33605
+ }
33606
+ function log2(x) {
33607
+ return Math.log(x) / Math.LN2;
33608
+ }
33609
+ function Parser(options) {
33610
+ this.options = options || {};
33611
+ this.unaryOps = {
33612
+ sin: Math.sin,
33613
+ cos: Math.cos,
33614
+ tan: Math.tan,
33615
+ asin: Math.asin,
33616
+ acos: Math.acos,
33617
+ atan: Math.atan,
33618
+ sinh: Math.sinh || sinh,
33619
+ cosh: Math.cosh || cosh,
33620
+ tanh: Math.tanh || tanh,
33621
+ asinh: Math.asinh || asinh,
33622
+ acosh: Math.acosh || acosh,
33623
+ atanh: Math.atanh || atanh,
33624
+ sqrt: Math.sqrt,
33625
+ cbrt: Math.cbrt || cbrt,
33626
+ log: Math.log,
33627
+ log2: Math.log2 || log2,
33628
+ ln: Math.log,
33629
+ lg: Math.log10 || log10,
33630
+ log10: Math.log10 || log10,
33631
+ expm1: Math.expm1 || expm1,
33632
+ log1p: Math.log1p || log1p,
33633
+ abs: Math.abs,
33634
+ ceil: Math.ceil,
33635
+ floor: Math.floor,
33636
+ round: Math.round,
33637
+ trunc: Math.trunc || trunc,
33638
+ "-": neg,
33639
+ "+": Number,
33640
+ exp: Math.exp,
33641
+ not,
33642
+ length: stringOrArrayLength,
33643
+ "!": factorial,
33644
+ sign: Math.sign || sign
33645
+ };
33646
+ this.binaryOps = {
33647
+ "+": add,
33648
+ "-": sub,
33649
+ "*": mul,
33650
+ "/": div,
33651
+ "%": mod,
33652
+ "^": Math.pow,
33653
+ "||": concat,
33654
+ "==": equal,
33655
+ "!=": notEqual,
33656
+ ">": greaterThan,
33657
+ "<": lessThan,
33658
+ ">=": greaterThanEqual,
33659
+ "<=": lessThanEqual,
33660
+ and: andOperator,
33661
+ or: orOperator,
33662
+ "in": inOperator,
33663
+ "=": setVar,
33664
+ "[": arrayIndex
33665
+ };
33666
+ this.ternaryOps = {
33667
+ "?": condition
33668
+ };
33669
+ this.functions = {
33670
+ random,
33671
+ fac: factorial,
33672
+ min,
33673
+ max,
33674
+ hypot: Math.hypot || hypot,
33675
+ pyt: Math.hypot || hypot,
33676
+ // backward compat
33677
+ pow: Math.pow,
33678
+ atan2: Math.atan2,
33679
+ "if": condition,
33680
+ gamma,
33681
+ roundTo,
33682
+ map: arrayMap,
33683
+ fold: arrayFold,
33684
+ filter: arrayFilter,
33685
+ indexOf: stringOrArrayIndexOf,
33686
+ join: arrayJoin
33687
+ };
33688
+ this.consts = {
33689
+ E: Math.E,
33690
+ PI: Math.PI,
33691
+ "true": true,
33692
+ "false": false
33693
+ };
33694
+ }
33695
+ Parser.prototype.parse = function(expr) {
33696
+ var instr = [];
33697
+ var parserState = new ParserState(
33698
+ this,
33699
+ new TokenStream(this, expr),
33700
+ { allowMemberAccess: this.options.allowMemberAccess }
33701
+ );
33702
+ parserState.parseExpression(instr);
33703
+ parserState.expect(TEOF, "EOF");
33704
+ return new Expression(instr, this);
33705
+ };
33706
+ Parser.prototype.evaluate = function(expr, variables) {
33707
+ return this.parse(expr).evaluate(variables);
33708
+ };
33709
+ var sharedParser = new Parser();
33710
+ Parser.parse = function(expr) {
33711
+ return sharedParser.parse(expr);
33712
+ };
33713
+ Parser.evaluate = function(expr, variables) {
33714
+ return sharedParser.parse(expr).evaluate(variables);
33715
+ };
33716
+ var optionNameMap = {
33717
+ "+": "add",
33718
+ "-": "subtract",
33719
+ "*": "multiply",
33720
+ "/": "divide",
33721
+ "%": "remainder",
33722
+ "^": "power",
33723
+ "!": "factorial",
33724
+ "<": "comparison",
33725
+ ">": "comparison",
33726
+ "<=": "comparison",
33727
+ ">=": "comparison",
33728
+ "==": "comparison",
33729
+ "!=": "comparison",
33730
+ "||": "concatenate",
33731
+ "and": "logical",
33732
+ "or": "logical",
33733
+ "not": "logical",
33734
+ "?": "conditional",
33735
+ ":": "conditional",
33736
+ "=": "assignment",
33737
+ "[": "array",
33738
+ "()=": "fndef"
33739
+ };
33740
+ function getOptionName(op) {
33741
+ return optionNameMap.hasOwnProperty(op) ? optionNameMap[op] : op;
33742
+ }
33743
+ Parser.prototype.isOperatorEnabled = function(op) {
33744
+ var optionName = getOptionName(op);
33745
+ var operators = this.options.operators || {};
33746
+ return !(optionName in operators) || !!operators[optionName];
33747
+ };
33748
+ const OPTIONAL_CHAIN_PATH_REGEX = /\b[$A-Za-z_][$\w]*(?:(?:\?\.)|\.)[$A-Za-z_][$\w]*(?:(?:\?\.)[$A-Za-z_][$\w]*|(?:\.)[$A-Za-z_][$\w]*)*/g;
33749
+ const LENGTH_ACCESS_REGEX = /\b([$A-Za-z_][$\w]*(?:\.[$A-Za-z_][$\w]*)*)\.length\b/g;
33750
+ const OPTIONAL_LENGTH_ACCESS_REGEX = /(__optional\("[^"]+"\))\.length\b/g;
33751
+ const parser = new Parser({
33752
+ allowMemberAccess: true,
33753
+ operators: {
33754
+ assignment: false,
33755
+ fndef: false
33756
+ }
33757
+ });
33758
+ const expressionCache = /* @__PURE__ */ new Map();
33759
+ function normalizeExpression(expression) {
33760
+ return expression.replace(OPTIONAL_CHAIN_PATH_REGEX, (chain) => {
33761
+ if (!chain.includes("?.")) {
33762
+ return chain;
33763
+ }
33764
+ const serializedPath = chain.replace(/\?\./g, ".");
33765
+ return `__optional("${serializedPath}")`;
33766
+ }).replace(LENGTH_ACCESS_REGEX, (_, basePath) => `__length(${basePath})`).replace(OPTIONAL_LENGTH_ACCESS_REGEX, (_, optionalPath) => `__length(${optionalPath})`).replaceAll("!==", "!=").replaceAll("===", "==").replaceAll("&&", " and ").replaceAll("||", " or ").replace(/!\s*(?!=)/g, "not ");
33767
+ }
33768
+ function parseExpression(expression) {
33769
+ const cached = expressionCache.get(expression);
33770
+ if (cached) {
33771
+ return cached;
33772
+ }
33773
+ const parsed = parser.parse(normalizeExpression(expression));
33774
+ expressionCache.set(expression, parsed);
33775
+ return parsed;
33776
+ }
32144
33777
  function evaluateExpression(expression, data) {
33778
+ if (expression === void 0 || expression === null) {
33779
+ return expression;
33780
+ }
33781
+ if (typeof expression !== "string") {
33782
+ return expression;
33783
+ }
33784
+ const scope = {
33785
+ data,
33786
+ undefined: void 0,
33787
+ null: null
33788
+ };
33789
+ scope.__optional = (path) => {
33790
+ return path.split(".").reduce((current, key) => {
33791
+ if (current === null || current === void 0) {
33792
+ return void 0;
33793
+ }
33794
+ return current[key];
33795
+ }, scope);
33796
+ };
33797
+ scope.__length = (value) => {
33798
+ if (value === null || value === void 0) {
33799
+ return void 0;
33800
+ }
33801
+ if (typeof value === "string" || Array.isArray(value)) {
33802
+ return value.length;
33803
+ }
33804
+ if (typeof value === "object" && "length" in value) {
33805
+ const length = value.length;
33806
+ return typeof length === "number" ? length : void 0;
33807
+ }
33808
+ return void 0;
33809
+ };
32145
33810
  try {
32146
- const func = new Function("data", `return ${expression};`);
32147
- return func(data);
33811
+ const parsedExpression = parseExpression(expression);
33812
+ for (const symbol of parsedExpression.symbols()) {
33813
+ if (scope[symbol] !== void 0) {
33814
+ continue;
33815
+ }
33816
+ const value = globalThis[symbol];
33817
+ if (typeof value === "function") {
33818
+ scope[symbol] = value;
33819
+ }
33820
+ }
33821
+ return parsedExpression.evaluate(scope);
32148
33822
  } catch (error) {
32149
33823
  console.error(`Error while evaluating when (${expression}) in go-if: ${error.message}`);
32150
33824
  }
@@ -33132,10 +34806,10 @@ function Overview($$anchor, $$props) {
33132
34806
  {
33133
34807
  var consequent = ($$anchor2) => {
33134
34808
  var fragment_1 = root_1$4();
33135
- var div = first_child(fragment_1);
33136
- var text2 = child(div);
33137
- reset(div);
33138
- var div_1 = sibling(div, 2);
34809
+ var div2 = first_child(fragment_1);
34810
+ var text2 = child(div2);
34811
+ reset(div2);
34812
+ var div_1 = sibling(div2, 2);
33139
34813
  var text_1 = child(div_1, true);
33140
34814
  reset(div_1);
33141
34815
  template_effect(() => {
@@ -34249,8 +35923,8 @@ function CalendarUI($$anchor, $$props) {
34249
35923
  flushSync();
34250
35924
  }
34251
35925
  };
34252
- var div = root_1();
34253
- var node = child(div);
35926
+ var div2 = root_1();
35927
+ var node = child(div2);
34254
35928
  {
34255
35929
  const children = ($$anchor2, $$arg0) => {
34256
35930
  let months = () => $$arg0?.().months;
@@ -34454,9 +36128,9 @@ function CalendarUI($$anchor, $$props) {
34454
36128
  });
34455
36129
  });
34456
36130
  }
34457
- reset(div);
34458
- bind_this(div, ($$value) => set(root2, $$value), () => get$2(root2));
34459
- append($$anchor, div);
36131
+ reset(div2);
36132
+ bind_this(div2, ($$value) => set(root2, $$value), () => get$2(root2));
36133
+ append($$anchor, div2);
34460
36134
  return pop($$exports);
34461
36135
  }
34462
36136
  create_custom_element(CalendarUI, { calendarClass: {} }, [], ["details"], { mode: "open" });