@gamelearn/arcade-components 3.14.5 → 3.14.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -64,7 +64,7 @@ object-assign
64
64
  Valid keys: `+JSON.stringify(Object.keys(q),null," "));var ue=le(V,ee,te,H,W+"."+ee,n);if(ue)return ue}return null}return v(re)}function $(q){switch(typeof q){case"number":case"string":case"undefined":return!0;case"boolean":return!q;case"object":if(Array.isArray(q))return q.every($);if(q===null||h(q))return!0;var re=x(q);if(re){var ce=re.call(q),fe;if(re!==q.entries){for(;!(fe=ce.next()).done;)if(!$(fe.value))return!1}else for(;!(fe=ce.next()).done;){var te=fe.value;if(te&&!$(te[1]))return!1}}else return!1;return!0;default:return!1}}function B(q,re){return q==="symbol"?!0:re?re["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&re instanceof Symbol:!1}function J(q){var re=typeof q;return Array.isArray(q)?"array":q instanceof RegExp?"object":B(re,q)?"symbol":re}function ne(q){if(typeof q>"u"||q===null)return""+q;var re=J(q);if(re==="object"){if(q instanceof Date)return"date";if(q instanceof RegExp)return"regexp"}return re}function ie(q){var re=ne(q);switch(re){case"array":case"object":return"an "+re;case"boolean":case"date":case"regexp":return"a "+re;default:return re}}function Y(q){return!q.constructor||!q.constructor.name?R:q.constructor.name}return S.checkPropTypes=t,S.resetWarningCache=t.resetWarningCache,S.PropTypes=S,S},factoryWithTypeCheckers}var factoryWithThrowingShims,hasRequiredFactoryWithThrowingShims;function requireFactoryWithThrowingShims(){if(hasRequiredFactoryWithThrowingShims)return factoryWithThrowingShims;hasRequiredFactoryWithThrowingShims=1;var l=requireReactPropTypesSecret();function e(){}function n(){}return n.resetWarningCache=e,factoryWithThrowingShims=function(){function t(d,h,f,u,p,x){if(x!==l){var R=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw R.name="Invariant Violation",R}}t.isRequired=t;function a(){return t}var o={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:a,element:t,elementType:t,instanceOf:a,node:t,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:e};return o.PropTypes=o,o},factoryWithThrowingShims}if(process.env.NODE_ENV!=="production"){var ReactIs=requireReactIs(),throwOnDirectAccess=!0;propTypes.exports=requireFactoryWithTypeCheckers()(ReactIs.isElement,throwOnDirectAccess)}else propTypes.exports=requireFactoryWithThrowingShims()();var propTypesExports=propTypes.exports;const PropTypes=getDefaultExportFromCjs(propTypesExports);function BufferBar({time:l,setTimePoint:e,mandatory:n,mandatoryHasBeenViewed:t,viewed:a}){const o=Math.trunc(l.current*1e3/l.duration)/10,d=React$2.useRef(),[h,f]=React$2.useState(!1),u=Math.trunc(l.current/60)<10?["0",Math.trunc(l.current/60)].join("").trim():Math.trunc(l.current/60),p=Math.trunc(l.current%60)<10?["0",Math.trunc(l.current%60)].join("").trim():Math.trunc(l.current%60),x=(g,v)=>{f(!0);let T=g.offsetX;g.changedTouches&&(T=g.changedTouches[0].clientX);const b=v.offsetWidth+v.offsetLeft;T<=b&&T>=v.offsetLeft&&e(T,v.offsetWidth,v.offsetLeft)},R=()=>{window.onmousemove=null,window.onmouseup=null,f(!1)},S=g=>{window.onmousemove=v=>x(v,g),window.onmouseup=v=>R()},E=(g,v)=>{(!n||n&&t||a)&&(g.preventDefault(),e(g.clientX,v.offsetWidth,v.offsetLeft),S(v),f(!0))};return jsxRuntimeExports.jsx("div",{id:"buffer",ref:d,className:"video--controls__bar",onMouseDown:g=>{const v=d.current;E(g,v)},onTouchMove:g=>{const v=d.current;x(g,v)},onTouchStart:g=>{const v=d.current;f(!0),e(g.changedTouches[0].clientX,v.offsetWidth,v.offsetLeft)},children:jsxRuntimeExports.jsx("div",{className:"video--controls__progress",style:{width:`${o}%`},children:jsxRuntimeExports.jsx("span",{className:h?"video--controls__handle active":"video--controls__handle",children:h?jsxRuntimeExports.jsxs("div",{className:"video--current__time active",children:[u,":",p]}):null})})})}BufferBar.defaultProps={time:{current:0,duration:0},setTimePoint:()=>{}};BufferBar.propTypes={time:PropTypes.shape({current:PropTypes.number,duration:PropTypes.number}),setTimePoint:PropTypes.func};function Timer({time:l}){const e=Math.trunc(l.current/60)<10?["0",Math.trunc(l.current/60)].join("").trim():Math.trunc(l.current/60),n=Math.trunc(l.current%60)<10?["0",Math.trunc(l.current%60)].join("").trim():Math.trunc(l.current%60),t=Math.trunc(l.duration/60)<10?["0",Math.trunc(l.duration/60)].join("").trim():Math.trunc(l.duration/60),a=Math.trunc(l.duration%60)<10?["0",Math.trunc(l.duration%60)].join("").trim():Math.trunc(l.duration%60);return jsxRuntimeExports.jsxs("div",{className:"video--time",children:[jsxRuntimeExports.jsxs("span",{className:"time",children:[e,":",n]}),jsxRuntimeExports.jsxs("span",{className:"duration",children:[t,":",a]})]})}Timer.defaultProps={time:{current:0,duration:0}};Timer.propTypes={time:PropTypes.shape({current:PropTypes.number,duration:PropTypes.number})};function ControlButtons({pauseVideo:l,paused:e,translate:n}){return jsxRuntimeExports.jsx("div",{className:"video--controls__buttons",children:jsxRuntimeExports.jsx("button",{id:"playPause","aria-label":n(e?"storylines.misc.play":"storylines.misc.pause"),className:e?"unset-button icon-play":"unset-button icon-pause",type:"button",onClick:()=>{l(),document.querySelector("#playPause").blur()}})})}ControlButtons.defaultProps={paused:!1,pauseVideo:()=>{}};function FinishedVideoButtons({restart:l,translate:e}){return jsxRuntimeExports.jsx("div",{className:"video--extra__actions video--extra__actions--widthTransparencyLayer position--absolute z-index1",children:jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>{l()},className:"gat--btn gat--btn__secondary","aria-label":e("video.replay"),children:[jsxRuntimeExports.jsx("span",{className:"icon-rewind"}),jsxRuntimeExports.jsx("span",{id:"video.replay"})]})})}FinishedVideoButtons.defaultProps={restart:()=>{},finished:!1};function PlayInitButton({play:l,finished:e,paused:n}){return e||!n?jsxRuntimeExports.jsx("div",{}):jsxRuntimeExports.jsx("div",{className:"video--extra__actions position--absolute z-index1",children:jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,"aria-label":"play video",onKeyUp:()=>{},onClick:()=>{l()},className:"play--video__button",children:jsxRuntimeExports.jsx("span",{className:"icon-play-outline"})})})}PlayInitButton.defaultProps={play:()=>{},finished:!1,paused:!1};function skipButton({viewed:l,mandatory:e,finished:n,skip:t,mandatoryHasBeenViewed:a,translate:o}){return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:e&&l||!e||n||a?jsxRuntimeExports.jsx("div",{className:"position--absolute right top z-index2",children:jsxRuntimeExports.jsx("button",{className:"gat--btn__round gat--btn__close",type:"button","aria-label":o("storylines.misc.closePiece"),onKeyUp:()=>{},onClick:()=>{t()},children:jsxRuntimeExports.jsx("span",{className:"icon-close"})})}):null})}skipButton.defaultProps={mandatory:!1,viewed:!1,finished:!1,skip:()=>{}};function VolumeBar({volume:l,muted:e,setVolume:n,mute:t}){const a=React$2.useRef(),o=e?0:Math.floor(l*100),d=(p,x)=>{const R=x.offsetWidth+x.offsetLeft;let S=p.clientX;p.changedTouches&&(S=p.changedTouches[0].clientX),S<=R&&S>=x.offsetLeft&&n(S,x.offsetWidth,x.offsetLeft)},h=()=>{window.onmousemove=null,window.onmouseup=null},f=p=>{window.onmousemove=x=>d(x,p),window.onmouseup=x=>h()},u=(p,x)=>{p.preventDefault(),n(p.clientX,x.offsetWidth,x.offsetLeft),f(x)};return jsxRuntimeExports.jsxs("div",{className:"video--sound",children:[jsxRuntimeExports.jsx("span",{onClick:()=>t(),className:o===0?"icon-sound-off":"icon-sound"}),jsxRuntimeExports.jsx("div",{ref:a,onMouseDown:p=>{const x=a.current;u(p,x)},onTouchMove:p=>{const x=a.current;d(p,x)},onTouchStart:p=>{const x=a.current;n(p.changedTouches[0].clientX,x.offsetWidth,x.offsetLeft)},id:"volume",className:"video--sound__level",children:jsxRuntimeExports.jsx("span",{style:{width:`${o<10?10:o}%`},className:"video--sound__progress",children:jsxRuntimeExports.jsx("span",{className:"video--handle"})})})]})}VolumeBar.defaultProps={volume:0,muted:!1,setVolume:()=>{},mute:()=>{}};VolumeBar.propTypes={volume:PropTypes.number,setVolume:PropTypes.func,mute:PropTypes.func,muted:PropTypes.bool};function VideoControllers({pause:l,mandatory:e,viewed:n,skip:t,rewind:a,paused:o,time:d,finished:h,restart:f,volume:u,muted:p,mute:x,setVolume:R,setTimePoint:S,audioAnimation:E,mandatoryHasBeenViewed:g,translate:v,visibility:T,withoutControls:b,documentType:_}){return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(skipButton,{mandatory:e,finished:h,viewed:n,skip:t,rewind:a,mandatoryHasBeenViewed:g,translate:v}),b?null:jsxRuntimeExports.jsxs("div",{className:`video--controls-wrap ${T?"video--controls-wrap--hidden":""}`,children:[E?null:jsxRuntimeExports.jsx(PlayInitButton,{play:l,paused:o,finished:h}),h&&(_==="document"||_==="lesson")?jsxRuntimeExports.jsx(FinishedVideoButtons,{restart:f,translate:v}):null,jsxRuntimeExports.jsxs("div",{className:"video--controls",children:[jsxRuntimeExports.jsx(BufferBar,{mandatory:e,mandatoryHasBeenViewed:g,time:d,setTimePoint:S,finished:h,viewed:n}),jsxRuntimeExports.jsxs("div",{className:"video--controls__actions",children:[jsxRuntimeExports.jsx(Timer,{time:d}),E?jsxRuntimeExports.jsx("div",{className:"audio-animation-wrap",children:jsxRuntimeExports.jsx("div",{className:`audio-animation ${o?"audio-animation--notAnimate ":null}`})}):null,jsxRuntimeExports.jsx(ControlButtons,{paused:o,pauseVideo:l,translate:v}),jsxRuntimeExports.jsx(VolumeBar,{muted:p,mute:x,volume:u,setVolume:R})]})]})]})]})}VideoControllers.defaultProps={audioAnimation:!1,paused:!1,mandatory:!1,viewed:!1,volume:0,muted:!1,finished:!1,restart:()=>{},pause:()=>{},skip:()=>{},rewind:()=>{},setTimePoint:()=>{},setVolume:()=>{},mute:()=>{},time:{current:0,duration:0}};VideoControllers.propTypes={audioAnimation:PropTypes.bool,paused:PropTypes.bool,mandatory:PropTypes.bool,muted:PropTypes.bool,volume:PropTypes.number,viewed:PropTypes.bool,pause:PropTypes.func,finished:PropTypes.bool,restart:PropTypes.func,skip:PropTypes.func,rewind:PropTypes.func,mute:PropTypes.func,setTimePoint:PropTypes.func,setVolume:PropTypes.func,time:PropTypes.shape({current:PropTypes.number,duration:PropTypes.number})};const defaultBgImageForAudio="https://min.gamelearn.io/css-resources/gamelearn/resources/bgAudioPiece.jpg";function VideoVisor({documentType:l,url:e,required:n,viewed:t,backgroundImage:a,soundActions:o,endVideo:d,translate:h,autoPlay:f,withoutControls:u}){const[p,x]=React$2.useState(!1),[R]=o,[S,E]=React$2.useState(0),[g,v]=React$2.useState(0),[T,b]=React$2.useState(!1),[_,w]=React$2.useState(!0),[C,P]=React$2.useState(!1),[D,N]=React$2.useState(),[k,F]=React$2.useState(0),[M,U]=React$2.useState(!1),$=e&&e.match(/\.m3u8(\?.+=.+)*$/i)&&Hls.isSupported(),B=e&&(e.match(/youtube/i)||e.match(/vimeo/i)),J=e&&(e.match(/.mp3/i)||e.match(/.ogg/i)||e.match(/.wav/i)||e.match(/.m4a/i)),ne={ref:he=>{N(he)},src:e,style:{height:"100%",width:"100%"}},ie=()=>{n&&x(!0),b(!1),D.pause(),w(!0),P(!0),U(!1),l!=="document"&&l!=="lesson"&&d()},Y=()=>{d()},q=()=>{w(!1),b(!1)},re=()=>{b(!0)},ce=()=>{b(!1),E(D.duration)};React$2.useEffect(()=>{let he;if(D){if($){he=new Hls;const ve=`${e}?v=${Math.floor(Math.random()*99999999)}`;he.loadSource(ve),he.attachMedia(D),he.on(Hls.Events.FRAG_LOAD_PROGRESS,(be,Re)=>{const{stats:Le}=Re;v(Le.loaded*100/Le.total)})}return()=>{he&&he.destroy(),he=null}}},[$,e,D]);const fe=()=>{D.currentTime-=15},te=()=>{R("click-ui"),_?(D.play(),P(!1)):D.pause(),w(!_)},H=(he,ve,be)=>{P(!1),D.currentTime=ve?parseFloat((he-be)/ve*D.duration):0},W=()=>{P(!1),D.currentTime=0,te()},V=()=>{R("click-ui"),D.muted=!D.muted},z=(he,ve,be)=>{D.muted=!1;const Re=he-be>=0?(he-be)/ve:0;D.volume=Re*100>10?Re:0,F(D.volume)};React$2.useEffect(()=>{let he;return!M&&!_&&(he=setTimeout(()=>{U(!0),clearTimeout(he)},3e3)),()=>clearTimeout(he)},[M,_]);const Q=()=>{M&&U(!1)},ee=a||defaultBgImageForAudio,le=ee===defaultBgImageForAudio?"cover":"contain",ue={backgroundImage:`url("${ee}")`,backgroundSize:le,backgroundRepeat:"no-repeat",backgroundPosition:"center center"};return jsxRuntimeExports.jsx("div",{className:`video ${n&&!p&&!t?"forward-disabled":""}`,style:J?ue:null,children:B?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"position--absolute right top z-index2",children:jsxRuntimeExports.jsx("button",{type:"button","aria-label":h("storylines.misc.closePiece"),className:"gat--btn__round gat--btn__close",onClick:()=>{R("click-ui"),d()},children:jsxRuntimeExports.jsx("span",{className:"icon-close"})})}),jsxRuntimeExports.jsx("iframe",{className:"embeddedVideo",title:"title",...ne})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(VideoControllers,{documentType:l,visibility:M,mandatoryHasBeenViewed:p,audioAnimation:!!J,skip:d,mandatory:n,viewed:t,volume:D?D.volume:0,mute:V,muted:D?D.muted:!1,paused:_,finished:C,restart:W,setTimePoint:H,time:{duration:S,current:D?D.currentTime:0},rewind:fe,pause:te,volumeState:k,setVolume:z,translate:h,withoutControls:u}),jsxRuntimeExports.jsx("video",{"data-testid":"video-visor-video",autoPlay:f,onMouseMove:()=>Q(),onClick:()=>{Q()},onFocus:()=>{Q()},onCanPlayThrough:ce,onWaiting:re,onEnded:ie,onError:Y,onPlaying:q,...ne,children:jsxRuntimeExports.jsx("track",{kind:"captions"})}),T?jsxRuntimeExports.jsxs("div",{className:"video-loading-container",style:{top:0,left:0},children:[jsxRuntimeExports.jsx("div",{className:"video-loading-container-bg opacity-wrapper"}),jsxRuntimeExports.jsx("div",{className:"popup-alert warning",children:jsxRuntimeExports.jsx("div",{className:"popup-message",children:jsxRuntimeExports.jsx("p",{children:Math.floor(g)})})})]}):null]})})}VideoVisor.defaultProps={url:"",name:"",backgroundImage:null,documentType:"",required:!1,viewed:!1,endVideo:()=>{}};function VideoComponent({emitEvent:l,name:e,documentType:n,document:t,documentId_labelId:a,soundActions:o,required:d,viewed:h,visible:f,img:u,imgId_labelId:p,withoutControls:x,autoPlay:R,keyboardControl:S}){const E=_=>l({type:"translate",payload:_}),{url:g}=t,v=React$2.useMemo(()=>({documentId:a,imgId:p,required:d,name:e,type:"video",viewed:h,documentType:n}),[a,p,d,e,h,n]),T=React$2.useCallback(()=>{l({type:"finishMedia",payload:v})},[l,v]);React$2.useEffect(()=>{f||T()},[T,f]);const b=S({disabled:h,forward:T,escape:T});return React$2.useEffect(()=>b(),[b]),f?jsxRuntimeExports.jsx(VideoVisor,{autoPlay:R,withoutControls:x,backgroundImage:u==null?void 0:u.url,url:g,soundActions:o,documentType:n,required:d,viewed:h,endVideo:()=>T(),translate:E}):null}function ChangeCamera({targetUid:l,emitEvent:e,success:n=!0,onFinish:t=()=>{},transition:a={type:"pan",speed:10}}){const{change:o}=arcadeThreeCore.CameraControls.useStore(),d=fiber.useThree(f=>f.camera),h=React$2.useRef();return React$2.useEffect(()=>{const f=()=>{e({type:"changeCamera",payload:{targetUid:l,transition:a}}),setTimeout(()=>{n&&e({type:"success"}),t()},200)};return d.addEventListener("transitionEnd",f),()=>{d.removeEventListener("transitionEnd",f)}},[d,e,t,n,l,a]),React$2.useEffect(()=>{o&&h.current!==l&&(o(l,a),h.current=l)},[o,l,a]),null}var htmlReactParser={exports:{}},lib$4={},possibleStandardNamesOptimized$1={},SAME$1=0;possibleStandardNamesOptimized$1.SAME=SAME$1;var CAMELCASE$1=1;possibleStandardNamesOptimized$1.CAMELCASE=CAMELCASE$1;possibleStandardNamesOptimized$1.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1};Object.defineProperty(lib$4,"__esModule",{value:!0});function _slicedToArray(l,e){return _arrayWithHoles(l)||_iterableToArrayLimit(l,e)||_unsupportedIterableToArray(l,e)||_nonIterableRest()}function _arrayWithHoles(l){if(Array.isArray(l))return l}function _iterableToArrayLimit(l,e){var n=l==null?null:typeof Symbol<"u"&&l[Symbol.iterator]||l["@@iterator"];if(n!=null){var t=[],a=!0,o=!1,d,h;try{for(n=n.call(l);!(a=(d=n.next()).done)&&(t.push(d.value),!(e&&t.length===e));a=!0);}catch(f){o=!0,h=f}finally{try{!a&&n.return!=null&&n.return()}finally{if(o)throw h}}return t}}function _unsupportedIterableToArray(l,e){if(l){if(typeof l=="string")return _arrayLikeToArray(l,e);var n=Object.prototype.toString.call(l).slice(8,-1);if(n==="Object"&&l.constructor&&(n=l.constructor.name),n==="Map"||n==="Set")return Array.from(l);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(l,e)}}function _arrayLikeToArray(l,e){(e==null||e>l.length)&&(e=l.length);for(var n=0,t=new Array(e);n<e;n++)t[n]=l[n];return t}function _nonIterableRest(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
65
65
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var RESERVED=0,STRING=1,BOOLEANISH_STRING=2,BOOLEAN=3,OVERLOADED_BOOLEAN=4,NUMERIC=5,POSITIVE_NUMERIC=6;function getPropertyInfo(l){return properties.hasOwnProperty(l)?properties[l]:null}function PropertyInfoRecord(l,e,n,t,a,o,d){this.acceptsBooleans=e===BOOLEANISH_STRING||e===BOOLEAN||e===OVERLOADED_BOOLEAN,this.attributeName=t,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=l,this.type=e,this.sanitizeURL=o,this.removeEmptyString=d}var properties={},reservedProps=["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"];reservedProps.forEach(function(l){properties[l]=new PropertyInfoRecord(l,RESERVED,!1,l,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var e=_slicedToArray(l,2),n=e[0],t=e[1];properties[n]=new PropertyInfoRecord(n,STRING,!1,t,null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(l){properties[l]=new PropertyInfoRecord(l,BOOLEANISH_STRING,!1,l.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){properties[l]=new PropertyInfoRecord(l,BOOLEANISH_STRING,!1,l,null,!1,!1)});["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach(function(l){properties[l]=new PropertyInfoRecord(l,BOOLEAN,!1,l.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(l){properties[l]=new PropertyInfoRecord(l,BOOLEAN,!0,l,null,!1,!1)});["capture","download"].forEach(function(l){properties[l]=new PropertyInfoRecord(l,OVERLOADED_BOOLEAN,!1,l,null,!1,!1)});["cols","rows","size","span"].forEach(function(l){properties[l]=new PropertyInfoRecord(l,POSITIVE_NUMERIC,!1,l,null,!1,!1)});["rowSpan","start"].forEach(function(l){properties[l]=new PropertyInfoRecord(l,NUMERIC,!1,l.toLowerCase(),null,!1,!1)});var CAMELIZE=/[\-\:]([a-z])/g,capitalize$1=function l(e){return e[1].toUpperCase()};["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach(function(l){var e=l.replace(CAMELIZE,capitalize$1);properties[e]=new PropertyInfoRecord(e,STRING,!1,l,null,!1,!1)});["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(function(l){var e=l.replace(CAMELIZE,capitalize$1);properties[e]=new PropertyInfoRecord(e,STRING,!1,l,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(l){var e=l.replace(CAMELIZE,capitalize$1);properties[e]=new PropertyInfoRecord(e,STRING,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(l){properties[l]=new PropertyInfoRecord(l,STRING,!1,l.toLowerCase(),null,!1,!1)});var xlinkHref="xlinkHref";properties[xlinkHref]=new PropertyInfoRecord("xlinkHref",STRING,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(l){properties[l]=new PropertyInfoRecord(l,STRING,!1,l.toLowerCase(),null,!0,!0)});var _require=possibleStandardNamesOptimized$1,CAMELCASE=_require.CAMELCASE,SAME=_require.SAME,possibleStandardNamesOptimized=_require.possibleStandardNames,ATTRIBUTE_NAME_START_CHAR=":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",ATTRIBUTE_NAME_CHAR=ATTRIBUTE_NAME_START_CHAR+"\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",isCustomAttribute=RegExp.prototype.test.bind(new RegExp("^(data|aria)-["+ATTRIBUTE_NAME_CHAR+"]*$")),possibleStandardNames=Object.keys(possibleStandardNamesOptimized).reduce(function(l,e){var n=possibleStandardNamesOptimized[e];return n===SAME?l[e]=e:n===CAMELCASE?l[e.toLowerCase()]=e:l[e]=n,l},{});lib$4.BOOLEAN=BOOLEAN;lib$4.BOOLEANISH_STRING=BOOLEANISH_STRING;lib$4.NUMERIC=NUMERIC;lib$4.OVERLOADED_BOOLEAN=OVERLOADED_BOOLEAN;lib$4.POSITIVE_NUMERIC=POSITIVE_NUMERIC;lib$4.RESERVED=RESERVED;lib$4.STRING=STRING;lib$4.getPropertyInfo=getPropertyInfo;lib$4.isCustomAttribute=isCustomAttribute;lib$4.possibleStandardNames=possibleStandardNames;var cjs={},COMMENT_REGEX=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,NEWLINE_REGEX=/\n/g,WHITESPACE_REGEX=/^\s*/,PROPERTY_REGEX=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,COLON_REGEX=/^:\s*/,VALUE_REGEX=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,SEMICOLON_REGEX=/^[;\s]*/,TRIM_REGEX=/^\s+|\s+$/g,NEWLINE=`
66
66
  `,FORWARD_SLASH="/",ASTERISK="*",EMPTY_STRING$1="",TYPE_COMMENT="comment",TYPE_DECLARATION="declaration",inlineStyleParser=function(l,e){if(typeof l!="string")throw new TypeError("First argument must be a string");if(!l)return[];e=e||{};var n=1,t=1;function a(E){var g=E.match(NEWLINE_REGEX);g&&(n+=g.length);var v=E.lastIndexOf(NEWLINE);t=~v?E.length-v:t+E.length}function o(){var E={line:n,column:t};return function(g){return g.position=new d(E),u(),g}}function d(E){this.start=E,this.end={line:n,column:t},this.source=e.source}d.prototype.content=l;function h(E){var g=new Error(e.source+":"+n+":"+t+": "+E);if(g.reason=E,g.filename=e.source,g.line=n,g.column=t,g.source=l,!e.silent)throw g}function f(E){var g=E.exec(l);if(g){var v=g[0];return a(v),l=l.slice(v.length),g}}function u(){f(WHITESPACE_REGEX)}function p(E){var g;for(E=E||[];g=x();)g!==!1&&E.push(g);return E}function x(){var E=o();if(!(FORWARD_SLASH!=l.charAt(0)||ASTERISK!=l.charAt(1))){for(var g=2;EMPTY_STRING$1!=l.charAt(g)&&(ASTERISK!=l.charAt(g)||FORWARD_SLASH!=l.charAt(g+1));)++g;if(g+=2,EMPTY_STRING$1===l.charAt(g-1))return h("End of comment missing");var v=l.slice(2,g-2);return t+=2,a(v),l=l.slice(g),t+=2,E({type:TYPE_COMMENT,comment:v})}}function R(){var E=o(),g=f(PROPERTY_REGEX);if(g){if(x(),!f(COLON_REGEX))return h("property missing ':'");var v=f(VALUE_REGEX),T=E({type:TYPE_DECLARATION,property:trim(g[0].replace(COMMENT_REGEX,EMPTY_STRING$1)),value:v?trim(v[0].replace(COMMENT_REGEX,EMPTY_STRING$1)):EMPTY_STRING$1});return f(SEMICOLON_REGEX),T}}function S(){var E=[];p(E);for(var g;g=R();)g!==!1&&(E.push(g),p(E));return E}return u(),S()};function trim(l){return l?l.replace(TRIM_REGEX,EMPTY_STRING$1):EMPTY_STRING$1}var parse=inlineStyleParser;function StyleToObject(l,e){var n=null;if(!l||typeof l!="string")return n;for(var t,a=parse(l),o=typeof e=="function",d,h,f=0,u=a.length;f<u;f++)t=a[f],d=t.property,h=t.value,o?e(d,h,t):h&&(n||(n={}),n[d]=h);return n}var styleToObject=StyleToObject,utilities$4={};utilities$4.__esModule=!0;utilities$4.camelCase=void 0;var CUSTOM_PROPERTY_REGEX=/^--[a-zA-Z0-9-]+$/,HYPHEN_REGEX=/-([a-z])/g,NO_HYPHEN_REGEX=/^[^-]+$/,VENDOR_PREFIX_REGEX=/^-(webkit|moz|ms|o|khtml)-/,MS_VENDOR_PREFIX_REGEX=/^-(ms)-/,skipCamelCase=function(l){return!l||NO_HYPHEN_REGEX.test(l)||CUSTOM_PROPERTY_REGEX.test(l)},capitalize=function(l,e){return e.toUpperCase()},trimHyphen=function(l,e){return"".concat(e,"-")},camelCase=function(l,e){return e===void 0&&(e={}),skipCamelCase(l)?l:(l=l.toLowerCase(),e.reactCompat?l=l.replace(MS_VENDOR_PREFIX_REGEX,trimHyphen):l=l.replace(VENDOR_PREFIX_REGEX,trimHyphen),l.replace(HYPHEN_REGEX,capitalize))};utilities$4.camelCase=camelCase;(function(l){var e=commonjsGlobal&&commonjsGlobal.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};l.__esModule=!0;var n=e(styleToObject),t=utilities$4;function a(o,d){var h={};return!o||typeof o!="string"||(0,n.default)(o,function(f,u){f&&u&&(h[(0,t.camelCase)(f,d)]=u)}),h}l.default=a})(cjs);var React$1=React$2,styleToJS=cjs.default;function invertObject(l,e){if(!l||typeof l!="object")throw new TypeError("First argument must be an object");var n,t,a=typeof e=="function",o={},d={};for(n in l){if(t=l[n],a&&(o=e(n,t),o&&o.length===2)){d[o[0]]=o[1];continue}typeof t=="string"&&(d[t]=n)}return d}function isCustomComponent(l,e){if(l.indexOf("-")===-1)return e&&typeof e.is=="string";switch(l){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var styleToJSOptions={reactCompat:!0};function setStyleProp$1(l,e){if(l!=null)try{e.style=styleToJS(l,styleToJSOptions)}catch{e.style={}}}var PRESERVE_CUSTOM_ATTRIBUTES=React$1.version.split(".")[0]>=16,elementsWithNoTextChildren=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);function canTextBeChildOfNode$1(l){return!elementsWithNoTextChildren.has(l.name)}var utilities$3={PRESERVE_CUSTOM_ATTRIBUTES,invertObject,isCustomComponent,setStyleProp:setStyleProp$1,canTextBeChildOfNode:canTextBeChildOfNode$1,elementsWithNoTextChildren},reactProperty=lib$4,utilities$2=utilities$3,attributesToProps$2=function l(e){e=e||{};var n={reset:!0,submit:!0},t,a,o,d,h,f={},u=e.type&&n[e.type];for(t in e){if(o=e[t],reactProperty.isCustomAttribute(t)){f[t]=o;continue}if(a=t.toLowerCase(),d=getPropName(a),d){switch(h=reactProperty.getPropertyInfo(d),(d==="checked"||d==="value")&&!u&&(d=getPropName("default"+a)),f[d]=o,h&&h.type){case reactProperty.BOOLEAN:f[d]=!0;break;case reactProperty.OVERLOADED_BOOLEAN:o===""&&(f[d]=!0);break}continue}utilities$2.PRESERVE_CUSTOM_ATTRIBUTES&&(f[t]=o)}return utilities$2.setStyleProp(e.style,f),f};function getPropName(l){return reactProperty.possibleStandardNames[l]}var React=React$2,attributesToProps$1=attributesToProps$2,utilities$1=utilities$3,setStyleProp=utilities$1.setStyleProp,canTextBeChildOfNode=utilities$1.canTextBeChildOfNode;function domToReact$1(l,e){e=e||{};for(var n=e.library||React,t=n.cloneElement,a=n.createElement,o=n.isValidElement,d=[],h,f,u=typeof e.replace=="function",p,x,R,S=e.trim,E=0,g=l.length;E<g;E++){if(h=l[E],u&&(p=e.replace(h),o(p))){g>1&&(p=t(p,{key:p.key||E})),d.push(p);continue}if(h.type==="text"){if(f=!h.data.trim().length,f&&h.parent&&!canTextBeChildOfNode(h.parent)||S&&f)continue;d.push(h.data);continue}switch(x=h.attribs,skipAttributesToProps(h)?setStyleProp(x.style,x):x&&(x=attributesToProps$1(x)),R=null,h.type){case"script":case"style":h.children[0]&&(x.dangerouslySetInnerHTML={__html:h.children[0].data});break;case"tag":h.name==="textarea"&&h.children[0]?x.defaultValue=h.children[0].data:h.children&&h.children.length&&(R=domToReact$1(h.children,e));break;default:continue}g>1&&(x.key=E),d.push(a(h.name,x,R))}return d.length===1?d[0]:d}function skipAttributesToProps(l){return utilities$1.PRESERVE_CUSTOM_ATTRIBUTES&&l.type==="tag"&&utilities$1.isCustomComponent(l.name,l.attribs)}var domToReact_1=domToReact$1,CASE_SENSITIVE_TAG_NAMES$1=["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussainBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"],constants$2={CASE_SENSITIVE_TAG_NAMES:CASE_SENSITIVE_TAG_NAMES$1},node={},lib$3={},hasRequiredLib$1;function requireLib$1(){return hasRequiredLib$1||(hasRequiredLib$1=1,function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.Doctype=l.CDATA=l.Tag=l.Style=l.Script=l.Comment=l.Directive=l.Text=l.Root=l.isTag=l.ElementType=void 0;var e;(function(t){t.Root="root",t.Text="text",t.Directive="directive",t.Comment="comment",t.Script="script",t.Style="style",t.Tag="tag",t.CDATA="cdata",t.Doctype="doctype"})(e=l.ElementType||(l.ElementType={}));function n(t){return t.type===e.Tag||t.type===e.Script||t.type===e.Style}l.isTag=n,l.Root=e.Root,l.Text=e.Text,l.Directive=e.Directive,l.Comment=e.Comment,l.Script=e.Script,l.Style=e.Style,l.Tag=e.Tag,l.CDATA=e.CDATA,l.Doctype=e.Doctype}(lib$3)),lib$3}var __extends=commonjsGlobal&&commonjsGlobal.__extends||function(){var l=function(e,n){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,a){t.__proto__=a}||function(t,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(t[o]=a[o])},l(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");l(e,n);function t(){this.constructor=e}e.prototype=n===null?Object.create(n):(t.prototype=n.prototype,new t)}}(),__assign=commonjsGlobal&&commonjsGlobal.__assign||function(){return __assign=Object.assign||function(l){for(var e,n=1,t=arguments.length;n<t;n++){e=arguments[n];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(l[a]=e[a])}return l},__assign.apply(this,arguments)};Object.defineProperty(node,"__esModule",{value:!0});node.cloneNode=node.hasChildren=node.isDocument=node.isDirective=node.isComment=node.isText=node.isCDATA=node.isTag=node.Element=node.Document=node.NodeWithChildren=node.ProcessingInstruction=node.Comment=node.Text=node.DataNode=node.Node=void 0;var domelementtype_1=requireLib$1(),nodeTypes=new Map([[domelementtype_1.ElementType.Tag,1],[domelementtype_1.ElementType.Script,1],[domelementtype_1.ElementType.Style,1],[domelementtype_1.ElementType.Directive,1],[domelementtype_1.ElementType.Text,3],[domelementtype_1.ElementType.CDATA,4],[domelementtype_1.ElementType.Comment,8],[domelementtype_1.ElementType.Root,9]]),Node$2=function(){function l(e){this.type=e,this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(l.prototype,"nodeType",{get:function(){var e;return(e=nodeTypes.get(this.type))!==null&&e!==void 0?e:1},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"parentNode",{get:function(){return this.parent},set:function(e){this.parent=e},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"previousSibling",{get:function(){return this.prev},set:function(e){this.prev=e},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"nextSibling",{get:function(){return this.next},set:function(e){this.next=e},enumerable:!1,configurable:!0}),l.prototype.cloneNode=function(e){return e===void 0&&(e=!1),cloneNode(this,e)},l}();node.Node=Node$2;var DataNode=function(l){__extends(e,l);function e(n,t){var a=l.call(this,n)||this;return a.data=t,a}return Object.defineProperty(e.prototype,"nodeValue",{get:function(){return this.data},set:function(n){this.data=n},enumerable:!1,configurable:!0}),e}(Node$2);node.DataNode=DataNode;var Text$4=function(l){__extends(e,l);function e(n){return l.call(this,domelementtype_1.ElementType.Text,n)||this}return e}(DataNode);node.Text=Text$4;var Comment$1=function(l){__extends(e,l);function e(n){return l.call(this,domelementtype_1.ElementType.Comment,n)||this}return e}(DataNode);node.Comment=Comment$1;var ProcessingInstruction$1=function(l){__extends(e,l);function e(n,t){var a=l.call(this,domelementtype_1.ElementType.Directive,t)||this;return a.name=n,a}return e}(DataNode);node.ProcessingInstruction=ProcessingInstruction$1;var NodeWithChildren=function(l){__extends(e,l);function e(n,t){var a=l.call(this,n)||this;return a.children=t,a}return Object.defineProperty(e.prototype,"firstChild",{get:function(){var n;return(n=this.children[0])!==null&&n!==void 0?n:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastChild",{get:function(){return this.children.length>0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"childNodes",{get:function(){return this.children},set:function(n){this.children=n},enumerable:!1,configurable:!0}),e}(Node$2);node.NodeWithChildren=NodeWithChildren;var Document=function(l){__extends(e,l);function e(n){return l.call(this,domelementtype_1.ElementType.Root,n)||this}return e}(NodeWithChildren);node.Document=Document;var Element$1=function(l){__extends(e,l);function e(n,t,a,o){a===void 0&&(a=[]),o===void 0&&(o=n==="script"?domelementtype_1.ElementType.Script:n==="style"?domelementtype_1.ElementType.Style:domelementtype_1.ElementType.Tag);var d=l.call(this,o,a)||this;return d.name=n,d.attribs=t,d}return Object.defineProperty(e.prototype,"tagName",{get:function(){return this.name},set:function(n){this.name=n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"attributes",{get:function(){var n=this;return Object.keys(this.attribs).map(function(t){var a,o;return{name:t,value:n.attribs[t],namespace:(a=n["x-attribsNamespace"])===null||a===void 0?void 0:a[t],prefix:(o=n["x-attribsPrefix"])===null||o===void 0?void 0:o[t]}})},enumerable:!1,configurable:!0}),e}(NodeWithChildren);node.Element=Element$1;function isTag(l){return(0,domelementtype_1.isTag)(l)}node.isTag=isTag;function isCDATA(l){return l.type===domelementtype_1.ElementType.CDATA}node.isCDATA=isCDATA;function isText(l){return l.type===domelementtype_1.ElementType.Text}node.isText=isText;function isComment(l){return l.type===domelementtype_1.ElementType.Comment}node.isComment=isComment;function isDirective(l){return l.type===domelementtype_1.ElementType.Directive}node.isDirective=isDirective;function isDocument(l){return l.type===domelementtype_1.ElementType.Root}node.isDocument=isDocument;function hasChildren(l){return Object.prototype.hasOwnProperty.call(l,"children")}node.hasChildren=hasChildren;function cloneNode(l,e){e===void 0&&(e=!1);var n;if(isText(l))n=new Text$4(l.data);else if(isComment(l))n=new Comment$1(l.data);else if(isTag(l)){var t=e?cloneChildren(l.children):[],a=new Element$1(l.name,__assign({},l.attribs),t);t.forEach(function(f){return f.parent=a}),l.namespace!=null&&(a.namespace=l.namespace),l["x-attribsNamespace"]&&(a["x-attribsNamespace"]=__assign({},l["x-attribsNamespace"])),l["x-attribsPrefix"]&&(a["x-attribsPrefix"]=__assign({},l["x-attribsPrefix"])),n=a}else if(isCDATA(l)){var t=e?cloneChildren(l.children):[],o=new NodeWithChildren(domelementtype_1.ElementType.CDATA,t);t.forEach(function(u){return u.parent=o}),n=o}else if(isDocument(l)){var t=e?cloneChildren(l.children):[],d=new Document(t);t.forEach(function(u){return u.parent=d}),l["x-mode"]&&(d["x-mode"]=l["x-mode"]),n=d}else if(isDirective(l)){var h=new ProcessingInstruction$1(l.name,l.data);l["x-name"]!=null&&(h["x-name"]=l["x-name"],h["x-publicId"]=l["x-publicId"],h["x-systemId"]=l["x-systemId"]),n=h}else throw new Error("Not implemented yet: ".concat(l.type));return n.startIndex=l.startIndex,n.endIndex=l.endIndex,l.sourceCodeLocation!=null&&(n.sourceCodeLocation=l.sourceCodeLocation),n}node.cloneNode=cloneNode;function cloneChildren(l){for(var e=l.map(function(t){return cloneNode(t,!0)}),n=1;n<e.length;n++)e[n].prev=e[n-1],e[n-1].next=e[n];return e}var constants$1=constants$2,domhandler=node,CASE_SENSITIVE_TAG_NAMES=constants$1.CASE_SENSITIVE_TAG_NAMES,Comment=domhandler.Comment,Element=domhandler.Element,ProcessingInstruction=domhandler.ProcessingInstruction,Text$3=domhandler.Text,caseSensitiveTagNamesMap={},tagName;for(var i$1=0,len=CASE_SENSITIVE_TAG_NAMES.length;i$1<len;i$1++)tagName=CASE_SENSITIVE_TAG_NAMES[i$1],caseSensitiveTagNamesMap[tagName.toLowerCase()]=tagName;function getCaseSensitiveTagName(l){return caseSensitiveTagNamesMap[l]}function formatAttributes(l){for(var e={},n,t=0,a=l.length;t<a;t++)n=l[t],e[n.name]=n.value;return e}function formatTagName(l){l=l.toLowerCase();var e=getCaseSensitiveTagName(l);return e||l}function formatDOM$1(l,e,n){e=e||null;for(var t=[],a=0,o=l.length;a<o;a++){var d=l[a],h;switch(d.nodeType){case 1:h=new Element(formatTagName(d.nodeName),formatAttributes(d.attributes)),h.children=formatDOM$1(d.childNodes,h);break;case 3:h=new Text$3(d.nodeValue);break;case 8:h=new Comment(d.nodeValue);break;default:continue}var f=t[a-1]||null;f&&(f.next=h),h.parent=e,h.prev=f,h.next=null,t.push(h)}return n&&(h=new ProcessingInstruction(n.substring(0,n.indexOf(" ")).toLowerCase(),n),h.next=t[0]||null,h.parent=e,t.unshift(h),t[1]&&(t[1].prev=t[0])),t}function isIE$1(){return/(MSIE |Trident\/|Edge\/)/.test(navigator.userAgent)}var utilities={formatAttributes,formatDOM:formatDOM$1,isIE:isIE$1},HTML="html",HEAD="head",BODY="body",FIRST_TAG_REGEX=/<([a-zA-Z]+[0-9]?)/,HEAD_TAG_REGEX=/<head.*>/i,BODY_TAG_REGEX=/<body.*>/i,parseFromDocument=function(){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},parseFromString=function(){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")};if(typeof window.DOMParser=="function"){var domParser=new window.DOMParser,mimeType="text/html";parseFromString=function(l,e){return e&&(l="<"+e+">"+l+"</"+e+">"),domParser.parseFromString(l,mimeType)},parseFromDocument=parseFromString}if(document.implementation){var isIE=utilities.isIE,doc=document.implementation.createHTMLDocument(isIE()?"html-dom-parser":void 0);parseFromDocument=function(l,e){return e?(doc.documentElement.getElementsByTagName(e)[0].innerHTML=l,doc):(doc.documentElement.innerHTML=l,doc)}}var template=document.createElement("template"),parseFromTemplate;template.content&&(parseFromTemplate=function(l){return template.innerHTML=l,template.content.childNodes});function domparser$1(l){var e,n=l.match(FIRST_TAG_REGEX);n&&n[1]&&(e=n[1].toLowerCase());var t,a,o;switch(e){case HTML:return t=parseFromString(l),HEAD_TAG_REGEX.test(l)||(a=t.getElementsByTagName(HEAD)[0],a&&a.parentNode.removeChild(a)),BODY_TAG_REGEX.test(l)||(a=t.getElementsByTagName(BODY)[0],a&&a.parentNode.removeChild(a)),t.getElementsByTagName(HTML);case HEAD:case BODY:return o=parseFromDocument(l).getElementsByTagName(e),BODY_TAG_REGEX.test(l)&&HEAD_TAG_REGEX.test(l)?o[0].parentNode.childNodes:o;default:return parseFromTemplate?parseFromTemplate(l):parseFromDocument(l,BODY).getElementsByTagName(BODY)[0].childNodes}}var domparser_1=domparser$1,domparser=domparser_1,formatDOM=utilities.formatDOM,DIRECTIVE_REGEX=/<(![a-zA-Z\s]+)>/;function HTMLDOMParser(l){if(typeof l!="string")throw new TypeError("First argument must be a string");if(l==="")return[];var e=l.match(DIRECTIVE_REGEX),n;return e&&e[1]&&(n=e[1]),formatDOM(domparser(l),null,n)}var htmlToDom=HTMLDOMParser,lib$2={},hasRequiredLib;function requireLib(){return hasRequiredLib||(hasRequiredLib=1,function(l){var e=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(f,u,p,x){x===void 0&&(x=p);var R=Object.getOwnPropertyDescriptor(u,p);(!R||("get"in R?!u.__esModule:R.writable||R.configurable))&&(R={enumerable:!0,get:function(){return u[p]}}),Object.defineProperty(f,x,R)}:function(f,u,p,x){x===void 0&&(x=p),f[x]=u[p]}),n=commonjsGlobal&&commonjsGlobal.__exportStar||function(f,u){for(var p in f)p!=="default"&&!Object.prototype.hasOwnProperty.call(u,p)&&e(u,f,p)};Object.defineProperty(l,"__esModule",{value:!0}),l.DomHandler=void 0;var t=requireLib$1(),a=node;n(node,l);var o=/\s+/g,d={normalizeWhitespace:!1,withStartIndices:!1,withEndIndices:!1,xmlMode:!1},h=function(){function f(u,p,x){this.dom=[],this.root=new a.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof p=="function"&&(x=p,p=d),typeof u=="object"&&(p=u,u=void 0),this.callback=u??null,this.options=p??d,this.elementCB=x??null}return f.prototype.onparserinit=function(u){this.parser=u},f.prototype.onreset=function(){this.dom=[],this.root=new a.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null},f.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},f.prototype.onerror=function(u){this.handleCallback(u)},f.prototype.onclosetag=function(){this.lastNode=null;var u=this.tagStack.pop();this.options.withEndIndices&&(u.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(u)},f.prototype.onopentag=function(u,p){var x=this.options.xmlMode?t.ElementType.Tag:void 0,R=new a.Element(u,p,void 0,x);this.addNode(R),this.tagStack.push(R)},f.prototype.ontext=function(u){var p=this.options.normalizeWhitespace,x=this.lastNode;if(x&&x.type===t.ElementType.Text)p?x.data=(x.data+u).replace(o," "):x.data+=u,this.options.withEndIndices&&(x.endIndex=this.parser.endIndex);else{p&&(u=u.replace(o," "));var R=new a.Text(u);this.addNode(R),this.lastNode=R}},f.prototype.oncomment=function(u){if(this.lastNode&&this.lastNode.type===t.ElementType.Comment){this.lastNode.data+=u;return}var p=new a.Comment(u);this.addNode(p),this.lastNode=p},f.prototype.oncommentend=function(){this.lastNode=null},f.prototype.oncdatastart=function(){var u=new a.Text(""),p=new a.NodeWithChildren(t.ElementType.CDATA,[u]);this.addNode(p),u.parent=p,this.lastNode=u},f.prototype.oncdataend=function(){this.lastNode=null},f.prototype.onprocessinginstruction=function(u,p){var x=new a.ProcessingInstruction(u,p);this.addNode(x)},f.prototype.handleCallback=function(u){if(typeof this.callback=="function")this.callback(u,this.dom);else if(u)throw u},f.prototype.addNode=function(u){var p=this.tagStack[this.tagStack.length-1],x=p.children[p.children.length-1];this.options.withStartIndices&&(u.startIndex=this.parser.startIndex),this.options.withEndIndices&&(u.endIndex=this.parser.endIndex),p.children.push(u),x&&(u.prev=x,x.next=u),u.parent=p,this.lastNode=null},f}();l.DomHandler=h,l.default=h}(lib$2)),lib$2}var domToReact=domToReact_1,attributesToProps=attributesToProps$2,htmlToDOM=htmlToDom;htmlToDOM=typeof htmlToDOM.default=="function"?htmlToDOM.default:htmlToDOM;var domParserOptions={lowerCaseAttributeNames:!1};function HTMLReactParser(l,e){if(typeof l!="string")throw new TypeError("First argument must be a string");return l===""?[]:(e=e||{},domToReact(htmlToDOM(l,e.htmlparser2||domParserOptions),e))}HTMLReactParser.domToReact=domToReact;HTMLReactParser.htmlToDOM=htmlToDOM;HTMLReactParser.attributesToProps=attributesToProps;HTMLReactParser.Element=requireLib().Element;htmlReactParser.exports=HTMLReactParser;htmlReactParser.exports.default=HTMLReactParser;var htmlReactParserExports=htmlReactParser.exports;const HTMLReactParser$1=getDefaultExportFromCjs(htmlReactParserExports);HTMLReactParser$1.domToReact;HTMLReactParser$1.htmlToDOM;HTMLReactParser$1.attributesToProps;HTMLReactParser$1.Element;function LectureButtons({goToLecture:l,close:e,minutes:n,seconds:t,btnText:a}){return jsxRuntimeExports.jsx("div",{className:"lectures--buttons",children:l?jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn__navigation",onClick:()=>e(),"aria-label":a,children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})}):jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn__count","data-testid":"countdown",children:jsxRuntimeExports.jsxs("span",{children:[n<10?`0${n}`:n,":",t<10?`0${t}`:t]})})})}LectureButtons.defaultProps={goToLecture:!1,close:()=>{},minutes:0,seconds:0};const noop$1=()=>{},useEkho=({voice:l,text:e,audioType:n,loop:t=!1,started:a=!0,slide:o=0,audio:d,soundActions:h,emitEvent:f,volume:u=.5,onFinish:p=noop$1,onError:x=noop$1,onStart:R=noop$1,pauseTTS:S})=>{const[E,g,v,T]=h,b=!d&&!l,[_,w]=React$2.useState(!1),C=React$2.useRef({url:"",cc:"tts"}),P=React$2.useCallback(M=>f({type:"translate",payload:M}),[f]),D=React$2.useCallback(({id:M,type:U="base"})=>{var J;const $=P("usedVoices"),B=P("gameCharacters");return U==="base"?$==null?void 0:$[M]:U==="character"?(J=B==null?void 0:B[M])==null?void 0:J.voiceId:null},[P]),N=React$2.useCallback((M,U="tts")=>{C.current.url===M&&o===C.current.slide||(C.current={url:M,cc:U,slide:o},E(M,U,t,u,p,R,x))},[o,E,t,u,p,R,x]),k=React$2.useCallback(async M=>{if(_&&M.voiceId&&M.text){const U=await f({type:"getSpeech",payload:M});U?N(U):x()}else x()},[f,_,x,N]),F=React$2.useCallback(()=>{C.current.url&&g(C.current.cc)},[g]);return React$2.useEffect(()=>(w(!0),()=>{w(!1),F()}),[F]),React$2.useEffect(()=>{S?v():T()},[v,S,T]),React$2.useEffect(()=>{b&&F()},[b,F]),React$2.useEffect(()=>{if(_&&a)if(n==="voice"&&(l!=null&&l.id)){const M=D(l);k({voiceId:M,text:e})}else(n==="file"||!n)&&d?N(d==null?void 0:d.url):x()},[D,k,_,l,e,n,d==null?void 0:d.url,d,N,x,a]),F},cleanTextOfHtmlTags=l=>{const e=/<\/p>|<\/h1>|<\/h2>|<\/h3>|<\/h4>|<\/h5>|<\/h6>|<\/li>/gi,n=/&quot;|&#39;/gi;if(l)return l.replace(e,". </p>").replace(n,"").replace(/(<([^>]+)>)/gi,"")},READING_TIME=.2;function LecturesComponent({emitEvent:l,name:e,name_labelId:n,required:t,text:a,text_labelId:o,visible:d,documentType:h,viewed:f,soundActions:u,backgroundImage:p,hideBackgroundImageTheme:x=!1,keyboardControl:R,audio:S,audioType:E,audioVolume:g,voice:v,pause:T,styles:b}){const[_,w]=React$2.useState(),[C,P]=React$2.useState(!1),[D,N]=React$2.useState(0),k=a,F=Math.trunc(k.split(" ").length*READING_TIME),M=!t||t&&D>=F||t&&!d,[U]=u,$=`${e}. ${cleanTextOfHtmlTags(a)}`;useEkho({audioType:E,voice:v,text:$,audio:S,soundActions:u,emitEvent:l,volume:g,pauseTTS:T});const B=fe=>l({type:"translate",payload:fe}),J=React$2.useCallback(()=>{M&&(U("click-ui"),l({type:"finishMedia",payload:{name:n,type:"text",text:o,documentType:h}}))},[h,l,M,n,o,U]),ne=R({disabled:f,forward:J,escape:J});React$2.useEffect(()=>ne(),[ne]),React$2.useEffect(()=>{if(!d&&!C&&(J(),P(!0)),t&&d){const fe=setInterval(()=>{N(te=>te+1)},1e3);return w(fe),()=>{clearInterval(fe)}}},[J,t,C,d]),React$2.useEffect(()=>{D===F&&clearInterval(_)},[_,D,F]);const ie=F-D,Y=Math.floor(ie/60),q=ie%60,re=React$2.useMemo(()=>{let fe="";return f?fe="notes--results":(fe="lectures--container",b&&(fe+=` lectures--container--${b}`),p!=null&&p.url&&(fe+=" lectures--container--with-custom-bg"),b&&x&&(fe+=" disable-background-image")),fe},[p==null?void 0:p.url,x,b,f]),ce={backgroundImage:p!=null&&p.url?`url('${p.url}')`:""};return d?jsxRuntimeExports.jsx("div",{className:re,style:ce,children:jsxRuntimeExports.jsx("div",{className:f?"":"lectures__overlay",children:jsxRuntimeExports.jsxs("div",{className:f?"notes--results__text":`lectures lectures--${b}`,children:[jsxRuntimeExports.jsx("div",{className:"lectures--title",children:e}),jsxRuntimeExports.jsxs("div",{className:"lectures--text",dir:"auto",children:[jsxRuntimeExports.jsx("div",{children:k?HTMLReactParser$1(k):null}),f?null:jsxRuntimeExports.jsx(LectureButtons,{goToLecture:M,close:J,minutes:Y,seconds:q,btnText:B("screens.continue")})]})]})})}):null}LecturesComponent.defaultProps={emitEvent:()=>{},name:"",text:"",visible:!1,documentType:"",viewed:!1,required:!1,context:{},styles:""};function Slot({character:l,active:e,slot:n,lowQuality:t}){var R;const a=l.type==="image",o=l.type==="character",d=l.type==="object",h=(R=l==null?void 0:l.resource)==null?void 0:R.url,f=()=>a?`url(${h})`:o&&t?`url(${h.replace("character.glb","face.png")})`:d&&t?`url(${h.replace("object.glb","thumbnail.png")})`:"",u=()=>a?"contain":o||d?"auto 95%":"",p=()=>a?"center":o||d?"center bottom":"",x=a||t?{backgroundImage:f(),backgroundRepeat:"no-repeat",backgroundPosition:p(),backgroundSize:u()}:{};return jsxRuntimeExports.jsx("div",{className:`conversation--character__item ${e?"active":""} ${n}`,style:x,children:e&&l.name?jsxRuntimeExports.jsx("span",{className:"conversation--character__name",children:l.name}):null},l.name)}Slot.propTypes={character:PropTypes.shape({name:PropTypes.string,url:PropTypes.string,type:PropTypes.string,emotion:PropTypes.string,uid:PropTypes.string,resource:PropTypes.shape({resourceId:PropTypes.string,url:PropTypes.string})}),active:PropTypes.bool,slot:PropTypes.number};Slot.defaultProps={character:{name:"",url:"",type:"",resource:{resourceId:""}},active:!1,slot:0};function toTrianglesDrawMode(l,e){if(e===three.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),l;if(e===three.TriangleFanDrawMode||e===three.TriangleStripDrawMode){let n=l.getIndex();if(n===null){const d=[],h=l.getAttribute("position");if(h!==void 0){for(let f=0;f<h.count;f++)d.push(f);l.setIndex(d),n=l.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),l}const t=n.count-2,a=[];if(e===three.TriangleFanDrawMode)for(let d=1;d<=t;d++)a.push(n.getX(0)),a.push(n.getX(d)),a.push(n.getX(d+1));else for(let d=0;d<t;d++)d%2===0?(a.push(n.getX(d)),a.push(n.getX(d+1)),a.push(n.getX(d+2))):(a.push(n.getX(d+2)),a.push(n.getX(d+1)),a.push(n.getX(d)));a.length/3!==t&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=l.clone();return o.setIndex(a),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),l}class GLTFLoader extends three.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(n){return new GLTFMaterialsClearcoatExtension(n)}),this.register(function(n){return new GLTFTextureBasisUExtension(n)}),this.register(function(n){return new GLTFTextureWebPExtension(n)}),this.register(function(n){return new GLTFTextureAVIFExtension(n)}),this.register(function(n){return new GLTFMaterialsSheenExtension(n)}),this.register(function(n){return new GLTFMaterialsTransmissionExtension(n)}),this.register(function(n){return new GLTFMaterialsVolumeExtension(n)}),this.register(function(n){return new GLTFMaterialsIorExtension(n)}),this.register(function(n){return new GLTFMaterialsEmissiveStrengthExtension(n)}),this.register(function(n){return new GLTFMaterialsSpecularExtension(n)}),this.register(function(n){return new GLTFMaterialsIridescenceExtension(n)}),this.register(function(n){return new GLTFMaterialsAnisotropyExtension(n)}),this.register(function(n){return new GLTFMaterialsBumpExtension(n)}),this.register(function(n){return new GLTFLightsExtension(n)}),this.register(function(n){return new GLTFMeshoptCompression(n)}),this.register(function(n){return new GLTFMeshGpuInstancing(n)})}load(e,n,t,a){const o=this;let d;if(this.resourcePath!=="")d=this.resourcePath;else if(this.path!==""){const u=three.LoaderUtils.extractUrlBase(e);d=three.LoaderUtils.resolveURL(u,this.path)}else d=three.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const h=function(u){a?a(u):console.error(u),o.manager.itemError(e),o.manager.itemEnd(e)},f=new three.FileLoader(this.manager);f.setPath(this.path),f.setResponseType("arraybuffer"),f.setRequestHeader(this.requestHeader),f.setWithCredentials(this.withCredentials),f.load(e,function(u){try{o.parse(u,d,function(p){n(p),o.manager.itemEnd(e)},h)}catch(p){h(p)}},t,h)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,n,t,a){let o;const d={},h={},f=new TextDecoder;if(typeof e=="string")o=JSON.parse(e);else if(e instanceof ArrayBuffer)if(f.decode(new Uint8Array(e,0,4))===BINARY_EXTENSION_HEADER_MAGIC){try{d[EXTENSIONS.KHR_BINARY_GLTF]=new GLTFBinaryExtension(e)}catch(x){a&&a(x);return}o=JSON.parse(d[EXTENSIONS.KHR_BINARY_GLTF].content)}else o=JSON.parse(f.decode(e));else o=e;if(o.asset===void 0||o.asset.version[0]<2){a&&a(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const u=new GLTFParser(o,{path:n||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(let p=0;p<this.pluginCallbacks.length;p++){const x=this.pluginCallbacks[p](u);x.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),h[x.name]=x,d[x.name]=!0}if(o.extensionsUsed)for(let p=0;p<o.extensionsUsed.length;++p){const x=o.extensionsUsed[p],R=o.extensionsRequired||[];switch(x){case EXTENSIONS.KHR_MATERIALS_UNLIT:d[x]=new GLTFMaterialsUnlitExtension;break;case EXTENSIONS.KHR_DRACO_MESH_COMPRESSION:d[x]=new GLTFDracoMeshCompressionExtension(o,this.dracoLoader);break;case EXTENSIONS.KHR_TEXTURE_TRANSFORM:d[x]=new GLTFTextureTransformExtension;break;case EXTENSIONS.KHR_MESH_QUANTIZATION:d[x]=new GLTFMeshQuantizationExtension;break;default:R.indexOf(x)>=0&&h[x]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+x+'".')}}u.setExtensions(d),u.setPlugins(h),u.parse(t,a)}parseAsync(e,n){const t=this;return new Promise(function(a,o){t.parse(e,n,a,o)})}}function GLTFRegistry(){let l={};return{get:function(e){return l[e]},add:function(e,n){l[e]=n},remove:function(e){delete l[e]},removeAll:function(){l={}}}}const EXTENSIONS={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class GLTFLightsExtension{constructor(e){this.parser=e,this.name=EXTENSIONS.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,n=this.parser.json.nodes||[];for(let t=0,a=n.length;t<a;t++){const o=n[t];o.extensions&&o.extensions[this.name]&&o.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,o.extensions[this.name].light)}}_loadLight(e){const n=this.parser,t="light:"+e;let a=n.cache.get(t);if(a)return a;const o=n.json,f=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e];let u;const p=new three.Color(16777215);f.color!==void 0&&p.setRGB(f.color[0],f.color[1],f.color[2],three.LinearSRGBColorSpace);const x=f.range!==void 0?f.range:0;switch(f.type){case"directional":u=new three.DirectionalLight(p),u.target.position.set(0,0,-1),u.add(u.target);break;case"point":u=new three.PointLight(p),u.distance=x;break;case"spot":u=new three.SpotLight(p),u.distance=x,f.spot=f.spot||{},f.spot.innerConeAngle=f.spot.innerConeAngle!==void 0?f.spot.innerConeAngle:0,f.spot.outerConeAngle=f.spot.outerConeAngle!==void 0?f.spot.outerConeAngle:Math.PI/4,u.angle=f.spot.outerConeAngle,u.penumbra=1-f.spot.innerConeAngle/f.spot.outerConeAngle,u.target.position.set(0,0,-1),u.add(u.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+f.type)}return u.position.set(0,0,0),u.decay=2,assignExtrasToUserData(u,f),f.intensity!==void 0&&(u.intensity=f.intensity),u.name=n.createUniqueName(f.name||"light_"+e),a=Promise.resolve(u),n.cache.add(t,a),a}getDependency(e,n){if(e==="light")return this._loadLight(n)}createNodeAttachment(e){const n=this,t=this.parser,o=t.json.nodes[e],h=(o.extensions&&o.extensions[this.name]||{}).light;return h===void 0?null:this._loadLight(h).then(function(f){return t._getNodeRef(n.cache,h,f)})}}class GLTFMaterialsUnlitExtension{constructor(){this.name=EXTENSIONS.KHR_MATERIALS_UNLIT}getMaterialType(){return three.MeshBasicMaterial}extendParams(e,n,t){const a=[];e.color=new three.Color(1,1,1),e.opacity=1;const o=n.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const d=o.baseColorFactor;e.color.setRGB(d[0],d[1],d[2],three.LinearSRGBColorSpace),e.opacity=d[3]}o.baseColorTexture!==void 0&&a.push(t.assignTexture(e,"map",o.baseColorTexture,three.SRGBColorSpace))}return Promise.all(a)}}class GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.parser=e,this.name=EXTENSIONS.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,n){const a=this.parser.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const o=a.extensions[this.name].emissiveStrength;return o!==void 0&&(n.emissiveIntensity=o),Promise.resolve()}}class GLTFMaterialsClearcoatExtension{constructor(e){this.parser=e,this.name=EXTENSIONS.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:three.MeshPhysicalMaterial}extendMaterialParams(e,n){const t=this.parser,a=t.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const o=[],d=a.extensions[this.name];if(d.clearcoatFactor!==void 0&&(n.clearcoat=d.clearcoatFactor),d.clearcoatTexture!==void 0&&o.push(t.assignTexture(n,"clearcoatMap",d.clearcoatTexture)),d.clearcoatRoughnessFactor!==void 0&&(n.clearcoatRoughness=d.clearcoatRoughnessFactor),d.clearcoatRoughnessTexture!==void 0&&o.push(t.assignTexture(n,"clearcoatRoughnessMap",d.clearcoatRoughnessTexture)),d.clearcoatNormalTexture!==void 0&&(o.push(t.assignTexture(n,"clearcoatNormalMap",d.clearcoatNormalTexture)),d.clearcoatNormalTexture.scale!==void 0)){const h=d.clearcoatNormalTexture.scale;n.clearcoatNormalScale=new three.Vector2(h,h)}return Promise.all(o)}}class GLTFMaterialsIridescenceExtension{constructor(e){this.parser=e,this.name=EXTENSIONS.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:three.MeshPhysicalMaterial}extendMaterialParams(e,n){const t=this.parser,a=t.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const o=[],d=a.extensions[this.name];return d.iridescenceFactor!==void 0&&(n.iridescence=d.iridescenceFactor),d.iridescenceTexture!==void 0&&o.push(t.assignTexture(n,"iridescenceMap",d.iridescenceTexture)),d.iridescenceIor!==void 0&&(n.iridescenceIOR=d.iridescenceIor),n.iridescenceThicknessRange===void 0&&(n.iridescenceThicknessRange=[100,400]),d.iridescenceThicknessMinimum!==void 0&&(n.iridescenceThicknessRange[0]=d.iridescenceThicknessMinimum),d.iridescenceThicknessMaximum!==void 0&&(n.iridescenceThicknessRange[1]=d.iridescenceThicknessMaximum),d.iridescenceThicknessTexture!==void 0&&o.push(t.assignTexture(n,"iridescenceThicknessMap",d.iridescenceThicknessTexture)),Promise.all(o)}}class GLTFMaterialsSheenExtension{constructor(e){this.parser=e,this.name=EXTENSIONS.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:three.MeshPhysicalMaterial}extendMaterialParams(e,n){const t=this.parser,a=t.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const o=[];n.sheenColor=new three.Color(0,0,0),n.sheenRoughness=0,n.sheen=1;const d=a.extensions[this.name];if(d.sheenColorFactor!==void 0){const h=d.sheenColorFactor;n.sheenColor.setRGB(h[0],h[1],h[2],three.LinearSRGBColorSpace)}return d.sheenRoughnessFactor!==void 0&&(n.sheenRoughness=d.sheenRoughnessFactor),d.sheenColorTexture!==void 0&&o.push(t.assignTexture(n,"sheenColorMap",d.sheenColorTexture,three.SRGBColorSpace)),d.sheenRoughnessTexture!==void 0&&o.push(t.assignTexture(n,"sheenRoughnessMap",d.sheenRoughnessTexture)),Promise.all(o)}}class GLTFMaterialsTransmissionExtension{constructor(e){this.parser=e,this.name=EXTENSIONS.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:three.MeshPhysicalMaterial}extendMaterialParams(e,n){const t=this.parser,a=t.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const o=[],d=a.extensions[this.name];return d.transmissionFactor!==void 0&&(n.transmission=d.transmissionFactor),d.transmissionTexture!==void 0&&o.push(t.assignTexture(n,"transmissionMap",d.transmissionTexture)),Promise.all(o)}}class GLTFMaterialsVolumeExtension{constructor(e){this.parser=e,this.name=EXTENSIONS.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:three.MeshPhysicalMaterial}extendMaterialParams(e,n){const t=this.parser,a=t.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const o=[],d=a.extensions[this.name];n.thickness=d.thicknessFactor!==void 0?d.thicknessFactor:0,d.thicknessTexture!==void 0&&o.push(t.assignTexture(n,"thicknessMap",d.thicknessTexture)),n.attenuationDistance=d.attenuationDistance||1/0;const h=d.attenuationColor||[1,1,1];return n.attenuationColor=new three.Color().setRGB(h[0],h[1],h[2],three.LinearSRGBColorSpace),Promise.all(o)}}class GLTFMaterialsIorExtension{constructor(e){this.parser=e,this.name=EXTENSIONS.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:three.MeshPhysicalMaterial}extendMaterialParams(e,n){const a=this.parser.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const o=a.extensions[this.name];return n.ior=o.ior!==void 0?o.ior:1.5,Promise.resolve()}}class GLTFMaterialsSpecularExtension{constructor(e){this.parser=e,this.name=EXTENSIONS.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:three.MeshPhysicalMaterial}extendMaterialParams(e,n){const t=this.parser,a=t.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const o=[],d=a.extensions[this.name];n.specularIntensity=d.specularFactor!==void 0?d.specularFactor:1,d.specularTexture!==void 0&&o.push(t.assignTexture(n,"specularIntensityMap",d.specularTexture));const h=d.specularColorFactor||[1,1,1];return n.specularColor=new three.Color().setRGB(h[0],h[1],h[2],three.LinearSRGBColorSpace),d.specularColorTexture!==void 0&&o.push(t.assignTexture(n,"specularColorMap",d.specularColorTexture,three.SRGBColorSpace)),Promise.all(o)}}class GLTFMaterialsBumpExtension{constructor(e){this.parser=e,this.name=EXTENSIONS.EXT_MATERIALS_BUMP}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:three.MeshPhysicalMaterial}extendMaterialParams(e,n){const t=this.parser,a=t.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const o=[],d=a.extensions[this.name];return n.bumpScale=d.bumpFactor!==void 0?d.bumpFactor:1,d.bumpTexture!==void 0&&o.push(t.assignTexture(n,"bumpMap",d.bumpTexture)),Promise.all(o)}}class GLTFMaterialsAnisotropyExtension{constructor(e){this.parser=e,this.name=EXTENSIONS.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:three.MeshPhysicalMaterial}extendMaterialParams(e,n){const t=this.parser,a=t.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const o=[],d=a.extensions[this.name];return d.anisotropyStrength!==void 0&&(n.anisotropy=d.anisotropyStrength),d.anisotropyRotation!==void 0&&(n.anisotropyRotation=d.anisotropyRotation),d.anisotropyTexture!==void 0&&o.push(t.assignTexture(n,"anisotropyMap",d.anisotropyTexture)),Promise.all(o)}}class GLTFTextureBasisUExtension{constructor(e){this.parser=e,this.name=EXTENSIONS.KHR_TEXTURE_BASISU}loadTexture(e){const n=this.parser,t=n.json,a=t.textures[e];if(!a.extensions||!a.extensions[this.name])return null;const o=a.extensions[this.name],d=n.options.ktx2Loader;if(!d){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return n.loadTextureImage(e,o.source,d)}}class GLTFTextureWebPExtension{constructor(e){this.parser=e,this.name=EXTENSIONS.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const n=this.name,t=this.parser,a=t.json,o=a.textures[e];if(!o.extensions||!o.extensions[n])return null;const d=o.extensions[n],h=a.images[d.source];let f=t.textureLoader;if(h.uri){const u=t.options.manager.getHandler(h.uri);u!==null&&(f=u)}return this.detectSupport().then(function(u){if(u)return t.loadTextureImage(e,d.source,f);if(a.extensionsRequired&&a.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return t.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class GLTFTextureAVIFExtension{constructor(e){this.parser=e,this.name=EXTENSIONS.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const n=this.name,t=this.parser,a=t.json,o=a.textures[e];if(!o.extensions||!o.extensions[n])return null;const d=o.extensions[n],h=a.images[d.source];let f=t.textureLoader;if(h.uri){const u=t.options.manager.getHandler(h.uri);u!==null&&(f=u)}return this.detectSupport().then(function(u){if(u)return t.loadTextureImage(e,d.source,f);if(a.extensionsRequired&&a.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return t.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class GLTFMeshoptCompression{constructor(e){this.name=EXTENSIONS.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const n=this.parser.json,t=n.bufferViews[e];if(t.extensions&&t.extensions[this.name]){const a=t.extensions[this.name],o=this.parser.getDependency("buffer",a.buffer),d=this.parser.options.meshoptDecoder;if(!d||!d.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return o.then(function(h){const f=a.byteOffset||0,u=a.byteLength||0,p=a.count,x=a.byteStride,R=new Uint8Array(h,f,u);return d.decodeGltfBufferAsync?d.decodeGltfBufferAsync(p,x,R,a.mode,a.filter).then(function(S){return S.buffer}):d.ready.then(function(){const S=new ArrayBuffer(p*x);return d.decodeGltfBuffer(new Uint8Array(S),p,x,R,a.mode,a.filter),S})})}else return null}}class GLTFMeshGpuInstancing{constructor(e){this.name=EXTENSIONS.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const n=this.parser.json,t=n.nodes[e];if(!t.extensions||!t.extensions[this.name]||t.mesh===void 0)return null;const a=n.meshes[t.mesh];for(const u of a.primitives)if(u.mode!==WEBGL_CONSTANTS.TRIANGLES&&u.mode!==WEBGL_CONSTANTS.TRIANGLE_STRIP&&u.mode!==WEBGL_CONSTANTS.TRIANGLE_FAN&&u.mode!==void 0)return null;const d=t.extensions[this.name].attributes,h=[],f={};for(const u in d)h.push(this.parser.getDependency("accessor",d[u]).then(p=>(f[u]=p,f[u])));return h.length<1?null:(h.push(this.parser.createNodeMesh(e)),Promise.all(h).then(u=>{const p=u.pop(),x=p.isGroup?p.children:[p],R=u[0].count,S=[];for(const E of x){const g=new three.Matrix4,v=new three.Vector3,T=new three.Quaternion,b=new three.Vector3(1,1,1),_=new three.InstancedMesh(E.geometry,E.material,R);for(let w=0;w<R;w++)f.TRANSLATION&&v.fromBufferAttribute(f.TRANSLATION,w),f.ROTATION&&T.fromBufferAttribute(f.ROTATION,w),f.SCALE&&b.fromBufferAttribute(f.SCALE,w),_.setMatrixAt(w,g.compose(v,T,b));for(const w in f)if(w==="_COLOR_0"){const C=f[w];_.instanceColor=new three.InstancedBufferAttribute(C.array,C.itemSize,C.normalized)}else w!=="TRANSLATION"&&w!=="ROTATION"&&w!=="SCALE"&&E.geometry.setAttribute(w,f[w]);three.Object3D.prototype.copy.call(_,E),this.parser.assignFinalMaterial(_),S.push(_)}return p.isGroup?(p.clear(),p.add(...S),p):S[0]}))}}const BINARY_EXTENSION_HEADER_MAGIC="glTF",BINARY_EXTENSION_HEADER_LENGTH=12,BINARY_EXTENSION_CHUNK_TYPES={JSON:1313821514,BIN:5130562};class GLTFBinaryExtension{constructor(e){this.name=EXTENSIONS.KHR_BINARY_GLTF,this.content=null,this.body=null;const n=new DataView(e,0,BINARY_EXTENSION_HEADER_LENGTH),t=new TextDecoder;if(this.header={magic:t.decode(new Uint8Array(e.slice(0,4))),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==BINARY_EXTENSION_HEADER_MAGIC)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const a=this.header.length-BINARY_EXTENSION_HEADER_LENGTH,o=new DataView(e,BINARY_EXTENSION_HEADER_LENGTH);let d=0;for(;d<a;){const h=o.getUint32(d,!0);d+=4;const f=o.getUint32(d,!0);if(d+=4,f===BINARY_EXTENSION_CHUNK_TYPES.JSON){const u=new Uint8Array(e,BINARY_EXTENSION_HEADER_LENGTH+d,h);this.content=t.decode(u)}else if(f===BINARY_EXTENSION_CHUNK_TYPES.BIN){const u=BINARY_EXTENSION_HEADER_LENGTH+d;this.body=e.slice(u,u+h)}d+=h}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class GLTFDracoMeshCompressionExtension{constructor(e,n){if(!n)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=EXTENSIONS.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=n,this.dracoLoader.preload()}decodePrimitive(e,n){const t=this.json,a=this.dracoLoader,o=e.extensions[this.name].bufferView,d=e.extensions[this.name].attributes,h={},f={},u={};for(const p in d){const x=ATTRIBUTES[p]||p.toLowerCase();h[x]=d[p]}for(const p in e.attributes){const x=ATTRIBUTES[p]||p.toLowerCase();if(d[p]!==void 0){const R=t.accessors[e.attributes[p]],S=WEBGL_COMPONENT_TYPES[R.componentType];u[x]=S.name,f[x]=R.normalized===!0}}return n.getDependency("bufferView",o).then(function(p){return new Promise(function(x,R){a.decodeDracoFile(p,function(S){for(const E in S.attributes){const g=S.attributes[E],v=f[E];v!==void 0&&(g.normalized=v)}x(S)},h,u,three.LinearSRGBColorSpace,R)})})}}class GLTFTextureTransformExtension{constructor(){this.name=EXTENSIONS.KHR_TEXTURE_TRANSFORM}extendTexture(e,n){return(n.texCoord===void 0||n.texCoord===e.channel)&&n.offset===void 0&&n.rotation===void 0&&n.scale===void 0||(e=e.clone(),n.texCoord!==void 0&&(e.channel=n.texCoord),n.offset!==void 0&&e.offset.fromArray(n.offset),n.rotation!==void 0&&(e.rotation=n.rotation),n.scale!==void 0&&e.repeat.fromArray(n.scale),e.needsUpdate=!0),e}}class GLTFMeshQuantizationExtension{constructor(){this.name=EXTENSIONS.KHR_MESH_QUANTIZATION}}class GLTFCubicSplineInterpolant extends three.Interpolant{constructor(e,n,t,a){super(e,n,t,a)}copySampleValue_(e){const n=this.resultBuffer,t=this.sampleValues,a=this.valueSize,o=e*a*3+a;for(let d=0;d!==a;d++)n[d]=t[o+d];return n}interpolate_(e,n,t,a){const o=this.resultBuffer,d=this.sampleValues,h=this.valueSize,f=h*2,u=h*3,p=a-n,x=(t-n)/p,R=x*x,S=R*x,E=e*u,g=E-u,v=-2*S+3*R,T=S-R,b=1-v,_=T-R+x;for(let w=0;w!==h;w++){const C=d[g+w+h],P=d[g+w+f]*p,D=d[E+w+h],N=d[E+w]*p;o[w]=b*C+_*P+v*D+T*N}return o}}const _q=new three.Quaternion;class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant{interpolate_(e,n,t,a){const o=super.interpolate_(e,n,t,a);return _q.fromArray(o).normalize().toArray(o),o}}const WEBGL_CONSTANTS={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},WEBGL_COMPONENT_TYPES={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},WEBGL_FILTERS={9728:three.NearestFilter,9729:three.LinearFilter,9984:three.NearestMipmapNearestFilter,9985:three.LinearMipmapNearestFilter,9986:three.NearestMipmapLinearFilter,9987:three.LinearMipmapLinearFilter},WEBGL_WRAPPINGS={33071:three.ClampToEdgeWrapping,33648:three.MirroredRepeatWrapping,10497:three.RepeatWrapping},WEBGL_TYPE_SIZES={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ATTRIBUTES={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},PATH_PROPERTIES={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},INTERPOLATION={CUBICSPLINE:void 0,LINEAR:three.InterpolateLinear,STEP:three.InterpolateDiscrete},ALPHA_MODES={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function createDefaultMaterial(l){return l.DefaultMaterial===void 0&&(l.DefaultMaterial=new three.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:three.FrontSide})),l.DefaultMaterial}function addUnknownExtensionsToUserData(l,e,n){for(const t in n.extensions)l[t]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[t]=n.extensions[t])}function assignExtrasToUserData(l,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(l.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function addMorphTargets(l,e,n){let t=!1,a=!1,o=!1;for(let u=0,p=e.length;u<p;u++){const x=e[u];if(x.POSITION!==void 0&&(t=!0),x.NORMAL!==void 0&&(a=!0),x.COLOR_0!==void 0&&(o=!0),t&&a&&o)break}if(!t&&!a&&!o)return Promise.resolve(l);const d=[],h=[],f=[];for(let u=0,p=e.length;u<p;u++){const x=e[u];if(t){const R=x.POSITION!==void 0?n.getDependency("accessor",x.POSITION):l.attributes.position;d.push(R)}if(a){const R=x.NORMAL!==void 0?n.getDependency("accessor",x.NORMAL):l.attributes.normal;h.push(R)}if(o){const R=x.COLOR_0!==void 0?n.getDependency("accessor",x.COLOR_0):l.attributes.color;f.push(R)}}return Promise.all([Promise.all(d),Promise.all(h),Promise.all(f)]).then(function(u){const p=u[0],x=u[1],R=u[2];return t&&(l.morphAttributes.position=p),a&&(l.morphAttributes.normal=x),o&&(l.morphAttributes.color=R),l.morphTargetsRelative=!0,l})}function updateMorphTargets(l,e){if(l.updateMorphTargets(),e.weights!==void 0)for(let n=0,t=e.weights.length;n<t;n++)l.morphTargetInfluences[n]=e.weights[n];if(e.extras&&Array.isArray(e.extras.targetNames)){const n=e.extras.targetNames;if(l.morphTargetInfluences.length===n.length){l.morphTargetDictionary={};for(let t=0,a=n.length;t<a;t++)l.morphTargetDictionary[n[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function createPrimitiveKey(l){let e;const n=l.extensions&&l.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION];if(n?e="draco:"+n.bufferView+":"+n.indices+":"+createAttributesKey(n.attributes):e=l.indices+":"+createAttributesKey(l.attributes)+":"+l.mode,l.targets!==void 0)for(let t=0,a=l.targets.length;t<a;t++)e+=":"+createAttributesKey(l.targets[t]);return e}function createAttributesKey(l){let e="";const n=Object.keys(l).sort();for(let t=0,a=n.length;t<a;t++)e+=n[t]+":"+l[n[t]]+";";return e}function getNormalizedComponentScale(l){switch(l){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function getImageURIMimeType(l){return l.search(/\.jpe?g($|\?)/i)>0||l.search(/^data\:image\/jpeg/)===0?"image/jpeg":l.search(/\.webp($|\?)/i)>0||l.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const _identityMatrix=new three.Matrix4;class GLTFParser{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new GLTFRegistry,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let t=!1,a=!1,o=-1;typeof navigator<"u"&&(t=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,a=navigator.userAgent.indexOf("Firefox")>-1,o=a?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||t||a&&o<98?this.textureLoader=new three.TextureLoader(this.options.manager):this.textureLoader=new three.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new three.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,n){const t=this,a=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(d){return d._markDefs&&d._markDefs()}),Promise.all(this._invokeAll(function(d){return d.beforeRoot&&d.beforeRoot()})).then(function(){return Promise.all([t.getDependencies("scene"),t.getDependencies("animation"),t.getDependencies("camera")])}).then(function(d){const h={scene:d[0][a.scene||0],scenes:d[0],animations:d[1],cameras:d[2],asset:a.asset,parser:t,userData:{}};return addUnknownExtensionsToUserData(o,h,a),assignExtrasToUserData(h,a),Promise.all(t._invokeAll(function(f){return f.afterRoot&&f.afterRoot(h)})).then(function(){e(h)})}).catch(n)}_markDefs(){const e=this.json.nodes||[],n=this.json.skins||[],t=this.json.meshes||[];for(let a=0,o=n.length;a<o;a++){const d=n[a].joints;for(let h=0,f=d.length;h<f;h++)e[d[h]].isBone=!0}for(let a=0,o=e.length;a<o;a++){const d=e[a];d.mesh!==void 0&&(this._addNodeRef(this.meshCache,d.mesh),d.skin!==void 0&&(t[d.mesh].isSkinnedMesh=!0)),d.camera!==void 0&&this._addNodeRef(this.cameraCache,d.camera)}}_addNodeRef(e,n){n!==void 0&&(e.refs[n]===void 0&&(e.refs[n]=e.uses[n]=0),e.refs[n]++)}_getNodeRef(e,n,t){if(e.refs[n]<=1)return t;const a=t.clone(),o=(d,h)=>{const f=this.associations.get(d);f!=null&&this.associations.set(h,f);for(const[u,p]of d.children.entries())o(p,h.children[u])};return o(t,a),a.name+="_instance_"+e.uses[n]++,a}_invokeOne(e){const n=Object.values(this.plugins);n.push(this);for(let t=0;t<n.length;t++){const a=e(n[t]);if(a)return a}return null}_invokeAll(e){const n=Object.values(this.plugins);n.unshift(this);const t=[];for(let a=0;a<n.length;a++){const o=e(n[a]);o&&t.push(o)}return t}getDependency(e,n){const t=e+":"+n;let a=this.cache.get(t);if(!a){switch(e){case"scene":a=this.loadScene(n);break;case"node":a=this._invokeOne(function(o){return o.loadNode&&o.loadNode(n)});break;case"mesh":a=this._invokeOne(function(o){return o.loadMesh&&o.loadMesh(n)});break;case"accessor":a=this.loadAccessor(n);break;case"bufferView":a=this._invokeOne(function(o){return o.loadBufferView&&o.loadBufferView(n)});break;case"buffer":a=this.loadBuffer(n);break;case"material":a=this._invokeOne(function(o){return o.loadMaterial&&o.loadMaterial(n)});break;case"texture":a=this._invokeOne(function(o){return o.loadTexture&&o.loadTexture(n)});break;case"skin":a=this.loadSkin(n);break;case"animation":a=this._invokeOne(function(o){return o.loadAnimation&&o.loadAnimation(n)});break;case"camera":a=this.loadCamera(n);break;default:if(a=this._invokeOne(function(o){return o!=this&&o.getDependency&&o.getDependency(e,n)}),!a)throw new Error("Unknown type: "+e);break}this.cache.add(t,a)}return a}getDependencies(e){let n=this.cache.get(e);if(!n){const t=this,a=this.json[e+(e==="mesh"?"es":"s")]||[];n=Promise.all(a.map(function(o,d){return t.getDependency(e,d)})),this.cache.add(e,n)}return n}loadBuffer(e){const n=this.json.buffers[e],t=this.fileLoader;if(n.type&&n.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+n.type+" buffer type is not supported.");if(n.uri===void 0&&e===0)return Promise.resolve(this.extensions[EXTENSIONS.KHR_BINARY_GLTF].body);const a=this.options;return new Promise(function(o,d){t.load(three.LoaderUtils.resolveURL(n.uri,a.path),o,void 0,function(){d(new Error('THREE.GLTFLoader: Failed to load buffer "'+n.uri+'".'))})})}loadBufferView(e){const n=this.json.bufferViews[e];return this.getDependency("buffer",n.buffer).then(function(t){const a=n.byteLength||0,o=n.byteOffset||0;return t.slice(o,o+a)})}loadAccessor(e){const n=this,t=this.json,a=this.json.accessors[e];if(a.bufferView===void 0&&a.sparse===void 0){const d=WEBGL_TYPE_SIZES[a.type],h=WEBGL_COMPONENT_TYPES[a.componentType],f=a.normalized===!0,u=new h(a.count*d);return Promise.resolve(new three.BufferAttribute(u,d,f))}const o=[];return a.bufferView!==void 0?o.push(this.getDependency("bufferView",a.bufferView)):o.push(null),a.sparse!==void 0&&(o.push(this.getDependency("bufferView",a.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",a.sparse.values.bufferView))),Promise.all(o).then(function(d){const h=d[0],f=WEBGL_TYPE_SIZES[a.type],u=WEBGL_COMPONENT_TYPES[a.componentType],p=u.BYTES_PER_ELEMENT,x=p*f,R=a.byteOffset||0,S=a.bufferView!==void 0?t.bufferViews[a.bufferView].byteStride:void 0,E=a.normalized===!0;let g,v;if(S&&S!==x){const T=Math.floor(R/S),b="InterleavedBuffer:"+a.bufferView+":"+a.componentType+":"+T+":"+a.count;let _=n.cache.get(b);_||(g=new u(h,T*S,a.count*S/p),_=new three.InterleavedBuffer(g,S/p),n.cache.add(b,_)),v=new three.InterleavedBufferAttribute(_,f,R%S/p,E)}else h===null?g=new u(a.count*f):g=new u(h,R,a.count*f),v=new three.BufferAttribute(g,f,E);if(a.sparse!==void 0){const T=WEBGL_TYPE_SIZES.SCALAR,b=WEBGL_COMPONENT_TYPES[a.sparse.indices.componentType],_=a.sparse.indices.byteOffset||0,w=a.sparse.values.byteOffset||0,C=new b(d[1],_,a.sparse.count*T),P=new u(d[2],w,a.sparse.count*f);h!==null&&(v=new three.BufferAttribute(v.array.slice(),v.itemSize,v.normalized));for(let D=0,N=C.length;D<N;D++){const k=C[D];if(v.setX(k,P[D*f]),f>=2&&v.setY(k,P[D*f+1]),f>=3&&v.setZ(k,P[D*f+2]),f>=4&&v.setW(k,P[D*f+3]),f>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return v})}loadTexture(e){const n=this.json,t=this.options,o=n.textures[e].source,d=n.images[o];let h=this.textureLoader;if(d.uri){const f=t.manager.getHandler(d.uri);f!==null&&(h=f)}return this.loadTextureImage(e,o,h)}loadTextureImage(e,n,t){const a=this,o=this.json,d=o.textures[e],h=o.images[n],f=(h.uri||h.bufferView)+":"+d.sampler;if(this.textureCache[f])return this.textureCache[f];const u=this.loadImageSource(n,t).then(function(p){p.flipY=!1,p.name=d.name||h.name||"",p.name===""&&typeof h.uri=="string"&&h.uri.startsWith("data:image/")===!1&&(p.name=h.uri);const R=(o.samplers||{})[d.sampler]||{};return p.magFilter=WEBGL_FILTERS[R.magFilter]||three.LinearFilter,p.minFilter=WEBGL_FILTERS[R.minFilter]||three.LinearMipmapLinearFilter,p.wrapS=WEBGL_WRAPPINGS[R.wrapS]||three.RepeatWrapping,p.wrapT=WEBGL_WRAPPINGS[R.wrapT]||three.RepeatWrapping,a.associations.set(p,{textures:e}),p}).catch(function(){return null});return this.textureCache[f]=u,u}loadImageSource(e,n){const t=this,a=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(x=>x.clone());const d=a.images[e],h=self.URL||self.webkitURL;let f=d.uri||"",u=!1;if(d.bufferView!==void 0)f=t.getDependency("bufferView",d.bufferView).then(function(x){u=!0;const R=new Blob([x],{type:d.mimeType});return f=h.createObjectURL(R),f});else if(d.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const p=Promise.resolve(f).then(function(x){return new Promise(function(R,S){let E=R;n.isImageBitmapLoader===!0&&(E=function(g){const v=new three.Texture(g);v.needsUpdate=!0,R(v)}),n.load(three.LoaderUtils.resolveURL(x,o.path),E,void 0,S)})}).then(function(x){return u===!0&&h.revokeObjectURL(f),x.userData.mimeType=d.mimeType||getImageURIMimeType(d.uri),x}).catch(function(x){throw console.error("THREE.GLTFLoader: Couldn't load texture",f),x});return this.sourceCache[e]=p,p}assignTexture(e,n,t,a){const o=this;return this.getDependency("texture",t.index).then(function(d){if(!d)return null;if(t.texCoord!==void 0&&t.texCoord>0&&(d=d.clone(),d.channel=t.texCoord),o.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM]){const h=t.extensions!==void 0?t.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM]:void 0;if(h){const f=o.associations.get(d);d=o.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM].extendTexture(d,h),o.associations.set(d,f)}}return a!==void 0&&(d.colorSpace=a),e[n]=d,d})}assignFinalMaterial(e){const n=e.geometry;let t=e.material;const a=n.attributes.tangent===void 0,o=n.attributes.color!==void 0,d=n.attributes.normal===void 0;if(e.isPoints){const h="PointsMaterial:"+t.uuid;let f=this.cache.get(h);f||(f=new three.PointsMaterial,three.Material.prototype.copy.call(f,t),f.color.copy(t.color),f.map=t.map,f.sizeAttenuation=!1,this.cache.add(h,f)),t=f}else if(e.isLine){const h="LineBasicMaterial:"+t.uuid;let f=this.cache.get(h);f||(f=new three.LineBasicMaterial,three.Material.prototype.copy.call(f,t),f.color.copy(t.color),f.map=t.map,this.cache.add(h,f)),t=f}if(a||o||d){let h="ClonedMaterial:"+t.uuid+":";a&&(h+="derivative-tangents:"),o&&(h+="vertex-colors:"),d&&(h+="flat-shading:");let f=this.cache.get(h);f||(f=t.clone(),o&&(f.vertexColors=!0),d&&(f.flatShading=!0),a&&(f.normalScale&&(f.normalScale.y*=-1),f.clearcoatNormalScale&&(f.clearcoatNormalScale.y*=-1)),this.cache.add(h,f),this.associations.set(f,this.associations.get(t))),t=f}e.material=t}getMaterialType(){return three.MeshStandardMaterial}loadMaterial(e){const n=this,t=this.json,a=this.extensions,o=t.materials[e];let d;const h={},f=o.extensions||{},u=[];if(f[EXTENSIONS.KHR_MATERIALS_UNLIT]){const x=a[EXTENSIONS.KHR_MATERIALS_UNLIT];d=x.getMaterialType(),u.push(x.extendParams(h,o,n))}else{const x=o.pbrMetallicRoughness||{};if(h.color=new three.Color(1,1,1),h.opacity=1,Array.isArray(x.baseColorFactor)){const R=x.baseColorFactor;h.color.setRGB(R[0],R[1],R[2],three.LinearSRGBColorSpace),h.opacity=R[3]}x.baseColorTexture!==void 0&&u.push(n.assignTexture(h,"map",x.baseColorTexture,three.SRGBColorSpace)),h.metalness=x.metallicFactor!==void 0?x.metallicFactor:1,h.roughness=x.roughnessFactor!==void 0?x.roughnessFactor:1,x.metallicRoughnessTexture!==void 0&&(u.push(n.assignTexture(h,"metalnessMap",x.metallicRoughnessTexture)),u.push(n.assignTexture(h,"roughnessMap",x.metallicRoughnessTexture))),d=this._invokeOne(function(R){return R.getMaterialType&&R.getMaterialType(e)}),u.push(Promise.all(this._invokeAll(function(R){return R.extendMaterialParams&&R.extendMaterialParams(e,h)})))}o.doubleSided===!0&&(h.side=three.DoubleSide);const p=o.alphaMode||ALPHA_MODES.OPAQUE;if(p===ALPHA_MODES.BLEND?(h.transparent=!0,h.depthWrite=!1):(h.transparent=!1,p===ALPHA_MODES.MASK&&(h.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&d!==three.MeshBasicMaterial&&(u.push(n.assignTexture(h,"normalMap",o.normalTexture)),h.normalScale=new three.Vector2(1,1),o.normalTexture.scale!==void 0)){const x=o.normalTexture.scale;h.normalScale.set(x,x)}if(o.occlusionTexture!==void 0&&d!==three.MeshBasicMaterial&&(u.push(n.assignTexture(h,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(h.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&d!==three.MeshBasicMaterial){const x=o.emissiveFactor;h.emissive=new three.Color().setRGB(x[0],x[1],x[2],three.LinearSRGBColorSpace)}return o.emissiveTexture!==void 0&&d!==three.MeshBasicMaterial&&u.push(n.assignTexture(h,"emissiveMap",o.emissiveTexture,three.SRGBColorSpace)),Promise.all(u).then(function(){const x=new d(h);return o.name&&(x.name=o.name),assignExtrasToUserData(x,o),n.associations.set(x,{materials:e}),o.extensions&&addUnknownExtensionsToUserData(a,x,o),x})}createUniqueName(e){const n=three.PropertyBinding.sanitizeNodeName(e||"");return n in this.nodeNamesUsed?n+"_"+ ++this.nodeNamesUsed[n]:(this.nodeNamesUsed[n]=0,n)}loadGeometries(e){const n=this,t=this.extensions,a=this.primitiveCache;function o(h){return t[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(h,n).then(function(f){return addPrimitiveAttributes(f,h,n)})}const d=[];for(let h=0,f=e.length;h<f;h++){const u=e[h],p=createPrimitiveKey(u),x=a[p];if(x)d.push(x.promise);else{let R;u.extensions&&u.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]?R=o(u):R=addPrimitiveAttributes(new three.BufferGeometry,u,n),a[p]={primitive:u,promise:R},d.push(R)}}return Promise.all(d)}loadMesh(e){const n=this,t=this.json,a=this.extensions,o=t.meshes[e],d=o.primitives,h=[];for(let f=0,u=d.length;f<u;f++){const p=d[f].material===void 0?createDefaultMaterial(this.cache):this.getDependency("material",d[f].material);h.push(p)}return h.push(n.loadGeometries(d)),Promise.all(h).then(function(f){const u=f.slice(0,f.length-1),p=f[f.length-1],x=[];for(let S=0,E=p.length;S<E;S++){const g=p[S],v=d[S];let T;const b=u[S];if(v.mode===WEBGL_CONSTANTS.TRIANGLES||v.mode===WEBGL_CONSTANTS.TRIANGLE_STRIP||v.mode===WEBGL_CONSTANTS.TRIANGLE_FAN||v.mode===void 0)T=o.isSkinnedMesh===!0?new three.SkinnedMesh(g,b):new three.Mesh(g,b),T.isSkinnedMesh===!0&&T.normalizeSkinWeights(),v.mode===WEBGL_CONSTANTS.TRIANGLE_STRIP?T.geometry=toTrianglesDrawMode(T.geometry,three.TriangleStripDrawMode):v.mode===WEBGL_CONSTANTS.TRIANGLE_FAN&&(T.geometry=toTrianglesDrawMode(T.geometry,three.TriangleFanDrawMode));else if(v.mode===WEBGL_CONSTANTS.LINES)T=new three.LineSegments(g,b);else if(v.mode===WEBGL_CONSTANTS.LINE_STRIP)T=new three.Line(g,b);else if(v.mode===WEBGL_CONSTANTS.LINE_LOOP)T=new three.LineLoop(g,b);else if(v.mode===WEBGL_CONSTANTS.POINTS)T=new three.Points(g,b);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+v.mode);Object.keys(T.geometry.morphAttributes).length>0&&updateMorphTargets(T,o),T.name=n.createUniqueName(o.name||"mesh_"+e),assignExtrasToUserData(T,o),v.extensions&&addUnknownExtensionsToUserData(a,T,v),n.assignFinalMaterial(T),x.push(T)}for(let S=0,E=x.length;S<E;S++)n.associations.set(x[S],{meshes:e,primitives:S});if(x.length===1)return o.extensions&&addUnknownExtensionsToUserData(a,x[0],o),x[0];const R=new three.Group;o.extensions&&addUnknownExtensionsToUserData(a,R,o),n.associations.set(R,{meshes:e});for(let S=0,E=x.length;S<E;S++)R.add(x[S]);return R})}loadCamera(e){let n;const t=this.json.cameras[e],a=t[t.type];if(!a){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return t.type==="perspective"?n=new three.PerspectiveCamera(three.MathUtils.radToDeg(a.yfov),a.aspectRatio||1,a.znear||1,a.zfar||2e6):t.type==="orthographic"&&(n=new three.OrthographicCamera(-a.xmag,a.xmag,a.ymag,-a.ymag,a.znear,a.zfar)),t.name&&(n.name=this.createUniqueName(t.name)),assignExtrasToUserData(n,t),Promise.resolve(n)}loadSkin(e){const n=this.json.skins[e],t=[];for(let a=0,o=n.joints.length;a<o;a++)t.push(this._loadNodeShallow(n.joints[a]));return n.inverseBindMatrices!==void 0?t.push(this.getDependency("accessor",n.inverseBindMatrices)):t.push(null),Promise.all(t).then(function(a){const o=a.pop(),d=a,h=[],f=[];for(let u=0,p=d.length;u<p;u++){const x=d[u];if(x){h.push(x);const R=new three.Matrix4;o!==null&&R.fromArray(o.array,u*16),f.push(R)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',n.joints[u])}return new three.Skeleton(h,f)})}loadAnimation(e){const n=this.json,t=this,a=n.animations[e],o=a.name?a.name:"animation_"+e,d=[],h=[],f=[],u=[],p=[];for(let x=0,R=a.channels.length;x<R;x++){const S=a.channels[x],E=a.samplers[S.sampler],g=S.target,v=g.node,T=a.parameters!==void 0?a.parameters[E.input]:E.input,b=a.parameters!==void 0?a.parameters[E.output]:E.output;g.node!==void 0&&(d.push(this.getDependency("node",v)),h.push(this.getDependency("accessor",T)),f.push(this.getDependency("accessor",b)),u.push(E),p.push(g))}return Promise.all([Promise.all(d),Promise.all(h),Promise.all(f),Promise.all(u),Promise.all(p)]).then(function(x){const R=x[0],S=x[1],E=x[2],g=x[3],v=x[4],T=[];for(let b=0,_=R.length;b<_;b++){const w=R[b],C=S[b],P=E[b],D=g[b],N=v[b];if(w===void 0)continue;w.updateMatrix&&w.updateMatrix();const k=t._createAnimationTracks(w,C,P,D,N);if(k)for(let F=0;F<k.length;F++)T.push(k[F])}return new three.AnimationClip(o,void 0,T)})}createNodeMesh(e){const n=this.json,t=this,a=n.nodes[e];return a.mesh===void 0?null:t.getDependency("mesh",a.mesh).then(function(o){const d=t._getNodeRef(t.meshCache,a.mesh,o);return a.weights!==void 0&&d.traverse(function(h){if(h.isMesh)for(let f=0,u=a.weights.length;f<u;f++)h.morphTargetInfluences[f]=a.weights[f]}),d})}loadNode(e){const n=this.json,t=this,a=n.nodes[e],o=t._loadNodeShallow(e),d=[],h=a.children||[];for(let u=0,p=h.length;u<p;u++)d.push(t.getDependency("node",h[u]));const f=a.skin===void 0?Promise.resolve(null):t.getDependency("skin",a.skin);return Promise.all([o,Promise.all(d),f]).then(function(u){const p=u[0],x=u[1],R=u[2];R!==null&&p.traverse(function(S){S.isSkinnedMesh&&S.bind(R,_identityMatrix)});for(let S=0,E=x.length;S<E;S++)p.add(x[S]);return p})}_loadNodeShallow(e){const n=this.json,t=this.extensions,a=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const o=n.nodes[e],d=o.name?a.createUniqueName(o.name):"",h=[],f=a._invokeOne(function(u){return u.createNodeMesh&&u.createNodeMesh(e)});return f&&h.push(f),o.camera!==void 0&&h.push(a.getDependency("camera",o.camera).then(function(u){return a._getNodeRef(a.cameraCache,o.camera,u)})),a._invokeAll(function(u){return u.createNodeAttachment&&u.createNodeAttachment(e)}).forEach(function(u){h.push(u)}),this.nodeCache[e]=Promise.all(h).then(function(u){let p;if(o.isBone===!0?p=new three.Bone:u.length>1?p=new three.Group:u.length===1?p=u[0]:p=new three.Object3D,p!==u[0])for(let x=0,R=u.length;x<R;x++)p.add(u[x]);if(o.name&&(p.userData.name=o.name,p.name=d),assignExtrasToUserData(p,o),o.extensions&&addUnknownExtensionsToUserData(t,p,o),o.matrix!==void 0){const x=new three.Matrix4;x.fromArray(o.matrix),p.applyMatrix4(x)}else o.translation!==void 0&&p.position.fromArray(o.translation),o.rotation!==void 0&&p.quaternion.fromArray(o.rotation),o.scale!==void 0&&p.scale.fromArray(o.scale);return a.associations.has(p)||a.associations.set(p,{}),a.associations.get(p).nodes=e,p}),this.nodeCache[e]}loadScene(e){const n=this.extensions,t=this.json.scenes[e],a=this,o=new three.Group;t.name&&(o.name=a.createUniqueName(t.name)),assignExtrasToUserData(o,t),t.extensions&&addUnknownExtensionsToUserData(n,o,t);const d=t.nodes||[],h=[];for(let f=0,u=d.length;f<u;f++)h.push(a.getDependency("node",d[f]));return Promise.all(h).then(function(f){for(let p=0,x=f.length;p<x;p++)o.add(f[p]);const u=p=>{const x=new Map;for(const[R,S]of a.associations)(R instanceof three.Material||R instanceof three.Texture)&&x.set(R,S);return p.traverse(R=>{const S=a.associations.get(R);S!=null&&x.set(R,S)}),x};return a.associations=u(o),o})}_createAnimationTracks(e,n,t,a,o){const d=[],h=e.name?e.name:e.uuid,f=[];PATH_PROPERTIES[o.path]===PATH_PROPERTIES.weights?e.traverse(function(R){R.morphTargetInfluences&&f.push(R.name?R.name:R.uuid)}):f.push(h);let u;switch(PATH_PROPERTIES[o.path]){case PATH_PROPERTIES.weights:u=three.NumberKeyframeTrack;break;case PATH_PROPERTIES.rotation:u=three.QuaternionKeyframeTrack;break;case PATH_PROPERTIES.position:case PATH_PROPERTIES.scale:u=three.VectorKeyframeTrack;break;default:switch(t.itemSize){case 1:u=three.NumberKeyframeTrack;break;case 2:case 3:default:u=three.VectorKeyframeTrack;break}break}const p=a.interpolation!==void 0?INTERPOLATION[a.interpolation]:three.InterpolateLinear,x=this._getArrayFromAccessor(t);for(let R=0,S=f.length;R<S;R++){const E=new u(f[R]+"."+PATH_PROPERTIES[o.path],n.array,x,p);a.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(E),d.push(E)}return d}_getArrayFromAccessor(e){let n=e.array;if(e.normalized){const t=getNormalizedComponentScale(n.constructor),a=new Float32Array(n.length);for(let o=0,d=n.length;o<d;o++)a[o]=n[o]*t;n=a}return n}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(t){const a=this instanceof three.QuaternionKeyframeTrack?GLTFCubicSplineQuaternionInterpolant:GLTFCubicSplineInterpolant;return new a(this.times,this.values,this.getValueSize()/3,t)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function computeBounds(l,e,n){const t=e.attributes,a=new three.Box3;if(t.POSITION!==void 0){const h=n.json.accessors[t.POSITION],f=h.min,u=h.max;if(f!==void 0&&u!==void 0){if(a.set(new three.Vector3(f[0],f[1],f[2]),new three.Vector3(u[0],u[1],u[2])),h.normalized){const p=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[h.componentType]);a.min.multiplyScalar(p),a.max.multiplyScalar(p)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const o=e.targets;if(o!==void 0){const h=new three.Vector3,f=new three.Vector3;for(let u=0,p=o.length;u<p;u++){const x=o[u];if(x.POSITION!==void 0){const R=n.json.accessors[x.POSITION],S=R.min,E=R.max;if(S!==void 0&&E!==void 0){if(f.setX(Math.max(Math.abs(S[0]),Math.abs(E[0]))),f.setY(Math.max(Math.abs(S[1]),Math.abs(E[1]))),f.setZ(Math.max(Math.abs(S[2]),Math.abs(E[2]))),R.normalized){const g=getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[R.componentType]);f.multiplyScalar(g)}h.max(f)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}a.expandByVector(h)}l.boundingBox=a;const d=new three.Sphere;a.getCenter(d.center),d.radius=a.min.distanceTo(a.max)/2,l.boundingSphere=d}function addPrimitiveAttributes(l,e,n){const t=e.attributes,a=[];function o(d,h){return n.getDependency("accessor",d).then(function(f){l.setAttribute(h,f)})}for(const d in t){const h=ATTRIBUTES[d]||d.toLowerCase();h in l.attributes||a.push(o(t[d],h))}if(e.indices!==void 0&&!l.index){const d=n.getDependency("accessor",e.indices).then(function(h){l.setIndex(h)});a.push(d)}return three.ColorManagement.workingColorSpace!==three.LinearSRGBColorSpace&&"COLOR_0"in t&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${three.ColorManagement.workingColorSpace}" not supported.`),assignExtrasToUserData(l,e),computeBounds(l,e,n),Promise.all(a).then(function(){return e.targets!==void 0?addMorphTargets(l,e.targets,n):l})}const defaultCamPos=[0,14.63,16],isMobile=DeviceDetection(),loader$1=new GLTFLoader,box=new three.Box3,worldPos=new three.Vector3,size=new three.Vector3;function Panel({character:l,ttsStarted:e,active:n}){var R,S,E,g,v;const t=React$2.useRef(null),a=React$2.useRef(null),o=l.type==="character",[d,h]=React$2.useState(!1),f=React$2.useRef(),u=React$2.useMemo(()=>{var T,b,_,w,C,P,D,N;return o?l.animationId&&((T=l.animation)!=null&&T.url)?l.animation:(w=(_=(b=l==null?void 0:l.resource)==null?void 0:b.animations)==null?void 0:_[l.emotion])!=null&&w.url?(P=(C=l==null?void 0:l.resource)==null?void 0:C.animations)==null?void 0:P[l.emotion]:(N=(D=l==null?void 0:l.resource)==null?void 0:D.animations)==null?void 0:N.neutral:{}},[l.emotion,l==null?void 0:l.animationId,l==null?void 0:l.animation,(R=l==null?void 0:l.resource)==null?void 0:R.animations,o]),p=React$2.useCallback(()=>{var T;if((T=f.current.userData)!=null&&T.animation){const{clipAction:b,defaultAnim:_}=f.current.userData.animation;_&&b(_)}},[]);React$2.useEffect(()=>{var T,b,_;if(f.current)if(n)if(e){const w=(_=(b=(T=l==null?void 0:l.resource)==null?void 0:T.animations)==null?void 0:b.talking)==null?void 0:_.url;w&&loader$1.load(w,({animations:C})=>{if(!f.current)return;const{defaultAnim:P,clipAction:D}=f.current.userData.animation;D(mixWithTalkingClip(C[0],P)),h(!0)})}else p();else d&&p()},[(g=(E=(S=l==null?void 0:l.resource)==null?void 0:S.animations)==null?void 0:E.talking)==null?void 0:g.url,e,n,p,d]);const x=React$2.useCallback(T=>{if(l.type==="character"){const b=T.getObjectByName("Head_M",!0);b?(b.updateMatrixWorld(!0),box.setFromObject(T),box.getSize(size),b.getWorldPosition(worldPos),t.current.lookAt(worldPos)):t.current.position.setY(size.y-1.5*1.3),t.current.zoom=1.5}else cameraFitAnyObject(T,t.current),t.current.zoom=1;t.current.updateProjectionMatrix()},[l]);return fiber.useFrame(({gl:T,scene:b})=>{if(t.current&&a.current){const _=document.querySelectorAll(".conversation--character__item")[l.slot];if(_){const w=_.getBoundingClientRect(),C=_.parentNode.getBoundingClientRect(),[P,D]=[w.right-w.left,w.bottom-w.top];if(t.current.aspect=P/D,t.current.updateProjectionMatrix(),o&&f.current){box.setFromObject(f.current),box.getSize(size);const F=f.current.getObjectByName("Head_M",!0);F?(F.getWorldPosition(worldPos),t.current.lookAt(worldPos)):t.current.position.setY(size.y-1.5*1.3),t.current.zoom=1.5}const N={top:w.top-C.top,right:w.right-C.right,left:w.left-C.left,bottom:w.bottom-C.bottom},k=isMobile?24:40;N.bottom+=n?-k:k,T.setViewport(N.left,N.bottom,P,D),T.setScissor(N.left,N.bottom,P,D),a.current.environment=b.environment,T.render(a.current,t.current)}}},1),l.type==="image"?null:jsxRuntimeExports.jsxs("scene",{ref:a,children:[(v=l.resource)!=null&&v.url?jsxRuntimeExports.jsx(arcadeThreeCore.SceneResource,{ref:f,name:`char_${l.uid}`,url:l.resource.url,animationUrl:u.url,type:l.type,onLoad:x,texturable:!0,interactive:!0,merge:l.type!=="character"}):null,jsxRuntimeExports.jsx(drei.PerspectiveCamera,{ref:t,fov:35,position:defaultCamPos,rotation:[0,0,0],onUpdate:T=>{T.layers.enableAll()},manual:!0}),jsxRuntimeExports.jsx(LightSet,{})]})}function PanelsWrapper({characters:l,slots:e,ttsStarted:n,flex:t,currentMessage:a,emitEvent:o}){fiber.useFrame(({gl:h})=>{h.setScissorTest(!1),h.clear(!0,!0),h.setScissorTest(!0)});const d=React$2.useMemo(()=>o({type:"currentLod"}),[o]);return jsxRuntimeExports.jsx(arcadeThreeCore.QualityManager,{lod:d,active:!0,children:e.map((h,f)=>{let u=null;const p=l.findIndex(x=>x&&x.uid===h.uid);if(p>=0){const x=t?p:f;return u={...l[p]},u.slot=x,jsxRuntimeExports.jsx(Panel,{character:u,active:a.position===x,ttsStarted:n,emitEvent:o},`${`${u.uid}_${f}`}_${p}`)}return null})})}function Scene(l){return l.lowQuality?null:jsxRuntimeExports.jsxs(arcadeThreeCore.Renderer,{className:"conversation--canvas",style:{position:"absolute",width:"100%",height:"100%"},gl:{antialias:!0},fullscreen:!1,onCreated:({gl:e})=>{e.setClearColor("white",0)},children:[jsxRuntimeExports.jsx(arcadeThreeCore.SettingsController,{current:{animate:l.pause}}),jsxRuntimeExports.jsx(arcadeThreeCore.EnvironmentWrapper,{url:"https://min.gamelearn.io/statics/envs/envmap_1k.hdr"}),jsxRuntimeExports.jsx(PanelsWrapper,{...l})]})}function SlotList({characters:l,actors:e,lodSettings:n,ttsStarted:t,currentMessage:a,flex:o,slots:d,children:h,pause:f,emitEvent:u}){const p=({character:T,active:b,slot:_})=>({character:T,active:b,emotion:b?a.emotion:"neutral",slot:_}),R=React$2.useMemo(()=>u({type:"currentLod"}),[u])==="divideby64",S=d.reduce((T,b)=>{var C,P;const _=e==null?void 0:e.find(D=>D.uid===b.uid),w={...b};if(b.character)w.name=b.alias||b.character.name,w.resource=w.character.resource,w.position=w.position>=0?w.position:-1,delete w.character,w.type="character",T.push(w);else if(_){const{resource:D}=_;w.name=b.alias||b.name,w.position=w.position>=0?w.position:-1,w.resource=D,w.type=_.type,T.push(w)}else b.type?(w.name=b.alias||((C=b.character)==null?void 0:C.name)||b.name,w.resource=((P=w.character)==null?void 0:P.resource)||b.resource,w.position=w.position>=0?w.position:-1,delete w.character,w.type=b.type,T.push(w)):o||T.push(null);return T},[]),E=S.length&&S.some(T=>T),g=l.filter(T=>d.find(b=>T.uid===b.uid));function v(){return E?S.map((T,b)=>T?jsxRuntimeExports.jsx(Slot,{emitEvent:u,lowQuality:R,...p({character:T,active:a.position===T.position,slot:b})},`${T.uid+b}`):jsxRuntimeExports.jsx("div",{className:`conversation--character__item void ${b}`},`void_${0+b}`)):o?g.map((T,b)=>{const _=a.position===b;return jsxRuntimeExports.jsx(Slot,{...p({character:T,active:_,slot:b})},`${T.uid+b}`)}):d.length>0?d.map((T,b)=>{const _=l.find(w=>w.uid===T.uid);if(_){const w=a.position===b;return _.name=T.alias||_.name,jsxRuntimeExports.jsx(Slot,{...p({character:_,active:w,slot:b})},`${_.uid+b}`)}return jsxRuntimeExports.jsx("div",{className:`conversation--character__item void ${b}`},`${0+b}`)}):null}return jsxRuntimeExports.jsxs("div",{className:"conversation--characters",children:[jsxRuntimeExports.jsx(Scene,{characters:E?S:g,slots:d,flex:o,currentMessage:a,lodSettings:n,ttsStarted:t,pause:f,emitEvent:u,lowQuality:R}),h||jsxRuntimeExports.jsx(v,{})]})}SlotList.defaultProps={characters:[],currentMessage:{},flex:!0,slots:[]};function Options({inherited:l,options:e,selectedChoice:n,selectChoice:t,showingResults:a,simplifiedOptions:o,required:d}){const[h,f]=React$2.useState(null),u=x=>{o?(f(x),setTimeout(()=>{t(x)},1e3)):t(x)},p=x=>!!(a&&(n==null?void 0:n.id)===x.id||(n==null?void 0:n.right)===!0||a&&!d);return e==null?void 0:e.filter(x=>x.text).map(x=>jsxRuntimeExports.jsxs("div",{className:`${l?"conversation--question custom-radio":"custom-radio"}
67
- ${(h==null?void 0:h.id)===x.id?"radio-text-clicked":""}`,children:[jsxRuntimeExports.jsx("input",{onChange:()=>{u(x)},className:"radio",type:"radio",id:x.text_labelId,name:x.id,checked:(n==null?void 0:n.id)===x.id,disabled:p(x)}),jsxRuntimeExports.jsx("label",{className:`${x.right?"radio-text-success":"radio-text-fail"}`,htmlFor:x.text_labelId,children:HTMLReactParser$1(x.text)})]},`${x.id}_${x.text_labelId}`))}const noop=()=>{};function BasicDecision({children:l,question:e,showingResults:n,selected:t,required:a,failed:o,onNext:d,translate:h,hasRewards:f,options:u}){const[p,x]=React$2.useState(!1);function R(){(t==null?void 0:t.id)!==void 0&&!p&&(x(!0),d())}return jsxRuntimeExports.jsxs("div",{className:`popup popup__large popup__basicDecision ${n&&(t!=null&&t.feedback)?"popup__feedback":""}`,children:[jsxRuntimeExports.jsx("div",{className:"popup--info",children:n?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[l,!(t!=null&&t.feedback)&&f.length===0&&jsxRuntimeExports.jsx("span",{className:"popup--info__title",children:e!==""&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:e})}),!(t!=null&&t.feedback)&&f.length>0&&jsxRuntimeExports.jsx("span",{className:"popup--info__title",children:e})]}):jsxRuntimeExports.jsx("span",{className:"popup--info__title",children:e})}),jsxRuntimeExports.jsx("div",{className:"popup__questions",dir:"auto",children:u}),jsxRuntimeExports.jsx("div",{className:"popup--buttons",children:(a?!o:(t==null?void 0:t.id)!==void 0)?jsxRuntimeExports.jsx("button",{type:"button",className:`gat--btn__navigation ${p||(t==null?void 0:t.id)===void 0?"disabled":""}`,onClick:()=>R(),"aria-label":h("storylines.misc.closePiece"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})}):null})]})}function ComplexDecision({question:l,inScene:e,disabled:n,onNext:t,children:a}){return jsxRuntimeExports.jsxs("div",{dir:"auto",className:`conversation--body ${e?"conversation--body--inScene":""}`,children:[jsxRuntimeExports.jsxs("div",{className:"conversation--message",children:[l!==""&&jsxRuntimeExports.jsx("div",{className:"conversation--main__text",children:HTMLReactParser$1(l)}),a]}),jsxRuntimeExports.jsxs("div",{className:"conversation--controls conversation--controls--fixedbottom",children:[jsxRuntimeExports.jsx("div",{className:"gat--btn__round disabled",children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-next":"icon-back"})}),jsxRuntimeExports.jsx("button",{className:`gat--btn__round ${n?"disabled":""}`,type:"button",onClick:()=>!n&&t(),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})]})]})}function DecisionBody({options:l,question:e,inherited:n,branched:t,changeOption:a,onNext:o,failed:d,showingResults:h,currentSelectedChoice:f,children:u,translate:p,hasRewards:x,inScene:R,required:S,simplifiedOptions:E}){const g=b=>{h&&d&&a(b),o(b)},v=!h&&(f==null?void 0:f.id)!==void 0||!d,T={inherited:n,selectedChoice:f,selectChoice:(!S||t)&&(f==null?void 0:f.id)!==void 0||S&&!d?noop:g,options:l,showingResults:h,simplifiedOptions:E,required:S};return n?jsxRuntimeExports.jsx(ComplexDecision,{disabled:!v,question:e,inScene:R,onNext:()=>o(f),children:jsxRuntimeExports.jsx(Options,{...T})}):jsxRuntimeExports.jsx(BasicDecision,{question:e,showingResults:h,selected:f,required:S,failed:d,onNext:()=>o(f),translate:p,hasRewards:x,options:jsxRuntimeExports.jsx(Options,{...T}),children:u})}function Wrapper({children:l,inherit:e,feedback:n}){return e?jsxRuntimeExports.jsx("div",{className:`conversation--feedback ${n?"":"only--rewards"}`,children:l}):n?l:jsxRuntimeExports.jsx("div",{className:"popup__basicDecision__only--rewards only--rewards",children:l})}function FeedBack({choice:l,inherited:e,question:n}){return l.feedback?jsxRuntimeExports.jsx(Wrapper,{inherit:e,feedback:l.feedback,children:l.feedback?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"conversation--feedback__title",children:n}),jsxRuntimeExports.jsxs("div",{className:"conversation--feedback__text",dir:"auto",children:[l.right?jsxRuntimeExports.jsx("span",{className:"icon-check-circle-black color--success"}):jsxRuntimeExports.jsx("span",{className:"icon-error-circle-black color--error"}),jsxRuntimeExports.jsx("div",{className:"conversation--feedback__wysiwyg",children:HTMLReactParser$1(l.feedback)})]})]}):null}):null}function DecisionComponent({emitEvent:l,soundActions:e,keyboardControl:n,inScene:t,...a}){var M,U;const{inheritProps:o={},decisionNumber:d,required:h,question:f,onAddPoints:u,onFinish:p,branched:x,simplifiedOptions:R}=a,S=Object.keys(o).length>0,[E,g]=React$2.useState("options"),[v,T]=React$2.useState({}),[b]=e,_=h&&!(v!=null&&v.right),w=React$2.useRef(),C=$=>{var B;(B=$.audio)!=null&&B.url&&b($.audio.url,"audio_file",!1,$.audioVolume)},P={...o,slots:o.slots?o.slots:o.characters,currentMessage:{position:null,emotion:""},emitEvent:l};o&&o.flex&&P.slots&&(P.characters=P.characters.filter($=>P.slots.find(B=>B.uid===$.uid)));const D=$=>{l({type:"decisionJournal",payload:{choice:$,decisionNumber:d}})},N=$=>{!_&&E==="results"?(b("click-ui"),S?R?p&&(D($),p($,()=>{T({}),g("options")})):(u&&u($),D($),l({type:"addPoints",payload:$.rewards,finish:!1,complex:!0,onFinish:()=>{p?p($,()=>{T({}),g("options")}):l({type:"success"}),T({}),g("options")}})):(D($),l({type:"addPoints",payload:$.rewards,finish:!0,complex:!0}))):Object.keys($).length>0&&(b("click-ui"),R?(D({...$,simplified:!0}),p($,()=>{T({}),g("options")})):($.right?b("score"):(b("fail"),x||(S||h?(D($),l({type:"addPoints",payload:$.rewards,finish:!1,complex:!0})):h||(T({}),g("options")))),T($),C($),g("results")))},k={...a,selectView:g,selectedView:E,emitEvent:l,inherited:S,branched:x,soundActions:e,showingResults:E==="results",currentSelectedChoice:v,hasRewards:(v==null?void 0:v.rewards)||[],failed:_,inScene:t,required:h,simplifiedOptions:R,changeOption:$=>{b("click-ui"),T($),g("options")},onNext:N,translate:$=>l({type:"translate",payload:$})},F=n({disabled:E!=="results",repeat:!1,forward:()=>{if(w.current!==v)w.current=v;else return;N(v)}});return React$2.useEffect(()=>F(),[F]),S?jsxRuntimeExports.jsx("div",{className:`conversation--layer
67
+ ${(h==null?void 0:h.id)===x.id?"radio-text-clicked":""}`,children:[jsxRuntimeExports.jsx("input",{onChange:()=>{u(x)},className:"radio",type:"radio",id:x.text_labelId,name:x.id,checked:(n==null?void 0:n.id)===x.id,disabled:p(x)}),jsxRuntimeExports.jsx("label",{className:`${x.right?"radio-text-success":"radio-text-fail"}`,htmlFor:x.text_labelId,children:HTMLReactParser$1(x.text)})]},`${x.id}_${x.text_labelId}`))}const noop=()=>{};function BasicDecision({children:l,question:e,showingResults:n,selected:t,required:a,failed:o,onNext:d,translate:h,hasRewards:f,options:u}){const[p,x]=React$2.useState(!1);function R(){(t==null?void 0:t.id)!==void 0&&!p&&(x(!0),d())}return jsxRuntimeExports.jsxs("div",{className:`popup popup__large popup__basicDecision ${n&&(t!=null&&t.feedback)?"popup__feedback":""}`,children:[jsxRuntimeExports.jsx("div",{className:"popup--info",children:n?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[l,!(t!=null&&t.feedback)&&f.length===0&&jsxRuntimeExports.jsx("span",{className:"popup--info__title",children:e!==""&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:e})}),!(t!=null&&t.feedback)&&f.length>0&&jsxRuntimeExports.jsx("span",{className:"popup--info__title",children:e})]}):jsxRuntimeExports.jsx("span",{className:"popup--info__title",children:e})}),jsxRuntimeExports.jsx("div",{className:"popup__questions",dir:"auto",children:u}),jsxRuntimeExports.jsx("div",{className:"popup--buttons",children:(a?!o:(t==null?void 0:t.id)!==void 0)?jsxRuntimeExports.jsx("button",{"data-testid":"continueButtonDecision",type:"button",className:`gat--btn__navigation ${p||(t==null?void 0:t.id)===void 0?"disabled":""}`,onClick:()=>R(),"aria-label":h("storylines.misc.closePiece"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})}):null})]})}function ComplexDecision({question:l,inScene:e,disabled:n,onNext:t,children:a}){return jsxRuntimeExports.jsxs("div",{dir:"auto",className:`conversation--body ${e?"conversation--body--inScene":""}`,children:[jsxRuntimeExports.jsxs("div",{className:"conversation--message",children:[l!==""&&jsxRuntimeExports.jsx("div",{className:"conversation--main__text",children:HTMLReactParser$1(l)}),a]}),jsxRuntimeExports.jsxs("div",{className:"conversation--controls conversation--controls--fixedbottom",children:[jsxRuntimeExports.jsx("div",{className:"gat--btn__round disabled",children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-next":"icon-back"})}),jsxRuntimeExports.jsx("button",{"data-testid":"continueButtonComplexDecision",className:`gat--btn__round ${n?"disabled":""}`,type:"button",onClick:()=>!n&&t(),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})]})]})}function DecisionBody({options:l,question:e,inherited:n,branched:t,changeOption:a,onNext:o,failed:d,showingResults:h,currentSelectedChoice:f,children:u,translate:p,hasRewards:x,inScene:R,required:S,simplifiedOptions:E}){const g=b=>{h&&d&&a(b),o(b)},v=!h&&(f==null?void 0:f.id)!==void 0||!d,T={inherited:n,selectedChoice:f,selectChoice:(!S||t)&&(f==null?void 0:f.id)!==void 0||S&&!d?noop:g,options:l,showingResults:h,simplifiedOptions:E,required:S};return n?jsxRuntimeExports.jsx(ComplexDecision,{disabled:!v,question:e,inScene:R,onNext:()=>o(f),children:jsxRuntimeExports.jsx(Options,{...T})}):jsxRuntimeExports.jsx(BasicDecision,{question:e,showingResults:h,selected:f,required:S,failed:d,onNext:()=>o(f),translate:p,hasRewards:x,options:jsxRuntimeExports.jsx(Options,{...T}),children:u})}function Wrapper({children:l,inherit:e}){return e?jsxRuntimeExports.jsx("div",{className:"conversation--feedback",children:l}):l}function FeedBack({choice:l,inherited:e,question:n}){return l.feedback?jsxRuntimeExports.jsx(Wrapper,{inherit:e,children:l.feedback&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"conversation--feedback__title",children:n}),jsxRuntimeExports.jsxs("div",{className:"conversation--feedback__text",dir:"auto",children:[l.right?jsxRuntimeExports.jsx("span",{className:"icon-check-circle-black color--success"}):jsxRuntimeExports.jsx("span",{className:"icon-error-circle-black color--error"}),jsxRuntimeExports.jsx("div",{className:"conversation--feedback__wysiwyg",children:HTMLReactParser$1(l.feedback)})]})]})}):null}function DecisionComponent({emitEvent:l,soundActions:e,keyboardControl:n,inScene:t,...a}){var M,U;const{inheritProps:o={},decisionNumber:d,required:h,question:f,onAddPoints:u,onFinish:p,branched:x,simplifiedOptions:R}=a,S=Object.keys(o).length>0,[E,g]=React$2.useState("options"),[v,T]=React$2.useState({}),[b]=e,_=h&&!(v!=null&&v.right),w=React$2.useRef(),C=$=>{var B;(B=$.audio)!=null&&B.url&&b($.audio.url,"audio_file",!1,$.audioVolume)},P={...o,slots:o.slots?o.slots:o.characters,currentMessage:{position:null,emotion:""},emitEvent:l};o&&o.flex&&P.slots&&(P.characters=P.characters.filter($=>P.slots.find(B=>B.uid===$.uid)));const D=$=>{l({type:"decisionJournal",payload:{choice:$,decisionNumber:d}})},N=$=>{!_&&E==="results"?(b("click-ui"),S?R?p&&(D($),p($,()=>{T({}),g("options")})):(u&&u($),D($),l({type:"addPoints",payload:$.rewards,finish:!1,complex:!0,onFinish:()=>{p?p($,()=>{T({}),g("options")}):l({type:"success"}),T({}),g("options")}})):(D($),l({type:"addPoints",payload:$.rewards,finish:!0,complex:!0}))):Object.keys($).length>0&&(b("click-ui"),R?(D({...$,simplified:!0}),p($,()=>{T({}),g("options")})):($.right?b("score"):(b("fail"),x||(S||h?(D($),l({type:"addPoints",payload:$.rewards,finish:!1,complex:!0})):h||(T({}),g("options")))),T($),C($),g("results")))},k={...a,selectView:g,selectedView:E,emitEvent:l,inherited:S,branched:x,soundActions:e,showingResults:E==="results",currentSelectedChoice:v,hasRewards:(v==null?void 0:v.rewards)||[],failed:_,inScene:t,required:h,simplifiedOptions:R,changeOption:$=>{b("click-ui"),T($),g("options")},onNext:N,translate:$=>l({type:"translate",payload:$})},F=n({disabled:E!=="results",repeat:!1,forward:()=>{if(w.current!==v)w.current=v;else return;N(v)}});return React$2.useEffect(()=>F(),[F]),S?jsxRuntimeExports.jsx("div",{className:`conversation--layer
68
68
  ${v!=null&&v.feedback?"":"conversation--layer__defaultFeedback"}
69
69
  ${E==="results"?"conversation--layer__feedback":""}`,children:jsxRuntimeExports.jsxs("div",{className:`conversation ${t?"conversation--inScene":""}`,style:(M=o.background)!=null&&M.img?{backgroundImage:`url("${(U=o.background.img)==null?void 0:U.url}")`}:null,children:[jsxRuntimeExports.jsx(SlotList,{...P,children:E==="results"&&(v!=null&&v.feedback)?jsxRuntimeExports.jsx(FeedBack,{question:f,soundActions:e,inherited:S,choice:v,rewards:(v==null?void 0:v.rewards)||[],emitEvent:l}):null}),jsxRuntimeExports.jsx(DecisionBody,{...k})]})}):jsxRuntimeExports.jsx("div",{className:"popup--layer popup--layer--transparent",children:jsxRuntimeExports.jsx(DecisionBody,{...k,children:jsxRuntimeExports.jsx(FeedBack,{question:f,soundActions:e,inherited:S,choice:v,rewards:(v==null?void 0:v.rewards)||[],emitEvent:l})})})}function ImageComponent({emitEvent:l,img:e,imgName:n,documentType:t,visible:a,viewed:o,imgId_labelId:d,soundActions:h,keyboardControl:f}){const u=v=>l({type:"translate",payload:v}),[p,x]=React$2.useState(!1),R=e.url,[S]=h,E=React$2.useCallback(()=>{S("click-ui"),l({type:"finishMedia",payload:{imgId:d,name:n,imgName:n,documentType:t,type:"image"}})},[S,d,n,t,l]),g=f({disabled:o,forward:E,escape:E});return React$2.useEffect(()=>g(),[g]),React$2.useEffect(()=>{!a&&!p&&(x(!0),E())},[E,a,p]),a?jsxRuntimeExports.jsx("div",{className:o?"notes--results":"readings--container readings--container--darkopacity",children:jsxRuntimeExports.jsxs("div",{className:o?"notes--results__text":"readings readings--image",children:[R&&jsxRuntimeExports.jsx("img",{src:R,alt:n}),o?null:jsxRuntimeExports.jsx("div",{className:R?"readings--image--closeBtn":"position--absolute top right",children:jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn__round gat--btn__close",onClick:E,"aria-label":u("storylines.misc.closePiece"),children:jsxRuntimeExports.jsx("span",{className:"icon-close"})})})]})}):null}function VoiceOver({name:l}){return jsxRuntimeExports.jsx("div",{className:"conversation--voice__over",children:jsxRuntimeExports.jsx("span",{children:l||"Voice-Over"})})}function ThinkFul({text:l}){return jsxRuntimeExports.jsxs("div",{className:"conversation--voice__over",children:[jsxRuntimeExports.jsx("span",{className:"icon-bubble-thinkful-black"}),jsxRuntimeExports.jsxs("span",{children:["[",l,"]"]})]})}function Message({current:l,translate:e}){var t,a;const n=l.text;return jsxRuntimeExports.jsxs("div",{className:`conversation--message ${l.voiceOver||(t=l==null?void 0:l.emotion)!=null&&t.includes("think")?"voice--over":""}`,children:[l.voiceOver?jsxRuntimeExports.jsx(VoiceOver,{name:l.name}):null,(a=l==null?void 0:l.emotion)!=null&&a.includes("think")?jsxRuntimeExports.jsx(ThinkFul,{text:e("emotion.thinking")}):null,jsxRuntimeExports.jsx("div",{className:"conversation--main__text",children:HTMLReactParser$1(n)})]})}Message.defaultProps={current:{},voiceOver:!1};const characterMs$3=75,minMs$1=1400;function ConversationalProComponent({keyboardControl:l,emitEvent:e,pause:n,lines:t,edges:a,characters:o,actors:d,background:h,soundActions:f,lodSettings:u,autoPlay:p,autoEnd:x,progress:R}){var xt,Et,Qe;const S=t.length-1<=(R==null?void 0:R.line)?t.length-1:(R==null?void 0:R.line)||0,[E,g]=React$2.useState(!1),[v,T]=React$2.useState(!0),[b,_]=React$2.useState(!!p),[w,C]=React$2.useState(!1),[P,D]=React$2.useState(S),[N,k]=React$2.useState(!1),[F]=f,{start:M,stop:U}=useTimeout(),$=((xt=h==null?void 0:h.img)==null?void 0:xt.url)||null,B=t[P],{voiceOver:J,decision:ne}=B;let{flex:ie}=B,Y=[];const q=!!a,re=J||B.type==="conversationalNarration",ce=ne||B.type==="conversationalDecision",fe=B.type==="conversationalCamera",[te,H]=React$2.useState([]),W=React$2.useMemo(()=>te[te.length-1],[te]),V=React$2.useCallback(()=>{const Be=a.find(Ye=>Ye.fromId===W)||a.find(Ye=>Ye.toId===W),Xe=t.find(Ye=>Ye.id===(Be==null?void 0:Be.fromId));return!W&&(R==null?void 0:R.line)>=0?{decision:!0}:Xe},[a,t,W,R==null?void 0:R.line]),z=React$2.useCallback(()=>{if(q){const Xe=V();return Xe==null?void 0:Xe.decision}const Be=t[P-1]?t[P-1]:{};return P>0&&(Be==null?void 0:Be.decision)},[q,V,t,P]),Q=React$2.useCallback(()=>{if(q){const Xe=V();return(Xe==null?void 0:Xe.type)==="conversationalCamera"}const Be=t[P-1]?t[P-1]:{};return P>0&&(Be==null?void 0:Be.type)==="conversationalCamera"},[q,t,P,V]),ee=React$2.useCallback(Be=>e({type:"translate",payload:Be}),[e]),le=React$2.useMemo(()=>{var Xe,Ye;if(ce)return{};if(re)return B;const Be=(Xe=B==null?void 0:B.slots)==null?void 0:Xe.find(Pe=>Pe.uid&&Pe.talking);return Be||((Ye=B==null?void 0:B.slots)==null?void 0:Ye.find(Pe=>Pe.uid&&Pe.text))},[B,re,ce]),ue=t.slice(0,P+1).reverse().find(Be=>Be.slots),he=!ce&&((Et=B.slots)==null?void 0:Et.filter(Be=>Be.uid).length),ve=characterMs$3*(((Qe=le==null?void 0:le.text)==null?void 0:Qe.length)||0);let be=[];B.slots?be=B.slots:ue&&(be=ue.slots);const Re=be.filter(Be=>Be.uid).map(Be=>{const Xe=(o||d||[]).find(Ye=>Ye.uid===Be.uid);return Xe&&(Be.resource=Xe.resource,Be.type=Xe.type),Be.resource||(Be.resource={}),Be}),Le={characters:Re,lodSettings:u,actors:d,currentMessage:le||{},slots:re?Y:B.slots,flex:ie,pause:n,emitEvent:e};if(re){const Be=t.slice(P).find(Ye=>Ye.slots),Xe=ue||Be;Xe&&(Y=Xe.slots,ie=Xe.flex)}else if(!ce&&he&&(B.slots.forEach(Be=>{const Xe=Re.findIndex(Ye=>Ye.uid===Be.uid);Xe>=0&&(Re[Xe].emotion=Be.emotion)}),le&&le.uid)){const Be=B.slots.findIndex(Ye=>Ye.uid===le.uid),Xe=Re.findIndex(Ye=>Ye.uid===le.uid);Re.forEach(Ye=>{Ye.uid===le.uid&&(Ye.name=le.alias)}),le.position=ie?Xe:Be}const Oe=React$2.useCallback(()=>{e({type:"success"})},[e]),Ke=React$2.useCallback((Be,Xe)=>{const Ye=[3,2,1][Be.id],Ae=a.filter(_e=>_e.fromId===B.id).find(_e=>parseInt(_e.fromPointIndex)===Ye);if(Ae){const _e=t.findIndex(Ie=>Ie.id===Ae.toId);Ae.fromId===Ae.toId?Xe():_e>=0?(D(_e),e({type:"notifyProgress",payload:{line:_e}})):Oe()}else Oe()},[B.id,a,e,Oe,t]),St=React$2.useCallback((Be=!0)=>{const Xe=Be?["fromId","toId"]:["toId","fromId"],Ye=a.filter(_e=>_e[Xe[0]]===B.id),Pe=Ye.length===1?Ye[0]:Ye.find(_e=>_e[Xe[1]]===W);if(!(Pe!=null&&Pe[Xe[0]])){Oe();return}Be||H(te.slice(0,-1));const Ae=t.findIndex(_e=>_e.id===Pe[Xe[1]]);Ae>=0?(D(Ae),e({type:"notifyProgress",payload:{line:Ae}})):Oe()},[B.id,a,te,e,Oe,W,t]),it=React$2.useCallback(Be=>{if(q){if(Be){const Xe=[3,2,1][Be.id],Pe=a.filter(Ae=>Ae.fromId===B.id).find(Ae=>parseInt(Ae.fromPointIndex)===Xe);if(Pe){const Ae=t.findIndex(_e=>_e.id===Pe.toId);Ae>=0&&e({type:"notifyProgress",payload:{line:Ae}})}else e({type:"saveNode"})}}else if(P<t.length-1){const Ye=P+1;e({type:"notifyProgress",payload:{line:Ye}})}else e({type:"saveNode"})},[a,t,e,P,B.id,q]),gt=React$2.useCallback((Be,Xe)=>{let Ye=!1;if(k(!1),H([...te,B.id]),T(!1),C(!1),q)Be?Ke(Be,Xe):St();else if(P<t.length-1){const Ae=P+1;D(Ae),e({type:"notifyProgress",payload:{line:Ae}}),Xe&&Xe()}else x||ce||fe?Oe():Ye=!0;Ye||T(!0)},[te,B.id,q,P,t.length,x,ce,fe,Ke,St,e,Oe]),Ge=()=>{if(T(!1),k(!1),C(!1),q)St(!1);else if(!z()){const Be=P-1;D(Be),e({type:"notifyProgress",payload:{line:Be}})}T(!0)},Me=React$2.useCallback(()=>q?B&&B.type!=="conversationalDecision"&&!a.find(Be=>Be.fromId===B.id):P===t.length-1,[P,B,a,q,t.length]),De=()=>{F("click-ui"),Me()?Oe():(_(!1),gt())},Ve=()=>{F("click-ui"),_(!1),Ge()},ct=b&&!ce&&!n&&!fe,dt=React$2.useMemo(()=>P===0||z()||Q(),[P,z,Q]);useEkho({audioType:B==null?void 0:B.audioType,volume:B==null?void 0:B.audioVolume,voice:B==null?void 0:B.voice,started:v,slide:P,text:cleanTextOfHtmlTags(le==null?void 0:le.text),audio:B==null?void 0:B.audio,soundActions:f,emitEvent:e,pauseTTS:n,onStart:()=>{var Be;(Be=le==null?void 0:le.emotion)!=null&&Be.includes("think")||k(!0)},onError:()=>{C(!0)},onFinish:()=>{k(!1),ct&&gt()}}),React$2.useEffect(()=>{var Xe;let Be;return ce?()=>{}:(((B==null?void 0:B.audioType)==="none"||w)&&!((Xe=le==null?void 0:le.emotion)!=null&&Xe.includes("think"))&&(k(!0),Be=setTimeout(()=>{k(!1)},ve<minMs$1?minMs$1:ve)),()=>{Be&&clearTimeout(Be)})},[w,B,le==null?void 0:le.emotion,ve,ce]),React$2.useEffect(()=>(ct&&((B==null?void 0:B.audioType)==="none"||w)&&(!Me()||Me()&&x)&&M(gt,ve<minMs$1?minMs$1:ve),()=>{U()}),[le,M,U,gt,B==null?void 0:B.audioType,ct,w,x,t,Me,ve]),React$2.useEffect(()=>{if(fe){const{targetUid:Be}=B;e({type:"changeCamera",payload:{targetUid:Be,transition:{type:"none"}}}),gt()}},[fe,gt,e,B]),React$2.useEffect(()=>{if(q&&!E){const Be=R==null?void 0:R.line;if(Be>=0){g(!0),D(Be);return}const Xe=t.filter(Ye=>!a.find(Pe=>Pe.toId===Ye.id));if(Xe.length){const Ye=Xe[0],Pe=t.indexOf(Ye);Pe>=0&&(g(!0),D(Pe))}}},[a,q,t,E,R==null?void 0:R.line]);const rt=l({disabled:ce,repeat:!1,forward:De,rewind:dt?null:Ve});if(React$2.useEffect(()=>rt(),[rt]),ce){const Be=t[P].id?t.filter(Ye=>Ye.decision).findIndex(Ye=>Ye.id===t[P].id)+1:t.filter(Ye=>Ye.decision).findIndex(Ye=>Ye===t[P])+1,Xe={...B.payload,decisionNumber:Be,required:!q,branched:q,onAddPoints:it,onFinish:gt,keyboardControl:l,emitEvent:e,soundActions:f,inheritProps:{characters:Re,background:h,flex:ue?ue.flex:!0,slots:ue?ue.slots:[]}};return jsxRuntimeExports.jsx(DecisionComponent,{...Xe})}return jsxRuntimeExports.jsx("div",{className:"conversation--layer",children:jsxRuntimeExports.jsxs("div",{"data-testid":"conversational-pro-image",className:"conversation",style:$?{backgroundImage:`url("${$}")`}:null,children:[jsxRuntimeExports.jsx(SlotList,{...Le,ttsStarted:N}),jsxRuntimeExports.jsxs("div",{className:"conversation--body",dir:"auto",children:[le?jsxRuntimeExports.jsx(Message,{current:le,translate:ee}):null,jsxRuntimeExports.jsxs("div",{className:"conversation--controls",children:[jsxRuntimeExports.jsx("button",{"data-testid":"conversational-pro-button-back",className:`gat--btn__round ${dt?"disabled":""}`,disabled:dt?!0:"",type:"button",onClick:Ve,"aria-label":LangIsRtl()?ee("storylines.misc.forward"):ee("storylines.misc.rewind"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-next":"icon-back"})}),jsxRuntimeExports.jsx("button",{"data-testid":"conversational-pro-button-next",className:`gat--btn__round ${b&&Me()?"glowing-animation":""}`,type:"button",onClick:De,"aria-label":LangIsRtl()?ee("storylines.misc.rewind"):ee("storylines.misc.forward"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})]})]})]})})}ConversationalProComponent.defaultProps={background:{},emitEvent:()=>{},soundActions:[()=>{},()=>{}]};function ConversationalComponent({emitEvent:l,soundActions:e,messages:n,characters:t,alias:a,background:o,lodSettings:d}){var g;const[h,f]=React$2.useState(0),[u]=e,p=((g=o==null?void 0:o.img)==null?void 0:g.url)||null,x=n[h],R=t.map((v,T)=>({...v,name:a[T]?a[T]:v.name,uid:T})),S=()=>{const v=n.length-1;u("click-ui"),h+1<=v?f(h+1):l({type:"success"})},E=()=>{h>0&&(f(h-1),u("click-ui"))};return jsxRuntimeExports.jsx("div",{className:"conversation--layer",children:jsxRuntimeExports.jsxs("div",{"data-testid":"conversation-component",className:"conversation arcade-conversation",style:p?{backgroundImage:`url("${p}")`}:{},children:[jsxRuntimeExports.jsx(SlotList,{characters:R,lodSettings:d,currentMessage:x,slots:R,emitEvent:l,flex:!0}),jsxRuntimeExports.jsxs("div",{className:"conversation--body",children:[x?jsxRuntimeExports.jsx(Message,{current:x,voiceOver:x.emotion===null}):jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsxs("div",{className:"conversation--controls arcade-conversation--controls",children:[jsxRuntimeExports.jsx("button",{"data-testid":"conversational-back-button",className:`gat--btn__round ${h>0?"":"visibility--hidden"}`,type:"button",onClick:E,children:jsxRuntimeExports.jsx("span",{className:"icon-back"})}),jsxRuntimeExports.jsx("button",{"data-testid":"conversational-next-button",className:"gat--btn__round",type:"button",onClick:S,children:jsxRuntimeExports.jsx("span",{className:"icon-next"})})]})]})]})})}function Vignette({vignette:l,alias:e,translate:n,backgroundImageCover:t}){var u;const o=(l.img||{url:"https://min.gamelearn.io/css-resources/gamelearn/resources/conversation.jpg"}).url,[d,h]=React$2.useState(!0),f=p=>{document.querySelector(`#${p}`).focus(),h(!d)};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{"data-testid":"comic-image",className:`comic-image ${t?"comic-image--cover":""}`,children:o&&jsxRuntimeExports.jsx("img",{src:o,alt:"comic pic"})}),(u=l==null?void 0:l.textData)!=null&&u.text?jsxRuntimeExports.jsxs("div",{"data-testid":"comicCollapsable",className:`comic-collapsable ${d?"comic-collapsable--opened":""}`,children:[jsxRuntimeExports.jsx("button",{id:"buttonDown","data-testid":"buttonDown",onClick:()=>f("buttonUp"),type:"button",className:"un-btn comic-collapsable__headertoggle","aria-label":n("comic.toggleText"),children:jsxRuntimeExports.jsx("span",{className:"icon-down-arrow"})}),jsxRuntimeExports.jsxs("div",{className:"comic-collapsable__text",children:[e?jsxRuntimeExports.jsxs("b",{children:[e,": "]}):null,HTMLReactParser$1(l.textData.text)]})]}):null,jsxRuntimeExports.jsx("button",{id:"buttonUp","data-testid":"buttonUp",tabIndex:d?"-1":"0","aria-hidden":d,className:`unset-button comic-buttonup
70
70
  ${d?"":"comic-buttonup--visible"}`,type:"button",onClick:()=>f("buttonDown"),"aria-label":n("comic.toggleText"),children:jsxRuntimeExports.jsx("span",{className:"icon-up-arrow"})})]})}function Slide({slide:l,transition:e,translate:n,backgroundImageCover:t}){const a=l.transitionEffects||e;return jsxRuntimeExports.jsx("div",{className:`comic-slide__item ${a}`,"aria-label":"comic slide item",children:l.vignettes.map(o=>jsxRuntimeExports.jsx(Vignette,{vignette:o,alias:l.alias,"aria-hidden":"true",translate:n,backgroundImageCover:t},`Vignete ${o.vignetteOrder}`))})}const characterMs$2=75;function ComicComponent({slides:l,emitEvent:e,soundActions:n=[()=>{},()=>{}],autoPlay:t,autoEnd:a,pause:o,progress:d,keyboardControl:h,backgroundImageCover:f=!1}){var J,ne,ie,Y,q,re,ce,fe;const u=(d==null?void 0:d.slide)||0,p=te=>e({type:"translate",payload:te}),[x,R]=React$2.useState(!0),[S,E]=React$2.useState(!!t),[g,v]=React$2.useState(!1),{start:T,stop:b}=useTimeout(),[_,w]=React$2.useState(u),[C,P]=React$2.useState("slide-animation"),[D]=n,N=l==null?void 0:l[_],k=React$2.useCallback(()=>{R(!1),e({type:"success"})},[e]),F=React$2.useCallback(()=>{if(R(!1),v(!1),_+1<l.length&&!o){const te=_+1;P("slide-animation"),w(te),R(!0),e({type:"notifyProgress",payload:{slide:te}})}else a&&!o&&k()},[_,l.length,o,a,e,k]),M=React$2.useCallback(()=>{if(R(!1),v(!1),_-1>=0){const te=_-1;P("slide-animation"),w(te),R(!0),D("click-ui"),e({type:"notifyProgress",payload:{slide:te}})}},[D,_,e]),U=()=>{D("click-ui"),E(!1),F()},$=()=>{D("click-ui"),E(!1),M()},B=h({repeat:!1,rewind:_>0?$:null,forward:_+1>=l.length?k:U,escape:_+1>=l.length?k:null});return React$2.useEffect(()=>B(),[B]),useEkho({audioType:(J=l==null?void 0:l[_])==null?void 0:J.audioType,voice:(ne=l==null?void 0:l[_])==null?void 0:ne.voice,text:cleanTextOfHtmlTags((Y=(ie=l==null?void 0:l[_])==null?void 0:ie.vignettes[0].textData)==null?void 0:Y.text),audio:(q=l==null?void 0:l[_])==null?void 0:q.audio,slide:_,started:x,soundActions:n,emitEvent:e,pauseTTS:o,volume:(re=l==null?void 0:l[_])!=null&&re.audioVolume||((ce=l==null?void 0:l[_])==null?void 0:ce.audioVolume)===0?(fe=l==null?void 0:l[_])==null?void 0:fe.audioVolume:.5,onError:()=>{v(!0)},onFinish:()=>{S&&!(N!=null&&N.slideTimer)&&F()}}),React$2.useEffect(()=>{var te,H;if(S){if(N!=null&&N.slideTimer)T(F,N.slideTimer*1e3);else if((N==null?void 0:N.audioType)==="none"&&!o||g&&!o){const W=characterMs$2*(((H=(te=N==null?void 0:N.vignettes[0])==null?void 0:te.textData)==null?void 0:H.text.length)||0);T(F,W<1400?1400:W)}}return()=>{b()}},[g,S,F,o,N==null?void 0:N.audio,N==null?void 0:N.audioType,N==null?void 0:N.slideTimer,N==null?void 0:N.vignettes,T,b]),l!=null&&l.length?jsxRuntimeExports.jsx("div",{dir:LangIsRtl()?"rtl":"auto",className:"comic component growIn-animation",role:"main","aria-label":"Comic",children:jsxRuntimeExports.jsxs("div",{className:"comic-slider",role:"navigation","aria-label":"Slider",children:[l[_]&&jsxRuntimeExports.jsx(Slide,{slide:l[_],transition:C,soundActions:n,emitEvent:e,role:"complementary","aria-hidden":"true",translate:p,backgroundImageCover:f},`comic page ${l[_].slideOrder}`),_>0&&jsxRuntimeExports.jsx("button",{type:"button",className:"comic-control comic-control--left gat--btn__round","data-testid":"btn-bck",onClick:$,"aria-label":LangIsRtl()?p("comic.next"):p("comic.previous"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-next":"icon-back"})}),_<l.length&&jsxRuntimeExports.jsx("button",{type:"button",className:`comic-control comic-control--right gat--btn__round
@@ -250,7 +250,7 @@ For more info see: https://github.com/konvajs/react-konva/issues/256
250
250
  react-konva may get confused with ordering. Just define correct order of elements in your render function of a component.
251
251
  For more info see: https://github.com/konvajs/react-konva/issues/194
252
252
  `,EMPTY_PROPS={};function applyNodeProps(l,e,n=EMPTY_PROPS){if(!zIndexWarningShowed&&"zIndex"in e&&(console.warn(Z_INDEX_WARNING),zIndexWarningShowed=!0),!dragWarningShowed&&e.draggable){var t=e.x!==void 0||e.y!==void 0,a=e.onDragEnd||e.onDragMove;t&&!a&&(console.warn(DRAGGABLE_WARNING),dragWarningShowed=!0)}for(var o in n)if(!propsToSkip[o]){var d=o.slice(0,2)==="on",h=n[o]!==e[o];if(d&&h){var f=o.substr(2).toLowerCase();f.substr(0,7)==="content"&&(f="content"+f.substr(7,1).toUpperCase()+f.substr(8)),l.off(f,n[o])}var u=!e.hasOwnProperty(o);u&&l.setAttr(o,void 0)}var p=e._useStrictMode,x={},R=!1;const S={};for(var o in e)if(!propsToSkip[o]){var d=o.slice(0,2)==="on",E=n[o]!==e[o];if(d&&E){var f=o.substr(2).toLowerCase();f.substr(0,7)==="content"&&(f="content"+f.substr(7,1).toUpperCase()+f.substr(8)),e[o]&&(S[f]=e[o])}!d&&(e[o]!==n[o]||p&&e[o]!==l.getAttr(o))&&(R=!0,x[o]=e[o])}R&&(l.setAttrs(x),updatePicture(l));for(var f in S)l.on(f+EVENTS_NAMESPACE,S[f])}function updatePicture(l){if(!Global.Konva.autoDrawEnabled){var e=l.getLayer()||l.getStage();e&&e.batchDraw()}}var schedulerExports=requireScheduler();const NO_CONTEXT={},UPDATE_SIGNAL={};Konva.Node.prototype._applyProps=applyNodeProps;function appendInitialChild(l,e){if(typeof e=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${e}`);return}l.add(e),updatePicture(l)}function createInstance(l,e,n){let t=Konva[l];t||(console.error(`Konva has no node with the type ${l}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${l}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),t=Konva.Group);const a={},o={};for(var d in e){var h=d.slice(0,2)==="on";h?o[d]=e[d]:a[d]=e[d]}const f=new t(a);return applyNodeProps(f,o),f}function createTextInstance(l,e,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${l}"`)}function finalizeInitialChildren(l,e,n){return!1}function getPublicInstance(l){return l}function prepareForCommit(){return null}function preparePortalMount(){return null}function prepareUpdate(l,e,n,t){return UPDATE_SIGNAL}function resetAfterCommit(){}function resetTextContent(l){}function shouldDeprioritizeSubtree(l,e){return!1}function getRootHostContext(){return NO_CONTEXT}function getChildHostContext(){return NO_CONTEXT}const scheduleTimeout=setTimeout,cancelTimeout=clearTimeout,noTimeout=-1;function shouldSetTextContent(l,e){return!1}const isPrimaryRenderer=!1,warnsIfNotActing=!0,supportsMutation=!0;function appendChild(l,e){e.parent===l?e.moveToTop():l.add(e),updatePicture(l)}function appendChildToContainer(l,e){e.parent===l?e.moveToTop():l.add(e),updatePicture(l)}function insertBefore(l,e,n){e._remove(),l.add(e),e.setZIndex(n.getZIndex()),updatePicture(l)}function insertInContainerBefore(l,e,n){insertBefore(l,e,n)}function removeChild(l,e){e.destroy(),e.off(EVENTS_NAMESPACE),updatePicture(l)}function removeChildFromContainer(l,e){e.destroy(),e.off(EVENTS_NAMESPACE),updatePicture(l)}function commitTextUpdate(l,e,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function commitMount(l,e,n){}function commitUpdate(l,e,n,t,a){applyNodeProps(l,a,t)}function hideInstance(l){l.hide(),updatePicture(l)}function hideTextInstance(l){}function unhideInstance(l,e){(e.visible==null||e.visible)&&l.show()}function unhideTextInstance(l,e){}function clearContainer(l){}function detachDeletedInstance(){}const getCurrentEventPriority=()=>constantsExports.DefaultEventPriority,HostConfig=Object.freeze(Object.defineProperty({__proto__:null,appendChild,appendChildToContainer,appendInitialChild,cancelTimeout,clearContainer,commitMount,commitTextUpdate,commitUpdate,createInstance,createTextInstance,detachDeletedInstance,finalizeInitialChildren,getChildHostContext,getCurrentEventPriority,getPublicInstance,getRootHostContext,hideInstance,hideTextInstance,idlePriority:schedulerExports.unstable_IdlePriority,insertBefore,insertInContainerBefore,isPrimaryRenderer,noTimeout,now:schedulerExports.unstable_now,prepareForCommit,preparePortalMount,prepareUpdate,removeChild,removeChildFromContainer,resetAfterCommit,resetTextContent,run:schedulerExports.unstable_runWithPriority,scheduleTimeout,shouldDeprioritizeSubtree,shouldSetTextContent,supportsMutation,unhideInstance,unhideTextInstance,warnsIfNotActing},Symbol.toStringTag,{value:"Module"}));var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(l,e,n)=>e in l?__defProp(l,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):l[e]=n,__spreadValues=(l,e)=>{for(var n in e||(e={}))__hasOwnProp.call(e,n)&&__defNormalProp(l,n,e[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(e))__propIsEnum.call(e,n)&&__defNormalProp(l,n,e[n]);return l},__spreadProps=(l,e)=>__defProps(l,__getOwnPropDescs(e));function traverseFiber(l,e,n){if(!l)return;if(n(l)===!0)return l;let t=e?l.return:l.child;for(;t;){const a=traverseFiber(t,e,n);if(a)return a;t=e?null:t.sibling}}function wrapContext(l){try{return Object.defineProperties(l,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return l}}const FiberContext=wrapContext(React__namespace.createContext(null));class FiberProvider extends React__namespace.Component{render(){return React__namespace.createElement(FiberContext.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner,ReactCurrentDispatcher}=React__namespace.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function useFiber(){const l=React__namespace.useContext(FiberContext);if(l===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=React__namespace.useId();return React__namespace.useMemo(()=>{for(const t of[ReactCurrentOwner==null?void 0:ReactCurrentOwner.current,l,l==null?void 0:l.alternate]){if(!t)continue;const a=traverseFiber(t,!1,o=>{let d=o.memoizedState;for(;d;){if(d.memoizedState===e)return!0;d=d.next}});if(a)return a}},[l,e])}function useContextMap(){var l,e;const n=useFiber(),[t]=React__namespace.useState(()=>new Map);t.clear();let a=n;for(;a;){const o=(l=a.type)==null?void 0:l._context;o&&o!==FiberContext&&!t.has(o)&&t.set(o,(e=ReactCurrentDispatcher==null?void 0:ReactCurrentDispatcher.current)==null?void 0:e.readContext(wrapContext(o))),a=a.return}return t}function useContextBridge(){const l=useContextMap();return React__namespace.useMemo(()=>Array.from(l.keys()).reduce((e,n)=>t=>React__namespace.createElement(e,null,React__namespace.createElement(n.Provider,__spreadProps(__spreadValues({},t),{value:l.get(n)}))),e=>React__namespace.createElement(FiberProvider,__spreadValues({},e))),[l])}function usePrevious(l){const e=React$2.useRef({});return React$2.useLayoutEffect(()=>{e.current=l}),React$2.useLayoutEffect(()=>()=>{e.current={}},[]),e.current}const StageWrap=l=>{const e=React$2.useRef(),n=React$2.useRef(),t=React$2.useRef(),a=usePrevious(l),o=useContextBridge(),d=h=>{const{forwardedRef:f}=l;f&&(typeof f=="function"?f(h):f.current=h)};return React$2.useLayoutEffect(()=>(n.current=new Konva.Stage({width:l.width,height:l.height,container:e.current}),d(n.current),t.current=KonvaRenderer.createContainer(n.current,constantsExports.LegacyRoot,!1,null),KonvaRenderer.updateContainer(React$2.createElement(o,{},l.children),t.current),()=>{Konva.isBrowser&&(d(null),KonvaRenderer.updateContainer(null,t.current,null),n.current.destroy())}),[]),React$2.useLayoutEffect(()=>{d(n.current),applyNodeProps(n.current,l,a),KonvaRenderer.updateContainer(React$2.createElement(o,{},l.children),t.current,null)}),React$2.createElement("div",{ref:e,id:l.id,accessKey:l.accessKey,className:l.className,role:l.role,style:l.style,tabIndex:l.tabIndex,title:l.title})},Layer="Layer",Group="Group",Rect="Rect",Line="Line",Image$2="Image",Text="Text",KonvaRenderer=ReactFiberReconciler(HostConfig);KonvaRenderer.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:process.env.NODE_ENV!=="production"?1:0,version:React$2.version,rendererPackageName:"react-konva"});const Stage=React$2.forwardRef((l,e)=>React$2.createElement(FiberProvider,{},React$2.createElement(StageWrap,{...l,forwardedRef:e})));var client={},m=require$$0;if(process.env.NODE_ENV==="production")client.createRoot=m.createRoot,client.hydrateRoot=m.hydrateRoot;else{var i=m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;client.createRoot=function(l,e){i.usingClientEntryPoint=!0;try{return m.createRoot(l,e)}finally{i.usingClientEntryPoint=!1}},client.hydrateRoot=function(l,e,n){i.usingClientEntryPoint=!0;try{return m.hydrateRoot(l,e,n)}finally{i.usingClientEntryPoint=!1}}}var __rest=function(l,e){var n={};for(var t in l)Object.prototype.hasOwnProperty.call(l,t)&&e.indexOf(t)<0&&(n[t]=l[t]);if(l!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,t=Object.getOwnPropertySymbols(l);a<t.length;a++)e.indexOf(t[a])<0&&Object.prototype.propertyIsEnumerable.call(l,t[a])&&(n[t[a]]=l[t[a]]);return n};const needForceStyle=l=>{const e=window.getComputedStyle(l).position;return!(e==="absolute"||e==="relative")};function useEvent(l=()=>{}){const e=React$2.useRef(l);return e.current=l,React$2.useCallback((...n)=>e.current.apply(null,n),[])}const Html=({children:l,groupProps:e,divProps:n,transform:t,transformFunc:a})=>{const o=React$2.useRef(null);React$2.useRef();const[d]=React$2.useState(()=>document.createElement("div")),h=React$2.useMemo(()=>client.createRoot(d),[d]),f=t??!0,u=useEvent(()=>{if(f&&o.current){let E=o.current.getAbsoluteTransform().decompose();a&&(E=a(E)),d.style.position="absolute",d.style.zIndex="10",d.style.top="0px",d.style.left="0px",d.style.transform=`translate(${E.x}px, ${E.y}px) rotate(${E.rotation}deg) scaleX(${E.scaleX}) scaleY(${E.scaleY})`,d.style.transformOrigin="top left"}else d.style.position="",d.style.zIndex="",d.style.top="",d.style.left="",d.style.transform="",d.style.transformOrigin="";const p=n||{},{style:x}=p,R=__rest(p,["style"]);Object.assign(d.style,x),Object.assign(d,R)});return React$2.useLayoutEffect(()=>{var p;const x=o.current;if(!x)return;const R=(p=x.getStage())===null||p===void 0?void 0:p.container();if(R)return R.appendChild(d),f&&needForceStyle(R)&&(R.style.position="relative"),x.on("absoluteTransformChange",u),u(),()=>{var S;x.off("absoluteTransformChange",u),(S=d.parentNode)===null||S===void 0||S.removeChild(d)}},[f]),React$2.useLayoutEffect(()=>{u()},[n,a]),React$2.useLayoutEffect(()=>{h.render(l)}),React$2.useLayoutEffect(()=>()=>{setTimeout(()=>{h.unmount()})},[]),React$2.createElement(Group,Object.assign({ref:o},e))};function Area({area:l,finished:e,isClicked:n,isBad:t,hasHighlights:a,completed:o,onClick:d,onClickOutside:h}){const f=React$2.useRef(),[u,p]=React$2.useState(),x=t?"rgba(255, 99, 77, 0.32)":"rgba(75, 215, 169, 0.32)",R=t?"#ff634d":"#4bd7a9",S=DeviceDetection(),E=()=>{var _,w,C;a&&!o&&!n&&((_=f.current)==null||_.setAttr("fill","rgba(130, 134, 142, 0.4)"),(w=f.current)==null||w.setAttr("stroke","rgba(255, 255, 255, 0.3)"),(C=f.current)==null||C.to({duration:.25,opacity:1}))},g=()=>{var _;a&&!o&&!n&&((_=f.current)==null||_.to({duration:.25,opacity:0}))};React$2.useEffect(()=>{var _,w,C;o&&!e&&(t?(C=f.current)==null||C.to({duration:.25,opacity:0}):((_=f.current)==null||_.to({duration:.25,opacity:1}),(w=f.current)==null||w.globalCompositeOperation("destination-out")))},[o,e,t]);const v=()=>{var _,w;o||(t?h(l):d(l),(_=f.current)==null||_.setAttr("fill",x),(w=f.current)==null||w.setAttr("stroke",R))},T=l.scaleX?l.scaleX:1,b=l.scaleY?l.scaleY:1;return React$2.useLayoutEffect(()=>{const _=f.current.getStage();_.on("stage-loaded",()=>{const w=f.current.getClientRect({relativeTo:f.current.getParent()});p({x:w.x+w.width/2,y:w.y+w.height/2}),_.batchDraw()})},[l]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[u?jsxRuntimeExports.jsx(Html,{transform:!0,groupProps:{id:"projection",...u},divProps:{style:{pointerEvents:"none"}},children:jsxRuntimeExports.jsx("div",{style:{width:"50px",height:"50px",pointerEvents:"none"},id:l.id})}):null,jsxRuntimeExports.jsx(Line,{name:l.id,ref:f,onFocus:()=>E(),onMouseOver:()=>E(),onMouseLeave:g,onClick:()=>v(),onTap:()=>v(),x:l.x,y:l.y,scale:{x:T,y:b},skew:{x:l.skewX,y:l.skewY},rotation:l.rotation,points:l.points,shape:"poly",fill:e?"":x,stroke:e||n?R:"",strokeWidth:S?10:4,opacity:e||n?1:0,closed:!0})]})}Area.defaultProps={finished:!1,isBad:!1,isClicked:!1,hasHighlights:!1,completed:!1,onClick:()=>{},onClickOutside:()=>{}};const useWindowSize=()=>{const[l,e]=React$2.useState([0,0]);return React$2.useLayoutEffect(()=>{function n(){e([window.innerWidth,window.innerHeight])}return window.addEventListener("resize",n),n(),()=>window.removeEventListener("resize",n)},[]),l};function KonvaMapper({areas:l,badAreas:e,imageUrl:n,completed:t,onClick:a,onClickOutside:o,hasHighlights:d,clickedZones:h}){const f=React$2.useRef(),u=React$2.useRef(),p=React$2.useRef(),x=React$2.useRef(),R=React$2.useRef(),S=React$2.useRef(),E=React$2.useRef(),[g,v]=React$2.useState(new window.Image),[T,b]=useWindowSize(),_=e.find(P=>P.id==="AllArea")||!1,w=e.filter(P=>P.id!=="AllArea");React$2.useEffect(()=>{E.current&&u.current&&t&&(E.current.to({duration:.25,opacity:.5}),u.current.setAttr("visible",!0))},[t]);const C=P=>{_&&!P.target.attrs.shape&&o(_)};return React$2.useEffect(()=>{g.src=n,g.addEventListener("load",()=>{if(f.current){const P={x:T/2,y:b/2,width:g.width,height:g.height,offsetX:g.width/2,offsetY:g.height/2,scale:{x:Math.min(T/g.width,b/g.height),y:Math.min(T/g.width,b/g.height)}};x.current&&x.current.setAttrs(P),R.current&&R.current.setAttrs(P),u.current&&u.current.setAttrs(P),p.current&&p.current.setAttrs(P),S.current&&S.current.setAttrs(P),f.current.batchDraw(),v(g),f.current.fire("stage-loaded")}})},[g,b,n,T]),jsxRuntimeExports.jsxs(Stage,{ref:f,width:T,height:b,onClick:C,onTouchEnd:C,children:[jsxRuntimeExports.jsx(Layer,{children:jsxRuntimeExports.jsx(Image$2,{ref:S,image:g})}),jsxRuntimeExports.jsxs(Layer,{children:[jsxRuntimeExports.jsx(Rect,{ref:E,width:T,height:b,fill:"black",opacity:0}),jsxRuntimeExports.jsx(Group,{ref:R,children:w.map((P,D)=>jsxRuntimeExports.jsx(Area,{hasHighlights:d,completed:t,onClick:a,onClickOutside:o,area:P,isBad:!0},P.name+"_"+D))}),jsxRuntimeExports.jsx(Group,{ref:x,children:l.map((P,D)=>jsxRuntimeExports.jsx(Area,{hasHighlights:d,completed:t,onClick:a,onClickOutside:o,area:P,isClicked:h.some(N=>N.index===P.index)},P.name+"_"+D))}),jsxRuntimeExports.jsx(Group,{ref:p,visible:!1,children:w.map((P,D)=>jsxRuntimeExports.jsx(Area,{hasHighlights:d,completed:t,onClick:a,onClickOutside:o,area:P,isBad:!0,finished:!0},P.name+"_"+D))}),jsxRuntimeExports.jsx(Group,{ref:u,visible:!1,children:l.map((P,D)=>jsxRuntimeExports.jsx(Area,{hasHighlights:d,completed:t,onClick:a,onClickOutside:o,area:P,finished:!0},P.name+"_"+D))})]})]})}KonvaMapper.defaultProps={hasHighlights:!1,onClick:()=>{},completed:!1,onClickOutside:()=>{}};function TimerDialog({retry:l,translate:e,onInit:n}){return jsxRuntimeExports.jsx("div",{className:"timer-dialog",children:jsxRuntimeExports.jsxs("div",{className:"timer-dialog__container",children:[jsxRuntimeExports.jsx("div",{className:"timer-dialog__title",children:e("storylines.misc.ready")}),jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn gat--btn__primary",onClick:n,children:jsxRuntimeExports.jsx("span",{children:e(l?"storylines.misc.start":"storylines.misc.retry")})})]})})}function CountDown({time:l}){const e=Math.floor(l/60),n=l%60;return jsxRuntimeExports.jsx("div",{className:`count-down count-down--in-puzzle-frame ${l<10?"count-down--finalseconds":""}`,children:jsxRuntimeExports.jsxs("div",{children:[e<10?`0${e}`:e," : ",n<10?`0${Math.floor(n)}`:Math.floor(n)]})})}const defaultImg="https://min.gamelearn.io/css-resources/gamelearn/resources/puzzle-login-low.png";function ImageReview(){return jsxRuntimeExports.jsx("div",{className:"puzzle--image__preview",children:jsxRuntimeExports.jsx("img",{alt:"img",src:"https://min.gamelearn.io/css-resources/gamelearn/resources/image-click.jpg"})})}function ImageClickWrapperComponent(l){var Xe,Ye;const{soundActions:e,emitEvent:n,handleClick:t,disableExit:a,setResolveAction:o,info:d,image:h,areas:f,badAreas:u,hasClickOrder:p,timer:x,hasClickOnce:R,hasHighlights:S,hasImageReview:E,defaultCompleted:g,className:v,emitFinish:T,emitResolve:b,translateFromParent:_,specificFeedbacks:w,slideNumber:C,emitResetPuzzle:P,firstTryForFrame:D,puzzlesAutoCompleted:N,emitOpenPopupCounterInfo:k,pause:F,keyboardControl:M}=l,[U,$]=React$2.useState([]),[B,J]=React$2.useState(!1),[ne,ie]=React$2.useState(!1),[Y,q]=React$2.useState({show:!1,success:!1,text:"",rewards:[]}),re=React$2.useRef(!1),[ce,fe]=React$2.useState(!0),[te,H]=React$2.useState(!1),W=React$2.useRef(null),V=React$2.useRef(null),z=React$2.useRef(null),Q=React$2.useRef(null),ee=React$2.useRef(null),le=React$2.useRef(null),ue=React$2.useRef(null),he=React$2.useRef(null),ve=React$2.useRef(null),[be,Re]=React$2.useState(x),Le=Pe=>_?_(Pe):n({type:"translate",payload:Pe}),[Oe]=e,{solution:Ke}=d,St=h.img.url||defaultImg,it=f.map((Pe,Ae)=>({index:Ae,shape:"poly",...Pe})),gt=u.map((Pe,Ae)=>({index:Ae,shape:"poly",...Pe})),Ge=React$2.useCallback(()=>{if(!ce){const Pe=setInterval(()=>{Re(Ae=>Ae>1?Ae-1:0)},1e3);ve.current=Pe}},[ce]),Me=React$2.useCallback((Pe,Ae)=>{T?T(Pe,Ae):n({type:"addPoints",payload:Pe})},[n,T]);React$2.useEffect(()=>{B&&a(!0)},[B,a]),React$2.useEffect(()=>{J(g)},[g]);const De=React$2.useCallback(()=>{clearInterval(z.current)},[]),Ve=React$2.useCallback(()=>{clearInterval(ve.current)},[]),ct=React$2.useCallback(Pe=>{ee.current=Date.now(),Q.current?(ue.current=Q.current-ee.current,De()):(ue.current=ee.current-(ee.current-Pe*1e3),De())},[De]),dt=React$2.useCallback(()=>{q(()=>{var Pe,Ae;return{show:!0,success:!1,text:(Pe=d==null?void 0:d.timerFeedback)!=null&&Pe.desc?d.timerFeedback.desc:"",rewards:(Ae=d==null?void 0:d.timerFeedback)==null?void 0:Ae.rewards}}),H(!0),Ve(),De()},[Ve,De,(Xe=d.timerFeedback)==null?void 0:Xe.desc,(Ye=d.timerFeedback)==null?void 0:Ye.rewards]),rt=React$2.useCallback(()=>{clearInterval(z.current),z.current=setInterval(()=>{V.current=Date.now(),V.current>Q.current&&dt()},250)},[dt]);React$2.useEffect(()=>{var Pe;if((f.length===U.length||R&&U.length>0)&&!B){J(!0);const Ae=U[U.length-1],_e=w==null?void 0:w.correctFeedbacks.find(Ie=>Ie.id===Ae.id);(!((Pe=w==null?void 0:w.correctFeedbacks)!=null&&Pe.length)||w!=null&&w.correctFeedbacks.some(Ie=>!Ie.desc)||R)&&(q(Ie=>({...Ie,show:!0,success:!0,text:_e?_e.desc:d.solution.right.desc,rewards:_e?_e.rewards:d.solution.right.rewards})),x&&(Ve(),ct()))}},[U,f.length,w,R,B,d.solution.right,ct,x,Ve]),React$2.useEffect(()=>{o(Pe=>{x&&(Ve(),fe(!1),Y.show?q(Ae=>({...Ae,show:!1,success:!1,text:"",rewards:[]})):De()),J(!0),ie(!0),setTimeout(()=>{b?b(Pe):Pe()},4e3)})},[o,b,Oe,x,Y.show,De,Ve]),React$2.useEffect(()=>{ne&&a(!0)},[ne,a]);const xt=(Pe,Ae=!1)=>{var _e,Ie;if(!B){const{rewards:tt,desc:Gt}=Ke.wrong;let Dt=Gt,ke=tt;const mt=(_e=w==null?void 0:w.wrongFeedbacks)==null?void 0:_e.find(Pt=>Pt.id===Pe.id);mt&&(Dt=mt.desc,ke=mt.rewards),p&&($([]),Ae&&(Ie=d==null?void 0:d.orderFeedback)!=null&&Ie.desc&&(Dt=d.orderFeedback.desc,ke=d.orderFeedback.rewards)),x&&(Ve(),ct()),q(Pt=>({...Pt,show:!0,success:!1,text:Dt,rewards:ke})),Oe("fail")}},Et=React$2.useCallback(()=>{le.current=Date.now();const Pe=le.current+ue.current;V.current=null,Q.current=Pe,(x||te)&&(Y.success?f.length===U.length||R&&U.length>0?Ve():(Re(ue.current*.001),Ge(),rt()):($([]),fe(!0),P())),Me(Y.rewards,Y.success),Oe("click-ui"),q(Ae=>({...Ae,show:!1,success:!1,text:"",rewards:[]}))},[x,te,Me,Y.rewards,Y.success,Oe,f.length,U.length,R,P,Ve,Ge,rt]),Qe=Pe=>{var Ae,_e;if(!U.some(Ie=>Ie.index===Pe.index)&&!Y.show&&!B){Oe("click-ui");let Ie=Ke.right.desc,{rewards:tt}=Ke.right;const Gt=[...U,Pe];if(p&&Pe.index===U.length||!p){if(x&&ct(be),t(),(Ae=w==null?void 0:w.correctFeedbacks)!=null&&Ae.length){const Dt=(_e=w.correctFeedbacks)==null?void 0:_e.find(ke=>ke.id===Pe.id);Dt&&(Ie=Dt.desc,tt=Dt.rewards),!Ie&&f.length>Gt.length&&!R?Me(tt,!0):Ie&&!R&&(q(ke=>({...ke,show:!0,success:!0,text:Ie,rewards:tt})),x&&Ve())}$(Gt)}else xt(Pe,!0)}},Be=React$2.useCallback(()=>{Ve(),Re(x),Ge(),!re.current&&D&&k(),fe(!1),W.current=Date.now(),Q.current=W.current+x*1e3,rt()},[Ve,x,Ge,D,rt,k]);return React$2.useEffect(()=>{x&&C>0&&!he.current&&(D&&Object.keys(N).length&&N[C-1]?(fe(!0),he.current=!0):fe(!1))},[g,D,N,C,x]),React$2.useEffect(()=>{x&&be===0&&dt()},[be,dt,x]),React$2.useEffect(()=>{x&&(F?(Ve(),ct()):Ge())},[Ve,rt,F,ct,Ge,x]),jsxRuntimeExports.jsxs("div",{className:v,children:[Y.show?jsxRuntimeExports.jsx(FeedbackComponent$1,{playSound:Oe,text:Y.text,success:Y.success,translate:Le,hasTimeout:!Y.text,delay:x?1e3:2e3,functionOnClose:Et,timeExpired:te,keyboardControl:M}):null,jsxRuntimeExports.jsx(KonvaMapper,{completed:B,imageUrl:St,areas:R&&U.length?[U[0]]:it,badAreas:gt,clickedZones:U,onClick:Qe,onClickOutside:xt,hasHighlights:S,emitEvent:n}),E?jsxRuntimeExports.jsx(ImageReview,{}):null,x&&ce?jsxRuntimeExports.jsx(TimerDialog,{retry:D||N[C-1],translate:Le,onInit:Be}):null,x?jsxRuntimeExports.jsx(CountDown,{time:be}):null]})}ImageClickWrapperComponent.defaultProps={info:{instructions:"",resolve:{},solution:{},hint:{},title:""},badAreas:[],className:"puzzle--image__click",hasClickOrder:!1,hasClickOnce:!1,hasHighlights:!1,hasImageReview:!1,defaultCompleted:!1,hideContinue:!1,emitAreaClick:()=>{},handleClick:()=>{}};function ImageClickPuzzleComponent(l){const e=(n,t)=>{t?(l.emitEvent({type:"addPoints",complex:!0,finish:!0,payload:n}),l.emitEvent({type:"passPuzzle"})):(l.emitEvent({type:"addPoints",payload:n,finish:!1}),l.emitEvent({type:"failPuzzle"}))};return jsxRuntimeExports.jsx(ImageClickWrapperComponent,{...l,emitFinish:e,name:"image-click-puzzle"})}const GREEN="#44d7ab",ORANGE="#FFB34B",RED="#FF634D",getDistance=(l,e)=>Math.max(Math.abs(l[0]-e[0]),Math.abs(l[1]-e[1])),generatePasswordPositions=(l,e,n,t)=>{const a=[],o=l;for(const d of e.toLowerCase()){const h=Math.floor(Math.random()*n),f=Math.floor(Math.random()*t);o[h][f].value=d,a.push({char:d,position:[h,f]})}return[o,a]},paintedGridPassword=(l,e,n,t)=>{const a=l;for(let o=0;o<e;o+=1)for(let d=0;d<n;d+=1)switch(t.reduce((f,u)=>{const p=[o,d],x=getDistance(u.position,p);return x<f?x:f},9999)){case 0:a[o][d].hiddenColor=GREEN;break;case 1:a[o][d].hiddenColor=ORANGE;break;case 2:a[o][d].hiddenColor=RED;break}return a},resetColors=(l,e,n)=>{const t=n;for(let a=0;a<l;a+=1)for(let o=0;o<e;o+=1)t[a][o].color="",t[a][o].hiddenColor=RED;return t},repaintGridPassword=(l,e,n,t)=>{const a=resetColors(n,t,l),[o,d]=generatePasswordPositions(a,e,n,t);return paintedGridPassword(o,n,t,d)},prepareAcceptedChars=(l,e)=>e.split("").filter(n=>!l.includes(n)).join(""),generateBasicGrid=(l,e,n)=>{const t=[];for(let a=0;a<l;a+=1){const o=[];for(let d=0;d<e;d+=1){const h={color:"",hiddenColor:RED,value:n[Math.floor(Math.random()*n.length)]};o.push(h)}t.push(o)}return t},makeSomeNoise=({numberOfColumns:l,numberOfRows:e,password:n})=>{const t=LangIsRtl()?"٠١٢٣٤٥٦٧٨٩شزذيثبلاهتنمورخحضقسفعدصطغظ":"0123456789abcdefghijklmnopqrstuvwxyz",a=prepareAcceptedChars(n,t),o=generateBasicGrid(e,l,a),[d,h]=generatePasswordPositions(o,n,e,l);return paintedGridPassword(d,e,l,h)};function DrawItem({item:l,rowIndex:e,columnIndex:n,setCursorPosition:t,cursorPosition:a}){const o=Math.abs(e-a[0])<3&&Math.abs(n-a[1])<3;return jsxRuntimeExports.jsx("span",{className:"puzzle--cracker__item",style:{backgroundColor:`${o?l.hiddenColor:l.color}`,flexGrow:1,textAlign:"center"},onMouseOver:()=>{t([e,n])},onFocus:()=>{t([e,n])},children:l.value})}DrawItem.defaultProps={setCursorPosition:()=>{}};DrawItem.propTypes={item:PropTypes.shape({color:PropTypes.string,hiddenColor:PropTypes.string,value:PropTypes.string}).isRequired,rowIndex:PropTypes.number.isRequired,columnIndex:PropTypes.number.isRequired,cursorPosition:PropTypes.arrayOf(PropTypes.number).isRequired,setCursorPosition:PropTypes.func};function DrawRow({row:l,rowIndex:e,setCursorPosition:n,cursorPosition:t}){return l.length?jsxRuntimeExports.jsx("div",{className:"puzzle--cracker",children:l.map((a,o)=>jsxRuntimeExports.jsx(DrawItem,{item:a,rowIndex:e,columnIndex:o,setCursorPosition:n,cursorPosition:t},o))}):null}DrawRow.defaultProps={row:[]};DrawRow.propTypes={row:PropTypes.arrayOf(PropTypes.shape({})),rowIndex:PropTypes.number.isRequired,setCursorPosition:PropTypes.func.isRequired,cursorPosition:PropTypes.arrayOf(PropTypes.number).isRequired};function DrawGrid({grid:l,cursorPosition:e,setCursorPosition:n}){return jsxRuntimeExports.jsx("div",{className:"puzzle--cracker__canvas",children:l.map((t,a)=>jsxRuntimeExports.jsx(DrawRow,{row:t,rowIndex:a,cursorPosition:e,setCursorPosition:n},a))})}DrawGrid.defaultProps={setCursorPosition:()=>{}};const VELOCITY_MAP={slow:2,fast:5,fastest:10},DIFFICULTY_MAP={easy:{visibleRows:"auto",visibleColumns:40,totalRows:25},medium:{visibleRows:"auto",visibleColumns:40,totalRows:40},hard:{visibleRows:"auto",visibleColumns:40,totalRows:80}};function CrackerPuzzleComponent({emitEvent:l,soundActions:e,info:n,velocity:t,password:a,disableExit:o,difficulty:d,setResolveAction:h}){const[f]=e,u=fe=>l({type:"translate",payload:fe}),p=React$2.useRef(),x=React$2.useRef(),{solution:R}=n,[S,E]=React$2.useState(a.toLowerCase()),[g,v]=React$2.useState(),[T,b]=React$2.useState(Array(a.toLowerCase().length).fill("")),[_,w]=React$2.useState(!1),[C,P]=React$2.useState([0,0]),D=u("puzzle.cracker.crackedPassword"),N=n.solution.right.desc&&n.solution.right.desc!==""?n.solution.right.desc:"",k=u("puzzle.cracker.congratulations"),[F,M]=React$2.useState([[]]),{visibleRows:U,visibleColumns:$}=DIFFICULTY_MAP[d];let B=U==="auto"?Math.ceil(window.innerHeight*.025):U;B=B>=20?B:20,React$2.useEffect(()=>{_&&o(!0)},[_,o]),React$2.useEffect(()=>{h(fe=>{f("score"),w(!0),setTimeout(()=>{l({type:"hidePuzzleButtons",payload:!1}),fe()},0)})},[h,f]);const J=()=>{f("click-ui");const{rewards:fe}=R.right;l({type:"addPoints",complex:!0,finish:!0,payload:fe}),l({type:"passPuzzle"})},ne=()=>a.toLowerCase().split("").map((te,H)=>({char:te,index:H,used:!1})),ie=fe=>fe.filter(te=>te.used===!1).map(te=>te.char).join(""),Y=fe=>{if(fe[0].length>0&&!_){const te=[...fe];return te.push(te.shift()),te}return fe};let q=0;const re=fe=>{if(x.current!==void 0){const te=fe-x.current;q+=te,q>1e3/VELOCITY_MAP[t]&&(M(Y),q=0)}x.current=fe,p.current=requestAnimationFrame(re)};React$2.useEffect(()=>{E(a.toLowerCase());const fe=makeSomeNoise({numberOfColumns:$,numberOfRows:B,password:a.toLowerCase()});return M(fe),v(ne()),p.current=requestAnimationFrame(re),()=>cancelAnimationFrame(p.current)},[]);const ce=()=>{if(F.length<=1)return;const[fe,te]=C,H=F[fe][te];if(H.hiddenColor===GREEN){const W=g.filter(V=>V.char===H.value.toLowerCase()&&V.used===!1)[0];if(W){const{index:V}=W;f("score");const z=g;z[V].used=!0,v(z);const Q=[...T];Q[V]=H.value;const ee=ie(z);E(ee);const le=repaintGridPassword(F,ee,B,$);M(le),b(Q)}}S<=0&&(f("score"),w(!0))};return React$2.useEffect(()=>{_||ce()},[C]),jsxRuntimeExports.jsxs("div",{className:"puzzle--cracker__container",children:[jsxRuntimeExports.jsxs("div",{className:"puzzle--cracker__header",children:[jsxRuntimeExports.jsx("span",{className:"title",children:"Dcoder.exe"}),jsxRuntimeExports.jsx("div",{className:"puzzle--pieces",children:T.map((fe,te)=>jsxRuntimeExports.jsx("span",{className:"puzzle--pieces__item",children:fe&&jsxRuntimeExports.jsx("span",{className:"character success-transition-animation","data-testid":`solution${te}`,children:fe})},`${fe+te}`))})]}),jsxRuntimeExports.jsx(DrawGrid,{grid:_?[[]]:F,cursorPosition:C,setCursorPosition:P}),_&&D&&k&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(Typist,{avgTypingDelay:110,cursor:{hideWhenDone:!0},className:"puzzle--cracker__result",children:[jsxRuntimeExports.jsx(Typist.Delay,{ms:300}),jsxRuntimeExports.jsxs("span",{children:[`${D} ${a.toLowerCase()}`," "]}),jsxRuntimeExports.jsxs("span",{children:[k," "]}),N!==""&&jsxRuntimeExports.jsx("span",{children:N})]}),jsxRuntimeExports.jsx("div",{className:"position--absolute bottom center",children:jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn gat--btn__primary gat--btn__cracker",onClick:J,children:u("screens.continue")})})]})]})}CrackerPuzzleComponent.defaultProps={velocity:"slow",difficulty:"easy",context:{},info:{}};const ARABIC=/[\u0600-\u06FF]/,restrictCharacters=(l,e)=>{let n=!1;return e==="or"&&(n=l===""||l===" "||l===","||l==="."||l==="/"),e==="and"&&(n=l&&l!==" "&&l!==","&&l!=="."&&l!==""&&l!=="/"),n},sortChar=(l,e)=>l.char>e.char?1:l.char<e.char?-1:0,analyzeChars=l=>{const e={anyArabic:!1,anyNumber:!1,anyWestern:!1};for(let n=0;n<l.length;n+=1){const t=l[n].charCodeAt(0);t>=65&&t<=90?e.anyWestern=!0:t>=48&&t<=57?e.anyNumber=!0:ARABIC.test(l[n])&&(e.anyArabic=!0)}return e},makeChar=l=>{const e="شزذيثبلاهتنمورخحضثقسفعدصطغظ",n="ABCDEFGHIJKLMNOPQRSTUVWXYZ",t="0123456789";let a="";return l.anyWestern&&(a+=n),l.anyNumber&&(a+=t),l.anyArabic&&(a+=e),a.charAt(Math.floor(Math.random()*a.length))},MAX_POOL_LETTERS=26,MAX_EXTRA_LETTERS=8,AnswerPanel=({answer:l,flickerPosition:e,show:n=!1,showCorrectSolution:t})=>{const a=[];let o=0;return l.forEach(d=>{a[o]||(a[o]=[]),a[o]=[...a[o],d],d.char===" "&&(o+=1),t||(d.positionInitial=d.index)}),a.map((d,h)=>jsxRuntimeExports.jsx("div",{dir:"auto",className:"puzzle--hanged__word","data-testid":`result-${h}`,children:n?d.map((f,u)=>jsxRuntimeExports.jsx("span",{className:"puzzle--hanged__letter active",children:f},`${f+u}`)):d.filter(({char:f})=>f!==" ").map(({char:f,fixed:u},p)=>jsxRuntimeExports.jsx("span",{className:`puzzle--hanged__letter ${u?"":"active"} ${d[p].positionInitial===e?"fakeFocus":""}`,children:f},`${f+p}`))},`${d+h}`))},defaultImage="https://min.gamelearn.io/css-resources/gamelearn/resources/partenon.jpg";function HangedPuzzleComponent({soundActions:l,emitEvent:e,disableExit:n,question:t,image:a,info:o,answer:d,hintUsed:h,setResolveAction:f,setHintAction:u,keyboardControl:p}){var le;const[x]=l,R=((le=a.img)==null?void 0:le.url)||defaultImage,[S,E]=React$2.useState(0),[g,v]=React$2.useState(!1),[T,b]=React$2.useState([]),[_,w]=React$2.useState(!1),[C,P]=React$2.useState([]),[D,N]=React$2.useState(""),[k,F]=React$2.useState(!1),[M,U]=React$2.useState([]),[$,B]=React$2.useState(!1),J=d.toUpperCase().split(""),ne=J.filter(ue=>restrictCharacters(ue,"and")),ie=ue=>e({type:"translate",payload:ue}),Y=React$2.useCallback(()=>{const ue=ne.map(be=>({char:be}));let he=[];const ve=analyzeChars(ne);for(;he.length<MAX_EXTRA_LETTERS;){const be=makeChar(ve);he=[...he,{char:be}]}return[...ue,...he]},[ne]),q=d.toUpperCase().split("").map((ue,he)=>restrictCharacters(ue,"or")?{index:he,letter:ue,char:ue,fixed:!0}:{index:he,letter:ue,char:""}),re=React$2.useCallback(()=>{let ue=Y();for(;ue.length>MAX_POOL_LETTERS;){const he=Math.trunc(Math.random()*(ue.length-1))+1,ve=ue[he],be=q.find((Re,Le)=>ve.char===Re.letter&&!q[Le].fixed);be&&(ue.splice(he,1),q[be.index]={...be,char:be.letter,fixed:!0})}h&&(ue=[],q.forEach(({letter:he})=>{he!==" "&&ue.push({char:he})})),P(q),b(ue)},[q,h,Y]),ce=(ue,he)=>T.map((be,Re)=>Re===he?{...be,deleted:!0}:{...be}),fe=(ue,he,ve)=>{const be=he.map((Le,Oe)=>ve.find(St=>St.poolIndex===Oe)?{char:Le.char}:Le);b(be),P(ue);const Re=ue.find(Le=>Le.char==="");E(Re.index)},te=(ue,he)=>{x("click-ui");let ve=!1;const be=C.map(Oe=>!Oe.char&&!ve?(ve=!0,{...Oe,char:ue,poolIndex:he}):Oe),Re=ce(ue,he),Le=be.filter(Oe=>Oe.char).length;b(Re),P(be),H(),Le===C.length&&Q(be,Re)},H=()=>{var ue;if(g){const he=C.find(ve=>ve.index!==S&&ve.letter!==" "&&ve.char===""&&ve.poolIndex===!1);he&&E(he.index)}else{const he=C.find(ve=>ve.char==="");E(he.index+1),((ue=C[he.index+1])==null?void 0:ue.letter)===" "&&E(he.index+2)}},W=()=>{x("click-ui");const ue=C.map((he,ve)=>C[C.length-1-ve]).find(he=>he.char&&!he.fixed);if(ue){const he=C.map(Re=>Re.index===ue.index?{...ue,char:""}:Re);let ve=!1;const be=T.map((Re,Le)=>Le===ue.poolIndex&&(Re.deleted||!ve)?(ve=!0,{char:Re.char}):Re);b(be),P(he),E(ue.index)}},V=()=>{n(!0),N("");const ue=[...M,...o.solution.right.rewards];x("score"),e({type:"hidePuzzleButtons",payload:!1}),e({type:"addPoints",complex:!0,finish:!0,payload:ue}),e({type:"passPuzzle"})},z=()=>{x("fail"),e({type:"hidePuzzleButtons",payload:!1}),U([...M,...o.solution.wrong.rewards]),N(""),F(!1),e({type:"failPuzzle"}),v(!0)},Q=(ue,he)=>{let ve=[];F(!0);const be=ue.map((Le,Oe)=>J[Oe]===Le.char?{...Le,fixed:!0}:(ve=[...ve,Le],{...Le,poolIndex:!1,char:""})),Re=be.filter(Le=>Le.fixed).length;e({type:"hidePuzzleButtons",payload:!0}),Re===J.length?(N("success"),o.solution.right.desc===""&&setTimeout(()=>{V()},2e3)):(N("failed"),fe(be,he,ve),o.solution.wrong.desc===""&&setTimeout(()=>{z()},2e3))},ee=()=>{if(D==="success")V();else{z();const ue=C.find(he=>he.char==="");E(ue.index)}};return React$2.useEffect(()=>{_||(w(!0),re()),f(ue=>{B(!0),setTimeout(()=>{e({type:"hidePuzzleButtons",payload:!1}),ue()},2e3)}),u(ue=>{const he=[];q.forEach(({letter:ve})=>{ve!==" "&&he.push({char:ve})}),b(he),ue()})},[re,_,d,f,e,M,o.resolve.rewards,q,u]),jsxRuntimeExports.jsxs("div",{className:"puzzle--hanged",style:{backgroundImage:`url("${R}")`},children:[D?jsxRuntimeExports.jsx(FeedbackComponent$1,{playSound:x,text:o.solution[D==="success"?"right":"wrong"].desc,success:D==="success",translate:ie,functionOnClose:ee,keyboardControl:p}):null,jsxRuntimeExports.jsx("div",{className:"puzzle--hanged__content",children:jsxRuntimeExports.jsxs("div",{className:"puzzle--hanged__controls",children:[jsxRuntimeExports.jsx("div",{dir:"auto",className:"puzzle--hanged__header",children:t}),jsxRuntimeExports.jsx("div",{dir:"auto",className:`puzzle--hanged__solution ${D}`,"data-testid":`${D}`,children:$?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(AnswerPanel,{showCorrectSolution:$,answer:d.split(""),show:!0})}):jsxRuntimeExports.jsx(AnswerPanel,{showCorrectSolution:$,flickerPosition:S,answer:C})}),jsxRuntimeExports.jsxs("div",{className:"puzzle--hanged__keyboard",children:[T.sort((ue,he)=>sortChar(ue,he)).map((ue,he)=>jsxRuntimeExports.jsx("button",{"data-testid":`key-${ue.char}`,type:"button",onClick:()=>{!ue.deleted&&!D&&!k&&(te(ue.char,he),x("click-ui"))},className:`puzzle--hanged__keyboard--item ${ue.deleted||k?"disabled":""}`,children:ue.char},`${ue+he}`)),jsxRuntimeExports.jsx("button",{onClick:k?null:()=>W(),type:"button",disabled:k?"disabled":null,"aria-label":ie("puzzles.hanged-puzzle.deleteButton"),className:`puzzle--hanged__keyboard--item delete ${k?"disabled":""}`,children:jsxRuntimeExports.jsx("span",{className:"icon-delete-keyboard"})})]})]})})]})}HangedPuzzleComponent.defaultProps={question:"",answer:"",image:{},hintBought:!1,info:{description:"",instructions:"",resolve:{},solution:{},hintBought:{}}};function CurrentImageClickPuzzle({list:l,description:e,nodeId:n,setInfo:t,emitEvent:a,disableExit:o,setResolveAction:d,soundActions:h,setSelected:f,selected:u,pause:p,loadPuzzleStatus:x,index:R,setIndex:S,slidesCompleted:E,setSlidesCompleted:g,keyboardControl:v,totalCorrects:T}){const b=React$2.useRef([]),_=React$2.useRef(0),w=React$2.useRef(0),C=`chained-image-click-puzzle_${R}_${n}`,[P]=h,D=Y=>{b.current=[...b.current,...Y]},N=React$2.useCallback(Y=>{P("score"),a({type:"hidePuzzleButtons",payload:!1}),a({type:"addPoints",complex:!0,finish:!0,payload:[...b.current,...Y]}),a({type:"passPuzzle"})},[P,a]),[k,F]=React$2.useState(!1),M=l[R],{info:U,specificFeedbacks:$}=M;U.description=e,React$2.useEffect(()=>{_.current=0,w.current=0,F(!1)},[R]);const B=React$2.useCallback((Y,q=!1)=>{var ce;let re={...E};if(q){if((ce=$==null?void 0:$.correctFeedbacks)!=null&&ce.length&&!M.hasClickOnce){const fe=$.correctFeedbacks.length;k&&fe?(_.current>0?f(u+(fe-_.current)):f(u+fe),_.current=fe):_.current+=1}else{let fe=u;w.current&&(fe-=w.current),_.current=M.areas.length,f(fe+_.current)}_.current===M.areas.length&&(R+1>=l.length?N(Y):S(R+1),re={...re,[R]:!0},g(re)),D(Y)}else a({type:"addPoints",payload:Y,finish:!1}),a({type:"failPuzzle"}),M.hasClickOrder&&(f(u-_.current),_.current===0&&Object.entries(E).length===0?f(0):_.current=0),Object.entries(E).length===0&&M.hasClickOrder&&!u&&f(0)},[E,$,M.hasClickOnce,M.areas.length,M.hasClickOrder,k,f,u,R,l.length,g,N,S,a]),J=()=>{for(let Y=0;Y<b.current.length;Y=Y+1)if(b.current[Y].points>0)return!0;return!1},ne=()=>{F(!0),R>=l.length-1&&f(T),P("score"),R+1>=l.length&&J()?(U.resolve.rewards.forEach(Y=>{b.current.forEach(q=>{q.id===Y.id&&(Y.points=Y.points+q.points)})}),a({type:"puzzleAction",action:"resolve",payload:{element:C,rewards:U.resolve.rewards,finish:!0}})):a({type:"puzzleAction",action:"resolve",payload:{element:C,rewards:U.resolve.rewards,finish:R+1>=l.length}})};React$2.useEffect(()=>{t({...U,hintId:C})},[U,C,t]),React$2.useEffect(()=>{x&&R!==l.length-1&&B([],!0)},[R,l.length,x,B]);const ie=()=>{const Y=M.hasClickOnce?M.areas.length:1;w.current+=Y,f(u+Y)};return jsxRuntimeExports.jsx(ImageClickWrapperComponent,{...M,puzzle:{name:C,component:"chained-image-click-puzzle"},specificFeedbacks:$,emitFinish:B,emitError:D,emitResolve:ne,isLast:R+1===l.length,defaultCompleted:E[R]||!!x,hideContinue:R+1!==l.length,handleClick:ie,emitEvent:a,disableExit:o,soundActions:h,setResolveAction:d,pause:p,keyboardControl:v},R)}function ChainedImageClickPuzzleComponent(l){const{setInfo:e,emitEvent:n,nodeId:t,list:a,description:o,soundActions:d,showFrames:h,disableExit:f,setResolveAction:u,pause:p,keyboardControl:x}=l,[R,S]=React$2.useState(0),[E,g]=React$2.useState(0),[v,T]=React$2.useState({}),b=`chained-image-click-puzzle_${E}_${t}`,_=React$2.useMemo(()=>n({type:"loadObjectStatus",payload:b}),[n,b]),w=a.reduce((P,D)=>P+D.areas.length,0),C={list:a,description:o,nodeId:t,disableExit:f,setResolveAction:u,emitEvent:n,soundActions:d,setInfo:e,setSelected:S,selected:R,index:E,setIndex:g,slidesCompleted:v,setSlidesCompleted:T,loadPuzzleStatus:_,pause:p,keyboardControl:x,totalCorrects:w};return jsxRuntimeExports.jsxs("div",{className:"puzzle--image__click",children:[h?jsxRuntimeExports.jsxs("div",{className:"puzzle-image__info",children:[jsxRuntimeExports.jsx("span",{className:"info-circle"}),jsxRuntimeExports.jsxs("span",{children:[R," / ",w]})]}):null,jsxRuntimeExports.jsx(CurrentImageClickPuzzle,{...C})]})}function CurrentFramePuzzle({list:l,index:e,puzzlesCompiledRef:n,framesCompleted:t,handleFinish:a,accRewards:o,setRewards:d,setIndex:h,setFramesCompleted:f,loadPuzzleStatus:u,soundActions:p,setResolveAction:x,disableExit:R,description:S,translateFromParent:E,setInfo:g,emitEvent:v,nodeId:T,setSelected:b,selected:_,emitResetPuzzle:w,firstTryForFrame:C,setPuzzlesAutoCompleted:P,puzzlesAutoCompleted:D,emitOpenPopupCounterInfo:N,resetValues:k,setResetValues:F,pause:M,keyboardControl:U,totalCorrects:$}){var Q;const[B]=p,[J,ne]=React$2.useState(!1),ie=l[e],{info:Y,specificFeedbacks:q}=ie;Y.description=S;const re=React$2.useRef(0),ce=React$2.useRef(0),fe=`frame-image-click-puzzle_${e}_${T}`;React$2.useEffect(()=>{n.current+=1},[n]),React$2.useEffect(()=>{g({...Y,hintId:fe})},[g,Y,fe]),React$2.useEffect(()=>{k&&(ce.current=0,re.current=0,b(0),F(!1))},[k,F,b]),React$2.useEffect(()=>{ce.current=0,re.current=0,ne(!1)},[e]);const te=React$2.useCallback((ee,le=!1)=>{var he;let ue={...t};if(le){if((he=q==null?void 0:q.correctFeedbacks)!=null&&he.length&&!ie.hasClickOnce){const ve=q.correctFeedbacks.length;J&&ve?(ce.current>0?b(_+(ve-ce.current)):b(_+ve),ce.current=ve):ce.current+=1}else{let ve=_;re.current&&(ve-=re.current),ce.current=ie.areas.length,D[0]&&Object.entries(t).length===0?b(ce.current):b(ve+ce.current)}ce.current===ie.areas.length&&(e+1>=l.length&&a(ee),ue={...ue,[e]:!0},f(ue),h(e+1>l.length-1?0:e+1)),d(ee)}else v({type:"addPoints",payload:ee,finish:!1}),v({type:"failPuzzle"}),ie.hasClickOrder&&(b(_-ce.current),ce.current=0)},[t,(Q=q==null?void 0:q.correctFeedbacks)==null?void 0:Q.length,ie.hasClickOnce,ie.areas.length,ie.hasClickOrder,d,J,b,_,D,e,l.length,f,h,a,v]),H=React$2.useCallback(()=>{for(let ee=0;ee<o.current.length;ee=ee+1)if(o.current[ee].points>0)return!0;return!1},[o]),W=React$2.useCallback(()=>{ne(!0),e>=l.length-1&&b($),B("score"),v({type:"hidePuzzleButtons",payload:!1}),P(ee=>({...ee,[e]:!0})),e+1>=l.length&&H()?(Y.resolve.rewards.forEach(ee=>{o.current.forEach(le=>{le.id===ee.id&&(ee.points=ee.points+le.points)})}),v({type:"puzzleAction",action:"resolve",payload:{element:fe,rewards:Y.resolve.rewards,finish:!0}})):v({type:"puzzleAction",action:"resolve",payload:{element:fe,rewards:Y.resolve.rewards,finish:e+1>=l.length}})},[e,l.length,B,v,P,H,b,$,Y.resolve.rewards,fe,o]),V=React$2.useCallback(()=>{f({}),ce.current=0,re.current=0,w()},[w,f]);React$2.useEffect(()=>{u&&e!==l.length-1&&te([],!0)},[t,e,l.length,u,te]);const z=()=>{const ee=ie.hasClickOnce?ie.areas.length:1;re.current+=ee,b(_+ee)};return jsxRuntimeExports.jsx(ImageClickWrapperComponent,{...ie,className:"puzzle-frame__canvas",puzzle:{name:"",component:"frame-click-puzzle"},specificFeedbacks:q,emitFinish:te,emitResolve:W,hideContinue:!0,disableInfo:n.current>1,defaultCompleted:t[e]||!!u,soundActions:p,setResolveAction:x,disableExit:R,translateFromParent:E,emitEvent:v,slideNumber:e,handleClick:z,emitResetPuzzle:V,firstTryForFrame:C,puzzlesAutoCompleted:D,emitOpenPopupCounterInfo:N,pause:M,keyboardControl:U},e)}function Tooltip({emitEvent:l}){const e=n=>l({type:"translate",payload:n});return jsxRuntimeExports.jsx("div",{dir:"auto",className:"puzzle-frame__info--tooltip",children:e("puzzles.counterTooltip")})}function Counter({current:l,total:e,tooltip:n,emitEvent:t}){return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[n?jsxRuntimeExports.jsx(Tooltip,{emitEvent:t}):null,jsxRuntimeExports.jsxs("div",{className:"puzzle-frame__info--frames",children:[jsxRuntimeExports.jsx("span",{className:"info-circle"}),jsxRuntimeExports.jsxs("span",{children:[l," / ",e]})]})]})}function FrameImageClickComponent({emitEvent:l,nodeId:e,list:n,description:t,showFrames:a,soundActions:o,disableExit:d,setResolveAction:h,setInfo:f,pause:u,keyboardControl:p}){const[x,R]=React$2.useState({}),S=React$2.useRef([]),[E,g]=React$2.useState(0),[v,T]=React$2.useState({}),[b,_]=React$2.useState(0),w=React$2.useRef(0),[C,P]=React$2.useState(!0),[D,N]=React$2.useState(!0),[k,F]=React$2.useState(!1),M=n.reduce((ce,fe)=>ce+fe.areas.length,0),U=ce=>{S.current=[...S.current,...ce]},$=`frame-image-click-puzzle_${E}_${e}`,B=React$2.useMemo(()=>l({type:"loadObjectStatus",payload:$}),[l,$]),J=React$2.useCallback(ce=>{l({type:"addPoints",complex:!0,finish:!0,payload:[...S.current,...ce]}),l({type:"passPuzzle"})},[l]),ne=React$2.useCallback(()=>{N(!1),S.current=[],_(0),g(0),T({}),P(!0),F(!0)},[]),ie=ce=>l({type:"translate",payload:ce}),Y=()=>{P(!0)},re={firstTryForFrame:D,list:n,description:t,index:E,puzzlesCompiledRef:w,framesCompleted:v,handleFinish:J,setRewards:U,accRewards:S,setSelected:_,selected:b,setIndex:g,setFramesCompleted:T,loadPuzzleStatus:B,soundActions:o,setResolveAction:h,disableExit:d,translateFromParent:ie,setInfo:f,emitEvent:l,nodeId:e,emitResetPuzzle:ne,resetValues:k,setResetValues:F,setPuzzlesAutoCompleted:R,puzzlesAutoCompleted:x,emitOpenPopupCounterInfo:()=>{E===0&&P(!1)},pause:u,keyboardControl:p,totalCorrects:M};return jsxRuntimeExports.jsxs("div",{className:"puzzle-frame",children:[jsxRuntimeExports.jsx(CurrentFramePuzzle,{...re}),jsxRuntimeExports.jsxs("div",{className:"puzzle-frame__content",children:[jsxRuntimeExports.jsx("div",{className:"puzzle-frame__controls",children:jsxRuntimeExports.jsx("div",{className:"puzzle-frame__progress",children:jsxRuntimeExports.jsx("div",{"data-testid":"puzzle-frame-progress",style:{width:`${b/M*100}%`},className:"puzzle-frame__progress--handle"})})}),a?jsxRuntimeExports.jsx("button",{"data-testid":"puzzle-frame-counter-button",disabled:C,"aria-hidden":C,type:"button",className:"puzzle-frame__info",onClick:Y,children:jsxRuntimeExports.jsx(Counter,{current:b,total:M,tooltip:!C,emitEvent:l})}):null]})]})}FrameImageClickComponent.defaultProps={description:"",context:{},nodeId:0,showFrames:!1};function EditButton({action:l,className:e}){return jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,"aria-label":`${l} edit button`,onKeyUp:()=>{},className:`puzzle--webBuilder__edit ${e}`,onClick:l,children:jsxRuntimeExports.jsx("span",{className:"icon-fb-edit"})})}EditButton.defaultProps={action:()=>{},className:""};const path="https://min.gamelearn.io/css-resources/gamelearn/resources/",imagesOptions=[{name:"webbuilder.imageOptions.image1",src:"Amor.jpg"},{name:"webbuilder.imageOptions.image2",src:"Bancorp.svg"},{name:"webbuilder.imageOptions.image3",src:"Amanda.jpg"},{name:"webbuilder.imageOptions.image4",src:"keyboard.jpg"},{name:"webbuilder.imageOptions.image5",src:"Melanie.jpg"},{name:"webbuilder.imageOptions.image6",src:"Sharon.jpg"},{name:"webbuilder.imageOptions.image7",src:"Bankex.svg"},{name:"webbuilder.imageOptions.image8",src:"Futbol.jpg"},{name:"webbuilder.imageOptions.image9",src:"GBL.svg"},{name:"webbuilder.imageOptions.image10",src:"Fooder.jpg"},{name:"webbuilder.imageOptions.image11",src:"Corporate.jpg"},{name:"webbuilder.imageOptions.image12",src:"Bank of Zamunda.svg"},{name:"webbuilder.imageOptions.image13",src:"mindfullness.jpg"},{name:"webbuilder.imageOptions.image14",src:"Nature.jpg"},{name:"webbuilder.imageOptions.image15",src:"Shopper.jpg"},{name:"webbuilder.imageOptions.image16",src:"Lab.jpg"}],colorOptions=["#c66a46","#3c9dc0","#6236ff","#21254f"],colorOptions2=["#39b7b9","#25a1d4","#f5a623","#080269"],titleOptions=[{title:"webbuilder.bank.titleOptions.title1.text",desc:"webbuilder.bank.titleOptions.title1.description"},{title:"webbuilder.bank.titleOptions.title2.text",desc:"webbuilder.bank.titleOptions.title2.description"},{title:"webbuilder.bank.titleOptions.title3.text",desc:"webbuilder.bank.titleOptions.title3.description"},{title:"webbuilder.bank.titleOptions.title4.text",desc:"webbuilder.bank.titleOptions.title4.description"},{title:"webbuilder.bank.titleOptions.title5.text",desc:"webbuilder.bank.titleOptions.title5.description"}],bankProps={backgroundImage:imagesOptions[10].src,backgroundLogo:imagesOptions[11].src,backgroundColor:"#21254f",btnColor:"#25a1d4"},BankTemplate={header:{color:bankProps.backgroundColor,logo:bankProps.backgroundLogo},body:{bankTitle:titleOptions[0].title,bankDesc:titleOptions[0].desc,bgImage:bankProps.backgroundImage,btnColor:bankProps.btnColor}};function BankHeader({showingReference:l,usingTemplate:e,openPopup:n,onSave:t,header:a,translate:o}){return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[l?jsxRuntimeExports.jsx("div",{className:"bank--edit__logo",children:jsxRuntimeExports.jsx("img",{src:path+e.header.logo,alt:"",title:""})}):jsxRuntimeExports.jsxs("div",{className:"bank--edit__logo",children:[a.logo?jsxRuntimeExports.jsx("img",{src:path+a.logo,alt:"",title:""}):jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx("b",{children:o("webbuilder.bank.header.title")}),jsxRuntimeExports.jsx("b",{children:o("webbuilder.bank.header.logo")})]}),jsxRuntimeExports.jsx(EditButton,{action:()=>n("PopupImageComponent",{text:"Documents",images:imagesOptions,onSave:d=>t({logo:d})})})]}),jsxRuntimeExports.jsxs("div",{className:"flex align-center",children:[jsxRuntimeExports.jsxs("ul",{className:"bank--navigation",children:[jsxRuntimeExports.jsx("li",{className:"bank-navigation__item",children:o("webbuilder.bank.header.account")}),jsxRuntimeExports.jsx("li",{className:"bank-navigation__item",children:o("webbuilder.bank.header.invest")}),jsxRuntimeExports.jsx("li",{className:"bank-navigation__item",children:o("webbuilder.bank.header.loans")}),jsxRuntimeExports.jsx("li",{className:"bank-navigation__item",children:o("webbuilder.bank.header.mortgage")})]}),l?null:jsxRuntimeExports.jsx(EditButton,{action:()=>n("PopupColorComponent",{colors:colorOptions,onSave:d=>t({color:d})})})]})]})}BankHeader.defaultProps={showingReference:!1,usingTemplate:{},openPopup:()=>{},onSave:()=>{},header:{}};BankHeader.propTypes={showingReference:PropTypes.bool,usingTemplate:PropTypes.shape({}),openPopup:PropTypes.func,onSave:PropTypes.func,header:PropTypes.shape({})};function FacebookHeader({showingReference:l,usingTemplate:e,header:n,translate:t}){const a=l?e.header.userImage:n.userImage,o=l?e.header.username:n.username;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("span",{className:"facebook--header__logo",children:jsxRuntimeExports.jsx("span",{className:"icon-fb-logo"})}),jsxRuntimeExports.jsxs("span",{className:"facebook--header__user",children:[jsxRuntimeExports.jsx("span",{className:"facebook--header__user--circle",style:{backgroundImage:`url(${path+a})`}}),jsxRuntimeExports.jsx("span",{className:"facebook--header__user--text",children:t(o||"webbuilder.facebook.header.userName")})]})]})}FacebookHeader.defaultProps={showingReference:!1,usingTemplate:{},header:{}};function WebBuilderHeader(l){const{isFacebook:e,header:n,showingReference:t,usingTemplate:a}=l,o=t?a.header.color:n.color;return jsxRuntimeExports.jsx("div",{className:`puzzle--webBuilder__header ${e?"":"bank"}`,style:e?{}:{backgroundColor:`${o}`},children:jsxRuntimeExports.jsx("div",{className:`${e?"facebook":"bank"}--header`,children:e?jsxRuntimeExports.jsx(FacebookHeader,{...l}):jsxRuntimeExports.jsx(BankHeader,{...l})})})}WebBuilderHeader.defaultProps={isFacebook:!1,showingReference:!1,usingTemplate:{},header:{}};WebBuilderHeader.propTypes={isFacebook:PropTypes.bool,showingReference:PropTypes.bool,usingTemplate:PropTypes.shape({}),header:PropTypes.shape({})};const facebookProps={backgroundImage:imagesOptions[12].src,backgroundUser:imagesOptions[5].src},userOptions=["webbuilder.userOptions.user1","webbuilder.userOptions.user2","webbuilder.userOptions.user3"],workOptions=["webbuilder.workOptions.work1","webbuilder.workOptions.work2","webbuilder.workOptions.work3"],studiesOptions=["webbuilder.studiesOptions.study1","webbuilder.studiesOptions.study2","webbuilder.studiesOptions.study3"],mailOptions=["webbuilder.mailOptions.mail1","webbuilder.mailOptions.mail2","webbuilder.mailOptions.mail3"],homeOptions=["webbuilder.homeOptions.home1","webbuilder.homeOptions.home2","webbuilder.homeOptions.home3"],FacebookTemplate={header:{username:userOptions[1],userImage:facebookProps.backgroundUser,bgImage:facebookProps.backgroundImage},body:{work:workOptions[2],home:homeOptions[1],studies:studiesOptions[0],mail:mailOptions[0]}};function WebBuilderFront({showingReference:l,usingTemplate:e,header:n,onSave:t,translate:a,openPopup:o}){const d=l?e.header.userImage:n.userImage,h=l?e.header.username:n.username,f=l?e.header.bgImage:n.bgImage;return jsxRuntimeExports.jsxs("div",{className:"puzzle--webBuilder__front",style:{backgroundImage:`url(${path+f})`},children:[jsxRuntimeExports.jsxs("div",{className:"facebook--user",children:[jsxRuntimeExports.jsx("span",{className:"facebook--user__circle",style:{backgroundImage:`url(${path+d})`},children:l?null:jsxRuntimeExports.jsx(EditButton,{action:()=>{o("PopupImageComponent",{images:imagesOptions,onSave:u=>t({userImage:u})})}})}),jsxRuntimeExports.jsx("span",{className:"facebook--user__text",children:a(h||"webbuilder.facebook.header.userName")}),l?null:jsxRuntimeExports.jsx(EditButton,{action:()=>{o("PopupTextComponent",{options:userOptions,onSave:u=>t({username:u})})}})]}),l?null:jsxRuntimeExports.jsx(EditButton,{className:"position--absolute right top",action:()=>{o("PopupImageComponent",{images:imagesOptions,onSave:u=>t({bgImage:u})})}})]})}WebBuilderFront.defaultProps={showingReference:!1,usingTemplate:{},openPopup:()=>{},onSave:()=>{},header:{}};WebBuilderFront.propTypes={showingReference:PropTypes.bool,usingTemplate:PropTypes.shape({}),openPopup:PropTypes.func,onSave:PropTypes.func,header:PropTypes.shape({})};function FacebookBody({showingReference:l,usingTemplate:e,body:n,onSave:t,openPopup:a,translate:o}){const d=l?e.body.work:n.work,h=l?e.body.studies:n.studies,f=l?e.body.home:n.home,u=l?e.body.mail:n.mail;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("ul",{className:"facebook--sidebar",dir:"auto",children:[jsxRuntimeExports.jsxs("li",{className:`facebook--sidebar__item ${d||l?"selected":""}`,children:[jsxRuntimeExports.jsxs("div",{className:"flex align-center",children:[jsxRuntimeExports.jsx("span",{className:"icon-fb-work"}),jsxRuntimeExports.jsx("span",{className:"text",children:o(d||"webbuilder.facebook.body.work")})]}),l?null:jsxRuntimeExports.jsx(EditButton,{action:()=>{a("PopupTextComponent",{options:workOptions,onSave:p=>t({work:p})})}})]}),jsxRuntimeExports.jsxs("li",{className:`facebook--sidebar__item ${h||l?"selected":""}`,children:[jsxRuntimeExports.jsxs("div",{className:"flex align-center",children:[jsxRuntimeExports.jsx("span",{className:"icon-fb-education"}),jsxRuntimeExports.jsx("span",{className:"text",children:o(h||"webbuilder.facebook.body.studies")})]}),l?null:jsxRuntimeExports.jsx(EditButton,{action:()=>{a("PopupTextComponent",{options:studiesOptions,onSave:p=>t({studies:p})})}})]}),jsxRuntimeExports.jsxs("li",{className:`facebook--sidebar__item ${f||l?"selected":""}`,children:[jsxRuntimeExports.jsxs("div",{className:"flex align-center",children:[jsxRuntimeExports.jsx("span",{className:"icon-fb-home"}),jsxRuntimeExports.jsx("span",{className:"text",children:o(f||"webbuilder.facebook.body.home")})]}),l?null:jsxRuntimeExports.jsx(EditButton,{action:()=>{a("PopupTextComponent",{options:homeOptions,onSave:p=>t({home:p})})}})]})]}),jsxRuntimeExports.jsxs("div",{className:"facebook--board",children:[jsxRuntimeExports.jsx("div",{className:"facebook--mail__label",children:"E-mail"}),jsxRuntimeExports.jsxs("div",{className:`facebook--mail__box ${u||l?"active":""}`,children:[jsxRuntimeExports.jsxs("div",{className:"flex align-center",children:[jsxRuntimeExports.jsx("span",{className:"icon-fb-mail"}),jsxRuntimeExports.jsx("span",{className:"text",children:o(u||"webbuilder.facebook.body.email")})]}),l?null:jsxRuntimeExports.jsx(EditButton,{action:()=>{a("PopupTextComponent",{options:mailOptions,onSave:p=>t({mail:p})})}})]}),jsxRuntimeExports.jsxs("div",{className:"facebook--tabs",children:[jsxRuntimeExports.jsxs("div",{className:"facebook--tabs__item",children:[jsxRuntimeExports.jsx("span",{className:"icon-fb-edit"}),o("webbuilder.facebook.body.editPost")]}),jsxRuntimeExports.jsxs("div",{className:"facebook--tabs__item",children:[jsxRuntimeExports.jsx("span",{className:"icon-fb-photo"}),o("webbuilder.facebook.body.editPhoto")]}),jsxRuntimeExports.jsxs("div",{className:"facebook--tabs__item",children:[jsxRuntimeExports.jsx("span",{className:"icon-fb-video"}),o("webbuilder.facebook.body.liveVideo")]}),jsxRuntimeExports.jsxs("div",{className:"facebook--tabs__item",children:[jsxRuntimeExports.jsx("span",{className:"icon-fb-events"}),o("webbuilder.facebook.body.facebookEvent")]})]}),jsxRuntimeExports.jsxs("div",{className:"facebook--thinking",children:[jsxRuntimeExports.jsxs("div",{className:"facebook--textarea",children:[jsxRuntimeExports.jsx("div",{className:"facebook--textarea__circle"}),jsxRuntimeExports.jsx("div",{className:"facebook--textarea__placeholder",children:o("webbuilder.facebook.body.think")})]}),jsxRuntimeExports.jsxs("div",{className:"facebook--chips",children:[jsxRuntimeExports.jsx("span",{className:"facebook--chips__item",children:o("webbuilder.facebook.body.photo")}),jsxRuntimeExports.jsx("span",{className:"facebook--chips__item",children:o("webbuilder.facebook.body.label")}),jsxRuntimeExports.jsx("span",{className:"facebook--chips__item",children:o("webbuilder.facebook.body.feeling")})]})]})]})]})}FacebookBody.defaultProps={showingReference:!1,usingTemplate:{},openPopup:()=>{},onSave:()=>{},body:{}};function BankBody({showingReference:l,usingTemplate:e,body:n,onSave:t,openPopup:a,translate:o}){const d=l?e.body.bgImage:n.bgImage,h=l?e.body.btnColor:n.btnColor,f=o(l?e.body.bankTitle:"webbuilder.bank.body.image.title"),u=o(l?e.body.bankDesc:"webbuilder.bank.body.image.description");return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"bank--image__front",style:{backgroundImage:`url(${path+d})`},children:jsxRuntimeExports.jsxs("div",{className:"bank--image__text",children:[jsxRuntimeExports.jsx("span",{className:"title",children:n.bankTitle&&!l?o(n.bankTitle):f}),jsxRuntimeExports.jsx("span",{children:n.bankDesc&&!l?o(n.bankDesc):u}),l?null:jsxRuntimeExports.jsx(EditButton,{action:()=>{a("PopupTextComponent",{options:titleOptions,onSave:p=>t({bankTitle:p.title,bankDesc:p.desc})})}}),l?null:jsxRuntimeExports.jsx(EditButton,{className:"position--absolute top right",action:()=>{a("PopupImageComponent",{images:imagesOptions,onSave:p=>t({bgImage:p})})}})]})}),jsxRuntimeExports.jsx("div",{dir:"auto",className:"bank--sidebar",children:jsxRuntimeExports.jsxs("div",{className:"bank--form",children:[jsxRuntimeExports.jsx("div",{className:"bank--form__title",children:o("webbuilder.bank.body.password.title")}),jsxRuntimeExports.jsxs("div",{className:"bank--form__group",children:[jsxRuntimeExports.jsx("div",{className:"bank--form__label",children:o("webbuilder.bank.body.password.current")}),jsxRuntimeExports.jsx("input",{disabled:!0,className:"bank--form__input",type:"password",placeholder:"********"}),jsxRuntimeExports.jsx("span",{className:"icon-circle-check"})]}),jsxRuntimeExports.jsxs("div",{className:"bank--form__group",children:[jsxRuntimeExports.jsx("div",{className:"bank--form__label",children:o("webbuilder.bank.body.password.new")}),jsxRuntimeExports.jsx("input",{disabled:!0,className:"bank--form__input",type:"password",placeholder:"********"}),jsxRuntimeExports.jsx("span",{className:"icon-circle-check"})]}),jsxRuntimeExports.jsxs("div",{className:"bank--form__group",children:[jsxRuntimeExports.jsx("div",{className:"bank--form__label",children:o("webbuilder.bank.body.password.confirm")}),jsxRuntimeExports.jsx("input",{disabled:!0,className:"bank--form__input",type:"password",placeholder:"********"}),jsxRuntimeExports.jsx("span",{className:"icon-circle-check"})]}),jsxRuntimeExports.jsxs("div",{className:"bank--form__buttons",children:[jsxRuntimeExports.jsx("button",{type:"button",className:"bank--form__btn",style:{backgroundColor:`${h}`},children:o("webbuilder.save")}),l?null:jsxRuntimeExports.jsx(EditButton,{action:()=>{a("PopupColorComponent",{colors:colorOptions2,onSave:p=>t({btnColor:p})})}})]})]})})]})}function WebBuilderBody(l){const{isFacebook:e}=l;return jsxRuntimeExports.jsx("div",{className:`puzzle--webBuilder__body ${e?"":"bank"}`,children:e?jsxRuntimeExports.jsx(FacebookBody,{...l}):jsxRuntimeExports.jsx(BankBody,{...l})})}WebBuilderBody.defaultProps={isFacebook:!1};WebBuilderBody.propTypes={isFacebook:PropTypes.bool};function CurrentButton({translate:l,backActive:e,action:n}){return jsxRuntimeExports.jsx("div",{className:"puzzle--webBuilder__topbar--buttons",children:jsxRuntimeExports.jsx("button",{type:"button",className:"puzzle--webBuilder__topbar--buttons__item",onClick:n,children:l(`webbuilder.${e?"return":"showReference"}`)})})}function WebBuilderTopBar({backActive:l,displayButton:e,clickAction:n,translate:t}){return jsxRuntimeExports.jsxs("div",{className:"puzzle--webBuilder__topbar",children:[e?jsxRuntimeExports.jsx(CurrentButton,{backActive:l,action:n,translate:t}):null,jsxRuntimeExports.jsx("div",{className:"puzzle--webBuilder__title",children:"web builder 3.0"})]})}function FeedbackResult({onNext:l,success:e,showButton:n,translate:t}){const a=t(e?"webbuilder.feedback.successTitle":"webbuilder.feedback.failTitle"),o=t(e?"webbuilder.feedback.success":"webbuilder.feedback.fail");return jsxRuntimeExports.jsxs("div",{dir:"auto",className:`puzzle--webBuilder__feedback bottom ${e?"success":"failed"}`,style:e?{zIndex:"11"}:{},children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{className:"title",children:a}),jsxRuntimeExports.jsx("div",{className:"description",children:o})]}),n?jsxRuntimeExports.jsx("button",{type:"button",className:`gat--btn gat--btn__secondary ${e?"green":"red"}`,onClick:l,style:{marginRight:"64px"},children:t("webbuilder.continue")}):null]})}FeedbackResult.defaultProps={onNext:()=>{},success:!1,showButton:!0};function PublishButton({onPublish:l,translate:e}){return jsxRuntimeExports.jsx("div",{role:"button",tabIndex:0,onKeyUp:()=>{},"aria-label":"publish",className:"position--absolute bottom center",onClick:l,children:jsxRuntimeExports.jsxs("div",{className:"gat--btn gat--btn__primary",children:[jsxRuntimeExports.jsx("span",{className:"icon-download-cloud"}),e("webbuilder.publish")]})})}PublishButton.defaultProps={onPublish:()=>{}};function PopupColorComponent({colors:l,onSave:e,closingAction:n,translate:t,soundActions:a}){const[o]=a,[d,h]=React$2.useState(),f=d===null;return jsxRuntimeExports.jsx("div",{className:"popup--layer",children:jsxRuntimeExports.jsxs("div",{className:"popup",children:[jsxRuntimeExports.jsx("div",{className:"popup--info",children:jsxRuntimeExports.jsx("span",{className:"popup--info__item",children:jsxRuntimeExports.jsxs("div",{className:"puzzle--webBuilder__colors",children:[jsxRuntimeExports.jsx("div",{className:"puzzle--webBuilder__colors--title",children:jsxRuntimeExports.jsx("span",{children:t("webbuilder.colorSelect.title")})}),jsxRuntimeExports.jsx("div",{className:"puzzle--webBuilder__colors--items",children:l.map(u=>jsxRuntimeExports.jsx("div",{className:`puzzle--webBuilder__color--select ${d===u?"selected":""}`,style:{borderColor:`${u}`},onClick:()=>h(u),children:jsxRuntimeExports.jsx("span",{style:{backgroundColor:`${u}`}})},u+Date.now()))})]})})}),jsxRuntimeExports.jsxs("div",{className:"popup--buttons",children:[jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn gat--btn__secondary",onClick:n,children:jsxRuntimeExports.jsx("span",{children:t("webbuilder.cancel")})}),jsxRuntimeExports.jsx("button",{type:"button",className:`gat--btn gat--btn__primary ${f?"disabled":""}`,onClick:f?null:()=>{o("click-ui"),e(d)},children:t("webbuilder.save")})]})]})})}PopupColorComponent.defaultProps={closingAction:()=>{},onSave:()=>{},colors:{}};PopupColorComponent.propTypes={closingAction:PropTypes.func,onSave:PropTypes.func,colors:PropTypes.arrayOf(PropTypes.string)};function PopupImageComponent({images:l,onSave:e,closingAction:n,translate:t,soundActions:a}){const[o]=a,[d,h]=React$2.useState(),f=!d;return jsxRuntimeExports.jsx("div",{className:"folder-popup",children:jsxRuntimeExports.jsxs("div",{className:"folder-popup__content",children:[jsxRuntimeExports.jsxs("div",{className:"folder-popup__header",children:[jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsxs("div",{className:"folder-popup__title",children:[jsxRuntimeExports.jsx("span",{className:"folder-popup__icon-header icon-fb-search"}),jsxRuntimeExports.jsx("span",{children:t("webbuilder.imageSelect.title")})]}),jsxRuntimeExports.jsx("button",{onClick:n,className:"folder-popup__close",type:"button",children:jsxRuntimeExports.jsx("span",{className:"icon-close-fit"})})]}),jsxRuntimeExports.jsxs("div",{className:"folder-popup__body",children:[jsxRuntimeExports.jsx("div",{className:"folder-popup__scroll",children:jsxRuntimeExports.jsx("ul",{className:"folder-popup__list",children:l.map(u=>jsxRuntimeExports.jsxs("li",{className:"folder-item-file",children:[jsxRuntimeExports.jsx("div",{className:"folder-item-file__imagewrap",onClick:()=>h(u),onKeyUp:()=>{},role:"button",tabIndex:0,children:jsxRuntimeExports.jsx("img",{alt:u.src,src:path+u.src})}),jsxRuntimeExports.jsx("div",{className:"folder-item-file__title",title:u.src,children:u.src})]},u.src+Date.now()))})}),jsxRuntimeExports.jsxs("div",{className:"folder-popup__buttons",children:[jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn gat--btn__secondary",onClick:n,children:t("webbuilder.cancel")}),jsxRuntimeExports.jsx("button",{type:"button",className:`gat--btn gat--btn__primary ${f?"disabled":""}`,onClick:f?null:()=>{o("click-ui"),e(d.src)},children:t("webbuilder.open")})]})]})]})})}PopupImageComponent.defaultProps={closingAction:()=>{},onSave:()=>{},images:[]};function Selected({item:l,translate:e}){return l instanceof Object?e(l.title.toString()):jsxRuntimeExports.jsx("span",{children:e(l||"webbuilder.textSelect.title")})}function PopupTextComponent({closingAction:l,onSave:e,options:n,translate:t,soundActions:a}){const[o]=a,[d,h]=React$2.useState(""),f=d==="",[u,p]=React$2.useState(!1),x=u?"puzzle--webBuilder__select--item open":"puzzle--webBuilder__select--item",R=()=>{p(!u)};return jsxRuntimeExports.jsx("div",{className:"popup--layer",children:jsxRuntimeExports.jsxs("div",{className:"popup",children:[jsxRuntimeExports.jsx("div",{className:"popup--info",children:jsxRuntimeExports.jsx("span",{className:"popup--info__item",children:jsxRuntimeExports.jsxs("div",{className:"puzzle--webBuilder__select",children:[jsxRuntimeExports.jsx("div",{className:"puzzle--webBuilder__select--label",children:jsxRuntimeExports.jsx("div",{dir:"auto",children:t("webbuilder.textSelect.title")})}),jsxRuntimeExports.jsxs("div",{dir:"auto",className:x,onClick:()=>R(),role:"presentation",children:[jsxRuntimeExports.jsx(Selected,{item:d,translate:t}),jsxRuntimeExports.jsx("span",{className:"icon-down-arrow"}),jsxRuntimeExports.jsx("div",{className:"puzzle--webBuilder__dropdown",children:n.map(S=>S instanceof Object?jsxRuntimeExports.jsxs("span",{role:"button",tabIndex:0,onKeyUp:()=>{},className:"puzzle--webBuilder__dropdown--option",onClick:()=>{h(S)},children:[jsxRuntimeExports.jsx("span",{children:t(S.title)}),jsxRuntimeExports.jsx("span",{className:"subtitle",children:t(S.desc)})]},S.title):jsxRuntimeExports.jsx("span",{role:"button",tabIndex:0,onKeyUp:()=>{},className:"puzzle--webBuilder__dropdown--option",onClick:()=>{h(S)},children:t(S)},S))})]})]})})}),jsxRuntimeExports.jsxs("div",{className:"popup--buttons",children:[jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn gat--btn__secondary",onClick:l,children:t("webbuilder.cancel")}),jsxRuntimeExports.jsx("button",{type:"button",className:`gat--btn gat--btn__primary ${f?"disabled":""}`,disabled:f,onClick:()=>{o("click-ui"),e(d)},children:t("webbuilder.save")})]})]})})}const POPUPS=Object.freeze(Object.defineProperty({__proto__:null,PopupColorComponent,PopupImageComponent,PopupTextComponent},Symbol.toStringTag,{value:"Module"})),defaultHeader={username:null,logo:null,userImage:null,bgImage:null,color:""},defaultBody={bankTitle:null,color:"",btnColor:"",work:null,home:null,mail:null,studies:null,bgImage:null};function PopupComponent({type:l,close:e,translate:n,soundActions:t,...a}){const o=POPUPS[l];return o?jsxRuntimeExports.jsx(o,{type:l,...a.props,closingAction:e,translate:n,soundActions:t}):null}function DisplayingFeedback({feed:l,resolved:e,translate:n,onNext:t}){return l==="success"?jsxRuntimeExports.jsx(FeedbackResult,{success:!0,showButton:!e,onNext:t,translate:n}):l==="failed"?jsxRuntimeExports.jsx(FeedbackResult,{onNext:t,translate:n}):null}function WebBuilderPuzzleComponent({type:l,info:e,emitEvent:n,setResolveAction:t,soundActions:a,disableExit:o,keyboardControl:d}){const[h,f]=React$2.useState(!1),[u,p]=React$2.useState(!1),[x,R]=React$2.useState(!1),[S,E]=React$2.useState(!1),[g,v]=React$2.useState(!1),[T,b]=React$2.useState(null),_=l==="facebook",w=_?FacebookTemplate:BankTemplate,[C,P]=React$2.useState({type:"",props:{}}),[D,N]=React$2.useState(defaultHeader),[k,F]=React$2.useState(defaultBody),[M]=a,U=H=>n({type:"translate",payload:H}),$=()=>{P({type:"",props:{}})},B=(H,W={})=>{P({type:H,props:W})},J=()=>{if(e.solution){const{rewards:H}=e.solution.right,{rewards:W}=e.solution.wrong;M(x?"fail":"score"),n({type:"addPoints",complex:!0,finish:!0,payload:x?W:H}),n({type:"passPuzzle"})}},ne=d({disabled:T!=="success",forward:J,escape:J});React$2.useEffect(()=>ne(),[ne]);const ie=(H,W)=>{const V=Object.keys(H),z={existing:0,equal:0};return V.forEach(Q=>{W[Q]!==null&&W[Q]!==""&&(z.existing+=1),H[Q]===W[Q]&&(z.equal+=1)}),z},Y=(H,W)=>{const V=Object.keys(w.header).length,z=Object.keys(w.body).length,Q=ie(w.header,H),ee=ie(w.body,W),le=ee.existing+Q.existing===V+z,ue=ee.equal+Q.equal===V+z;return{exist:le,equal:ue}},q=()=>{M("click-ui");const{exist:H,equal:W}=Y(D,k);n({type:"hidePuzzleButtons",payload:!0}),H&&!W?(g&&v(!1),b("failed"),R(!0),n({type:"failPuzzle"})):H&&W&&(g&&(o(!1),v(!1)),E(!0),b("success"))},re=H=>{if(Object.keys(H).length>0){const W={...D,...H};N(W),$();const{exist:V}=Y(W,k);v(!!V)}},ce=H=>{if(Object.keys(H).length>0){const W={...k,...H};F(W),$();const{exist:V}=Y(D,W);v(!!V)}};React$2.useEffect(()=>{t(H=>{p(!0),b("success"),f(!1),setTimeout(()=>{b(""),H()},4e3)}),o(!0)},[t,o,e.resolve.rewards,n]);const fe={showingReference:h||u,isFacebook:_,openPopup:B,usingTemplate:w,translate:U},te=()=>{T==="failed"?(b(null),n({type:"hidePuzzleButtons",payload:!1})):T==="success"&&J()};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(PopupComponent,{type:C.type,...C,close:$,soundActions:a,translate:U}),jsxRuntimeExports.jsxs("div",{className:"puzzle--webBuilder",children:[jsxRuntimeExports.jsx(WebBuilderTopBar,{backActive:h,displayButton:!u&&!S,translate:U,clickAction:()=>{M("click-ui"),f(!h)}}),jsxRuntimeExports.jsx(WebBuilderHeader,{...fe,header:D,onSave:re}),_?jsxRuntimeExports.jsx(WebBuilderFront,{...fe,header:D,onSave:re}):null,jsxRuntimeExports.jsx(WebBuilderBody,{...fe,body:k,onSave:ce})]}),!g&&!h?jsxRuntimeExports.jsx(DisplayingFeedback,{feed:T,onNext:te,resolved:u,translate:U}):null,g&&!h?jsxRuntimeExports.jsx(PublishButton,{onPublish:q,translate:U}):null]})}function CardImage({img:l}){const n=(l||{}).url;return jsxRuntimeExports.jsx("img",{src:n,alt:""})}function CardText({text:l,hasImage:e}){return l?jsxRuntimeExports.jsx("div",{className:`card-selector-item__textbox ${e?"":"card-selector-item__textbox--noimage"}`,children:jsxRuntimeExports.jsx("div",{className:"card-selector-item__text",children:jsxRuntimeExports.jsx("span",{children:l||"_"})})}):null}function CardNumber({order:l}){return l?jsxRuntimeExports.jsx("div",{className:"card-selector-item__order",children:jsxRuntimeExports.jsx("div",{children:l})}):null}function CardSuccess({order:l}){return jsxRuntimeExports.jsxs("div",{className:"card-selector-item__feedback card-selector-item__feedback--success ",children:[jsxRuntimeExports.jsx(CardNumber,{order:l}),jsxRuntimeExports.jsx("div",{className:"card-selector-item__feedbackicon",children:jsxRuntimeExports.jsx("div",{className:"icon-check-circle-black"})})]})}function CardFail(){return jsxRuntimeExports.jsx("div",{className:"card-selector-item__feedback card-selector-item__feedback--error",children:jsxRuntimeExports.jsx("div",{className:"card-selector-item__feedbackicon",children:jsxRuntimeExports.jsx("div",{className:"icon-error-circle-black"})})})}function CardContainer({flipped:l,correct:e,order:n,wrongOrder:t,isEmpty:a}){return!a&&l&&e&&!t?jsxRuntimeExports.jsx(CardSuccess,{order:n}):!a&&l?jsxRuntimeExports.jsx(CardFail,{}):null}function Card({card:l,handleClick:e,flipped:n,cardIndex:t,wrongOrder:a}){const o=()=>!(l.img||l.text),d=()=>!!(n&&!l.correct||!n);return jsxRuntimeExports.jsxs("button",{"data-testid":`card-${t}`,type:"button",order:l.order,onClick:()=>{!o()&&d()&&e(t)},className:`unset-button card-selector-item ${o()?"card-selector-item--empty":""}`,"aria-label":l.text?l.text:null,children:[jsxRuntimeExports.jsx(CardImage,{img:l.img}),jsxRuntimeExports.jsx(CardText,{text:l.text,hasImage:!!l.img}),jsxRuntimeExports.jsx(CardContainer,{isEmpty:o(),flipped:n,wrongOrder:a,order:l.order,correct:l.correct})]})}Card.defaultProps={handleClick:()=>{},documentsDict:{},card:{},flipped:!1,wrongOrder:!1,cardIndex:0};Card.propTypes={wrongOrder:PropTypes.bool,handleClick:PropTypes.func,cardIndex:PropTypes.number,flipped:PropTypes.bool,documentsDict:PropTypes.shape({}),card:PropTypes.shape({correct:PropTypes.bool,order:PropTypes.number,text:PropTypes.string,imgId:PropTypes.string,status:PropTypes.string})};function Board({cards:l,currentOrder:e,setCurrentOrder:n,handleError:t,feedbackIsShown:a,resolvePuzzle:o,soundActions:d,onFinish:h,handleSuccess:f,resolveWithAnyCard:u}){const[p,x]=React$2.useState(Array(l.length).fill(!1)),[R,S]=React$2.useState(Array(l.length).fill(!1)),[E,g]=React$2.useState(0),[v,T]=React$2.useState(!1),[b]=d,_=l.filter(M=>M.correct===!0).length,w=l.filter(M=>M.order).length>0,C=React$2.useCallback(()=>{x(Array(l.length).fill(!1)),S(Array(l.length).fill(!1)),g(0),n(1)},[l.length,n]),P=()=>{setTimeout(()=>{C()},1e3)};function D(M,U=M){const $=Array.from(p);$[M]=U,x($)}const N=React$2.useCallback(()=>{const M=[];l.forEach((U,$)=>{U.correct===!0&&M.push($)}),x(M)},[l]);React$2.useEffect(()=>{o&&N()},[N,o]),React$2.useEffect(()=>{(u&&E||E===_&&_>0)&&(h(),T(!0),g(0))},[E,h,_,u]);const k=M=>{D(M),f(l[M].id||null),g(E+1)},F=M=>{var U,$;if(!v&&!a)if(b("click-ui"),l[M].correct&&!w)k(M);else if(w){if(l[M].order===e)n(e+1),k(M);else if(D(M),l[M].order!==e){const B=Array.from(R);B[M]=M,S(B),t(((U=l[M])==null?void 0:U.id)||null,l[M].correct),P()}}else t((($=l[M])==null?void 0:$.id)||null),D(M),setTimeout(()=>{D(M,!1)},1e3)};return jsxRuntimeExports.jsx("div",{className:`cards-selector__content cards-selector__content-${l.length}`,children:l&&l.map((M,U)=>jsxRuntimeExports.jsx(Card,{setCurrentOrder:n,card:M,handleClick:()=>F(U),flipped:p.includes(U),wrongOrder:R.includes(U),cardIndex:U},`cardPuzzle ${l.indexOf(M)}`))})}Board.defaultProps={setCurrentOrder:()=>{},handleError:()=>{},onFinish:()=>{},handleSuccess:()=>{},documentsDict:{},cards:[],currentOrder:1,resolvePuzzle:!1,feedbackIsShown:!1,resolveWithAnyCard:!1};function CardsSelectorPuzzleComponent({emitEvent:l,info:e,cards:n,resolveWithAnyCard:t,specificFeedbacks:a,disableExit:o,setResolveAction:d,soundActions:h,backgroundImage:f,nodeId:u,keyboardControl:p,hideBackgroundImageTheme:x=!1}){var te,H;const[R,S]=React$2.useState(!1),[E,g]=React$2.useState(1),[v,T]=React$2.useState(!1),[b,_]=React$2.useState(!1),[w,C]=React$2.useState(!1),[P,D]=React$2.useState([]),[N,k]=React$2.useState(!1),[F,M]=React$2.useState(""),[U]=h,$=W=>l({type:"translate",payload:W}),B=`cards-selector-puzzle_${u}`,J=React$2.useCallback(W=>{T(!1),C(!1),l({type:"hidePuzzleButtons",payload:!1}),l({type:"addPoints",complex:!0,finish:!0,payload:W}),l({type:"passPuzzle"})},[l]),ne=React$2.useCallback(()=>{var Q,ee;l({type:"hidePuzzleButtons",payload:!0}),T(!0);const{rewards:W}=((Q=e==null?void 0:e.solution)==null?void 0:Q.right)||{},V=((ee=a==null?void 0:a.correctFeedbacks)==null?void 0:ee.map(le=>le.rewards).flat())||[],z=[...P,...W,...V];U("score"),J(z)},[P,J,l,(te=e==null?void 0:e.solution)==null?void 0:te.right,U,a==null?void 0:a.correctFeedbacks]),ie=()=>{S(!0),e.solution.right.desc&&!(a!=null&&a.specificCorrectFeedbacks)&&M(e.solution.right.desc),C(!0)},Y=()=>{v||R?ne():(T(!1),o(!1),C(!1),l({type:"hidePuzzleButtons",payload:!1})),M("")},q=W=>{if(_(!0),a!=null&&a.specificCorrectFeedbacks){const V=a.correctFeedbacks.find(z=>z.id===W);V!=null&&V.desc&&(M(V.desc),C(!0))}U("score"),l({type:"hidePuzzleButtons",payload:!0})},re=(W,V=!1)=>{var z,Q;if(_(!1),V)M((z=e.orderFeedback)==null?void 0:z.desc),C(!0),D([...P,...((Q=e.orderFeedback)==null?void 0:Q.rewards)||[]]);else if(a!=null&&a.specificWrongFeedbacks){const ee=a.wrongFeedbacks.find(le=>le.id===W);ee!=null&&ee.desc?(M(ee.desc),C(!0)):(C(!0),setTimeout(()=>{Y(),l({type:"hidePuzzleButtons",payload:!1})},2e3)),D([...P,...(ee==null?void 0:ee.rewards)||[]])}else e.solution.wrong.desc?(M(e.solution.wrong.desc),C(!0)):(C(!0),setTimeout(()=>{Y(),l({type:"hidePuzzleButtons",payload:!1})},3e3));o(!0),!(a!=null&&a.specificWrongFeedbacks)&&!V&&D([...P,...e.solution.wrong.rewards]),U("fail"),l({type:"hidePuzzleButtons",payload:!0}),l({type:"failPuzzle"})};React$2.useEffect(()=>{R&&o(!0)},[o,R]),React$2.useEffect(()=>{d(()=>{var V;l({type:"hidePuzzleButtons",payload:!0}),k(!0);const W=[...P,...((V=e==null?void 0:e.resolve)==null?void 0:V.rewards)||{}];setTimeout(()=>{T(!1),C(!1),l({type:"hidePuzzleButtons",payload:!1}),l({type:"puzzleAction",action:"resolve",payload:{element:B,rewards:W,finish:!0}})},2e3)})},[d,o,P,(H=e==null?void 0:e.resolve)==null?void 0:H.rewards,l,B]);const ce=React$2.useMemo(()=>{let W="";return W="cards-selector",f!=null&&f.url&&(W+=" cards-selector--with-custom-bg"),x&&(W+=" disable-background-image"),W},[f==null?void 0:f.url,x]),fe={backgroundImage:f!=null&&f.url?`url('${f.url}')`:""};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:ce,style:fe,children:jsxRuntimeExports.jsx(Board,{setCurrentOrder:g,currentOrder:E,cards:n,onFinish:ie,resolveWithAnyCard:t,handleError:re,feedbackIsShown:w,resolvePuzzle:N,soundActions:h,handleSuccess:q})}),w&&jsxRuntimeExports.jsx(FeedbackComponent$1,{success:v||b,text:F,hasTimeout:!F,translate:$,functionOnClose:Y,keyboardControl:p})]})}CardsSelectorPuzzleComponent.defaultProps={cards:[],info:{},resolveWithAnyCard:!1,backgroundImage:{url:""}};function Fakecursor(){return jsxRuntimeExports.jsx("span",{className:"fakecursor",children:"|"})}function FixedComponent({delay:l,index:e,length:n,textToPrint:t,setDoneTyping:a,nextParagraphType:o,isWriting:d}){const[h,f]=React$2.useState(!0),[u,p]=React$2.useState(""),[x,R]=React$2.useState(!1);React$2.useEffect(()=>{R(e===n-1)},[e,n]);const S=T=>{if(!T||!T.length)return"";const b=T.replace(/<script.*?>.*?<\/script>/gim,""),_=document.createElement("DIV");return _.innerHTML=b,_.textContent||_.innerText||""};React$2.useEffect(()=>{const T=()=>{const _=t.trim().split(" ");return b(_,_.length-1).join(" ")},b=(_,w)=>{if(w<0)return[""];const C=[..._];if(S(_[w]).length!==0){const P=_[w];return C[w]=`<span class="lastWord" >${P}</span>`,C}return b(_,w-1)};o==="election"?p(T()):setTimeout(()=>{p(t)},200)},[o,t]);const E=()=>{a(!0),f(!1)},g=t.split("<p>");g.shift();const v=g.length>1;return h&&t!==""&&u!==""?jsxRuntimeExports.jsx("span",{className:`writer-inline ${v?"multiple":""} ${x?"Typist":""}`,"data-testid":`result-${e}`,children:jsxRuntimeExports.jsx(Typist,{startDelay:300,avgTypingDelay:l,stdTypingDelay:10,onCharacterTyped:d,onTypingDone:E,cursor:{hideWhenDone:!0,hideWhenDoneDelay:200},blink:!0,children:HTMLReactParser$1(t)})}):jsxRuntimeExports.jsxs("span",{className:`writer-inline ${v?"multiple":""} ${x?"Typist":""}`,"data-testid":`result-${e}`,children:[HTMLReactParser$1(u),o==="election"&&x&&jsxRuntimeExports.jsx(Fakecursor,{})]})}FixedComponent.defaultProps={delay:0,textToPrint:"",setDoneTyping:()=>{},nextParagraphType:"",isWriting:()=>{}};function SingleElection({option:l,decisionInspected:e,setCurrentDecisionSelected:n,index:t,setCurrentDecisionInspected:a,soundActions:o}){const[d]=o,h=R=>R.previewText!==""?HTMLReactParser$1(R.previewText):HTMLReactParser$1(R.fullText),f=R=>R.previewText!==""?e===t?"icon-eye inspected":"icon-eye":"",u=()=>{d("click-ui"),n(t)},p=R=>{R.keyCode===13&&x(R)},x=R=>{R.preventDefault(),R.stopPropagation(),e===t?(R.target.style.background="",a("")):a(t)};return jsxRuntimeExports.jsxs("div",{className:"single-election",children:[jsxRuntimeExports.jsxs("button",{className:"single-election__cta",type:"button",onClick:()=>u(),children:[jsxRuntimeExports.jsx("div",{className:"single-election__btn",children:jsxRuntimeExports.jsx("span",{children:h(l)})}),jsxRuntimeExports.jsx("div",{onClick:x,onKeyDown:p,className:f(l),"aria-label":"Inspect",role:"button",tabIndex:0})]}),e===t&&jsxRuntimeExports.jsx("div",{className:"single-election__complete",children:jsxRuntimeExports.jsx("div",{children:HTMLReactParser$1(l.fullText)})})]})}SingleElection.defaultProps={setCurrentDecisionSelected:()=>{},setCurrentDecisionInspected:()=>{},option:{},index:0};function SingleElectionRender({decisionInspected:l,opt:e,index:n,setCurrentDecisionSelected:t,setCurrentDecisionInspected:a,soundActions:o}){return e&&e.fullText&&e.fullText!==""?jsxRuntimeExports.jsx(SingleElection,{decisionInspected:l,setCurrentDecisionSelected:t,setCurrentDecisionInspected:a,option:e,soundActions:o,index:n}):null}function ElectionComponent({textWithOpts:l,setCurrentDecisionSelected:e,printed:n,soundActions:t}){const[a,o]=React$2.useState("");return React$2.useEffect(()=>{n()},[n]),jsxRuntimeExports.jsx("div",{className:`elections-box pos${a+1}-${l.filter(d=>!!d.fullText).length}`,children:l&&l.map((d,h)=>jsxRuntimeExports.jsx(SingleElectionRender,{opt:d,soundActions:t,index:h,setCurrentDecisionSelected:e,setCurrentDecisionInspected:o,decisionInspected:a},h))})}ElectionComponent.defaultProps={textWithOpts:[],setCurrentDecisionSelected:()=>{},printed:()=>{}};function FeedbackElement({decision:l}){const{title:e,body:n}=l.feedback;return jsxRuntimeExports.jsx("div",{children:n!==""&&jsxRuntimeExports.jsxs("div",{className:"writer-feedback-decision-item",children:[e&&jsxRuntimeExports.jsxs("div",{dir:"auto",className:"writer-feedback-decision-item__title",children:[e," "]}),n&&jsxRuntimeExports.jsxs("div",{dir:"auto",className:"writer-feedback-decision-item__message",children:[l.correct?jsxRuntimeExports.jsx("span",{className:"icon-check-circle-black color--success"}):jsxRuntimeExports.jsx("span",{className:"icon-error-circle-black color--error"}),jsxRuntimeExports.jsx("span",{children:n})]})]})})}FeedbackElement.defaultProps={decision:{}};function FeedbackComponent({emitEvent:l,closingAction:e,feedbackIsDone:n,decisionsList:t,texts:a,retryAction:o,retry:d,skip:h,checkCorrect:f,rewardsStack:u,setFailed:p,soundActions:x}){const[R]=x,S=g=>l({type:"translate",payload:g}),E=()=>{R("click-ui"),e(),p(),n()};return jsxRuntimeExports.jsxs("div",{className:`writer-feedback ${u.length?"":"start"}`,children:[jsxRuntimeExports.jsx("div",{className:"writer-feedback__title",children:S("puzzles.feedback")}),jsxRuntimeExports.jsx("div",{className:"writer-feedback__decisions",children:t.map(g=>a[g.currenTextParagraph].electionTexts[g.index].feedback.body?jsxRuntimeExports.jsx(FeedbackElement,{decision:a[g.currenTextParagraph].electionTexts[g.index]},g.index):null)}),jsxRuntimeExports.jsxs("div",{className:"writer-feedback__btns",children:[h&&jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn gat--btn__secondary writer-feedback__btn-mobile",onClick:()=>{E()},children:S("puzzles.skip")}),d&&jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn gat--btn__primary writer-feedback__btn-mobile",onClick:()=>{f()?E():(R("click-ui"),o())},children:S(f()?"puzzles.continue":"puzzles.retry")}),!d&&jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn gat--btn__primary writer-feedback__btn-mobile",onClick:()=>E(),children:S("puzzles.continue")})]})]})}FeedbackComponent.defaultProps={emitEvent:()=>{},closingAction:()=>{},feedbackIsDone:()=>{},decisionsList:[],texts:[],retryAction:()=>{},retry:!1,skip:!1,checkCorrect:()=>{},nodeId:"0"};function FinishedTextComponent({textToPrint:l,correct:e}){const n=l.split("<p>");n.shift();const t=n.length>1;return jsxRuntimeExports.jsx("span",{className:`writer-inline ${t?"multiple":""} ${e}`,children:HTMLReactParser$1(l)})}FinishedTextComponent.defaultProps={correct:"",textToPrint:""};function WriterPuzzleComponent({emitEvent:l,styles:e,nodeId:n,retry:t,skip:a,type:o,info:d,setResolveAction:h,documentTitle:f,documentTitle_labelId:u,texts:p,soundActions:x,backgroundImage:R,hideBackgroundImageTheme:S=!1}){const E=rt=>l({type:"translate",payload:rt}),g=React$2.useRef(),[v,T]=React$2.useState(!1),[b,_]=React$2.useState(!1),[w,C]=React$2.useState(0),[P,D]=React$2.useState({[`text_${w}`]:{...p[w],id:`text_${w}`,correct:""}}),[N,k]=React$2.useState(!1),[F,M]=React$2.useState([]),[U,$]=React$2.useState(!1),[B,J]=React$2.useState(!1),[ne,ie]=React$2.useState(!1),[Y,q]=React$2.useState(!0),[re,ce]=React$2.useState([]),[fe,te]=React$2.useState(!0),[H]=x,W=React$2.useRef({}),V=rt=>{let xt;return rt.electionTexts.forEach((Et,Qe)=>{Et.correct&&(xt=Qe)}),xt},z=React$2.useCallback(rt=>F.filter(Et=>Et.currenTextParagraph===rt)[0].fullText_labelId,[F]),Q=React$2.useCallback(()=>p.map((rt,xt)=>{if(rt.type==="fixed")return rt.fullText_labelId??rt.fullText;if(rt.type==="election"){const Et=V(rt);return Et>=0?rt.electionTexts[Et].fullText_labelId:z(xt)}return""}),[z,p]),ee=12,le=()=>{if(F){const rt=F.length;let xt=0;for(let Et=0;Et<rt;Et+=1)F[Et].isCorrect==="none"&&(xt+=1);return xt===rt}return!0},ue=React$2.useCallback(()=>{if(F){const rt=F.length;let xt=0;for(let Et=0;Et<rt;Et+=1)F[Et].isCorrect==="green"&&(xt+=1);return xt===rt}return!0},[F]),he=()=>!!(F&&F.length),ve=()=>F.find(rt=>{const{feedback:xt}=p[rt.currenTextParagraph].electionTexts[rt.index];return xt.body!==""}),be=React$2.useCallback(()=>{const rt=Q();l({type:"finishMedia",payload:{name:u,text:rt,documentType:o,type:"text"}})},[Q,u,l,o]),Re=React$2.useCallback(rt=>{const xt=ue();H(b?"fail":xt?"score":"fail"),l({type:"addPoints",complex:!0,finish:!0,payload:rt||re,onFinish:o!=="view"?be:null}),l({type:"passPuzzle"})},[ue,l,b,be,H,re,o]);React$2.useEffect(()=>{v&&te(!1),h(()=>{Re(d.resolve.rewards)})},[l,Re,v,be,d.resolve.rewards,h,o]);const Le=()=>{T(!1),C(0),M([]),ce([]),_(!1),ie(!1),k(!1),J(!1),$(!1),D({text_0:{...p[0],id:"text_0",correct:""}}),q(!0),l({type:"addPoints",complex:!0,finish:!1,payload:re}),l({type:"failPuzzle"})},Oe=()=>{he()?le()&&($(!0),Re()):($(!0),ie(!0),Re()),U?(q(!1),ne&&!B?J(!0):(B||!ne&&!B)&&(!ne&&!B&&t?ue()?Re():Le():Re())):($(!0),ve()&&ie(!0))},Ke=()=>{const rt=p[w].electionTexts.filter(Et=>Et.correct).length,xt=p[w].electionTexts;return rt===0||rt===xt},St=rt=>{const xt=p[w].electionTexts[rt],Et=xt.feedback.rewards;Et&&Et[0]&&Et[0].points&&(W.current[`t${w}_e${rt}`]||(xt.correct&&(W.current[`t${w}_e${rt}`]=!0),ce([...re,...Et])));const Qe=()=>Ke()?"none":xt.correct?"green":"red",Be={currenTextParagraph:w,fullText:xt.fullText,index:rt,isCorrect:Qe()};D({...P,[`text_${w}`]:{type:"fixed",fullText:xt.fullText,correct:Be.isCorrect}}),M([...F,Be])},it=()=>{g.current.scrollTop=g.current.scrollHeight+100},gt=()=>{if(g.current.querySelector(".wrapfixed").offsetHeight>g.current.offsetHeight){const rt=g.current.querySelector(".wrapfixed").offsetHeight;g.current.scrollTo({top:rt,behavior:"smooth"})}},Ge=(rt,xt,Et)=>{const Qe=rt.fullText,Be=p[Et+1]?p[Et+1].type:"",Xe=P[`text_${Et+1}`]&&P[`text_${Et+1}`].type?P[`text_${Et+1}`].type:Be;return jsxRuntimeExports.jsx(FixedComponent,{length:xt,doneTyping:N,index:Et,delay:ee,setDoneTyping:k,nextParagraphType:Xe,isWriting:gt,textToPrint:Qe},Et.toString())},Me=(rt,xt)=>{const Et=rt.fullText;return jsxRuntimeExports.jsx(FinishedTextComponent,{textToPrint:Et,correct:rt.correct},xt)},De=rt=>jsxRuntimeExports.jsx(ElectionComponent,{soundActions:x,textWithOpts:rt.electionTexts,setCurrentDecisionSelected:St,printed:it,disableExit:fe},rt.electionTexts),Ve=(rt,xt,Et)=>rt.type==="fixed"?Ge(rt,xt,Et):De(rt);React$2.useEffect(()=>{N===!0&&(()=>{p[w+1]?(D({...P,[`text_${w+1}`]:{...p[w+1],id:`text_${w+1}`,correct:""}}),C(w+1),k(!1)):T(!0)})()},[N,w,P,p]);const ct=React$2.useMemo(()=>{let rt=`writer-puzzle writer-puzzle--${e}`;return S&&(rt+=" disable-background-image"),rt},[S,e]),dt={backgroundImage:R!=null&&R.url?`url('${R.url}')`:""};return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("div",{className:ct,style:dt,children:jsxRuntimeExports.jsxs("div",{className:"writer-puzzle__overlay",children:[B&&jsxRuntimeExports.jsx(FeedbackComponent,{emitEvent:l,texts:p,setFailed:()=>_(!0),decisionsList:F,closingAction:Oe,retry:t,skip:a,checkCorrect:ue,retryAction:Le,rewardsStack:re,nodeId:n,soundActions:x}),!B&&jsxRuntimeExports.jsxs("div",{className:"writer-puzzle__container",children:[jsxRuntimeExports.jsx("div",{dir:"auto",className:"writer-puzzle__title",children:f!==""&&f}),jsxRuntimeExports.jsx("div",{className:"writer-puzzle__body",dir:LangIsRtl()?"rtl":"auto",children:jsxRuntimeExports.jsxs("div",{className:"writer-puzzle__scroll",tabIndex:0,style:{overflowX:"hidden",padding:"0 0 20px 0",height:"95%"},ref:g,children:[jsxRuntimeExports.jsx("div",{className:"wrapfixed",children:Y&&!U&&Object.values(P).map((rt,xt)=>Ve(rt,Object.values(P).length-1,xt))}),U&&Object.values(P).map((rt,xt)=>Me(rt,xt))]})}),v&&jsxRuntimeExports.jsx("div",{className:"writer-puzzle__footer",children:jsxRuntimeExports.jsx("button",{type:"button",className:"gat--btn gat--btn__primary",onClick:Oe,children:E("screens.continue")})})]})]})})})}WriterPuzzleComponent.defaultProps={emitEvent:()=>{},info:{},styles:"",nodeId:"0",retry:!1,skip:!1,type:"",documentTitle:"",texts:[]};function Image$1({document:l,name:e,isWallpaper:n}){const t=(l==null?void 0:l.url)||null;return jsxRuntimeExports.jsx("div",{className:`puzzle--terminal__image ${n?"puzzle--terminal__image--wallpaper":""}`,children:t?jsxRuntimeExports.jsx("img",{src:t,alt:e||""}):null})}const ICONS$1={image:"image-icon",video:"video-icon",embedded_video:"video-icon",pdf:"pdf-icon",terminal:"console-icon",cracker:"cracker-icon",folder:"folder-icon",world:"world-icon"};function Visor({file:l,solution:e,showContinue:n,info:t,resolvePuzzle:a,backFile:o,translate:d,soundActions:h,keyboardControl:f}){var b;const{fileId:u}=l,p=((b=l.document)==null?void 0:b.url)||"",[x]=h,R={image:{component:Image$1,props:{...l,url:p,soundActions:h}},video:{component:VideoVisor,props:{...l,url:p,endVideo:a,soundActions:h,translate:d}},embedded_video:{component:VideoVisor,props:{...l,url:p,soundActions:h}},pdf:{component:PdfVisor,props:{...l,url:p,translate:d,soundActions:h,emitNumberOfPages:()=>{},endPdf:()=>{},keyboardControl:f}},application:{component:PdfVisor,props:{...l,url:p,translate:d,soundActions:h,emitNumberOfPages:()=>{},keyboardControl:f,endPdf:()=>{}}}};if(!R[l.type])return null;const S=R[l.type].component,E=R[l.type].props,v=l.name.replace(/.jpg|.png|.pdf|.mp4/gi,""),T=e.fileId;return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{className:"puzzle--terminal__visor",children:[jsxRuntimeExports.jsx(FeedbackComponent$1,{playSound:x,shortText:!0,success:u===T,text:u===T?t.solution.right.desc:t.solution.wrong.desc,functionOnClose:u===T?a:o,additionalStyle:ICONS$1[l.type],secondText:v,translate:d,puzzleHeaderClass:"puzzle--terminal__visor--message",keyboardControl:f}),jsxRuntimeExports.jsx("div",{className:"puzzle--terminal__visor--body",children:jsxRuntimeExports.jsx(S,{...E})}),jsxRuntimeExports.jsx("div",{className:"puzzle--terminal__button",children:u===T&&n?jsxRuntimeExports.jsx("button",{className:"gat--btn gat--btn__primary green",type:"button",onClick:a,children:d("screens.continue")}):null})]})})}const ICONS={image:"image-icon",video:"video-icon",embedded_video:"video-icon",pdf:"pdf-icon",terminal:"console-icon",cracker:"cracker-icon",folder:"folder-icon",application:"pdf-icon",world:"world-icon"};function Item({item:l,selectItem:e}){const n=l.name;return jsxRuntimeExports.jsx("li",{className:"puzzle--terminal__folder__list--item",children:jsxRuntimeExports.jsxs("button",{type:"button",title:n,className:`unset-button puzzle--terminal__item id-${l.id}`,onClick:()=>l.fixed?null:e(l),children:[jsxRuntimeExports.jsx("span",{className:`puzzle--terminal__icon ${ICONS[l.type]}`}),jsxRuntimeExports.jsx("span",{children:n})]})})}function FilesGroup({initFile:l,backFile:e,file:n,closeFolder:t,selectItem:a}){return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:n.id==="init"?jsxRuntimeExports.jsx("ul",{className:"puzzle--terminal__folder__list desktop",children:n.children.map((o,d)=>jsxRuntimeExports.jsx(Item,{selectItem:a,item:o},`${`${d}${o.id}`}`))}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("ul",{className:"puzzle--terminal__folder__list desktop",children:l.children.map((o,d)=>jsxRuntimeExports.jsx(Item,{selectItem:a,item:o},`${d+o.id}`))}),jsxRuntimeExports.jsxs("div",{className:"puzzle--terminal__folder",children:[jsxRuntimeExports.jsxs("div",{className:"puzzle--terminal__folder--head",children:[jsxRuntimeExports.jsx("span",{role:"button",onKeyUp:()=>{},"aria-label":"back file",tabIndex:0,onClick:()=>e(),className:"puzzle--terminal__folder--back",children:jsxRuntimeExports.jsx("span",{className:"icon-back"})}),jsxRuntimeExports.jsx("span",{className:`puzzle--terminal__folder--head__icon ${ICONS[n.type]}`}),jsxRuntimeExports.jsx("span",{className:"text",children:n.name}),jsxRuntimeExports.jsx("span",{role:"button",tabIndex:0,"aria-label":"close folder",onKeyUp:()=>{},onClick:()=>t(),className:"puzzle--terminal__folder--close",children:jsxRuntimeExports.jsx("span",{className:"icon-close"})})]}),jsxRuntimeExports.jsx("div",{className:"puzzle--terminal__folder--body",children:jsxRuntimeExports.jsx("ul",{className:"puzzle--terminal__folder__list",children:n.children.map((o,d)=>jsxRuntimeExports.jsx(Item,{selectItem:a,item:o},`${d+o.id}`))})})]})]})})}const DEFAULT_IMG="https://min.gamelearn.io/css-resources/gamelearn/resources/cosmos-bg-min.jpg",FIXED_ITEMS=[{fileId:"ids1",type:"world",fixed:!0,name:"Web builder 3.0"},{fileId:"ids2",type:"cracker",fixed:!0,name:"Decoder.exe"},{fileId:"ids3",type:"terminal",fixed:!0,name:"terminal"}];function TerminalPuzzleComponent({emitEvent:l,items:e,backgroundImage:n,solution:t,info:a,disableExit:o,soundActions:d,setResolveAction:h,nodeId:f,keyboardControl:u}){const[p,x]=React$2.useState({}),[R]=React$2.useState(!1),[S,E]=React$2.useState([]),g=React$2.useRef([]),[v]=d,T=k=>l({type:"translate",payload:k}),b=`terminal-puzzle_${f}`,_=React$2.useMemo(()=>({name:"init",children:[...FIXED_ITEMS,...e],id:"init"}),[e]),w=React$2.useCallback(k=>{v("click-ui"),x(k),E([...S,k]),k.type!=="folder"&&(l({type:"hidePuzzleButtons",payload:!0}),o(!0))},[S,o,l,v]);React$2.useEffect(()=>{x(_),E([_])},[_]),React$2.useEffect(()=>{h(()=>{g.current=[...g.current,...a.resolve.rewards];const k=g.current.map(F=>{var ne;const{name:M,points:U,type:$,id:B}=F,J={name:M,points:U,type:$,id:B};return(ne=F==null?void 0:F.document)!=null&&ne.resourceId&&(J.id=F.document.resourceId),J});l({type:"hidePuzzleButtons",payload:!1}),l({type:"puzzleAction",action:"resolve",payload:{element:b,rewards:k,finish:!0}})})},[h,a.resolve.rewards,l,b]);const C=()=>{g.current=[...g.current,...a.solution.wrong.rewards];const k=S.length-1,F=S.filter((M,U)=>k>U);x(S[k-1]),E(F),o(!1),l({type:"hidePuzzleButtons",payload:!1})},P=()=>{v("click-ui");const k=S[0];x(k),E([k])},D=()=>{g.current=[...g.current,...a.solution.right.rewards];const k=g.current.map(F=>{var ne;const{name:M,points:U,type:$,id:B}=F,J={name:M,points:U,type:$,id:B};return(ne=F==null?void 0:F.document)!=null&&ne.resourceId&&(J.id=F.document.resourceId),J});l({type:"hidePuzzleButtons",payload:!1}),v("score"),l({type:"addPoints",complex:!0,finish:!0,payload:k}),l({type:"passPuzzle"})},N=(n==null?void 0:n.url)||DEFAULT_IMG;return jsxRuntimeExports.jsx("div",{className:"puzzle--terminal",children:p.children?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Image$1,{isWallpaper:!0,document:{url:N}}),jsxRuntimeExports.jsx(FilesGroup,{backFile:C,initFile:_,selectItem:w,breadcrumb:S,closeFolder:P,file:p,translate:T})]}):jsxRuntimeExports.jsx(Visor,{soundActions:d,backFile:C,resolvePuzzle:D,info:a,showContinue:!R,solution:t,file:p,translate:T,keyboardControl:u})})}function DragItemPuzzleComponent({area:l,image:e,resolveObject:n,info:t,hasHighlights:a,consume:o,disableExit:d,emitEvent:h,soundActions:f,keyboardControl:u}){const{solution:p}=t,x=React$2.useRef(),R=React$2.useRef(),S=React$2.useRef(),E=React$2.useRef(),g=React$2.useRef({}),[v,T]=React$2.useState(""),[b,_]=React$2.useState(!1),[w,C]=React$2.useState(),[P]=React$2.useState(new window.Image),D=React$2.useRef([]),[N]=f,k=fe=>h({type:"translate",payload:fe});React$2.useEffect(()=>{d(v!=="")},[v,d]);const F=(fe,te)=>(fe.x+fe.width>te.x&&fe.x+fe.width<=te.x+te.width||te.x+te.width>fe.x&&te.x+te.width<=fe.x+fe.width)&&(fe.y+fe.height>te.y&&fe.y+fe.height<=te.y+te.height||te.y+te.height>fe.y&&te.y+te.height<=fe.y+fe.height),M=()=>{x&&a&&(x.current.to({duration:.25,opacity:.75}),R.current.to({duration:.25,opacity:.4}))},U=()=>{x&&a&&(x.current.to({duration:.25,opacity:0}),R.current.to({duration:.25,opacity:0}))},$=React$2.useCallback(fe=>{let te=!1;if(fe){const H=S.current;H.setPointersPositions(fe);const W=H.getPointerPosition(),V=x.current.getClientRect({relativeTo:H});te=F({...W,width:1,height:1},V)}return te},[]),B=React$2.useCallback(fe=>fe&&n.uid===JSON.parse(fe).uid,[n.uid]),J=React$2.useCallback(()=>{T(""),h({type:"hidePuzzleButtons",payload:!1}),h({type:"addPoints",complex:!0,finish:!0,payload:D.current}),h({type:"passPuzzle"}),o&&h({type:"consumeItem",payload:{uid:n.uid,targetId:n.uid,name:n.name}}),h({type:"closeUI",ui:"inventory"})},[o,h,n.name,n.uid]),ne=React$2.useCallback(()=>{T("success"),h({type:"hidePuzzleButtons",payload:!0}),D.current=[...D.current,...p.right.rewards],setTimeout(()=>{J()},2e3)},[h,J,p.right.rewards]),ie=React$2.useCallback(()=>{h({type:"openUI",ui:"inventory",onFinish:()=>{}}),T(""),h({type:"hidePuzzleButtons",payload:!1}),h({type:"failPuzzle"}),D.current=[...D.current,...p.wrong.rewards]},[h,p.wrong.rewards]),Y=React$2.useCallback(fe=>{const te=fe.dataTransfer.getData("item");S.current.setPointersPositions(fe);const H=$(fe);h({type:"hidePuzzleButtons",payload:!0}),H&&B(te)?(T("success"),h({type:"closeUI",ui:"inventory"}),t.solution.right.desc===""&&ne()):(h({type:"closeUI",ui:"inventory"}),T("failed"),t.solution.wrong.desc===""&&setTimeout(()=>{ie()},2e3))},[$,B,h,ne,ie,t.solution.right.desc,t.solution.wrong.desc]),q=()=>{v==="success"?ne():ie()};React$2.useEffect(()=>{const fe=e.img.url||"";P.src=fe,P.onload=()=>{E.current&&(g.current={x:E.current.clientWidth/2,y:E.current.clientHeight/2,width:P.width,height:P.height,offsetX:P.width/2,offsetY:P.height/2,scale:{x:Math.min(E.current.clientWidth/P.width,E.current.clientHeight/P.height),y:Math.min(E.current.clientWidth/P.width,E.current.clientHeight/P.height)}},_(!0))}},[P,e.img.url]);const re=fe=>{fe!==null&&(x.current=fe)},ce=fe=>{if(fe!==null&&(R.current=fe,x.current)){const{x:te,y:H,width:W,height:V}=x.current.getClientRect();fe.setAttr("x",te),fe.setAttr("y",H),fe.setAttr("height",V),fe.setAttr("width",W)}};return React$2.useLayoutEffect(()=>{if(x.current&&b){const fe=x.current.getClientRect({relativeTo:x.current.getParent()});C({x:fe.x+fe.width/2,y:fe.y+fe.height/2})}},[b]),jsxRuntimeExports.jsxs("div",{className:"puzzle--drag__mask100",onDrop:Y,onDragOver:fe=>{fe.preventDefault()},children:[jsxRuntimeExports.jsx("div",{className:"puzzle--drag__mask",children:jsxRuntimeExports.jsx("div",{ref:E,"data-testid":"mask_canvas",className:"puzzle--drag__mask--canvas",children:b?jsxRuntimeExports.jsx(Stage,{ref:S,width:E.current.clientWidth,height:E.current.clientHeight,children:jsxRuntimeExports.jsxs(Layer,{children:[jsxRuntimeExports.jsx(Image$2,{image:P,...g.current}),jsxRuntimeExports.jsxs(Group,{...g.current,children:[w?jsxRuntimeExports.jsx(Html,{transform:!0,groupProps:{id:"projection",...w},divProps:{style:{pointerEvents:"none"}},children:jsxRuntimeExports.jsx("div",{style:{width:"50px",height:"50px",pointerEvents:"none"},id:"object-area-projection"})}):null,jsxRuntimeExports.jsx(Line,{onMouseEnter:M,onMouseLeave:U,ref:re,...l,shape:"poly",fill:"#262a31d9",stroke:"white",strokeWidth:1,opacity:0,dash:[3,2],closed:!0,draggable:!1})]}),jsxRuntimeExports.jsx(Text,{onMouseEnter:M,onMouseLeave:U,ref:ce,text:k("puzzle.drag.dropzone"),fontSize:12,align:"center",verticalAlign:"middle",fill:"#ffffff",opacity:0})]})}):null})}),v!==""?jsxRuntimeExports.jsx(FeedbackComponent$1,{text:t.solution[v==="success"?"right":"wrong"].desc,success:v==="success",translate:k,playSound:N,functionOnClose:q,keyboardControl:u}):null]})}const LABELS_INDEX$1=["A","B","C","D","E","F","G","H","I","J"];function Questions({disabled:l,answered:e,question:n,updateForm:t,result:a,correctQuestions:o,translate:d}){const[h,f]=React$2.useState(!1),u=n.answers.filter(v=>v.text),p=v=>{let T=!1;return a[n.id].find(b=>b.id===v)&&(T=!0),T},x=v=>{let T="";return h?(e&&p(v.id)&&(T="selected"),l&&p(v.id)&&o.includes(v.id)&&(T="success"),l&&p(v.id)&&!o.includes(v.id)&&(T="failed")):(e&&v.id===a[n.id][0].id&&(T="selected"),l&&v.id===a[n.id][0].id&&(T=a[n.id][0].isCorrect?"success":"failed")),T},R=v=>{const T=x(v);return T==="selected"?"icon-check-circle-black color--selected":T==="success"?"icon-check-circle-black color--success":T==="failed"?"icon-error-circle-black color--error":""},S=v=>l&&v.feedback&&(h&&p(v.id)||v.id===a[n.id][0].id),E=(v,T)=>T===0?"tooltip--right__top":T===v.length-1?"tooltip--right__bottom":"tooltip--center__right",g=n.answers.filter(v=>v.isCorrect);return React$2.useEffect(()=>{g.length===1?f(!1):f(!0)},[g.length,h,n.answers]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"test--questions__item",children:jsxRuntimeExports.jsx("span",{children:n.text})}),h&&!l?jsxRuntimeExports.jsx("div",{className:"test--questions__intertitle test--questions__intertitle--multiresponse",children:d("tests.chooseMoreOneAnswer")}):null,u.map((v,T)=>jsxRuntimeExports.jsxs("div",{className:"test--response__fakeinput",children:[h?jsxRuntimeExports.jsx("input",{checked:e&&p(v.id),disabled:l&&!p(v.id),readOnly:l,type:"checkbox",id:v.id,onChange:()=>l?null:t(v,n.id,T,"isCheckbox",v.id)}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("input",{checked:e&&v.id===a[n.id][0].id,disabled:l&&!x(v),type:"radio",name:"name",id:v.id,onChange:()=>l?null:t(v,n.id,T,"isRadio")})}),jsxRuntimeExports.jsxs("label",{htmlFor:v.id,className:`test--response__item ${x(v)}`,children:[jsxRuntimeExports.jsx("div",{className:"test--response__index",children:LABELS_INDEX$1[T]}),jsxRuntimeExports.jsx("div",{className:"test--response__text",children:jsxRuntimeExports.jsx("span",{children:v.text})}),jsxRuntimeExports.jsx("div",{className:`test--response__icon ${R(v)}`})]}),l?jsxRuntimeExports.jsxs("div",{className:`test--feedback__info ${S(v)?"":"test--feedback__info--hidden"}`,children:[jsxRuntimeExports.jsx("span",{className:`icon-info2 ${x(v)==="success"?"color--success":"color--error"}`}),jsxRuntimeExports.jsxs("div",{id:`tooltipFeedback-${T}`,className:`tooltip ${E(u,T)}`,children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx("b",{children:jsxRuntimeExports.jsx("span",{children:d("test.feedback")})})}),jsxRuntimeExports.jsx("span",{children:jsxRuntimeExports.jsx("span",{children:v.feedback})})]})]}):null]},v.text))]})}const LABELS_INDEX=["A","B","C","D","E","F","G","H","I","J"];function FeedbackItem({selectedAnswers:l,correctQuestions:e,question:n,translate:t}){const a=h=>e.includes(h),o=(h,f)=>h.index<f.index?-1:h.index>f.index?1:0,d=l.sort(o);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"test--questions__item",children:jsxRuntimeExports.jsx("span",{children:n})}),d.map(h=>jsxRuntimeExports.jsxs("div",{className:"test--response__itemwrap",children:[jsxRuntimeExports.jsxs("div",{className:`test--response__item ${a(h.id)?"success":"failed"}`,children:[jsxRuntimeExports.jsx("div",{className:"test--response__index",children:LABELS_INDEX[h.index]}),jsxRuntimeExports.jsx("div",{className:"test--response__text",children:jsxRuntimeExports.jsx("span",{children:h.text})}),jsxRuntimeExports.jsx("div",{className:`test--response__icon ${a(h.id)?"icon-check-circle-black color--success":"icon-error-circle-black color--error"}`})]}),jsxRuntimeExports.jsxs("div",{className:"test--feedback",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx("b",{children:jsxRuntimeExports.jsxs("span",{children:[t("test.feedback")," ",l.length>1?LABELS_INDEX[h.index]:""]})})}),jsxRuntimeExports.jsx("span",{children:h.feedback})]})]},h.text))]})}function Container({questions:l,setTime:e,saveInterval:n,result:t,setTries:a,tries:o,time:d,showResults:h,answered:f,answerPage:u,updateForm:p,disabled:x,translate:R,soundActions:S,paused:E,view:g,correctQuestions:v,feedbacksOnlyWhenReview:T}){const b=document.querySelector(".test--container"),[_,w]=React$2.useState(0),[C,P]=React$2.useState(),D=l[_].id,[N]=S;React$2.useEffect(()=>{if(d>=0&&!x&&!E){const ne=setInterval(()=>{C||e(ie=>ie-1)},1e3);return n(ne),()=>{clearInterval(ne)}}},[x,C,E,n,e,d]);const k=()=>{b.scrollTo(0,0),N("click-ui"),f&&(t[D][0].feedback&&!x&&!T?P(!0):(u(!1),w(_+1)))},F=()=>{N("click-ui"),w(_-1)},M=()=>{b.scrollTo(0,0),l[_+1]?(P(!1),u(!1),w(_+1)):h()},U=()=>{b.scrollTo(0,0),a(o+1),t[D][0].feedback&&!x&&!T?P(!0):h()},$=Math.floor(d/60),B=d%60;React$2.useEffect(()=>{if(g==="review"){const ne=t[`q${_}`][0].id,ie=document.querySelector(`#${ne}`);b.scrollTo(0,ie.offsetTop)}},[_,b,t,g]);const J=()=>{if(f){const ne=v[l[_].id.substring(1)].answers,ie=t[D],Y=ie.find(re=>re.isCorrect===!1);let q=0;return ie.forEach(re=>{ne.includes(re.id)&&(q+=1)}),!Y&&q===ne.length}return!1};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[g==="review"||C?jsxRuntimeExports.jsx("div",{className:`test-feedback-header ${J()?"success":"failed"}`,children:jsxRuntimeExports.jsxs("h2",{children:[jsxRuntimeExports.jsx("span",{className:`${J()?"icon-correct-thumb":"icon-incorrect-thumb"}`}),jsxRuntimeExports.jsx("span",{className:"test-feedback-header__title",children:J()?R("tests.resolvedQuestion"):R("tests.notResolvedQuestion")})]})}):null,jsxRuntimeExports.jsxs("div",{className:"test--questions",children:[jsxRuntimeExports.jsx("div",{className:"test--questions__container",children:C?jsxRuntimeExports.jsx(FeedbackItem,{selectedAnswers:t[D],correctQuestions:v[l[_].id.substring(1)].answers,question:l[_].text,translate:R}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"test--questions__intertitle",children:[jsxRuntimeExports.jsx("div",{children:LangIsRtl()?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[_+1,"/",l.length," ",jsxRuntimeExports.jsx("span",{children:R("tests.question")})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("span",{children:R("tests.question")})," ",_+1,"/",l.length]})}),g!=="review"&&d>=0?jsxRuntimeExports.jsx("div",{dir:"ltr",className:`count-down ${d<10?"count-down--finalseconds":""}`,children:jsxRuntimeExports.jsxs("div",{id:"test-time",children:[$<10?`0${$}`:$," : ",B<10?`0${B}`:B]})}):null]}),jsxRuntimeExports.jsx(Questions,{result:t,disabled:x,answered:f,updateForm:p,question:l[_],correctQuestions:x?v[l[_].id.substring(1)].answers:[],translate:R},l[_].id)]})}),jsxRuntimeExports.jsxs("div",{className:`test--buttons ${g==="review"?"reviewmode":"next"}`,children:[g==="review"?jsxRuntimeExports.jsx("button",{disabled:_===0,id:"back-button",onClick:()=>F(),type:"button",className:`gat--btn__navigation ${_===0?"disabled":""}`,"aria-label":LangIsRtl()?R("survey.next"):R("survey.previous"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-next":"icon-back"})}):null,!C&&l[_+1]?jsxRuntimeExports.jsx("button",{disabled:!f,id:"next-button",onClick:()=>k(),type:"button",className:`gat--btn__navigation ${f?"":"disabled"}`,"aria-label":LangIsRtl()?R("survey.previous"):R("survey.next"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})}):null,C?jsxRuntimeExports.jsx("button",{id:"next-button",onClick:()=>M(),type:"button",className:"gat--btn__navigation",children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})}):null,!C&&l[_].id.substring(1)===(l.length-1).toString()?jsxRuntimeExports.jsx("button",{disabled:!f,id:"finish-button",onClick:()=>{N("click-ui"),f&&U()},type:"button",className:`gat--btn__navigation ${f?"":"disabled"}`,"aria-label":LangIsRtl()?R("survey.previous"):R("survey.next"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})}):null]})]})]})}function ResultsComponent({result:l,time:e,mandatory:n,correctQuestions:t,isFirst:a,reviewTest:o,finishTest:d,restartTest:h,timeOver:f,timeOverText:u,emitEvent:p,minimumPercentage:x}){const[R,S]=React$2.useState(0),[E,g]=React$2.useState(),[v,T]=React$2.useState([]),[b,_]=React$2.useState([]),[w,C]=React$2.useState([]),P=React$2.useCallback(()=>{const ie=[];return t.forEach(Y=>ie.push(Y.answers)),ie},[t]),D=React$2.useCallback(()=>{const ie=[];return Object.values(l).forEach(Y=>{if(Y.length>1){const q=Y.find(ce=>ce.isCorrect===!1),re=[];q?ie.push([]):(Y.forEach(ce=>{ce.isCorrect&&re.push(ce.id)}),ie.push(re))}else Y[0].isCorrect?ie.push([Y[0].id]):Y[0].isCorrect===!1&&ie.push("")}),ie},[l]),N=React$2.useCallback(()=>{let ie=0;return b.length>0&&v.forEach((Y,q)=>{Y.length>1?Y.every(re=>b[q].includes(re))&&(ie+=1):Y.length===1&&b[q]&&Y[0]===b[q][0]&&(ie+=1)}),ie},[v,b]);React$2.useEffect(()=>{T(P),_(D),C(N)},[P,D,N]);const k=t.length,F=N()===k,M=w<x,U=w>=x,$=!n||U,B=Math.trunc(R/k*100),J=(ie,Y)=>p({type:"translate",payload:ie,values:Y}),ne={"--chart-color":"var(--color-error)"};return React$2.useEffect(()=>{if(R<w){const ie=setInterval(()=>{S(Y=>Y+1)},100);return g(ie),()=>{clearInterval(ie)}}},[w,R]),React$2.useEffect(()=>{R>=w&&clearInterval(E)},[w,E,R]),jsxRuntimeExports.jsxs("div",{className:`test--results ${M||f?"test--results--failed":""}`,children:[a&&F?jsxRuntimeExports.jsxs("div",{className:"fireworks",children:[jsxRuntimeExports.jsx("div",{className:"before"}),jsxRuntimeExports.jsx("div",{className:"after"})]}):null,!f&&M?jsxRuntimeExports.jsx("div",{className:"test--results__title",children:jsxRuntimeExports.jsx("span",{children:J("tests.NotFinishedSuccessfully")})}):null,!f&&U||F?jsxRuntimeExports.jsx("div",{className:"test--results__title",children:jsxRuntimeExports.jsx("span",{children:J("tests.finishedSuccessfully")})}):null,f?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"test--results__title",children:jsxRuntimeExports.jsx("span",{children:u})}),jsxRuntimeExports.jsx("div",{className:"test--results__time",id:"results-time",children:jsxRuntimeExports.jsx("span",{children:J("tests.time",e)})})]}):null,jsxRuntimeExports.jsxs("div",{className:`chart center chart${B}`,children:[jsxRuntimeExports.jsxs("div",{className:"chart-slice",children:[jsxRuntimeExports.jsx("div",{className:"chart-bar",style:M||f?ne:{}}),jsxRuntimeExports.jsx("div",{className:"chart-fill",style:M||f?ne:{}})]}),jsxRuntimeExports.jsxs("span",{className:"chart-value",children:[jsxRuntimeExports.jsxs("div",{className:"test--results__chart",children:[jsxRuntimeExports.jsx("span",{children:R}),jsxRuntimeExports.jsxs("span",{children:["/",k]})]}),jsxRuntimeExports.jsx("div",{className:"test--results__chart--label",children:jsxRuntimeExports.jsx("span",{children:J("tests.success")})})]})]}),jsxRuntimeExports.jsxs("div",{className:"test--results__minimum",children:[jsxRuntimeExports.jsx("div",{className:"icon-bell"}),jsxRuntimeExports.jsx("div",{children:J("tests.minimumQuestionsMessage",{minimumPercentage:x})})]}),jsxRuntimeExports.jsxs("div",{className:"test--results__buttons",children:[f?null:jsxRuntimeExports.jsx("button",{className:"gat--btn gat--btn__secondary",id:"review-button",onClick:()=>o(),type:"button",children:jsxRuntimeExports.jsx("span",{children:J("tests.review")})}),$?null:jsxRuntimeExports.jsx("button",{className:"gat--btn gat--btn__primary",id:"restart-button",onClick:()=>h(),type:"button",children:jsxRuntimeExports.jsx("span",{children:J("tests.restart")})}),$?jsxRuntimeExports.jsx("button",{className:"gat--btn gat--btn__primary",id:"finish-button",onClick:()=>d(),type:"button",children:jsxRuntimeExports.jsx("span",{children:J("tests.continue")})}):null]})]})}function TestComponent({test:l,countdown:e={},emitEvent:n,soundActions:t,audio:a,required:o,pause:d,minimumPercentage:h=100,feedbacksOnlyWhenReview:f}){const{questions:u}=l,[p,x]=React$2.useState({}),[R,S]=React$2.useState(),[E,g]=React$2.useState(0),[v,T]=React$2.useState([]),[b,_]=React$2.useState(e.time),[w,C]=React$2.useState(!1),[P,D]=React$2.useState("test"),[N,k]=React$2.useState(!0),[F,M]=React$2.useState({}),[U,$]=React$2.useState({}),[B,J]=React$2.useState(!1),ne=o||l.required||!1,ie=React$2.useRef({}),[Y,q]=React$2.useState(),[re,ce]=t,fe=(Q,ee,le,ue,he)=>{const ve={...Q,index:le};if(E>0&&(ve.rewards=ve.rewards.filter(Re=>!U[Q.id]||Re.points<0)),p[ee]){const Re=p[ee].find(Le=>Le.id===he);if(Re){if(Re.id===Q.id){const Le=p[ee].find(Ke=>Ke.id===he),Oe=p[ee].indexOf(Le);if(p[ee].splice(Oe,1),p[ee].length===0){C(!1);return}}}else p[ee].push(ve)}else p[ee]=[ve];let be;ue==="isRadio"?be={...p,[ee]:[ve]}:be={...p},x(be),M(be),$({...U,[Q.id]:{...Q}}),C(!0)};React$2.useEffect(()=>{a!=null&&a.url&&re(a.url,"tts")},[re,a]);const te=u.map(Q=>{const ee=Q.answers.filter(ue=>ue.isCorrect),le=[];return ee.forEach(ue=>{le.push(ue.id)}),{question:Q.id,answers:le}});React$2.useEffect(()=>{T(te)},[te]),React$2.useEffect(()=>{if(h){const Q=Math.ceil(u.length*h/100);q(Q)}},[u.length,h]),React$2.useEffect(()=>{b===0&&(clearInterval(R),C(!1),J(!0),D("results"),ce("tts"))},[R,ce,b]);const H=()=>{clearInterval(R),C(!1),D("results");const Q={...F};M(Q),ce("tts")},W=()=>{const Q={correctQuestions:v.length,result:p,status:"resolved"};Object.keys(p).forEach(le=>{p[le].forEach(ue=>{ie.current[ue.id]&&(ue.rewards=[])})}),n({type:"saveTest",payload:Q})},V=()=>{const Q=()=>{M({}),$({}),D("test"),x({}),_(e.time),J(!1),a!=null&&a.url&&re(a.url,"tts")},ee=Object.values(p);ee.forEach(ue=>{ue.forEach(he=>{he.isCorrect&&(ie.current[he.id]?he.rewards=[]:ie.current[he.id]=!0)})});let le=ee.reduce((ue,he)=>{const ve=[];return he.forEach(be=>{ve.push(be.rewards)}),[...ue,...ve.flat()]},[]);B&&e.rewards&&(le=[...le,...e.rewards]),n({type:"addPoints",payload:le,complex:!0,finish:!1,onFinish:Q}),n({type:"failTest"})},z=(Q,ee)=>n({type:"translate",payload:Q,values:ee});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"test--container__overlay"}),jsxRuntimeExports.jsx("div",{className:"test--container",dir:"auto",children:P!=="results"?jsxRuntimeExports.jsx(Container,{result:p,time:b,setTries:g,tries:E,answerPage:C,setTime:_,paused:d,saveInterval:S,disabled:P!=="test",answered:w||P!=="test",questions:u,updateForm:fe,showResults:H,translate:z,soundActions:t,view:P,correctQuestions:v,feedbacksOnlyWhenReview:f}):jsxRuntimeExports.jsx(ResultsComponent,{reviewTest:()=>{k(!1),D("review")},isFirst:N,finishTest:W,time:b,mandatory:ne,restartTest:V,result:p,correctQuestions:v,timeOver:B,timeOverText:e.text,emitEvent:n,soundActions:t,minimumPercentage:Y})})]})}const OPTIONS=["yes","no"],LETTERS=["A","B"];function ApplicableBox({setSurveyData:l,survey:e,id:n,translate:t,changePage:a}){const o=d=>{l({...e,[n]:d}),a()};return jsxRuntimeExports.jsx("div",{className:"survey--page__item",children:OPTIONS.map((d,h)=>jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>o(d),className:`unset-button survey--response__item ${e[n]===d?"selected":""}`,children:[jsxRuntimeExports.jsx("div",{className:"survey--response__index",children:LETTERS[h]}),jsxRuntimeExports.jsx("div",{className:"survey--response__text",children:t(`survey.${d}`)})]},d))})}const OPINION_OPTIONS=[0,1,2,3,4,5,6,7,8,9,10];function OpinionBox({setSurveyData:l,survey:e,id:n,translate:t,changePage:a}){const o=d=>{l({...e,[n]:d}),a()};return jsxRuntimeExports.jsxs("div",{className:"survey--page__item","aria-label":"opinion box",children:[jsxRuntimeExports.jsx("div",{className:"survey--points",children:OPINION_OPTIONS.map(d=>jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>o(d),className:`unset-button survey--points__item survey--points__item--colorized ${e[n]===d?"selected":""}`,children:d},d))}),jsxRuntimeExports.jsxs("div",{className:"survey--points__labels",children:[jsxRuntimeExports.jsx("span",{children:t("survey.bad")}),jsxRuntimeExports.jsx("span",{children:t("survey.excellent")})]})]})}function TextBox({setSurveyData:l,survey:e,id:n,literalLabel:t}){const a=o=>{l({...e,[n]:o})};return jsxRuntimeExports.jsx("div",{className:"survey--page__item",children:jsxRuntimeExports.jsx("textarea",{ref:o=>{o&&o.focus()},className:"survey--textarea",id:t,value:e[n],onChange:o=>a(o.target.value)})})}const INIT_SURVEY={applicable:"",opinion:"",comments:"",suggestions:""},PAGES=[{component:ApplicableBox,id:"applicable"},{component:OpinionBox,id:"opinion"},{component:TextBox,id:"comments"},{component:TextBox,id:"suggestions"}];function SurveyComponent({emitEvent:l,soundActions:e}){const[n,t]=React$2.useState(INIT_SURVEY),[a,o]=React$2.useState(0),[d,h]=React$2.useState(!1),[f]=e,u=(R,S)=>l({type:"translate",payload:R,values:S}),p=(R=!1)=>{if(f("click-ui"),!R&&a+1>=PAGES.length)h(!0);else{R&&h(!1);const S=R?a-1:a+1;o(S)}},x=PAGES[a].component;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"survey--container__overlay"}),jsxRuntimeExports.jsx("div",{className:"survey--container",dir:"auto",children:jsxRuntimeExports.jsxs("div",{className:"survey--questions",children:[jsxRuntimeExports.jsxs("div",{className:"survey--questions__container",children:[jsxRuntimeExports.jsxs("div",{className:"survey--questions__intertitle",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx("span",{children:u("survey.numQuestion",{init:a+1,page:PAGES.length})})}),jsxRuntimeExports.jsx("div",{children:u("auto-evaluation.allQuestionsMandatory")})]}),jsxRuntimeExports.jsx("label",{className:"survey--questions__item",htmlFor:u(`survey.question${a+1}`,{ordinal:a+1}),children:u(`survey.question${a+1}`,{ordinal:a+1})}),jsxRuntimeExports.jsx(x,{setSurveyData:t,id:PAGES[a].id,survey:n,translate:u,changePage:R=>p(!1),literalLabel:u(`survey.question${a+1}`,{ordinal:a+1})})]}),jsxRuntimeExports.jsxs("div",{className:"test--buttons next",children:[jsxRuntimeExports.jsx("button",{id:"survey-button-back",type:"button",disabled:a===0,onClick:()=>p(!0),className:`gat--btn__navigation ${a===0?"disabled":""}`,"aria-label":LangIsRtl()?u("survey.next"):u("survey.previous"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-next":"icon-back"})}),d&&a===PAGES.length-1?jsxRuntimeExports.jsx("button",{id:"survey-button",type:"button",disabled:!n[PAGES[a].id],onClick:()=>{f("click-ui"),l({type:"saveSurvey",payload:n})},className:`gat--btn gat--btn__primary ${n[PAGES[a].id]?"":"disabled"} not-transition`,children:u("survey.finish")}):null,!d&&a!==PAGES.length?jsxRuntimeExports.jsx("button",{id:"survey-button",type:"button",disabled:!n[PAGES[a].id],onClick:()=>p(!1),className:`gat--btn__navigation ${n[PAGES[a].id]?"":"disabled"}`,"aria-label":LangIsRtl()?u("survey.previous"):u("survey.next"),children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})}):null]})]})})]})}function EndScreen({onFinish:l,translate:e}){return React$2.useEffect(()=>{let n;return l&&(n=setTimeout(()=>{l()},2e3)),()=>{n&&clearTimeout(n)}},[l]),jsxRuntimeExports.jsx("div",{"data-testid":"endScreen",className:"auto-evaluation__endscreen","aria-label":"auto evaluation endscreen",children:jsxRuntimeExports.jsxs("div",{className:"auto-evaluation__finishband","aria-label":"auto evaluation finishband",children:[jsxRuntimeExports.jsx("span",{className:"icon-check-laptop auto-evaluation__iconendscreen","aria-label":"icon-check",role:"img"}),jsxRuntimeExports.jsx("span",{className:"auto-evaluation__thanks","aria-label":"auto evaluation thanks",role:"contentinfo",children:e("auto-evaluation.thanks")})]})})}function StartScreen({onNext:l,description:e,translate:n}){return jsxRuntimeExports.jsxs("div",{className:"auto-evaluation__startscreen",role:"alertdialog","aria-modal":"true","aria-label":"ae start screen",children:[jsxRuntimeExports.jsx("span",{className:"icon-happy-laptop auto-evaluation__starticon","aria-label":"icon laptop",role:"img"}),jsxRuntimeExports.jsx("div",{className:"auto-evaluation__starttext","aria-label":"desciption",children:jsxRuntimeExports.jsx("span",{children:e})}),jsxRuntimeExports.jsx("button",{"data-testid":"auto-start-button",type:"button",className:"gat--btn gat--btn__primary auto-evaluation__button auto-evaluation__button--start",onClick:l,children:jsxRuntimeExports.jsx("span",{children:n("auto-evaluation.start")})})]})}function AutoEvaluation({description:l,questions:e,type:n,emitEvent:t,soundActions:a}){var w,C,P;const[o,d]=React$2.useState(null),[h,f]=React$2.useState("start"),[u,p]=React$2.useState(!1),[x,R]=React$2.useState(0),[S,E]=React$2.useState({current:{questions:[],type:n}}),[g]=a,v=D=>t({type:"translate",payload:D}),T=D=>{D.code==="Enter"&&D.target.blur()},b=()=>{g("click-ui"),t({type:"saveSurveyPrePos",payload:S.current})};React$2.useEffect(()=>{!e.length&&h==="questions"&&f("end")},[e,h]);const _=(D,N=!1)=>{var F;const k=D!==null?D:(F=S.current.questions.find(M=>M.id===e[x].id))==null?void 0:F.answer;if(g("click-ui"),N)R(x-1),p(!1);else{const M=S.current.questions.findIndex($=>$.id===e[x].id),U=[...S.current.questions];M>-1?U.splice(M,1,{id:e[x].id,answer:k}):U.push({id:e[x].id,answer:k}),E({...S,current:{...S.current,questions:U}}),x===e.length-1?p(!0):(R(x+1),p(!1))}};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"test--container__overlay","aria-label":"test container overlay"}),jsxRuntimeExports.jsxs("div",{className:"test--container",dir:"auto","aria-label":"test container",children:[h==="start"&&jsxRuntimeExports.jsx(StartScreen,{description:l,onNext:()=>{f("questions"),g("click-ui")},translate:v}),h==="questions"&&jsxRuntimeExports.jsxs("div",{"data-testid":"survey--questions",className:"survey--questions","aria-label":"survey questions",children:[jsxRuntimeExports.jsxs("div",{className:"survey--questions__container","aria-label":"survey questions container",children:[jsxRuntimeExports.jsxs("div",{className:"survey--questions__intertitle",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsxs("span",{children:[v("auto-evaluation.question")," ",x+1," ",v("storylines.misc.of")," ",e.length]})}),jsxRuntimeExports.jsx("div",{children:v("auto-evaluation.allQuestionsMandatory")})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{className:"survey--questions__item","aria-label":"survey questions item",children:(w=e[x])==null?void 0:w.text}),jsxRuntimeExports.jsx("div",{className:"survey--page__item","aria-label":"survey page item",children:jsxRuntimeExports.jsx("div",{className:"survey--points","aria-label":"survey points",children:Array(11).fill(0).map((D,N)=>{var k;return jsxRuntimeExports.jsx("button",{"data-testid":`button-option-${0+N}`,type:"button",onTouchStart:()=>{d(N)},onTouchEnd:()=>{d(null)},onKeyUp:F=>{T(F)},onClick:()=>{_(N,!1)},className:`survey--points__item survey--points__item--simple ${((k=S.current.questions[x])==null?void 0:k.answer)===N||o===N?"selected":""}`,children:N},`${0+N}`)})})})]},`${e[x]}`)]}),jsxRuntimeExports.jsxs("div",{className:"test--buttons next","aria-label":"test buttons",children:[jsxRuntimeExports.jsx("button",{"data-testid":"back-button",type:"button",disabled:x===0,onClick:()=>_(null,!0),"aria-label":LangIsRtl()?v("survey.next"):v("survey.previous"),className:`gat--btn__navigation ${x===0?"disabled":""}`,children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-next":"icon-back","aria-label":"icon button"})}),u?jsxRuntimeExports.jsx("button",{"data-testid":"finish-button",type:"button",onClick:()=>{f("end"),g("click-ui")},className:`gat--btn gat--btn__primary auto-evaluation__button not-transition
253
- `,children:jsxRuntimeExports.jsx("span",{children:v("auto-evaluation.end")})}):jsxRuntimeExports.jsx("button",{"data-testid":"forward-button",type:"button",onClick:()=>_(null,!1),disabled:((C=S.current.questions[x])==null?void 0:C.answer)===void 0,"aria-label":LangIsRtl()?v("survey.previous"):v("survey.next"),className:`gat--btn__navigation ${((P=S.current.questions[x])==null?void 0:P.answer)===void 0?"disabled":""}`,children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})]})]}),h==="end"&&jsxRuntimeExports.jsx(EndScreen,{onFinish:b,translate:v})]})]})}function PatternComponent({img:l,name:e,viewed:n,emitEvent:t,soundActions:a,keyboardControl:o}){const[d]=a,h=x=>t({type:"translate",payload:x}),f=()=>{d("click-ui"),t({type:"emitSavePattern",payload:{imgId:l.resourceId,name:e,viewed:!0,url:p,type:"pattern"}})},u=o({disabled:n,forward:f,escape:f});if(React$2.useEffect(()=>u(),[u]),!l)return null;const p=l.url;return jsxRuntimeExports.jsx("div",{className:n?"notes--results":"readings--container pattern-wrap--overlay",children:jsxRuntimeExports.jsx("div",{className:n?"notes--results__text":"pattern-wrap",children:n?jsxRuntimeExports.jsx("div",{children:p&&jsxRuntimeExports.jsx("img",{src:p,alt:"pattern"})}):jsxRuntimeExports.jsxs("div",{className:"pattern",children:[jsxRuntimeExports.jsxs("div",{className:"pattern__header",children:[jsxRuntimeExports.jsx("div",{className:"pattern__title",children:h("phone.pattern")}),jsxRuntimeExports.jsx("button",{type:"button","aria-label":h("storylines.misc.closePiece"),className:"pattern__close gat--btn__round gat--btn__close",onClick:()=>f(),children:jsxRuntimeExports.jsx("span",{className:"icon-close"})})]}),jsxRuntimeExports.jsx("figure",{className:"pattern__figure",children:p&&jsxRuntimeExports.jsx("img",{src:p,alt:"pattern"})})]})})})}const getRecursiveJSX=(l,e=0,n,t,a)=>{var o,d;if((o=l.props)!=null&&o.children){const h=l.type,{children:f,...u}=l.props;if(l.props["data-text-id"]){if(u.dir="auto",u.onClick=p=>t(p,u["data-text-id"]||-1),n!=null&&n.hasHighlights){const p=[...n.correctTexts,...n.wrongTexts];for(let x=0;x<p.length;x+=1)u["data-text-id"]===p[x].id&&(u.className="text-click__hover-correct")}}else n!=null&&n.allWrong&&!l.props["data-text-id"]&&(u.onClick=p=>t(p,"allWrong"));return Array.isArray(f)?jsxRuntimeExports.jsx(h,{...u,children:f.map((p,x)=>getRecursiveJSX(p,x,n,t))},`${l.type}_${e}`):jsxRuntimeExports.jsx(h,{...u,children:getRecursiveJSX(f,e,n,t)},`${l.type}_${e}`)}return((d=l.props)==null?void 0:d.children)!==null?l.split(" ").filter(h=>h!=="").map(h=>jsxRuntimeExports.jsx("span",{dir:"auto",children:h},h)):null};function TextClickPuzzleComponent({emitEvent:l,showFrames:e,styles:n,list:t,soundActions:a,description:o,setInfo:d,setResolveAction:h,keyboardControl:f,backgroundImage:u,hideBackgroundImageTheme:p=!1,nodeId:x}){const R=`textclick-puzzle_${x}`,[S,E]=React$2.useState({result:null,show:!1,text:"",timeout:!1}),[g]=a,[v,T]=React$2.useState(0),[b,_]=React$2.useState(0),[w,C]=React$2.useState(0),P=React$2.useRef(0),D=React$2.useRef([]),[N,k]=React$2.useState(0),[F,M]=React$2.useState(),U=React$2.useCallback(V=>l({type:"translate",payload:V}),[l]),$=React$2.useRef(null),B=React$2.useCallback(()=>P.current===t[v].correctTexts.length||t[v].hasClickOnce&&P.current>=1,[v,t]),J=React$2.useCallback((V,z)=>{V&&l({type:"hidePuzzleButtons",payload:!0}),E(Q=>({...Q,show:V,...z}))},[l]),ne=React$2.useCallback(()=>{if(B())if(E(V=>({...V,result:!1})),P.current=0,w===b){const V=D.current.reduce((z,Q)=>{const ee=z.findIndex(le=>le.id===Q.id);return ee>=0?z[ee].points+=Q.points:z.push({...Q}),z},[]);l({type:"addPoints",complex:!0,finish:!0,payload:V}),l({type:"passPuzzle"})}else $.current=null,T(v+1),k(0),M(!0),setTimeout(()=>{M(!1)},1200)},[B,w,b,l,v]),ie=React$2.useCallback(()=>{l({type:"hidePuzzleButtons",payload:!1}),ne(),E(z=>({...z,show:!1,text:""}));const V=document.querySelectorAll(".text-click__failed");V.length>0&&V.forEach(z=>z.classList.remove("text-click__failed"))},[l,ne]),Y=React$2.useCallback((V,z)=>{var Q,ee;V.forEach(le=>le.classList.add("text-click__success")),C(w+1),P.current+=1,g("score"),(Q=t[v].info.solution.right)!=null&&Q.desc?B()&&(D.current=[...D.current,...t[v].info.solution.right.rewards],J(!0,{result:!0,text:t[v].info.solution.right.desc,timeout:!1})):t[v].info.solution.right.desc===""&&(z!=null&&z.desc)?(D.current=((ee=z==null?void 0:z.rewards)==null?void 0:ee.length)>0?[...D.current,...(z==null?void 0:z.rewards)||{}]:[...D.current],J(!0,{result:!0,text:z.desc,timeout:!1})):t[v].specificFeedbacks.specificCorrectFeedbacks?(D.current=[...D.current,...(z==null?void 0:z.rewards)||{}],B()&&J(!0,{result:!0,timeout:!0})):B()&&(D.current=[...D.current,...t[v].info.solution.right.rewards],J(!0,{result:!0,timeout:!0}))},[w,g,t,v,B,J]),q=React$2.useCallback((V,z)=>{var Q;V.forEach(ee=>ee.classList.add("text-click__failed")),g("fail"),l({type:"failPuzzle"}),t[v].info.solution.wrong.desc!==""?(D.current=[...D.current,...t[v].info.solution.wrong.rewards],J(!0,{result:!1,text:t[v].info.solution.wrong.desc,timeout:!1})):t[v].info.solution.wrong.desc===""&&(z!=null&&z.desc)?(D.current=(Q=z==null?void 0:z.rewards)!=null&&Q.length?[...D.current,...(z==null?void 0:z.rewards)||{}]:[...D.current],J(!0,{result:!1,text:z.desc,timeout:!1})):t[v].specificFeedbacks.specificWrongFeedbacks?(D.current=[...D.current,...(z==null?void 0:z.rewards)||{}],J(!0,{result:!1,timeout:!0})):(D.current=[...D.current,...t[v].info.solution.wrong.rewards],J(!0,{result:!1,timeout:!0}))},[g,l,t,v,J]),re=React$2.useCallback((V,z)=>{var be,Re,Le,Oe;V.stopPropagation();const Q=document.querySelectorAll(`[data-text-id="${z}"]`),ee=document.querySelectorAll("[data-text-id]"),le=t[v].correctTexts.find(Ke=>Ke.id===z),ue=t[v].wrongTexts.find(Ke=>Ke.id===z),he=(Re=(be=t[v])==null?void 0:be.specificFeedbacks)==null?void 0:Re.correctFeedbacks.find(Ke=>Ke.id===z),ve=(Oe=(Le=t[v])==null?void 0:Le.specificFeedbacks)==null?void 0:Oe.wrongFeedbacks.find(Ke=>Ke.id===z);g("click-ui"),t[v].hasClickOrder?t[v].correctTexts[N].id===z?(k(N+1),Y(Q,he)):t[v].correctTexts.find(Ke=>Ke.id===z)&&t[v].correctTexts[N].id!==z?(ee.forEach(Ke=>Ke.classList.remove("text-click__success")),k(0),C(0),P.current=0,J(!0,{result:!1,text:t[v].info.orderFeedback.desc||U("puzzles.incorrectOrder"),timeout:!1}),T(0)):q(Q,ve):(le==null?void 0:le.id)===z?Y(Q,he):((ue==null?void 0:ue.id)===z||z==="allWrong")&&q(Q,ve)},[t,v,g,N,Y,J,U,q]),ce=React$2.useCallback(V=>getRecursiveJSX(V,0,t[v],re),[v,t,re]),fe=React$2.useCallback(()=>{let V=0;for(let z=0;z<t.length;z+=1)if(t[z].hasClickOnce)V+=1,_(V);else for(let Q=0;Q<t[z].correctTexts.length;Q+=1)V+=1,_(V)},[t]);React$2.useEffect(()=>{var V;if(t!=null&&t[v]&&d({...t[v].info,description:o}),(V=t[v])!=null&&V.text){const z=HTMLReactParser$1(t[v].text);$.current=ce(z),fe()}else $.current=""},[v,o,fe,t,ce,d]);const te=()=>{for(let V=0;V<D.current.length;V=V+1)if(D.current[V].points>0)return!0;return!1};React$2.useEffect(()=>{h(()=>{l({type:"hidePuzzleButtons",payload:!0});const V=document.querySelectorAll(".text-click [data-text-id]"),z=t[v].correctTexts.map(ee=>ee.id);V.forEach(ee=>{z.includes(ee.getAttribute("data-text-id"))&&ee.classList.add("text-click__success")});const Q=t[v].info.resolve.rewards;v+1<t.length?(setTimeout(()=>{l({type:"puzzleAction",action:"addPoints",payload:{element:R,rewards:Q,finish:!1,payload:Q}});let ee=0;t.forEach((le,ue)=>{ue<=v&&(ee+=le.correctTexts.length)}),C(ee),$.current=null,P.current=0,M(!0),T(v+1)},2e3),setTimeout(()=>{M(!1),l({type:"hidePuzzleButtons",payload:!1})},3200)):v+1>=t.length&&te()?setTimeout(()=>{Q.forEach(ee=>{D.current.forEach(le=>{le.id===ee.id&&(ee.points=ee.points+le.points)})}),l({type:"puzzleAction",action:"resolve",payload:{element:R,rewards:Q,finish:!0}})},2e3):setTimeout(()=>{l({type:"puzzleAction",action:"resolve",payload:{element:R,rewards:Q,finish:v+1>=t.length}})},2e3)})},[h,l,t,v,R]);const H=React$2.useMemo(()=>{let V=`text-click text-click--${n}`;return p&&(V+=" disable-background-image"),V},[p,n]),W={pointerEvents:S.show?"none":null,backgroundImage:u!=null&&u.url?`url('${u.url}')`:""};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:H,style:W,children:[jsxRuntimeExports.jsx("div",{className:"text-click__overlay",children:jsxRuntimeExports.jsx("div",{className:`text-click__container ${F?"slideInLeft":""} `,children:jsxRuntimeExports.jsx("div",{className:"text-click__body",children:jsxRuntimeExports.jsx("div",{className:"text-click__scroll",dir:LangIsRtl()?"rtl":"auto",children:$.current})})})}),e&&jsxRuntimeExports.jsxs("div",{className:"text-click__paginator",children:[jsxRuntimeExports.jsx("div",{className:"text-click__icon-check-circle-black",children:jsxRuntimeExports.jsx("span",{className:"icon-check-circle-black"})}),jsxRuntimeExports.jsxs("span",{className:"text-click__slide",children:[w," / ",b]})]})]}),S.show&&jsxRuntimeExports.jsx(FeedbackComponent$1,{playSound:g,success:S.result,text:S.text,translate:U,functionOnClose:ie,hasTimeout:S.timeout,keyboardControl:f})]})}function _assertThisInitialized(l){if(l===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return l}function _inheritsLoose(l,e){l.prototype=Object.create(e.prototype),l.prototype.constructor=l,l.__proto__=e}/*!
253
+ `,children:jsxRuntimeExports.jsx("span",{children:v("auto-evaluation.end")})}):jsxRuntimeExports.jsx("button",{"data-testid":"forward-button",type:"button",onClick:()=>_(null,!1),disabled:((C=S.current.questions[x])==null?void 0:C.answer)===void 0,"aria-label":LangIsRtl()?v("survey.previous"):v("survey.next"),className:`gat--btn__navigation ${((P=S.current.questions[x])==null?void 0:P.answer)===void 0?"disabled":""}`,children:jsxRuntimeExports.jsx("span",{className:LangIsRtl()?"icon-back":"icon-next"})})]})]}),h==="end"&&jsxRuntimeExports.jsx(EndScreen,{onFinish:b,translate:v})]})]})}function PatternComponent({img:l,name:e,viewed:n,emitEvent:t,soundActions:a,keyboardControl:o}){const[d]=a,h=x=>t({type:"translate",payload:x}),f=()=>{d("click-ui"),t({type:"emitSavePattern",payload:{imgId:l.resourceId,name:e,viewed:!0,url:p,type:"pattern"}})},u=o({disabled:n,forward:f,escape:f});if(React$2.useEffect(()=>u(),[u]),!l)return null;const p=l.url;return jsxRuntimeExports.jsx("div",{className:n?"notes--results":"readings--container pattern-wrap--overlay",children:jsxRuntimeExports.jsx("div",{className:n?"notes--results__text":"pattern-wrap",children:n?jsxRuntimeExports.jsx("div",{children:p&&jsxRuntimeExports.jsx("img",{src:p,alt:"pattern"})}):jsxRuntimeExports.jsxs("div",{className:"pattern",children:[jsxRuntimeExports.jsxs("div",{className:"pattern__header",children:[jsxRuntimeExports.jsx("div",{className:"pattern__title",children:h("phone.pattern")}),jsxRuntimeExports.jsx("button",{type:"button","aria-label":h("storylines.misc.closePiece"),className:"pattern__close gat--btn__round gat--btn__close",onClick:()=>f(),children:jsxRuntimeExports.jsx("span",{className:"icon-close"})})]}),jsxRuntimeExports.jsx("figure",{className:"pattern__figure",children:p&&jsxRuntimeExports.jsx("img",{src:p,alt:"pattern"})})]})})})}const getRecursiveJSX=(l,e=0,n,t,a)=>{var o,d;if((o=l.props)!=null&&o.children){const h=l.type,{children:f,...u}=l.props;if(l.props["data-text-id"]){if(u.dir="auto",u.onClick=p=>t(p,u["data-text-id"]||-1),n!=null&&n.hasHighlights){const p=[...n.correctTexts,...n.wrongTexts];for(let x=0;x<p.length;x+=1)u["data-text-id"]===p[x].id&&(u.className="text-click__hover-correct")}}else n!=null&&n.allWrong&&!l.props["data-text-id"]&&(u.onClick=p=>t(p,"allWrong"));return Array.isArray(f)?jsxRuntimeExports.jsx(h,{...u,children:f.map((p,x)=>getRecursiveJSX(p,x,n,t))},`${l.type}_${e}`):jsxRuntimeExports.jsx(h,{...u,children:getRecursiveJSX(f,e,n,t)},`${l.type}_${e}`)}return((d=l.props)==null?void 0:d.children)!==null?l.split(" ").filter(h=>h!=="").map(h=>jsxRuntimeExports.jsx("span",{dir:"auto",children:h},h)):null};function TextClickPuzzleComponent({emitEvent:l,showFrames:e,styles:n,list:t,soundActions:a,description:o,setInfo:d,setResolveAction:h,keyboardControl:f,backgroundImage:u,hideBackgroundImageTheme:p=!1,nodeId:x}){const R=`textclick-puzzle_${x}`,[S,E]=React$2.useState({result:null,show:!1,text:"",timeout:!1}),[g]=a,[v,T]=React$2.useState(0),[b,_]=React$2.useState(0),[w,C]=React$2.useState(0),P=React$2.useRef(0),D=React$2.useRef([]),[N,k]=React$2.useState(0),[F,M]=React$2.useState(),U=React$2.useCallback(V=>l({type:"translate",payload:V}),[l]),$=React$2.useRef(null),B=React$2.useCallback(()=>P.current===t[v].correctTexts.length||t[v].hasClickOnce&&P.current>=1,[v,t]),J=React$2.useCallback((V,z)=>{V&&l({type:"hidePuzzleButtons",payload:!0}),E(Q=>({...Q,show:V,...z}))},[l]),ne=React$2.useCallback(()=>{if(B())if(E(V=>({...V,result:!1})),P.current=0,w===b){const V=D.current.reduce((z,Q)=>{const ee=z.findIndex(le=>le.id===Q.id);return ee>=0?z[ee].points+=Q.points:z.push({...Q}),z},[]);l({type:"addPoints",complex:!0,finish:!0,payload:V}),l({type:"passPuzzle"})}else $.current=null,T(v+1),k(0),M(!0),setTimeout(()=>{M(!1)},1200)},[B,w,b,l,v]),ie=React$2.useCallback(()=>{l({type:"hidePuzzleButtons",payload:!1}),ne(),E(z=>({...z,show:!1,text:""}));const V=document.querySelectorAll(".text-click__failed");V.length>0&&V.forEach(z=>z.classList.remove("text-click__failed"))},[l,ne]),Y=React$2.useCallback((V,z)=>{var Q,ee;V.forEach(le=>le.classList.add("text-click__success")),C(w+1),P.current+=1,g("score"),(Q=t[v].info.solution.right)!=null&&Q.desc?B()&&(D.current=[...D.current,...t[v].info.solution.right.rewards],J(!0,{result:!0,text:t[v].info.solution.right.desc,timeout:!1})):t[v].info.solution.right.desc===""&&(z!=null&&z.desc)?(D.current=((ee=z==null?void 0:z.rewards)==null?void 0:ee.length)>0?[...D.current,...(z==null?void 0:z.rewards)||{}]:[...D.current],J(!0,{result:!0,text:z.desc,timeout:!1})):t[v].specificFeedbacks.specificCorrectFeedbacks?(D.current=[...D.current,...(z==null?void 0:z.rewards)||{}],B()&&J(!0,{result:!0,timeout:!0})):B()&&(D.current=[...D.current,...t[v].info.solution.right.rewards],J(!0,{result:!0,timeout:!0}))},[w,g,t,v,B,J]),q=React$2.useCallback((V,z)=>{var Q;V.forEach(ee=>ee.classList.add("text-click__failed")),g("fail"),l({type:"failPuzzle"}),t[v].info.solution.wrong.desc!==""?(D.current=[...D.current,...t[v].info.solution.wrong.rewards],J(!0,{result:!1,text:t[v].info.solution.wrong.desc,timeout:!1})):t[v].info.solution.wrong.desc===""&&(z!=null&&z.desc)?(D.current=(Q=z==null?void 0:z.rewards)!=null&&Q.length?[...D.current,...(z==null?void 0:z.rewards)||{}]:[...D.current],J(!0,{result:!1,text:z.desc,timeout:!1})):t[v].specificFeedbacks.specificWrongFeedbacks?(D.current=[...D.current,...(z==null?void 0:z.rewards)||{}],J(!0,{result:!1,timeout:!0})):(D.current=[...D.current,...t[v].info.solution.wrong.rewards],J(!0,{result:!1,timeout:!0}))},[g,l,t,v,J]),re=React$2.useCallback((V,z)=>{var be,Re,Le,Oe;V.stopPropagation();const Q=document.querySelectorAll(`[data-text-id="${z}"]`),ee=document.querySelectorAll("[data-text-id]"),le=t[v].correctTexts.find(Ke=>Ke.id===z),ue=t[v].wrongTexts.find(Ke=>Ke.id===z),he=(Re=(be=t[v])==null?void 0:be.specificFeedbacks)==null?void 0:Re.correctFeedbacks.find(Ke=>Ke.id===z),ve=(Oe=(Le=t[v])==null?void 0:Le.specificFeedbacks)==null?void 0:Oe.wrongFeedbacks.find(Ke=>Ke.id===z);g("click-ui"),t[v].hasClickOrder?t[v].correctTexts[N].id===z?(k(N+1),Y(Q,he)):t[v].correctTexts.find(Ke=>Ke.id===z)&&t[v].correctTexts[N].id!==z?(ee.forEach(Ke=>Ke.classList.remove("text-click__success")),k(0),C(0),P.current=0,J(!0,{result:!1,text:t[v].info.orderFeedback.desc||U("puzzles.incorrectOrder"),timeout:!1}),T(0)):q(Q,ve):(le==null?void 0:le.id)===z?Y(Q,he):((ue==null?void 0:ue.id)===z||z==="allWrong")&&q(Q,ve)},[t,v,g,N,Y,J,U,q]),ce=React$2.useCallback(V=>getRecursiveJSX(V,0,t[v],re),[v,t,re]),fe=React$2.useCallback(()=>{let V=0;for(let z=0;z<t.length;z+=1)if(t[z].hasClickOnce)V+=1,_(V);else for(let Q=0;Q<t[z].correctTexts.length;Q+=1)V+=1,_(V)},[t]);React$2.useEffect(()=>{var V;if(t!=null&&t[v]&&d({...t[v].info,description:o}),(V=t[v])!=null&&V.text){const z=HTMLReactParser$1(t[v].text);$.current=ce(z),fe()}else $.current=""},[v,o,fe,t,ce,d]);const te=()=>{for(let V=0;V<D.current.length;V=V+1)if(D.current[V].points>0)return!0;return!1};React$2.useEffect(()=>{h(()=>{l({type:"hidePuzzleButtons",payload:!0});const V=document.querySelectorAll(".text-click [data-text-id]"),z=t[v].correctTexts.map(ee=>ee.id);V.forEach(ee=>{z.includes(ee.getAttribute("data-text-id"))&&ee.classList.add("text-click__success")});const Q=t[v].info.resolve.rewards;v+1<t.length?(setTimeout(()=>{l({type:"puzzleAction",action:"addPoints",payload:{element:R,rewards:Q,finish:!1,payload:Q}});let ee=0;t.forEach((le,ue)=>{ue<=v&&(ee+=le.correctTexts.length)}),C(ee),$.current=null,P.current=0,M(!0),T(v+1)},2e3),setTimeout(()=>{M(!1),l({type:"hidePuzzleButtons",payload:!1})},3200)):v+1>=t.length&&te()?setTimeout(()=>{Q.forEach(ee=>{D.current.forEach(le=>{le.id===ee.id&&(ee.points=ee.points+le.points)})}),l({type:"puzzleAction",action:"resolve",payload:{element:R,rewards:Q,finish:!0}})},2e3):setTimeout(()=>{l({type:"puzzleAction",action:"resolve",payload:{element:R,rewards:Q,finish:v+1>=t.length}})},2e3)})},[h,l,t,v,R]);const H=React$2.useMemo(()=>{let V=`text-click text-click--${n}`;return p&&(V+=" disable-background-image"),V},[p,n]),W={pointerEvents:S.show?"none":null,backgroundImage:u!=null&&u.url?`url('${u.url}')`:""};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{"data-testid":"wrapperDiv",className:H,style:W,children:[jsxRuntimeExports.jsx("div",{className:"text-click__overlay",children:jsxRuntimeExports.jsx("div",{className:`text-click__container ${F?"slideInLeft":""} `,children:jsxRuntimeExports.jsx("div",{className:"text-click__body",children:jsxRuntimeExports.jsx("div",{className:"text-click__scroll",dir:LangIsRtl()?"rtl":"auto",children:$.current})})})}),e&&jsxRuntimeExports.jsxs("div",{className:"text-click__paginator",children:[jsxRuntimeExports.jsx("div",{className:"text-click__icon-check-circle-black",children:jsxRuntimeExports.jsx("span",{className:"icon-check-circle-black"})}),jsxRuntimeExports.jsxs("span",{"data-testid":"slideCounter",className:"text-click__slide",children:[w," / ",b]})]})]}),S.show&&jsxRuntimeExports.jsx(FeedbackComponent$1,{playSound:g,success:S.result,text:S.text,translate:U,functionOnClose:ie,hasTimeout:S.timeout,keyboardControl:f})]})}function _assertThisInitialized(l){if(l===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return l}function _inheritsLoose(l,e){l.prototype=Object.create(e.prototype),l.prototype.constructor=l,l.__proto__=e}/*!
254
254
  * GSAP 3.12.4
255
255
  * https://gsap.com
256
256
  *