1import{a as T}from"./chunk-KOLG7EBW.js";import{a as A,db as I}from"./chunk-N6RRKPMH.js";import{d as V}from"./chunk-5IJU7MQ2.js";import{a as L}from"./chunk-LM6BYTWK.js";import{q as n,r as R,u as c}from"./chunk-ECXCM7JU.js";import{b as v}from"./chunk-G6PWMA7J.js";import{F as u,Y as d,ba as M,fa as g,i as p}from"./chunk-IQ6SK2BU.js";import{d as a}from"./chunk-OXDKANHF.js";import{a as y,b as f}from"./chunk-XUHYVR5R.js";var b=(()=>{class i{static{this.type="[MechVision] Load Vision Access"}}return i})(),E=(()=>{class i{static{this.type="[MechVision] Set Vision Tier"}constructor(e){this.tier=e}}return i})(),F=(()=>{class i{static{this.type="[MechVision] Init Wizard"}constructor(e){this.vehicleId=e}}return i})(),x=(()=>{class i{static{this.type="[MechVision] Update Wizard State"}constructor(e){this.patch=e}}return i})(),k=(()=>{class i{static{this.type="[MechVision] Create Scan"}constructor(e){this.request=e}}return i})(),w=(()=>{class i{static{this.type="[MechVision] Upload Photos"}constructor(e,r){this.scanId=e,this.photos=r}}return i})(),W=(()=>{class i{static{this.type="[MechVision] Analyze Scan"}constructor(e){this.scanId=e}}return i})(),_=(()=>{class i{static{this.type="[MechVision] Load Report"}constructor(e){this.reportId=e}}return i})(),P=(()=>{class i{static{this.type="[MechVision] Set Active Report"}constructor(e){this.report=e}}return i})(),U=(()=>{class i{static{this.type="[MechVision] Submit Feedback"}constructor(e,r){this.reportId=e,this.feedback=r}}return i})(),N=(()=>{class i{static{this.type="[MechVision] Reset"}}return i})(),j=(()=>{class i{static{this.type="[MechVision] Set Error"}constructor(e){this.error=e}}return i})(),O=(()=>{class i{static{this.type="[MechVision] Clear Error"}}return i})();var z={step:"vehicle-select",selectedVehicleId:null,selectedScanType:null,laborRate:null,scanId:null,capturedPhotos:[],scanMode:"quick"},H={visionTier:null,capabilities:null,wizardState:null,activeReport:null,recentReports:[],isLoading:!1,isAnalyzing:!1,error:null,errorCode:null},s=class m{constructor(t,e,r,o){this.api=t,this.toastr=e,this.analytics=r,this.translate=o}static visionTier(t){return t.visionTier}static capabilities(t){return t.capabilities}static wizardState(t){return t.wizardState}static activeReport(t){return t.activeReport}static recentReports(t){return t.recentReports}static isLoading(t){return t.isLoading}static isAnalyzing(t){return t.isAnalyzing}static error(t){return t.error}static errorCode(t){return t.errorCode}loadVisionAccess(t){return t.patchState({isLoading:!0,error:null}),this.api.getAccess().pipe(d(e=>{t.patchState({visionTier:e.visionTier,capabilities:e.capabilities,isLoading:!1})}),u(e=>{let r=this.extractMsg(e,"Failed to load MECH Vision access");return t.patchState({isLoading:!1,error:r}),p}))}setVisionTier(t,e){t.patchState({visionTier:e.tier})}initWizard(t,e){t.patchState({wizardState:f(y({},z),{selectedVehicleId:e.vehicleId??null}),activeReport:null,error:null,errorCode:null})}updateWizardState(t,e){let r=t.getState().wizardState??z;t.patchState({wizardState:y(y({},r),e.patch)})}createScan(t,e){return t.patchState({isLoading:!0,error:null,errorCode:null}),this.api.createScan(e.request).pipe(d(r=>{let o=t.getState().wizardState??z;t.patchState({isLoading:!1,wizardState:f(y({},o),{scanId:r.scanId,step:"guided-capture"})})}),u(r=>{let o=this.extractMsg(r,"Failed to create scan");return this.toastr.error(o),t.patchState({isLoading:!1,error:o,errorCode:this.extractCode(r)}),this.reportFailure("create_scan",r,o),p}))}uploadPhotos(t,e){return t.patchState({isLoading:!0,error:null,errorCode:null}),this.api.uploadPhotos(e.scanId,{photos:e.photos}).pipe(d(()=>{t.patchState({isLoading:!1})}),u(r=>{let o=this.extractMsg(r,"Failed to upload photos"),h=this.extractCode(r);return(!h||!["ImageTooLarge","PayloadTooLarge","TooManyPhotos"].includes(h))&&this.toastr.error(o),t.patchState({isLoading:!1,error:o,errorCode:h}),this.reportFailure("upload_photos",r,o),p}))}analyzeScan(t,e){return t.patchState({isAnalyzing:!0,error:null,errorCode:null}),this.api.analyzeScan(e.scanId).pipe(d(r=>{t.patchState({isAnalyzing:!1,activeReport:r})}),u(r=>{let o=this.extractMsg(r,"Analysis failed. Please try again.");return V(r)||this.toastr.error(o),t.patchState({isAnalyzing:!1,error:o,errorCode:this.extractCode(r)}),this.reportFailure("analyze",r,o),p}))}loadReport(t,e){return t.patchState({isLoading:!0,error:null}),this.api.getReport(e.reportId).pipe(d(r=>{t.patchState({isLoading:!1,activeReport:r})}),u(r=>{let o=this.extractMsg(r,"Failed to load report");return t.patchState({isLoading:!1,error:o}),p}))}setActiveReport(t,e){t.patchState({activeReport:e.report})}submitFeedback(t,e){return this.api.submitFeedback(e.reportId,e.feedback).pipe(d(()=>{this.toastr.success(this.translate.instant("V2.MECH_VISION.FEEDBACK_SUCCESS"))}),u(()=>p))}reset(t){t.setState(H)}setError(t,e){t.patchState({error:e.error,isLoading:!1,isAnalyzing:!1})}clearError(t){t.patchState({error:null,errorCode:null})}extractMsg(t,e){let r=t;return r?.status===0?this.translate.instant("V2.COMMON.CONNECTION_UNSTABLE"):r?.error?.detail??r?.error?.message??r?.message??e}extractCode(t){let r=t?.error?.code;return typeof r=="string"&&r.length>0?r:null}reportFailure(t,e,r){let o=this.extractCode(e),h=V(e);if(this.analytics.logMechVisionError(h&&o==="DailyLimitReached"?`${t}_daily_limit`:t,o??r),h)return;let S=e?.status,C=o??(S===0?"network_unavailable":S!=null?`http_${S}`:"unknown");A(new Error(`[MechVision] ${t} failed: ${C}`),l=>(l.setTag("feature","mech-vision"),l.setTag("stage",t),S!=null&&l.setTag("http_status",String(S)),o&&l.setTag("error_code",o),l.setExtra("detail",r),l.setFingerprint(["mech-vision",t,C]),l))}static{this.\u0275fac=function(e){return new(e||m)(g(T),g(L),g(I),g(v))}}static{this.\u0275prov=M({token:m,factory:m.\u0275fac})}};a([n(b)],s.prototype,"loadVisionAccess",null);a([n(E)],s.prototype,"setVisionTier",null);a([n(F)],s.prototype,"initWizard",null);a([n(x)],s.prototype,"updateWizardState",null);a([n(k)],s.prototype,"createScan",null);a([n(w)],s.prototype,"uploadPhotos",null);a([n(W)],s.prototype,"analyzeScan",null);a([n(_)],s.prototype,"loadReport",null);a([n(P)],s.prototype,"setActiveReport",null);a([n(U)],s.prototype,"submitFeedback",null);a([n(N)],s.prototype,"reset",null);a([n(j)],s.prototype,"setError",null);a([n(O)],s.prototype,"clearError",null);a([c()],s,"visionTier",null);a([c()],s,"capabilities",null);a([c()],s,"wizardState",null);a([c()],s,"activeReport",null);a([c()],s,"recentReports",null);a([c()],s,"isLoading",null);a([c()],s,"isAnalyzing",null);a([c()],s,"error",null);a([c()],s,"errorCode",null);s=a([R({name:"mechVision",defaults:H})],s);export{b as a,F as b,x as c,k as d,w as e,W as f,_ as g,P as h,N as i,s as j};
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.