{"version":3,"file":"defaultImpls.mjs","sources":["webpack://@ui-tars-test/agent-sdk/./src/defaultImpls.ts"],"sourcesContent":["/*\n * Copyright (c) 2025 Bytedance, Inc. and its affiliates.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n  Coordinates,\n  ImageDetailCalculator,\n  NormalizeCoordinates,\n} from '@ui-tars-test/shared/types';\n\n/**\n * Default coordinate normalization function\n * Normalizes raw coordinates by dividing by 1000 (simple scaling)\n * @param rawCoords - The raw coordinates to normalize\n * @returns Object containing normalized coordinates\n */\nexport const defaultNormalizeCoords: NormalizeCoordinates = (rawCoords: Coordinates) => {\n  if (!rawCoords.raw) {\n    return { normalized: rawCoords };\n  }\n  const clamp01 = (value: number): number => Math.min(1, Math.max(0, value));\n  const normalizedCoords = {\n    ...rawCoords,\n    normalized: {\n      x: clamp01(rawCoords.raw.x / 1000),\n      y: clamp01(rawCoords.raw.y / 1000),\n    },\n  };\n  return { normalized: normalizedCoords };\n};\n\n/**\n * Default implementation for detail calculation based on pixel count\n * detail:low mode: 1,048,576 px (1024×1024)\n * detail:high mode: 4,014,080 px (2048×1960)\n */\nexport const defaultDetailCalculator: ImageDetailCalculator = (\n  width: number,\n  height: number,\n): 'low' | 'high' | 'auto' => {\n  // Always use 'high' detail for GUI tasks to ensure text and small elements are visible\n  // 'low' detail (512x512) is too small for screen reading\n  // 'auto' might choose 'low' for smaller screens incorrectly\n  return 'high';\n};\n"],"names":["defaultNormalizeCoords","rawCoords","clamp01","value","Math","normalizedCoords","defaultDetailCalculator","width","height"],"mappings":";;;;AAgBO,MAAMA,yBAA+C,CAACC;IAC3D,IAAI,CAACA,UAAU,GAAG,EAChB,OAAO;QAAE,YAAYA;IAAU;IAEjC,MAAMC,UAAU,CAACC,QAA0BC,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,CAAC,GAAGD;IACnE,MAAME,mBAAmB;QACvB,GAAGJ,SAAS;QACZ,YAAY;YACV,GAAGC,QAAQD,UAAU,GAAG,CAAC,CAAC,GAAG;YAC7B,GAAGC,QAAQD,UAAU,GAAG,CAAC,CAAC,GAAG;QAC/B;IACF;IACA,OAAO;QAAE,YAAYI;IAAiB;AACxC;AAOO,MAAMC,0BAAiD,CAC5DC,OACAC,SAKO"}