@gramlot/gramlot 0.3.9 → 0.3.10

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.
@@ -20773,13 +20773,14 @@ function buildTree(data2) {
20773
20773
  cursor.next();
20774
20774
  let localChildren = [], localPositions = [];
20775
20775
  let localInRepeat = id2 >= minRepeatType ? id2 : -1;
20776
- let lastGroup = 0, lastEnd = end;
20776
+ let lastGroup = 0, lastEnd = end, groupLookAhead = lookAheadAtStart;
20777
20777
  while (cursor.pos > endPos) {
20778
20778
  if (localInRepeat >= 0 && cursor.id == localInRepeat && cursor.size >= 0) {
20779
20779
  if (cursor.end <= lastEnd - maxBufferLength) {
20780
- makeRepeatLeaf(localChildren, localPositions, start, lastGroup, cursor.end, lastEnd, localInRepeat, lookAheadAtStart, contextAtStart);
20780
+ makeRepeatLeaf(localChildren, localPositions, start, lastGroup, cursor.end, lastEnd, localInRepeat, groupLookAhead, contextAtStart);
20781
20781
  lastGroup = localChildren.length;
20782
20782
  lastEnd = cursor.end;
20783
+ groupLookAhead = lookAhead;
20783
20784
  }
20784
20785
  cursor.next();
20785
20786
  } else if (depth2 > 2500) {
@@ -20789,7 +20790,7 @@ function buildTree(data2) {
20789
20790
  }
20790
20791
  }
20791
20792
  if (localInRepeat >= 0 && lastGroup > 0 && lastGroup < localChildren.length)
20792
- makeRepeatLeaf(localChildren, localPositions, start, lastGroup, start, lastEnd, localInRepeat, lookAheadAtStart, contextAtStart);
20793
+ makeRepeatLeaf(localChildren, localPositions, start, lastGroup, start, lastEnd, localInRepeat, groupLookAhead, contextAtStart);
20793
20794
  localChildren.reverse();
20794
20795
  localPositions.reverse();
20795
20796
  if (localInRepeat > -1 && lastGroup > 0) {
@@ -20839,7 +20840,7 @@ function buildTree(data2) {
20839
20840
  if (!lastI && last2.type == type && last2.length == length2)
20840
20841
  return last2;
20841
20842
  if (lookAheadProp = last2.prop(NodeProp.lookAhead))
20842
- lookAhead2 = positions2[lastI] + last2.length + lookAheadProp;
20843
+ lookAhead2 = positions2[lastI] + last2.length + lookAheadProp - length2;
20843
20844
  }
20844
20845
  return makeTree(type, children2, positions2, length2, lookAhead2, contextHash2);
20845
20846
  };
@@ -89724,36 +89725,25 @@ function contentBetween(doc4, from2, to) {
89724
89725
  return false;
89725
89726
  }
89726
89727
  function addMark(tr, from2, to, mark) {
89727
- let removed = [], added = [];
89728
- let removing, adding;
89728
+ let added = [], adding;
89729
89729
  tr.doc.nodesBetween(from2, to, (node, pos, parent) => {
89730
89730
  if (!node.isInline)
89731
89731
  return;
89732
89732
  let marks2 = node.marks;
89733
89733
  if (!mark.isInSet(marks2) && parent.type.allowsMarkType(mark.type)) {
89734
89734
  let start = Math.max(pos, from2), end = Math.min(pos + node.nodeSize, to);
89735
- let newSet = mark.addToSet(marks2);
89736
- for (let i2 = 0; i2 < marks2.length; i2++) {
89737
- if (!marks2[i2].isInSet(newSet)) {
89738
- if (removing && removing.to == start && removing.mark.eq(marks2[i2]))
89739
- removing.to = end;
89740
- else
89741
- removed.push(removing = new RemoveMarkStep(start, end, marks2[i2]));
89742
- }
89743
- }
89744
89735
  if (adding && adding.to == start)
89745
89736
  adding.to = end;
89746
89737
  else
89747
89738
  added.push(adding = new AddMarkStep(start, end, mark));
89748
89739
  }
89749
89740
  });
89750
- removed.forEach((s) => tr.step(s));
89751
89741
  added.forEach((s) => tr.step(s));
89752
89742
  }
89753
89743
  function removeMark(tr, from2, to, mark) {
89754
89744
  let matched = [], step = 0;
89755
89745
  tr.doc.nodesBetween(from2, to, (node, pos) => {
89756
- if (!node.isInline)
89746
+ if (!node.isInline || !node.isAtom)
89757
89747
  return;
89758
89748
  step++;
89759
89749
  let toRemove = null;
@@ -90257,7 +90247,7 @@ function coveredDepths($from, $to) {
90257
90247
  }
90258
90248
  return result;
90259
90249
  }
90260
- var lower16, factor16, DEL_BEFORE, DEL_AFTER, DEL_ACROSS, DEL_SIDE, MapResult, StepMap, Mapping, stepsByID, Step, StepResult, AddMarkStep, RemoveMarkStep, AddNodeMarkStep, RemoveNodeMarkStep, ReplaceStep, ReplaceAroundStep, Fitter, AttrStep, DocAttrStep, TransformError, Transform;
90250
+ var lower16, factor16, DEL_BEFORE, DEL_AFTER, DEL_ACROSS, DEL_SIDE, MapResult, StepMap, Mapping, stepsByID, Step, StepResult, AddMarkStep, RemoveMarkStep, MarkSetStep, AddNodeMarkStep, RemoveNodeMarkStep, ReplaceStep, ReplaceAroundStep, Fitter, AttrStep, DocAttrStep, TransformError, Transform;
90261
90251
  var init_dist28 = __esm({
90262
90252
  "node_modules/prosemirror-transform/dist/index.js"() {
90263
90253
  init_dist27();
@@ -90627,6 +90617,8 @@ var init_dist28 = __esm({
90627
90617
  this.mark = mark;
90628
90618
  }
90629
90619
  apply(doc4) {
90620
+ if (this.from == this.to)
90621
+ return new StepResult(doc4, null);
90630
90622
  let oldSlice = doc4.slice(this.from, this.to), $from = doc4.resolve(this.from);
90631
90623
  let parent = $from.node($from.sharedDepth(this.to));
90632
90624
  let slice2 = new Slice(mapFragment(oldSlice.content, (node, parent2) => {
@@ -90636,14 +90628,27 @@ var init_dist28 = __esm({
90636
90628
  }, parent), oldSlice.openStart, oldSlice.openEnd);
90637
90629
  return StepResult.fromReplace(doc4, this.from, this.to, slice2);
90638
90630
  }
90639
- invert() {
90640
- return new RemoveMarkStep(this.from, this.to, this.mark);
90631
+ invert(doc4) {
90632
+ let steps = [];
90633
+ doc4.nodesBetween(this.from, this.to, (node, pos) => {
90634
+ if (node.isInline && node.isAtom) {
90635
+ let added = this.mark.addToSet(node.marks);
90636
+ if (!Mark.sameSet(added, node.marks)) {
90637
+ let from2 = Math.max(this.from, pos), to = Math.min(this.to, pos + node.nodeSize);
90638
+ steps.push(new RemoveMarkStep(from2, to, this.mark));
90639
+ for (let mark of node.marks)
90640
+ if (!mark.isInSet(added))
90641
+ steps.push(new _AddMarkStep(from2, to, mark));
90642
+ }
90643
+ }
90644
+ });
90645
+ return steps.length == 0 ? new RemoveMarkStep(this.from, this.from, this.mark) : steps.length == 1 ? steps[0] : new MarkSetStep(steps);
90641
90646
  }
90642
90647
  map(mapping) {
90643
- let from2 = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
90644
- if (from2.deleted && to.deleted || from2.pos >= to.pos)
90648
+ let from2 = mapping.map(this.from, 1), to = mapping.map(this.to, -1);
90649
+ if (from2 >= to)
90645
90650
  return null;
90646
- return new _AddMarkStep(from2.pos, to.pos, this.mark);
90651
+ return new _AddMarkStep(from2, to, this.mark);
90647
90652
  }
90648
90653
  merge(other) {
90649
90654
  if (other instanceof _AddMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from)
@@ -90679,20 +90684,27 @@ var init_dist28 = __esm({
90679
90684
  this.mark = mark;
90680
90685
  }
90681
90686
  apply(doc4) {
90687
+ if (this.from == this.to)
90688
+ return new StepResult(doc4, null);
90682
90689
  let oldSlice = doc4.slice(this.from, this.to);
90683
90690
  let slice2 = new Slice(mapFragment(oldSlice.content, (node) => {
90684
90691
  return node.mark(this.mark.removeFromSet(node.marks));
90685
90692
  }, doc4), oldSlice.openStart, oldSlice.openEnd);
90686
90693
  return StepResult.fromReplace(doc4, this.from, this.to, slice2);
90687
90694
  }
90688
- invert() {
90689
- return new AddMarkStep(this.from, this.to, this.mark);
90695
+ invert(doc4) {
90696
+ let steps = [];
90697
+ doc4.nodesBetween(this.from, this.to, (node, pos) => {
90698
+ if (node.isInline && node.isAtom && this.mark.isInSet(node.marks))
90699
+ steps.push(new AddMarkStep(Math.max(this.from, pos), Math.min(this.to, pos + node.nodeSize), this.mark));
90700
+ });
90701
+ return steps.length == 0 ? new AddMarkStep(this.from, this.from, this.mark) : steps.length == 1 ? steps[0] : new MarkSetStep(steps);
90690
90702
  }
90691
90703
  map(mapping) {
90692
- let from2 = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
90693
- if (from2.deleted && to.deleted || from2.pos >= to.pos)
90704
+ let from2 = mapping.map(this.from, 1), to = mapping.map(this.to, -1);
90705
+ if (from2 >= to)
90694
90706
  return null;
90695
- return new _RemoveMarkStep(from2.pos, to.pos, this.mark);
90707
+ return new _RemoveMarkStep(from2, to, this.mark);
90696
90708
  }
90697
90709
  merge(other) {
90698
90710
  if (other instanceof _RemoveMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from)
@@ -90717,6 +90729,42 @@ var init_dist28 = __esm({
90717
90729
  }
90718
90730
  };
90719
90731
  Step.jsonID("removeMark", RemoveMarkStep);
90732
+ MarkSetStep = class _MarkSetStep extends Step {
90733
+ constructor(steps) {
90734
+ super();
90735
+ this.steps = steps;
90736
+ }
90737
+ apply(doc4) {
90738
+ for (let step of this.steps) {
90739
+ let result = step.apply(doc4);
90740
+ if (!result.doc)
90741
+ return result;
90742
+ doc4 = result.doc;
90743
+ }
90744
+ return new StepResult(doc4, null);
90745
+ }
90746
+ invert(doc4) {
90747
+ return new _MarkSetStep(this.steps.map((s) => s.invert(doc4)));
90748
+ }
90749
+ map(mapping) {
90750
+ let result = [];
90751
+ for (let step of this.steps) {
90752
+ let mapped = step.map(mapping);
90753
+ if (mapped)
90754
+ result.push(mapped);
90755
+ }
90756
+ return result.length ? new _MarkSetStep(result) : null;
90757
+ }
90758
+ toJSON() {
90759
+ return { stepType: "markSet", steps: this.steps.map((s) => s.toJSON()) };
90760
+ }
90761
+ fromJSON(schema2, json3) {
90762
+ if (!Array.isArray(json3.steps) || !json3.steps.every((s) => s.stepType == "addMark" || s.stepType == "removeMark"))
90763
+ throw new RangeError("Invalid JSON for MarkSetStep");
90764
+ return new _MarkSetStep(json3.steps.map((s) => Step.fromJSON(schema2, s)));
90765
+ }
90766
+ };
90767
+ Step.jsonID("markSet", MarkSetStep);
90720
90768
  AddNodeMarkStep = class _AddNodeMarkStep extends Step {
90721
90769
  /**
90722
90770
  Create a node mark step.
@@ -100300,6 +100348,163 @@ Labelbox.parameters = {
100300
100348
  lbl_position: { dtype: "T", default: "TL", binding: "read", enum: POSITIONS }
100301
100349
  };
100302
100350
 
100351
+ // src/components/validation.js
100352
+ import { Bag as Bag2 } from "@gramlot/gramlot";
100353
+
100354
+ // node_modules/@genrojs/builders/src/pointers.js
100355
+ function pointerTransform(value) {
100356
+ if (typeof value !== "string" || !["^", "="].includes(value[0]) || value.startsWith("==")) return null;
100357
+ const index = value.indexOf(":");
100358
+ if (index < 0) return null;
100359
+ const expression = value[index + 1] === "=";
100360
+ return { pointer: value.slice(0, index), expression, body: value.slice(index + (expression ? 2 : 1)) };
100361
+ }
100362
+ var SLOT = /^\{(\??[A-Za-z_][A-Za-z0-9_]*|\?)?\}/;
100363
+ function pointerTemplate(body, read) {
100364
+ let result = "", blocked = false;
100365
+ for (let i2 = 0; i2 < body.length; ) {
100366
+ if (body[i2] !== "{" && body[i2] !== "}") {
100367
+ result += body[i2++];
100368
+ continue;
100369
+ }
100370
+ const match2 = body.slice(i2).match(SLOT);
100371
+ if (!match2) throw new SyntaxError("Invalid pointer template placeholder");
100372
+ const slot = match2[1] ?? "";
100373
+ const optional = slot.startsWith("?");
100374
+ const value = read(optional ? slot.slice(1) : slot);
100375
+ if (value == null || value === "" && !optional) blocked = true;
100376
+ else result += String(value);
100377
+ i2 += match2[0].length;
100378
+ }
100379
+ return blocked ? null : result;
100380
+ }
100381
+ function pointerExpression(body) {
100382
+ const slots = [], identifiers2 = /* @__PURE__ */ new Set();
100383
+ let text4 = "", operand = true;
100384
+ for (let i2 = 0; i2 < body.length; ) {
100385
+ const start = i2, c = body[i2];
100386
+ if (c === '"' || c === "'" || c === "`") {
100387
+ i2++;
100388
+ while (i2 < body.length) {
100389
+ if (body[i2] === "\\") {
100390
+ i2 += 2;
100391
+ continue;
100392
+ }
100393
+ if (body[i2++] === c) break;
100394
+ }
100395
+ text4 += body.slice(start, i2);
100396
+ operand = false;
100397
+ continue;
100398
+ }
100399
+ if (body.startsWith("//", i2)) {
100400
+ i2 = body.indexOf("\n", i2);
100401
+ if (i2 < 0) i2 = body.length;
100402
+ text4 += body.slice(start, i2);
100403
+ continue;
100404
+ }
100405
+ if (body.startsWith("/*", i2)) {
100406
+ const end = body.indexOf("*/", i2 + 2);
100407
+ i2 = end < 0 ? body.length : end + 2;
100408
+ text4 += body.slice(start, i2);
100409
+ continue;
100410
+ }
100411
+ if (c === "/" && operand) {
100412
+ let bracket2 = false;
100413
+ i2++;
100414
+ while (i2 < body.length) {
100415
+ const current = body[i2++];
100416
+ if (current === "\\") {
100417
+ i2++;
100418
+ continue;
100419
+ }
100420
+ if (current === "[") bracket2 = true;
100421
+ else if (current === "]") bracket2 = false;
100422
+ else if (current === "/" && !bracket2) break;
100423
+ }
100424
+ while (/[a-z]/i.test(body[i2] ?? "") && i2 < body.length) i2++;
100425
+ text4 += body.slice(start, i2);
100426
+ operand = false;
100427
+ continue;
100428
+ }
100429
+ const slot = c === "{" ? body.slice(i2).match(SLOT) : null;
100430
+ if (slot) {
100431
+ const name2 = slot[1] ?? "";
100432
+ if (name2.startsWith("?")) throw new SyntaxError("Optional slots are supported in pointer templates only");
100433
+ text4 += `_pointerValues[${slots.length}]`;
100434
+ slots.push(name2);
100435
+ i2 += slot[0].length;
100436
+ operand = false;
100437
+ continue;
100438
+ }
100439
+ const word = body.slice(i2).match(/^[A-Za-z_$][\w$]*/);
100440
+ if (word) {
100441
+ identifiers2.add(word[0]);
100442
+ text4 += word[0];
100443
+ i2 += word[0].length;
100444
+ operand = ["return", "typeof", "void", "delete", "new", "in", "instanceof", "yield", "await"].includes(word[0]);
100445
+ continue;
100446
+ }
100447
+ text4 += c;
100448
+ i2++;
100449
+ if (!/\s/.test(c)) operand = /[([{,:;=!?&|+*%~<>\/-]/.test(c);
100450
+ }
100451
+ return { text: text4, slots, identifiers: identifiers2 };
100452
+ }
100453
+ function resolvePointerItems(items, current, evaluate = () => null) {
100454
+ const values2 = /* @__PURE__ */ new Map(), active = [];
100455
+ const resolve = (name2) => {
100456
+ if (values2.has(name2)) return values2.get(name2);
100457
+ if (!items.has(name2)) throw new Error(`Referenced Source attribute '${name2}' does not exist`);
100458
+ if (active.includes(name2)) throw new Error(`Cyclic attribute dependency: ${[...active, name2].join(" -> ")}`);
100459
+ active.push(name2);
100460
+ try {
100461
+ const raw = items.get(name2);
100462
+ const transform = typeof name2 === "string" ? pointerTransform(raw) : null;
100463
+ let result = current.get(name2);
100464
+ if (transform) {
100465
+ const read = (key3) => key3 ? resolve(key3) : current.get(name2);
100466
+ if (transform.expression) {
100467
+ const expression = pointerExpression(transform.body);
100468
+ result = evaluate(name2, raw, expression, expression.slots.map(read));
100469
+ } else {
100470
+ result = pointerTemplate(transform.body, read);
100471
+ if (current.get(name2) == null) result = null;
100472
+ }
100473
+ }
100474
+ values2.set(name2, result);
100475
+ return result;
100476
+ } finally {
100477
+ active.pop();
100478
+ }
100479
+ };
100480
+ return new Map([...items.keys()].map((name2) => [name2, resolve(name2)]));
100481
+ }
100482
+ function pointerDependencies(node, raw) {
100483
+ const items = new Map([...Object.entries(node.getAttr()), ...node.fixedAttrItems()]);
100484
+ const seen = /* @__PURE__ */ new Set(), active = [];
100485
+ const visit = (value) => {
100486
+ const transform = pointerTransform(value);
100487
+ if (!transform) return;
100488
+ const names = [];
100489
+ if (transform.expression) names.push(...pointerExpression(transform.body).slots);
100490
+ else pointerTemplate(transform.body, (key3) => {
100491
+ names.push(key3);
100492
+ return "";
100493
+ });
100494
+ for (const name2 of names.filter(Boolean)) {
100495
+ if (!items.has(name2)) throw new Error(`Referenced Source attribute '${name2}' does not exist`);
100496
+ if (active.includes(name2)) throw new Error(`Cyclic attribute dependency: ${[...active, name2].join(" -> ")}`);
100497
+ if (seen.has(name2)) continue;
100498
+ active.push(name2);
100499
+ visit(items.get(name2));
100500
+ active.pop();
100501
+ seen.add(name2);
100502
+ }
100503
+ };
100504
+ visit(raw);
100505
+ return seen;
100506
+ }
100507
+
100303
100508
  // node_modules/decimal.js/decimal.mjs
100304
100509
  /*!
100305
100510
  * decimal.js v10.6.0
@@ -108838,160 +109043,6 @@ BagResolver.registerBagClass(Bag);
108838
109043
  registerType(Bag, "X", (bag) => bag._toTytxPayload(), (payload) => Bag._fromTytxPayload(payload));
108839
109044
  setSubtypeDict(Bag.tytxSuffix, { ...getSubtypeDict(Bag.tytxSuffix), Bag });
108840
109045
 
108841
- // node_modules/@genrojs/builders/src/pointers.js
108842
- function pointerTransform(value) {
108843
- if (typeof value !== "string" || !["^", "="].includes(value[0]) || value.startsWith("==")) return null;
108844
- const index = value.indexOf(":");
108845
- if (index < 0) return null;
108846
- const expression = value[index + 1] === "=";
108847
- return { pointer: value.slice(0, index), expression, body: value.slice(index + (expression ? 2 : 1)) };
108848
- }
108849
- var SLOT = /^\{(\??[A-Za-z_][A-Za-z0-9_]*|\?)?\}/;
108850
- function pointerTemplate(body, read) {
108851
- let result = "", blocked = false;
108852
- for (let i2 = 0; i2 < body.length; ) {
108853
- if (body[i2] !== "{" && body[i2] !== "}") {
108854
- result += body[i2++];
108855
- continue;
108856
- }
108857
- const match2 = body.slice(i2).match(SLOT);
108858
- if (!match2) throw new SyntaxError("Invalid pointer template placeholder");
108859
- const slot = match2[1] ?? "";
108860
- const optional = slot.startsWith("?");
108861
- const value = read(optional ? slot.slice(1) : slot);
108862
- if (value == null || value === "" && !optional) blocked = true;
108863
- else result += String(value);
108864
- i2 += match2[0].length;
108865
- }
108866
- return blocked ? null : result;
108867
- }
108868
- function pointerExpression(body) {
108869
- const slots = [], identifiers2 = /* @__PURE__ */ new Set();
108870
- let text4 = "", operand = true;
108871
- for (let i2 = 0; i2 < body.length; ) {
108872
- const start = i2, c = body[i2];
108873
- if (c === '"' || c === "'" || c === "`") {
108874
- i2++;
108875
- while (i2 < body.length) {
108876
- if (body[i2] === "\\") {
108877
- i2 += 2;
108878
- continue;
108879
- }
108880
- if (body[i2++] === c) break;
108881
- }
108882
- text4 += body.slice(start, i2);
108883
- operand = false;
108884
- continue;
108885
- }
108886
- if (body.startsWith("//", i2)) {
108887
- i2 = body.indexOf("\n", i2);
108888
- if (i2 < 0) i2 = body.length;
108889
- text4 += body.slice(start, i2);
108890
- continue;
108891
- }
108892
- if (body.startsWith("/*", i2)) {
108893
- const end = body.indexOf("*/", i2 + 2);
108894
- i2 = end < 0 ? body.length : end + 2;
108895
- text4 += body.slice(start, i2);
108896
- continue;
108897
- }
108898
- if (c === "/" && operand) {
108899
- let bracket2 = false;
108900
- i2++;
108901
- while (i2 < body.length) {
108902
- const current = body[i2++];
108903
- if (current === "\\") {
108904
- i2++;
108905
- continue;
108906
- }
108907
- if (current === "[") bracket2 = true;
108908
- else if (current === "]") bracket2 = false;
108909
- else if (current === "/" && !bracket2) break;
108910
- }
108911
- while (/[a-z]/i.test(body[i2] ?? "") && i2 < body.length) i2++;
108912
- text4 += body.slice(start, i2);
108913
- operand = false;
108914
- continue;
108915
- }
108916
- const slot = c === "{" ? body.slice(i2).match(SLOT) : null;
108917
- if (slot) {
108918
- const name2 = slot[1] ?? "";
108919
- if (name2.startsWith("?")) throw new SyntaxError("Optional slots are supported in pointer templates only");
108920
- text4 += `_pointerValues[${slots.length}]`;
108921
- slots.push(name2);
108922
- i2 += slot[0].length;
108923
- operand = false;
108924
- continue;
108925
- }
108926
- const word = body.slice(i2).match(/^[A-Za-z_$][\w$]*/);
108927
- if (word) {
108928
- identifiers2.add(word[0]);
108929
- text4 += word[0];
108930
- i2 += word[0].length;
108931
- operand = ["return", "typeof", "void", "delete", "new", "in", "instanceof", "yield", "await"].includes(word[0]);
108932
- continue;
108933
- }
108934
- text4 += c;
108935
- i2++;
108936
- if (!/\s/.test(c)) operand = /[([{,:;=!?&|+*%~<>\/-]/.test(c);
108937
- }
108938
- return { text: text4, slots, identifiers: identifiers2 };
108939
- }
108940
- function resolvePointerItems(items, current, evaluate = () => null) {
108941
- const values2 = /* @__PURE__ */ new Map(), active = [];
108942
- const resolve = (name2) => {
108943
- if (values2.has(name2)) return values2.get(name2);
108944
- if (!items.has(name2)) throw new Error(`Referenced Source attribute '${name2}' does not exist`);
108945
- if (active.includes(name2)) throw new Error(`Cyclic attribute dependency: ${[...active, name2].join(" -> ")}`);
108946
- active.push(name2);
108947
- try {
108948
- const raw = items.get(name2);
108949
- const transform = typeof name2 === "string" ? pointerTransform(raw) : null;
108950
- let result = current.get(name2);
108951
- if (transform) {
108952
- const read = (key3) => key3 ? resolve(key3) : current.get(name2);
108953
- if (transform.expression) {
108954
- const expression = pointerExpression(transform.body);
108955
- result = evaluate(name2, raw, expression, expression.slots.map(read));
108956
- } else {
108957
- result = pointerTemplate(transform.body, read);
108958
- if (current.get(name2) == null) result = null;
108959
- }
108960
- }
108961
- values2.set(name2, result);
108962
- return result;
108963
- } finally {
108964
- active.pop();
108965
- }
108966
- };
108967
- return new Map([...items.keys()].map((name2) => [name2, resolve(name2)]));
108968
- }
108969
- function pointerDependencies(node, raw) {
108970
- const items = new Map([...Object.entries(node.getAttr()), ...node.fixedAttrItems()]);
108971
- const seen = /* @__PURE__ */ new Set(), active = [];
108972
- const visit = (value) => {
108973
- const transform = pointerTransform(value);
108974
- if (!transform) return;
108975
- const names = [];
108976
- if (transform.expression) names.push(...pointerExpression(transform.body).slots);
108977
- else pointerTemplate(transform.body, (key3) => {
108978
- names.push(key3);
108979
- return "";
108980
- });
108981
- for (const name2 of names.filter(Boolean)) {
108982
- if (!items.has(name2)) throw new Error(`Referenced Source attribute '${name2}' does not exist`);
108983
- if (active.includes(name2)) throw new Error(`Cyclic attribute dependency: ${[...active, name2].join(" -> ")}`);
108984
- if (seen.has(name2)) continue;
108985
- active.push(name2);
108986
- visit(items.get(name2));
108987
- active.pop();
108988
- seen.add(name2);
108989
- }
108990
- };
108991
- visit(raw);
108992
- return seen;
108993
- }
108994
-
108995
109046
  // node_modules/@genrojs/builders/src/utils.js
108996
109047
  var PYTHON_KEYWORDS = /* @__PURE__ */ new Set([
108997
109048
  "False",
@@ -115799,7 +115850,7 @@ function validateInput(value, parameters2, context = {}) {
115799
115850
  if (output == null || output === true) return;
115800
115851
  if (typeof output !== "boolean" && typeof output !== "string" && (typeof output !== "object" || Array.isArray(output))) throw new TypeError("A validator returns true, false, null, an error code, or a result object/Bag.");
115801
115852
  const prefix = `validate_${rule}`;
115802
- const response = output instanceof Bag ? Object.fromEntries(output.getNodes().map((node) => [node.label, node.value])) : typeof output === "object" ? output : { errorcode: output === false ? "error" : output };
115853
+ const response = output instanceof Bag2 ? Object.fromEntries(output.getNodes().map((node) => [node.label, node.value])) : typeof output === "object" ? output : { errorcode: output === false ? "error" : output };
115803
115854
  if (Object.hasOwn(response, "value")) {
115804
115855
  result.modified ||= !Object.is(result.value, response.value);
115805
115856
  result.value = response.value;
@@ -23497,6 +23497,7 @@ var timeEditor = (Base) => class extends Base {
23497
23497
  };
23498
23498
 
23499
23499
  // src/components/validation.js
23500
+ import { Bag as Bag2 } from "@gramlot/gramlot";
23500
23501
  var validationRules = ["select", "notnull", "empty", "case", "len", "min", "max", "email", "regex", "call", "remote"];
23501
23502
  var deferredRules = ["nodup", "exist", "gridnodup"];
23502
23503
  var empty = (value) => value == null || value === "";
@@ -23518,7 +23519,7 @@ function validateInput(value, parameters2, context = {}) {
23518
23519
  if (output == null || output === true) return;
23519
23520
  if (typeof output !== "boolean" && typeof output !== "string" && (typeof output !== "object" || Array.isArray(output))) throw new TypeError("A validator returns true, false, null, an error code, or a result object/Bag.");
23520
23521
  const prefix = `validate_${rule}`;
23521
- const response = output instanceof Bag ? Object.fromEntries(output.getNodes().map((node) => [node.label, node.value])) : typeof output === "object" ? output : { errorcode: output === false ? "error" : output };
23522
+ const response = output instanceof Bag2 ? Object.fromEntries(output.getNodes().map((node) => [node.label, node.value])) : typeof output === "object" ? output : { errorcode: output === false ? "error" : output };
23522
23523
  if (Object.hasOwn(response, "value")) {
23523
23524
  result.modified ||= !Object.is(result.value, response.value);
23524
23525
  result.value = response.value;
@@ -23852,6 +23853,7 @@ function FieldState(Base) {
23852
23853
  FieldState.parameters = validationParameters;
23853
23854
 
23854
23855
  // src/components/choice-editor.js
23856
+ import { Bag as Bag3 } from "@gramlot/gramlot";
23855
23857
  function ChoiceEditor(HTMLElement) {
23856
23858
  return class extends NativeControl(HTMLElement) {
23857
23859
  #value;
@@ -24124,7 +24126,7 @@ function localChoices(Base) {
24124
24126
  loadChoices(keywords) {
24125
24127
  let rows;
24126
24128
  if (this.parameters.store != null) {
24127
- if (!(this.parameters.store instanceof Bag)) throw new TypeError("store must be a Bag");
24129
+ if (!(this.parameters.store instanceof Bag3)) throw new TypeError("store must be a Bag");
24128
24130
  if (this.parameters.values) throw new TypeError("store and values are mutually exclusive");
24129
24131
  const ids = /* @__PURE__ */ new Set();
24130
24132
  rows = this.parameters.store.getNodes().map((node) => {