@appilots/sdk 0.2.0 → 0.3.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 chunkSIBKF7AA_js = require('./chunk-SIBKF7AA.js');
3
+ var chunkMCY5YFYD_js = require('./chunk-MCY5YFYD.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: chunkSIBKF7AA_js.getCurrentScreen(),
498
+ route: chunkMCY5YFYD_js.getCurrentScreen(),
499
499
  texts: [],
500
500
  inputs: [],
501
501
  buttons: [],
@@ -890,9 +890,9 @@ function fiberSliderMatches(fiber, registryId, registryLabel) {
890
890
  function reconcileSliders(snapshot) {
891
891
  const fiberSliders = snapshot.sliders;
892
892
  const out = [];
893
- for (const { id, kind } of chunkSIBKF7AA_js.componentRegistry.snapshot()) {
893
+ for (const { id, kind } of chunkMCY5YFYD_js.componentRegistry.snapshot()) {
894
894
  if (kind !== "slider") continue;
895
- const entry = chunkSIBKF7AA_js.componentRegistry.getSlider(id);
895
+ const entry = chunkMCY5YFYD_js.componentRegistry.getSlider(id);
896
896
  if (!entry) continue;
897
897
  const fiber = fiberSliders.find((s) => fiberSliderMatches(s, id, entry.label));
898
898
  const visible = !!fiber || typeof entry.screen === "string" && entry.screen === snapshot.route;
@@ -916,7 +916,7 @@ function reconcileSliders(snapshot) {
916
916
  snapshot.sliders = out;
917
917
  }
918
918
  function mergeRegisteredLists(snapshot) {
919
- const registered = chunkSIBKF7AA_js.listRegistry.snapshot();
919
+ const registered = chunkMCY5YFYD_js.listRegistry.snapshot();
920
920
  if (registered.length === 0) return;
921
921
  const byId = /* @__PURE__ */ new Map();
922
922
  for (const list of snapshot.lists) {
@@ -964,13 +964,13 @@ function mergeRegisteredLists(snapshot) {
964
964
  }
965
965
  }
966
966
  function captureSnapshot() {
967
- const root = chunkSIBKF7AA_js.getFiberRoot();
967
+ const root = chunkMCY5YFYD_js.getFiberRoot();
968
968
  if (!root) {
969
969
  console.warn(
970
970
  "[Appilots] captureSnapshot: fiber root not captured yet. Ensure <AppilotsProvider> has rendered before calling this."
971
971
  );
972
972
  return {
973
- route: chunkSIBKF7AA_js.getCurrentScreen(),
973
+ route: chunkMCY5YFYD_js.getCurrentScreen(),
974
974
  texts: [],
975
975
  inputs: [],
976
976
  buttons: [],
@@ -985,7 +985,7 @@ function captureSnapshot() {
985
985
  }
986
986
  const start = Date.now();
987
987
  const snapshot = walkFiber(root);
988
- const activePath = chunkSIBKF7AA_js.getActiveRouteNames();
988
+ const activePath = chunkMCY5YFYD_js.getActiveRouteNames();
989
989
  const deepestRoute = activePath[activePath.length - 1];
990
990
  if (deepestRoute) snapshot.route = deepestRoute;
991
991
  mergeRegisteredLists(snapshot);
@@ -995,7 +995,7 @@ function captureSnapshot() {
995
995
  snapshot.choiceGroups,
996
996
  snapshot.elements
997
997
  );
998
- chunkSIBKF7AA_js.elementRegistry.replaceAll(snapshot.elements);
998
+ chunkMCY5YFYD_js.elementRegistry.replaceAll(snapshot.elements);
999
999
  const elapsed = Date.now() - start;
1000
1000
  const totalListItems = snapshot.lists.reduce(
1001
1001
  (acc, l) => acc + l.items.length,
@@ -1188,7 +1188,7 @@ function wrapTouchable(fiber, label) {
1188
1188
  };
1189
1189
  }
1190
1190
  function findInteractiveByIdentifier(query, options = {}) {
1191
- const root = chunkSIBKF7AA_js.getFiberRoot();
1191
+ const root = chunkMCY5YFYD_js.getFiberRoot();
1192
1192
  if (!root) {
1193
1193
  console.warn("[Appilots] findInteractiveByIdentifier: fiber root not captured yet");
1194
1194
  return null;
@@ -1234,27 +1234,6 @@ function findInteractiveByIdentifier(query, options = {}) {
1234
1234
  return bestHandle;
1235
1235
  }
1236
1236
 
1237
- // src/hooks/fingerprint.ts
1238
- function fingerprintAction(action, screen) {
1239
- const p = action.payload ?? {};
1240
- const scope = `@${screen ?? "?"}`;
1241
- switch (action.type) {
1242
- case "navigate":
1243
- return `navigate${scope}:${p.screenName ?? "?"}`;
1244
- case "form_fill": {
1245
- const fields = p.fields ?? [];
1246
- const ids = fields.map((f) => String(f?.fieldId ?? "?")).sort();
1247
- return `form_fill${scope}:${ids.join(",")}`;
1248
- }
1249
- case "ui_interaction":
1250
- return `ui_interaction${scope}:${p.action ?? "?"}:${p.componentId ?? p.targetId ?? "?"}`;
1251
- case "confirm":
1252
- return `confirm${scope}:${p.message ?? p.title ?? "?"}`;
1253
- default:
1254
- return `${action.type}${scope}:${JSON.stringify(p)}`;
1255
- }
1256
- }
1257
-
1258
1237
  // src/hooks/visibleMessages.ts
1259
1238
  var INTERNAL_MARKER_RE = /^\[(?:Permission policy notice|Recovery exhausted|User rejected the proposed action)[^\]]*\]:\s*/i;
1260
1239
  var TECHNICAL_TRACE_RE = /(^|\n)\s*(?:Results:|[-*]\s*[✓✗]\s+|(?:press|click|tap|navigate|form_fill|ui_interaction|scroll_list)\b|(?:Cliquei|Clicked)\s+em\s+(?:el:|list-\d+-item-\d+|[A-Za-z]+:))/i;
@@ -1281,61 +1260,6 @@ function isInternalTraceMessage(message) {
1281
1260
  return TECHNICAL_TRACE_RE.test(content) || TECHNICAL_SELECTOR_RE.test(content);
1282
1261
  }
1283
1262
 
1284
- // src/hooks/continuationErrors.ts
1285
- function normalize2(value) {
1286
- return value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[‘’]/g, "'").toLowerCase();
1287
- }
1288
- function detectLocaleFromUserTexts(texts) {
1289
- for (const raw of texts) {
1290
- const normalized = normalize2(raw);
1291
- if (/[ãõáéíóúâêôç]/i.test(raw) || /\b(voce|voces|pra|assinatura|cancela|canela|segunda|certo|quais|tenho|pode|posso)\b/.test(
1292
- normalized
1293
- )) {
1294
- return "pt";
1295
- }
1296
- if (/[áéíóúñ¿¡]/i.test(raw) || /\b(cancela|segunda|suscripcion|puedo|cuales|hola)\b/.test(normalized)) {
1297
- return "es";
1298
- }
1299
- if (/[àâçéèêëîïôûùüÿœ]/i.test(raw) || /\b(annuler|deuxieme|abonnement|bonjour)\b/.test(normalized)) {
1300
- return "fr";
1301
- }
1302
- }
1303
- return "en";
1304
- }
1305
- var copy = {
1306
- pt: {
1307
- rateLimit: "O provedor de IA atingiu o limite de uso durante a automa\xE7\xE3o. Aguarde um momento e pe\xE7a para continuar, ou aumente o limite de tokens por minuto.",
1308
- invalidInput: "N\xE3o consegui continuar a automa\xE7\xE3o por um problema interno de sincroniza\xE7\xE3o. Pode tentar de novo ou fazer essa parte manualmente?",
1309
- generic: (detail) => `Perdi o fio da automa\xE7\xE3o (${detail}). Pode continuar manualmente ou me pedir de novo?`
1310
- },
1311
- es: {
1312
- rateLimit: "El proveedor de IA alcanz\xF3 su l\xEDmite de uso durante la automatizaci\xF3n. Espera un momento y p\xEDdeme continuar, o aumenta el l\xEDmite de tokens por minuto.",
1313
- invalidInput: "No pude continuar la automatizaci\xF3n por un problema interno de sincronizaci\xF3n. \xBFPuedes intentarlo de nuevo o hacer esta parte manualmente?",
1314
- generic: (detail) => `Perd\xED el hilo de la automatizaci\xF3n (${detail}). \xBFPuedes continuar manualmente o ped\xEDrmelo de nuevo?`
1315
- },
1316
- fr: {
1317
- rateLimit: "Le fournisseur d'IA a atteint sa limite d'utilisation pendant l'automatisation. Attendez un instant et demandez-moi de continuer, ou augmentez la limite de tokens par minute.",
1318
- invalidInput: "Je n'ai pas pu poursuivre l'automatisation \xE0 cause d'un probl\xE8me interne de synchronisation. Pouvez-vous r\xE9essayer ou faire cette \xE9tape manuellement ?",
1319
- generic: (detail) => `J'ai perdu le fil de l'automatisation (${detail}). Vous pouvez continuer manuellement ou me redemander ?`
1320
- },
1321
- en: {
1322
- rateLimit: "Your AI provider hit its rate limit during automation. Wait a moment and ask me to continue, or raise your TPM limit.",
1323
- invalidInput: "I could not continue the automation because of an internal sync issue. You can try again or take over manually.",
1324
- generic: (detail) => `I lost my footing during automation (${detail}). You can take over from here.`
1325
- }
1326
- };
1327
- function buildContinuationFailureMessage(rawError, recentUserTexts) {
1328
- const locale = detectLocaleFromUserTexts(recentUserTexts);
1329
- const strings = copy[locale] ?? copy.en;
1330
- if (/rate limit|tokens per min|tpm/i.test(rawError)) {
1331
- return strings.rateLimit;
1332
- }
1333
- if (/invalid input|validation_error|422/i.test(rawError)) {
1334
- return strings.invalidInput;
1335
- }
1336
- return strings.generic(rawError);
1337
- }
1338
-
1339
1263
  // src/executor/formWriteEffect.ts
1340
1264
  var CREATE_FORM_ROUTE_RE = /vehiclecreate|subscriptioncreate|vehicleedit|subscriptionedit|maintenancecreate|create|cadastr|register|novo|edit/i;
1341
1265
  var SUBMIT_BUTTON_RE = /cadastrar|registrar|salvar|submit|register|guardar|enviar|confirmar|save/i;
@@ -1383,63 +1307,38 @@ function formFillLackedWriteEffect(action, snap, activePath = []) {
1383
1307
  return Array.isArray(payload?.fields) && payload.fields.length > 0;
1384
1308
  }
1385
1309
 
1386
- // src/introspection/actionTargets.ts
1387
- var LIST_ITEM_TARGET_RE = /^list-\d+-item-\d+$/i;
1388
- var DESTRUCTIVE_LABEL_RE = /\b(cancelar?\w*|cancel(?:ar|led|ation|amento)?|delete\w*|exclu\w*|delet\w*|remov\w*|remove|apag\w*|destroy\w*|unsubscribe\w*)\b/i;
1389
- function isListItemPressTarget(value) {
1390
- if (typeof value !== "string" || !value.trim()) return false;
1391
- return LIST_ITEM_TARGET_RE.test(value.trim());
1392
- }
1393
- function looksDestructiveActionLabel(value) {
1394
- if (typeof value !== "string" || !value.trim()) return false;
1395
- return DESTRUCTIVE_LABEL_RE.test(value.trim());
1396
- }
1397
-
1398
- // src/hooks/turnContinuation.ts
1399
- function actionPressTargetId(action) {
1400
- if (action.type !== "ui_interaction") return null;
1401
- const payload = action.payload;
1402
- const componentId = payload?.componentId;
1403
- if (typeof componentId === "string" && componentId.trim()) return componentId.trim();
1404
- const targetId = payload?.targetId;
1405
- if (typeof targetId === "string" && targetId.trim()) return targetId.trim();
1406
- return null;
1407
- }
1408
- function turnHasConfirmActions(actions) {
1409
- return actions.some((action) => action.type === "confirm");
1410
- }
1411
-
1412
1310
  // src/hooks/useAppilotsChat.ts
1413
1311
  var ESCALATION_RECONNECT_MAX_MS = 3e4;
1414
1312
  function resolveScreenMetadata() {
1415
- const activePath = chunkSIBKF7AA_js.getActiveRouteNames();
1313
+ const activePath = chunkMCY5YFYD_js.getActiveRouteNames();
1416
1314
  for (let i = activePath.length - 1; i >= 0; i--) {
1417
1315
  const name = activePath[i];
1418
- const meta = name ? chunkSIBKF7AA_js.getScreenMetadata(name) : void 0;
1316
+ const meta = name ? chunkMCY5YFYD_js.getScreenMetadata(name) : void 0;
1419
1317
  if (meta && (Array.isArray(meta.fields) && meta.fields.length > 0 || Array.isArray(meta.actions) && meta.actions.length > 0)) {
1420
1318
  return meta;
1421
1319
  }
1422
1320
  }
1423
- const screen = chunkSIBKF7AA_js.getCurrentScreen();
1424
- return screen ? chunkSIBKF7AA_js.getScreenMetadata(screen) : void 0;
1321
+ const screen = chunkMCY5YFYD_js.getCurrentScreen();
1322
+ return screen ? chunkMCY5YFYD_js.getScreenMetadata(screen) : void 0;
1425
1323
  }
1426
1324
  function buildAgentContext(extras = {}) {
1427
1325
  const context = {};
1428
- const screen = chunkSIBKF7AA_js.getCurrentScreen();
1326
+ context.platform = "react-native";
1327
+ const screen = chunkMCY5YFYD_js.getCurrentScreen();
1429
1328
  if (screen) context.currentScreen = screen;
1430
- const navigationState = chunkSIBKF7AA_js.getNavigationStateSnapshot();
1329
+ const navigationState = chunkMCY5YFYD_js.getNavigationStateSnapshot();
1431
1330
  if (navigationState) context.navigationState = navigationState;
1432
1331
  const screenMeta = resolveScreenMetadata();
1433
1332
  if (screenMeta) context.screenMetadata = screenMeta;
1434
1333
  try {
1435
1334
  context.snapshot = captureSnapshot();
1436
1335
  } catch (err) {
1437
- chunkSIBKF7AA_js.appilotsDebugWarn("buildAgentContext: captureSnapshot failed", err);
1336
+ chunkMCY5YFYD_js.appilotsDebugWarn("buildAgentContext: captureSnapshot failed", err);
1438
1337
  }
1439
- const registry = chunkSIBKF7AA_js.componentRegistry.snapshot();
1338
+ const registry = chunkMCY5YFYD_js.componentRegistry.snapshot();
1440
1339
  const filtered = screen ? registry.filter((c) => !c.screen || c.screen === screen) : registry;
1441
1340
  if (filtered.length > 0) context.registeredComponents = filtered;
1442
- const registeredLists = chunkSIBKF7AA_js.listRegistry.snapshot();
1341
+ const registeredLists = chunkMCY5YFYD_js.listRegistry.snapshot();
1443
1342
  if (registeredLists.length > 0) {
1444
1343
  context.registeredLists = registeredLists.map(
1445
1344
  ({ scrollToIndex, scrollToOffset, getScrollMetrics, dataPreview, ...rest }) => rest
@@ -1485,7 +1384,7 @@ function resolveActionHints(screen, pressedComponentId, actionPayload) {
1485
1384
  }
1486
1385
  }
1487
1386
  if (!screen || !pressedComponentId) return void 0;
1488
- const meta = chunkSIBKF7AA_js.getScreenMetadata(screen);
1387
+ const meta = chunkMCY5YFYD_js.getScreenMetadata(screen);
1489
1388
  const actions = meta?.actions;
1490
1389
  if (!actions || actions.length === 0) return void 0;
1491
1390
  for (const a of actions) {
@@ -1525,7 +1424,7 @@ function summarizeAction(action) {
1525
1424
  var MAX_RECOVERY_ATTEMPTS_PER_ACTION = 2;
1526
1425
  var POST_ACTION_LOADING_MAX_MS = 6e3;
1527
1426
  function useAppilotsChat(options = {}) {
1528
- const { client, emit, subscribe } = chunkSIBKF7AA_js.useAppilotsContext();
1427
+ const { client, emit, subscribe } = chunkMCY5YFYD_js.useAppilotsContext();
1529
1428
  const errorPrefix = options.errorPrefix ?? "Algo deu errado";
1530
1429
  const streamingEnabled = options.streaming !== false;
1531
1430
  const abortRef = react.useRef(null);
@@ -1555,7 +1454,7 @@ function useAppilotsChat(options = {}) {
1555
1454
  const visibleContent = message.role === "assistant" ? sanitizeVisibleAssistantContent(message.content) : message.content;
1556
1455
  const candidate = { ...message, content: visibleContent };
1557
1456
  if (isInternalTraceMessage(candidate)) {
1558
- chunkSIBKF7AA_js.recordAppilotsDebugTrace({
1457
+ chunkMCY5YFYD_js.recordAppilotsDebugTrace({
1559
1458
  type: "agent:trace",
1560
1459
  timestamp: Date.now(),
1561
1460
  messageId: candidate.id,
@@ -1707,18 +1606,18 @@ function useAppilotsChat(options = {}) {
1707
1606
  // Snapshot the current screen NOW, before any navigate
1708
1607
  // dispatches. waitForScreenSettle will use this as the
1709
1608
  // baseline to detect that the navigate completed.
1710
- preNavigateScreen: chunkSIBKF7AA_js.getCurrentScreen(),
1609
+ preNavigateScreen: chunkMCY5YFYD_js.getCurrentScreen(),
1711
1610
  // Full route+params signature — lets settle detect navigate
1712
1611
  // to the same route name with different params.
1713
- preNavigateSignature: chunkSIBKF7AA_js.getCurrentScreenSignature()
1612
+ preNavigateSignature: chunkMCY5YFYD_js.getCurrentScreenSignature()
1714
1613
  };
1715
- const originScreen = chunkSIBKF7AA_js.getCurrentScreen() ?? void 0;
1614
+ const originScreen = chunkMCY5YFYD_js.getCurrentScreen() ?? void 0;
1716
1615
  for (const a of stamped) {
1717
1616
  turn.results.set(a.id, {
1718
1617
  type: a.type,
1719
1618
  success: false,
1720
1619
  summary: summarizeAction(a),
1721
- fingerprint: fingerprintAction(a, originScreen)
1620
+ fingerprint: chunkMCY5YFYD_js.fingerprintAction(a, originScreen)
1722
1621
  });
1723
1622
  }
1724
1623
  currentTurnRef.current = turn;
@@ -1729,7 +1628,7 @@ function useAppilotsChat(options = {}) {
1729
1628
  data: { action }
1730
1629
  });
1731
1630
  }
1732
- if (turnHasConfirmActions(stamped)) {
1631
+ if (chunkMCY5YFYD_js.turnHasConfirmActions(stamped)) {
1733
1632
  setIsLoading(false);
1734
1633
  setLoadingStatusKey("thinking");
1735
1634
  }
@@ -1745,7 +1644,7 @@ function useAppilotsChat(options = {}) {
1745
1644
  type: stamped.type,
1746
1645
  success: false,
1747
1646
  summary: summarizeAction(stamped),
1748
- fingerprint: fingerprintAction(stamped, chunkSIBKF7AA_js.getCurrentScreen() ?? void 0)
1647
+ fingerprint: chunkMCY5YFYD_js.fingerprintAction(stamped, chunkMCY5YFYD_js.getCurrentScreen() ?? void 0)
1749
1648
  });
1750
1649
  setPendingActions((prev) => {
1751
1650
  if (prev.some((candidate) => candidate.id === stamped.id)) return prev;
@@ -1771,7 +1670,7 @@ function useAppilotsChat(options = {}) {
1771
1670
  const pressedId = extractPressedComponentId(turnActions);
1772
1671
  const navigateTargetScreen = extractNavigateTargetScreen(turnActions);
1773
1672
  if (turn.hadNavigate) {
1774
- const settle = await chunkSIBKF7AA_js.waitForScreenSettle({
1673
+ const settle = await chunkMCY5YFYD_js.waitForScreenSettle({
1775
1674
  expectingChange: true,
1776
1675
  fromScreen: turn.preNavigateScreen ?? null,
1777
1676
  fromSignature: turn.preNavigateSignature ?? null,
@@ -1781,9 +1680,9 @@ function useAppilotsChat(options = {}) {
1781
1680
  console.log(
1782
1681
  `[Appilots] runContinuation: post-navigate settle done \u2014 screen="${settle.screen}" transitioned=${settle.transitioned} timedOut=${settle.timedOut} waitedMs=${settle.waitedMs}`
1783
1682
  );
1784
- const navigationMoved = settle.transitioned || chunkSIBKF7AA_js.screenDepartedBaseline(turn.preNavigateScreen ?? null, turn.preNavigateSignature ?? null) || !!navigateTargetScreen && !!settle.screen && chunkSIBKF7AA_js.routesBelongToSameFeature(settle.screen, navigateTargetScreen);
1683
+ const navigationMoved = settle.transitioned || chunkMCY5YFYD_js.screenDepartedBaseline(turn.preNavigateScreen ?? null, turn.preNavigateSignature ?? null) || !!navigateTargetScreen && !!settle.screen && chunkMCY5YFYD_js.routesBelongToSameFeature(settle.screen, navigateTargetScreen);
1785
1684
  if (!navigationMoved) {
1786
- chunkSIBKF7AA_js.appilotsDebugWarn(
1685
+ chunkMCY5YFYD_js.appilotsDebugWarn(
1787
1686
  `tool-without-effect: navigate emitted but screen did not change (stayed at "${turn.preNavigateScreen ?? "unknown"}", waitedMs=${settle.waitedMs}). Likely causes: target screenName missing from MCP doc, nested-nav path absent, or React Navigation rejected the route.`
1788
1687
  );
1789
1688
  for (const actionId of turn.actionIds) {
@@ -1793,7 +1692,7 @@ function useAppilotsChat(options = {}) {
1793
1692
  }
1794
1693
  }
1795
1694
  }
1796
- const loadSettle = await chunkSIBKF7AA_js.waitForLoadingSettle({
1695
+ const loadSettle = await chunkMCY5YFYD_js.waitForLoadingSettle({
1797
1696
  fromScreen: settle.screen ?? null,
1798
1697
  maxMs: 3e3
1799
1698
  });
@@ -1806,14 +1705,14 @@ function useAppilotsChat(options = {}) {
1806
1705
  (a) => a.type === "ui_interaction" && a.payload?.componentId === pressedId
1807
1706
  );
1808
1707
  const hints = resolveActionHints(
1809
- chunkSIBKF7AA_js.getCurrentScreen(),
1708
+ chunkMCY5YFYD_js.getCurrentScreen(),
1810
1709
  pressedId,
1811
1710
  pressedAction?.payload
1812
1711
  );
1813
1712
  const settleCapMs = hints?.isAsyncTrigger === true ? 1e4 : POST_ACTION_LOADING_MAX_MS;
1814
- const loadSettle = await chunkSIBKF7AA_js.waitForLoadingSettle({
1713
+ const loadSettle = await chunkMCY5YFYD_js.waitForLoadingSettle({
1815
1714
  pressedComponentId: pressedId,
1816
- fromScreen: chunkSIBKF7AA_js.getCurrentScreen(),
1715
+ fromScreen: chunkMCY5YFYD_js.getCurrentScreen(),
1817
1716
  maxMs: settleCapMs
1818
1717
  });
1819
1718
  console.log(
@@ -1821,28 +1720,28 @@ function useAppilotsChat(options = {}) {
1821
1720
  );
1822
1721
  if (loadSettle.loadingPending) loadingPending = true;
1823
1722
  const listPressActions = turnActions.filter((action) => {
1824
- const target = actionPressTargetId(action);
1825
- return target ? isListItemPressTarget(target) : false;
1723
+ const target = chunkMCY5YFYD_js.actionPressTargetId(action);
1724
+ return target ? chunkMCY5YFYD_js.isListItemPressTarget(target) : false;
1826
1725
  });
1827
1726
  if (listPressActions.length > 0) {
1828
- const baselineFingerprint = chunkSIBKF7AA_js.probeLoadingState(
1727
+ const baselineFingerprint = chunkMCY5YFYD_js.probeLoadingState(
1829
1728
  pressedId,
1830
- chunkSIBKF7AA_js.getCurrentScreen()
1729
+ chunkMCY5YFYD_js.getCurrentScreen()
1831
1730
  ).fingerprint;
1832
- const postPressSettle = await chunkSIBKF7AA_js.waitForScreenSettle({
1731
+ const postPressSettle = await chunkMCY5YFYD_js.waitForScreenSettle({
1833
1732
  expectingChange: true,
1834
1733
  fromScreen: turn.preNavigateScreen ?? null,
1835
1734
  fromSignature: turn.preNavigateSignature ?? null,
1836
1735
  maxMs: 2500
1837
1736
  });
1838
- await chunkSIBKF7AA_js.waitForLoadingSettle({
1737
+ await chunkMCY5YFYD_js.waitForLoadingSettle({
1839
1738
  pressedComponentId: pressedId,
1840
- fromScreen: chunkSIBKF7AA_js.getCurrentScreen(),
1739
+ fromScreen: chunkMCY5YFYD_js.getCurrentScreen(),
1841
1740
  maxMs: 4e3
1842
1741
  });
1843
- const afterFingerprint = chunkSIBKF7AA_js.probeLoadingState(
1742
+ const afterFingerprint = chunkMCY5YFYD_js.probeLoadingState(
1844
1743
  pressedId,
1845
- chunkSIBKF7AA_js.getCurrentScreen()
1744
+ chunkMCY5YFYD_js.getCurrentScreen()
1846
1745
  ).fingerprint;
1847
1746
  console.log(
1848
1747
  `[Appilots] runContinuation: post-list-press settle \u2014 screen="${postPressSettle.screen}" transitioned=${postPressSettle.transitioned} timedOut=${postPressSettle.timedOut} waitedMs=${postPressSettle.waitedMs}`
@@ -1864,7 +1763,7 @@ function useAppilotsChat(options = {}) {
1864
1763
  const result = turn.results.get(action.id);
1865
1764
  if (result?.success && formFillLackedWriteEffect(action, snap, activePath)) {
1866
1765
  toolWithoutEffectIds.add(action.id);
1867
- chunkSIBKF7AA_js.appilotsDebugWarn(
1766
+ chunkMCY5YFYD_js.appilotsDebugWarn(
1868
1767
  `tool-without-effect: form_fill succeeded but create form is still open (actionId="${action.id}")`
1869
1768
  );
1870
1769
  }
@@ -1933,9 +1832,9 @@ function useAppilotsChat(options = {}) {
1933
1832
  beginTurn(response.message.id, response.actions, response.hop);
1934
1833
  } catch (err) {
1935
1834
  const raw = err instanceof Error ? err.message : "Continuation failed";
1936
- chunkSIBKF7AA_js.appilotsDebugWarn("useAppilotsChat: continuation failed \u2014", raw);
1835
+ chunkMCY5YFYD_js.appilotsDebugWarn("useAppilotsChat: continuation failed \u2014", raw);
1937
1836
  const recentUserTexts = messagesRef.current.filter((m) => m.role === "user").slice(-4).map((m) => m.content);
1938
- const friendly = buildContinuationFailureMessage(raw, recentUserTexts);
1837
+ const friendly = chunkMCY5YFYD_js.buildContinuationFailureMessage(raw, recentUserTexts);
1939
1838
  addAssistantMessage({
1940
1839
  id: `error_${++messageIdCounter.current}`,
1941
1840
  role: "assistant",
@@ -2058,7 +1957,7 @@ function useAppilotsChat(options = {}) {
2058
1957
  }
2059
1958
  });
2060
1959
  } catch (err) {
2061
- if (err instanceof chunkSIBKF7AA_js.StreamTransportError) {
1960
+ if (err instanceof chunkMCY5YFYD_js.StreamTransportError) {
2062
1961
  console.warn(`[Appilots] streaming unavailable, falling back to JSON: ${err.message}`);
2063
1962
  response = await client.sendMessage(content.trim(), context);
2064
1963
  } else {
@@ -2087,7 +1986,7 @@ function useAppilotsChat(options = {}) {
2087
1986
  setLoadingStatusKey("thinking");
2088
1987
  }
2089
1988
  } catch (err) {
2090
- if (err instanceof chunkSIBKF7AA_js.StreamAbortError || err instanceof Error && err.name === "AbortError") {
1989
+ if (err instanceof chunkMCY5YFYD_js.StreamAbortError || err instanceof Error && err.name === "AbortError") {
2091
1990
  setIsLoading(false);
2092
1991
  setLoadingStatusKey("thinking");
2093
1992
  return;
@@ -2344,7 +2243,7 @@ function isPressableFiber(fiber) {
2344
2243
  return TOUCHABLE_NAMES.has(typeName) || hasPressHandler3(fiber);
2345
2244
  }
2346
2245
  function findListContainers(options = {}) {
2347
- const root = chunkSIBKF7AA_js.getFiberRoot();
2246
+ const root = chunkMCY5YFYD_js.getFiberRoot();
2348
2247
  if (!root) return [];
2349
2248
  const containers = [];
2350
2249
  const visited = /* @__PURE__ */ new WeakSet();
@@ -2503,7 +2402,7 @@ function describeTouchable(fiber) {
2503
2402
  }
2504
2403
  function touchableLooksDestructive(fiber) {
2505
2404
  const descriptor = describeTouchable(fiber);
2506
- if (descriptor && looksDestructiveActionLabel(descriptor)) return true;
2405
+ if (descriptor && chunkMCY5YFYD_js.looksDestructiveActionLabel(descriptor)) return true;
2507
2406
  const props = fiber?.memoizedProps ?? {};
2508
2407
  const haystack = [
2509
2408
  props.testID,
@@ -2511,7 +2410,7 @@ function touchableLooksDestructive(fiber) {
2511
2410
  props.accessibilityHint,
2512
2411
  props.label
2513
2412
  ].filter((value) => typeof value === "string").join(" ");
2514
- return looksDestructiveActionLabel(haystack);
2413
+ return chunkMCY5YFYD_js.looksDestructiveActionLabel(haystack);
2515
2414
  }
2516
2415
  function describeItemCandidate(listIndex, zeroBasedIndex, item) {
2517
2416
  const syntheticId = `list-${listIndex}-item-${zeroBasedIndex + 1}`;
@@ -2642,7 +2541,7 @@ function candidateLists(containers, locator) {
2642
2541
  return containers.map((list, listIndex) => ({ list, listIndex }));
2643
2542
  }
2644
2543
  function pressListItemAtOrdinal(listIndex, itemIndex) {
2645
- if (!chunkSIBKF7AA_js.getFiberRoot()) return { ok: false, reason: "no-fiber-root" };
2544
+ if (!chunkMCY5YFYD_js.getFiberRoot()) return { ok: false, reason: "no-fiber-root" };
2646
2545
  const containers = findListContainers({ allowSingleHeuristic: true });
2647
2546
  if (listIndex < 0 || listIndex >= containers.length) {
2648
2547
  return { ok: false, reason: "list-not-found" };
@@ -2656,7 +2555,7 @@ function pressListItemAtOrdinal(listIndex, itemIndex) {
2656
2555
  return pressResolvedListItem(list, items[zeroBased], listIndex, itemIndex);
2657
2556
  }
2658
2557
  function pressListItemByIdentity(locator) {
2659
- if (!chunkSIBKF7AA_js.getFiberRoot()) return { ok: false, reason: "no-fiber-root" };
2558
+ if (!chunkMCY5YFYD_js.getFiberRoot()) return { ok: false, reason: "no-fiber-root" };
2660
2559
  const parsed = locator.syntheticId ? parseSyntheticListItemId(locator.syntheticId) : null;
2661
2560
  const effective = parsed ? { ...locator, listIndex: parsed.listIndex, itemIndex: parsed.itemIndex } : locator;
2662
2561
  const containers = findListContainers({ allowSingleHeuristic: true });
@@ -2696,7 +2595,7 @@ function screenDiagnose(targetId, category = "component-not-found") {
2696
2595
  return {
2697
2596
  category,
2698
2597
  targetId,
2699
- screen: chunkSIBKF7AA_js.getCurrentScreen() ?? void 0
2598
+ screen: chunkMCY5YFYD_js.getCurrentScreen() ?? void 0
2700
2599
  };
2701
2600
  }
2702
2601
  function isPressLike(action) {
@@ -2713,10 +2612,10 @@ function elementLookupKey(value) {
2713
2612
  return canonicalElementId(value).toLowerCase().replace(/[\s_]+/g, "-");
2714
2613
  }
2715
2614
  function findRegisteredElement(elementId) {
2716
- const direct = chunkSIBKF7AA_js.elementRegistry.get(elementId) ?? chunkSIBKF7AA_js.elementRegistry.get(canonicalElementId(elementId));
2615
+ const direct = chunkMCY5YFYD_js.elementRegistry.get(elementId) ?? chunkMCY5YFYD_js.elementRegistry.get(canonicalElementId(elementId));
2717
2616
  if (direct) return direct;
2718
2617
  const wanted = elementLookupKey(elementId);
2719
- return chunkSIBKF7AA_js.elementRegistry.snapshot().find((element) => elementLookupKey(element.id) === wanted);
2618
+ return chunkMCY5YFYD_js.elementRegistry.snapshot().find((element) => elementLookupKey(element.id) === wanted);
2720
2619
  }
2721
2620
  function resolveInteractionElement(elementId) {
2722
2621
  return getLatestElement(elementId);
@@ -2976,20 +2875,20 @@ function normalize5(value) {
2976
2875
  return value.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]/g, "");
2977
2876
  }
2978
2877
  function resolveScreenForFormFields() {
2979
- const activePath = chunkSIBKF7AA_js.getActiveRouteNames();
2878
+ const activePath = chunkMCY5YFYD_js.getActiveRouteNames();
2980
2879
  for (let i = activePath.length - 1; i >= 0; i--) {
2981
2880
  const name = activePath[i];
2982
- const meta = name ? chunkSIBKF7AA_js.getScreenMetadata(name) : void 0;
2881
+ const meta = name ? chunkMCY5YFYD_js.getScreenMetadata(name) : void 0;
2983
2882
  if (name && Array.isArray(meta?.fields) && meta.fields.length > 0) return name;
2984
2883
  }
2985
- return chunkSIBKF7AA_js.getCurrentScreen();
2884
+ return chunkMCY5YFYD_js.getCurrentScreen();
2986
2885
  }
2987
2886
  function collectKnownFormFields(registry) {
2988
2887
  const registryFields = registry.snapshot().filter((entry) => entry.kind === "field" || entry.kind === "slider").map((entry) => ({ id: entry.id, label: entry.label }));
2989
2888
  if (registryFields.length >= 2) return registryFields;
2990
2889
  const screen = resolveScreenForFormFields();
2991
2890
  if (screen) {
2992
- const metaFields = chunkSIBKF7AA_js.getScreenMetadata(screen)?.fields;
2891
+ const metaFields = chunkMCY5YFYD_js.getScreenMetadata(screen)?.fields;
2993
2892
  if (Array.isArray(metaFields) && metaFields.length > 0) {
2994
2893
  return metaFields.filter((field) => !!field && typeof field.id === "string").map((field) => ({
2995
2894
  id: field.id,
@@ -2999,7 +2898,7 @@ function collectKnownFormFields(registry) {
2999
2898
  }));
3000
2899
  }
3001
2900
  }
3002
- for (const meta of chunkSIBKF7AA_js.getAllScreens()) {
2901
+ for (const meta of chunkMCY5YFYD_js.getAllScreens()) {
3003
2902
  if (Array.isArray(meta.fields) && meta.fields.length > 0) {
3004
2903
  return meta.fields.filter((field) => !!field && typeof field.id === "string").map((field) => ({
3005
2904
  id: field.id,
@@ -3097,7 +2996,7 @@ function rewriteMisplacedFormFillFields(fields, registry) {
3097
2996
  const inferred = inferFieldIdForValue(String(field.value ?? ""), knownFields, used);
3098
2997
  if (!inferred) return field;
3099
2998
  used.add(inferred);
3100
- chunkSIBKF7AA_js.appilotsDebugWarn(
2999
+ chunkMCY5YFYD_js.appilotsDebugWarn(
3101
3000
  `formFieldRewrite: ${field.fieldId} \u2192 ${inferred} (value=${JSON.stringify(field.value)})`
3102
3001
  );
3103
3002
  return { ...field, fieldId: inferred };
@@ -3135,7 +3034,7 @@ function readVisibleFormSuccess(snap) {
3135
3034
  return (snap.texts ?? []).find((text) => text?.trim() && FORM_SUCCESS_TEXT_RE.test(text));
3136
3035
  }
3137
3036
  function submitAsyncStillPending(submitTargetId) {
3138
- const probe = chunkSIBKF7AA_js.probeLoadingState(submitTargetId ?? null, chunkSIBKF7AA_js.getCurrentScreen());
3037
+ const probe = chunkMCY5YFYD_js.probeLoadingState(submitTargetId ?? null, chunkMCY5YFYD_js.getCurrentScreen());
3139
3038
  if (probe.loading) return true;
3140
3039
  if (submitTargetId && probe.pressedFound && probe.pressedDisabled) return true;
3141
3040
  return false;
@@ -3163,7 +3062,7 @@ async function waitForPostSubmitOutcome(options) {
3163
3062
  continue;
3164
3063
  }
3165
3064
  const snap2 = captureSnapshot();
3166
- const activePath2 = chunkSIBKF7AA_js.getActiveRouteNames();
3065
+ const activePath2 = chunkMCY5YFYD_js.getActiveRouteNames();
3167
3066
  const outcome2 = evaluatePostSubmitSnapshot(snap2, activePath2);
3168
3067
  if (outcome2) return outcome2;
3169
3068
  await sleep(pollMs);
@@ -3175,7 +3074,7 @@ async function waitForPostSubmitOutcome(options) {
3175
3074
  };
3176
3075
  }
3177
3076
  const snap = captureSnapshot();
3178
- const activePath = chunkSIBKF7AA_js.getActiveRouteNames();
3077
+ const activePath = chunkMCY5YFYD_js.getActiveRouteNames();
3179
3078
  const outcome = evaluatePostSubmitSnapshot(snap, activePath);
3180
3079
  if (outcome) return outcome;
3181
3080
  return {
@@ -3184,27 +3083,6 @@ async function waitForPostSubmitOutcome(options) {
3184
3083
  };
3185
3084
  }
3186
3085
 
3187
- // src/executor/handlers/formFillMatching.ts
3188
- function normalize6(s) {
3189
- return s.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]/g, "");
3190
- }
3191
- function matchScore(needle, hay) {
3192
- if (!needle || !hay) return 0;
3193
- if (needle === hay) return 100;
3194
- if (hay.startsWith(needle) || needle.startsWith(hay)) return 75;
3195
- if (hay.endsWith(needle) || needle.endsWith(hay)) return 60;
3196
- if (hay.includes(needle) || needle.includes(hay)) return 40;
3197
- return 0;
3198
- }
3199
- function isGenericSelectValue(value) {
3200
- if (value === void 0 || value === null || value === "") return true;
3201
- const normalized = normalize6(String(value));
3202
- if (!normalized) return true;
3203
- return /^(any|qualquer|random|aleatorio|aleatoria|auto|automatico|automatica|mock|mockado|mockada|mockados|mockadas|dummy|sample|exemplo|default|padrao|teste|test)$/.test(
3204
- normalized
3205
- );
3206
- }
3207
-
3208
3086
  // ../shared/dist/chunk-ERITSWKE.mjs
3209
3087
  var DEFAULT_FUZZY_FLOOR = 4;
3210
3088
  function normalizeId(value) {
@@ -3290,39 +3168,6 @@ function resolveTarget(requested, candidates, opts = {}) {
3290
3168
  return { status: "matched", id: ids[0], tier: "fuzzy" };
3291
3169
  }
3292
3170
 
3293
- // src/executor/interactionGuidance.ts
3294
- var LIST_ORDINAL_RE2 = /^list-\d+-item-\d+$/i;
3295
- function normalizeId2(value) {
3296
- return value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
3297
- }
3298
- function isOptionalCosmeticTargetId(targetId) {
3299
- if (typeof targetId !== "string" || !targetId.trim()) return false;
3300
- const id = normalizeId2(targetId);
3301
- return /foto|photo|avatar|icone|icon|emoji|sheetaction|sheet-action|btn-foto/.test(id) || id.includes("photo-sheet");
3302
- }
3303
- function routeLooksLikeFormContext(route) {
3304
- const haystack = normalizeId2(route ?? "");
3305
- return /create|edit|form|cadastr|register|novo|vehiclecreate|subscriptioncreate|vehicleedit|subscriptioncreate/.test(
3306
- haystack
3307
- );
3308
- }
3309
- function screenPathParts(screen) {
3310
- if (!screen) return [];
3311
- return screen.split("/").map((part) => part.trim()).filter(Boolean);
3312
- }
3313
- function isMisappliedListOrdinalOnForm(targetId, screen, activePath) {
3314
- if (typeof targetId !== "string" || !LIST_ORDINAL_RE2.test(targetId.trim())) {
3315
- return false;
3316
- }
3317
- const routes = [...screenPathParts(screen), ...activePath ?? []];
3318
- if (routes.length === 0) return routeLooksLikeFormContext(screen);
3319
- return routes.some((route) => routeLooksLikeFormContext(route));
3320
- }
3321
- function isOptionalStepAutomationFailure(targetId, screen, activePath) {
3322
- return isOptionalCosmeticTargetId(targetId) || isMisappliedListOrdinalOnForm(targetId, screen, activePath);
3323
- }
3324
- var OPTIONAL_STEP_AUTOMATION_HINT = "optional-step-automation-failed";
3325
-
3326
3171
  // src/executor/handlers/uiInteractionHandler.ts
3327
3172
  function findSnapshotButton(targetId) {
3328
3173
  try {
@@ -3335,16 +3180,16 @@ function findSnapshotButton(targetId) {
3335
3180
  }
3336
3181
  }
3337
3182
  function buildUiDiagnose(targetId, cause) {
3338
- const activePath = chunkSIBKF7AA_js.getActiveRouteNames();
3339
- const screen = activePath[activePath.length - 1] ?? chunkSIBKF7AA_js.getCurrentScreen() ?? void 0;
3183
+ const activePath = chunkMCY5YFYD_js.getActiveRouteNames();
3184
+ const screen = activePath[activePath.length - 1] ?? chunkMCY5YFYD_js.getCurrentScreen() ?? void 0;
3340
3185
  const screenPath = activePath.length > 1 ? activePath.join("/") : screen;
3341
3186
  const diagnose = {
3342
3187
  category: cause === "not-found" ? "component-not-found" : cause === "disabled" ? "disabled" : "unknown",
3343
3188
  targetId,
3344
3189
  screen: screenPath
3345
3190
  };
3346
- if (isOptionalStepAutomationFailure(targetId, screenPath, activePath)) {
3347
- diagnose.visibleMessage = OPTIONAL_STEP_AUTOMATION_HINT;
3191
+ if (chunkMCY5YFYD_js.isOptionalStepAutomationFailure(targetId, screenPath, activePath)) {
3192
+ diagnose.visibleMessage = chunkMCY5YFYD_js.OPTIONAL_STEP_AUTOMATION_HINT;
3348
3193
  diagnose.recoverable = true;
3349
3194
  }
3350
3195
  return diagnose;
@@ -3406,9 +3251,9 @@ function resolveComponentId(componentId, registry, action) {
3406
3251
  return comp.id;
3407
3252
  }
3408
3253
  }
3409
- const currentScreen = chunkSIBKF7AA_js.getCurrentScreen();
3254
+ const currentScreen = chunkMCY5YFYD_js.getCurrentScreen();
3410
3255
  if (currentScreen) {
3411
- const screenMeta = chunkSIBKF7AA_js.getScreenMetadata(currentScreen);
3256
+ const screenMeta = chunkMCY5YFYD_js.getScreenMetadata(currentScreen);
3412
3257
  const actions = screenMeta?.actions;
3413
3258
  if (actions && Array.isArray(actions)) {
3414
3259
  const metaAction = actions.find(
@@ -3562,7 +3407,7 @@ function checkModalOcclusion(rawComponentId, action) {
3562
3407
  return null;
3563
3408
  }
3564
3409
  if (typeof rawComponentId !== "string" || rawComponentId.trim().length === 0) return null;
3565
- const fiberRoot = chunkSIBKF7AA_js.getFiberRoot();
3410
+ const fiberRoot = chunkMCY5YFYD_js.getFiberRoot();
3566
3411
  if (!fiberRoot) return null;
3567
3412
  let snap;
3568
3413
  try {
@@ -3625,7 +3470,7 @@ function checkModalOcclusion(rawComponentId, action) {
3625
3470
  }
3626
3471
  function uiInteractionHandler(payload, context) {
3627
3472
  const { permissions } = context;
3628
- const registry = context.registry ?? chunkSIBKF7AA_js.componentRegistry;
3473
+ const registry = context.registry ?? chunkMCY5YFYD_js.componentRegistry;
3629
3474
  if (!permissions.canInteractUI) {
3630
3475
  return {
3631
3476
  success: false,
@@ -3684,7 +3529,7 @@ function uiInteractionHandler(payload, context) {
3684
3529
  );
3685
3530
  return { success: true };
3686
3531
  }
3687
- const screen = chunkSIBKF7AA_js.getCurrentScreen() ?? void 0;
3532
+ const screen = chunkMCY5YFYD_js.getCurrentScreen() ?? void 0;
3688
3533
  if (result.reason === "list-not-found" || result.reason === "item-not-found") {
3689
3534
  return {
3690
3535
  success: false,
@@ -3825,18 +3670,18 @@ function uiInteractionHandler(payload, context) {
3825
3670
  // src/executor/formSubmitResolve.ts
3826
3671
  var SUBMIT_LABEL_HINT_RE = /\b(submit|save|send|continue|next|sign\s*in|log\s*in|register|salvar|enviar|entrar|cadastrar|continuar|proximo|próximo|avancar|avançar|confirmar|guardar|registrarse|iniciar\s+sesi[óo]n|enregistrer|envoyer|valider|soumettre|confirmer|se\s+connecter|s['e]\s*inscrire)\b/i;
3827
3672
  var AGENT_CHROME_TARGET_RE = /\b(fechar|close|dismiss|cancelar|cancel|limpar|clear|chat\s+do\s+assistente|assistant\s+chat)\b/i;
3828
- function normalize7(value) {
3673
+ function normalize6(value) {
3829
3674
  return value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
3830
3675
  }
3831
3676
  function isAgentChromeTarget(id, label) {
3832
- const hay = normalize7(`${id ?? ""} ${label ?? ""}`);
3677
+ const hay = normalize6(`${id ?? ""} ${label ?? ""}`);
3833
3678
  return AGENT_CHROME_TARGET_RE.test(hay);
3834
3679
  }
3835
3680
  function isSubmitLikeTarget(id, label) {
3836
3681
  if (!id && !label) return false;
3837
3682
  if (isAgentChromeTarget(id, label)) return false;
3838
- const idNorm = normalize7(id ?? "");
3839
- normalize7(label ?? "");
3683
+ const idNorm = normalize6(id ?? "");
3684
+ normalize6(label ?? "");
3840
3685
  if (/^submit[-_]/i.test(id ?? "")) return true;
3841
3686
  if (submitLabelHintsSubmit(label ?? "")) return true;
3842
3687
  if (submitLabelHintsSubmit(id ?? "")) return true;
@@ -3849,7 +3694,7 @@ function submitLabelHintsSubmit(label) {
3849
3694
  return SUBMIT_LABEL_HINT_RE.test(trimmed);
3850
3695
  }
3851
3696
  function screenDeclaresSubmitAction(screenName) {
3852
- const meta = chunkSIBKF7AA_js.getScreenMetadata(screenName);
3697
+ const meta = chunkMCY5YFYD_js.getScreenMetadata(screenName);
3853
3698
  return Array.isArray(meta?.actions) && meta.actions.some(
3854
3699
  (action) => typeof action === "object" && action !== null && action.type === "submit"
3855
3700
  );
@@ -3882,7 +3727,7 @@ function resolveFormScreensForSubmit(screen, activePath, registry) {
3882
3727
  } else {
3883
3728
  push(screen);
3884
3729
  }
3885
- push(chunkSIBKF7AA_js.getCurrentScreen() ?? void 0);
3730
+ push(chunkMCY5YFYD_js.getCurrentScreen() ?? void 0);
3886
3731
  const withSubmit = [];
3887
3732
  const rest = [];
3888
3733
  for (const name of ordered) {
@@ -3900,7 +3745,7 @@ function collectSubmitTargetCandidates(screens, registry) {
3900
3745
  candidates.push(id);
3901
3746
  };
3902
3747
  for (const screenName of screens) {
3903
- const meta = chunkSIBKF7AA_js.getScreenMetadata(screenName);
3748
+ const meta = chunkMCY5YFYD_js.getScreenMetadata(screenName);
3904
3749
  const submitMeta = Array.isArray(meta?.actions) ? meta.actions.find(
3905
3750
  (action) => typeof action === "object" && action !== null && action.type === "submit"
3906
3751
  ) : void 0;
@@ -3946,8 +3791,8 @@ function readVisibleValidation(fieldId, label) {
3946
3791
  return void 0;
3947
3792
  }
3948
3793
  function resolveScreenContext() {
3949
- const activePath = chunkSIBKF7AA_js.getActiveRouteNames();
3950
- const screen = activePath[activePath.length - 1] ?? chunkSIBKF7AA_js.getCurrentScreen() ?? void 0;
3794
+ const activePath = chunkMCY5YFYD_js.getActiveRouteNames();
3795
+ const screen = activePath[activePath.length - 1] ?? chunkMCY5YFYD_js.getCurrentScreen() ?? void 0;
3951
3796
  return { screen, activePath };
3952
3797
  }
3953
3798
  function selectValueApplied(fieldId, requestedValue, currentValue, registry) {
@@ -3955,36 +3800,36 @@ function selectValueApplied(fieldId, requestedValue, currentValue, registry) {
3955
3800
  if (!requested) return false;
3956
3801
  const meta = getMetadataField(fieldId, registry);
3957
3802
  const options = Array.isArray(meta?.options) ? meta.options : [];
3958
- const requestedNorm = normalize6(requested);
3959
- const currentNorm = normalize6(currentValue);
3803
+ const requestedNorm = chunkMCY5YFYD_js.normalize2(requested);
3804
+ const currentNorm = chunkMCY5YFYD_js.normalize2(currentValue);
3960
3805
  if (currentNorm === requestedNorm) return true;
3961
3806
  for (const option of options) {
3962
3807
  const value = typeof option?.value === "string" ? option.value : "";
3963
3808
  const label = typeof option?.label === "string" ? option.label : "";
3964
- if (normalize6(value) === requestedNorm && normalize6(label) === currentNorm) return true;
3965
- if (normalize6(label) === requestedNorm && normalize6(label) === currentNorm) return true;
3966
- if (normalize6(value) === requestedNorm && normalize6(value) === currentNorm) return true;
3809
+ if (chunkMCY5YFYD_js.normalize2(value) === requestedNorm && chunkMCY5YFYD_js.normalize2(label) === currentNorm) return true;
3810
+ if (chunkMCY5YFYD_js.normalize2(label) === requestedNorm && chunkMCY5YFYD_js.normalize2(label) === currentNorm) return true;
3811
+ if (chunkMCY5YFYD_js.normalize2(value) === requestedNorm && chunkMCY5YFYD_js.normalize2(value) === currentNorm) return true;
3967
3812
  }
3968
3813
  return false;
3969
3814
  }
3970
3815
  function getMetadataField(fieldId, registry) {
3971
3816
  const screens = /* @__PURE__ */ new Set();
3972
- for (const name of chunkSIBKF7AA_js.getActiveRouteNames()) screens.add(name);
3973
- const current = chunkSIBKF7AA_js.getCurrentScreen();
3817
+ for (const name of chunkMCY5YFYD_js.getActiveRouteNames()) screens.add(name);
3818
+ const current = chunkMCY5YFYD_js.getCurrentScreen();
3974
3819
  if (current) screens.add(current);
3975
3820
  if (registry) {
3976
3821
  for (const comp of registry.snapshot()) {
3977
3822
  if (comp.kind === "field" && comp.screen) screens.add(comp.screen);
3978
3823
  }
3979
3824
  }
3980
- const needle = normalize6(fieldId);
3825
+ const needle = chunkMCY5YFYD_js.normalize2(fieldId);
3981
3826
  for (const screenName of screens) {
3982
- const screenMeta = chunkSIBKF7AA_js.getScreenMetadata(screenName);
3827
+ const screenMeta = chunkMCY5YFYD_js.getScreenMetadata(screenName);
3983
3828
  const fields = Array.isArray(screenMeta?.fields) ? screenMeta.fields : [];
3984
3829
  const match = fields.find((field) => {
3985
3830
  if (!field || typeof field !== "object") return false;
3986
- const id = typeof field.id === "string" ? normalize6(field.id) : "";
3987
- const label = typeof field.label === "string" ? normalize6(field.label) : "";
3831
+ const id = typeof field.id === "string" ? chunkMCY5YFYD_js.normalize2(field.id) : "";
3832
+ const label = typeof field.label === "string" ? chunkMCY5YFYD_js.normalize2(field.label) : "";
3988
3833
  return id === needle || label === needle;
3989
3834
  });
3990
3835
  if (match) return match;
@@ -3996,11 +3841,11 @@ function resolveSelectOption(fieldId, value, registry) {
3996
3841
  if (!requested) return void 0;
3997
3842
  const meta = getMetadataField(fieldId, registry);
3998
3843
  const options = Array.isArray(meta?.options) ? meta.options : [];
3999
- const requestedNorm = normalize6(requested);
3844
+ const requestedNorm = chunkMCY5YFYD_js.normalize2(requested);
4000
3845
  for (const option of options) {
4001
3846
  const optionValue = typeof option?.value === "string" ? option.value : "";
4002
3847
  const optionLabel = typeof option?.label === "string" ? option.label : "";
4003
- if (normalize6(optionValue) === requestedNorm || normalize6(optionLabel) === requestedNorm) {
3848
+ if (chunkMCY5YFYD_js.normalize2(optionValue) === requestedNorm || chunkMCY5YFYD_js.normalize2(optionLabel) === requestedNorm) {
4004
3849
  return { value: optionValue, label: optionLabel };
4005
3850
  }
4006
3851
  }
@@ -4050,12 +3895,12 @@ async function tryPressSelectOption(fieldId, value, registry, options = {}) {
4050
3895
  return {
4051
3896
  success: false,
4052
3897
  error: `No pressable option found for select field "${fieldId}"`,
4053
- diagnose: { category: "component-not-found", fieldId, screen: chunkSIBKF7AA_js.getCurrentScreen() ?? void 0 }
3898
+ diagnose: { category: "component-not-found", fieldId, screen: chunkMCY5YFYD_js.getCurrentScreen() ?? void 0 }
4054
3899
  };
4055
3900
  }
4056
3901
  function normalizeFieldType(type) {
4057
3902
  if (typeof type !== "string") return void 0;
4058
- const normalized = normalize6(type);
3903
+ const normalized = chunkMCY5YFYD_js.normalize2(type);
4059
3904
  if (normalized === "select" || normalized === "picker" || normalized === "dropdown") return "select";
4060
3905
  if (normalized === "toggle" || normalized === "switch" || normalized === "checkbox") return "toggle";
4061
3906
  if (normalized === "date") return "date";
@@ -4083,7 +3928,7 @@ function fieldCueTerms(fieldId, label) {
4083
3928
  );
4084
3929
  const terms = /* @__PURE__ */ new Set();
4085
3930
  for (const value of raw) {
4086
- const normalized = normalize6(value);
3931
+ const normalized = chunkMCY5YFYD_js.normalize2(value);
4087
3932
  if (normalized.length >= 3 && normalized !== "id") terms.add(normalized);
4088
3933
  }
4089
3934
  return [...terms];
@@ -4094,17 +3939,17 @@ function snapshotHasFieldCue(snap, fieldId, label) {
4094
3939
  const visible = [
4095
3940
  ...snap.texts ?? [],
4096
3941
  ...(snap.buttons ?? []).map((b) => b.label ?? b.id ?? "")
4097
- ].map((text) => normalize6(text)).filter(Boolean);
3942
+ ].map((text) => chunkMCY5YFYD_js.normalize2(text)).filter(Boolean);
4098
3943
  return visible.some((text) => terms.some((term) => text.includes(term) || term.includes(text)));
4099
3944
  }
4100
3945
  function scoreCandidateText(value, texts) {
4101
- const valueNorm = normalize6(String(value ?? ""));
3946
+ const valueNorm = chunkMCY5YFYD_js.normalize2(String(value ?? ""));
4102
3947
  if (!valueNorm) return 0;
4103
3948
  let best = 0;
4104
3949
  for (const text of texts) {
4105
- const textNorm = normalize6(text);
3950
+ const textNorm = chunkMCY5YFYD_js.normalize2(text);
4106
3951
  if (!textNorm) continue;
4107
- best = Math.max(best, matchScore(valueNorm, textNorm));
3952
+ best = Math.max(best, chunkMCY5YFYD_js.matchScore(valueNorm, textNorm));
4108
3953
  }
4109
3954
  return best;
4110
3955
  }
@@ -4118,7 +3963,7 @@ function optionTexts(option) {
4118
3963
  function buildChoiceCandidates(snap, fieldId, value, allowFirstVisibleWhenNoCue, registry) {
4119
3964
  const fieldLabel = getFieldLabel(fieldId, registry);
4120
3965
  const fieldCueVisible = snapshotHasFieldCue(snap, fieldId, fieldLabel);
4121
- const genericValue = isGenericSelectValue(value);
3966
+ const genericValue = chunkMCY5YFYD_js.isGenericSelectValue(value);
4122
3967
  const candidates = [];
4123
3968
  let order = 0;
4124
3969
  const choiceGroups = snap.choiceGroups ?? [];
@@ -4130,7 +3975,7 @@ function buildChoiceCandidates(snap, fieldId, value, allowFirstVisibleWhenNoCue,
4130
3975
  const groupCueScore = Math.max(
4131
3976
  globalCueScore,
4132
3977
  ...groupTexts.map((text) => {
4133
- const normalized = normalize6(text);
3978
+ const normalized = chunkMCY5YFYD_js.normalize2(text);
4134
3979
  return fieldCueTerms(fieldId, fieldLabel).some(
4135
3980
  (term) => normalized.includes(term) || term.includes(normalized)
4136
3981
  ) ? 80 : 0;
@@ -4167,7 +4012,7 @@ function buildChoiceCandidates(snap, fieldId, value, allowFirstVisibleWhenNoCue,
4167
4012
  const elementCueScore = Math.max(
4168
4013
  fieldCueVisible && elements.length <= 12 ? 50 : 0,
4169
4014
  ...cueTexts.map((text) => {
4170
- const normalized = normalize6(text);
4015
+ const normalized = chunkMCY5YFYD_js.normalize2(text);
4171
4016
  return fieldTerms.some(
4172
4017
  (term) => normalized.includes(term) || term.includes(normalized)
4173
4018
  ) ? 80 : 0;
@@ -4227,7 +4072,7 @@ async function selectVisibleChoiceAsync(fieldId, value, registry, options) {
4227
4072
  return {
4228
4073
  success: false,
4229
4074
  error: err?.message ?? "Could not capture visible choices",
4230
- diagnose: { category: "unknown", fieldId, screen: chunkSIBKF7AA_js.getCurrentScreen() ?? void 0 }
4075
+ diagnose: { category: "unknown", fieldId, screen: chunkMCY5YFYD_js.getCurrentScreen() ?? void 0 }
4231
4076
  };
4232
4077
  }
4233
4078
  const candidates = buildChoiceCandidates(
@@ -4242,7 +4087,7 @@ async function selectVisibleChoiceAsync(fieldId, value, registry, options) {
4242
4087
  return {
4243
4088
  success: false,
4244
4089
  error: `No visible option found for select field "${fieldId}"`,
4245
- diagnose: { category: "component-not-found", fieldId, screen: chunkSIBKF7AA_js.getCurrentScreen() ?? void 0 }
4090
+ diagnose: { category: "component-not-found", fieldId, screen: chunkMCY5YFYD_js.getCurrentScreen() ?? void 0 }
4246
4091
  };
4247
4092
  }
4248
4093
  const pressed = pressTargetByIdOrLabel(candidate.targetId, registry);
@@ -4255,7 +4100,7 @@ async function selectVisibleChoiceAsync(fieldId, value, registry, options) {
4255
4100
  }
4256
4101
  function isContinuationButton(label) {
4257
4102
  if (!label) return false;
4258
- return /^(next|continue|proximo|prox|continuar|avancar|avançar)$/i.test(normalize6(label));
4103
+ return /^(next|continue|proximo|prox|continuar|avancar|avançar)$/i.test(chunkMCY5YFYD_js.normalize2(label));
4259
4104
  }
4260
4105
  function pressContinuationButton(registry) {
4261
4106
  const snap = captureSnapshot();
@@ -4268,7 +4113,7 @@ function pressContinuationButton(registry) {
4268
4113
  return {
4269
4114
  success: false,
4270
4115
  error: "No enabled continuation button is visible",
4271
- diagnose: { category: "component-not-found", screen: chunkSIBKF7AA_js.getCurrentScreen() ?? void 0 }
4116
+ diagnose: { category: "component-not-found", screen: chunkMCY5YFYD_js.getCurrentScreen() ?? void 0 }
4272
4117
  };
4273
4118
  }
4274
4119
  return pressTargetByIdOrLabel(id, registry);
@@ -4288,18 +4133,18 @@ function findField(fieldId, registry) {
4288
4133
  return registry.getField(comp.id);
4289
4134
  }
4290
4135
  }
4291
- const currentScreenForTieBreak = chunkSIBKF7AA_js.getCurrentScreen();
4292
- const needle = normalize6(fieldId);
4136
+ const currentScreenForTieBreak = chunkMCY5YFYD_js.getCurrentScreen();
4137
+ const needle = chunkMCY5YFYD_js.normalize2(fieldId);
4293
4138
  let bestComp;
4294
4139
  let bestScore = 0;
4295
4140
  let bestOnCurrentScreen = false;
4296
4141
  for (const comp of snapshot) {
4297
4142
  if (comp.kind !== "field") continue;
4298
- const candidates = [normalize6(comp.id)];
4299
- if (comp.label) candidates.push(normalize6(comp.label));
4143
+ const candidates = [chunkMCY5YFYD_js.normalize2(comp.id)];
4144
+ if (comp.label) candidates.push(chunkMCY5YFYD_js.normalize2(comp.label));
4300
4145
  let candidateScore = 0;
4301
4146
  for (const cand of candidates) {
4302
- const s = matchScore(needle, cand);
4147
+ const s = chunkMCY5YFYD_js.matchScore(needle, cand);
4303
4148
  if (s > candidateScore) candidateScore = s;
4304
4149
  }
4305
4150
  if (candidateScore === 0) continue;
@@ -4317,9 +4162,9 @@ function findField(fieldId, registry) {
4317
4162
  );
4318
4163
  return registry.getField(bestComp.id);
4319
4164
  }
4320
- const currentScreen = chunkSIBKF7AA_js.getCurrentScreen();
4165
+ const currentScreen = chunkMCY5YFYD_js.getCurrentScreen();
4321
4166
  if (currentScreen) {
4322
- const screenMeta = chunkSIBKF7AA_js.getScreenMetadata(currentScreen);
4167
+ const screenMeta = chunkMCY5YFYD_js.getScreenMetadata(currentScreen);
4323
4168
  const fields = screenMeta?.fields;
4324
4169
  if (fields && Array.isArray(fields)) {
4325
4170
  const metaField = fields.find(
@@ -4327,12 +4172,12 @@ function findField(fieldId, registry) {
4327
4172
  );
4328
4173
  if (metaField && typeof metaField === "object" && metaField.label) {
4329
4174
  const metaLabel = metaField.label;
4330
- const metaNeedle = normalize6(metaLabel);
4175
+ const metaNeedle = chunkMCY5YFYD_js.normalize2(metaLabel);
4331
4176
  let mBest;
4332
4177
  let mBestScore = 0;
4333
4178
  for (const comp of snapshot) {
4334
4179
  if (comp.kind !== "field" || !comp.label) continue;
4335
- const score = matchScore(metaNeedle, normalize6(comp.label));
4180
+ const score = chunkMCY5YFYD_js.matchScore(metaNeedle, chunkMCY5YFYD_js.normalize2(comp.label));
4336
4181
  if (score > mBestScore) {
4337
4182
  mBestScore = score;
4338
4183
  mBest = comp;
@@ -4353,7 +4198,7 @@ function findField(fieldId, registry) {
4353
4198
  );
4354
4199
  return registry.getField(bestComp.id);
4355
4200
  }
4356
- chunkSIBKF7AA_js.appilotsDebugWarn(
4201
+ chunkMCY5YFYD_js.appilotsDebugWarn(
4357
4202
  `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"}`
4358
4203
  );
4359
4204
  return void 0;
@@ -4373,7 +4218,7 @@ function findToggle(fieldId, registry) {
4373
4218
  return registry.getToggle(comp.id);
4374
4219
  }
4375
4220
  }
4376
- chunkSIBKF7AA_js.appilotsDebugWarn(
4221
+ chunkMCY5YFYD_js.appilotsDebugWarn(
4377
4222
  `findToggle: NOT FOUND \u2014 fieldId="${fieldId}" not in registry. Available toggles: ${snapshot.filter((c) => c.kind === "toggle").map((c) => `"${c.id}"`).join(", ") || "none"}`
4378
4223
  );
4379
4224
  return void 0;
@@ -4393,7 +4238,7 @@ function findSlider(fieldId, registry) {
4393
4238
  var sleep2 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
4394
4239
  async function formFillHandler(payload, context) {
4395
4240
  const { permissions } = context;
4396
- const registry = context.registry ?? chunkSIBKF7AA_js.componentRegistry;
4241
+ const registry = context.registry ?? chunkMCY5YFYD_js.componentRegistry;
4397
4242
  const { screen, activePath } = resolveScreenContext();
4398
4243
  const screenPath = activePath.length > 1 ? activePath.join("/") : screen;
4399
4244
  if (!permissions.canFillForms) {
@@ -4412,7 +4257,7 @@ async function formFillHandler(payload, context) {
4412
4257
  }
4413
4258
  const registrySnapshot = registry.snapshot();
4414
4259
  if (registrySnapshot.length === 0) {
4415
- chunkSIBKF7AA_js.appilotsDebugWarn(
4260
+ chunkMCY5YFYD_js.appilotsDebugWarn(
4416
4261
  "formFillHandler: registry is EMPTY \u2014 auto-tracking may not be active. Ensure enableAppilotsAutoTracking() runs before components mount."
4417
4262
  );
4418
4263
  } else {
@@ -4486,7 +4331,7 @@ async function formFillHandler(payload, context) {
4486
4331
  after = fieldEntry.getValue?.() ?? "";
4487
4332
  }
4488
4333
  if (!selectValueApplied(fieldId, value, after, registry)) {
4489
- chunkSIBKF7AA_js.appilotsDebugWarn(
4334
+ chunkMCY5YFYD_js.appilotsDebugWarn(
4490
4335
  `formFillHandler: select field "${fieldId}" setValue("${value}") did not stick (current="${after}"), trying visible choice fallback`
4491
4336
  );
4492
4337
  const selectResult = await selectVisibleChoice(fieldId, value, registry, {
@@ -4659,14 +4504,14 @@ async function formFillHandler(payload, context) {
4659
4504
  if (payload.submitAfterFill === true) {
4660
4505
  if (!allSuccess) {
4661
4506
  const failedIds = fieldResults.filter((result) => !result.success).map((result) => result.fieldId);
4662
- chunkSIBKF7AA_js.appilotsDebugWarn(
4507
+ chunkMCY5YFYD_js.appilotsDebugWarn(
4663
4508
  "formFillHandler: submitAfterFill=true requested but some fields failed; NOT submitting" + (failedIds.length > 0 ? ` (failed: ${failedIds.join(", ")})` : "")
4664
4509
  );
4665
4510
  } else {
4666
4511
  await sleep2(120);
4667
4512
  const submitResult = pressSubmitButton({ screen, screenPath, activePath }, registry);
4668
4513
  if (!submitResult.success) {
4669
- chunkSIBKF7AA_js.appilotsDebugWarn(`formFillHandler: submitAfterFill failed \u2014 ${submitResult.error}`);
4514
+ chunkMCY5YFYD_js.appilotsDebugWarn(`formFillHandler: submitAfterFill failed \u2014 ${submitResult.error}`);
4670
4515
  return {
4671
4516
  success: false,
4672
4517
  error: submitResult.error,
@@ -4678,7 +4523,7 @@ async function formFillHandler(payload, context) {
4678
4523
  submitTargetId: submitResult.pressedTargetId
4679
4524
  });
4680
4525
  if (postSubmit.status === "pending") {
4681
- chunkSIBKF7AA_js.appilotsDebugWarn(`formFillHandler: submit still pending \u2014 ${postSubmit.message}`);
4526
+ chunkMCY5YFYD_js.appilotsDebugWarn(`formFillHandler: submit still pending \u2014 ${postSubmit.message}`);
4682
4527
  return {
4683
4528
  success: false,
4684
4529
  error: postSubmit.message,
@@ -4687,7 +4532,7 @@ async function formFillHandler(payload, context) {
4687
4532
  };
4688
4533
  }
4689
4534
  if (postSubmit.status === "failure") {
4690
- chunkSIBKF7AA_js.appilotsDebugWarn(
4535
+ chunkMCY5YFYD_js.appilotsDebugWarn(
4691
4536
  `formFillHandler: submit rejected by visible validation \u2014 ${postSubmit.message}`
4692
4537
  );
4693
4538
  return {
@@ -4714,10 +4559,10 @@ async function formFillHandler(payload, context) {
4714
4559
  };
4715
4560
  }
4716
4561
  function pressSubmitButton(context, registry) {
4717
- const activePath = context.activePath ?? chunkSIBKF7AA_js.getActiveRouteNames();
4562
+ const activePath = context.activePath ?? chunkMCY5YFYD_js.getActiveRouteNames();
4718
4563
  const hintScreen = context.screen ?? context.screenPath;
4719
4564
  const formScreens = resolveFormScreensForSubmit(hintScreen, activePath, registry);
4720
- const resolvedScreen = formScreens.find((name) => screenDeclaresSubmit(name)) ?? formScreens[0] ?? hintScreen ?? chunkSIBKF7AA_js.getCurrentScreen() ?? void 0;
4565
+ const resolvedScreen = formScreens.find((name) => screenDeclaresSubmit(name)) ?? formScreens[0] ?? hintScreen ?? chunkMCY5YFYD_js.getCurrentScreen() ?? void 0;
4721
4566
  const candidates = collectSubmitTargetCandidates(formScreens, registry);
4722
4567
  for (const candidate of candidates) {
4723
4568
  const target = registry.getTarget(candidate);
@@ -4738,7 +4583,7 @@ function pressSubmitButton(context, registry) {
4738
4583
  }
4739
4584
  }
4740
4585
  for (const screenName of formScreens) {
4741
- const screenMeta = chunkSIBKF7AA_js.getScreenMetadata(screenName);
4586
+ const screenMeta = chunkMCY5YFYD_js.getScreenMetadata(screenName);
4742
4587
  const submitMeta = Array.isArray(screenMeta?.actions) ? screenMeta.actions.find(
4743
4588
  (action) => typeof action === "object" && action !== null && action.type === "submit"
4744
4589
  ) : void 0;
@@ -4837,23 +4682,23 @@ var FALLBACK_PAGE_PX = 600;
4837
4682
  var PAGE_FRACTION = 0.85;
4838
4683
  var POST_SCROLL_MOUNT_MS = 400;
4839
4684
  var sleep3 = (ms) => new Promise((r) => setTimeout(r, ms));
4840
- function normalizeId3(value) {
4685
+ function normalizeId2(value) {
4841
4686
  return String(value ?? "").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]+/g, "");
4842
4687
  }
4843
4688
  function buildDiagnose(category, targetId, candidates) {
4844
4689
  return {
4845
4690
  category,
4846
4691
  targetId,
4847
- screen: chunkSIBKF7AA_js.getCurrentScreen() ?? void 0,
4692
+ screen: chunkMCY5YFYD_js.getCurrentScreen() ?? void 0,
4848
4693
  ...candidates && candidates.length > 0 ? { candidates: candidates.slice(0, 8) } : {}
4849
4694
  };
4850
4695
  }
4851
4696
  function resolveListEntry(listId) {
4852
- const entries = chunkSIBKF7AA_js.listRegistry.snapshot();
4697
+ const entries = chunkMCY5YFYD_js.listRegistry.snapshot();
4853
4698
  if (entries.length === 0) return {};
4854
4699
  if (listId) {
4855
- const wanted = normalizeId3(listId);
4856
- const match = entries.find((e) => normalizeId3(e.id) === wanted);
4700
+ const wanted = normalizeId2(listId);
4701
+ const match = entries.find((e) => normalizeId2(e.id) === wanted);
4857
4702
  if (match) return { entry: match };
4858
4703
  return { candidates: entries.map((e) => e.id) };
4859
4704
  }
@@ -4960,23 +4805,23 @@ function targetIdFromPayload(payload) {
4960
4805
  }
4961
4806
  async function waitForPostInteractionSettle(payload) {
4962
4807
  const targetId = targetIdFromPayload(payload);
4963
- const fromScreen = chunkSIBKF7AA_js.getCurrentScreen();
4964
- const baseline = chunkSIBKF7AA_js.probeLoadingState(targetId || null, fromScreen);
4808
+ const fromScreen = chunkMCY5YFYD_js.getCurrentScreen();
4809
+ const baseline = chunkMCY5YFYD_js.probeLoadingState(targetId || null, fromScreen);
4965
4810
  await sleepMs(100);
4966
- const afterPress = chunkSIBKF7AA_js.probeLoadingState(targetId || null, chunkSIBKF7AA_js.getCurrentScreen());
4811
+ const afterPress = chunkMCY5YFYD_js.probeLoadingState(targetId || null, chunkMCY5YFYD_js.getCurrentScreen());
4967
4812
  const modalOrLoading = afterPress.modalOpen || afterPress.loading || afterPress.pressedDisabled;
4968
4813
  const fingerprintChanged = afterPress.fingerprint !== baseline.fingerprint;
4969
- const capMs = isListItemPressTarget(targetId) ? 5e3 : 1e4;
4814
+ const capMs = chunkMCY5YFYD_js.isListItemPressTarget(targetId) ? 5e3 : 1e4;
4970
4815
  if (modalOrLoading || fingerprintChanged) {
4971
- await chunkSIBKF7AA_js.waitForLoadingSettle({
4816
+ await chunkMCY5YFYD_js.waitForLoadingSettle({
4972
4817
  pressedComponentId: targetId || null,
4973
4818
  fromScreen,
4974
4819
  maxMs: capMs
4975
4820
  });
4976
4821
  return;
4977
4822
  }
4978
- if (isListItemPressTarget(targetId)) {
4979
- await chunkSIBKF7AA_js.waitForLoadingSettle({
4823
+ if (chunkMCY5YFYD_js.isListItemPressTarget(targetId)) {
4824
+ await chunkMCY5YFYD_js.waitForLoadingSettle({
4980
4825
  fromScreen,
4981
4826
  maxMs: 3e3
4982
4827
  });
@@ -4996,7 +4841,7 @@ function validateActionPayload(action) {
4996
4841
  error: message,
4997
4842
  diagnose: {
4998
4843
  category: "validation",
4999
- screen: chunkSIBKF7AA_js.getCurrentScreen() ?? void 0,
4844
+ screen: chunkMCY5YFYD_js.getCurrentScreen() ?? void 0,
5000
4845
  ...ids ?? {}
5001
4846
  }
5002
4847
  });
@@ -5063,7 +4908,7 @@ async function executeAction(action, context) {
5063
4908
  let result;
5064
4909
  const validationFailure = validateActionPayload(action);
5065
4910
  if (validationFailure) {
5066
- chunkSIBKF7AA_js.appilotsDebugWarn(
4911
+ chunkMCY5YFYD_js.appilotsDebugWarn(
5067
4912
  `executeAction: payload validation failed for type="${action.type}" id="${action.id}": ${validationFailure.error}`
5068
4913
  );
5069
4914
  context.emit({
@@ -5090,13 +4935,13 @@ async function executeAction(action, context) {
5090
4935
  case "form_fill":
5091
4936
  result = await formFillHandler(action.payload, {
5092
4937
  permissions,
5093
- registry: context.registry ?? chunkSIBKF7AA_js.getDefaultRegistry()
4938
+ registry: context.registry ?? chunkMCY5YFYD_js.getDefaultRegistry()
5094
4939
  });
5095
4940
  break;
5096
4941
  case "ui_interaction":
5097
4942
  result = uiInteractionHandler(action.payload, {
5098
4943
  permissions,
5099
- registry: context.registry ?? chunkSIBKF7AA_js.getDefaultRegistry()
4944
+ registry: context.registry ?? chunkMCY5YFYD_js.getDefaultRegistry()
5100
4945
  });
5101
4946
  if (result.success) {
5102
4947
  await waitForPostInteractionSettle(action.payload);
@@ -5126,7 +4971,7 @@ async function executeAction(action, context) {
5126
4971
  };
5127
4972
  }
5128
4973
  } catch (err) {
5129
- chunkSIBKF7AA_js.appilotsDebugWarn(
4974
+ chunkMCY5YFYD_js.appilotsDebugWarn(
5130
4975
  `executeAction: exception during action type="${action.type}" id="${action.id}": ${err?.message}`
5131
4976
  );
5132
4977
  result = {
@@ -5150,17 +4995,6 @@ async function executeAction(action, context) {
5150
4995
  });
5151
4996
  return result;
5152
4997
  }
5153
-
5154
- // src/hooks/confirmMatching.ts
5155
- function metadataMatchesComponentId(metaId, componentId) {
5156
- const norm = (s) => s.toLowerCase().replace(/^el:(button|link|input|toggle|listitem)[:_-]/, "").replace(/^(btn-|btn_|button-|button_|link-|link_)/, "").trim();
5157
- const meta = norm(metaId);
5158
- const comp = norm(componentId);
5159
- if (!meta || !comp) return false;
5160
- return meta === comp;
5161
- }
5162
-
5163
- // src/hooks/useAppilotsActions.ts
5164
4998
  var DEFAULT_PERMISSIONS2 = {
5165
4999
  canNavigate: true,
5166
5000
  canFillForms: true,
@@ -5264,7 +5098,7 @@ async function runWithConfirmedDestructiveContext(enabled, fn) {
5264
5098
  }
5265
5099
  }
5266
5100
  function useAppilotsActions(options = {}) {
5267
- const { client, subscribe, config, emit } = chunkSIBKF7AA_js.useAppilotsContext();
5101
+ const { client, subscribe, config, emit } = chunkMCY5YFYD_js.useAppilotsContext();
5268
5102
  const [actions, setActions] = react.useState([]);
5269
5103
  const { navigationRef, autoExecute = false } = options;
5270
5104
  const actionsRef = react.useRef([]);
@@ -5308,13 +5142,13 @@ function useAppilotsActions(options = {}) {
5308
5142
  const componentId = typeof payload?.componentId === "string" && payload.componentId || typeof payload?.targetId === "string" && payload.targetId || "";
5309
5143
  let policy = payloadRequiresConfirmation(target);
5310
5144
  if (!policy.required && componentId) {
5311
- const screen = chunkSIBKF7AA_js.getCurrentScreen();
5312
- const meta = screen ? chunkSIBKF7AA_js.getScreenMetadata(screen) : void 0;
5145
+ const screen = chunkMCY5YFYD_js.getCurrentScreen();
5146
+ const meta = screen ? chunkMCY5YFYD_js.getScreenMetadata(screen) : void 0;
5313
5147
  const actionsMeta = meta?.actions;
5314
5148
  if (actionsMeta && Array.isArray(actionsMeta)) {
5315
5149
  const match = actionsMeta.find((a) => {
5316
5150
  if (typeof a === "string") return false;
5317
- return metadataMatchesComponentId(a.id, componentId);
5151
+ return chunkMCY5YFYD_js.metadataMatchesComponentId(a.id, componentId);
5318
5152
  });
5319
5153
  if (match && typeof match !== "string") {
5320
5154
  policy = actionMetadataRequiresConfirmation(match);
@@ -5446,7 +5280,7 @@ function useAppilotsActions(options = {}) {
5446
5280
  }
5447
5281
  }
5448
5282
  if (lastWasNavigate) {
5449
- const settle = await chunkSIBKF7AA_js.waitForScreenSettle({
5283
+ const settle = await chunkMCY5YFYD_js.waitForScreenSettle({
5450
5284
  expectingChange: true,
5451
5285
  fromScreen: preNavScreen,
5452
5286
  fromSignature: preNavSignature,
@@ -5459,12 +5293,12 @@ function useAppilotsActions(options = {}) {
5459
5293
  console.log(`[Appilots] useAppilotsActions: auto-executing action id="${action.id}" type="${action.type}"`);
5460
5294
  processedRef.current.add(action.id);
5461
5295
  if (action.type === "navigate") {
5462
- preNavScreen = chunkSIBKF7AA_js.getCurrentScreen();
5463
- preNavSignature = chunkSIBKF7AA_js.getCurrentScreenSignature();
5296
+ preNavScreen = chunkMCY5YFYD_js.getCurrentScreen();
5297
+ preNavSignature = chunkMCY5YFYD_js.getCurrentScreenSignature();
5464
5298
  }
5465
5299
  const succeeded = await approveActionImpl(action.id);
5466
5300
  if (!succeeded) {
5467
- chunkSIBKF7AA_js.appilotsDebugWarn(
5301
+ chunkMCY5YFYD_js.appilotsDebugWarn(
5468
5302
  `useAppilotsActions: stopping current action batch after failed action id="${action.id}"`
5469
5303
  );
5470
5304
  break;
@@ -5483,7 +5317,7 @@ function useAppilotsActions(options = {}) {
5483
5317
  (prev) => prev.map((a) => a.id === actionId ? { ...a, status: "executing" } : a)
5484
5318
  );
5485
5319
  try {
5486
- const navRef = navRefStable.current?.current ? navRefStable.current : { current: chunkSIBKF7AA_js.getNavigationRef() };
5320
+ const navRef = navRefStable.current?.current ? navRefStable.current : { current: chunkMCY5YFYD_js.getNavigationRef() };
5487
5321
  const confirmedDestructive = actionHasCompletedConfirmGate(
5488
5322
  action,
5489
5323
  actionsRef.current
@@ -5510,7 +5344,7 @@ function useAppilotsActions(options = {}) {
5510
5344
  }
5511
5345
  return true;
5512
5346
  } else {
5513
- chunkSIBKF7AA_js.appilotsDebugWarn(
5347
+ chunkMCY5YFYD_js.appilotsDebugWarn(
5514
5348
  `useAppilotsActions: action status transition: executing \u2192 failed (id="${actionId}", type="${action.type}", error="${result.error}")`
5515
5349
  );
5516
5350
  setActions(
@@ -5531,7 +5365,7 @@ function useAppilotsActions(options = {}) {
5531
5365
  }
5532
5366
  } catch (err) {
5533
5367
  const errorMsg = err instanceof Error ? err.message : "Action failed";
5534
- chunkSIBKF7AA_js.appilotsDebugWarn(
5368
+ chunkMCY5YFYD_js.appilotsDebugWarn(
5535
5369
  `useAppilotsActions: action status transition: executing \u2192 failed (exception) (id="${actionId}", error="${errorMsg}")`
5536
5370
  );
5537
5371
  setActions(
@@ -5610,7 +5444,7 @@ function shouldShowSuggestedPrompts(args) {
5610
5444
 
5611
5445
  // src/hooks/useSuggestedPrompts.ts
5612
5446
  function useSuggestedPrompts(options) {
5613
- const { client } = chunkSIBKF7AA_js.useAppilotsContext();
5447
+ const { client } = chunkMCY5YFYD_js.useAppilotsContext();
5614
5448
  const { enabled, limit = 4 } = options;
5615
5449
  const [prompts, setPrompts] = react.useState([]);
5616
5450
  const [isLoading, setIsLoading] = react.useState(false);
@@ -5620,8 +5454,8 @@ function useSuggestedPrompts(options) {
5620
5454
  if (!enabled) return;
5621
5455
  const requestId = ++requestIdRef.current;
5622
5456
  let cancelled = false;
5623
- const screen = chunkSIBKF7AA_js.getCurrentScreen() ?? void 0;
5624
- const localDev = screen ? (chunkSIBKF7AA_js.getScreenMetadata(screen)?.suggestedPrompts ?? []).map((text) => ({
5457
+ const screen = chunkMCY5YFYD_js.getCurrentScreen() ?? void 0;
5458
+ const localDev = screen ? (chunkMCY5YFYD_js.getScreenMetadata(screen)?.suggestedPrompts ?? []).map((text) => ({
5625
5459
  text,
5626
5460
  source: "dev-defined"
5627
5461
  })) : [];
@@ -5646,9 +5480,9 @@ function useSuggestedPrompts(options) {
5646
5480
  }, [client, enabled, limit, refreshTick]);
5647
5481
  react.useEffect(() => {
5648
5482
  if (!enabled) return;
5649
- let lastScreen = chunkSIBKF7AA_js.getCurrentScreen();
5483
+ let lastScreen = chunkMCY5YFYD_js.getCurrentScreen();
5650
5484
  const interval = setInterval(() => {
5651
- const current = chunkSIBKF7AA_js.getCurrentScreen();
5485
+ const current = chunkMCY5YFYD_js.getCurrentScreen();
5652
5486
  if (current !== lastScreen) {
5653
5487
  lastScreen = current;
5654
5488
  setRefreshTick((t) => t + 1);
@@ -5663,14 +5497,14 @@ function useSuggestedPrompts(options) {
5663
5497
  };
5664
5498
  }
5665
5499
  function useAppilotsNavigation() {
5666
- const { emit } = chunkSIBKF7AA_js.useAppilotsContext();
5500
+ const { emit } = chunkMCY5YFYD_js.useAppilotsContext();
5667
5501
  const [currentScreen, setCurrentScreenState] = react.useState(null);
5668
5502
  const [navigationHistory, setNavigationHistory] = react.useState([]);
5669
5503
  const navigationRef = react.useRef(null);
5670
5504
  const setCurrentScreen2 = react.useCallback(
5671
5505
  (screenName) => {
5672
5506
  setCurrentScreenState(screenName);
5673
- chunkSIBKF7AA_js.setCurrentScreen(screenName);
5507
+ chunkMCY5YFYD_js.setCurrentScreen(screenName);
5674
5508
  setNavigationHistory((prev) => [...prev, screenName]);
5675
5509
  emit({
5676
5510
  type: "navigation:change",
@@ -5701,7 +5535,7 @@ function useAppilotsNavigation() {
5701
5535
 
5702
5536
  // src/hooks/useAppilots.ts
5703
5537
  function useAppilots() {
5704
- const { config, client } = chunkSIBKF7AA_js.useAppilotsContext();
5538
+ const { config, client } = chunkMCY5YFYD_js.useAppilotsContext();
5705
5539
  const chat = useAppilotsChat();
5706
5540
  const navigation = useAppilotsNavigation();
5707
5541
  const actions = useAppilotsActions();
@@ -5730,7 +5564,7 @@ function useAppilots() {
5730
5564
  }
5731
5565
  function useAppilotsField(id, options) {
5732
5566
  const { value, onChangeText, ref, fieldType, label, screen } = options;
5733
- const registry = chunkSIBKF7AA_js.useResolvedRegistry();
5567
+ const registry = chunkMCY5YFYD_js.useResolvedRegistry();
5734
5568
  const valueRef = react.useRef(value);
5735
5569
  const onChangeRef = react.useRef(onChangeText);
5736
5570
  valueRef.current = value;
@@ -5758,7 +5592,7 @@ function useAppilotsField(id, options) {
5758
5592
  }
5759
5593
  function useAppilotsTarget(id, options) {
5760
5594
  const { onPress, onLongPress, onScrollTo, label, screen } = options;
5761
- const registry = chunkSIBKF7AA_js.useResolvedRegistry();
5595
+ const registry = chunkMCY5YFYD_js.useResolvedRegistry();
5762
5596
  const onPressRef = react.useRef(onPress);
5763
5597
  const onLongPressRef = react.useRef(onLongPress);
5764
5598
  const onScrollToRef = react.useRef(onScrollTo);
@@ -5785,7 +5619,7 @@ function useAppilotsTarget(id, options) {
5785
5619
  }
5786
5620
  function useAppilotsToggle(id, options) {
5787
5621
  const { value, onValueChange, label, screen } = options;
5788
- const registry = chunkSIBKF7AA_js.useResolvedRegistry();
5622
+ const registry = chunkMCY5YFYD_js.useResolvedRegistry();
5789
5623
  const valueRef = react.useRef(value);
5790
5624
  const onChangeRef = react.useRef(onValueChange);
5791
5625
  valueRef.current = value;
@@ -5808,7 +5642,7 @@ function useAppilotsToggle(id, options) {
5808
5642
  }
5809
5643
  function useAppilotsSlider(id, options) {
5810
5644
  const { value, onValueChange, min, max, step, label, screen } = options;
5811
- const registry = chunkSIBKF7AA_js.useResolvedRegistry();
5645
+ const registry = chunkMCY5YFYD_js.useResolvedRegistry();
5812
5646
  const valueRef = react.useRef(value);
5813
5647
  const onChangeRef = react.useRef(onValueChange);
5814
5648
  valueRef.current = value;