"use strict";(self.webpackChunk_genially_view_client=self.webpackChunk_genially_view_client||[]).push([[4311],{95881(e,t,i){i.d(t,{q:()=>H});var s=i(45992),o=i(37577),a=i(17588),n=i(70377);const r=o.i7`
  from { opacity: 0; transform: translateX(-50%) translateY(4px)  scale(0.95); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0)     scale(1);   }
`,l=o.i7`
  from { opacity: 0; transform: translateX(-50%) translateY(-4px) scale(0.95); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0)    scale(1);   }
`,u=o.Ay.div`
  position: absolute;
  ${e=>{let{$placement:t}=e;return"top"===t?o.AH`
          bottom: calc(100% + 8px);
          top: auto;
          animation: ${l} 0.2s ease-out;
        `:o.AH`
          bottom: 8px;
          top: auto;
          animation: ${r} 0.2s ease-out;
        `}}
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  min-width: 120px;
  max-width: 220px;
  background: #ffffff;
  border-radius: 12px;
  /* !important needed: .genially-embed div reset overrides with padding: 0 */
  padding: 12px 20px !important;
  font-family: 'Comic Sans MS', 'Chalkboard SE', cursive, sans-serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  color: #1a1a1a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  z-index: 10;
  text-align: center;
  white-space: normal;
  word-break: break-word;

  /* tail pointing toward the avatar */
  &::before {
    content: '';
    position: absolute;
    ${e=>{let{$placement:t}=e;return"top"===t?o.AH`
            bottom: -5px;
            top: auto;
          `:o.AH`
            top: -5px;
            bottom: auto;
          `}}
    left: 50%;
    width: 10px;
    height: 10px;
    background: #ffffff;
    transform: translateX(-50%) rotate(45deg);
    border-radius: 2px;
  }
`,h=e=>{let{controller:t,placement:i}=e;const[o,n]=(0,a.useState)(null);return(0,a.useEffect)((()=>(n(null),t?t.subscribeBubble(n):()=>{})),[t]),o?(0,s.jsx)(u,{$placement:i,role:"status","aria-live":"polite",children:o.text}):null};const d=.5,c=100;class m{constructor(){this.mode="static",this.slideBounds=null,this.avatarBounds=null,this.reactiveItemIds=[],this.isDragging=!1,this.offsetX=0,this.offsetY=0,this.targetX=0,this.targetY=0,this.velX=0,this.velY=0,this.assistantLeft=0,this.assistantTop=0,this.cursorX=0,this.cursorY=0,this.lastCursorForReeval={x:0,y:0},this.inactivityTimer=null,this.anchorHistory=[],this.rafId=null,this.listeners=new Set,this.disposed=!1,this.lastClosestId=null,this.onTargetItemChanged=null,this.reduceMotion="undefined"!==typeof window&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,this.tick=()=>{if(this.rafId=null,this.disposed)return;if("assistant"===this.mode)return void this.tickAssistant();if(this.reduceMotion)this.offsetX=this.targetX,this.offsetY=this.targetY,this.velX=0,this.velY=0;else{const e=.12*(this.targetX-this.offsetX),t=.12*(this.targetY-this.offsetY);this.velX=.72*(this.velX+e),this.velY=.72*(this.velY+t),this.offsetX+=this.velX,this.offsetY+=this.velY}this.notify();Math.abs(this.targetX-this.offsetX)<d&&Math.abs(this.targetY-this.offsetY)<d&&Math.abs(this.velX)<d&&Math.abs(this.velY)<d?(this.offsetX=this.targetX,this.offsetY=this.targetY,this.velX=0,this.velY=0,this.notify()):this.rafId=requestAnimationFrame(this.tick)}}setMode(e){if(!this.disposed&&e!==this.mode){if(this.mode=e,this.cancelInactivityTimer(),this.cancelRaf(),this.velX=0,this.velY=0,"static"===e)return this.targetX=0,this.targetY=0,this.offsetX=0,this.offsetY=0,this.notify(),void this.startRaf();if("wanderer"!==e){if("interactive"===e)return this.offsetX=0,this.offsetY=0,this.notify(),void this.updateReactiveTarget();this.avatarBounds&&(this.assistantLeft=this.avatarBounds.left,this.assistantTop=this.avatarBounds.top),this.notify(),this.startRaf()}else this.scheduleInactivity()}}setSlideBounds(e){this.disposed||(this.slideBounds=e)}setAvatarBounds(e){if(this.disposed)return;const t=this.avatarBounds;this.avatarBounds=e,"interactive"===this.mode&&null!==t&&Math.abs(e.left-t.left)>2&&(this.lastCursorForReeval={x:-9999,y:-9999})}getOffset(){return{x:this.offsetX,y:this.offsetY}}setReactiveItemIds(e){this.disposed||(this.reactiveItemIds=e,this.lastClosestId=null,this.lastCursorForReeval={x:-9999,y:-9999})}setDragging(e){this.disposed||(this.isDragging=e,e||"interactive"!==this.mode||this.updateReactiveTarget())}setCursor(e,t){if(!this.disposed&&(this.cursorX=e,this.cursorY=t,"wanderer"===this.mode&&this.onActivity(),"interactive"===this.mode&&!this.isDragging)){const i=e-this.lastCursorForReeval.x,s=t-this.lastCursorForReeval.y;Math.hypot(i,s)>60&&(this.lastCursorForReeval={x:e,y:t},this.updateReactiveTarget())}}onActivity(){this.disposed||"wanderer"===this.mode&&(this.cancelInactivityTimer(),this.scheduleInactivity())}subscribe(e){return this.listeners.add(e),e(this.currentState()),()=>this.listeners.delete(e)}dispose(){this.disposed=!0,this.cancelRaf(),this.cancelInactivityTimer(),this.listeners.clear(),this.onTargetItemChanged=null}currentState(){return"assistant"===this.mode?{kind:"fixed",left:this.assistantLeft,top:this.assistantTop}:{kind:"offset",x:this.offsetX,y:this.offsetY}}startRaf(){null===this.rafId&&(this.rafId=requestAnimationFrame(this.tick))}cancelRaf(){null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null)}tickAssistant(){const e=-c/2;const t=this.cursorX+24,i=this.cursorY+e,s=this.clampViewport(t,i);this.reduceMotion?(this.assistantLeft=s.x,this.assistantTop=s.y):(this.assistantLeft+=.1*(s.x-this.assistantLeft),this.assistantTop+=.1*(s.y-this.assistantTop)),this.notify(),this.rafId=requestAnimationFrame(this.tick)}updateReactiveTarget(){var e;if(this.isDragging||!this.avatarBounds)return this.targetX=0,this.targetY=0,void this.startRaf();const t=this.queryReactiveItemBounds();if(0===t.length)return this.targetX=0,this.targetY=0,void this.startRaf();let i=t[0],s=1/0;for(const v of t){const e=v.bounds.left+v.bounds.width/2,t=v.bounds.top+v.bounds.height/2,o=Math.hypot(this.cursorX-e,this.cursorY-t);o<s&&(s=o,i=v)}i.id!==this.lastClosestId&&(this.lastClosestId=i.id,null===(e=this.onTargetItemChanged)||void 0===e||e.call(this));const{bounds:o}=i,a=this.avatarBounds.width,n=this.avatarBounds.height,r=o.top+o.height/2,l=o.left+o.width+4+a/2,u=o.left-4-a/2,h=this.cursorX>=o.left+o.width/2,d=!this.slideBounds||l+a/2<=this.slideBounds.left+this.slideBounds.width,c=!this.slideBounds||u-a/2>=this.slideBounds.left;let m;m=h?d?l:u:c?u:l;const f=this.clampToBounds(m,r),p=this.avatarBounds.left+a/2,g=this.avatarBounds.top+n/2;this.targetX=f.x-p,this.targetY=f.y-g,this.startRaf()}queryReactiveItemBounds(){return this.reactiveItemIds.flatMap((e=>{const t=document.querySelector(`[data-item-id="${e}"]`);if(!t)return[];const i=t.getBoundingClientRect();return 0===i.width&&0===i.height?[]:[{id:e,bounds:{left:i.left,top:i.top,width:i.width,height:i.height}}]}))}scheduleInactivity(){this.inactivityTimer=setTimeout((()=>{this.inactivityTimer=null,this.wander()}),8e3)}cancelInactivityTimer(){null!==this.inactivityTimer&&(clearTimeout(this.inactivityTimer),this.inactivityTimer=null)}wander(){if(!this.slideBounds||!this.avatarBounds)return;const e=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.12;const i=e.width*t,s=e.height*t,o=e.left+i,a=e.left+e.width-i,n=e.top+s,r=e.top+e.height-s,l=e.left+e.width/2,u=e.top+e.height/2;return[{x:o,y:n},{x:l,y:n},{x:a,y:n},{x:o,y:u},{x:l,y:u},{x:a,y:u},{x:o,y:r},{x:l,y:r},{x:a,y:r}]}(this.slideBounds),t=function(e,t){const i=new Set(t.map((e=>`${Math.round(e.x)},${Math.round(e.y)}`))),s=e.filter((e=>!i.has(`${Math.round(e.x)},${Math.round(e.y)}`))),o=s.length>0?s:e;return o[Math.floor(Math.random()*o.length)]}(e,this.anchorHistory.slice(-2));this.anchorHistory.push(t),this.anchorHistory.length>4&&this.anchorHistory.shift();const i=this.avatarBounds.left+this.avatarBounds.width/2,s=this.avatarBounds.top+this.avatarBounds.height/2;this.targetX=t.x-i,this.targetY=t.y-s,this.startRaf(),this.scheduleInactivity()}clampToBounds(e,t){if(!this.slideBounds||!this.avatarBounds)return{x:e,y:t};const i=this.avatarBounds.width/2,s=this.avatarBounds.height/2;return{x:Math.max(this.slideBounds.left+i,Math.min(this.slideBounds.left+this.slideBounds.width-i,e)),y:Math.max(this.slideBounds.top+s,Math.min(this.slideBounds.top+this.slideBounds.height-s,t))}}clampViewport(e,t){return{x:Math.max(8,Math.min(window.innerWidth-c-8,e)),y:Math.max(8,Math.min(window.innerHeight-c-8,t))}}notify(){const e=this.currentState();for(const t of this.listeners)t(e)}}var f=i(60053),p=i(1425),g=i(83043),v=i(48571),b=i(32297);const y=["es","en","pt","fr","de","it"],w={es:{question:["\xbfSabes la respuesta?","\xa1A ver qu\xe9 sabes!","\xa1Responde y demu\xe9stralo!","\xbfQu\xe9 opinas?","\xa1Atr\xe9vete a responder!","\xbfTienes la respuesta?","\xa1Hay una pregunta para ti!","Pi\xe9nsalo bien\u2026","\xa1A ver qu\xe9 piensas!","\xa1Vamos, t\xfa puedes responderla!"],moving:["\xa1S\xedgueme!","\xa1Por aqu\xed!","\xa1Mira lo que encontr\xe9!","\xa1Ven, hay algo aqu\xed!","\xa1Psst, por aqu\xed!","\xa1\xc9chale un ojo a esto!","\xa1He encontrado algo para ti!","\xa1Ven conmigo!"],idle:["\xbfProbamos a arrastrar algo?","\xa1A ver qu\xe9 pasa!","Arrastra los elementos a su sitio","\xbfVes los objetos? \xa1Mu\xe9velos!","El truco est\xe1 en arrastrar y soltar","\xa1Vamos, mueve esas piezas!","\xbfTe atreves a arrastrarlo?","Int\xe9ntalo, mueve algo","\xa1Prueba a colocar las piezas!","\xa1Hay algo que encaja aqu\xed!"],poke:["\xa1Eso hace cosquillas!","\xbfQu\xe9 haces?","\xa1Para, para!","Soy un avatar, \xa1no un bot\xf3n!","\xa1Oye, cuidado!","Jeje\u2026 eso ha molado","\xa1Buenas! \xbfMe necesitas?","\xa1Eh, que estoy aqu\xed!","Otro click m\xe1s y me pongo a bailar","\xbfMe est\xe1s probando?","\xa1Uf, casi me caigo!","\xa1Hola a ti tambi\xe9n!"],dragging:["\xa1T\xfa puedes!","Su\xe9ltalo donde toque","\xa1Casi lo tienes!","\xa1Venga, un poco m\xe1s!","\xa1Eso es, sigue as\xed!","\xa1Conf\xedo en ti!","\xa1Dale, dale!","\xbfAd\xf3nde va eso?"],success:["\xa1Bien hecho!","\xa1Lo lograste!","\xa1Perfecto!","\xa1Eso es!","\xa1Genial!","\xa1Sab\xeda que pod\xedas!","\xa1Incre\xedble!","\xa110 sobre 10!","\xa1Eres una m\xe1quina!","\xa1Toma ya!"],failure:["Casi, vuelve a intentarlo","No pasa nada, prueba otra vez","\xa1\xc1nimo, puedes hacerlo!","Ups, \xa1int\xe9ntalo de nuevo!","Casi casi\u2026","La pr\xf3xima seguro que s\xed","\xa1No te rindas!","Un intento m\xe1s, \xa1venga!","\xa1Fallo bueno, el que ense\xf1a!","Sigue probando, \xa1lo tienes!"]},en:{question:["Do you know the answer?","Let's see what you know!","Answer and prove it!","What do you think?","Dare to answer?","Got the answer?","There is a question for you!","Take your time and think\u2026","What's your take on this?","Come on, you can do it!"],moving:["Follow me!","Over here!","Look what I found!","Come, there is something here!","Psst, this way!","Take a look at this!","Found something for you!","Come with me!"],idle:["Try dragging something!","Let's see what happens!","Drag the elements to the right place","See those objects? Move them!","Give drag and drop a shot!","Something here fits somewhere\u2026","Come on, move those pieces!","Dare to drag it?","Try placing the pieces!","There is a perfect spot for each one!"],poke:["That tickles!","Hey, easy there!","Stop poking me!","I'm an avatar, not a button!","Did you just\u2026 click me?","Hehe, that was fun!","Hello to you too!","One more click and I start dancing!","Are you testing me?","Whoa, almost fell over!","Yes, I am here!","Fancy seeing you click me!"],dragging:["You got this!","Drop it where it belongs","Almost there!","Come on, a bit further!","That's it, keep going!","I believe in you!","Go, go, go!","Where are you taking that?"],success:["Great job!","You nailed it!","Perfect!","Yes!","Awesome!","I knew you could do it!","Incredible!","10 out of 10!","You are on fire!","Boom!"],failure:["Almost, try again!","No worries, give it another go","You can do it!","Oops, try once more!","So close\u2026","Next time for sure!","Don't give up!","One more try, come on!","Every mistake is a lesson!","Keep going, you have got this!"]},pt:{question:["Voc\xea sabe a resposta?","Vamos ver o que voc\xea sabe!","Responda e prove!","O que voc\xea acha?","Ouse responder?","Tem a resposta?","H\xe1 uma pergunta para voc\xea!","Pense bem\u2026","Qual \xe9 a sua opini\xe3o?","Vamos, voc\xea pode responder!"],moving:["Siga-me!","Por aqui!","Veja o que encontrei!","Venha, h\xe1 algo aqui!","Psst, por aqui!","D\xea uma olhada nisso!","Encontrei algo para voc\xea!","Venha comigo!"],idle:["Tente arrastar algo!","Vamos ver o que acontece!","Arraste os elementos para o lugar certo","V\xea aqueles objetos? Mova-os!","Experimente arrastar e soltar!","Algo aqui encaixa em algum lugar\u2026","Vamos l\xe1, mova essas pe\xe7as!","Topa arrastar?","Tente colocar as pe\xe7as!","Cada um tem o seu lugar!"],poke:["Isso faz c\xf3cegas!","Ei, com cuidado!","Para com isso!","Sou um avatar, n\xe3o um bot\xe3o!","Voc\xea acabou de me clicar?","Hehe, que divertido!","Ol\xe1 para voc\xea tamb\xe9m!","Mais um clique e come\xe7o a dan\xe7ar!","Est\xe1 me testando?","Uau, quase ca\xed!","Sim, estou aqui!","Que surpresa voc\xea me clicar!"],dragging:["Voc\xea consegue!","Solte onde for preciso","Quase l\xe1!","Vamos, um pouco mais!","Isso, continue assim!","Acredito em voc\xea!","Vai, vai, vai!","Para onde vai isso?"],success:["Muito bem!","Conseguiu!","Perfeito!","Isso mesmo!","Incr\xedvel!","Sabia que conseguia!","Fant\xe1stico!","10 em 10!","Voc\xea est\xe1 arrasando!","Boom!"],failure:["Quase, tente de novo!","N\xe3o tem problema, tente outra vez","Voc\xea pode fazer isso!","Ops, tente mais uma vez!","T\xe3o perto\u2026","Na pr\xf3xima com certeza!","N\xe3o desista!","Mais uma tentativa, vamos!","Cada erro \xe9 um aprendizado!","Continue, voc\xea consegue!"]},fr:{question:["Tu connais la r\xe9ponse?","Voyons ce que tu sais!","R\xe9ponds et prouve-le!","Qu'est-ce que tu en penses?","Tu oses r\xe9pondre?","Tu as la r\xe9ponse?","Il y a une question pour toi!","R\xe9fl\xe9chis bien\u2026","Quel est ton avis?","Allez, tu peux r\xe9pondre!"],moving:["Suis-moi!","Par ici!","Regarde ce que j'ai trouv\xe9!","Viens, il y a quelque chose ici!","Psst, par ici!","Jette un \u0153il \xe0 \xe7a!","J'ai trouv\xe9 quelque chose pour toi!","Viens avec moi!"],idle:["Essaie de faire glisser quelque chose!","Voyons ce qui se passe!","Fais glisser les \xe9l\xe9ments au bon endroit","Tu vois ces objets? Bouge-les!","Tente le glisser-d\xe9poser!","Il y a forc\xe9ment une place pour chaque pi\xe8ce\u2026","Allez, d\xe9place ces \xe9l\xe9ments!","Tu oses le faire glisser?","Essaie de placer les pi\xe8ces!","Chaque pi\xe8ce a son endroit!"],poke:["\xc7a chatouille!","H\xe9, doucement!","Arr\xeate de me toucher!","Je suis un avatar, pas un bouton!","Tu viens de me cliquer?","Hehe, c'\xe9tait sympa!","Bonjour \xe0 toi aussi!","Encore un clic et je me mets \xe0 danser!","Tu me testes?","Ouah, failli tomber!","Oui, je suis l\xe0!","Quelle surprise de te voir me cliquer!"],dragging:["Tu peux le faire!","D\xe9pose-le au bon endroit","Presque!","Allez, encore un peu!","C'est \xe7a, continue!","Je crois en toi!","Vas-y, vas-y!","Tu le poses o\xf9?"],success:["Bravo!","Tu y es arriv\xe9!","Parfait!","Oui!","Super!","Je savais que tu pouvais!","Incroyable!","10 sur 10!","Tu es en feu!","Boom!"],failure:["Presque, r\xe9essaie!","Pas de souci, essaie encore","Tu peux y arriver!","Oups, encore un essai!","Si proche\u2026","La prochaine fois, \xe7a ira!","Ne l\xe2che pas!","Un essai de plus, allez!","Chaque erreur est un apprentissage!","Continue, tu vas y arriver!"]},de:{question:["Kennst du die Antwort?","Mal sehen, was du wei\xdft!","Antworte und beweise es!","Was denkst du?","Traust du dich zu antworten?","Hast du die Antwort?","Hier ist eine Frage f\xfcr dich!","Denk gut nach\u2026","Was ist deine Meinung?","Komm, du kannst es beantworten!"],moving:["Komm mit!","Hierher!","Schau, was ich gefunden habe!","Komm, hier ist etwas!","Psst, hier entlang!","Wirf einen Blick darauf!","Ich habe etwas f\xfcr dich gefunden!","Folg mir!"],idle:["Versuche etwas zu ziehen!","Mal sehen, was passiert!","Ziehe die Elemente an den richtigen Ort","Siehst du die Objekte? Beweg sie!","Probiere Drag-and-Drop aus!","Irgendwo passt jedes Teil hin\u2026","Los, beweg diese Teile!","Traust du dich, es zu ziehen?","Versuche, die Teile zu platzieren!","Jedes Teil hat seinen Platz!"],poke:["Das kitzelt!","Hey, vorsichtig!","H\xf6r auf, mich anzutippen!","Ich bin ein Avatar, kein Knopf!","Hast du mich gerade geklickt?","Hehe, das hat Spa\xdf gemacht!","Hallo auch an dich!","Noch ein Klick und ich fange an zu tanzen!","Testest du mich?","Ui, fast hingefallen!","Ja, ich bin hier!","Was f\xfcr eine \xdcberraschung!"],dragging:["Du schaffst das!","Lass es los, wo es hingeh\xf6rt","Fast!","Komm, noch ein bisschen!","So ist es, weiter so!","Ich glaube an dich!","Los, los, los!","Wohin geh\xf6rt das?"],success:["Gut gemacht!","Du hast es geschafft!","Perfekt!","Ja!","Super!","Ich wusste, du kannst es!","Unglaublich!","10 von 10!","Du bist auf Feuer!","Boom!"],failure:["Fast, versuch es nochmal!","Kein Problem, versuche es noch einmal","Du kannst es schaffen!","Hoppla, noch ein Versuch!","So nah dran\u2026","N\xe4chstes Mal bestimmt!","Gib nicht auf!","Noch ein Versuch, komm!","Jeder Fehler ist eine Lektion!","Weiter so, du schaffst das!"]},it:{question:["Conosci la risposta?","Vediamo cosa sai!","Rispondi e dimostralo!","Cosa ne pensi?","Osi rispondere?","Hai la risposta?","C'\xe8 una domanda per te!","Pensa bene\u2026","Qual \xe8 la tua opinione?","Dai, puoi risponderci!"],moving:["Seguimi!","Da questa parte!","Guarda cosa ho trovato!","Vieni, c'\xe8 qualcosa qui!","Psst, da qui!","Dai un'occhiata a questo!","Ho trovato qualcosa per te!","Vieni con me!"],idle:["Prova a trascinare qualcosa!","Vediamo cosa succede!","Trascina gli elementi nel posto giusto","Vedi quegli oggetti? Spostali!","Prova il trascinamento!","Da qualche parte ci sta un posto giusto\u2026","Dai, muovi questi pezzi!","Osi trascinarlo?","Prova a posizionare i pezzi!","Ogni pezzo ha il suo posto!"],poke:["Fa il solletico!","Ehi, piano!","Smettila di toccarmi!","Sono un avatar, non un pulsante!","Mi hai appena cliccato?","Hehe, \xe8 stato divertente!","Ciao anche a te!","Un altro clic e comincio a ballare!","Mi stai mettendo alla prova?","Uh, quasi caduto!","S\xec, sono qui!","Che sorpresa vederti cliccarmi!"],dragging:["Ce la fai!","Lascialo dove va","Quasi!","Dai, ancora un po!","Ecco, continua cos\xec!","Credo in te!","Vai, vai, vai!","Dove lo porti?"],success:["Bravo!","Ce l'hai fatta!","Perfetto!","S\xec!","Fantastico!","Sapevo che potevi!","Incredibile!","10 su 10!","Sei in fiamme!","Boom!"],failure:["Quasi, riprova!","Non preoccuparti, riprova","Puoi farcela!","Ops, riprova ancora!","Cos\xec vicino\u2026","La prossima volta di sicuro!","Non mollare!","Un altro tentativo, dai!","Ogni errore \xe8 una lezione!","Continua, ci riesci!"]}};const T=4e3,x=5e3,I=[120,500],S=new Set(["happy","sad"]),M={success:"happy",failure:"sad"},B={success:"success",failure:"shake"},C={none:0,idle:1,poke:1,dragging:2,outcome:3},E={idle:"idle",question:"idle",moving:"idle",poke:"poke",dragging:"dragging",success:"outcome",failure:"outcome"};class q{constructor(){this.vmi=null,this.faceState="idle",this.idlePool=[],this.currentIdleExpression=null,this.idleEmotionTimer=null,this.reactionHoldTimer=null,this.reapplyTimers=[],this.pendingOutcome=null,this.configuredExpression=null,this.hasDragAndDrop=!1,this.hasInteractiveQuestion=!1,this.suppressIdleUntil=0,this.bubblePriority="none",this.bubbleHideTimer=null,this.bubbleListeners=new Set,this.currentBubble=null,this.lang=function(){var e,t;const i=null!==(t=null===(e=navigator.language)||void 0===e?void 0:e.toLowerCase())&&void 0!==t?t:"";for(const s of y)if(i===s||i.startsWith(`${s}-`)||i.startsWith(`${s}_`))return s;return"en"}(),this.gazeTargetX=0,this.gazeTargetY=0,this.gazeCurrentX=0,this.gazeCurrentY=0,this.gazeRafId=null,this.tickGaze=()=>{var e,t;this.gazeCurrentX+=.15*(this.gazeTargetX-this.gazeCurrentX),this.gazeCurrentY+=.15*(this.gazeTargetY-this.gazeCurrentY);const i=null===(e=this.vmi)||void 0===e?void 0:e.number("head/gazeX"),s=null===(t=this.vmi)||void 0===t?void 0:t.number("head/gazeY");i&&(i.value=this.gazeCurrentX),s&&(s.value=this.gazeCurrentY),this.gazeRafId=requestAnimationFrame(this.tickGaze)}}setVmi(e){var t,i;if(this.stopIdleLoop(),this.vmi=e,!e)return;const s=e.enum("head/expression"),o=null!==(t=null===s||void 0===s?void 0:s.values)&&void 0!==t?t:[];if(this.idlePool=o.filter((e=>!S.has(e))),this.currentIdleExpression=null!==(i=o[0])&&void 0!==i?i:null,this.hasDragAndDrop?setTimeout((()=>this.showBubble("idle",x)),0):this.hasInteractiveQuestion&&setTimeout((()=>this.showBubble("question",x)),0),null!==this.pendingOutcome){const e=this.pendingOutcome;return this.pendingOutcome=null,void this.reactToOutcome(e)}null===this.configuredExpression?this.scheduleIdleEmotionTick():this.applyExpression(this.configuredExpression)}setSlideExpression(e){this.configuredExpression=e,null!==e?(this.stopIdleLoop(),this.vmi&&this.applyExpression(e)):"idle"===this.faceState&&this.vmi&&(this.stopIdleLoop(),this.scheduleIdleEmotionTick())}setHasDragAndDrop(e){this.hasDragAndDrop=e,e&&this.vmi&&"idle"===this.faceState&&"none"===this.bubblePriority&&this.showBubble("idle",x)}setHasInteractiveQuestion(e){this.hasInteractiveQuestion=e,e&&!this.hasDragAndDrop&&this.vmi&&"idle"===this.faceState&&this.showBubble("question",x)}reactToOutcome(e){var t;if(!this.vmi)return void(this.pendingOutcome=e);this.faceState="reacting",this.stopIdleLoop(),this.clearReapplyTimers(),null!==this.reactionHoldTimer&&clearTimeout(this.reactionHoldTimer);const i=M[e],s=B[e];this.applyExpression(i),null===(t=this.vmi.trigger(s))||void 0===t||t.trigger(),this.suppressIdleUntil=Date.now()+T;for(const o of I){const e=setTimeout((()=>{var e;"reacting"===this.faceState&&this.vmi&&(this.applyExpression(i),null===(e=this.vmi.trigger(s))||void 0===e||e.trigger())}),o);this.reapplyTimers.push(e)}this.reactionHoldTimer=setTimeout((()=>{this.reactionHoldTimer=null,this.faceState="idle",null!==this.configuredExpression?this.applyExpression(this.configuredExpression):this.scheduleIdleEmotionTick()}),T),this.showBubble(e,T)}isIdleSuppressed(){return Date.now()<this.suppressIdleUntil}poke(){this.showBubble("poke",3e3)}onAvatarMoved(){this.vmi&&"idle"===this.faceState&&(this.hasDragAndDrop||this.hasInteractiveQuestion)&&this.showBubble("moving",3e3)}setDragState(e){e?this.showBubble("dragging",0):this.clearBubble("dragging")}subscribeBubble(e){return this.bubbleListeners.add(e),e(this.currentBubble),()=>{this.bubbleListeners.delete(e)}}applyExpression(e){if(!this.vmi)return;const t=this.vmi.enum("head/expression");t&&(t.value=e)}scheduleIdleEmotionTick(){if(null!==this.configuredExpression||0===this.idlePool.length||!this.vmi)return;const e=5e3+1e4*Math.random();this.idleEmotionTimer=setTimeout((()=>{if(this.idleEmotionTimer=null,"idle"===this.faceState&&this.vmi){const e=this.idlePool.filter((e=>e!==this.currentIdleExpression)),t=e.length>0?e:this.idlePool,i=t[Math.floor(Math.random()*t.length)];this.applyExpression(i),this.currentIdleExpression=i,this.scheduleIdleEmotionTick()}}),e)}stopIdleLoop(){null!==this.idleEmotionTimer&&(clearTimeout(this.idleEmotionTimer),this.idleEmotionTimer=null)}clearReapplyTimers(){for(const e of this.reapplyTimers)clearTimeout(e);this.reapplyTimers=[]}showBubble(e,t){const i=E[e];if(C[i]<C[this.bubblePriority])return;this.bubblePriority=i,null!==this.bubbleHideTimer&&(clearTimeout(this.bubbleHideTimer),this.bubbleHideTimer=null);const s=function(e,t){const i=w[e][t];return i[Math.floor(Math.random()*i.length)]}(this.lang,e);this.notifyBubble({state:e,text:s}),t>0&&(this.bubbleHideTimer=setTimeout((()=>{this.bubbleHideTimer=null,this.bubblePriority="none",this.notifyBubble(null)}),t))}clearBubble(e){this.bubblePriority===e&&(null!==this.bubbleHideTimer&&(clearTimeout(this.bubbleHideTimer),this.bubbleHideTimer=null),this.bubblePriority="none",this.notifyBubble(null))}notifyBubble(e){this.currentBubble=e;for(const t of this.bubbleListeners)t(e)}setGazeTarget(e,t){this.gazeTargetX=2*e,this.gazeTargetY=2*t,null===this.gazeRafId&&(this.gazeRafId=requestAnimationFrame(this.tickGaze))}dispose(){null!==this.gazeRafId&&(cancelAnimationFrame(this.gazeRafId),this.gazeRafId=null)}}const k=e=>{let{src:t,artboard:i,stateMachines:o,fit:n,alignment:r,layoutScaleFactor:l=1,autoplay:u=!0,autoBind:h=!0,viewModelSchema:d,viewModelData:c,onControllerReady:m,interactive:y=!0}=e;const w=(0,a.useRef)(null),{rive:T,RiveComponent:x,canvas:I}=(0,f.useRive)({src:t,artboard:i||void 0,stateMachines:o||void 0,layout:new f.Layout({fit:(0,g.eY)(n),alignment:(0,p.oy)(r),layoutScaleFactor:Number.isFinite(Number(l))?Number(l):1}),autoplay:u,autoBind:h},{shouldResizeCanvasToContainer:!1,useDevicePixelRatio:!0}),[S,M]=(0,a.useState)(null);(0,a.useEffect)((()=>{if(!T)return M(null),()=>{};const e=()=>{var e;M(null!==(e=T.viewModelInstance)&&void 0!==e?e:null)};return e(),T.on("load",e),()=>{T.off("load",e)}}),[T]);const B=(0,a.useMemo)((()=>new q),[]);return(0,a.useEffect)((()=>{null===m||void 0===m||m(B)}),[B,m]),(0,a.useEffect)((()=>(B.setVmi(S),()=>{B.setVmi(null)})),[B,S]),(0,a.useEffect)((()=>{const e=e=>{var t;const i=null===(t=w.current)||void 0===t?void 0:t.getBoundingClientRect();i&&B.setGazeTarget(e.clientX-(i.left+i.width/2),e.clientY-(i.top+i.height/2))};return window.addEventListener("pointermove",e),()=>{window.removeEventListener("pointermove",e),B.dispose()}}),[B]),(0,b.S)(S,c,d),(0,v.w)(T,I,w),(0,s.jsx)("div",{ref:w,style:{width:"100%",height:"100%"},children:(0,s.jsx)(x,{style:{width:"100%",height:"100%",pointerEvents:y?"auto":"none"}})})},z="https://rive.genially.com/rive-animations/avatar.riv",R=o.Ay.div`
  position: relative;
  width: 100%;
  height: 100%;
`,D=o.Ay.div`
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
`;const A=e=>{let{src:t=z,artboard:i,stateMachines:o,fit:r,alignment:l,layoutScaleFactor:u,autoplay:d=!0,autoBind:f=!0,viewModelSchema:p,viewModelData:g,onControllerReady:v,onMovementControllerReady:b,interactive:y=!0,movementMode:w="static"}=e;var T;const x=(0,a.useRef)(null),[I,S]=(0,a.useState)(null),[M,B]=(0,a.useState)({kind:"offset",x:0,y:0}),[C,E]=(0,a.useState)(!1),q=(0,a.useMemo)((()=>new m),[]);(0,a.useEffect)((()=>{null===b||void 0===b||b(q)}),[q,b]),(0,a.useEffect)((()=>{const e=null!==w&&void 0!==w?w:"static",t="reactive"===e?"interactive":e;q.setMode(t),"assistant"!==t&&B((e=>"fixed"===e.kind?{kind:"offset",x:0,y:0}:e))}),[q,w]),(0,a.useEffect)((()=>q.subscribe((e=>{B(e),"fixed"===e.kind&&E(function(e,t,i){const s=e+i,o=window.innerWidth,a=window.innerHeight;return t>.2*a&&t+i<.85*a&&(e<80||s>o-80)}(e.left,e.top,c))}))),[q]),(0,a.useEffect)((()=>(q.onTargetItemChanged=()=>{null===I||void 0===I||I.onAvatarMoved()},()=>{q.onTargetItemChanged=null})),[I,q]);const A=(0,a.useRef)(null),H=(0,a.useRef)({x:1,y:1}),Y=(0,a.useCallback)((()=>{const e=x.current;if(!e)return;const t=e.getBoundingClientRect(),i=e.offsetWidth>0?t.width/e.offsetWidth:1,s=e.offsetHeight>0?t.height/e.offsetHeight:1;H.current={x:i,y:s};const{x:o,y:a}=q.getOffset(),n="interactive"===w,r=n?c*i:t.width,l=n?c*s:t.height,u=t.left-o+t.width/2,h=t.top-a+t.height/2;q.setAvatarBounds({left:u-r/2,top:h-l/2,width:r,height:l}),A.current||(A.current=function(e){const t=e.getBoundingClientRect();let i=e.parentElement;for(;i&&i!==document.body;){const e=i.getBoundingClientRect();if(e.width>=4*t.width&&e.height>=4*t.height)return i;i=i.parentElement}return null}(e));const d=A.current;if(d){const e=d.getBoundingClientRect();q.setSlideBounds({left:e.left,top:e.top,width:e.width,height:e.height})}else q.setSlideBounds({left:0,top:0,width:window.innerWidth,height:window.innerHeight})}),[q,w]);(0,a.useEffect)((()=>(A.current=null,Y(),window.addEventListener("resize",Y),()=>{A.current=null,window.removeEventListener("resize",Y),q.dispose()})),[q,Y]),(0,a.useEffect)((()=>{const e=e=>{Y(),q.setCursor(e.clientX,e.clientY)};return window.addEventListener("pointermove",e),()=>window.removeEventListener("pointermove",e)}),[q,Y]);const X=(0,a.useCallback)((e=>{S(e),null===v||void 0===v||v(e)}),[v]),P=(0,a.useCallback)((()=>{y&&(null===I||void 0===I||I.poke(),q.onActivity())}),[I,y,q]),F=`${t}|${null!==i&&void 0!==i?i:""}|${null!==o&&void 0!==o?o:""}|${null!==(T=null===p||void 0===p?void 0:p.length)&&void 0!==T?T:0}`;if((0,a.useLayoutEffect)((()=>{if("offset"!==M.kind)return;if(0===M.x&&0===M.y)return;let e=x.current;for(;e&&!e.hasAttribute("data-item-id");)e=e.parentElement;const t=e;if(!t)return;const{x:i,y:s}=H.current,o=t.style.transform,a=t.style.zIndex;return t.style.transform=`translate3d(${M.x/i}px, ${M.y/s}px, 0)`,t.style.zIndex="100",()=>{t.style.transform=o,t.style.zIndex=a}}),[M]),"fixed"===M.kind)return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{ref:x,style:{width:"100%",height:"100%"}}),(0,n.createPortal)((0,s.jsxs)("div",{style:{position:"fixed",left:M.left,top:M.top,width:c,height:c,zIndex:C?1:9999,opacity:C?.15:1,transition:"opacity 0.3s ease",pointerEvents:"none"},children:[(0,s.jsx)(k,{src:t,artboard:i,stateMachines:o,fit:r,alignment:l,layoutScaleFactor:u,autoplay:d,autoBind:f,viewModelSchema:p,viewModelData:g,onControllerReady:X,interactive:!1},F),(0,s.jsx)(h,{controller:I,placement:"top"})]}),document.body)]});const O="interactive"===w,V=(0,s.jsx)(k,{src:t,artboard:i,stateMachines:o,fit:r,alignment:l,layoutScaleFactor:u,autoplay:d,autoBind:f,viewModelSchema:p,viewModelData:g,onControllerReady:X},F);return O?(0,s.jsx)(R,{ref:x,children:(0,s.jsxs)("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:c,height:c},children:[(0,s.jsx)(D,{onClick:P,children:V}),(0,s.jsx)(h,{controller:I,placement:"top"})]})}):(0,s.jsxs)(R,{ref:x,children:[(0,s.jsx)(D,{onClick:P,children:V}),(0,s.jsx)(h,{controller:I})]})},H=e=>{let{theme:t,src:i,artboard:a,stateMachines:n,fit:r,alignment:l,layoutScaleFactor:u,autoplay:h,autoBind:d,viewModelSchema:c,viewModelData:m,movementMode:f,onControllerReady:p,onMovementControllerReady:g,interactive:v}=e;return(0,s.jsx)(o.NP,{theme:t,children:(0,s.jsx)(A,{src:i,artboard:a,stateMachines:n,fit:r,alignment:l,layoutScaleFactor:u,autoplay:h,autoBind:d,viewModelSchema:c,viewModelData:m,movementMode:f,onControllerReady:p,onMovementControllerReady:g,interactive:v})})}},24311(e,t,i){i.d(t,{avatarViewScript:()=>n});var s=i(45992),o=i(41381),a=i(95881);const n=(e,t)=>{let i,n=null,r=null,l=null,u=null,h=null;const d=t=>{var s,o;if(n=t,null!==h&&(t.setHasInteractiveQuestion(h),h=null),void 0!==i){const a=e.config;t.setSlideExpression(null!==(o=null===(s=a.expressionBySlide)||void 0===s?void 0:s[i])&&void 0!==o?o:null),i=void 0}},c=e=>{r=e,null!==l&&(e.setDragging(l),l=null),null!==u&&(e.setReactiveItemIds(u),u=null)};(0,o.p)({getTargetNodeItem:()=>e.item,initialState:void 0,renderApp:o=>{let{onUnmount:m}=o;const f=e.config;return m((()=>{n=null,r=null,l=null,u=null,h=null,i=void 0})),()=>(0,s.jsx)(a.q,{theme:t.theme,src:f.src,artboard:f.artboard||void 0,stateMachines:f.stateMachines,fit:f.fit,alignment:f.alignment,layoutScaleFactor:f.layoutScaleFactor,autoplay:f.autoplay,autoBind:f.autoBind,viewModelSchema:f.viewModelSchema,viewModelData:f.viewModelData,movementMode:f.movementMode,onControllerReady:d,onMovementControllerReady:c})},renderThumbnailApp:()=>{const i=e.config;return(0,s.jsx)(a.q,{theme:t.theme,src:i.src,artboard:i.artboard||void 0,stateMachines:i.stateMachines,fit:i.fit,alignment:i.alignment,layoutScaleFactor:i.layoutScaleFactor,autoplay:!1,autoBind:i.autoBind,viewModelSchema:i.viewModelSchema,viewModelData:i.viewModelData})}})(e,t),e.setApi({reactToOutcome:e=>{null===n||void 0===n||n.reactToOutcome(e)},setDragState:e=>{null===n||void 0===n||n.setDragState(e),r?r.setDragging(e):l=e},setHasDragAndDrop:e=>{null===n||void 0===n||n.setHasDragAndDrop(e)},setHasInteractiveQuestion:e=>{n?n.setHasInteractiveQuestion(e):h=e},setReactiveItemIds:e=>{r?r.setReactiveItemIds(e):u=e},setCurrentSlideId:t=>{var s,o;const a=e.config,r=t&&null!==(o=null===(s=a.expressionBySlide)||void 0===s?void 0:s[t])&&void 0!==o?o:null;n?n.setSlideExpression(r):null!==t&&(i=t)}})}},48571(e,t,i){i.d(t,{w:()=>o});var s=i(17588);function o(e,t,i){(0,s.useEffect)((()=>{if(!e||!t||!i.current)return;let s;const o=()=>{const{offsetWidth:e,offsetHeight:s}=i.current;t.style.width=`${e}px`,t.style.height=`${s}px`,t.style.maxWidth="100%",t.style.maxHeight="100%"};o(),e.resizeDrawingSurfaceToCanvas();const a=new ResizeObserver((()=>{o(),window.clearTimeout(s),s=window.setTimeout((()=>{e.resizeDrawingSurfaceToCanvas()}),100)}));return a.observe(i.current),()=>{a.disconnect(),window.clearTimeout(s)}}),[e,t,i])}},32297(e,t,i){i.d(t,{S:()=>l});var s=i(17588);function o(e,t){const i=[];for(const[s,a]of Object.entries(e)){const e=t?`${t}/${s}`:s;"object"===typeof a&&null!==a?i.push(...o(a,e)):i.push([e,a])}return i}const a={1:"string",2:"number",3:"boolean",4:"color",5:"list",6:"enum",7:"trigger",8:"viewModel"};function n(e){var t;return"number"===typeof e?null!==(t=a[e])&&void 0!==t?t:String(e):String(null!==e&&void 0!==e?e:"")}function r(e,t,i){const s=new Set;for(const o of e){const e=t?`${t}/${o.name}`:o.name,a=n(o.type);if(a===i)s.add(e);else if("viewModel"===a&&o.children)for(const t of r(o.children,e,i))s.add(t)}return s}function l(e,t,i){const a=(0,s.useMemo)((()=>JSON.stringify(null!==t&&void 0!==t?t:{})),[t]),n=(0,s.useMemo)((()=>r(null!==i&&void 0!==i?i:[],"","trigger")),[i]),l=(0,s.useMemo)((()=>r(null!==i&&void 0!==i?i:[],"","color")),[i]),u=(0,s.useRef)({});(0,s.useEffect)((()=>{if(!e)return;o(JSON.parse(a),"").forEach((t=>{let[i,s]=t;var o;try{if(n.has(i)){const t=Number(s)||0;if(t>(null!==(o=u.current[i])&&void 0!==o?o:0)){const t=e.trigger(i);t&&t.trigger()}u.current[i]=t}else if("string"===typeof s){const t=e.enum(i);if(t)t.value=s;else{const t=e.string(i);t&&(t.value=s)}}else if(l.has(i)){const t=e.color(i);t&&(t.value=Number(s))}else if("number"===typeof s){const t=e.number(i);t&&(t.value=s)}else if("boolean"===typeof s){const t=e.boolean(i);t&&(t.value=s)}}catch(a){}}))}),[e,a,n,l])}},41381(e,t,i){i.d(t,{p:()=>n});var s=i(70377),o=i(66264),a=i(60708);function n(e){let{getTargetNodeItem:t,renderApp:i,renderThumbnailApp:n,initialState:r}=e,l=!1;const u=[],h=e=>{u.push(e)};return e=>{const d=t(e.config),c=null===d||void 0===d?void 0:d.parentSlide;function m(){l=!1,u.forEach((e=>{e()})),u.length=0}function f(){if(!d)return;let e=null;if("idOfFreeNode"in d)e=document.getElementById(d.idOfFreeNode);else{const t=document.createElement("div");t.innerHTML=d.source;let i=t.getElementsByClassName("genially-widget-app");i.length||(i=t.getElementsByClassName("genially-widget-gallery"));const{id:s}=i[0];if(!s)return;e=document.getElementById(s)}if(e){let t;const o=i=>{l&&t?s.render(t(i),e):console.warn('"rerender" was called when the widget was already unmounted. This is a no-op. Did you forget to dispose of an event handler with "onUnmount"?')};t=i({setState:o,onUnmount:h,unmountNow:m}),l=!0,o(r),u.push((()=>{s.unmountComponentAtNode(e)}))}}function p(){if(!d||!("idOfThumbnailFreeNode"in d))return[];const e=document.getElementsByClassName(d.idOfThumbnailFreeNode);return Array.from(e).filter((e=>e instanceof HTMLElement))}const g=d&&"isTransversal"in d&&d.isTransversal,v=()=>{null===d||void 0===d||d.on(o.q.Mount,(()=>{f()})),null===d||void 0===d||d.on(o.q.Unmount,(()=>{m()}))};g?v():(null===c||void 0===c||c.on(a.m.Entering,(()=>{l||(f(),l||v())})),null===c||void 0===c||c.on(a.m.Exited,(()=>{l&&m()}))),null===c||void 0===c||c.on(a.m.ThumbnailMount,(()=>{!function(){if(!n||!d||!("idOfThumbnailFreeNode"in d))return;p().forEach((e=>{s.unmountComponentAtNode(e)}))}(),function(){if(!n||!d||!("idOfThumbnailFreeNode"in d))return;p().forEach((e=>{const{renderingSlideId:t}=e.dataset;s.render(n({renderingSlideId:t}),e)}))}()}))}}}}]);
//# sourceMappingURL=https://s3-static-genially.genially.com/view/static/js/4311.aff70d85.chunk.js.map