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