PageSourceSearch

https://www.upcar.ai/_next/static/chunks/14950-96eb4074f0237429.js

js upcar.ai collected 2026-10-05 15:27:07 UTC 101,056 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[14950],{14467:function(e,t,r){"use strict";r.d(t,{BE:function(){return c},DQ:function(){return d},M:function(){return s},Te:function(){return l}});let i="https://apiprod.upcar.ai/v1";class l extends Error{constructor(e,t,r){super(t),this.name="UploadError",this.kind=e,this.status=r}}let n=e=>e&&"TypeError"===e.name,a=async(e,t)=>{let r=async()=>{let r=new AbortController,i=setTimeout(()=>r.abort(),6e4);try{return await fetch(e,{...t,signal:r.signal})}finally{clearTimeout(i)}};try{return await r()}catch(e){if(e&&"AbortError"===e.name)throw new l("timeout","Upload timed out. Check your connection and try again.");if(n(e))try{return await r()}catch(e){if(e&&"AbortError"===e.name)throw new l("timeout","Upload timed out. Check your connection and try again.");throw new l("network","We couldn't reach the server. Check your connection and try again.")}throw e}},o=async(e,t)=>{let r=null;try{r=await e.json()}catch(e){}return 413===e.status?new l("too_large","File too large — try a smaller photo.",413):e.status>=500?new l("server",r&&r.message||"Server error. Please try again.",e.status):new l("client",r&&r.message||t||e.statusText,e.status)},s=async(e,t,r)=>{if(!e)throw console.error("No file selected"),new l("client","No file selected");let n=new FormData;n.append("images",e),n.append("fileType",t);try{let e=await a("".concat(i,"/users/addDlImages"),{method:"POST",headers:{Authorization:"Bearer ".concat(r)},body:n});if(!e.ok){let t=await o(e,"Failed to upload the image");throw console.error("Server error response:",t.message),t}return await e.json()}catch(e){if(e instanceof l)throw e;throw console.error("Error uploading image:",e),new l("unknown","An error occurred while uploading the image: ".concat(e.message||e))}},c=async(e,t,r)=>{let n=new FormData;e.forEach(e=>{n.append("images",e)}),n.append("fileType",t);try{let e=await a("".concat(i,"/image/uploadSecretImages"),{method:"POST",headers:{Authorization:"Bearer ".concat(r)},body:n});if(!e.ok)throw await o(e,"Image upload failed");return await e.json()}catch(e){if(e instanceof l)throw e;throw console.error("Error uploading images:",e),new l("unknown",e.message||"Image upload failed")}},d=async(e,t)=>{let r=e.replace(/\//g,"%2F");try{let e=await fetch("".concat(i,"/image/generateSecretImagePresignedUrlNew"),{method:"POST",headers:{Authorization:"Bearer ".concat(t),"Content-Type":"application/json"},body:JSON.stringify({key:r})}),l=await e.json();if(l.status)return l.url;throw Error("Failed to generate URL")}catch(e){return console.error("Error fetching image URL:",e),null}}},59362:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var i=r(27573),l=r(3458),n=r(65880);function a(e){let{photo:t,x:r,y:a}=e;return t?(0,l.createPortal)((0,i.jsx)("div",{"data-testid":"photo-drag-preview",className:"pointer-events-none fixed z-[100] h-[105px] w-[126px] overflow-hidden rounded-xl border-2 border-white bg-white shadow-xl",style:{left:r-63,top:a-52},"aria-hidden":"true",children:(0,i.jsx)(n.default,{src:t.url,alt:"",unoptimized:!0,loading:"eager",fill:!0,sizes:"126px",draggable:!1,className:"object-cover"})}),document.body):null}},89111:function(e,t,r){"use strict";r.d(t,{default:function(){return a}});var i=r(27573),l=r(7653);let n=["Warming up the engine...","Checking tire pressure...","Fueling up for the ride...","Fastening seatbelts...","Polishing the rims...","Tuning the radio to your vibe...","Adjusting mirrors...","Wiping down the windshield...","Charging the battery...","Starting the ignition...","Brakes checked... we're not stopping though.","Applying one last coat of wax.","Recalculating... just for fun.","Revving up... but not too loud.","Parallel parking this app... perfectly.","Tires spinning, pages loading.","Cleaning out the glove box...","Brushing off the license plate...","Making sure the AC works...","Test-driving your experience...","Double-checking the handbrake...","Checking under the hood... of the code.","Making sure the cup holders are deep enough.","Avoiding potholes in the backend.","Installing fuzzy dice... virtually.","Spinning the odometer back to 0...","Calibrating GPS for adventure...","Revving the engine...","Filling the tank with premium code...","Aligning your wheels for launch..."];function a(){let[e,t]=(0,l.useState)(0);return(0,l.useEffect)(()=>{t(Math.floor(Math.random()*n.length));let e=setInterval(()=>{t(e=>(e+1)%n.length)},3e3);return()=>clearInterval(e)},[]),(0,i.jsx)("div",{"data-app-loader":!0,className:"absolute inset-0 flex items-center justify-center bg-white/80 z-10",children:(0,i.jsxs)("div",{className:"flex flex-col items-center",children:[(0,i.jsx)("div",{className:"w-[50px] h-[50px] rounded-full flex items-center justify-center shadow-[0_0_15px_rgba(0,119,255,0.3)] animate-spin-custom",style:{background:"conic-gradient(from 0deg, #027bff, #00c6ff, #027bff)"},children:(0,i.jsx)("div",{className:"w-[18px] h-[18px] rounded-full bg-white shadow-[0_0_5px_rgba(255,255,255,0.5)]"})}),(0,i.jsx)("div",{className:"mt-4 bg-gradient-to-r from-[#027bff] to-[#00c6ff] bg-clip-text text-transparent text-sm font-medium text-center animate-fade-in",children:n[e]})]})})}},42791:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return ej}});var i=r(27573),l=r(67580),n=r(74825),a=r(33880),o=r(89825),s=r(14467),c=r(82523),d=r(65547),u=r(61192),m=r(52351),p=r(24286),h=r(54945);let x=e=>"upcar:sell-photo-draft:".concat(e);function f(e){if(e)try{window.sessionStorage.removeItem(x(e))}catch(e){}}var g=r(89111),v=r(19891),b=r.n(v),y=r(79509),w=r(66282),j=r(7157),F=r(65731),N=r(5363),k=r(31435),C=r(57908),S=r(59362),P=r(20422),E=r(1578),D=r(67754),U=r(7653),B=r(7384),T=r(15025),M=r(52919);let L=["gas","diesel","ev","hybrid"],_="https://apiprod.upcar.ai/v1",I="/assets/img/buy-sell/sell-flow",A=[{value:"Black",hex:"#1A1D20"},{value:"Charcoal Grey",hex:"#54585E"},{value:"Grey",hex:"#707379"},{value:"Silver",hex:"#CCD0D5"},{value:"White",hex:"#EEF3F8",border:"#D0D5DD"},{value:"Pearl White",hex:"#FFFFFF",border:"#D0D5DD"}
1,{value:"Beige",hex:"#F4F3D6",border:"#E4E3C6"},{value:"Gold",hex:"#D1B875"},{value:"Tan",hex:"#C6A984"},{value:"Brown",hex:"#502013"},{value:"Burgundy",hex:"#5E0B19"},{value:"Red",hex:"#E01F35"},{value:"Orange",hex:"#FF7D00"},{value:"Yellow",hex:"#FFEB00"},{value:"Dark Green",hex:"#224A2D"},{value:"Bright Green",hex:"#0F9950"},{value:"Light Green",hex:"#778F7A"},{value:"Dark Blue",hex:"#0D1845"},{value:"Bright Blue",hex:"#198CD8"},{value:"Light Blue",hex:"#5570C3"},{value:"Purple",hex:"#523163"}],R=[{key:"front-right-quarter",label:"Front Right Quarter",art:"".concat(I,"/slot-front-right-quarter.svg"),artWidth:87,artHeight:59},{key:"front-left-quarter",label:"Front Left Quarter",art:"".concat(I,"/slot-front-left-quarter.svg"),artWidth:84,artHeight:57},{key:"rear-right-quarter",label:"Rear Right Quarter",art:"".concat(I,"/slot-rear-right-quarter.svg"),artWidth:88,artHeight:54},{key:"rear-left-quarter",label:"Rear Left Quarter",art:"".concat(I,"/slot-rear-left-quarter.svg"),artWidth:88,artHeight:54},{key:"front-right-wheel",label:"Front Right Wheel",art:"".concat(I,"/slot-wheel.svg"),artWidth:72,artHeight:65},{key:"front-left-wheel",label:"Front Left Wheel",art:"".concat(I,"/slot-wheel.svg"),artWidth:72,artHeight:65},{key:"rear-right-wheel",label:"Rear Right Wheel",art:"".concat(I,"/slot-wheel.svg"),artWidth:72,artHeight:65},{key:"rear-left-wheel",label:"Rear Left Wheel",art:"".concat(I,"/slot-wheel.svg"),artWidth:72,artHeight:65},{key:"odometer",label:"Odometer",art:"".concat(I,"/slot-odometer-digits.svg"),artWidth:64,artHeight:15,isOdometer:!0},{key:"front-seat-interior",label:"Front Seat Interior",art:"".concat(I,"/slot-front-seat-interior.svg"),artWidth:88,artHeight:59},{key:"rear-seat-interior",label:"Rear Seat Interior",art:"".concat(I,"/slot-rear-seat-interior.svg"),artWidth:88,artHeight:53},{key:"360-video",label:"360 Video",art:"",artWidth:0,artHeight:0,isVideo:!0}],V=R.filter(e=>!e.isVideo).length,z={photos:{minCount:6,maxCount:20},video:{allowedMimeTypes:["video/mp4","video/quicktime","video/webm"],maxBytes:104857600,maxDurationSeconds:60,minDurationSeconds:3}},O=Math.max(V,z.photos.maxCount);function q(e,t){let r=Array(O).fill(""),i=new Set(e.filter(Boolean));return(t||[]).slice(0,O).forEach((e,t)=>{e&&i.has(e)&&(r[t]=e,i.delete(e))}
1),i.forEach(e=>{let t=r.indexOf("");-1!==t&&(r[t]=e)}),r}function Z(){return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{"aria-hidden":"true",className:"ml-0.5 text-sm font-semibold text-[#CB2029]",children:"*"}),(0,i.jsx)("span",{className:"sr-only",children:" (required)"})]})}function W(e){if("string"!=typeof e)return"hybrid";let t=e.toLowerCase();return"gasoline"===t||"petrol"===t?"gas":L.includes(t)?t:"hybrid"}function Y(e){return"string"!=typeof e?"":"Other"===e?"sedan":e}function H(e){return e&&String(e.vin||"").trim()&&String(e.make||"").trim()&&String(e.model||"").trim()&&String(e.carYear||"").trim()&&String(e.carType||"").trim()?String(e.odometer||"").trim()&&String(e.transmissionType||"").trim()&&String(e.title||"").trim()&&String(e.previewsOwner||"").trim()&&(0,p.mb)(String(e.noLoan||"").trim())&&String(e.exteriorColor||"").trim()&&String(e.interiorColor||"").trim()?Number(e.askingPriceByHost||0)>0?3:2:1:0}function G(e){let{onClick:t}=e;return(0,i.jsx)("button",{type:"button",onClick:t,"aria-label":"Go back",className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full border border-[#F0F0F0] bg-white shadow-[0px_1px_4px_0px_rgba(14,15,17,0.05)] transition-colors hover:bg-[#F9F9F9]",children:(0,i.jsx)("img",{src:"/assets/img/subscription/back-arrow.svg",alt:"",className:"h-5 w-5"})})}function Q(e){let{tabs:t,activeIndex:r,onChange:l}=e;return(0,i.jsx)("div",{className:"flex w-[328px] max-w-full items-center gap-0 rounded-[43px] bg-[#F0F0F0] p-1",children:t.map((e,t)=>(0,i.jsx)("button",{type:"button",onClick:()=>l(t),className:(0,C.Z)("flex h-10 flex-1 items-center justify-center rounded-[32px] px-4 py-2 text-base font-semibold leading-6 transition-colors",r===t?"bg-white text-[#1F1F1F]":"bg-transparent text-[#454545]"),children:e},e))})}function $(e){let{title:t,description:r,align:l="left",descriptionSize:n="sm"}=e;return(0,i.jsxs)("div",{className:(0,C.Z)("flex flex-col gap-2","center"===l?"items-center text-center":"items-start text-left"),children:[(0,i.jsx)("h1",{className:"w-full text-2xl font-bold leading-[34px] text-[#0E0F11]",children:t}),r?(0,i.jsx)("p",{className:(0,C.Z)("w-full font-normal text-[#595959]","lg"===n?"text-base leading-[26px] tracking-[0.16px]":"text-sm leading-5"),children:r}):null]})}function K(e){let{children:t,required:r=!1,htmlFor:l}=e;return(0,i.jsxs)("label",{htmlFor:l,className:"block text-sm font-medium leading-5 tracking-[0.14px] text-[#1F1F1F]",children:[t,r?(0,i.jsx)(Z,{}):null]})}let J="h-10 w-full rounded-[10px] border bg-white px-[10px] text-[15px] font-medium leading-[22px] tracking-[0.15px] text-[#0E0F11] placeholder:font-medium placeholder:text-[#BFBFBF] focus:outline-none focus:border-[#0E0F11]";function X(e){let{children:t}=e;return t?(0,i.jsx)("p",{className:"text-xs leading-4 text-[#CB2029]",children:t}):null}function ee(e){let{value:t,onChange:r,placeholder:l,hasError:n=!1,inputMode:a,maxLength:o,id:s}=e;return(0,i.jsx)("input",{id:s,value:t,inputMode:a,maxLength:o,onChange:e=>r(e.target.value),placeholder:l,className:(0,C.Z)(J,n?"border-[#CB2029]":"border-[#F0F0F0]")})}function et(e){let{value:t,onChange:r,placeholder:l,options:n,hasError:a=!1,id:o}=e;return(0,i.jsxs)("div",{className:"relative",children:[(0,i.jsxs)("select",{id:o,value:t,onChange:e=>r(e.target.value),className:(0,C.Z)(J,"appearance-none pr-9",a?"border-[#CB2029]":"border-[#F0F0F0]",t?"text-[#0E0F11]":"text-[#BFBFBF]"),children:[(0,i.jsx)("option",{value:"",children:l}),n.map(e=>(0,i.jsx)("option",{value:e.value,className:"text-[#0E0F11]",children:e.label},e.value))]}),(0,i.jsx)(N.K,{size:20,stroke:"#0E0F11",className:"pointer-events-none absolute right-[10px] top-1/2 -translate-y-1/2"})]})}function er(e){let{checked:t}=e;return t?(0,i.jsxs)("span",{className:"relative flex h-6 w-6 shrink-0 items-center justify-center",children:[(0,i.jsx)("span",{className:"block h-5 w-5 rounded-full border-2 border-[#0E0F11] bg-white shadow-[0px_0px_0px_2px_#F0F0F0]"}),(0,i.jsx)("span",{className:"absolute left-[7px] top-[7px] block h-2.5 w-2.5 rounded-full bg-[#0E0F11] shadow-[0px_1px_4px_0px_rgba(14,15,17,0.05)]"})]}):(0,i.jsx)("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center",children:(0,i.jsx)("span",{className:"block h-5 w-5 rounded-full border-2 border-[#F0F0F0]"})})}
1function ei(e){let{name:t,options:r,value:l,onChange:n,compact:a=!1}=e;return(0,i.jsx)("div",{className:"flex flex-wrap items-start gap-3",children:r.map(e=>{let r=l===e.value;return(0,i.jsxs)("label",{className:(0,C.Z)("flex cursor-pointer items-center gap-2 rounded-[10px] border border-[#F0F0F0] p-2 transition-colors",a?"shrink-0":"min-w-0 flex-1",r?"bg-[#F9F9F9]":"bg-white"),children:[(0,i.jsx)("input",{type:"radio",name:t,checked:r,onChange:()=>n(e.value),className:"sr-only"}),(0,i.jsx)(er,{checked:r}),(0,i.jsx)("span",{className:"whitespace-nowrap text-[15px] font-medium leading-[22px] tracking-[0.15px] text-black",children:e.label})]},e.value)})})}function el(e){let{children:t,onClick:r,disabled:l=!1,isLoading:n=!1,fullWidth:a=!1,type:o="button"}=e;return(0,i.jsxs)("button",{type:o,onClick:r,disabled:l||n,className:(0,C.Z)("inline-flex h-12 items-center justify-center gap-2 rounded-xl bg-[#0E0F11] px-4 py-2.5 text-base font-semibold leading-6 text-white transition-opacity disabled:cursor-not-allowed disabled:bg-[#F0F0F0] disabled:text-[#BFBFBF]",a?"w-full":"min-w-[185px]"),children:[n?(0,i.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white/40 border-t-white"}):null,t]})}function en(e){let{children:t,onClick:r,disabled:l=!1,className:n}=e;return(0,i.jsx)("button",{type:"button",onClick:r,disabled:l,className:(0,C.Z)("inline-flex h-12 items-center justify-center gap-2 whitespace-nowrap rounded-xl border border-[#F0F0F0] bg-white px-3 text-base font-semibold leading-6 text-[#1F1F1F] transition-colors hover:bg-[#F9F9F9] disabled:cursor-not-allowed disabled:opacity-60",n),children:t})}function ea(e){let{carDetails:t,vehicleSpecs:r,previewPhotoUrl:l,onEditDetails:n}=e,a=[t.carYear,t.make,t.model].filter(Boolean).join(" ").toUpperCase(),o=[t.model,"--"!==r.drive?r.drive:"",t.doors?"".concat(t.doors," Door"):"","--"!==r.body?r.body:"","--"!==r.engine?r.engine:""].filter(Boolean).join(" "),s=[{icon:"/assets/img/buy-sell/car-details/engine.svg",label:"ENGINE",value:r.engine},{icon:"/assets/img/buy-sell/car-details/drive.svg",label:"DRIVE",value:r.drive},{icon:"/assets/img/buy-sell/car-details/body-type.svg",label:"BODY",value:r.body}];return(0,i.jsxs)("div",{className:"flex w-full max-w-[424px] flex-col gap-[66px]",children:[(0,i.jsxs)("div",{className:"flex flex-col",children:[(0,i.jsx)("div",{className:"h-[265px] w-full overflow-hidden rounded-xl border border-[#F0F0F0] bg-[#F4F4F5]",children:(0,i.jsx)("img",{src:l,alt:a||"Your vehicle",className:"h-full w-full object-cover"})}),(0,i.jsxs)("div",{className:"mt-6 flex flex-col gap-2",children:[(0,i.jsx)("h2",{className:"text-2xl font-bold leading-[34px] text-[#0E0F11]",children:a||"Your vehicle"}),(0,i.jsx)("p",{className:"text-base font-medium leading-6 text-[#595959]",children:o||"Vehicle details"})]}),(0,i.jsxs)("div",{className:"mt-6 flex flex-wrap items-center justify-between gap-3",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[t.vin?(0,i.jsx)("span",{className:"rounded-md bg-[#F5FAF8] px-2.5 py-1.5 text-xs font-semibold leading-4 text-[#167F50]",children:"VERIFIED VIN"}):null,t.carYear?(0,i.jsxs)("span",{className:"rounded-md bg-[#F9F9F9] px-2.5 py-1.5 text-xs font-semibold leading-4 text-[#1F1F1F]",children:[t.carYear," MODEL"]}):null]}),n?(0,i.jsxs)(en,{onClick:n,className:"h-10 text-sm",children:["Edit Details",(0,i.jsx)("img",{src:"/assets/img/bookings/pencil-edit.svg",alt:"",className:"h-4 w-4"})]}):null]})]}),(0,i.jsx)("div",{className:"flex items-start justify-between rounded-[15px] border border-[#F0F0F0] bg-[#F9F9F9] p-5",children:s.map(e=>(0,i.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,i.jsxs)("div",{className:"flex items-center gap-1",children:[(0,i.jsx)("img",{src:e.icon,alt:"",className:"h-5 w-5"}),(0,i.jsx)("span",{className:"whitespace-nowrap text-xs font-medium leading-4 tracking-[0.01px] text-[#595959]",children:e.label})]}),(0,i.jsx)("span",{className:"whitespace-nowrap text-sm font-semibold leading-5 text-[#0E0F11]",children:e.value})]},e.label))})]})}function eo(e){let{left:t,children:r,railClassName:l="lg:w-[540px] lg:px-[72px]"}=e;return(0,i.jsxs)("div",{className:"flex flex-col gap-10 lg:flex-row lg:gap-0",children:[(0,i.jsx)("aside",{className:(0,C.Z)("w-full shrink-0 px-4 pb-8 lg:border-r lg:border-[#F0F0F0] lg:pb-16",l),children:t}),(0,i.jsx)("div",{className:"w-full px-4 lg:px-[74px]",children:(0,i.jsx)("div",{className:"w-full max-w-[535px]",children:r})})]})}let es=/^[A-HJ-NPR-Z0-9]{17}$/i;function ec(e){let{onScanned:t}=e,[r,l]=(0,U.useState)(!1),[n,a]=(0,U.useState)(!1),[o,s]=(0,U.useState)(""),c=(0,U.useRef)(null),d=(0,U.useRef)(null),u=(0,U.useRef)(null),m=U.useCallback(()=>{let e=e=>{if(e)for(let t of e.getTracks())"live"===t.readyState&&t.stop()};try{var t,r,i,n,o;null===(r=d.current)||void 0===r||null===(t=r.stopContinuousDecode)||void 0===t||t.call(r),null===(n=d.current)||void 0===n||null===(i=n.reset)||void 0===i||i.call(n),d.current=null,e(u.current),e(null===(o=c.current)||void 0===o?void 0:o.srcObject),u.current=null,c.current&&(c.current.srcObject=null)}catch(e){}finally{l(!1),a(!1)}},[]);return(0,U.useEffect)(()=>
1{if(!r||!c.current||d.current)return;let e=setTimeout(async()=>{var e;if(!(null===(e=navigator.mediaDevices)||void 0===e?void 0:e.getUserMedia)){s((0,p.IS)(!1,window.isSecureContext)||""),a(!1),l(!1);return}if(!c.current){s("Camera element not ready. Try again."),a(!1),l(!1);return}try{if(!(await navigator.mediaDevices.enumerateDevices()).some(e=>"videoinput"===e.kind)){s("No camera found on this device."),a(!1),l(!1);return}let e=null;try{e=await navigator.mediaDevices.getUserMedia({video:{facingMode:{ideal:"environment"}},audio:!1})}catch(t){e=await navigator.mediaDevices.getUserMedia({video:!0,audio:!1})}if(!e){s("Failed to obtain camera stream."),a(!1),l(!1);return}u.current=e,c.current.srcObject=e,await c.current.play(),a(!1);let r=new F.BrowserMultiFormatReader;d.current=r,r.decodeFromVideoDevice(null,c.current,e=>{var r,i;let l=(null!==(i=null==e?void 0:null===(r=e.getText)||void 0===r?void 0:r.call(e))&&void 0!==i?i:"").trim().toUpperCase();l&&es.test(l)&&(t(l),m())})}catch(e){s((null==e?void 0:e.name)==="NotAllowedError"?"Camera access denied. Please allow camera permissions.":(null==e?void 0:e.name)==="NotFoundError"?"No camera found on this device.":(null==e?void 0:e.name)==="NotReadableError"?"Camera is already in use by another app.":"Failed to access camera. Please try again."),a(!1),l(!1)}},140);return()=>clearTimeout(e)},[r]),(0,U.useEffect)(()=>m,[m]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("button",{type:"button",onClick:()=>{var e;s("");let t=(0,p.IS)(!!(null===(e=navigator.mediaDevices)||void 0===e?void 0:e.getUserMedia),window.isSecureContext);if(t){s(t);return}l(!0),a(!0)},"aria-label":"Scan VIN with camera",className:"flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-full border-0 bg-transparent p-0",children:(0,i.jsx)("img",{src:"/assets/img/carList/vin-camara-icon.svg",alt:"",width:40,height:40})}),o?(0,i.jsx)("p",{className:"basis-full text-xs leading-4 text-[#CB2029]",children:o}):null,r?(0,i.jsx)("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/80 p-3 sm:p-5",children:(0,i.jsxs)("div",{className:"max-h-[90vh] w-full max-w-sm overflow-y-auto rounded-xl bg-white shadow-2xl",children:[(0,i.jsx)("div",{className:"mb-4 flex items-center justify-end border-b border-gray-200 px-4 pb-3 pt-4 sm:px-5 sm:pt-5",children:(0,i.jsx)("div",{role:"button",tabIndex:0,onClick:m,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&m()},"aria-label":"Close scanner",className:"grid size-6 cursor-pointer place-items-end rounded-lg text-2xl text-gray-500",children:(0,i.jsx)(j.Tw,{})})}),(0,i.jsxs)("div",{className:"relative mb-4 overflow-hidden rounded-lg bg-black px-4 sm:mb-5 sm:px-5",children:[n?(0,i.jsx)("div",{className:"flex h-[300px] items-center justify-center bg-gray-100",children:(0,i.jsxs)("div",{className:"text-center",children:[(0,i.jsx)("div",{className:"mx-auto mb-2 h-8 w-8 animate-spin rounded-full border-b-2 border-[#0E0F11]"}),(0,i.jsx)("p",{className:"text-sm text-gray-600",children:"Loading camera..."})]})}):null,(0,i.jsx)("video",{ref:c,style:{width:"100%",height:"300px",display:n?"none":"block",objectFit:"cover",backgroundColor:"#000"},playsInline:!0,muted:!0,autoPlay:!0})]}),(0,i.jsx)("p",{className:"px-4 pb-4 text-center text-sm text-gray-600 sm:px-5 sm:pb-5",children:"Align with the VIN barcode to scan."}),(0,i.jsx)("div",{className:"flex justify-center px-4 pb-4 sm:px-5 sm:pb-5",children:(0,i.jsx)("button",{type:"button",onClick:m,className:"w-full rounded-xl bg-[#0E0F11] px-5 py-3 text-sm font-semibold text-white",children:"Type VIN Instead"})})]})}):null]})}function ed(e){let{lookupErrorMessage:t,lookupTab:r,setLookupTab:l,lookupMode:n,carDetails:a,setCarDetails:o,statesData:s,onVehicleLookup:c,isVehicleLookupLoading:d=!1,showLookupErrors:u=!1,unresolvedZipCode:m=""}=e,[p,x]=(0,U.useState)(!1),f="plate"===n&&a.licensePlate.trim().length<4,g="plate"===n&&!a.licensePlateState.trim(),v="vin"===n&&17!==a.vin.trim().length,j=!(0,h.mP)(a.zipCode),F=!a.termsAgreed,N=(0,h.mP)(a.zipCode)&&a.termsAgreed&&("vin"===n?17===a.vin.trim().length:a.licensePlate.trim().length>=4&&a.licensePlateState.trim().length>
10),k=t.vin||(u&&v?"Enter a valid 17-character VIN.":""),C=t.plate||(u&&f?"Please enter a valid plate number.":""),S=t.state||(u&&g?"State is required.":""),P=t.zipCode||(m&&m===a.zipCode.trim()?(0,h.PY)(m):"")||(u&&j?"Please enter a valid 5-digit ZIP code.":"");return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"mx-auto flex w-full max-w-[353px] flex-col items-center gap-8",children:[(0,i.jsx)(Q,{tabs:["License Plate","VIN Number"],activeIndex:r,onChange:l}),(0,i.jsx)($,{align:"center",title:"Let’s get started",description:"plate"===n?"We'll use your vehicle identification License Plate to identify your specific car":"We'll use your vehicle identification number (VIN) to identify your specific car"}),(0,i.jsxs)("div",{className:"flex w-full flex-col gap-4",children:["plate"===n?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsx)(K,{htmlFor:"sell-plate-number",required:!0,children:"Plate Number"}),(0,i.jsx)(ee,{id:"sell-plate-number",value:a.licensePlate,onChange:e=>o(t=>({...t,licensePlate:e.toUpperCase()})),placeholder:"Enter Plate Number",hasError:!!C}),C?(0,i.jsx)(X,{children:C}):null]}),(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsx)(K,{htmlFor:"sell-plate-state",required:!0,children:"State"}),(0,i.jsx)(et,{id:"sell-plate-state",value:a.licensePlateState,onChange:e=>o(t=>({...t,licensePlateState:e.toUpperCase()})),placeholder:"Select",options:s,hasError:!!S}),S?(0,i.jsx)(X,{children:S}):null]})]}):(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsx)(K,{htmlFor:"sell-vin",required:!0,children:"Vehicle identification number (VIN)"}),(0,i.jsxs)("div",{className:"flex w-full flex-wrap items-center gap-3",children:[(0,i.jsx)("div",{className:"min-w-0 flex-1",children:(0,i.jsx)(ee,{id:"sell-vin",value:a.vin,onChange:e=>o(t=>({...t,vin:e.toUpperCase()})),placeholder:"Enter VIN",maxLength:17,hasError:!!k})}),(0,i.jsx)(ec,{onScanned:e=>o(t=>({...t,vin:e}))})]}),k?(0,i.jsx)(X,{children:k}):null,(0,i.jsx)("button",{type:"button",onClick:()=>x(!0),className:"mt-1.5 self-start text-[13px] font-normal leading-5 text-[#027BFF] !underline underline-offset-2",children:"Where can I find my VIN?"})]}),(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsx)(K,{htmlFor:"sell-zip",required:!0,children:"Zip Code"}),(0,i.jsx)(ee,{id:"sell-zip",value:a.zipCode,inputMode:"numeric",maxLength:5,onChange:e=>o(t=>({...t,zipCode:e.replace(/[^\d]/g,"")})),placeholder:"Enter Zip Code",hasError:!!P}),P?(0,i.jsx)(X,{children:P}):null]})]}),(0,i.jsxs)("div",{className:"flex w-full flex-col gap-6",children:[(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsxs)("div",{className:"flex w-full items-start gap-[7px]",children:[(0,i.jsx)(w.n,{id:"sell-terms",checked:a.termsAgreed,onChange:e=>o(t=>({...t,termsAgreed:e.target.checked})),className:"!h-6 !w-6 cursor-pointer checked:!border-[#0E0F11] checked:!bg-[#0E0
1F11]","aria-label":"Agree to terms of service"}),(0,i.jsxs)("label",{htmlFor:"sell-terms",className:"cursor-pointer text-[13px] font-normal leading-5 text-[#0E0F11]",children:["I agree to the"," ",(0,i.jsx)("a",{href:"/terms/conditions",target:"_blank",rel:"noreferrer",className:"text-[#027BFF] !underline underline-offset-2",onClick:e=>e.stopPropagation(),children:"Terms of Service"}),". I understand that a buyer can rent this car for up to 7 days before deciding to buy it."]})]}),u&&F?(0,i.jsx)(X,{children:"Please agree to terms of service."}):null]}),(0,i.jsx)(el,{fullWidth:!0,onClick:c,disabled:!N,isLoading:d,children:d?"Getting details...":"Get Started"})]})]}),(0,i.jsxs)(y.Z,{isVisible:p,onClose:()=>x(!1),customClassName:"".concat(b().modalContent," !max-w-[min(420px,92vw)] !p-6"),children:[(0,i.jsx)("h2",{className:"!mb-3 !mt-0 !text-lg !font-semibold !text-[#0E0F11]",children:"Where to find your VIN"}),(0,i.jsx)("p",{className:"!mb-3 !text-sm !leading-relaxed !text-[#595959]",children:"Your vehicle identification number (VIN) is 17 characters—letters and numbers."}),(0,i.jsxs)("ul",{className:"!m-0 !mb-4 !list-disc !pl-5 !text-sm !text-[#595959] space-y-2",children:[(0,i.jsxs)("li",{children:[(0,i.jsx)("span",{className:"font-medium text-[#0E0F11]",children:"Windshield / dashboard:"})," Look at the lower driver's corner of the windshield from outside the car."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("span",{className:"font-medium text-[#0E0F11]",children:"Driver's door jamb:"})," Open the driver's door; the sticker on the frame often shows the VIN."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("span",{className:"font-medium text-[#0E0F11]",children:"Registration & insurance:"})," ","Printed on your registration card and insurance documents."]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("span",{className:"font-medium text-[#0E0F11]",children:"Title:"})," Listed on your certificate of title."]})]}),(0,i.jsx)("button",{type:"button",className:b().addCarButton,onClick:()=>x(!1),children:"Got it"})]})]})}function eu(e){let{listingId:t,lookupMode:r,carDetails:l,setCarDetails:n,makes:a,models:o,stylesList:s,carYears:c,vehicleSpecs:d,previewPhotoUrl:u,onContinue:m,isContinuing:h=!1,showContinueErrors:x=!1}=e,f=!l.licensePlate.trim(),g=!l.carYear,v=!l.make,b=(0,p.W9)(l.model,o),y=!l.trim.trim(),w=!l.style,j=!f&&!g&&!v&&!b&&!y&&!w&&!!l.vin,F="vin"===r||!!t;return(0,i.jsxs)(eo,{left:(0,i.jsx)(ea,{carDetails:l,vehicleSpecs:d,previewPhotoUrl:u,onEditDetails:()=>{let e=document.getElementById(F?"sell-confirm-plate":"sell-car-year");null==e||e.scrollIntoView({behavior:"smooth",block:"center"}),null==e||e.focus()}}),children:[(0,i.jsx)($,{title:"We Found Your Vehicle",description:(0,i.jsxs)(i.Fragment,{children:["We found this vehicle under VIN"," ",(0,i.jsx)("span",{className:"font-semibold text-[#0E0F11]",children:l.vin||"--"}),". Please confirm the details below."]})}),(0,i.jsxs)("div",{className:"mt-8 flex flex-col gap-5",children:[F?(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsxs)(K,{htmlFor:"sell-confirm-plate",required:!0,children:["License Plate"," "]}),(0,i.jsx)(ee,{id:"sell-confirm-plate",value:l.licensePlate,onChange:e=>n(t=>({...t,licensePlate:e.toUpperCase()})),placeholder:"Enter License Plate",hasError:x&&f}),x&&f?(0,i.jsx)(X,{children:"License plate is required."}):null]}):null,(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsx)(K,{htmlFor:"sell-car-year",required:!0,children:"Car Year"}),(0,i.jsx)(et,{id:"sell-car-year",value:l.carYear,onChange:e=>n(t=>({...t,carYear:e})),placeholder:"Select car year",options:c.map(e=>({value:String(e),label:String(e)})),hasError:x&&g}),x&&g?(0,i.jsx)(X,{children:"Car year is required."}):null]}),(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsx)(K,{htmlFor:"sell-brand",required:!0,children:"Brand"}),(0,i.jsx)(et,{id:"sell-brand",value:l.make,onChange:e=>n(t=>t.make===e?t:{...t,make:e,model:""}),placeholder:"Choose make",options:a.map(e=>({value:e,label:e})),hasError:x&&v}),x&&v?(0,i.jsx)(X,{children:"Brand is required."}):null]}),(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsx)(K,{htmlFor:"sell-model",required:!0,children:"Model"}),(0,i.jsx)(et,{id:"sell-model",value:l.model,onChange:e=>n(t=>({...t,model:e})),placeholder:o.length?"Choose model":"No models available",options:o.map(e=>({value:e,label:e})),hasError:x&&b}),x&&b?(0,i.jsx)(X,{children:"Model is required."}):null]}),(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsx)(K,{htmlFor:"sell-trim",required:!0,children:"Trim"}
1),(0,i.jsx)(ee,{id:"sell-trim",value:l.trim,onChange:e=>n(t=>({...t,trim:e})),placeholder:"e.g. Sport, Limited",hasError:x&&y}),x&&y?(0,i.jsx)(X,{children:"Trim is required."}):null]}),(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsx)(K,{htmlFor:"sell-type",required:!0,children:"Type"}),(0,i.jsx)(et,{id:"sell-type",value:l.style,onChange:e=>n(t=>({...t,style:e})),placeholder:"Choose style",options:s.map(e=>({value:e,label:String(e).toUpperCase()})),hasError:x&&w}),x&&w?(0,i.jsx)(X,{children:"Type is required."}):null]})]}),(0,i.jsx)("div",{className:"mt-8",children:(0,i.jsx)(el,{onClick:m,disabled:!j,isLoading:h,children:h?"Loading...":"Continue"})})]})}function em(e){let{open:t,title:r,selectedValue:l,onSelect:n,onClose:a}=e;return t?(0,i.jsx)("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center bg-black/40 px-4",role:"dialog","aria-modal":"true","aria-label":r,onClick:a,children:(0,i.jsxs)("div",{className:"max-h-[90vh] w-full max-w-[400px] overflow-y-auto rounded-3xl bg-white px-6 pb-10 pt-6 shadow-[0px_6px_16px_0px_rgba(16,18,20,0.13),0px_0px_6px_0px_rgba(14,15,17,0.03)]",onClick:e=>e.stopPropagation(),children:[(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsx)("h2",{className:"text-2xl font-semibold leading-8 text-[#0E0F11]",children:r}),(0,i.jsx)("button",{type:"button",onClick:a,"aria-label":"Close",className:"flex h-10 w-10 items-center justify-center rounded-3xl border border-white bg-[#F9F9F9] text-[#1F1F1F] transition-colors hover:bg-[#F0F0F0]",children:(0,i.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:(0,i.jsx)("path",{d:"M17 7L7 17M7 7l10 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),(0,i.jsx)("div",{className:"mt-7 grid grid-cols-5 gap-x-3 gap-y-6",children:A.map(e=>{let t=l===e.value;return(0,i.jsxs)("button",{type:"button",onClick:()=>{n(e.value),a()},className:"flex w-full flex-col items-center gap-2",title:e.value,children:[(0,i.jsx)("span",{className:(0,C.Z)("block h-[52px] w-[52px] rounded",t?"ring-2 ring-[#0E0F11] ring-offset-2":""),style:{backgroundColor:e.hex,border:e.border?"1px solid ".concat(e.border):void 0}}),(0,i.jsx)("span",{className:"w-full truncate text-center text-[11px] font-medium leading-[14px] text-[#0E0F11]",children:e.value})]},e.value)})})]})}):null}function ep(e){let{kind:t,value:r,onClick:l}=e,n=A.find(e=>e.value===r);return(0,i.jsxs)("button",{type:"button",onClick:l,className:"flex flex-col items-center gap-1.5",children:[(0,i.jsx)("span",{className:(0,C.Z)("block h-[40px] w-[61px] rounded-lg",n?"border":"border border-dashed border-[#D9D9D9] bg-[#F0F0F0]"),style:n?{backgroundColor:n.hex,borderColor:n.border||"rgba(14,15,17,0.08)"}:void 0}),(0,i.jsx)("span",{className:"whitespace-nowrap text-sm font-normal leading-5 text-[#0E0F11]",children:r?"".concat(t," is ").concat(r):"Choose ".concat(t.toLowerCase())})]})}function eh(e){let{additionalDetails:t,setAdditionalDetails:r,carDetails:l,vehicleSpecs:n,previewPhotoUrl:a,onContinue:o,isSubmitting:s,showValidationErrors:d=!1}=e,[u,m]=(0,U.useState)(null),h=!t.odometer,x=!t.carDailyMileage,f=!t.exterior
1Color||!t.interiorColor,g=!h&&!x&&!!t.transmissionType&&!!t.title&&!!t.previewsOwner&&(0,p.mb)(t.noLoan)&&!f;function v(e){r(t=>({...t,...e}))}return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(eo,{left:(0,i.jsx)(ea,{carDetails:l,vehicleSpecs:n,previewPhotoUrl:a}),children:[(0,i.jsx)($,{title:"Tell us about your car",description:"Fill in the car's odometer, daily mileage and transmission."}),(0,i.jsxs)("div",{className:"mt-8 flex flex-col gap-5",children:[(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsx)(K,{htmlFor:"sell-odometer",required:!0,children:"How many miles display on your odometer?"}),(0,i.jsx)(et,{id:"sell-odometer",value:t.odometer,onChange:e=>v({odometer:e}),placeholder:"Select",options:c.$O.map(e=>({value:e,label:"".concat(e," miles")})),hasError:d&&h}),d&&h?(0,i.jsx)(X,{children:"Odometer reading is required."}):null]}),(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsx)(K,{htmlFor:"sell-daily-mileage",required:!0,children:"Daily mileage for rentals"}),(0,i.jsx)(et,{id:"sell-daily-mileage",value:t.carDailyMileage,onChange:e=>v({carDailyMileage:e}),placeholder:"Select",options:(0,c.yo)(t.carDailyMileage).map(e=>({value:e,label:e===c.ZM?"Unlimited":"".concat(e," miles per day")})),hasError:d&&x}),(0,i.jsx)("p",{className:"text-xs leading-4 text-[#8C8C8C]",children:"Miles a buyer can drive per day if they rent the car before buying."}),d&&x?(0,i.jsx)(X,{children:"Daily mileage is required."}):null]}),(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsx)(K,{required:!0,children:"Transmission"}),(0,i.jsx)(ei,{name:"transmissionType",value:t.transmissionType,onChange:e=>v({transmissionType:e}),options:[{value:"Automatic",label:"Automatic"},{value:"Manual",label:"Manual"}]})]}),(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsx)(K,{required:!0,children:"Title"}),(0,i.jsx)(ei,{name:"titleType",value:t.title,onChange:e=>v({title:e}),options:[{value:"clean",label:"Clean"},{value:"branded",label:"Branded"},{value:"salvaged",label:"Salvage"}]})]}),(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsx)(K,{required:!0,children:"Loan Status"}),(0,i.jsx)(ei,{name:"noLoan",value:t.noLoan,onChange:e=>v({noLoan:e}),options:[{value:"no_loan",label:"No Loan on this vehicle"},{value:"has_loan",label:"Has an active Loan"}]}),(0,p.p$)(t.noLoan)?(0,i.jsx)(X,{children:p.az}):d&&!t.noLoan?(0,i.jsx)(X,{children:"Loan status is required."}):null]}),(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsx)(K,{required:!0,children:"Accident History"}),(0,i.jsx)(ei,{name:"previousAccident",value:t.previousAccident?"yes":"no",onChange:e=>v({previousAccident:"yes"===e}),options:[{value:"no",label:"No Accidents"},{value:"yes",label:"Has Accident History"}]})]}),(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsx)(K,{required:!0,children:"Number of Owners"}),(0,i.jsx)(ei,{compact:!0,name:"previewsOwner",value:t.previewsOwner,onChange:e=>v({previewsOwner:e}),options:[{value:"one",label:"1"},{value:"two",label:"2"},{value:"three",label:"3"},{value:"four",label:"4+"}]})]}),(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsx)(K,{required:!0,children:"Color of your car?"}),(0,i.jsxs)("div",{className:"flex items-start gap-14 pt-1.5",children:[(0,i.jsx)(ep,{kind:"Exterior",value:t.exteriorColor,onClick:()=>m("exterior")}),(0,i.jsx)(ep,{kind:"Interior",value:t.interiorColor,onClick:()=>m("interior")})]}),d&&f?(0,i.jsx)(X,{children:"Please pick both an exterior and an interior colour."}):null]})]}),(0,i.jsx)("div",{className:"mt-8",children:(0,i.jsx)(el,{onClick:o,disabled:!g,isLoading:s,children:"Continue"})})]}),(0,i.jsx)(em,{open:"exterior"===u,title:"Exterior color",selectedValue:t.exteriorColor,onSelect:e=>
1v({exteriorColor:e}),onClose:()=>m(null)}),(0,i.jsx)(em,{open:"interior"===u,title:"Interior color",selectedValue:t.interiorColor,onSelect:e=>v({interiorColor:e}),onClose:()=>m(null)})]})}function ex(e){let{slot:t,slotIndex:r,photoUrl:l,isUploading:n,onUpload:a,onRemove:o,isCover:s=!1,canDrag:c=!1,isDragging:d=!1,isDragActive:u=!1,cellRef:m,mediaRef:p,onPointerDown:h}=e,x=(0,U.useRef)(null),f=!!l;return(0,i.jsxs)("div",{ref:m,onPointerDown:f?h:void 0,onContextMenu:f&&c?e=>e.preventDefault():void 0,style:f&&c?{WebkitTouchCallout:"none"}:void 0,className:(0,C.Z)("flex w-full flex-col gap-1.5 select-none",f&&c&&"cursor-grab active:cursor-grabbing",d&&"opacity-40"),children:[(0,i.jsxs)("div",{ref:p,className:(0,C.Z)("relative h-[109px] w-full overflow-hidden rounded-[9px] bg-[#F9F9F9]",u&&"pointer-events-none",f?"border border-[#F0F0F0]":"border border-dashed border-[#F0F0F0]"),children:[f?(0,i.jsx)("img",{src:l,alt:t.label,draggable:!1,className:"h-full w-full object-cover"}):t.isOdometer?(0,i.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,i.jsx)("span",{className:"flex h-[40px] w-[79px] items-center justify-center border-[0.55px] border-[#F0F0F0]",children:(0,i.jsx)("img",{src:t.art,alt:"",style:{width:t.artWidth,height:t.artHeight}})})}):t.art?(0,i.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,i.jsx)("img",{src:t.art,alt:"",style:{width:t.artWidth,height:t.artHeight}})}):(0,i.jsx)("div",{className:"flex h-full w-full items-center justify-center text-xs font-medium text-[#8C8C8C]",children:"Add photo"}),n?(0,i.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-white/70",children:(0,i.jsx)("span",{className:"h-5 w-5 animate-spin rounded-full border-2 border-[#F0F0F0] border-t-[#0E0F11]"})}):null,f&&s?(0,i.jsx)("span",{className:"pointer-events-none absolute bottom-[5px] left-[5px] rounded-[6px] bg-white px-2 py-[2px] text-[11px] font-medium leading-4 text-[#0E0F11]",children:"Cover"}):null,f?(0,i.jsx)("button",{type:"button",onClick:()=>o(r),"aria-label":"Remove ".concat(t.label),className:"absolute right-[5px] top-[5px] inline-flex items-center justify-center rounded-2xl border border-[#F0F0F0] bg-white p-1 transition-colors hover:bg-[#F9F9F9]",children:(0,i.jsx)("img",{src:"/assets/img/checkout/trash.svg",alt:"",className:"h-4 w-4"})}):(0,i.jsx)("button",{type:"button",onClick:()=>{var e;return null===(e=x.current)||void 0===e?void 0:e.click()},"aria-label":"Add ".concat(t.label),className:"absolute right-[5px] top-[5px] inline-flex items-center justify-center rounded-2xl border border-[#F0F0F0] bg-white p-1 transition-colors hover:bg-[#F9F9F9]",children:(0,i.jsx)("img",{src:"".concat(I,"/plus-sign.svg"),alt:"",className:"h-4 w-4"})}),(0,i.jsx)("input",{ref:x,type:"file",accept:"image/jpeg, image/png, image/avif, image/heic, image/heif",multiple:!0,className:"hidden",onChange:e=>{a(r,e.target.files),e.target.value=""}})]}),(0,i.jsx)("p",{className:"text-xs font-medium leading-4 tracking-[0.01px] text-[#0E0F11]",children:t.label})]})}function ef(e){let{videoUrl:t,isUploading:r,onUpload:l,onRemove:n,videoLimits:a}=e,o=(0,U.useRef)(null),[s,c]=(0,U.useState)(!1),d=(0,U.useRef)(null),u=!!t;return(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsxs)("div",{className:(0,C.Z)("relative h-[109px] w-full overflow-hidden rounded-[9px] bg-[#F9F9F9]",u?"border border-[#F0F0F0]":"border border-dashed border-[#F0F0F0]"),children:[u?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("video",{ref:d,src:t,className:"h-full w-full object-cover",playsInline:!0,preload:"metadata",onPlay:()=>c(!0),onPause:()=>c(!1),onEnded:()=>c(!1)}),s?null:(0,i.jsx)("button",{type:"button",onClick:()=>{var e;null===(e=d.current)||void 0===e||e.play()},"aria-label":"Play 360 video",className:"absolute inset-0 flex items-center justify-center",children:(0,i.jsx)("img",{src:"".concat(I,"/play-circle.svg"),alt:"",className:"h-[30px] w-[30px]"})})]}):(0,i.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,i.jsxs)("span",{className:"relative flex h-[52px] w-[52px] items-center justify-center",children:[(0,i.jsx)("img",{src:"".concat(I,"/slot-video-playlist.svg"),alt:"",className:"h-[52px] w-[52px]"}),(0,i.jsx)("img",{src:"".concat(I,"/slot-video-play.svg"),alt:"",className:"absolute left-[20px] top-[26px] h-[13px] w-[13px]"})]})}),r?(0,i.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-1 bg-white/80",children:[(0,i.jsx)("span",{className:"h-5 w-5 animate-spin rounded-full border-2 border-[#F0F0F0] border-t-[#0E0F11]"}),(0,i.jsx)("span",{className:"text-[10px] leading-3 text-[#595959]",children:"Uploading..."})]}):null,u?(0,i.jsx)("button",{type:"button",onClick:n,"aria-label":"Remove 360 video",className:"absolute right-[5px] top-[5px] inline-flex items-center justify-center rounded-2xl border border-[#F0F0F0] bg-white p-1 transition-colors hover:bg-[#F9F9F9]",children:(0,i.jsx)("img",{src:"/assets/img/checkout/trash.svg",alt:"",className:"h-4 w-4"})}):(0,i.jsx)("button",{type:"button",onClick:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.click()},disabled:r,"aria-label":"Add 360 video",className:"absolute right-[5px] top-[5px] inline-flex items-center justify-center rounded-2xl border border-[#F0F0F0] bg-white p-1 transition-colors hover:bg-[#F9F9F9] disabled:opacity-60",children:(0,i.jsx)("img",{src:"".concat(I,"/plus-sign.svg"),alt:"",className:"h-4 w-4"})}),(0,i.jsx)("input",{ref:o,type:"file",accept:a.allowedMimeTypes.join(","),className:"hidden",onChange:e=>{l(e.target.files),e.target.value=""}})]}),(0,i.jsx)("p",{className:"text-xs font-medium leading-4 tracking-[0.01px] text-[#0E0F11]",children:"360 Video"})]})}function eg(e){let{docs:t,phoneDocs:r,uploadingSlot:l,onUploadDoc:n,onRemoveDoc:a,onContinue:o,onSkip:s,isSubmitting:c,isDesktop:u,qrValue:p,isPreparingQr:h,qrError:x,isSyncingFromMobile:f,onSyncFromMobile:g}=e,v=(0,i.jsx)("div",{className:"flex flex-col gap-4",children:m.NH.map(e=>{let o=t[e.key]||r[e.key],s=l===e.key;return(0,i.jsxs)("div",{className:"flex items-center gap-3 rounded-xl border border-[#F0F0F0] bg-white p-3",children:[(0,i.jsx)("div",{className:"flex h-14 w-20 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-[#F9F9F9]",children:o?(0,i.jsx)("span",{className:"text-[11px] font-semibold text-[#167F50]",children:"Uploaded"}):(0,i.jsx)("span",{className:"text-[11px] text-[#8C8C8C]",children:"No file"})}),(0,i.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,i.jsx)("p",{className:"text-sm font-semibold text-[#0E0F11]",children:e.label}),(0,i.jsx)("p",{className:"text-xs text-[#8C8C8C]",children:e.hint})]}),o?(0,i.jsx)("button",{type:"button",onClick:()=>
1a(e.key),disabled:c,className:"text-xs font-semibold text-[#B42318] underline disabled:opacity-50",children:"Remove"}):(0,i.jsxs)("label",{className:(0,C.Z)("cursor-pointer text-xs font-semibold text-[#027BFF] underline",(s||c)&&"pointer-events-none opacity-50"),children:[s?"Uploading…":"Upload",(0,i.jsx)("input",{type:"file",accept:"image/*",className:"hidden",onChange:t=>{var r;let i=null===(r=t.target.files)||void 0===r?void 0:r[0];i&&n(e.key,i),t.target.value=""}})]})]},e.key)})});return(0,i.jsxs)("div",{className:"mx-auto flex w-full max-w-[942px] flex-col",children:[(0,i.jsx)("div",{className:"mx-auto w-full max-w-[441px]",children:(0,i.jsx)($,{align:"center",descriptionSize:"lg",title:"Upload your licence and title",description:"We check these before your listing goes live. You can skip and send them later."})}),u?(0,i.jsxs)("div",{className:"mt-8 flex flex-col items-stretch gap-6 lg:flex-row lg:items-center lg:gap-0",children:[(0,i.jsxs)("div",{className:"w-full shrink-0 rounded-2xl border border-[#F0F0F0] bg-white p-6 lg:w-[598px]",children:[(0,i.jsx)("h2",{className:"mb-6 text-xl font-semibold leading-7 text-[#0E0F11]",children:"Upload from Desktop"}),v]}),(0,i.jsx)("span",{className:"text-center text-xl font-semibold leading-7 text-[#0E0F11] lg:px-[18px]",children:"or"}),(0,i.jsx)(d.Z,{qrImageUrl:"",qrValue:p,isPreparing:h,isSyncing:f,error:x,onSync:g,description:"Scan the QR code with your mobile device to upload your licence and title",className:"lg:w-[287px] lg:shrink-0 lg:self-stretch"})]}):(0,i.jsx)("div",{className:"mx-auto mt-8 w-full max-w-[441px]",children:v}),(0,i.jsx)("div",{className:"mx-auto w-full max-w-[441px]",children:(0,i.jsxs)("div",{className:"mt-8 flex flex-col items-center gap-3",children:[(0,i.jsx)(el,{fullWidth:!0,onClick:o,isLoading:c,children:"Continue"}),(0,i.jsx)("button",{type:"button",onClick:s,disabled:c,className:"text-sm font-semibold text-[#595959] underline disabled:opacity-50",children:"Skip for now"})]})})]})}function ev(e){let{isDesktop:t,isPreparingQr:r,qrValue:l,isSyncingFromMobile:n,onSyncPhotosFromMobile:a,uploadingSlotIndexes:o,onUploadSlotImage:s,photoSlots:c,onRemoveSlot:d,walkaroundVideoUrl:m,isUploadingVideo:p,videoError:h,onUploadVideo:x,onRemoveVideo:f,videoLimits:g,minPhotoCount:v,maxPhotoCount:b,onReorderPhotos:y,isSubmitting:w,onContinue:j}=e,F=Math.min(b,O),N=!w&&0===o.length,[k,C]=(0,U.useState)(null),D=(0,U.useRef)(null),B=(0,U.useRef)(null),T=(0,U.useRef)(void 0),M=(0,U.useRef)(null),L=(0,U.useRef)(new Map),_=(0,U.useRef)(new Map),I=(0,U.useRef)({photoSlots:c,photoCapacity:F,canReorder:N,onReorderPhotos:y});function A(e){D.current=e,C(e)}function z(e){clearTimeout(T.current);let t=D.current;if(B.current=null,A(null),!e||!t)return;let{photoSlots:r,onReorderPhotos:i}=I.current,l=r.map((e,r)=>{var i;return r<t.grid.length?(null===(i=t.grid[r])||void 0===i?void 0:i.url)||"":e});l.some((e,t)=>e!==r[t])&&i(l)}function q(e,t){let r=B.current,{photoSlots:i,photoCapacity:l,canReorder:n}=I.current;if(!r||!n)return;let a=i.slice(0,l).map(e=>e?{id:e,url:e}:void 0);A({id:r.id,grid:a,extra:[],x:e,y:t,previewUrl:r.id})}I.current={photoSlots:c,photoCapacity:F,canReorder:N,onReorderPhotos:y};let Z=e=>t=>{let{photoSlots:r,canReorder:i}=I.current,l=r[e];if(!l||!i||0!==t.button||!1===t.isPrimary||B.current||t.target.closest("button, input"))return;let n={id:l,pointerId:t.pointerId,x:t.clientX,y:t.clientY,touch:"touch"===t.pointerType};B.current=n,n.touch&&(T.current=setTimeout(()=>{B.current===n&&q(n.x,n.y)},200))};(0,U.useEffect)(()=>{let e=e=>{let t=B.current;if(t&&e.pointerId===t.pointerId){if(!D.current){let r=Math.hypot(e.clientX-t.x,e.clientY-t.y);if(t.touch){r>8&&z(!1);return}if(r<5||(q(t.x,t.y),!D.current))return}!function(e,t){let r=D.current;if(!r)return;let i=-1,l=1/0;if(L.current.forEach((n,a)=>
1{if(a>=r.grid.length)return;let o=n.getBoundingClientRect(),s=e-(o.left+o.width/2),c=t-(o.top+o.height/2),d=s*s+c*c;d<l&&(l=d,i=a)}),i<0){A({...r,x:e,y:t});return}let n=(0,E.V)(r,"grid",i);A({...r,grid:n.grid,extra:n.extra,x:e,y:t})}(e.clientX,e.clientY)}},t=e=>{var t;e.pointerId===(null===(t=B.current)||void 0===t?void 0:t.pointerId)&&z("pointerup"===e.type)},r=()=>{B.current&&z(!1)},i=e=>{"Escape"===e.key&&r()},l=e=>{D.current&&e.cancelable&&e.preventDefault()},n=M.current;return null==n||n.addEventListener("touchmove",l,{passive:!1}),window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),window.addEventListener("blur",r),window.addEventListener("keydown",i),()=>{clearTimeout(T.current),null==n||n.removeEventListener("touchmove",l),window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t),window.removeEventListener("blur",r),window.removeEventListener("keydown",i)}},[]),(0,U.useEffect)(()=>{B.current&&z(!1)},[c,N]);let W=k?c.map((e,t)=>{var r;return t<k.grid.length?(null===(r=k.grid[t])||void 0===r?void 0:r.url)||"":e}):c;(0,P.b)(_,null==k?void 0:k.id,k?k.grid:c,P.M);let Y=W.slice(0,F).findIndex(Boolean),H=[...W.keys()].slice(V,F),G=W.slice(0,F).filter((e,t)=>e||o.includes(t)).length,Q=G<F?H.find(e=>!W[e]&&!o.includes(e)):void 0,K=H.filter(e=>W[e]||k&&c[e]||o.includes(e)||e===Q),J=e=>{let t=W[e]||"";return{photoUrl:t,isCover:e===Y,canDrag:N,isDragging:!!(k&&t&&k.id===t),isDragActive:!!k,cellRef:t=>{t?L.current.set(e,t):L.current.delete(e)},mediaRef:e=>{t&&(e?_.current.set(t,e):_.current.delete(t))},onPointerDown:Z(e)}};return(0,i.jsxs)("div",{className:"mx-auto flex w-full max-w-[942px] flex-col",children:[(0,i.jsx)("div",{className:"mx-auto w-full max-w-[441px]",children:(0,i.jsx)($,{align:"center",descriptionSize:"lg",title:"Add Car Image",description:(0,i.jsxs)(i.Fragment,{children:["Great photos increase visibility and bookings. Add at least ",v," photos from the angles below, plus an optional 360 video."]})})}),(0,i.jsxs)("div",{className:"mt-8 flex flex-col items-stretch gap-6 lg:flex-row lg:items-center lg:gap-0",children:[(0,i.jsxs)("div",{ref:M,style:{touchAction:"pan-y pinch-zoom"},className:"w-full shrink-0 rounded-2xl border border-[#F0F0F0] bg-white p-6 lg:w-[598px]",children:[(0,i.jsx)("h2",{className:"text-xl font-semibold leading-7 text-[#0E0F11]",children:"Upload from Desktop"}),Y>=0?(0,i.jsx)("p",{className:"mt-1 text-xs leading-4 text-[#8C8C8C]",children:"Drag photos to rearrange. The first photo is your cover."}):null,(0,i.jsx)("div",{className:"mt-6 grid grid-cols-2 gap-x-[15px] gap-y-7 sm:grid-cols-3 lg:grid-cols-4",children:R.map((e,t)=>e.isVideo?(0,i.jsx)(ef,{videoUrl:m,isUploading:p,onUpload:x,onRemove:f,videoLimits:g},e.key):(0,i.jsx)(ex,{slot:e,slotIndex:t,isUploading:o.includes(t),onUpload:s,onRemove:d,...J(t)},e.key))}),K.length>0?(0,i.jsxs)("div",{className:"mt-7",children:[(0,i.jsx)("h3",{className:"text-base font-semibold leading-6 text-[#0E0F11]",children:"Additional photos"}),(0,i.jsxs)("p",{className:"mt-1 text-xs leading-4 text-[#8C8C8C]",children:["Optional. Up to ",F," photos in total (",G,"/",F," added)."]}),(0,i.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-x-[15px] gap-y-7 sm:grid-cols-3 lg:grid-cols-4",children:K.map(e=>(0,i.jsx)(ex,{slot:{key:"additional-".concat(e),label:"Additional Photo",art:"",artWidth:0,artHeight:0},slotIndex:e,isUploading:o.includes(e),onUpload:s,onRemove:d,...J(e)},"additional-".concat(e)))})]}):null,k?(0,i.jsx)(S.Z,{photo:{url:k.previewUrl},x:k.x,y:k.y}):null,h?(0,i.jsx)("p",{className:"mt-4 text-xs leading-4 text-[#CB2029]",children:h}):(0,i.jsxs)("p",{className:"mt-4 text-xs leading-4 text-[#8C8C8C]",children:["360 video: up to ",Math.round(g.maxBytes/1048576),"MB and"," ",g.maxDurationSeconds," seconds (MP4, MOV or WebM)."]})]}),t?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"text-center text-xl font-semibold leading-7 text-[#0E0F11] lg:px-[18px]",children:"or"}),(0,i.jsxs)("div",{className:"flex w-full shrink-0 flex-col items-start justify-between rounded-2xl border border-[#F0F0F0] bg-white p-6 lg:w-[287px] lg:self-stretch",children:[(0,i.jsxs)("div",{className:"flex w-full flex-col gap-5",children:[(0,i.jsxs)("div",{className:"flex w-full flex-col gap-2",children:[(0,i.jsx)("h2",{className:"text-xl font-semibold leading-7 text-[#0E0F11]",children:"Upload from Mobile"}),(0,i.jsx)("p",{className:"w-full text-base font-normal leading-[26px] tracking-[0.16px] text-[#0E0F11]",children:"Scan the QR code with your mobile device to upload Car Photos"})]}),(0,i.jsx)("div",{className:"flex w-fit items-center rounded-[18px] border border-[#F0F0F0] p-2",children:r||!l?(0,i.jsx)("span",{className:"flex h-[147px] w-[145px] items-center justify-center text-sm text-[#8C8C8C]",children:"Preparing QR..."}):(0,i.jsx)(u.Z,{value:l,size:147,snapToModules:!0})})]}),(0,i.jsx)(en,{onClick:a,disabled:n,className:"mt-6 !border-[1.5px]",children:n?"Syncing...":"Tap here when you're done"})]})]}):null]}),(0,i.jsx)("div",{className:"mt-8",children:(0,i.jsx)(el,{onClick:j,disabled:p,isLoading:w,children:w?"Submitting...":"Continue"})})]})}function eb(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(e)}function ey(e){let{isLoading:t,report:r}=e;return(0,i.jsxs)("div",{className:"flex w-full max-w-[490px] flex-col gap-6 rounded-2xl border border-[#F0F0F0] bg-white p-6",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("img",{src:"".concat(I,"/dollar-circle.svg"),alt:"",className:"h-6 w-6"}),(0,i.jsx)("h2",{className:"text-lg font-semibold leading-[25px] text-[#0E0F11]",children:"Market Price Report"})]}),(0,i.jsx)("img",{src:"".concat(I,"/information-circle.svg"),alt:"",title:"An estimate based on your car's year, make, model and trim. Cars in cleaner condition sell at the top of the range.",className:"h-6 w-6"})]}),t?(0,i.jsxs)("div",{className:"flex animate-pulse flex-col gap-3",children:[(0,i.jsx)("div",{className:"h-[18px] w-full rounded bg-[#F0F0F0]"}),(0,i.jsx)("div",{className:"h-4 w-full rounded-lg bg-[#F0F0F0]"}),(0,i.jsx)("div",{className:"h-[62px] w-full rounded-lg bg-[#F0F0F0]"}),(0,i.jsx)("div",{className:"h-[120px] w-full rounded-lg bg-[#F0F0F0]"})]}):r?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,i.jsx)("div",{className:"flex items-start justify-between",children:r.tiers.map(e=>(0,i.jsx)("p",{className:"whitespace-nowrap text-[13px] font-medium leading-[18px] tracking-[0.13px]",style:{color:e.labelColor},children:e.label},e.key))}),(0,i.jsx)("div",{className:"flex h-4 w-full items-start gap-1",children:r.tiers.map((e,t)=>(0,i.jsx)("span",{className:(0,C.Z)("h-full min-w-px flex-1",0===t?"rounded-l-lg":"",t
1===r.tiers.length-1?"rounded-r-lg":""),style:{backgroundColor:e.segmentColor}},e.key))}),(0,i.jsxs)("div",{className:"flex w-full flex-col items-center gap-1 rounded-lg border border-[#EBECEF] bg-[#F9F9F9] px-3 py-2",children:[(0,i.jsx)("p",{className:"whitespace-nowrap text-xs text-[#595959]",children:"Estimated Retail Value (“Clean” Tier)"}),(0,i.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,i.jsx)("p",{className:"text-2xl font-bold leading-[34px] text-[#0F5B38]",children:eb(r.cleanValue)}),(0,i.jsx)("span",{className:"rounded-md bg-[#F5FAF8] px-1.5 py-1 text-xs font-medium leading-4 text-[#167F50]",children:"Top Tier"})]})]})]}),(0,i.jsx)("div",{className:"flex flex-col gap-2",children:r.tiers.map(e=>(0,i.jsxs)("div",{className:"flex items-center justify-between py-1",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"block h-2 w-2 rounded-full",style:{backgroundColor:e.dotColor}}),(0,i.jsx)("p",{className:"text-sm font-normal leading-5 text-[#0E0F11]",children:e.label})]}),(0,i.jsx)("p",{className:"text-lg font-semibold leading-[25px] text-[#0E0F11]",children:eb(e.value)})]},e.key))})]}):(0,i.jsx)("p",{className:"text-sm leading-5 text-[#595959]",children:"We couldn’t estimate a market range for this car. You can still set your own asking price below."})]})}function ew(e){let{priceDescription:t,fetchingMarketPriceRange:r,marketPriceReport:l,isGeneratingDescription:n,setPriceDescription:a,onGenerateDescription:o,onSubmit:s,isSubmitting:c}=e,d=t.carDescription.trim().split(/\s+/).filter(Boolean).length,u=0>=Number(t.askingPriceByHost||0),m=d<20;return(0,i.jsxs)(eo,{railClassName:"lg:w-[569px] lg:px-10",left:(0,i.jsx)(ey,{isLoading:r,report:l}),children:[(0,i.jsx)($,{title:"Car Price",description:"Set your asking price and tell buyers what makes your car worth it."}),(0,i.jsxs)("div",{className:"mt-8 flex flex-col gap-5",children:[(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsx)(K,{htmlFor:"sell-asking-price",required:!0,children:"Car Asking Price"}),(0,i.jsxs)("div",{className:"relative",children:[(0,i.jsx)("span",{className:(0,C.Z)("pointer-events-none absolute left-[10px] top-1/2 -translate-y-1/2 text-[15px] font-medium leading-[22px]",t.askingPriceByHost?"text-[#0E0F11]":"text-[#BFBFBF]"),children:"$"}),(0,i.jsx)("input",{id:"sell-asking-price",value:t.askingPriceByHost,inputMode:"numeric",onChange:e=>a(t=>({...t,askingPriceByHost:e.target.value.replace(/[^\d]/g,"")})),placeholder:"Enter price",className:(0,C.Z)(J,"border-[#F0F0F0] pl-[22px]")})]})]}),(0,i.jsxs)("div",{className:"flex w-full flex-col gap-1.5",children:[(0,i.jsx)(K,{htmlFor:"sell-description",required:!0,children:"Enter Description of car"}),(0,i.jsx)("textarea",{id:"sell-description",value:t.carDescription,onChange:e=>a(t=>({...t,carDescription:e.target.value})),placeholder:"Enter custom message for the buyer",rows:5,className:"min-h-[141px] w-full rounded-[10px] border border-[#F0F0F0] bg-white p-[10px] text-[15px] font-medium leading-[22px] text-[#0E0F11] placeholder:font-medium placeholder:text-[#BFBFBF] focus:border-[#0E0F11] focus:outline-none"}),(0,i.jsxs)("p",{className:"text-[13px] leading-[18px] text-[#595959]",children:[d,"/",20," Word Minimum"]}),(0,i.jsxs)("button",{type:"button",onClick:()=>o(),disabled:n,className:"mt-2 flex items-center gap-2 self-start text-sm font-semibold text-[#027BFF] disabled:opacity-60",children:[(0,i.jsx)("img",{src:"/assets/img/buy-sell/generate.svg",alt:"",className:"h-5 w-5"}),n?"Generating description...":"Generate Description for me"]})]})]}),(0,i.jsx)("div",{className:"mt-8",children:(0,i.jsx)(el,{onClick:s,disabled:!(!u&&!m),isLoading:c,children:"Continue"})})]})}function ej(){let e=(0,D.useRouter)(),t=(0,D.useSearchParams)(),r=(0,B.v9)(e=>{var t;return(null===(t=e.user)||void 0===t?void 0:t.token)||""}),d=(0,B.v9)(e=>{var t,r;return(null===(r=e.user)||void 0===r?void 0:null===(t=r.user)||void 0===t?void 0:t.userId)||""}),[u,v]=(0,U.useState)(0),[b,y]=(0,U.useState)(()=>(0,m.Ed)(null)),[w,j]=(0,U.useState)(null),[F,N]=(0,U.useState)(null),[C,S]=(0,U.useState)(()=>(0,m.Ed)(!1)),[P,E]=(0,U.useState)(""),[L,I]=(0,U.useState)(!1),[A,R]=(0,U.useState)(""),[Z,Q]=(0,U.useState)(!1),[$,K]=(0,U.useState)(!0),[J,X]=(0,U.useState)(!1),[ee,et]=(0,U.useState)(!1),[er,ei]=(0,U.useState)(!1),[el,en]=(0,U.useState)(!1),[ea,eo]=(0,U.useState)(!1),[es,ec]=(0,U.useState)(!1),[em,ep]=(0,U.useState)(!1),[ex,ef]=(0,U.useState)(""),[eb,ey]=(0,U.useState)({vin:"",plate:"",zipCode:"",state:""}),[ej,eF]=(0,U.useState)(""),[eN,ek]=(0,U.useState)("plate"),[eC,eS]=(0,U.useState)(0),[eP,eE]=(0,U.useState)(!1),[eD,eU]=(0,U.useState)(!1),[eB,eT]=(0,U.useState)([]),[eM,eL]=(0,U.useState)([]),[e_,eI]=(0,U.useState)([]),[eA,eR]=(0,U.useState)([]),[eV,ez]=(0,U.useState)([]),[eO,eq]=(0,U.useState)(null),[eZ,eW]=(0,U.useState)(!1),[eY,eH]=(0,U.useState)({vin:"",licensePlate:"",licensePlateState:"",zipCode:"",termsAgreed:!1,make:"",model:"",trim:"",style:"",carYear:"",seats:5,doors:4,gasType:"gas"}),[eG,eQ]=(0,U.useState)({odometer:"",carDailyMileage:c.A7,transmissionType:"Automatic",title:"clean",previewsOwner:"one",previousAccident:!1,noLoan:"",exterior
1Color:"",interiorColor:""}),[e$,eK]=(0,U.useState)(()=>Array(O).fill("")),[eJ,eX]=(0,U.useState)([]),[e0,e1]=(0,U.useState)(""),[e5,e2]=(0,U.useState)(null),[e4,e9]=(0,U.useState)(!1),[e3,e6]=(0,U.useState)(""),[e7,e8]=(0,U.useState)(z),te=e7.video,tt=e7.photos.minCount,[tr,ti]=(0,U.useState)(""),[tl,tn]=(0,U.useState)(!1),[ta,to]=(0,U.useState)(!1),[ts,tc]=(0,U.useState)({askingPriceByHost:"",carDescription:""}),[td,tu]=(0,U.useState)(null),[tm,tp]=(0,U.useState)({displacement:"",driveType:"",cylinders:""}),[th,tx]=(0,U.useState)(!1),[tf,tg]=(0,U.useState)(!1),tv=(0,U.useRef)(!1),tb=(0,U.useRef)(!1),[ty,tw]=(0,U.useState)(""),[tj,tF]=(0,U.useState)(null),tN=(0,U.useRef)(""),tk=(0,U.useRef)(""),tC=(0,U.useRef)(new Map),tS=(0,U.useRef)({pendingPhotos:!1,pendingVideo:!1,photosDirty:!1,videoDirty:!1,videoUnsynced:!1,isSaving:!1,retryCount:0}),tP=(0,U.useRef)({slots:[],videoUrl:"",videoDuration:null}),tE=(0,U.useRef)(new Set),tD=(0,U.useRef)(new Set);(0,U.useEffect)(()=>{e$.forEach(e=>{e&&tE.current.add(e)}),tP.current={slots:e$,videoUrl:e0,videoDuration:e5};let e=tS.current,t=e.pendingPhotos||e.pendingVideo;e.pendingPhotos&&(e.photosDirty=!0),e.pendingVideo&&(e.videoDirty=!0,e.videoUnsynced=!0),e.pendingPhotos=!1,e.pendingVideo=!1,t&&ej&&function(e,t){if(e)try{window.sessionStorage.setItem(x(e),JSON.stringify(t))}catch(e){}}(ej,{slots:e$,shownPhotoUrls:Array.from(tE.current),...e.videoUnsynced?{video:{url:e0,durationSeconds:e5}}:{}}),(e.photosDirty||e.videoDirty)&&ej&&r&&tK()},[e$,e0,e5,ej,r]);let tU=!(0,k.d)(),tB=(0,U.useMemo)(()=>e$.filter(Boolean),[e$]),tT=tB[0]||"",tM=(0,U.useMemo)(()=>{let e=String(tm.displacement||"").trim(),t=String(tm.cylinders||"").trim();return{engine:[e?"".concat(Number(e).toFixed(1),"L"):"",t?"V".concat(t):""].filter(Boolean).join(" ")||"--",drive:String(tm.driveType||"").trim()||"--",body:String(eY.style||"").trim().toUpperCase()||"--"}},[tm,eY.style]),tL=tT||"/assets/img/car-img-a.png";async function t_(){if(!F)return null;try{var e;let t=await o.ZP.get("/sell-cars/".concat(F,"/documents")),r=(0,m.AM)(null==t?void 0:null===(e=t.data)||void 0===e?void 0:e.data);return S(r),r}catch(e){return null}}async function tI(){Q(!0);try{await t_()}finally{Q(!1)}}(0,U.useEffect)(()=>{if(!r)return;let e=!1;return(async()=>{var t,i;let l=await (0,n.Sj)(r);!e&&(null==l?void 0:null===(t=l.photos)||void 0===t?void 0:t.minCount)&&(null==l?void 0:null===(i=l.video)||void 0===i?void 0:i.maxBytes)&&e8(l)})(),()=>{e=!0}},[r]),(0,U.useEffect)(()=>{if(!r)return;let e=!1;return(async()=>{try{let t=await (0,n.BD)(r,"US");!e&&Array.isArray(t)&&t.length>0&&(eT(t),eH(e=>{let r=(e.licensePlateState||"").toUpperCase(),i=t.some(e=>e.value===r);return{...e,licensePlateState:i?r:""}}))}catch(t){e||eT([])}})(),()=>{e=!0}},[r]),(0,U.useEffect)(()=>{ek(0===eC?"plate":"vin"),ey({vin:"",plate:"",zipCode:"",state:""}),ei(!1),ef("")},[eC]),(0,U.useEffect)(()=>{if(!r||!eP)return;let e=!1;return(async()=>{try{if(null!==eO){let e=new Date().getFullYear(),t=[];for(let r=e;r>=eO;r--)t.push(r);ez(t)}let[t,i]=await Promise.all([(0,n.ix)(r),(0,n.Wi)(r)]);if(e)return;eL(Array.isArray(t)?t:[]),eR(Array.isArray(i)?i:[])}catch(t){if(e)return;eL([]),eR([])}})(),()=>{e=!0}},[r,eP,eO]),(0,U.useEffect)(()=>{if(!r||!eP||!eY.make){eI([]);return}let e=!1;return(async()=>{try{let t=await (0,n.hM)(eY.make,r);if(e)return;eI(Array.isArray(null==t?void 0:t.models)?t.models:[])}catch(t){if(e)return;eI([])}})(),()=>{e=!0}},[r,eP,eY.make]),(0,U.useEffect)(()=>{let e=!1,i=null;if(!r||!d)return tN.current="",K(!0),ef(""),i=setTimeout(()=>{e||(K(!1),ef("Please login to continue."))},800),()=>{e=!0,i&&clearTimeout(i)};let l="".concat(d,"|").concat(t.toString());if(tN.current!==l)return(async()=>{let i={listingId:"",resumedQueryDraft:!1,draftVin:""},a=!1;try{var o,s,u;tF(null),K(!0),ef("");let l=(t.get("zipCode")||"").trim(),m=(0,h.mP)(l)?l:"",p=(t.get("licensePlateState")||t.get("state")||"").trim().toUpperCase(),f=(t.get("country")||"US").trim().toUpperCase(),g=!!(m||p),b=(t.get("vin")||"").trim().toUpperCase(),y=(t.get("licensePlate")||"").trim().toUpperCase(),w=await (0,n.V9)(d,r),j=(null==w?void 0:w.carId)||"";if(j&&(b||y))try{let e=await (0,n.PT)(j,r),t=null==e?void 0:e.carListing,i=String((null==t?void 0:t.vin)||"").toUpperCase(),l=String((null==t?void 0:t.licensePlate)||"").toUpperCase();(b?i&&i!==b:l&&l!==y)&&(await (0,n.QN)(String(j),r),j="")}catch(e){}g&&eH(e=>({...e,zipCode:m||e.zipCode,licensePlateState:p||e.licensePlateState}));let F=!!j;if(!j&&(m?j=await tq(m,p,f):p&&(j=await tq("",p,f))),!j){e||(eF(""),v(0)),a=!0;return}let N=await (0,n.PT)(j,r),k=null==N?void 0:N.carListing,C=!!k&&(!!b&&String(k.vin||"").toUpperCase()===b||!!y&&String(k.licensePlate||"").toUpperCase()===y);i={listingId:String((null==k?void 0:k._id)||j),resumedQueryDraft:C,draftVin:String((null==k?void 0:k.vin)||"").toUpperCase()};let S=!1;if(F&&k&&g&&!C)try{let e=await tV(m,p,f);await tZ("location",e,"Unable to save listing location."),tk.current=m,S=!0}catch(t){if(!(0,h.OR)(t))throw t;e||tw(m)}F&&k&&!S&&(tk.current=String((null===(o=k.address)||void 0===o?void 0:o.zip)||"").trim());let P=H(k);if(!e){if(eF((null==k?void 0:k._id)||j),k){eH(e=>{var t;return{...e,zipCode:(C||!m)&&String((null===(t=k.address)||void 0===t?void 0:t.zip)||"").trim()||e.zipCode,...C?{termsAgreed:!0}:{},vin:k.vin||"",licensePlate:k.licensePlate||"",licensePlateState:k.licensePlateState||e.licensePlateState,make:k.make||"",model:k.model||"",trim:k.trim||"",style:Y(k.carType||""),carYear:k.carYear?String(k.carYear):"",seats:k.seats||e.seats,doors:k.doors||e.doors,gasType:W(k.gasType||e.gasType)}}),eQ(e=>({...e,transmissionType:k.transmissionType||e.transmissionType,title:k.title||e.title,previewsOwner:k.previewsOwner||e.previewsOwner,...(()=>{let t=null!=k.carDailyMileage?String(k.carDailyMileage):"",r=c.Wd.includes(t);return{odometer:k.odometer||(!r&&t?(0,c.LR)(t):"")||e.odometer,carDailyMileage:k.unlimitedDailyDistance?c.ZM:r?t:e.carDailyMileage}})(),previousAccident:"boolean"==typeof k.previousAccident?k.previousAccident:e.previousAccident,noLoan:k.noLoan||e.noLoan,exterior
1Color:k.exteriorColor||e.exteriorColor,interiorColor:k.interiorColor||e.interiorColor}));let e=function(e){if(!e)return null;try{let t=window.sessionStorage.getItem(x(e));if(!t)return null;let r=JSON.parse(t);if(!Array.isArray(null==r?void 0:r.slots)||!Array.isArray(null==r?void 0:r.shownPhotoUrls))return null;return r}catch(e){return null}}(String(k._id||j));e?(e.shownPhotoUrls.forEach(e=>e&&tE.current.add(e)),eK(q(function(e,t){let r=t.slots.filter(Boolean),i=new Set([...t.shownPhotoUrls,...r]);return Array.from(new Set([...r,...(e||[]).filter(e=>e&&!i.has(e))]))}(k.photoUrls,e),e.slots)),e1(e.video?e.video.url:k.walkaroundVideoUrl||""),e2(e.video?e.video.durationSeconds:null!==(s=k.walkaroundVideoDurationSeconds)&&void 0!==s?s:null),tS.current.pendingPhotos=!0,e.video&&(tS.current.pendingVideo=!0)):(eK(q(k.photoUrls||[],k.photoSlots)),e1(k.walkaroundVideoUrl||""),e2(null!==(u=k.walkaroundVideoDurationSeconds)&&void 0!==u?u:null)),tc(e=>({...e,carDescription:k.carDetails||"",askingPriceByHost:Number(k.askingPriceByHost)>0?String(k.askingPriceByHost):""})),k.vin&&k.make&&k.model&&eE(!0),v(P)}else v(0)}a=!0}catch(r){if(e)return;(0,h.OR)(r)?tw((t.get("zipCode")||"").trim()):ef((null==r?void 0:r.message)||"Something went wrong while loading your listing. Please try again.")}finally{e||(a&&(tN.current=l),K(!1),tF(i))}})(),()=>{e=!0,i&&clearTimeout(i)}},[r,d,t]),(0,U.useEffect)(()=>{if(!tU||3!==u||!ej||!r)return;let e=!1;return(async()=>{try{tn(!0);let t=await (0,a.Gc)(r),i=null==t?void 0:t.tempToken;if(!i)throw Error("Unable to generate temporary token.");let l="".concat(window.location.origin,"/host/upload-car-photos?token=").concat(encodeURIComponent(i),"&carListingId=").concat(encodeURIComponent(ej),"&sellCar=1");e||ti(l)}catch(t){e||ef((null==t?void 0:t.message)||"Unable to prepare QR upload.")}finally{e||tn(!1)}})(),()=>{e=!0}},[tU,u,ej,r]),(0,U.useEffect)(()=>{if(!tU||4!==u||!F||!r)return;let e=!1;return(async()=>{try{I(!0),R("");let t=await (0,a.Gc)(r),i=null==t?void 0:t.tempToken;if(!i)throw Error("Unable to generate temporary token.");e||E((0,m.nb)(window.location.origin,String(i),F))}catch(t){e||R((null==t?void 0:t.message)||"Unable to prepare QR upload.")}finally{e||I(!1)}})(),()=>{e=!0}},[tU,u,F,r]);let tA=m.WQ.every(e=>b[e.key]||C[e.key]);(0,U.useEffect)(()=>{if(!tU||4!==u||!F||!P||tA)return;let e=setInterval(()=>{"visible"===document.visibilityState&&t_()},5e3);return()=>clearInterval(e)},[tU,u,F,P,tA]);let tR=(0,U.useMemo)(()=>(function(e){if(!(Number.isFinite(Number(null==e?void 0:e.min))&&Number.isFinite(Number(null==e?void 0:e.max))&&Number(null==e?void 0:e.max)>Number(null==e?void 0:e.min)))return null;let t=Math.round(Number(null==e?void 0:e.min)),r=Math.round(Number(null==e?void 0:e.max)),i=r-t;return{tiers:[{key:"poor",label:"Poor",value:t,labelColor:"#CB2029",segmentColor:"#FECACD",dotColor:"#CB2029"},{key:"fair",label:"Fair",value:Math.round(t+.3333*i),labelColor:"#946300",segmentColor:"#FFCE70",dotColor:"#946300"},{key:"good",label:"Good",value:Math.round(t+.6666*i),labelColor:"#167F50",segmentColor:"#8ED0B2",dotColor:"#167F50"},{key:"clean",label:"Clean",value:r,labelColor:"#0F5B38",segmentColor:"#0F5B38",dotColor:"#0F5B38"}],cleanValue:r}})(td),[td]);function tV(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"US",l=(0,h.$3)(e,t,i),n=tC.current,a=n.get(l);if(a)return a;let o=(0,h.Dw)({apiBaseUrl:_,token:r,zipCode:e,state:t,country:i});return n.set(l,o),o.catch(()=>n.delete(l)),o}async function tz(e,t){let r=e.trim();try{return await tV(r,t),tw(""),!0}catch(e){if(!(0,h.OR)(e))throw e;return tw(r),!1}}function tO(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";tw(t?"":e.trim()),ey({vin:"",plate:"",zipCode:t,state:""}),ef(""),eE(!1),v(0)}async function tq(e,t){var i;let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"US",a=await tV(e,t,l),o=await (0,n.G2)(d,r,"location",a);if(!(null==o?void 0:o.status))throw Error((null==o?void 0:o.message)||"Unable to start your listing right now.");let s=String((null==o?void 0:null===(i=o.carData)||void 0===i?void 0:i._id)||"");if(!s)throw Error("Unable to prepare listing draft.");return tk.current=String(e||"").trim(),s}async function tZ(e,t,i){let l=await (0,n.G2)(d,r,e,t);if(!(null==l?void 0:l.status))throw Error((null==l?void 0:l.message)||i);return l}function tW(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return{...e,vin:String((null==t?void 0:t.vin)||r||e.vin||"").toUpperCase(),make:(null==t?void 0:t.make)||e.make,model:(null==t?void 0:t.model)||e.model,trim:(null==t?void 0:t.trim)||e.trim,style:Y((null==t?void 0:t.style)||e.style),carYear:(null==t?void 0:t.carYear)?String(t.carYear):e.carYear,seats:Number(null==t?void 0:t.seats)||e.seats,doors:Number(null==t?void 0:t.doors)||e.doors,gasType:W((null==t?void 0:t.gasType)||e.gasType)}}function tY(e){tp(t=>({displacement:String((null==e?void 0:e.displacement)||"")||t.displacement,driveType:String((null==e?void 0:e.driveType)||"")||t.driveType,cylinders:String((null==e?void 0:e.cylinders)||"")||t.cylinders}))}async function tH(){if(ej&&r){to(!0),ef("");try{let t=await (0,n.PT)(ej,r),i=null==t?void 0:t.carListing;if(eK(e=>q([...e.filter(Boolean),...(null==i?void 0:i.photoUrls)||[]],e)),null==i?void 0:i.walkaroundVideoUrl){var e;e1(i.walkaroundVideoUrl),e2(null!==(e=i.walkaroundVideoDurationSeconds)&&void 0!==e?e:null)}}catch(e){ef("Unable to sync mobile photos. Please try again.")}finally{to(!1)}}}async function tG(){if(em||(ei(!0),en(!1),ey({vin:"",plate:"",zipCode:"",state:""}),ef(""),!eY.termsAgreed))return;ep(!0);let e={vin:"",plate:"",zipCode:"",state:""};try{let t={},i="";if("vin"===eN){let l=eY.vin.trim().toUpperCase(),a={...e};if(17!==l.length&&(a.vin="Enter a valid 17-character VIN."),(0,h.mP)(eY.zipCode)||(a.zipCode="Enter a valid 5-digit ZIP code."),Object.values(a).some(Boolean)){ey(a);return}if(!await tz(eY.zipCode,eY.licensePlateState))return;let o=await (0,n.xK)(l,r);if(!(null==o?void 0:o.status)){ey({...e,vin:(null==o?void 0:o.message)||"This VIN is already in use."});return}let s=await (0,n.iO)(l,r);t=(null==s?void 0:s.data)||{},i=l}else{let l={...e};if(eY.licensePlate.trim().length<4&&(l.plate="Enter a valid plate number."),eY.licensePlateState.trim()||(l.state="State is required."),(0,h.mP)(eY.zipCode)||(l.zipCode="Enter a valid 5-digit ZIP code."),Object.values(l).some(Boolean)){ey(l);return}if(!await tz(eY.zipCode,eY.licensePlateState))return;let a=await (0,n.fF)(eY.licensePlate,eY.licensePlateState,r),o=(null==a?void 0:a.data)||{};if(!(null==o?void 0:o.vin)){ef("Please enter a valid VIN number.");return}i=String(o.vin).toUpperCase();let s=await (0,n.xK)(i,r);if(!(null==s?void 0:s.status)){ey({...e,plate:(null==s?void 0:s.message)||"This vehicle is already listed."});return}t=o}eH(e=>tW(e,t,i)),tY(t);let l=Number(null==t?void 0:t.minYear);Number.isFinite(l)&&l>0&&eq(l),eE(!0),ei(!1)}catch(e){ef((null==e?void 0:e.message)||"Unable to fetch vehicle details right now. Please try again.")}finally{ep(!1)}}async function tQ(){if(!es){if(en(!0),ec(!0),!eP){ef("Please fetch and confirm vehicle details first."),ec(!1);return}if(!eY.licensePlate.trim()){ef("License Plate is required."),ec(!1);return}if(!eY.trim.trim()){ef("Trim is required."),ec(!1);return}if(!eY.make||!eY.model||!eY.carYear||!eY.vin||!eY.style){ef("VIN, make, model, year, and type are required."),ec(!1);return}if(!ej&&!(0,h.mP)(eY.zipCode)){tO(eY.zipCode,"Enter a valid 5-digit ZIP code."),ec(!1);return}ef("");try{let e=ej;if(e){if((0,h.mP)(eY.zipCode)&&eY.zipCode.trim()!==tk.current){let e=await tV(eY.zipCode.trim(),eY.licensePlateState.trim().toUpperCase());await tZ("location",e,"Unable to save listing location."),tk.current=eY.zipCode.trim()}}else e=await tq(eY.zipCode.trim(),eY.licensePlateState.trim().toUpperCase(),"US"),eF(e);
1await tZ("vinDetails",{vin:eY.vin.trim().toUpperCase(),licensePlate:eY.licensePlate.trim().toUpperCase(),licensePlateState:eY.licensePlateState.trim().toUpperCase(),make:eY.make,model:eY.model,trim:eY.trim||"",style:eY.style||"",carYear:Number(eY.carYear),transmissionType:eG.transmissionType,...eG.odometer?{odometer:eG.odometer,...(0,c.SR)(eG.carDailyMileage)}:{}},"Unable to save car details."),v(1),en(!1)}catch(e){if((0,h.OR)(e)){tO(eY.zipCode);return}ef((null==e?void 0:e.message)||"Unable to save your details right now. Please try again.")}finally{ec(!1)}}}async function t$(){if(eo(!0),!eG.odometer){ef("Please select the odometer reading.");return}if(!eG.carDailyMileage){ef("Please select the daily mileage.");return}if((0,p.p$)(eG.noLoan)){ef(p.az);return}et(!0),ef("");try{if(!ej){let e=await tq(eY.zipCode,eY.licensePlateState);eF(e)}let e=eY.licensePlate.trim().toUpperCase(),t=eY.licensePlateState.trim().toUpperCase(),r={vin:eY.vin.trim().toUpperCase(),licensePlate:e,licensePlateState:t,make:eY.make,model:eY.model,trim:eY.trim||"",style:eY.style||"",carYear:Number(eY.carYear),odometer:eG.odometer,...(0,c.SR)(eG.carDailyMileage),transmissionType:eG.transmissionType};await tZ("vinDetails",r,"Unable to save car details."),await tZ("features",{licensePlate:e,licensePlateState:t,features:[],seats:Number(eY.seats)||5,doors:Number(eY.doors)||4,gasType:W(eY.gasType),title:eG.title,previewsOwner:eG.previewsOwner,previousAccident:eG.previousAccident,noLoan:eG.noLoan,exteriorColor:eG.exteriorColor||void 0,interiorColor:eG.interiorColor||void 0},"Unable to save additional details."),v(2),eo(!1)}catch(e){if((0,h.OR)(e)){tO(eY.zipCode);return}ef((null==e?void 0:e.message)||"Unable to save your details right now. Please try again.")}finally{et(!1)}}async function tK(){let e=tS.current;if(e.isSaving)return;e.isSaving=!0;let t=!1;try{for(;e.photosDirty||e.videoDirty;){let i=e.videoDirty;e.photosDirty=!1,e.videoDirty=!1;let l=tP.current,a=await (0,n.G2)(d,r,"photoDraft",{photoSlots:l.slots,knownPhotoUrls:Array.from(tE.current),...i?{walkaroundVideoUrl:l.videoUrl||null,walkaroundVideoDurationSeconds:l.videoDuration}:{}});if(!(null==a?void 0:a.status)){e.photosDirty=!0,i&&(e.videoDirty=!0),t=!0;break}e.retryCount=0,i&&!e.videoDirty&&(e.videoUnsynced=!1)}t||e.photosDirty||e.videoDirty||f(ej)}finally{e.isSaving=!1}t&&e.retryCount<3&&(e.retryCount+=1,setTimeout(()=>void tK(),3e3*e.retryCount))}async function tJ(e,t){let i=Array.from(t||[]);if(0===i.length)return;ef("");let l=tD.current,a=e7.photos.maxCount,o=function(e,t,r,i,l){let n=[...e.keys()].slice(0,Math.min(e.length,l)),a=e=>e<V,o=n.filter(e=>a(e)===a(t)),s=n.filter(e=>a(e)!==a(t));return[...o.filter(e=>e>=t),...o.filter(e=>e<t),...s].filter(t=>!e[t]&&!i.has(t)).slice(0,r)}(e$,e,i.length,l,a);if(0===o.length){M.toast.info("You can add up to ".concat(a," photos."));return}o.length<i.length&&M.toast.info("Only ".concat(o.length," of ").concat(i.length," photos were added — you can add up to ").concat(a," photos.")),o.forEach(e=>l.add(e)),eX(e=>[...e,...o.filter(t=>!e.includes(t))]);let s=0;await Promise.all(o.map(async(e,t)=>{try{var a;let l=await (0,n.OM)([i[t]],r),o=null==l?void 0:null===(a=l.photoUrls)||void 0===a?void 0:a[0];if(!o)throw Error("No files were uploaded.");tS.current.pendingPhotos=!0,eK(t=>{let r=[...t];return r[e]=o,r})}catch(e){s+=1}finally{l.delete(e),eX(t=>t.filter(t=>t!==e))}})),s>0&&ef(1===s?"Photo upload failed. Please try again.":"".concat(s," photos failed to upload. Please try again."))}async function tX(e){let t=null==e?void 0:e[0];if(t){if(e6(""),!te.allowedMimeTypes.includes(t.type)){e6("Unsupported video format. Upload an MP4, MOV or WebM file.");return}if(t.size>te.maxBytes){e6("Video is too large. Maximum size is ".concat(Math.round(te.maxBytes/1048576),"MB."));return}e9(!0);try{var i;let e=await (0,n.Yr)(t,r);if(!(null==e?void 0:e.status)){e6((null==e?void 0:e.message)||"Video upload failed. Please try again.");return}tS.current.pendingVideo=!0,e1(e.videoUrl),e2(null!==(i=e.durationSeconds)&&void 0!==i?i:null)}catch(e){e6("Video upload failed. Please try again.")}finally{e9(!1)}}}async function t0(){if(!ts.askingPriceByHost||0>=Number(ts.askingPriceByHost)){ef("Car asking price is required.");return}if(!ts.carDescription.trim()){ef("Description is required.");return}et(!0),ef("");try{await tZ("description",{carDescription:ts.carDescription.trim()},"Unable to save description."),await tZ("dailyPrice",{carDailyPrice:50,askingPriceByHost:Number(ts.askingPriceByHost)},"Unable to save listing price."),v(3)}catch(e){ef((null==e?void 0:e.message)||"Unable to save your details right now. Please try again.")}finally{et(!1)}}async function t1(e,t){if(r){j(e);try{let i=await (0,s.BE)([t],"sellerDocument",r),l=Array.isArray(null==i?void 0:i.keys)?i.keys[0]:void 0;if(!l)throw Error("Upload failed.");y(t=>({...t,[e]:l}))}catch(e){M.toast.error((null==e?void 0:e.message)||"Could not upload that file. Please try again.")}finally{j(null)}}}async function t5(e){if(y(t=>({...t,[e]:null})),!C[e]||!F)return;let t=m.NH.find(t=>t.key===e);try{await o.ZP.post("/sell-cars/".concat(F,"/documents"),{[t.urlField]:null,
1skipped:!1}),S(t=>({...t,[e]:!1}))}catch(e){var r,i;M.toast.error((null==e?void 0:null===(i=e.response)||void 0===i?void 0:null===(r=i.data)||void 0===r?void 0:r.message)||"Could not remove that document. Please try again.")}}async function t2(t){et(!0);try{if(F){if(t){let e=await t_();!e||m.NH.some(t=>e[t.key])||await o.ZP.post("/sell-cars/".concat(F,"/documents"),{licenseFrontUrl:null,licenseBackUrl:null,titleUrl:null,selfieUrl:null,skipped:!0})}else await o.ZP.post("/sell-cars/".concat(F,"/documents"),{licenseFrontUrl:b.licenseFront||void 0,licenseBackUrl:b.licenseBack||void 0,titleUrl:b.title||void 0,selfieUrl:b.selfie||void 0,skipped:!1})}}catch(e){console.error("Failed to save seller documents",e)}finally{et(!1),e.push("/host/sell-cars")}}async function t4(){if(tB.length<tt){let e=tt-tB.length;M.toast.error(1===e?"Add 1 more photo to continue.":"Add at least ".concat(tt," photos to continue."));return}if(tB.length>e7.photos.maxCount){M.toast.error("You can upload up to ".concat(e7.photos.maxCount," photos."));return}if((0,p.p$)(eG.noLoan)){ef(p.az),M.toast.error(p.az);return}if(0>=Number(ts.askingPriceByHost||0)){v(2),ef("Car asking price is required.");return}et(!0),ef("");try{await tZ("photos",{photoUrls:tB,primaryPhotoUrl:tT||tB[0],...e0?{walkaroundVideoUrl:e0,walkaroundVideoDurationSeconds:e5}:{}},"Unable to save photos.");let e=await tZ("finalize",{},"Unable to finalize listing.");if(!(null==e?void 0:e.carId))throw Error((null==e?void 0:e.message)||"Unable to finalize listing.");await (0,l.Cu)(e.carId,{isUpForSelling:!0,askingPriceByHost:Number(ts.askingPriceByHost),...e0?{walkaroundVideoUrl:e0,walkaroundVideoDurationSeconds:e5}:{},previewsOwner:eG.previewsOwner,title:eG.title,previousAccident:eG.previousAccident,noLoan:eG.noLoan,exteriorColor:eG.exteriorColor||void 0,interiorColor:eG.interiorColor||void 0,licensePlate:eY.licensePlate||void 0,licensePlateState:eY.licensePlateState||void 0},r);try{(0,T.Zv)({car_id:String(e.carId),asking_price:Number(ts.askingPriceByHost)||void 0,make:eY.make||void 0,model:eY.model||void 0,year:eY.carYear?Number(eY.carYear):void 0,state:eY.licensePlateState||void 0})}catch(e){}f(ej),Object.assign(tS.current,{photosDirty:!1,videoDirty:!1,videoUnsynced:!1,retryCount:3}),N(String(e.carId)),v(4),window.scrollTo({top:0,behavior:"smooth"})}catch(t){let e=(null==t?void 0:t.message)||"Unable to continue right now. Please try again.";ef(e),M.toast.error(e)}finally{et(!1)}}async function t9(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!r){e||ef("Please sign in to generate a description.");return}if(!ej){e||ef("Please complete previous steps first, then try again.");return}if(!_){e||ef("Description generation is temporarily unavailable.");return}e||tx(!0),eW(!0),ef("");try{var t;let i=await fetch("".concat(_,"/host/carListing/getCarDescription"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(r)},body:JSON.stringify({carListingId:ej,make:eY.make,model:eY.model,trim:eY.trim,year:eY.carYear?Number(eY.carYear):void 0,transmissionType:eG.transmissionType,style:eY.style,generateEstimatedPriceRange:!0,mileage:Number(eG.carDailyMileage)||void 0,zip:(null===(t=eY.zipCode)||void 0===t?void 0:t.trim())||void 0})}),l=await i.json();if(!i.ok||!(null==l?void 0:l.success)||!(null==l?void 0:l.carDescription))throw Error((null==l?void 0:l.message)||"Unable to generate description right now.");let n=null==l?void 0:l.estimatedPriceRange,a=n&&Number.isFinite(Number(n.min))&&Number.isFinite(Number(n.max))&&Number(n.max)>Number(n.min);tu(a?{min:Number(n.min),max:Number(n.max),suggestedPrice:Number(n.suggestedPrice||0)||void 0}:null),e||tc(e=>({...e,carDescription:String(l.carDescription).trim()}))}catch(t){e||ef((null==t?void 0:t.message)||"Failed to generate description.")}finally{tx(!1),eW(!1)}}return(0,U.useMemo)(()=>{var e;return eY.licensePlateState?(null===(e=eB.find(e=>e.value===eY.licensePlateState))||void 0===e?void 0:e.label)||eY.licensePlateState:""},[eY.licensePlateState,eB]),(0,U.useEffect)(()=>{if(2!==u){tv.current=!1;return}tv.current||th||(tv.current=!0,td||t9(!0))},[u,th]),(0,U.useEffect)(()=>
1{if(tb.current||!tj||!r)return;let e=t.get("lookupMode"),i=(t.get("vin")||"").trim().toUpperCase(),l=(t.get("licensePlate")||"").trim().toUpperCase(),a=(t.get("licensePlateState")||"").trim().toUpperCase(),o="vin"===e&&17===i.length,s="plate"===e&&l.length>=4&&a.length>0;if(!o&&!s||(tb.current=!0,eS(s?0:1),ef(""),eH(e=>({...e,vin:i||e.vin,licensePlate:s?l:e.licensePlate,licensePlateState:s?a:e.licensePlateState,termsAgreed:!0})),tj.resumedQueryDraft))return;let c=(t.get("zipCode")||"").trim(),d=tj.listingId,u=tj.draftVin;(async()=>{X(!0);try{if(c&&(!(0,h.mP)(c)||!await tz(c,a)))return;let e={},t=i;if(s){let i=await (0,n.fF)(l,a,r);if(!(null==(e=(null==i?void 0:i.data)||{})?void 0:e.vin))throw Error((null==i?void 0:i.message)||"No vehicle found for this plate. Please try VIN.");t=String(e.vin).toUpperCase();let o=await (0,n.xK)(t,r);if(!(null==o?void 0:o.status))throw Error((null==o?void 0:o.message)||"This vehicle is already listed.");if(d&&u&&u!==t)try{await (0,n.QN)(String(d),r),d="",eF("")}catch(e){}}else{let t=await (0,n.xK)(i,r);if(!(null==t?void 0:t.status))throw Error("This VIN is already in use.");let l=await (0,n.iO)(i,r);e=(null==l?void 0:l.data)||{}}eH(r=>tW(r,e,t)),tY(e);let o=Number(null==e?void 0:e.minYear);Number.isFinite(o)&&o>0&&eq(o),eE(!0);let m=0;if(d)try{let e=await (0,n.PT)(d,r),t=null==e?void 0:e.carListing;m=H(t)}catch(e){m=0}v(m)}catch(e){ef((null==e?void 0:e.message)||"Unable to fetch vehicle details.")}finally{X(!1)}})()},[tj,r,t]),$||J?(0,i.jsx)("div",{className:"relative min-h-[calc(100vh-72px)] bg-[#F9FAFB]",children:(0,i.jsx)(g.default,{})}):(0,i.jsx)("div",{className:"min-h-[calc(100vh-72px)] bg-white",children:(0,i.jsxs)("div",{className:"mx-auto w-full max-w-[1440px]",children:[(0,i.jsx)("div",{className:"px-4 pt-6 lg:px-[52px] lg:pt-[31px]",children:(0,i.jsx)(G,{onClick:function(){if(0===u){eP?eE(!1):e.back();return}v(e=>Math.max(0,e-1))}})}),(0,i.jsxs)("div",{className:"pb-20 pt-6 lg:pt-8",children:[0===u&&!eP&&(0,i.jsx)(ed,{lookupErrorMessage:eb,lookupTab:eC,listingId:ej,setLookupTab:eS,lookupMode:eN,carDetails:eY,setCarDetails:eH,statesData:eB,makes:eM,models:e_,stylesList:eA,carYears:eV,vehicleSpecs:tM,previewPhotoUrl:tL,onVehicleLookup:tG,onContinue:tQ,isContinuing:es,isVehicleLookupLoading:em,showLookupErrors:er,showContinueErrors:el,unresolvedZipCode:ty}),0===u&&eP&&(0,i.jsx)(eu,{lookupErrorMessage:eb,lookupTab:eC,listingId:ej,setLookupTab:eS,lookupMode:eN,carDetails:eY,setCarDetails:eH,statesData:eB,makes:eM,models:e_,stylesList:eA,carYears:eV,vehicleSpecs:tM,previewPhotoUrl:tL,onVehicleLookup:tG,onContinue:tQ,isContinuing:es,isVehicleLookupLoading:em,showLookupErrors:er,showContinueErrors:el}),1===u&&(0,i.jsx)(eh,{additionalDetails:eG,setAdditionalDetails:eQ,carDetails:eY,vehicleSpecs:tM,previewPhotoUrl:tL,onContinue:t$,isSubmitting:ee,showValidationErrors:ea}),2===u&&(0,i.jsx)(ew,{priceDescription:ts,fetchingMarketPriceRange:eZ,marketPriceReport:tR,isGeneratingDescription:th,setPriceDescription:tc,onGenerateDescription:t9,onSubmit:t0,isSubmitting:ee}),3===u&&(0,i.jsx)(ev,{isDesktop:tU,isPreparingQr:tl,qrValue:tr,isSyncingFromMobile:ta,onSyncPhotosFromMobile:tH,uploadingSlotIndexes:eJ,onUploadSlotImage:tJ,photoSlots:e$,onRemoveSlot:function(e){tS.current.pendingPhotos=!0,eK(t=>{let r=[...t];return r[e]="",r})},walkaroundVideoUrl:e0,isUploadingVideo:e4,videoError:e3,onUploadVideo:tX,onRemoveVideo:function(){tS.current.pendingVideo=!0,e1(""),e2(null),e6("")},videoLimits:te,minPhotoCount:tt,maxPhotoCount:e7.photos.maxCount,onReorderPhotos:function(e){tS.current.pendingPhotos=!0,eK(e)},isSubmitting:ee,onContinue:t4}),4===u&&(0,i.jsx)(eg,{docs:b,phoneDocs:C,isDesktop:tU,qrValue:P,isPreparingQr:L,qrError:A,isSyncingFromMobile:Z,onSyncFromMobile:tI,uploadingSlot:w,onUploadDoc:t1,onRemoveDoc:t5,onContinue:()=>t2(!1),onSkip:()=>t2(!0),isSubmitting:ee}),ex?(0,i.jsx)("div",{className:"mx-auto mt-6 w-full max-w-[942px] px-4 lg:px-[74px]",children:(0,i.jsx)("p",{className:"rounded-lg border border-[#FECDCA] bg-[#FEF3F2] px-3 py-2 text-sm text-[#B42318]",children:ex})}):null]})]})})}},79509:function(e,t,r){"use strict";var i=r(27573),l=r(97273),n=r.n(l),a=r(5734);t.Z=e=>{let{isVisible:t,onClose:r,children:l,customClassName:o="",allowPageScroll:s=!1,maintainScrollPosition:c=!0}=e;return((0,a.Ni)(t&&!s,{restoreScroll:c}),t)?(0,i.jsx)("div",{className:n().modalBackdrop,onClick:e=>{e.target===e.currentTarget&&r&&r()},children:(0,i.jsxs)("div",{className:"".concat(n().modalContent," ").concat(o),onClick:e=>e.stopPropagation(),children:[r&&(0,i.jsx)("button",{onClick:r,className:n().closeButton,"aria-label":"Close",children:"\xd7"}),l]})}):null}},65547:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var i=r(27573),l=r(65880),n=r(35662),a=r(61192);function o(e){let{qrImageUrl:t,qrValue:r,isPreparing:o=!1,isSyncing:s=!1,error:c,onSync:d,className:u,description:m="Scan the QR code with your mobile device to upload Car Photos"}=e;return(0,i.jsxs)("div",{className:(0,n.cn)("flex w-full min-w-0 flex-col items-start justify-between rounded-2xl border border-[#F0F0F0] bg-white p-[23px]",u),children:[(0,i.jsxs)("div",{className:"flex w-full flex-col items-start gap-5",children:[(0,i.jsxs)("div",{className:"flex w-full flex-col gap-2",children:[(0,i.jsx)("h2",{className:"m-0 text-xl font-semibold leading-7 text-[#0E0F11]",children:"Upload from Mobile"}),(0,i.jsx)("p",{className:"m-0 w-full text-base font-normal leading-[26px] tracking-[0.16px] text-[#0E0F11]",children:m})]}),(0,i.jsx)("div",{className:"flex w-fit shrink-0 items-center rounded-[18px] border border-[#F0F0F0] p-2",children:r&&!o?(0,i.jsx)(a.Z,{value:r,size:147,snapToModules:!0}):o||!t?(0,i.jsx)("span",{className:"flex h-[147px] w-[145px] items-center justify-center text-sm text-[#595959]",children:"Preparing QR..."}):(0,i.jsx)(l.default,{src:t,alt:m,width:145,height:147,loading:"eager",unoptimized:!0,className:"h-[147px] w-[145px]"})}),c&&(0,i.jsx)("p",{className:"m-0 text-xs leading-4 text-[#B42318]",children:c})]}),(0,i.jsx)("button",{type:"button",onClick:d,disabled:o||s,className:"mt-6 flex h-12 min-h-12 w-full shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-xl border-[1.5px] border-[#F0F0F0] bg-white px-3 py-[10px] text-sm font-semibold leading-5 tracking-[0.01px] text-[#1F1F1F] transition-colors hover:bg-[#F9F9F9] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#027BFF] disabled:cursor-not-allowed disabled:opacity-60",children:s?"Syncing...":"Tap here when you're done"})]})}},61192:function(e,t,r){"use strict";var i=r(27573),l=r(7653),n=r(70476);let a=l.useLayoutEffect;t.Z=e=>{let{value:t,size:r=256,level:o="M",bgColor:s="#FFFFFF",fgColor:c="#000000",style:d,snapToModules:u=!1}=e,m=(0,l.useRef)(null),[p,h]=(0,l.useState)(r);return a(()=>{var e,t,i,l;if(!u){h(r);return}let n=null===(l=m.current)||void 0===l?void 0:null===(i=l.querySelector("svg"))||void 0===i?void 0:null===(t=i.viewBox)||void 0===t?void 0:null===(e=t.baseVal)||void 0===e?void 0:e.width;n&&h(Math.max(4,Math.round(r/n))*n)},[t,r,o,u]),(0,i.jsx)("div",{ref:m,style:d,children:(0,i.jsx)(n.ZP,{value:t,size:p,level:o,bgColor:s,fgColor:c,shapeRendering:"crispEdges"})})}},66282:function(e,t,r){"use strict";r.d(t,{n:function(){return a}});var i=r(27573),l=r(7653),n=r(35662);let a=l.forwardRef((e,t)=>
1{let{checked:r,className:l,style:a,...o}=e;return(0,i.jsx)("input",{ref:t,type:"checkbox",checked:r,className:(0,n.cn)("!w-[20px] !h-[20px] accent-[#1F1F1F] shrink-0 rounded appearance-none border checked:bg-[#1F1F1F] checked:border-[#1F1F1F]",r?"bg-[#1F1F1F] border-[#1F1F1F]":"bg-white border-[#F0F0F0]",l),style:{backgroundImage:r?"url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M20 6L9 17l-5-5'/%3e%3c/svg%3e\")":"none",backgroundSize:"100% 100%",backgroundPosition:"center",backgroundRepeat:"no-repeat",...a},...o})});a.displayName="SquareCheckbox"},36576:function(e,t,r){"use strict";r.d(t,{L:function(){return i}});let i=r(7653).useLayoutEffect},20422:function(e,t,r){"use strict";r.d(t,{M:function(){return a},b:function(){return o}});var i=r(7653),l=r(36576);let n=e=>({left:e.offsetLeft,top:e.offsetTop,width:e.offsetWidth,height:e.offsetHeight}),a=e=>{let t=e.getBoundingClientRect();return{left:t.left+window.scrollX,top:t.top+window.scrollY,width:t.width,height:t.height}};function o(e,t,r){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n,o=(0,i.useRef)(new Map),s=(0,i.useRef)(new Map);(0,l.L)(()=>{var r;s.current.forEach(e=>e.cancel()),s.current.clear();let i=new Map,l=window.matchMedia("(prefers-reduced-motion: reduce)").matches;null===(r=e.current)||void 0===r||r.forEach((e,r)=>{let n=a(e),c=o.current.get(r);if(i.set(r,n),!t||!c||!n.width||!n.height||!e.animate||l)return;let d=c.left-n.left,u=c.top-n.top;(d||u||c.width!==n.width||c.height!==n.height)&&s.current.set(r,e.animate([{transform:"translate(".concat(d,"px, ").concat(u,"px) scale(").concat(c.width/n.width,", ").concat(c.height/n.height,")"),transformOrigin:"top left"},{transform:"none",transformOrigin:"top left"}],{duration:220,easing:"cubic-bezier(0.2, 0, 0, 1)"}))}),o.current=i},[e,t,r,a]),(0,i.useEffect)(()=>()=>{s.current.forEach(e=>e.cancel())},[])}},52351:function(e,t,r){"use strict";r.d(t,{AM:function(){return o},Ed:function(){return n},NH:function(){return i},TG:function(){return a},WQ:function(){return l},nb:function(){return s}});let i=[{key:"licenseFront",label:"Driver's licence — front",hint:"Photo of the front",urlField:"licenseFrontUrl",viewField:"licenseFrontViewUrl",listingFlag:"hasLicenceFront"},{key:"licenseBack",label:"Driver's licence — back",hint:"Photo of the back",urlField:"licenseBackUrl",viewField:"licenseBackViewUrl",listingFlag:"hasLicenceBack"},{key:"title",label:"Car title",hint:"Photo of the title document",urlField:"titleUrl",viewField:"titleViewUrl",listingFlag:"hasTitle"},{key:"selfie",label:"Selfie",hint:"Optional — a clear photo of your face",urlField:"selfieUrl",viewField:"selfieViewUrl",optional:!0}],l=i.filter(e=>!e.optional);function n(e){return i.reduce((t,r)=>({...t,[r.key]:e}),{})}let a="image/*,application/pdf";function o(e){return i.reduce((t,r)=>({...t,[r.key]:!!(null==e?void 0:e[r.viewField])}),n(!1))}function s(e,t,r){return"".concat(e,"/host/upload-car-photos?token=").concat(encodeURIComponent(t),"&carId=").concat(encodeURIComponent(r),"&documents=1")}},15025:function(e,t,r){"use strict";r.d(t,{HF:function(){return n},L2:function(){return o},Zv:function(){return a},pM:function(){return l}}),window.dataLayer=window.dataLayer||[];let i=e=>{window.dataLayer&&window.dataLayer.push(e)};function l(e){i({event:"university_landing_view",university_slug:e.university_slug,university_short_name:e.university_short_name,timestamp:new Date().toISOString()})}function n(e){i({event:"university_landing_cta",university_slug:e.university_slug,cta_id:e.cta_id,timestamp:new Date().toISOString()})}let a=e=>{i({event:"buysell_listing_published",car_id:e.car_id,asking_price:e.asking_price,currency:"USD",make:e.make,model:e.model,year:e.year,state:e.state,timestamp:new Date().toISOString()})},o=e=>{i({event:"buysell_vdp_inquiry_sent",car_id:e.car_id,offer_amount:e.offer_amount,asking_price:e.asking_price,has_message:e.has_message,currency:"USD",timestamp:new Date().toISOString()})}},1578:function(e,t,r){"use strict";function i(e,t,r){let i=[...e.grid],l=[...e.extra],n=i.findIndex(t=>(null==t?void 0:t.id)===e.id),a=n>=0?"grid":"extra",o=n>=0?n:l.findIndex(t=>t.id===e.id);if(o<0)return e;let s="grid"===t?i:l,c=Math.max(0,Math.min(r,"grid"===t||a===t?s.length-1:s.length));if(a===t&&o===c)return e;let d=("grid"===a?i:l)[o];if("grid"===a&&"grid"===t&&i[c])i.splice(o,1),i.splice(c,0,d);else if("grid"===a?i[o]=void 0:l.splice(o,1),"extra"===t)l.splice(c,0,d);else if(i[c]){let e=i.findIndex((e,t)=>t>c&&!e),t=i.findIndex((e,t)=>t<c&&!e);e>=0?(i.splice(e,1),i.splice(c,0,d)):t>=0?(i.splice(t,1),i.splice(c,0,d)):(i.splice(c,0,d),l.unshift(i.pop()))}else i[c]=d;return{...e,grid:i,extra:l}}r.d(t,{V:function(){return i}})},54945:function(e,t,r){"use strict";r.d(t,{$3:function(){return o},Dw:function(){return s},OR:function(){return a},PY:function(){return n},mP:function(){return l}});let i="LISTING_ZIP_NOT_FOUND";function l(e){return/^\d{5}$/.test(String(e||"").trim())}
1function n(e){return"We couldn't find ZIP code ".concat(String(e||"").trim(),". Please check it and try again.")}function a(e){return(null==e?void 0:e.code)===i}function o(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"US",i=String(e||"").trim(),l=String(t||"").trim().toUpperCase();return[i||l,String(r||"US").trim().toUpperCase()||"US"].filter(Boolean).join(", ")}async function s(e){var t;let{apiBaseUrl:r,token:l,zipCode:a,state:s,country:c="US",fetchImpl:d=fetch}=e,u=String(a||"").trim(),m=String(s||"").trim().toUpperCase(),p=String(c||"US").trim().toUpperCase()||"US";if(!u&&!m)throw Error("ZIP code or state is required to prepare listing draft.");let h={"Content-Type":"application/json",Authorization:"Bearer ".concat(l)},x=o(u,m,p),f=await d("".concat(r,"/host/carListing/searchListingAddress?input=").concat(encodeURIComponent(x)),{method:"GET",headers:h});if(!f.ok)throw Error("Unable to look up your ZIP code right now. Please try again.");let g=await f.json(),v=null==g?void 0:null===(t=g.results)||void 0===t?void 0:t[0];if(!(null==g?void 0:g.status)||!(null==v?void 0:v.place_id)){let e=Error(u?n(u):"Unable to locate your area from the selected state.");throw e.code=i,e}let b=await d("".concat(r,"/host/carListing/getListingLocation?placeId=").concat(encodeURIComponent(v.place_id)),{method:"GET",headers:h}),y=await b.json(),w=null==y?void 0:y.placeDetails,j=Number(null==w?void 0:w.latitude),F=Number(null==w?void 0:w.longitude);if(!Number.isFinite(j)||!Number.isFinite(F))throw Error("Unable to resolve map coordinates from ZIP code and state.");let N=(null==v?void 0:v.address_components)||{},k=(null==N?void 0:N.city)||"",C=(null==N?void 0:N.state)||m,S=(null==N?void 0:N.zipcode)||u;return{address:{street:(null==N?void 0:N.street)&&String(N.street).trim()||k||C||S||"N/A",city:k,state:C,zip:S,country:p},location:{type:"Point",coordinates:[F,j]}}}},82523:function(e,t,r){"use strict";r.d(t,{$O:function(){return i},A7:function(){return a},LR:function(){return o},SR:function(){return d},Wd:function(){return l},Yn:function(){return s},ZM:function(){return n},dG:function(){return u},yo:function(){return c}});let i=["0-10k","10-20k","20-30k","30-40k","40-50k","50-60k","60-70k","70-80k","80-90k","90-100k","100-110k","110-120k","120-130k","130-140k","140-150k","150-160k","160-170k","170-180k","180-190k","190-200k","200k+"],l=["200","250","300","350","400","450","500"],n="Unlimited",a="200";function o(e){let t=Number(String(null!=e?e:"").replace(/[,\s]/g,""));if(!Number.isFinite(t)||t<0||""===String(null!=e?e:"").trim())return"";if(t>=2e5)return"200k+";let r=10*Math.floor(t/1e4);return i.find(e=>e==="".concat(r,"-").concat(r+10,"k"))||""}function s(e){if(null==e?void 0:e.unlimitedDailyDistance)return n;let t=Number(null==e?void 0:e.carDailyMileage);return Number.isFinite(t)&&t>0?String(t):a}function c(e){let t=[...l];return e&&e!==n&&!t.includes(e)&&Number(e)>0&&(t.push(e),t.sort((e,t)=>Number(e)-Number(t))),[...t,n]}function d(e,t){if(e===n){let e=Number(t);return{carDailyMileage:Number.isFinite(e)&&e>0?e:Number(a),unlimitedDailyDistance:!0}}let r=Number(e);return{carDailyMileage:Number.isFinite(r)&&r>0?r:Number(a),unlimitedDailyDistance:!1}}function u(e){if(null==e?void 0:e.unlimitedDailyDistance)return"Unlimited";let t=Number(null==e?void 0:e.carDailyMileage);return Number.isFinite(t)&&t>0?"".concat(t.toLocaleString()," mi/day"):""}},97273:function(e){e.exports={modalBackdrop:"Modal_modalBackdrop__F8uAK",modalContent:"Modal_modalContent__uOMcP",closeButton:"Modal_closeButton__Djgg8",customWidthModal:"Modal_customWidthModal__ghmvo"}},19891:function(e){e.exports={modalBackdrop:"CustomModalStyles_modalBackdrop__Ob_Qu",container:"CustomModalStyles_container__GrCrv",modalContent:"CustomModalStyles_modalContent__IK8UA",addCarButton:"CustomModalStyles_addCarButton__rQ0_g",modalTitle:"CustomModalStyles_modalTitle__YkETl",modalText:"CustomModalStyles_modalText__1jAZO",modalButtons:"CustomModalStyles_modalButtons__Lnl0O",button:"CustomModalStyles_button__9aAXh",continueButton:"CustomModalStyles_continueButton__Dv9S2",newListingButton:"CustomModalStyles_newListingButton__hvg3q"}}
1,68571:function(e){var t,r,i,l=e.exports={};function n(){throw Error("setTimeout has not been defined")}function a(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===n||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:n}catch(e){t=n}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var s=[],c=!1,d=-1;function u(){c&&i&&(c=!1,i.length?s=i.concat(s):d=-1,s.length&&m())}function m(){if(!c){var e=o(u);c=!0;for(var t=s.length;t;){for(i=s,s=[];++d<t;)i&&i[d].run();d=-1,t=s.length}i=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function h(){}l.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];s.push(new p(e,t)),1!==s.length||c||o(m)},p.prototype.run=function(){this.fun.apply(null,this.array)},l.title="browser",l.browser=!0,l.env={},l.argv=[],l.version="",l.versions={},l.on=h,l.addListener=h,l.once=h,l.off=h,l.removeListener=h,l.removeAllListeners=h,l.emit=h,l.prependListener=h,l.prependOnceListener=h,l.listeners=function(e){return[]},l.binding=function(e){throw Error("process.binding is not supported")},l.cwd=function(){return"/"},l.chdir=function(e){throw Error("process.chdir is not supported")},l.umask=function(){return 0}}}]);

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.