1import{C as e}from"./config.fPWQ9Zl8.js";import{F as o}from"./form.BcT4gWOe.js";const d=()=>({data:{rating_points:0,rating_points_fitting:6,rating_points_length:6,message:"",name:"",body_size:"",email:"",privacy:!1,article_id:null,color_id:null,order_id:null},stars:{total:5},config:{url:`${e.params.getParam("base_url.shop_api")}app/article_rating.json`},errors:{general:!1,rating_points:!1,duplicate:!1},success:!1,init(t){if(!t)return;const{articleId:a,colorId:s,refOrderId:i,userEmail:r}=JSON.parse(t);i==="ALREADY_RATED"&&(this.errors.duplicate=!0),this.data.article_id=a,this.data.color_id=s,this.data.order_id=i,this.data.email=r,this.$nextTick(()=>{new o})},setRatingPoints(t){this.data.rating_points=t,this.errors.rating_points=!1},submitForm(){this.validateForm()&&this.addRating()},validateForm(){let t=!0;return(this.data.article_id===null||this.data.color_id===null)&&(this.errors.general=!0,t=!1),this.data.rating_points===0&&(this.errors.rating_points=!0,t=!1),(this.data.email===""||this.data.privacy===!1)&&(t=!1),t},async addRating(){try{const a=await(await fetch(this.config.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:this.data})})).json();a.success?this.success=!0:a.message==="already rated"&&(this.errors.duplicate=!0)}catch(t){console.error(t),this.errors.general=!0}}});export{d as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.