@appilots/sdk 0.4.1 → 0.6.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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkJ75B2HWG_js = require('./chunk-J75B2HWG.js');
3
+ var chunkDZ7QRFHD_js = require('./chunk-DZ7QRFHD.js');
4
4
  var react = require('react');
5
5
  var reactNative = require('react-native');
6
6
 
@@ -495,7 +495,7 @@ function walkSubtree(root, detectLists, startInModal = false) {
495
495
  }
496
496
  function walkFiber(root) {
497
497
  const snapshot = {
498
- route: chunkJ75B2HWG_js.getCurrentScreen(),
498
+ route: chunkDZ7QRFHD_js.getCurrentScreen(),
499
499
  texts: [],
500
500
  inputs: [],
501
501
  buttons: [],
@@ -671,9 +671,9 @@ function fiberSliderMatches(fiber, registryId, registryLabel) {
671
671
  function reconcileSliders(snapshot) {
672
672
  const fiberSliders = snapshot.sliders;
673
673
  const out = [];
674
- for (const { id, kind } of chunkJ75B2HWG_js.componentRegistry.snapshot()) {
674
+ for (const { id, kind } of chunkDZ7QRFHD_js.componentRegistry.snapshot()) {
675
675
  if (kind !== "slider") continue;
676
- const entry = chunkJ75B2HWG_js.componentRegistry.getSlider(id);
676
+ const entry = chunkDZ7QRFHD_js.componentRegistry.getSlider(id);
677
677
  if (!entry) continue;
678
678
  const fiber = fiberSliders.find((s) => fiberSliderMatches(s, id, entry.label));
679
679
  const visible = !!fiber || typeof entry.screen === "string" && entry.screen === snapshot.route;
@@ -697,7 +697,7 @@ function reconcileSliders(snapshot) {
697
697
  snapshot.sliders = out;
698
698
  }
699
699
  function mergeRegisteredLists(snapshot) {
700
- const registered = chunkJ75B2HWG_js.listRegistry.snapshot();
700
+ const registered = chunkDZ7QRFHD_js.listRegistry.snapshot();
701
701
  if (registered.length === 0) return;
702
702
  const byId = /* @__PURE__ */ new Map();
703
703
  for (const list of snapshot.lists) {
@@ -745,13 +745,14 @@ function mergeRegisteredLists(snapshot) {
745
745
  }
746
746
  }
747
747
  function captureSnapshot() {
748
- const root = chunkJ75B2HWG_js.getFiberRoot();
748
+ const root = chunkDZ7QRFHD_js.getFiberRoot();
749
749
  if (!root) {
750
750
  console.warn(
751
751
  "[Appilots] captureSnapshot: fiber root not captured yet. Ensure <AppilotsProvider> has rendered before calling this."
752
752
  );
753
+ chunkDZ7QRFHD_js.recordIntrospectionFailure("never-mounted", null);
753
754
  return {
754
- route: chunkJ75B2HWG_js.getCurrentScreen(),
755
+ route: chunkDZ7QRFHD_js.getCurrentScreen(),
755
756
  texts: [],
756
757
  inputs: [],
757
758
  buttons: [],
@@ -766,17 +767,17 @@ function captureSnapshot() {
766
767
  }
767
768
  const start = Date.now();
768
769
  const snapshot = walkFiber(root);
769
- const activePath = chunkJ75B2HWG_js.getActiveRouteNames();
770
+ const activePath = chunkDZ7QRFHD_js.getActiveRouteNames();
770
771
  const deepestRoute = activePath[activePath.length - 1];
771
772
  if (deepestRoute) snapshot.route = deepestRoute;
772
773
  mergeRegisteredLists(snapshot);
773
774
  reconcileSliders(snapshot);
774
- snapshot.elements = chunkJ75B2HWG_js.deriveInteractionElements(snapshot);
775
- snapshot.choiceGroups = chunkJ75B2HWG_js.attachElementIdsToChoiceGroups(
775
+ snapshot.elements = chunkDZ7QRFHD_js.deriveInteractionElements(snapshot);
776
+ snapshot.choiceGroups = chunkDZ7QRFHD_js.attachElementIdsToChoiceGroups(
776
777
  snapshot.choiceGroups,
777
778
  snapshot.elements
778
779
  );
779
- chunkJ75B2HWG_js.elementRegistry.replaceAll(snapshot.elements);
780
+ chunkDZ7QRFHD_js.elementRegistry.replaceAll(snapshot.elements);
780
781
  const elapsed = Date.now() - start;
781
782
  const totalListItems = snapshot.lists.reduce(
782
783
  (acc, l) => acc + l.items.length,
@@ -969,7 +970,7 @@ function wrapTouchable(fiber, label) {
969
970
  };
970
971
  }
971
972
  function findInteractiveByIdentifier(query, options = {}) {
972
- const root = chunkJ75B2HWG_js.getFiberRoot();
973
+ const root = chunkDZ7QRFHD_js.getFiberRoot();
973
974
  if (!root) {
974
975
  console.warn("[Appilots] findInteractiveByIdentifier: fiber root not captured yet");
975
976
  return null;
@@ -1210,7 +1211,7 @@ function isPressableFiber(fiber) {
1210
1211
  return TOUCHABLE_NAMES.has(typeName) || hasPressHandler3(fiber);
1211
1212
  }
1212
1213
  function findListContainers(options = {}) {
1213
- const root = chunkJ75B2HWG_js.getFiberRoot();
1214
+ const root = chunkDZ7QRFHD_js.getFiberRoot();
1214
1215
  if (!root) return [];
1215
1216
  const containers = [];
1216
1217
  const visited = /* @__PURE__ */ new WeakSet();
@@ -1369,7 +1370,7 @@ function describeTouchable(fiber) {
1369
1370
  }
1370
1371
  function touchableLooksDestructive(fiber) {
1371
1372
  const descriptor = describeTouchable(fiber);
1372
- if (descriptor && chunkJ75B2HWG_js.looksDestructiveActionLabel(descriptor)) return true;
1373
+ if (descriptor && chunkDZ7QRFHD_js.looksDestructiveActionLabel(descriptor)) return true;
1373
1374
  const props = fiber?.memoizedProps ?? {};
1374
1375
  const haystack = [
1375
1376
  props.testID,
@@ -1377,7 +1378,7 @@ function touchableLooksDestructive(fiber) {
1377
1378
  props.accessibilityHint,
1378
1379
  props.label
1379
1380
  ].filter((value) => typeof value === "string").join(" ");
1380
- return chunkJ75B2HWG_js.looksDestructiveActionLabel(haystack);
1381
+ return chunkDZ7QRFHD_js.looksDestructiveActionLabel(haystack);
1381
1382
  }
1382
1383
  function describeItemCandidate(listIndex, zeroBasedIndex, item) {
1383
1384
  const syntheticId = `list-${listIndex}-item-${zeroBasedIndex + 1}`;
@@ -1508,7 +1509,7 @@ function candidateLists(containers, locator) {
1508
1509
  return containers.map((list, listIndex) => ({ list, listIndex }));
1509
1510
  }
1510
1511
  function pressListItemAtOrdinal(listIndex, itemIndex) {
1511
- if (!chunkJ75B2HWG_js.getFiberRoot()) return { ok: false, reason: "no-fiber-root" };
1512
+ if (!chunkDZ7QRFHD_js.getFiberRoot()) return { ok: false, reason: "no-fiber-root" };
1512
1513
  const containers = findListContainers({ allowSingleHeuristic: true });
1513
1514
  if (listIndex < 0 || listIndex >= containers.length) {
1514
1515
  return { ok: false, reason: "list-not-found" };
@@ -1522,7 +1523,7 @@ function pressListItemAtOrdinal(listIndex, itemIndex) {
1522
1523
  return pressResolvedListItem(list, items[zeroBased], listIndex, itemIndex);
1523
1524
  }
1524
1525
  function pressListItemByIdentity(locator) {
1525
- if (!chunkJ75B2HWG_js.getFiberRoot()) return { ok: false, reason: "no-fiber-root" };
1526
+ if (!chunkDZ7QRFHD_js.getFiberRoot()) return { ok: false, reason: "no-fiber-root" };
1526
1527
  const parsed = locator.syntheticId ? parseSyntheticListItemId(locator.syntheticId) : null;
1527
1528
  const effective = parsed ? { ...locator, listIndex: parsed.listIndex, itemIndex: parsed.itemIndex } : locator;
1528
1529
  const containers = findListContainers({ allowSingleHeuristic: true });
@@ -1562,7 +1563,7 @@ function screenDiagnose(targetId, category = "component-not-found") {
1562
1563
  return {
1563
1564
  category,
1564
1565
  targetId,
1565
- screen: chunkJ75B2HWG_js.getCurrentScreen() ?? void 0
1566
+ screen: chunkDZ7QRFHD_js.getCurrentScreen() ?? void 0
1566
1567
  };
1567
1568
  }
1568
1569
  function isPressLike(action) {
@@ -1579,10 +1580,10 @@ function elementLookupKey(value) {
1579
1580
  return canonicalElementId(value).toLowerCase().replace(/[\s_]+/g, "-");
1580
1581
  }
1581
1582
  function findRegisteredElement(elementId) {
1582
- const direct = chunkJ75B2HWG_js.elementRegistry.get(elementId) ?? chunkJ75B2HWG_js.elementRegistry.get(canonicalElementId(elementId));
1583
+ const direct = chunkDZ7QRFHD_js.elementRegistry.get(elementId) ?? chunkDZ7QRFHD_js.elementRegistry.get(canonicalElementId(elementId));
1583
1584
  if (direct) return direct;
1584
1585
  const wanted = elementLookupKey(elementId);
1585
- return chunkJ75B2HWG_js.elementRegistry.snapshot().find((element) => elementLookupKey(element.id) === wanted);
1586
+ return chunkDZ7QRFHD_js.elementRegistry.snapshot().find((element) => elementLookupKey(element.id) === wanted);
1586
1587
  }
1587
1588
  function resolveInteractionElement(elementId) {
1588
1589
  return getLatestElement(elementId);
@@ -1802,7 +1803,7 @@ function dispatchElement(element, registry, action) {
1802
1803
  }
1803
1804
  function dispatchStructuredElementId(identifier, action) {
1804
1805
  if (!isElementIdentifier(identifier) || !isPressLike(action)) return null;
1805
- const parsed = chunkJ75B2HWG_js.parseStableElementId(identifier);
1806
+ const parsed = chunkDZ7QRFHD_js.parseStableElementId(identifier);
1806
1807
  if (!parsed || parsed.role !== "option") return null;
1807
1808
  if (!parsed.itemKey && !parsed.listId) return null;
1808
1809
  const pressed = pressListItemByIdentity({
@@ -1842,20 +1843,20 @@ function normalize4(value) {
1842
1843
  return value.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]/g, "");
1843
1844
  }
1844
1845
  function resolveScreenForFormFields() {
1845
- const activePath = chunkJ75B2HWG_js.getActiveRouteNames();
1846
+ const activePath = chunkDZ7QRFHD_js.getActiveRouteNames();
1846
1847
  for (let i = activePath.length - 1; i >= 0; i--) {
1847
1848
  const name = activePath[i];
1848
- const meta = name ? chunkJ75B2HWG_js.getScreenMetadata(name) : void 0;
1849
+ const meta = name ? chunkDZ7QRFHD_js.getScreenMetadata(name) : void 0;
1849
1850
  if (name && Array.isArray(meta?.fields) && meta.fields.length > 0) return name;
1850
1851
  }
1851
- return chunkJ75B2HWG_js.getCurrentScreen();
1852
+ return chunkDZ7QRFHD_js.getCurrentScreen();
1852
1853
  }
1853
1854
  function collectKnownFormFields(registry) {
1854
1855
  const registryFields = registry.snapshot().filter((entry) => entry.kind === "field" || entry.kind === "slider").map((entry) => ({ id: entry.id, label: entry.label }));
1855
1856
  if (registryFields.length >= 2) return registryFields;
1856
1857
  const screen = resolveScreenForFormFields();
1857
1858
  if (screen) {
1858
- const metaFields = chunkJ75B2HWG_js.getScreenMetadata(screen)?.fields;
1859
+ const metaFields = chunkDZ7QRFHD_js.getScreenMetadata(screen)?.fields;
1859
1860
  if (Array.isArray(metaFields) && metaFields.length > 0) {
1860
1861
  return metaFields.filter((field) => !!field && typeof field.id === "string").map((field) => ({
1861
1862
  id: field.id,
@@ -1865,7 +1866,7 @@ function collectKnownFormFields(registry) {
1865
1866
  }));
1866
1867
  }
1867
1868
  }
1868
- for (const meta of chunkJ75B2HWG_js.getAllScreens()) {
1869
+ for (const meta of chunkDZ7QRFHD_js.getAllScreens()) {
1869
1870
  if (Array.isArray(meta.fields) && meta.fields.length > 0) {
1870
1871
  return meta.fields.filter((field) => !!field && typeof field.id === "string").map((field) => ({
1871
1872
  id: field.id,
@@ -1963,7 +1964,7 @@ function rewriteMisplacedFormFillFields(fields, registry) {
1963
1964
  const inferred = inferFieldIdForValue(String(field.value ?? ""), knownFields, used);
1964
1965
  if (!inferred) return field;
1965
1966
  used.add(inferred);
1966
- chunkJ75B2HWG_js.appilotsDebugWarn(
1967
+ chunkDZ7QRFHD_js.appilotsDebugWarn(
1967
1968
  `formFieldRewrite: ${field.fieldId} \u2192 ${inferred} (value=${JSON.stringify(field.value)})`
1968
1969
  );
1969
1970
  return { ...field, fieldId: inferred };
@@ -2001,7 +2002,7 @@ function readVisibleFormSuccess(snap) {
2001
2002
  return (snap.texts ?? []).find((text) => text?.trim() && FORM_SUCCESS_TEXT_RE.test(text));
2002
2003
  }
2003
2004
  function submitAsyncStillPending(submitTargetId) {
2004
- const probe = chunkJ75B2HWG_js.probeLoadingState(submitTargetId ?? null, chunkJ75B2HWG_js.getCurrentScreen());
2005
+ const probe = chunkDZ7QRFHD_js.probeLoadingState(submitTargetId ?? null, chunkDZ7QRFHD_js.getCurrentScreen());
2005
2006
  if (probe.loading) return true;
2006
2007
  if (submitTargetId && probe.pressedFound && probe.pressedDisabled) return true;
2007
2008
  return false;
@@ -2013,7 +2014,7 @@ function evaluatePostSubmitSnapshot(snap, activePath) {
2013
2014
  }
2014
2015
  const successText = readVisibleFormSuccess(snap);
2015
2016
  if (successText) return { status: "success", message: successText };
2016
- if (!chunkJ75B2HWG_js.snapshotShowsOpenCreateForm(snap, activePath)) {
2017
+ if (!chunkDZ7QRFHD_js.snapshotShowsOpenCreateForm(snap, activePath)) {
2017
2018
  return { status: "success" };
2018
2019
  }
2019
2020
  return void 0;
@@ -2029,7 +2030,7 @@ async function waitForPostSubmitOutcome(options) {
2029
2030
  continue;
2030
2031
  }
2031
2032
  const snap2 = captureSnapshot();
2032
- const activePath2 = chunkJ75B2HWG_js.getActiveRouteNames();
2033
+ const activePath2 = chunkDZ7QRFHD_js.getActiveRouteNames();
2033
2034
  const outcome2 = evaluatePostSubmitSnapshot(snap2, activePath2);
2034
2035
  if (outcome2) return outcome2;
2035
2036
  await sleep(pollMs);
@@ -2041,7 +2042,7 @@ async function waitForPostSubmitOutcome(options) {
2041
2042
  };
2042
2043
  }
2043
2044
  const snap = captureSnapshot();
2044
- const activePath = chunkJ75B2HWG_js.getActiveRouteNames();
2045
+ const activePath = chunkDZ7QRFHD_js.getActiveRouteNames();
2045
2046
  const outcome = evaluatePostSubmitSnapshot(snap, activePath);
2046
2047
  if (outcome) return outcome;
2047
2048
  return {
@@ -2147,16 +2148,16 @@ function findSnapshotButton(targetId) {
2147
2148
  }
2148
2149
  }
2149
2150
  function buildUiDiagnose(targetId, cause) {
2150
- const activePath = chunkJ75B2HWG_js.getActiveRouteNames();
2151
- const screen = activePath[activePath.length - 1] ?? chunkJ75B2HWG_js.getCurrentScreen() ?? void 0;
2151
+ const activePath = chunkDZ7QRFHD_js.getActiveRouteNames();
2152
+ const screen = activePath[activePath.length - 1] ?? chunkDZ7QRFHD_js.getCurrentScreen() ?? void 0;
2152
2153
  const screenPath = activePath.length > 1 ? activePath.join("/") : screen;
2153
2154
  const diagnose = {
2154
2155
  category: cause === "not-found" ? "component-not-found" : cause === "disabled" ? "disabled" : "unknown",
2155
2156
  targetId,
2156
2157
  screen: screenPath
2157
2158
  };
2158
- if (chunkJ75B2HWG_js.isOptionalStepAutomationFailure(targetId, screenPath, activePath)) {
2159
- diagnose.visibleMessage = chunkJ75B2HWG_js.OPTIONAL_STEP_AUTOMATION_HINT;
2159
+ if (chunkDZ7QRFHD_js.isOptionalStepAutomationFailure(targetId, screenPath, activePath)) {
2160
+ diagnose.visibleMessage = chunkDZ7QRFHD_js.OPTIONAL_STEP_AUTOMATION_HINT;
2160
2161
  diagnose.recoverable = true;
2161
2162
  }
2162
2163
  return diagnose;
@@ -2218,9 +2219,9 @@ function resolveComponentId(componentId, registry, action) {
2218
2219
  return comp.id;
2219
2220
  }
2220
2221
  }
2221
- const currentScreen = chunkJ75B2HWG_js.getCurrentScreen();
2222
+ const currentScreen = chunkDZ7QRFHD_js.getCurrentScreen();
2222
2223
  if (currentScreen) {
2223
- const screenMeta = chunkJ75B2HWG_js.getScreenMetadata(currentScreen);
2224
+ const screenMeta = chunkDZ7QRFHD_js.getScreenMetadata(currentScreen);
2224
2225
  const actions = screenMeta?.actions;
2225
2226
  if (actions && Array.isArray(actions)) {
2226
2227
  const metaAction = actions.find(
@@ -2374,7 +2375,7 @@ function checkModalOcclusion(rawComponentId, action) {
2374
2375
  return null;
2375
2376
  }
2376
2377
  if (typeof rawComponentId !== "string" || rawComponentId.trim().length === 0) return null;
2377
- const fiberRoot = chunkJ75B2HWG_js.getFiberRoot();
2378
+ const fiberRoot = chunkDZ7QRFHD_js.getFiberRoot();
2378
2379
  if (!fiberRoot) return null;
2379
2380
  let snap;
2380
2381
  try {
@@ -2437,7 +2438,7 @@ function checkModalOcclusion(rawComponentId, action) {
2437
2438
  }
2438
2439
  function uiInteractionHandler(payload, context) {
2439
2440
  const { permissions } = context;
2440
- const registry = context.registry ?? chunkJ75B2HWG_js.componentRegistry;
2441
+ const registry = context.registry ?? chunkDZ7QRFHD_js.componentRegistry;
2441
2442
  if (!permissions.canInteractUI) {
2442
2443
  return {
2443
2444
  success: false,
@@ -2496,7 +2497,7 @@ function uiInteractionHandler(payload, context) {
2496
2497
  );
2497
2498
  return { success: true };
2498
2499
  }
2499
- const screen = chunkJ75B2HWG_js.getCurrentScreen() ?? void 0;
2500
+ const screen = chunkDZ7QRFHD_js.getCurrentScreen() ?? void 0;
2500
2501
  if (result.reason === "list-not-found" || result.reason === "item-not-found") {
2501
2502
  return {
2502
2503
  success: false,
@@ -2661,7 +2662,7 @@ function submitLabelHintsSubmit(label) {
2661
2662
  return SUBMIT_LABEL_HINT_RE.test(trimmed);
2662
2663
  }
2663
2664
  function screenDeclaresSubmitAction(screenName) {
2664
- const meta = chunkJ75B2HWG_js.getScreenMetadata(screenName);
2665
+ const meta = chunkDZ7QRFHD_js.getScreenMetadata(screenName);
2665
2666
  return Array.isArray(meta?.actions) && meta.actions.some(
2666
2667
  (action) => typeof action === "object" && action !== null && action.type === "submit"
2667
2668
  );
@@ -2694,7 +2695,7 @@ function resolveFormScreensForSubmit(screen, activePath, registry) {
2694
2695
  } else {
2695
2696
  push(screen);
2696
2697
  }
2697
- push(chunkJ75B2HWG_js.getCurrentScreen() ?? void 0);
2698
+ push(chunkDZ7QRFHD_js.getCurrentScreen() ?? void 0);
2698
2699
  const withSubmit = [];
2699
2700
  const rest = [];
2700
2701
  for (const name of ordered) {
@@ -2712,7 +2713,7 @@ function collectSubmitTargetCandidates(screens, registry) {
2712
2713
  candidates.push(id);
2713
2714
  };
2714
2715
  for (const screenName of screens) {
2715
- const meta = chunkJ75B2HWG_js.getScreenMetadata(screenName);
2716
+ const meta = chunkDZ7QRFHD_js.getScreenMetadata(screenName);
2716
2717
  const submitMeta = Array.isArray(meta?.actions) ? meta.actions.find(
2717
2718
  (action) => typeof action === "object" && action !== null && action.type === "submit"
2718
2719
  ) : void 0;
@@ -2758,8 +2759,8 @@ function readVisibleValidation(fieldId, label) {
2758
2759
  return void 0;
2759
2760
  }
2760
2761
  function resolveScreenContext() {
2761
- const activePath = chunkJ75B2HWG_js.getActiveRouteNames();
2762
- const screen = activePath[activePath.length - 1] ?? chunkJ75B2HWG_js.getCurrentScreen() ?? void 0;
2762
+ const activePath = chunkDZ7QRFHD_js.getActiveRouteNames();
2763
+ const screen = activePath[activePath.length - 1] ?? chunkDZ7QRFHD_js.getCurrentScreen() ?? void 0;
2763
2764
  return { screen, activePath };
2764
2765
  }
2765
2766
  function selectValueApplied(fieldId, requestedValue, currentValue, registry) {
@@ -2767,36 +2768,36 @@ function selectValueApplied(fieldId, requestedValue, currentValue, registry) {
2767
2768
  if (!requested) return false;
2768
2769
  const meta = getMetadataField(fieldId, registry);
2769
2770
  const options = Array.isArray(meta?.options) ? meta.options : [];
2770
- const requestedNorm = chunkJ75B2HWG_js.normalize3(requested);
2771
- const currentNorm = chunkJ75B2HWG_js.normalize3(currentValue);
2771
+ const requestedNorm = chunkDZ7QRFHD_js.normalize3(requested);
2772
+ const currentNorm = chunkDZ7QRFHD_js.normalize3(currentValue);
2772
2773
  if (currentNorm === requestedNorm) return true;
2773
2774
  for (const option of options) {
2774
2775
  const value = typeof option?.value === "string" ? option.value : "";
2775
2776
  const label = typeof option?.label === "string" ? option.label : "";
2776
- if (chunkJ75B2HWG_js.normalize3(value) === requestedNorm && chunkJ75B2HWG_js.normalize3(label) === currentNorm) return true;
2777
- if (chunkJ75B2HWG_js.normalize3(label) === requestedNorm && chunkJ75B2HWG_js.normalize3(label) === currentNorm) return true;
2778
- if (chunkJ75B2HWG_js.normalize3(value) === requestedNorm && chunkJ75B2HWG_js.normalize3(value) === currentNorm) return true;
2777
+ if (chunkDZ7QRFHD_js.normalize3(value) === requestedNorm && chunkDZ7QRFHD_js.normalize3(label) === currentNorm) return true;
2778
+ if (chunkDZ7QRFHD_js.normalize3(label) === requestedNorm && chunkDZ7QRFHD_js.normalize3(label) === currentNorm) return true;
2779
+ if (chunkDZ7QRFHD_js.normalize3(value) === requestedNorm && chunkDZ7QRFHD_js.normalize3(value) === currentNorm) return true;
2779
2780
  }
2780
2781
  return false;
2781
2782
  }
2782
2783
  function getMetadataField(fieldId, registry) {
2783
2784
  const screens = /* @__PURE__ */ new Set();
2784
- for (const name of chunkJ75B2HWG_js.getActiveRouteNames()) screens.add(name);
2785
- const current = chunkJ75B2HWG_js.getCurrentScreen();
2785
+ for (const name of chunkDZ7QRFHD_js.getActiveRouteNames()) screens.add(name);
2786
+ const current = chunkDZ7QRFHD_js.getCurrentScreen();
2786
2787
  if (current) screens.add(current);
2787
2788
  if (registry) {
2788
2789
  for (const comp of registry.snapshot()) {
2789
2790
  if (comp.kind === "field" && comp.screen) screens.add(comp.screen);
2790
2791
  }
2791
2792
  }
2792
- const needle = chunkJ75B2HWG_js.normalize3(fieldId);
2793
+ const needle = chunkDZ7QRFHD_js.normalize3(fieldId);
2793
2794
  for (const screenName of screens) {
2794
- const screenMeta = chunkJ75B2HWG_js.getScreenMetadata(screenName);
2795
+ const screenMeta = chunkDZ7QRFHD_js.getScreenMetadata(screenName);
2795
2796
  const fields = Array.isArray(screenMeta?.fields) ? screenMeta.fields : [];
2796
2797
  const match = fields.find((field) => {
2797
2798
  if (!field || typeof field !== "object") return false;
2798
- const id = typeof field.id === "string" ? chunkJ75B2HWG_js.normalize3(field.id) : "";
2799
- const label = typeof field.label === "string" ? chunkJ75B2HWG_js.normalize3(field.label) : "";
2799
+ const id = typeof field.id === "string" ? chunkDZ7QRFHD_js.normalize3(field.id) : "";
2800
+ const label = typeof field.label === "string" ? chunkDZ7QRFHD_js.normalize3(field.label) : "";
2800
2801
  return id === needle || label === needle;
2801
2802
  });
2802
2803
  if (match) return match;
@@ -2808,11 +2809,11 @@ function resolveSelectOption(fieldId, value, registry) {
2808
2809
  if (!requested) return void 0;
2809
2810
  const meta = getMetadataField(fieldId, registry);
2810
2811
  const options = Array.isArray(meta?.options) ? meta.options : [];
2811
- const requestedNorm = chunkJ75B2HWG_js.normalize3(requested);
2812
+ const requestedNorm = chunkDZ7QRFHD_js.normalize3(requested);
2812
2813
  for (const option of options) {
2813
2814
  const optionValue = typeof option?.value === "string" ? option.value : "";
2814
2815
  const optionLabel = typeof option?.label === "string" ? option.label : "";
2815
- if (chunkJ75B2HWG_js.normalize3(optionValue) === requestedNorm || chunkJ75B2HWG_js.normalize3(optionLabel) === requestedNorm) {
2816
+ if (chunkDZ7QRFHD_js.normalize3(optionValue) === requestedNorm || chunkDZ7QRFHD_js.normalize3(optionLabel) === requestedNorm) {
2816
2817
  return { value: optionValue, label: optionLabel };
2817
2818
  }
2818
2819
  }
@@ -2862,12 +2863,12 @@ async function tryPressSelectOption(fieldId, value, registry, options = {}) {
2862
2863
  return {
2863
2864
  success: false,
2864
2865
  error: `No pressable option found for select field "${fieldId}"`,
2865
- diagnose: { category: "component-not-found", fieldId, screen: chunkJ75B2HWG_js.getCurrentScreen() ?? void 0 }
2866
+ diagnose: { category: "component-not-found", fieldId, screen: chunkDZ7QRFHD_js.getCurrentScreen() ?? void 0 }
2866
2867
  };
2867
2868
  }
2868
2869
  function normalizeFieldType(type) {
2869
2870
  if (typeof type !== "string") return void 0;
2870
- const normalized = chunkJ75B2HWG_js.normalize3(type);
2871
+ const normalized = chunkDZ7QRFHD_js.normalize3(type);
2871
2872
  if (normalized === "select" || normalized === "picker" || normalized === "dropdown") return "select";
2872
2873
  if (normalized === "toggle" || normalized === "switch" || normalized === "checkbox") return "toggle";
2873
2874
  if (normalized === "date") return "date";
@@ -2895,7 +2896,7 @@ function fieldCueTerms(fieldId, label) {
2895
2896
  );
2896
2897
  const terms = /* @__PURE__ */ new Set();
2897
2898
  for (const value of raw) {
2898
- const normalized = chunkJ75B2HWG_js.normalize3(value);
2899
+ const normalized = chunkDZ7QRFHD_js.normalize3(value);
2899
2900
  if (normalized.length >= 3 && normalized !== "id") terms.add(normalized);
2900
2901
  }
2901
2902
  return [...terms];
@@ -2906,17 +2907,17 @@ function snapshotHasFieldCue(snap, fieldId, label) {
2906
2907
  const visible = [
2907
2908
  ...snap.texts ?? [],
2908
2909
  ...(snap.buttons ?? []).map((b) => b.label ?? b.id ?? "")
2909
- ].map((text) => chunkJ75B2HWG_js.normalize3(text)).filter(Boolean);
2910
+ ].map((text) => chunkDZ7QRFHD_js.normalize3(text)).filter(Boolean);
2910
2911
  return visible.some((text) => terms.some((term) => text.includes(term) || term.includes(text)));
2911
2912
  }
2912
2913
  function scoreCandidateText(value, texts) {
2913
- const valueNorm = chunkJ75B2HWG_js.normalize3(String(value ?? ""));
2914
+ const valueNorm = chunkDZ7QRFHD_js.normalize3(String(value ?? ""));
2914
2915
  if (!valueNorm) return 0;
2915
2916
  let best = 0;
2916
2917
  for (const text of texts) {
2917
- const textNorm = chunkJ75B2HWG_js.normalize3(text);
2918
+ const textNorm = chunkDZ7QRFHD_js.normalize3(text);
2918
2919
  if (!textNorm) continue;
2919
- best = Math.max(best, chunkJ75B2HWG_js.matchScore(valueNorm, textNorm));
2920
+ best = Math.max(best, chunkDZ7QRFHD_js.matchScore(valueNorm, textNorm));
2920
2921
  }
2921
2922
  return best;
2922
2923
  }
@@ -2930,7 +2931,7 @@ function optionTexts(option) {
2930
2931
  function buildChoiceCandidates(snap, fieldId, value, allowFirstVisibleWhenNoCue, registry) {
2931
2932
  const fieldLabel = getFieldLabel(fieldId, registry);
2932
2933
  const fieldCueVisible = snapshotHasFieldCue(snap, fieldId, fieldLabel);
2933
- const genericValue = chunkJ75B2HWG_js.isGenericSelectValue(value);
2934
+ const genericValue = chunkDZ7QRFHD_js.isGenericSelectValue(value);
2934
2935
  const candidates = [];
2935
2936
  let order = 0;
2936
2937
  const choiceGroups = snap.choiceGroups ?? [];
@@ -2942,7 +2943,7 @@ function buildChoiceCandidates(snap, fieldId, value, allowFirstVisibleWhenNoCue,
2942
2943
  const groupCueScore = Math.max(
2943
2944
  globalCueScore,
2944
2945
  ...groupTexts.map((text) => {
2945
- const normalized = chunkJ75B2HWG_js.normalize3(text);
2946
+ const normalized = chunkDZ7QRFHD_js.normalize3(text);
2946
2947
  return fieldCueTerms(fieldId, fieldLabel).some(
2947
2948
  (term) => normalized.includes(term) || term.includes(normalized)
2948
2949
  ) ? 80 : 0;
@@ -2979,7 +2980,7 @@ function buildChoiceCandidates(snap, fieldId, value, allowFirstVisibleWhenNoCue,
2979
2980
  const elementCueScore = Math.max(
2980
2981
  fieldCueVisible && elements.length <= 12 ? 50 : 0,
2981
2982
  ...cueTexts.map((text) => {
2982
- const normalized = chunkJ75B2HWG_js.normalize3(text);
2983
+ const normalized = chunkDZ7QRFHD_js.normalize3(text);
2983
2984
  return fieldTerms.some(
2984
2985
  (term) => normalized.includes(term) || term.includes(normalized)
2985
2986
  ) ? 80 : 0;
@@ -3039,7 +3040,7 @@ async function selectVisibleChoiceAsync(fieldId, value, registry, options) {
3039
3040
  return {
3040
3041
  success: false,
3041
3042
  error: err?.message ?? "Could not capture visible choices",
3042
- diagnose: { category: "unknown", fieldId, screen: chunkJ75B2HWG_js.getCurrentScreen() ?? void 0 }
3043
+ diagnose: { category: "unknown", fieldId, screen: chunkDZ7QRFHD_js.getCurrentScreen() ?? void 0 }
3043
3044
  };
3044
3045
  }
3045
3046
  const candidates = buildChoiceCandidates(
@@ -3054,7 +3055,7 @@ async function selectVisibleChoiceAsync(fieldId, value, registry, options) {
3054
3055
  return {
3055
3056
  success: false,
3056
3057
  error: `No visible option found for select field "${fieldId}"`,
3057
- diagnose: { category: "component-not-found", fieldId, screen: chunkJ75B2HWG_js.getCurrentScreen() ?? void 0 }
3058
+ diagnose: { category: "component-not-found", fieldId, screen: chunkDZ7QRFHD_js.getCurrentScreen() ?? void 0 }
3058
3059
  };
3059
3060
  }
3060
3061
  const pressed = pressTargetByIdOrLabel(candidate.targetId, registry);
@@ -3067,7 +3068,7 @@ async function selectVisibleChoiceAsync(fieldId, value, registry, options) {
3067
3068
  }
3068
3069
  function isContinuationButton(label) {
3069
3070
  if (!label) return false;
3070
- return /^(next|continue|proximo|prox|continuar|avancar|avançar)$/i.test(chunkJ75B2HWG_js.normalize3(label));
3071
+ return /^(next|continue|proximo|prox|continuar|avancar|avançar)$/i.test(chunkDZ7QRFHD_js.normalize3(label));
3071
3072
  }
3072
3073
  function pressContinuationButton(registry) {
3073
3074
  const snap = captureSnapshot();
@@ -3080,7 +3081,7 @@ function pressContinuationButton(registry) {
3080
3081
  return {
3081
3082
  success: false,
3082
3083
  error: "No enabled continuation button is visible",
3083
- diagnose: { category: "component-not-found", screen: chunkJ75B2HWG_js.getCurrentScreen() ?? void 0 }
3084
+ diagnose: { category: "component-not-found", screen: chunkDZ7QRFHD_js.getCurrentScreen() ?? void 0 }
3084
3085
  };
3085
3086
  }
3086
3087
  return pressTargetByIdOrLabel(id, registry);
@@ -3100,18 +3101,18 @@ function findField(fieldId, registry) {
3100
3101
  return registry.getField(comp.id);
3101
3102
  }
3102
3103
  }
3103
- const currentScreenForTieBreak = chunkJ75B2HWG_js.getCurrentScreen();
3104
- const needle = chunkJ75B2HWG_js.normalize3(fieldId);
3104
+ const currentScreenForTieBreak = chunkDZ7QRFHD_js.getCurrentScreen();
3105
+ const needle = chunkDZ7QRFHD_js.normalize3(fieldId);
3105
3106
  let bestComp;
3106
3107
  let bestScore = 0;
3107
3108
  let bestOnCurrentScreen = false;
3108
3109
  for (const comp of snapshot) {
3109
3110
  if (comp.kind !== "field") continue;
3110
- const candidates = [chunkJ75B2HWG_js.normalize3(comp.id)];
3111
- if (comp.label) candidates.push(chunkJ75B2HWG_js.normalize3(comp.label));
3111
+ const candidates = [chunkDZ7QRFHD_js.normalize3(comp.id)];
3112
+ if (comp.label) candidates.push(chunkDZ7QRFHD_js.normalize3(comp.label));
3112
3113
  let candidateScore = 0;
3113
3114
  for (const cand of candidates) {
3114
- const s = chunkJ75B2HWG_js.matchScore(needle, cand);
3115
+ const s = chunkDZ7QRFHD_js.matchScore(needle, cand);
3115
3116
  if (s > candidateScore) candidateScore = s;
3116
3117
  }
3117
3118
  if (candidateScore === 0) continue;
@@ -3129,9 +3130,9 @@ function findField(fieldId, registry) {
3129
3130
  );
3130
3131
  return registry.getField(bestComp.id);
3131
3132
  }
3132
- const currentScreen = chunkJ75B2HWG_js.getCurrentScreen();
3133
+ const currentScreen = chunkDZ7QRFHD_js.getCurrentScreen();
3133
3134
  if (currentScreen) {
3134
- const screenMeta = chunkJ75B2HWG_js.getScreenMetadata(currentScreen);
3135
+ const screenMeta = chunkDZ7QRFHD_js.getScreenMetadata(currentScreen);
3135
3136
  const fields = screenMeta?.fields;
3136
3137
  if (fields && Array.isArray(fields)) {
3137
3138
  const metaField = fields.find(
@@ -3139,12 +3140,12 @@ function findField(fieldId, registry) {
3139
3140
  );
3140
3141
  if (metaField && typeof metaField === "object" && metaField.label) {
3141
3142
  const metaLabel = metaField.label;
3142
- const metaNeedle = chunkJ75B2HWG_js.normalize3(metaLabel);
3143
+ const metaNeedle = chunkDZ7QRFHD_js.normalize3(metaLabel);
3143
3144
  let mBest;
3144
3145
  let mBestScore = 0;
3145
3146
  for (const comp of snapshot) {
3146
3147
  if (comp.kind !== "field" || !comp.label) continue;
3147
- const score = chunkJ75B2HWG_js.matchScore(metaNeedle, chunkJ75B2HWG_js.normalize3(comp.label));
3148
+ const score = chunkDZ7QRFHD_js.matchScore(metaNeedle, chunkDZ7QRFHD_js.normalize3(comp.label));
3148
3149
  if (score > mBestScore) {
3149
3150
  mBestScore = score;
3150
3151
  mBest = comp;
@@ -3165,7 +3166,7 @@ function findField(fieldId, registry) {
3165
3166
  );
3166
3167
  return registry.getField(bestComp.id);
3167
3168
  }
3168
- chunkJ75B2HWG_js.appilotsDebugWarn(
3169
+ chunkDZ7QRFHD_js.appilotsDebugWarn(
3169
3170
  `findField: NOT FOUND \u2014 fieldId="${fieldId}" not in registry. Available fields: ${snapshot.filter((c) => c.kind === "field").map((c) => `"${c.id}" (label: ${c.label})`).join(", ") || "none"}`
3170
3171
  );
3171
3172
  return void 0;
@@ -3185,7 +3186,7 @@ function findToggle(fieldId, registry) {
3185
3186
  return registry.getToggle(comp.id);
3186
3187
  }
3187
3188
  }
3188
- chunkJ75B2HWG_js.appilotsDebugWarn(
3189
+ chunkDZ7QRFHD_js.appilotsDebugWarn(
3189
3190
  `findToggle: NOT FOUND \u2014 fieldId="${fieldId}" not in registry. Available toggles: ${snapshot.filter((c) => c.kind === "toggle").map((c) => `"${c.id}"`).join(", ") || "none"}`
3190
3191
  );
3191
3192
  return void 0;
@@ -3205,7 +3206,7 @@ function findSlider(fieldId, registry) {
3205
3206
  var sleep2 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
3206
3207
  async function formFillHandler(payload, context) {
3207
3208
  const { permissions } = context;
3208
- const registry = context.registry ?? chunkJ75B2HWG_js.componentRegistry;
3209
+ const registry = context.registry ?? chunkDZ7QRFHD_js.componentRegistry;
3209
3210
  const { screen, activePath } = resolveScreenContext();
3210
3211
  const screenPath = activePath.length > 1 ? activePath.join("/") : screen;
3211
3212
  if (!permissions.canFillForms) {
@@ -3224,7 +3225,7 @@ async function formFillHandler(payload, context) {
3224
3225
  }
3225
3226
  const registrySnapshot = registry.snapshot();
3226
3227
  if (registrySnapshot.length === 0) {
3227
- chunkJ75B2HWG_js.appilotsDebugWarn(
3228
+ chunkDZ7QRFHD_js.appilotsDebugWarn(
3228
3229
  "formFillHandler: registry is EMPTY \u2014 auto-tracking may not be active. Ensure enableAppilotsAutoTracking() runs before components mount."
3229
3230
  );
3230
3231
  } else {
@@ -3269,7 +3270,7 @@ async function formFillHandler(payload, context) {
3269
3270
  const fieldEntry = findField(fieldId, registry);
3270
3271
  if (fieldEntry) {
3271
3272
  try {
3272
- chunkJ75B2HWG_js.appilotsDebugLog(
3273
+ chunkDZ7QRFHD_js.appilotsDebugLog(
3273
3274
  `formFillHandler: found field "${fieldId}" via registry, calling setValue(<${String(value).length} chars>)`
3274
3275
  );
3275
3276
  const beforeValue = effectiveFieldType === "date" ? fieldEntry.getValue?.() ?? "" : void 0;
@@ -3300,7 +3301,7 @@ async function formFillHandler(payload, context) {
3300
3301
  after = fieldEntry.getValue?.() ?? "";
3301
3302
  }
3302
3303
  if (!selectValueApplied(fieldId, value, after, registry)) {
3303
- chunkJ75B2HWG_js.appilotsDebugWarn(
3304
+ chunkDZ7QRFHD_js.appilotsDebugWarn(
3304
3305
  `formFillHandler: select field "${fieldId}" setValue did not stick (wrote <${String(value).length} chars>, current is <${String(after ?? "").length} chars>), trying visible choice fallback`
3305
3306
  );
3306
3307
  const selectResult = await selectVisibleChoice(fieldId, value, registry, {
@@ -3473,14 +3474,14 @@ async function formFillHandler(payload, context) {
3473
3474
  if (payload.submitAfterFill === true) {
3474
3475
  if (!allSuccess) {
3475
3476
  const failedIds = fieldResults.filter((result) => !result.success).map((result) => result.fieldId);
3476
- chunkJ75B2HWG_js.appilotsDebugWarn(
3477
+ chunkDZ7QRFHD_js.appilotsDebugWarn(
3477
3478
  "formFillHandler: submitAfterFill=true requested but some fields failed; NOT submitting" + (failedIds.length > 0 ? ` (failed: ${failedIds.join(", ")})` : "")
3478
3479
  );
3479
3480
  } else {
3480
3481
  await sleep2(120);
3481
3482
  const submitResult = pressSubmitButton({ screen, screenPath, activePath }, registry);
3482
3483
  if (!submitResult.success) {
3483
- chunkJ75B2HWG_js.appilotsDebugWarn(`formFillHandler: submitAfterFill failed \u2014 ${submitResult.error}`);
3484
+ chunkDZ7QRFHD_js.appilotsDebugWarn(`formFillHandler: submitAfterFill failed \u2014 ${submitResult.error}`);
3484
3485
  return {
3485
3486
  success: false,
3486
3487
  error: submitResult.error,
@@ -3492,7 +3493,7 @@ async function formFillHandler(payload, context) {
3492
3493
  submitTargetId: submitResult.pressedTargetId
3493
3494
  });
3494
3495
  if (postSubmit.status === "pending") {
3495
- chunkJ75B2HWG_js.appilotsDebugWarn(`formFillHandler: submit still pending \u2014 ${postSubmit.message}`);
3496
+ chunkDZ7QRFHD_js.appilotsDebugWarn(`formFillHandler: submit still pending \u2014 ${postSubmit.message}`);
3496
3497
  return {
3497
3498
  success: false,
3498
3499
  error: postSubmit.message,
@@ -3501,7 +3502,7 @@ async function formFillHandler(payload, context) {
3501
3502
  };
3502
3503
  }
3503
3504
  if (postSubmit.status === "failure") {
3504
- chunkJ75B2HWG_js.appilotsDebugWarn(
3505
+ chunkDZ7QRFHD_js.appilotsDebugWarn(
3505
3506
  `formFillHandler: submit rejected by visible validation \u2014 ${postSubmit.message}`
3506
3507
  );
3507
3508
  return {
@@ -3528,10 +3529,10 @@ async function formFillHandler(payload, context) {
3528
3529
  };
3529
3530
  }
3530
3531
  function pressSubmitButton(context, registry) {
3531
- const activePath = context.activePath ?? chunkJ75B2HWG_js.getActiveRouteNames();
3532
+ const activePath = context.activePath ?? chunkDZ7QRFHD_js.getActiveRouteNames();
3532
3533
  const hintScreen = context.screen ?? context.screenPath;
3533
3534
  const formScreens = resolveFormScreensForSubmit(hintScreen, activePath, registry);
3534
- const resolvedScreen = formScreens.find((name) => screenDeclaresSubmit(name)) ?? formScreens[0] ?? hintScreen ?? chunkJ75B2HWG_js.getCurrentScreen() ?? void 0;
3535
+ const resolvedScreen = formScreens.find((name) => screenDeclaresSubmit(name)) ?? formScreens[0] ?? hintScreen ?? chunkDZ7QRFHD_js.getCurrentScreen() ?? void 0;
3535
3536
  const candidates = collectSubmitTargetCandidates(formScreens, registry);
3536
3537
  for (const candidate of candidates) {
3537
3538
  const target = registry.getTarget(candidate);
@@ -3552,7 +3553,7 @@ function pressSubmitButton(context, registry) {
3552
3553
  }
3553
3554
  }
3554
3555
  for (const screenName of formScreens) {
3555
- const screenMeta = chunkJ75B2HWG_js.getScreenMetadata(screenName);
3556
+ const screenMeta = chunkDZ7QRFHD_js.getScreenMetadata(screenName);
3556
3557
  const submitMeta = Array.isArray(screenMeta?.actions) ? screenMeta.actions.find(
3557
3558
  (action) => typeof action === "object" && action !== null && action.type === "submit"
3558
3559
  ) : void 0;
@@ -3658,12 +3659,12 @@ function buildDiagnose(category, targetId, candidates) {
3658
3659
  return {
3659
3660
  category,
3660
3661
  targetId,
3661
- screen: chunkJ75B2HWG_js.getCurrentScreen() ?? void 0,
3662
+ screen: chunkDZ7QRFHD_js.getCurrentScreen() ?? void 0,
3662
3663
  ...candidates && candidates.length > 0 ? { candidates: candidates.slice(0, 8) } : {}
3663
3664
  };
3664
3665
  }
3665
3666
  function resolveListEntry(listId) {
3666
- const entries = chunkJ75B2HWG_js.listRegistry.snapshot();
3667
+ const entries = chunkDZ7QRFHD_js.listRegistry.snapshot();
3667
3668
  if (entries.length === 0) return {};
3668
3669
  if (listId) {
3669
3670
  const wanted = normalizeId2(listId);
@@ -3774,23 +3775,23 @@ function targetIdFromPayload(payload) {
3774
3775
  }
3775
3776
  async function waitForPostInteractionSettle(payload) {
3776
3777
  const targetId = targetIdFromPayload(payload);
3777
- const fromScreen = chunkJ75B2HWG_js.getCurrentScreen();
3778
- const baseline = chunkJ75B2HWG_js.probeLoadingState(targetId || null, fromScreen);
3778
+ const fromScreen = chunkDZ7QRFHD_js.getCurrentScreen();
3779
+ const baseline = chunkDZ7QRFHD_js.probeLoadingState(targetId || null, fromScreen);
3779
3780
  await sleepMs(100);
3780
- const afterPress = chunkJ75B2HWG_js.probeLoadingState(targetId || null, chunkJ75B2HWG_js.getCurrentScreen());
3781
+ const afterPress = chunkDZ7QRFHD_js.probeLoadingState(targetId || null, chunkDZ7QRFHD_js.getCurrentScreen());
3781
3782
  const modalOrLoading = afterPress.modalOpen || afterPress.loading || afterPress.pressedDisabled;
3782
3783
  const fingerprintChanged = afterPress.fingerprint !== baseline.fingerprint;
3783
- const capMs = chunkJ75B2HWG_js.isListItemPressTarget(targetId) ? 5e3 : 1e4;
3784
+ const capMs = chunkDZ7QRFHD_js.isListItemPressTarget(targetId) ? 5e3 : 1e4;
3784
3785
  if (modalOrLoading || fingerprintChanged) {
3785
- await chunkJ75B2HWG_js.waitForLoadingSettle({
3786
+ await chunkDZ7QRFHD_js.waitForLoadingSettle({
3786
3787
  pressedComponentId: targetId || null,
3787
3788
  fromScreen,
3788
3789
  maxMs: capMs
3789
3790
  });
3790
3791
  return;
3791
3792
  }
3792
- if (chunkJ75B2HWG_js.isListItemPressTarget(targetId)) {
3793
- await chunkJ75B2HWG_js.waitForLoadingSettle({
3793
+ if (chunkDZ7QRFHD_js.isListItemPressTarget(targetId)) {
3794
+ await chunkDZ7QRFHD_js.waitForLoadingSettle({
3794
3795
  fromScreen,
3795
3796
  maxMs: 3e3
3796
3797
  });
@@ -3810,7 +3811,7 @@ function validateActionPayload(action) {
3810
3811
  error: message,
3811
3812
  diagnose: {
3812
3813
  category: "validation",
3813
- screen: chunkJ75B2HWG_js.getCurrentScreen() ?? void 0,
3814
+ screen: chunkDZ7QRFHD_js.getCurrentScreen() ?? void 0,
3814
3815
  ...ids ?? {}
3815
3816
  }
3816
3817
  });
@@ -3877,7 +3878,7 @@ async function executeAction(action, context) {
3877
3878
  let result;
3878
3879
  const validationFailure = validateActionPayload(action);
3879
3880
  if (validationFailure) {
3880
- chunkJ75B2HWG_js.appilotsDebugWarn(
3881
+ chunkDZ7QRFHD_js.appilotsDebugWarn(
3881
3882
  `executeAction: payload validation failed for type="${action.type}" id="${action.id}": ${validationFailure.error}`
3882
3883
  );
3883
3884
  context.emit({
@@ -3904,13 +3905,13 @@ async function executeAction(action, context) {
3904
3905
  case "form_fill":
3905
3906
  result = await formFillHandler(action.payload, {
3906
3907
  permissions,
3907
- registry: context.registry ?? chunkJ75B2HWG_js.getDefaultRegistry()
3908
+ registry: context.registry ?? chunkDZ7QRFHD_js.getDefaultRegistry()
3908
3909
  });
3909
3910
  break;
3910
3911
  case "ui_interaction":
3911
3912
  result = uiInteractionHandler(action.payload, {
3912
3913
  permissions,
3913
- registry: context.registry ?? chunkJ75B2HWG_js.getDefaultRegistry()
3914
+ registry: context.registry ?? chunkDZ7QRFHD_js.getDefaultRegistry()
3914
3915
  });
3915
3916
  if (result.success) {
3916
3917
  await waitForPostInteractionSettle(action.payload);
@@ -3940,7 +3941,7 @@ async function executeAction(action, context) {
3940
3941
  };
3941
3942
  }
3942
3943
  } catch (err) {
3943
- chunkJ75B2HWG_js.appilotsDebugWarn(
3944
+ chunkDZ7QRFHD_js.appilotsDebugWarn(
3944
3945
  `executeAction: exception during action type="${action.type}" id="${action.id}": ${err?.message}`
3945
3946
  );
3946
3947
  result = {
@@ -3966,35 +3967,35 @@ async function executeAction(action, context) {
3966
3967
  }
3967
3968
  var POST_ACTION_LOADING_MAX_MS = 6e3;
3968
3969
  function resolveScreenMetadata() {
3969
- const activePath = chunkJ75B2HWG_js.getActiveRouteNames();
3970
+ const activePath = chunkDZ7QRFHD_js.getActiveRouteNames();
3970
3971
  for (let i = activePath.length - 1; i >= 0; i--) {
3971
3972
  const name = activePath[i];
3972
- const meta = name ? chunkJ75B2HWG_js.getScreenMetadata(name) : void 0;
3973
+ const meta = name ? chunkDZ7QRFHD_js.getScreenMetadata(name) : void 0;
3973
3974
  if (meta && (Array.isArray(meta.fields) && meta.fields.length > 0 || Array.isArray(meta.actions) && meta.actions.length > 0)) {
3974
3975
  return meta;
3975
3976
  }
3976
3977
  }
3977
- const screen = chunkJ75B2HWG_js.getCurrentScreen();
3978
- return screen ? chunkJ75B2HWG_js.getScreenMetadata(screen) : void 0;
3978
+ const screen = chunkDZ7QRFHD_js.getCurrentScreen();
3979
+ return screen ? chunkDZ7QRFHD_js.getScreenMetadata(screen) : void 0;
3979
3980
  }
3980
3981
  function buildAgentContext(extras = {}) {
3981
3982
  const context = {};
3982
3983
  context.platform = "react-native";
3983
- const screen = chunkJ75B2HWG_js.getCurrentScreen();
3984
+ const screen = chunkDZ7QRFHD_js.getCurrentScreen();
3984
3985
  if (screen) context.currentScreen = screen;
3985
- const navigationState = chunkJ75B2HWG_js.getNavigationStateSnapshot();
3986
+ const navigationState = chunkDZ7QRFHD_js.getNavigationStateSnapshot();
3986
3987
  if (navigationState) context.navigationState = navigationState;
3987
3988
  const screenMeta = resolveScreenMetadata();
3988
3989
  if (screenMeta) context.screenMetadata = screenMeta;
3989
3990
  try {
3990
3991
  context.snapshot = captureSnapshot();
3991
3992
  } catch (err) {
3992
- chunkJ75B2HWG_js.appilotsDebugWarn("buildAgentContext: captureSnapshot failed", err);
3993
+ chunkDZ7QRFHD_js.appilotsDebugWarn("buildAgentContext: captureSnapshot failed", err);
3993
3994
  }
3994
- const registry = chunkJ75B2HWG_js.componentRegistry.snapshot();
3995
+ const registry = chunkDZ7QRFHD_js.componentRegistry.snapshot();
3995
3996
  const filtered = screen ? registry.filter((c) => !c.screen || c.screen === screen) : registry;
3996
3997
  if (filtered.length > 0) context.registeredComponents = filtered;
3997
- const registeredLists = chunkJ75B2HWG_js.listRegistry.snapshot();
3998
+ const registeredLists = chunkDZ7QRFHD_js.listRegistry.snapshot();
3998
3999
  if (registeredLists.length > 0) {
3999
4000
  context.registeredLists = registeredLists.map(
4000
4001
  ({ scrollToIndex, scrollToOffset, getScrollMetrics, dataPreview, ...rest }) => rest
@@ -4011,12 +4012,12 @@ function resolveActionHints(screen, pressedComponentId, actionPayload) {
4011
4012
  }
4012
4013
  }
4013
4014
  if (!screen || !pressedComponentId) return void 0;
4014
- const meta = chunkJ75B2HWG_js.getScreenMetadata(screen);
4015
+ const meta = chunkDZ7QRFHD_js.getScreenMetadata(screen);
4015
4016
  const actions = meta?.actions;
4016
4017
  if (!actions || actions.length === 0) return void 0;
4017
4018
  for (const a of actions) {
4018
4019
  if (typeof a === "string") continue;
4019
- if (chunkJ75B2HWG_js.idLooselyMatches(a.id, pressedComponentId)) {
4020
+ if (chunkDZ7QRFHD_js.idLooselyMatches(a.id, pressedComponentId)) {
4020
4021
  const inferred = a.appilotsInferred;
4021
4022
  if (inferred && typeof inferred === "object") return inferred;
4022
4023
  return void 0;
@@ -4031,7 +4032,7 @@ async function settleTurn(input) {
4031
4032
  const successById = new Map(input.results.map((r) => [r.actionId, r.success]));
4032
4033
  const typeById = new Map(input.results.map((r) => [r.actionId, r.type]));
4033
4034
  if (input.hadNavigate) {
4034
- const settle = await chunkJ75B2HWG_js.waitForScreenSettle({
4035
+ const settle = await chunkDZ7QRFHD_js.waitForScreenSettle({
4035
4036
  expectingChange: true,
4036
4037
  fromScreen: input.preNavigateScreen ?? null,
4037
4038
  fromSignature: input.preNavigateSignature ?? null,
@@ -4041,19 +4042,19 @@ async function settleTurn(input) {
4041
4042
  console.log(
4042
4043
  `[Appilots] settleTurn: post-navigate settle done \u2014 screen="${settle.screen}" transitioned=${settle.transitioned} timedOut=${settle.timedOut} waitedMs=${settle.waitedMs}`
4043
4044
  );
4044
- const navigationMoved = settle.transitioned || chunkJ75B2HWG_js.screenDepartedBaseline(
4045
+ const navigationMoved = settle.transitioned || chunkDZ7QRFHD_js.screenDepartedBaseline(
4045
4046
  input.preNavigateScreen ?? null,
4046
4047
  input.preNavigateSignature ?? null
4047
- ) || !!navigateTargetScreen && !!settle.screen && chunkJ75B2HWG_js.routesBelongToSameFeature(settle.screen, navigateTargetScreen);
4048
+ ) || !!navigateTargetScreen && !!settle.screen && chunkDZ7QRFHD_js.routesBelongToSameFeature(settle.screen, navigateTargetScreen);
4048
4049
  if (!navigationMoved) {
4049
- chunkJ75B2HWG_js.appilotsDebugWarn(
4050
+ chunkDZ7QRFHD_js.appilotsDebugWarn(
4050
4051
  `tool-without-effect: navigate emitted but screen did not change (stayed at "${input.preNavigateScreen ?? "unknown"}", waitedMs=${settle.waitedMs}). Likely causes: target screenName missing from MCP doc, nested-nav path absent, or React Navigation rejected the route.`
4051
4052
  );
4052
4053
  for (const [actionId, type] of typeById) {
4053
4054
  if (type === "navigate") toolWithoutEffectIds.add(actionId);
4054
4055
  }
4055
4056
  }
4056
- const loadSettle = await chunkJ75B2HWG_js.waitForLoadingSettle({
4057
+ const loadSettle = await chunkDZ7QRFHD_js.waitForLoadingSettle({
4057
4058
  fromScreen: settle.screen ?? null,
4058
4059
  maxMs: 3e3
4059
4060
  });
@@ -4065,11 +4066,11 @@ async function settleTurn(input) {
4065
4066
  const pressedAction = turnActions.find(
4066
4067
  (a) => a.type === "ui_interaction" && a.payload?.componentId === pressedId
4067
4068
  );
4068
- const hints = resolveActionHints(chunkJ75B2HWG_js.getCurrentScreen(), pressedId, pressedAction?.payload);
4069
+ const hints = resolveActionHints(chunkDZ7QRFHD_js.getCurrentScreen(), pressedId, pressedAction?.payload);
4069
4070
  const settleCapMs = hints?.isAsyncTrigger === true ? 1e4 : POST_ACTION_LOADING_MAX_MS;
4070
- const loadSettle = await chunkJ75B2HWG_js.waitForLoadingSettle({
4071
+ const loadSettle = await chunkDZ7QRFHD_js.waitForLoadingSettle({
4071
4072
  pressedComponentId: pressedId,
4072
- fromScreen: chunkJ75B2HWG_js.getCurrentScreen(),
4073
+ fromScreen: chunkDZ7QRFHD_js.getCurrentScreen(),
4073
4074
  maxMs: settleCapMs
4074
4075
  });
4075
4076
  console.log(
@@ -4077,23 +4078,23 @@ async function settleTurn(input) {
4077
4078
  );
4078
4079
  if (loadSettle.loadingPending) loadingPending = true;
4079
4080
  const listPressActions = turnActions.filter((action) => {
4080
- const target = chunkJ75B2HWG_js.actionPressTargetId(action);
4081
- return target ? chunkJ75B2HWG_js.isListItemPressTarget(target) : false;
4081
+ const target = chunkDZ7QRFHD_js.actionPressTargetId(action);
4082
+ return target ? chunkDZ7QRFHD_js.isListItemPressTarget(target) : false;
4082
4083
  });
4083
4084
  if (listPressActions.length > 0) {
4084
- const baselineFingerprint = chunkJ75B2HWG_js.probeLoadingState(pressedId, chunkJ75B2HWG_js.getCurrentScreen()).fingerprint;
4085
- const postPressSettle = await chunkJ75B2HWG_js.waitForScreenSettle({
4085
+ const baselineFingerprint = chunkDZ7QRFHD_js.probeLoadingState(pressedId, chunkDZ7QRFHD_js.getCurrentScreen()).fingerprint;
4086
+ const postPressSettle = await chunkDZ7QRFHD_js.waitForScreenSettle({
4086
4087
  expectingChange: true,
4087
4088
  fromScreen: input.preNavigateScreen ?? null,
4088
4089
  fromSignature: input.preNavigateSignature ?? null,
4089
4090
  maxMs: 2500
4090
4091
  });
4091
- await chunkJ75B2HWG_js.waitForLoadingSettle({
4092
+ await chunkDZ7QRFHD_js.waitForLoadingSettle({
4092
4093
  pressedComponentId: pressedId,
4093
- fromScreen: chunkJ75B2HWG_js.getCurrentScreen(),
4094
+ fromScreen: chunkDZ7QRFHD_js.getCurrentScreen(),
4094
4095
  maxMs: 4e3
4095
4096
  });
4096
- const afterFingerprint = chunkJ75B2HWG_js.probeLoadingState(pressedId, chunkJ75B2HWG_js.getCurrentScreen()).fingerprint;
4097
+ const afterFingerprint = chunkDZ7QRFHD_js.probeLoadingState(pressedId, chunkDZ7QRFHD_js.getCurrentScreen()).fingerprint;
4097
4098
  console.log(
4098
4099
  `[Appilots] settleTurn: post-list-press settle \u2014 screen="${postPressSettle.screen}" transitioned=${postPressSettle.transitioned} timedOut=${postPressSettle.timedOut} waitedMs=${postPressSettle.waitedMs}`
4099
4100
  );
@@ -4110,8 +4111,8 @@ async function settleTurn(input) {
4110
4111
  }
4111
4112
  var reactNativeChatAdapter = {
4112
4113
  buildContext: buildAgentContext,
4113
- getCurrentScreen: chunkJ75B2HWG_js.getCurrentScreen,
4114
- getCurrentScreenSignature: chunkJ75B2HWG_js.getCurrentScreenSignature,
4114
+ getCurrentScreen: chunkDZ7QRFHD_js.getCurrentScreen,
4115
+ getCurrentScreenSignature: chunkDZ7QRFHD_js.getCurrentScreenSignature,
4115
4116
  settleTurn
4116
4117
  };
4117
4118
  async function runWithConfirmedDestructiveContext(enabled, fn) {
@@ -4147,7 +4148,7 @@ function createReactNativeActionRunner(getOptions) {
4147
4148
  return {
4148
4149
  async execute(action, { confirmedDestructive }) {
4149
4150
  const { permissions, emit, navigationRef } = getOptions();
4150
- const navRef = navigationRef?.current ? navigationRef : { current: chunkJ75B2HWG_js.getNavigationRef() };
4151
+ const navRef = navigationRef?.current ? navigationRef : { current: chunkDZ7QRFHD_js.getNavigationRef() };
4151
4152
  return runWithConfirmedDestructiveContext(
4152
4153
  confirmedDestructive,
4153
4154
  () => executeAction(action, {
@@ -4157,21 +4158,21 @@ function createReactNativeActionRunner(getOptions) {
4157
4158
  })
4158
4159
  );
4159
4160
  },
4160
- getCurrentScreen: chunkJ75B2HWG_js.getCurrentScreen,
4161
- getCurrentScreenSignature: chunkJ75B2HWG_js.getCurrentScreenSignature,
4161
+ getCurrentScreen: chunkDZ7QRFHD_js.getCurrentScreen,
4162
+ getCurrentScreenSignature: chunkDZ7QRFHD_js.getCurrentScreenSignature,
4162
4163
  getScreenActionsMetadata(screen) {
4163
- return chunkJ75B2HWG_js.getScreenMetadata(screen)?.actions;
4164
+ return chunkDZ7QRFHD_js.getScreenMetadata(screen)?.actions;
4164
4165
  },
4165
- waitForScreenSettle: chunkJ75B2HWG_js.waitForScreenSettle
4166
+ waitForScreenSettle: chunkDZ7QRFHD_js.waitForScreenSettle
4166
4167
  };
4167
4168
  }
4168
4169
 
4169
4170
  // src/hooks/useAppilotsChat.ts
4170
4171
  function useAppilotsChat(options = {}) {
4171
- const { client, emit, subscribe } = chunkJ75B2HWG_js.useAppilotsContext();
4172
+ const { client, emit, subscribe } = chunkDZ7QRFHD_js.useAppilotsContext();
4172
4173
  const machine = react.useMemo(
4173
- () => new chunkJ75B2HWG_js.ChatSessionMachine(
4174
- { client, adapter: reactNativeChatAdapter, emit, warn: chunkJ75B2HWG_js.appilotsDebugWarn },
4174
+ () => new chunkDZ7QRFHD_js.ChatSessionMachine(
4175
+ { client, adapter: reactNativeChatAdapter, emit, warn: chunkDZ7QRFHD_js.appilotsDebugWarn },
4175
4176
  options
4176
4177
  ),
4177
4178
  // A new machine per client/provider instance — options are pushed in
@@ -4214,7 +4215,7 @@ var DEFAULT_PERMISSIONS2 = {
4214
4215
  canSubmitForms: true
4215
4216
  };
4216
4217
  function useAppilotsActions(options = {}) {
4217
- const { client, subscribe, config, emit } = chunkJ75B2HWG_js.useAppilotsContext();
4218
+ const { client, subscribe, config, emit } = chunkDZ7QRFHD_js.useAppilotsContext();
4218
4219
  const { navigationRef, autoExecute = false } = options;
4219
4220
  const runnerOptionsRef = react.useRef({
4220
4221
  permissions: config.permissions ?? DEFAULT_PERMISSIONS2,
@@ -4227,12 +4228,12 @@ function useAppilotsActions(options = {}) {
4227
4228
  navigationRef
4228
4229
  };
4229
4230
  const machine = react.useMemo(
4230
- () => new chunkJ75B2HWG_js.ActionQueueMachine(
4231
+ () => new chunkDZ7QRFHD_js.ActionQueueMachine(
4231
4232
  {
4232
4233
  client,
4233
4234
  adapter: createReactNativeActionRunner(() => runnerOptionsRef.current),
4234
4235
  emit,
4235
- warn: chunkJ75B2HWG_js.appilotsDebugWarn
4236
+ warn: chunkDZ7QRFHD_js.appilotsDebugWarn
4236
4237
  },
4237
4238
  { autoExecute }
4238
4239
  ),
@@ -4289,7 +4290,7 @@ function shouldShowSuggestedPrompts(args) {
4289
4290
 
4290
4291
  // src/hooks/useSuggestedPrompts.ts
4291
4292
  function useSuggestedPrompts(options) {
4292
- const { client } = chunkJ75B2HWG_js.useAppilotsContext();
4293
+ const { client } = chunkDZ7QRFHD_js.useAppilotsContext();
4293
4294
  const { enabled, limit = 4 } = options;
4294
4295
  const [prompts, setPrompts] = react.useState([]);
4295
4296
  const [isLoading, setIsLoading] = react.useState(false);
@@ -4299,8 +4300,8 @@ function useSuggestedPrompts(options) {
4299
4300
  if (!enabled) return;
4300
4301
  const requestId = ++requestIdRef.current;
4301
4302
  let cancelled = false;
4302
- const screen = chunkJ75B2HWG_js.getCurrentScreen() ?? void 0;
4303
- const localDev = screen ? (chunkJ75B2HWG_js.getScreenMetadata(screen)?.suggestedPrompts ?? []).map((text) => ({
4303
+ const screen = chunkDZ7QRFHD_js.getCurrentScreen() ?? void 0;
4304
+ const localDev = screen ? (chunkDZ7QRFHD_js.getScreenMetadata(screen)?.suggestedPrompts ?? []).map((text) => ({
4304
4305
  text,
4305
4306
  source: "dev-defined"
4306
4307
  })) : [];
@@ -4325,9 +4326,9 @@ function useSuggestedPrompts(options) {
4325
4326
  }, [client, enabled, limit, refreshTick]);
4326
4327
  react.useEffect(() => {
4327
4328
  if (!enabled) return;
4328
- let lastScreen = chunkJ75B2HWG_js.getCurrentScreen();
4329
+ let lastScreen = chunkDZ7QRFHD_js.getCurrentScreen();
4329
4330
  const interval = setInterval(() => {
4330
- const current = chunkJ75B2HWG_js.getCurrentScreen();
4331
+ const current = chunkDZ7QRFHD_js.getCurrentScreen();
4331
4332
  if (current !== lastScreen) {
4332
4333
  lastScreen = current;
4333
4334
  setRefreshTick((t) => t + 1);
@@ -4342,14 +4343,14 @@ function useSuggestedPrompts(options) {
4342
4343
  };
4343
4344
  }
4344
4345
  function useAppilotsNavigation() {
4345
- const { emit } = chunkJ75B2HWG_js.useAppilotsContext();
4346
+ const { emit } = chunkDZ7QRFHD_js.useAppilotsContext();
4346
4347
  const [currentScreen, setCurrentScreenState] = react.useState(null);
4347
4348
  const [navigationHistory, setNavigationHistory] = react.useState([]);
4348
4349
  const navigationRef = react.useRef(null);
4349
4350
  const setCurrentScreen2 = react.useCallback(
4350
4351
  (screenName) => {
4351
4352
  setCurrentScreenState(screenName);
4352
- chunkJ75B2HWG_js.setCurrentScreen(screenName);
4353
+ chunkDZ7QRFHD_js.setCurrentScreen(screenName);
4353
4354
  setNavigationHistory((prev) => [...prev, screenName]);
4354
4355
  emit({
4355
4356
  type: "navigation:change",
@@ -4380,7 +4381,7 @@ function useAppilotsNavigation() {
4380
4381
 
4381
4382
  // src/hooks/useAppilots.ts
4382
4383
  function useAppilots() {
4383
- const { config, client } = chunkJ75B2HWG_js.useAppilotsContext();
4384
+ const { config, client } = chunkDZ7QRFHD_js.useAppilotsContext();
4384
4385
  const chat = useAppilotsChat();
4385
4386
  const navigation = useAppilotsNavigation();
4386
4387
  const actions = useAppilotsActions();
@@ -4409,7 +4410,7 @@ function useAppilots() {
4409
4410
  }
4410
4411
  function useAppilotsField(id, options) {
4411
4412
  const { value, onChangeText, ref, fieldType, label, screen } = options;
4412
- const registry = chunkJ75B2HWG_js.useResolvedRegistry();
4413
+ const registry = chunkDZ7QRFHD_js.useResolvedRegistry();
4413
4414
  const valueRef = react.useRef(value);
4414
4415
  const onChangeRef = react.useRef(onChangeText);
4415
4416
  valueRef.current = value;
@@ -4437,7 +4438,7 @@ function useAppilotsField(id, options) {
4437
4438
  }
4438
4439
  function useAppilotsTarget(id, options) {
4439
4440
  const { onPress, onLongPress, onScrollTo, label, screen } = options;
4440
- const registry = chunkJ75B2HWG_js.useResolvedRegistry();
4441
+ const registry = chunkDZ7QRFHD_js.useResolvedRegistry();
4441
4442
  const onPressRef = react.useRef(onPress);
4442
4443
  const onLongPressRef = react.useRef(onLongPress);
4443
4444
  const onScrollToRef = react.useRef(onScrollTo);
@@ -4464,7 +4465,7 @@ function useAppilotsTarget(id, options) {
4464
4465
  }
4465
4466
  function useAppilotsToggle(id, options) {
4466
4467
  const { value, onValueChange, label, screen } = options;
4467
- const registry = chunkJ75B2HWG_js.useResolvedRegistry();
4468
+ const registry = chunkDZ7QRFHD_js.useResolvedRegistry();
4468
4469
  const valueRef = react.useRef(value);
4469
4470
  const onChangeRef = react.useRef(onValueChange);
4470
4471
  valueRef.current = value;
@@ -4487,7 +4488,7 @@ function useAppilotsToggle(id, options) {
4487
4488
  }
4488
4489
  function useAppilotsSlider(id, options) {
4489
4490
  const { value, onValueChange, min, max, step, label, screen } = options;
4490
- const registry = chunkJ75B2HWG_js.useResolvedRegistry();
4491
+ const registry = chunkDZ7QRFHD_js.useResolvedRegistry();
4491
4492
  const valueRef = react.useRef(value);
4492
4493
  const onChangeRef = react.useRef(onValueChange);
4493
4494
  valueRef.current = value;