import{r as l,d as h,a as i,c as I,cm as x,cC as O,cD as z,cE as N,cF as L,cG as R,cH as U,cI as J,b as B,H,e as j,w as F,h as G,ak as P}from"./index-OSKNspXo.js";class X{async init(a,t){return(await l.post("/api/magasin/init",{type:a,version:t})).data.data}async getCategories(){return(await l.get("/api/magasin/categories")).data.list}async getAll({criterias:a}){return(await l.post("/api/magasin/all",{criterias:a})).data.data}async get(a){return(await l.get(`/api/magasin/${a}`)).data.data}async deleteEquipment(a){await l.delete(`/api/magasin/${a}`)}async saveEquipment(a,t){await l.put(`/api/magasin/${a}`,t)}async validate(a){let t={type:a.type.label,mag:a.description.mag,type_mag:a.description.type_mag,libelle:a.description.libelle};return(await l.post("/api/magasin/validate",t)).data.data}async generate(a){let t={type:a.type.label,version:a.version.label,subVersion:a.version.subLabel,mag:a.description.mag,type_mag:a.description.type_mag,id_robot:a.description.id_robot??"",id_zone:a.description.id_zone??"",libelle:a.description.libelle};return Object.keys(a.description.options).forEach(e=>{t[e]=a.description.options[e]}),(await l.post("/api/magasin/generate",t)).data.data}async saveAvatar(a,t){const s=new FormData;return s.append("files[0]",t),(await l.put(`/api/magasin/${a}/avatar`,s,{headers:{"Content-Type":"multipart/form-data"}})).data.avatar}async removeAvatar(a){await l.delete(`/api/magasin/${a}/avatar`)}}class K{async getTypes(){return(await l.get("/api/catalog/types")).data.list}async getVersions(a){return(await l.get(`/api/catalog/${a}/versions`)).data.list}async getAllVersions(){return(await l.get("/api/catalog/versions")).data.list}async getOptions(a,t){return(await l.get(`/api/catalog/${a}/${t}/options`)).data.list}}const Q=h("StepperAddStore",()=>{const n=i(1),a=new X,t=new K,s=i(!1),e=i({}),r=i({mag:null,type_mag:null,id_robot:null,libelle:null,id_zone:null,options:[]}),c=i(null),o=i(null),p=i(""),A={ACCED:"ACCED",AIDE:"AIDE",ASTUS:"ASTUS",RIEDL:"RIEDL",EXTERNAL:"EXTERNE"},y=i([]),m=i([]),d=i([]);async function $(u){e.value.type={...u},n.value=2,await E(e.value.type.pk),o.value=null,o.value=_,p.value=null,c.value=null}async function C(u){e.value.version={...u},await D(e.value.type.label,e.value.version),n.value=3,r.value.options={},await S(e.value.type.pk,e.value.version.pk),d.value.forEach(v=>{r.value.options[v.label]=v.value}),o.value=b,c.value=w,p.value=null}async function _(){e.value.type=null,n.value=1,await f()}async function w(){e.value.description=JSON.parse(JSON.stringify(r.value)),await a.validate(e.value),n.value=4,p.value="equipments.creation.generate",c.value=V,o.value=k}async function b(){e.value.version=null,n.value=2,o.value=null,o.value=_,c.value=null,p.value=null,await E(e.value.type.pk)}async function V(){try{return s.value=!0,await a.generate(e.value)}finally{s.value=!1}}async function k(){r.value=JSON.parse(JSON.stringify(e.value.description)),n.value=3,o.value=b,c.value=w,p.value=null,await S(e.value.type.pk,e.value.version.pk)}async function D(u,v){let g=await a.init(u,v.label);r.value.mag=g.mag,r.value.type_mag=g.type_mag,r.value.libelle=g.libelle}async function T(){n.value=1,o.value=null,c.value=null,p.value=null,e.value={},await f(),r.value={mag:null,type_mag:null,id_robot:null,libelle:null,id_zone:null,options:[]}}async function f(){y.value=await t.getTypes()}async function E(u){m.value=await t.getVersions(u)}async function S(u,v){d.value=await t.getOptions(u,v)}return{step:n,equipment:e,equipmentType:A,types:y,versions:m,next:c,prev:o,options:d,nexLabel:p,loading:s,nextSelectType:$,nextVersion:C,description:r,reset:T}}),M=["src"],Y={__name:"avatarEquipmentComponent",props:{equipement:{type:Object},size:{type:String}},setup(n){const a=n;Q();const t=I(()=>{let s=null;switch(a.equipement.label){case"RIEDL_2":s=J;break;case"AIDE_V2":case"ACCED_V2":s=U;break;case"ACCED_V3":s=R;break;case"ASTUS_V2":case"ASTUS_V3":s=L;break;case"AIDE_CUT_V1":s=N;break;case"AIDE_PICK_V1":s=z;break;case"CHARIOT_V1":case"ETAGERE_V1":s=O;break;default:s=x}return s});return(s,e)=>t.value?(j(),B(P,{key:0,size:n.size??"3rem",color:"white"},{default:F(()=>[G("img",{src:t.value,style:{"max-height":"10vh"},alt:""},null,8,M)]),_:1},8,["size"])):H("",!0)}};export{K as C,X as E,Y as _,Q as u};
//# sourceMappingURL=stepperGeneratorComponent.vue_vue_type_style_index_0_lang-D_tXregx.js.map
