Current Path : /storage/v11800/affypharma/public_html/wp-content/plugins/ai-engine/app/

Linux v11800 5.3.0-1023-aws #25~18.04.1-Ubuntu SMP Fri Jun 5 15:19:18 UTC 2020 aarch64

Upload File :
Current File : /storage/v11800/affypharma/public_html/wp-content/plugins/ai-engine/app/chatbot.js
/*! For license information please see chatbot.js.LICENSE.txt */
(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=React;function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}var r=function(e){var t=[];return function(r,o){if("object"===n(o)&&null!==o){if(-1!==t.indexOf(o)){if(!e)throw console.warn("Circular reference found.",{key:r,value:o,cache:t,cacheIndex:t.indexOf(o)}),new Error("Circular reference found. Cancelled.");return}t.push(o)}return o}};function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return JSON.stringify(e,r(n),t)}e.n(t)().Component;var i=["active","disabled"],a=["if","className","disableTransition","children"];function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u.apply(this,arguments)}function l(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var f=wp.element,p=f.useState,d=f.useMemo,h=f.useEffect,m=f.useRef,y=function(e){var t=e.active,n=e.disabled,r=l(e,i);return React.createElement("div",u({active:t?"true":"false",disabled:n},r),React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",dangerouslySetInnerHTML:{__html:'<path d="M192 0C139 0 96 43 96 96V256c0 53 43 96 96 96s96-43 96-96V96c0-53-43-96-96-96zM64 216c0-13.3-10.7-24-24-24s-24 10.7-24 24v40c0 89.1 66.2 162.7 152 174.4V464H120c-13.3 0-24 10.7-24 24s10.7 24 24 24h72 72c13.3 0 24-10.7 24-24s-10.7-24-24-24H216V430.4c85.8-11.7 152-85.3 152-174.4V216c0-13.3-10.7-24-24-24s-24 10.7-24 24v40c0 70.7-57.3 128-128 128s-128-57.3-128-128V216z"/>'}}))},v=function(){return d((function(){return function(e,t){return Array.isArray(e)||(e=[e]),t&&Object.entries(t).forEach((function(t){var n=c(t,2),r=n[0];n[1]&&e.push(r)})),e.join(" ")}}),[])};function g(e){return!(!e||"string"!=typeof e)&&0===e.indexOf("http")}var b=function(e){var t=e.if,n=e.className,r=e.disableTransition,o=void 0!==r&&r,i=e.children,s=l(e,a),f=c(p(!1),2),d=f[0],m=f[1],y=c(p("mwai-transition"),2),v=y[0],g=y[1];return h((function(){o?m(t):t?(m(!0),setTimeout((function(){g("mwai-transition mwai-transition-visible")}),150)):g("mwai-transition")}),[t,o]),d?React.createElement("div",u({className:"".concat(n," ").concat(o?"":v),onTransitionEnd:function(){"mwai-transition"!==v||o||m(!1)}},s),i):null};function w(e){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(e)}function x(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,E(r.key),r)}}function E(e){var t=function(e,t){if("object"!=w(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=w(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==w(t)?t:String(t)}var S=function(){function e(){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),e.instance)return e.instance;this.chatbots=[],this.filters={},this.actions={},e.instance=this,"undefined"!=typeof window&&(window.MwaiAPI=e.instance)}var t,n;return t=e,n=[{key:"getChatbot",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return e?this.chatbots.find((function(t){return t.botId===e||t.customId===e})):this.chatbots[0]}},{key:"addFilter",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;this.filters[e]||(this.filters[e]=[]),this.filters[e].push({callback:t,priority:n}),this.filters[e].sort((function(e,t){return e.priority-t.priority}))}},{key:"applyFilters",value:function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return this.filters[e]?this.filters[e].reduce((function(e,t){return t.callback.apply(t,[e].concat(r))}),t):t}},{key:"addAction",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;this.actions[e]||(this.actions[e]=[]),this.actions[e].push({callback:t,priority:n}),this.actions[e].sort((function(e,t){return e.priority-t.priority}))}},{key:"doAction",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.actions[e]&&this.actions[e].forEach((function(e){e.callback.apply(e,n)}))}}],n&&x(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),O=new S,k=function(e,t,n){return O.applyFilters(e,t,n)};function j(e){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},j(e)}function R(){R=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,a=Object.create(i.prototype),c=new T(r||[]);return o(a,"_invoke",{value:I(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",m="completed",y={};function v(){}function g(){}function b(){}var w={};u(w,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(L([])));E&&E!==n&&r.call(E,a)&&(w=E);var S=b.prototype=v.prototype=Object.create(w);function O(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(o,i,a,c){var s=f(e[o],e,i);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==j(l)&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(l).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return i=i?i.then(o,o):o()}})}function I(t,n,r){var o=p;return function(i,a){if(o===h)throw new Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var c=r.delegate;if(c){var s=C(c,r);if(s){if(s===y)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var i=f(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,y;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(j(t)+" is not iterable")}return g.prototype=b,o(S,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,u(e,s,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},O(k.prototype),u(k.prototype,c,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new k(l(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},O(S),u(S,s,"Generator"),u(S,a,(function(){return this})),u(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(A),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;A(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return C(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function P(e,t,n,r,o,i,a){try{var c=e[i](a),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,o)}function A(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){P(i,r,o,a,c,"next",e)}function c(e){P(i,r,o,a,c,"throw",e)}a(void 0)}))}}var T=wp.element,L=(T.useMemo,T.useEffect),N=T.useState;function M(e,t){return D.apply(this,arguments)}function D(){return D=A(R().mark((function e(t,n){var r,o,i,a,c,s,u,l,f,p,d,h,m,y,v=arguments;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=v.length>2&&void 0!==v[2]?v[2]:null,n){e.next=14;break}return e.prev=2,e.next=5,t.json();case 5:return o=e.sent,r&&console.log("[".concat(r,"] IN: "),o),e.abrupt("return",o);case 10:return e.prev=10,e.t0=e.catch(2),console.error("Could not parse the regular response.",{err:e.t0,data}),e.abrupt("return",{success:!1,message:"Could not parse the regular response."});case 14:i=t.body.getReader(),a=new TextDecoder("utf-8"),c="",s="";case 18:return e.next=21,i.read();case 21:if(u=e.sent,l=u.value,f=u.done,c+=a.decode(l,{stream:!0}),!f){e.next=27;break}return e.abrupt("break",68);case 27:p=c.split("\n"),d=0;case 29:if(!(d<p.length-1)){e.next=65;break}if(0===p[d].indexOf("data: ")){e.next=32;break}return e.abrupt("continue",62);case 32:if("live"!==(h=JSON.parse(p[d].replace("data: ",""))).type){e.next=39;break}r&&console.log("[".concat(r," STREAM] LIVE: "),h),s+=h.data,n&&n(s,h.data),e.next=62;break;case 39:if("error"!==h.type){e.next=51;break}return e.prev=40,r&&console.error("[".concat(r," STREAM] ERROR: "),h.data),e.abrupt("return",{success:!1,message:h.data});case 45:return e.prev=45,e.t1=e.catch(40),console.error("Could not parse the 'error' stream.",{err:e.t1,data:h}),e.abrupt("return",{success:!1,message:"Could not parse the 'error' stream."});case 49:e.next=62;break;case 51:if("end"!==h.type){e.next=62;break}return e.prev=52,m=JSON.parse(h.data),r&&console.log("[".concat(r," STREAM] END: "),m),e.abrupt("return",m);case 58:return e.prev=58,e.t2=e.catch(52),console.error("Could not parse the 'end' stream.",{err:e.t2,data:h}),e.abrupt("return",{success:!1,message:"Could not parse the 'end' stream."});case 62:d++,e.next=29;break;case 65:c=p[p.length-1],e.next=18;break;case 68:return e.prev=68,y=JSON.parse(c),r&&console.log("[".concat(r," STREAM] IN: "),y),e.abrupt("return",y);case 74:return e.prev=74,e.t3=e.catch(68),console.error("Could not parse the buffer.",{err:e.t3,buffer:c}),e.abrupt("return",{success:!1,message:"Could not parse the buffer."});case 78:case"end":return e.stop()}}),e,null,[[2,10],[40,45],[52,58],[68,74]])}))),D.apply(this,arguments)}function F(e,t,n,r){return _.apply(this,arguments)}function _(){return(_=A(R().mark((function e(t,n,r,i){var a;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a={"Content-Type":"application/json"},r&&(a["X-WP-Nonce"]=r),i&&(a.Accept="text/event-stream"),e.next=5,fetch("".concat(t),{method:"POST",headers:a,body:o(n)});case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function B(e,t,n,r){return U.apply(this,arguments)}function U(){return U=A(R().mark((function e(t,n,r,o){var i,a=arguments;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=a.length>4&&void 0!==a[4]?a[4]:{},e.abrupt("return",new Promise((function(e,a){var c=new FormData;c.append("file",n);for(var s=0,u=Object.entries(i);s<u.length;s++){var l=I(u[s],2),f=l[0],p=l[1];c.append(f,p)}var d=new XMLHttpRequest;d.open("POST",t,!0),r&&d.setRequestHeader("X-WP-Nonce",r),d.upload.onprogress=function(e){if(e.lengthComputable&&o){var t=e.loaded/e.total*100;o(t)}},d.onload=function(){if(d.status>=200&&d.status<300)try{var t=JSON.parse(d.responseText);e(t)}catch(e){a({status:d.status,statusText:d.statusText,error:"The server response is not valid JSON"})}else{try{var n=JSON.parse(d.responseText);return void a({status:d.status,message:n.message})}catch(e){}a({status:d.status,statusText:d.statusText})}},d.onerror=function(){a({status:d.status,statusText:d.statusText})},d.send(c)})));case 2:case"end":return e.stop()}}),e)}))),U.apply(this,arguments)}function H(){return Math.random().toString(36).substring(2)}var z=function(){var e=I(N(!0),2),t=e[0],n=e[1];L((function(){var e=setTimeout((function(){var e=setInterval((function(){n((function(e){return!e}))}),500);return function(){return clearInterval(e)}}),200);return function(){return clearTimeout(e)}}),[]);var r={opacity:t?1:0,width:"1px",height:"1em",borderLeft:"8px solid",marginLeft:"2px"};return React.createElement("span",{style:r})};function $(e){return $="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$(e)}var G=["children"];function W(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?W(Object(n),!0).forEach((function(t){var r,o,i;r=e,o=t,i=n[t],o=function(e){var t=function(e,t){if("object"!=$(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=$(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==$(t)?t:String(t)}(o),o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):W(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function V(e){return function(e){if(Array.isArray(e))return K(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Z(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Q(){Q=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,a=Object.create(i.prototype),c=new P(r||[]);return o(a,"_invoke",{value:j(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",m="completed",y={};function v(){}function g(){}function b(){}var w={};u(w,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(A([])));E&&E!==n&&r.call(E,a)&&(w=E);var S=b.prototype=v.prototype=Object.create(w);function O(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(o,i,a,c){var s=f(e[o],e,i);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==$(l)&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(l).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return i=i?i.then(o,o):o()}})}function j(t,n,r){var o=p;return function(i,a){if(o===h)throw new Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var c=r.delegate;if(c){var s=R(c,r);if(s){if(s===y)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function R(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,R(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var i=f(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,y;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError($(t)+" is not iterable")}return g.prototype=b,o(S,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,u(e,s,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},O(k.prototype),u(k.prototype,c,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new k(l(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},O(S),u(S,s,"Generator"),u(S,a,(function(){return this})),u(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=A,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(C),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;C(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:A(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function J(e,t,n,r,o,i,a){try{var c=e[i](a),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,o)}function Y(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){J(i,r,o,a,c,"next",e)}function c(e){J(i,r,o,a,c,"throw",e)}a(void 0)}))}}function X(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,t)||Z(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Z(e,t){if(e){if("string"==typeof e)return K(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?K(e,t):void 0}}function K(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ee=wp.element,te=ee.useContext,ne=ee.createContext,re=ee.useState,oe=ee.useMemo,ie=ee.useEffect,ae=ee.useCallback,ce=ee.useRef,se="AI: ",ue=ne(),le=function(){var e=te(ue);if(!e)throw new Error("useChatbotContext must be used within a ChatbotContextProvider");return e},fe=function(e){var t,n,r,i,a,s=e.children,u=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,G),l=u.params,f=u.system,d=u.theme,y=u.atts,v=function(){var e=c(p(null),2),t=e[0],n=e[1],r=m(null);return h((function(){return function(){clearInterval(r.current)}}),[]),{timeElapsed:t,startChrono:function(){if(null===r.current){var e=Date.now();r.current=setInterval((function(){var t,r,o,i=Math.floor((Date.now()-e)/1e3);n((t=i,r=Math.floor(t/60),o=t%60,"".concat(r,":").concat(o.toString().padStart(2,"0"))))}),500)}},stopChrono:function(){clearInterval(r.current),r.current=null,n(null)}}}(),b=v.timeElapsed,w=v.startChrono,x=v.stopChrono,E=oe((function(){return(null==d?void 0:d.settings)||{}}),[d]),S=X(re(f.restNonce),2),j=S[0],R=S[1],I=X(re([]),2),C=I[0],P=I[1],A=X(re(H()),2),T=A[0],L=A[1],N=X(re(""),2),D=N[0],_=N[1],U=X(re(!1),2),z=U[0],$=U[1],W=X(re(!1),2),J=W[0],Z=W[1],K=X(re({localFile:null,uploadedId:null,uploadedUrl:null,uploadProgress:null}),2),ee=K[0],te=K[1],ne=X(re(!0),2),le=ne[0],fe=ne[1],pe=X(re(!1),2),de=pe[0],he=pe[1],me=X(re(null),2),ye=me[0],ve=me[1],ge=X(re(!1),2),be=ge[0],we=ge[1],xe=X(re(),2),Ee=xe[0],Se=xe[1],Oe=ce(),ke=ce(),je=ce(!1),Re=function(e){var t=c(p(!1),2),n=t[0],r=t[1],o=c(p(!1),2),i=o[0],a=o[1];return h((function(){"undefined"!=typeof window&&("SpeechRecognition"in window||"webkitSpeechRecognition"in window)&&a(!0)}),[]),h((function(){if(i){var e=new(window.SpeechRecognition||window.webkitSpeechRecognition);e.interimResults=!0,e.continuous=!0;var t=function(e){var t=Array.from(e.results).map((function(e){return e[0]})).map((function(e){return e.transcript})).join("");_(t)};return n?(e.addEventListener("result",t),e.start()):(e.removeEventListener("result",t),e.abort()),function(){e.abort()}}}),[n,i]),{isListening:n,setIsListening:r,speechRecognitionAvailable:i}}(),Ie=Re.isListening,Ce=Re.setIsListening,Pe=Re.speechRecognitionAvailable,Ae=f.stream||!1,Te=f.botId,Le=f.customId,Ne=f.userData,Me=f.sessionId,De=f.contextId,Fe=f.pluginUrl,_e=f.restUrl,Be=f.debugMode,Ue=null!==(t=null==f?void 0:f.typewriter)&&void 0!==t&&t,He=null!==(n=null==f?void 0:f.speech_recognition)&&void 0!==n&&n,ze=null!==(r=null==f?void 0:f.speech_synthesis)&&void 0!==r&&r,$e=null!==(i=null===(a=l.startSentence)||void 0===a?void 0:a.trim())&&void 0!==i?i:"",Ge=document.innerWidth<=768,We=function(e){var t,n,r,o,i,a,c,s,u,l,f,p,d,h,m,y,v,g,b,w,x,E,S=null!==(t=null===(n=e.guestName)||void 0===n?void 0:n.trim())&&void 0!==t?t:"",O=null!==(r=null===(o=e.textSend)||void 0===o?void 0:o.trim())&&void 0!==r?r:"",k=null!==(i=null===(a=e.textClear)||void 0===a?void 0:a.trim())&&void 0!==i?i:"",j=parseInt(e.textInputMaxLength),R=null!==(c=null===(s=e.textInputPlaceholder)||void 0===s?void 0:s.trim())&&void 0!==c?c:"",I=null!==(u=null===(l=e.textCompliance)||void 0===l?void 0:l.trim())&&void 0!==u?u:"",C=Boolean(e.window),P=Boolean(e.copyButton),A=Boolean(e.fullscreen),T=null!==(f=null===(p=e.icon)||void 0===p?void 0:p.trim())&&void 0!==f?f:"",L=null!==(d=null===(h=e.iconText)||void 0===h?void 0:h.trim())&&void 0!==d?d:"",N=parseInt(e.iconTextDelay||1),M=null!==(m=null===(y=e.iconAlt)||void 0===y?void 0:y.trim())&&void 0!==m?m:"",D=null!==(v=null===(g=e.iconPosition)||void 0===g?void 0:g.trim())&&void 0!==v?v:"",F=Boolean(e.iconBubble),_=null!==(b=null===(w=e.aiName)||void 0===w?void 0:w.trim())&&void 0!==b?b:"",B=null!==(x=null===(E=e.userName)||void 0===E?void 0:E.trim())&&void 0!==x?x:"",U=Boolean(null==e?void 0:e.aiAvatar),H=Boolean(null==e?void 0:e.userAvatar);return{textSend:O,textClear:k,textInputMaxLength:j,textInputPlaceholder:R,textCompliance:I,window:C,copyButton:P,fullscreen:A,localMemory:Boolean(e.localMemory),imageUpload:Boolean(e.imageUpload),fileSearch:Boolean(e.fileSearch),icon:T,iconText:L,iconTextDelay:N,iconAlt:M,iconPosition:D,iconBubble:F,aiName:_,aiAvatar:U,userName:B,userAvatar:H,guestName:S}}(l),qe=We.aiName,Ve=We.userName,Qe=We.aiAvatar,Je=We.userAvatar,Ye=We.textSend,Xe=We.textClear,Ze=We.textInputMaxLength,Ke=We.textInputPlaceholder,et=We.textCompliance,tt=We.guestName,nt=We.window,rt=We.copyButton,ot=We.fullscreen,it=We.localMemory,at=We.icon,ct=We.iconText,st=We.iconTextDelay,ut=We.iconAlt,lt=We.iconPosition,ft=We.iconBubble,pt=We.imageUpload,dt=We.fileSearch,ht=it&&(!!Le||!!Te),mt=ht?"mwai-chat-".concat(Le||Te):null,yt=oe((function(){var e=at?g(at)?at:Fe+"/images/"+at:Fe+"/images/chat-green.svg";return{cssVariables:Object.keys(E).reduce((function(e,t){return e["--mwai-".concat(t)]=E[t],e}),{}),iconUrl:e}}),[at,Fe,E]),vt=yt.cssVariables,gt=yt.iconUrl,bt=X(re(!1),2),wt=bt[0],xt=bt[1],Et=X(re(!1),2),St=Et[0],Ot=Et[1],kt=oe((function(){return"timeless"===(null==d?void 0:d.themeId)?"mwai-tools":"mwai-input"}),[null==d?void 0:d.themeId]),jt=oe((function(){return{text:Ye,image:"timeless"===(null==d?void 0:d.themeId)?Fe+"/images/submit-blue-arrow.svg":null,imageOnly:!1}}),[Fe,Ye,null==d?void 0:d.themeId]),Rt=function(){if(Mt(),$e){var e=[{id:H(),role:"assistant",content:$e,who:se,timestamp:(new Date).getTime()}];P(e)}else P([])};ie((function(){function e(){return(e=Y(Q().mark((function e(){var t,n;return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!z||j){e.next=14;break}return e.prev=1,e.next=4,F("".concat(_e,"/mwai/v1/start_session"));case 4:return t=e.sent,e.next=7,t.json();case 7:n=e.sent,R(n.restNonce),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),console.error("Error while fetching the restNonce.",e.t0);case 14:case"end":return e.stop()}}),e,null,[[1,11]])})))).apply(this,arguments)}!function(){e.apply(this,arguments)}()}),[z]),ie((function(){D.length>0&&!z&&$(!0)}),[z,D]),ie((function(){Rt()}),[$e]),ie((function(){(Le||Te)&&O.chatbots.push({botId:Te,chatId:T,customId:Le,open:function(){Bt((function(e){return[].concat(V(e),[{action:"open"}])}))},close:function(){Bt((function(e){return[].concat(V(e),[{action:"close"}])}))},clear:function(){Bt((function(e){return[].concat(V(e),[{action:"clear"}])}))},toggle:function(){Bt((function(e){return[].concat(V(e),[{action:"toggle"}])}))},ask:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];Bt((function(n){return[].concat(V(n),[{action:"ask",data:{text:e,submit:t}}])}))},setContext:function(e){var t=e.chatId,n=e.messages;Bt((function(e){return[].concat(V(e),[{action:"setContext",data:{chatId:t,messages:n}}])}))}})}),[Te,T,Le]),ie((function(){be?w():(!Ge&&je.current&&Oe.current.focusInput(),x())}),[be,w,x,Ge]);var It=ae((function(e){mt&&localStorage.setItem(mt,o({chatId:T,messages:e}))}),[mt,T]),Ct=function(){ve(null)};ie((function(){var e=[];if(mt&&(e=localStorage.getItem(mt)))return e=JSON.parse(e),P(e.messages),void L(e.chatId);Rt()}),[Te]),ie((function(){if(Ee){we(!1);var e=V(C),t=e.length>0?e[e.length-1]:null;if(!Ee.success)return"assistant"===t.role&&t.isQuerying&&e.pop(),e.pop(),e.push({id:H(),role:"system",content:Ee.message,who:se,timestamp:(new Date).getTime()}),P(e),void It(e);if("assistant"===t.role&&t.isQuerying)t.content=k("ai.reply",Ee.reply),Ee.images&&(t.images=Ee.images),t.timestamp=(new Date).getTime(),delete t.isQuerying;else if("assistant"===t.role&&t.isStreaming)t.content=k("ai.reply",Ee.reply),Ee.images&&(t.images=Ee.images),t.timestamp=(new Date).getTime(),delete t.isStreaming;else{var n={id:H(),role:"assistant",content:k("ai.reply",Ee.reply),who:se,timestamp:(new Date).getTime()};Ee.images&&(n.images=Ee.images),e.push(n)}P(e),It(e)}}),[Ee]);var Pt=ae(Y(Q().mark((function e(){return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,L(H());case 2:mt&&localStorage.removeItem(mt),Rt(),_("");case 5:case"end":return e.stop()}}),e)}))),[Te]),At=ae(function(){var e=Y(Q().mark((function e(t){var n,r,o,i,a,c,s,u,l,f,p,d,h,m;return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!be){e.next=3;break}return console.error("AI Engine: There is already a query in progress."),e.abrupt("return");case 3:return"string"!=typeof t&&(t=D),r=ee,o=null==ee?void 0:ee.uploadedUrl,i=null==ee||null===(n=ee.localFile)||void 0===n?void 0:n.type,a=!!i&&i.startsWith("image"),c=t,o&&(c=a?"![Uploaded Image](".concat(o,")\n").concat(t):"[Uploaded File](".concat(o,")\n").concat(t)),we(!0),_(""),Mt(),s=[].concat(V(C),[{id:H(),role:"user",content:c,who:"User: ",timestamp:(new Date).getTime()}]),It(s),u=H(),l=[].concat(V(s),[{id:u,role:"assistant",content:null,who:se,timestamp:null,isQuerying:!Ae,isStreaming:!!Ae}]),P(l),f=q({botId:Te,customId:Le,session:Me,chatId:T,contextId:De,messages:C,newMessage:t,newFileId:null==r?void 0:r.uploadedId,stream:Ae},y),e.prev=19,Be&&console.log("[CHATBOT] OUT: ",f),p=Ae?function(e){P((function(t){var n=V(t),r=n.length>0?n[n.length-1]:null;return r&&r.id===u&&(r.content=e,r.timestamp=(new Date).getTime()),n}))}:null,e.next=24,F("".concat(_e,"/mwai-ui/v1/chats/submit"),f,j,Ae);case 24:return d=e.sent,e.next=27,M(d,p,Be?"CHATBOT":null);case 27:if((h=e.sent).success||!h.message){e.next=37;break}return ve(h.message),(m=V(l)).pop(),m.pop(),P(m),It(m),we(!1),e.abrupt("return");case 37:Se(h),e.next=44;break;case 40:e.prev=40,e.t0=e.catch(19),console.error("An error happened in the handling of the chatbot response.",{err:e.t0}),we(!1);case 44:case"end":return e.stop()}}),e,null,[[19,40]])})));return function(t){return e.apply(this,arguments)}}(),[be,ee,C,It,Ae,Te,Le,Me,T,De,y,D,Be,_e,j]),Tt=ae((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=!(null==ee||!ee.uploadedId);je.current=document.activeElement===Oe.current.currentElement(),e?At(e):(t||D.length>0)&&At(D)}),[D,At,null==ee?void 0:ee.uploadedId]),Lt=function(){var e=Y(Q().mark((function e(t){var n,r,o,i,a,c=arguments;return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=c.length>1&&void 0!==c[1]?c[1]:"N/A",r=c.length>2&&void 0!==c[2]?c[2]:"N/A",e.prev=2,null!==t){e.next=6;break}return Mt(),e.abrupt("return");case 6:return o={type:n,purpose:r},i="".concat(_e,"/mwai-ui/v1/files/upload"),e.next=10,B(i,t,j,(function(e){te({localFile:t,uploadedId:null,uploadedUrl:null,uploadProgress:e})}),o);case 10:a=e.sent,te({localFile:t,uploadedId:a.data.id,uploadedUrl:a.data.url,uploadProgress:null}),e.next=19;break;case 14:e.prev=14,e.t0=e.catch(2),console.error("onFileUpload Error",e.t0),ve(e.t0.message||"An unknown error occurred"),Mt();case 19:case"end":return e.stop()}}),e,null,[[2,14]])})));return function(t){return e.apply(this,arguments)}}(),Nt=function(){var e=Y(Q().mark((function e(t){return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ye&&Ct(),e.abrupt("return",Lt(t));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Mt=function(){te({localFile:null,uploadedId:null,uploadedUrl:null,uploadProgress:null})},Dt=ae((function(){var e=setTimeout((function(){he((function(e){return e||Z(!0),e}))}),1e3*st);return function(){return clearTimeout(e)}}),[ct,st]);ie((function(){if(ct&&!st)Z(!0);else if(ct&&st)return Dt()}),[ct]);var Ft=X(re([]),2),_t=Ft[0],Bt=Ft[1],Ut=ae(Y(Q().mark((function e(){var t,n,r,o,i,a;return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:_t.length>0&&("ask"===(t=_t[0]).action?(n=t.data,r=n.text,n.submit?At(r):_(r)):"toggle"===t.action?he((function(e){return!e})):"open"===t.action?he(!0):"close"===t.action?he(!1):"clear"===t.action?Pt():"setContext"===t.action&&(o=t.data,i=o.chatId,a=o.messages,L(i),P(a)),Bt((function(e){return e.slice(1)})));case 1:case"end":return e.stop()}}),e)}))),[_t,Pt,At,L,_,P]);ie((function(){Ut()}),[Ut]);var Ht={setInputText:_,saveMessages:It,setMessages:P,resetMessages:Rt,resetError:Ct,onClear:Pt,onSubmit:At,onSubmitAction:Tt,onFileUpload:Lt,onUploadFile:Nt,setOpen:he,setWindowed:fe,setShowIconMessage:Z,setIsListening:Ce,setDraggingType:xt,setIsBlocked:Ot},zt={theme:d,botId:Te,customId:Le,userData:Ne,pluginUrl:Fe,inputText:D,messages:C,busy:be,error:ye,setBusy:we,typewriter:Ue,speechRecognition:He,speechSynthesis:ze,localMemory:ht,imageUpload:pt,uploadedFile:ee,fileSearch:dt,textSend:Ye,textClear:Xe,textInputMaxLength:Ze,textInputPlaceholder:Ke,textCompliance:et,aiName:qe,userName:Ve,guestName:tt,aiAvatar:Qe,userAvatar:Je,isWindow:nt,copyButton:rt,fullscreen:ot,icon:at,iconText:ct,iconAlt:ut,iconPosition:lt,iconBubble:ft,cssVariables:vt,iconUrl:gt,chatbotInputRef:Oe,conversationRef:ke,isMobile:Ge,open:de,windowed:le,showIconMessage:J,timeElapsed:b,isListening:Ie,speechRecognitionAvailable:Pe,uploadIconPosition:kt,submitButtonConf:jt,draggingType:wt,isBlocked:St};return React.createElement(ue.Provider,{value:{state:zt,actions:Ht}},s)};function pe(){return pe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pe.apply(this,arguments)}const de=["children","options"];var he,me;!function(e){e.blockQuote="0",e.breakLine="1",e.breakThematic="2",e.codeBlock="3",e.codeFenced="4",e.codeInline="5",e.footnote="6",e.footnoteReference="7",e.gfmTask="8",e.heading="9",e.headingSetext="10",e.htmlBlock="11",e.htmlComment="12",e.htmlSelfClosing="13",e.image="14",e.link="15",e.linkAngleBraceStyleDetector="16",e.linkBareUrlDetector="17",e.linkMailtoDetector="18",e.newlineCoalescer="19",e.orderedList="20",e.paragraph="21",e.ref="22",e.refImage="23",e.refLink="24",e.table="25",e.tableSeparator="26",e.text="27",e.textBolded="28",e.textEmphasized="29",e.textEscaped="30",e.textMarked="31",e.textStrikethroughed="32",e.unorderedList="33"}(he||(he={})),function(e){e[e.MAX=0]="MAX",e[e.HIGH=1]="HIGH",e[e.MED=2]="MED",e[e.LOW=3]="LOW",e[e.MIN=4]="MIN"}(me||(me={}));const ye=["allowFullScreen","allowTransparency","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","charSet","className","classId","colSpan","contentEditable","contextMenu","crossOrigin","encType","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","hrefLang","inputMode","keyParams","keyType","marginHeight","marginWidth","maxLength","mediaGroup","minLength","noValidate","radioGroup","readOnly","rowSpan","spellCheck","srcDoc","srcLang","srcSet","tabIndex","useMap"].reduce(((e,t)=>(e[t.toLowerCase()]=t,e)),{for:"htmlFor"}),ve={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},ge=["style","script"],be=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,we=/mailto:/i,xe=/\n{2,}$/,Ee=/^( *>[^\n]+(\n[^\n]+)*\n*)+\n{2,}/,Se=/^ *> ?/gm,Oe=/^ {2,}\n/,ke=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,je=/^\s*(`{3,}|~{3,}) *(\S+)?([^\n]*?)?\n([\s\S]+?)\s*\1 *(?:\n *)*\n?/,Re=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,Ie=/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,Ce=/^(?:\n *)*\n/,Pe=/\r\n?/g,Ae=/^\[\^([^\]]+)](:.*)\n/,Te=/^\[\^([^\]]+)]/,Le=/\f/g,Ne=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,Me=/^\s*?\[(x|\s)\]/,De=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,Fe=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,_e=/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/,Be=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?([^>]*)\/{0}>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1)[\s\S])*?)<\/\1>\n*/i,Ue=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,He=/^<!--[\s\S]*?(?:-->)/,ze=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,$e=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,Ge=/^\{.*\}$/,We=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,qe=/^<([^ >]+@[^ >]+)>/,Ve=/^<([^ >]+:\/[^ >]+)>/,Qe=/-([a-z])?/gi,Je=/^(.*\|?.*)\n *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*)\n?/,Ye=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,Xe=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,Ze=/^\[([^\]]*)\] ?\[([^\]]*)\]/,Ke=/(\[|\])/g,et=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,tt=/\t/g,nt=/^ *\| */,rt=/(^ *\||\| *$)/g,ot=/ *$/,it=/^ *:-+: *$/,at=/^ *:-+ *$/,ct=/^ *-+: *$/,st=/^([*_])\1((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1\1(?!\1)/,ut=/^([*_])((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1(?!\1|\w)/,lt=/^==((?:\[.*?\]|<.*?>(?:.*?<.*?>)?|`.*?`|.)*?)==/,ft=/^~~((?:\[.*?\]|<.*?>(?:.*?<.*?>)?|`.*?`|.)*?)~~/,pt=/^\\([^0-9A-Za-z\s])/,dt=/^[\s\S]+?(?=[^0-9A-Z\s\u00c0-\uffff&#;.()'"]|\d+\.|\n\n| {2,}\n|\w+:\S|$)/i,ht=/^\n+/,mt=/^([ \t]*)/,yt=/\\([^\\])/g,vt=/ *\n+$/,gt=/(?:^|\n)( *)$/,bt="(?:\\d+\\.)",wt="(?:[*+-])";function xt(e){return"( *)("+(1===e?bt:wt)+") +"}const Et=xt(1),St=xt(2);function Ot(e){return new RegExp("^"+(1===e?Et:St))}const kt=Ot(1),jt=Ot(2);function Rt(e){return new RegExp("^"+(1===e?Et:St)+"[^\\n]*(?:\\n(?!\\1"+(1===e?bt:wt)+" )[^\\n]*)*(\\n|$)","gm")}const It=Rt(1),Ct=Rt(2);function Pt(e){const t=1===e?bt:wt;return new RegExp("^( *)("+t+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+t+" (?!"+t+" ))\\n*|\\s*\\n*$)")}const At=Pt(1),Tt=Pt(2);function Lt(e,t){const n=1===t,r=n?At:Tt,o=n?It:Ct,i=n?kt:jt;return{match(e,t,n){const o=gt.exec(n);return o&&(t.list||!t.inline&&!t.simple)?r.exec(e=o[1]+e):null},order:1,parse(e,t,r){const a=n?+e[2]:void 0,c=e[0].replace(xe,"\n").match(o);let s=!1;return{items:c.map((function(e,n){const o=i.exec(e)[0].length,a=new RegExp("^ {1,"+o+"}","gm"),u=e.replace(a,"").replace(i,""),l=n===c.length-1,f=-1!==u.indexOf("\n\n")||l&&s;s=f;const p=r.inline,d=r.list;let h;r.list=!0,f?(r.inline=!1,h=u.replace(vt,"\n\n")):(r.inline=!0,h=u.replace(vt,""));const m=t(h,r);return r.inline=p,r.list=d,m})),ordered:n,start:a}},render:(t,n,r)=>e(t.ordered?"ol":"ul",{key:r.key,start:"20"===t.type?t.start:void 0},t.items.map((function(t,o){return e("li",{key:o},n(t,r))})))}}const Nt=/^\[([^\]]*)]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/,Mt=/^!\[([^\]]*)]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/,Dt=[Ee,je,Re,De,_e,Fe,He,Je,It,At,Ct,Tt],Ft=[...Dt,/^[^\n]+(?:  \n|\n{2,})/,Be,$e];function _t(e){return e.replace(/[ÀÁÂÃÄÅàáâãäåæÆ]/g,"a").replace(/[çÇ]/g,"c").replace(/[ðÐ]/g,"d").replace(/[ÈÉÊËéèêë]/g,"e").replace(/[ÏïÎîÍíÌì]/g,"i").replace(/[Ññ]/g,"n").replace(/[øØœŒÕõÔôÓóÒò]/g,"o").replace(/[ÜüÛûÚúÙù]/g,"u").replace(/[ŸÿÝý]/g,"y").replace(/[^a-z0-9- ]/gi,"").replace(/ /gi,"-").toLowerCase()}function Bt(e){return ct.test(e)?"right":it.test(e)?"center":at.test(e)?"left":null}function Ut(e,t,n){const r=n.inTable;n.inTable=!0;const o=t(e.trim(),n);n.inTable=r;let i=[[]];return o.forEach((function(e,t){"26"===e.type?0!==t&&t!==o.length-1&&i.push([]):("27"!==e.type||null!=o[t+1]&&"26"!==o[t+1].type||(e.text=e.text.replace(ot,"")),i[i.length-1].push(e))})),i}function Ht(e,t,n){n.inline=!0;const r=Ut(e[1],t,n),o=e[2].replace(rt,"").split("|").map(Bt),i=function(e,t,n){return e.trim().split("\n").map((function(e){return Ut(e,t,n)}))}(e[3],t,n);return n.inline=!1,{align:o,cells:i,header:r,type:"25"}}function zt(e,t){return null==e.align[t]?{}:{textAlign:e.align[t]}}function $t(e){return function(t,n){return n.inline?e.exec(t):null}}function Gt(e){return function(t,n){return n.inline||n.simple?e.exec(t):null}}function Wt(e){return function(t,n){return n.inline||n.simple?null:e.exec(t)}}function qt(e){return function(t){return e.exec(t)}}function Vt(e,t,n){if(t.inline||t.simple)return null;if(n&&!n.endsWith("\n"))return null;let r="";e.split("\n").every((e=>!Dt.some((t=>t.test(e)))&&(r+=e+"\n",e.trim())));const o=r.trimEnd();return""==o?null:[r,o]}function Qt(e){try{if(decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"").match(/^\s*(javascript|vbscript|data(?!:image)):/i))return}catch(e){return null}return e}function Jt(e){return e.replace(yt,"$1")}function Yt(e,t,n){const r=n.inline||!1,o=n.simple||!1;n.inline=!0,n.simple=!0;const i=e(t,n);return n.inline=r,n.simple=o,i}function Xt(e,t,n){const r=n.inline||!1,o=n.simple||!1;n.inline=!1,n.simple=!0;const i=e(t,n);return n.inline=r,n.simple=o,i}function Zt(e,t,n){return n.inline=!1,e(t,n)}const Kt=(e,t,n)=>({children:Yt(t,e[1],n)});function en(){return{}}function tn(){return null}function nn(...e){return e.filter(Boolean).join(" ")}function rn(e,t,n){let r=e;const o=t.split(".");for(;o.length&&(r=r[o[0]],void 0!==r);)o.shift();return r||n}function on(e,n={}){n.overrides=n.overrides||{},n.slugify=n.slugify||_t,n.namedCodesToUnicode=n.namedCodesToUnicode?pe({},ve,n.namedCodesToUnicode):ve;const r=n.createElement||t.createElement;function o(e,t,...o){const i=rn(n.overrides,`${e}.props`,{});return r(function(e,t){const n=rn(t,e);return n?"function"==typeof n||"object"==typeof n&&"render"in n?n:rn(t,`${e}.component`,e):e}(e,n.overrides),pe({},t,i,{className:nn(null==t?void 0:t.className,i.className)||void 0}),...o)}function i(e){e=e.replace(Ne,"");let r=!1;n.forceInline?r=!0:n.forceBlock||(r=!1===et.test(e));const i=f(l(r?e:`${e.trimEnd().replace(ht,"")}\n\n`,{inline:r}));for(;"string"==typeof i[i.length-1]&&!i[i.length-1].trim();)i.pop();if(null===n.wrapper)return i;const a=n.wrapper||(r?"span":"div");let c;if(i.length>1||n.forceWrapper)c=i;else{if(1===i.length)return c=i[0],"string"==typeof c?o("span",{key:"outer"},c):c;c=null}return t.createElement(a,{key:"outer"},c)}function a(e){const n=e.match(be);return n?n.reduce((function(e,n,r){const o=n.indexOf("=");if(-1!==o){const a=function(e){return-1!==e.indexOf("-")&&null===e.match(ze)&&(e=e.replace(Qe,(function(e,t){return t.toUpperCase()}))),e}(n.slice(0,o)).trim(),c=function(e){const t=e[0];return('"'===t||"'"===t)&&e.length>=2&&e[e.length-1]===t?e.slice(1,-1):e}(n.slice(o+1).trim()),s=ye[a]||a,u=e[s]=function(e,t){return"style"===e?t.split(/;\s?/).reduce((function(e,t){const n=t.slice(0,t.indexOf(":"));return e[n.replace(/(-[a-z])/g,(e=>e[1].toUpperCase()))]=t.slice(n.length+1).trim(),e}),{}):"href"===e||"src"===e?Qt(t):(t.match(Ge)&&(t=t.slice(1,t.length-1)),"true"===t||"false"!==t&&t)}(a,c);"string"==typeof u&&(Be.test(u)||$e.test(u))&&(e[s]=t.cloneElement(i(u.trim()),{key:r}))}else"style"!==n&&(e[ye[n]||n]=!0);return e}),{}):null}const c=[],s={},u={0:{match:Wt(Ee),order:1,parse:(e,t,n)=>({children:t(e[0].replace(Se,""),n)}),render:(e,t,n)=>o("blockquote",{key:n.key},t(e.children,n))},1:{match:qt(Oe),order:1,parse:en,render:(e,t,n)=>o("br",{key:n.key})},2:{match:Wt(ke),order:1,parse:en,render:(e,t,n)=>o("hr",{key:n.key})},3:{match:Wt(Re),order:0,parse:e=>({lang:void 0,text:e[0].replace(/^ {4}/gm,"").replace(/\n+$/,"")}),render:(e,t,n)=>o("pre",{key:n.key},o("code",pe({},e.attrs,{className:e.lang?`lang-${e.lang}`:""}),e.text))},4:{match:Wt(je),order:0,parse:e=>({attrs:a(e[3]||""),lang:e[2]||void 0,text:e[4],type:"3"})},5:{match:Gt(Ie),order:3,parse:e=>({text:e[2]}),render:(e,t,n)=>o("code",{key:n.key},e.text)},6:{match:Wt(Ae),order:0,parse:e=>(c.push({footnote:e[2],identifier:e[1]}),{}),render:tn},7:{match:$t(Te),order:1,parse:e=>({target:`#${n.slugify(e[1])}`,text:e[1]}),render:(e,t,n)=>o("a",{key:n.key,href:Qt(e.target)},o("sup",{key:n.key},e.text))},8:{match:$t(Me),order:1,parse:e=>({completed:"x"===e[1].toLowerCase()}),render:(e,t,n)=>o("input",{checked:e.completed,key:n.key,readOnly:!0,type:"checkbox"})},9:{match:Wt(n.enforceAtxHeadings?Fe:De),order:1,parse:(e,t,r)=>({children:Yt(t,e[2],r),id:n.slugify(e[2]),level:e[1].length}),render:(e,t,n)=>o(`h${e.level}`,{id:e.id,key:n.key},t(e.children,n))},10:{match:Wt(_e),order:0,parse:(e,t,n)=>({children:Yt(t,e[1],n),level:"="===e[2]?1:2,type:"9"})},11:{match:qt(Be),order:1,parse(e,t,n){const[,r]=e[3].match(mt),o=new RegExp(`^${r}`,"gm"),i=e[3].replace(o,""),c=(s=i,Ft.some((e=>e.test(s)))?Zt:Yt);var s;const u=e[1].toLowerCase(),l=-1!==ge.indexOf(u),f={attrs:a(e[2]),noInnerParse:l,tag:l?u:e[1]};return n.inAnchor=n.inAnchor||"a"===u,l?f.text=e[3]:f.children=c(t,i,n),n.inAnchor=!1,f},render:(e,t,n)=>o(e.tag,pe({key:n.key},e.attrs),e.text||t(e.children,n))},13:{match:qt($e),order:1,parse:e=>({attrs:a(e[2]||""),tag:e[1]}),render:(e,t,n)=>o(e.tag,pe({},e.attrs,{key:n.key}))},12:{match:qt(He),order:1,parse:()=>({}),render:tn},14:{match:Gt(Mt),order:1,parse:e=>({alt:e[1],target:Jt(e[2]),title:e[3]}),render:(e,t,n)=>o("img",{key:n.key,alt:e.alt||void 0,title:e.title||void 0,src:Qt(e.target)})},15:{match:$t(Nt),order:3,parse:(e,t,n)=>({children:Xt(t,e[1],n),target:Jt(e[2]),title:e[3]}),render:(e,t,n)=>o("a",{key:n.key,href:Qt(e.target),title:e.title},t(e.children,n))},16:{match:$t(Ve),order:0,parse:e=>({children:[{text:e[1],type:"27"}],target:e[1],type:"15"})},17:{match:(e,t)=>t.inAnchor?null:$t(We)(e,t),order:0,parse:e=>({children:[{text:e[1],type:"27"}],target:e[1],title:void 0,type:"15"})},18:{match:$t(qe),order:0,parse(e){let t=e[1],n=e[1];return we.test(n)||(n="mailto:"+n),{children:[{text:t.replace("mailto:",""),type:"27"}],target:n,type:"15"}}},20:Lt(o,1),33:Lt(o,2),19:{match:Wt(Ce),order:3,parse:en,render:()=>"\n"},21:{match:Vt,order:3,parse:Kt,render:(e,t,n)=>o("p",{key:n.key},t(e.children,n))},22:{match:$t(Ye),order:0,parse:e=>(s[e[1]]={target:e[2],title:e[4]},{}),render:tn},23:{match:Gt(Xe),order:0,parse:e=>({alt:e[1]||void 0,ref:e[2]}),render:(e,t,n)=>o("img",{key:n.key,alt:e.alt,src:Qt(s[e.ref].target),title:s[e.ref].title})},24:{match:$t(Ze),order:0,parse:(e,t,n)=>({children:t(e[1],n),fallbackChildren:t(e[0].replace(Ke,"\\$1"),n),ref:e[2]}),render:(e,t,n)=>s[e.ref]?o("a",{key:n.key,href:Qt(s[e.ref].target),title:s[e.ref].title},t(e.children,n)):o("span",{key:n.key},t(e.fallbackChildren,n))},25:{match:Wt(Je),order:1,parse:Ht,render:(e,t,n)=>o("table",{key:n.key},o("thead",null,o("tr",null,e.header.map((function(r,i){return o("th",{key:i,style:zt(e,i)},t(r,n))})))),o("tbody",null,e.cells.map((function(r,i){return o("tr",{key:i},r.map((function(r,i){return o("td",{key:i,style:zt(e,i)},t(r,n))})))}))))},26:{match:function(e,t){return t.inTable?(t.inline=!0,nt.exec(e)):null},order:1,parse:function(){return{type:"26"}},render:()=>" | "},27:{match:qt(dt),order:4,parse:e=>({text:e[0].replace(Ue,((e,t)=>n.namedCodesToUnicode[t]?n.namedCodesToUnicode[t]:e))}),render:e=>e.text},28:{match:Gt(st),order:2,parse:(e,t,n)=>({children:t(e[2],n)}),render:(e,t,n)=>o("strong",{key:n.key},t(e.children,n))},29:{match:Gt(ut),order:3,parse:(e,t,n)=>({children:t(e[2],n)}),render:(e,t,n)=>o("em",{key:n.key},t(e.children,n))},30:{match:Gt(pt),order:1,parse:e=>({text:e[1],type:"27"})},31:{match:Gt(lt),order:3,parse:Kt,render:(e,t,n)=>o("mark",{key:n.key},t(e.children,n))},32:{match:Gt(ft),order:3,parse:Kt,render:(e,t,n)=>o("del",{key:n.key},t(e.children,n))}};!0===n.disableParsingRawHTML&&(delete u[11],delete u[13]);const l=function(e){let t=Object.keys(e);function n(r,o){let i=[],a="";for(;r;){let c=0;for(;c<t.length;){const s=t[c],u=e[s],l=u.match(r,o,a);if(l){const e=l[0];r=r.substring(e.length);const t=u.parse(l,n,o);null==t.type&&(t.type=s),i.push(t),a=e;break}c++}}return i}return t.sort((function(t,n){let r=e[t].order,o=e[n].order;return r!==o?r-o:1})),function(e,t){return n(function(e){return e.replace(Pe,"\n").replace(Le,"").replace(tt,"    ")}(e),t)}}(u),f=(p=function(e,t){return function(n,r,o){const i=e[n.type].render;return t?t((()=>i(n,r,o)),n,r,o):i(n,r,o)}}(u,n.renderRule),function e(t,n={}){if(Array.isArray(t)){const r=n.key,o=[];let i=!1;for(let r=0;r<t.length;r++){n.key=r;const a=e(t[r],n),c="string"==typeof a;c&&i?o[o.length-1]+=a:null!==a&&o.push(a),i=c}return n.key=r,o}return p(t,e,n)});var p;const d=i(e);return c.length?o("div",null,d,o("footer",{key:"footer"},c.map((function(e){return o("div",{id:n.slugify(e.identifier),key:e.identifier},e.identifier,f(l(e.footnote,{inline:!0})))})))):d}const an=e=>{let{children:n,options:r}=e,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}(e,de);return t.cloneElement(on(n,r),o)};function cn(){return cn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},cn.apply(this,arguments)}var sn={strings:["These are the default values...","You know what you should do?","Use your own!","Have a great day!"],stringsElement:null,typeSpeed:0,startDelay:0,backSpeed:0,smartBackspace:!0,shuffle:!1,backDelay:700,fadeOut:!1,fadeOutClass:"typed-fade-out",fadeOutDelay:500,loop:!1,loopCount:1/0,showCursor:!0,cursorChar:"|",autoInsertCss:!0,attr:null,bindInputFocusEvents:!1,contentType:"html",onBegin:function(e){},onComplete:function(e){},preStringTyped:function(e,t){},onStringTyped:function(e,t){},onLastStringBackspaced:function(e){},onTypingPaused:function(e,t){},onTypingResumed:function(e,t){},onReset:function(e){},onStop:function(e,t){},onStart:function(e,t){},onDestroy:function(e){}},un=new(function(){function e(){}var t=e.prototype;return t.load=function(e,t,n){if(e.el="string"==typeof n?document.querySelector(n):n,e.options=cn({},sn,t),e.isInput="input"===e.el.tagName.toLowerCase(),e.attr=e.options.attr,e.bindInputFocusEvents=e.options.bindInputFocusEvents,e.showCursor=!e.isInput&&e.options.showCursor,e.cursorChar=e.options.cursorChar,e.cursorBlinking=!0,e.elContent=e.attr?e.el.getAttribute(e.attr):e.el.textContent,e.contentType=e.options.contentType,e.typeSpeed=e.options.typeSpeed,e.startDelay=e.options.startDelay,e.backSpeed=e.options.backSpeed,e.smartBackspace=e.options.smartBackspace,e.backDelay=e.options.backDelay,e.fadeOut=e.options.fadeOut,e.fadeOutClass=e.options.fadeOutClass,e.fadeOutDelay=e.options.fadeOutDelay,e.isPaused=!1,e.strings=e.options.strings.map((function(e){return e.trim()})),e.stringsElement="string"==typeof e.options.stringsElement?document.querySelector(e.options.stringsElement):e.options.stringsElement,e.stringsElement){e.strings=[],e.stringsElement.style.cssText="clip: rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;";var r=Array.prototype.slice.apply(e.stringsElement.children),o=r.length;if(o)for(var i=0;i<o;i+=1)e.strings.push(r[i].innerHTML.trim())}for(var a in e.strPos=0,e.currentElContent=this.getCurrentElContent(e),e.currentElContent&&e.currentElContent.length>0&&(e.strPos=e.currentElContent.length-1,e.strings.unshift(e.currentElContent)),e.sequence=[],e.strings)e.sequence[a]=a;e.arrayPos=0,e.stopNum=0,e.loop=e.options.loop,e.loopCount=e.options.loopCount,e.curLoop=0,e.shuffle=e.options.shuffle,e.pause={status:!1,typewrite:!0,curString:"",curStrPos:0},e.typingComplete=!1,e.autoInsertCss=e.options.autoInsertCss,e.autoInsertCss&&(this.appendCursorAnimationCss(e),this.appendFadeOutAnimationCss(e))},t.getCurrentElContent=function(e){return e.attr?e.el.getAttribute(e.attr):e.isInput?e.el.value:"html"===e.contentType?e.el.innerHTML:e.el.textContent},t.appendCursorAnimationCss=function(e){var t="data-typed-js-cursor-css";if(e.showCursor&&!document.querySelector("["+t+"]")){var n=document.createElement("style");n.setAttribute(t,"true"),n.innerHTML="\n        .typed-cursor{\n          opacity: 1;\n        }\n        .typed-cursor.typed-cursor--blink{\n          animation: typedjsBlink 0.7s infinite;\n          -webkit-animation: typedjsBlink 0.7s infinite;\n                  animation: typedjsBlink 0.7s infinite;\n        }\n        @keyframes typedjsBlink{\n          50% { opacity: 0.0; }\n        }\n        @-webkit-keyframes typedjsBlink{\n          0% { opacity: 1; }\n          50% { opacity: 0.0; }\n          100% { opacity: 1; }\n        }\n      ",document.body.appendChild(n)}},t.appendFadeOutAnimationCss=function(e){var t="data-typed-fadeout-js-css";if(e.fadeOut&&!document.querySelector("["+t+"]")){var n=document.createElement("style");n.setAttribute(t,"true"),n.innerHTML="\n        .typed-fade-out{\n          opacity: 0;\n          transition: opacity .25s;\n        }\n        .typed-cursor.typed-cursor--blink.typed-fade-out{\n          -webkit-animation: 0;\n          animation: 0;\n        }\n      ",document.body.appendChild(n)}},e}()),ln=new(function(){function e(){}var t=e.prototype;return t.typeHtmlChars=function(e,t,n){if("html"!==n.contentType)return t;var r=e.substring(t).charAt(0);if("<"===r||"&"===r){var o;for(o="<"===r?">":";";e.substring(t+1).charAt(0)!==o&&!(1+ ++t>e.length););t++}return t},t.backSpaceHtmlChars=function(e,t,n){if("html"!==n.contentType)return t;var r=e.substring(t).charAt(0);if(">"===r||";"===r){var o;for(o=">"===r?"<":"&";e.substring(t-1).charAt(0)!==o&&!(--t<0););t--}return t},e}()),fn=function(){function e(e,t){un.load(this,t,e),this.begin()}var t=e.prototype;return t.toggle=function(){this.pause.status?this.start():this.stop()},t.stop=function(){this.typingComplete||this.pause.status||(this.toggleBlinking(!0),this.pause.status=!0,this.options.onStop(this.arrayPos,this))},t.start=function(){this.typingComplete||this.pause.status&&(this.pause.status=!1,this.pause.typewrite?this.typewrite(this.pause.curString,this.pause.curStrPos):this.backspace(this.pause.curString,this.pause.curStrPos),this.options.onStart(this.arrayPos,this))},t.destroy=function(){this.reset(!1),this.options.onDestroy(this)},t.reset=function(e){void 0===e&&(e=!0),clearInterval(this.timeout),this.replaceText(""),this.cursor&&this.cursor.parentNode&&(this.cursor.parentNode.removeChild(this.cursor),this.cursor=null),this.strPos=0,this.arrayPos=0,this.curLoop=0,e&&(this.insertCursor(),this.options.onReset(this),this.begin())},t.begin=function(){var e=this;this.options.onBegin(this),this.typingComplete=!1,this.shuffleStringsIfNeeded(this),this.insertCursor(),this.bindInputFocusEvents&&this.bindFocusEvents(),this.timeout=setTimeout((function(){0===e.strPos?e.typewrite(e.strings[e.sequence[e.arrayPos]],e.strPos):e.backspace(e.strings[e.sequence[e.arrayPos]],e.strPos)}),this.startDelay)},t.typewrite=function(e,t){var n=this;this.fadeOut&&this.el.classList.contains(this.fadeOutClass)&&(this.el.classList.remove(this.fadeOutClass),this.cursor&&this.cursor.classList.remove(this.fadeOutClass));var r=this.humanizer(this.typeSpeed),o=1;!0!==this.pause.status?this.timeout=setTimeout((function(){t=ln.typeHtmlChars(e,t,n);var r=0,i=e.substring(t);if("^"===i.charAt(0)&&/^\^\d+/.test(i)){var a=1;a+=(i=/\d+/.exec(i)[0]).length,r=parseInt(i),n.temporaryPause=!0,n.options.onTypingPaused(n.arrayPos,n),e=e.substring(0,t)+e.substring(t+a),n.toggleBlinking(!0)}if("`"===i.charAt(0)){for(;"`"!==e.substring(t+o).charAt(0)&&(o++,!(t+o>e.length)););var c=e.substring(0,t),s=e.substring(c.length+1,t+o),u=e.substring(t+o+1);e=c+s+u,o--}n.timeout=setTimeout((function(){n.toggleBlinking(!1),t>=e.length?n.doneTyping(e,t):n.keepTyping(e,t,o),n.temporaryPause&&(n.temporaryPause=!1,n.options.onTypingResumed(n.arrayPos,n))}),r)}),r):this.setPauseStatus(e,t,!0)},t.keepTyping=function(e,t,n){0===t&&(this.toggleBlinking(!1),this.options.preStringTyped(this.arrayPos,this));var r=e.substring(0,t+=n);this.replaceText(r),this.typewrite(e,t)},t.doneTyping=function(e,t){var n=this;this.options.onStringTyped(this.arrayPos,this),this.toggleBlinking(!0),this.arrayPos===this.strings.length-1&&(this.complete(),!1===this.loop||this.curLoop===this.loopCount)||(this.timeout=setTimeout((function(){n.backspace(e,t)}),this.backDelay))},t.backspace=function(e,t){var n=this;if(!0!==this.pause.status){if(this.fadeOut)return this.initFadeOut();this.toggleBlinking(!1);var r=this.humanizer(this.backSpeed);this.timeout=setTimeout((function(){t=ln.backSpaceHtmlChars(e,t,n);var r=e.substring(0,t);if(n.replaceText(r),n.smartBackspace){var o=n.strings[n.arrayPos+1];n.stopNum=o&&r===o.substring(0,t)?t:0}t>n.stopNum?(t--,n.backspace(e,t)):t<=n.stopNum&&(n.arrayPos++,n.arrayPos===n.strings.length?(n.arrayPos=0,n.options.onLastStringBackspaced(),n.shuffleStringsIfNeeded(),n.begin()):n.typewrite(n.strings[n.sequence[n.arrayPos]],t))}),r)}else this.setPauseStatus(e,t,!1)},t.complete=function(){this.options.onComplete(this),this.loop?this.curLoop++:this.typingComplete=!0},t.setPauseStatus=function(e,t,n){this.pause.typewrite=n,this.pause.curString=e,this.pause.curStrPos=t},t.toggleBlinking=function(e){this.cursor&&(this.pause.status||this.cursorBlinking!==e&&(this.cursorBlinking=e,e?this.cursor.classList.add("typed-cursor--blink"):this.cursor.classList.remove("typed-cursor--blink")))},t.humanizer=function(e){return Math.round(Math.random()*e/2)+e},t.shuffleStringsIfNeeded=function(){this.shuffle&&(this.sequence=this.sequence.sort((function(){return Math.random()-.5})))},t.initFadeOut=function(){var e=this;return this.el.className+=" "+this.fadeOutClass,this.cursor&&(this.cursor.className+=" "+this.fadeOutClass),setTimeout((function(){e.arrayPos++,e.replaceText(""),e.strings.length>e.arrayPos?e.typewrite(e.strings[e.sequence[e.arrayPos]],0):(e.typewrite(e.strings[0],0),e.arrayPos=0)}),this.fadeOutDelay)},t.replaceText=function(e){this.attr?this.el.setAttribute(this.attr,e):this.isInput?this.el.value=e:"html"===this.contentType?this.el.innerHTML=e:this.el.textContent=e},t.bindFocusEvents=function(){var e=this;this.isInput&&(this.el.addEventListener("focus",(function(t){e.stop()})),this.el.addEventListener("blur",(function(t){e.el.value&&0!==e.el.value.length||e.start()})))},t.insertCursor=function(){this.showCursor&&(this.cursor||(this.cursor=document.createElement("span"),this.cursor.className="typed-cursor",this.cursor.setAttribute("aria-hidden",!0),this.cursor.innerHTML=this.cursorChar,this.el.parentNode&&this.el.parentNode.insertBefore(this.cursor,this.el.nextSibling)))},e}();function pn(e){return pn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pn(e)}function dn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function hn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dn(Object(n),!0).forEach((function(t){var r,o,i;r=e,o=t,i=n[t],o=function(e){var t=function(e,t){if("object"!=pn(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=pn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==pn(t)?t:String(t)}(o),o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var mn=function(e){var t={width:9,height:9,margin:"5px 0px 0px 5px",borderRadius:"50%",backgroundColor:"#a3a1a1",opacity:1,animation:"bouncing-loader 0.4s infinite alternate"};return React.createElement(React.Fragment,null,React.createElement("style",null,"\n          @keyframes bouncing-loader {\n            to {\n              opacity: 0.6;\n              transform: translateY(-10px);\n            }\n          }\n        "),React.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:26}},["0.1s","0.2s","0.3s"].map((function(e,n){return React.createElement("div",{key:n,style:hn(hn({},t),{},{animationDelay:e})})}))))},yn=["enabled","content","children"];function vn(){return vn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vn.apply(this,arguments)}function gn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return bn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function bn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var wn=wp.element,xn=wn.useState,En=wn.useEffect,Sn=wn.useRef,On=wn.useCallback;const kn=function(e){var t=e.enabled,n=e.content,r=e.children,o=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,yn),i=v(),a=gn(xn("idle"),2),c=a[0],s=a[1],u=gn(xn(!0),2),l=u[0],f=u[1],p=Sn(null),d=On((function(){p.current&&clearTimeout(p.current),p.current=setTimeout((function(){f(!1)}),500)}),[]),h=On((function(){p.current&&clearTimeout(p.current),f(!0)}),[]);En((function(){return function(){p.current&&clearTimeout(p.current)}}),[]);var m="success"===c?'<path d="M9 16.2l-3.5-3.5L5.9 12l2.1 2.1 5.1-5.1L14.5 9l-6 6.2z"/>':"error"===c?'<path d="M12 10.585l4.95-4.95 1.415 1.415L13.415 12l4.95 4.95-1.415 1.415L12 13.415l-4.95 4.95-1.415-1.415L10.585 12 5.635 7.05 7.05 5.635 12 10.585z"/>':'<path d="M7 5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-2v2a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-9a3 3 0 0 1 3-3h2zm2 2h5a3 3 0 0 1 3 3v5h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1zM5 9a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1z" />';return t?React.createElement("div",vn({onMouseEnter:d,onMouseLeave:h},o),React.createElement("div",{className:i("mwai-reply-actions",{"mwai-hidden":l})},React.createElement("div",{className:"mwai-copy-button",onClick:function(){try{navigator.clipboard.writeText(n),s("success")}catch(e){s("error"),console.warn("Not allowed to copy to clipboard. Make sure your website uses HTTPS.",{content:n})}finally{setTimeout((function(){s("idle")}),2e3)}}},React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",dangerouslySetInnerHTML:{__html:m}}))),r):r};function jn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Rn=wp.element.useMemo;const In=function(e){var t=e.role,n=void 0===t?"user":t,r=le().state,o=r.pluginUrl,i=r.iconUrl,a=r.guestName,c=r.userData,s=r.userName,u=r.aiName,l=r.userAvatar,f=r.aiAvatar,p=Rn((function(){var e="assistant"===n,t=!c&&!e,r=e?u:s||t&&a,p=e?f:l,d=e?i||"".concat(o,"/images/chat-openai.svg"):"".concat(o,"/images/avatar-user.svg"),h=function(e,t){return React.createElement("div",{className:"mwai-avatar"},React.createElement("img",{width:"32",height:"32",src:e,alt:t}))};if(!e&&l&&null!=c&&c.AVATAR_URL)return h(c.AVATAR_URL,"User Avatar");if(!r)return h((null==c?void 0:c.AVATAR_URL)||d,e?"AI Avatar":"User Avatar");if(g(r))return h(r,e?"AI Avatar":"User Avatar");if(p&&!t)return h(d,e?"AI Avatar":"User Avatar");var m=function(e,t,n){return n&&0!==Object.keys(n).length?Object.entries(n).reduce((function(e,t){var n=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return jn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?jn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t,2),r=n[0],o=n[1],i="{".concat(r,"}");return e.includes(i)?e.replace(i,o):e}),e):t||e||"Guest:"}(r,a,c);return React.createElement("div",{className:"mwai-name-text"},m)}),[n,u,s,a,c,i,f,l,o]);return React.createElement("span",{className:"mwai-name"},p)};function Cn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Pn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var An=wp.element,Tn=An.useState,Ln=An.useMemo,Nn=An.useEffect,Mn=An.useRef,Dn=function(e){var t=e.href,n=e.children;if(!t)return React.createElement("span",null,n);var r=window.location.hostname,o="_self";try{o=r===new URL(t,window.location.href).hostname?"_self":"_blank"}catch(e){console.error("Invalid URL:",e),o="_blank"}if("Uploaded File"===String(n)){var i=t.split("/").pop();return React.createElement("a",{href:t,target:o,rel:"noopener noreferrer",className:"mwai-filename"},React.createElement("span",null,"✓ ",i))}return React.createElement("a",{href:t,target:o,rel:"noopener noreferrer"},n)},Fn=function(e){var t,n=e.message,r=e.onRendered,o=void 0===r?function(){}:r,i=le().state.copyButton,a=Cn(Tn(n.isQuerying||n.isStreaming),1)[0],c=n.isQuerying,s=n.isStreaming,u=null!==(t=n.content)&&void 0!==t?t:"";(u.match(/```/g)||[]).length%2!=0?u+="\n```":n.isStreaming&&(u+="<BlinkingCursor />"),Nn((function(){a&&(!a||c||s)||o()}),[a,c,s]);var l=Ln((function(){var e={overrides:{BlinkingCursor:{component:z},a:{component:Dn},img:{props:{onError:function(e){null!==e.target.src.match(/\.(jpeg|jpg|gif|png)$/)&&(e.target.src="https://placehold.co/600x200?text=Expired+Image")},className:"mwai-image"}}}};return e}),[]);return c||s&&!u?React.createElement(mn,null):React.createElement(React.Fragment,null,React.createElement(In,{role:n.role}),React.createElement(kn,{content:n.content,enabled:i,className:"mwai-text"},React.createElement(an,{options:l},u)))},_n=function(e){var t=e.message,n=e.onRendered,r=void 0===n?function(){}:n,o=Cn(Tn(null==t?void 0:t.images),2),i=o[0],a=o[1];return Nn((function(){r()})),t.isQuerying?React.createElement(mn,null):React.createElement(React.Fragment,null,React.createElement(In,{role:t.role}),React.createElement("span",{className:"mwai-text"},React.createElement("div",{className:"mwai-gallery"},null==i?void 0:i.map((function(e,t){return React.createElement("a",{key:t,href:e,target:"_blank",rel:"noopener noreferrer"},React.createElement("img",{key:t,src:e,onError:function(){return function(e){a((function(t){return t.map((function(t,n){return n===e?"https://placehold.co/600x200?text=Expired+Image":t}))}))}(t)}}))})))))},Bn=function(e){var t=e.message,n=e.conversationRef,r=e.onRendered,o=void 0===r?function(){}:r,i=Mn(null),a=Cn(Tn(t.isQuerying),1)[0],c=Cn(Tn(!t.isQuerying),2),s=c[0],u=c[1],l=Cn(Tn(!1),2),f=l[0],p=(l[1],t.content);return Nn((function(){console.warn("Do not use the Typewriter Effect. Use Streaming instead.")}),[]),function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=m();h((function(){r.current=t}),[t]),h((function(){if(null!==e&&n){var t=setInterval((function(){r.current()}),e);return function(){return clearInterval(t)}}}),[e,n])}(200,(function(){null!=n&&n.current&&(f||(n.current.scrollTop=n.current.scrollHeight))}),!s),Nn((function(){if(a){if(i.current){var e={strings:[p],typeSpeed:k("typewriter.speed",15),showCursor:!1,onComplete:function(e){e.cursor&&e.cursor.remove(),o(),u((function(){return!0}))}},t=new fn(i.current,e);return function(){t.destroy()}}}else o()}),[t,t.isQuerying]),React.createElement(React.Fragment,null,t.isQuerying&&React.createElement(mn,null),!t.isQuerying&&a&&React.createElement(React.Fragment,null,React.createElement(In,{role:t.role}),React.createElement("span",{className:"mwai-text",ref:i})),!t.isQuerying&&!a&&React.createElement(React.Fragment,null,React.createElement(In,{role:t.role}),React.createElement("span",{className:"mwai-text"},React.createElement(an,null,p))))};const Un=function(e){var t,n=e.message,r=e.conversationRef,o=le().state.typewriter,i=v(),a=Mn(),c=i("mwai-reply",{"mwai-ai":"assistant"===n.role,"mwai-user":"user"===n.role,"mwai-system":"system"===n.role}),s=(null==n||null===(t=n.images)||void 0===t?void 0:t.length)>0,u=function(){a.current&&(n.isQuerying||a.current.classList.contains("mwai-rendered")||"undefined"!=typeof hljs&&(a.current.classList.add("mwai-rendered"),a.current.querySelectorAll("pre code").forEach((function(e){hljs.highlightElement(e)}))))};return Ln((function(){return"user"===n.role?React.createElement("div",{ref:a,className:c},React.createElement(Fn,{message:n})):"assistant"===n.role?s?React.createElement("div",{ref:a,className:c},React.createElement(_n,{message:n,conversationRef:r,onRendered:u})):o&&!n.isStreaming?React.createElement("div",{ref:a,className:c},React.createElement(Bn,{message:n,conversationRef:r,onRendered:u})):React.createElement("div",{ref:a,className:c},React.createElement(Fn,{message:n,conversationRef:r,onRendered:u})):"system"===n.role?React.createElement("div",{ref:a,className:c},React.createElement(Fn,{message:n,conversationRef:r,onRendered:u})):React.createElement("div",null,React.createElement("i",null,"Unhandled role."))}),[n,r,s,o])};function Hn(){return Hn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Hn.apply(this,arguments)}const zn=t.useLayoutEffect;var $n=function(e,t){"function"!=typeof e?e.current=t:e(t)};var Gn={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},Wn=function(e){Object.keys(Gn).forEach((function(t){e.style.setProperty(t,Gn[t],"important")}))},qn=null,Vn=function(e,t){var n=e.scrollHeight;return"border-box"===t.sizingStyle.boxSizing?n+t.borderSize:n-t.paddingSize},Qn=function(){},Jn=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak"],Yn=!!document.documentElement.currentStyle;function Xn(e,n,r){var o,i,a=(o=r,i=t.useRef(o),zn((function(){i.current=o})),i);t.useLayoutEffect((function(){var t=function(e){return a.current(e)};if(e)return e.addEventListener(n,t),function(){return e.removeEventListener(n,t)}}),[])}var Zn=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],Kn=function(e,n){var r,o=e.cacheMeasurements,i=e.maxRows,a=e.minRows,c=e.onChange,s=void 0===c?Qn:c,u=e.onHeightChange,l=void 0===u?Qn:u,f=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,Zn),p=void 0!==f.value,d=t.useRef(null),h=function(e,n){var r=(0,t.useRef)();return(0,t.useCallback)((function(t){e.current=t,r.current&&$n(r.current,null),r.current=n,n&&$n(n,t)}),[n])}(d,n),m=t.useRef(0),y=t.useRef(),v=function(){var e=d.current,t=o&&y.current?y.current:function(e){var t=window.getComputedStyle(e);if(null===t)return null;var n,r=(n=t,Jn.reduce((function(e,t){return e[t]=n[t],e}),{})),o=r.boxSizing;return""===o?null:(Yn&&"border-box"===o&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px"),{sizingStyle:r,paddingSize:parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),borderSize:parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth)})}(e);if(t){y.current=t;var n=function(e,t,n,r){void 0===n&&(n=1),void 0===r&&(r=1/0),qn||((qn=document.createElement("textarea")).setAttribute("tabindex","-1"),qn.setAttribute("aria-hidden","true"),Wn(qn)),null===qn.parentNode&&document.body.appendChild(qn);var o=e.paddingSize,i=e.borderSize,a=e.sizingStyle,c=a.boxSizing;Object.keys(a).forEach((function(e){var t=e;qn.style[t]=a[t]})),Wn(qn),qn.value=t;var s=Vn(qn,e);qn.value=t,s=Vn(qn,e),qn.value="x";var u=qn.scrollHeight-o,l=u*n;"border-box"===c&&(l=l+o+i),s=Math.max(l,s);var f=u*r;return"border-box"===c&&(f=f+o+i),[s=Math.min(f,s),u]}(t,e.value||e.placeholder||"x",a,i),r=n[0],c=n[1];m.current!==r&&(m.current=r,e.style.setProperty("height",r+"px","important"),l(r,{rowHeight:c}))}};return t.useLayoutEffect(v),Xn(window,"resize",v),r=v,Xn(document.fonts,"loadingdone",r),t.createElement("textarea",Hn({},f,{onChange:function(e){p||v(),s(e)},ref:h}))},er=t.forwardRef(Kn);function tr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var nr=wp.element,rr=nr.useState,or=nr.useMemo,ir=nr.useRef;const ar=function(){var e=v(),t=le(),n=t.state,r=t.actions,o=n.uploadedFile,i=n.busy,a=n.imageUpload,c=n.fileSearch,s=n.draggingType,u=r.onUploadFile,l=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return tr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(rr(!1),2),f=l[0],p=l[1],d=ir(),h=null==o?void 0:o.uploadedId,m=a||c,y=o,g=or((function(){return null!=y&&y.localFile?y.localFile.type.startsWith("image/")?"image":"document":s}),[y,s]),b=or((function(){var e="idle";null!=y&&y.uploadProgress?e="up":s?e="add":f&&h?e="del":h?e="ok":f&&!h&&(e="add");var t=g?g.toLowerCase():"idle";return"mwai-file-upload-icon mwai-".concat(t,"-").concat(e)}),[g,y,s,f,h]),w=or((function(){return null!=y&&y.uploadProgress?y.uploadProgress>99?99:Math.round(y.uploadProgress):""}),[y]);return m?React.createElement("div",{disabled:i,onClick:function(){null!=o&&o.localFile?u(null):i||d.current.click()},onMouseEnter:function(){return p(!0)},onMouseLeave:function(){return p(!1)},className:e("mwai-file-upload",{"mwai-enabled":null==o?void 0:o.uploadedId,"mwai-busy":(null==o?void 0:o.localFile)&&!(null!=o&&o.uploadedId)}),style:{cursor:i?"default":"pointer"}},React.createElement("div",{className:b},React.createElement("span",{className:"mwai-file-upload-progress"},w)),React.createElement("input",{type:"file",ref:d,onChange:function(e){var t=e.target.files[0];t&&u(t)},style:{display:"none"}})):null};function cr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var sr=wp.element,ur=sr.useRef,lr=sr.useState,fr=sr.useEffect,pr=sr.useImperativeHandle;const dr=function(){var e=v(),t=le(),n=t.state,r=t.actions,o=n.inputText,i=n.textInputMaxLength,a=n.textInputPlaceholder,c=n.error,s=n.speechRecognitionAvailable,u=n.isMobile,l=n.conversationRef,f=n.open,p=n.uploadIconPosition,d=n.draggingType,h=n.isBlocked,m=n.isListening,g=n.busy,b=n.speechRecognition,w=n.imageUpload,x=n.fileSearch,E=n.chatbotInputRef,S=r.onSubmitAction,O=r.setIsListening,k=r.resetError,j=r.setInputText,R=r.setIsBlocked,I=r.setDraggingType,C=r.onUploadFile,P=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return cr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(lr(!1),2),A=P[0],T=P[1],L=ur();pr(E,(function(){return{focusInput:function(){var e;null===(e=L.current)||void 0===e||e.focus()},currentElement:function(){return L.current}}})),fr((function(){!u&&f&&L.current.focus(),l.current&&(l.current.scrollTop=l.current.scrollHeight)}),[f,u,l]);var N=function(e,t){e.preventDefault(),e.stopPropagation();var n=e.dataTransfer.items[0];t?w&&function(e){return e.type.startsWith("image/")}(n)?(I("image"),R(!1)):x&&function(e){return["text/x-c","text/x-csharp","text/x-c++","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/html","text/x-java","application/json","text/markdown","application/pdf","text/x-php","application/vnd.openxmlformats-officedocument.presentationml.presentation","text/x-python","text/x-script.python","text/x-ruby","text/x-tex","text/plain","text/css","text/javascript","application/x-sh","application/typescript"].includes(e.type)}(n)?(I("document"),R(!1)):(I(!1),R(!0)):(I(!1),R(!1))},M=e("mwai-input-text",{"mwai-dragging":d,"mwai-blocked":h});return React.createElement("div",{ref:E,className:M,onDrop:function(e){if(e.preventDefault(),N(e,!1),!g){var t=e.dataTransfer.files[0];t&&("image"===d&&w||"document"===d&&x?C(t):(R(!0),setTimeout((function(){return R(!1)}),2e3)))}},onDragEnter:function(e){return N(e,!0)},onDragLeave:function(e){return N(e,!1)},onDragOver:function(e){return N(e,!0)}},"mwai-input"===p&&React.createElement(ar,null),React.createElement(er,{ref:L,disabled:g,placeholder:a,value:o,maxLength:i,onCompositionStart:function(){return T(!0)},onCompositionEnd:function(){return T(!1)},onKeyDown:function(e){A||"Enter"!==e.code||e.shiftKey||(e.preventDefault(),S())},onChange:function(e){return t=e.target.value,m&&O(!1),c&&k(),void j(t);var t}}),b&&React.createElement(y,{active:m,disabled:!s||g,className:"mwai-microphone",onClick:function(){return O(!m)}}))};var hr=wp.element,mr=hr.useMemo,yr=hr.useCallback;const vr=function(){var e=le(),t=e.state,n=e.actions,r=n.onClear,o=n.onSubmitAction,i=n.setIsListening,a=t.textClear,c=t.textSend,s=t.uploadedFile,u=t.inputText,l=t.messages,f=t.isListening,p=t.timeElapsed,d=t.busy,h=t.submitButtonConf,m=!(null==s||!s.uploadProgress),y=!(null!=s&&s.uploadedId)&&u.length<1&&(null==l?void 0:l.length)>1,v=mr((function(){return d?p?React.createElement("div",{className:"mwai-timer"},p):null:null!=h&&h.image?React.createElement("img",{src:h.image,alt:h.alt}):React.createElement("span",null,y?a:c)}),[d,p,y,a,c,h]),g=mr((function(){return"mwai-input-submit ".concat(d?"mwai-busy":"")}),[d]),b=yr((function(){f&&i(!1),y?r():o()}),[y,f,r,o,i]),w=yr((function(){d||b()}),[d,b]);return React.createElement("button",{className:g,disabled:d||m,onClick:w},v)};var gr=wp.element.useMemo;const br=function(){var e=le(),t=e.state,n=e.actions,r=t.theme,o=t.isWindow,i=t.fullscreen,a=t.aiName,c=t.pluginUrl,s=t.open,u=t.iconUrl,l=t.windowed,f=n.setOpen,p=n.setWindowed,d=gr((function(){if(!o)return null;var e="timeless"===(null==r?void 0:r.themeId),t=e?function(e,t,n){if(g(e))e=React.createElement("div",{className:"mwai-avatar"},React.createElement("img",{alt:"AI Engine",src:e}));else{var r=n||"".concat(t,"/images/chat-openai.svg");e=React.createElement("div",{className:"mwai-avatar"},React.createElement("img",{alt:"AI Engine",src:"".concat(r)}))}return e}(a,c,u):null;return React.createElement(React.Fragment,null,e&&React.createElement(React.Fragment,null,t,React.createElement("div",{className:"mwai-name"},React.createElement("small",null,"Discuss with"),React.createElement("div",null,a)),React.createElement("div",{style:{flex:"auto"}})),React.createElement("div",{className:"mwai-buttons"},i&&React.createElement("div",{className:"mwai-resize-button",onClick:function(){return p(!l)}}),React.createElement("div",{className:"mwai-close-button",onClick:function(){return f(!s)}})))}),[o,null==r?void 0:r.themeId,a,c,u,i,p,l,f,s]);return React.createElement("div",{className:"mwai-header"},d)};var wr=wp.element,xr=wr.useMemo,Er=wr.useEffect;const Sr=function(){var e=le(),t=e.state,n=e.actions,r=t.isWindow,o=t.iconText,i=t.showIconMessage,a=t.iconAlt,c=t.iconUrl,s=t.open,u=n.setShowIconMessage,l=n.setOpen;Er((function(){s&&i&&u(!1)}),[s,u,i]);var f=xr((function(){return r?React.createElement("div",{className:"mwai-trigger mwai-open-button"},React.createElement(b,{className:"mwai-icon-text-container",if:o&&i},React.createElement("div",{className:"mwai-icon-text-close",onClick:function(){return u(!1)}},"✕"),React.createElement("div",{className:"mwai-icon-text",onClick:function(){return l(!0)}},o)),React.createElement("div",{className:"mwai-icon-container",onClick:function(){return l(!0)}},React.createElement("img",{className:"mwai-icon",width:"64",height:"64",alt:a,src:c}))):null}),[r,o,i,a,c,u,l]);return React.createElement(React.Fragment,null,f)};function Or(e){return Or="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Or(e)}function kr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function jr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?kr(Object(n),!0).forEach((function(t){Rr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Rr(e,t,n){return t=function(e){var t=function(e,t){if("object"!=Or(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Or(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Or(t)?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ir(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Cr=wp.element,Pr=Cr.useState,Ar=Cr.useMemo,Tr=Cr.useLayoutEffect,Lr={overrides:{a:{props:{target:"_blank"}}}};const Nr=function(e){var t=v(),n=e.style,r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ir(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ir(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Pr(!0),2),o=r[0],i=r[1],a=le(),c=a.state,s=a.actions,u=c.theme,l=c.botId,f=c.customId,p=c.messages,d=c.textCompliance,h=c.isWindow,m=c.fullscreen,y=c.iconPosition,g=c.iconBubble,w=c.windowed,x=c.cssVariables,E=c.error,S=c.conversationRef,O=c.open,k=c.busy,j=c.uploadIconPosition,R=s.resetError,I=Ar((function(){return"css"===(null==u?void 0:u.type)?null==u?void 0:u.style:null}),[u]),C=t("mwai-chatbot",Rr(Rr(Rr(Rr(Rr(Rr(Rr(Rr({},"mwai-".concat(null==u?void 0:u.themeId,"-theme"),!0),"mwai-window",h),"mwai-bubble",g),"mwai-open",O),"mwai-fullscreen",!w||!h&&m),"mwai-bottom-left","bottom-left"===y),"mwai-top-right","top-right"===y),"mwai-top-left","top-left"===y));Tr((function(){o&&S.current&&(S.current.scrollTop=S.current.scrollHeight)}),[p,o,S,k]);var P=Ar((function(){return null==p?void 0:p.map((function(e){return React.createElement(Un,{key:e.id,message:e})}))}),[p]);return React.createElement(b,{id:"mwai-chatbot-".concat(f||l),className:C,style:jr(jr({},x),n),if:!0,disableTransition:!h},I&&React.createElement("style",null,I),React.createElement(Sr,null),React.createElement(br,null),React.createElement("div",{className:"mwai-content"},React.createElement("div",{ref:S,className:"mwai-conversation",onScroll:function(){if(S.current){var e=S.current,t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;i(n-t<=r+1)}}},P),E&&React.createElement("div",{className:"mwai-error",onClick:function(){return R()}},React.createElement(an,{options:Lr},E)),React.createElement("div",{className:"mwai-input"},React.createElement(dr,null),React.createElement(vr,null)),React.createElement("div",{className:"mwai-tools"},"mwai-tools"===j&&React.createElement(ar,null)),d&&React.createElement("div",{className:"mwai-compliance",dangerouslySetInnerHTML:{__html:d}})))},Mr=function(e){return React.createElement(fe,e,React.createElement(Nr,e))};function Dr(e){return Dr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Dr(e)}var Fr=["children"];function _r(){_r=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,a=Object.create(i.prototype),c=new P(r||[]);return o(a,"_invoke",{value:j(e,n,c)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",m="completed",y={};function v(){}function g(){}function b(){}var w={};u(w,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(A([])));E&&E!==n&&r.call(E,a)&&(w=E);var S=b.prototype=v.prototype=Object.create(w);function O(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(o,i,a,c){var s=f(e[o],e,i);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==Dr(l)&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(l).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return i=i?i.then(o,o):o()}})}function j(t,n,r){var o=p;return function(i,a){if(o===h)throw new Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var c=r.delegate;if(c){var s=R(c,r);if(s){if(s===y)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function R(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,R(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var i=f(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,y;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(Dr(t)+" is not iterable")}return g.prototype=b,o(S,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,u(e,s,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},O(k.prototype),u(k.prototype,c,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new k(l(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},O(S),u(S,s,"Generator"),u(S,a,(function(){return this})),u(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=A,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(C),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;C(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:A(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function Br(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ur(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Br(Object(n),!0).forEach((function(t){var r,o,i;r=e,o=t,i=n[t],o=function(e){var t=function(e,t){if("object"!=Dr(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Dr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Dr(t)?t:String(t)}(o),o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Br(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Hr(e,t,n,r,o,i,a){try{var c=e[i](a),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,o)}function zr(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){Hr(i,r,o,a,c,"next",e)}function c(e){Hr(i,r,o,a,c,"throw",e)}a(void 0)}))}}function $r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,c=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Gr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Gr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Wr=wp.element,qr=Wr.useContext,Vr=Wr.createContext,Qr=Wr.useState,Jr=Wr.useMemo,Yr=Wr.useEffect,Xr=Wr.useCallback,Zr=Vr(),Kr=function(e){var t=e.children,n=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,Fr),r=n.system,i=n.theme,a=$r(Qr([]),2),c=a[0],s=a[1],u=$r(Qr(null),2),l=u[0],f=u[1],p=$r(Qr(!1),2),d=p[0],h=p[1],m=Jr((function(){return(null==i?void 0:i.settings)||{}}),[i]),y=r.botId,v=r.customId,g=r.restNonce,b=r.pluginUrl,w=r.restUrl,x=r.debugMode,E=Jr((function(){return Object.keys(m).reduce((function(e,t){return e["--mwai-".concat(t)]=m[t],e}),{})}),[m]),S=Xr(zr(_r().mark((function e(){var t,n,r,i,a,c=arguments;return _r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=c.length>0&&void 0!==c[0]&&c[0],e.prev=1,t||h(!0),n={botId:y||v},x&&console.log("[DISCUSSIONS] OUT: ",n),e.next=7,fetch("".concat(w,"/mwai-ui/v1/discussions/list"),{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":g},body:o(n)});case 7:return r=e.sent,e.next=10,r.json();case 10:if((i=e.sent).success){e.next=13;break}throw new Error("Could not retrieve the discussions: ".concat(i.message));case 13:x&&console.log("[DISCUSSIONS] IN: ",i),a=i.chats.map((function(e){var t=JSON.parse(e.messages),n=JSON.parse(e.extra);return Ur(Ur({},e),{},{messages:t,extra:n})})),s(a),e.next=21;break;case 18:e.prev=18,e.t0=e.catch(1),console.error(e.t0);case 21:return e.prev=21,t||h(!1),e.finish(21);case 24:case"end":return e.stop()}}),e,null,[[1,18,21,24]])}))),[]);Yr((function(){S();var e=setInterval((function(){S(!0)}),5e3);return function(){return clearInterval(e)}}),[]);var O=function(e){var t=MwaiAPI.getChatbot(e);if(!t)throw new Error("Chatbot not found.",{botId:e,chatbots:MwaiAPI.chatbots});return t},k=function(){var e=zr(_r().mark((function e(t){var n;return _r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=c.find((function(e){return e.chatId===t}))){e.next=4;break}return console.error("Discussion not found.",{chatId:t,discussions:c}),e.abrupt("return");case 4:O(y).setContext({chatId:t,messages:n.messages}),f(n);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),j=function(){var e=zr(_r().mark((function e(){return _r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:O(y).clear();case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),R={onDiscussionClick:k,onNewChatClick:j},I={botId:y,pluginUrl:b,busy:d,setBusy:h,cssVariables:E,discussions:c,discussion:l,theme:i};return React.createElement(Zr.Provider,{value:{state:I,actions:R}},t)};function eo(e){return eo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},eo(e)}function to(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function no(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?to(Object(n),!0).forEach((function(t){ro(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):to(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ro(e,t,n){return t=function(e){var t=function(e,t){if("object"!=eo(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=eo(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==eo(t)?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var oo=wp.element,io=oo.useMemo,ao=oo.useEffect,co=function(e){var t=e.discussion,n=e.onClick,r=void 0===n?function(){}:n,o=e.selected,i=void 0!==o&&o,a=v(),c=t.messages,s=c[c.length-1],u=s.content.length>64?s.content.substring(0,64)+"...":s.content,l=a("mwai-discussion",{"mwai-active":i});return React.createElement("li",{className:l,onClick:r},u)};const so=function(e){var t=e.theme,n=e.style,r=e.params,o=v(),i=io((function(){return"css"===(null==t?void 0:t.type)?null==t?void 0:t.style:null}),[t]),a=function(){var e=qr(Zr);if(!e)throw new Error("useDiscussionsContext must be used within a DiscussionsContextProvider");return e}(),c=a.state,s=a.actions,u=c.botId,l=c.cssVariables,f=c.discussions,p=c.discussion,d=c.busy,h=s.onDiscussionClick,m=s.onNewChatClick,y=r.textNewChat;ao((function(){}));var g=o("mwai-discussions",ro({},"mwai-".concat(null==t?void 0:t.themeId,"-theme"),!0));return React.createElement(React.Fragment,null,React.createElement("div",{id:"mwai-discussions-".concat(u),className:g,style:no(no({},l),n)},i&&React.createElement("style",null,i),React.createElement("div",{className:o("mwai-header")},React.createElement("button",{onClick:function(){return m()},disabled:d},React.createElement("span",null,null!=y?y:"+ New chat"))),React.createElement("ul",{className:o("mwai-content")},f.map((function(e){return React.createElement(co,{key:e.id,discussion:e,selected:(null==p?void 0:p.id)===e.id,onClick:function(){return h(e.chatId)}})})))))},uo=function(e){return React.createElement(Kr,e,React.createElement(so,e))};var lo=wp.element.render;function fo(e){var t=document.createElement("textarea");return t.innerHTML=e,t.value}document.addEventListener("DOMContentLoaded",(function(){function e(e,t){e.forEach((function(e){var n=JSON.parse(fo(e.getAttribute("data-params"))),r=JSON.parse(fo(e.getAttribute("data-system"))),o=JSON.parse(fo(e.getAttribute("data-theme")));e.removeAttribute("data-params"),e.removeAttribute("data-system"),e.removeAttribute("data-theme"),lo(t({system:r,params:n,theme:o}),e)}))}e(document.querySelectorAll(".mwai-chatbot-container"),Mr),e(document.querySelectorAll(".mwai-discussions-container"),uo)}))})();

ESTRELLA Pharma – Affy Pharma Pvt Ltd

TREPODOX

POWDER FOR ORAL SUSPENSION
30ML (HDPE BOTTLE)

Composition

Cefpodoxime 50mg/5ml

Indications & Uses

UTIs, LRTs

TREPODOX – CV

POWDER FOR ORAL SUSPENSION
30ML (GLASS BOTTLE)

Composition

Cefpodoxime 50mg + Potassium Clavulanate 31.25mg/ 5ml

Indications & Uses

Upper & lower respiratory infections, Uncomplicated skin infections, Urinary Tract Infections

ESTY CLAV

POWDER FOR ORAL SUSPENSION
30ML (GLASS +HDPE BOTTLE)

Composition

Amoxycillin 200mg + Potassium clavulanate 28.50 mg/ 5ml

Indications & Uses

Community Acquired Pneumonia, Acute Exacerbations of Chronic Bronchitis, Upper Respiratory Tract Infections, Urinary Tract Infections

ESTRIXIME – CV

POWDER FOR ORAL SUSPENSION
30ML (GLASS BOTTLE)

Composition

Cefixime 50mg + Potassium clavulanate 31.25mg/5ml

Indications & Uses

Urinary Tract Inefctions, AECB, Otitis Media, Typhoid/p>

ESTRIXIME

POWDER FOR ORAL SUSPENSION
30ML (HDPE BOTTLE)

Composition

Cefixime 50mg/5ml

Indications & Uses

Urinary Tract Inefctions, Gastroenteritis

REOMELL

ORAL SUSPENSION
15 ml

Composition

Azithromycin 200mg/5ml

Indications & Uses

Community Acquired Pneumonia, Acute Exacerbations of Chronic Bronchitis,

TAMEST – DS

ORAL SUSPENSION
60 ml

Composition

Paracetamol 250mg/5ml

Indications & Uses

Fever, Pain

STREFEN

ORAL SUSPENSION
60 ml

Composition

Paracetamol 125mg + Mefenamic Acid 50mg/5ml

Indications & Uses

Pain, Fever

STREFOX

ORAL SUSPENSION
30 ml

Composition

Ofloxacin 50mg/5ml

Indications & Uses

Acute exacerbations of chronic Bronchitis, Diarrhoea

TAMACET-P

SYRUP
60 ml

Composition

Paracetamol 125mg + PPH 5mg + Cetirizine HCI 2mg/5ml

Indications & Uses

Fever, common cold & Flu

HEPTRELL

ORAL SUSPENSION
200ml

Composition

Cyproheptadine HCI 2mg + Tricholine citrate 0.275mg/5ml

Indications & Uses

Stimulate Apetite, Induces Weight Gain, Cure Allergies

TREP-DSR

CAPSULES ( HARD GELATIN)
10X10 (Alu-Alu)

Composition

Pantoprazole 40mg (EC) + Domperidone 30mg (SR)

Indications & Uses

GERD, Dyspepsia, Acid Peptic Disorders, Gastritis

RALE-DSR

CAPSULES ( HARD GELATIN)
11X10 (Alu-Alu)

Composition

Rabeprazole 20mg (EC) + Domperidone SR

Indications & Uses

GERD, Dyspepsia, Acid Peptic Disorders, Gastritis

STRETOP-40

INJECTION
40ml

Composition

Pantoprazole Sodium 40mg + NaCL

Indications & Uses

Acid-peptic disorders in hospitalized patients, Zollinger – Ellison Syndrome, Treatment of GERD Associated with Erasive Esophagitis, GL Bleed

DIMACID

SUSPENSION
170ml

Composition

Activated Dimethicone 25mg + Magnesium Hydroxide 200mg+ Aluminium Hydroxide Gel 200mg/10ml

Indications & Uses

Heartburn, Acid Indigestion

ELLAZYME

SYRUP
200ml

Composition

Alpha Amylase (1:2000) 50mg, Pepsin(1:3000) 10mg/5ml

Indications & Uses

Dyspepsia, Flatulence, Anorexia, Pancreatic Insufficiency

ARBOLL-Z

CAPSULES (HARD GELATIN)
10X3X10

Composition

Vitamin C 75mg + Vitamin B12 5mcg + Carbonyl Iron 100mg + Folic Acid 1.5mg + Zinc Sulphate 61.8mg

Indications & Uses

Hyphocromic Anemia in Pregnancy, Chronic and / or Acute Blood Loss, Post-gynaesurgery, Iron Deficiency Anemia

EST-D3 60K

CAPSULES (SOFT GELATIN)
10X1X4

Composition

Cholecalciferol 60000 UI

Indications & Uses

Osteoporosis, Osteoarthritis, Musculoskeletal Pain, Type- 2 Diabetes, Menstrual Irregularities, Pre-eclampsia, IUGR

STREBONA

ORAL SUSPENSION
200ml

Composition

Calcium Carbonate 625mg, Vitamin D3 125 IU/5ml

Indications & Uses

Osteomalacia, Osteoporosis, Fractures, Premenstrual Syndrome

STREFE-III

SYRUP (IRON TONIC)
300 ml

Composition

Iron (III) Hydroxide Polymaltose 50mg, Folic Acid 0.5mg/15ml

Indications & Uses

Pregnancy and lactation, Iron Deficiency Anaemia, Anaemia due to Excessive Haemorrhage, Anaemia Associated with Infections and Malignant Disease

STRECIUM

CAPSULES (SOFT GELATIN)
5X2X15

Composition

Calcitriol 0.25mcg + Calcium Carbonate 500mg + Zinc Sulphate 7.5mg

Indications & Uses

Osteoporosis, Hypoparathyroidism, Pregnancy & Lactation, Premenstrual Syndrome

ESTRE-SPAS

TABLETS
20X10

Composition

Mefenamic Acid 250mg + Dicyclomine HCI 10mg

Indications & Uses

Dysmenorrhea, Irritable Bowel Syndrome, Colic and Bladder Spasm, Abdominal Pain

TAMEST-A

TABLETS (BLISTERS)
20X10

Composition

Nimeulide 100mg + Paracetamo; 325mg

Indications & Uses

Arthritis Pain, Soft Tissue Trauma Including Sprains, Musculoskeletal Pain, Pain Following Dental Extraction

PARTRA FORTE

TABLETS

20X10

Composition

Tramadol 37.5mg + Paracetamol 325mg

Indications & Uses

Chronic Back Pain, Osteoarthritis, Postoperative Pain

UMRELY GEL

GEL
30g

Composition

Diclofenac Diethylamine 1.16% w/w + Oleum Linseed Oil 3 % w/w + Menthol 5% w/w +Methyl Salicylate 10% w/w

Indications & Uses

Sprains & Strains, Lower Back Pain, Joint Pain, Knee Pain

MOISTACT

CREAM
20g

Composition

Urea 10% +Lactic Acid 10% + Propylene Glycol 10% + Liquid Paraffin 10%

Indications & Uses

Foot Cracks, Keratolytic

BELODIP

OINTMENT
15g

Composition

Clotrimazole 1% w/w + Beclomethasone Dipropionate 0.025% w/w + Neomycin 0.5% w/w

Indications & Uses

Eczema, Psoriasis, Corticosteroid Responsive Dermatoses

MIN-DAND

LOTION
100 ml

Composition

Ketoconazole 2% w/v

Indications & Uses

Pityriasis, Dandruff

MIN-DAND-Z

LOTION
100 ml

Composition

Ketoconazole Shampoo 2% w/v + ZPTO 1% w/v

Indications & Uses

Pityriasis, Dandruff

MIN-DAND

SOAP
75g

Composition

Ketoconazole 1% w/w

Indications & Uses

Tinea Versicolor, Prophylaxis of Pityriasis Versicolor

FLUTRELLA

TABLETS
20X1X1

Composition

Fluconazole 200mg

Indications & Uses

Vaginal Candidiasis, Brochopulmonary Infections, Candiduria, Tinea Pedis, Corposis, Cruris, Versicolor

ESTRAVIT

SYRUP
200ml

Composition

L-Iysine HCI 25mg + Vitamin B1 2.5mg + Vitamin B2 2.5mg + Vitamin B6 0.75mg + D-panthenol 3mg +Niacinamide 25mg + Mecobalamin 2mcg/10ml

Indications & Uses

Sub-optimal Growth, Poor Weight Gain, Malnutrition, Prolonged Illness

LYCOSTER PLUS

SYRUP
225ml

Composition

Each 10ml Contains: Lycopene 6% 1000mcg + Vitamin A Palmitate 2500 IU + Vitamin E 10 IU + Ascorbic Acid 50mg + Selenium (as Sodium Selenate) 35mcg + Zinc (As Zinc Gluconate) 3mg + Manganese (as Manganese Gluconate) 2mg + Iodine ( As Potassium Iodine) 100mcg + Copper (As Copper Sulphate0 500mcg + Thiamine HCI 2mg + Riboflavine 3mg + Pyridoxine HCI 1.5mg

Indications & Uses

Tiredness, Stress, Feeling of Weakness, Vitality Deficiency

OSERON

CAPSULES (SOFT GELATIN)
10X1X10

Composition

Antioxidant, Multivitamin & Multiminerals

Indications & Uses

Tiredness, Stress, Feeling of Weakness, Vitality Deficiency

GERMELLA

CAPSULES (SOFT GELATIN)
10X1X10

Composition

Vitamin E (Natural) 400 IU + Wheat Germ Oil 100mg + Omega 3 Fatty Acids 30mg

Indications & Uses

Ulcerative colitis, Metabolic Syndrome, Rheumatoid Arthritis, Type-2 Diabetes, Cardiovascular Diseases

LYCOSTER GOLD

CAPSULES (SOFT GELATIN)
10X1X10

Composition

Each SG Contains Lycopene 6% 2000 IU + Vitamin A 2500 IU + Vitamin E Acetate 10 IU + Vitamin C 50 mg + Zinc sulphate Monohydrate 27.45mg + Selenium Dioxide 70mcg

Indications & Uses

Idiopathic Male Infertility, Pre-eclampsia, Prostate Cancer, Cardiovascular Diseases, Diabetes Mellitus

OSERON -G

CAPSULES (SOFT GELATIN)
10X1X11

Composition

Ginseng + Multivitamin + Multimineral

Indications & Uses

Tiredness, Stress, Feeling of Weakness, Vitality Deficiency

OSERON -G

CAPSULES (SOFT GELATIN)
10X1X11

Composition

Ginseng + Multivitamin + Multimineral

Indications & Uses

Tiredness, Stress, Feeling of Weakness, Vitality Deficiency

ESTRIXIME-200 LB

TABLETS (Alu-Alu)
20X10

Composition

Cefixime 200mg + Lactic Acid Bacilus 2.5 billion spores

Indications & Uses

Otitis Media, Pharyngitis & Tonsillitis, Uncomplicated Urinary Tract Infections, Acute Exacerbations of Chronic Bronchitis, Enteric Fever

ESTRIXIME-CV-325

TABLETS (Alu-Alu)
10X1X6

Composition

Cefixime 200mg + Potassium Clavulanate 125mg

Indications & Uses

Respiratory Tract Infections, Urinary Tract Infections, Skin & Skin Structure Infections

ESTY CLAV-625 LB

TABLETS (Alu-Alu)
10X1X6

Composition

Amoxycillin 500mg + Potassium Clavulanate 125mg

Indications & Uses

Respiratory Tract Infections, Community Acquired Pneumonia, Gynaecological Infections, Acute Exacerbations of Chronic Bronchitis, Skin and Soft Tissue Infections

FLOXEST

TABLETS (Blister)
20X10

Composition

Ofloxacin 200mg + Ornidazole 500mg

Indications & Uses

Surgical ions, Diarrheas of Mixed Etiology, Gynaecological Infections, Orofacial and Dental Infections

VOFLOX-500

TABLETS
10X10

Composition

Levofloxacin 500mg

Indications & Uses

Acute Bacterial Sinusitis, Acute Bacterial Exacerbations of Chronic Bronchitis, Skin & Skin Structure Infections, Chronic Bacterial Prostatitis, Urinary Tract Infections

FLOXEST – O

TABLETS (Alu-Alu)
20X10

Composition

Cefixime 200mg + Ofloxacin 200mg

Indications & Uses

Community Acquired Pneumonia, Multiple Drug Resistant-TB, Typhoid

FLOXEST

TABLETS (Alu-Alu)
20X10

Composition

Ofloxacin 200mg

Indications & Uses

Community Acquired Pneumonia, Multiple Drug Resistant-TB, Typhoid

ESTY CLAV- 1.2

INJECTIONS
1.2g

Composition

Amoxycillin 1000mg + Potassium Clavulanate 200mg + WFI

Indications & Uses

Community Acquired Pneumonia, Gynaecological Infections, Upper Respiratory Tract Infections, Skin and Soft Tissue Infections, Urinary Tract Infections, Acute Exacerbations of Chronic Bronchitis

TRELLON-SB 1.5

INJECTIONS
1.5g

Composition

Ceftriaxone 1000mg + Sulbactam 500mg + WFI

Indications & Uses

Gynaecological Infections, Lower Respiratory Tract Infections, Intra-abdominal Infections with Aerobic Organisms, Surgical Prophylaxis

TRELLON-TZ 1.125

INJECTIONS
1.125gm

Composition

Ceftriaxone 1000mg + Tazobactam 500 mg + WFI

Indications & Uses

Bone & Joint Infections, Intra-abdominal Infections, Bacterial Meningitis, Pre-operative Surgical Prophylaxis

RELLAM

INJECTIONS
1gm

Composition

Meropenem 1gm + WFI

Indications & Uses

Complicated Intra-abdominal Infection (cIAI), Complicated Skin & Skin Structure Infections (cSSSI), Bacterial Meningitis, Noscocomial Pneumonia

TRELIN-Z 4.5

INJECTIONS
4.5gm

Composition

Piperacillin 4000mg + Tazobactam 500mg + WFI

Indications & Uses

Intra-abdominal Infections, Complicated Urinary Tract Infections, Febrile Neutropenia, Lower Respiratory Tract Infections

TRELIN-Z 4.5

INJECTIONS
4.5gm

Composition

Piperacillin 4000mg + Tazobactam 500mg + WFI

Indications & Uses

Intra-abdominal Infections, Complicated Urinary Tract Infections, Febrile Neutropenia, Lower Respiratory Tract Infections

BUTRELLA

SYRUP

100ml

Composition

Ambroxol HCI 15mg + Guaiphensin 50mg + Terbutaline Sulphate 1.5mg + Mentholated Base/5ml

Indications & Uses

Bronchitis, Productive Cough, Emphysema, Bronchial Asthma

BUTRELLA-BR

SYRUP

100ml

Composition

Terbutaline Sulphate 1.25mg + Bromhexine HCI 4mg + Guaiphenesin 50mg + Methalated Base/5ml

Indications & Uses

Acute Cough, Abnormal Mucus Secretion, Productive Cough

DEXTRIN

SYRUP
100ml

Composition

Dextromethorphan Hydrobromide 10mg + Phenylpherine 5 mg + Cetrizine 5mg + Mentholated Base/5ml

Indications & Uses

Commom Cold and Flu, Nasal Congestion, Sore Throat

VOTRELL-M

TABLETS (Alu-Alu)
20X10

Composition

Levocetirizine 5mg + Montelukast 10mg

Indications & Uses

Allergic Rhinitis, Nasal Congestion, Asthma

VOTRELL

TABLETS (Alu-Alu)
20X11

Composition

Levocetirizine 5mg

Indications & Uses

Chronic Idiopathic Urticaria (CIU), Seasonal Allergic Rhinitis (SAR), Perennial Allergic Rhinitis (PAR)

Arrange A Callback
[]
1 Step 1
Full Name
Telephone
Departmentyour full name
Postal Address
Message
0 /
Previous
Next
Shopping Basket