@appilots/sdk 0.4.0 → 0.5.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 chunkV3TUIIT2_js = require('./chunk-V3TUIIT2.js');
3
+ var chunkPQHZTAFG_js = require('./chunk-PQHZTAFG.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: chunkV3TUIIT2_js.getCurrentScreen(),
498
+ route: chunkPQHZTAFG_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 chunkV3TUIIT2_js.componentRegistry.snapshot()) {
674
+ for (const { id, kind } of chunkPQHZTAFG_js.componentRegistry.snapshot()) {
675
675
  if (kind !== "slider") continue;
676
- const entry = chunkV3TUIIT2_js.componentRegistry.getSlider(id);
676
+ const entry = chunkPQHZTAFG_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 = chunkV3TUIIT2_js.listRegistry.snapshot();
700
+ const registered = chunkPQHZTAFG_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 = chunkV3TUIIT2_js.getFiberRoot();
748
+ const root = chunkPQHZTAFG_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
+ chunkPQHZTAFG_js.recordIntrospectionFailure("never-mounted", null);
753
754
  return {
754
- route: chunkV3TUIIT2_js.getCurrentScreen(),
755
+ route: chunkPQHZTAFG_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 = chunkV3TUIIT2_js.getActiveRouteNames();
770
+ const activePath = chunkPQHZTAFG_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 = chunkV3TUIIT2_js.deriveInteractionElements(snapshot);
775
- snapshot.choiceGroups = chunkV3TUIIT2_js.attachElementIdsToChoiceGroups(
775
+ snapshot.elements = chunkPQHZTAFG_js.deriveInteractionElements(snapshot);
776
+ snapshot.choiceGroups = chunkPQHZTAFG_js.attachElementIdsToChoiceGroups(
776
777
  snapshot.choiceGroups,
777
778
  snapshot.elements
778
779
  );
779
- chunkV3TUIIT2_js.elementRegistry.replaceAll(snapshot.elements);
780
+ chunkPQHZTAFG_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 = chunkV3TUIIT2_js.getFiberRoot();
973
+ const root = chunkPQHZTAFG_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 = chunkV3TUIIT2_js.getFiberRoot();
1214
+ const root = chunkPQHZTAFG_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 && chunkV3TUIIT2_js.looksDestructiveActionLabel(descriptor)) return true;
1373
+ if (descriptor && chunkPQHZTAFG_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 chunkV3TUIIT2_js.looksDestructiveActionLabel(haystack);
1381
+ return chunkPQHZTAFG_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 (!chunkV3TUIIT2_js.getFiberRoot()) return { ok: false, reason: "no-fiber-root" };
1512
+ if (!chunkPQHZTAFG_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 (!chunkV3TUIIT2_js.getFiberRoot()) return { ok: false, reason: "no-fiber-root" };
1526
+ if (!chunkPQHZTAFG_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: chunkV3TUIIT2_js.getCurrentScreen() ?? void 0
1566
+ screen: chunkPQHZTAFG_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 = chunkV3TUIIT2_js.elementRegistry.get(elementId) ?? chunkV3TUIIT2_js.elementRegistry.get(canonicalElementId(elementId));
1583
+ const direct = chunkPQHZTAFG_js.elementRegistry.get(elementId) ?? chunkPQHZTAFG_js.elementRegistry.get(canonicalElementId(elementId));
1583
1584
  if (direct) return direct;
1584
1585
  const wanted = elementLookupKey(elementId);
1585
- return chunkV3TUIIT2_js.elementRegistry.snapshot().find((element) => elementLookupKey(element.id) === wanted);
1586
+ return chunkPQHZTAFG_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 = chunkV3TUIIT2_js.parseStableElementId(identifier);
1806
+ const parsed = chunkPQHZTAFG_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 = chunkV3TUIIT2_js.getActiveRouteNames();
1846
+ const activePath = chunkPQHZTAFG_js.getActiveRouteNames();
1846
1847
  for (let i = activePath.length - 1; i >= 0; i--) {
1847
1848
  const name = activePath[i];
1848
- const meta = name ? chunkV3TUIIT2_js.getScreenMetadata(name) : void 0;
1849
+ const meta = name ? chunkPQHZTAFG_js.getScreenMetadata(name) : void 0;
1849
1850
  if (name && Array.isArray(meta?.fields) && meta.fields.length > 0) return name;
1850
1851
  }
1851
- return chunkV3TUIIT2_js.getCurrentScreen();
1852
+ return chunkPQHZTAFG_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 = chunkV3TUIIT2_js.getScreenMetadata(screen)?.fields;
1859
+ const metaFields = chunkPQHZTAFG_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 chunkV3TUIIT2_js.getAllScreens()) {
1869
+ for (const meta of chunkPQHZTAFG_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
- chunkV3TUIIT2_js.appilotsDebugWarn(
1967
+ chunkPQHZTAFG_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 = chunkV3TUIIT2_js.probeLoadingState(submitTargetId ?? null, chunkV3TUIIT2_js.getCurrentScreen());
2005
+ const probe = chunkPQHZTAFG_js.probeLoadingState(submitTargetId ?? null, chunkPQHZTAFG_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 (!chunkV3TUIIT2_js.snapshotShowsOpenCreateForm(snap, activePath)) {
2017
+ if (!chunkPQHZTAFG_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 = chunkV3TUIIT2_js.getActiveRouteNames();
2033
+ const activePath2 = chunkPQHZTAFG_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 = chunkV3TUIIT2_js.getActiveRouteNames();
2045
+ const activePath = chunkPQHZTAFG_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 = chunkV3TUIIT2_js.getActiveRouteNames();
2151
- const screen = activePath[activePath.length - 1] ?? chunkV3TUIIT2_js.getCurrentScreen() ?? void 0;
2151
+ const activePath = chunkPQHZTAFG_js.getActiveRouteNames();
2152
+ const screen = activePath[activePath.length - 1] ?? chunkPQHZTAFG_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 (chunkV3TUIIT2_js.isOptionalStepAutomationFailure(targetId, screenPath, activePath)) {
2159
- diagnose.visibleMessage = chunkV3TUIIT2_js.OPTIONAL_STEP_AUTOMATION_HINT;
2159
+ if (chunkPQHZTAFG_js.isOptionalStepAutomationFailure(targetId, screenPath, activePath)) {
2160
+ diagnose.visibleMessage = chunkPQHZTAFG_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 = chunkV3TUIIT2_js.getCurrentScreen();
2222
+ const currentScreen = chunkPQHZTAFG_js.getCurrentScreen();
2222
2223
  if (currentScreen) {
2223
- const screenMeta = chunkV3TUIIT2_js.getScreenMetadata(currentScreen);
2224
+ const screenMeta = chunkPQHZTAFG_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 = chunkV3TUIIT2_js.getFiberRoot();
2378
+ const fiberRoot = chunkPQHZTAFG_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 ?? chunkV3TUIIT2_js.componentRegistry;
2441
+ const registry = context.registry ?? chunkPQHZTAFG_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 = chunkV3TUIIT2_js.getCurrentScreen() ?? void 0;
2500
+ const screen = chunkPQHZTAFG_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 = chunkV3TUIIT2_js.getScreenMetadata(screenName);
2665
+ const meta = chunkPQHZTAFG_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(chunkV3TUIIT2_js.getCurrentScreen() ?? void 0);
2698
+ push(chunkPQHZTAFG_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 = chunkV3TUIIT2_js.getScreenMetadata(screenName);
2716
+ const meta = chunkPQHZTAFG_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 = chunkV3TUIIT2_js.getActiveRouteNames();
2762
- const screen = activePath[activePath.length - 1] ?? chunkV3TUIIT2_js.getCurrentScreen() ?? void 0;
2762
+ const activePath = chunkPQHZTAFG_js.getActiveRouteNames();
2763
+ const screen = activePath[activePath.length - 1] ?? chunkPQHZTAFG_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 = chunkV3TUIIT2_js.normalize3(requested);
2771
- const currentNorm = chunkV3TUIIT2_js.normalize3(currentValue);
2771
+ const requestedNorm = chunkPQHZTAFG_js.normalize3(requested);
2772
+ const currentNorm = chunkPQHZTAFG_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 (chunkV3TUIIT2_js.normalize3(value) === requestedNorm && chunkV3TUIIT2_js.normalize3(label) === currentNorm) return true;
2777
- if (chunkV3TUIIT2_js.normalize3(label) === requestedNorm && chunkV3TUIIT2_js.normalize3(label) === currentNorm) return true;
2778
- if (chunkV3TUIIT2_js.normalize3(value) === requestedNorm && chunkV3TUIIT2_js.normalize3(value) === currentNorm) return true;
2777
+ if (chunkPQHZTAFG_js.normalize3(value) === requestedNorm && chunkPQHZTAFG_js.normalize3(label) === currentNorm) return true;
2778
+ if (chunkPQHZTAFG_js.normalize3(label) === requestedNorm && chunkPQHZTAFG_js.normalize3(label) === currentNorm) return true;
2779
+ if (chunkPQHZTAFG_js.normalize3(value) === requestedNorm && chunkPQHZTAFG_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 chunkV3TUIIT2_js.getActiveRouteNames()) screens.add(name);
2785
- const current = chunkV3TUIIT2_js.getCurrentScreen();
2785
+ for (const name of chunkPQHZTAFG_js.getActiveRouteNames()) screens.add(name);
2786
+ const current = chunkPQHZTAFG_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 = chunkV3TUIIT2_js.normalize3(fieldId);
2793
+ const needle = chunkPQHZTAFG_js.normalize3(fieldId);
2793
2794
  for (const screenName of screens) {
2794
- const screenMeta = chunkV3TUIIT2_js.getScreenMetadata(screenName);
2795
+ const screenMeta = chunkPQHZTAFG_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" ? chunkV3TUIIT2_js.normalize3(field.id) : "";
2799
- const label = typeof field.label === "string" ? chunkV3TUIIT2_js.normalize3(field.label) : "";
2799
+ const id = typeof field.id === "string" ? chunkPQHZTAFG_js.normalize3(field.id) : "";
2800
+ const label = typeof field.label === "string" ? chunkPQHZTAFG_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 = chunkV3TUIIT2_js.normalize3(requested);
2812
+ const requestedNorm = chunkPQHZTAFG_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 (chunkV3TUIIT2_js.normalize3(optionValue) === requestedNorm || chunkV3TUIIT2_js.normalize3(optionLabel) === requestedNorm) {
2816
+ if (chunkPQHZTAFG_js.normalize3(optionValue) === requestedNorm || chunkPQHZTAFG_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: chunkV3TUIIT2_js.getCurrentScreen() ?? void 0 }
2866
+ diagnose: { category: "component-not-found", fieldId, screen: chunkPQHZTAFG_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 = chunkV3TUIIT2_js.normalize3(type);
2871
+ const normalized = chunkPQHZTAFG_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 = chunkV3TUIIT2_js.normalize3(value);
2899
+ const normalized = chunkPQHZTAFG_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) => chunkV3TUIIT2_js.normalize3(text)).filter(Boolean);
2910
+ ].map((text) => chunkPQHZTAFG_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 = chunkV3TUIIT2_js.normalize3(String(value ?? ""));
2914
+ const valueNorm = chunkPQHZTAFG_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 = chunkV3TUIIT2_js.normalize3(text);
2918
+ const textNorm = chunkPQHZTAFG_js.normalize3(text);
2918
2919
  if (!textNorm) continue;
2919
- best = Math.max(best, chunkV3TUIIT2_js.matchScore(valueNorm, textNorm));
2920
+ best = Math.max(best, chunkPQHZTAFG_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 = chunkV3TUIIT2_js.isGenericSelectValue(value);
2934
+ const genericValue = chunkPQHZTAFG_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 = chunkV3TUIIT2_js.normalize3(text);
2946
+ const normalized = chunkPQHZTAFG_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 = chunkV3TUIIT2_js.normalize3(text);
2983
+ const normalized = chunkPQHZTAFG_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: chunkV3TUIIT2_js.getCurrentScreen() ?? void 0 }
3043
+ diagnose: { category: "unknown", fieldId, screen: chunkPQHZTAFG_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: chunkV3TUIIT2_js.getCurrentScreen() ?? void 0 }
3058
+ diagnose: { category: "component-not-found", fieldId, screen: chunkPQHZTAFG_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(chunkV3TUIIT2_js.normalize3(label));
3071
+ return /^(next|continue|proximo|prox|continuar|avancar|avançar)$/i.test(chunkPQHZTAFG_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: chunkV3TUIIT2_js.getCurrentScreen() ?? void 0 }
3084
+ diagnose: { category: "component-not-found", screen: chunkPQHZTAFG_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 = chunkV3TUIIT2_js.getCurrentScreen();
3104
- const needle = chunkV3TUIIT2_js.normalize3(fieldId);
3104
+ const currentScreenForTieBreak = chunkPQHZTAFG_js.getCurrentScreen();
3105
+ const needle = chunkPQHZTAFG_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 = [chunkV3TUIIT2_js.normalize3(comp.id)];
3111
- if (comp.label) candidates.push(chunkV3TUIIT2_js.normalize3(comp.label));
3111
+ const candidates = [chunkPQHZTAFG_js.normalize3(comp.id)];
3112
+ if (comp.label) candidates.push(chunkPQHZTAFG_js.normalize3(comp.label));
3112
3113
  let candidateScore = 0;
3113
3114
  for (const cand of candidates) {
3114
- const s = chunkV3TUIIT2_js.matchScore(needle, cand);
3115
+ const s = chunkPQHZTAFG_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 = chunkV3TUIIT2_js.getCurrentScreen();
3133
+ const currentScreen = chunkPQHZTAFG_js.getCurrentScreen();
3133
3134
  if (currentScreen) {
3134
- const screenMeta = chunkV3TUIIT2_js.getScreenMetadata(currentScreen);
3135
+ const screenMeta = chunkPQHZTAFG_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 = chunkV3TUIIT2_js.normalize3(metaLabel);
3143
+ const metaNeedle = chunkPQHZTAFG_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 = chunkV3TUIIT2_js.matchScore(metaNeedle, chunkV3TUIIT2_js.normalize3(comp.label));
3148
+ const score = chunkPQHZTAFG_js.matchScore(metaNeedle, chunkPQHZTAFG_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
- chunkV3TUIIT2_js.appilotsDebugWarn(
3169
+ chunkPQHZTAFG_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
- chunkV3TUIIT2_js.appilotsDebugWarn(
3189
+ chunkPQHZTAFG_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 ?? chunkV3TUIIT2_js.componentRegistry;
3209
+ const registry = context.registry ?? chunkPQHZTAFG_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
- chunkV3TUIIT2_js.appilotsDebugWarn(
3228
+ chunkPQHZTAFG_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,9 @@ async function formFillHandler(payload, context) {
3269
3270
  const fieldEntry = findField(fieldId, registry);
3270
3271
  if (fieldEntry) {
3271
3272
  try {
3272
- console.log(`[Appilots] formFillHandler: found field "${fieldId}" via registry, calling setValue("${value}")`);
3273
+ chunkPQHZTAFG_js.appilotsDebugLog(
3274
+ `formFillHandler: found field "${fieldId}" via registry, calling setValue(<${String(value).length} chars>)`
3275
+ );
3273
3276
  const beforeValue = effectiveFieldType === "date" ? fieldEntry.getValue?.() ?? "" : void 0;
3274
3277
  fieldEntry.focus?.();
3275
3278
  fieldEntry.setValue(String(value));
@@ -3298,8 +3301,8 @@ async function formFillHandler(payload, context) {
3298
3301
  after = fieldEntry.getValue?.() ?? "";
3299
3302
  }
3300
3303
  if (!selectValueApplied(fieldId, value, after, registry)) {
3301
- chunkV3TUIIT2_js.appilotsDebugWarn(
3302
- `formFillHandler: select field "${fieldId}" setValue("${value}") did not stick (current="${after}"), trying visible choice fallback`
3304
+ chunkPQHZTAFG_js.appilotsDebugWarn(
3305
+ `formFillHandler: select field "${fieldId}" setValue did not stick (wrote <${String(value).length} chars>, current is <${String(after ?? "").length} chars>), trying visible choice fallback`
3303
3306
  );
3304
3307
  const selectResult = await selectVisibleChoice(fieldId, value, registry, {
3305
3308
  allowFirstVisibleWhenNoCue: !selectedChoiceThisBatch
@@ -3471,14 +3474,14 @@ async function formFillHandler(payload, context) {
3471
3474
  if (payload.submitAfterFill === true) {
3472
3475
  if (!allSuccess) {
3473
3476
  const failedIds = fieldResults.filter((result) => !result.success).map((result) => result.fieldId);
3474
- chunkV3TUIIT2_js.appilotsDebugWarn(
3477
+ chunkPQHZTAFG_js.appilotsDebugWarn(
3475
3478
  "formFillHandler: submitAfterFill=true requested but some fields failed; NOT submitting" + (failedIds.length > 0 ? ` (failed: ${failedIds.join(", ")})` : "")
3476
3479
  );
3477
3480
  } else {
3478
3481
  await sleep2(120);
3479
3482
  const submitResult = pressSubmitButton({ screen, screenPath, activePath }, registry);
3480
3483
  if (!submitResult.success) {
3481
- chunkV3TUIIT2_js.appilotsDebugWarn(`formFillHandler: submitAfterFill failed \u2014 ${submitResult.error}`);
3484
+ chunkPQHZTAFG_js.appilotsDebugWarn(`formFillHandler: submitAfterFill failed \u2014 ${submitResult.error}`);
3482
3485
  return {
3483
3486
  success: false,
3484
3487
  error: submitResult.error,
@@ -3490,7 +3493,7 @@ async function formFillHandler(payload, context) {
3490
3493
  submitTargetId: submitResult.pressedTargetId
3491
3494
  });
3492
3495
  if (postSubmit.status === "pending") {
3493
- chunkV3TUIIT2_js.appilotsDebugWarn(`formFillHandler: submit still pending \u2014 ${postSubmit.message}`);
3496
+ chunkPQHZTAFG_js.appilotsDebugWarn(`formFillHandler: submit still pending \u2014 ${postSubmit.message}`);
3494
3497
  return {
3495
3498
  success: false,
3496
3499
  error: postSubmit.message,
@@ -3499,7 +3502,7 @@ async function formFillHandler(payload, context) {
3499
3502
  };
3500
3503
  }
3501
3504
  if (postSubmit.status === "failure") {
3502
- chunkV3TUIIT2_js.appilotsDebugWarn(
3505
+ chunkPQHZTAFG_js.appilotsDebugWarn(
3503
3506
  `formFillHandler: submit rejected by visible validation \u2014 ${postSubmit.message}`
3504
3507
  );
3505
3508
  return {
@@ -3526,10 +3529,10 @@ async function formFillHandler(payload, context) {
3526
3529
  };
3527
3530
  }
3528
3531
  function pressSubmitButton(context, registry) {
3529
- const activePath = context.activePath ?? chunkV3TUIIT2_js.getActiveRouteNames();
3532
+ const activePath = context.activePath ?? chunkPQHZTAFG_js.getActiveRouteNames();
3530
3533
  const hintScreen = context.screen ?? context.screenPath;
3531
3534
  const formScreens = resolveFormScreensForSubmit(hintScreen, activePath, registry);
3532
- const resolvedScreen = formScreens.find((name) => screenDeclaresSubmit(name)) ?? formScreens[0] ?? hintScreen ?? chunkV3TUIIT2_js.getCurrentScreen() ?? void 0;
3535
+ const resolvedScreen = formScreens.find((name) => screenDeclaresSubmit(name)) ?? formScreens[0] ?? hintScreen ?? chunkPQHZTAFG_js.getCurrentScreen() ?? void 0;
3533
3536
  const candidates = collectSubmitTargetCandidates(formScreens, registry);
3534
3537
  for (const candidate of candidates) {
3535
3538
  const target = registry.getTarget(candidate);
@@ -3550,7 +3553,7 @@ function pressSubmitButton(context, registry) {
3550
3553
  }
3551
3554
  }
3552
3555
  for (const screenName of formScreens) {
3553
- const screenMeta = chunkV3TUIIT2_js.getScreenMetadata(screenName);
3556
+ const screenMeta = chunkPQHZTAFG_js.getScreenMetadata(screenName);
3554
3557
  const submitMeta = Array.isArray(screenMeta?.actions) ? screenMeta.actions.find(
3555
3558
  (action) => typeof action === "object" && action !== null && action.type === "submit"
3556
3559
  ) : void 0;
@@ -3656,12 +3659,12 @@ function buildDiagnose(category, targetId, candidates) {
3656
3659
  return {
3657
3660
  category,
3658
3661
  targetId,
3659
- screen: chunkV3TUIIT2_js.getCurrentScreen() ?? void 0,
3662
+ screen: chunkPQHZTAFG_js.getCurrentScreen() ?? void 0,
3660
3663
  ...candidates && candidates.length > 0 ? { candidates: candidates.slice(0, 8) } : {}
3661
3664
  };
3662
3665
  }
3663
3666
  function resolveListEntry(listId) {
3664
- const entries = chunkV3TUIIT2_js.listRegistry.snapshot();
3667
+ const entries = chunkPQHZTAFG_js.listRegistry.snapshot();
3665
3668
  if (entries.length === 0) return {};
3666
3669
  if (listId) {
3667
3670
  const wanted = normalizeId2(listId);
@@ -3772,23 +3775,23 @@ function targetIdFromPayload(payload) {
3772
3775
  }
3773
3776
  async function waitForPostInteractionSettle(payload) {
3774
3777
  const targetId = targetIdFromPayload(payload);
3775
- const fromScreen = chunkV3TUIIT2_js.getCurrentScreen();
3776
- const baseline = chunkV3TUIIT2_js.probeLoadingState(targetId || null, fromScreen);
3778
+ const fromScreen = chunkPQHZTAFG_js.getCurrentScreen();
3779
+ const baseline = chunkPQHZTAFG_js.probeLoadingState(targetId || null, fromScreen);
3777
3780
  await sleepMs(100);
3778
- const afterPress = chunkV3TUIIT2_js.probeLoadingState(targetId || null, chunkV3TUIIT2_js.getCurrentScreen());
3781
+ const afterPress = chunkPQHZTAFG_js.probeLoadingState(targetId || null, chunkPQHZTAFG_js.getCurrentScreen());
3779
3782
  const modalOrLoading = afterPress.modalOpen || afterPress.loading || afterPress.pressedDisabled;
3780
3783
  const fingerprintChanged = afterPress.fingerprint !== baseline.fingerprint;
3781
- const capMs = chunkV3TUIIT2_js.isListItemPressTarget(targetId) ? 5e3 : 1e4;
3784
+ const capMs = chunkPQHZTAFG_js.isListItemPressTarget(targetId) ? 5e3 : 1e4;
3782
3785
  if (modalOrLoading || fingerprintChanged) {
3783
- await chunkV3TUIIT2_js.waitForLoadingSettle({
3786
+ await chunkPQHZTAFG_js.waitForLoadingSettle({
3784
3787
  pressedComponentId: targetId || null,
3785
3788
  fromScreen,
3786
3789
  maxMs: capMs
3787
3790
  });
3788
3791
  return;
3789
3792
  }
3790
- if (chunkV3TUIIT2_js.isListItemPressTarget(targetId)) {
3791
- await chunkV3TUIIT2_js.waitForLoadingSettle({
3793
+ if (chunkPQHZTAFG_js.isListItemPressTarget(targetId)) {
3794
+ await chunkPQHZTAFG_js.waitForLoadingSettle({
3792
3795
  fromScreen,
3793
3796
  maxMs: 3e3
3794
3797
  });
@@ -3808,7 +3811,7 @@ function validateActionPayload(action) {
3808
3811
  error: message,
3809
3812
  diagnose: {
3810
3813
  category: "validation",
3811
- screen: chunkV3TUIIT2_js.getCurrentScreen() ?? void 0,
3814
+ screen: chunkPQHZTAFG_js.getCurrentScreen() ?? void 0,
3812
3815
  ...ids ?? {}
3813
3816
  }
3814
3817
  });
@@ -3875,7 +3878,7 @@ async function executeAction(action, context) {
3875
3878
  let result;
3876
3879
  const validationFailure = validateActionPayload(action);
3877
3880
  if (validationFailure) {
3878
- chunkV3TUIIT2_js.appilotsDebugWarn(
3881
+ chunkPQHZTAFG_js.appilotsDebugWarn(
3879
3882
  `executeAction: payload validation failed for type="${action.type}" id="${action.id}": ${validationFailure.error}`
3880
3883
  );
3881
3884
  context.emit({
@@ -3902,13 +3905,13 @@ async function executeAction(action, context) {
3902
3905
  case "form_fill":
3903
3906
  result = await formFillHandler(action.payload, {
3904
3907
  permissions,
3905
- registry: context.registry ?? chunkV3TUIIT2_js.getDefaultRegistry()
3908
+ registry: context.registry ?? chunkPQHZTAFG_js.getDefaultRegistry()
3906
3909
  });
3907
3910
  break;
3908
3911
  case "ui_interaction":
3909
3912
  result = uiInteractionHandler(action.payload, {
3910
3913
  permissions,
3911
- registry: context.registry ?? chunkV3TUIIT2_js.getDefaultRegistry()
3914
+ registry: context.registry ?? chunkPQHZTAFG_js.getDefaultRegistry()
3912
3915
  });
3913
3916
  if (result.success) {
3914
3917
  await waitForPostInteractionSettle(action.payload);
@@ -3938,7 +3941,7 @@ async function executeAction(action, context) {
3938
3941
  };
3939
3942
  }
3940
3943
  } catch (err) {
3941
- chunkV3TUIIT2_js.appilotsDebugWarn(
3944
+ chunkPQHZTAFG_js.appilotsDebugWarn(
3942
3945
  `executeAction: exception during action type="${action.type}" id="${action.id}": ${err?.message}`
3943
3946
  );
3944
3947
  result = {
@@ -3964,35 +3967,35 @@ async function executeAction(action, context) {
3964
3967
  }
3965
3968
  var POST_ACTION_LOADING_MAX_MS = 6e3;
3966
3969
  function resolveScreenMetadata() {
3967
- const activePath = chunkV3TUIIT2_js.getActiveRouteNames();
3970
+ const activePath = chunkPQHZTAFG_js.getActiveRouteNames();
3968
3971
  for (let i = activePath.length - 1; i >= 0; i--) {
3969
3972
  const name = activePath[i];
3970
- const meta = name ? chunkV3TUIIT2_js.getScreenMetadata(name) : void 0;
3973
+ const meta = name ? chunkPQHZTAFG_js.getScreenMetadata(name) : void 0;
3971
3974
  if (meta && (Array.isArray(meta.fields) && meta.fields.length > 0 || Array.isArray(meta.actions) && meta.actions.length > 0)) {
3972
3975
  return meta;
3973
3976
  }
3974
3977
  }
3975
- const screen = chunkV3TUIIT2_js.getCurrentScreen();
3976
- return screen ? chunkV3TUIIT2_js.getScreenMetadata(screen) : void 0;
3978
+ const screen = chunkPQHZTAFG_js.getCurrentScreen();
3979
+ return screen ? chunkPQHZTAFG_js.getScreenMetadata(screen) : void 0;
3977
3980
  }
3978
3981
  function buildAgentContext(extras = {}) {
3979
3982
  const context = {};
3980
3983
  context.platform = "react-native";
3981
- const screen = chunkV3TUIIT2_js.getCurrentScreen();
3984
+ const screen = chunkPQHZTAFG_js.getCurrentScreen();
3982
3985
  if (screen) context.currentScreen = screen;
3983
- const navigationState = chunkV3TUIIT2_js.getNavigationStateSnapshot();
3986
+ const navigationState = chunkPQHZTAFG_js.getNavigationStateSnapshot();
3984
3987
  if (navigationState) context.navigationState = navigationState;
3985
3988
  const screenMeta = resolveScreenMetadata();
3986
3989
  if (screenMeta) context.screenMetadata = screenMeta;
3987
3990
  try {
3988
3991
  context.snapshot = captureSnapshot();
3989
3992
  } catch (err) {
3990
- chunkV3TUIIT2_js.appilotsDebugWarn("buildAgentContext: captureSnapshot failed", err);
3993
+ chunkPQHZTAFG_js.appilotsDebugWarn("buildAgentContext: captureSnapshot failed", err);
3991
3994
  }
3992
- const registry = chunkV3TUIIT2_js.componentRegistry.snapshot();
3995
+ const registry = chunkPQHZTAFG_js.componentRegistry.snapshot();
3993
3996
  const filtered = screen ? registry.filter((c) => !c.screen || c.screen === screen) : registry;
3994
3997
  if (filtered.length > 0) context.registeredComponents = filtered;
3995
- const registeredLists = chunkV3TUIIT2_js.listRegistry.snapshot();
3998
+ const registeredLists = chunkPQHZTAFG_js.listRegistry.snapshot();
3996
3999
  if (registeredLists.length > 0) {
3997
4000
  context.registeredLists = registeredLists.map(
3998
4001
  ({ scrollToIndex, scrollToOffset, getScrollMetrics, dataPreview, ...rest }) => rest
@@ -4009,12 +4012,12 @@ function resolveActionHints(screen, pressedComponentId, actionPayload) {
4009
4012
  }
4010
4013
  }
4011
4014
  if (!screen || !pressedComponentId) return void 0;
4012
- const meta = chunkV3TUIIT2_js.getScreenMetadata(screen);
4015
+ const meta = chunkPQHZTAFG_js.getScreenMetadata(screen);
4013
4016
  const actions = meta?.actions;
4014
4017
  if (!actions || actions.length === 0) return void 0;
4015
4018
  for (const a of actions) {
4016
4019
  if (typeof a === "string") continue;
4017
- if (chunkV3TUIIT2_js.idLooselyMatches(a.id, pressedComponentId)) {
4020
+ if (chunkPQHZTAFG_js.idLooselyMatches(a.id, pressedComponentId)) {
4018
4021
  const inferred = a.appilotsInferred;
4019
4022
  if (inferred && typeof inferred === "object") return inferred;
4020
4023
  return void 0;
@@ -4029,7 +4032,7 @@ async function settleTurn(input) {
4029
4032
  const successById = new Map(input.results.map((r) => [r.actionId, r.success]));
4030
4033
  const typeById = new Map(input.results.map((r) => [r.actionId, r.type]));
4031
4034
  if (input.hadNavigate) {
4032
- const settle = await chunkV3TUIIT2_js.waitForScreenSettle({
4035
+ const settle = await chunkPQHZTAFG_js.waitForScreenSettle({
4033
4036
  expectingChange: true,
4034
4037
  fromScreen: input.preNavigateScreen ?? null,
4035
4038
  fromSignature: input.preNavigateSignature ?? null,
@@ -4039,19 +4042,19 @@ async function settleTurn(input) {
4039
4042
  console.log(
4040
4043
  `[Appilots] settleTurn: post-navigate settle done \u2014 screen="${settle.screen}" transitioned=${settle.transitioned} timedOut=${settle.timedOut} waitedMs=${settle.waitedMs}`
4041
4044
  );
4042
- const navigationMoved = settle.transitioned || chunkV3TUIIT2_js.screenDepartedBaseline(
4045
+ const navigationMoved = settle.transitioned || chunkPQHZTAFG_js.screenDepartedBaseline(
4043
4046
  input.preNavigateScreen ?? null,
4044
4047
  input.preNavigateSignature ?? null
4045
- ) || !!navigateTargetScreen && !!settle.screen && chunkV3TUIIT2_js.routesBelongToSameFeature(settle.screen, navigateTargetScreen);
4048
+ ) || !!navigateTargetScreen && !!settle.screen && chunkPQHZTAFG_js.routesBelongToSameFeature(settle.screen, navigateTargetScreen);
4046
4049
  if (!navigationMoved) {
4047
- chunkV3TUIIT2_js.appilotsDebugWarn(
4050
+ chunkPQHZTAFG_js.appilotsDebugWarn(
4048
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.`
4049
4052
  );
4050
4053
  for (const [actionId, type] of typeById) {
4051
4054
  if (type === "navigate") toolWithoutEffectIds.add(actionId);
4052
4055
  }
4053
4056
  }
4054
- const loadSettle = await chunkV3TUIIT2_js.waitForLoadingSettle({
4057
+ const loadSettle = await chunkPQHZTAFG_js.waitForLoadingSettle({
4055
4058
  fromScreen: settle.screen ?? null,
4056
4059
  maxMs: 3e3
4057
4060
  });
@@ -4063,11 +4066,11 @@ async function settleTurn(input) {
4063
4066
  const pressedAction = turnActions.find(
4064
4067
  (a) => a.type === "ui_interaction" && a.payload?.componentId === pressedId
4065
4068
  );
4066
- const hints = resolveActionHints(chunkV3TUIIT2_js.getCurrentScreen(), pressedId, pressedAction?.payload);
4069
+ const hints = resolveActionHints(chunkPQHZTAFG_js.getCurrentScreen(), pressedId, pressedAction?.payload);
4067
4070
  const settleCapMs = hints?.isAsyncTrigger === true ? 1e4 : POST_ACTION_LOADING_MAX_MS;
4068
- const loadSettle = await chunkV3TUIIT2_js.waitForLoadingSettle({
4071
+ const loadSettle = await chunkPQHZTAFG_js.waitForLoadingSettle({
4069
4072
  pressedComponentId: pressedId,
4070
- fromScreen: chunkV3TUIIT2_js.getCurrentScreen(),
4073
+ fromScreen: chunkPQHZTAFG_js.getCurrentScreen(),
4071
4074
  maxMs: settleCapMs
4072
4075
  });
4073
4076
  console.log(
@@ -4075,23 +4078,23 @@ async function settleTurn(input) {
4075
4078
  );
4076
4079
  if (loadSettle.loadingPending) loadingPending = true;
4077
4080
  const listPressActions = turnActions.filter((action) => {
4078
- const target = chunkV3TUIIT2_js.actionPressTargetId(action);
4079
- return target ? chunkV3TUIIT2_js.isListItemPressTarget(target) : false;
4081
+ const target = chunkPQHZTAFG_js.actionPressTargetId(action);
4082
+ return target ? chunkPQHZTAFG_js.isListItemPressTarget(target) : false;
4080
4083
  });
4081
4084
  if (listPressActions.length > 0) {
4082
- const baselineFingerprint = chunkV3TUIIT2_js.probeLoadingState(pressedId, chunkV3TUIIT2_js.getCurrentScreen()).fingerprint;
4083
- const postPressSettle = await chunkV3TUIIT2_js.waitForScreenSettle({
4085
+ const baselineFingerprint = chunkPQHZTAFG_js.probeLoadingState(pressedId, chunkPQHZTAFG_js.getCurrentScreen()).fingerprint;
4086
+ const postPressSettle = await chunkPQHZTAFG_js.waitForScreenSettle({
4084
4087
  expectingChange: true,
4085
4088
  fromScreen: input.preNavigateScreen ?? null,
4086
4089
  fromSignature: input.preNavigateSignature ?? null,
4087
4090
  maxMs: 2500
4088
4091
  });
4089
- await chunkV3TUIIT2_js.waitForLoadingSettle({
4092
+ await chunkPQHZTAFG_js.waitForLoadingSettle({
4090
4093
  pressedComponentId: pressedId,
4091
- fromScreen: chunkV3TUIIT2_js.getCurrentScreen(),
4094
+ fromScreen: chunkPQHZTAFG_js.getCurrentScreen(),
4092
4095
  maxMs: 4e3
4093
4096
  });
4094
- const afterFingerprint = chunkV3TUIIT2_js.probeLoadingState(pressedId, chunkV3TUIIT2_js.getCurrentScreen()).fingerprint;
4097
+ const afterFingerprint = chunkPQHZTAFG_js.probeLoadingState(pressedId, chunkPQHZTAFG_js.getCurrentScreen()).fingerprint;
4095
4098
  console.log(
4096
4099
  `[Appilots] settleTurn: post-list-press settle \u2014 screen="${postPressSettle.screen}" transitioned=${postPressSettle.transitioned} timedOut=${postPressSettle.timedOut} waitedMs=${postPressSettle.waitedMs}`
4097
4100
  );
@@ -4108,8 +4111,8 @@ async function settleTurn(input) {
4108
4111
  }
4109
4112
  var reactNativeChatAdapter = {
4110
4113
  buildContext: buildAgentContext,
4111
- getCurrentScreen: chunkV3TUIIT2_js.getCurrentScreen,
4112
- getCurrentScreenSignature: chunkV3TUIIT2_js.getCurrentScreenSignature,
4114
+ getCurrentScreen: chunkPQHZTAFG_js.getCurrentScreen,
4115
+ getCurrentScreenSignature: chunkPQHZTAFG_js.getCurrentScreenSignature,
4113
4116
  settleTurn
4114
4117
  };
4115
4118
  async function runWithConfirmedDestructiveContext(enabled, fn) {
@@ -4145,7 +4148,7 @@ function createReactNativeActionRunner(getOptions) {
4145
4148
  return {
4146
4149
  async execute(action, { confirmedDestructive }) {
4147
4150
  const { permissions, emit, navigationRef } = getOptions();
4148
- const navRef = navigationRef?.current ? navigationRef : { current: chunkV3TUIIT2_js.getNavigationRef() };
4151
+ const navRef = navigationRef?.current ? navigationRef : { current: chunkPQHZTAFG_js.getNavigationRef() };
4149
4152
  return runWithConfirmedDestructiveContext(
4150
4153
  confirmedDestructive,
4151
4154
  () => executeAction(action, {
@@ -4155,21 +4158,21 @@ function createReactNativeActionRunner(getOptions) {
4155
4158
  })
4156
4159
  );
4157
4160
  },
4158
- getCurrentScreen: chunkV3TUIIT2_js.getCurrentScreen,
4159
- getCurrentScreenSignature: chunkV3TUIIT2_js.getCurrentScreenSignature,
4161
+ getCurrentScreen: chunkPQHZTAFG_js.getCurrentScreen,
4162
+ getCurrentScreenSignature: chunkPQHZTAFG_js.getCurrentScreenSignature,
4160
4163
  getScreenActionsMetadata(screen) {
4161
- return chunkV3TUIIT2_js.getScreenMetadata(screen)?.actions;
4164
+ return chunkPQHZTAFG_js.getScreenMetadata(screen)?.actions;
4162
4165
  },
4163
- waitForScreenSettle: chunkV3TUIIT2_js.waitForScreenSettle
4166
+ waitForScreenSettle: chunkPQHZTAFG_js.waitForScreenSettle
4164
4167
  };
4165
4168
  }
4166
4169
 
4167
4170
  // src/hooks/useAppilotsChat.ts
4168
4171
  function useAppilotsChat(options = {}) {
4169
- const { client, emit, subscribe } = chunkV3TUIIT2_js.useAppilotsContext();
4172
+ const { client, emit, subscribe } = chunkPQHZTAFG_js.useAppilotsContext();
4170
4173
  const machine = react.useMemo(
4171
- () => new chunkV3TUIIT2_js.ChatSessionMachine(
4172
- { client, adapter: reactNativeChatAdapter, emit, warn: chunkV3TUIIT2_js.appilotsDebugWarn },
4174
+ () => new chunkPQHZTAFG_js.ChatSessionMachine(
4175
+ { client, adapter: reactNativeChatAdapter, emit, warn: chunkPQHZTAFG_js.appilotsDebugWarn },
4173
4176
  options
4174
4177
  ),
4175
4178
  // A new machine per client/provider instance — options are pushed in
@@ -4212,7 +4215,7 @@ var DEFAULT_PERMISSIONS2 = {
4212
4215
  canSubmitForms: true
4213
4216
  };
4214
4217
  function useAppilotsActions(options = {}) {
4215
- const { client, subscribe, config, emit } = chunkV3TUIIT2_js.useAppilotsContext();
4218
+ const { client, subscribe, config, emit } = chunkPQHZTAFG_js.useAppilotsContext();
4216
4219
  const { navigationRef, autoExecute = false } = options;
4217
4220
  const runnerOptionsRef = react.useRef({
4218
4221
  permissions: config.permissions ?? DEFAULT_PERMISSIONS2,
@@ -4225,12 +4228,12 @@ function useAppilotsActions(options = {}) {
4225
4228
  navigationRef
4226
4229
  };
4227
4230
  const machine = react.useMemo(
4228
- () => new chunkV3TUIIT2_js.ActionQueueMachine(
4231
+ () => new chunkPQHZTAFG_js.ActionQueueMachine(
4229
4232
  {
4230
4233
  client,
4231
4234
  adapter: createReactNativeActionRunner(() => runnerOptionsRef.current),
4232
4235
  emit,
4233
- warn: chunkV3TUIIT2_js.appilotsDebugWarn
4236
+ warn: chunkPQHZTAFG_js.appilotsDebugWarn
4234
4237
  },
4235
4238
  { autoExecute }
4236
4239
  ),
@@ -4287,7 +4290,7 @@ function shouldShowSuggestedPrompts(args) {
4287
4290
 
4288
4291
  // src/hooks/useSuggestedPrompts.ts
4289
4292
  function useSuggestedPrompts(options) {
4290
- const { client } = chunkV3TUIIT2_js.useAppilotsContext();
4293
+ const { client } = chunkPQHZTAFG_js.useAppilotsContext();
4291
4294
  const { enabled, limit = 4 } = options;
4292
4295
  const [prompts, setPrompts] = react.useState([]);
4293
4296
  const [isLoading, setIsLoading] = react.useState(false);
@@ -4297,8 +4300,8 @@ function useSuggestedPrompts(options) {
4297
4300
  if (!enabled) return;
4298
4301
  const requestId = ++requestIdRef.current;
4299
4302
  let cancelled = false;
4300
- const screen = chunkV3TUIIT2_js.getCurrentScreen() ?? void 0;
4301
- const localDev = screen ? (chunkV3TUIIT2_js.getScreenMetadata(screen)?.suggestedPrompts ?? []).map((text) => ({
4303
+ const screen = chunkPQHZTAFG_js.getCurrentScreen() ?? void 0;
4304
+ const localDev = screen ? (chunkPQHZTAFG_js.getScreenMetadata(screen)?.suggestedPrompts ?? []).map((text) => ({
4302
4305
  text,
4303
4306
  source: "dev-defined"
4304
4307
  })) : [];
@@ -4323,9 +4326,9 @@ function useSuggestedPrompts(options) {
4323
4326
  }, [client, enabled, limit, refreshTick]);
4324
4327
  react.useEffect(() => {
4325
4328
  if (!enabled) return;
4326
- let lastScreen = chunkV3TUIIT2_js.getCurrentScreen();
4329
+ let lastScreen = chunkPQHZTAFG_js.getCurrentScreen();
4327
4330
  const interval = setInterval(() => {
4328
- const current = chunkV3TUIIT2_js.getCurrentScreen();
4331
+ const current = chunkPQHZTAFG_js.getCurrentScreen();
4329
4332
  if (current !== lastScreen) {
4330
4333
  lastScreen = current;
4331
4334
  setRefreshTick((t) => t + 1);
@@ -4340,14 +4343,14 @@ function useSuggestedPrompts(options) {
4340
4343
  };
4341
4344
  }
4342
4345
  function useAppilotsNavigation() {
4343
- const { emit } = chunkV3TUIIT2_js.useAppilotsContext();
4346
+ const { emit } = chunkPQHZTAFG_js.useAppilotsContext();
4344
4347
  const [currentScreen, setCurrentScreenState] = react.useState(null);
4345
4348
  const [navigationHistory, setNavigationHistory] = react.useState([]);
4346
4349
  const navigationRef = react.useRef(null);
4347
4350
  const setCurrentScreen2 = react.useCallback(
4348
4351
  (screenName) => {
4349
4352
  setCurrentScreenState(screenName);
4350
- chunkV3TUIIT2_js.setCurrentScreen(screenName);
4353
+ chunkPQHZTAFG_js.setCurrentScreen(screenName);
4351
4354
  setNavigationHistory((prev) => [...prev, screenName]);
4352
4355
  emit({
4353
4356
  type: "navigation:change",
@@ -4378,7 +4381,7 @@ function useAppilotsNavigation() {
4378
4381
 
4379
4382
  // src/hooks/useAppilots.ts
4380
4383
  function useAppilots() {
4381
- const { config, client } = chunkV3TUIIT2_js.useAppilotsContext();
4384
+ const { config, client } = chunkPQHZTAFG_js.useAppilotsContext();
4382
4385
  const chat = useAppilotsChat();
4383
4386
  const navigation = useAppilotsNavigation();
4384
4387
  const actions = useAppilotsActions();
@@ -4407,7 +4410,7 @@ function useAppilots() {
4407
4410
  }
4408
4411
  function useAppilotsField(id, options) {
4409
4412
  const { value, onChangeText, ref, fieldType, label, screen } = options;
4410
- const registry = chunkV3TUIIT2_js.useResolvedRegistry();
4413
+ const registry = chunkPQHZTAFG_js.useResolvedRegistry();
4411
4414
  const valueRef = react.useRef(value);
4412
4415
  const onChangeRef = react.useRef(onChangeText);
4413
4416
  valueRef.current = value;
@@ -4435,7 +4438,7 @@ function useAppilotsField(id, options) {
4435
4438
  }
4436
4439
  function useAppilotsTarget(id, options) {
4437
4440
  const { onPress, onLongPress, onScrollTo, label, screen } = options;
4438
- const registry = chunkV3TUIIT2_js.useResolvedRegistry();
4441
+ const registry = chunkPQHZTAFG_js.useResolvedRegistry();
4439
4442
  const onPressRef = react.useRef(onPress);
4440
4443
  const onLongPressRef = react.useRef(onLongPress);
4441
4444
  const onScrollToRef = react.useRef(onScrollTo);
@@ -4462,7 +4465,7 @@ function useAppilotsTarget(id, options) {
4462
4465
  }
4463
4466
  function useAppilotsToggle(id, options) {
4464
4467
  const { value, onValueChange, label, screen } = options;
4465
- const registry = chunkV3TUIIT2_js.useResolvedRegistry();
4468
+ const registry = chunkPQHZTAFG_js.useResolvedRegistry();
4466
4469
  const valueRef = react.useRef(value);
4467
4470
  const onChangeRef = react.useRef(onValueChange);
4468
4471
  valueRef.current = value;
@@ -4485,7 +4488,7 @@ function useAppilotsToggle(id, options) {
4485
4488
  }
4486
4489
  function useAppilotsSlider(id, options) {
4487
4490
  const { value, onValueChange, min, max, step, label, screen } = options;
4488
- const registry = chunkV3TUIIT2_js.useResolvedRegistry();
4491
+ const registry = chunkPQHZTAFG_js.useResolvedRegistry();
4489
4492
  const valueRef = react.useRef(value);
4490
4493
  const onChangeRef = react.useRef(onValueChange);
4491
4494
  valueRef.current = value;