1(()=>{'use strict'; 2const init=root=>{ 3 if(root.dataset.ready)return;root.dataset.ready='1'; 4 const cfg=window.CKClassroomConfig;if(!cfg)return; 5 const first=root.querySelector('.cc-lead-start'),details=root.querySelector('.cc-lead-details');if(!first||!details)return; 6 const pageCentre=root.dataset.centre||cfg.centre||''; 7 const lead={name:'',mobile:'',website:''}; 8 const say=(form,message)=>{form.querySelector('[role="status"]').textContent=message||'';}; 9 const show=step=>{root.querySelectorAll('[data-step-panel]').forEach(panel=>{panel.hidden=panel.dataset.stepPanel!==step;});root.dataset.step=step;root.scrollIntoView?.({block:'center',behavior:'smooth'});root.querySelector(`[data-step-panel="${step}"] h2`)?.focus();}; 10 const centreInput=value=>[...details.querySelectorAll('input[name="centre"]')].find(input=>input.value===value)||null; 11 if(pageCentre){const own=centreInput(pageCentre);if(own)own.checked=true;} 12 first.addEventListener('submit',async e=>{ 13 e.preventDefault();const button=first.querySelector('button[type="submit"]');if(button.disabled||!first.reportValidity())return; 14 lead.name=first.elements.name.value.trim();lead.mobile=first.elements.mobile.value.trim();lead.website=first.elements.website.value; 15 button.disabled=true;say(first,'Checking your loginâ¦'); 16 try{ 17 if(!window.CKClassroomAuth?.ensure)throw new Error('Login is unavailable. Please refresh and retry.'); 18 await window.CKClassroomAuth.ensure(lead,button); 19 say(first,'');show('2'); 20 }catch(err){say(first,err.message||'Could not verify your mobile. Please retry.');} 21 finally{button.disabled=false;} 22 }); 23 details.addEventListener('change',e=>{ 24 const box=e.target;if(box.name!=='exam'||!box.checked)return; 25 details.querySelectorAll('input[name="exam"]').forEach(other=>{if(other!==box&&(box.value==='All Exams'||other.value==='All Exams'))other.checked=false;}); 26 }); 27 const send=async skip=>{ 28 const buttons=[...details.querySelectorAll('button')];if(buttons.some(b=>b.disabled))return;
29 const picked=details.querySelector('input[name="centre"]:checked'),exams=[...details.querySelectorAll('input[name="exam"]:checked')].map(x=>x.value); 30 if(!skip&&!picked){say(details,'Choose where you would like to study, or tap Skip for now.');return;} 31 if(!skip&&!exams.length){say(details,'Choose your exam, or tap Skip for now.');return;} 32 const centre=picked?picked.value:(pageCentre||'online'); 33 const enquiry={name:lead.name,mobile:lead.mobile,exam:exams.length?exams.join(', '):'Not specified',centre,website:lead.website,source:location.pathname}; 34 buttons.forEach(b=>{b.disabled=true;});say(details,'Saving your enquiryâ¦'); 35 try{ 36 const controller=new AbortController(),timer=setTimeout(()=>controller.abort(),20000);let response,json; 37 try{response=await fetch(cfg.api+'demo',{method:'POST',credentials:'same-origin',cache:'no-store',headers:{'Content-Type':'application/json','X-CK-Arena':'1'},body:JSON.stringify(enquiry),signal:controller.signal});json=await response.json();}finally{clearTimeout(timer);} 38 if(response.status===401||response.status===403){say(details,'');show('1');say(first,json.message||'Please verify your mobile again.');return;} 39 if(!response.ok||!json.saved)throw new Error(json.message||'Could not save your enquiry. Please retry.'); 40 root.querySelector('[data-lead-name]').textContent=lead.name; 41 root.querySelector('[data-lead-mobile]').textContent='+91 '+lead.mobile.replace(/\D/g,'').replace(/^91(?=\d{10}$)/,''); 42 root.querySelector('[data-lead-centre]').textContent=(picked||centreInput(centre))?.dataset.label||centre; 43 root.querySelector('[data-lead-exam]').textContent=enquiry.exam; 44 say(details,'');show('3'); 45 }catch(err){say(details,err.name==='AbortError'?'The connection timed out. Please retry.':err.message||'Could not send your enquiry. Please retry.');} 46 finally{buttons.forEach(b=>{b.disabled=false;});} 47 }; 48 details.addEventListener('submit',e=>{e.preventDefault();send(false);}); 49 details.querySelector('.cc-lead-skip').addEventListener('click',()=>send(true)); 50}; 51const start=()=>document.querySelectorAll('.cc-lead').forEach(init); 52if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',start,{once:true});else start(); 53})();
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.