PageSourceSearch

https://sundr.ca/_next/static/chunks/app/decide/page-aec0b6274c8d5bf8.js?dpl=dpl_Fg1Rm3kQz5N4WFBe3Kv4whWeL6ha

js sundr.ca collected 2026-10-04 01:39:21 UTC 54,439 bytes, 19 lines download raw bytes

1!function(){try{var e="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{},r=(new e.Error).stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="ced89276-ee3b-47f6-9e10-adf81666498a",e._sentryDebugIdIdentifier="sentry-dbid-ced89276-ee3b-47f6-9e10-adf81666498a")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4303],{17363:(e,r,a)=>{"use strict";a.d(r,{DecideClient:()=>E});var t=a(95155),o=a(12115),n=a(88370),s=a(32896),l=a(21123);let i=!1,c=0;function d(){if(!i){i=!0;try{var e;null==(e=s.M())||e.flush().catch(()=>{})}catch{}}}function u(e){c+=1;try{var r;l.Wt({decision_verdict:e.verdict,decision_category:e.category,decision_confidence:(r=e.confidence)>=80?"high":r>=60?"moderate":r>=40?"low":"very_low",decide_layout:e.layout,decision_runs:String(c)})}catch{}}var m=a(53378),p=a(73470),g=a(89824);let v=(0,o.memo)(function(e){let{categories:r,onSelect:a}=e;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-[var(--color-text-secondary)] mb-4",children:"Select a category:"}),r.map(e=>(0,t.jsxs)("button",{onClick:()=>
1{(0,n.sx)("category_selected",{category:e.slug}),a(e)},className:"w-full flex items-center justify-between p-4 bg-[var(--color-surface)] border border-[var(--color-border)] rounded-[var(--radius-md)] hover:border-[var(--color-primary)] transition-colors",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:"text-2xl","aria-hidden":"true",children:e.icon}),(0,t.jsx)("span",{className:"font-medium text-[var(--color-text-primary)]",children:e.name})]}),(0,t.jsx)("svg",{className:"w-5 h-5 text-[var(--color-text-secondary)]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]},e.slug))]})});var h=a(54327),b=a(39277),f=a(44037);let y=["image/jpeg","image/png"];function x(e){let{onDiagnosisComplete:r,categoryHint:a}=e,[n,s]=(0,o.useState)(null),[l,i]=(0,o.useState)(null),[c,d]=(0,o.useState)(null),[u,m]=(0,o.useState)(!1),[p,g]=(0,o.useState)(null),[v,b]=(0,o.useState)(null),[f,x]=(0,o.useState)(null),k=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e=new AbortController;return async function(){try{var r;let a=await fetch("/api/v1/diagnose",{signal:e.signal}),t=await a.json();t.success&&(null==(r=t.data)?void 0:r.rateLimit)&&s(t.data.rateLimit)}catch{}}(),()=>e.abort()},[]);let N=(0,o.useCallback)(e=>{var r;let a=null==(r=e.target.files)?void 0:r[0];if(!a)return;if(b(null),g(null),x(null),!y.includes(a.type))return void b("Please select a JPEG or PNG image.");if(a.size>0x1400000)return void b(`Image too large (${Math.round(a.size/1024/1024)}MB). Maximum 20MB.`);i(a);let t=new FileReader;t.onload=e=>{var r;d(null==(r=e.target)?void 0:r.result)},t.readAsDataURL(a)},[]),S=(0,o.useCallback)(()=>{i(null),d(null),g(null),b(null),x(null),k.current&&(k.current.value="")},[]),A=(0,o.useCallback)(async()=>{if(l&&c){m(!0),b(null),x(null);try{var e,r,t;let o=c.split(",")[1];if(!o)return void b("Failed to process image data.");let n=await fetch("/api/v1/diagnose",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({imageData:o,mimeType:l.type,categoryHint:a})}),i=await n.json();if(429===n.status){let a=null==(e=i.error)?void 0:e.details;(null==a?void 0:a.reason)==="anonymous_daily"?x("Sign up for 10 free analyses per day."):(null==a?void 0:a.reason)==="user_daily"?x("Daily limit reached. Try again tomorrow."):(null==a?void 0:a.reason)==="moderation_block"?x("Access temporarily suspended. Please try again later."):x((null==(r=i.error)?void 0:r.message)||"Too many requests. Please try again later."),a&&s({remaining:a.remaining??0,limit:a.limit??0,resetAt:a.resetAt??0,isAuthenticated:a.isAuthenticated??!1,blocked:"moderation_block"===a.reason});return}if(!n.ok||!i.success)return void b((null==(t=i.error)?void 0:t.message)||"Analysis failed. Please try again.");let d=i.data;g(d.diagnosis),d.rateLimit&&s({remaining:d.rateLimit.remaining,limit:d.rateLimit.limit,resetAt:d.rateLimit.resetAt,isAuthenticated:d.rateLimit.isAuthenticated,blocked:!1})}catch{b("Network error. Please check your connection and try again.")}finally{m(!1)}}},[l,c,a]),M=(0,o.useCallback)(()=>{p&&r&&r(p)},[p,r]),$=null!==n&&n.remaining<=0&&!n.blocked,P=(null==n?void 0:n.blocked)===!0;return(0,t.jsxs)("div",{className:"space-y-4",children:[n&&!p&&(0,t.jsx)(w,{status:n}),(0,t.jsxs)("div",{children:[(0,t.jsx)("input",{ref:k,type:"file",accept:"image/jpeg,image/png",onChange:N,className:"hidden",id:"photo-upload-input"}),c?(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("img",{src:c,alt:"Selected photo preview",width:400,height:256,className:"w-full max-h-64 object-contain rounded-[var(--radius-md)] border border-[var(--color-border)]"}),(0,t.jsx)("button",{onClick:S,className:"absolute top-2 right-2 px-3 py-1 text-sm bg-[var(--color-surface)]/90 border border-[var(--color-border)] rounded-[var(--radius-sm)] hover:bg-[var(--color-surface)] transition-colors",children:"Retake"})]}):(0,t.jsxs)("label",{htmlFor:"photo-upload-input",className:`
2              flex items-center gap-3
3              w-full px-4 py-3
4              border border-dashed rounded-[var(--radius-md)]
5              transition-colors cursor-pointer
6              ${$||P?"border-[var(--color-border)] bg-[var(--color-surface)] opacity-60":"border-[var(--color-border)] hover:border-[var(--color-primary)] bg-[var(--color-surface)]"}
7            `,children:[(0,t.jsxs)("svg",{className:"w-5 h-5 text-[var(--color-text-secondary)] flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M3 9a2 2 0 012-2h.93a2 2 0 001.664-.89l.812-1.22A2 2 0 0110.07 4h3.86a2 2 0 011.
7664.89l.812 1.22A2 2 0 0018.07 7H19a2 2 0 012 2v9a2 2 0 01-2 2H5a2 2 0 01-2-2V9z"}),(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M15 13a3 3 0 11-6 0 3 3 0 016 0z"})]}),(0,t.jsx)("div",{children:(0,t.jsx)("span",{className:"text-sm text-[var(--color-text-secondary)]",children:"Add a photo for AI to improve our diagnosis"})})]})]}),v&&(0,t.jsx)("div",{role:"alert",className:"p-3 text-sm bg-[var(--color-danger-bg)] border border-[var(--color-danger-border)] rounded-[var(--radius-md)] text-[var(--color-error)]",children:v}),f&&(0,t.jsx)(j,{message:f,isAuthenticated:(null==n?void 0:n.isAuthenticated)??!1}),c&&!p&&(0,t.jsx)(h.Button,{fullWidth:!0,size:"lg",onClick:A,disabled:u||$||P,children:u?(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsxs)("svg",{className:"animate-spin h-5 w-5",viewBox:"0 0 24 24",fill:"none",children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Analyzing..."]}):"Analyze Photo"}),p&&(0,t.jsx)(C,{diagnosis:p,onUseDiagnosis:r?M:void 0,onRetake:S})]})}function w(e){let{status:r}=e;return r.blocked?(0,t.jsx)("div",{className:"p-3 text-sm bg-[var(--color-danger-bg)] border border-[var(--color-danger-border)] rounded-[var(--radius-md)] text-[var(--color-error)]",children:"Access temporarily suspended due to policy violations."}):r.remaining<=0?r.isAuthenticated?(0,t.jsx)("div",{className:"p-3 text-sm bg-[var(--color-warning-bg)] border border-[var(--color-warning-border)] rounded-[var(--radius-md)] text-[var(--color-warning-text)]",children:"Daily limit reached. Your analyses reset tomorrow."}):(0,t.jsxs)("div",{className:"p-3 text-sm bg-[var(--color-warning-bg)] border border-[var(--color-warning-border)] rounded-[var(--radius-md)] text-[var(--color-warning-text)]",children:["You've used your free analyses for today."," ",(0,t.jsx)("a",{href:"/auth/signup",className:"font-medium underline hover:no-underline",children:"Sign up for 10 free analyses per day"}),"."]}):null}function j(e){let{message:r,isAuthenticated:a}=e;return(0,t.jsxs)("div",{className:"p-4 bg-[var(--color-warning-bg)] border border-[var(--color-warning-border)] rounded-[var(--radius-md)]",children:[(0,t.jsx)("p",{className:"text-sm text-[var(--color-warning-text)] font-medium",children:r}),!a&&(0,t.jsx)("a",{href:"/auth/signup",className:"inline-block mt-2 text-sm font-medium text-[var(--color-primary)] hover:underline",children:"Sign up for 10 free analyses per day →"})]})}function C(e){let{diagnosis:r,onUseDiagnosis:a,onRetake:o}=e;if(!r.success)return(0,t.jsx)(f.Z,{children:(0,t.jsxs)("div",{className:"text-center py-4",children:[(0,t.jsx)("p",{className:"text-[var(--color-text-secondary)]",children:r.suggestedDescription||"Could not analyze the image. Please try a different photo or describe the issue manually."}),(0,t.jsx)(h.Button,{variant:"secondary",size:"sm",onClick:o,className:"mt-3",children:"Try Another Photo"})]})});let n={minor:"text-[var(--color-success-text)] bg-[var(--color-success-bg)] border-[var(--color-success-border)]",moderate:"text-[var(--color-warning-text)] bg-[var(--color-warning-bg)] border-[var(--color-warning-border)]",severe:"text-[var(--color-danger-text)] bg-[var(--color-danger-bg)] border-[var(--color-danger-border)]",unknown:"text-[var(--color-text-secondary)] bg-[var(--color-background)] border-[var(--color-border)]"};return(0,t.jsx)(f.Z,{children:(0,t.jsxs)("div",{className:"space-y-4",children:[r.item&&(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-[var(--color-text-secondary)] mb-1",children:"Detected Item"}),(0,t.jsx)("p",{className:"text-[var(--color-text-primary)] font-medium",children:r.item.brand?`${r.item.brand} ${r.item.model||r.item.itemType}`:r.item.itemType})]}),r.damages.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-[var(--color-text-secondary)] mb-2",children:"Detected Issues"}),(0,t.jsx)("ul",{className:"space-y-1",children:r.damages.map((e,r)=>(0,t.jsxs)("li",{className:"flex items-start gap-2 text-sm text-[var(--color-text-primary)]",children:[(0,t.jsx)("span",{className:"mt-1 w-1.5 h-1.5 rounded-full bg-[var(--color-text-secondary)] flex-shrink-0"}),(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"font-medium",children:e.type}),e.description&&` - ${e.description}`]})]},r))})]}),(0,t.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,t.jsxs)("span",{className:`inline-block px-2 py-1 text-xs font-medium rounded border ${n[r.severity]||n.unknown}`,children:[r.severity.charAt(0).toUpperCase()+r.severity.slice(1)," ","severity"]}),"unknown"!==r.diyFeasibility&&(0,t.jsxs)("span",{className:"inline-block px-2 py-1 text-xs font-medium rounded border text-[var(--color-info-text)] bg-[var(--color-info-bg)] border-[var(--color-info-border)]",children:["DIY: ",r.diyFeasibility.replace("_"," ")]})]}),r.safetyWarnings.length>0&&(0,t.jsxs)("div",{className:"p-3 bg-[var(--color-danger-bg)] border border-[var(--color-danger-border)] rounded-[var(--radius-sm)]",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-[var(--color-danger-text)] mb-1",children:"Safety Warnings"}),(0,t.jsx)("ul",{className:"text-xs text-[var(--color-danger-text)] space-y-0.5",children:r.safetyWarnings.map((e,r)=>(0,t.jsx)("li",{children:e},r))})]}),(0,t.jsxs)("div",{className:"flex gap-2 pt-2",children:[a&&(0,t.jsx)(h.Button,{onClick:a,size:"sm",className:"flex-1",children:"Use This Diagnosis"}),(0,t.jsx)(h.Button,{variant:"secondary",size:"sm",onClick:o,children:"Try Another Photo"})]})]})})}function k(e){let{diagnosis:r,onDismiss:a}=e;return(0,t.jsxs)("div",{className:"relative p-4 bg-[var(--color-info-bg)] border border-[var(--color-info-border)] rounded-[var(--radius-md)]",children:[(0,t.jsx)("button",{type:"button",onClick:a,className:"absolute top-2 right-2 p-1 text-[var(--color-info-text)] opacity-60 hover:opacity-100 transition-colors","aria-label":"Dismiss AI summary",children:(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),(0,t.jsx)("p",{className:"text-sm font-medium text-[var(--color-info-text)] mb-2",children:"AI-detected summary"}),(0,t.jsxs)("div",{className:"space-y-1.5 text-sm text-[var(--color-info-text)]",children:[r.item&&(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"font-medium",children:"Item:"})," ",r.item.itemType,r.item.brand&&` (${r.item.brand}${r.item.model?` ${r.item.model}`:""})`]}),r.damages.length>0&&(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"font-medium",children:"Issues:"})," ",r.damages.map(e=>e.description).join("; ")]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 mt-2",children:["unknown"!==r.severity&&(0,t.jsxs)("span",{className:"inline-block px-2 py-0.5 bg-[var(--color-info-bg)] border border-[var(--color-info-border)] rounded text-xs",children:["Severity: ",r.severity.charAt(0).toUpperCase()+r.severity.slice(1)]}),"unknown"!==r.diyFeasibility&&(0,t.jsxs)("span",{className:"inline-block px-2 py-0.5 bg-[var(--color-info-bg)] border border-[var(--color-info-border)] rounded text-xs",children:["DIY: ",r.diyFeasibility.replace(/_/g," ")
7]})]}),r.safetyWarnings.length>0&&(0,t.jsxs)("div",{className:"mt-2 p-2 bg-[var(--color-warning-bg)] border border-[var(--color-warning-border)] rounded text-[var(--color-warning-text)] text-xs",children:[(0,t.jsx)("span",{className:"font-medium",children:"Safety:"})," ",r.safetyWarnings.join(". ")]})]}),(0,t.jsx)("p",{className:"text-xs text-[var(--color-info-text)] opacity-75 mt-2",children:"Fields below have been auto-filled. You can edit them."})]})}var N=a(25911);let S={smartphone:{slug:"smartphone",name:"Smartphone",icon:"\uD83D\uDCF1",commonIssues:["Cracked screen","Battery drains fast","Won't charge","Won't turn on","Camera not working","Speaker issues"],typicalCosts:[{label:"Under $50",value:50},{label:"$50-100",value:75},{label:"$100-200",value:150},{label:"$200-300",value:250},{label:"Over $300",value:350}]},laptop:{slug:"laptop",name:"Laptop",icon:"\uD83D\uDCBB",commonIssues:["Screen damaged","Battery won't hold charge","Keyboard not working","Won't turn on","Running slow","Overheating"],typicalCosts:[{label:"Under $100",value:75},{label:"$100-200",value:150},{label:"$200-400",value:300},{label:"$400-600",value:500},{label:"Over $600",value:700}]},tablet:{slug:"tablet",name:"Tablet",icon:"\uD83D\uDCF2",commonIssues:["Cracked screen","Battery drains fast","Won't charge","Won't turn on","Touchscreen unresponsive","Running slow"],typicalCosts:[{label:"Under $50",value:40},{label:"$50-100",value:75},{label:"$100-200",value:150},{label:"$200-400",value:300},{label:"Over $400",value:500}]},"e-reader":{slug:"e-reader",name:"E-Reader",icon:"\uD83D\uDCD6",commonIssues:["Battery won't hold charge","Screen is cracked","Touchscreen unresponsive","Won't charge","Frozen/unresponsive","WiFi not connecting"],typicalCosts:[{label:"Under $30",value:25},{label:"$30-50",value:40},{label:"$50-80",value:65},{label:"$80-150",value:100},{label:"Over $150",value:175}]},washer:{slug:"washing-machine",name:"Washing Machine",icon:"\uD83E\uDDFA",commonIssues:["Not draining","Leaking water","Won't spin","Making strange noises","Not turning on","Error codes showing"],typicalCosts:[{label:"Under $100",value:75},{label:"$100-200",value:150},{label:"$200-400",value:300},{label:"$400-600",value:500},{label:"Over $600",value:700}]},dryer:{slug:"dryer",name:"Dryer",icon:"\uD83D\uDC55",commonIssues:["Not heating","Takes too long to dry","Making strange noises","Won't turn on","Won't tumble","Error codes showing"],typicalCosts:[{label:"Under $100",value:75},{label:"$100-200",value:150},{label:"$200-400",value:300},{label:"$400-600",value:500},{label:"Over $600",value:700}]},dishwasher:{slug:"dishwasher",name:"Dishwasher",icon:"\uD83C\uDF7D️",commonIssues:["Not cleaning dishes","Leaking water","Not draining","Won't start","Making strange noises","Error codes showing"],typicalCosts:[{label:"Under $100",value:75},{label:"$100-200",value:150},{label:"$200-400",value:300},{label:"$400-600",value:500},{label:"Over $600",value:700}]},refrigerator:{slug:"refrigerator",name:"Refrigerator",icon:"\uD83E\uDDCA",commonIssues:["Not cooling","Making strange noises","Leaking water","Ice maker not working","Running constantly","Freezer not freezing"],typicalCosts:[{label:"Under $100",value:75},{label:"$100-200",value:150},{label:"$200-400",value:300},{label:"$400-600",value:500},{label:"Over $600",value:700}]}};Object.values(S).map(e=>e.slug),Object.fromEntries(Object.values(S).map(e=>[e.slug,e.typicalCosts]));let A={...Object.fromEntries(Object.values(S).map(e=>[e.slug,e.commonIssues])),headphones:["No sound from one side","Bluetooth won't connect","Battery dies quickly","Crackling or distorted sound","Broken headband or hinge","Microphone not working"],tv:["Screen is cracked or damaged","No picture but has sound","Won't turn on","Flickering or dim screen","No sound","Remote not working"],blender:["Motor won't start","Blades not spinning","Leaking from base","Making grinding noises","Lid won't seal properly","Jar is cracked"],"stand-mixer":["Motor won't start","Making grinding noises","Attachments won't lock in","Speed control not working","Leaking oil or grease","Bowl won't stay in place"],"coffee-maker":["Not brewing","Leaking water","Coffee tastes off","Not heating water","Won't turn on","Slow brewing"],"toaster-
7oven":["Not heating up","Uneven heating","Door won't close properly","Timer not working","Won't turn on","Burning smell"]};var M=a(67618);let $=[{id:"apple_iup",name:"Apple iPhone Upgrade Program",carrier:"Apple",country:"both",versions:[{effectiveFrom:"2015-09-01",effectiveTo:null,eligibleAfterMonths:12,lastVerified:"2026-02-20"}]},{id:"tmobile_yearly",name:"T-Mobile Yearly Upgrade",carrier:"T-Mobile",country:"US",versions:[{effectiveFrom:"2023-12-07",effectiveTo:null,eligibleAfterMonths:6,requiresPercentPaid:.5,lastVerified:"2026-02-20"}]},{id:"att_next_up",name:"AT&T Next Up Anytime",carrier:"AT&T",country:"US",versions:[{effectiveFrom:"2023-01-01",effectiveTo:null,eligibleAfterMonths:1,lastVerified:"2026-02-20"}]},{id:"carrier_credits",name:"Carrier bill credits (24mo)",carrier:"Various",country:"US",versions:[{effectiveFrom:"2020-01-01",effectiveTo:null,eligibleAfterMonths:24,lastVerified:"2026-02-20"}]},{id:"bell_dro",name:"Bell Device Return Option",carrier:"Bell",country:"CA",versions:[{effectiveFrom:"2019-01-01",effectiveTo:null,eligibleAfterMonths:24,lastVerified:"2026-02-20"}]},{id:"rogers_upfront_edge",name:"Rogers Upfront Edge",carrier:"Rogers",country:"CA",versions:[{effectiveFrom:"2019-03-01",effectiveTo:null,eligibleAfterMonths:24,lastVerified:"2026-02-20"}]},{id:"telus_bib",name:"Telus Bring-It-Back",carrier:"Telus",country:"CA",versions:[{effectiveFrom:"2019-06-01",effectiveTo:null,eligibleAfterMonths:24,lastVerified:"2026-02-20"}]},{id:"koodo_tab",name:"Koodo Tab",carrier:"Koodo",country:"CA",versions:[{effectiveFrom:"2018-01-01",effectiveTo:null,eligibleAfterMonths:24,lastVerified:"2026-02-20"}]}];var P=a(63109);let I=[{brand:"apple",deviceSlugs:["smartphone"],standardWarrantyMonths:12,standardWarrantyUrl:"https://www.apple.com/legal/warranty/",standardCoverageNote:"Covers manufacturing defects and hardware failures under normal use. Does not cover accidental damage, theft, or cosmetic wear.",extendedPlans:[{id:"applecare-plus-iphone",name:"AppleCare+",description:"Extends hardware coverage and adds accidental damage protection with a per-incident service fee.",coverageIncludes:["Up to 2 accidental damage incidents per 12 months (screen/back glass: $29 service fee; other damage: $99 service fee)","Battery replacement if capacity drops below 80%","Priority access to Apple technical support","Coverage for hardware defects beyond the standard warranty period","Express replacement service"],coverageExcludes:["Theft or loss (covered separately by AppleCare+ with Theft & Loss)","Intentional damage or cosmetic damage beyond accident coverage","Lost or missing accessories not included in original box"],pricingUS:{monthlyCents:999,upfrontCents:19900,upfrontCoverageMonths:24,note:null},pricingCA:{monthlyCents:1399,upfrontCents:22900,upfrontCoverageMonths:24,note:"Pricing is approximate -- confirm current rates at apple.com/ca"},planUrl:"https://www.apple.com/support/products/iphone/",notes:"AppleCare+ can be purchased within 60 days of buying a new iPhone. Plans auto-renew monthly after the initial term.",deductibles:{screenCents:2900,otherCents:9900}},{id:"applecare-plus-theft-loss-iphone",name:"AppleCare+ with Theft & Loss",description:"All AppleCare+ coverage plus up to 2 theft or loss incidents per year. Available in the US only.",coverageIncludes:["Everything in AppleCare+","Up to 2 theft or loss incidents per 12 months ($149 deductible per incident)","Replacement device shipped directly to you"],coverageExcludes:["Third or subsequent theft/loss incidents within 12 months","Intentional loss or fraud"],pricingUS:{monthlyCents:1349,upfrontCents:29900,upfrontCoverageMonths:24,note:null},pricingCA:null,planUrl:"https://www.apple.com/support/products/iphone/",notes:"Requires Find My to be enabled. The $149 theft/loss deductible applies per incident.",deductibles:{screenCents:2900,otherCents:9900}}],lastVerifiedDate:"2026-02-01"},{brand:"apple",deviceSlugs:["laptop"],standardWarrantyMonths:12,standardWarrantyUrl:"https://www.apple.com/legal/warranty/",standardCoverageNote:"Covers manufacturing defects and hardware failures. Does not cover accidental damage or cosmetic wear.",extendedPlans:[{id:"applecare-plus-mac",name:"AppleCare+ for Mac",de
7scription:"Extends coverage to 3 years and adds accidental damage protection for Mac laptops.",coverageIncludes:["Up to 2 accidental damage incidents per 12 months (keyboard/display: $99 service fee; other: $299 service fee)","Hardware coverage extended to 3 years","Priority access to Apple technical support (phone and chat)","Coverage for battery if capacity drops below 80%"],coverageExcludes:["Theft or loss","Intentional damage","Cosmetic damage beyond covered accident incidents"],pricingUS:{monthlyCents:null,upfrontCents:null,upfrontCoverageMonths:36,note:"Pricing varies by Mac model ($99--$299). Check apple.com for your specific model."},pricingCA:{monthlyCents:null,upfrontCents:null,upfrontCoverageMonths:36,note:"Pricing varies by Mac model -- confirm current rates at apple.com/ca"},planUrl:"https://www.apple.com/support/products/mac/",notes:"Must be purchased within 60 days of the Mac purchase. AppleCare+ for Mac extends coverage from 1 year to 3 years.",deductibles:{screenCents:9900,otherCents:29900}}],lastVerifiedDate:"2026-02-01"},{brand:"apple",deviceSlugs:["tablet"],standardWarrantyMonths:12,standardWarrantyUrl:"https://www.apple.com/legal/warranty/",standardCoverageNote:"Covers manufacturing defects and hardware failures. Does not cover accidental damage.",extendedPlans:[{id:"applecare-plus-ipad",name:"AppleCare+ for iPad",description:"Extends coverage and adds accidental damage protection for iPad models.",coverageIncludes:["Up to 2 accidental damage incidents per 12 months ($49 service fee per incident)","Battery service if capacity drops below 80%","Priority access to Apple technical support","Hardware coverage extended beyond standard warranty"],coverageExcludes:["Theft or loss","Intentional damage","Apple Pencil and keyboard accessories (covered by separate plans)"],pricingUS:{monthlyCents:null,upfrontCents:6900,upfrontCoverageMonths:24,note:"Shown for standard iPad. iPad Pro plans are priced higher -- check apple.com."},pricingCA:{monthlyCents:null,upfrontCents:7900,upfrontCoverageMonths:24,note:"Approximate price for standard iPad -- confirm at apple.com/ca"},planUrl:"https://www.apple.com/support/products/ipad/",notes:"Must be purchased within 60 days of the iPad purchase.",deductibles:{screenCents:4900,otherCents:4900}}],lastVerifiedDate:"2026-02-01"},{brand:"samsung",deviceSlugs:["smartphone"],standardWarrantyMonths:12,standardWarrantyUrl:"https://www.samsung.com/us/support/warranty/",standardCoverageNote:"Covers manufacturing defects and hardware failures for 1 year. Does not cover accidental damage, physical damage, or water damage beyond the device's IP rating.",extendedPlans:[{id:"samsung-care-plus",name:"Samsung Care+",description:"Accidental damage and breakdown protection for Galaxy smartphones.",coverageIncludes:["Unlimited accidental damage incidents (screen repair: $29 deductible; other damage: $99 deductible)","Mechanical and electrical breakdown","Water and liquid damage","Out-of-warranty hardware failures"],coverageExcludes:["Theft or loss (covered by Samsung Care+ with Theft & Loss)","Intentional damage or abuse","Loss of data or software"],pricingUS:{monthlyCents:800,upfrontCents:null,upfrontCoverageMonths:null,note:"Monthly pricing starting at ~$8/mo. Varies by device model."},pricingCA:{monthlyCents:null,upfrontCents:null,upfrontCoverageMonths:null,note:"Available in Canada -- check samsung.com/ca for current pricing."},planUrl:"https://www.samsung.com/us/smartphones/mobile-protection-plans/",notes:"Must be enrolled within 30 days of device purchase. Claims are handled via the Samsung Members app or samsung.com.",deductibles:{screenCents:2900,otherCents:9900}},{id:"samsung-care-plus-theft-loss",name:"Samsung Care+ with Theft & Loss",description:"All Samsung Care+ coverage plus theft and loss protection. Available in the US only.",coverageIncludes:["Everything in Samsung Care+","Theft or loss replacement ($250 deductible for devices over $599)","ADH (Accidental Damage from Handling) with same deductibles as Samsung Care+"],coverageExcludes:["Devices not reported stolen or lost immediately","Fraud or intentional loss"],pricingUS:{monthlyCents:1300,upfrontCents:null,upfrontCoverageMonths:null,note:"Starting at ~$13/mo. Varies by device model."},pricingCA:null,planUrl:"https://www.samsung.com/us/smartphones/mobile-protection-
7plans/",notes:"Requires Find My Mobile to be enabled. Report theft or loss within 60 days of the incident.",deductibles:{screenCents:2900,otherCents:9900}}],lastVerifiedDate:"2026-02-01"},{brand:"google",deviceSlugs:["smartphone"],standardWarrantyMonths:12,standardWarrantyUrl:"https://store.google.com/us/category/phones",standardCoverageNote:"Covers manufacturing defects and hardware failures for 1 year. Does not cover accidental damage, cracks, or liquid damage.",extendedPlans:[{id:"google-preferred-care",name:"Google Preferred Care",description:"Adds accidental damage protection and extends coverage for Pixel phones.",coverageIncludes:["Up to 2 accidental damage incidents per 12 months ($79 deductible per incident)","Coverage for cracked screens, water damage, and drops","Hardware malfunction coverage beyond standard warranty period","Replacement device if yours cannot be repaired"],coverageExcludes:["Theft or loss","Intentional damage","Pre-existing damage at time of enrollment"],pricingUS:{monthlyCents:800,upfrontCents:12900,upfrontCoverageMonths:24,note:null},pricingCA:{monthlyCents:null,upfrontCents:null,upfrontCoverageMonths:24,note:"Available in Canada -- check store.google.com/ca for current pricing."},planUrl:"https://store.google.com/us/category/phones",notes:"Preferred Care must be purchased at the same time as the Pixel device. Available through the Google Store.",deductibles:{screenCents:7900,otherCents:7900}}],lastVerifiedDate:"2026-02-01"},{brand:"framework",deviceSlugs:["laptop"],standardWarrantyMonths:12,standardWarrantyUrl:"https://frame.work/warranty",standardCoverageNote:"Covers manufacturing defects and hardware failures for 1 year. Framework's modular design means most components can be replaced independently, often reducing repair costs significantly.",extendedPlans:[],lastVerifiedDate:"2026-02-01"}];function D(e){var r,a;let s,l,i,c,d,u,{itemAge:m,setItemAge:p,issueDescription:v,setIssueDescription:f,warrantyPlanId:y,setWarrantyPlanId:w,brand:j,setBrand:C,model:S,setModel:D,weightPreset:T,setWeightPreset:U,onSubmit:W,error:L,onDiagnosisComplete:_,diagnosis:E,showDiagnosisBanner:O,onDismissDiagnosis:B,pendingDiagnosisSubmit:F,upgradeProgram:R,setUpgradeProgram:z,upgradeProgramType:V,setUpgradeProgramType:G,categorySlug:q,isPrefilled:J,issuePrefilled:H}=e,[Y,K]=(0,o.useState)(!1),[Z,X]=(0,o.useState)(!1),Q=(0,o.useRef)(null),{currency:ee}=(0,P.H)(),er=(r="USD"===ee?"US":"CA",$.filter(e=>e.country===r||"both"===e.country)),ea=!!F&&0===m,et=J&&0===m;(0,o.useEffect)(()=>{ea&&Q.current&&(Q.current.scrollIntoView({behavior:"smooth",block:"center"}),Q.current.focus())},[ea]);let eo=v.trim().length>=5&&m>0,en=q?A[q]:void 0,es=new Set(v.split(", ").map(e=>e.trim()).filter(Boolean)),el=e=>!Y&&es.has(e),ei=(0,o.useCallback)(e=>{let r,a=Array.from(e.currentTarget.querySelectorAll("button")),t=a.indexOf(e.target);if(-1!==t&&("ArrowRight"===e.key||"ArrowDown"===e.key?r=(t+1)%a.length:("ArrowLeft"===e.key||"ArrowUp"===e.key)&&(r=(t-1+a.length)%a.length),void 0!==r)){var o;e.preventDefault(),a.forEach((e,a)=>{e.tabIndex=a===r?0:-1}),null==(o=a[r])||o.focus()}},[]);return(0,t.jsxs)("div",{className:"space-y-6",children:[L&&(0,t.jsx)("div",{role:"alert",className:"p-4 bg-[var(--color-danger-bg)] border border-[var(--color-danger-border)] rounded-[var(--radius-md)] text-[var(--color-error)]",children:L}),(0,t.jsxs)("div",{className:"space-y-6",children:[H&&!Z&&(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 p-3 bg-[var(--color-surface)] border border-[var(--color-border)] rounded-[var(--radius-sm)]",children:[(0,t.jsxs)("p",{className:"text-sm text-[var(--color-text-primary)]",children:[(0,t.jsx)("span",{className:"text-[var(--color-text-secondary)]",children:"Problem:"})," ",v]}),(0,t.jsx)("button",{type:"button",onClick:()=>X(!0),className:"text-sm text-[var(--color-primary)] hover:underline shrink-0",children:"Change"})]}),!(H&&!Z)&&(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{id:"issue-label",className:"block text-sm font-medium text-[var(--color-text-primary)] mb-2",children:"What's the problem?"}),en&&(s=en.findIndex(e=>el(e)),l=Y?en.length:s>=0?s:0,(0,t.jsxs)("div",{role:"group","aria-labelledby":"issue-label",className:"grid grid-cols-2 gap-2 mb-3",onKeyDown:ei,children:[en.map((e,r)=>(0,t.jsx)("button",{type:"button",tabIndex:r===l?0:-1,"aria-pressed":el(e),onClick:()=>{let r;return K(!1),void f(((r=v.split(", ").map(e=>e.trim()).filter(e=>e&&(null==en?void 0:en.includes(e)))).includes(e)?r.filter(r=>r!==e):[...r,e]).join(", "))},className:`p-2.5 text-left text-sm rounded-[var(--radius-sm)] border transition-colors ${el(e)?"border-[var(--color-primary)] bg-[var(--color-primary)]/10 text-[var(--color-primary)]":"border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text-primary)] hover:border-[var(--color-primary)]/50"}`,children:e},e)),(0,t.jsx)("button",{type:"button",tabIndex:l===en.length?0:-1,"aria-pressed":Y,onClick:()=>{K(!0),f("")},className:`p-2.5 text-left text-sm rounded-[var(--radius-sm)] border transition-colors ${Y?"border-[var(--color-primary)] bg-[var(--color-primary)]/10 text-[var(--color-primary)]":"border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text-primary)] hover:border-[var(--color-primary)]/50"}`,children:"Other issue..."})]})),Y&&(0,t.jsx)(b.f,{"aria-label":"What's the problem?",placeholder:"Describe the issue...",value:v,onCh
7ange:e=>f(e.target.value),error:v.length>0&&v.length<5?"Please provide more detail":void 0}),!en&&!Y&&(0,t.jsx)(b.f,{"aria-label":"What's the problem?",placeholder:"Describe the issue (e.g., screen is cracked, won't turn on, makes strange noise)",value:v,onChange:e=>f(e.target.value),error:v.length>0&&v.length<5?"Please provide more detail":void 0})]})}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{htmlFor:"item-age",className:"block text-sm font-medium text-[var(--color-text-primary)] mb-1",children:["How old is it?",J&&(0,t.jsx)("span",{className:"text-[var(--color-primary)] ml-1",children:"(required)"})]}),(0,t.jsx)("select",{id:"item-age",ref:Q,required:!0,value:m,onChange:e=>p(Number(e.target.value)),className:`w-full px-3 py-2 bg-[var(--color-surface)] border rounded-[var(--radius-sm)] focus:border-[var(--color-primary)] focus:outline-none${0===m?" text-[var(--color-text-secondary)]":""}${ea||et?" border-[var(--color-primary)] ring-2 ring-[var(--color-primary)]/30":" border-[var(--color-border)]"}`,children:g.My.map(e=>(0,t.jsx)("option",{value:e.value,disabled:0===e.value,children:e.label},e.value))}),ea&&(0,t.jsx)("p",{className:"mt-1 text-sm text-[var(--color-primary)]",children:"Select the item's age to get your recommendation"})]}),!J&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{children:(0,t.jsx)(x,{categoryHint:q,onDiagnosisComplete:_})}),O&&E&&(0,t.jsx)(k,{diagnosis:E,onDismiss:B}),(0,t.jsx)(N.V,{categorySlug:q??"",brand:j,onBrandChange:C,model:S,onModelChange:D,ageMonths:m})]}),(i=q??"",(d=j&&i?(a=j.toLowerCase(),c=a.toLowerCase(),I.find(e=>e.brand===c&&e.deviceSlugs.includes(i))??null):null)?(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{htmlFor:"warranty-plan",className:"block text-sm font-medium text-[var(--color-text-primary)] mb-1",children:"Warranty coverage"}),(0,t.jsxs)("select",{id:"warranty-plan",value:y,onChange:e=>w(e.target.value),className:"w-full px-3 py-2 bg-[var(--color-surface)] border border-[var(--color-border)] rounded-[var(--radius-sm)] focus:border-[var(--color-primary)] focus:outline-none",children:[(0,t.jsx)("option",{value:"none",children:"No warranty / expired"}),(0,t.jsxs)("option",{value:"standard",children:["Standard ",12===d.standardWarrantyMonths?"1-year":`${d.standardWarrantyMonths}-month`," warranty (free repairs)"]}),d.extendedPlans.map(e=>(0,t.jsx)("option",{value:e.id,children:e.name},e.id))]})]}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"flex items-center gap-3 p-3 bg-[var(--color-surface)] border border-[var(--color-border)] rounded-[var(--radius-sm)] cursor-pointer hover:border-[var(--color-primary)]",children:[(0,t.jsx)("input",{type:"checkbox",checked:"none"!==y,onChange:e=>w(e.target.checked?"standard":"none"),className:"w-5 h-5 rounded border-[var(--color-border)] text-[var(--color-primary)] focus:ring-[var(--color-primary)]"}),(0,t.jsx)("span",{className:"text-[var(--color-text-primary)]",children:"This item is under warranty"})]}),"none"!==y&&(0,t.jsx)("p",{className:"mt-1 text-xs text-[var(--color-text-secondary)]",children:"Check your plan for repair costs. Covered repairs may cost less than the estimate above."})]})),("smartphone"===q||"tablet"===q)&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("label",{className:"flex items-center gap-3 p-3 bg-[var(--color-surface)] border border-[var(--color-border)] rounded-[var(--radius-sm)] cursor-pointer hover:border-[var(--color-primary)]",children:[(0,t.jsx)("input",{type:"checkbox",checked:R,onChange:e=>z(e.target.checked),className:"w-5 h-5 rounded border-[var(--color-border)] text-[var(--color-primary)] focus:ring-[var(--color-primary)]"}),(0,t.jsx)("span",{className:"text-[var(--color-text-primary)]",children:"I'm enrolled in a device upgrade program"})]}),R&&(0,t.jsxs)("div",{className:"pl-2",children:[(0,t.jsx)("label",{htmlFor:"upgrade-program-type",className:"block text-sm font-medium text-[var(--color-text-primary)] mb-1",children:"Which program?"}),(0,t.jsxs)("select",{id:"upgrade-program-type",value:V,onChange:e=>G(e.target.value),className:"w-full px-3 py-2 bg-[var(--color-surface)] border border-[var(--color-border)] rounded-[var(--radius-sm)] focus:border-[var(--color-primary)] focus:outline-none",children:[(0,t.jsx)("option",{value:"",children:"Select program..."}),er.map(e=>(0,t.jsx)("option",{value:e.id,children:e.name},e.id)),(0,t.jsx)("option",{value:"unknown",children:"Not sure"})]})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{id:"weight-preset-label",className:"block text-sm font-medium text-[var(--color-text-primary)] mb-2",children:"What matters most to you?"}),(0,t.jsx)("div",{role:"group","aria-labelledby":"weight-preset-label",className:"grid grid-cols-2 gap-2",onKeyDown:ei,children:(u=Math.max(0,M.YS.findIndex(e=>e.id===T)),M.YS.map((e,r)=>(0,t.jsxs)("button",{type:"button",tabIndex:r===u?0:-1,"aria-pressed":T===e.id,onClick:()=>U(e.id),className:`p-2.5 text-left text-sm rounded-[var(--radius-sm)] border transition-colors ${T===e.id?"border-[var(--color-primary)] bg-[var(--color-primary)]/10 text-[var(--color-primary)]":"border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text-primary)] hover:border-[var(--color-primary)]/50"}`,children:[(0,t.jsx)("span",{className:"font-medium",children:e.name}),(0,t.jsx)("span",{className:"block text-xs mt-0.5 text-[var(--color-text-secondary)]",children:e.description})]},e.id)))})]}),(0,t.jsx)(h.Button,{fullWidth:!0,size:"lg",onClick:()=>{(0,n.sx)("decision_form_submitted",{category:q??"",has_brand:!!j,has_model:!!S,age_months:String(m)}),W()},disabled:!eo,children:"Get Recommendation"})]})}var T=a(81021);let U=(0,o.memo)(function(){return(0,t.jsxs)("div",{"aria-live":"polite","aria-busy":"true",children:[(0,t.jsxs)("div",{className:"text-center mb-6",children:[(0,t.jsx)("div",{className:"w-16 h-16 border-4 border-[var(--color-primary)] border-t-transparent roun
7ded-full animate-spin mx-auto mb-4"}),(0,t.jsx)("p",{className:"text-[var(--color-text-secondary)]",children:"Analyzing your item..."}),(0,t.jsx)("p",{className:"text-sm text-[var(--color-text-secondary)] mt-1",children:"Checking repair costs, environmental impact, and alternatives"})]}),(0,t.jsx)(T.xx,{})]})});var W=a(69460);class L extends o.Component{static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){l.Cp(e,{tags:{component:"ResultErrorBoundary"}})}render(){return this.state.hasError?(0,t.jsxs)(f.Z,{className:"text-center py-8",children:[(0,t.jsx)("p",{className:"text-lg font-semibold text-[var(--color-text-primary)] mb-2",children:"Something went wrong"}),(0,t.jsx)("p",{className:"text-sm text-[var(--color-text-secondary)] mb-4",children:"We couldn't display your result. Please try again."}),(0,t.jsx)(h.Button,{onClick:this.props.onStartOver,children:"Start Over"})]}):this.props.children}constructor(e){super(e),this.state={hasError:!1}}}function _(e){for(let r of g.LZ){if(r.slug===e)return{parent:r,sub:r};if(r.subcategories){let a=r.subcategories.find(r=>r.slug===e);if(a)return{parent:r,sub:a}}}return null}function E(e){var r,a,s,l;let{prefill:i,initialCategorySlug:c}=e,h=1===g.LZ.length&&(null==(a=g.LZ[0])||null==(r=a.subcategories)?void 0:r.length)?g.LZ[0]:null,b=(0,o.useMemo)(()=>i?_(i.categorySlug):null,[i]),f=(0,o.useMemo)(()=>!i&&c?_(c):null,[i,c]),y=!!(f&&!(null==(s=f.sub.subcategories)?void 0:s.length)),[x,w]=(0,o.useState)(!!(i&&b)),[j,C]=(0,o.useState)(()=>x||y?"details":f||h?"subcategory":"category"),[k,N]=(0,o.useState)(()=>b?b.parent:f?f.parent:h),[S,A]=(0,o.useState)(()=>b?b.sub:y?f.sub:null),[M,$]=(0,o.useState)((null==i?void 0:i.ageMonths)??0),[P,I]=(0,o.useState)(()=>(null==i?void 0:i.issue)??""),[T,E]=(0,o.useState)("none"),[O,B]=(0,o.useState)(()=>(null==i?void 0:i.brand)??""),[F,R]=(0,o.useState)(()=>(null==i?void 0:i.model)??""),[z,V]=(0,o.useState)("balanced"),[G,q]=(0,o.useState)(!1),[J,H]=(0,o.useState)(""),[Y,K]=(0,o.useState)(null),[Z,X]=(0,o.useState)(null),[Q,ee]=(0,o.useState)(null),[er,ea]=(0,o.useState)(!1),[et,eo]=(0,o.useState)(!1),[en,es]=(0,o.useState)(!1),[el,ei]=(0,o.useState)(null),ec=(0,o.useRef)(null),ed=(0,o.useRef)(()=>Promise.resolve()),eu=(0,o.useCallback)(()=>new Promise(e=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(r=>{let a={lat:r.coords.latitude,lng:r.coords.longitude};ei(a),e(a)},()=>e(null),{timeout:1e4,maximumAge:6e4}):e(null)}),[]),em=(0,o.useCallback)(()=>{w(!1),C(h?"subcategory":"category"),N(h),A(null),$(0),I(""),E("none"),B(""),R(""),V("balanced"),q(!1),H(""),K(null),ee(null),ea(!1),eo(!1)},[]),ep=(0,o.useCallback)(e=>{var r;e.success&&(ee(e),e.suggestedDescription&&I(e.suggestedDescription),(null==(r=e.item)?void 0:r.brand)&&B(e.item.brand),eo(!0),(0,n.sx)("photo_diagnosis_completed",{category:null==S?void 0:S.slug,severity:e.severity,itemDetected:!!e.item}))},[S]);(0,o.useEffect)(()=>{ed.current=ev}),(0,o.useEffect)(()=>{et&&M>0&&P.trim().length>=5&&(eo(!1),ed.current())},[et,M,P]),(0,o.useEffect)(()=>{ec.current&&ec.current.focus()},[j]),(0,o.useEffect)(()=>{x&&i&&(0,n.sx)("decide_prefilled",{category:i.categorySlug,brand:i.brand,hasIssue:!!i.issue})},[]);let eg=(0,o.useRef)(!1);(0,o.useEffect)(()=>{x&&(null==i?void 0:i.ageMonths)&&i.ageMonths>0&&i.issue&&!eg.current&&"details"===j&&(eg.current=!0,ed.current())},[x,i,j]);let ev=async()=>{if(!S||P.trim().length<5||0===M)return;C("loading"),X(null),d(),(0,n.sx)("decision_started",{category:S.slug,layout:x?"prefilled":"full"});let e=el??await eu();try{var r,a,t,o,s,l,i,c,g,v,h,b,f,y,w,j;let d=F.trim(),k={"Content-Type":"application/json"};e&&(k["x-user-latitude"]=String(e.lat),k["x-user-longitude"]=String(e.lng));let N=await fetch("/api/v1/decisions",{method:"POST",headers:k,body:JSON.stringify({category:S.slug,itemAge:M,issueDescription:P.trim(),warrantyStatus:"none"!==T?"under_warranty":"unknown",warrantyPlanId:"none"!==T?T:void 0,brand:O||void 0,model:d||void 0,weightPreset:"balanced"!==z?z:void 0,upgradeProgram:G&&J?{type:J}:void 0})}),A=await N.json();if(!N.ok||!A.success)throw Error((null==(j=A.error)?void 0:j.message)||"Failed to get recommendation");K(A.data),C("result"),u({verdict:A.data.recommendation,category:S.slug,confidence:A.data.confidence,layout:x?"prefilled":"full"}),A.data.token&&A.data.anonymous&&(0,p.storeUnclaimedToken)(A.data.token);let $=A.data;$.anonymous&&(0,m.dC)({category:S.slug,recommendation:$.recommendation,confidence:$.confidence,repairCostCents:(null==(t=$.factors)||null==(a=t.cost)||null==(r=a.data)?void 0:r.repairCost)??0,replaceCostCents:(null==(l=$.factors)||null==(s=l.cost)||null==(o=s.data)?void 0:o.replaceCost)??0,co2SavedGrams:(null==(g=$.factors)||null==(c=g.environmental)||null==(i=c.data)?void 0:i.co2SavedByRepair)??0,remainingLifeMonths:(null==(b=$.factors)||null==(h=b.lifespan)||null==(v=h.data)?void 0:v.remainingLifespanMonths)??0,ageMonths:(null==(w=$.factors)||null==(y=w.lifespan)||null==(f=y.data)?void 0:f.currentAgeMonths)??0,shareId:$.token,brand:O||void 0,modelName:d||void 0,createdAt:new Date().toISOString()}),(0,n.sx)("decision_completed",{category:S.slug,recommendation:A.data.recommendation,confidence:A.data.confidence,layout:x?"prefilled":"full"})}catch(e){X(e instanceof Error?e.message:"Something went wrong"),C("details")}},eh=(0,o.useCallback)(async e=>{if(S&&!en){es(!0),V(e);try{let a=F.trim(),t={"Content-Type":"application/json"};el&&(t["x-user-latitude"]=String(el.lat),t["x-user-longitude"]=String(el.lng));let o=await fetch("/api/v1/decisions",{method:"POST",headers:t,body:JSON.stringify({category:S.slug,itemAge:M,issueDescription:P.trim(),warrantyStatus:"none"!==T?"under_warranty":"unknown",warrantyPlanId:"none"!==T?T:void 0,brand:O||void 0,model:a||void 0,weightPreset:"balanced"!==e?e:void 0,upgradeProgram:G&&J?{type:J}:void 0})}),s=await o.json();if(!o.ok||!s.success){var r;throw Error((null==(r=s.error)?void 0:r.message)||"Failed to get recommendation")}K(s.data),u({verdict:s.data.recommendation,category:S.slug,confidence:s.data.confidence,layout:x?"prefilled":"full"}),(0,n.sx)("preset_changed",{category:S.slug,preset:e,recommendation:s.data.recommendation})}catch{V(z)}finally{es(!1)}}},[S,en,F,M,P,T,O,G,J,z]),eb=()=>"category"===j||"subcategory"===j?1:"details"===j?x?1:2:x?2:3,ef=x?1:2,ey="category"===j||"subcategory"===j||"details"===j;return(0,t.jsxs)(t.Fragment,{children:[ey&&(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)("h1",{className:"text-2xl md:text-3xl font-bold text-[var(--color-text-primary)] mb-3",children:x&&i?`Should you repair your ${i.brand} ${i.model}?`:"Should you repair or replace it?"}),(0,t.jsx)("p",{className:"text-[var(--color-text-secondary)] leading-relaxed",children:x?"Just tell us how old it is and get a personalized verdict in seconds.":"Not sure whether to fix it or buy new? Tell us what broke and we’ll compare repair costs, replacement prices, and environmental impact to give you an answer in under 60 seconds."})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:["category"!==j&&"loading"!==j&&!("subcategory"===j&&h)&&(0,t.jsx)("button",{onClick:()=>
7{if("subcategory"===j)C("category"),N(null);else if("details"===j){if(x)return void em();(null==k?void 0:k.subcategories)?C("subcategory"):C(h?"subcategory":"category"),A(null),B(""),R("")}else"result"===j&&(C("details"),K(null))},className:"p-2 hover:bg-[var(--color-background)] rounded-full transition-colors","aria-label":"Go back",children:(0,t.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),(0,t.jsx)("h2",{ref:ec,tabIndex:-1,className:"text-xl font-semibold text-[var(--color-text-primary)] outline-none",children:(()=>{switch(j){case"category":return"What needs help?";case"subcategory":return h?"What needs help?":(null==k?void 0:k.name)||"Select type";case"details":if(x&&i)return`${i.brand} ${i.model}`;return(null==S?void 0:S.name)||"Item details";case"loading":return"Analyzing...";case"result":return"Your Recommendation"}})()})]}),"loading"!==j&&"result"!==j&&(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)("p",{id:"progress-label",className:"text-sm text-[var(--color-text-secondary)] mb-2",children:x?"Just one question":`Step ${eb()} of ${ef}`}),(0,t.jsx)("div",{role:"progressbar","aria-valuenow":eb(),"aria-valuemin":1,"aria-valuemax":ef,"aria-labelledby":"progress-label",className:"h-2 bg-[var(--color-border)] rounded-full overflow-hidden",children:(0,t.jsx)("div",{className:"h-full bg-[var(--color-primary)] transition-all duration-300",style:{width:`${eb()/ef*100}%`}})})]}),(0,t.jsxs)("div",{className:"step-transition",children:["category"===j&&(0,t.jsx)(v,{categories:g.LZ,onSelect:e=>{N(e),d(),(0,n.sx)("category_selected",{category:e.slug}),e.subcategories&&e.subcategories.length>0?C("subcategory"):(A(e),C("details"))}}),"subcategory"===j&&(null==k?void 0:k.subcategories)&&(0,t.jsx)(v,{categories:k.subcategories,onSelect:e=>{A(e),d(),(0,n.sx)("category_selected",{category:e.slug}),C("details")}}),"details"===j&&(0,t.jsx)(D,{itemAge:M,setItemAge:$,issueDescription:P,setIssueDescription:I,warrantyPlanId:T,setWarrantyPlanId:E,brand:O,setBrand:B,model:F,setModel:R,weightPreset:z,setWeightPreset:V,onSubmit:ev,error:Z,onDiagnosisComplete:ep,diagnosis:Q,showDiagnosisBanner:er,onDismissDiagnosis:()=>ea(!1),pendingDiagnosisSubmit:et,upgradeProgram:G,setUpgradeProgram:q,upgradeProgramType:J,setUpgradeProgramType:H,categorySlug:null==S?void 0:S.slug,isPrefilled:x,issuePrefilled:x&&((null==i||null==(l=i.issue)?void 0:l.trim().length)??0)>=5}),"loading"===j&&(0,t.jsx)(U,{}),"result"===j&&Y&&(0,t.jsx)("div",{className:"w-[calc(100vw-2rem)] max-w-4xl relative left-1/2 -translate-x-1/2",children:(0,t.jsx)(L,{onStartOver:em,children:(0,t.jsx)(W.c,{result:Y,categorySlug:(null==S?void 0:S.slug)||"",issueDescription:P,onPresetChange:eh,presetLoa
7ding:en})})})]},j)]})}},25911:(e,r,a)=>{"use strict";a.d(r,{V:()=>l});var t=a(95155),o=a(12115),n=a(22126),s=a(89824);function l(e){let{categorySlug:r,brand:a,onBrandChange:l,model:i,onModelChange:c,ageMonths:d,disabled:u}=e,[m,p]=(0,o.useState)([]),[g,v]=(0,o.useState)([]),[h,b]=(0,o.useState)(!1),[f,y]=(0,o.useState)(!1),[x,w]=(0,o.useState)(!1);return((0,o.useEffect)(()=>{if(p([]),v([]),!r)return;let e=!1;return w(!0),fetch(`/api/v1/devices/brands?category=${encodeURIComponent(r)}`).then(e=>e.json()).then(a=>{var t;e||(a.success&&Array.isArray(null==(t=a.data)?void 0:t.brands)&&a.data.brands.length>0?p(a.data.brands):p((0,s.C9)(r).filter(e=>e.value&&"Other"!==e.value).map(e=>e.value)))}).catch(()=>{e||p((0,s.C9)(r).filter(e=>e.value&&"Other"!==e.value).map(e=>e.value))}).finally(()=>{e||w(!1)}),()=>{e=!0}},[r]),(0,o.useEffect)(()=>{if(v([]),y(!1),!a||!r)return;let e=!1;b(!0);let t=new URLSearchParams({brand:a,category:r,limit:"50"});return d&&d>0&&t.set("age_months",String(d)),fetch(`/api/v1/devices/models?${t}`).then(e=>e.json()).then(r=>{var a;e||(r.success&&Array.isArray(null==(a=r.data)?void 0:a.models)?v(r.data.models):y(!0))}).catch(()=>{e||y(!0)}).finally(()=>{e||b(!1)}),()=>{e=!0}},[a,r,d]),r&&(0!==m.length||x))?(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(n.G,{label:"Brand",id:"brand-select",value:a,onChange:e=>{l(e),c("")},options:m,placeholder:"Search or type brand...",loading:x,disabled:u}),a&&(0,t.jsxs)("div",{children:[(0,t.jsx)(n.G,{label:"Model (optional)",value:i,onChange:c,options:g,placeholder:"Search or type model name...",loading:h,disabled:u}),f&&(0,t.jsx)("p",{className:"mt-1 text-xs text-[var(--color-warning-text)]",children:"Couldn't load model suggestions. You can still type the model in."})]})]}):null}},39277:(e,r,a)=>{"use strict";a.d(r,{f:()=>o});var t=a(95155);let o=(0,a(12115).forwardRef)(function(e,r){let{label:a,error:o,helperText:n,className:s="",id:l,...i}=e,c=l||(null==a?void 0:a.toLowerCase().replace(/\s+/g,"-"));return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[a&&(0,t.jsx)("label",{htmlFor:c,className:"text-sm font-medium text-[var(--color-text-primary)]",children:a}),(0,t.jsx)("textarea",{ref:r,id:c,className:`
8            w-full px-3 py-2
9            text-base
10            bg-[var(--color-surface)]
11            border rounded-[var(--radius-sm)]
12            transition-colors duration-200
13            placeholder:text-[var(--color-text-secondary)]
14            resize-y min-h-[100px]
15            ${o?"border-[var(--color-error)] focus:border-[var(--color-error)]":"border-[var(--color-border)] focus:border-[var(--color-primary)]"}
16            focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]/20
17            disabled:bg-[var(--color-disabled-bg)]/30 disabled:cursor-not-allowed
18            ${s}
19          `,...i}),o&&(0,t.jsx)("p",{className:"text-sm text-[var(--color-error)]",role:"alert",children:o}),n&&!o&&(0,t.jsx)("p",{className:"text-sm text-[var(--color-text-secondary)]",children:n})]})})},53378:(e,r,a)=>{"use strict";a.d(r,{Mn:()=>l,Xy:()=>o,dC:()=>n,mK:()=>s});let t="sundr_recent_decisions";function o(){try{let e=localStorage.getItem(t);if(!e)return[];let r=JSON.parse(e);if(!Array.isArray(r))return[];return r.filter(e=>"object"==typeof e&&null!==e&&"string"==typeof e.category&&"string"==typeof e.recommendation&&"number"==typeof e.confidence&&"string"==typeof e.shareId&&"string"==typeof e.createdAt)}catch{return[]}}function n(e){let r=o().filter(r=>r.shareId!==e.shareId),a=[e,...r].slice(0,10);localStorage.setItem(t,JSON.stringify(a)),window.dispatchEvent(new CustomEvent("sundr:recent-decisions-change"))}function s(){localStorage.removeItem(t),window.dispatchEvent(new CustomEvent("sundr:recent-decisions-change"))}function l(e,r){var a,t;let o=null==(a=e.brand)?void 0:a.trim(),n=null==(t=e.modelName)?void 0:t.trim();return o&&n?`${o} ${n}`:o?`${o} ${r}`:r}},73470:(e,r,a)=>{"use strict";a.d(r,{qd:()=>s,storeUnclaimedToken:()=>o});let t="sundr:unclaimed-decision-tokens";function o(e){try{let r=n();if(r.includes(e))return;let a=[...r,e].slice(-50);localStorage.setItem(t,JSON.stringify(a))}catch{}}function n(){try{let e=localStorage.getItem(t);if(!e)return[];let r=JSON.parse(e);if(!Array.isArray(r))return[];return r.filter(e=>"string"==typeof e)}catch{return[]}}async function s(){var e,r;let a=n();if(0===a.length)return 0;let o=await fetch("/api/v1/decisions/claim",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tokens:a})});if(!o.ok)throw Error(`Claim failed: ${o.status}`);let s=await o.json();if(s.success&&(null==(r=s.data)||null==(e=r.tokens)?void 0:e.length)>0)return!function(e){try{let r=n(),a=new Set(e),o=r.filter(e=>!a.has(e));0===o.length?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(o))}catch{}}(s.data.tokens),s.data.claimed;try{localStorage.removeItem(t)}catch{}return 0}},82667:(e,r,a)=>{Promise.resolve().then(a.t.bind(a,98500,23)),Promise.resolve().then(a.bind(a,17363))},89824:(e,r,a)=>{"use strict";a.d(r,{C9:()=>s,LZ:()=>t,My:()=>o});let t=[{slug:"electronics",name:"Electronics",icon:"\uD83D\uDCF1",subcategories:[{slug:"smartphone",name:"Smartphone",icon:"\uD83D\uDCF1"},{slug:"laptop",name:"Laptop",icon:"\uD83D\uDCBB"},{slug:"tablet",name:"Tablet",icon:"\uD83D\uDCF2"},{slug:"e-reader",name:"E-Reader",icon:"\uD83D\uDCD6"}]}],o=[{value:0,label:"Select age..."},{value:6,label:"Less than 1 year"},{value:18,label:"1-2 years"},{value:30,label:"2-3 years"},{value:48,label:"3-5 years"},{value:72,label:"5-7 years"},{value:96,label:"7-10 years"},{value:144,label:"10+ years"}],n={smartphone:[{value:"Apple",label:"Apple"},{value:"Samsung",label:"Samsung"},{value:"Google",label:"Google"},{value:"Motorola",label:"Motorola"},{value:"OnePlus",label:"OnePlus"},{value:"Xiaomi",label:"Xiaomi"},{value:"Sony",label:"Sony"},{value:"Nothing",label:"Nothing"}],laptop:[{value:"Apple",label:"Apple"},{value:"Dell",label:"Dell"},{value:"HP",label:"HP"},{value:"Lenovo",label:"Lenovo"},{value:"Asus",label:"Asus"},{value:"Acer",label:"Acer"},{value:"Microsoft",label:"Microsoft"},{value:"Framework",label:"Framework"},{value:"Samsung",label:"Samsung"}],tablet:[{value:"Apple",label:"Apple"},{value:"Samsung",label:"Samsung"},{value:"Lenovo",label:"Lenovo"},{value:"Microsoft",label:"Microsoft"},{value:"Amazon",label:"Amazon"},{value:"Google",label:"Google"}],"e-reader":[{value:"Amazon",label:"Amazon (Kindle)"},{value:"Kobo",label:"Kobo"},{value:"Boox",label:"Boox"},{value:"PocketBook",label:"PocketBook"},{value:"Remarkable",label:"reMarkable"}]};function s(e){return e?[{value:"",label:"Select brand (optional)"},...n[e]??[],{value:"Other",label:"Other"}]:[{value:"",label:"Select brand (optional)"},{value:"Other",label:"Other"}]}}},e=>{e.O(0,[2545,8500,4490,7536,9771,9964,8252,584,9460,3402,4850,8441,8105,7358],()=>e(e.s=82667)),_N_E=e.O()}]);

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.