1(window.webpackJsonp=window.webpackJsonp||[]).push([["tutorai-chat",13],{A0D6:function(t,e){t.exports="https://cdn.skuola.net/build/assets/images/tutorai/tutorai_icon.f08ffa2f.svg"},FXsZ:function(t,e){t.exports="https://cdn.skuola.net/build/assets/images/tutorai/sendMessage.92e25861.svg"},GMYB:function(t,e,r){"use strict";r.r(e),r.d(e,"default",(function(){return S})),r.d(e,"openChat",(function(){return k}));var n=r("yXPU"),o=r.n(n),i=r("o0o1"),a=r.n(i),u=(r("u7xK"),r("A0D6")),s=r.n(u),c=r("FXsZ"),l=r.n(c),f=r("T9Ih"),h=r.n(f),p=document.querySelector(".tutor-ai-wrapper"),d=document.querySelector(".tutor-ai-icon"),y=document.querySelector(".tutor-ai-main-window"),v=document.querySelector("#closeChat"),g=document.querySelector("#resetChat"),m=document.querySelector("#chatMessage"),w=document.querySelector("#sendMessage"),b=document.querySelector(".tutor-ai-main-window-chat"),x=document.querySelector("#typingIndicator"),E=!0;function S(){var t=!1,e=null;function r(t){return n.apply(this,arguments)}function n(){return(n=o()(a.a.mark((function r(n){var o;return a.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i("user",n),r.next=3,fetch("/tutorai/question/",{method:"POST",body:JSON.stringify({message:n})}).then((function(t){return t.json()}));case 3:o=r.sent,void 0===(e=o.thread)||t||(t=!0,new EventSource("https://tutorai.skuola.net/.well-known/mercure?topic=/threads/"+e).onmessage=function(t){i("tutor",JSON.parse(t.data).data.content)});case 6:case"end":return r.stop()}}),r)})))).apply(this,arguments)}function i(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];String.prototype.stripSlashes=function(){return this.replace(/\\(.)/gm,"$1")};var n=document.createElement("div");if(n.classList.add("tutor-ai-chat-bubble"),n.classList.add(t+"-bubble"),"tutor"===t){var o=document.createElement("div");o.classList.add("tutor-ai-chat-bubble-icon");var i=document.createElement("img");i.src=s.a,o.appendChild(i),n.appendChild(o)}var a=document.createElement("div");a.classList.add("tutor-ai-chat-bubble-text"),a.innerHTML=e.stripSlashes(),n.appendChild(a),b.insertBefore(n,x),b.scrollTop=b.scrollHeight,r&&("tutor"===t?x.style.display="none":setTimeout((function(){x.style.display="flex",b.scrollTop=b.scrollHeight}),500)),m.value=""}function u(){return(u=o()(a.a.mark((function r(){return a.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,fetch("/tutorai/reset/",{method:"POST",body:{}}).then((function(t){return t.json()}));case 2:200===r.sent.status&&(document.querySelectorAll(".tutor-ai-chat-bubble").forEach((function(t){"introMessage"!==t.id&&"typingIndicator"!==t.id&&t.remove(),x.style.display="none"})),e=null,t=!1);case 4:case"end":return r.stop()}}),r)})))).apply(this,arguments)}function c(){return(c=o()(a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/tutorai/retrieve/",{method:"GET",headers:{"cache-control":"private, must-revalidate"}}).then((function(t){return t.json()}));case 2:t.sent.list.forEach((function(t){i(t.role,t.message,!1)}));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function f(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=w.querySelector("img");e.src=t?h.a:l.a}d.style.display="flex",function(){c.apply(this,arguments)}(),d.addEventListener("click",(function(){p.classList.add("chat-open"),d.style.display="none",y.style.display="block",b.scrollTop=b.scrollHeight})),v.addEventListener("click",(function(){E&&(d.style.display="flex"),y.style.display="none",p.classList.remove("chat-open")})),g&&g.addEventListener("click",(function(){!function(){u.apply(this,arguments)}()})),w.addEventListener("click",(function(){""!==m.value&&r(m.value)})),m.addEventListener("keyup",(function(t){""!==m.value?f(!0):f(!1),"Backspace"===t.key&&""===m.value&&f(!1),"Enter"===t.key&&""!==m.value&&(r(m.value),f(!1))}))}function k(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];p.classList.add("chat-open"),d.style.display="none",y.style.display="block",E=t,b.scrollTop=b.scrollHeight}},T9Ih:function(t,e){t.exports="https://cdn.skuola.net/build/assets/images/tutorai/sendMessage_blue.858d296a.svg"}
1,cDf5:function(t,e){function r(e){return t.exports=r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,r(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},fsL8:function(t,e,r){(function(e){var n=r("cDf5").default;function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */t.exports=o=function(){return i},t.exports.__esModule=!0,t.exports.default=t.exports;var r,i={},a=Object.prototype,u=a.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},c=s.iterator||"@@iterator",l=s.asyncIterator||"@@asyncIterator",f=s.toStringTag||"@@toStringTag";function h(t,e,r,n){Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{h({},"")}catch(r){h=function(t,e,r){return t[e]=r}}function p(t,e,n,o){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype);return h(a,"_invoke",function(t,e,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:r,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var s=_(u,n);if(s){if(s===y)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var c=d(t,e,n);if("normal"===c.type){if(o=n.done?4:2,c.arg===y)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=4,n.method="throw",n.arg=c.arg)}}}(t,n,new j(o||[])),!0),a}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}i.wrap=p;var y={};function v(){}function g(){}function m(){}var w={};h(w,c,(function(){return this}));var b=Object.getPrototypeOf,x=b&&b(b(L([])));x&&x!==a&&u.call(x,c)&&(w=x);var E=m.prototype=v.prototype=Object.create(w);function S(t){["next","throw","return"].forEach((function(e){h(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function r(o,i,a,s){var c=d(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==n(f)&&u.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,s)}))}s(c.arg)}var o;h(this,"_invoke",(function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}),!0)}function _(t,e){var n=e.method,o=t.i[n];if(o===r)return e.delegate=null,"throw"===n&&t.i.return&&(e.method="return",e.arg=r,_(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=d(o,t.i,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,y;var a=i.arg;return a?a.done?(e[t.r]=a.value,e.next=t.n,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,y):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,y)}function T(t){this.tryEntries.push(t)}function O(t){var e=t[4]||{};e.type="normal",e.arg=r,t[4]=e}function j(t){this.tryEntries=[[-1]],t.forEach(T,this),this.reset(!0)}function L(t){if(null!=t){var e=t[c];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function e(){for(;++o<t.length;)if(u.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return i.next=i}}throw new TypeError(n(t)+" is not iterable")}return g.prototype=m,h(E,"constructor",m),h(m,"constructor",g),h(m,f,g.displayName="GeneratorFunction"),i.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},i.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,h(t,f,"GeneratorFunction")),t.prototype=Object.create(E),t},i.awrap=function(t){return{__await:t}},S(k.prototype),h(k.prototype,l,(function(){return this})),i.AsyncIterator=k,i.async=function(t,r,n,o,a){void 0===a&&(a=e);var u=new k(p(t,r,n,o),a);return i.isGeneratorFunction(r)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},S(E),h(E,f,"Generator"),h(E,c,(function(){return this})),h(E,"toString",(function(){return"[object Generator]"})),i.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},i.values=L,j.prototype={constructor:j,reset:function(t){if(this.prev=this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEac
1h(O),!t)for(var e in this)"t"===e.charAt(0)&&u.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r){a.type="throw",a.arg=t,e.next=r}for(var o=e.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],u=this.prev,s=i[1],c=i[2];if(-1===i[0])return n("end"),!1;if(!s&&!c)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=u){if(u<s)return this.method="next",this.arg=r,n(s),!0;if(u<c)return n(c),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=e&&e<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o[2],y):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),O(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;O(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={i:L(t),r:e,n:n},"next"===this.method&&(this.arg=r),y}},i}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports}).call(this,r("E2g8").Promise)},o0o1:function(t,e,r){var n=r("fsL8")();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},u7xK:function(t,e,r){},yXPU:function(t,e,r){(function(e){function r(t,r,n,o,i,a,u){try{var s=t[a](u),c=s.value}catch(t){return void n(t)}s.done?r(c):e.resolve(c).then(o,i)}t.exports=function(t){return function(){var n=this,o=arguments;return new e((function(e,i){var a=t.apply(n,o);function u(t){r(a,e,i,u,s,"next",t)}function s(t){r(a,e,i,u,s,"throw",t)}u(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports}).call(this,r("E2g8").Promise)}},[["GMYB","runtime",0]]]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.