PageSourceSearch

https://rasjunction.com/_next/static/chunks/pages/saved-question-9f693ed6e39d799c.js

js rasjunction.com collected 2026-09-24 14:54:05 UTC 33,771 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9783],{83712:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/saved-question",function(){return n(27952)}])},85030:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(85893);function s(e){var t=e.className,n=void 0===t?"":t,s=e.title,o=void 0===s?"No content available":s,a=e.description;return(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center gap-5 py-16 text-center ".concat(n),children:[(0,r.jsx)(i,{className:"h-40 w-40 md:h-44 md:w-44"}),(0,r.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,r.jsx)("h3",{className:"mb-0 max-w-md text-lg font-bold tracking-tight text-foreground md:text-xl",children:o}),a&&(0,r.jsx)("p",{className:"mb-0 max-w-md text-sm text-muted-foreground",children:a})]})]})}function i(e){var t=e.className,n=void 0===t?"":t;return(0,r.jsxs)("svg",{viewBox:"0 0 200 178",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-hidden":"true",className:n,children:[(0,r.jsx)("circle",{cx:"100",cy:"82",r:"72",fill:"hsl(var(--primary))",opacity:"0.07"}),(0,r.jsx)("rect",{x:"54",y:"34",width:"76",height:"96",rx:"12",fill:"hsl(var(--muted))",stroke:"hsl(var(--border))",strokeWidth:"2"}),(0,r.jsx)("rect",{x:"67",y:"53",width:"50",height:"7",rx:"3.5",fill:"hsl(var(--muted-foreground))",opacity:"0.35"}),(0,r.jsx)("rect",{x:"67",y:"68",width:"38",height:"7",rx:"3.5",fill:"hsl(var(--muted-foreground))",opacity:"0.28"}),(0,r.jsx)("rect",{x:"67",y:"83",width:"44",height:"7",rx:"3.5",fill:"hsl(var(--muted-foreground))",opacity:"0.22"}),(0,r.jsx)("circle",{cx:"120",cy:"106",r:"27",fill:"hsl(var(--background))",stroke:"hsl(var(--primary))",strokeWidth:"5"}),(0,r.jsx)("circle",{cx:"120",cy:"106",r:"14",fill:"hsl(var(--primary))",opacity:"0.12"}),(0,r.jsx)("line",{x1:"141",y1:"127",x2:"160",y2:"146",stroke:"hsl(var(--primary))",strokeWidth:"7",strokeLinecap:"round"}),(0,r.jsx)("circle",{cx:"48",cy:"120",r:"3.5",fill:"hsl(var(--primary))",opacity:"0.4"}),(0,r.jsx)("circle",{cx:"150",cy:"44",r:"2.5",fill:"hsl(var(--primary))",opacity:"0.35"}),(0,r.jsx)("circle",{cx:"40",cy:"60",r:"2",fill:"hsl(var(--muted-foreground))",opacity:"0.3"})]})}},95034:function(e,t,n){"use strict";n.d(t,{C:function(){return l},t:function(){return u}});var r=n(26042),s=n(99534),i=n(85893),o=(n(67294),n(12003)),a=n(62461),u=(0,o.j)("inline-flex items-center gap-1.5 whitespace-nowrap font-bold transition-colors duration-200 ease [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{success:"bg-green-100 text-green-600 dark:bg-green-900/40 dark:text-green-500",default:"bg-primary text-primary-foreground hover:bg-primary/90 border border-input",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 border border-input",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 border border-border",muted:"bg-muted text-muted-foreground hover:bg-muted/80 border border-border",blue:"bg-blue-100 text-blue-700 dark:bg-blue-500/15 dark:text-blue-400",outline:"border border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground",category:"text-primary bg-accent hover:bg-accent/80 border border-border shadow-sm",ghost:"text-foreground hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",new:"bg-primary text-primary-foreground border border-primary/20"},size:{xs:"text-[10px] px-1.5 py-px rounded-sm [&_svg]:size-3",sm:"text-xs px-2 py-0.5 rounded-sm [&_svg]:size-3",default:"text-sm px-2.5 py-0.5 rounded-md [&_svg]:size-4",lg:"text-sm px-3 py-1 rounded-lg [&_svg]:size-4"}},defaultVariants:{variant:"default",size:"default"}});function l(e){var t=e.className,n=e.variant,o=e.size,l=(0,s.Z)(e,["className","variant","size"]);return(0,i.jsx)("div",(0,r.Z)({className:(0,a.cn)(u({variant:n,size:o}),t)},l))}},35895:function(e,t,n){"use strict";n.d(t,{SP:function(){return d},dr:function(){return c},mQ:function(){return l},nU:function(){return f}});var r=n(26042),s=n(99534),i=n(85893),o=n(67294),a=n(60434),u=n(62461),l=a.fC,c=o.forwardRef((function(e,t){var n=e.className,o=(0,s.Z)(e,["className"]);return(0,i.jsx)(a.aV,(0,r.Z)({ref:t,className:(0,u.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",n)},o))}));c.displayName=a.aV.displayName;var d=o.forwardRef((function(e,t){var n=e.className,o=(0,s.Z)(e,["className"]);return(0,i.jsx)(a.xz,(0,r.Z)({ref:t,className:(0,u.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",n
1)},o))}));d.displayName=a.xz.displayName;var f=o.forwardRef((function(e,t){var n=e.className,o=(0,s.Z)(e,["className"]);return(0,i.jsx)(a.VY,(0,r.Z)({ref:t,className:(0,u.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",n)},o))}));f.displayName=a.VY.displayName},13348:function(e,t,n){"use strict";n.d(t,{y:function(){return v}});var r=n(47568),s=n(97582),i=n(67294),o=n(19201),a=n(47041),u=n(96076),l=n(7386),c=n(11163),d=n(89885),f=n(96486),v=function(e,t){var n=(0,i.useContext)(d.Z).appConfig,v=(0,i.useState)({}),m=v[0],h=v[1],g=(0,i.useState)([]),p=g[0],x=g[1],b=(0,i.useState)(!0),y=b[0],_=b[1],j=(0,c.useRouter)(),w=function(e){localStorage.setItem(u.dA.SAVED_QUIZ_QUESTIONS_MAP,JSON.stringify(e)),h(e)},N=function(){var e=(0,r.Z)((function(){var e,t,r,i,o,c;return(0,s.__generator)(this,(function(s){switch(s.label){case 0:if(e=(0,a.getCookie)(u.z1),(0,f.isEmpty)(n.web_menuitems)||!(0,f.some)(n.web_menuitems,{type:"SAVED_QUESTION"}))return _(!1),[2];s.label=1;case 1:return s.trys.push([1,3,4,5]),[4,(0,l.A_)({baseURL:e})];case 2:return 200===(null===(r=s.sent())||void 0===r||null===(t=r.data)||void 0===t?void 0:t.status)&&Array.isArray(r.data.data)&&(i=r.data.data,x(i),o={},i.forEach((function(e){(null===e||void 0===e?void 0:e.id)&&(o[e.id]=!0)})),w(o)),[3,5];case 3:return c=s.sent(),console.error("Error fetching saved quiz questions:",c),[3,5];case 4:return _(!1),[7];case 5:return[2]}}
1))}));return function(){return e.apply(this,arguments)}}();(0,i.useEffect)((function(){var e=function(){var e=(0,r.Z)((function(){var e,t,n;return(0,s.__generator)(this,(function(r){switch(r.label){case 0:if(!(e=localStorage.getItem(u.dA.SAVED_QUIZ_QUESTIONS_MAP)))return[3,5];r.label=1;case 1:return r.trys.push([1,2,,4]),t=JSON.parse(e),h(t),_(!1),[3,4];case 2:return n=r.sent(),console.error("Error parsing saved quiz questions:",n),[4,N()];case 3:return r.sent(),[3,4];case 4:return[3,7];case 5:return[4,N()];case 6:r.sent(),r.label=7;case 7:return[2]}}))}));return function(){return e.apply(this,arguments)}}();e()}),[]);var S=function(){var i=(0,r.Z)((function(){var r,i,c,d,v;return(0,s.__generator)(this,(function(s){switch(s.label){case 0:if(!e||!t)return o.A.error("Missing required data to save the quiz question.",{autoClose:1e3}),[2];if(r=(0,a.getCookie)(u.z1),(0,f.isEmpty)(n.web_menuitems)||!(0,f.some)(n.web_menuitems,{type:"SAVED_QUESTION"}))return[2];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,(0,l.GF)({questionId:e,quizId:t,baseURL:r})];case 2:return 200===(null===(i=s.sent())||void 0===i?void 0:i.status)&&(null===i||void 0===i?void 0:i.data)&&(c=i.data[e],d=function(){try{var e=localStorage.getItem(u.dA.SAVED_QUIZ_QUESTIONS_MAP);return e?JSON.parse(e):{}}catch(t){return console.error("Error parsing saved quiz questions:",t),{}}}(),c?d[e]=!0:delete d[e],w(d),o.A.success(c?"Added to saved quiz questions":"Removed from saved quiz questions",{autoClose:1e3})),[3,4];case 3:return v=s.sent(),console.error("Error while saving quiz question:",v),o.A.error("Error while saving quiz question.",{autoClose:1e3}),[3,4];case 4:return[2]}}
1))}));return function(){return i.apply(this,arguments)}}(),q=(0,f.debounce)(S,500),E=function(){var e=(0,r.Z)((function(e,t){var n,r,i;return(0,s.__generator)(this,(function(s){switch(s.label){case 0:if(!e||!t)return o.A.error("No question ID provided for deletion.",{autoClose:1e3}),[2];s.label=1;case 1:return s.trys.push([1,5,,6]),n=(0,a.getCookie)(u.z1),[4,(0,l.GF)({questionId:e,quizId:t,baseURL:n})];case 2:return 200===(null===(r=s.sent())||void 0===r?void 0:r.status)&&(null===r||void 0===r?void 0:r.data)?[4,N()]:[3,4];case 3:s.sent(),j.replace("/saved-question?type=quiz"),o.A.success("Quiz question removed from saved.",{autoClose:1e3}),s.label=4;case 4:return[3,6];case 5:return i=s.sent(),console.error("Error while deleting saved quiz question:",i),o.A.error("Error while deleting saved quiz question.",{autoClose:1e3}),[3,6];case 6:return[2]}}))}));return function(t,n){return e.apply(this,arguments)}}();return{loading:y,isSaved:(0,i.useMemo)((function(){return!!e&&Boolean(m[e])}),[e,m]),handleSaveQuizQuestion:q,handleDeleteQuizQuestion:E,savedQuizQuestionsMap:m,fetchAndStoreSavedQuizQuestions:N,savedQuizQuestionsData:p}}},40048:function(e,t,n){"use strict";n.d(t,{K:function(){return x}});var r=n(47568),s=n(26042),i=n(10253),o=n(97582),a=n(67294),u=n(19201),l=n(47041),c=n(96076),d=n(7386),f=n(11163),v=n(89885),m=n(96486),h="appx:saved-questions-map";function g(e){return e&&"object"===typeof e?Object.fromEntries(Object.entries(e).map((function(e){var t=(0,i.Z)(e,2),n=t[0],r=t[1];return[String(n),Boolean(r)]}))):{}}function p(){try{var e=localStorage.getItem(c.dA.SAVED_QUESTIONS_MAP);return e?g(JSON.parse(e)):{}}catch(t){return console.error("Error parsing saved questions:",t),{}}}var x=function(e,t,n){var x=(0,a.useContext)(v.Z).appConfig,b=(0,a.useState)({}),y=b[0],_=b[1],j=(0,a.useState)([]),w=j[0],N=j[1],S=(0,a.useState)(!0),q=S[0],E=S[1],A=((0,f.useRouter)(),(0,a.useCallback)((function(e){var t=function(e){var t=g(e);return 0===Object.keys(t).length?localStorage.removeItem(c.dA.SAVED_QUESTIONS_MAP):localStorage.setItem(c.dA.SAVED_QUESTIONS_MAP,JSON.stringify(t)),window.dispatchEvent(new CustomEvent(h,{detail:t})),t}(e);_(t)}),[])),z=function(){var e=(0,r.Z)((function(){var e,t,n,r,s,i;return(0,o.__generator)(this,(function(o){switch(o.label){case 0:if(e=(0,l.getCookie)(c.z1),(0,m.isEmpty)(x.web_menuitems)||!(0,m.some)(x.web_menuitems,{type:"SAVED_QUESTION"}))return[2];o.label=1;case 1:return o.trys.push([1,3,4,5]),[4,(0,d.mP)({baseURL:e,signal:AbortSignal})];case 2:return 200===(null===(n=o.sent())||void 0===n||null===(t=n.data)||void 0===t?void 0:t.status)&&Array.isArray(n.data.data)?(r=n.data.data,N(r),s={},r.forEach((function(e){null!=(null===e||void 0===e?void 0:e.id)&&(s[String(e.id)]=!0)})),A(s)):console.error("Error fetching saved questions"),[3,5];case 3:return i=o.sent(),console.error("Error fetching saved questions:",i),[3,5];case 4:return E(!1),[7];case 5:return[2]}}
1))}));return function(){return e.apply(this,arguments)}}();(0,a.useEffect)((function(){var e=function(){var e=(0,r.Z)((function(){var e;return(0,o.__generator)(this,(function(t){switch(t.label){case 0:return e=p(),Object.keys(e).length>0?(_(e),E(!1),[3,3]):[3,1];case 1:return[4,z()];case 2:t.sent(),t.label=3;case 3:return[2]}}))}));return function(){return e.apply(this,arguments)}}();e()}),[]),(0,a.useEffect)((function(){var e=function(e){var t=e.detail;_(g(t))},t=function(e){e.key===c.dA.SAVED_QUESTIONS_MAP&&_(p())};return window.addEventListener(h,e),window.addEventListener("storage",t),function(){window.removeEventListener(h,e),window.removeEventListener("storage",t)}}),[]);var k=function(){var a=(0,r.Z)((function(){var r,a,f,v,h,g,b,y,_;return(0,o.__generator)(this,(function(o){switch(o.label){case 0:if(!e||!t||!n)return u.A.error("Missing required data to save the question.",{autoClose:1e3}),[2];if(r=String(e),a=(0,l.getCookie)(c.z1),(0,m.isEmpty)(x.web_menuitems)||!(0,m.some)(x.web_menuitems,{type:"SAVED_QUESTION"}))return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,(0,d.iy)({questionId:r,testSeriesId:t,testId:n,baseURL:a})];case 2:return 200===(null===(f=o.sent())||void 0===f?void 0:f.status)&&(null===f||void 0===f?void 0:f.data)?(b=null!==(g=null!==(h=f.data[r])&&void 0!==h?h:f.data[e])&&void 0!==g?g:null===(v=Object.entries(f.data).find((function(e){var t=(0,i.Z)(e,1)[0];return String(t)===r})))||void 0===v?void 0:v[1],y=(0,s.Z)({},p()),b?y[r]=!0:delete y[r],A(y),u.A.success(b?"Added to saved questions":"Removed from saved questions",{autoClose:1e3})):u.A.info((null===f||void 0===f?void 0:f.message)||"Could not update saved status.",{autoClose:1e3}),[3,4];case 3:return _=o.sent(),console.error("Error while saving question:",_),u.A.error("Error while saving question.",{autoClose:1e3}),[3,4];case 4:return[2]}}
1))}));return function(){return a.apply(this,arguments)}}(),C=(0,m.debounce)(k,500),I=function(){var e=(0,r.Z)((function(e,t,n){var r,i,a,f,v;return(0,o.__generator)(this,(function(o){switch(o.label){case 0:if(!e||!t||!n)return u.A.error("No question ID provided for deletion.",{autoClose:1e3}),[2];if((0,m.isEmpty)(x.web_menuitems)||!(0,m.some)(x.web_menuitems,{type:"SAVED_QUESTION"}))return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),r=(0,l.getCookie)(c.z1),i=String(e),[4,(0,d.iy)({questionId:i,testSeriesId:t,testId:n,baseURL:r})];case 2:return 200===(null===(a=o.sent())||void 0===a?void 0:a.status)&&(null===a||void 0===a?void 0:a.data)?(delete(f=(0,s.Z)({},p()))[i],A(f),u.A.success("Question deleted from saved questions.",{autoClose:1e3})):u.A.info((null===a||void 0===a?void 0:a.message)||"Could not delete the saved question.",{autoClose:1e3}),[3,4];case 3:return v=o.sent(),console.error("Error while deleting saved question:",v),u.A.error("Error while deleting saved question.",{autoClose:1e3}),[3,4];case 4:return[2]}}
1))}));return function(t,n,r){return e.apply(this,arguments)}}();return{loading:q,isSaved:(0,a.useMemo)((function(){return!!e&&Boolean(y[String(e)])}),[e,y]),handleSaveQuestion:C,handleDeleteQuestion:I,getAllSavedQuestions:function(){return Object.values(y)},savedQuestionsMap:y,fetchAndStoreSavedQuestions:z,savedQuestionsData:w}}},27952:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSP:function(){return D},default:function(){return F}});var r=n(85893),s=n(11163),i=n(67294),o=n(40048),a=n(7386),u=n(13348),l=n(83609),c=n(47568),d=n(97582),f=n(35895),v=n(35739),m=n(70499),h=n(19201),g=n(62461),p=n(29815),x=n(23302),b=n(89508),y=n(20291),_=n(8971),j=n(58533),w=n(47041),N=n(96076),S=n(23203),q=n(64998),E=(0,g.cn)("text-sm leading-snug text-inherit","[&_p]:m-0 [&_p]:inline","[&_ol]:m-0 [&_ul]:m-0 [&_li]:inline [&_li]:mr-1","[&_img]:hidden [&_table]:hidden","[&_sup]:align-super [&_sup]:text-[0.7em]");function A(e){var t=e.index,n=e.question,s=e.active,i=e.onSelect,o=e.onUnsave,a=(0,x.J)();return(0,r.jsxs)(y.E.div,{initial:!a&&{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.3,ease:[.16,1,.3,1],delay:t%10*.03},className:"group relative",children:[(0,r.jsxs)("button",{type:"button",onClick:i,"aria-current":s||void 0,className:(0,g.cn)("flex w-full items-center gap-3 rounded-none py-2.5 pl-3 pr-16 text-left transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",s?"bg-primary/5":"hover:bg-accent/50"),children:[s&&(0,r.jsx)("span",{className:"absolute inset-y-1.5 left-0 w-1 rounded-full bg-primary","aria-hidden":"true"}),(0,r.jsx)("span",{className:(0,g.cn)("flex size-7 shrink-0 items-center justify-center rounded-full text-xs font-bold tabular-nums transition-colors",s?"bg-background text-primary shadow-sm":"bg-muted text-muted-foreground"),children:t+1}),(0,r.jsx)("span",{className:(0,g.cn)("min-w-0 flex-1 break-words text-sm leading-snug",s?"font-semibold text-foreground":"font-medium text-foreground/80"),children:(0,r.jsx)("span",{className:(0,g.cn)("line-clamp-2",E),dangerouslySetInnerHTML:{__html:n}})})]}),(0,r.jsxs)("div",{className:"pointer-events-none absolute right-2 top-1/2 flex -translate-y-1/2 items-center gap-1",children:[(0,r.jsxs)("button",{type:"button",onClick:function(e){e.stopPropagation(),o()},title:"Saved \u2014 remove from your saved questions",className:"pointer-events-auto flex size-7 items-center justify-center rounded-md text-primary transition-colors hover:text-primary/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,r.jsx)(S.Z,{className:"h-4 w-4","aria-hidden":"true"}),(0,r.jsx)("span",{className:"sr-only",children:"Saved. Remove this question from your saved questions."})]}),(0,r.jsx)(q.Z,{className:(0,g.cn)("h-4 w-4 shrink-0 transition-opacity duration-200",s?"text-primary opacity-100":"text-muted-foreground opacity-0 group-hover:opacity-60"),"aria-hidden":"true"})]})]})}var z=(0,g.cn)("text-sm leading-6 text-foreground/90","[&_p]:mb-2 [&_p:last-child]:mb-0","[&_ol]:mb-0 [&_ol]:mt-2.5 [&_ol]:list-[upper-alpha] [&_ol]:space-y-1 [&_ol]:pl-5","[&_ul]:mb-0 [&_ul]:mt-2.5 [&_ul]:list-disc [&_ul]:space-y-1 [&_ul]:pl-5","[&_li]:marker:font-bold [&_li]:marker:text-muted-foreground","[&_img]:my-2.5 [&_img]:max-w-full [&_img]:rounded-lg [&_img]:border [&_img]:border-border","[&_table]:my-2.5 [&_table]:w-full [&_table]:border-collapse [&_table]:text-xs","[&_th]:border [&_th]:border-border [&_th]:bg-muted [&_th]:p-2 [&_th]:text-left [&_th]:font-bold","[&_td]:border [&_td]:border-border [&_td]:p-2","[&_blockquote]:my-2.5 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-3 [&_blockquote]:italic [&_blockquote]:text-muted-foreground","[&_sup]:align-super [&_sup]:text-[0.7em]");function k(e){var t=e.count,n=void 0===t?2:t;return(0,r.jsx)("div",{"aria-hidden":"true",children:Array.from({length:n},(function(e,t){return(0,r.jsxs)("div",{className:"mb-3 animate-pulse rounded-xl border border-border bg-card p-4 pr-14",children:[(0,r.jsx)("div",{className:"mb-1 flex h-4 items-center",children:(0,r.jsx)("div",{className:"h-2.5 w-16 rounded bg-muted"})}),(0,r.jsx)("div",{className:"mb-3 flex h-5 items-center",children:(0,r.jsx)("div",{className:"h-3 w-2/3 rounded bg-muted"})}),(0,r.jsxs)("div",{className:"space-y-3 overflow-hidden",style:{height:120},children:[(0,r.jsx)("div",{className:"h-3 w-full rounded bg-muted"}),(0,r.jsx)("div",{className:"h-3 w-11/12 rounded bg-muted"}),(0,r.jsx)("div",{className:"h-3 w-4/5 rounded bg-muted"})]})]},t)}))})}function C(e){var t=e.section,n=e.fetchFunction,s=e.getRoutePath,o=e.getTitle,a=e.onEmpty,u=e.selectedId,l=e.deletedIds,f=e.onSelect,v=e.onRequestUnsave,m=(0,i.useRef)(null),h=(0,x.J)(),S=(0,i.useState)(!1),q=S[0],E=S[1],z=(0,i.useState)([]),C=z[0],I=z[1],Z=(0,i.useState)(!1),R=Z[0],Q=Z[1],U=(0,i.useState)(!1),P=U[0],T=U[1],O=(0,i.useState)(!0),M=O[0],D=O[1],F=(0,i.useState)(0),V=F[0],L=F[1],J=(0,i.useRef)(!1);(0,i.useEffect)((function(){C.length>0&&(J.current=!0)}),[C.length]);var B=(0,i.useCallback)(function(){var e=(0,c.Z)((function(e){var r,s,i,o,a,u,l;return(0,d.__generator)(this,(function(c){switch(c.label){case 0:null===(r=m.current)||void 0===r||r.abort(),s=new AbortController,m.current=s,c.label=1;case 1:return c.trys.push([1,3,,4]),o=(0,w.getCookie)(N.z1),[4,n(o,e,t.section_id,s.signal)];case 2:return 200===(null===(a=c.sent())||void 0===a||null===(i=a.data)||void 0===i?void 0:i.status)&&Array.isArray(a.data.data)?0===(u=a.data.data).length?(D(!1),[2,[]]):[2,u]:(D(!1),[2,[]]);case 3:return l=c.sent(),console.error("Failed to fetch questions for section",t.section_id,l),D(!1),[2,[]];case 4:return[2]}}
1))}));return function(t){return e.apply(this,arguments)}}(),[n,t.section_id]),W=function(){var e=(0,c.Z)((function(){var e,t;return(0,d.__generator)(this,(function(n){switch(n.label){case 0:return E(e=!q),!e||P?[3,2]:(Q(!0),[4,B(0)]);case 1:t=n.sent(),I(t),L(t.length),T(!0),Q(!1),n.label=2;case 2:return[2]}}))}));return function(){return e.apply(this,arguments)}}(),H=function(){var e=(0,c.Z)((function(){var e,t;return(0,d.__generator)(this,(function(n){switch(n.label){case 0:return M?[4,B(V)]:[2];case 1:return 0===(e=n.sent()).length?(D(!1),[2]):(t=0,I((function(n){var r=new Set(n.map((function(e){return e.id}))),s=e.filter((function(e){return!r.has(e.id)&&!l.has(e.id)}));return t=s.length,(0,p.Z)(n).concat((0,p.Z)(s))})),L((function(e){return e+t})),0===t&&D(!1),[2])}}))}));return function(){return e.apply(this,arguments)}}();return(0,i.useEffect)((function(){0!==l.size&&I((function(e){var t=e.filter((function(e){return!l.has(e.id)}));return t.length===e.length?e:t}))}),[l]),(0,i.useEffect)((function(){P&&J.current&&0===C.length&&a()}),[C.length,P,a]),(0,r.jsxs)("div",{className:"border-b border-border last:border-b-0",children:[(0,r.jsxs)("button",{type:"button",onClick:W,"aria-expanded":q,className:"flex w-full items-center justify-between gap-3 rounded-md px-2.5 py-2.5 text-left transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:[(0,r.jsx)("span",{className:"min-w-0 truncate text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:t.section_title}),(0,r.jsx)(_.Z,{className:(0,g.cn)("h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-300",q&&"rotate-180"),"aria-hidden":"true"})]}),(0,r.jsx)(b.M,{initial:!1,children:q&&(0,r.jsx)(y.E.div,{initial:!h&&{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:h?void 0:{height:0,opacity:0},transition:{duration:.28,ease:[.16,1,.3,1]},className:"overflow-hidden",children:(0,r.jsx)("div",{className:"pb-2",children:R?(0,r.jsx)(k,{count:2}):0===C.length?(0,r.jsx)("p",{className:"mb-0 py-8 text-center text-sm text-muted-foreground",children:"No questions in this section."}):(0,r.jsx)(j.Z,{dataLength:C.length,next:H,hasMore:M,style:{overflow:"visible"},loader:(0,r.jsx)(k,{count:1}),children:C.map((function(e,n){return(0,r.jsx)(A,{index:n,question:e.question,active:u===e.id,onSelect:function(){return f({question:e,index:n,total:C.length,title:o(e),getRoutePath:function(e){return s(e,t.section_id)}})},onUnsave:function(){return v(e)}},e.id)}))})})})})]})}var I=n(85030);function Z(e){var t=e.sections,n=e.fetchFunction,s=e.getRoutePath,o=e.getTitle,a=e.selectedId,u=e.deletedIds,l=e.onSelect,c=e.onRequestUnsave,d=(0,i.useState)((function(){return new Set(t.map((function(e){return e.section_id})))})),f=d[0],v=d[1],m=t.filter((function(e){return f.has(e.section_id)}));return 0===m.length?(0,r.jsx)(I.Z,{}):(0,r.jsx)("div",{children:m.map((function(e){return(0,r.jsx)(C,{section:e,onEmpty:function(){return t=e.section_id,void v((function(e){var n=new Set(e);return n.delete(t),n}));var t},fetchFunction:n,getRoutePath:s,getTitle:o,selectedId:a,deletedIds:u,onSelect:l,onRequestUnsave:c},e.section_id)}))})}function R(e){var t,n=e.type,s=e.fetchFunction,o=e.sections,a=e.getRoutePath,u=e.getTitle,l=e.selectedId,f=e.deletedIds,v=e.onSelect,m=e.onRequestUnsave,h=(0,i.useRef)(null),g=(0,i.useRef)(null),x=o&&o.length>0,b=(0,i.useState)(null),y=b[0],_=b[1],S=(0,i.useState)([]),q=S[0],E=S[1],z=(0,i.useState)(!x),C=z[0],Z=z[1],R=(0,i.useState)(!1),Q=R[0],U=R[1],P=(0,i.useState)(!0),T=P[0],O=P[1],M=(0,i.useState)(0),D=M[0],F=M[1],V=(0,i.useCallback)(function(){var e=(0,c.Z)((function(e,t){var r,i,o,a,u,l,c;return(0,d.__generator)(this,(function(d){switch(d.label){case 0:null===(r=h.current)||void 0===r||r.abort(),i=new AbortController,h.current=i,d.label=1;case 1:return d.trys.push([1,3,,4]),a=(0,w.getCookie)(N.z1),[4,s(a,e,t,i.signal)];case 2:return 200===(null===(u=d.sent())||void 0===u||null===(o=u.data)||void 0===o?void 0:o.status)&&Array.isArray(u.data.data)?0===(l=u.data.data).length?(O(!1),[2,[]]):[2,l]:(O(!1),[2,[]]);case 3:return c=d.sent(),console.error("Failed to fetch saved ".concat(n," questions"),c),O(!1),[2,[]];case 4:return[2]}}
1))}));return function(t,n){return e.apply(this,arguments)}}(),[s,n]),L=function(){var e=(0,c.Z)((function(e){var t;return(0,d.__generator)(this,(function(n){switch(n.label){case 0:return Z(!0),O(!0),E([]),[4,V(0,e)];case 1:return t=n.sent(),E(t),F(t.length),U(!0),Z(!1),[2]}}))}));return function(t){return e.apply(this,arguments)}}(),J=function(){var e=(0,c.Z)((function(){var e,t;return(0,d.__generator)(this,(function(n){switch(n.label){case 0:return T?[4,V(D,g.current)]:[2];case 1:return 0===(e=n.sent()).length?(O(!1),[2]):(t=0,E((function(n){var r=new Set(n.map((function(e){return e.id}))),s=e.filter((function(e){return!r.has(e.id)&&!f.has(e.id)}));return t=s.length,(0,p.Z)(n).concat((0,p.Z)(s))})),F((function(e){return e+t})),0===t&&O(!1),[2])}}))}));return function(){return e.apply(this,arguments)}}();return(0,i.useEffect)((function(){return x||L(null),function(){var e;return null===(e=h.current)||void 0===e?void 0:e.abort()}}),[]),(0,i.useEffect)((function(){0!==f.size&&E((function(e){var t=e.filter((function(e){return!f.has(e.id)}));return t.length===e.length?e:t}))}),[f]),(0,r.jsxs)(r.Fragment,{children:[x&&(0,r.jsxs)("select",{className:"mb-4 w-full rounded-lg border border-border bg-card px-3 py-2 text-sm font-medium text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring md:w-auto",value:null!==y&&void 0!==y?y:"",onChange:function(e){return t=e.target.value||null,g.current=t,_(t),void(t&&L(t));var t},children:[(0,r.jsx)("option",{value:"",children:"Select a section"}),o.map((function(e){return(0,r.jsxs)("option",{value:e.section_id,children:[e.section_title," (",e.question_count,")"]},e.section_id)}))]}),C?(0,r.jsx)(k,{count:3}):Q?0===q.length?(0,r.jsx)(I.Z,{}):(0,r.jsx)(j.Z,{dataLength:q.length,next:J,hasMore:T,style:{overflow:"visible"},loader:(0,r.jsx)(k,{count:1}),children:q.map((function(e,n){return(0,r.jsx)(A,{index:n,question:e.question,active:l===e.id,onSelect:function(){return v({question:e,index:n,total:q.length,title:u(e),getRoutePath:function(e){return a(e,null!==(t=g.current)&&void 0!==t?t:void 0)}})},onUnsave:function(){return m(e)}},e.id)}))}):(0,r.jsx)(I.Z,{})]})}var Q=n(82701),U=n(95034),P=(0,i.forwardRef)((function(e,t){var n,i=e.selection,o=e.onRequestUnsave,a=(0,s.useRouter)();if(!i)return(0,r.jsxs)("div",{ref:t,className:"flex min-h-[280px] flex-col items-center justify-center rounded-2xl border border-dashed border-border bg-card px-6 py-16 text-center",children:[(0,r.jsx)("span",{className:"mb-3 flex size-12 items-center justify-center rounded-full bg-muted text-muted-foreground",children:(0,r.jsx)(S.Z,{className:"h-6 w-6","aria-hidden":"true"})}),(0,r.jsx)("p",{className:"mb-1 text-sm font-semibold text-foreground",children:"Select a question to preview"}),(0,r.jsx)("p",{className:"max-w-xs text-sm text-muted-foreground",children:"Pick any saved question from the list to see its details here."})]});var u=i.question,l=i.index,c=i.total,d=i.title,f=i.getRoutePath,m=[u.subject,u.topic,u.concept].filter((function(e){return"string"===typeof e&&e.trim().length>0}));return(0,r.jsxs)("div",{ref:t,className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"relative rounded-2xl border border-border bg-card p-5 pr-14 sm:p-6 sm:pr-16",children:[(0,r.jsxs)("button",{type:"button",onClick:function(){return o(u)},title:"Saved \u2014 remove from your saved questions",className:"absolute right-4 top-4 flex size-8 items-center justify-center rounded-md text-primary transition-colors hover:text-primary/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,r.jsx)(S.Z,{className:"h-5 w-5","aria-hidden":"true"}),(0,r.jsx)("span",{className:"sr-only",children:"Saved. Remove this question from your saved questions."})]}),(0,r.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[(0,r.jsxs)("span",{className:"inline-flex items-center rounded-full bg-muted px-3 py-1 text-sm font-semibold tabular-nums text-foreground",children:[l+1," of ",c]}),(null===(n=u.subject)||void 0===n?void 0:n.trim())?(0,r.jsx)(U.C,{variant:"muted",size:"sm",children:u.subject}):null]}),(null===d||void 0===d?void 0:d.trim())?(0,r.jsx)("p",{className:"mb-2 line-clamp-1 text-xs font-medium text-muted-foreground",children:d}):null,m.length>0&&(0,r.jsx)("p",{className:"mb-3 flex flex-wrap items-center gap-1.5 text-xs font-medium text-muted-foreground",children:m.map((function(e,t){return(0,r.jsxs)("span",{className:"flex items-center gap-1.5",children:[t>0&&(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground
1/60",children:"\u203a"}),(0,r.jsx)("span",{className:(0,g.cn)(t===m.length-1&&"text-foreground"),children:e})]},t)}))}),(0,r.jsx)("div",{className:(0,g.cn)(z,"text-base font-medium text-foreground md:text-lg"),dangerouslySetInnerHTML:{__html:u.question}})]}),(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsxs)(v.z,{type:"button",onClick:function(){a.push(f(u.id),void 0,{shallow:!0})},children:["Attempt Question",(0,r.jsx)(Q.Z,{"aria-hidden":"true"})]})})]})}));P.displayName="SavedQuestionPreview";var T=P,O=(0,g.cn)("relative -mb-px h-14 rounded-none border-b-[3px] border-r border-b-transparent border-r-border bg-transparent px-8 last:border-r-0","text-base font-medium text-muted-foreground shadow-none transition-colors","hover:text-foreground","data-[state=active]:border-b-primary data-[state=active]:bg-primary/5 data-[state=active]:font-bold data-[state=active]:text-foreground data-[state=active]:shadow-none");function M(e){var t=e.questionAdapter,n=e.quizAdapter,s=e.activeTab,o=e.onTabChange,a=(0,i.useState)(null),u=a[0],l=a[1],g=(0,i.useState)((function(){return new Set})),p=g[0],x=g[1],b=(0,i.useState)(null),y=b[0],_=b[1],j=(0,i.useRef)(null);(0,i.useEffect)((function(){l(null)}),[s]);var w,N,S=function(e){l(e),window.innerWidth<1024&&requestAnimationFrame((function(){var e;null===(e=j.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"})}))},q=function(){var e=(0,c.Z)((function(){var e;return(0,d.__generator)(this,(function(r){switch(r.label){case 0:if(!y)return[2];e=y,_(null),r.label=1;case 1:return r.trys.push([1,6,,7]),"quiz"!==s?[3,3]:[4,n.deleteFunction(e.id,e.quiz_id)];case 2:return r.sent(),[3,5];case 3:return[4,t.deleteFunction(e.id,e.test_series_id,e.test_id)];case 4:r.sent(),r.label=5;case 5:return x((function(t){return new Set(t).add(e.id)})),l((function(t){return(null===t||void 0===t?void 0:t.question.id)===e.id?null:t})),[3,7];case 6:return r.sent(),h.A.error("Failed to delete. Please try again."),[3,7];case 7:return[2]}}
1))}));return function(){return e.apply(this,arguments)}}();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-[minmax(320px,360px)_1fr]",children:[(0,r.jsx)("div",{className:"min-w-0 overflow-hidden rounded-2xl border border-border bg-card",children:(0,r.jsxs)(f.mQ,{value:s,onValueChange:o,activationMode:"manual",className:"w-full",children:[(0,r.jsxs)(f.dr,{className:"h-auto w-full justify-start gap-0 rounded-none border-b border-border bg-transparent p-0",children:[(0,r.jsx)(f.SP,{value:"question",className:O,children:"Questions"}),(0,r.jsx)(f.SP,{value:"quiz",className:O,children:"Quiz"})]}),(0,r.jsx)(f.nU,{forceMount:!0,value:"question",className:"mt-0 py-1 data-[state=inactive]:hidden",children:(0,r.jsx)(Z,{sections:t.sections,fetchFunction:t.fetchFunction,getRoutePath:t.getRoutePath,getTitle:t.getTitle,selectedId:null!==(w=null===u||void 0===u?void 0:u.question.id)&&void 0!==w?w:null,deletedIds:p,onSelect:S,onRequestUnsave:_})}),(0,r.jsx)(f.nU,{forceMount:!0,value:"quiz",className:"mt-0 py-1 data-[state=inactive]:hidden",children:(0,r.jsx)(R,{type:n.type,fetchFunction:n.fetchFunction,getRoutePath:n.getRoutePath,getTitle:n.getTitle,selectedId:null!==(N=null===u||void 0===u?void 0:u.question.id)&&void 0!==N?N:null,deletedIds:p,onSelect:S,onRequestUnsave:_},"quiz")})]})}),(0,r.jsx)("div",{className:"min-w-0 lg:sticky lg:top-6 lg:self-start",children:(0,r.jsx)(T,{ref:j,selection:u,onRequestUnsave:_})})]}),(0,r.jsx)(m.Vq,{open:!!y,onOpenChange:function(e){e||_(null)},children:(0,r.jsxs)(m.cZ,{closeButton:!0,className:"max-w-md",children:[(0,r.jsxs)(m.fK,{children:[(0,r.jsx)(m.$N,{children:"Confirm Delete"}),(0,r.jsx)(m.Be,{children:"Are you sure you want to delete this saved question?"})]}),(0,r.jsxs)(m.cN,{children:[(0,r.jsx)(v.z,{variant:"destructive",onClick:q,children:"Delete"}),(0,r.jsx)(v.z,{variant:"outline",onClick:function(){return _(null)},children:"Cancel"})]})]})})]})}var D=!0;function F(e){var t=e.sections,n=(0,s.useRouter)(),c=n.query.type,d=void 0===c?"question":c,f=(0,o.K)().handleDeleteQuestion,v=(0,u.y)().handleDeleteQuizQuestion,m="quiz"===d?"quiz":"question",h=(0,i.useMemo)((function(){return{sections:t,fetchFunction:function(e,t,n,r){return(0,a.mP)({baseURL:e,start:t,sectionId:n,signal:r})},deleteFunction:f,getRoutePath:function(e,t){return"/saved-question/".concat(e,"/attempt?type=question").concat(t?"&sectionId=".concat(t):"")},getTitle:function(e){return"".concat(e.test_series_title," > Test > ").concat(e.test_title)}}}),[f,t]),g=(0,i.useMemo)((function(){return{type:"quiz",fetchFunction:function(e,t){return(0,a.A_)({baseURL:e,start:t})},deleteFunction:v,getRoutePath:function(e){return"/saved-question/".concat(e,"/attempt?type=quiz")},getTitle:function(e){return"Quiz: ".concat(e.quiz_title||"Untitled Quiz")}}}),[v]);return(0,r.jsxs)("div",{className:"mx-auto w-full max-w-7xl px-4 py-6 sm:px-6 sm:py-8 lg:px-8",children:[(0,r.jsx)(l.Z,{className:"mb-8 gap-0 lg:gap-0",showCategoryRow:!1,breadcrumbs:[{label:"Home",href:"/"},{label:"Saved Questions"}]}),(0,r.jsx)(M,{questionAdapter:h,quizAdapter:g,activeTab:m,onTabChange:function(e){n.push("/saved-question?type=".concat(e),void 0,{shallow:!0})}})]})}}},function(e){e.O(0,[2177,3609,9774,2888,179],(function(){return t=83712,e(e.s=t);var t}));var t=e.O();_N_E=t}]);

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.