{"version":3,"file":"ai-model/shared/planning-action.mjs","sources":["../../../../src/ai-model/shared/planning-action.ts"],"sourcesContent":["import type { PixelBbox, PlanningAction, PlanningLocateParam } from '@/types';\n\nexport type LocateActionParam = {\n  locate: PlanningLocateParam;\n};\n\nexport type LocatePlanningAction<TType extends string> =\n  PlanningAction<LocateActionParam> & {\n    type: TType;\n  };\n\nexport type ScrollPlanningAction = PlanningAction<\n  LocateActionParam & {\n    distance: number;\n    direction: 'up' | 'down' | 'left' | 'right';\n  }\n> & {\n  type: 'Scroll';\n};\n\nexport type DragAndDropPlanningAction = PlanningAction<{\n  from: PlanningLocateParam;\n  to: PlanningLocateParam;\n}> & {\n  type: 'DragAndDrop';\n};\n\ntype TapPlanningActionWithLocatedPixelBbox = PlanningAction<{\n  locate: {\n    locatedPixelBbox: PixelBbox;\n  };\n}>;\n\nexport function getTapLocatedPixelBbox(\n  actions: PlanningAction[],\n): PixelBbox | undefined {\n  for (const action of actions) {\n    if (action.type !== 'Tap') {\n      continue;\n    }\n\n    return (action as TapPlanningActionWithLocatedPixelBbox).param.locate\n      .locatedPixelBbox;\n  }\n\n  return undefined;\n}\n"],"names":["getTapLocatedPixelBbox","actions","action"],"mappings":"AAiCO,SAASA,uBACdC,OAAyB;IAEzB,KAAK,MAAMC,UAAUD,QACnB,IAAIC,AAAgB,UAAhBA,OAAO,IAAI,EAIf,OAAQA,OAAiD,KAAK,CAAC,MAAM,CAClE,gBAAgB;AAIvB"}