PageSourceSearch

https://app.memrise.com/_next/static/chunks/pages/aprender/grammar-7c86d59e641cf9e5.js

js memrise.com collected 2026-09-24 08:27:07 UTC 67,050 bytes, 2 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9537],{15785:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r="/_next/static/audios/be633aa1d63996dba16fba6c21d35297.mp3"},25022:(e,t,n)=>{"use strict";n.d(t,{K:()=>l});var r=n(61542),a=n(2553),o=n(5646),i=o.Ay.div.withConfig({componentId:"sc-zjxmey-0"})(function(e){var t=e.theme,n=e.$disabled;return(0,o.AH)(["padding:0;display:flex;align-items:center;gap:",";",";cursor:pointer;color:",";"],t.sz.s2,t.typography.paragraph.m,n?t.co.secondary50:t.co.secondary0)}),s=o.Ay.button.withConfig({componentId:"sc-zjxmey-1"})(function(e){var t=e.theme,n=e.$disabled,r=e.$inverseColors,a=e.$pressed,i=e.$textInside;return(0,o.AH)(["cursor:pointer;border-radius:50%;border:none;width:",";height:",";padding:0;background-color:",";color:",";text-align:-webkit-center;&:hover{background-color:",";}"," ",";",";& svg{font-size:",";}"],t.sz.s8,t.sz.s8,t.co.neutral98,n?t.co.secondary50:t.co.secondary0,t.co.neutral95,r&&(0,o.AH)(["background-color:",";&:hover{background-color:",";}"],n?t.co.neutral98:t.co.primary20,n?t.co.neutral95:t.co.primary40),a&&(0,o.AH)(["background-color:",";border:"," solid ",";&:hover{background-color:",";}"],t.co.primary90,t.bo.thinWidth,t.co.primary20,t.co.primary90),i&&(0,o.AH)(["display:flex;align-items:center;width:auto;padding:",";gap:",";border-radius:",";border:"," solid ",";",";"],t.sz.s2,t.sz.s2,t.bo.medium,t.bo.thinWidth,a?t.co.primary20:t.co.neutral95,t.typography.paragraph.base),t.sz.s5)}),c=n(37876),l=function(e){var t=e.disabled,n=void 0!==t&&t,o=e.handleClick,l=e.ariaLabel,d=e.icon,u=e.text,p=e.className,m=e.inverseColors,h=e.pressed,f=void 0!==h&&h,g=e.children,x=function(){n||o()};return(0,c.jsxs)(i,{$disabled:n,onClick:x,children:[(0,c.jsxs)(s,{onClick:function(){return!u&&x},onKeyDown:function(e){n||("Enter"===e.key||" "===e.key)&&(e.preventDefault(),o())},"aria-label":l,"aria-disabled":n,"aria-pressed":f,disabled:n,className:p,$disabled:n,$inverseColors:void 0!==m&&m,$pressed:f,$textInside:!!g,children:[(0,r.Ay)(d)?(0,c.jsx)(a.A,{name:d}):d,g]}),u]})}},47673:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r="/_next/static/audios/03b2b576c717394705349725d47a1852.mp3"},74024:(e,t,n)=>{"use strict";n.d(t,{jQ:()=>i});var r=n(42969),a=/[\u0300-\u036F]/,o=function(e){if("string"!=typeof e||!e)return!1;try{return a.test(e.normalize("NFD"))}catch(e){return!1}},i=function(e){return o(e)?(0,r.A)({},"data-romanization","true"):{}}},79407:(e,t,n)=>{"use strict";n.d(t,{VY:()=>s,aH:()=>c,hE:()=>i,mc:()=>o,yp:()=>l});var r=n(5646),a=n(90316),o=r.Ay.div.withConfig({componentId:"sc-rj5hlc-0"})(function(e){var t=e.theme;return(0,r.AH)(["display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:",";padding:"," ",";min-height:60vh;width:100%;"],t.sz.s4,t.sz.s6,t.sz.s4)}),i=r.Ay.h1.withConfig({componentId:"sc-rj5hlc-1"})(function(e){var t=e.theme;return(0,r.AH)(["",";color:",";margin:0;@media (max-width:","){",";}"],t.typography.heading.desktop.m,t.co.neutral10,t.sz.lg,t.typography.heading.mobile.m)}),s=r.Ay.p.withConfig({componentId:"sc-rj5hlc-2"})(function(e){var t=e.theme;return(0,r.AH)(["",";color:",";margin:0;max-width:28rem;"],t.typography.paragraph.m,t.co.neutral40)}),c=(0,r.Ay)(a.A).withConfig({componentId:"sc-rj5hlc-3"})(function(e){var t=e.theme;return(0,r.AH)(["width:",";"],t.sz.s12)}),l=r.Ay.div.withConfig({componentId:"sc-rj5hlc-4"})(function(e){var t=e.theme;return(0,r.AH)(["display:flex;flex-direction:column;gap:",";width:100%;max-width:20rem;margin-top:",";"],t.sz.s3,t.sz.s2)})},85746:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/aprender/grammar",function(){return n(89524)}])},89524:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>tJ});var r=n(5720),a=n(77328),o=n.n(a),i=n(64191),s=n(42969),c=n(44478),l=n(63857),d=n(60180),u=n.n(d),p=n(14232),m=n(89099),h=n(74359),f=n(26900),g=n(68567),x=n(47019),y=n(53403),v=n(48278),b=n(70610),w=n(61542),A=n(47673),C=n(5646),k=C.Ay.section.withConfig({componentId:"sc-h0oakc-0"})(function(e){var t=e.theme;return(0,C.AH)(["max-width:none;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:",";width:100%;min-height:",";text-align:center;padding:"," 0;p,h1,h2,h3,h4{max-width:none;}
1"],t.sz.s4,t.sz.s48,t.sz.s8)}),j=C.Ay.h2.withConfig({componentId:"sc-h0oakc-1"})(function(e){var t=e.theme;return(0,C.AH)(["",";margin:0;color:",";@media (max-width:","){",";}"],t.typography.heading.desktop.l,t.co.neutral10,t.sz.lg,t.typography.heading.mobile.l)}),I=C.Ay.p.withConfig({componentId:"sc-h0oakc-2"})(function(e){var t=e.theme;return(0,C.AH)(["",";margin:0;color:",";max-width:",";"],t.typography.paragraph.m,t.co.neutral40,t.sz.xxl)}),z=C.Ay.div.withConfig({componentId:"sc-h0oakc-3"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:",";width:100%;"],t.sz.s3)}),_=n(37876),T=(0,r.YK)({title:{id:"grammar_session_complete_title",defaultMessage:"Nice work!"},description:{id:"grammar_session_complete_description",defaultMessage:"You’ve finished this grammar session."},doAnother:{id:"grammar_session_complete_do_another",defaultMessage:"Do another one"},leave:{id:"grammar_session_complete_leave",defaultMessage:"Leave session"}}),S=function(e){var t=e.onDoAnother,n=e.onLeave,a=e.isLeaving,o=void 0!==a&&a,i=(0,r.tz)();return(0,_.jsxs)(k,{"data-testid":"grammar-complete",children:[(0,_.jsx)("audio",{autoPlay:!0,preload:"auto",src:A.A,"data-testid":"grammar-complete-celebration-sound"}),(0,_.jsx)(j,{children:i.formatMessage(T.title)}),(0,_.jsx)(I,{children:i.formatMessage(T.description)}),(0,_.jsxs)(z,{children:[(0,_.jsx)(w.$n,{buttonType:"secondary",buttonSize:"large",onClick:t,disabled:o,"data-testid":"grammar-complete-do-another",children:i.formatMessage(T.doAnother)}),(0,_.jsx)(w.$n,{buttonType:"primary",buttonSize:"large",onClick:function(){n()},loading:o,disabled:o,"data-testid":"grammar-complete-leave",children:i.formatMessage(T.leave)})]})]})},M=n(14780);function H(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?H(Object(n),!0).forEach(function(t){(0,s.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):H(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var P=RegExp("[^\\p{L}\\p{N}\\s']","gu"),E=function(e){return e.trim().toLowerCase().replace(/[’‘']/g,"'").replace(P,"").replace(/\s+/g," ").trim()},q=function(e,t){return E(e)===E(t)},W=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:300,r=e&&t-e.lastClickAt<n?e.clickCount+1:1;return{lastClickAt:t,clickCount:r}},D=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(e===t)return e;var r=(0,c.A)(e),a=(0,c.A)(t),o=r.findIndex(function(e,t){return e!==a[t]}),i=o>=0?r.slice(0,o):r;if(i.length>=a.length)return t;var s=Math.max(1,n);return[].concat((0,c.A)(i),(0,c.A)(a.slice(i.length,i.length+s))).join("")},L=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Math.random,n=(0,c.A)(e),r=n.length-1;r>0;r--){var a=Math.floor(t()*(r+1)),o=n[r];n[r]=n[a],n[a]=o}return n},$=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Math.random;return L(e,n).slice(0,Math.min(t,e.length))},N=function(e){var t=e.concepts,n=e.translationsByConceptId,r=e.excludeConceptId,a=e.maxConcepts,o=e.translationsPerConcept,i=void 0===o?2:o,s=e.random,c=void 0===s?Math.random:s;return $(t.filter(function(e){return e.alreadySeen&&e.id!==r}),void 0===a?3:a,c).flatMap(function(e){var t,r=null!=(t=n[e.id])?t:[];if(0===r.length)return[];var a=$(r,i,c);return[{conceptId:e.id,title:e.title,translations:a.map(function(t){return O(O({},t),{},{id:"recap-".concat(e.id,"-").concat(t.id)})})}]})},B=function(e,t){switch(t){case 1:return e.co.success40;case 2:return e.co.success50;case 3:return e.co.warning60;case 4:return e.co.warning50;case 5:return e.co.warning40;case 6:return e.co.warning30;case 7:return e.co.warning20;case 8:return e.co.error60;case 9:return e.co.error50;default:return e.co.error40}},F=C.Ay.div.withConfig({componentId:"sc-zqj2jx-0"})(function(e){var t=e.theme;return(0,C.AH)(["width:100%;max-width:",";min-width:0;margin-top:",";> div{width:100%;}> div >
1 span{display:block;width:100%;}"],t.sz.s48,t.sz.s1)}),K=C.Ay.div.withConfig({componentId:"sc-zqj2jx-1"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;align-items:center;width:100%;min-width:0;gap:",";height:",";"],t.sz.s1,t.sz.s2)}),Y=C.Ay.div.withConfig({componentId:"sc-zqj2jx-2"})(function(e){var t=e.theme,n=e.$filled,r=e.$filledCount;return(0,C.AH)(["flex:1;min-width:0;height:100%;border-radius:",";background-color:",";transition:background-color 0.2s ease;"],t.bo.round,n?B(t,r):t.co.neutral90)}),R=(0,r.YK)({difficulty:{id:"grammar_session_concept_difficulty",defaultMessage:"Difficulty"},label:{id:"grammar_session_concept_complexity",defaultMessage:"Difficulty: {filled} of {total}"}}),G=function(e){var t=e.complexity,n=e.testId,a=(0,r.tz)(),o=Math.min(10,Math.floor(Math.min(100,Math.max(0,t))/10)+1),i=a.formatMessage(R.difficulty);return(0,_.jsx)(F,{children:(0,_.jsx)(M.m,{placement:"top",tooltip:i,children:(0,_.jsx)(K,{role:"meter","aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":o,"aria-label":a.formatMessage(R.label,{filled:o,total:10}),"data-testid":null!=n?n:"grammar-complexity-meter","data-filled":o,children:Array.from({length:10},function(e,t){var n=t<o;return(0,_.jsx)(Y,{$filled:n,$filledCount:o,"data-testid":"grammar-complexity-segment-".concat(t),"data-filled":n?"true":"false"},t)})})})})},V=n(2553),U=n(66185),J=C.Ay.section.withConfig({componentId:"sc-1yqmvq3-0"})(function(e){var t=e.theme;return(0,C.AH)(["max-width:none;display:flex;flex-direction:column;gap:",";width:100%;p,ul,ol,li,h1,h2,h3,h4,span{max-width:none;}"],t.sz.s6)}),X=C.Ay.div.withConfig({componentId:"sc-1yqmvq3-1"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;flex-direction:column;gap:",";"],t.sz.s2)}),Q=C.Ay.h2.withConfig({componentId:"sc-1yqmvq3-2"})(function(e){var t=e.theme;return(0,C.AH)(["",";margin:0;color:",";@media (max-width:","){",";}"],t.typography.heading.desktop.m,t.co.neutral10,t.sz.lg,t.typography.heading.mobile.m)}),Z=C.Ay.div.withConfig({componentId:"sc-1yqmvq3-3"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;flex-direction:column;gap:",";"],t.sz.s3)}),ee=C.Ay.div.withConfig({componentId:"sc-1yqmvq3-4"})(function(e){var t=e.theme,n=e.$alreadySeen;return(0,C.AH)(["display:flex;align-items:center;gap:",";width:100%;text-align:left;padding:",";border-radius:",";border:"," solid ",";background-color:",";color:",";transition:border-color 0.15s ease,background-color 0.15s ease;&:hover{border-color:",";background-color:",";}"],t.sz.s3,t.sz.s5,t.bo.medium,t.bo.thinWidth,n?t.co.success70:t.co.secondary80,n?t.co.success95:t.co.neutral95,t.co.neutral20,n?t.co.success50:t.co.secondary40,n?t.co.success90:t.co.neutral99)}),et=C.Ay.button.withConfig({componentId:"sc-1yqmvq3-5"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;align-items:center;justify-content:space-between;gap:",";flex:1;min-width:0;padding:0;border:none;background:transparent;color:inherit;text-align:left;cursor:pointer;&:focus-visible{outline:"," solid ",";outline-offset:",";border-radius:",";}"],t.sz.s4,t.bo.mediumWidth,t.co.secondary40,t.sz.s1,t.bo.small)}),en=C.Ay.div.withConfig({componentId:"sc-1yqmvq3-6"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;flex-direction:column;gap:",";min-width:0;flex:1;"],t.sz.s2)}),er=C.Ay.div.withConfig({componentId:"sc-1yqmvq3-7"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;align-items:center;gap:",";min-width:0;"],t.sz.s2)}),ea=(0,C.AH)(function(e){var t=e.theme;return(0,C.AH)(["box-sizing:border-box;width:",";height:",";flex-shrink:0;"],t.sz.s6,t.sz.s6)}),eo=C.Ay.div.withConfig({componentId:"sc-1yqmvq3-8"})(function(e){var t=e.theme;return(0,C.AH)(["",";position:relative;display:inline-flex;align-items:center;justify-content:center;> div,> div > span{display:inline-flex;width:",";height:",";align-items:center;justify-content:center;}"],ea,t.sz.s6,t.sz.s6)}),ei=(0,C.Ay)(V.A).withConfig({componentId:"sc-1yqmvq3-9"})(function(e){var t=e.theme;return(0,C.AH)(["font-size:",";"],t.sz.s6)}),es=C.Ay.button.withConfig({componentId:"sc-1yqmvq3-10"})(function(e){var t=e.theme;return(0,C.AH)(["",";display:inline-flex;align-items:center;justify-content:center;padding:0;border-radius:50%;border:"," solid ",";background-color:transparent;cursor:pointer;transition:border-color 0.15s ease,background-color 0.15s ease,box-shadow 0.15s ease;&:hover:not(:disabled){border-color:",";background-color:",";}&:focus-visible{outline:none;box-shadow:0 0 0 "," ",";}&:disabled{cursor:wait;opacity:0.7;}"],ea,t.bo.mediumWidth,t.co.secondary70,t.co.success50,t.co.success98,t.bo.mediumWidth,t.co.success40)}),ec=C.Ay.button.withConfig({componentId:"sc-1yqmvq3-11"})(function(e){var t=e.theme;return(0,C.AH)(["",";display:inline-flex;align-items:center;justify-content:center;padding:0;border:none;border-radius:50%;background-color:transparent;color:",";cursor:pointer;transition:color 0.15s ease,background-color 0.15s ease,box-shadow 0.15s ease;&:hover:not(:disabled){color:",";background-color:",";}&:focus-visible{outline:none;box-shadow:0 0 0 "," ",";}&:disabled{cursor:wait;opacity:0.7;}"],ea,t.co.success30,t.co.success20,t.co.success90,t.bo.mediumWidth,t.co.success40)}),el=C.Ay.span.withConfig({componentId:"sc-1yqmvq3-12"})(function(){return(0,C.AH)(["position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;"])}),ed=C.Ay.span.withConfig({componentId:"sc-1yqmvq3-13"})(function(e){var t=e.theme;return(0,C.AH)(["",";color:",";@media (max-width:","){",";}"],t.typography.heading.desktop.s,t.co.neutral10,t.sz.lg,t.typography.heading.mobile.s)}),eu=C.Ay.p.withConfig({componentId:"sc-1yqmvq3-14"})(function(e){var t=e.theme;return(0,C.AH)(["",";margin:0;color:",";"],t.typography.paragraph.s,t.co.neutral40)}),ep=C.Ay.span.withConfig({componentId:"sc-1yqmvq3-15"})(function(e){var t=e.theme,n=e.$alreadySeen;return(0,C.AH)(["display:inline-flex;flex-shrink:0;align-items:center;gap:",";color:",";"],t.sz.s1,n?t.co.success20:t.co.secondary30)}),em=C.Ay.span.withConfig({componentId:"sc-1yqmvq3-16"})(function(e){var t=e.theme;return(0,C.AH)(["",";white-space:nowrap;"],t.typography.heading.desktop.xxxs)}),eh=(0,C.Ay)(V.A).withConfig({componentId:"sc-1yqmvq3-17"})(function(e){var t=e.theme;return(0,C.AH)(["font-size:",";
1transform:scaleX(",");"],t.sz.s5,(0,U.g)(t))}),ef=(0,r.YK)({title:{id:"grammar_session_concept_selection_title",defaultMessage:"Choose a grammar concept to study"},study:{id:"grammar_session_concept_study",defaultMessage:"Study"},studyAgain:{id:"grammar_session_concept_study_again",defaultMessage:"Study again"},markAsKnown:{id:"grammar_session_concept_mark_as_known",defaultMessage:"Mark as known"},unmarkAsKnown:{id:"grammar_session_concept_unmark_as_known",defaultMessage:"Unmark as known"}}),eg=function(e){var t=e.concepts,n=e.onSelect,a=e.onMarkAsKnown,o=e.onUnmarkAsKnown,i=e.updatingKnownConceptIds,s=(0,r.tz)(),c=s.formatMessage(ef.markAsKnown),l=s.formatMessage(ef.unmarkAsKnown),d=function(e,t){e.preventDefault(),e.stopPropagation(),a(t)},u=function(e,t){e.preventDefault(),e.stopPropagation(),o(t)};return(0,_.jsxs)(J,{"data-testid":"grammar-concept-selection",children:[(0,_.jsx)(X,{children:(0,_.jsx)(Q,{children:s.formatMessage(ef.title)})}),(0,_.jsx)(Z,{children:t.map(function(e){var t,r=null!=(t=null==i?void 0:i.has(e.id))&&t;return(0,_.jsxs)(ee,{$alreadySeen:e.alreadySeen,"data-testid":"grammar-concept-".concat(e.id),children:[e.alreadySeen?(0,_.jsx)(eo,{children:(0,_.jsx)(M.m,{placement:"top",tooltip:l,children:(0,_.jsx)(ec,{type:"button",disabled:r,onClick:function(t){return u(t,e.id)},"aria-label":l,"data-testid":"grammar-concept-unmark-known-".concat(e.id),children:(0,_.jsx)(ei,{name:"tickFilled","aria-hidden":!0})})})}):(0,_.jsx)(eo,{children:(0,_.jsx)(M.m,{placement:"top",tooltip:c,children:(0,_.jsx)(es,{type:"button",disabled:r,onClick:function(t){return d(t,e.id)},"data-testid":"grammar-concept-mark-known-".concat(e.id),children:(0,_.jsx)(el,{children:c})})})}),(0,_.jsxs)(et,{type:"button",onClick:function(){return n(e.id)},"data-testid":"grammar-concept-select-".concat(e.id),children:[(0,_.jsxs)(en,{children:[(0,_.jsx)(er,{children:(0,_.jsx)(ed,{children:e.title})}),(0,_.jsx)(eu,{children:e.description}),(0,_.jsx)(G,{complexity:e.complexity,testId:"grammar-concept-complexity-".concat(e.id)})]}),(0,_.jsxs)(ep,{$alreadySeen:e.alreadySeen,children:[(0,_.jsx)(em,{children:s.formatMessage(e.alreadySeen?ef.studyAgain:ef.study)}),(0,_.jsx)(eh,{name:"forward"})]})]})]},e.id)})})]})},ex=n(64150),ey=n(31906),ev=n(74024),eb=n(15785),ew=(0,C.i7)(["0%{box-shadow:0 0 0 0 rgba(0,167,120,0.55),0 0 0 0 rgba(0,167,120,0.25);}40%{box-shadow:0 0 0 6px rgba(0,167,120,0.4),0 0 28px 6px rgba(0,167,120,0.5);}100%{box-shadow:0 0 0 0 rgba(0,167,120,0),0 0 0 0 rgba(0,167,120,0);}"]),eA=C.Ay.section.withConfig({componentId:"sc-vko5rf-0"})(function(e){var t=e.theme;return(0,C.AH)(["max-width:none;display:flex;flex-direction:column;gap:",";width:100%;p,ul,ol,li,h1,h2,h3,h4,span,button{max-width:none;}"],t.sz.s6)}),eC=C.Ay.div.withConfig({componentId:"sc-vko5rf-1"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;flex-direction:column;gap:",";"],t.sz.s3)}),ek=C.Ay.h2.withConfig({componentId:"sc-vko5rf-2"})(function(e){var t=e.theme;return(0,C.AH)(["",";margin:0;color:",";@media (max-width:","){",";}"],t.typography.heading.desktop.m,t.co.neutral10,t.sz.lg,t.typography.heading.mobile.m)}),ej=C.Ay.div.withConfig({componentId:"sc-vko5rf-3"})(function(e){var t=e.theme;return(0,C.AH)(["max-width:none;",";margin:0;color:",";line-height:1.5;p,ul,ol,li,h1,h2,h3,h4,blockquote,pre,code,table{max-width:none;}> :first-child{margin-top:0;}> :last-child{margin-bottom:0;}p{margin:0 0 ",";}ul,ol{margin:0 0 ",";padding-left:",";}li{margin:0 0 ",";}h1,h2,h3,h4{margin:"," 0 ",";color:",";}strong{font-weight:700;color:",";}em{font-style:italic;}code{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,'Liberation Mono','Courier New',monospace;font-size:0.95em;padding:0.1em 0.35em;border-radius:",";background-color:",";}pre{margin:0 0 ",";padding:",";overflow-x:auto;border-radius:",";background-color:",";code{padding:0;background:none;}}blockquote{margin:0 0 ",";padding:0 0 0 ",";border-left:"," solid ",";color:",";}a{color:",";text-decoration:underline;}"],t.typography.paragraph.m,t.co.neutral20,t.sz.s3,t.sz.s3,t.sz.s4,t.sz.s1,t.sz.s4,t.sz.s2,t.co.neutral10,t.co.neutral10,t.bo.small,t.co.neutral95,t.sz.
1s3,t.sz.s3,t.bo.medium,t.co.neutral95,t.sz.s3,t.sz.s3,t.bo.mediumWidth,t.co.secondary70,t.co.neutral40,t.co.secondary40)}),eI=C.Ay.div.withConfig({componentId:"sc-vko5rf-4"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;flex-direction:column;gap:",";"],t.sz.s3)}),ez=C.Ay.h3.withConfig({componentId:"sc-vko5rf-5"})(function(e){var t=e.theme;return(0,C.AH)(["",";margin:0;color:",";@media (max-width:","){",";}"],t.typography.heading.desktop.s,t.co.neutral20,t.sz.lg,t.typography.heading.mobile.s)}),e_=C.Ay.p.withConfig({componentId:"sc-vko5rf-6"})(function(e){var t=e.theme;return(0,C.AH)(["",";margin:0;color:",";"],t.typography.paragraph.s,t.co.neutral50)}),eT=C.Ay.div.withConfig({componentId:"sc-vko5rf-7"})(function(e){var t=e.theme;return(0,C.AH)(["max-width:none;display:flex;flex-direction:column;gap:",";width:100%;"],t.sz.s3)}),eS=C.Ay.button.withConfig({componentId:"sc-vko5rf-8"})(function(e){var t=e.theme,n=e.$revealed,r=e.$glowing;return(0,C.AH)(["max-width:none;display:flex;flex-direction:column;align-items:flex-start;gap:",";width:100%;padding:",";border-radius:",";border:"," solid ",";background-color:",";color:inherit;text-align:left;cursor:pointer;transition:background-color 0.2s ease,border-color 0.2s ease;"," &:hover{border-color:",";background-color:",";}&:focus-visible{outline:"," solid ",";outline-offset:",";}"],t.sz.s1,t.sz.s4,t.bo.medium,t.bo.mediumWidth,n?t.co.success40:t.co.secondary90,n?t.co.success95:t.co.neutral95,r&&(0,C.AH)(["animation:"," 0.7s ease-out;"],ew),n?t.co.success40:t.co.secondary70,n?t.co.success95:t.co.neutral99,t.bo.mediumWidth,t.co.success40,t.sz.s1)}),eM=C.Ay.span.withConfig({componentId:"sc-vko5rf-9"})(function(e){var t=e.theme;return(0,C.AH)(["",";color:",";@media (max-width:","){",";}"],t.typography.heading.desktop.s,t.co.neutral10,t.sz.lg,t.typography.heading.mobile.s)}),eH=C.Ay.span.withConfig({componentId:"sc-vko5rf-10"})(function(e){var t=e.theme;return(0,C.AH)(["",";color:",";font-style:italic;"],t.typography.paragraph.s,t.co.neutral50)}),eO=C.Ay.span.withConfig({componentId:"sc-vko5rf-11"})(function(e){var t=e.theme;return(0,C.AH)(["",";color:",";"],t.typography.paragraph.m,t.co.neutral40)}),eP=C.Ay.div.withConfig({componentId:"sc-vko5rf-12"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;justify-content:center;margin-top:",";"],t.sz.s2)});function eE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function eq(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?eE(Object(n),!0).forEach(function(t){(0,s.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eE(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var eW=(0,r.YK)({examplesHeading:{id:"grammar_session_explanation_examples_heading",defaultMessage:"Examples"},gotIt:{id:"grammar_session_explanation_got_it",defaultMessage:"Got it"},revealTranslation:{id:"grammar_session_explanation_reveal_translation",defaultMessage:"Show translation"},examplesHint:{id:"grammar_session_explanation_examples_hint",defaultMessage:"Tap an example to reveal its translation"}}),eD=function(e){var t=e.explanation,n=e.onContinue,a=e.showContinue,o=(0,r.tz)(),i=(0,p.useState)(function(){return new Set}),s=i[0],c=i[1],l=(0,p.useState)(null),d=l[0],u=l[1],m=(0,p.useState)(0),h=m[0],f=m[1],g=function(e){s.has(e)||c(function(t){return new Set(t).add(e)}),u(e),f(function(e){return e+1})};return(0,_.jsxs)(eA,{"data-testid":"grammar-explanation",children:[h>0&&(0,_.jsx)("audio",{autoPlay:!0,preload:"auto",src:eb.A,"data-testid":"grammar-explanation-reveal-sound"},h),(0,_.jsxs)(eC,{children:[(0,_.jsx)(ek,{children:t.title}),(0,_.jsx)(ej,{"data-testid":"grammar-explanation-markdown",children:(0,_.jsx)(ex.oz,{remarkPlugins:[ey.A],children:t.explanationText})})]}),(0,_.jsxs)(eI,{children:[(0,_.jsx)(ez,{children:o.formatMessage(eW.examplesHeading)}),(0,_.jsx)(e_,{children:o.formatMessage(eW.examplesHint)}),(0,_.jsx)(eT,{children:t.examples.map(function(e,t){var n=e.targetText,r=s.has(n),a=d===n;return(0,_.jsxs)(eS,{type:"button",onClick:function(){return g(n)},onAnimationEnd:function(){d===n&&u(null)},$revealed:r,$glowing:a,"aria-expanded":r,"aria-label":r?"".concat(e.targetText,". ").concat(e.sourceText):o.formatMessage(eW.revealTranslation),"data-testid":"grammar-explanation-example-".concat(t),children:[(0,_.jsx)(eM,{children:e.targetText}),e.romanization?(0,_.jsx)(eH,eq(eq({},(0,ev.jQ)(e.romanization)),{},{children:e.romanization})):null,r?(0,_.jsx)(eO,{"data-testid":"grammar-explanation-source-".concat(t),children:e.sourceText}):null]},n)})})]}),(void 0===a||a)&&(0,_.jsx)(eP,{children:(0,_.jsx)(w.$n,{wide:!0,buttonType:"primary",buttonSize:"large",onClick:n,"data-testid":"grammar-explanation-got-it",children:o.formatMessage(eW.gotIt)})})]})},eL=C.Ay.section.withConfig({componentId:"sc-17iirtc-0"})(function(e){var t=e.theme;return(0,C.AH)(["max-width:none;display:flex;flex-direction:column;gap:",";width:100%;p,ul,ol,li,h1,h2,h3,h4,span{max-width:none;}
1"],t.sz.s6)}),e$=C.Ay.div.withConfig({componentId:"sc-17iirtc-1"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;flex-direction:column;gap:",";"],t.sz.s2)}),eN=C.Ay.h2.withConfig({componentId:"sc-17iirtc-2"})(function(e){var t=e.theme;return(0,C.AH)(["",";margin:0;color:",";@media (max-width:","){",";}"],t.typography.heading.desktop.m,t.co.neutral10,t.sz.lg,t.typography.heading.mobile.m)}),eB=C.Ay.div.withConfig({componentId:"sc-17iirtc-3"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;flex-direction:column;gap:",";"],t.sz.s6)}),eF=C.Ay.div.withConfig({componentId:"sc-17iirtc-4"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;flex-direction:column;gap:",";"],t.sz.s4)}),eK=C.Ay.p.withConfig({componentId:"sc-17iirtc-5"})(function(e){var t=e.theme;return(0,C.AH)(["",";margin:0;color:",";"],t.typography.paragraph.m,t.co.neutral40)}),eY=C.Ay.div.withConfig({componentId:"sc-17iirtc-6"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;align-items:stretch;gap:",";width:100%;padding:",";margin:-",";@media (max-width:","){flex-direction:column;}"],t.sz.s2,t.sz.s1,t.sz.s1,t.sz.lg)}),eR=C.Ay.div.withConfig({componentId:"sc-17iirtc-7"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;align-items:stretch;gap:",";flex-shrink:0;@media (max-width:","){width:100%;> *{flex:1;}}"],t.sz.s2,t.sz.lg)}),eG=C.Ay.input.withConfig({componentId:"sc-17iirtc-8"})(function(e){var t=e.theme;return(0,C.AH)(["box-sizing:border-box;flex:1;min-width:0;min-height:",";padding:"," ",";border-radius:",";border:"," solid ",";background-color:",";color:",";",";&:disabled{opacity:1;background-color:",";}&:focus-visible{outline:"," solid ",";outline-offset:",";}"],t.sz.s12,t.sz.s3,t.sz.s4,t.bo.medium,t.bo.mediumWidth,t.co.secondary80,t.co.neutral99,t.co.neutral20,t.typography.paragraph.m,t.co.neutral95,t.bo.mediumWidth,t.co.secondary40,t.sz.s1)}),eV=C.Ay.div.withConfig({componentId:"sc-17iirtc-9"})(function(e){var t=e.theme,n=e.$isCorrect;return(0,C.AH)(["display:flex;flex-direction:column;gap:",";padding:",";border-radius:",";border:"," solid ",";background-color:",";"],t.sz.s3,t.sz.s5,t.bo.medium,t.bo.thinWidth,n?t.co.success40:t.co.secondary80,n?t.co.success95:t.co.neutral95)}),eU=C.Ay.p.withConfig({componentId:"sc-17iirtc-10"})(function(e){var t=e.theme;return(0,C.AH)(["",";margin:0;color:",";"],t.typography.paragraph.m,t.co.neutral20)}),eJ=(0,r.YK)({title:{id:"grammar_session_free_write_title",defaultMessage:"Now it's your turn to write!"},sentenceLabel:{id:"grammar_session_free_write_sentence_label",defaultMessage:"Your sentence"},check:{id:"grammar_session_free_write_check",defaultMessage:"Check"},skip:{id:"grammar_session_free_write_skip",defaultMessage:"Skip"},assessing:{id:"grammar_session_free_write_assessing",defaultMessage:"Checking your sentence…"},proposedCorrection:{id:"grammar_session_free_write_proposed_correction",defaultMessage:"AI Suggested correction: {correction}"}}),eX=function(e){var t=e.prompts,n=e.entries,a=e.activeIndex,o=e.onSentenceChange,i=e.onCheck,s=e.onSkip,c=e.readOnly,l=void 0!==c&&c,d=(0,r.tz)(),u=t.slice(0,a+1);return(0,_.jsxs)(eL,{"data-testid":"grammar-free-write",children:[(0,_.jsx)(e$,{children:(0,_.jsx)(eN,{children:d.formatMessage(eJ.title)})}),(0,_.jsx)(eB,{children:u.map(function(e,t){var r,c=n[t];if(!c)return null;var u=!l&&t===a,p=!!c.assessment,m=c.assessment;return(0,_.jsxs)(eF,{"data-testid":"grammar-free-write-prompt-".concat(e.id),children:[(0,_.jsx)(eK,{"data-testid":"grammar-free-write-instruction-".concat(e.id),children:e.instruction}),(0,_.jsxs)(eY,{children:[(0,_.jsx)(eG,{"aria-label":d.formatMessage(eJ.sentenceLabel),value:c.sentence,onChange:function(e){u&&o(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),u&&!p&&!c.isAssessing&&c.sentence.trim()&&i())},disabled:!u||p||c.isAssessing,"data-testid":"grammar-free-write-input-".concat(e.id)}),u&&!p&&(0,_.jsxs)(eR,{children:[(0,_.jsx)(w.$n,{buttonType:"secondary",buttonSize:"medium",onClick:s,disabled:c.isAssessing,"data-testid":"grammar-free-write-skip",children:d.formatMessage(eJ.skip)}),(0,_.jsx)(w.$n,{buttonType:"primary",buttonSize:"medium",onClick:function(){i()},loading:c.isAssessing,disabled:c.isAssessing||!c.sentence.trim(),"data-testid":"grammar-free-write-check",children:d.formatMessage(c.isAssessing?eJ.asse
1ssing:eJ.check)})]})]}),m&&(0,_.jsx)(eV,{$isCorrect:m.isCorrect,"data-testid":"grammar-free-write-feedback-".concat(e.id),children:m.isCorrect?(0,_.jsx)(eU,{children:null!=(r=m.feedback)?r:"Well done! Your grammar is correct."}):(0,_.jsxs)(_.Fragment,{children:[m.proposedCorrection?(0,_.jsx)(eU,{"data-testid":"grammar-free-write-correction-".concat(e.id),children:d.formatMessage(eJ.proposedCorrection,{correction:m.proposedCorrection})}):null,m.explanation?(0,_.jsx)(eU,{"data-testid":"grammar-free-write-explanation-".concat(e.id),children:m.explanation}):null]})})]},e.id)})})]})},eQ=n(25022),eZ=C.Ay.header.withConfig({componentId:"sc-v60d6l-0"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;flex-shrink:0;align-items:center;justify-content:space-between;width:100%;gap:",";padding:"," 0;"],t.sz.s3,t.sz.s3)}),e0=C.Ay.div.withConfig({componentId:"sc-v60d6l-1"})(function(e){var t=e.theme,n=e.$align;return(0,C.AH)(["display:flex;align-items:center;justify-content:",";min-width:",";flex:1;"],"end"===(void 0===n?"start":n)?"flex-end":"flex-start",t.sz.s16)}),e1=C.Ay.h1.withConfig({componentId:"sc-v60d6l-2"})(function(e){var t=e.theme;return(0,C.AH)(["",";margin:0;text-align:center;color:",";@media (max-width:","){",";}"],t.typography.heading.desktop.s,t.co.neutral20,t.sz.lg,t.typography.heading.mobile.s)}),e2=C.Ay.div.withConfig({componentId:"sc-v60d6l-3"})(function(){return(0,C.AH)(["flex:0 0 auto;"])}),e5=C.Ay.span.withConfig({componentId:"sc-v60d6l-4"})(function(){return(0,C.AH)(["display:inline-flex;align-items:center;"])}),e4=(0,C.Ay)(V.A).withConfig({componentId:"sc-v60d6l-5"})(function(e){var t=e.theme;return(0,C.AH)(["margin-right:",";font-size:",";transform:scaleX(",");"],t.sz.s1,t.sz.s6,(0,U.g)(t))}),e3=C.Ay.span.withConfig({componentId:"sc-v60d6l-6"})(function(e){var t=e.theme;return(0,C.AH)(["",";"],t.typography.heading.desktop.xxxs)}),e6=(0,r.YK)({exit:{id:"grammar_session_exit",defaultMessage:"Exit session"},back:{id:"web_header_back",defaultMessage:"Back"},title:{id:"grammar_session_title",defaultMessage:"Grammar"}}),e7=function(e){var t=e.onExit,n=e.onBackToConcepts,a=e.showTitle,o=(0,r.tz)();return(0,_.jsxs)(eZ,{"data-testid":"grammar-session-header",children:[(0,_.jsx)(e0,{children:n?(0,_.jsx)(w.$n,{buttonType:"tertiary",buttonSize:"extraSmall",onClick:n,a11yText:o.formatMessage(e6.back),"data-testid":"grammar-session-back",children:(0,_.jsxs)(e5,{children:[(0,_.jsx)(e4,{name:"backwards"}),(0,_.jsx)(e3,{children:o.formatMessage(e6.back)})]})}):(0,_.jsx)(eQ.K,{icon:"close",ariaLabel:o.formatMessage(e6.exit),handleClick:t})}),void 0===a||a?(0,_.jsx)(e1,{children:o.formatMessage(e6.title)}):(0,_.jsx)(e2,{}),(0,_.jsx)(e0,{$align:"end"})]})},e9=n(79407),e8=(0,r.YK)({loadingTitle:{id:"grammar_session_loading_title",defaultMessage:"Loading exercise…"},errorTitle:{id:"grammar_session_error_title",defaultMessage:"Something went wrong"},errorDescription:{id:"grammar_session_error_description",defaultMessage:"We couldn’t start the grammar session. Please try again later."},conceptErrorDescription:{id:"grammar_session_concept_error_description",defaultMessage:"We couldn’t load that grammar concept. Please try another one."},exit:{id:"grammar_session_status_exit",defaultMessage:"Exit"}}),te=function(){var e=(0,r.tz)();return(0,_.jsxs)(e9.mc,{"data-testid":"grammar-session-loading",children:[(0,_.jsx)(e9.aH,{"data-testid":"grammar-session-loader"}),(0,_.jsx)(e9.hE,{children:e.formatMessage(e8.loadingTitle)})]})},tt=function(e){var t=e.onExit,n=e.variant,a=void 0===n?"session":n,o=(0,r.tz)();return(0,_.jsxs)(e9.mc,{"data-testid":"grammar-session-error-".concat(a),children:[(0,_.jsx)(e9.hE,{children:o.formatMessage(e8.errorTitle)}),(0,_.jsx)(e9.VY,{children:o.formatMessage("concept"===a?e8.conceptErrorDescription:e8.errorDescription)}),(0,_.jsx)(e9.yp,{children:(0,_.jsx)(w.$n,{wide:!0,buttonType:"primary",buttonSize:"large",onClick:t,"data-testid":"grammar-session-error-exit",children:o.formatMessage(e8.exit)})})]})},tn=n(59860),tr=C.Ay.section.withConfig({componentId:"sc-erfhru-0"})(function(e){var t=e.theme;return(0,C.AH)(["max-width:none;display:flex;flex-direction:column;gap:",";width:100%;p,ul,ol,li,h1,h2,h3,h4,span{max-width:none;}
1"],t.sz.s6)}),ta=C.Ay.div.withConfig({componentId:"sc-erfhru-1"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;flex-direction:column;gap:",";"],t.sz.s2)}),to=C.Ay.h2.withConfig({componentId:"sc-erfhru-2"})(function(e){var t=e.theme;return(0,C.AH)(["",";margin:0;color:",";@media (max-width:","){",";}"],t.typography.heading.desktop.m,t.co.neutral10,t.sz.lg,t.typography.heading.mobile.m)}),ti=C.Ay.div.withConfig({componentId:"sc-erfhru-3"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;flex-direction:column;gap:",";"],t.sz.s5)}),ts=C.Ay.div.withConfig({componentId:"sc-erfhru-4"})(function(e){var t=e.theme;return(0,C.AH)(["display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1.4fr);gap:"," ",";align-items:start;padding:",";border-radius:",";background-color:",";border:"," solid ",";@media (max-width:","){grid-template-columns:1fr;}"],t.sz.s3,t.sz.s4,t.sz.s4,t.bo.medium,t.co.neutral95,t.bo.thinWidth,t.co.secondary90,t.sz.lg)}),tc=C.Ay.div.withConfig({componentId:"sc-erfhru-5"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;flex-direction:column;gap:",";padding-top:",";"],t.sz.s1,t.sz.s2)}),tl=C.Ay.span.withConfig({componentId:"sc-erfhru-6"})(function(e){var t=e.theme;return(0,C.AH)(["",";color:",";@media (max-width:","){",";}"],t.typography.heading.desktop.s,t.co.neutral10,t.sz.lg,t.typography.heading.mobile.s)}),td=C.Ay.span.withConfig({componentId:"sc-erfhru-7"})(function(e){var t=e.theme;return(0,C.AH)(["",";color:",";font-style:italic;"],t.typography.paragraph.s,t.co.neutral50)}),tu=C.Ay.div.withConfig({componentId:"sc-erfhru-8"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;align-items:stretch;gap:",";width:100%;padding:",";margin:-",";@media (max-width:","){flex-direction:column;}"],t.sz.s2,t.sz.s1,t.sz.s1,t.sz.lg)}),tp=(0,C.AH)(function(e){var t=e.theme;return(0,C.AH)(["box-sizing:border-box;width:",";height:",";flex-shrink:0;"],t.sz.s12,t.sz.s12)}),tm=C.Ay.div.withConfig({componentId:"sc-erfhru-9"})(function(e){var t=e.theme;return(0,C.AH)(["",";position:relative;display:inline-flex;align-items:center;justify-content:center;align-self:center;> div,> div > span{display:inline-flex;width:",";height:",";align-items:center;justify-content:center;}@media (max-width:","){align-self:flex-end;}"],tp,t.sz.s12,t.sz.s12,t.sz.lg)}),th=C.Ay.button.withConfig({componentId:"sc-erfhru-10"})(function(e){var t=e.theme;return(0,C.AH)(["",";display:inline-flex;align-items:center;justify-content:center;padding:0;border-radius:",";border:"," solid ",";background-color:",";color:",";cursor:pointer;box-shadow:0 "," 0 ",";&:hover:not(:disabled),&:active:not(:disabled){box-shadow:0 "," 0 ",";transform:translateY(-2px);}&:focus-visible{outline:"," solid ",";outline-offset:",";}&:disabled{opacity:0.5;cursor:not-allowed;transform:none;box-shadow:0 "," 0 ",";}"],tp,t.bo.medium,t.bo.mediumWidth,t.co.secondary80,t.co.neutral99,t.co.secondary20,t.sz.s1,t.co.secondary80,t.bo.veryThickWidth,t.co.secondary80,t.bo.mediumWidth,t.co.secondary40,t.sz.s1,t.sz.s1,t.co.secondary80)}),tf=(0,C.Ay)(V.A).withConfig({componentId:"sc-erfhru-11"})(function(e){var t=e.theme;return(0,C.AH)(["font-size:",";"],t.sz.s6)}),tg=C.Ay.input.withConfig({componentId:"sc-erfhru-12"})(function(e){var t=e.theme,n=e.$isExactMatch;return(0,C.AH)(["box-sizing:border-box;flex:1;min-width:0;min-height:",";padding:"," ",";border-radius:",";border:"," solid ",";background-color:",";color:",";",";&:disabled{opacity:1;}&:focus-visible{outline:"," solid ",";outline-offset:",";}"],t.sz.s12,t.sz.s3,t.sz.s4,t.bo.medium,t.bo.mediumWidth,n?t.co.success40:t.co.secondary80,n?t.co.success95:t.co.neutral99,t.co.neutral20,t.typography.paragraph.m,t.bo.mediumWidth,t.co.secondary40,t.sz.s1)}),tx=C.Ay.p.withConfig({componentId:"sc-erfhru-13"})(function(e){var t=e.theme;return(0,C.AH)(["box-sizing:border-box;flex:1;min-width:0;min-height:",";margin:0;padding:"," ",";border-radius:",";border:"," solid ",";background-color:",";color:",";",";display:flex;align-items:center;"],t.sz.s12,t.sz.s3,t.sz.s4,t.bo.medium,t.bo.mediumWidth,t.co.success40,t.co.success95,t.co.neutral20,t.typography.paragraph.m)}),ty=C.Ay.p.withConfig({componentId:"sc-erfhru-14"})(function(e){var t=e.theme;return(0,C.AH)(["grid-column:1 / -1;",";margin:0;color:",";"],t.typography.paragraph.s,t.co.neutral40)}),tv=C.Ay.div.withConfig({componentId:"sc-erfhru-15"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;flex-direction:column;gap:",";"],t.sz.s8)}),tb=C.Ay.section.withConfig({componentId:"sc-erfhru-16"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;flex-direction:column;gap:",";max-width:none;width:100%;"],t.sz.s4)}),tw=C.Ay.h3.withConfig({componentId:"sc-erfhru-17"})(function(e){var t=e.theme;return(0,C.AH)(["",";margin:0;color:",";@media (max-width:","){",";}"],t.typography.heading.desktop.s,t.co.neutral20,t.sz.lg,t.typography.heading.mobile.s)}),tA=["translationStates","sourceLanguageName","onAnswerChange","onCheck","onHint","readOnly","variant"];function tC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function tk(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
1t%2?tC(Object(n),!0).forEach(function(t){(0,s.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tC(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var tj=(0,r.YK)({title:{id:"grammar_session_translation_title",defaultMessage:"Translate these sentences into {sourceLanguage}"},recapTitle:{id:"grammar_session_translation_recap_title",defaultMessage:"Now, some recap translations on what you’ve studied before"},answerLabel:{id:"grammar_session_translation_answer_label",defaultMessage:"Your translation"},check:{id:"grammar_session_translation_check",defaultMessage:"Check"},hint:{id:"web_hint_button",defaultMessage:"Hint"},expectedAnswer:{id:"grammar_session_translation_expected_answer",defaultMessage:"Expected answer: {answer}"}}),tI=function(e){return"grammar-translation-input-".concat(e)},tz=function(e){var t=e.translations,n=e.translationStates,r=e.onAnswerChange,a=e.onCheck,o=e.onHint,i=e.readOnly,s=e.answerLabel,c=e.checkLabel,l=e.hintLabel,d=e.expectedAnswerLabel;return(0,_.jsx)(ti,{children:t.map(function(e){var t,u,p,m,h=n[e.id],f=null!=(t=null==h?void 0:h.revealed)&&t,g=null!=(u=null==h?void 0:h.isExactMatch)&&u,x=!!(null!=(p=null==h?void 0:h.userAnswer)?p:"").trim();return(0,_.jsxs)(ts,{"data-testid":"grammar-translation-row-".concat(e.id),children:[(0,_.jsxs)(tc,{children:[(0,_.jsx)(tl,{children:e.targetText}),e.romanization?(0,_.jsx)(td,tk(tk({},(0,ev.jQ)(e.romanization)),{},{children:e.romanization})):null]}),(0,_.jsx)(tu,{children:g?(0,_.jsx)(tx,{"data-testid":"grammar-translation-answer-".concat(e.id),children:null==h?void 0:h.userAnswer}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(tg,{id:tI(e.id),"aria-label":s,value:null!=(m=null==h?void 0:h.userAnswer)?m:"",onChange:function(t){return r(e.id,t.target.value)},onKeyDown:function(t){"Enter"===t.key&&(t.preventDefault(),i||f||!x||a(e.id))},disabled:i,$isExactMatch:!1,"data-testid":"grammar-translation-input-".concat(e.id)}),(0,_.jsx)(tm,{children:(0,_.jsx)(M.m,{placement:"top",tooltip:l,children:(0,_.jsx)(th,{type:"button",onClick:function(){return o(e.id)},disabled:i,"aria-label":l,"data-testid":"grammar-translation-hint-".concat(e.id),children:(0,_.jsx)(tf,{name:"hint","aria-hidden":!0})})})}),!f&&(0,_.jsx)(w.$n,{buttonType:"primary",buttonSize:"medium",onClick:function(){return a(e.id)},disabled:i||!x,"data-testid":"grammar-translation-check-".concat(e.id),children:c})]})}),f&&!g&&(0,_.jsx)(ty,{"data-testid":"grammar-translation-expected-".concat(e.id),children:d(e.expectedSourceText)})]},e.id)})})},t_=function(e){var t,n,a=e.translationStates,o=e.sourceLanguageName,i=e.onAnswerChange,s=e.onCheck,c=e.onHint,l=e.readOnly,d=void 0!==l&&l,u=e.variant,m=void 0===u?"simple":u,h=(0,tn.A)(e,tA),f=(0,r.tz)(),g=f.formatMessage(tj.hint),x=f.formatMessage(tj.answerLabel),y=f.formatMessage(tj.check),v=(0,p.useMemo)(function(){var e,t;return"recap"===m?(null!=(t=h.groups)?t:[]).flatMap(function(e){return e.translations.map(function(e){return e.id})}):(null!=(e=h.translations)?e:[]).map(function(e){return e.id})},[h.groups,h.translations,m]),b=(0,p.useMemo)(function(){return v.filter(function(e){var t;return null==(t=a[e])?void 0:t.hasCelebratedMatch}).length},[v,a]),w=(0,p.useRef)(null),A=v.join("|");(0,p.useEffect)(function(){w.current=null},[A]),(0,p.useEffect)(function(){var e=new Set(v.filter(function(e){var t;return null==(t=a[e])?void 0:t.isExactMatch})),t=w.current;if(w.current=e,null!==t&&!d){var n=v.find(function(n){return e.has(n)&&!t.has(n)});if(n){var r=v.slice(v.indexOf(n)+1).find(function(t){return!e.has(t)});if(r){var o=window.requestAnimationFrame(function(){var e;null==(e=document.getElementById(tI(r)))||e.focus()});return function(){return window.cancelAnimationFrame(o)}}}}},[v,d,a]);var C={translationStates:a,onAnswerChange:i,onCheck:s,onHint:c,readOnly:d,answerLabel:x,checkLabel:y,hintLabel:g,expectedAnswerLabel:function(e){return f.formatMessage(tj.expectedAnswer,{answer:e})}};return(0,_.jsxs)(tr,{"data-testid":"recap"===m?"grammar-translation-recap":"grammar-translation",children:[b>0&&(0,_.jsx)("audio",{autoPlay:!0,preload:"auto",src:eb.A,"data-testid":"grammar-translation-correct-sound"},b),(0,_.jsx)(ta,{children:(0,_.jsx)(to,{children:f.formatMessage("recap"===m?tj.recapTitle:tj.title,{sourceLanguage:o})})}),"recap"===m?(0,_.jsx)(tv,{children:(null!=(t=h.groups)?t:[]).map(function(e){return(0,_.jsxs)(tb,{"data-testid":"grammar-recap-group-".concat(e.conceptId),children:[(0,_.jsx)(tw,{children:e.title}),(0,_.jsx)(tz,tk({translations:e.translations},C))]},e.conceptId)})}):(0,_.jsx)(tz,tk({translations:null!=(n=h.translations)?n:[]},C))]})},tT={concepts:[{id:"future-tense",title:"Future tense",description:"Talk about plans and things that will happen.",alreadySeen:!0,complexity:25}
1,{id:"conditionals",title:"Conditionals",description:"Describe what would happen if something else were true.",alreadySeen:!1,complexity:70},{id:"negations",title:"Forming negations",description:"Say that something is not the case.",alreadySeen:!1,complexity:15},{id:"comparatives",title:"Comparatives",description:"Compare people, places, and things.",alreadySeen:!0,complexity:40},{id:"past-perfect",title:"Past perfect",description:"Talk about something that happened before another past event.",alreadySeen:!1,complexity:85}],explanationsByConceptId:{"future-tense":{conceptId:"future-tense",title:"Future tense",explanationText:"In French, the near future is often formed with “aller” + infinitive. Use it for plans and things that are about to happen. For script languages, romanization is shown under the target sentence.",examples:[{targetText:"Je vais partir demain.",sourceText:"I am going to leave tomorrow."},{targetText:"Nous allons manger au restaurant.",sourceText:"We are going to eat at the restaurant."},{targetText:"明日行きます。",sourceText:"I will go tomorrow.",romanization:"Ashita ikimasu."}]},conditionals:{conceptId:"conditionals",title:"Conditionals",explanationText:"Use “si” with the imperfect, then the conditional, to talk about imaginary or unlikely situations.",examples:[{targetText:"Si j’avais le temps, je voyagerais.",sourceText:"If I had the time, I would travel."},{targetText:"Si tu \xe9tudiais, tu r\xe9ussirais.",sourceText:"If you studied, you would succeed."},{targetText:"S’il faisait beau, nous sortirions.",sourceText:"If the weather were nice, we would go out."}]},negations:{conceptId:"negations",title:"Forming negations",explanationText:"French negation usually wraps the verb with “ne … pas”. In everyday speech, “ne” is often dropped.",examples:[{targetText:"Je ne comprends pas.",sourceText:"I do not understand."},{targetText:"Elle n’aime pas le caf\xe9.",sourceText:"She does not like coffee."},{targetText:"Nous ne parlons pas espagnol.",sourceText:"We do not speak Spanish."}]},comparatives:{conceptId:"comparatives",title:"Comparatives",explanationText:"Use “plus … que”, “moins … que”, or “aussi … que” to compare qualities between two things.",examples:[{targetText:"Ce livre est plus int\xe9ressant que l’autre.",sourceText:"This book is more interesting than the other one."},{targetText:"Paris est moins grand que Londres.",sourceText:"Paris is less big than London."},{targetText:"Il est aussi rapide que moi.",sourceText:"He is as fast as me."}]},"past-perfect":{conceptId:"past-perfect",title:"Past perfect",explanationText:"The pluperfect (plus-que-parfait) describes an action completed before another past action. Form it with the imperfect of “avoir/\xeatre” + past participle.",examples:[{targetText:"J’avais d\xe9j\xe0 mang\xe9 quand il est arriv\xe9.",sourceText:"I had already eaten when he arrived."},{targetText:"Elle \xe9tait partie avant midi.",sourceText:"She had left before noon."},{targetText:"Nous avions fini le travail.",sourceText:"We had finished the work."}]}},translationsByConceptId:{"future-tense":[{id:"ft-1",targetText:"Tu vas appeler ta m\xe8re.",expectedSourceText:"You are going to call your mother."},{id:"ft-2",targetText:"Ils vont acheter une maison.",expectedSourceText:"They are going to buy a house."},{id:"ft-3",targetText:"明日勉強します。",romanization:"Ashita benkyō shimasu.",expectedSourceText:"I will study tomorrow."}],conditionals:[{id:"cond-1",targetText:"Si je gagnais, j’ach\xe8terais une voiture.",expectedSourceText:"If I won, I would buy a car."},{id:"cond-2",targetText:"Si elle savait, elle viendrait.",expectedSourceText:"If she knew, she would come."},{id:"cond-3",targetText:"Si nous avions de l’argent, nous partirions.",expectedSourceText:"If we had money, we would leave."}],negations:[{id:"neg-1",targetText:"Je ne veux pas partir.",expectedSourceText:"I do not want to leave."},{id:"neg-2",targetText:"Tu n’as pas de temps.",expectedSourceText:"You do not have time."},{id:"neg-3",targetText:"Ils ne regardent pas la t\xe9l\xe9.",expectedSourceText:"They do not watch TV."}],comparatives:[{id:"comp-1",targetText:"Ma sœur est plus grande que moi.",expectedSourceText:"My sister is taller than me."},{id:"comp-2",targetText:"Ce film est moins dr\xf4le que le livre.",expectedSourceText:"This film is less funny than the book."},{id:"comp-3",targetText:"Le th\xe9 est aussi bon que le caf\xe9.",expectedSourceText:"Tea is as good as coffee."}],"past-perfect":[{id:"pp-1",targetText:"Il avait oubli\xe9 ses cl\xe9s.",expectedSourceText:"He had forgotten his keys."},{id:"pp-2",targetText:"J’avais vu ce film avant.",expectedSourceText:"I had seen that film before."},{id:"pp-3",targetText:"Elles \xe9taient d\xe9j\xe0 parties.",expectedSourceText:"They had already left."}]},freeWritePrompts:[{id:"free-write-1",instruction:"Write a short sentence using this grammar concept."},{id:"free-write-2",instruction:"Now try to write a slightly longer sentence."}]}
1,tS=function(e,t){return e.trim().split(/\s+/).filter(Boolean).length<3?Promise.resolve({isCorrect:!1,proposedCorrection:"Je ne comprends pas encore tr\xe8s bien.",explanation:"That sentence is too short to clearly show the grammar concept. Try a fuller sentence that uses the structure you’re practising."}):Promise.resolve({isCorrect:!0,feedback:"Well done! Your grammar is correct."})};function tM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function tH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tM(Object(n),!0).forEach(function(t){(0,s.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tM(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var tO=function(e){return Object.fromEntries(e.map(function(e){return[e.id,{userAnswer:"",revealed:!1,isExactMatch:!1,hasCelebratedMatch:!1}]}))},tP=function(e,t){return e.length>0&&e.every(function(e){var n;return null==(n=t[e.id])?void 0:n.revealed})},tE=function(e){return e.flatMap(function(e){return e.translations})},tq=function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=null!=(t=r.assessSentence)?t:tS,o=null!=(n=r.random)?n:Math.random,i=e.concepts,c=(0,p.useState)("selectConcept"),d=c[0],m=c[1],h=(0,p.useState)(null),f=h[0],g=h[1],x=(0,p.useState)(null),y=x[0],v=x[1],b=(0,p.useState)([]),w=b[0],A=b[1],C=(0,p.useState)([]),k=C[0],j=C[1],I=(0,p.useState)({}),z=I[0],_=I[1],T=(0,p.useState)(0),S=T[0],M=T[1],H=(0,p.useState)(e.freeWritePrompts.map(function(){return{sentence:"",assessment:null,isAssessing:!1}})),O=H[0],P=H[1],E=(0,p.useRef)({}),L=(0,p.useMemo)(function(){var e;return null!=(e=i.find(function(e){return e.id===f}))?e:null},[i,f]),$=(0,p.useMemo)(function(){return tE(k)},[k]),B=tP(w,z),F=tP($,z),K=(0,p.useMemo)(function(){return Object.values(z).filter(function(e){return e.hasCelebratedMatch}).length},[z]);(0,p.useEffect)(function(){"translation"===d&&B&&m("freeWrite")},[B,d]),(0,p.useEffect)(function(){"recapTranslation"===d&&F&&m("complete")},[F,d]);var Y=(0,p.useCallback)(function(t,n){if(i.find(function(e){return e.id===t})){var r,a,o,s=null!=(r=null==n?void 0:n.explanation)?r:e.explanationsByConceptId[t],c=null!=(a=null!=(o=null==n?void 0:n.translations)?o:e.translationsByConceptId[t])?a:[];s&&(g(t),v(s),A(c),j([]),_(tO(c)),E.current={},M(0),P(e.freeWritePrompts.map(function(){return{sentence:"",assessment:null,isAssessing:!1}})),m("explanation"))}},[i,e.explanationsByConceptId,e.freeWritePrompts,e.translationsByConceptId]),R=(0,p.useCallback)(function(){m("selectConcept"),g(null),v(null),A([]),j([]),_({}),E.current={},M(0),P(e.freeWritePrompts.map(function(){return{sentence:"",assessment:null,isAssessing:!1}}))},[e.freeWritePrompts]),G=(0,p.useCallback)(function(){m("translation")},[]),V=(0,p.useCallback)(function(e){var t;return null!=(t=w.find(function(t){return t.id===e}))?t:$.find(function(t){return t.id===e})},[$,w]),U=(0,p.useCallback)(function(e,t){var n=V(e);n&&_(function(r){var a=r[e];if(!a||a.isExactMatch)return r;var o=q(t,n.expectedSourceText);return tH(tH({},r),{},(0,s.A)({},e,tH(tH({},a),{},{userAnswer:t,revealed:a.revealed||o,isExactMatch:o,hasCelebratedMatch:a.hasCelebratedMatch||o})))})},[V]),J=(0,p.useCallback)(function(e){var t=V(e);t&&_(function(n){var r=n[e];if(!r||r.isExactMatch||r.revealed||!r.userAnswer.trim())return n;var a=q(r.userAnswer,t.expectedSourceText);return tH(tH({},n),{},(0,s.A)({},e,tH(tH({},r),{},{revealed:!0,isExactMatch:a,hasCelebratedMatch:r.hasCelebratedMatch||a})))})},[V]),X=(0,p.useCallback)(function(e){var t=V(e);if(t){var n=W(E.current[e],Date.now());E.current[e]=n;var r=1+Math.max(0,n.clickCount-3);_(function(n){var a=n[e];if(!a||a.isExactMatch)return n;var o=D(a.userAnswer,t.expectedSourceText,r);if(o===a.userAnswer)return n;var i=q(o,t.expectedSourceText);return tH(tH({},n),{},(0,s.A)({},e,tH(tH({},a),{},{userAnswer:o,revealed:a.revealed||i,isExactMatch:i,hasCelebratedMatch:a.hasCelebratedMatch||i})))})}},[V]),Q=(0,p.useCallback)(function(e){P(function(t){return t.map(function(t,n){return n!==S||t.assessment||t.isAssessing?t:tH(tH({},t),{},{sentence:e})})})},[S]),Z=(0,p.useCallback)(function(){if(!f)return void m("complete");var t=N({concepts:i,translationsByConceptId:e.translationsByConceptId,excludeConceptId:f,random:o});if(0===t.length){j([]),m("complete");return}j(t),_(function(e){return tH(tH({},e),tO(tE(t)))}),m("recapTranslation")},[i,e.translationsByConceptId,o,f]),ee=(0,p.useCallback)((0,l.A)(u().mark(function t(){var n,r,o,i,s;return u().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(!(n=O[S])||!f||n.assessment||n.isAssessing||!n.sentence.trim())){t.next=3;break}return t.abrupt("return");case 3:return r=n.sentence,i=(o=S)>=e.freeWritePrompts.length-1,P(function(e){return e.map(function(e,t){return t===o?tH(tH({},e),{},{isAssessing:!0}):e})}),t.prev=7,t.next=10,a(r,f);case 10:s=t.sent,P(function(e){return e.map(function(e,t){return t===o?tH(tH({},e),{},{assessment:s,isAssessing:!1}):e})}),t.next=17;break;case 14:t.prev=14,t.t0=t.catch(7),P(function(e){return e.map(function(e,t){return t===o?tH(tH({},e),{},{isAssessing:!1,assessment:{isCorrect:!1,proposedCorrection:null,explanation:"We could not assess that sentence right now. You can continue anyway."}}):e})});case 17:i?Z():M(o+1);case 18:case"end":return t.stop()}},t,null,[[7,14]])}
1)),[a,Z,e.freeWritePrompts.length,O,S,f]),et=(0,p.useCallback)(function(){if("freeWrite"===d){var e=O[S];null!=e&&e.isAssessing||Z()}},[Z,O,S,d]);return{phase:d,selectedConcept:L,explanation:y,translations:w,recapGroups:k,translationStates:z,freeWritePrompts:e.freeWritePrompts,freeWriteIndex:S,freeWriteEntries:O,allTranslationsChecked:B,allRecapChecked:F,celebratedMatchCount:K,selectConcept:Y,returnToConceptSelection:R,continueFromExplanation:G,setTranslationAnswer:U,checkTranslation:J,hintTranslation:X,setFreeWriteSentence:Q,checkFreeWrite:ee,skipFreeWrite:et}},tW=function(e){var t=e.sentences.slice(0,3),n=e.sentences.slice(3);return{explanation:{conceptId:String(e.id),title:e.title,explanationText:e.explanation,examples:t.map(function(e){return{targetText:e.value,sourceText:e.translation,romanization:e.romanization}})},translations:n.map(function(e){return{id:String(e.id),targetText:e.value,romanization:e.romanization,expectedSourceText:e.translation}})}},tD=C.Ay.div.withConfig({componentId:"sc-p7mm7o-0"})(function(e){var t=e.theme;return(0,C.AH)(["box-sizing:border-box;display:flex;flex-direction:column;width:100%;height:100dvh;overflow:hidden;background-color:",";color:",";"],t.co.neutral99,t.co.neutral20)}),tL=C.Ay.div.withConfig({componentId:"sc-p7mm7o-1"})(function(e){var t=e.theme;return(0,C.AH)(["box-sizing:border-box;display:flex;flex-direction:column;flex:1;min-height:0;width:100%;max-width:",";margin:0 auto;padding:",";overflow:hidden;@media (min-width:","){padding:"," ",";}"],t.sz.xxl,t.sz.s4,t.sz.ml,t.sz.s6,t.sz.s8)}),t$=C.Ay.div.withConfig({componentId:"sc-p7mm7o-2"})(function(e){var t=e.theme;return(0,C.AH)(["display:flex;flex-direction:column;flex:1;min-height:0;gap:",";margin-top:",";width:100%;overflow-y:auto;overscroll-behavior:contain;padding:0 "," ",";box-sizing:border-box;& > *{max-width:none;width:100%;}"],t.sz.s8,t.sz.s2,t.sz.s2,t.sz.s12)});function tN(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function tB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function tF(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tB(Object(n),!0).forEach(function(t){(0,s.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tB(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var tK=(0,r.YK)({fallbackLanguageName:{id:"grammar_session_fallback_language_name",defaultMessage:"your language"}}),tY=function(e){if("string"!=typeof e)return null;var t=(0,b.oV)(e);return t instanceof b.XR?null:t},tR=function(){var e=tY((0,m.useRouter)().query.language_pair_id);return null!=e?e:(0,v.S)()},tG=function(e){var t,n,r,a,o=e.content,i=e.usingMockContent,d=e.languagePairId,m=e.sourceLanguageName,h=e.onExit,g=e.onComplete,x=e.isCompleting,y=(0,p.useState)(o),v=y[0],b=y[1],w=(0,p.useState)(function(){return new Set}),A=w[0],C=w[1],k=(0,p.useState)(!1),j=k[0],I=k[1],z=(0,p.useState)(!1),T=z[0],M=z[1],H=(0,p.useRef)(0),O=(0,p.useRef)(null),P=(0,p.useRef)(new Set);(0,p.useEffect)(function(){b(o),P.current=new Set},[o]),(0,p.useEffect)(function(){if(!i){var e=v.concepts.filter(function(e){return e.alreadySeen}).map(function(e){return e.id}).filter(function(e){return!P.current.has(e)});if(0!==e.length){var t,n=!1;return Promise.all(e.map((t=(0,l.A)(u().mark(function e(t){var n;return u().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,f.VG.getConcept({conceptId:Number(t),languagePairId:d});case 2:return n=e.sent,e.abrupt("return",{conceptId:t,mapped:tW(n)});case 4:case"end":return e.stop()}},e)})),function(e){return t.apply(this,arguments)}))).then(function(e){n||(P.current=new Set([].concat((0,c.A)(P.current),(0,c.A)(e.map(function(e){return e.conceptId})))),b(function(t){var n,r=tF({},t.explanationsByConceptId),a=tF({},t.translationsByConceptId),o=function(e){var t="u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e){if(e){if("string"==typeof e)return tN(e,void 0);var t=({}).toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?tN(e,void 0):void 0}}(e))){t&&(e=t);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,i=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return o=e.done,e},e:function(e){i=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(i)throw a}}}}(e);try{for(o.s();!(n=o.n()).done;){var i=n.value,s=i.conceptId,c=i.mapped;r[s]=c.explanation,a[s]=c.translations}}catch(e){o.e(e)}finally{o.f()}return tF(tF({},t),{},{explanationsByConceptId:r,translationsByConceptId:a})}))}).catch(function(){}),function(){n=!0}}}},[d,v.concepts,i]);var E=tq(v,{assessSentence:(0,p.useCallback)((t=(0,l.A)(u().mark(function e(t,n){var r,a;return u().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!i){e.next=2;break}return e.abrupt("return",tS(t,n));case 2:return e.next=4,f.VG.assessSentence({conceptId:Number(n),languagePairId:d,sentence:t});case 4:return a={isCorrect:(r=e.sent).isCorrect,proposedCorrection:r.proposedCorrection,explanation:r.explanation},r.isCorrect&&(a.feedback="Well done! Your grammar is correct."),e.abrupt("return",a);case 8:case"end":return e.stop()}},e)})),function(e,n){return t.apply(this,arguments)}),[d,i])}),q=E.phase,W=E.selectedConcept,D=E.explanation,L=E.translations,$=E.recapGroups,N=E.translationStates,B=E.freeWritePrompts,F=E.freeWriteIndex,K=E.freeWriteEntries,Y=E.selectConcept,R=E.returnToConceptSelection,G=E.continueFromExplanation,V=E.setTranslationAnswer,U=E.checkTranslation,J=E.hintTranslation,X=E.setFreeWriteSentence,Q=E.checkFreeWrite,Z=E.skipFreeWrite,ee=(0,p.useCallback)(function(e,t){b(function(n){return tF(tF({},n),{},{concepts:n.concepts.map(function(n){return n.id===e?tF(tF({},n),{},{alreadySeen:t}):n})})})},[]),et=(0,p.useCallback)(function(e,t){b(function(n){return tF(tF({},n),{},{explanationsByConceptId:tF(tF({},n.explanationsByConceptId),{},(0,s.A)({},e,t.explanation)),translationsByConceptId:tF(tF({},n.translationsByConceptId),{},(0,s.A)({},e,t.translations))})}
1),P.current=new Set(P.current).add(e)},[]),en=(0,p.useCallback)(function(e){var t=!1;return C(function(n){return n.has(e)?(t=!0,n):new Set(n).add(e)}),!t},[]),er=(0,p.useCallback)(function(e){C(function(t){var n=new Set(t);return n.delete(e),n})},[]),ea=(0,p.useCallback)((n=(0,l.A)(u().mark(function e(t){return u().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(en(t)){e.next=2;break}return e.abrupt("return");case 2:if(e.prev=2,i){e.next=6;break}return e.next=6,f.VG.markSeen({conceptId:Number(t),languagePairId:d});case 6:ee(t,!0),e.next=11;break;case 9:e.prev=9,e.t0=e.catch(2);case 11:return e.prev=11,er(t),e.finish(11);case 14:case"end":return e.stop()}},e,null,[[2,9,11,14]])})),function(e){return n.apply(this,arguments)}),[en,er,d,ee,i]),eo=(0,p.useCallback)((r=(0,l.A)(u().mark(function e(t){return u().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(en(t)){e.next=2;break}return e.abrupt("return");case 2:if(e.prev=2,i){e.next=6;break}return e.next=6,f.VG.unmarkSeen({conceptId:Number(t),languagePairId:d});case 6:ee(t,!1),e.next=11;break;case 9:e.prev=9,e.t0=e.catch(2);case 11:return e.prev=11,er(t),e.finish(11);case 14:case"end":return e.stop()}},e,null,[[2,9,11,14]])}
1)),function(e){return r.apply(this,arguments)}),[en,er,d,ee,i]),ei=(0,p.useCallback)((a=(0,l.A)(u().mark(function e(t){var n,r,a,o,s;return u().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(M(!1),!i){e.next=4;break}return Y(t),e.abrupt("return");case 4:if(n=v.explanationsByConceptId[t],r=v.translationsByConceptId[t],!(n&&void 0!==r)){e.next=9;break}return Y(t,{explanation:n,translations:r}),e.abrupt("return");case 9:return a=H.current+1,H.current=a,I(!0),e.prev=12,e.next=15,f.VG.getConcept({conceptId:Number(t),languagePairId:d});case 15:if(o=e.sent,H.current===a){e.next=18;break}return e.abrupt("return");case 18:et(t,s=tW(o)),Y(t,s),e.next=28;break;case 23:if(e.prev=23,e.t0=e.catch(12),H.current===a){e.next=27;break}return e.abrupt("return");case 27:M(!0);case 28:return e.prev=28,H.current===a&&I(!1),e.finish(28);case 31:case"end":return e.stop()}},e,null,[[12,23,28,31]])})),function(e){return a.apply(this,arguments)}),[d,et,Y,v.explanationsByConceptId,v.translationsByConceptId,i]),es=(0,p.useCallback)(function(){H.current+=1,I(!1),M(!1),O.current=null,R()},[R]);(0,p.useEffect)(function(){"complete"!==q||!W||i||O.current!==W.id&&(O.current=W.id,f.VG.markSeen({conceptId:Number(W.id),languagePairId:d}).then(function(){ee(W.id,!0)}).catch(function(){O.current=null}))},[d,q,W,ee,i]);var ec=!!D&&("explanation"===q||"translation"===q||"freeWrite"===q||"recapTranslation"===q||"complete"===q),el=("recapTranslation"===q||"complete"===q)&&$.length>0,ed=("freeWrite"===q||"recapTranslation"===q||"complete"===q)&&!!W,eu="explanation"!==q,ep=j||"explanation"===q||"translation"===q||"freeWrite"===q||"recapTranslation"===q||"complete"===q;return j?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(e7,{onExit:h,onBackToConcepts:es}),(0,_.jsx)(t$,{"data-testid":"grammar-session-body",children:(0,_.jsx)(te,{})})]}):T&&"selectConcept"===q?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(e7,{onExit:h,showTitle:!1}),(0,_.jsx)(t$,{"data-testid":"grammar-session-body",children:(0,_.jsx)(tt,{variant:"concept",onExit:h})})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(e7,{onExit:h,onBackToConcepts:ep?es:void 0,showTitle:"selectConcept"!==q}),(0,_.jsxs)(t$,{"data-testid":"grammar-session-body",children:["selectConcept"===q&&(0,_.jsx)(eg,{concepts:v.concepts,onSelect:ei,onMarkAsKnown:ea,onUnmarkAsKnown:eo,updatingKnownConceptIds:A}),ec&&D&&(0,_.jsx)(eD,{explanation:D,onContinue:G,showContinue:!eu}),("translation"===q||"freeWrite"===q||"recapTranslation"===q||"complete"===q)&&(0,_.jsx)(t_,{variant:"simple",translations:L,translationStates:N,sourceLanguageName:m,onAnswerChange:V,onCheck:U,onHint:J,readOnly:"freeWrite"===q||"recapTranslation"===q||"complete"===q}),ed&&W&&(0,_.jsx)(eX,{prompts:B,entries:K,activeIndex:"complete"===q||"recapTranslation"===q?B.length-1:F,onSentenceChange:X,onCheck:Q,onSkip:Z,readOnly:"freeWrite"!==q}),el&&(0,_.jsx)(t_,{variant:"recap",groups:$,translationStates:N,sourceLanguageName:m,onAnswerChange:V,onCheck:U,onHint:J,readOnly:"complete"===q}),"complete"===q&&(0,_.jsx)(S,{onDoAnother:es,onLeave:g,isLeaving:void 0!==x&&x})]})]})},tV=function(){var e,t,n,a=(0,r.tz)(),o=(0,m.useRouter)(),i=(0,g.A)().safePush,s=tR(),c=tY((0,m.useRouter)().query.pathway_node_id),d=(0,x.a)({languagePairId:s,pathwayNodeId:c,pathwayCheckpointId:null,sessionType:"grammar"}).completePathwayProgress,v=(0,p.useState)(!1),b=v[0],w=v[1],A="string"==typeof(e=o.query.back)&&e.startsWith("/")?e:y.b.path,C=(0,h.I)({queryKey:["grammarConcepts",s],queryFn:function(){return null==s?Promise.reject(Error("languagePairId is required")):f.VG.listConcepts({languagePairId:s})},enabled:!!s}),k=C.data,j=C.isPending,I=C.isError,z=(0,h.I)({queryKey:["userLanguages"],queryFn:function(){return f.fR.getUserLanguages()}}).data,T=!k||0===k.concepts.length,S=(0,p.useMemo)(function(){return T?tT:{concepts:k.concepts.map(function(e){return{id:String(e.id),title:e.title,description:e.description,alreadySeen:e.alreadySeen,complexity:e.complexity}}),explanationsByConceptId:{},translationsByConceptId:{},freeWritePrompts:tT.freeWritePrompts}},[k,T]),M=a.formatMessage(tK.fallbackLanguageName),H=null!=(t=null==z||null==(n=z.languagePairs.find(function(e){return e.languagePairId===s}))?void 0:n.sourceLanguageName)?t:M,O=(0,p.useCallback)(function(){i(A)},[A,i]),P=(0,p.useCallback)((0,l.A)(u().mark(function e(){return u().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return w(!0),e.prev=1,e.next=4,d();case 4:e.next=8;break;case 6:e.prev=6,e.t0=e.catch(1);case 8:return e.prev=8,w(!1),e.finish(8);case 11:i(A);case 12:case"end":return e.stop()}},e,null,[[1,6,8,11]])})),[A,d,i]);return!s||I?(0,_.jsx)(tD,{"data-testid":"grammar-session",children:(0,_.jsxs)(tL,{children:[(0,_.jsx)(e7,{onExit:O}),(0,_.jsx)(t$,{"data-testid":"grammar-session-body",children:(0,_.jsx)(tt,{onExit:O})})]})}):j?(0,_.jsx)(tD,{"data-testid":"grammar-session",children:(0,_.jsxs)(tL,{children:[(0,_.jsx)(e7,{onExit:O}),(0,_.jsx)(t$,{"data-testid":"grammar-session-body",children:(0,_.jsx)(te,{})})]})}):(0,_.jsx)(tD,{"data-testid":"grammar-session",children:(0,_.jsx)(tL,{children:(0,_.jsx)(tG,{content:S,usingMockContent:T,languagePairId:s,sourceLanguageName:H,onExit:O,onComplete:P,isCompleting:b})})})},tU=(0,r.YK)({pageTitle:{id:"grammar_session_page_title",defaultMessage:"Grammar"}});let tJ=function(){var e=(0,r.tz)();return(0,_.jsxs)(i.co,{children:[(0,_.jsx)(o(),{children:(0,_.jsx)("title",{children:e.formatMessage(tU.pageTitle)})}),(0,_.jsx)(tV,{})]})}}},e=>{e.O(0,[4150,1906,6593,636,8792],()=>e(e.s=85746)),_N_E=e.O()}]);
2//# sourceMappingURL=grammar-7c86d59e641cf9e5.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.