import{aQ as e}from"./index-DrvLDslf.js";import{r as s}from"./reflection-Dr3WM5Rz.js";async function p(){const{data:t}=await e.get("/sl/projection/sites");return t}async function d(){const{data:t}=await e.get("/sl/projection/tracks");return t}function i(t){if(!t)return"idle";const r=t.toLowerCase();return/fault|error|failed|故障|异常|失联|超时|检修/.test(r)?"fault":/charg|充电/.test(r)?"charging":/pause|暂停|挂起/.test(r)?"paused":/offline|离线/.test(r)?"offline":/run|busy|working|运行|工作|执行|忙/.test(r)?"running":"idle"}function o(t){if(!t)return"queued";const r=t.toLowerCase();return/run|运行|执行/.test(r)?"running":/pause|暂停|挂起/.test(r)?"paused":/complete|done|完成|成功/.test(r)?"completed":/cancel|取消|中止/.test(r)?"cancelled":/fail|error|fault|失败|异常/.test(r)?"failed":/assign|分配/.test(r)?"assigned":"queued"}function u(t){return{id:`C${String(t.id).padStart(2,"0")}`,rawId:t.id,name:t.name,typeName:t.typeName,x:0,y:0,theta:0,batterySoc:.8,state:i(t.status),lastUpdate:new Date().toISOString(),group:t.layer??void 0}}function c(t){return{id:`M${String(t.id).padStart(2,"0")}`,name:t.name,typeName:t.typeName,priority:50,status:o(t.status),steps:[],createdAt:new Date().toISOString()}}async function n(){return(await s.listObjects("car")).map(u)}async function a(){return(await s.listObjects("mission")).map(c)}async function m(){try{const{data:t}=await e.get("/sl/projection/cars");if(Array.isArray(t)&&t.length>0)return t;const r=await n();return r.length>0?r:Array.isArray(t)?t:[]}catch{return n()}}async function y(){try{const{data:t}=await e.get("/sl/projection/missions");if(Array.isArray(t)&&t.length>0)return t;const r=await a();return r.length>0?r:Array.isArray(t)?t:[]}catch{return a()}}export{y as a,p as b,d as c,m as l};
