1"use strict";(self.webpackChunkulearn_abroad=self.webpackChunkulearn_abroad||[]).push([[9773],{1317:(e,t,s)=>{s.d(t,{k:()=>r});const r=e=>{if(!e||"string"!==typeof e)return e||"";let t=e;for(let r=0;r<3&&/\\\\/.test(t);r++)t=t.replace(/\\\\/g,"\\");/\\(?:frac|sqrt|text|mathbb|binom|overline|underline)\s*\\\{/.test(t)&&(t=t.replace(/\\([{}])/g,"$1"));const s=t.match(/^\s*\$\$([\s\S]*)\$\$\s*$/);return s&&/\\\(/.test(s[1])&&(t=s[1].trim()),t}},4601:(e,t,s)=>{s.d(t,{A:()=>l});var r=s(5043),a=s(6965),n=s(1317),c=(s(7104),s(579));const l=e=>{let{question:t,options:s=[],onAnswerSelect:l,selectedAnswer:i,language:o,questionNumber:d,isMathTest:p=!1}=e;const g=String(o||"").toLowerCase().startsWith("ar"),h=(0,r.useRef)(null),u=["\u0623","\u0628","\u062c","\u062f","\u0647\u0640","\u0648"];var f,m;((0,r.useEffect)(()=>{const e=e=>(e.preventDefault(),!1),t=h.current;return t&&(t.addEventListener("contextmenu",e),t.addEventListener("copy",e),t.addEventListener("cut",e),t.addEventListener("dragstart",e),t.style.userSelect="none",t.style.webkitUserSelect="none",t.style.MozUserSelect="none",t.style.msUserSelect="none"),()=>{t&&(t.removeEventListener("contextmenu",e),t.removeEventListener("copy",e),t.removeEventListener("cut",e),t.removeEventListener("dragstart",e))}},[]),p&&1===d)&&console.log("\ud83d\udd0d MathQuestion Component Received:",{isMathTest:p,question:null===t||void 0===t?void 0:t.substring(0,100),optionsCount:null===s||void 0===s?void 0:s.length,firstOption:null===s||void 0===s||null===(f=s[0])||void 0===f||null===(m=f.text)||void 0===m?void 0:m.substring(0,50)});const x=e=>{if(!e)return"";e=(0,n.k)(e);const t=/\\\[|\\\(|\$/.test(e);if(!p&&!t)return e.trim();let s=e.trim().replace(/\\frac\\\{/g,"\\frac{").replace(/\\sqrt\\\{/g,"\\sqrt{").replace(/\\mathbb\\\{/g,"\\mathbb{").replace(/\\text\\\{/g,"\\text{").replace(/(\\(?:frac|sqrt|mathbb|text|left|right))\\\{/g,"$1{").replace(/\\frac\s*([^{\s])([^{\s])/g,"\\frac{$1}{$2}").replace(/x\+3>0x\+3>0/g,"x+3>0").replace(/\)\s*\u0647\u064a:\s*([^A-D])/g,") \u0647\u064a: $1").replace(/\\\(\s*\\\(/g,"\\(").replace(/\\\)\s*\\\)/g,"\\)").replace(/\\frac\s*([^{\s]+)\s*\\\)/g,"\\frac{$1}").replace(/\\sqrt\s*([^{\s]+)\s*\\\)/g,"\\sqrt{$1}").replace(/\\\]\s*\\\]/g,"\\]");const r=/\\\[([\s\S]*?)\\\]|\\\(([\s\S]*?)\\\)|\$([^$]*)\$/g;if(r.test(s)){r.lastIndex=0;const e=[];let t,n=0;for(;null!==(t=r.exec(s));){t.index>n&&e.push(s.substring(n,t.index));const r=t[1]||t[2]||t[3],l=!!t[1];e.push((0,c.jsx)(a.r,{isArabic:g,expression:r,inline:!l,className:g?"question-math-ar question-math":"question-math"},t.index)),n=t.index+t[0].length}return n<s.length&&e.push(s.substring(n)),e}if(p){const e=/\\[a-zA-Z]+/.test(s),t=/^\s*-?\d+\s*\/\s*\d+\s*$/.test(s),r=/^[\\a-zA-Z0-9{}_^\/\s\-+*()\[\].,:;|]+$/.test(s),n=s.length<=40;if(e&&r&&n||t)return(0,c.jsx)(a.r,{expression:s,inline:!0,isArabic:g,className:g?"question-math-ar question-math":"question-math"})}return s};return(0,c.jsxs)("div",{className:"math-question-container ".concat(g?"rtl":"ltr"),children:[(0,c.jsx)("div",{className:"question-content",children:(0,c.jsx)("div",{className:"question-text ".concat(g?"rtl":"ltr"),children:(e=>{if(!e)return"";e=(0,n.k)(e);const t=/\\\[|\\\(|\$/.test(e);if(!p&&!t)return e;let s=e.replace(/\\frac\\\{/g,"\\frac{").replace(/\\sqrt\\\{/g,"\\sqrt{").replace(/\\mathbb\\\{/g,"\\mathbb{").replace(/\\text\\\{/g,"\\text{").replace(/(\\(?:frac|sqrt|mathbb|text|left|right))\\\{/g,"$1{").replace(/\\frac\s*([^{\s])([^{\s])/g,"\\frac{$1}{$2}").replace(/\\frac\{([^}]*)\}([^{])/g,(e,t,s)=>" "===s||"\\"===s?e:"\\frac{".concat(t,"}{").concat(s,"}"));const r=/\\\[([\s\S]*?)\\\]|\\\(([\s\S]*?)\\\)|\$([^$]*)\$/g;if(r.test(s)){r.lastIndex=0;const e=[];let t,n=0;for(;null!==(t=r.exec(s));){t.index>n&&e.push(s.substring(n,t.index));const r=t[1]||t[2]||t[3],l=!!t[1];e.push((0,c.jsx)(a.r,{isArabic:g,expression:r,inline:!l,className:g?"question-math-ar question-math":"question-math"},t.index)),n=t.index+t[0].length}return n<s.length&&e.push(s.substring(n)),e}return s})(t)})}),s.length>0&&(0,c.jsx)("div",{className:"options-container",children:s.map((e,t)=>{const s=e.id||String.fromCharCode(97+t),r=i===s;return(0,c.jsxs)("div",{className:"option-item ".concat(r?"selected":""," ").concat(g?"rtl":"ltr"),onClick:()=>l&&l(s),children:[(0,c.jsx)("div",{className:"option-label",children:"".concat(g&&u[t]||s.toUpperCase(),")")}),(0,c.jsx)("div",{className:"option-content",children:x(e.text||e)})]},s)})})]})}},6965:(e,t,s)=>{s.d(t,{r:()=>c});s(5043);var r=s(3927),a=(s(3159),s(579));const n=e=>{const t=/[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/;if(t.test(e))return!0;const s=e.match(/\\text\{([^}]*)\}/g);if(s)for(const a of s)if(t.test(a))return!0;const r=["\u062a\u0633\u0627\u0648\u064a","\u062d\u064a\u062b","\u0625\u0630\u0627","\u0643\u0627\u0646\u062a","\u0623\u0648\u062c\u062f","\u0642\u064a\u0645\u0629","\u0627\u0644\u062f\u0627\u0644\u0629","\u0627\u0644\u0645\u062c\u0627\u0644","\u0627\u0644\u0645\u062f\u0649","\u0627\u0644\u0639\u062f\u062f","\u0627\u0644\u062d\u0644","\u0627\u0644\u0645\u0639\u0627\u062f\u0644\u0629","\u0627\u0644\u0645\u062a\u0628\u0627\u064a\u0646\u0629"];for(const a of r)if(e.includes(a))return!0;return!1},c=e=>{let{expression:t,inline:s=!1,className:c,displayMode:l=!1}=e;if(!t)return null;let i=t.trim();i=i.replace(/\\frac\\\{/g,"\\frac{").replace(/\\sqrt\\\{/g,"\\sqrt{").replace(/\\mathbb\\\{/g,"\\mathbb{").replace(/\\text\\\{/g,"\\text{").replace(/(\\(?:frac|sqrt|mathbb|text|left|right))\\\{/g,"$1{").replace(/([^>]+>0)\1/g,"$1").replace(/\^{\s*-\s*(\d+)\s*\}/g,"^{-$1}").replace(/\^{\s*(\d+)\s*\}/g,"^{$1}").replace(/\^{\s*-\s*(\d+)\s*\\\}/g,"^{-$1}").replace(/\^{\s*(\d+)\s*\\\}/g,"^{$1}").replace(/\\Re\\backslash/g,"\\mathbb{R}\\setminus").replace(/\\Re\\\\/g,"\\mathbb{R}\\setminus").replace(/\\backslash/g,"\\setminus").replace(/\\mathbb\{R\}\\setminus\\{0\\}/g,"\\mathbb{R}\\setminus\\{0\\}").replace(/\\infty/g,"\\infty").replace(/\u221e/g,"\\infty").replace(/\u222a/g,"\\cup").replace(/\u2229/g,"\\cap").replace(/\u2212/g,"-").replace(/(?<![a-zA-Z\\^_}])\{(\d+)\}/g,"\\{$1\\}").replace(/(?<![a-zA-Z\\^_}])\{(\d+,\s*-?\s*\d+)\}/g,"\\{$1\\}").replace(/(\d+)\s*\/\s*(\d+)/g,"\\frac{$1}{$2}").replace(/\\frac\{([^{}]*)\}\s*\\?\{([^{}]*)\}/g,"\\frac{$1}{$2}").replace(/\\frac\s*\{\s*([^{}]*)\s*\}\s*\{\s*([^{}]*)\s*\}/g,"\\frac{$1}{$2}").replace(/\\frac\{([^{}]*)\}(?!\s*\\?\{)/g,"$1").replace(/\\sqrt\\\{([^}]*)\\\}/g,"\\sqrt{$1}").replace(/\\\{([^}\\]*)\}(?!\\)/g,"\\{$1\\}").replace(/\\mathb(?![b])/g,"\\mathbb").replace(/\\mathbb\{R\}\\setminus\\{0\}/g,"\\mathbb{R}\\setminus\\{0\\}").replace(/\\mathbb\{R\}\\setminus/g,"\\mathbb{R}\\setminus").replace(/\\cup/g,"\\cup").replace(/\\infty/g,"\\infty").replace(/(\([^()]*\))\s*\1/g,"$1").replace(/([0-9A-Za-z\s\-+*=<>\u2264\u2265\[\],.]{8,}
1)\1/g,"$1").replace(/f\(([^)]+)\)\s*=\s*([^{]+)\{([^}]+)\}\s*-\s*([^\\]+)\\\\\s*\(f\(([^)]+)\)\\\\\s*\u062a\u0633\u0627\u0648\u064a:/g,"f($1) = $2\\{$3\\} - $4\\\\ f($5) \\text{ \u062a\u0633\u0627\u0648\u064a}:").replace(/\u0625\u0630\u0627 \u0643\u0627\u0646\u062a\s+([^\\]+)\\\\\s*\(f\(([^)]+)\)\\\\\s*\u062a\u0633\u0627\u0648\u064a:/g,"\\text{\u0625\u0630\u0627 \u0643\u0627\u0646\u062a } $1\\\\ f($2) \\text{ \u062a\u0633\u0627\u0648\u064a}:").replace(/\(\s*-\s*\\infty\s*,/g,"(-\\infty,").replace(/,\s*\\infty\s*\)/g,",\\infty)").replace(/\s*-\s*/g," - ").replace(/\s*\+\s*/g," + ").replace(/\s*=\s*/g," = ").replace(/\\left\s*\(/g,"\\left(").replace(/\)\s*\\right/g,")\\right").replace(/\\left\s*\[/g,"\\left[").replace(/\]\s*\\right/g,"]\\right").replace(/\\left\s*\{/g,"\\left\\{").replace(/\}\s*\\right/g,"\\}\\right").replace(/\\\s*$/g,"").replace(/\s+/g," ").trim();const o=n(i)?"rtl":"ltr";try{return s?(0,a.jsx)("span",{className:"math-display-inline ".concat(c),dir:o,style:{display:"inline-block"},children:(0,a.jsx)(r.InlineMath,{math:i,errorColor:"#ff0000",throwOnError:!1})}):(0,a.jsx)("div",{className:"math-display-block ".concat(c),dir:o,children:(0,a.jsx)(r.BlockMath,{math:i,errorColor:"#ff0000",throwOnError:!1})})}catch(d){console.warn("\u26a0\ufe0f KaTeX rendering error:",d.message);try{let e=i.replace(/\\left\(/g,"\\left(").replace(/\\right\)/g,"\\right)").replace(/\\frac\s*\{\s*/g,"\\frac{").replace(/\s*\}\s*\{\s*/g,"}{").replace(/\s*\}\s*([^{])/g,"}$1").replace(/\s+/g," ").trim();return s?(0,a.jsx)("span",{className:"math-display-inline ".concat(c),dir:o,style:{display:"inline-block"},children:(0,a.jsx)(r.InlineMath,{math:e})}):(0,a.jsx)("div",{className:"math-display-block ".concat(c),dir:o,children:(0,a.jsx)(r.BlockMath,{math:e})})}catch(p){return console.error("KaTeX rendering failed after fixes:",p),console.error("Expression that failed:",i),(0,a.jsx)("span",{className:"math-display-text ".concat(c),dir:o,style:{display:"inline-block"},children:i})}}}},7104:()=>{},9773:(e,t,s)=>{s.r(t),s.d(t,{default:()=>l});var r=s(5043),a=s(6247),n=s(4601),c=s(579);const l=()=>{const[e,t]=(0,r.useState)([]),[s,l]=(0,r.useState)(!0),[i,o]=(0,r.useState)(null),[d,p]=(0,r.useState)("MathEnglish");return(0,r.useEffect)(()=>{(async()=>{try{l(!0);const e="".concat(a.Zt,"/").concat(d,"/English");console.log("Fetching from:",e);const s=await fetch(e);if(!s.ok)throw new Error("HTTP error! status: ".concat(s.status));const r=await s.json();console.log("Raw backend data:",r),t(r.slice(0,3)),l(!1)}catch(e){console.error("Error fetching questions:",e),o(e.message),l(!1)}})()},[d]),s?(0,c.jsx)("div",{style:{padding:"20px"},children:"Loading..."}):i?(0,c.jsxs)("div",{style:{padding:"20px",color:"red"},children:["Error: ",i]}):(0,c.jsxs)("div",{style:{padding:"20px",maxWidth:"1200px",margin:"0 auto"},children:[(0,c.jsx)("h1",{children:"Question Debug Page"}),(0,c.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,c.jsx)("button",{onClick:()=>p("MathEnglish"),style:{marginRight:"10px"},children:"Math English"}),(0,c.jsx)("button",{onClick:()=>p("MathArabic"),children:"Math Arabic"})]}),e.map((e,t)=>(0,c.jsxs)("div",{style:{marginBottom:"40px",padding:"20px",border:"2px solid #ddd",borderRadius:"8px"},children:[(0,c.jsxs)("h3",{children:["Question ",t+1]}),(0,c.jsxs)("div",{style:{backgroundColor:"#f5f5f5",padding:"15px",marginBottom:"20px",borderRadius:"4px"},children:[(0,c.jsx)("h4",{children:"Raw Backend Data:"}),(0,c.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:"12px"},children:JSON.stringify({question:e.question,options:e.options.map(e=>e.text)},null,2)})]}),(0,c.jsxs)("div",{style:{backgroundColor:"#e3f2fd",padding:"15px",borderRadius:"4px"},children:[(0,c.jsx)("h4",{children:"Rendered with MathQuestion (isMathTest=true):"}),(0,c.jsx)(n.A,{question:e.question,options:e.options.map((e,t)=>({id:String.fromCharCode(97+t),text:e.text,correct:e.answer})),onAnswerSelect:e=>console.log("Selected:",e),selectedAnswer:null,language:"en",questionNumber:t+1,isMathTest:!0})]}),(0,c.jsxs)("div",{style:{backgroundColor:"#fff3cd",padding:"15px",marginTop:"15p
1x",borderRadius:"4px"},children:[(0,c.jsx)("h4",{children:"Rendered with MathQuestion (isMathTest=false):"}),(0,c.jsx)(n.A,{question:e.question,options:e.options.map((e,t)=>({id:String.fromCharCode(97+t),text:e.text,correct:e.answer})),onAnswerSelect:e=>console.log("Selected:",e),selectedAnswer:null,language:"en",questionNumber:t+1,isMathTest:!1})]})]},t))]})}}}]); 2//# sourceMappingURL=9773.26013372.chunk.js.map
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.