PageSourceSearch

https://soberpedia.ai/assets/quiz-guided-results-app-20260907.js

js soberpedia.ai collected 2026-10-05 15:07:38 UTC 17,561 bytes, 1 lines download raw bytes

1const{useState,useRef,useEffect}=React;function Quiz(){const[answers,setAnswers]=useState({}),[index,setIndex]=useState(0),[zip,setZip]=useState(''),[error,setError]=useState('');const heading=useRef(null);const steps=SoberQuiz.flow(answers),id=steps[Math.min(index,steps.length-1)],q=SoberQuiz.question(id,answers);useEffect(()=>{heading.current?.focus();window.scrollTo({top:0,behavior:'instant'});},[index,id]);const go=()=>{setError('');setIndex(i=>i+1);};const choose=value=>{const next=SoberQuiz.select(answers,id,value);if(JSON.stringify(answers[id])!==JSON.stringify(next[id])){steps.slice(index+1).forEach(k=>delete next[k]);}setAnswers(next);setError('');if(!q.multi)setIndex(i=>i+1);};const reset=()=>{setAnswers({});setIndex(0);setZip('');setError('');};const download=()=>{const rows=Object.keys(answers).map(k=>{const qq=SoberQuiz.question(k,answers);return qq?qq.title+'\n'+SoberQuiz.label(k,answers):'';}).filter(Boolean);const content='My Soberpedia conversation summary\n\nPersonal notes, not a diagnosis or medication recommendation.\n\n'+rows.join('\n\n');const url=URL.createObjectURL(new Blob([content],{type:'text/plain'}));const a=document.createElement('a');a.href=url;a.download='my-soberpedia-summary.txt';a.click();setTimeout(()=>URL.revokeObjectURL(url),1000);};const finder=React.createElement("form",{className:"zip-form",onSubmit:e=>{e.preventDefault();if(!/^\d{5}$/.test(zip)){setError('Enter a five-digit US ZIP code.');return;}location.assign('/?view=search&zip='+encodeURIComponent(zip));}},React.createElement("label",{htmlFor:"find-zip"},"Where would you like to find care?"),React.createElement("div",null,React.createElement("input",{id:"find-zip",value:zip,onChange:e=>setZip(e.target.value),inputMode:"numeric",autoComplete:"postal-code",maxLength:5,placeholder:"US ZIP code","aria-describedby":error?'zip-error':undefined}),React.createElement("button",{className:"primary",type:"submit"},"Find care near me \u2192")),error&&React.createElement("p",{role:"alert",id:"zip-error"},error),React.createElement("small",null,"Only this ZIP code is passed to the directory. Your quiz answers stay here."));let body;if(index<0)body=React.createElement(React.Fragment,null,React.createElement("p",{className:"eyebrow"},"YOUR RECOVERY, CONNECTED"),React.createElement("h1",{ref:heading,tabIndex:"-1"},"Explore peptide therapy.",React.createElement("br",null),"Start with you."),React.createElement("p",{className:"intro"},"Curious about peptides, appetite, or cravings? Tell us what you want to change, learn what the research says, and prepare for a conversation about your options."),React.createElement("div",{className:"welcome-facts"},React.createElement("span",null,"About 2 minutes"),React.createElement("span",null,"No account needed"),React.createElement("span",null,"Tap to move forward")),React.createElement("button",{className:"primary large",onClick:()=>setIndex(0)},"Explore my options \u2192"),React.createElement("p",{className:"privacy"},"Your quiz answers stay in this tab. At the end, you can choose to share your name, email, and peptide interest with Soberpedia. This guide helps prepare a care conversation; it doesn\u2019t diagnose or prescribe."),React.createElement("a",{className:"quiet",href:"/?view=search"},"Looking for a clinic instead? Search the directory"));else if(q)body=React.createElement(React.Fragment,null,React.createElement("p",{className:"eyebrow"},id==='safety'?'A QUICK CHECK-IN':'YOUR PEPTIDE PATHWAY'),React.createElement("h1",{ref:heading,tabIndex:"-1"},id==='audience'?'Your next step starts here.':q.title),React.createElement("p",{className:"intro"},id==='audience'?'Explore peptide therapy in a few simple steps. First, who are you here for?':q.sub),React.createElement("p",{className:"tap-hint"},q.multi?`${(answers[id]||[]).length} selected · Choose all that apply`:'Select one to continue'),React.createElement("div",{className:"options "+(q.multi?"multi":""),role:"group","aria-label":q.title},q.options.map(o=>React.createElement("button",{key:o.id,className:'option '+((q.multi?(answers[id]||[]).includes(o.id):answers[id]===o.id)?'selected':''),"aria-pressed":q.multi?(answers[id]||[]).includes(o.id):answers[id]===o.id,onClick:()=>choose(o.id)},React.createElement("span",null,React.createElement("strong",null,o.label),o.detail&&React.createElement("small",null,o.detail)),React.createElement("span",{className:"choice","aria-hidden":"true"},(q.multi?(answers[id]||[]).includes(o.id):answers[id]===o.id)?'✓':'')))),React.createElement(React.Fragment,null,q.multi&&React.createElement("button",{className:"primary next",disabled:!answers[id]?.length,onClick:go},"Continue with ",(answers[id]||[]).length," selected \u2192")));else if(id==='education')body=React.createElement(React.Fragment,null,React.createElement("p",{className:"eyebrow"},"PEPTIDES, APPETITE & CRAVINGS"),React.createElement("h1",{ref:heading,tabIndex:"-1"},"There\u2019s more to the GLP-1 conversation than weight."),React.createElement("p",{className:"intro"},"GLP-1 medicines act on pathways involved in appetite and reward. Researchers are studying whether some can also help reduce alcohol cravings and drinking."),React.createElement("div",{className:"reflection"},React.createElement("span",null,"WHAT THE RESEARCH SHOWS"),React.createElement("h2",null,"Promising evidence for semaglutide."),React.createElement("p",null,"In a 26-week trial of 108 adults with alcohol use disorder and obesity, semaglutide reduced heavy drinking and self-reported alcohol cravings more than placebo. Both groups were offered behavioral therapy.")),React.createElement("p",{className:"privacy"},"Semaglutide is not FDA-approved to treat addiction. Peptide therapy does not replace withdrawal care or established addiction treatment. A clinician reviews benefits, risks, and your health history."),React.createElement("button",{className:"primary",onClick:go},"Explore the next step \u2192"));else if(id==='reflection')body=React.createElement(React.Fragment,null,React.createElement("p",{className:"eyebrow"},"HERE\u2019S WHAT WE\u2019RE HEARING"),React.createElement("h1",{ref:heading,tabIndex:"-1"},"Your priorities",React.createElement("br",null),"are coming into focus."),React.createElement("p",{className:"intro"},"You don\u2019t have to figure everything out at once. These are the things you\u2019ve told us matter today."),React.createElement("div",{className:"reflection"},React.createElement("span",null,"WHAT YOU WANT TO CHANGE"),React.createElement("h2",null,SoberQuiz.label('goal',answers
1)),React.createElement("span",null,"WHAT PROGRESS WOULD LOOK LIKE"),React.createElement("p",null,SoberQuiz.label('goal',answers)),React.createElement("span",null,"THE PATTERN YOU\u2019VE NOTICED"),React.createElement("p",null,SoberQuiz.label('context',answers))),React.createElement("p",{className:"intro"},"A few more questions about your support will help us give you a useful place to start."),React.createElement("button",{className:"primary",onClick:go},"That\u2019s right. Continue \u2192"));else if(id==='urgent'){const s=answers.safety;body=React.createElement(React.Fragment,null,React.createElement("p",{className:"eyebrow"},"HELP COMES FIRST"),React.createElement("h1",{ref:heading,tabIndex:"-1"},s==='emergency'?'Get emergency help now.':s==='crisis'?'Connect with someone now.':'Get medical guidance for stopping safely.'),React.createElement("p",{className:"intro"},s==='emergency'?'Call 911 for a possible overdose, trouble breathing, seizure, severe confusion, or immediate danger. Don’t wait for this website or an AI assistant.':s==='crisis'?'In the US, call or text 988 for immediate crisis support. If there is immediate physical danger or a medical emergency, call 911.':'Withdrawal can require medical care, particularly after regular alcohol or sedative use. Contact a medical professional promptly rather than using this quiz to decide how to stop. Severe symptoms or immediate danger need 911.'),React.createElement("a",{className:"primary",href:s==='emergency'?'tel:911':s==='crisis'?'tel:988':'tel:18006624357'},s==='emergency'?'Call 911':s==='crisis'?'Call 988':'Call SAMHSA for treatment referrals'),s==='crisis'&&React.createElement("p",null,React.createElement("a",{href:"sms:988"},"Text 988 instead")),s==='withdrawal'&&React.createElement("p",{className:"privacy"},"SAMHSA\u2019s helpline offers treatment referrals; it is not emergency medical care. You can also contact your clinician or seek urgent medical care."),React.createElement("p",null,React.createElement("a",{href:"/resources/"},"More recovery and crisis resources")));}else if(id==='international'||id==='youth')body=React.createElement(React.Fragment,null,React.createElement("p",{className:"eyebrow"},"FIND SUPPORT THAT FITS"),React.createElement("h1",{ref:heading,tabIndex:"-1"},id==='youth'?'You deserve support, too.':'Let’s find support where you are.'),React.createElement("p",{className:"intro"},id==='youth'?'This adult care quiz isn’t the right assessment for you. A trusted adult, school counselor, or healthcare professional can help you find age-appropriate support. In the US, call or text 988 in a crisis; call 911 for an emergency.':'Soberpedia’s directory focuses on US services. A local health professional or support service can help you explore care in your country. In an emergency, call your local emergency number.'),React.createElement("a",{className:"primary",href:id==='youth'?'https://www.samhsa.gov/find-help':'https://findahelpline.com/'},"Find support \u2192"));else{const r=SoberQuiz.result(answers);body=React.createElement(React.Fragment,null,React.createElement("p",{className:"eyebrow"},"YOUR NEXT STEP"),React.createElement("h1",{ref:heading,tabIndex:"-1"},r.title),React.createElement("p",{className:"intro"},r.body),answers.audience==='self'&&React.createElement("div",{className:"reflection"},React.createElement("span",null,"YOUR PRIORITY"),React.createElement("h2",null,SoberQuiz.label('goal',answers)),React.createElement("span",null,"WHERE YOU ARE TODAY"),React.createElement("p",null,SoberQuiz.label('stage',answers
1)),answers.support==='clinician'&&React.createElement("p",null,"You already have a care team. Bring these priorities to them before changing your treatment.")),r.topics&&React.createElement("div",{className:"reflection"},React.createElement("span",null,"RELEVANT INFORMATION FOR YOUR GOAL"),r.topics.map(topic=>React.createElement("article",{key:topic.href},React.createElement("h2",null,React.createElement("a",{href:topic.href},topic.name," \u2192")),React.createElement("p",null,topic.text)))),r.note&&React.createElement("p",{className:"privacy"},r.note),r.finder?finder:r.peptide?React.createElement(LeadCapture,{key:r.interest,interest:r.interest,result:r}):React.createElement("a",{className:"primary",href:r.href},r.action," \u2192"),React.createElement("details",{className:"explanation"},React.createElement("summary",null,"Why this next step?"),React.createElement("p",null,answers.audience==='someone'?'Supporting someone starts with their choices and with support for you, too. We haven’t assessed them or selected a treatment.':r.why||'A clinician needs to review your health and current medications before deciding on treatment.')),r.pair&&React.createElement("details",{className:"explanation"},React.createElement("summary",null,"Medication questions to bring to a clinician"),React.createElement("p",null,"Ask about established alcohol-treatment options and whether weight-management treatment is relevant. Semaglutide has emerging alcohol-use research; it is not a guaranteed fit or an FDA-approved addiction treatment. This does not establish the same benefit for every GLP-1 medication."),React.createElement("a",{href:"/peptides/semaglutide/"},"Read about semaglutide research \u2192")),React.createElement("details",{className:"explanation"},React.createElement("summary",null,"What happens next?"),React.createElement("p",null,r.finder?'Choose a provider and confirm its services, costs, and availability directly. Your quiz answers are not sent to the provider. You can download your summary below to bring to a conversation.':r.peptide?'Review the product information and available intake pathway. A clinician determines whether treatment is appropriate; prescribing and supply are not guaranteed. Only your name, email, and peptide inquiry topic are saved if you submit the inquiry form. Your health-related quiz answers are not transferred. Download your summary to bring to that conversation.':'The next page explains the companion service or resources. Your quiz answers are not shared with it.')),React.createElement("details",{className:"save"},React.createElement("summary",null,"Save a copy of your answers"),React.createElement("h2",null,"Keep this conversation starter."),React.createElement("p",null,"Download a personal copy to bring to your care team. It may contain sensitive information; save it somewhere private."),React.createElement("button",{className:"secondary",onClick:download},"Download my summary")));}return React.createElement(React.Fragment,null,React.createElement("header",{className:"quiz-header"},React.createElement("a",{href:"/",className:"quiz-brand"},React.createElement("img",{src:"/assets/brand-favicon-20260906.svg",alt:""}),"Soberpedia"),React.createElement("a",{href:"/resources/"},"Need help now?")),React.createElement("main",null,React.createElement("section",{className:"quiz-panel"},index>=0&&React.createElement("div",{className:"progress"},React.createElement("button",{disabled:index===0,onClick:()=>{setIndex(i=>Math.max(0,i-1));setError('');}},"\u2190 Back"),React.createElement("span",null,['result','urgent','youth','international'].includes(id)?'Your next step':id==='reflection'?'A moment to reflect':`${index+1} / ${steps.length}`),React.createElement("div",{className:"track"},React.createElement("div",{style:{width:Math.round((index+1)/steps.length*100)+'%'}}))),React.createElement("div",{className:"screen screen-"+id,key:id||"welcome"},body),index>=0&&React.createElement("button",{className:"restart",onClick:reset},"Start over"))),React.createElement("footer",null,React.createElement("span",null,"\xA9 Soberpedia 2026"),React.createElement("a",{href:"/privacy/"},"Privacy"),React.createElement("a",{href:"/resources/"},"Recovery resources"),React.createElement("span",null,"Not a medical provider or emergency service.")));}function LeadCapture({interest,result}){const[status,setStatus]=React.useState('idle'),[error,setError]=React.useState('');const requestId=React.useRef(null),busy=React.useRef(false);async function submit(e){e.preventDefault();if(busy.current)return;busy.current=true;setStatus('saving');setError('');const form=new FormData(e.currentTarget);if(!requestId.current)requestId.current=crypto.randomUUID();try{const res=await fetch('/api/peptide-inquiry',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({name:form.get('name'),email:form.get('email'),consent:form.get('consent')==='on',interest:interest||'unsure',request_id:requestId.current,website:form.get('website')||''})});if(!res.ok)throw Error(res.status===429?'Please wait a few minutes before trying again.':'We couldn’t save your inquiry. Please try again, or continue below.');const data=await res.json();
1if(!data.ok)throw Error('Your inquiry was not saved. Please try again.');setStatus('saved');}catch(err){setStatus('idle');setError(err.message);}finally{busy.current=false;}}if(status==='saved')return React.createElement("div",{className:"save",role:"status"},React.createElement("h2",null,"You\u2019re on the list."),React.createElement("p",null,"Your inquiry is saved with Soberpedia. Continue below to review your option and its available intake pathway."),React.createElement("a",{className:"primary",href:result.href},result.action," \u2192"));return React.createElement("form",{className:"save lead-form",onSubmit:submit},React.createElement("p",{className:"eyebrow"},"KEEP MOVING FORWARD"),React.createElement("h2",null,"Let\u2019s help you take the next step."),React.createElement("p",null,"Want help exploring this next step? Leave your details so Soberpedia can follow up about your inquiry."),React.createElement("label",null,"First name",React.createElement("input",{name:"name",required:true,maxLength:100,autoComplete:"given-name"})),React.createElement("label",null,"Email address",React.createElement("input",{name:"email",type:"email",required:true,maxLength:254,autoComplete:"email"})),React.createElement("div",{hidden:true},React.createElement("label",null,"Website",React.createElement("input",{name:"website",tabIndex:"-1",autoComplete:"off"}))),React.createElement("label",{className:"consent"},React.createElement("input",{type:"checkbox",name:"consent",required:true}),"I agree that Soberpedia may store my name, email, and peptide inquiry topic and email me about this inquiry."),React.createElement("p",{className:"privacy"},"Your other quiz answers are not sent. This is an inquiry, not a clinical assessment or prescription. ",React.createElement("a",{href:"/privacy/"},"Privacy policy")),error&&React.createElement("p",{role:"alert"},error),React.createElement("button",{className:"primary next",disabled:status==='saving'},status==='saving'?'Saving your inquiry…':'Save my inquiry →'),React.createElement("a",{className:"skip",href:result.href},"Continue without sharing my details \u2192"));}ReactDOM.createRoot(document.getElementById('quiz-root')).render(React.createElement(Quiz,null));

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.