Plugin Directory

Changeset 3153708

Timestamp:
09/18/2024 06:47:24 AM (14 months ago)
Author:
TigrouMeow
Message:

Minor enhancements. Version 2.6.2.

Location:
ai-engine/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • ai-engine/trunk/ai-engine.php

    r3144578 r3153708  
    44Plugin URI: https://wordpress.org/plugins/ai-engine/
    55Description: Chat, Create, Translate, Automate, Finetune with AI! Copilot, Internal API. Sleek UI. Hundreds of AI models supported. Build your dream project now!
    6 Version: 2.6.1
     6Version: 2.6.2
    77Author: Jordy Meow
    88Author URI: https://jordymeow.com
     
    1414*/
    1515
    16 define( 'MWAI_VERSION', '2.6.1' );
     16define( 'MWAI_VERSION', '2.6.2' );
    1717define( 'MWAI_PREFIX', 'mwai' );
    1818define( 'MWAI_DOMAIN', 'ai-engine' );
  • ai-engine/trunk/app/index.js

    r3144578 r3153708  
    11/*! For license information please see index.js.LICENSE.txt */
    2 (()=>{"use strict";var __webpack_modules__={1469:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{G:()=>ChatbotContextProvider,o:()=>useChatbotContext});var _neko_ui__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(8135),_app_chatbot_helpers__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(6966),_app_chatbot_MwaiAPI__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(1137),_app_helpers__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(7678);function _typeof(e){return _typeof="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},_typeof(e)}var _excluded=["children"];function ownKeys(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 _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach((function(t){_defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _createForOfIteratorHelper(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){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 _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==_typeof(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(_typeof(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 asyncGeneratorStep(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){asyncGeneratorStep(o,r,a,i,l,"next",e)}function l(e){asyncGeneratorStep(o,r,a,i,l,"throw",e)}i(void 0)}))}}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(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)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(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 _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _objectWithoutProperties(e,t){if(null==e)return{};var n,r,a=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}var _wp$element=wp.element,useContext=_wp$element.useContext,createContext=_wp$element.createContext,useState=_wp$element.useState,useMemo=_wp$element.useMemo,useEffect=_wp$element.useEffect,useCallback=_wp$element.useCallback,useRef=_wp$element.useRef,rawAiName="AI: ",rawUserName="User: ",ChatbotContext=createContext(),useChatbotContext=function(){var e=useContext(ChatbotContext);if(!e)throw new Error("useChatbotContext must be used within a ChatbotContextProvider");return e},ChatbotContextProvider=function ChatbotContextProvider(_ref){var _system$typewriter,_system$speech_recogn,_system$speech_synthe,_params$startSentence,_params$startSentence2,children=_ref.children,rest=_objectWithoutProperties(_ref,_excluded),params=rest.params,system=rest.system,theme=rest.theme,atts=rest.atts,_useChrono=(0,_app_chatbot_helpers__WEBPACK_IMPORTED_MODULE_0__.dh)(),timeElapsed=_useChrono.timeElapsed,startChrono=_useChrono.startChrono,stopChrono=_useChrono.stopChrono,shortcodeStyles=useMemo((function(){return(null==theme?void 0:theme.settings)||{}}),[theme]),_useState=useState(system.restNonce),_useState2=_slicedToArray(_useState,2),restNonce=_useState2[0],setRestNonce=_useState2[1],_useState3=useState([]),_useState4=_slicedToArray(_useState3,2),messages=_useState4[0],setMessages=_useState4[1],_useState5=useState([]),_useState6=_slicedToArray(_useState5,2),shortcuts=_useState6[0],setShortcuts=_useState6[1],_useState7=useState([]),_useState8=_slicedToArray(_useState7,2),blocks=_useState8[0],setBlocks=_useState8[1],_useState9=useState(!1),_useState10=_slicedToArray(_useState9,2),locked=_useState10[0],setLocked=_useState10[1],_useState11=useState((0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.vx)()),_useState12=_slicedToArray(_useState11,2),chatId=_useState12[0],setChatId=_useState12[1],_useState13=useState(""),_useState14=_slicedToArray(_useState13,2),inputText=_useState14[0],setInputText=_useState14[1],_useState15=useState(!1),_useState16=_slicedToArray(_useState15,2),chatbotTriggered=_useState16[0],setChatbotTriggered=_useState16[1],_useState17=useState(!1),_useState18=_slicedToArray(_useState17,2),showIconMessage=_useState18[0],setShowIconMessage=_useState18[1],_useState19=useState({localFile:null,uploadedId:null,uploadedUrl:null,uploadProgress:null}),_useState20=_slicedToArray(_useState19,2),uploadedFile=_useState20[0],setUploadedFile=_useState20[1],_useState21=useState(!0),_useState22=_slicedToArray(_useState21,2),windowed=_useState22[0],setWindowed=_useState22[1],_useState23=useState(!1),_useState24=_slicedToArray(_useState23,2),open=_useState24[0],setOpen=_useState24[1],_useState25=useState(null),_useState26=_slicedToArray(_useState25,2),error=_useState26[0],setError=_useState26[1],_useState27=useState(!1),_useState28=_slicedToArray(_useState27,2),busy=_useState28[0],setBusy=_useState28[1],_useState29=useState(!1),_useState30=_slicedToArray(_useState29,2),busyNonce=_useState30[0],setBusyNonce=_useState30[1],_useState31=useState(),_useState32=_slicedToArray(_useState31,2),serverReply=_useState32[0],setServerReply=_useState32[1],chatbotInputRef=useRef(),conversationRef=useRef(),hasFocusRef=useRef(!1),_useSpeechRecognition=(0,_app_chatbot_helpers__WEBPACK_IMPORTED_MODULE_0__.Vw)((function(e){setInputText(e)})),isListening=_useSpeechRecognition.isListening,setIsListening=_useSpeechRecognition.setIsListening,speechRecognitionAvailable=_useSpeechRecognition.speechRecognitionAvailable,stream=system.stream||!1,internalId=useMemo((function(){return(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.vx)()}),[]),botId=system.botId,customId=system.customId,userData=system.userData,sessionId=system.sessionId,contextId=system.contextId,pluginUrl=system.pluginUrl,restUrl=system.restUrl,debugMode=system.debugMode,virtualKeyboardFix=system.virtual_keyboard_fix,typewriter=null!==(_system$typewriter=null==system?void 0:system.typewriter)&&void 0!==_system$typewriter&&_system$typewriter,speechRecognition=null!==(_system$speech_recogn=null==system?void 0:system.speech_recognition)&&void 0!==_system$speech_recogn&&_system$speech_recogn,speechSynthesis=null!==(_system$speech_synthe=null==system?void 0:system.speech_synthesis)&&void 0!==_system$speech_synthe&&_system$speech_synthe,startSentence=(0,_app_chatbot_helpers__WEBPACK_IMPORTED_MODULE_0__.Mc)(null!==(_params$startSentence=null===(_params$startSentence2=params.startSentence)||void 0===_params$startSentence2?void 0:_params$startSentence2.trim())&&void 0!==_params$startSentence?_params$startSentence:"",userData),initialActions=system.actions||[],initialShortcuts=system.shortcuts||[],initialBlocks=system.blocks||[],isMobile=document.innerWidth<=768,processedParams=(0,_app_chatbot_helpers__WEBPACK_IMPORTED_MODULE_0__._$)(params,userData),aiName=processedParams.aiName,userName=processedParams.userName,guestName=processedParams.guestName,aiAvatar=processedParams.aiAvatar,userAvatar=processedParams.userAvatar,guestAvatar=processedParams.guestAvatar,textSend=processedParams.textSend,textClear=processedParams.textClear,textInputMaxLength=processedParams.textInputMaxLength,textInputPlaceholder=processedParams.textInputPlaceholder,textCompliance=processedParams.textCompliance,isWindow=processedParams.window,copyButton=processedParams.copyButton,fullscreen=processedParams.fullscreen,localMemoryParam=processedParams.localMemory,icon=processedParams.icon,iconText=processedParams.iconText,iconTextDelay=processedParams.iconTextDelay,iconAlt=processedParams.iconAlt,iconPosition=processedParams.iconPosition,iconBubble=processedParams.iconBubble,imageUpload=processedParams.imageUpload,fileSearch=processedParams.fileSearch,localMemory=localMemoryParam&&(!!customId||!!botId),localStorageKey=localMemory?"mwai-chat-".concat(customId||botId):null,_useMemo=useMemo((function(){var e=function(e){return e?(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.Ve)(e)||(0,_app_chatbot_helpers__WEBPACK_IMPORTED_MODULE_0__.mv)(e)?e:"".concat(pluginUrl,"/images/").concat(e):null},t=icon?e(icon):"".concat(pluginUrl,"/images/chat-traditional-1.svg"),n=e(processedParams.aiAvatarUrl),r=e(processedParams.userAvatarUrl),a=e(processedParams.guestAvatarUrl);return{cssVariables:Object.keys(shortcodeStyles).reduce((function(e,t){return e["--mwai-".concat(t)]=shortcodeStyles[t],e}),{}),iconUrl:t,aiAvatarUrl:n,userAvatarUrl:r,guestAvatarUrl:a}}),[icon,pluginUrl,shortcodeStyles,processedParams]),cssVariables=_useMemo.cssVariables,iconUrl=_useMemo.iconUrl,aiAvatarUrl=_useMemo.aiAvatarUrl,userAvatarUrl=_useMemo.userAvatarUrl,guestAvatarUrl=_useMemo.guestAvatarUrl,_useState33=useState(!1),_useState34=_slicedToArray(_useState33,2),draggingType=_useState34[0],setDraggingType=_useState34[1],_useState35=useState(!1),_useState36=_slicedToArray(_useState35,2),isBlocked=_useState36[0],setIsBlocked=_useState36[1],uploadIconPosition=useMemo((function(){return"timeless"===(null==theme?void 0:theme.themeId)?"mwai-tools":"mwai-input"}),[null==theme?void 0:theme.themeId]),submitButtonConf=useMemo((function(){return{text:textSend,textSend,textClear,imageSend:"timeless"===(null==theme?void 0:theme.themeId)?pluginUrl+"/images/action-submit-blue.svg":null,imageClear:"timeless"===(null==theme?void 0:theme.themeId)?pluginUrl+"/images/action-clear-blue.svg":null}}),[pluginUrl,textClear,textSend,null==theme?void 0:theme.themeId]),resetMessages=function(){if(resetUploadedFile(),startSentence){var e=[{id:(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.vx)(),role:"assistant",content:startSentence,who:rawAiName,timestamp:(new Date).getTime()}];setMessages(e)}else setMessages([])},refreshRestNonce=useCallback(_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,n,r,a=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]&&a[0],e.prev=1,t||!restNonce){e.next=4;break}return e.abrupt("return",restNonce);case 4:return setBusyNonce(!0),e.next=7,(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.ti)("".concat(restUrl,"/mwai/v1/start_session"));case 7:return n=e.sent,e.next=10,n.json();case 10:return r=e.sent,setRestNonce(r.restNonce),e.abrupt("return",r.restNonce);case 15:e.prev=15,e.t0=e.catch(1),console.error("Error while fetching the restNonce.",e.t0);case 18:return e.prev=18,setBusyNonce(!1),e.finish(18);case 21:case"end":return e.stop()}}),e,null,[[1,15,18,21]])}))),[restNonce,setRestNonce,restUrl]);useEffect((function(){initialActions.length>0&&handleActions(initialActions),initialShortcuts.length>0&&handleShortcuts(initialShortcuts),initialBlocks.length>0&&handleBlocks(initialBlocks)}),[]),useEffect((function(){chatbotTriggered&&!restNonce&&refreshRestNonce()}),[chatbotTriggered]),useEffect((function(){inputText.length>0&&!chatbotTriggered&&setChatbotTriggered(!0)}),[chatbotTriggered,inputText]),useEffect((function(){resetMessages()}),[startSentence]),useEffect((function(){if(customId||botId){var e=_app_chatbot_MwaiAPI__WEBPACK_IMPORTED_MODULE_2__.HX.chatbots.findIndex((function(e){return e.internalId===internalId})),t={internalId,botId,chatId,customId,open:function(){setTasks((function(e){return[].concat(_toConsumableArray(e),[{action:"open"}])}))},close:function(){setTasks((function(e){return[].concat(_toConsumableArray(e),[{action:"close"}])}))},clear:function(){setTasks((function(e){return[].concat(_toConsumableArray(e),[{action:"clear"}])}))},toggle:function(){setTasks((function(e){return[].concat(_toConsumableArray(e),[{action:"toggle"}])}))},ask:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];setTasks((function(n){return[].concat(_toConsumableArray(n),[{action:"ask",data:{text:e,submit:t}}])}))},lock:function(){setLocked(!0)},unlock:function(){setLocked(!1)},setShortcuts:function(e){setTasks((function(t){return[].concat(_toConsumableArray(t),[{action:"setShortcuts",data:e}])}))},setBlocks:function(e){setTasks((function(t){return[].concat(_toConsumableArray(t),[{action:"setBlocks",data:e}])}))},setContext:function(e){var t=e.chatId,n=e.messages;setTasks((function(e){return[].concat(_toConsumableArray(e),[{action:"setContext",data:{chatId:t,messages:n}}])}))}};-1!==e?_app_chatbot_MwaiAPI__WEBPACK_IMPORTED_MODULE_2__.HX.chatbots[e]=t:_app_chatbot_MwaiAPI__WEBPACK_IMPORTED_MODULE_2__.HX.chatbots.push(t)}}),[botId,chatId,customId,internalId]),useEffect((function(){busy?startChrono():(!isMobile&&hasFocusRef.current&&chatbotInputRef.current.focusInput(),stopChrono())}),[busy,startChrono,stopChrono,isMobile]);var saveMessages=useCallback((function(e){localStorageKey&&localStorage.setItem(localStorageKey,(0,_neko_ui__WEBPACK_IMPORTED_MODULE_3__.F1)({chatId,messages:e}))}),[localStorageKey,chatId]),resetError=function(){setError(null)};useEffect((function(){var e=[];if(localStorageKey&&(e=localStorage.getItem(localStorageKey)))return e=JSON.parse(e),setMessages(e.messages),void setChatId(e.chatId);resetMessages()}),[botId]);var handleActions=useCallback((function(actions,lastMessage){actions=actions||[];var callsCount=0,_iterator=_createForOfIteratorHelper(actions),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var action=_step.value;if("function"===action.type){var data=action.data||{},_data$name=data.name,name=void 0===_data$name?null:_data$name,_data$args=data.args,args=void 0===_data$args?[]:_data$args,finalArgs=args?Object.values(args).map((function(e){return JSON.stringify(e)})):[];try{debugMode&&console.log("[CHATBOT] CALL ".concat(name,"(").concat(finalArgs.join(", "),")")),eval("".concat(name,"(").concat(finalArgs.join(", "),")")),callsCount++}catch(e){console.error("Error while executing an action.",e)}}}}catch(e){_iterator.e(e)}finally{_iterator.f()}!lastMessage.content&&callsCount>0&&(lastMessage.content="*Done!*")}),[debugMode]),handleShortcuts=useCallback((function(e){setShortcuts(e||[])}),[]),handleBlocks=useCallback((function(e){setBlocks(e||[])}),[]);useEffect((function(){if(serverReply){setBusy(!1);var e=_toConsumableArray(messages),t=e.length>0?e[e.length-1]:null;if(!serverReply.success)return"assistant"===t.role&&t.isQuerying&&e.pop(),e.pop(),e.push({id:(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.vx)(),role:"system",content:serverReply.message,who:rawAiName,timestamp:(new Date).getTime()}),setMessages(e),void saveMessages(e);if("assistant"===t.role&&t.isQuerying)t.content=(0,_app_chatbot_MwaiAPI__WEBPACK_IMPORTED_MODULE_2__.W5)("ai.reply",serverReply.reply,{chatId,botId}),serverReply.images&&(t.images=serverReply.images),t.timestamp=(new Date).getTime(),delete t.isQuerying,handleActions(null==serverReply?void 0:serverReply.actions,t),handleBlocks(null==serverReply?void 0:serverReply.blocks),handleShortcuts(null==serverReply?void 0:serverReply.shortcuts);else if("assistant"===t.role&&t.isStreaming)t.content=(0,_app_chatbot_MwaiAPI__WEBPACK_IMPORTED_MODULE_2__.W5)("ai.reply",serverReply.reply,{chatId,botId}),serverReply.images&&(t.images=serverReply.images),t.timestamp=(new Date).getTime(),delete t.isStreaming,handleActions(null==serverReply?void 0:serverReply.actions,t),handleBlocks(null==serverReply?void 0:serverReply.blocks),handleShortcuts(null==serverReply?void 0:serverReply.shortcuts);else{var n={id:(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.vx)(),role:"assistant",content:(0,_app_chatbot_MwaiAPI__WEBPACK_IMPORTED_MODULE_2__.W5)("ai.reply",serverReply.reply,{botId,chatId,customId}),who:rawAiName,timestamp:(new Date).getTime()};serverReply.images&&(n.images=serverReply.images),handleActions(null==serverReply?void 0:serverReply.actions,n),handleBlocks(null==serverReply?void 0:serverReply.blocks),handleShortcuts(null==serverReply?void 0:serverReply.shortcuts),e.push(n)}setMessages(e),saveMessages(e)}}),[serverReply]);var onClear=useCallback(_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,setChatId((0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.vx)());case 2:localStorageKey&&localStorage.removeItem(localStorageKey),resetMessages(),setInputText(""),setShortcuts([]),setBlocks([]);case 7:case"end":return e.stop()}}),e)}))),[botId]),onSubmit=useCallback(function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var n,r,a,o,i,l,c,u,s,f,m,d,p,h,y;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!busy){e.next=3;break}return console.error("AI Engine: There is already a query in progress."),e.abrupt("return");case 3:if("string"!=typeof t&&(t=inputText),r=uploadedFile,a=null==uploadedFile?void 0:uploadedFile.uploadedUrl,o=null==uploadedFile||null===(n=uploadedFile.localFile)||void 0===n?void 0:n.type,i=!!o&&o.startsWith("image"),l=t,a&&(l=i?"![Uploaded Image](".concat(a,")\n").concat(t):"[Uploaded File](".concat(a,")\n").concat(t)),setBusy(!0),setInputText(""),setShortcuts([]),setBlocks([]),resetUploadedFile(),c=[].concat(_toConsumableArray(messages),[{id:(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.vx)(),role:"user",content:l,who:rawUserName,timestamp:(new Date).getTime()}]),saveMessages(c),u=(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.vx)(),s=[].concat(_toConsumableArray(c),[{id:u,role:"assistant",content:null,who:rawAiName,timestamp:null,isQuerying:!stream,isStreaming:!!stream}]),setMessages(s),f=_objectSpread({botId,customId,session:sessionId,chatId,contextId,messages,newMessage:t,newFileId:null==r?void 0:r.uploadedId,stream},atts),e.prev=21,debugMode&&console.log("[CHATBOT] OUT: ",f),m=stream?function(e){setMessages((function(t){var n=_toConsumableArray(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,null==restNonce){e.next=28;break}e.t0=restNonce,e.next=31;break;case 28:return e.next=30,refreshRestNonce();case 30:e.t0=e.sent;case 31:return d=e.t0,e.next=34,(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.ti)("".concat(restUrl,"/mwai-ui/v1/chats/submit"),f,d,stream);case 34:return p=e.sent,e.next=37,(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.Pn)(p,m,debugMode?"CHATBOT":null);case 37:if((h=e.sent).success||!h.message){e.next=47;break}return setError(h.message),(y=_toConsumableArray(s)).pop(),y.pop(),setMessages(y),saveMessages(y),setBusy(!1),e.abrupt("return");case 47:setServerReply(h),e.next=54;break;case 50:e.prev=50,e.t1=e.catch(21),console.error("An error happened in the handling of the chatbot response.",{err:e.t1}),setBusy(!1);case 54:case"end":return e.stop()}}),e,null,[[21,50]])})));return function(t){return e.apply(this,arguments)}}(),[busy,uploadedFile,messages,saveMessages,stream,botId,customId,sessionId,chatId,contextId,atts,inputText,debugMode,restNonce,refreshRestNonce,restUrl]),onSubmitAction=useCallback((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=!(null==uploadedFile||!uploadedFile.uploadedId);hasFocusRef.current=document.activeElement===chatbotInputRef.current.currentElement(),e?onSubmit(e):(t||inputText.length>0)&&onSubmit(inputText)}),[inputText,onSubmit,null==uploadedFile?void 0:uploadedFile.uploadedId]),onFileUpload=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var n,r,a,o,i,l,c=arguments;return _regeneratorRuntime().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 resetUploadedFile(),e.abrupt("return");case 6:if(a={type:n,purpose:r},o="".concat(restUrl,"/mwai-ui/v1/files/upload"),null==restNonce){e.next=12;break}e.t0=restNonce,e.next=15;break;case 12:return e.next=14,refreshRestNonce();case 14:e.t0=e.sent;case 15:return i=e.t0,e.next=18,(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.uE)(o,t,i,(function(e){setUploadedFile({localFile:t,uploadedId:null,uploadedUrl:null,uploadProgress:e})}),a);case 18:l=e.sent,setUploadedFile({localFile:t,uploadedId:l.data.id,uploadedUrl:l.data.url,uploadProgress:null}),e.next=27;break;case 22:e.prev=22,e.t1=e.catch(2),console.error("onFileUpload Error",e.t1),setError(e.t1.message||"An unknown error occurred"),resetUploadedFile();case 27:case"end":return e.stop()}}),e,null,[[2,22]])})));return function(t){return e.apply(this,arguments)}}(),onUploadFile=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return error&&resetError(),e.abrupt("return",onFileUpload(t));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),resetUploadedFile=function(){setUploadedFile({localFile:null,uploadedId:null,uploadedUrl:null,uploadProgress:null})},runTimer=useCallback((function(){var e=setTimeout((function(){setOpen((function(e){return e||setShowIconMessage(!0),e}))}),1e3*iconTextDelay);return function(){return clearTimeout(e)}}),[iconText,iconTextDelay]);useEffect((function(){if(iconText&&!iconTextDelay)setShowIconMessage(!0);else if(iconText&&iconTextDelay)return runTimer()}),[iconText]);var _useState37=useState([]),_useState38=_slicedToArray(_useState37,2),tasks=_useState38[0],setTasks=_useState38[1],runTasks=useCallback(_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,n,r,a,o,i,l,c;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:tasks.length>0&&("ask"===(t=tasks[0]).action?(n=t.data,r=n.text,n.submit?onSubmit(r):setInputText(r)):"toggle"===t.action?setOpen((function(e){return!e})):"open"===t.action?setOpen(!0):"close"===t.action?setOpen(!1):"clear"===t.action?onClear():"setContext"===t.action?(a=t.data,o=a.chatId,i=a.messages,setChatId(o),setMessages(i)):"setShortcuts"===t.action?(l=t.data,handleShortcuts(l)):"setBlocks"===t.action&&(c=t.data,handleBlocks(c)),setTasks((function(e){return e.slice(1)})));case 1:case"end":return e.stop()}}),e)}))),[tasks,onClear,onSubmit,setChatId,setInputText,setMessages,setOpen,handleShortcuts,handleBlocks]);useEffect((function(){runTasks()}),[runTasks]);var actions={setInputText,saveMessages,setMessages,resetMessages,resetError,onClear,onSubmit,onSubmitAction,onFileUpload,onUploadFile,setOpen,setWindowed,setShowIconMessage,setIsListening,setDraggingType,setIsBlocked},state={theme,botId,customId,userData,pluginUrl,inputText,messages,shortcuts,blocks,busy,error,setBusy,typewriter,speechRecognition,speechSynthesis,virtualKeyboardFix,localMemory,imageUpload,uploadedFile,fileSearch,textSend,textClear,textInputMaxLength,textInputPlaceholder,textCompliance,aiName,userName,guestName,aiAvatar,userAvatar,guestAvatar,aiAvatarUrl,userAvatarUrl,guestAvatarUrl,isWindow,copyButton,fullscreen,icon,iconText,iconAlt,iconPosition,iconBubble,cssVariables,iconUrl,chatbotInputRef,conversationRef,isMobile,open,locked,windowed,showIconMessage,timeElapsed,isListening,speechRecognitionAvailable,uploadIconPosition,submitButtonConf,draggingType,isBlocked,busyNonce};return React.createElement(ChatbotContext.Provider,{value:{state,actions}},children)}},1137:(e,t,n)=>{function r(e){return r="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},r(e)}function a(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,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,"string");if("object"!=r(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:String(t)}n.d(t,{HX:()=>l,W5:()=>c});var i=function(){function e(){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),"undefined"!=typeof window&&window.MwaiAPI)return window.MwaiAPI;this.chatbots=[],this.filters={},this.actions={},"undefined"!=typeof window&&(window.MwaiAPI=this)}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),a=2;a<n;a++)r[a-2]=arguments[a];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&&a(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),l=function(){if("undefined"!=typeof window&&window.MwaiAPI)return window.MwaiAPI;var e=new i;return"undefined"!=typeof window&&(window.MwaiAPI=e),e}(),c=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),a=2;a<n;a++)r[a-2]=arguments[a];return l.applyFilters.apply(l,[e,t].concat(r))}},6966:(e,t,n)=>{n.d(t,{$$:()=>y,Mc:()=>b,Vw:()=>R,_$:()=>w,bE:()=>O,dh:()=>E,gR:()=>v,kW:()=>_,mv:()=>g,tm:()=>h});var r=["active","disabled"],a=["if","className","disableTransition","children"];function o(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(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)?i(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 i(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 l(){return l=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},l.apply(this,arguments)}function c(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var u=wp.element,s=u.useState,f=u.useMemo,m=u.useEffect,d=u.useRef,p=u.useCallback,h=function(e){var t=e.active,n=e.disabled,a=c(e,r);return React.createElement("div",l({active:t?"true":"false",disabled:n},a),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"/>'}}))};function y(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=d();m((function(){r.current=t}),[t]),m((function(){if(null!==e&&n){var t=setInterval((function(){r.current()}),e);return function(){return clearInterval(t)}}}),[e,n])}var v=function(){return f((function(){return function(e,t){return Array.isArray(e)||(e=[e]),t&&Object.entries(t).forEach((function(t){var n=o(t,2),r=n[0];n[1]&&e.push(r)})),e.join(" ")}}),[])};function g(e){return!(!e||"string"!=typeof e)&&0===e.indexOf("http")}function E(){var e=o(s(null),2),t=e[0],n=e[1],r=d(null);return m((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,a,o=Math.floor((Date.now()-e)/1e3);n((t=o,r=Math.floor(t/60),a=t%60,"".concat(r,":").concat(a.toString().padStart(2,"0"))))}),500)}},stopChrono:function(){clearInterval(r.current),r.current=null,n(null)}}}var b=function(e,t){return"string"==typeof e&&t?(Object.entries(t).forEach((function(t){var n=o(t,2),r=n[0],a=n[1];e=e.replace(new RegExp("{".concat(r,"}"),"g"),a)})),e):e},w=function(e){var t,n,r,a,o,i,l,c,u,s,f,m,d,p,h,y,v,g,E,w,R,O,_,x,S,T,N,C,I=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],A=null!==(t=null===(n=e.guestName)||void 0===n?void 0:n.trim())&&void 0!==t?t:"",k=null!==(r=null===(a=e.textSend)||void 0===a?void 0:a.trim())&&void 0!==r?r:"",L=null!==(o=null===(i=e.textClear)||void 0===i?void 0:i.trim())&&void 0!==o?o:"",M=parseInt(e.textInputMaxLength),P=null!==(l=null===(c=e.textInputPlaceholder)||void 0===c?void 0:c.trim())&&void 0!==l?l:"",j=null!==(u=null===(s=e.textCompliance)||void 0===s?void 0:s.trim())&&void 0!==u?u:"",F=Boolean(e.window),D=Boolean(e.copyButton),G=Boolean(e.fullscreen),U=null!==(f=null===(m=e.icon)||void 0===m?void 0:m.trim())&&void 0!==f?f:"",B=null!==(d=null===(p=e.iconText)||void 0===p?void 0:p.trim())&&void 0!==d?d:"",H=parseInt(e.iconTextDelay||1),Y=null!==(h=null===(y=e.iconAlt)||void 0===y?void 0:y.trim())&&void 0!==h?h:"",z=null!==(v=null===(g=e.iconPosition)||void 0===g?void 0:g.trim())&&void 0!==v?v:"",W=Boolean(e.iconBubble),V=null!==(E=null===(w=e.aiName)||void 0===w?void 0:w.trim())&&void 0!==E?E:"",K=null!==(R=null===(O=e.userName)||void 0===O?void 0:O.trim())&&void 0!==R?R:"",q=Boolean(null==e?void 0:e.aiAvatar),X=Boolean(null==e?void 0:e.userAvatar),$=Boolean(null==e?void 0:e.guestAvatar),Q=q?null!==(_=null==e||null===(x=e.aiAvatarUrl)||void 0===x?void 0:x.trim())&&void 0!==_?_:"":null,J=X?null!==(S=null==e||null===(T=e.userAvatarUrl)||void 0===T?void 0:T.trim())&&void 0!==S?S:"":null,Z=$?null!==(N=null==e||null===(C=e.guestAvatarUrl)||void 0===C?void 0:C.trim())&&void 0!==N?N:"":null,ee=Boolean(e.localMemory),te=Boolean(e.imageUpload),ne=Boolean(e.fileSearch);return I&&(j=b(j,I),B=b(B,I)),{textSend:k,textClear:L,textInputMaxLength:M,textInputPlaceholder:P,textCompliance:j,window:F,copyButton:D,fullscreen:G,localMemory:ee,imageUpload:te,fileSearch:ne,icon:U,iconText:B,iconTextDelay:H,iconAlt:Y,iconPosition:z,iconBubble:W,aiName:V,userName:K,guestName:A,aiAvatar:q,userAvatar:X,guestAvatar:$,aiAvatarUrl:Q,userAvatarUrl:J,guestAvatarUrl:Z}},R=function(e){var t=o(s(!1),2),n=t[0],r=t[1],a=o(s(!1),2),i=a[0],l=a[1];return m((function(){"undefined"!=typeof window&&("SpeechRecognition"in window||"webkitSpeechRecognition"in window)&&l(!0)}),[]),m((function(){if(i){var t=new(window.SpeechRecognition||window.webkitSpeechRecognition),a=null;return navigator.userAgent.toLowerCase().indexOf("android")>-1?(t.interimResults=!1,t.continuous=!1,a=function(t){var n=Array.from(t.results).filter((function(e){return e.isFinal})).map((function(e){return e[0].transcript})).join("");e(n),r(!1)}):(t.interimResults=!0,t.continuous=!0,a=function(t){var n=Array.from(t.results).map((function(e){return e[0]})).map((function(e){return e.transcript})).join("");e(n)}),n?(t.addEventListener("result",a),t.start()):(t.removeEventListener("result",a),t.abort()),function(){t.abort()}}}),[n,i]),{isListening:n,setIsListening:r,speechRecognitionAvailable:i}},O=function(e){var t=e.if,n=e.className,r=e.disableTransition,i=void 0!==r&&r,u=e.children,f=c(e,a),d=o(s(!1),2),p=d[0],h=d[1],y=o(s("mwai-transition"),2),v=y[0],g=y[1];return m((function(){i?h(t):t?(h(!0),setTimeout((function(){g("mwai-transition mwai-transition-visible")}),150)):g("mwai-transition")}),[t,i]),p?React.createElement("div",l({className:"".concat(n," ").concat(i?"":v),onTransitionEnd:function(){"mwai-transition"!==v||i||h(!1)}},f),u):null},_=function(){var e=o(s(window.visualViewport.height),2),t=e[0],n=e[1],r=f((function(){return/Android/.test(navigator.userAgent)}),[]),a=f((function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream}),[]),i=d(window.visualViewport),l=p((function(){n(i.current.height)}),[]);return m((function(){var e=i.current;return e.addEventListener("resize",l),a?(window.addEventListener("resize",l),document.addEventListener("focusin",l)):e.addEventListener("scroll",l),function(){e.removeEventListener("resize",l),a?(window.removeEventListener("resize",l),document.removeEventListener("focusin",l)):e.removeEventListener("scroll",l)}}),[l,a]),{viewportHeight:t,isIOS:a,isAndroid:r}}},7678:(e,t,n)=>{n.d(t,{CI:()=>O,Pn:()=>h,Ve:()=>x,rn:()=>R,ti:()=>v,uE:()=>E,vx:()=>w});var r=n(8135),a=n(6841);function o(e){return o="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},o(e)}function i(){i=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},l="function"==typeof Symbol?Symbol:{},c=l.iterator||"@@iterator",u=l.asyncIterator||"@@asyncIterator",s=l.toStringTag||"@@toStringTag";function f(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,n){return e[t]=n}}function m(e,t,n,r){var o=t&&t.prototype instanceof E?t:E,i=Object.create(o.prototype),l=new k(r||[]);return a(i,"_invoke",{value:N(e,n,l)}),i}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=m;var p="suspendedStart",h="suspendedYield",y="executing",v="completed",g={};function E(){}function b(){}function w(){}var R={};f(R,c,(function(){return this}));var O=Object.getPrototypeOf,_=O&&O(O(L([])));_&&_!==n&&r.call(_,c)&&(R=_);var x=w.prototype=E.prototype=Object.create(R);function S(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function n(a,i,l,c){var u=d(e[a],e,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==o(f)&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,l,c)}),(function(e){n("throw",e,l,c)})):t.resolve(f).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,c)}))}c(u.arg)}var i;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return i=i?i.then(a,a):a()}})}function N(t,n,r){var a=p;return function(o,i){if(a===y)throw new Error("Generator is already running");if(a===v){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=C(l,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===p)throw a=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=y;var u=d(t,n,r);if("normal"===u.type){if(a=r.done?v:h,u.arg===g)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=v,r.method="throw",r.arg=u.arg)}}}function C(t,n){var r=n.method,a=t.iterator[r];if(a===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")),g;var o=d(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}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 A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[c];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,i=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(o(t)+" is not iterable")}return b.prototype=w,a(x,"constructor",{value:w,configurable:!0}),a(w,"constructor",{value:b,configurable:!0}),b.displayName=f(w,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,f(e,s,"GeneratorFunction")),e.prototype=Object.create(x),e},t.awrap=function(e){return{__await:e}},S(T.prototype),f(T.prototype,u,(function(){return this})),t.AsyncIterator=T,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new T(m(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},S(x),f(x,s,"Generator"),f(x,c,(function(){return this})),f(x,"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,k.prototype={constructor:k,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(i)},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),g},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),g}},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 a=r.arg;A(n)}return a}}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),g}},t}function l(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(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 u(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){u(o,r,a,i,l,"next",e)}function l(e){u(o,r,a,i,l,"throw",e)}i(void 0)}))}}var f=wp.element,m=f.useMemo,d=f.useEffect,p=f.useState;function h(e,t){return y.apply(this,arguments)}function y(){return y=s(i().mark((function e(t,n){var r,a,o,l,c,u,s,f,m,d,p,h,y,v,g=arguments;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=g.length>2&&void 0!==g[2]?g[2]:null,n){e.next=14;break}return e.prev=2,e.next=5,t.json();case 5:return a=e.sent,r&&console.log("[".concat(r,"] IN: "),a),e.abrupt("return",a);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:o=t.body.getReader(),l=new TextDecoder("utf-8"),c="",u="";case 18:return e.next=21,o.read();case 21:if(s=e.sent,f=s.value,m=s.done,c+=l.decode(f,{stream:!0}),!m){e.next=27;break}return e.abrupt("break",68);case 27:d=c.split("\n"),p=0;case 29:if(!(p<d.length-1)){e.next=65;break}if(0===d[p].indexOf("data: ")){e.next=32;break}return e.abrupt("continue",62);case 32:if("live"!==(h=JSON.parse(d[p].replace("data: ",""))).type){e.next=39;break}r&&console.log("[".concat(r," STREAM] LIVE: "),h),u+=h.data,n&&n(u,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,y=JSON.parse(h.data),r&&console.log("[".concat(r," STREAM] END: "),y),e.abrupt("return",y);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:p++,e.next=29;break;case 65:c=d[d.length-1],e.next=18;break;case 68:return e.prev=68,v=JSON.parse(c),r&&console.log("[".concat(r," STREAM] IN: "),v),e.abrupt("return",v);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]])}))),y.apply(this,arguments)}function v(e,t,n,r){return g.apply(this,arguments)}function g(){return(g=s(i().mark((function e(t,n,a,o){var l;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l={"Content-Type":"application/json"},a&&(l["X-WP-Nonce"]=a),o&&(l.Accept="text/event-stream"),e.next=5,fetch("".concat(t),{method:"POST",headers:l,body:(0,r.F1)(n)});case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function E(e,t,n,r){return b.apply(this,arguments)}function b(){return b=s(i().mark((function e(t,n,r,a){var o,c=arguments;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=c.length>4&&void 0!==c[4]?c[4]:{},e.abrupt("return",new Promise((function(e,i){var c=new FormData;c.append("file",n);for(var u=0,s=Object.entries(o);u<s.length;u++){var f=l(s[u],2),m=f[0],d=f[1];c.append(m,d)}var p=new XMLHttpRequest;p.open("POST",t,!0),r&&p.setRequestHeader("X-WP-Nonce",r),p.upload.onprogress=function(e){if(e.lengthComputable&&a){var t=e.loaded/e.total*100;a(t)}},p.onload=function(){if(p.status>=200&&p.status<300)try{var t=JSON.parse(p.responseText);e(t)}catch(e){i({status:p.status,statusText:p.statusText,error:"The server response is not valid JSON"})}else{try{var n=JSON.parse(p.responseText);return void i({status:p.status,message:n.message})}catch(e){}i({status:p.status,statusText:p.statusText})}},p.onerror=function(){i({status:p.status,statusText:p.statusText})},p.send(c)})));case 2:case"end":return e.stop()}}),e)}))),b.apply(this,arguments)}function w(){return Math.random().toString(36).substring(2)}var R=function(){var e=l(p(!0),2),t=e[0],n=e[1];d((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})},O=function(e){var t,n=e.content,r=e.error,o=e.isStreaming,i=e.baseClass,l=void 0===i?"mwai-output-handler":i,c=null!==(t=r||n)&&void 0!==t?t:"";(c.match(/```/g)||[]).length%2!=0?c+="\n```":o&&(c+="<BlinkingCursor />");var u=m((function(){var e=[l];return r&&e.push("mwai-error"),e}),[r]),s=m((function(){return{wrapper:"div",forceWrapper:!0,overrides:{BlinkingCursor:{component:R},a:{props:{target:"_blank"}}}}}),[]);return React.createElement(a.Ay,{options:s,className:u.join(" "),children:c})},_=/([\u2700-\u27BF]|[\uE000-\uF8FF]|[\uD800-\uDFFF]|[\uFE00-\uFE0F]|[\u1F100-\u1F1FF]|[\u1F200-\u1F2FF]|[\u1F300-\u1F5FF]|[\u1F600-\u1F64F]|[\u1F680-\u1F6FF]|[\u1F700-\u1F77F]|[\u1F780-\u1F7FF]|[\u1F800-\u1F8FF]|[\u1F900-\u1F9FF]|[\u1FA00-\u1FA6F])/;function x(e){return e&&2===e.length&&_.test(e)}},158:(e,t,n)=>{var r,a,o,i,l,c=n(5323),u=n(7665),s=n(2564),f=n(9270),m=n(7097),d=n(4977),p=n(7039),h=n(4536),y=n(5263),v=n(6913),g=n(3804),E=n(4547),b=n(3676),w=n(9296),R=n(4461),O=n(8135),_=mwai.prefix,x=mwai.domain,S=mwai.rest_url.replace(/\/+$/,""),T=mwai.api_url.replace(/\/+$/,""),N=mwai.plugin_url.replace(/\/+$/,""),C=mwai.user_data,I="1"===mwai.is_pro,A=I&&"1"===mwai.is_registered,k=mwai.rest_nonce,L=mwai.options,M=mwai.session,P=mwai.themes,j=!!mwai.stream,F=mwai.chatbots,D=n(197),G=n(3185);function U(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var B=G.Ay.div(r||(r=U(["\n  color: white;\n  padding: 15px;\n  margin-bottom: -15px;\n\n  a {\n    color: #7dedff;\n    text-decoration: none;\n  }\n\n  p {\n    font-size: 15px;\n  }\n"]))),H=(0,G.Ay)(R.z)(a||(a=U(["\n\n  .neko-block-title {\n    display: none;\n  }\n\n  .plugin-desc {\n    display: flex;\n    flex-direction: column;\n    margin-left: 15px;\n  }\n\n  .neko-block-content {\n    display: flex;\n    padding: 15px;\n\n    h2 {\n      font-size: 18px;\n      margin: 0;\n\n      a {\n        text-decoration: none;\n      }\n    }\n\n    p {\n      margin: 0px;\n      margin-top: 10px;\n      font-size: 13px;\n      line-height: 1.5;\n    }\n\n    .plugin-actual-desc {\n      font-size: 13px;\n      font-weight: 500;\n    }\n  }\n"]))),Y=G.Ay.img(o||(o=U(["\n  height: 125px;\n  width: auto;\n  border-radius: 10px;\n  background: lightgray;\n"]))),z=G.Ay.div(i||(i=U(["\n\n  margin: 15px;\n\n  .center {\n    background: white;\n    color: black;\n    border-radius: 10px;\n    padding: 10px;\n    max-width: 100%\n    overflow: none;\n\n    h2 {\n      font-size: 26px;\n    }\n\n    table {\n      width: 100%;\n\n      tr td:first-child {\n        width: 220px;\n        font-weight: bold;\n        color: #1e7cba;\n      }\n\n      * {\n        overflow-wrap: anywhere;\n      }\n    }\n  }\n\n  hr {\n    border-color: #1e7cba;\n  }\n"]))),W=G.Ay.ul(l||(l=U(["\n  margin-top: 10px;\n  background: rgb(0, 72, 88);\n  padding: 10px;\n  color: rgb(58, 212, 58);\n  max-height: 600px;\n  min-height: 200px;\n  display: block;\n  font-family: monospace;\n  font-size: 12px;\n  white-space: pre;\n  overflow-x: auto;\n  width: calc(100vw - 276px);\n  color: white;\n\n  .log-date {\n    color: var(--neko-yellow);\n    margin-left: 8px;\n  }\n\n  .log-type {\n    background: #0000004d;\n    padding: 2px 5px;\n    border-radius: 8px;\n    text-transform: uppercase;\n  }\n\n  .log-content {\n    display: block;\n  }\n\n  .log-warning .log-type {\n    background: var(--neko-yellow);\n    color: white;\n  }\n\n  .log-fatal .log-type {\n    background: var(--neko-red);\n    color: white;\n  }\n"])));function V(e){return V="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},V(e)}function K(){K=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==V(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(V(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 q(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function X(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){q(o,r,a,i,l,"next",e)}function l(e){q(o,r,a,i,l,"throw",e)}i(void 0)}))}}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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||Q(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 Q(e,t){if(e){if("string"==typeof e)return J(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)?J(e,t):void 0}}function J(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 Z=wp.element,ee=Z.useState,te=Z.useEffect,ne="".concat(S,"/meow-common/v1"),re=function(e){var t=e.request,n=e.title,r=e.max,a=$(ee(!1),2),o=a[0],i=a[1],l=$(ee([]),2),c=l[0],u=l[1],s=c.length>0?c.reduce((function(e,t){return e+t})):0,f=c.length>0?Math.ceil(s/c.length):0,m=!c.length&&o;return te((function(){o&&setTimeout(X(K().mark((function e(){var n,r,a;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(new Date).getTime(),e.next=3,(0,O.IU)("".concat(ne,"/").concat(t),{method:"POST",nonce:k});case 3:r=(new Date).getTime(),a=r-n,u((function(e){return[].concat(function(e){if(Array.isArray(e))return J(e)}(t=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||Q(t)||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.")}(),[a]);var t}));case 6:case"end":return e.stop()}}),e)}))),1e3)}),[c]),React.createElement(B,{style:{width:200,textAlign:"center"}},React.createElement(d.s,{h2:!0,style:{color:"white"}},n),React.createElement(D.X,{size:200,value:m?r:f,max:r},React.createElement("span",{style:{fontSize:20}},m?"START":f+" ms"),React.createElement("span",{style:{fontSize:12}},m?"YOUR ENGINE":c.length+" requests")),React.createElement(w.M,{style:{width:"100%",marginTop:10},color:o?"#cc3627":"#ccb027",onClick:function(){o||u([]),i(!o)}},o?"Stop":"Start"))};function ae(e){return ae="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},ae(e)}function oe(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ie(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)?ie(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 ie(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 le(){le=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==ae(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(ae(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 ce(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function ue(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){ce(o,r,a,i,l,"next",e)}function l(e){ce(o,r,a,i,l,"throw",e)}i(void 0)}))}}var se=wp.element,fe=se.useState,me=se.useEffect;T&&S&&N||console.error("[@common/dashboard] apiUrl, restUrl and pluginUrl are mandatory.");var de="".concat(S,"/meow-common/v1"),pe=React.createElement(B,null,React.createElement(d.s,{p:!0,style:{lineHeight:"1.5",margin:"0 0 15px 0"}},"Hi! ☀️ Meow Apps isn't your typical plugin suite—it's a passion project led by me, ",React.createElement("a",{target:"_blank",href:"https://jordymeow.com"},"Jordy Meow"),", and a stellar team! 💕 Based in ",React.createElement("a",{target:"_blank",href:"https://offbeatjapan.org"},"Japan"),", we're all about making your WordPress experience smoother and speedier. Our plugins are all about boosting your site's performance and user-friendliness. Ready to level up your WordPress game? Check out ",React.createElement("a",{href:"http://meowapps.com",target:"_blank"},"Meow Apps")," and let's make magic happen! 🌴🙀")),he=React.createElement(B,null,React.createElement(d.s,{p:!0},"The ",React.createElement("b",null,"Empty Request Time")," measures your installation's basic performance by showing the average time needed to process an empty request on your server. To see how disabling plugins affects the results, turn some off and run the test again. Aim for a time under 2,000 ms, but ideally, keep it below 500 ms. The ",React.createElement("b",null,"File Operation Time")," creates a temporary 10MB file each time it runs. ",React.createElement("b",null,"The SQL Request Time")," calculates the total number of posts. This process should be quick and have a similar duration to the Empty Request Time.")),ye=React.createElement(B,null,React.createElement(d.s,{p:!0},"Maintain a streamlined WordPress setup by using essential plugins and a dependable hosting provider. Refrain from self-hosting unless you're an expert. Go further by reading our tutorials:",React.createElement("ul",null,React.createElement("li",null,"⭐️ ",React.createElement("a",{href:"https://meowapps.com/tutorial-improve-seo-wordpress/",target:"_blank"},"SEO Checklist & Optimization")),React.createElement("li",null,"⭐️ ",React.createElement("a",{href:"https://meowapps.com/tutorial-faster-wordpress-optimize/",target:"_blank"},"Optimize your WordPress Speed")),React.createElement("li",null,"⭐️ ",React.createElement("a",{href:"https://meowapps.com/tutorial-optimize-images-wordpress/",target:"_blank"},"Optimize Images (CDN, and so on)")),React.createElement("li",null,"⭐️ ",React.createElement("a",{href:"https://meowapps.com/tutorial-hosting-service-wordpress/",target:"_blank"},"The Best Hosting Services for WordPress"))))),ve=function(){var e=ue(le().mark((function e(){var t;return le().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(de,"/all_settings/"),{method:"POST",nonce:k});case 2:return t=e.sent,e.abrupt("return",t.data);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ge=function(){var e=ue(le().mark((function e(t){var n,r,a;return le().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.value,r=t.id,e.next=3,(0,O.IU)("".concat(de,"/update_option"),{method:"POST",nonce:k,json:{name:r,value:n}});case 3:return a=e.sent,e.abrupt("return",a);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ee=function(){var e=ue(le().mark((function e(){var t;return le().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(de,"/error_logs"),{method:"POST",nonce:k});case 2:return t=e.sent,e.abrupt("return",t.data.reverse());case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),be=function(){var e=(0,u.jE)(),t=oe(fe(!1),2),n=t[0],r=t[1],a=oe(fe(!1),2),o=a[0],i=(a[1],oe(fe(""),2)),l=i[0],c=i[1],s=(0,f.I)({queryKey:["all_settings"],queryFn:ve}),O=s.data,_=s.error,x=(s.isLoading,(0,m.n)({mutationFn:ge,onSuccess:function(){e.invalidateQueries(["all_settings"])}}).mutate),S=(0,m.n)({mutationFn:Ee}),T=S.mutate,N=S.data,C=void 0===N?[]:N,I=null==O?void 0:O.meowapps_hide_meowapps,A=null==O?void 0:O.force_sslverify;me((function(){_&&!n&&(r(!0),console.error("Error from useQuery",_.message))}),[_]),me((function(){var e=document.getElementById("meow-common-phpinfo");c(e.innerHTML)}),[]);var k=function(e,t){x({value:e,id:t})},L=React.createElement(p.d,{title:"Main Menu"},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"meowapps_hide_meowapps",label:"Hide (Not Recommended)",description:React.createElement(d.s,{p:!0},"This will hide the Meow Apps Menu (on the left side) and everything it contains. You can re-enable it through though an option that will be added in Settings → General."),value:"1",disabled:o,checked:I,onChange:k}))),M=React.createElement(p.d,{title:"SSL Verify"},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"force_sslverify",label:"Force (Not Recommended)",description:React.createElement(d.s,{p:!0},"This will enforce the usage of SSL when checking the license or updating the plugin."),value:"1",disabled:o,checked:A,onChange:k})));return React.createElement(v.z,{showRestError:n},React.createElement(g.n,{title:"The Dashboard"}),React.createElement(E.N,null,React.createElement(E.Y,{full:!0},React.createElement(b._,{keepTabOnReload:!0},React.createElement(b.V,{title:"Meow Apps"},pe,React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(H,{title:"AI Engine",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/ai-engine/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/ai-engine/"},"AI Engine")),React.createElement("p",{className:"plugin-actual-desc"},"This is the ultimate AI plugin for WordPress. From a chatbot adapted to your needs to an AI that can write your content for you, API, REST, and more."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/ai-engine/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/ai-engine/"},"Meow Apps"))))),React.createElement(H,{title:"Media Cleaner",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/media-cleaner/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/media-cleaner/"},"Media Cleaner")),React.createElement("p",{className:"plugin-actual-desc"},"Is your Media Library bloated, your database heavy, and your website running slow? Media Cleaner will clean your Media Library from the media entries (and files) which aren't used in your website, as well as broken entries."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/media-cleaner/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/media-cleaner/"},"Meow Apps"))))),React.createElement(H,{title:"Database Cleaner",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/database-cleaner/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/database-cleaner/"},"Database Cleaner")),React.createElement("p",{className:"plugin-actual-desc"},"Not only does Database Cleaner have a user-friendly UI, but it's also equipped to handle large DBs, giving it an edge over other plugins. It's a must-have for any WordPress site."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/database-cleaner/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/database-cleaner/"},"Meow Apps"))))),React.createElement(H,{title:"Media File Renamer",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/media-file-renamer/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/media-file-renamer/"},"Media File Renamer")),React.createElement("p",{className:"plugin-actual-desc"},"Rename and move files directly from the dashboard, manually, automatically or via AI, either individually or in bulk. It's the best way to rename your files."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/media-file-renamer/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/media-file-renamer/"},"Meow Apps"))))),React.createElement(H,{title:"Social Engine",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/social-engine/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/social-engine/"},"Social Engine")),React.createElement("p",{className:"plugin-actual-desc"},'Effortlessly schedule and automate the perfect posts for all your networks. Unlimited capabilities and infinite className="plugin-actual-desc" extensibility, for free!'),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/social-engine/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/social-engine/"},"Meow Apps"))))),React.createElement(H,{title:"Meow Analytics",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/meow-analytics/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/meow-analytics/"},"Meow Analytics")),React.createElement("p",{className:"plugin-actual-desc"},"Google Analytics for your website. Simple and fast."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/meow-analytics/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/meow-analytics/"},"Meow Apps")))))),React.createElement(E.Y,{minimal:!0},React.createElement(H,{title:"Contact Form Block",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/seo-engine/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/seo-engine/"},"SEO Engine")),React.createElement("p",{className:"plugin-actual-desc"},"Optimize your content for SEO and for the AI world, with AI assistants... while keeping everything simple and fast, as it should be! ✌️"),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/seo-engine/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/seo-engine/"},"Meow Apps"))))),React.createElement(H,{title:"Meow Gallery",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/meow-gallery/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/meow-gallery/"},"Meow Gallery")),React.createElement("p",{className:"plugin-actual-desc"},"Fast and beautiful galleries with many layouts. Forget the heavy and slow plugins, use the Meow Gallery for a better experience! 💕"),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/meow-gallery/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/meow-gallery/"},"Meow Apps"))))),React.createElement(H,{title:"Meow Lightbox",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/meow-lightbox/assets/icon-256x256.gif"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/meow-lightbox/"},"Meow Lightbox")),React.createElement("p",{className:"plugin-actual-desc"},"Sleek and performant lightbox with EXIF support."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/meow-lightbox/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/meow-lightbox/"},"Meow Apps"))))),React.createElement(H,{title:"Perfect Images (Retina)",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/wp-retina-2x/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/wp-retina-2x/"},"Perfect Images")),React.createElement("p",{className:"plugin-actual-desc"},"Manage, Optimize, Replace your images with Perfect Images."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/wp-retina-2x/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/wp-retina-2x/"},"Meow Apps"))))),React.createElement(H,{title:"Photo Engine",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/wplr-sync/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/wplr-sync/"},"Photo Engine")),React.createElement("p",{className:"plugin-actual-desc"},"Organize your photos in folders and collections. Synchronize with Lightroom. Simplify and speed up your workflow."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/wplr-sync/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/wplr-sync/"},"Meow Apps"))))),React.createElement(H,{title:"Contact Form Block",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/contact-form-block/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/contact-form-block/"},"Contact Form Block")),React.createElement("p",{className:"plugin-actual-desc"},"Need a very simple but straightforward contact form? This is the one you need. It's fast, simple, and efficient."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/contact-form-block/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/contact-form-block/"},"Meow Apps")))))))),React.createElement(b.V,{title:"Performance"},he,React.createElement("div",{style:{display:"flex",justifyContent:"space-around",marginBottom:25}},React.createElement(re,{title:"Empty Request Time",request:"empty_request",max:2500}),React.createElement(re,{title:"File Operation Time",request:"file_operation",max:2600}),React.createElement(re,{title:"SQL Request Time",request:"sql_request",max:2800})),ye),React.createElement(b.V,{title:"PHP Info"},React.createElement(z,{dangerouslySetInnerHTML:{__html:l}})),React.createElement(b.V,{title:"PHP Error Logs"},React.createElement(B,null,React.createElement(w.M,{style:{marginBottom:10},color:"#ccb027",onClick:function(){T()},disabled:o,isBusy:"isLoadingErrorLogs"===o},"Load PHP Error Logs"),React.createElement(W,null,C.map((function(e){return React.createElement("li",{class:"log-".concat(e.type)},React.createElement("span",{class:"log-type"},e.type),React.createElement("span",{class:"log-date"},e.date),React.createElement("span",{class:"log-content"},e.content))}))),React.createElement(d.s,{p:!0},"If you don't see any errors, your host might not allow remote access to PHP error logs. Contact them for assistance, or look in your hosting control panel."))),React.createElement(b.V,{title:"Settings"},React.createElement(R.z,{title:"Settings",className:"primary"},L,M))))))},we=n(4677),Re=n(8696),Oe=n(8922),_e=n(6734),xe=n(1543),Se=n(8668),Te=n(9794),Ne=n(7213);function Ce(e){return Ce="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},Ce(e)}function Ie(){Ie=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Ce(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Ce(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Ae(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function ke(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Ae(o,r,a,i,l,"next",e)}function l(e){Ae(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Le(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Me(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)?Me(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 Me(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 Pe=wp.element,je=Pe.useState,Fe=Pe.useEffect,De="".concat(S,"/meow-licenser/").concat(_,"/v1"),Ge=function(){var e=Le(je(!1),2),t=e[0],n=e[1],r=Le(je(!1),2),a=r[0],o=r[1],i=Le(je(null),2),l=i[0],c=i[1],u=Le(je(null),2),s=u[0],f=u[1],m=Le(je(""),2),p=m[0],h=m[1],y=A&&(!s||"valid"!==s.license),v=function(){var e=ke(Ie().mark((function e(){var t;return Ie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I){e.next=2;break}return e.abrupt("return");case 2:return n(!0),e.prev=3,e.next=6,(0,O.IU)("".concat(De,"/get_license"),{method:"POST",nonce:k});case 6:t=e.sent,f(t.data),t.data.key&&h(t.data.key),e.next=15;break;case 11:e.prev=11,e.t0=e.catch(3),alert("Error while checking the license. Check your console for more information."),console.error(e.t0);case 15:n(!1);case 16:case"end":return e.stop()}}),e,null,[[3,11]])})));return function(){return e.apply(this,arguments)}}(),g=function(){var e=ke(Ie().mark((function e(){return Ie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n(!0),e.prev=1,e.next=4,(0,O.IU)("".concat(De,"/set_license"),{method:"POST",nonce:k,json:{serialKey:null}});case 4:e.sent.success&&(h(""),f(null),c("licenseRemoved")),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),alert("Error while removing the license. Check your console for more information."),console.error(e.t0);case 12:n(!1);case 13:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(){return e.apply(this,arguments)}}(),E=function(){var e=ke(Ie().mark((function e(){var t;return Ie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n(!0),e.prev=1,e.next=4,(0,O.IU)("".concat(De,"/set_license"),{method:"POST",nonce:k,json:{serialKey:p,override:!0}});case 4:(t=e.sent).success&&(f(t.data),t.data&&!t.data.issue&&c("licenseAdded")),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),alert("Error while forcing the license. Check your console for more information."),console.error(e.t0);case 12:n(!1);case 13:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(){return e.apply(this,arguments)}}(),b=function(){var e=ke(Ie().mark((function e(){var t;return Ie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("MEOW_OVERRIDE"!==p){e.next=5;break}return o(!0),f(null),h(""),e.abrupt("return");case 5:return n(!0),e.prev=6,e.next=9,(0,O.IU)("".concat(De,"/set_license"),{method:"POST",nonce:k,json:{serialKey:p}});case 9:(t=e.sent).success&&(f(t.data),t.data&&!t.data.issue&&c("licenseAdded")),e.next=17;break;case 13:e.prev=13,e.t0=e.catch(6),alert("Error while validating the license. Check your console for more information."),console.error(e.t0);case 17:n(!1);case 18:case"end":return e.stop()}}),e,null,[[6,13]])})));return function(){return e.apply(this,arguments)}}();Fe((function(){v()}),[]);var _=y?"Forced License":A?"Enabled":"Disabled",x=y||s&&"valid"===s.license,S="Your license is active. Thanks a lot for your support :)";y&&(S="This license has been force-enabled for you.",s&&s.check_url&&(S=React.createElement(React.Fragment,null,React.createElement("span",null,S),React.createElement("br",null),React.createElement("small",null,"To check your license status, please click ",React.createElement("a",{target:"_blank",href:s.check_url+"&cache="+642e3*Math.random(),rel:"noreferrer"},"here"),".")))),x||(s?"no_activations_left"===s.issue?S=React.createElement("span",null,"There are no activations left for this license. You can visit your account at ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com"},"Meow Apps"),", unregister a site, and click on ",React.createElement("i",null,"Retry to validate"),"."):"expired"===s.issue?S=React.createElement("span",null,"Your license has expired. You can get another license or renew the current one by visiting your account at ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com"},"Meow Apps"),"."):"missing"===s.issue?S="This license does not exist.":"disabled"===s.issue?S="This license has been disabled.":"item_name_mismatch"===s.issue?S="This license seems to be for a different plugin... isn't it? :)":"forced"===s.issue?S="ABC":(S=React.createElement("span",null,"There is an unknown error related to the system or this serial key. Really sorry about this! Make sure your security plugins and systems are off temporarily. If you are still experiencing an issue, please ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com/contact/"},"contact us"),"."),console.error({license:s})):S="Unknown error :(");var T=React.createElement(R.z,{title:"Pro Version (Not Installed)",className:"primary"},"You will find more information about the Pro Version ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com"},"here"),". If you actually bought the Pro Version already, please remove the current plugin and download the Pro Version from your account at ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com/"},"Meow Apps"),"."),N=React.createElement(R.z,{title:"Pro Version (".concat(_,")"),busy:t,className:"primary"},!y&&!(s&&s.key===p)&&React.createElement(React.Fragment,null,React.createElement("div",{style:{marginBottom:10}},"License Key:"),React.createElement(Re.A,{id:"mfrh_pro_serial",name:"mfrh_pro_serial",disabled:t,value:p,onChange:function(e){return h(e)},placeholder:"Type your license key..."}),React.createElement(d.s,{p:!0},"Insert your serial key above. If you don't have one yet, you can get one ",React.createElement("a",{href:"https://meowapps.com"},"here"),". If there was an error during the validation, try the ",React.createElement("i",null,"Retry")," to ",React.createElement("i",null,"validate")," button.")),s&&!x&&React.createElement(Ne.X,{variant:"danger"},S),(y||s)&&x&&React.createElement(Ne.X,{variant:"success"},S),React.createElement("div",{style:{marginTop:15,display:"flex",justifyContent:"end"}},s&&!x&&React.createElement(w.M,{className:"secondary",disabled:t||!p,onClick:b},"Retry to validate"),s&&s.key===p&&React.createElement(w.M,{className:"secondary",disabled:t||!p,onClick:g},"Remove License"),React.createElement(w.M,{disabled:t||!p||s&&s.key===p,onClick:b},"Validate License"),a&&!x&&React.createElement(w.M,{disabled:t||!p||s&&s.key===p,onClick:E,className:"danger"},"Force License")),React.createElement(Te.n,{isOpen:"licenseAdded"===l,title:"Thank you :)",content:"The Pro features have been enabled. This page should be now reloaded.",okButton:{label:"Reload",onClick:function(){return location.reload()}}}),React.createElement(Te.n,{isOpen:"licenseRemoved"===l,title:"Goodbye :(",content:"The Pro features have been disabled. This page should be now reloaded.",okButton:{label:"Reload",onClick:function(){return location.reload()}}}));return I?N:T};const{__:Ue}=wp.i18n,Be={};Be.COMMON={GENERAL:Ue("General","ai-engine"),MODULES:Ue("Modules","ai-engine"),CLIENT_MODULES:Ue("Client Modules","ai-engine"),BACKEND_MODULES:Ue("Admin Modules","ai-engine"),SERVER_MODULES:Ue("Server Modules","ai-engine"),ADVISOR:Ue("Advisor","ai-engine"),SETTINGS:Ue("Settings","ai-engine"),CHATBOT:Ue("Chatbot","ai-engine"),CHATBOTS:Ue("Chatbots","ai-engine"),CHATBOT_HELP:Ue("Highly customizable chatbot.","ai-engine"),STATISTICS:Ue("Statistics","ai-engine"),STYLE:Ue("Style","ai-engine"),ENABLE:Ue("Enable","ai-engine"),NAME:Ue("Name","ai-engine"),SUBMIT:Ue("Submit","ai-engine"),MODEL:Ue("Model","ai-engine"),AI_MODEL:Ue("AI Model","ai-engine"),TEMPERATURE:Ue("Temperature","ai-engine"),MAX_TOKENS:Ue("Max Tokens","ai-engine"),CONTEXT_MAX_LENGTH:Ue("Context Max Length","ai-engine"),STOP_SEQUENCE:Ue("Stop Sequence","ai-engine"),MODE:Ue("Mode","ai-engine"),CONTEXT:Ue("Context","ai-engine"),IMAGES_NUMBER:Ue("Number of Images","ai-engine"),AVATAR:Ue("Avatar","ai-engine"),AI_NAME:Ue("AI Name","ai-engine"),GUEST_NAME:Ue("Guest Name","ai-engine"),USER_NAME:Ue("User Name","ai-engine"),PLACEHOLDER:Ue("Placeholder","ai-engine"),START_SENTENCE:Ue("Start Sentence","ai-engine"),SEND:Ue("Send","ai-engine"),CLEAR:Ue("Clear","ai-engine"),SYSTEM_NAME:Ue("System Name","ai-engine"),ID:Ue("ID","ai-engine"),POPUP:Ue("Popup","ai-engine"),POSITION:Ue("Position","ai-engine"),ICON:Ue("Icon","ai-engine"),ICON_TEXT:Ue("Icon Text","ai-engine"),ICON_TEXT_DELAY:Ue("Icon Text Delay","ai-engine"),FULL_SCREEN:Ue("Full Screen","ai-engine"),CASUALLY_FINE_TUNED:Ue("Casually Fine-Tuned","ai-engine"),CONTENT_AWARE:Ue("Content Aware","ai-engine"),SPACING:Ue("Spacing","ai-engine"),BORDER_RADIUS:Ue("Border Radius","ai-engine"),FONT_SIZE:Ue("Font Size","ai-engine"),FONT_COLOR:Ue("Font Color","ai-engine"),BACK_PRIMARY_COLOR:Ue("Back Primary Color","ai-engine"),BACK_SECONDARY_COLOR:Ue("Back 2nd Color","ai-engine"),HEADER_BUTTONS_COLOR:Ue("Header Buttons Color","ai-engine"),HEADER_BACKGROUND_COLOR:Ue("Header Back Color","ai-engine"),BUBBLE_COLOR:Ue("Bubble Color","ai-engine"),BACK_USER_COLOR:Ue("Back User Color","ai-engine"),BACK_AI_COLOR:Ue("Back AI Color","ai-engine"),BACK_AI_SECONDARY_COLOR:Ue("Back AI 2nd Color","ai-engine"),AVATAR_MESSAGE_BACKGROUND_COLOR:Ue("Message Background","ai-engine"),AVATAR_MESSAGE_FONT_COLOR:Ue("Message Color","ai-engine"),POPUP_ICON:Ue("Popup Icon","ai-engine"),CUSTOM_ICON:Ue("Custom Icon (URL or Emoticon)","ai-engine"),FEATURES:Ue("Features","ai-engine"),TIMEFRAME:Ue("Timeframe","ai-engine"),ABSOLUTE:Ue("Absolute","ai-engine"),NONE:Ue("None","ai-engine"),EDITORS_ADMINS:Ue("Editors & Admins","ai-engine"),ADMINS_ONLY:Ue("Admins Only","ai-engine"),CREDITS:Ue("Credits","ai-engine"),TYPE:Ue("Type","ai-engine"),USERS:Ue("Users","ai-engine"),USER:Ue("User","ai-engine"),GUESTS:Ue("Guests","ai-engine"),GUEST:Ue("Guest","ai-engine"),OPENAI:Ue("Open AI","ai-engine"),LICENSE_TAB:Ue("License","ai-engine"),FINETUNES:Ue("Finetunes","ai-engine"),MODELS:Ue("Models","ai-engine"),FILES:Ue("Files","ai-engine"),ASSISTANT:Ue("Assistant","ai-engine"),ASSISTANTS:Ue("Assistants","ai-engine"),UTILITIES:Ue("Utilities","ai-engine"),POSTS_SUGGESTIONS:Ue("AI Copilot, AI Suggestions, Magic Wands","ai-engine"),POSTS_SUGGESTIONS_HELP:Ue("Tools to brainstorm/write faster and better.","ai-engine"),GENERATORS:Ue("Generators","ai-engine"),CONTENT_GENERATOR:Ue("Content Generator","ai-engine"),CONTENT_GENERATOR_HELP:Ue("Generate articles. Support templates.","ai-engine"),IMAGES_GENERATOR:Ue("Images Generator","ai-engine"),IMAGES_GENERATOR_HELP:Ue("Generate images. Support templates.","ai-engine"),PLAYGROUND:Ue("Playground","ai-engine"),PLAYGROUND_HELP:Ue("Play with AI or let it perform various tasks for you. Support templates.","ai-engine"),FORMS:Ue("Forms","ai-engine"),FORMS_HELP:Ue("Build AI forms. Based on fields, users will be given answers or suggestions.","ai-engine"),STATISTICS_HELP:Ue("Track AI interactions, check statistics, set limits, and more!","ai-engine"),CLIENT_DEBUG:Ue("Client Debug","ai-engine"),CLIENT_DEBUG_HELP:Ue("Debugging information will be displayed in the console.","ai-engine"),SERVER_DEBUG:Ue("Server Debug","ai-engine"),SERVER_DEBUG_HELP:Ue("Debugging information from your server will be displayed in a console on this tab.","ai-engine"),CLEAR_LOGS:Ue("Clear Logs","ai-engine"),REFRESH_LOGS:Ue("Refresh Logs","ai-engine"),API_KEY:Ue("API Key","ai-engine"),USAGE_HELP:Ue('Those values are for information only. They are not accurate and should not be used for billing purposes. The calculation of the number of tokens and the cost is very different from one service to another, and AI Engine does its best to estimate it. For the exact amounts, please check your accounts at the respective services. For OpenAI, you can check your <a href="https://platform.openai.com/usage" target="_blank">OpenAI account</a>.',"ai-engine"),USAGE_PRO_HELP:Ue('If you would like to have better control on the amounts, add conditions or set limits to the usage of the AI, consider <a href="https://meowapps.com/ai-engine/" target="_blank">AI Engine Pro</a>.',"ai-engine"),LANGUAGE:Ue("Language","ai-engine"),HIDE:Ue("Hide","ai-engine"),SHOW:Ue("Show","ai-engine"),CONTENT:Ue("Content","ai-engine"),IMAGES:Ue("Images","ai-engine"),IMAGES_AND_FILES:Ue("Images & Files","ai-engine"),EXCERPT:Ue("Excerpt","ai-engine"),GENERATE:Ue("Generate","ai-engine"),MODEL_PARAMS:Ue("Model Params","ai-engine"),CONTEXT_PARAMS:Ue("Context Params","ai-engine"),PROMPT:Ue("Prompt","ai-engine"),PROMPTS:Ue("Prompts","ai-engine"),LABEL:Ue("Label","ai-engine"),SYSTEM:Ue("System","ai-engine"),SHORTCODE:Ue("Shortcode","ai-engine"),SHORTCODES:Ue("Shortcodes","ai-engine"),RESOLVE:Ue("Resolve","ai-engine"),MAX_MESSAGES:Ue("Max Messages","ai-engine"),INPUT_MAX_LENGTH:Ue("Input Max Length","ai-engine"),COMPLIANCE_TEXT:Ue("Compliance Text","ai-engine"),MODERATION:Ue("Moderation","ai-engine"),MODERATION_HELP:Ue("Moderation features with AI.","ai-engine"),FORMATTING:Ue("Formatting","ai-engine"),FORMATTING_HELP:Ue("Format the reply from AI into HTML. This is already done automatically if Markdown is detected in the reply.","ai-engine"),LOGS:Ue("Logs","ai-engine"),CODE:Ue("Code","ai-engine"),EMBEDDINGS:Ue("Embeddings","ai-engine"),EMBEDDINGS_HELP:Ue("Create searchable data that can be reused to feed the chatbot and other AI or UI elements.","ai-engine"),OTHERS:Ue("Others","ai-engine"),PINECONE_APIKEY_HELP:Ue('You can get your API Keys in your <a href="https://app.pinecone.io/organizations/keys" target="_blank">Pinecone Account</a>.',"ai-engine"),QDRANT_APIKEY_HELP:Ue('You can get your API Keys in your <a href="https://cloud.qdrant.io/accounts/" target="_blank">Qdrant Account</a>.',"ai-engine"),SERVER:Ue("Server","ai-engine"),PINECONE_SERVER_HELP:Ue("The URL of your host (check your Indexes).","ai-engine"),PINECONE_NAMESPACE_HELP:Ue("The namespace is used to separate the data from other data. This allows you to use the same server/index on more than one website. This is optional.","ai-engine"),QDRANT_SERVER_HELP:Ue("The URL of your cluster (known as Cluster URL).","ai-engine"),QDRANT_COLLECTION_HELP:Ue("The collection keeps data apart so you can use one cluster for many websites. If there's no collection, Qdrant makes one with 1536 dimensions and uses cosine similarity.","ai-engine"),COST:Ue("Cost","ai-engine"),USAGE:Ue("Usage","ai-engine"),TRANSCRIPTION:Ue("Transcription","ai-engine"),TRANSCRIPTION_HELP:Ue("Introduces a 'Transcribe' tab to easily transform audio/images into text and get AI answers in JSON format.","ai-engine"),AUDIO_TRANSCRIPTION:Ue("Audio-to-Text","ai-engine"),IMAGE_TRANSCRIPTION:Ue("Image-to-Text","ai-engine"),AUDIO_TO_TEXT:Ue("Audio ➡ Text","ai-engine"),IMAGE_TO_TEXT:Ue("Image ➡ Text","ai-engine"),EMBEDDINGS_ENV:Ue("Environment","ai-engine"),EMBEDDINGS_INDEX:Ue("Index","ai-engine"),NAMESPACE:Ue("Namespace","ai-engine"),NAMESPACES:Ue("Namespaces","ai-engine"),NAMESPACE_HELP:Ue("The namespace is used to separate the data from other data. This allows you to use the same index on more than one website.","ai-engine"),NAMESPACES_HELP:Ue("Enter the namespaces you would like to use on this site, separated by commas.","ai-engine"),ERROR:Ue("Error","ai-engine"),RETRY:Ue("Retry","ai-engine"),AUTO_RETRY:Ue("Auto Retry","ai-engine"),SKIP:Ue("Skip","ai-engine"),AUTO_SKIP:Ue("Auto Skip","ai-engine"),STOP:Ue("Stop","ai-engine"),AUTO_RETRY_DESCRIPTION:Ue("Auto Retry retries actions up to 10 times with increasing delay to avoid timeouts.","ai-engine"),WIDTH:Ue("Width","ai-engine"),MAX_HEIGHT:Ue("Max Height","ai-engine"),APPEARANCE:Ue("Appearance","ai-engine"),THRESHOLDS:Ue("Thresholds","ai-engine"),DASHBOARD:Ue("Dashboard","ai-engine"),ADVANCED:Ue("Advanced","ai-engine"),DISCUSSIONS:Ue("Discussions","ai-engine"),ROWS:Ue("Rows","ai-engine"),POST_TYPE:Ue("Post Type","ai-engine"),GENERATE_CONTENT:Ue("Generate Content","ai-engine"),GENERATE_IMAGES:Ue("Generate Images","ai-engine"),ADMIN_BAR:Ue("Admin Bar","ai-engine"),ADMIN_TOOLS:Ue("Admin Tools","ai-engine"),REFRESH:Ue("Refresh","ai-engine"),DELETE:Ue("Delete","ai-engine"),DELETE_ALL:Ue("Delete All","ai-engine"),DELETE_SELECTED:Ue("Delete Selected","ai-engine"),OPENAI_ORGANIZATION_ID:Ue("Organization ID","ai-engine"),OPENAI_AZURE_API_KEY:Ue("API Key","ai-engine"),OPENAI_AZURE_DEPLOYMENT_NAME:Ue("Deployment Name","ai-engine"),OPENAI_AZURE_DEPLOYMENTS:Ue("Deployments","ai-engine"),ENDPOINT:Ue("Endpoint","ai-engine"),HUGGINGFACE_MODELS:Ue("Models","ai-engine"),HUGGINGFACE_MODEL_NAME:Ue("Name","ai-engine"),HUGGINGFACE_MODEL_URL:Ue("API URL","ai-engine"),THEME:Ue("Theme","ai-engine"),THEMES:Ue("Themes","ai-engine"),BANNED_WORDS:Ue("Banned Words","ai-engine"),BANNED_IPS:Ue("Banned IPs","ai-engine"),SECURITY:Ue("Security","ai-engine"),POST_TYPES:Ue("Post Types","ai-engine"),COPY_BUTTON:Ue("Copy Button","ai-engine"),AI_AVATAR:Ue("AI Avatar","ai-engine"),GUEST_AVATAR:Ue("Guest Avatar","ai-engine"),SITE_WIDE_CHATBOT:Ue("Site-Wide Chatbot","ai-engine"),QUERIES_DATA:Ue("Queries Data","ai-engine"),QUERIES_FORMS_DATA:Ue("Queries Form Data","ai-engine"),WEBSPEECH_API:Ue("Web Speech API","ai-engine"),VIRTUAL_KEYBOARD:Ue("Virtual Keyboard","ai-engine"),GDPR_CONSENT:Ue("GDPR Consent","ai-engine"),GDPR_TEXT:Ue("GDPR Text","ai-engine"),GDPR_BUTTON:Ue("GDPR Button","ai-engine"),FIX:Ue("Fix","ai-engine"),SPEECH_RECOGNITION:Ue("Speech Recognition","ai-engine"),SPEECH_SYNTHESIS:Ue("Speech Synthesis","ai-engine"),QUERY:Ue("Query","ai-engine"),QUERIES:Ue("Queries","ai-engine"),LOCAL_MEMORY:Ue("Local Memory","ai-engine"),ACTIONS:Ue("Actions","ai-engine"),RESET:Ue("Reset","ai-engine"),INCIDENTS_OPENAI:Ue("Incidents (OpenAI)","ai-engine"),PREVIEW:Ue("Preview","ai-engine"),LEGACY_FORMS:Ue("Legacy Forms","ai-engine"),LEGACY_FEATURES:Ue("Legacy Features","ai-engine"),DUPLICATE:Ue("Duplicate","ai-engine"),CHATBOT_EDITOR:Ue("Chatbot Editor","ai-engine"),THEME_EDITOR:Ue("Theme Editor","ai-engine"),STREAMING:Ue("Streaming","ai-engine"),SYNTAX_HIGHLIGHT:Ue("Syntax Highlight","ai-engine"),DATA_NOT_AVAILABLE:Ue("Data not available.","ai-engine"),EXPORT:Ue("Export","ai-engine"),IMPORT:Ue("Import","ai-engine"),MODIFY_EMBEDDING:Ue("Modify Embedding","ai-engine"),ADD_EMBEDDING:Ue("Add Embedding","ai-engine"),DEV_TOOLS:Ue("Dev Tools","ai-engine"),SINGLE_GENERATE:Ue("Single Generate","ai-engine"),PUBLIC_API:Ue("Public API","ai-engine"),USER_INTERFACE:Ue("User Interface","ai-engine"),INTRO_MESSAGE:Ue("Intro Message","ai-engine"),ADDONS:Ue("Add-ons","ai-engine"),AI_ENVIRONMENT_DEFAULTS:Ue("Default Environments for AI","ai-engine"),ENVIRONMENTS_FOR_AI:Ue("Environments for AI","ai-engine"),ENVIRONMENT_ID:Ue("Environment ID","ai-engine"),EMBEDDINGS_ENVIRONMENT_DEFAULT:Ue("Default Embeddings Environment","ai-engine"),ENVIRONMENT:Ue("Environment","ai-engine"),PLUGIN_DATA:Ue("Plugin Data","ai-engine"),PLUGIN_DATA_DESCRIPTION:Ue("The database and all the options of the plugin will be removed on uninstall.","ai-engine"),RESET_LIMITS:Ue("Reset Limits","ai-engine"),VISION:Ue("Vision","ai-engine"),FILE_SEARCH:Ue("File Search","ai-engine"),PROMPT_TO_JSON:Ue("Prompt ➡ JSON","ai-engine"),RESOLUTION:Ue("Resolution","ai-engine"),DEFAULT:Ue("Default","ai-engine"),REFRESH_MODELS:Ue("Refresh Models","ai-engine"),AUDIO:Ue("Audio","ai-engine"),JSON:Ue("JSON","ai-engine"),AI_ENVIRONMENT:Ue("AI Environment","ai-engine"),OVERRIDE_DEFAULTS:Ue("Override Defaults","ai-engine"),REGION:Ue("Region","ai-engine"),PROJECT_ID:Ue("Project ID","ai-engine"),BEARER_TOKEN:Ue("Bearer Token","ai-engine"),DIMENSIONS:Ue("Dimensions","ai-engine"),MIN_SCORE:Ue("Min Score","ai-engine"),MAX_SELECT:Ue("Max Results","ai-engine"),QDRANT_COLLECTION:Ue("Collection","ai-engine"),INSTRUCTIONS:Ue("Instructions","ai-engine"),FUNCTIONS:Ue("Functions","ai-engine"),BUBBLE:Ue("Bubble","ai-engine"),TABS:Ue("Tabs","ai-engine"),DROPDOWN:Ue("Dropdown","ai-engine"),CHATBOT_SELECT:Ue("Chatbot Select","ai-engine")},Be.FORMS={PROMPT_INFO:Ue("The template of your prompt. To re-use the data entered by the user, use the name of that field between curly braces. Example: Recommend me {MUSIC_TYPE} artists. You can also use an ID as an input, like this: ${#myfield}. Finally, if you wish the output to be formatted, add: 'Use Markdown.'.\"","ai-engine"),OUTPUT:Ue("Output","ai-engine"),OUTPUT_ELEMENT:Ue("Output Element","ai-engine"),OUTPUT_ELEMENT_INFO:Ue("The result will be written to this element. If you wish to simply display the result in an Output Block, use its ID. For instance, if its ID is mwai-666, use '#mwai-666'.","ai-engine")},Be.HELP={TEMPERATURE:Ue("Between 0 and 1. Higher values means the model will take more risks.","ai-engine"),MAX_TOKENS:Ue("The maximum number of tokens to generate. The model will stop generating once it hits this limit.","ai-engine"),STOP_SEQUENCE:Ue("The sequence of tokens that will cause the model to stop generating text. You absolutely need this with fine-tuned models.","ai-engine"),COST:Ue("Keeps track of the current costs.","ai-engine"),RESOLVE_SHORTCODE:Ue("Will resolve the shortcode in your content when needed (Content-Aware will use this, for instance).","ai-engine"),FINETUNES:Ue("Train your own AI models.","ai-engine"),DISCUSSIONS:Ue("Keep the conversations and enable browsing them via the Conversations tab.","ai-engine"),AZURE_DEPLOYMENTS:Ue("Add your deployments below and define what kind of model they are.","ai-engine"),BANNED_WORDS:Ue("Reject queries containing these words; separate with commas.","ai-engine"),BANNED_IPS:Ue("Block access from specified IP addresses or ranges using CIDR notation; separate with commas.","ai-engine"),VIRTUAL_KEYBOARD:Ue("Prevent the virtual keyboard from pushing the chatbot up on mobile devices. This is experimental and might cause issues.","ai-engine"),GDPR_CONSENT:Ue("If enabled, the user will have to accept the conditions before using the chatbot.","ai-engine"),POST_TYPES:Ue("Enable for these post types; separate with commas.","ai-engine"),POST_STATUS:Ue("Enable for these post statuses (publish, draft, future, private, etc); separate with commas.","ai-engine"),POST_CATEGORIES:Ue("Enable for these categories (slugs); separate with commas. If none, it will be enabled for all.","ai-engine"),CONTEXT_MAX_LENGTH:Ue("Truncate the context (Content-Aware, Embeddings, etc) to make sure it is below this number of characters.","ai-engine"),MAX_MESSAGES:Ue("Maximum number of historical messages that is sent to the AI model.","ai-engine"),INPUT_MAX_LENGTH:Ue("Maximum number of characters that can be input by the user.","ai-engine"),STATISTICS:Ue(" In the Queries tab, you can browse through all your users' activity. Contextual data is excluded unless you activate the options below. Make sure your users are aware of this.","ai-engine"),QUERIES_DATA:Ue("Record the queries and their replies.","ai-engine"),QUERIES_FORMS_DATA:Ue("Capture form data neatly for simple reuse.","ai-engine"),SPEECH_RECOGNITION:Ue("Enable speech-to-text. Depends on the browser and OS used by the user.","ai-engine"),SPEECH_SYNTHESIS:Ue("Enable text-to-speech.","ai-engine"),CUSTOM_SHORTCODE:Ue("Prefer the above version. If you need many chatbots, you can custom shortcodes, like the one below. Custom shortcodes are based on the default chatbot, and their attributes override the default ones.","ai-engine"),USER_FILTER:Ue("Type an User ID, or an IP.","ai-engine"),STREAMING:Ue("The AI's response will appear as it's being created. Be cautious: this feature's ability to manage statistics, limits, and filters is still in its beta phase.","ai-engine"),SYNTAX_HIGHLIGHT:Ue("Enable syntax highlighting for the code blocks.","ai-engine"),DEV_TOOLS:Ue("Enable a new tab with debugging tools. For developers only.","ai-engine"),PUBLIC_API:Ue("Enable the Public REST API.","ai-engine"),INTRO_MESSAGE:Ue("Enable the introduction text at the top of this page.","ai-engine"),ADDONS:Ue("Enable the AI Addons section under the Meow Apps menu.","ai-engine"),OPENAI_API_KEY:Ue('You can get your API Keys in your <a href="https://beta.openai.com/account/api-keys" target="_blank">OpenAI Account</a>.',"ai-engine"),OPENAI_ORGANIZATION_ID:Ue('You can link this environment to an <a href="https://platform.openai.com/account/organization" target="_blank">Organization</a>. This is optional.',"ai-engine"),AZURE_API_KEY:Ue('You can get your API Keys in your <a href="https://oai.azure.com/portal" target="_blank">Azure Account</a>.',"ai-engine"),ANTHROPIC_API_KEY:Ue('You can get your API Keys in your <a href="https://console.anthropic.com/settings/keys" target="_blank">Anthropic Account</a>.',"ai-engine"),OPENROUTER_API_KEY:Ue('You can get your API Keys in your <a href="https://openrouter.ai/keys" target="_blank">OpenRouter Account</a>.',"ai-engine"),QDRANT:Ue('Use the code <b>#AIENGINE5</b> when you <a href="https://qdrant.to/cloud" target="_blank">Create a Qdrant Account</a>. You will get 5% off.',"ai-engine"),ASSISTANTS:Ue("The Assistants API is designed to help developers build powerful AI assistants capable of performing a variety of tasks.","ai-engine"),ASSISTANTS_INTRO:Ue('The Assistants API is designed to help developers build powerful AI assistants capable of performing a variety of tasks. To create them, head to the <a href="https://beta.openai.com/assistants" target="_blank">OpenAI Assistants</a> dashboard, then <b>Refresh Assistants</b> here. You can use an assistant in your chatbots by switching the <b>Mode</b> to <b>Assistant</b>.',"ai-engine"),ASSISTANTS_WARNINGS:Ue('Assistants are also <a href="https://platform.openai.com/docs/api-reference/assistants" target="_blank">in beta</a>, both for OpenAI and AI Engine. OpenAI did not add streaming support for them yet. Pricing is still quite unclear and <a href="https://openai.com/pricing" target="_blank">tricky</a>. AI Engine can only perform an estimation. If you want to discuss assistants with other users, visit the <a href="https://discord.gg/bHDGh38" target="_blank">Meow Apps Discord Server</a>.',"ai-engine"),BEARER_TOKEN:Ue('The Public API will be usable by using this Bearer Token. If not set, you will need to <a href="https://meowapps.com/ai-engine/api/#public-rest-api" target="_blank">build your own authentication</a> by using the <i>mwai_allow_public_api</i> filter.',"ai-engine"),NO_EMBEDDINGS_RESULTS:Ue("No results for this search. Make sure the Minimum Score is not too high.","ai-engine"),NO_EMBEDDINGS_ROWS:Ue("No embeddings yet in this environment.","ai-engine"),MIN_SCORE:Ue("The minimum score the embeddings need to have to be returned. Between 0 and 100 and defaults to 35.","ai-engine"),MAX_SELECT:Ue("The maximum number of embeddings to return and to use as context. Between 1 and 100 and defaults to 10.","ai-engine"),FUNCTIONS:Ue("Select the functions to make available for the AI model's choice. It will use them to enhance responses and perform specific actions. This feature is known as Function Calling or Tools.","ai-engine"),FUNCTIONS_UNAVAILABLE:Ue('There are no functions available. Please use <a href="https://wordpress.org/plugins/snippet-vault/" target="_blank">Snippet Vault</a> to add some. The Pro Version of AI Engine is also required for this feature.',"ai-engine"),ADVISOR:Ue("In your Dashboard will be displayed daily recommendations tailored to your WordPress setup. Admins only.","ai-engine"),BUBBLE:Ue("The popup will be displayed as a bubble.","ai-engine"),ICON_TEXT:Ue("If set, this text will appear next to the icon/bubble.","ai-engine"),ICON_TEXT_DELAY:Ue("The delay before the text appears.","ai-engine"),CHATBOT_SELECT:Ue("Choose how you want to select the chatbot. By default, tabs are used, but you can also use a filterable dropdown if you have many chatbots.","ai-engine")},Be.SETTINGS={AI_ENV_SETUP:Ue('To leverage the functionalities of AI Engine, it needs to be connected directly to AI services. We recommend starting with OpenAI. Create an account and generate an API Key by visiting the <a href="https://beta.openai.com/account/api-keys" target="_blank">OpenAI</a> website. Once obtained, navigate to the <b>Settings</b> tab and input your OpenAI API Key in the "Environments for AI" section.',"ai-engine"),PINECONE_SETUP:Ue('You choose to use Embeddings. To use them, you need to a Pinecone account. Visit the <a href="https://app.pinecone.io" target="_blank">Pinecone</a> website to create an account, then insert your Pinecone API Key in the <b>Settings</b> tab.',"ai-engine"),INTRO:Ue('Boost your WordPress with AI, now! Please start with our <a href="https://meowapps.com/ai-engine/tutorial/" target="_blank">tutorial</a>. Then move to our <a href="https://docs.meowapps.com/" target="_blank">documentation</a>. Have a look at our <a href="https://meowapps.com/products/category/ai-add-ons/" target="_blank">add-ons</a>. And make sure you read the <a href="https://meowapps.com/ai-engine/disclaimer/" target="_blank">disclaimer</a>. Have fun! 🎵',"ai-engine"),MODULES_INTRO:Ue("To avoid cluttering the UI and your WP, only enable the features you need.","ai-engine"),ALERT_INJECT_BUT_NO_POPUP:Ue("You choose to inject the chatbot in your website. You probably also want to use the chatbot in a Popup.","ai-engine"),ALERT_CASUALLY_BUT_NO_FINETUNE:Ue("Normally, you should not check the Casually Fine Tuned option with a non-finetuned model. Make sure that's what you want.","ai-engine"),ALERT_CONTENTAWARE_BUT_NO_CONTENT:Ue('Content Aware requires your Context to use the {CONTENT} placeholder. It will be replaced by the content of page the chatbot is on. More info <a href="https://meowapps.com/ai-engine/tutorial/#contextualization" target="_blank">here</a>.',"ai-engine"),SET_AS_DEFAULT_PARAMETERS:Ue("Set as Default Parameters","ai-engine"),SET_AS_DEFAULT_PARAMETERS_HELP:Ue("Set the parameters above as the default parameters for the chatbot. You can then use the shortcode [mwai_chat] anywhere on your website.","ai-engine"),INJECT_DEFAULT_CHATBOT:Ue("Inject Default Chatbot in Entire Website","ai-engine"),INJECT_DEFAULT_CHATBOT_HELP:Ue("Inject the chatbot [mwai_chat] in the entire website.","ai-engine"),CHATGPT_STYLE_INTRO:Ue('Keep in mind that you can also style the chatbot (or a specific chatbot, if you use many) by injecting CSS. Have a look <a target="_blank" href="https://meowapps.com/ai-engine/tutorial/#apply-custom-style-to-the-chatbot">here</a>. More information in the <a target="_blank" href="https://meowapps.com/ai-engine/faq">FAQ</a>.',"ai-engine"),TYPEWRITER_EFFECT:Ue("Typewriter Effect","ai-engine"),TYPEWRITER_EFFECT_HELP:Ue("The reply from AI will be typewrited. This delays the final output! Absolutely not recommended. Please use <b>Streaming</b> instead.","ai-engine"),CHATBOT_MODERATION_HELP:Ue("If the conversation seems offensive, the chatbot will reject it.","ai-engine"),CUSTOM_URL:Ue("Custom URL","ai-engine"),ASSISTANT_NO_FILE_SEARCH:Ue('This assistant does not support File Search. You can activate it on the <a href="https://platform.openai.com/assistants" target="_blank">OpenAI Assistants</a> dashboard. Then, use the Refresh button in the Assistants tab.',"ai-engine"),ASSISTANT_FILE_SEARCH:Ue("File Search will be used when the users upload documents. If the user uploads images, those will be handled by AI Vision if the model supports it and if it is enabled.","ai-engine")},Be.CHATBOT={CHATBOT_BUILDER:Ue("Chatbot Builder","ai-engine"),RESET_PARAMS:Ue("Reset Parameters","ai-engine")},Be.STATISTICS={ABSOLUTE_HELP:Ue("Using Absolute, Day represents <i>today</i>. Otherwise, the <i>past 24 hours</i>. Same logic applies to the other timeframes.","ai-engine"),NO_CREDITS_MESSAGE:Ue("Message for No Credits","ai-engine"),FULL_ACCESS_USERS:Ue("Full-Access Users","ai-engine"),ENABLE_LIMITS:Ue("Enable Limits","ai-engine")},Be.CONTENT_GENERATOR={INTRO:Ue("The Content Generator is a powerful tool that can generate content for you. It can be used to generate articles, emails, or even code. It can also be used to generate content for your chatbot. <b>Let me know if there are any new features you would like to see!</b> Have fun 🥳","ai-engine"),TITLE_MISSING:Ue("Title is missing!","ai-engine"),SECTIONS_MISSING:Ue("Sections are missing!","ai-engine"),SINGLE_GENERATE:Ue("Single Generate","ai-engine"),BULK_GENERATE:Ue("Bulk Generate","ai-engine"),CONTENT_PARAMS:Ue("Content Params","ai-engine"),POST_PARAMS:Ue("Post Params","ai-engine"),CONTENT_PARAMS_INTRO:Ue("Input fields are displayed for certain placeholders used in prompts, such as {LANGUAGE} or {WRITING_TONE}","ai-engine"),CUSTOM_LANGUAGE:Ue("Custom Language","ai-engine"),WRITING_STYLE:Ue("Writing Style","ai-engine"),WRITING_TONE:Ue("Writing Tone","ai-engine"),CUSTOM_LANGUAGE_HELP:Ue('All the languages are <i>somehow</i> supported by AI. <a href="https://meowapps.com/ai-engine/faq/#languages" target="_blank">Learn more</a>.',"ai-engine"),MODEL_HELP:Ue("It is recommended to use Turbo or GPT-4 to write texts.","ai-engine"),PROMPTS_INTRO:Ue("Prompts represent the exact request sent to the AI. The variables between curly braces will be replaced by the content of the corresponding field. Prompts are saved in your templates.","ai-engine"),PROMPT_TITLE:Ue("Prompt for <b>Title</b>","ai-engine"),PROMPT_SECTIONS:Ue("Prompt for <b>Sections</b>","ai-engine"),PROMPT_CONTENT:Ue("Prompt for <b>Content</b>","ai-engine"),PROMPT_EXCERPT:Ue("Prompt for <b>Excerpt</b>","ai-engine"),POST_CREATED:Ue("Post Created","ai-engine"),POST_CREATED_AS_DRAFT:Ue("The post was created as a draft.","ai-engine"),CONTENT_HELP:Ue('You can modify the content before using "Create Post". Markdown is supported, and will be converted to HTML when the post is created.',"ai-engine"),SECTIONS_HELP:Ue('Add, rewrite, remove, or reorganize those sections as you wish before (re)clicking on "Generate Content". Markdown format is recommended.',"ai-engine"),GENERATE_EXCERPT:Ue("Generate Excerpt","ai-engine"),GENERATE_CONTENT:Ue("Generate Content","ai-engine"),GENERATE_SECTIONS:Ue("Generate Sections","ai-engine"),PARAGRAPHS_PER_SECTION:Ue("# of Paragraphs per Section","ai-engine"),SECTIONS:Ue("Sections","ai-engine"),TOPICS_HELP:Ue("Write or paste your topics below. Each line will be used as a topic. The same <b>Params</b> and <b>Prompts</b> will be used as with the <b>Single Generate</b>, so make sure you get satisfying results with it first. This <b>takes time</b>, so relax and enjoy some coffee ☕️ and tea 🍵 :)","ai-engine"),GENERATED_POSTS:Ue("Generated Posts","ai-engine"),GENERATE_ALL:Ue("Generate All","ai-engine"),EDIT_POST:Ue("Edit Post","ai-engine"),CREATE_POST:Ue("Create Post","ai-engine"),TITLE_TOO_SHORT:Ue("The title is too short. It should be at least 3 words.","ai-engine"),TITLE_TOO_SHORT_2:Ue("The title is too short.  It should be at least 40 characters.","ai-engine"),TITLE_TOO_LONG:Ue("The title is too long. It should be less than 8 words.","ai-engine"),TITLE_TOO_LONG_2:Ue("The title is too long. It should be less than 70 characters.","ai-engine")},Be.TEMPLATES={TEMPLATE:Ue("Template","ai-engine"),TEMPLATES:Ue("Templates","ai-engine"),DELETE_CONFIRM:Ue("Are you sure you want to delete this template?","ai-engine"),DELETE_ALL_CONFIRM:Ue("Are you sure you want to delete all the templates?","ai-engine"),NEW_TEMPLATE_NAME:Ue("New Template","ai-engine"),EDIT:Ue("EDIT","ai-engine")},Be.PLAYGROUND={INTRO:Ue("Welcome to the AI Playground! Here, you can play with different AI models and ask the UI to perform various tasks for you. You can ask it to write, rewrite, or translate an article, categorize words or elements into groups, write an email, etc. <b>Let me know if there are any new features you would like to see!</b> Have fun 🥳","ai-engine"),PROMPT:Ue("Query / Prompt","ai-engine"),REPLY:Ue("Reply","ai-engine")},Be.ALERTS={FINETUNING_STARTED:Ue("Fine-tuning started! Check its progress in the Models section. Depending on your dataset size, it may take a while (from a few minutes to days).","ai-engine"),RESET_BUILDER:Ue("This will delete all the rows in the builder. Are you sure?","ai-engine"),DELETE_FINETUNE:Ue("You are going to delete this fine-tune. Are you sure?\n\nPlease note that it will take a while before it is actually deleted. This might be a temporary issue of OpenAI.","ai-engine"),FINETUNE_ALREADY_DELETED:Ue("This fine-tune was already deleted. It will be removed from the list.","ai-engine"),CHECK_CONSOLE:Ue("Error! Check your console for more details.","ai-engine"),DATASET_UPLOADED:Ue("Uploaded successfully! You can now train a model based on this dataset.","ai-engine"),ONLY_SUPPORTS_FILES:Ue("This only supports JSON, JSONL, and CSV files.","ai-engine"),EMPTY_LINES_DATASET:Ue("Some lines were empty. Make sure the CSV has a header row and that the columns are named 'prompt' and 'completion'. For debugging, an empty line was logged to the console.","ai-engine"),EMPTY_LINES_EMBEDDINGS:Ue("Some lines were empty. Make sure the CSV has a header row and that the columns are named 'title' and 'content'. For debugging, an empty line was logged to the console.","ai-engine"),ARE_YOU_SURE:Ue("Are you sure?","ai-engine")},Be.FINETUNING={MODELS_INTRO:Ue("The AI models you have fine-tuned. To create more, visit <b>Files</b>.","ai-engine"),LEGACY_MODELS_INTRO:Ue('The AI models you have fine-tuned. <b>Do not use legacy fine-tuning anymore (based on models prior to GPT 3.5). Their deprecation has been <a href="https://platform.openai.com/docs/guides/legacy-fine-tuning" target="_blank">announced by OpenAI</a> for January 4th, 2024.</b><br />',"ai-engine"),FILES_INTRO:Ue("The files you have uploaded to OpenAI. To create a new dataset file, switch from <b>Model & Files</b> to <b>Dataset Editor</b>. To train a new model, click on the <i>magic wand</i>.","ai-engine"),MODEL_FINETUNE:Ue("Model Finetune","ai-engine"),MODELS_FILES:Ue("Models & Files","ai-engine"),DATASET_EDITOR:Ue("Dataset Editor","ai-engine"),EDITOR:Ue("Editor","ai-engine"),GENERATOR:Ue("Generator","ai-engine"),HUGE_DATASET_WARNING:Ue("Caution: The data is too large to be saved in your browser's local storage.","ai-engine"),NO_FINETUNES_YET:Ue("No fine-tunes found. Refresh the list, or create a new one (via a dataset).","ai-engine"),CLEAN_MODELS_LIST:Ue("Clean Models List","ai-engine"),DELETED_FINETUNE_ISSUE:Ue("For some reason, OpenAI still return the models even after you deleted them. Don't worry, AI Engine will do the cleanup for you! You can force the cleanup by using this button. It takes a bit of time depending on the total of models you have.","ai-engine")},Be.EMBEDDINGS={EDIT:Ue("EDIT","ai-engine"),AI_SEARCH:Ue("AI SEARCH","ai-engine"),SYNC_POSTS:Ue("Sync Posts","ai-engine"),AUTO_SYNC_POSTS:Ue("Auto-Sync Posts","ai-engine"),AUTO_SYNC_POSTS_DESCRIPTION:Ue("Embeddings will be created, updated or removed based on the activity related to your posts.","ai-engine"),REWRITE_CONTENT:Ue("Rewrite Content","ai-engine"),REWRITE_CONTENT_DESCRIPTION:Ue("Shorten and improve the content for your embedding using the default model.","ai-engine"),FORCE_RECREATE:Ue("Force Recreate","ai-engine"),FORCE_RECREATE_DESCRIPTION:Ue("Recreate embeddings on sync even if the content has not changed.","ai-engine"),REWRITE_PROMPT_DESCRIPTION:Ue("Prompt for the rewrite. Supports {CONTENT}, {TITLE}, {URL}, {EXCERPT}, {LANGUAGE}, {ID}.","ai-engine"),SYNC_ALL:Ue("Sync All","ai-engine"),SYNC_ONE:Ue("Sync One","ai-engine"),ADD_INDEX:Ue("Add Index","ai-engine"),ADD_INDEX_DESCRIPTION:Ue("An index is like a database, and contains embeddings. You can have many indexes and switch between them. The indexes are hosted on Pinecone.","ai-engine"),NO_NAMESPACE_SUPPORT:Ue("Note: This server does not support namespaces.","ai-engine")},Be.ERROR={UPDATING_OPTIONS:Ue("An error occured while updating the options."),GETTING_OPTIONS:Ue("An error occured while getting the options."),CHECK_YOUR_CONSOLE:Ue('For more information, check <a target="_blank" href="https://meowapps.com/tutorial-network-activity-dev-tools/">your console</a>. You might also want to check your <a target="_blank" href="https://meowapps.com/tutorial-php-error-logs/">PHP Error Logs</a>.',"ai-engine")};const He=Be;var Ye=["size","disabled","style"],ze=["size","disabled","style"],We=["size","disabled","style"],Ve=["size","disabled","style"];function Ke(){return Ke=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},Ke.apply(this,arguments)}function qe(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Xe(){Xe=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Je(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Je(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 $e(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Qe(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){$e(o,r,a,i,l,"next",e)}function l(e){$e(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Je(e){return Je="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},Je(e)}function Ze(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 et(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ze(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=Je(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Je(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==Je(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ze(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function tt(e){return function(e){if(Array.isArray(e))return at(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||rt(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 nt(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||rt(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 rt(e,t){if(e){if("string"==typeof e)return at(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)?at(e,t):void 0}}function at(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 ot=wp.element,it=ot.useMemo,lt=ot.useState,ct=ot.useEffect,ut={title:"",content:"",refId:null,type:"manual",behavior:"context"},st=function(e){var t=e.options,n=t.ai_envs.find((function(e){return e.apikey&&e.apikey.length>0})),r=!(null!=t&&t.module_embeddings)||(null==t?void 0:t.embeddings_envs)&&(null==t?void 0:t.embeddings_envs.length)>0;return React.createElement(React.Fragment,null,!n&&React.createElement(Ne.X,{variant:"danger",style:{marginTop:0,marginBottom:25}},(0,O.FE)(He.SETTINGS.AI_ENV_SETUP)),!r&&React.createElement(Ne.X,{variant:"danger",style:{marginTop:0,marginBottom:25}},(0,O.FE)(He.SETTINGS.PINECONE_SETUP)))},ft=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=nt(lt(null==e?void 0:e.ai_default_model),2),o=a[0],i=a[1],l=t||(null==e?void 0:e.ai_default_env),c=null!==(n=null==e?void 0:e.ai_envs)&&void 0!==n?n:[],u=it((function(){if(r&&null!=e&&e.ai_envs){var t={fake:!0,finetunes:[],legacy_finetunes:[],legacy_finetunes_deleted:[],finetunes_deleted:[],deployments:[]};return c.forEach((function(e){var n,r,a,o,i;e.finetunes&&(n=t.finetunes).push.apply(n,tt(e.finetunes)),e.legacy_finetunes&&(r=t.legacy_finetunes).push.apply(r,tt(e.legacy_finetunes)),e.legacy_finetunes_deleted&&(a=t.legacy_finetunes_deleted).push.apply(a,tt(e.legacy_finetunes_deleted)),e.finetunes_deleted&&(o=t.finetunes_deleted).push.apply(o,tt(e.finetunes_deleted)),e.deployments&&(i=t.deployments).push.apply(i,tt(e.deployments))})),t}return null}),[c,r]),s=it((function(){var t;return r?u:l?(null==e||null===(t=e.ai_envs)||void 0===t?void 0:t.find((function(e){return e.id===l})))||(console.warn("useModels: Environment with ID ".concat(l," could not be resolved."),{envs:c,envId:l}),null):(console.warn("useModels: Environment ID is null. Please provide a valid envId."),null)}),[c,l,r,u]),f=it((function(){var e=(null==s?void 0:s.finetunes_deleted)||[];return Array.isArray(null==s?void 0:s.legacy_finetunes_deleted)&&(e=[].concat(tt(e),tt(s.legacy_finetunes_deleted))),e}),[s]),m=function(e){return{background:{deprecated:"var(--neko-red)",tuned:"var(--neko-green)",preview:"var(--neko-orange)"}[e],color:"white",padding:"3px 4px",margin:"1px 0px 0px 3px",borderRadius:4,fontSize:9,lineHeight:"100%"}},d={deprecated:"DEPRECATED",tuned:"TUNED",preview:"PREVIEW"},p=function(e,t){var n,r,a,o=(null===(n=e.tags)||void 0===n?void 0:n.find((function(e){return["deprecated","preview"].includes(e)})))||(t?"tuned":"");return React.createElement(React.Fragment,null,null!==(r=null!==(a=e.name)&&void 0!==a?a:e.suffix)&&void 0!==r?r:e.model,o&&React.createElement("small",{style:m(o)},d[o]))},h=it((function(){var t,n=[];if(!0===(null==s?void 0:s.fake)){var r,a=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=rt(e))){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}(e.ai_engines);try{for(a.s();!(r=a.n()).done;){var o=r.value;Array.isArray(o.models)&&(n=[].concat(tt(n),tt(o.models)))}}catch(e){a.e(e)}finally{a.f()}}else if("azure"===(null==s?void 0:s.type)){var i,l,c=e.ai_engines.find((function(e){return"openai"===e.type})),u=null!==(i=null==c?void 0:c.models)&&void 0!==i?i:[];n=null!==(l=null==u?void 0:u.filter((function(e){var t;return null===(t=s.deployments)||void 0===t?void 0:t.find((function(t){return t.model===e.model}))})))&&void 0!==l?l:[]}else if("huggingface"===(null==s?void 0:s.type)){var f,m;n=null!==(f=null==s||null===(m=s.customModels)||void 0===m?void 0:m.map((function(e){var t=e.tags?tt(new Set([].concat(tt(e.tags),["core","chat"]))):["core","chat"],n=t.includes("image")?"text-to-image":"completion";return{model:e.name,name:e.name,features:n,tags:t,options:[]}})))&&void 0!==f?f:[]}else{var d,h=e.ai_engines.find((function(e){return e.type===(null==s?void 0:s.type)}));n=null!==(d=null==h?void 0:h.models)&&void 0!==d?d:[]}var y=null!==(t=null==s?void 0:s.finetunes)&&void 0!==t?t:[];return Array.isArray(null==s?void 0:s.legacy_finetunes)&&(y=[].concat(tt(y),tt(s.legacy_finetunes))),y=y.filter((function(e){return"succeeded"===e.status&&e.model})),n=n.map((function(e){return et(et({},e),{},{name:p(e),rawName:e.name})})),y.length&&(n=[].concat(tt(n),tt(y.map((function(e){var t=e.model.split(":")[0];return{model:e.model,name:p(e,!0),rawName:e.suffix,suffix:e.suffix,features:["completion"],family:t,description:"finetuned",finetuned:!0,tags:["chat","finetune"]}}))))),n}),[e,s]),y=it((function(){return h.filter((function(e){return!f.includes(e.model)}))}),[h,f]),v=it((function(){return h.filter((function(e){var t;return null==e||null===(t=e.tags)||void 0===t?void 0:t.includes("core")}))}),[h]),g=it((function(){return y.filter((function(e){var t;return null==e||null===(t=e.tags)||void 0===t?void 0:t.includes("image")}))}),[y]),E=it((function(){return y.filter((function(e){var t;return null==e||null===(t=e.tags)||void 0===t?void 0:t.includes("embedding")}))}),[y]),b=it((function(){return y.filter((function(e){var t;return null==e||null===(t=e.tags)||void 0===t?void 0:t.includes("vision")}))}),[y]),w=it((function(){return y.filter((function(e){var t;return null==e||null===(t=e.tags)||void 0===t?void 0:t.includes("chat")}))}),[y]),R=it((function(){return y.filter((function(e){var t;return null==e||null===(t=e.tags)||void 0===t?void 0:t.includes("audio")}))}),[y]),O=it((function(){return y.filter((function(e){var t;return null==e||null===(t=e.tags)||void 0===t?void 0:t.includes("json")}))}),[y]),_=function(t){if(!t)return null;t.startsWith("gpt-3.5-turbo-")||t.startsWith("gpt-35-turbo")?t="gpt-3.5-turbo":t.startsWith("gpt-4o-mini")?t="gpt-4o-mini":t.startsWith("gpt-4o")?t="gpt-4o":t.startsWith("gpt-4")&&(t="gpt-4");var n=h.find((function(e){return e.model===t}));return n||console.warn("Model ".concat(t," not found."),{allModels:h,options:e}),n},x=function(e){var t=_(e);return v.find((function(e){return(null==e?void 0:e.family)===(null==t?void 0:t.family)}))||null},S=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"1024x1024",n=x(e);if("image"===(null==n?void 0:n.type)&&null!=n&&n.resolutions){var r=n.resolutions.find((function(e){return e.name===t}));return(null==r?void 0:r.price)||null}return(null==n?void 0:n.price)||null};return{allModels:h,model:o,models:y,completionModels:w,imageModels:g,visionModels:b,coreModels:v,embeddingsModels:E,audioModels:R,jsonModels:O,setModel:i,isFineTunedModel:function(e){var t=_(e);return(null==t?void 0:t.finetuned)||!1},getModelName:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=_(e);return n?t&&n?n.rawName:(null==n?void 0:n.name)||(null==n?void 0:n.model)||e:e},getFamilyName:function(e){var t=_(e);return(null==t?void 0:t.family)||null},getPrice:S,getModel:_,calculatePrice:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"1024x1024",a=x(e),o=S(e,r),i=o,l=o;return"object"===Je(o)&&null!==o&&(i=o.in,l=o.out),i&&l?i*t*a.unit+l*n*a.unit:0}}},mt=function(){var e=Qe(Xe().mark((function e(t){var n;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/vectors/remote_list"),{nonce:k,method:"POST",json:t});case 2:return n=e.sent,e.abrupt("return",n?{total:n.total,vectors:n.vectors}:{total:0,vectors:[]});case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),dt=function(){var e=Qe(Xe().mark((function e(t,n){var r;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/vectors/add_from_remote"),{nonce:k,method:"POST",json:t,signal:n});case 2:return r=e.sent,e.abrupt("return",r);case 4:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),pt=function(){var e=Qe(Xe().mark((function e(t){var n;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.offset=(t.page-1)*t.limit,e.next=3,(0,O.IU)("".concat(T,"/discussions/list"),{nonce:k,method:"POST",json:t});case 3:return n=e.sent,e.abrupt("return",n?{total:n.total,chats:n.chats}:{total:0,chats:[]});case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ht=function(){var e=Qe(Xe().mark((function e(t){var n,r,a,o,i,l;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=null!==(null==t||null===(n=t.filters)||void 0===n?void 0:n.search),""!==(null==t||null===(r=t.filters)||void 0===r?void 0:r.search)){e.next=3;break}return e.abrupt("return",[]);case 3:if(t.filters.envId){e.next=5;break}return e.abrupt("return",{total:0,vectors:[]});case 5:return e.next=7,(0,O.IU)("".concat(T,"/vectors/list"),{nonce:k,method:"POST",json:t});case 7:return i=e.sent,o&&null!=i&&null!==(a=i.vectors)&&void 0!==a&&a.length&&(l=i.vectors.sort((function(e,n){var r;return"asc"===(null==t||null===(r=t.sort)||void 0===r?void 0:r.by)?e.score-n.score:n.score-e.score})),i.vectors=l),e.abrupt("return",i?{total:i.total,vectors:i.vectors}:{total:0,vectors:[]});case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),yt=function(){var e=Qe(Xe().mark((function e(t){var n,r,a=arguments;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:"publish",e.next=3,(0,O.IU)("".concat(T,"/helpers/count_posts?postType=").concat(t,"&postStatus=").concat(n),{nonce:k});case 3:return r=e.sent,e.abrupt("return",null!=r&&r.count?parseInt(null==r?void 0:r.count):null);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),vt=function(){var e=Qe(Xe().mark((function e(t){var n,r,a=arguments;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:"publish",e.next=3,(0,O.IU)("".concat(T,"/helpers/posts_ids?postType=").concat(t,"&postStatus=").concat(n),{nonce:k});case 3:return r=e.sent,e.abrupt("return",null!=r&&r.postIds?r.postIds:[]);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),gt=function(){var e=Qe(Xe().mark((function e(t){var n,r,a,o,i=arguments;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.length>1&&void 0!==i[1]?i[1]:0,r=i.length>2&&void 0!==i[2]?i[2]:0,a=i.length>3&&void 0!==i[3]?i[3]:"publish",e.next=5,(0,O.IU)("".concat(T,"/helpers/post_content?postType=").concat(t,"&postStatus=").concat(a,"&offset=").concat(n,"&postId=").concat(r),{nonce:k});case 5:return o=e.sent,e.abrupt("return",o);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Et=function(){var e=Qe(Xe().mark((function e(t){var n,r,a,o,i,l=arguments;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.vectorId,r=t.postId,a=t.envId,o=l.length>1&&void 0!==l[1]?l[1]:null,e.next=4,(0,O.IU)("".concat(T,"/vectors/sync"),{nonce:k,method:"POST",json:{vectorId:n,postId:r,envId:a},signal:o});case 4:return i=e.sent,e.abrupt("return",i);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function bt(e){var t=new Date(e),n=(t=new Date(t.getTime()-60*t.getTimezoneOffset()*1e3)).toLocaleDateString("ja-JP",{year:"numeric",month:"2-digit",day:"2-digit"}),r=t.toLocaleTimeString("ja-JP",{hour:"2-digit",minute:"2-digit",second:"2-digit"});return React.createElement(React.Fragment,null,n,React.createElement("br",null),React.createElement("small",null,r))}function wt(e,t){var n,r=t?(n=t.substring(0,12)).length<t.length?(n.endsWith(".")&&(n=n.slice(0,-1)),n+"~"):n:"";return React.createElement(React.Fragment,null,!e&&React.createElement(React.Fragment,null,He.COMMON.GUEST),e&&React.createElement(React.Fragment,null,React.createElement("a",{target:"_blank",href:"/wp-admin/user-edit.php?user_id=".concat(e),rel:"noreferrer"},He.COMMON.USER," #",e)),React.createElement("br",null),React.createElement("small",null,r))}var Rt=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6,t="",n=0;n<e;n++)t+="abcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(36*Math.random())];return t},Ot=function(e){var t=e.size,n=void 0===t?14:t,r=e.disabled,a=void 0!==r&&r,o=e.style,i=qe(e,Ye),l=et(et({},{position:"relative",top:2,borderRadius:2,filter:a?"grayscale(100%)":"none"}),o);return React.createElement("img",Ke({width:n,height:n},i,{style:l,alt:"OpenAI",src:N+"/images/chat-openai.svg"}))},_t=function(e){var t=e.size,n=void 0===t?14:t,r=e.disabled,a=void 0!==r&&r,o=e.style,i=qe(e,ze),l=et(et({},{position:"relative",top:2,borderRadius:2,filter:a?"grayscale(100%)":"none"}),o);return React.createElement("img",Ke({width:n,height:n},i,{style:l,alt:"Anthropic",src:N+"/images/chat-anthropic.svg"}))},xt=function(e){var t=e.size,n=void 0===t?14:t,r=e.disabled,a=void 0!==r&&r,o=e.style,i=qe(e,We),l=et(et({},{position:"relative",top:2,borderRadius:2,filter:a?"grayscale(100%)":"none"}),o);return React.createElement("img",Ke({width:n,height:n},i,{style:l,alt:"JavaScript",src:N+"/images/code-js.svg"}))},St=function(e){var t=e.size,n=void 0===t?14:t,r=e.disabled,a=void 0!==r&&r,o=e.style,i=qe(e,Ve),l=et(et({},{position:"relative",top:2,borderRadius:2,filter:a?"grayscale(100%)":"none"}),o);return React.createElement("img",Ke({width:n,height:n},i,{style:l,alt:"PHP",src:N+"/images/code-php.svg"}))},Tt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=wp.data.select("core/block-editor"),n=t.getBlocks,r=t.getSelectedBlockClientId,a=wp.data.select("core/editor").getEditedPostAttribute,o=n(),i=a("title"),l=r(),c=i+"\n\n";return o.forEach((function(t,n){e&&t.clientId===l?c+=e+"\n\n":c+=(t.attributes.content||"")+"\n\n"})),c.trim()};function Nt(e){return Nt="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},Nt(e)}function Ct(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 It(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ct(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=Nt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Nt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==Nt(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ct(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var At=wp.element,kt=(At.useState,At.useEffect,At.useMemo),Lt=React.createElement("g",null,React.createElement("g",null,React.createElement("path",{d:"m391 81h30v-66c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15z",fill:"#39326c"}),React.createElement("path",{d:"m331 81h30v-66c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15z",fill:"#39326c"}),React.createElement("path",{d:"m271 81h30v-66c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15z",fill:"#39326c"}),React.createElement("path",{d:"m211 81h30v-66c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15z",fill:"#5f55af"}),React.createElement("path",{d:"m151 81h30v-66c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15z",fill:"#5f55af"}),React.createElement("path",{d:"m91 81h30v-66c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15z",fill:"#5f55af"}),React.createElement("path",{d:"m406 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15z",fill:"#39326c"}),React.createElement("path",{d:"m346 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15z",fill:"#39326c"}),React.createElement("path",{d:"m286 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15z",fill:"#39326c"}),React.createElement("g",{fill:"#5f55af"},React.createElement("path",{d:"m226 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m166 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m106 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m15 121h66v-30h-66c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m15 181h66v-30h-66c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m15 241h66v-30h-66c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m15 301h66v-30h-66c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m15 361h66v-30h-66c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m15 421h66v-30h-66c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15z"})),React.createElement("path",{d:"m431 91v30h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15z",fill:"#39326c"}),React.createElement("path",{d:"m431 181h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15h-66z",fill:"#39326c"}),React.createElement("path",{d:"m431 241h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15h-66z",fill:"#39326c"}),React.createElement("path",{d:"m431 301h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15h-66z",fill:"#39326c"}),React.createElement("path",{d:"m431 361h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15h-66z",fill:"#39326c"}),React.createElement("path",{d:"m431 421h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15h-66z",fill:"#39326c"})),React.createElement("g",null,React.createElement("path",{d:"m446 51h-380c-8.284 0-15 6.716-15 15v380c0 8.284 6.716 15 15 15h380c8.284 0 15-6.716 15-15v-380c0-8.284-6.716-15-15-15z",fill:"#aed0ff"}),React.createElement("g",null,React.createElement("path",{d:"m461 446v-380c0-8.284-6.716-15-15-15h-190v410h190c8.284 0 15-6.716 15-15z",fill:"#7c84e8"})),React.createElement("path",{d:"m386 111h-260c-8.284 0-15 6.716-15 15v260c0 8.284 6.716 15 15 15h260c8.284 0 15-6.716 15-15v-260c0-8.284-6.716-15-15-15z",fill:"#5f55af"}),React.createElement("g",null,React.createElement("path",{d:"m401 386v-260c0-8.284-6.716-15-15-15h-130v290h130c8.284 0 15-6.716 15-15z",fill:"#39326c"}))),React.createElement("g",null,React.createElement("path",{d:"m247.626 192.389c-.052-.138-.106-.274-.162-.411-2.744-6.671-9.175-10.978-16.387-10.978-.006 0-.012 0-.018 0-7.219.007-13.65 4.329-16.383 11.01-.046.113-.091.227-.134.341l-45.06 118.31c-2.949 7.742.937 16.408 8.679 19.356 7.742 2.95 16.408-.937 19.356-8.679l7.543-19.804h51.691l7.458 19.762c2.267 6.007 7.974 9.708 14.036 9.708 1.76 0 3.55-.312 5.294-.97 7.75-2.925 11.663-11.579 8.737-19.33zm-31.14 79.146 14.538-38.171 14.406 38.171z",fill:"#f9f9f9"}),React.createElement("g",{fill:"#e2dff4"},React.createElement("path",{d:"m264.209 321.296c2.267 6.007 7.974 9.708 14.036 9.708 1.76 0 3.55-.312 5.294-.97 7.75-2.925 11.663-11.579 8.737-19.33l-36.276-96.126v86.956h.751z"}),React.createElement("path",{d:"m328.5 181c-8.284 0-15 6.716-15 15v120c0 8.284 6.716 15 15 15s15-6.716 15-15v-120c0-8.284-6.716-15-15-15z"})))),Mt=React.createElement("g",null,React.createElement("path",{d:"m213.46 341.461-139.26 156.08c-16.17 18.48-44.53 19.33-61.8 2.06-17.32-17.32-16.37-45.67 2.06-61.8l156.08-139.26s13.46-2.54 29.46 13.46 13.46 29.46 13.46 29.46z",fill:"#0052be"}),React.createElement("path",{d:"m213.46 341.461-139.26 156.08c-16.17 18.48-44.53 19.33-61.8 2.06l187.6-187.6c16 16 13.46 29.46 13.46 29.46z",fill:"#00429b"}),React.createElement("path",{d:"m304 240.001-90.54 101.46c-14.997-14.997-27.922-27.922-42.92-42.92l101.46-90.54z",fill:"#00429b"}),React.createElement("path",{d:"m304 240.001-90.54 101.46-21.46-21.46 96-96z",fill:"#00337a"}),React.createElement("path",{d:"m400 279.001h-64.4l-42.47 57.87c-7.88 10.735-24.824 6.606-26.91-6.52l-11.56-73.01-73.01-11.56c-13.139-2.087-17.244-19.042-6.52-26.91l57.87-42.47v-64.4c0-12.176 13.797-19.289 23.72-12.21l50.15 35.83 70.92-19.9c11.25-3.168 21.656 7.245 18.49 18.49l-19.9 70.92 35.83 50.15c7.071 9.913-.02 23.72-12.21 23.72z",fill:"#ffdd54"}),React.createElement("path",{d:"m412.21 255.281c7.071 9.913-.02 23.72-12.21 23.72h-64.4l-42.47 57.87c-7.875 10.728-24.823 6.616-26.91-6.52l-11.56-73.01 137.79-137.79c3.83 3.84 5.3 9.44 3.83 14.66l-19.9 70.92z",fill:"#ffb454"}),React.createElement("path",{d:"m512 39.001c0 8.28-6.72 15-15 15h-9v9c0 8.28-6.72 15-15 15s-15-6.72-15-15v-9h-9c-8.28 0-15-6.72-15-15s6.72-15 15-15h9v-9c0-8.28 6.72-15 15-15s15 6.72 15 15v9h9c8.28 0 15 6.719 15 15z",fill:"#bee75e"}),React.createElement("path",{d:"m512 39.001c0 8.28-6.72 15-15 15h-9v9c0 8.28-6.72 15-15 15s-15-6.72-15-15v-9l30-30h9c8.28 0 15 6.719 15 15z",fill:"#00cb75"}),React.createElement("path",{d:"m336 41.001h-9v-9c0-8.284-6.716-15-15-15s-15 6.716-15 15v9h-9c-8.284 0-15 6.716-15 15s6.716 15 15 15h9v9c0 8.284 6.716 15 15 15s15-6.716 15-15v-9h9c8.284 0 15-6.716 15-15s-6.716-15-15-15z",fill:"#f6f9f9"}),React.createElement("path",{d:"m441 224.001c0 8.284 6.716 15 15 15s15-6.716 15-15v-9h9c8.284 0 15-6.716 15-15s-6.716-15-15-15h-9v-9c0-8.284-6.716-15-15-15s-15 6.716-15 15v9h-9c-8.284 0-15 6.716-15 15s6.716 15 15 15h9z",fill:"#e2dff4"}),React.createElement("path",{d:"m497 329.001h-9v-9c0-8.284-6.716-15-15-15s-15 6.716-15 15v9h-9c-8.284 0-15 6.716-15 15s6.716 15 15 15h9v9c0 8.284 6.716 15 15 15s15-6.716 15-15v-9h9c8.284 0 15-6.716 15-15s-6.716-15-15-15z",fill:"#ff4a4a"}),React.createElement("path",{d:"m192 24.001h-9v-9c0-8.284-6.716-15-15-15s-15 6.716-15 15v9h-9c-8.284 0-15 6.716-15 15s6.716 15 15 15h9v9c0 8.284 6.716 15 15 15s15-6.716 15-15v-9h9c8.284 0 15-6.716 15-15s-6.716-15-15-15z",fill:"#ff8659"}),React.createElement("path",{d:"m159.442 122.977-56-32c-7.191-4.109-16.355-1.611-20.466 5.581-4.11 7.193-1.611 16.355 5.581 20.466l56 32c7.16 4.093 16.337 1.644 20.466-5.581 4.111-7.193 1.612-16.355-5.581-20.466z",fill:"#f6f9f9"}),React.createElement("path",{d:"m118.14 169.117-64 8c-8.221 1.027-14.052 8.524-13.023 16.744 1.027 8.218 8.523 14.054 16.744 13.023l64-8c8.221-1.027 14.052-8.524 13.023-16.744-1.028-8.22-8.527-14.062-16.744-13.023z",fill:"#acceff"}),React.createElement("path",{d:"m389.023 352.558c-4.111-7.193-13.274-9.693-20.466-5.581-7.192 4.11-9.691 13.272-5.581 20.466l32 56c2.769 4.845 7.83 7.561 13.037 7.561 11.319 0 18.784-12.341 13.01-22.445z",fill:"#e2dff4"}),React.createElement("path",{d:"m329.86 377.117c-8.222-1.031-15.717 4.804-16.744 13.023l-8 64c-1.117 8.925 5.834 16.862 14.902 16.862 7.455 0 13.917-5.553 14.865-13.142l8-64c1.029-8.219-4.802-15.716-13.023-16.743z",fill:"#6ba7ff"}));const Pt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.icon,n=void 0===t?"ai":t,r=e.size,a=void 0===r?20:r,o=e.style,i=void 0===o?{}:o,l=kt((function(){switch(n){case"ai":default:return Lt;case"wand":return Mt}}),[n]);return React.createElement("svg",{style:It({width:a,height:a,marginRight:5},i),"enable-background":"new 0 0 512 512",height:"512",viewBox:"0 0 512 512",width:"512",xmlns:"http://www.w3.org/2000/svg"},l)};var jt,Ft,Dt;function Gt(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Ut=function(e){var t=e.title,n=void 0===t?He.COMMON.SETTINGS:t,r=e.options,a=void 0===r?L:r,o=null==a?void 0:a.module_playground,i=null==a?void 0:a.module_generator_content,l=null==a?void 0:a.module_generator_images;return React.createElement(g.n,{title:"AI Engine | ".concat(n),subtitle:"🐱 Made by NyaoGPT"},React.createElement("div",{style:{display:"flex",justifyContent:"flex-end"}},i&&React.createElement(w.M,{className:"header",onClick:function(){return location.href="edit.php?page=mwai_content_generator"}},React.createElement(Pt,{icon:"wand",style:{marginRight:8}}),He.COMMON.CONTENT),l&&React.createElement(w.M,{className:"header",icon:"",onClick:function(){return location.href="edit.php?page=mwai_images_generator"}},React.createElement(Pt,{icon:"wand",style:{marginRight:8}}),He.COMMON.IMAGES),o&&React.createElement(w.M,{className:"header",icon:"",onClick:function(){return location.href="tools.php?page=mwai_dashboard"}},React.createElement(Pt,{icon:"wand",style:{marginRight:8}}),He.COMMON.PLAYGROUND),React.createElement(w.M,{className:"header",icon:"tools",onClick:function(){return location.href="admin.php?page=mwai_settings"}})))},Bt=((0,G.Ay)(w.M)(jt||(jt=Gt(["\n"]))),G.Ay.div(Ft||(Ft=Gt(["\n  display: flex;\n  justify-content: unset;\n  align-items: center;\n  justify-content: space-between;\n  padding: 0 0 2px 0;\n\n  h2 {\n    margin: 7px 0 0 0;\n    padding: 0;\n  }\n"])))),Ht=G.Ay.div(Dt||(Dt=Gt(["\n  display: grid;\n  grid-template-columns: repeat(auto-fit, minmax(30%, 1fr));\n  grid-template-rows: repeat(auto-fit, minmax(30%, 1fr));\n  grid-gap: 10px;\n  margin-top: 20px;\n\n  img, div {\n    width: 100%;\n    cursor: pointer;\n  }\n  .empty-image {\n    width: 100%;\n    padding-bottom: 100%;\n    background-color: #f5f5f5;\n  }\n"]))),Yt=n(4809),zt=n.n(Yt),Wt=n(3896),Vt=n(1843),Kt=n(5900),qt=n(7494),Xt=n(8482),$t=n(209),Qt=n(520),Jt=n(851),Zt=n(6897);function en(e){return en="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},en(e)}function tn(){tn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==en(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(en(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 nn(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function rn(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){nn(o,r,a,i,l,"next",e)}function l(e){nn(o,r,a,i,l,"throw",e)}i(void 0)}))}}var an=function(){var e=rn(tn().mark((function e(){var t;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/helpers/post_types"),{nonce:k});case 2:if((t=e.sent).success){e.next=5;break}throw new Error(t.message);case 5:return e.abrupt("return",t.postTypes);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),on=function(){var e=rn(tn().mark((function e(t){var n;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/helpers/count_posts?postType=").concat(t),{nonce:k});case 2:return n=e.sent,e.abrupt("return",null!=n&&n.count?parseInt(null==n?void 0:n.count):null);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ln=function(){var e=rn(tn().mark((function e(t){var n,r,a,o=arguments;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>1&&void 0!==o[1]?o[1]:0,r=o.length>2&&void 0!==o[2]?o[2]:0,e.next=4,(0,O.IU)("".concat(T,"/helpers/post_content?postType=").concat(t,"&offset=").concat(n,"&postId=").concat(r),{nonce:k});case 4:return a=e.sent,e.abrupt("return",a);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),cn=function(){var e=rn(tn().mark((function e(t){var n;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(S,"/mwai-ui/v1/files/delete"),{nonce:k,method:"POST",json:{files:t}});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(n.message);case 5:return e.abrupt("return",n);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),un=function(){var e=rn(tn().mark((function e(){var t,n,r,a,o,i=arguments;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.length>0&&void 0!==i[0]?i[0]:null,r=i.length>1&&void 0!==i[1]?i[1]:null,a="".concat(T,"/openai/files/list?envId=").concat(n),r&&(a+="&purpose=".concat(r)),e.next=6,(0,O.IU)(a,{nonce:k});case 6:if((o=e.sent).success){e.next=9;break}throw new Error(o.message);case 9:return e.abrupt("return",null==o||null===(t=o.files)||void 0===t?void 0:t.data);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),sn=function(){var e=rn(tn().mark((function e(t){var n,r,a,o,i,l,c,u,s,f,m,d,p;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.userId,r=void 0===n?null:n,a=t.purpose,o=void 0===a?null:a,i=t.metadata,l=void 0===i?null:i,c=t.envId,u=void 0===c?null:c,s=t.limit,f=void 0===s?10:s,m=t.page,d=void 0===m?0:m,e.next=3,(0,O.IU)("".concat(S,"/mwai-ui/v1/files/list"),{nonce:k,method:"POST",json:{userId:r,purpose:o,metadata:l,envId:u,limit:f,page:d}});case 3:if((p=e.sent).success){e.next=6;break}throw new Error(p.message);case 6:return e.abrupt("return",null==p?void 0:p.data);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),fn=function(){var e=rn(tn().mark((function e(){var t,n,r,a=arguments;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.length>0&&void 0!==a[0]?a[0]:null,n=a.length>1&&void 0!==a[1]&&a[1],e.next=4,(0,O.IU)("".concat(T,"/openai/finetunes/list_deleted?envId=").concat(t,"&legacy=").concat(n),{nonce:k});case 4:if((r=e.sent).success){e.next=7;break}throw new Error(r.message);case 7:return e.abrupt("return",null==r?void 0:r.finetunes);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),mn=function(){var e=rn(tn().mark((function e(){var t;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/settings/themes"),{method:"GET",nonce:k});case 2:return t=e.sent,e.abrupt("return",null==t?void 0:t.themes);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),dn=function(){var e=rn(tn().mark((function e(t){var n,r,a,o,i;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(n=[],r=0;r<t.length;r++){if(a=t[r].themeId,n.includes(a)){for(o=1;n.includes(a+"-"+o);)o++;a=a+"-"+o}n.push(a),t[r].themeId=a}return e.next=4,(0,O.IU)("".concat(T,"/settings/themes"),{method:"POST",nonce:k,json:{themes:t}});case 4:return i=e.sent,e.abrupt("return",null==i?void 0:i.themes);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),pn=function(){var e=rn(tn().mark((function e(){var t,n,r,a=arguments;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.length>0&&void 0!==a[0]?a[0]:null,n=a.length>1&&void 0!==a[1]&&a[1],e.next=4,(0,O.IU)("".concat(T,"/openai/finetunes/list?envId=").concat(t,"&legacy=").concat(n),{nonce:k});case 4:if((r=e.sent).success){e.next=7;break}throw new Error(r.message);case 7:return e.abrupt("return",null==r?void 0:r.finetunes);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),hn=function(){var e=rn(tn().mark((function e(){var t;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/settings/chatbots"),{method:"GET",nonce:k});case 2:if((t=e.sent).success){e.next=5;break}throw new Error(null==t?void 0:t.message);case 5:return e.abrupt("return",null==t?void 0:t.chatbots);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),yn=function(){var e=rn(tn().mark((function e(t){var n;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/settings/chatbots"),{method:"POST",nonce:k,json:{chatbots:t}});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",null==n?void 0:n.chatbots);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),vn=function(){var e=rn(tn().mark((function e(t){var n;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/openai/assistants/list?envId=").concat(t),{nonce:k});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(n.message);case 5:return e.abrupt("return",null==n?void 0:n.assistants);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),gn=function(){var e=rn(tn().mark((function e(t,n,r){var a;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/openai/assistants/set_functions"),{method:"POST",nonce:k,json:{envId:t,assistantId:n,functions:r}});case 2:if((a=e.sent).success){e.next=5;break}throw new Error(a.message);case 5:return e.abrupt("return",a);case 6:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),En=function(){var e=rn(tn().mark((function e(){var t;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/settings/options"),{method:"GET",nonce:k});case 2:return t=e.sent,e.abrupt("return",null==t?void 0:t.options);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),bn=function(){var e=rn(tn().mark((function e(){var t;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,O.IU)("".concat(T,"/get_logs"),{nonce:k,method:"GET"});case 3:return t=e.sent,e.abrupt("return",t.data);case 7:throw e.prev=7,e.t0=e.catch(0),new Error(e.t0.message);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}(),wn=function(){var e=rn(tn().mark((function e(){return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,O.IU)("".concat(T,"/clear_logs"),{nonce:k});case 3:e.next=8;break;case 5:throw e.prev=5,e.t0=e.catch(0),new Error(e.t0.message);case 8:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(){return e.apply(this,arguments)}}();function Rn(e){return Rn="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},Rn(e)}function On(){On=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Rn(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Rn(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 _n(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function xn(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){_n(o,r,a,i,l,"next",e)}function l(e){_n(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Sn(e){return function(e){if(Array.isArray(e))return Cn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Nn(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 Tn(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||Nn(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 Nn(e,t){if(e){if("string"==typeof e)return Cn(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)?Cn(e,t):void 0}}function Cn(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 In=wp.element.useState;const An=function(e){var t=e.instructions,n=e.setMessages,r=Tn(In("post"),2),a=r[0],o=r[1],i=Tn(In(0),2),l=i[0],c=i[1],u=Tn(In(!1),2),s=u[0],m=u[1],d=Tn(In("Generate 30 questions and answers from this text. Questions use a neutral tone. Answers use the same tone as the text."),2),p=d[0],h=d[1],y=(0,f.I)({queryKey:["postTypes"],queryFn:an}),v=y.isLoading,g=y.data,E=(0,f.I)({queryKey:["postsCount-"+a],queryFn:function(){return on(a)}}),b=E.isLoading,R=E.data,_=(0,Zt.XS)({i18n:He,onStop:function(){m(),_.reset()}}),x=s||_.busy||b||v,S=function(e){if(!e)return[];for(var n=e.split("\n").filter((function(e){return""!==e.trim()})),r=[],a=[],o=0;o<n.length;o++)n[o].startsWith("Q:")?(a.length&&(r.push({messages:Sn(a)}),a=[]),a.push({role:"system",content:t}),a.push({role:"user",content:n[o].slice(2).trim()})):n[o].startsWith("A:")&&(a.push({role:"assistant",content:n[o].slice(2).trim()}),r.push({messages:Sn(a)}),a=[]);return a.length&&r.push({messages:a}),r},N=function(){var e=xn(On().mark((function e(){var t,n,r,o,i,l,u,s,f,m,d,h,y,v,g,E,b,w=arguments;return On().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=w.length>0&&void 0!==w[0]?w[0]:0,n=w.length>1&&void 0!==w[1]?w[1]:void 0,r=w.length>2&&void 0!==w[2]?w[2]:void 0,o=p+"\n\nUse this format:\n\nQ: Question?\nA: Answer.\n\nQ: Question?\nA: Answer.\nText:\n\n{CONTENT}",e.next=6,ln(a,t,n||void 0);case 6:if(i=e.sent,l=null,u=null,s=null==i?void 0:i.content,f=null==i?void 0:i.url,m=null==i?void 0:i.title,d=0,i.success){e.next=18;break}alert(i.message),l=i.message,e.next=35;break;case 18:if(!(s.length<64)){e.next=22;break}console.log("Issue: Content is too short! Skipped.",{content:s}),e.next=35;break;case 22:return o=(o=(o=o.replace("{CONTENT}",s)).replace("{URL}",f)).replace("{TITLE}",m),e.next=27,(0,O.IU)("".concat(T,"/ai/completions"),{method:"POST",json:{scope:"admin-tools",session:M,message:o},signal:r,nonce:k});case 27:if((y=e.sent).success){e.next=33;break}if(null===(v=y.error)||void 0===v||!v.cancelledByUser){e.next=31;break}return e.abrupt("return",null);case 31:throw console.error(y),new Error(null!==(g=y.message)&&void 0!==g?g:"Unknown error, check your console logs.");case 33:u=null==y?void 0:y.data,null!=y&&null!==(h=y.usage)&&void 0!==h&&h.total_tokens&&(d=y.usage.total_tokens,c((function(e){return e+y.usage.total_tokens})));case 35:return null!=r&&r.aborted&&C(),E=S(u),b={content:s,prompt:o,rawData:u,entries:E,error:l,tokens:d},console.log("Result:",b),e.abrupt("return",b);case 40:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),C=function(){console.log("User aborted."),setBusy(!1),_.reset()},I=function(){var e=xn(On().mark((function e(){var t,r,a;return On().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c(0),t=Array.from(Array(R).keys()),r=prompt("There are "+t.length+" entries. If you want to start from a certain entry offset, type it here. Otherwise, just press OK, and everything will be processed."),a=t.map((function(e){return function(){var t=xn(On().mark((function t(a){var o,i;return On().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(console.log("Task "+e),!(r&&e<r)){t.next=3;break}return t.abrupt("return",{success:!0});case 3:return t.next=5,N(e,null,a);case 5:return(null==(i=t.sent)||null===(o=i.entries)||void 0===o?void 0:o.length)>0&&n((function(e){return[].concat(Sn(e),Sn(i.entries))})),t.abrupt("return",{success:!0});case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()})),e.next=6,_.start(a);case 6:m(!1),alert("All done!"),_.reset();case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),A=function(){var e=xn(On().mark((function e(){var t,r;return On().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,c(0),null!==(t=prompt("Enter the ID of a post (leave blank to use the very first one)."))){e.next=5;break}return e.abrupt("return");case 5:return m("singleGenerate"),e.next=8,N(0,t);case 8:(r=e.sent).entries.length?confirm("Got ".concat(r.entries.length," entries! Do you want to add them to your data? If not, they will be displayed in your console."))&&n((function(e){return[].concat(Sn(e),Sn(r.entries))})):alert("No entries were generated. Check the console for more information."),e.next=16;break;case 12:e.prev=12,e.t0=e.catch(0),console.error(e.t0),alert(e.t0.message);case 16:return e.prev=16,m(!1),e.finish(16);case 19:case"end":return e.stop()}}),e,null,[[0,12,16,19]])})));return function(){return e.apply(this,arguments)}}();return React.createElement(React.Fragment,null,React.createElement("div",{style:{display:"flex",width:"100%"}},React.createElement(w.M,{disabled:x,onClick:A,isBusy:"singleGenerate"===s},He.COMMON.SINGLE_GENERATE),React.createElement("span",{style:{color:"#d1e8f2",fontSize:"22px",padding:5}},"|"),React.createElement(w.M,{disabled:x,onClick:function(){return I()}},"Bulk Generate"),React.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",paddingLeft:10}},"Based on ",b&&"...",!b&&R),React.createElement(we.u,{id:"postType",scrolldown:!0,disabled:x,name:"postType",style:{width:100,marginLeft:10},onChange:o,value:a},null==g?void 0:g.map((function(e){return React.createElement(we.j,{key:e.type,value:e.type,label:e.name})}))),React.createElement(Jt.j,{busy:_.busy,style:{marginLeft:10,flex:"auto"},value:_.value,max:_.max,onStopClick:_.stop}),React.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",paddingLeft:10}},"Tokens: ",l)),React.createElement("div",{style:{width:"100%"}},React.createElement(Wt.m,{id:"generatePrompt",name:"generatePrompt",rows:2,style:{marginTop:10,marginBottom:5},value:p,onBlur:h,disabled:x})),_.TasksErrorModal)};function kn(e){return kn="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},kn(e)}function Ln(e){return function(e){if(Array.isArray(e))return Hn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Bn(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 Mn(){Mn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==kn(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(kn(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Pn(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 jn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pn(Object(n),!0).forEach((function(t){Fn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Fn(e,t,n){var r;return r=function(e,t){if("object"!=kn(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=kn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==kn(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dn(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Gn(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Dn(o,r,a,i,l,"next",e)}function l(e){Dn(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Un(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||Bn(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){if(e){if("string"==typeof e)return Hn(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)?Hn(e,t):void 0}}function Hn(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 Yn=wp.element,zn=Yn.useState,Wn=Yn.useMemo,Vn=Yn.useRef,Kn=Yn.useEffect,qn=function(e){var t=e.createdOn,n=e.estimatedOn;if(!t||!n)return null;var r=new Date;t=new Date(t),n=new Date(n);var a,o,i,l=function(e){return new Date(e).toLocaleString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})};return React.createElement("div",null,"Start: ",l(t),".",React.createElement("br",null),"Finish: ",l(n),".",React.createElement("br",null),"Time Left: ",React.createElement("b",null,(a=n-r,o=Math.floor(a/6e4),(i=Math.floor(o/60))>0?"".concat(i," hour").concat(i>1?"s":""," and ").concat(o%60," minute").concat(o%60!=1?"s":""):"".concat(o," minute").concat(1!==o?"s":""))),".",React.createElement("br",null),React.createElement("br",null),React.createElement("small",null,"Use Refresh Models to update the status."))},Xn=[{accessor:"row",title:"#",width:25,verticalAlign:"top"},{accessor:"question",title:"Question",verticalAlign:"top"},{accessor:"answer",title:"Answer",verticalAlign:"top"},{accessor:"actions",title:"",width:36,align:"center"}],$n=[{accessor:"row",title:"#",width:25,verticalAlign:"top"},{accessor:"messages",title:"Messages",verticalAlign:"top"},{accessor:"actions",title:"",width:68,align:"top"}],Qn=[{accessor:"status",title:"Status",sortable:!0,width:"120px"},{accessor:"id",title:"ID",width:"120px"},{accessor:"filename",title:"File"},{accessor:"purpose",title:"Purpose"},{accessor:"filesize",title:"Size",sortable:!0},{accessor:"createdOn",title:"Date",sortable:!0,width:"80px"},{accessor:"actions",title:"",width:"190px"}],Jn=[{accessor:"status",title:"Status",sortable:!0,width:"120px"},{accessor:"id",title:"ID",width:"120px"},{accessor:"suffix",title:"Suffix"},{accessor:"model",title:"Model"},{accessor:"base_model",title:"Based On",width:"200px"},{accessor:"createdOn",title:"Date",sortable:!0,width:"80px"},{accessor:"actions",title:""}],Zn=function(e){var t=e.status,n=e.includeText,r=void 0!==n&&n,a=(0,s.z)().colors,o=a.orange,i=a.green,l=a.red,c=null;switch(t){case"pending":case"running":c=React.createElement(Oe.z,{title:t,icon:"replay",spinning:!0,width:24,color:o});break;case"succeeded":case"processed":c=React.createElement(Oe.z,{title:t,icon:"check-circle",width:24,color:i});break;case"failed":c=React.createElement(Oe.z,{title:t,icon:"close",width:24,color:l});break;case"cancelled":c=React.createElement(Oe.z,{title:t,icon:"close",width:24,color:o});break;default:c=React.createElement(Oe.z,{title:t,icon:"alert",width:24,color:o})}return r?React.createElement("div",{style:{display:"flex",alignItems:"center"}},c,React.createElement("span",{style:{textTransform:"uppercase",fontSize:9,marginLeft:3}},t)):c},er=function(e){var t=e.children,n=e.data,r=e.onChange,a=void 0===r?function(){}:r,o=Un(zn(!1),2),i=o[0],l=o[1],c=function(e){l(!1),e!==n&&a(e)};return i?React.createElement("div",{onKeyUp:function(e){"Escape"===e.key&&c(n)},style:{height:"100%",display:"flex",flexDirection:"column",width:"100%"}},React.createElement(Wt.m,{onBlurForce:!0,autoFocus:!0,fullHeight:!0,rows:3,style:{height:"100%",width:"100%"},onEnter:c,onBlur:c,value:n}),React.createElement(w.M,{onClick:c,fullWidth:!0,style:{marginTop:2,height:35}},"Save")):React.createElement("pre",{style:{width:"100%",height:"100%",whiteSpace:"break-spaces",margin:0,padding:0,fontSize:13,fontFamily:"inherit"},onClick:function(){return l(!0)}},t)};const tr=function(e){var t,n=e.options,r=e.updateOption,a=e.refreshOptions,o=(0,s.z)().colors,i=(0,u.jE)(),l=Un(zn(!1),2),c=l[0],m=l[1],d=Un(zn(),2),p=d[0],h=d[1],v=Un(zn(!1),2),g=v[0],R=v[1],_=Un(zn("finetunes"),2),x=_[0],S=_[1],N=Un(zn("current"),2),C=N[0],I=N[1],A=Un(zn("fine-tune"),2),L=A[0],M=A[1],P=Un(zn("meow"),2),j=P[0],F=P[1],D=Un(zn(!1),2),G=D[0],U=D[1],B=Un(zn(4),2),H=B[0],Y=B[1],z=Un(zn(4),2),W=z[0],V=z[1],K=Un(zn(.1),2),q=K[0],X=K[1],$=Un(zn(.01),2),Q=$[0],J=$[1],Z=Un(zn(!1),2),ee=Z[0],te=Z[1],ne=Un(zn(null==n||null===(t=n.ai_envs)||void 0===t||null===(t=t[0])||void 0===t?void 0:t.id),2),re=ne[0],ae=ne[1],oe=Wn((function(){return(null==n?void 0:n.ai_envs)||[]}),[n]),ie=Wn((function(){return null==oe?void 0:oe.find((function(e){return e.id===re}))}),[re,oe]),le=(null==ie?void 0:ie.finetunes_deleted)||[],ce=(null==ie?void 0:ie.finetunes)||[],ue=(0,f.I)({queryKey:["datasets-"+re+"-"+L],enabled:ee,queryFn:function(){return un(re,L)}}),se=ue.isFetching,fe=ue.error,me=ue.data,de=Un(zn("gpt-4o-mini-2024-07-18"),2),pe=de[0],he=de[1],ye=function(){var e=Gn(Mn().mark((function e(t,n){var a;return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=oe.map((function(e){return e.id===re?jn(jn({},e),{},Fn({},t,n)):e})),e.abrupt("return",r(a,"ai_envs"));case 2:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}();Kn((function(){"files"!==x||ee||te(!0)}),[x]),Kn((function(){fe&&!c&&m(fe)}),[fe]);var ve=10,ge=Un(zn(!0),2),Ee=ge[0],be=ge[1],Oe=Un(zn(1),2),Ce=Oe[0],Ie=Oe[1],Ae=Un(zn([]),2),ke=Ae[0],Le=Ae[1],Me=Un(zn(!1),2),Pe=Me[0],je=Me[1],Fe=Un(zn("You are Chihiro, an AI Assistant. Your primary objective is to assist website visitors by directing them to the appropriate page or succinctly answering their questions with precision."),2),De=Fe[0],Ge=Fe[1],Ue=Un(zn(""),2),Be=Ue[0],Ye=Ue[1],ze=Un(zn(!1),2),We=ze[0],Ve=ze[1],Ke=Un(zn([]),2),qe=Ke[0],Xe=Ke[1],$e=Wn((function(){return ke.length}),[ke]);Kn((function(){if(0!==ke.length){var e=ke.map((function(e,t){if(!e.messages||e.messages.length<3)return t+1;if("system"!==e.messages[0].role||"user"!==e.messages[1].role||"assistant"!==e.messages[2].role)return t+1;for(var n=3;n<e.messages.length;n++)if(e.messages[n].role===e.messages[n-1].role)return t+1;return null})).filter((function(e){return null!==e}));Xe(e),Ve(0===e.length)}else Ve(!1)}),[ke]);var Qe=function(e){var t=e.messages,n=e.currentRow,r=e.onUpdateDataRow,a=e.onDeleteDataRow;return React.createElement(React.Fragment,null,t.map((function(e,t){return React.createElement("div",{key:t,style:{display:"flex"}},React.createElement(w.M,{rounded:!0,icon:"trash",onClick:function(){return a(n,t+1)}}),React.createElement("div",{style:{width:120,paddingLeft:5,paddingTop:0,paddingBottom:4,marginRight:10}},React.createElement(we.u,{scrolldown:!0,name:"role",value:e.role,style:{width:120},onChange:function(a){return r(n,a,e.content,t+1)}},React.createElement(we.j,{value:"assistant",label:"Assistant"}),React.createElement(we.j,{value:"user",label:"User"}),React.createElement(we.j,{value:"system",label:"System"}))),React.createElement(er,{data:e.content,style:{flex:"auto"},onChange:function(a){return r(n,e.role,a,t+1)}},e.content))})))},Je=function(){var e=Gn(Mn().mark((function e(){return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.invalidateQueries("datasets");case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ze=function(){var e=Gn(Mn().mark((function e(){return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return R(!0),e.next=3,Je();case 3:R(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),et=function(){var e=Gn(Mn().mark((function e(){var t,n,r,a;return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=p,n=j,R(!0),r={envId:re,fileId:t,model:pe,suffix:n},G&&(r=jn(jn({},r),{},{nEpochs:H,batchSize:W,learningRateMultiplier:q,promptLossWeight:Q})),e.prev=5,e.next=8,(0,O.IU)("".concat(T,"/openai/files/finetune"),{method:"POST",nonce:k,json:r});case 8:(a=e.sent).success?(tt(),alert(He.ALERTS.FINETUNING_STARTED),S("finetunes"),h()):alert(a.message),e.next=16;break;case 12:e.prev=12,e.t0=e.catch(5),console.log(e.t0.message),alert(e.t0.message);case 16:R(!1);case 17:case"end":return e.stop()}}),e,null,[[5,12]])})));return function(){return e.apply(this,arguments)}}(),tt=function(){var e=Gn(Mn().mark((function e(){return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(R("finetunes"),ce.length){e.next=6;break}return e.next=4,fn(re);case 4:e.next=8;break;case 6:return e.next=8,pn(re);case 8:return e.next=10,a();case 10:R(!1);case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),nt=function(){var e=Gn(Mn().mark((function e(){return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return R("clean"),e.next=3,fn(re);case 3:return e.next=5,a();case 5:R(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),rt=function(){(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&!confirm(He.ALERTS.RESET_BUILDER)||(Le([]),it({instructions:De,entries:[]}))};Kn((function(){if(!ke||0===ke.length){var e=localStorage.getItem("mwai_builder_data_v2");if(e){var t=JSON.parse(e);Le(t.entries),t.instructions&&Ge(t.instructions)}}}),[]);var at=function(e){for(var t,n=!1,r=!1,a=function(){var t=ke[o].messages;if(t&&t.length>0)if("system"===t[0].role){if(t[0].content!==e){if(!n){if(!confirm("The instructions in your data do not match the ones in your entries. Do you want to replace it for every entry?"))return{v:void 0};n=!0}var a=Ln(ke);a[o].messages[0].content=e,Le((function(){return a}))}}else{if(!r){if(!confirm("Some entries are missing the system role as the first message. Do you want to add it for every entry where it's missing?"))return{v:void 0};r=!0}var i=Ln(ke);i[o].messages.unshift({role:"system",content:e}),Le((function(){return i}))}else{if(!r){if(!confirm("Some entries are missing the system role as the first message. Do you want to add it for every entry where it's missing?"))return{v:void 0};r=!0}var l=Ln(ke);l[o].messages=[{role:"system",content:e}].concat(Ln(t)),Le((function(){return l}))}},o=0;o<ke.length;o++)if(t=a())return t.v},ot=function(e){Ge(e),Pe||at(e)},it=function(e){!function(){var e=new Date,t=e.toLocaleDateString("ja-JP",{year:"numeric",month:"2-digit",day:"2-digit"});t=t.replace(/\//g,"."),t+="-"+e.getHours().toString().padStart(2,"0")+"."+e.getMinutes().toString().padStart(2,"0"),Ye("MEOW-".concat(t,".jsonl"))}();try{e?localStorage.setItem("mwai_builder_data_v2",(0,O.F1)(e)):localStorage.removeItem("mwai_builder_data_v2"),be(!0)}catch(e){localStorage.removeItem("mwai_builder_data_v2"),be(!1)}};Kn((function(){ke&&(null==ke?void 0:ke.length)>0&&it({instructions:De,entries:ke})}),[ke]),Kn((function(){De&&(null==De?void 0:De.length)>0&&it({instructions:De,entries:ke})}),[De]);var lt=function(e,t){var n=Ln(ke);n[e-1].messages.splice(t-1,1),Le(n)},ct=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=ke.map((function(a,o){if(o===e-1){if(r)return jn(jn({},a),{},{messages:a.messages.map((function(e,a){return a===r-1?jn(jn({},e),{},{role:t,content:n}):e}))});if("assistant"===t)return jn(jn({},a),{},{messages:a.messages.map((function(e){return"assistant"===e.role?jn(jn({},e),{},{content:n}):e}))});if("user"===t)return jn(jn({},a),{},{messages:a.messages.map((function(e){return"user"===e.role?jn(jn({},e),{},{content:n}):e}))})}return a}));Le(a)},ut=Wn((function(){var e=(Ce-1)*ve,t=null==ke?void 0:ke.slice((Ce-1)*ve,(Ce-1)*ve+ve);return null==t?void 0:t.map((function(t){var n=++e,r="",a="",o=[];if(Pe)o=t.messages;else{var i=t.messages.find((function(e){return"user"===e.role}));i&&(r=i.content);var l=t.messages.find((function(e){return"assistant"===e.role}));l&&(a=l.content)}return{row:n,messages:React.createElement(Qe,{entries:ke,messages:o,currentRow:n,onUpdateDataRow:ct,onDeleteDataRow:lt}),question:React.createElement(er,{data:r,onChange:function(e){return ct(n,"user",e)}},r),answer:React.createElement(er,{data:a,onChange:function(e){return ct(n,"assistant",e)}},a),actions:React.createElement(React.Fragment,null,Pe&&React.createElement(w.M,{rounded:!0,icon:"plus",onClick:function(){return _t(n)}}),React.createElement(w.M,{rounded:!0,icon:"trash",onClick:function(){return e=n,t=ke.filter((function(t,n){return n!==e-1})),Le(t),void(0===t.length&&it({instructions:De,entries:[]}));var e,t}}))}}))}),[ke,Ce,ve,Pe,ct,lt]),st=function(){var e=Gn(Mn().mark((function e(t){var n;return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return R(!0),e.prev=1,e.next=4,(0,O.IU)("".concat(T,"/openai/files/delete"),{method:"POST",nonce:k,json:{envId:re,fileId:t}});case 4:if(!(n=e.sent).success){e.next=10;break}return e.next=8,Je();case 8:e.next=11;break;case 10:alert(n.message);case 11:e.next=17;break;case 13:e.prev=13,e.t0=e.catch(1),console.error(e.t0),alert(He.ALERTS.CHECK_CONSOLE);case 17:R(!1);case 18:case"end":return e.stop()}}),e,null,[[1,13]])})));return function(t){return e.apply(this,arguments)}}(),ft=function(){var e=Gn(Mn().mark((function e(t){var n;return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return R(!0),e.prev=1,e.next=4,(0,O.IU)("".concat(T,"/openai/finetunes/cancel"),{method:"POST",nonce:k,json:{envId:re,finetuneId:t}});case 4:(n=e.sent).success?tt():alert(n.message),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error(e.t0),alert(He.ALERTS.CHECK_CONSOLE);case 12:R(!1);case 13:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}(),mt=function(){var e=Gn(Mn().mark((function e(t){return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(confirm(He.ALERTS.DELETE_FINETUNE)){e.next=2;break}return e.abrupt("return");case 2:return R(!0),e.prev=3,e.next=6,ye("finetunes_deleted",[].concat(Ln(le),[t]));case 6:e.next=12;break;case 8:e.prev=8,e.t0=e.catch(3),console.error(e.t0),alert(He.ALERTS.CHECK_CONSOLE);case 12:R(!1);case 13:case"end":return e.stop()}}),e,null,[[3,8]])})));return function(t){return e.apply(this,arguments)}}(),dt=function(){var e=Gn(Mn().mark((function e(t){var n;return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(confirm(He.ALERTS.DELETE_FINETUNE)){e.next=2;break}return e.abrupt("return");case 2:return R(!0),e.prev=3,e.next=6,(0,O.IU)("".concat(T,"/openai/finetunes/delete"),{method:"POST",nonce:k,json:{envId:re,modelId:t}});case 6:if(!(n=e.sent).success){e.next=12;break}return e.next=10,ye("finetunes_deleted",[].concat(Ln(le),[t]));case 10:e.next=19;break;case 12:if(!(n.message.indexOf("does not exist")>-1)){e.next=18;break}return alert(He.ALERTS.FINETUNE_ALREADY_DELETED),e.next=16,ye("finetunes_deleted",[].concat(Ln(le),[t]));case 16:e.next=19;break;case 18:alert(n.message);case 19:e.next=25;break;case 21:e.prev=21,e.t0=e.catch(3),console.error(e.t0),alert(He.ALERTS.CHECK_CONSOLE);case 25:R(!1);case 26:case"end":return e.stop()}}),e,null,[[3,21]])})));return function(t){return e.apply(this,arguments)}}(),pt=function(){var e=Gn(Mn().mark((function e(t,n){var r,a,o,i;return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return R(!0),e.prev=1,e.next=4,(0,O.IU)("".concat(T,"/openai/files/download"),{method:"POST",nonce:k,json:{envId:re,fileId:t}});case 4:(r=e.sent).success?(a=new Blob([r.data],{type:"text/plain"}),o=window.URL.createObjectURL(a),(i=document.createElement("a")).setAttribute("href",o),i.setAttribute("download","".concat(n)),document.body.appendChild(i),i.click(),i.remove()):alert(r.message),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error(e.t0),alert(He.ALERTS.CHECK_CONSOLE);case 12:R(!1);case 13:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,n){return e.apply(this,arguments)}}(),ht=Wn((function(){return null==me?void 0:me.sort((function(e,t){return t.created_at-e.created_at})).map((function(e){var t=e.id,n=e.filename,r=new Date(1e3*e.created_at),a="fine-tune"===e.purpose;return{status:React.createElement(Zn,{status:e.status,includeText:!0}),id:t,filename:n,purpose:e.purpose,filesize:(0,O.z3)(e.bytes),createdOn:React.createElement(React.Fragment,null,r.toLocaleDateString(),React.createElement("br",null),r.toLocaleTimeString()),actions:React.createElement(React.Fragment,null,React.createElement(w.M,{disabled:!a,icon:"wand",onClick:function(){return h(t)}},"Train Model"),React.createElement(w.M,{rounded:!0,icon:"arrow-down",onClick:function(){return pt(t,n)}}),React.createElement(w.M,{className:"danger",rounded:!0,icon:"trash",onClick:function(){return st(t)}}))}}))}),[me]),yt=function(e){return le.includes(e.model)||le.includes(e.id)},vt=function(e){return"failed"===e.status||"cancelled"===e.status},gt=function(e){return!vt(e)&&!yt(e)},Et=Wn((function(){if(!ce)return[];var e=ce;return"current"===C?e=e.filter(gt):"deleted"===C?e=e.filter(yt):"failed"===C&&(e=e.filter(vt)),e.map((function(e){var t=new Date(e.createdOn);return jn(jn({},e),{},{model:e.model?e.model:React.createElement(qn,{createdOn:e.createdOn,estimatedOn:e.estimatedOn}),status:React.createElement(Zn,{status:e.status,includeText:!0}),createdOn:React.createElement(React.Fragment,null,t.toLocaleDateString(),React.createElement("br",null),t.toLocaleTimeString()),actions:React.createElement(React.Fragment,null,"succeeded"===e.status&&React.createElement(w.M,{className:"danger",rounded:!0,icon:"trash",onClick:function(){return dt(e.model)}}),"cancelled"===e.status&&React.createElement(w.M,{className:"danger",rounded:!0,icon:"trash",onClick:function(){return mt(e.id)}}),"failed"===e.status&&React.createElement(w.M,{className:"danger",rounded:!0,icon:"trash",onClick:function(){return mt(e.id)}}),"pending"===e.status&&React.createElement(w.M,{className:"danger",rounded:!0,icon:"close",onClick:function(){return ft(e.id)}}))})}))}),[C,le,ce]),bt=se||g,wt=function(){var e=Gn(Mn().mark((function e(){var t,n;return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return R(!0),e.prev=1,t=ke.map((function(e){return(0,O.F1)(e)})).join("\n"),e.next=5,(0,O.IU)("".concat(T,"/openai/files/upload"),{method:"POST",nonce:k,json:{envId:re,filename:Be,data:t}});case 5:return n=e.sent,e.next=8,Je();case 8:n.success?(rt(!1),alert(He.ALERTS.DATASET_UPLOADED),S("files")):alert(n.message),e.next=15;break;case 11:e.prev=11,e.t0=e.catch(1),console.error(e.t0),alert(He.ALERTS.CHECK_CONSOLE);case 15:R(!1);case 16:case"end":return e.stop()}}),e,null,[[1,11]])})));return function(){return e.apply(this,arguments)}}(),Rt=Wn((function(){var e=new Date,t=e.getFullYear(),n=e.getMonth()+1,r=e.getDate(),a=e.getHours(),o=e.getMinutes(),i=e.getSeconds();return"".concat(pe,":ft-your-org:").concat(j,"-").concat(t,"-").concat(n<10?"0"+n:n,"-").concat(r<10?"0"+r:r,"-").concat(a<10?"0"+a:a,"-").concat(o<10?"0"+o:o,"-").concat(i<10?"0"+i:i)}),[j,pe]),Ot=function(){var e=Gn(Mn().mark((function e(t){var n,r;return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Mn().mark((function e(){var n,a,o,i,l,c;return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t[r],a=new FileReader,o=n.name.endsWith(".json"),i=n.name.endsWith(".jsonl"),l=n.name.endsWith(".csv"),c=!1,o||i||l){e.next=10;break}return alert(He.ALERTS.ONLY_SUPPORTS_FILES),console.warn(n),e.abrupt("return",1);case 10:a.onload=function(){var e=Gn(Mn().mark((function e(t){var n,r,a,u;return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.target.result,r=[],o?r=JSON.parse(n):i?(a=n.split("\n"),r=a.map((function(e){e=e.trim();try{return JSON.parse(e)}catch(t){return console.error(t,e),null}})),r.every((function(e){return e.messages}))||(c=!0)):l&&(u=zt().parse(n,{header:!0,skipEmptyLines:!0}),r=u.data,console.log("The CSV was loaded!",r),c=!0),c&&(r=r.map((function(e){var t=Object.keys(e).reduce((function(t,n){return t[n.toLowerCase()]=e[n],t}),{});c=!0;var n=["prompt","question","q"].find((function(e){return t[e]})),r=["completion","reply","a"].find((function(e){return t[e]})),a=t[n],o=t[r],i=null==o?void 0:o.replace(/\n\n$/g,""),l=null==a?void 0:a.replace(/\n\n###\n\n$/g,"");return a&&o?{messages:[{role:"system",content:De},{role:"user",content:l.trim()},{role:"assistant",content:i.trim()}]}:null}))),(r=r.filter((function(e){return e}))).every((function(e){return null==e?void 0:e.messages}))){e.next=9;break}return alert(He.ALERTS.ONLY_SUPPORTS_FILES),e.abrupt("return");case 9:Le(r);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),a.readAsText(n);case 12:case"end":return e.stop()}}),e)})),r=0;case 2:if(!(r<t.length)){e.next=9;break}return e.delegateYield(n(),"t0",4);case 4:if(!e.t0){e.next=6;break}return e.abrupt("continue",6);case 6:r++,e.next=2;break;case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),_t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"user",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Hello!",r=ke.map((function(r,a){return a===e-1?jn(jn({},r),{},{messages:[].concat(Ln(r.messages),[{role:t,content:n}])}):r}));Le(r)},xt=Vn(null),St=null==ce?void 0:ce.filter(gt).length,Tt=null==ce?void 0:ce.filter(vt).length,Nt=null==ce?void 0:ce.filter(yt).length,Ct=Wn((function(){return React.createElement(we.u,{scrolldown:!0,value:re,onChange:ae,style:{marginLeft:5}},oe.filter((function(e){return"openai"===e.type})).map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})})))}),[re,oe]),It=Wn((function(){if(0===qe.length)return null;var e=qe.slice(0,10).map((function(e,t){return React.createElement("span",{key:e,style:{cursor:"pointer",textDecoration:"underline"},onClick:function(){return function(e){var t=Math.floor(e/ve);Ie(t+1)}(e)}},e,t<qe.slice(0,10).length-1?", ":"")}));return qe.length>10?React.createElement(React.Fragment,null,"Some entries are invalid, for example those ones: ",e,", and ",qe.length-10," more."):React.createElement(React.Fragment,null,"Some entries are invalid, for example those ones: ",e)}),[qe,ve]);return React.createElement(React.Fragment,null,React.createElement(E.N,null,React.createElement(E.Y,{fullWidth:!0,minimal:!0,style:{margin:8}},React.createElement(b._,{inversed:!0,currentTab:x,onChange:function(e,t){S(t.key)},action:React.createElement(React.Fragment,null,React.createElement("div",{style:{flex:"auto"}}),"finetunes"===x&&React.createElement(React.Fragment,null,React.createElement(w.M,{disabled:g,busy:"finetunes"===g,onClick:tt,className:"secondary"},He.COMMON.REFRESH_MODELS),Ct),"files"===x&&React.createElement(React.Fragment,null,React.createElement(w.M,{disabled:g,onClick:Ze,className:"secondary"},"Refresh Files"),Ct),"editor"===x&&React.createElement(React.Fragment,null,React.createElement("label",{style:{marginRight:10}},"Filename:"),React.createElement(Re.A,{disabled:!$e||g,value:$e?Be:"",onChange:Ye,style:{width:220,marginRight:5}}),React.createElement(w.M,{className:"secondary",disabled:!We||g,icon:"upload",onClick:wt},"Upload to OpenAI"),Ct))},React.createElement(b.V,{title:He.COMMON.MODELS,key:"finetunes"},React.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},React.createElement("div",null,(0,O.FE)(He.FINETUNING.MODELS_INTRO)),React.createElement(Vt.o,{value:C,onChange:function(e){I(e)}},React.createElement(Vt.K,{title:"Current",value:"current",count:null!=St?St:"-"}),React.createElement(Vt.K,{title:"Failed",value:"failed",count:null!=Tt?Tt:"-"}),React.createElement(Vt.K,{title:"Deleted",value:"deleted",count:null!=Nt?Nt:"-"}))),React.createElement(_e.g,null),React.createElement(Kt.o,{busy:bt,data:Et,columns:Jn,emptyMessage:He.FINETUNING.NO_FINETUNES_YET}),React.createElement("div",{style:{marginTop:5,display:"flex",justifyContent:"end",lineHeight:"12px",alignItems:"center"}},React.createElement(w.M,{small:!0,disabled:g,busy:"clean"===g,onClick:nt,className:"primary"},He.FINETUNING.CLEAN_MODELS_LIST),React.createElement("small",{style:{marginLeft:5}},He.FINETUNING.DELETED_FINETUNE_ISSUE))),React.createElement(b.V,{title:He.COMMON.FILES,key:"files"},React.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},React.createElement("div",null,(0,O.FE)(He.FINETUNING.FILES_INTRO)),React.createElement(Vt.o,{value:L,onChange:function(e){M(e)}},React.createElement(Vt.K,{title:"Datasets",value:"fine-tune"}),React.createElement(Vt.K,{title:"All",value:null}))),React.createElement(_e.g,null),React.createElement(Kt.o,{busy:bt,data:ht,columns:Qn,emptyMessage:React.createElement(React.Fragment,null,"You do not have any dataset files yet.")})),React.createElement(b.V,{title:He.FINETUNING.DATASET_EDITOR,key:"editor"},!Ee&&React.createElement("p",{style:{color:"red"}},He.FINETUNING.HUGE_DATASET_WARNING),React.createElement(qt.V,{style:{display:"flex"}},React.createElement(w.M,{icon:"plus",onClick:function(){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Question?",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Answer.";Le([].concat(Ln(ke),[{messages:[{role:"system",content:De},{role:"user",content:e},{role:"assistant",content:t}]}]))}()},disabled:g},"Add Entry"),Pe&&React.createElement(w.M,{onClick:function(){return at(De)},disabled:g},"Rewrite Instructions"),React.createElement("div",{style:{flex:"auto"}}),React.createElement(Xt.S,{style:{marginLeft:5},onLabel:"Expert",offLabel:"Easy",width:90,onBackgroundColor:o.purple,offBackgroundColor:o.green,onChange:je,checked:Pe}),React.createElement($t.Z,{ref:xt,onSelectFiles:Ot,accept:"",style:{paddingLeft:5}},React.createElement(w.M,{className:"secondary",onClick:function(){return xt.current.click()}},"Import")),React.createElement(w.M,{disabled:!$e,onClick:rt,className:"secondary"},"Clear")),React.createElement(_e.g,null),ke.length>0&&(null==qe?void 0:qe.length)>0&&React.createElement(React.Fragment,null,React.createElement(Ne.X,{variant:"danger"},It),React.createElement(_e.g,null)),React.createElement(Se.a,{keepState:"datasetEditor"},React.createElement(Se.Y,{title:"Dataset"},React.createElement(_e.g,{tiny:!0}),React.createElement("div",{style:{display:"flex"}},React.createElement("div",{style:{flex:"auto"}}),React.createElement(Qt.Q,{currentPage:Ce,limit:ve,total:$e,onCurrentPageChanged:Ie,onClick:Ie})),React.createElement(_e.g,{tiny:!0}),React.createElement(Kt.o,{busy:g,data:ut,columns:Pe?$n:Xn,emptyMessage:React.createElement(React.Fragment,null,"You can import a file, or create manually each entry by clicking ",React.createElement("b",null,"Add"),".")}),React.createElement(_e.g,{tiny:!0}),React.createElement("div",{style:{display:"flex"}},React.createElement("div",{style:{flex:"auto"}}),React.createElement(Qt.Q,{currentPage:Ce,limit:ve,total:$e,onCurrentPageChanged:Ie,onClick:Ie}),React.createElement(w.M,{disabled:!$e,style:{marginLeft:5},onClick:function(){var e=(0,O.F1)(ke,2),t=new Blob([e],{type:"text/plain"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n;var a=new Date,o="".concat(a.getFullYear(),"-").concat(a.getMonth()+1,"-").concat(a.getDate(),"-WP.json");r.download=o,document.body.appendChild(r),r.click(),document.body.removeChild(r)}},"Export as JSON"))),React.createElement(Se.Y,{title:He.COMMON.CONTEXT},React.createElement(_e.g,null),React.createElement("span",null,"The instructions are the same for all entries. It is used as the ",React.createElement("i",null,"system")," (and first) message in each conversation. More information ",React.createElement("a",{href:"https://platform.openai.com/docs/guides/fine-tuning/preparing-your-dataset",target:"_blank",rel:"noreferrer"},"here"),"."),React.createElement(_e.g,null),React.createElement(Wt.m,{id:"instructions",name:"instructions",rows:2,value:De,onBlur:ot,onEnter:ot})),React.createElement(Se.Y,{title:"Generator"},React.createElement(_e.g,null),React.createElement(An,{options:n,instructions:De,setMessages:Le}),React.createElement(Ne.X,{variant:"danger"},"Use this feature with caution. The AI will generate questions and answers for each of your post based on the given prompt, and they will be added to your dataset. Keep in mind that this process may be ",React.createElement("u",null,"extremely slow")," and require a ",React.createElement("u",null,"significant number of API calls"),", resulting in a ",React.createElement("u",null,"high cost"),".")),React.createElement(Se.Y,{title:"Instructions"},React.createElement("p",null,"You can create your dataset by importing a file (two columns, in the CSV, JSON or JSONL format) or manually by clicking ",React.createElement("b",null,"Add Entry"),". To avoid losing your work, this data is kept in your browser's local storage. ",React.createElement("b",null,"This is actually complex, so learn how to write datasets by studying ",React.createElement("a",{href:"https://beta.openai.com/docs/guides/fine-tuning/conditional-generation",target:"_blank",rel:"noreferrer"},"case studies"),". Please also check the ",React.createElement("a",{href:"https://meowapps.com/wordpress-chatbot-finetuned-model-ai/",target:"_blank",rel:"noreferrer"},"simplified tutorial"),".")," Is your dataset ready? Modify the filename to your liking and click ",React.createElement("b",null,"Upload to OpenAI"),"! 😎"))))))),React.createElement(xe.L,{style:{margin:10}},React.createElement(Te.n,{isOpen:c,title:"Error",onRequestClose:function(){return m()},okButton:{label:"Ok",onClick:function(){return m()}},content:React.createElement(React.Fragment,null,React.createElement("p",null,null==c?void 0:c.message))}),React.createElement(Te.n,{isOpen:p,title:"Train a new model",onRequestClose:function(){return h()},okButton:{label:"Start",disabled:g,onClick:et},cancelButton:{label:"Close",disabled:g,onClick:function(){return h()}},content:React.createElement(React.Fragment,null,React.createElement("p",null,"Exciting! 🎵 You are about to create your own new model, based on your dataset. You simply need to select a base model, and optionally, to modify the ",React.createElement("a",{href:"https://beta.openai.com/docs/guides/fine-tuning/hyperparameters",target:"_blank",rel:"noreferrer"},"hyperparameters"),". Before starting the process, make sure that:"),React.createElement("ul",null,React.createElement("li",null,"✅ The dataset is well-defined."),React.createElement("li",null,"✅ You understand ",React.createElement("a",{href:"https://openai.com/api/pricing/#faq-fine-tuning-pricing-calculation",target:"_blank",rel:"noreferrer"},"OpenAI pricing")," about fine-tuning.")),React.createElement("label",null,"Base model:"),React.createElement(_e.g,{height:5}),React.createElement(Re.A,{value:pe,onChange:he,description:React.createElement(React.Fragment,null,"As of August 2024, you can use ",React.createElement("a",{href:"#",onClick:function(){return he("gpt-4o-mini-2024-07-18")}},"gpt-4o-mini-2024-07-18"),", ",React.createElement("a",{href:"#",onClick:function(){return he("gpt-3.5-turbo-0125")}},"gpt-3.5-turbo-0125"),", or any of your previously fine-tuned models. Check all the available models ",React.createElement("a",{href:"https://platform.openai.com/docs/guides/fine-tuning/which-models-can-be-fine-tuned",target:"_blank",rel:"noreferrer"},"here"),".")}),React.createElement(_e.g,{height:10}),React.createElement("label",null,"Suffix (for new model name):"),React.createElement(_e.g,{height:5}),React.createElement(Re.A,{value:j,onChange:F}),React.createElement(_e.g,{height:5}),React.createElement("small",null,"The name of the new model name will be decided by OpenAI. You can customize it a bit with a ",React.createElement("a",{href:"https://platform.openai.com/docs/guides/fine-tuning/create-a-fine-tuned-model",target:"_blank",rel:"noreferrer"},"suffix"),". Preview: ",React.createElement("b",null,Rt),"."),React.createElement(_e.g,{line:!0,height:20}),React.createElement(y.R,{label:"Enable HyperParams",checked:G,onChange:U}),G&&React.createElement(React.Fragment,null,React.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"}},React.createElement("label",{style:{marginRight:5}},"Number of Epochs:"),React.createElement(Re.A,{style:{marginRight:5},value:H,onChange:Y,type:"number"}),React.createElement("label",{style:{marginRight:5}},"Batch Size:"),React.createElement(Re.A,{value:W,onChange:V,type:"number"})),React.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"}},React.createElement("label",{style:{marginRight:5}},"Learning Rate Multiplier:"),React.createElement(Re.A,{style:{marginRight:5},value:q,onChange:X,type:"number"}),React.createElement("label",{style:{marginRight:5}},"Prompt Loss Weight:"),React.createElement(Re.A,{value:Q,onChange:J,type:"number"}))))})))};var nr;wp.element.useMemo;var rr,ar,or=G.Ay.div(nr||(rr=["\n  display: flex;\n  flex-direction: column;\n  width: 100%;\n  max-height: 290px;\n  overflow: auto;\n  box-sizing: border-box;\n  padding: 15px;\n\n  h3 {\n    margin-top: 20px;\n    padding-bottom: 5px;\n    font-size: 14px;\n    border-bottom: 1px solid black;\n  }\n\n  .description {\n    border-radius: 5px;\n\n    p {\n      small {\n        color: var(--neko-blue);\n        font-size: 12px;\n      }\n    }\n\n    p:first-child {\n      margin-top: 0;\n    }\n\n    p:last-child {\n      margin-bottom: 0;\n    }\n  }\n"],ar||(ar=rr.slice(0)),nr=Object.freeze(Object.defineProperties(rr,{raw:{value:Object.freeze(ar)}}))));const ir=function(e){var t,n,r=e.incidents,a=e.isLoading,o=(t=new Date,n=new Date(t.toLocaleString("en-US",{timeZone:"America/Los_Angeles"})),((t-n)/36e5).toFixed(0));return React.createElement(or,null,React.createElement(d.s,null,"Only the incidents which occured ",React.createElement("b",null,"less than a week ago")," are displayed. The time difference between the PST time used by OpenAI and your local time is ",o," hours."),!a&&null==r&&React.createElement("p",null,React.createElement("i",null,"Could not load the incidents.")),!a&&0===(null==r?void 0:r.length)&&React.createElement("p",null,React.createElement("i",null,"Currently no incidents.")),r&&r.map((function(e){return React.createElement("div",{key:e.guid},React.createElement("h3",null,e.date,": ",e.title),React.createElement("div",{className:"description",dangerouslySetInnerHTML:{__html:e.description}}))})))};function lr(e){return lr="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},lr(e)}function cr(){cr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==lr(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(lr(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 ur(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function sr(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return fr(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)?fr(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 fr(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 mr=wp.element.useState;const dr=function(e){var t=e.options,n=e.updateOption,r=e.busy,a=sr(mr("I would love to live on a tropical island with beautiful and sexy felines, where we could bask in the sun on the sandy beaches, sip on refreshing coconut milk, and enjoy each other's company. While we might occasionally fight in the trees, our days would mostly be spent in peaceful slumber. However, I am not sure of how we would handle any potential disruptions to our idyllic existence if human were to come..."),2),o=a[0],i=a[1],l=sr(mr([]),2),c=l[0],u=l[1],s=sr(mr(""),2),f=(s[0],s[1]),m=sr(mr(!1),2),d=m[0],h=m[1],v=null==t?void 0:t.chatbot_moderation,g=d||r,b=function(){var e,t=(e=cr().mark((function e(){var t,n;return cr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h(!0),e.next=3,(0,O.IU)("".concat(T,"/ai/moderate"),{method:"POST",nonce:k,json:{text:o}});case 3:(t=e.sent).success?(n=t.results,u(null==n?void 0:n.results)):f(t.message),h(!1);case 6:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){ur(o,r,a,i,l,"next",e)}function l(e){ur(o,r,a,i,l,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}(),_=React.createElement(p.d,{title:He.COMMON.CHATBOT},React.createElement(y.R,{name:"chatbot_moderation",label:He.COMMON.ENABLE,value:"1",checked:v,description:He.SETTINGS.CHATBOT_MODERATION_HELP,onChange:n}));return React.createElement(React.Fragment,null,React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(R.z,{busy:g,title:He.COMMON.SETTINGS,className:"primary"},React.createElement("p",null,"You can enable moderation various parts of WordPress. It will slow down the processing a little."),_)),React.createElement(E.Y,{minimal:!0},React.createElement(R.z,{busy:g,title:"AI Moderation Tester",className:"primary"},React.createElement("p",null,"Paste a text below, and check if it is safe for your website. ",React.createElement("b",null,"OpenAI Moderation Model is free!")," Learn more about it ",React.createElement("a",{href:"https://platform.openai.com/docs/guides/moderation/overview",target:"_blank"},"here"),"."),React.createElement(Wt.m,{name:"context",rows:8,value:o,onChange:i}),React.createElement(_e.g,null),React.createElement(w.M,{fullWidth:!0,onClick:b},"Moderation Check"),React.createElement(_e.g,null),React.createElement("label",null,"Results:"),React.createElement("pre",null,(0,O.F1)(c,2))))))};function pr(e){return pr="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},pr(e)}function hr(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 yr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?hr(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=pr(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=pr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==pr(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vr(){vr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==pr(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(pr(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 gr(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Er(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){gr(o,r,a,i,l,"next",e)}function l(e){gr(o,r,a,i,l,"throw",e)}i(void 0)}))}}function br(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,Rr=wr.useState,Or=wr.useEffect,_r=wr.useMemo;const xr=function(e){var t,n,r=e.modal,a=e.busy,o=e.setModal,i=e.onAddEmbedding,l=e.onModifyEmbedding,c=(t=Rr(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,n)||function(e,t){if(e){if("string"==typeof e)return br(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)?br(e,t):void 0}}(t,n)||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.")}()),u=c[0],s=c[1],f=a;Or((function(){"edit"!==(null==r?void 0:r.type)&&"add"!==(null==r?void 0:r.type)||s((null==r?void 0:r.data)||{})}),[r]);var m=_r((function(){var e,t,n,a,o;return null==r||!r.data||(null==r||null===(e=r.data)||void 0===e?void 0:e.title)!==(null==u?void 0:u.title)||(null==r||null===(t=r.data)||void 0===t?void 0:t.content)!==(null==u?void 0:u.content)||(null==r||null===(n=r.data)||void 0===n?void 0:n.behavior)!==(null==u?void 0:u.behavior)||(null==r||null===(a=r.data)||void 0===a?void 0:a.type)!==(null==u?void 0:u.type)||(null==r||null===(o=r.data)||void 0===o?void 0:o.refId)!==(null==u?void 0:u.refId)}),[r,u]),d=function(){var e=Er(vr().mark((function e(){return vr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,l(u);case 3:o(null),e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),alert(e.t0.message);case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(){return e.apply(this,arguments)}}(),p=function(){var e=Er(vr().mark((function e(){return vr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,i(u);case 3:o(null),e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),alert(e.t0.message);case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(){return e.apply(this,arguments)}}();return React.createElement(React.Fragment,null,React.createElement(Te.n,{isOpen:"edit"===(null==r?void 0:r.type)||"add"===(null==r?void 0:r.type),title:"edit"===(null==r?void 0:r.type)?He.COMMON.MODIFY_EMBEDDING:He.COMMON.ADD_EMBEDDING,okButton:{label:"edit"===(null==r?void 0:r.type)?He.COMMON.MODIFY_EMBEDDING:He.COMMON.ADD_EMBEDDING,disabled:!m||a,isBusy:"addEmbedding"===a,onClick:function(){"edit"===r.type?d():p()}},cancelButton:{disabled:a,onClick:function(){return o(null)}},onRequestClose:function(){return o(null)},content:React.createElement(React.Fragment,null,React.createElement("p",null,"A custom embedding can be a sentence, a paragraph or a whole article. When an user input is made, the AI will search for the best embedding that matches the user input and will be able to reply with more accuracy."),React.createElement(_e.g,null),React.createElement("label",null,"Title:"),React.createElement(_e.g,{tiny:!0}),React.createElement(Re.A,{value:null==u?void 0:u.title,placeholder:'Title, like "My Website Information"',description:"This is for your convenience only, it's not used anywhere.",onChange:function(e){return s(yr(yr({},u),{},{title:e}))}}),React.createElement(_e.g,null),React.createElement("label",null,"Content:"),React.createElement(_e.g,{tiny:!0}),React.createElement(Wt.m,{countable:"chars",maxLength:64e3,description:"The content of your embeddings that will be used by the AI if it matches the user input.",value:null==u?void 0:u.content,onChange:function(e){return s(yr(yr({},u),{},{content:e}))}}),React.createElement(_e.g,null),React.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},React.createElement("div",{style:{flex:3}},React.createElement("label",null,"Behavior:"),React.createElement(_e.g,{tiny:!0}),React.createElement(we.u,{scrolldown:!0,name:"behavior",disabled:f||!0,value:null==u?void 0:u.behavior,onChange:function(e){s(yr(yr({},u),{},{behavior:e}))}},React.createElement(we.j,{value:"context",label:"Context"}),React.createElement(we.j,{value:"reply",label:"Reply"}))),React.createElement("div",{style:{flex:3,marginLeft:5}},React.createElement("label",null,"Type:"),React.createElement(_e.g,{tiny:!0}),React.createElement(we.u,{scrolldown:!0,name:"type",disabled:f||!0,value:null==u?void 0:u.type,onChange:function(e){s(yr(yr({},u),{},{type:e}))}},React.createElement(we.j,{value:"manual",label:"Manual"}),React.createElement(we.j,{value:"postId",label:"Related to Post"}))),"postId"===(null==u?void 0:u.type)&&React.createElement("div",{style:{flex:1,marginLeft:5}},React.createElement("label",null,"Post ID:"),React.createElement(_e.g,{tiny:!0}),React.createElement(Re.A,{value:null==u?void 0:u.refId,disabled:!0,onChange:function(e){return s(yr(yr({},u),{},{refId:e}))}}))))}))};function Sr(e){return Sr="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},Sr(e)}function Tr(){Tr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Sr(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Sr(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Nr(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Cr(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Nr(o,r,a,i,l,"next",e)}function l(e){Nr(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Ir(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ar(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)?Ar(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 Ar(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 kr=wp.element.useState;function Lr(e,t){var n=new Blob([e],{type:"text/plain;charset=utf-8;"}),r=document.createElement("a");r.href=URL.createObjectURL(n),r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r)}const Mr=function(e){var t=e.modal,n=e.setModal,r=Ir(kr(!1),2),a=r[0],o=r[1],i=Ir(kr(0),2),l=i[0],c=i[1],u=Ir(kr(0),2),s=u[0],f=u[1],m=null==t?void 0:t.data,d=function(){var e=Cr(Tr().mark((function e(){var t,n,r,a,i,l;return Tr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,o(!0),e.next=4,h();case 4:t=e.sent,n=(0,O.F1)(t,2),r=new Date,a=r.getFullYear(),i=r.getMonth()+1,l=r.getDate(),Lr(n,"vectors-".concat(a,"-").concat(i,"-").concat(l,".json")),setTimeout((function(){c(0)}),1e3),e.next=18;break;case 14:e.prev=14,e.t0=e.catch(0),console.error(e.t0),alert("An error occured while exporting vectors. Check your console.");case 18:return e.prev=18,o(!1),e.finish(18);case 21:case"end":return e.stop()}}),e,null,[[0,14,18,21]])})));return function(){return e.apply(this,arguments)}}(),p=function(){var e=Cr(Tr().mark((function e(){var t,n,r,a,i,l;return Tr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,o(!0),e.next=4,h();case 4:t=e.sent,n=zt().unparse(t),r=new Date,a=r.getFullYear(),i=r.getMonth()+1,l=r.getDate(),Lr(n,"vectors-".concat(a,"-").concat(i,"-").concat(l,".csv")),setTimeout((function(){c(0)}),1e3),e.next=18;break;case 14:e.prev=14,e.t0=e.catch(0),console.error(e.t0),alert("An error occured while exporting vectors. Check your console.");case 18:return e.prev=18,o(!1),e.finish(18);case 21:case"end":return e.stop()}}),e,null,[[0,14,18,21]])})));return function(){return e.apply(this,arguments)}}(),h=function(){var e=Cr(Tr().mark((function e(){var t,n,r,a;return Tr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=!1,n={page:1,limit:20,filters:{envId:m.envId,dbIndex:m.dbIndex,dbNS:m.dbNS}},r=[],a=Tr().mark((function e(){var a;return Tr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ht(n);case 2:(a=e.sent).vectors.length<2&&(t=!0),c((function(){return a.total})),r=r.concat(a.vectors),f((function(){return r.length})),n.page++;case 8:case"end":return e.stop()}}),e)}));case 4:if(t){e.next=8;break}return e.delegateYield(a(),"t0",6);case 6:e.next=4;break;case 8:return e.abrupt("return",r);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return React.createElement(React.Fragment,null,React.createElement(Te.n,{isOpen:"export"===(null==t?void 0:t.type),title:"Export Embeddings",onRequestClose:function(){return n(null)},okButton:{label:"Close",disabled:a,onClick:function(){return n(null)}},customButtons:React.createElement(React.Fragment,null,React.createElement(w.M,{onClick:p,disabled:a},"Export CSV"),React.createElement(w.M,{onClick:d,disabled:a},"Export JSON")),content:React.createElement(React.Fragment,null,React.createElement(Jt.j,{busy:a,style:{flex:"auto"},value:s,max:l}))}))};function Pr(e){return Pr="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},Pr(e)}function jr(){jr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Pr(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Pr(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Fr(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 Dr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fr(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=Pr(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Pr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==Pr(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Gr(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Yr(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}function Ur(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Br(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Ur(o,r,a,i,l,"next",e)}function l(e){Ur(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Hr(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||Yr(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 Yr(e,t){if(e){if("string"==typeof e)return zr(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)?zr(e,t):void 0}}function zr(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.useState;const Vr=function(e){var t,n,r=e.modal,a=e.setModal,o=e.onAddEmbedding,i=e.onModifyEmbedding,l=Hr(Wr(!1),2),c=l[0],u=l[1],s=Hr(Wr(0),2),f=s[0],m=s[1],d=Hr(Wr(0),2),p=d[0],h=d[1],v=Hr(Wr({add:[],modify:[],same:[],total:0,isReady:!1}),2),g=v[0],E=v[1],b=null!==(t=null==r||null===(n=r.data)||void 0===n?void 0:n.importVectors)&&void 0!==t?t:[],R=Hr(Wr({envId:!1,dbId:!1,dbIndex:!1,dbNS:!1,title:!0,refId:!0}),2),O=R[0],_=R[1],x=null==r?void 0:r.data,S=function(e){var t,n,r,a,o,i,l,c,u,s;return{id:null!==(t=e.id)&&void 0!==t?t:null,type:null!==(n=e.type)&&void 0!==n?n:"manual",title:null!==(r=e.title)&&void 0!==r?r:"N/A",behavior:null!==(a=e.behavior)&&void 0!==a?a:"context",envId:null!==(o=null==x?void 0:x.envId)&&void 0!==o?o:null,dbId:null!==(i=e.dbId)&&void 0!==i?i:null,dbIndex:null!==(l=x.dbIndex)&&void 0!==l?l:null,dbNS:null!==(c=x.dbNS)&&void 0!==c?c:null,content:null!==(u=e.content)&&void 0!==u?u:"",refId:null!==(s=e.refId)&&void 0!==s?s:null}},T=function(e,t,n){return Object.keys(n).every((function(r){return!n[r]||e[r]===t[r]}))},N=function(){var e=Br(jr().mark((function e(t,n){var r,a,o,i,l,c,u;return jr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],a=[],o=[],console.log("Calculate Diff",{currentVectors:t,importVectors:n}),i=Gr(n),e.prev=5,c=jr().mark((function e(){var n,i,c,u;return jr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=l.value,i=S(n),c=t.find((function(e){return T(e,i,O)})),console.log("Matched Vector",{cleanVector:Dr({},i),matchedVector:Dr({},c)}),c?i.id=c.id:delete i.id,(u=t.find((function(e){return e.id===i.id})))&&i.content===u.content&&i.title===u.title?o.push(i):i.id?a.push(i):r.push(i);case 7:case"end":return e.stop()}}),e)})),i.s();case 8:if((l=i.n()).done){e.next=12;break}return e.delegateYield(c(),"t0",10);case 10:e.next=8;break;case 12:e.next=17;break;case 14:e.prev=14,e.t1=e.catch(5),i.e(e.t1);case 17:return e.prev=17,i.f(),e.finish(17);case 20:u=r.length+a.length,E({add:r,modify:a,same:o,total:u,isReady:!0}),console.log("Embeddings Diff",{add:r,modify:a,same:o,total:u});case 23:case"end":return e.stop()}}),e,null,[[5,14,17,20]])})));return function(t,n){return e.apply(this,arguments)}}(),C=function(){var e=Br(jr().mark((function e(){var t,n,r,a;return jr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0,t=!1,n={page:1,limit:20,filters:{envId:x.envId,dbIndex:x.dbIndex,dbNS:x.dbNS}},r=[],u("stepOne"),a=jr().mark((function e(){var a;return jr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ht(n);case 2:(a=e.sent).vectors.length<2&&(t=!0),m((function(){return a.total})),r=r.concat(a.vectors),h((function(){return r.length})),n.page++;case 8:case"end":return e.stop()}}),e)}));case 6:if(t){e.next=10;break}return e.delegateYield(a(),"t0",8);case 8:e.next=6;break;case 10:N(r,b),e.next=17;break;case 13:e.prev=13,e.t1=e.catch(0),console.error(e.t1),alert("An error occured while retrieving your current embeddings. Check your console.");case 17:return e.prev=17,u(!1),e.finish(17);case 20:case"end":return e.stop()}}),e,null,[[0,13,17,20]])})));return function(){return e.apply(this,arguments)}}(),I=function(){var e=Br(jr().mark((function e(){var t,n,r,a,l,c;return jr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0,m(g.add.length+g.modify.length),h(0),u("stepTwo"),t=Gr(g.add),e.prev=5,t.s();case 7:if((n=t.n()).done){e.next=14;break}return r=n.value,e.next=11,o(r,!0);case 11:h((function(e){return e+1}));case 12:e.next=7;break;case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(5),t.e(e.t0);case 19:return e.prev=19,t.f(),e.finish(19);case 22:a=Gr(g.modify),e.prev=23,a.s();case 25:if((l=a.n()).done){e.next=32;break}return c=l.value,e.next=29,i(c,!0);case 29:h((function(e){return e+1}));case 30:e.next=25;break;case 32:e.next=37;break;case 34:e.prev=34,e.t1=e.catch(23),a.e(e.t1);case 37:return e.prev=37,a.f(),e.finish(37);case 40:alert("All embeddings have been updated."),E({add:[],modify:[],same:[],total:0,isReady:!1}),A(),e.next=49;break;case 45:e.prev=45,e.t2=e.catch(0),console.error(e.t2),alert("An error occured while updating embeddings. Check your console.");case 49:return e.prev=49,u(!1),e.finish(49);case 52:case"end":return e.stop()}}),e,null,[[0,45,49,52],[5,16,19,22],[23,34,37,40]])})));return function(){return e.apply(this,arguments)}}(),A=function(){a(null),u(!1),m(0),h(0),E({add:[],modify:[],same:[],total:0,isReady:!1})};return React.createElement(React.Fragment,null,React.createElement(Te.n,{isOpen:"import"===(null==r?void 0:r.type),title:"Import Embeddings",onRequestClose:A,okButton:{label:"Close",onClick:A,disabled:c},customButtons:React.createElement(React.Fragment,null,React.createElement(w.M,{onClick:C,disabled:c},"Check Differences"),React.createElement(w.M,{onClick:I,disabled:c||0===g.total},"Apply Changes")),content:React.createElement(React.Fragment,null,React.createElement("p",null,"There are ",React.createElement("b",null,b.length," embeddings")," in the file."),React.createElement(_e.g,null),React.createElement(Se.Y,{title:"1 - Check Differences"}),React.createElement("p",null,"Calculates the differences between the embeddings in your file and the ones currently registered in AI Engine. Based on that, a list of changes will be created. Please note that the environment, index and namespace that might be set in the file will be ignored."),React.createElement("p",{style:{marginTop:10}},"An embedding will be considered the same entry based on:"),React.createElement(_e.g,null),React.createElement("div",{style:{display:"flex"}},React.createElement("div",{style:{marginLeft:15}},React.createElement(y.R,{small:!0,label:"DB ID",disabled:!1,checked:O.dbId,onChange:function(){return _(Dr(Dr({},O),{},{dbId:!O.dbId}))}})),React.createElement("div",{style:{marginLeft:15}},React.createElement(y.R,{small:!0,label:"Title",disabled:!1,checked:O.title,onChange:function(){return _(Dr(Dr({},O),{},{title:!O.title}))}})),React.createElement("div",{style:{marginLeft:15}},React.createElement(y.R,{small:!0,label:"Ref (Post ID)",disabled:!1,checked:O.refId,onChange:function(){return _(Dr(Dr({},O),{},{refId:!O.refId}))}}))),"stepOne"===c&&React.createElement(React.Fragment,null,React.createElement(_e.g,null),React.createElement(Jt.j,{busy:c,style:{flex:"auto"},value:p,max:f})),React.createElement(_e.g,null),React.createElement(Se.Y,{title:"2 - Apply Changes"}),!g.isReady&&React.createElement("i",null,"Waiting for diff..."),g.isReady&&React.createElement(React.Fragment,null,React.createElement("p",null,"There are ",g.same.length>=1&&React.createElement("span",null,React.createElement("b",null,g.same.length," identical embeddings")," (with the same title and content). They will be ignored. "),React.createElement("span",null,"Changes to apply:")),React.createElement("ul",null,React.createElement("li",null,"👉 Add: ",React.createElement("b",null,g.add.length)),React.createElement("li",null,"👉 Modify: ",React.createElement("b",null,g.modify.length)))),"stepTwo"===c&&React.createElement(React.Fragment,null,React.createElement(_e.g,null),React.createElement(Jt.j,{busy:c,style:{flex:"auto"},value:p,max:f})),React.createElement(_e.g,null))}))};function Kr(e){return Kr="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},Kr(e)}function qr(e){return function(e){if(Array.isArray(e))return na(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ta(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 Xr(){Xr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Kr(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Kr(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 $r(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 Qr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$r(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=Kr(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Kr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==Kr(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Jr(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Zr(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Jr(o,r,a,i,l,"next",e)}function l(e){Jr(o,r,a,i,l,"throw",e)}i(void 0)}))}}function ea(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||ta(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 ta(e,t){if(e){if("string"==typeof e)return na(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)?na(e,t):void 0}}function na(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 ra=wp.element,aa=ra.useState,oa=ra.useMemo,ia=ra.useEffect,la=ra.useRef,ca=[{accessor:"status",title:"Status",width:"80px"},{accessor:"title",title:"Title / Model",sortable:!1},{accessor:"type",title:"Ref",sortable:!1,width:"75px"},{accessor:"score",title:"Score",sortable:!0,width:"65px"},{accessor:"updated",title:"Updated",sortable:!1,width:"80px"},{accessor:"actions",title:"",width:"100px"}],ua=[{accessor:"status",title:"Status",sortable:!0,width:"80px"},{accessor:"title",title:"Title / Model",sortable:!1},{accessor:"type",title:"Ref",sortable:!0,width:"75px"},{accessor:"updated",title:"Updated",sortable:!0,width:"80px"},{accessor:"actions",title:"",width:"100px"}],sa=function(e){var t=e.embedding,n=e.envName,r=(0,s.z)().colors,a=t.status,o=t.content,i=t.error,l=oa((function(){if("ok"===a){if(!n)return"env_issue";if(!o)return"empty"}return a}),[a,n,o]),c=oa((function(){return"orphan"===l?"This embedding was retrieved from the Vector DB, but it has no content. Add some, or delete it.":"env_issue"===l?"This embedding is not related to any Embeddings Environment. Make sure you have an Embeddings Environment selected, and Sync/Refresh it; it will be linked to the current environment. You can also delete it.":"empty"===l?"This embedding has no content.":i||null}),[l,i]),u=oa((function(){var e={outdated:{icon:"alert",color:r.orange},ok:{icon:"check-circle",color:r.green},error:{icon:"alert",color:r.red},orphan:{icon:"pencil",color:r.orange},env_issue:{icon:"database",color:r.red},empty:{icon:"alert",color:r.orange},default:{icon:"alert",color:r.orange}};return e[l]||e.default}),[l,r]),f=u.icon,m=u.color;return React.createElement("div",{style:{display:"flex",alignItems:"center"},title:c},React.createElement(Oe.z,{icon:f,width:24,color:m,title:c}),React.createElement("span",{style:{textTransform:"uppercase",fontSize:9,marginLeft:3}},l))};const fa=function(e){var t,n=e.options,r=e.updateOption,a=(0,u.jE)(),o=(0,s.z)().colors,i=ea(aa("post"),2),l=i[0],c=i[1],m=ea(aa(!1),2),p=m[0],h=m[1],v=ea(aa("edit"),2),g=v[0],_=v[1],x=ea(aa(null),2),S=x[0],N=x[1],C=ea(aa(!1),2),I=C[0],A=C[1],L=ea(aa([]),2),M=L[0],P=L[1],j=ea(aa({type:null,data:null}),2),F=j[0],D=j[1],G=ea(aa(null),2),U=G[0],B=G[1],H=n.embeddings||{},Y=la(null),z=ft(n,!1,!0),W=n.embeddings_envs||[],V=ea(aa(function(){var e=localStorage.getItem("mwai-admin-embeddings");try{var t=JSON.parse(e);return{environmentId:(null==t?void 0:t.environmentId)||null}}catch(e){return{environmentId:null}}}().environmentId),2),K=V[0],q=V[1],X=oa((function(){return W.find((function(e){return e.id===K}))||null}),[W,K]),$=(null==X?void 0:X.min_score)>=0?X.min_score:35,Q=(null==X?void 0:X.max_select)>=0?X.max_select:10,J=oa((function(){return null!=X&&X.ai_embeddings_override&&null!=X&&X.ai_embeddings_env&&null!=X&&X.ai_embeddings_model?z.getModel(X.ai_embeddings_model):z.getModel(n.ai_embeddings_default_model)}),[X,H.model]),Z=(0,f.I)({queryKey:["postTypes"],queryFn:an}),ee=Z.isLoading,te=Z.data,ne=(0,f.I)({queryKey:[null!==(t="postsCount-"+l+"-"+(null==H?void 0:H.syncPostStatus))&&void 0!==t?t:"publish"],queryFn:function(){var e;return yt(l,null!==(e=null==H?void 0:H.syncPostStatus)&&void 0!==e?e:"publish")}}),re=ne.isLoading,ae=ne.data,oe=ea(aa({filters:{envId:K,search:S,debugMode:!1},sort:{accessor:"updated",by:"desc"},page:1,limit:20}),2),ie=oe[0],le=oe[1],ce=(0,f.I)({queryKey:["vectors",ie],queryFn:function(){return ht(ie)}}),ue=ce.isFetching,se=ce.data,fe=ce.error,me=ue||"searchVectors"===p,de="search"===g?ca:ua,pe=(0,Zt.XS)({i18n:He,onStop:function(){h(),pe.reset()}}),he=p||me||pe.isBusy||ee,ye=function(){var e=Zr(Xr().mark((function e(t){return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h("updateSettings"),e.next=3,r(Qr({},t),"embeddings");case 3:h(null);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ve=oa((function(){return H.syncPosts&&(null==H?void 0:H.syncPostsEnvId)!==K}),[K,H]);ia((function(){!H.syncPosts&&H.syncPostsEnvId&&ye(Qr(Qr({},H),{},{syncPostsEnvId:null}))}),[H.syncPosts]);var ge=oa((function(){return W.find((function(e){return e.id===H.syncPostsEnvId}))||null}),[H.syncPostsEnvId]);ia((function(){var e;le(Qr(Qr({},ie),{},{filters:{envId:K,search:S,debugMode:U}})),e={environmentId:K||null},localStorage.setItem("mwai-admin-embeddings",(0,O.F1)(e))}),[K,U]),ia((function(){var e="edit"===g?null:"";N("edit"===g?null:""),le(Qr(Qr({},ie),{},{filters:Qr(Qr({},ie.filters),{},{search:e}),sort:{accessor:"edit"===g?"created":"score",by:"desc"},page:1,limit:20}))}),[g]),ia((function(){var e,t;null!=H&&null!==(e=H.syncPostTypes)&&void 0!==e&&e.length&&null!=H&&null!==(t=H.syncPostStatus)&&void 0!==t&&t.length||ye(Qr(Qr({},H),{},{syncPostTypes:["post","page","product"],syncPostStatus:["publish"]}))}),[H.syncPostTypes]);var Ee=oa((function(){var e={padding:"8px 15px",textAlign:"center"};return H.syncPosts&&!ge?React.createElement(Ne.X,{variant:"danger",style:e},"Pick a valid environment for the sync."):H.syncPosts?React.createElement(Ne.X,{variant:"special",style:e},"Enabled on ",React.createElement("b",null,null==ge?void 0:ge.name)):React.createElement(Ne.X,{variant:"info",style:e},"Disabled")}),[H]),be=function(){var e=Zr(Xr().mark((function e(){return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(S!==ie.filters.search){e.next=3;break}return a.invalidateQueries({queryKey:["vectors"]}),e.abrupt("return");case 3:le(Qr(Qr({},ie),{},{filters:Qr(Qr({},ie.filters),{},{search:S})}));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Oe=function(){var e=Zr(Xr().mark((function e(){return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:N(""),le(Qr(Qr({},ie),{},{filters:Qr(Qr({},ie.filters),{},{search:""})}));case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),xe=function(){var e=Zr(Xr().mark((function e(){var t,n,r,a,o,i=arguments;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:I,(n=i.length>1&&void 0!==i[1]&&i[1])||h("addEmbedding"),e.prev=3,(r=Qr({},t)).envId||(r.envId=X.id),e.next=8,(0,O.IU)("".concat(T,"/vectors/add"),{nonce:k,method:"POST",json:{vector:r}});case 8:a=e.sent,Me(null==a?void 0:a.vector,!0),A(!1),console.log("Embedding Added",t),e.next=18;break;case 14:throw e.prev=14,e.t0=e.catch(3),console.error(e.t0),new Error(null!==(o=e.t0.message)&&void 0!==o?o:"Unknown error, check your console logs.");case 18:return e.prev=18,n||h(!1),e.finish(18);case 21:return e.abrupt("return",!0);case 22:case"end":return e.stop()}}),e,null,[[3,14,18,21]])})));return function(){return e.apply(this,arguments)}}(),Se=function(){var e=Zr(Xr().mark((function e(){var t,n,r,a,o,i=arguments;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:I,(n=i.length>1?i[1]:void 0)||h("addEmbedding"),e.prev=3,(r=Qr({},t)).envId=X.id,e.next=8,(0,O.IU)("".concat(T,"/vectors/update"),{nonce:k,method:"POST",json:{vector:r}});case 8:a=e.sent,Me(null==a?void 0:a.vector),A(!1),console.log("Embeddings updated.",a),e.next=18;break;case 14:throw e.prev=14,e.t0=e.catch(3),console.error(e.t0),new Error(null!==(o=e.t0.message)&&void 0!==o?o:"Unknown error, check your console logs.");case 18:return e.prev=18,n||h(!1),e.finish(18);case 21:return e.abrupt("return",!0);case 22:case"end":return e.stop()}}),e,null,[[3,14,18,21]])})));return function(){return e.apply(this,arguments)}}(),Te=function(){var e=Zr(Xr().mark((function e(t,n){var r;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n||h("deleteEmbedding"),e.prev=1,e.next=4,(0,O.IU)("".concat(T,"/vectors/delete"),{nonce:k,method:"POST",json:{envId:X.id,ids:t}});case 4:e.next=13;break;case 6:if(e.prev=6,e.t0=e.catch(1),console.error(e.t0),confirm("Got an error from the vector database:\n\n".concat(e.t0.message,"\n\nDo you want to force the deletion locally?"))){e.next=11;break}throw new Error(null!==(r=e.t0.message)&&void 0!==r?r:"Unknown error, check your console logs.");case 11:return e.next=13,(0,O.IU)("".concat(T,"/vectors/delete"),{nonce:k,method:"POST",json:{envId:X.id,ids:t,force:!0}});case 13:return e.prev=13,n||h(!1),e.finish(13);case 16:console.log("Embeddings deleted.",{ids:t}),a.invalidateQueries({queryKey:["vectors"]}),"search"===g&&console.error("We should update the vectors data with the deleted embeddings.");case 19:case"end":return e.stop()}}),e,null,[[1,6,13,16]])})));return function(t,n){return e.apply(this,arguments)}}(),Ce=function(){var e=Zr(Xr().mark((function e(t){var n,r;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Xr().mark((function e(){var n,a,o,i,l;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t[r],a=new FileReader,o=n.name.endsWith(".json"),i=n.name.endsWith(".jsonl"),l=n.name.endsWith(".csv"),o||i||l){e.next=8;break}return alert(He.ALERTS.ONLY_SUPPORTS_FILES),e.abrupt("return",1);case 8:a.onload=function(){var e=Zr(Xr().mark((function e(t){var n,r,a,c,u,s,f;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.target.result,r=[],o?r=JSON.parse(n):i?(a=n.split("\n"),r=a.map((function(e){e=e.trim();try{return JSON.parse(e)}catch(e){return console.error(e),null}}))):l&&(c=zt().parse(n,{header:!0,skipEmptyLines:!0}),r=c.data,console.log("The CSV for Embeddings Import was loaded.",r)),s=(u=r).filter((function(e){return e.title&&e.content})),u.length!==s.length&&(alert(He.ALERTS.EMPTY_LINES_EMBEDDINGS),f=u.find((function(e){return!e.prompt||!e.completion})),console.warn("Empty line: ",f)),D({type:"import",data:{importVectors:s,envId:K}});case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),a.readAsText(n);case 10:case"end":return e.stop()}}),e)})),r=0;case 2:if(!(r<t.length)){e.next=9;break}return e.delegateYield(n(),"t0",4);case 4:if(!e.t0){e.next=6;break}return e.abrupt("continue",6);case 6:r++,e.next=2;break;case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ie=function(){var e=Zr(Xr().mark((function e(){return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(confirm("Are you sure you want to delete the selected embeddings?")){e.next=2;break}return e.abrupt("return");case 2:return h("deleteEmbeddings"),e.next=5,Te(M);case 5:P([]),h(!1);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ae=oa((function(){return(null==se?void 0:se.total)||0}),[se]),ke=oa((function(){var e=se;return null!=e&&e.vectors?null==e?void 0:e.vectors.map((function(e){var t,n,r,a=new Date(e.updated),i=(a=new Date(a.getTime()-60*a.getTimezoneOffset()*1e3)).toLocaleDateString("ja-JP",{year:"numeric",month:"2-digit",day:"2-digit"}),l=a.toLocaleTimeString("ja-JP",{hour:"2-digit",minute:"2-digit",second:"2-digit"}),c=React.createElement("span",null,i,React.createElement("br",null),l),u=new Date(e.created),s=(u=new Date(u.getTime()-60*u.getTimezoneOffset()*1e3)).toLocaleDateString("ja-JP",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),f=e.score?React.createElement("span",{style:{color:e.score>$/100?"var(--neko-green)":"inherit"}},(100*e.score.toFixed(4)).toFixed(2)):"-",m=null;e.subType&&"string"==typeof e.subType&&(m=e.subType.toUpperCase());var d=null!==(t=null===(n=z.getModel(e.model))||void 0===n?void 0:n.name)&&void 0!==t?t:e.model,p=e.model&&e.model!==(null==J?void 0:J.model),h=e.envId!==K,y=null===(r=W.find((function(t){return t.id===e.envId})))||void 0===r?void 0:r.name,v="ok"!==e.status||p||h,g=null;return p&&(g=React.createElement("b",{style:{color:o.red}},"[WRONG MODEL: ",e.model,"] ")),h&&y&&(g=React.createElement("b",{style:{color:o.green}},"[ENV: ",y,"] ")),{id:e.id,type:React.createElement("small",null,e.refId?React.createElement(React.Fragment,null,"ID ",React.createElement("a",{href:"/wp-admin/post.php?post=".concat(e.refId,"&action=edit"),target:"_blank",rel:"noreferrer"},"#",e.refId),React.createElement("br",null),React.createElement("div",{style:{fontSize:"80%",marginTop:-5}},m)):"MANUAL"),score:f,title:React.createElement(React.Fragment,null,React.createElement("span",null,e.title),React.createElement("br",null),React.createElement("small",{style:{color:p?o.red:"inherit"}},g,d," ",e.dimensions&&React.createElement(React.Fragment,null," (",e.dimensions,")"))),status:React.createElement(sa,{embedding:e,envName:y}),updated:c,created:s,actions:React.createElement(React.Fragment,null,React.createElement(w.M,{className:"primary",rounded:!0,icon:"pencil",disabled:he,onClick:function(){return D({type:"edit",data:e})}}),React.createElement(w.M,{className:"primary",rounded:!0,icon:"replay",disabled:he||!v,onClick:function(){return Le(e.id)}}),React.createElement(w.M,{className:"danger",rounded:!0,icon:"trash",disabled:he,onClick:function(){return Te([e.id])}}))}})):[]}),[g,se,he]),Le=function(){var e=Zr(Xr().mark((function e(t){var n;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h("syncEmbedding"),e.prev=1,e.next=4,Pe(t);case 4:e.next=10;break;case 6:e.prev=6,e.t0=e.catch(1),console.error(e.t0),alert(null!==(n=null===e.t0||void 0===e.t0?void 0:e.t0.message)&&void 0!==n?n:e.t0);case 10:h(!1);case 11:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(t){return e.apply(this,arguments)}}(),Me=function(e){a.invalidateQueries({queryKey:["vectors"]})},Pe=function(){var e=Zr(Xr().mark((function e(){var t,n,r,a,o=arguments;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:null,n=o.length>1&&void 0!==o[1]?o[1]:null,r=o.length>2&&void 0!==o[2]?o[2]:void 0,e.next=5,Et({vectorId:t,postId:n,envId:K},r);case 5:(a=e.sent).success&&Me(a.vector);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),je=function(){var e=Zr(Xr().mark((function e(){var t,n,r,o,i,l,c,u;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:h("bulkPullAll"),t={page:1,limit:1e4,filters:{envId:K}},n=[],r=[],o=!1;case 5:if(o){e.next=14;break}return e.next=8,mt(t);case 8:(i=e.sent).vectors.length<t.limit&&(o=!0),n=n.concat(i.vectors),t.page++,e.next=5;break;case 14:console.log("Remote vectors retrieved.",{remoteVectors:n}),o=!1,t.limit=20,t.page=0;case 18:if(o){e.next=27;break}return e.next=21,ht(t);case 21:(l=e.sent).vectors.length<t.limit&&(o=!0),r=r.concat(l.vectors),t.page++,e.next=18;break;case 27:if(r=r.map((function(e){return e.dbId})),console.log("Local vectors retrieved.",{vectors:r}),c=n.filter((function(e){return!r.includes(e)})),console.log("Vectors to pull from Vector DB to AI Engine.",{vectorsToPull:c}),c.length){e.next=35;break}return h(!1),alert("".concat(n.length," vectors were pulled from the remote database. They are already synchronized with the local database.")),e.abrupt("return");case 35:return u=c.map((function(e){return function(){var t=Zr(Xr().mark((function t(n){return Xr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,dt({envId:K,dbId:e},n);case 2:return t.next=4,a.invalidateQueries({queryKey:["vectors"]});case 4:return t.abrupt("return",{success:!0});case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()})),e.next=38,pe.start(u);case 38:h(!1),alert("All done! For more information, check the console (Chrome Developer Tools)."),pe.reset();case 41:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Fe=function(){var e=Zr(Xr().mark((function e(){var t,n,r,a,o=arguments;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>0&&void 0!==o[0]&&o[0],h("bulkPushAll"),n=[],!t&&0!==M.length){e.next=10;break}return e.next=6,vt(l,H.syncPostStatus);case 6:r=e.sent,n=r.map((function(e){return function(){var t=Zr(Xr().mark((function t(n){return Xr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Pe(null,e,n);case 2:return t.abrupt("return",{success:!0});case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()})),e.next=12;break;case 10:a=se.vectors.filter((function(e){return M.includes(e.id)})),n=a.map((function(e){return function(){var t=Zr(Xr().mark((function t(n){return Xr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("postId"!==e.type){t.next=5;break}return t.next=3,Pe(e.id,null,n);case 3:t.next=8;break;case 5:if("manual"!==e.type){t.next=8;break}return t.next=8,Se(e,n);case 8:return t.abrupt("return",{success:!0});case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()}));case 12:return e.next=14,pe.start(n);case 14:h(!1),alert("All done! For more information, check the console (Chrome Developer Tools). Posts with very short content (or content that could not be retrieved) are skipped."),pe.reset();case 17:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),De=function(){var e=Zr(Xr().mark((function e(){var t,n;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=prompt("Enter the Post ID to synchronize with:")){e.next=3;break}return e.abrupt("return");case 3:return h("singleRun"),e.prev=4,e.next=7,Pe(null,t);case 7:e.next=13;break;case 9:e.prev=9,e.t0=e.catch(4),console.error(e.t0),alert(null!==(n=null===e.t0||void 0===e.t0?void 0:e.t0.message)&&void 0!==n?n:e.t0);case 13:h(!1);case 14:case"end":return e.stop()}}),e,null,[[4,9]])})));return function(){return e.apply(this,arguments)}}(),Ge=oa((function(){var e;return React.createElement(React.Fragment,null,React.createElement("div",{style:{display:"flex"}},React.createElement(we.u,{scrolldown:!0,name:"environment",style:{flex:1,marginBottom:5},disabled:he,value:null!==(e=null==X?void 0:X.id)&&void 0!==e?e:null,onChange:function(e){q(e)}},W.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})})),!(null!=W&&W.length)&&React.createElement(we.j,{value:null,label:"None"}))))}),[X,W,he]),Ue=oa((function(){return null!=fe&&fe.message?React.createElement(Ne.X,{variant:"danger",style:{margin:"5px 5px"}},React.createElement("b",null,fe.message),React.createElement("br",null),React.createElement("small",null,"Check your Console Logs and PHP Error Logs for more information.")):"search"===g?He.HELP.NO_EMBEDDINGS_RESULTS:He.HELP.NO_EMBEDDINGS_ROWS}),[g,fe]);return React.createElement(React.Fragment,null,React.createElement(E.N,null,React.createElement(E.Y,{fullWidth:!0,minimal:!0,style:{margin:10}},React.createElement("div",{style:{display:"flex"}},React.createElement(qt.V,{style:{flex:1,marginRight:15}},React.createElement(Xt.S,{style:{marginRight:10},disabled:he,onLabel:He.EMBEDDINGS.AI_SEARCH,offLabel:He.EMBEDDINGS.EDIT,width:110,onValue:"search",offValue:"edit",checked:"search"===g,onChange:_,onBackgroundColor:o.purple,offBackgroundColor:o.green}),"edit"===g&&React.createElement(React.Fragment,null,React.createElement(w.M,{className:"primary",disabled:!X||he,onClick:function(){return D({type:"add",data:ut})}},"Add"))),React.createElement(qt.V,{style:{flex:"auto"}},"edit"===g&&React.createElement(React.Fragment,null,M.length>0&&React.createElement(React.Fragment,null,React.createElement(w.M,{className:"primary",disabled:he,isBusy:"bulkPushAll"===p,onClick:function(){return Fe(!1)}},"Sync Selected"),React.createElement(w.M,{className:"danger",disabled:he,onClick:Ie},He.COMMON.DELETE_SELECTED)),M.length>0&&React.createElement("div",{style:{display:"flex",alignItems:"center",marginLeft:10,marginRight:10}},M.length," selected"),React.createElement(Jt.j,{busy:pe.busy,style:{flex:"auto"},value:pe.value,max:pe.max,onStopClick:pe.stop})),"search"===g&&React.createElement("div",{style:{flex:"auto",display:"flex"}},React.createElement(Re.A,{style:{flex:"auto",marginRight:5},placeholder:"Search",disabled:!X||he,value:S,onChange:N,onEnter:be,onReset:Oe}),React.createElement(w.M,{className:"primary",onClick:be,disabled:!X||he||!S,isBusy:"searchVectors"===p},"Search"))))),React.createElement(E.Y,{minimal:!0,style:{flex:3}},React.createElement(R.z,{className:"primary",title:"Embeddings",action:React.createElement(React.Fragment,null,React.createElement("div",{style:{display:"flex",alignItems:"center"}},React.createElement(we.u,{scrolldown:!0,name:"debugMode",style:{width:180},disabled:he,value:U||null,onChange:B},React.createElement(we.j,{value:null,label:"Current Environment"}),React.createElement(we.j,{value:"includeOrphans",label:"With Orphans"}),React.createElement(we.j,{value:"includeAll",label:"All Envs & Orphans"})),React.createElement(w.M,{className:"secondary",style:{marginLeft:5},disabled:!X||me,onClick:function(){a.invalidateQueries({queryKey:["vectors"]})}},He.COMMON.REFRESH)))},React.createElement(Kt.o,{busy:he,sort:ie.sort,onSortChange:function(e,t){le(Qr(Qr({},ie),{},{sort:{accessor:e,by:t}}))},emptyMessage:Ue,data:ke,columns:de,onSelectRow:function(e){1===M.length&&M[0]===e&&P([]),P([e])},onSelect:function(e){P([].concat(qr(M),qr(e)))},onUnselect:function(e){P(qr(M.filter((function(t){return!e.includes(t)}))))},selectedItems:M}),React.createElement(_e.g,null),"search"!==g&&React.createElement("div",{style:{display:"flex"}},React.createElement("div",{style:{flex:"auto"}}),React.createElement(Qt.Q,{currentPage:ie.page,limit:ie.limit,onCurrentPageChanged:function(e){return le(Qr(Qr({},ie),{},{page:e}))},total:Ae,onClick:function(e){le(Qr(Qr({},ie),{},{page:e}))}}),React.createElement(w.M,{className:"primary",style:{marginLeft:5},disabled:!X,onClick:function(){D({type:"export",data:{envId:K}})}},He.COMMON.EXPORT))),React.createElement(R.z,{className:"primary",title:"Information"},React.createElement("p",null,React.createElement("b",null,"If want to discuss embeddings with other users, visit the ",React.createElement("a",{href:"https://discord.gg/bHDGh38",target:"_blank",rel:"noreferrer"},"Meow Apps Discord Server"),".")),React.createElement("p",null,"An embedding is a textual piece of data (sentence, paragraph, a whole article) that has been converted by OpenAI into a vector. Vectors can then be used to find the most relevant data for a given query. In this dashboard, you can create embeddings, and they will be synchronized with ",React.createElement("a",{target:"_blank",href:"https://www.pinecone.io/",rel:"noreferrer"},"Pinecone"),", a very fast and affordable vector database."),React.createElement("p",null,"You can switch from EDIT to AI SEARCH and you will be able to query the database, and get your content, with a score. You can edit the content and it will be synchronized with Pinecone. Then make your content perfect so that the results are satisfying! You can use Sync and Sync One, it will go through your posts and create the embeddings if they don't exist yet, or update them if they do."),React.createElement("p",null,"Both the chatbots and the AI Forms can use embeddings to enrich their answers."))),React.createElement(E.Y,{minimal:!0},React.createElement(R.z,{className:"primary"},Ge,React.createElement("div",{style:{display:"flex"}},React.createElement("div",{style:{flex:1,marginRight:5}},React.createElement("label",null,"Minimum Score:"),React.createElement("br",null),React.createElement("span",{style:{color:"var(--neko-green)"}},$,"%")),React.createElement("div",{style:{flex:1,marginLeft:5}},React.createElement("label",null,"Max Embedding(s):"),React.createElement("br",null),React.createElement("span",{style:{color:"var(--neko-green)"}},Q))),React.createElement("p",null,"The best ",Q," embedding(s) with a score of ",$," or more will provide additional context.")),"search"!==g&&React.createElement("div",{style:{margin:8}},React.createElement(d.s,{h2:!0,style:{color:"white",marginBottom:10}},He.EMBEDDINGS.SYNC_POSTS),React.createElement(b._,{inversed:!0},React.createElement(b.V,{title:"Push",inversed:!0},React.createElement($t.Z,{ref:Y,onSelectFiles:Ce,accept:""},React.createElement(w.M,{fullWidth:!0,className:"secondary",disabled:!X||he,onClick:function(){return Y.current.click()}},"Import CSV or JSON")),React.createElement(_e.g,{line:!0}),React.createElement("div",{style:{display:"flex",alignItems:"center"}},React.createElement(we.u,{id:"postType",scrolldown:!0,disabled:he,name:"postType",style:{width:100},onChange:c,value:l},null==te?void 0:te.map((function(e){return React.createElement(we.j,{key:e.type,value:e.type,label:e.name})}))),React.createElement(w.M,{fullWidth:!0,className:"primary",style:{marginLeft:10},disabled:!X||he,isBusy:"bulkPushAll"===p,onClick:function(){return Fe(!0)}},He.EMBEDDINGS.SYNC_ALL," ",!re&&React.createElement(React.Fragment,null,"(","".concat(ae),")"))),React.createElement(_e.g,{tiny:!0}),React.createElement(w.M,{fullWidth:!0,className:"primary",disabled:!X||he,isBusy:"singleRun"===p,onClick:De},He.EMBEDDINGS.SYNC_ONE)),React.createElement(b.V,{title:"Pull",inversed:!0},React.createElement(w.M,{fullWidth:!0,className:"primary",disabled:!X||he,isBusy:"bulkPullAll"===p,onClick:function(){return je()}},He.EMBEDDINGS.SYNC_ALL)),React.createElement(b.V,{title:"Settings",inversed:!0},React.createElement(y.R,{label:He.EMBEDDINGS.REWRITE_CONTENT,disabled:p,checked:H.rewriteContent,onChange:function(e){ye(Qr(Qr({},H),{},{rewriteContent:e}))},description:He.EMBEDDINGS.REWRITE_CONTENT_DESCRIPTION}),H.rewriteContent&&React.createElement(React.Fragment,null,React.createElement(_e.g,null),React.createElement(Wt.m,{value:H.rewritePrompt,rows:5,disabled:p,onBlur:function(e){ye(Qr(Qr({},H),{},{rewritePrompt:e}))},description:He.EMBEDDINGS.REWRITE_PROMPT_DESCRIPTION}),React.createElement(_e.g,null)),React.createElement(y.R,{label:He.EMBEDDINGS.FORCE_RECREATE,checked:H.forceRecreate,disabled:p,onChange:function(e){ye(Qr(Qr({},H),{},{forceRecreate:e}))},description:He.EMBEDDINGS.FORCE_RECREATE_DESCRIPTION})))),"search"!==g&&React.createElement("div",{style:{margin:"20px 8px 8px 8px"}},React.createElement(d.s,{h2:!0,style:{color:"white",marginBottom:10}},He.EMBEDDINGS.AUTO_SYNC_POSTS),React.createElement(b._,{inversed:!0},React.createElement(b.V,{title:"Status",inversed:!0},Ee),React.createElement(b.V,{title:"Settings",inversed:!0},Ee,X&&ve&&React.createElement(React.Fragment,null,React.createElement(_e.g,{tiny:!0}),React.createElement(Ne.X,{variant:"danger",style:{padding:"10px 20px",marginBottom:5}},"The currently selected environment is not used for Auto-Sync. Do you want to use this one?"),React.createElement(w.M,{fullWidth:!0,className:"primary",disabled:he,onClick:function(){return ye(Qr(Qr({},H),{},{syncPostsEnvId:K}))},style:{flex:1}},"Use Current Environment"),React.createElement(_e.g,{tiny:!0})),React.createElement(_e.g,{tiny:!0}),React.createElement(y.R,{label:He.EMBEDDINGS.AUTO_SYNC_POSTS,checked:H.syncPosts,disabled:p,onChange:function(e){ye(Qr(Qr({},H),{},{syncPosts:e}))},description:He.EMBEDDINGS.AUTO_SYNC_POSTS_DESCRIPTION}),H.syncPosts&&React.createElement(React.Fragment,null,React.createElement(_e.g,null),React.createElement(Re.A,{name:"syncPostTypes",value:H.syncPostTypes,isCommaSeparatedArray:!0,description:He.HELP.POST_TYPES,onBlur:function(e){ye(Qr(Qr({},H),{},{syncPostTypes:e}))}}),React.createElement(_e.g,null),React.createElement(Re.A,{name:"syncPostStatus",value:H.syncPostStatus||"publish",isCommaSeparatedArray:!0,description:He.HELP.POST_STATUS,onBlur:function(e){ye(Qr(Qr({},H),{},{syncPostStatus:e}))}}),React.createElement(_e.g,null),React.createElement(Re.A,{name:"syncPostCategories",value:H.syncPostCategories||"publish",isCommaSeparatedArray:!0,description:He.HELP.POST_CATEGORIES,onBlur:function(e){ye(Qr(Qr({},H),{},{syncPostCategories:e}))}}))))))),React.createElement(xr,{modal:F,setModal:D,busy:p,onAddEmbedding:xe,onModifyEmbedding:Se}),React.createElement(Mr,{modal:F,setModal:D,busy:p}),React.createElement(Vr,{modal:F,setModal:D,busy:p,onAddEmbedding:xe,onModifyEmbedding:Se}),pe.TasksErrorModal)};var ma=n(2262),da=n(4731);function pa(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ha(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)?ha(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 ha(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 ya=wp.element,va=ya.useState,ga=ya.useMemo;ma.t1.register(ma.PP,ma.kc,ma.E8,ma.m_,ma.s$);var Ea=function(e){var t=e.month,n=e.usageData;return 0===n[t].length?React.createElement("div",{style:{width:"calc(100% - 36px)",margin:"5px 18px 0px 18px",fontStyle:"italic"}},"No data available."):React.createElement("table",{style:{width:"calc(100% - 36px)",margin:"5px 18px 0px 18px",borderCollapse:"collapse"}},React.createElement("tbody",null,n[t].map((function(e,t){var n=e.isImage?"images":e.isAudio?"seconds":"tokens",r=e.units.toLocaleString();return React.createElement("tr",{key:t},React.createElement("td",{style:{paddingRight:10}},"Unknown Model"===e.name?"⚠️ ".concat(e.rawName):e.name),React.createElement("td",{style:{textAlign:"right",paddingRight:10}},r),React.createElement("td",{style:{paddingRight:10}},n),React.createElement("td",{style:{textAlign:"right"}},e.price>0?"".concat(e.price.toFixed(4),"$"):"-"))}))))};const ba=function(e){var t=e.options,n=ft(t,null,!0),r=n.models,a=n.getModel,o=n.calculatePrice,i=null==t?void 0:t.ai_models_usage,l=(0,s.z)().colors,c=pa(va("model"),2),u=c[0],f=c[1],m=pa(va("tokens"),2),d=m[0],p=m[1],h=ga((function(){var e={};return Object.keys(i).forEach((function(t){var n=i[t];e[t]||(e[t]=[]);var r={};Object.keys(n).forEach((function(e){var t=n[e],i=a(e),l=null,c=null,u=!1,s=!1;i?"image"===i.type?(c=(null==t?void 0:t.images)||0,s=!0):"second"===i.type?(c=(null==t?void 0:t.seconds)||0,u=!0):(l=(null==t?void 0:t.prompt_tokens)||0,c=(null==t?void 0:t.completion_tokens)||0):(l=(null==t?void 0:t.prompt_tokens)||0,c=(null==t?void 0:t.completion_tokens)||0);var f=i?o(e,l,c):0,m=i?i.rawName:"Unknown Model",d=e;r[m]||(r[m]={name:m,rawName:d,units:0,price:0,isImage:s,isAudio:u,family:i?i.family:null}),r[m].units+=s?c:l+c,r[m].price+=f})),e[t]=Object.values(r),e[t].sort((function(e,t){return t.price-e.price}))})),e}),[i,r]),y=ga((function(){var e=Object.keys(h),t=[],n=[l.blue,l.green,l.yellow,l.orange,l.red,l.purple];if("model"===u){r.forEach((function(r,a){var o=r.rawName,i=e.map((function(e){var t,n=null===(t=h[e])||void 0===t?void 0:t.find((function(e){return e.name===o||e.rawName===o}));return"tokens"===d?n?Math.max(n.units,1):0:n?Math.max(n.price,.01):0}));i.some((function(e){return e>0}))&&t.push({label:o,data:i,backgroundColor:n[a%n.length]})}));var a=e.map((function(e){var t;return(null===(t=h[e])||void 0===t?void 0:t.filter((function(e){return"Unknown Model"===e.name}))).reduce((function(e,t){return e+("tokens"===d?Math.max(t.units,1):Math.max(t.price,.01))}),0)}));a.some((function(e){return e>0}))&&t.push({label:"Unknown Model",data:a,backgroundColor:"rgba(128, 128, 128, 0.5)"})}else if("family"===u){var o={};e.forEach((function(t){h[t].forEach((function(n){var r=n.family;if(r){o[r]||(o[r]=Array(e.length).fill(0));var a="tokens"===d?Math.max(n.units,1):Math.max(n.price,.01),i=e.indexOf(t);o[r][i]+=a}}))})),Object.keys(o).forEach((function(e,r){t.push({label:e,data:o[e],backgroundColor:n[r%n.length]})}))}return{labels:e,datasets:t}}),[h,r,u,d,l]),v=ga((function(){var e={};y.datasets.forEach((function(t){var n=t.label;e[n]||(e[n]=0),t.data.forEach((function(t){e[n]+=t}))}));var t=Object.entries(e).sort((function(e,t){var n=pa(e,2)[1];return pa(t,2)[1]-n})).slice(0,8).map((function(e){return pa(e,1)[0]}));return y.datasets.filter((function(e){return t.includes(e.label)}))}),[y]),g={plugins:{legend:{position:"bottom",labels:{filter:function(e){return v.some((function(t){return t.label===e.text}))}}}},responsive:!0,scales:{x:{stacked:!0},y:{stacked:!0}}};return React.createElement(React.Fragment,null,i&&Object.keys(i).length>0&&React.createElement(React.Fragment,null,React.createElement(Vt.o,{name:"groupBy",value:"".concat(u,"-").concat(d),onChange:function(e){var t=pa(e.split("-"),2),n=t[0],r=t[1];f(n),p(r)}},React.createElement(Vt.K,{title:"Units by Model",value:"model-tokens"}),React.createElement(Vt.K,{title:"Price by Model",value:"model-price"}),React.createElement(Vt.K,{title:"Units by Family",value:"family-tokens"}),React.createElement(Vt.K,{title:"Price by Family",value:"family-price"})),React.createElement(_e.g,{size:"medium"}),React.createElement(da.yP,{options:g,data:y}),React.createElement(_e.g,{size:"medium"}),React.createElement(Se.a,{keepState:"monthlyUsageCategories"},Object.keys(h).reverse().map((function(e,t){return React.createElement(Se.Y,{key:t,title:"🗓️ ".concat(e," (").concat(h[e].reduce((function(e,t){return e+t.price}),0).toFixed(2),"$)")},React.createElement(Ea,{month:e,usageData:h}))})))))};var wa=n(6841);function Ra(e){return Ra="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},Ra(e)}function Oa(){Oa=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Ra(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Ra(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 _a(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function xa(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){_a(o,r,a,i,l,"next",e)}function l(e){_a(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Sa(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ta(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)?Ta(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 Ta(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 Na=wp.element.useState;function Ca(e,t){var n=new Blob([e],{type:"text/plain;charset=utf-8;"}),r=document.createElement("a");r.href=URL.createObjectURL(n),r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r)}const Ia=function(e){var t=e.modal,n=e.setModal,r=Sa(Na(!1),2),a=r[0],o=r[1],i=Sa(Na(0),2),l=i[0],c=i[1],u=Sa(Na(0),2),s=u[0],f=u[1],m=function(){var e=xa(Oa().mark((function e(){var t,n,r,a,i,l;return Oa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,o(!0),e.next=4,d();case 4:t=e.sent,n=(0,O.F1)(t,2),r=new Date,a=r.getFullYear(),i=r.getMonth()+1,l=r.getDate(),Ca(n,"discussions-".concat(a,"-").concat(i,"-").concat(l,".json")),setTimeout((function(){c(0)}),1e3),e.next=18;break;case 14:e.prev=14,e.t0=e.catch(0),console.error(e.t0),alert("An error occured while exporting discussions. Check your console.");case 18:return e.prev=18,o(!1),e.finish(18);case 21:case"end":return e.stop()}}),e,null,[[0,14,18,21]])})));return function(){return e.apply(this,arguments)}}(),d=function(){var e=xa(Oa().mark((function e(){var t,n,r,a;return Oa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=!1,n={page:1,limit:20,filters:{}},r=[],a=Oa().mark((function e(){var a;return Oa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,pt(n);case 2:(a=e.sent).chats.length<2&&(t=!0),c((function(){return a.total})),a.chats.forEach((function(e){e.messages=JSON.parse(e.messages),e.extra=JSON.parse(e.extra)})),r=r.concat(a.chats),f((function(){return r.length})),n.page++;case 9:case"end":return e.stop()}}),e)}));case 4:if(t){e.next=8;break}return e.delegateYield(a(),"t0",6);case 6:e.next=4;break;case 8:return e.abrupt("return",r);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return React.createElement(React.Fragment,null,React.createElement(Te.n,{isOpen:"export"===(null==t?void 0:t.type),title:"Export Discussions",onRequestClose:function(){return n(null)},okButton:{label:"Close",disabled:a,onClick:function(){return n(null)}},customButtons:React.createElement(React.Fragment,null,React.createElement(w.M,{onClick:m,disabled:a},"Export JSON")),content:React.createElement(React.Fragment,null,React.createElement(Jt.j,{busy:a,style:{flex:"auto"},value:s,max:l}))}))};function Aa(e){return Aa="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},Aa(e)}var ka,La,Ma,Pa,ja=["children"],Fa=["children"],Da=["children"];function Ga(e){return function(e){if(Array.isArray(e))return Ka(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Va(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 Ua(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 Ba(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ua(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=Aa(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Aa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==Aa(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ua(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ha(){Ha=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Aa(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Aa(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Ya(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function za(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Ya(o,r,a,i,l,"next",e)}function l(e){Ya(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Wa(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||Va(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 Va(e,t){if(e){if("string"==typeof e)return Ka(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)?Ka(e,t):void 0}}function Ka(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 qa(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Xa(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var $a=wp.element,Qa=$a.useMemo,Ja=$a.useState,Za=$a.useEffect,eo=G.Ay.div(ka||(ka=Xa(["\n  font-size: 12px;\n  border-bottom: 1px solid black;\n"]))),to=G.Ay.span(La||(La=Xa(["\n  font-weight: bold;\n  text-transform: uppercase;\n"]))),no=G.Ay.div(Ma||(Ma=Xa(["\n  font-size: 12px;\n  color: #bdb8b8;\n  background: #eeeeee;\n  padding: 2px 8px;\n"]))),ro=G.Ay.div(Pa||(Pa=Xa(["\n  font-size: 14px;\n  padding: 10px;\n  border: 1px solid #eaeaea;\n  background: #f5f5f5;\n  color: #333333;\n  word-break: break-word;\n  overflow-wrap: break-word;\n  word-wrap: break-word;\n  hyphens: auto;\n\n  img {\n    max-width: 100%;\n    height: auto;\n  }\n\n  a {\n    color: #333333;\n    text-decoration: underline;\n  }\n\n  a:hover {\n    color: #333333;\n    text-decoration: none;\n  }\n\n  blockquote {\n    border-left: 4px solid #dddddd;\n    padding-left: 10px;\n    margin-left: 0;\n    font-style: italic;\n  }\n\n  pre {\n    background: #eeeeee;\n    padding: 10px;\n    border-radius: 5px;\n    overflow-x: auto;\n    text-wrap: pretty;\n  }\n\n  code {\n    background: #eeeeee;\n    padding: 2px 5px;\n    border-radius: 5px;\n  }\n\n  table {\n    border-collapse: collapse;\n    width: 100%;\n    margin-bottom: 10px;\n  }\n  \n  table td, table th {\n    border: 1px solid #dddddd;\n    text-align: left;\n    padding: 5px;\n  }\n\n  table tr:nth-child(even) {\n    background-color: #dddddd;\n  }\n\n  .mwai-dead-image {\n    color: #ab5252;\n    background: #ffd2d2;\n    padding: 8px 8px;\n    text-align: center;\n  }\n"]))),ao={overrides:{object:{component:function(e){var t=e.children,n=qa(e,ja);return"<object ".concat(Object.keys(n).map((function(e){return"".concat(e,'="').concat(n[e],'"')})).join(" "),">").concat(t,"</object>")}},script:{component:function(e){var t=e.children,n=qa(e,Fa);return"<script ".concat(Object.keys(n).map((function(e){return"".concat(e,'="').concat(n[e],'"')})).join(" "),">").concat(t,"<\/script>")}},iframe:{component:function(e){var t=e.children,n=qa(e,Da);return"<iframe ".concat(Object.keys(n).map((function(e){return"".concat(e,'="').concat(n[e],'"')})).join(" "),">").concat(t,"</iframe>")}}}},oo=function(e){var t=e.content,n=Wa(Ja(t||""),2),r=n[0],a=n[1],o=function(e){return new Promise((function(t){var n=new Image;n.onload=function(){return t(!0)},n.onerror=function(){return t(!1)},n.src=e}))},i=function(){var e=za(Ha().mark((function e(t){var n,r,i,l;return Ha().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=/!\[.*?\]\((.*?)\)/g,r=t;case 2:if(null===(i=n.exec(t))){e.next=10;break}return l=i[1],e.next=6,o(l);case 6:e.sent||(r=r.replace(i[0],'<div class="mwai-dead-image">Image not available</div>')),e.next=2;break;case 10:a(r);case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();Za((function(){t&&i(t)}),[t]);var l=Qa((function(){var e="";try{e=(0,wa.cx)(r,ao)}catch(t){console.error("Crash in markdown-to-jsx! Reverting to plain text.",{e:t,processedContent:r}),e=r}return e}),[r]);return React.createElement(ro,null,l)},io=function(e){var t,n,r,a,o=e.message,i=null!=o&&null!==(t=o.extra)&&void 0!==t&&t.embeddings?null==o||null===(n=o.extra)||void 0===n?void 0:n.embeddings:null!=o&&null!==(r=o.extra)&&void 0!==r&&r.embedding?[null==o||null===(a=o.extra)||void 0===a?void 0:a.embedding]:[];return React.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:5}},React.createElement(eo,null,React.createElement(to,null,o.role||o.type)),(null==i?void 0:i.length)>0&&React.createElement(no,null,i.map((function(e){return React.createElement("div",{key:i.id},React.createElement("span",null,e.title)," (",React.createElement("span",null,(100*e.score.toFixed(4)).toFixed(2)),")")}))),React.createElement(oo,{content:o.content||o.text}))},lo=function(){var e=za(Ha().mark((function e(){var t,n,r=arguments;return Ha().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:[],e.next=3,(0,O.IU)("".concat(T,"/discussions/delete"),{nonce:k,method:"POST",json:{chatIds:t}});case 3:return n=e.sent,e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();const co=function(){var e,t,n,r,a,o,i,l,c,s=(0,u.jE)(),m=Wa(Ja({type:null,data:null}),2),d=m[0],p=m[1],h=Wa(Ja(!1),2),v=h[0],g=h[1],b=Wa(Ja(!1),2),O=b[0],_=b[1],x=(0,f.I)({queryKey:["chatbots"],queryFn:hn,initialData:F}).data,S=Qa((function(){return[{accessor:"updated",title:"Time",width:"80px",sortable:!0},{accessor:"user",title:"User",width:"85px",filters:{type:"text",description:He.HELP.USER_FILTER}},{accessor:"botId",title:"Chatbot",width:"85px",filters:{type:"select",options:x.map((function(e){return{value:e.botId,label:e.name}}))}},{accessor:"preview",title:He.COMMON.PREVIEW,filters:{type:"text"}},{accessor:"messages",title:"#",width:"45px"}]}),[x]),T=Wa(Ja((function(){return S.filter((function(e){return e.filters})).map((function(e){return{accessor:e.accessor,value:null}}))})),2),N=T[0],C=T[1],I=Wa(Ja([]),2),A=I[0],k=I[1],L=Wa(Ja({filters:N,sort:{accessor:"created",by:"desc"},page:1,limit:10}),2),M=L[0],P=L[1],j=(0,f.I)({queryKey:["chats",M],queryFn:function(){return pt(M)},refetchInterval:O?5e3:null}),D=j.isFetching,G=j.data,U=j.error;Za((function(){P(Ba(Ba({},M),{},{filters:N}))}),[N]);var B=Qa((function(){return(null==G?void 0:G.total)||0}),[G]),H=Qa((function(){return null!=G&&G.chats?null==G?void 0:G.chats.sort((function(e,t){return t.created_at-e.created_at})).map((function(e){var t,n,r,a,o=JSON.parse(e.messages),i=JSON.parse(e.extra),l=bt(e.created),c=bt(e.updated),u=wt(null!==(t=e.userId)&&void 0!==t?t:null==i?void 0:i.userId,null!==(n=e.ip)&&void 0!==n?n:null==i?void 0:i.ip),s=null==o?void 0:o.filter((function(e){return"user"===e.role||"user"===e.type})),f=null!=s&&s.length?s[0].content||s[0].text:"",m=null!=s&&s.length?s[s.length-1].content||s[s.length-1].text:"",d=null===(r=x.find((function(t){return t.botId===e.botId})))||void 0===r?void 0:r.name;return{id:e.id,botId:React.createElement(React.Fragment,null,React.createElement("div",null,d),React.createElement("div",null,React.createElement("small",null,React.createElement("i",null,e.botId)))),user:u,messages:null!==(a=null==o?void 0:o.length)&&void 0!==a?a:0,preview:React.createElement(React.Fragment,null,React.createElement("div",null,f),React.createElement("small",null,m)),extra:i.model,created:React.createElement("div",{style:{textAlign:"right"}},l),updated:React.createElement("div",{style:{textAlign:"right"}},c)}})):[]}),[G]),Y=Qa((function(){if(1!==(null==A?void 0:A.length))return null;var e=null==G?void 0:G.chats.find((function(e){return e.id===A[0]}));if(!e)return null;var t=[],n={};try{t=JSON.parse(e.messages),n=JSON.parse(e.extra)}catch(t){console.error("Could not parse discussion messages or extra.",{e:t,currentDiscussion:e})}return{id:e.id,chatId:e.chatId,botId:e.botId,messages:t,extra:n,created:e.created,updated:e.updated}}),[A,G]),z=function(){var e=za(Ha().mark((function e(){var t,n;return Ha().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g(!0),A.length){e.next=9;break}if(window.confirm(He.ALERTS.ARE_YOU_SURE)){e.next=5;break}return g(!1),e.abrupt("return");case 5:return e.next=7,lo();case 7:e.next=14;break;case 9:return t=null==G?void 0:G.chats.filter((function(e){return A.includes(e.id)})),n=t.map((function(e){return e.chatId})),e.next=13,lo(n);case 13:k([]);case 14:return e.next=16,s.invalidateQueries({queryKey:["chats"]});case 16:s.refetchQueries({queryKey:["chats"]}),g(!1);case 18:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),W=Qa((function(){return React.createElement("div",null,React.createElement("div",{style:{display:"flex",flexDirection:"row"}},React.createElement(Qt.Q,{currentPage:M.page,limit:M.limit,onCurrentPageChanged:function(e){return P(Ba(Ba({},M),{},{page:e}))},total:B,onClick:function(e){P(Ba(Ba({},M),{},{page:e}))}}),React.createElement(w.M,{className:"primary",style:{marginLeft:5},onClick:function(){p({type:"export",data:{}})}},He.COMMON.EXPORT)))}),[M,B]),V=Qa((function(){return null!=U&&U.message?React.createElement(Ne.X,{variant:"danger",style:{margin:"5px 5px"}},React.createElement("b",null,U.message),React.createElement("br",null),React.createElement("small",null,"Check your Console Logs and PHP Error Logs for more information.")):null}),[U]),K=bt(null==Y?void 0:Y.created),q=bt(null==Y?void 0:Y.updated);return React.createElement(React.Fragment,null,React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0,style:{flex:2}},React.createElement(R.z,{className:"primary",title:He.COMMON.DISCUSSIONS,action:React.createElement(React.Fragment,null,React.createElement("div",null,!O&&React.createElement(w.M,{className:"secondary",style:{marginLeft:5},disabled:D,onClick:za(Ha().mark((function e(){return Ha().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.invalidateQueries({queryKey:["chats"]});case 2:s.refetchQueries({queryKey:["chats"]});case 3:case"end":return e.stop()}}),e)})))},He.COMMON.REFRESH),A.length>0&&React.createElement(React.Fragment,null,React.createElement(w.M,{className:"danger",disabled:!1,onClick:z},He.COMMON.DELETE))))},React.createElement(Kt.o,{busy:!O&&D||v,sort:M.sort,onSortChange:function(e,t){P(Ba(Ba({},M),{},{sort:{accessor:e,by:t}}))},emptyMessage:V,filters:N,onFilterChange:function(e,t){var n=[].concat(Ga(N.filter((function(t){return t.accessor!==e}))),[{accessor:e,value:t}]);C(n)},data:H,columns:S,selectedItems:A,onSelectRow:function(e){1!==A.length||A[0]!==e?k([e]):k([])},onSelect:function(e){k([].concat(Ga(A),Ga(e)))},onUnselect:function(e){k(Ga(A.filter((function(t){return!e.includes(t)}))))}}),React.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:10}},React.createElement(w.M,{className:"danger",disabled:A.length,style:{marginRight:10},onClick:z},He.COMMON.DELETE_ALL),React.createElement(y.R,{name:"auto-refresh",label:"Auto Refresh",value:"1",checked:O,style:{width:180},onChange:function(){return _(!O)}}),React.createElement("div",{style:{flex:"auto"}}),W))),React.createElement(E.Y,{minimal:!0,style:{flex:1}},React.createElement(R.z,{className:"primary",title:"Selected Discussion",action:React.createElement(React.Fragment,null)},!Y&&React.createElement("div",{style:{textAlign:"center",padding:10}},"No discussion selected."),null==Y||null===(e=Y.messages)||void 0===e?void 0:e.map((function(e,t){return React.createElement(io,{key:t,message:e})}))),!!Y&&React.createElement(R.z,{className:"primary",title:"Information"},React.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:5}},React.createElement("div",{style:{fontWeight:"bold"}},"Model"),React.createElement("div",null,null==Y||null===(t=Y.extra)||void 0===t?void 0:t.model)),React.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:5}},React.createElement("div",{style:{fontWeight:"bold"}},"Bot ID (or Custom ID)"),React.createElement("div",null,null==Y?void 0:Y.botId)),(null==Y||null===(n=Y.extra)||void 0===n?void 0:n.context)&&React.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:5}},React.createElement("div",{style:{fontWeight:"bold"}},"Context"),React.createElement("div",null,null==Y||null===(r=Y.extra)||void 0===r?void 0:r.context)),(null==Y||null===(a=Y.extra)||void 0===a?void 0:a.assistantId)&&React.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:5}},React.createElement("div",{style:{fontWeight:"bold"}},"Assistant ID"),React.createElement("div",null,null==Y||null===(o=Y.extra)||void 0===o?void 0:o.assistantId)),(null==Y||null===(i=Y.extra)||void 0===i?void 0:i.threadId)&&React.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:5}},React.createElement("div",{style:{fontWeight:"bold"}},"Thread ID"),React.createElement("div",null,null==Y||null===(l=Y.extra)||void 0===l?void 0:l.threadId)),React.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:5}},React.createElement("div",{style:{fontWeight:"bold"}},"Chat ID"),React.createElement("div",null,null==Y?void 0:Y.chatId)),React.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:5}},React.createElement("div",{style:{fontWeight:"bold"}},"Session"),React.createElement("div",null,null==Y||null===(c=Y.extra)||void 0===c?void 0:c.session)),React.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:5}},React.createElement("div",{style:{fontWeight:"bold"}},"Created"),React.createElement("div",null,K)),React.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:5}},React.createElement("div",{style:{fontWeight:"bold"}},"Updated"),React.createElement("div",null,q))))),React.createElement(Ia,{modal:d,setModal:p,busy:v}))};var uo,so,fo;function mo(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var po=G.Ay.div(uo||(uo=mo(["\n  background: white;\n  padding: 15px;\n  border-radius: 5px;\n\n  h2 {\n    margin-bottom: 8px;\n  }\n  \n  h2:first-child, h3:first-child {\n    margin-top: 0;\n  }\n\n  label {\n    display: block;\n    margin-bottom: 5px;\n  }\n\n  label {\n    margin-top: 10px;\n  }\n\n  ul {\n    margin: 20px 0 0 0;\n  }\n\n  li {\n    margin-bottom: 5px;\n    border: 1px solid #e5e5e5;\n    padding: 8px;\n    background: #f5f5f5;\n    border-radius: 5px;\n    cursor: pointer;\n    position: relative;\n\n    &:last-child {\n      margin-bottom: 0;\n    }\n\n    &:hover {\n      background: #e5e5e5;\n    }\n\n    &.active {\n      background: #007cba;\n      color: white;\n      border-color: #007cba;\n\n      &.modified {\n        background: #ff8c00;\n        border-color: #ff8c00;\n      }\n    }\n  }\n\n  .information {\n    color: #a3a3a3;\n    margin-top: 5px;\n    font-size: 12px;\n    line-height: 100%;\n  }\n"]))),ho=(0,G.Ay)(Re.A)(so||(so=mo(["\n  flex: auto !important;\n\n  input {\n    height: 50px !important;\n    font-size: 13px !important;\n    font-family: monospace !important;\n    padding: 20px !important;\n    border-color: #333d4e !important;\n    background: #333d4e !important;\n    color: white !important;\n  }\n"]))),yo=G.Ay.div(fo||(fo=mo(["\n  display: flex;\n  flex-direction: column;\n\n  label {\n    margin-bottom: 3px;\n  }\n\n  .mwai-builder-row {\n    margin-top: 10px;\n    display: flex;\n    flex-direction: row;\n\n    .neko-color-picker {\n      margin-left: 5px;\n    }\n  }\n\n  .mwai-builder-col {\n    flex: 1;\n    display: flex;\n    flex-direction: column;\n    margin-right: 5px;\n  }\n\n  .mwai-builder-col:last-child {\n    margin-right: 0;\n  }\n\n  pre {\n    white-space: pre-wrap;\n    background: #d4f0ff;\n    color: #037cba;\n    padding: 10px;\n    font-size: 13px;\n    font-weight: bold;\n    margin: 10px 0 10px 0;\n  }\n\n  .neko-spacer {\n    margin-bottom: 0 !important;\n  }\n\n  .neko-input {\n  }\n\n  .nui-select-option {\n  }\n\n\n"]))),vo=["model","maxTokens","onRecommendedClick"];var go=wp.element.useMemo;const Eo=function(e){var t=e.model,n=e.maxTokens,r=e.onRecommendedClick,a=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,vo),o=null==t?void 0:t.maxContextualTokens,i=null==t?void 0:t.maxCompletionTokens,l=null==t?void 0:t.maxTokens,c=!!r;n=Math.floor(parseInt(n),0);var u=go((function(){return t?i||(o?Math.floor(o/2):l?Math.floor(l/2):null):null}),[i,o,l]),s=go((function(){return t?u===n?"var(--neko-green)":n>i?"var(--neko-red)":"var(--neko-yellow)":null}),[i,n,u]);return React.createElement("span",a,!(null==t||!t.maxContextualTokens)&&React.createElement(React.Fragment,null,"Contextual: ",null==t?void 0:t.maxContextualTokens,React.createElement("br",null)),!(null==t||!t.maxCompletionTokens)&&React.createElement(React.Fragment,null,"Completion: ",null==t?void 0:t.maxCompletionTokens,React.createElement("br",null)),!(null!=t&&t.maxCompletionTokens)&&!(null==t||!t.maxTokens)&&React.createElement(React.Fragment,null,"Total Max Tokens: ",null==t?void 0:t.maxTokens,React.createElement("br",null)),!!u&&React.createElement(React.Fragment,null,"Recommended: ",React.createElement("b",{onClick:c?function(){return r(u)}:null,style:{color:s,cursor:c?"pointer":"inherit"}},u,n>i&&React.createElement(React.Fragment,null,"❗️")),React.createElement("br",null)))};var bo,wo=["currentChatbot","isCustom","defaultChatbot"];function Ro(){Ro=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==_o(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(_o(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Oo(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function _o(e){return _o="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},_o(e)}function xo(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return So(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)?So(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 So(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 To=wp.element,No=To.useState,Co=To.useMemo,Io=G.Ay.div(bo||(bo=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n  pre {\n    display: flex;\n    align-items: center;\n    background: #f8fcff;\n    color: #779bb8;\n    margin: 0px;\n    padding: 3px 8px;\n    font-size: 13px;\n    border: 2px solid rgb(210 228 243);\n    border-radius: 5px;\n    font-family: system-ui;\n    cursor: pointer;\n    font-weight: 500;\n  }\n\n  .mwai-name {\n    font-style: italic;\n  }\n\n  .mwai-value {\n    color: var(--neko-green);\n  }\n\n  .skipped-params {\n    margin-top: 10px;\n    color: #ff4d4f;\n  }\n"]))),Ao=function(e){return"string"!=typeof e?e:e.replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/\n/g,"\\n").replace(/\[/g,"&#91;").replace(/\]/g,"&#93;")};const ko=function(e){var t,n=e.currentChatbot,r=e.isCustom,a=void 0!==r&&r,o=e.defaultChatbot,i=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,wo),l=xo(No(null),2),c=l[0],u=l[1],s=Co((function(){if(!n)return{shortcodeHtml:null,shortcodeText:null,skipped:[]};var e,t=[],r=[];if(a){for(var i in n){var l=n[i];if(null==l||"botId"===i||"name"===i||""===l||o&&o[i]===l||"object"===_o(l)||Array.isArray(l)&&0===l.length)"object"===_o(l)&&Array.isArray(l)&&0!==l.length&&r.push(i);else{var c=Ao(l),u=i.replace(/([A-Z])/g,(function(e){return"_".concat(e.toLowerCase())}));t.push("".concat(u,'="').concat(c,'"'))}}e="[mwai_chatbot"+(t.length?" ".concat(t.join(" ")):"")+"]"}else{var s,f=null!==(s=n.botId)&&void 0!==s?s:"default";t.push('id="'.concat(f,'"')),e='[mwai_chatbot id="'.concat(f,'"]')}var m=React.createElement("span",null,"[mwai_chatbot"," ",t.map((function(e,n){var r=xo(e.split("="),2),a=r[0],o=r[1];return React.createElement("span",{key:n},React.createElement("span",{className:"mwai-name"},a),"=",React.createElement("span",{className:"mwai-value"},o),n<t.length-1?" ":"")})),"]");return{shortcodeHtml:m,shortcodeText:e,skipped:r}}),[n,a,o]),f=null!==(t=null==s?void 0:s.skipped)&&void 0!==t?t:[],m=function(){var e,t=(e=Ro().mark((function e(){return Ro().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.clipboard){e.next=3;break}return alert("Clipboard is not enabled (only works with https)."),e.abrupt("return");case 3:return e.next=5,navigator.clipboard.writeText(s.shortcodeText);case 5:u("Copied!"),setTimeout((function(){u(null)}),2e3);case 7:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Oo(o,r,a,i,l,"next",e)}function l(e){Oo(o,r,a,i,l,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}();return n?React.createElement(Io,i,React.createElement("pre",{onClick:m},!c&&s.shortcodeHtml,c&&React.createElement("span",null,c)),f.length>0&&React.createElement("div",{className:"skipped-params"},"Skipped parameters: ",f.join(", "))):null};var Lo=n(7678);function Mo(e){return Mo="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},Mo(e)}var Po=["themes","shortcodeParams","updateShortcodeParams","defaultChatbot","blockMode","deleteCurrentChatbot","resetCurrentChatbot","duplicateCurrentChatbot","options"];function jo(){return jo=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},jo.apply(this,arguments)}function Fo(){Fo=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Mo(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Mo(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Do(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Go(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 Uo=wp.element,Bo=Uo.useMemo,Ho=Uo.useState,Yo=Uo.useEffect,zo="drop-shadow(0 0 5px rgba(0,0,0,0.1))",Wo=["chat-openai.svg","chat-robot-1.svg","chat-robot-2.svg","chat-nyao-1.svg","chat-nyao-2.svg","chat-nyao-3.svg","chat-color-blue.svg","chat-color-green.svg","chat-color-red.svg","chat-traditional-1.svg","chat-traditional-2.svg","avatar-user.svg","avatar-woman-blond.svg","avatar-woman-indian.svg","avatar-woman-asian.svg","avatar-woman-doctor.svg","avatar-man-blond.svg","avatar-man-black.svg","avatar-man-sunglasses.svg","avatar-man-pirate.svg"],Vo=function(e){var t=e.label,n=e.valueName,r=e.updateShortcodeParams,a=e.icon||"chat-color-green.svg",o=(0,Lo.Ve)(a),i=o||(null==a?void 0:a.startsWith("https://"))||(null==a?void 0:a.startsWith("http://")),l=i?a:"".concat(N,"/images/").concat(a);return React.createElement(React.Fragment,null,React.createElement("div",{className:"mwai-builder-row"},React.createElement("label",null,t,":")),React.createElement("div",{style:{marginTop:0,border:"1.5px solid #d2e4f3",borderRadius:5,padding:"10px 10px 10px 10px",background:"#f5fcff"}},React.createElement("div",{className:"mwai-builder-row",style:{marginTop:0}},React.createElement("div",{className:"mwai-builder-col",style:{flex:2}},React.createElement("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center"}},Wo.map((function(e){return React.createElement("img",{key:e,style:{marginRight:2,marginBottom:2,cursor:"pointer",filter:zo},width:24,height:24,src:"".concat(N,"/images/").concat(e),onClick:function(){r(e,n)}})})),React.createElement("div",{style:{width:24,height:24,border:"1px solid #d2e4f3",background:"#f5fcff",borderRadius:5,cursor:"pointer",display:"flex",justifyContent:"center",alignItems:"center"},onClick:function(){r("".concat(N,"/images/chat-traditional-1.svg"),n)}},"..."))),React.createElement("div",{className:"mwai-builder-col",style:{width:48,display:"flex",alignItems:"end"}},o?React.createElement("div",{style:{fontSize:48,lineHeight:"48px",marginRight:0,paddingTop:0}},a):React.createElement("img",{style:{marginRight:0,paddingTop:0,filter:zo},width:48,height:48,src:"".concat(l)}))),i&&React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.CUSTOM_ICON,":"),React.createElement(Re.A,{name:"icon",value:a,onBlur:function(e){return r(e,n)},onEnter:function(e){return r(e,n)}})))))};const Ko=function(e){var t,n,r,a,o,i,l,c,u=e.themes,s=e.shortcodeParams,f=e.updateShortcodeParams,m=e.defaultChatbot,d=e.blockMode,p=e.deleteCurrentChatbot,h=e.resetCurrentChatbot,v=e.duplicateCurrentChatbot,g=e.options,b=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,Po),R=ft(g,s.envId||null),_=R.completionModels,x=R.imageModels,S=R.getModel,T=null!==(t="chat"===s.mode)&&void 0!==t?t:"chat",N=null!==(n="assistant"===s.mode)&&void 0!==n&&n,C=null!==(r="images"===s.mode)&&void 0!==r&&r,I=s.contentAware,k=Bo((function(){return(null==g?void 0:g.ai_envs)||[]}),[g.ai_envs]),L=null==g?void 0:g.module_embeddings,M=(null==g?void 0:g.functions)||[],P=s.functions||[],j=(l=Ho(!1),c=2,function(e){if(Array.isArray(e))return e}(l)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(l,c)||function(e,t){if(e){if("string"==typeof e)return Go(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)?Go(e,t):void 0}}(l,c)||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.")}()),F=j[0],D=j[1],G=Bo((function(){return s.instructions&&s.instructions.includes("{CONTENT}")}),[s.instructions]),U=Bo((function(){return k.find((function(e){return e.id===s.envId}))||null}),[k,s.envId]),B=Bo((function(){return(null==U?void 0:U.assistants)||[]}),[U]),H=Bo((function(){return B.find((function(e){return e.id===s.assistantId}))||null}),[B,s.assistantId]),Y=S(H?H.model:s.model),z=g.embeddings_envs||[],W=Bo((function(){var e;return null==Y||null===(e=Y.tags)||void 0===e?void 0:e.includes("functions")}),[Y]),V=Bo((function(){var e;return null==Y||null===(e=Y.tags)||void 0===e?void 0:e.includes("vision")}),[Y]),K=Bo((function(){var e;return null==Y||null===(e=Y.tags)||void 0===e?void 0:e.includes("image")}),[Y]);Yo((function(){var e=P.filter((function(e){return M.some((function(t){return t.id===e.id}))}));if(e.length!==P.length)console.warn("Update Params: Functions has been updated."),f(e,"functions");else if(K&&!s.resolution){if(console.warn("Update Params: Resolution has been set."),null!=Y&&Y.resolutions){var t=Y.resolutions.map((function(e){return e.name})),n=t.includes("1024x1024")?"1024x1024":t[0];f(n,"resolution")}}else!K&&s.resolution?(console.warn("Update Params: Resolution has been removed."),f(null,"resolution")):K&&T||N&&s.model?(console.warn("Update Params: Model has been removed."),f(null,"model")):!N&&s.assistantId?(console.warn("Update Params: Assistant has been removed."),f(null,"assistantId")):s.imageUpload&&!V?(console.warn("Update Params: Vision has been removed."),f(null,"imageUpload")):s.fileSearch&&!N?(console.warn("Update Params: File search has been removed."),f(null,"fileSearch")):s.model&&!s.envId?(console.warn("Update Params: Model has been removed."),f(null,"model")):s.envId&&!U?(console.warn("Update Params: Environment has been removed."),f(null,"envId")):!L&&s.embeddingsEnvId?(console.warn("Update Params: Embeddings environment has been removed."),f(null,"embeddingsEnvId")):!W&&P.length?(console.warn("Update Params: Functions have been removed."),f([],"functions")):!N||!s.fileSearch||null!=H&&H.has_file_search?s.aiAvatar||s.aiName?s.userAvatar||s.userName?s.guestAvatar||s.guestName||(console.warn("Update Params: Guest avatar has been set to true."),f(!0,"guestAvatar")):(console.warn("Update Params: User avatar has been set to true."),f(!0,"userAvatar")):(console.warn("Update Params: AI avatar has been set to true."),f(!0,"aiAvatar")):(console.warn("Update Params: File search has been removed."),f(null,"fileSearch"))}),[s]);var q=function(){var e,t=(e=Fo().mark((function e(){return Fo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return D(!0),e.prev=1,e.next=4,gn(s.envId,s.assistantId,P);case 4:alert("Functions have been set on the assistant."),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(1),alert(e.t0.message);case 10:D(!1);case 11:case"end":return e.stop()}}),e,null,[[1,7]])})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Do(o,r,a,i,l,"next",e)}function l(e){Do(o,r,a,i,l,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}(),X=Bo((function(){return K&&Y?Y.resolutions?null==Y?void 0:Y.resolutions:(console.error("This image model does not have resolutions.",Y),[]):[]}),[Y,K]);return React.createElement(React.Fragment,null,React.createElement(E.N,null,React.createElement(E.Y,jo({minimal:!0},b),React.createElement(yo,null,React.createElement(Se.a,{keepState:"chatbotParams"},React.createElement(Se.Y,{title:He.COMMON.CHATBOT},React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.NAME,":"),React.createElement(Re.A,{name:"name","data-form-type":"other",disabled:"default"===s.botId,value:s.name,onBlur:f,onEnter:f})),React.createElement("div",{className:"mwai-builder-col"},React.createElement("div",null,React.createElement("label",{style:{display:"block"}},He.COMMON.ID,":"),React.createElement(Re.A,{name:"botId",type:"text",placeholder:"Optional",disabled:"default"===s.botId,value:s.botId,onBlur:f,onEnter:f}))),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.LOCAL_MEMORY,":"),React.createElement(y.R,{name:"localMemory",label:"Yes",checked:s.localMemory,value:"1",onChange:f}))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{height:"chat"===s.mode?76:"inherit"}},React.createElement("label",null,He.COMMON.MODE,":"),React.createElement(we.u,{scrolldown:!0,id:"mode",name:"mode",value:s.mode,onChange:f},React.createElement(we.j,{value:"chat",label:"Chat"}),React.createElement(we.j,{value:"assistant",label:"Assistant",isPro:!0,requirePro:!A}),React.createElement(we.j,{value:"images",label:"Images"}))),(T||N)&&React.createElement("div",{className:"mwai-builder-col",style:{flex:5}},React.createElement("label",null,He.COMMON.INSTRUCTIONS,":"),React.createElement(Wt.m,{name:"instructions",rows:10,textAreaStyle:{resize:"none"},value:s.instructions,onBlur:f,onEnter:f})))),React.createElement(Se.Y,{title:He.COMMON.AI_MODEL},React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.ENVIRONMENT,":"),React.createElement(we.u,{scrolldown:!0,name:"envId",value:null!==(a=s.envId)&&void 0!==a?a:"",onChange:f},k.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})})),React.createElement(we.j,{value:"",label:"Default"}))),(T||C)&&React.createElement("div",{className:"mwai-builder-col",style:{flex:2}},React.createElement("label",null,He.COMMON.MODEL,":"),React.createElement(we.u,{scrolldown:!0,name:"model",value:s.model,onChange:f},React.createElement(we.j,{value:"",label:"Default"}),(null!==(o=C?x:_)&&void 0!==o?o:[]).map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})})))),N&&React.createElement("div",{className:"mwai-builder-col",style:{flex:2}},React.createElement("label",null,He.COMMON.ASSISTANT,":"),React.createElement(we.u,{scrolldown:!0,name:"assistantId",value:s.assistantId,onChange:f},React.createElement(we.j,{value:"",label:"None"}),B.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})})))),K&&React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.RESOLUTION,":"),React.createElement(we.u,{scrolldown:!0,name:"resolution",value:s.resolution,onChange:f},X.map((function(e){return React.createElement(we.j,{key:e.name,value:e.name,label:e.label})})))),V&&React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.VISION,":"),React.createElement(y.R,{name:"imageUpload",label:He.COMMON.ENABLE,checked:s.imageUpload,value:"1",onChange:f}))),T&&React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.TEMPERATURE,":"),React.createElement(Re.A,{name:"temperature",type:"number",step:"0.1",min:"0",max:"1",value:s.temperature,onBlur:f,onEnter:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.MAX_TOKENS,":"),React.createElement(Re.A,{name:"maxTokens",type:"number",description:React.createElement(Eo,{model:Y,maxTokens:s.maxTokens,onRecommendedClick:function(e){f(e,"maxTokens")},style:{fontSize:11,lineHeight:"8px"}}),value:s.maxTokens,onBlur:f,onEnter:f})))),N&&React.createElement(Se.Y,{title:He.COMMON.ASSISTANT},React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.FILE_SEARCH,":"),React.createElement(we.u,{scrolldown:!0,name:"fileSearch",disabled:!(null!=H&&H.has_file_search),description:(0,O.FE)(null!=H&&H.has_file_search?He.SETTINGS.ASSISTANT_FILE_SEARCH:He.SETTINGS.ASSISTANT_NO_FILE_SEARCH),value:s.fileSearch,onChange:f},React.createElement(we.j,{value:"",label:"None"}),React.createElement(we.j,{value:"discussion",label:"For Discussion"}))))),(T||N)&&React.createElement(Se.Y,{title:He.COMMON.CONTEXT},React.createElement("div",{style:{marginTop:15,fontWeight:"bold"}},He.COMMON.EMBEDDINGS),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.EMBEDDINGS_ENV,":"),React.createElement(we.u,{scrolldown:!0,name:"embeddingsEnvId",requirePro:!0,isPro:A,disabled:!L||!(null!=z&&z.length),value:s.embeddingsEnvId,onChange:f},z.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})})),React.createElement(we.j,{value:"",label:"None"})))),React.createElement("div",{style:{marginTop:15,fontWeight:"bold"}},He.COMMON.OTHERS),T&&React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.CONTENT_AWARE,":"),React.createElement(y.R,{name:"contentAware",label:"Yes",requirePro:!0,isPro:A,checked:s.contentAware,value:"1",onChange:f}))),I&&!G&&React.createElement(Ne.X,{variant:"danger",style:{marginTop:15,padding:"10px 15px"}},React.createElement("p",null,(0,O.FE)(He.SETTINGS.ALERT_CONTENTAWARE_BUT_NO_CONTENT)))),W&&!d&&React.createElement(Se.Y,{title:He.COMMON.FUNCTIONS},React.createElement("p",null,React.createElement(Ot,{style:{marginRight:3}}),React.createElement(_t,{style:{marginRight:5}}),(0,O.FE)(He.HELP.FUNCTIONS)),!(null!=M&&M.length)&&React.createElement(Ne.X,{variant:"danger"},(0,O.FE)(He.HELP.FUNCTIONS_UNAVAILABLE)),!(null==M||!M.length)&&React.createElement("div",{style:{maxHeight:200,overflowY:"auto",border:"1px solid #d1e3f2",marginTop:10,padding:"5px 6px",borderRadius:5}},null==M?void 0:M.map((function(e){return React.createElement(y.R,{key:e.id,name:"functions",label:React.createElement(React.Fragment,null,"js"===e.target&&React.createElement(xt,{style:{marginRight:5}}),"js"!==e.target&&React.createElement(St,{style:{marginRight:5}}),React.createElement("span",null,e.name)),description:e.desc,checked:P.some((function(t){return t.id===e.id})),value:e.id,onChange:function(t){var n=P.filter((function(t){return t.id!==e.id}));t&&n.push({type:e.type,id:e.id}),f(n,"functions")}})}))),N&&React.createElement(React.Fragment,null,React.createElement("p",null,"Assistant needs to be updated with the set of functions every time you modify them (including their names, arguments, descriptions, etc)."),React.createElement(w.M,{className:"primary",fullWidth:!0,onClick:q,isBusy:F},"Set Functions on Assistant"))),React.createElement(Se.Y,{title:He.COMMON.THRESHOLDS},React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.INPUT_MAX_LENGTH,":"),React.createElement(Re.A,{name:"textInputMaxLength",type:"number",description:He.HELP.INPUT_MAX_LENGTH,step:"1",min:"8",value:s.textInputMaxLength,onBlur:f,onEnter:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.MAX_MESSAGES,":"),React.createElement(Re.A,{name:"maxMessages",type:"number",description:He.HELP.MAX_MESSAGES,step:"1",min:"1",max:"1024",value:s.maxMessages,onBlur:f,onEnter:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.CONTEXT_MAX_LENGTH,":"),React.createElement(Re.A,{name:"contextMaxLength",type:"number",step:"1",description:He.HELP.CONTEXT_MAX_LENGTH,value:s.contextMaxLength||(null==g?void 0:g.context_max_length),onBlur:f,onEnter:f})))),React.createElement(Se.Y,{title:He.COMMON.APPEARANCE},React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:3}},React.createElement("label",null,He.COMMON.THEME,":"),React.createElement(we.u,{scrolldown:!0,name:"themeId",value:s.themeId,description:"",onChange:f},React.createElement(we.j,{value:"none",label:"None"}),React.createElement(we.j,{value:"chatgpt",label:"ChatGPT"}),React.createElement(we.j,{value:"timeless",label:"Timeless"}),React.createElement(we.j,{value:"messages",label:"Messages"}),null==u?void 0:u.filter((function(e){return"css"===e.type})).map((function(e){return React.createElement(we.j,{key:e.themeId,value:e.themeId,label:e.name})})))),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.POPUP,":"),React.createElement(y.R,{name:"window",label:"Yes",checked:s.window,value:"1",onChange:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.FULL_SCREEN,":"),React.createElement(y.R,{name:"fullscreen",label:"Yes",checked:s.fullscreen,value:"1",onChange:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.COPY_BUTTON,":"),React.createElement(y.R,{name:"copyButton",label:"Yes",checked:s.copyButton,value:"1",onChange:f}))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.AVATAR,":"),React.createElement(y.R,{name:"aiAvatar",label:"Yes",checked:s.aiAvatar,value:"1",onChange:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:3}},React.createElement("label",null,He.COMMON.AI_NAME,":"),React.createElement(Re.A,{name:"aiName","data-form-type":"other",value:s.aiName,onBlur:f,onEnter:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:7}},React.createElement("label",null,He.COMMON.START_SENTENCE,":"),React.createElement(Wt.m,{name:"startSentence",rows:1,value:s.startSentence,onBlur:f,onEnter:f}))),s.aiAvatar&&React.createElement(Vo,{label:He.COMMON.AI_AVATAR,updateShortcodeParams:f,valueName:"aiAvatarUrl",icon:s.aiAvatarUrl}),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.AVATAR,":"),React.createElement(y.R,{name:"userAvatar",label:"Yes",checked:s.userAvatar,value:"1",onChange:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:3}},React.createElement("label",null,He.COMMON.USER_NAME,":"),React.createElement(Re.A,{name:"userName","data-form-type":"other",value:s.userName,onBlur:f,onEnter:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:3}},React.createElement("label",null,He.COMMON.PLACEHOLDER,":"),React.createElement(Re.A,{name:"textInputPlaceholder",value:s.textInputPlaceholder,onBlur:f,onEnter:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:2}},React.createElement("label",null,He.COMMON.SEND,":"),React.createElement(Re.A,{name:"textSend",value:s.textSend,onBlur:f,onEnter:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:2}},React.createElement("label",null,He.COMMON.CLEAR,":"),React.createElement(Re.A,{name:"textClear",value:s.textClear,onBlur:f,onEnter:f}))),s.userAvatar&&React.createElement("p",null,React.createElement("i",null,"The ",React.createElement("a",{href:"https://gravatar.com/",target:"_blank",rel:"noreferrer"},"gravatar")," of this user will be used as the avatar.")),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.AVATAR,":"),React.createElement(y.R,{name:"guestAvatar",label:"Yes",checked:s.guestAvatar,value:"1",onChange:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:3}},React.createElement("label",null,He.COMMON.GUEST_NAME,":"),React.createElement(Re.A,{name:"guestName",value:s.guestName,onBlur:f,onEnter:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:7}},React.createElement("label",null,He.COMMON.COMPLIANCE_TEXT,":"),React.createElement(Re.A,{name:"textCompliance",value:s.textCompliance,onBlur:f,onEnter:f}))),s.guestAvatar&&React.createElement(Vo,{label:He.COMMON.GUEST_AVATAR,updateShortcodeParams:f,valueName:"guestAvatarUrl",icon:s.guestAvatarUrl})),React.createElement(Se.Y,{title:He.COMMON.POPUP,hide:!s.window},React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:4}},React.createElement("label",null,He.COMMON.POSITION,":"),React.createElement(we.u,{scrolldown:!0,name:"iconPosition",value:s.iconPosition,onChange:f},React.createElement(we.j,{value:"bottom-right",label:"Bottom Right"}),React.createElement(we.j,{value:"bottom-left",label:"Bottom Left"}),React.createElement(we.j,{value:"top-right",label:"Top Right"}),React.createElement(we.j,{value:"top-left",label:"Top Left"}))),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.BUBBLE,":"),React.createElement(y.R,{name:"iconBubble",label:"Yes",checked:s.iconBubble,value:"1",onChange:f}))),React.createElement(Vo,{label:He.COMMON.ICON,updateShortcodeParams:f,valueName:"icon",icon:s.icon}),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:4}},React.createElement("label",null,He.COMMON.ICON_TEXT,":"),React.createElement(Re.A,{name:"iconText",description:He.HELP.ICON_TEXT,value:s.iconText,onBlur:f,onEnter:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:2}},React.createElement("label",null,He.COMMON.ICON_TEXT_DELAY,":"),React.createElement(Re.A,{name:"iconTextDelay",type:"number",description:null!==(i=He.HELP.ICON_TEXT_DELAY)&&void 0!==i?i:1,value:s.iconTextDelay,onBlur:f,onEnter:f})))),!d&&React.createElement(Se.Y,{title:He.COMMON.SHORTCODES},React.createElement(ko,{currentChatbot:s,style:{marginTop:10}}),"default"!==s.botId&&React.createElement(React.Fragment,null,React.createElement("p",null,He.HELP.CUSTOM_SHORTCODE),React.createElement(ko,{currentChatbot:s,isCustom:!0,defaultChatbot:m,style:{marginTop:10}}))),!d&&React.createElement(Se.Y,{title:He.COMMON.ACTIONS},React.createElement("div",{style:{display:"flex",marginTop:10}},React.createElement(w.M,{className:"primary",onClick:v},He.COMMON.DUPLICATE),React.createElement(w.M,{className:"secondary",onClick:h},He.COMMON.RESET),React.createElement("div",{style:{flex:"auto"}}),React.createElement(w.M,{className:"danger",disabled:"Default"===s.name,onClick:p},He.COMMON.DELETE))))))))};var qo,Xo=n(7612);function $o(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Qo(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)?Qo(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 Qo(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 Jo=wp.element,Zo=Jo.useState,ei=Jo.useEffect,ti=Jo.useRef,ni=Jo.useCallback,ri=G.Ay.div(qo||(qo=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n  position: relative;\n\n  .swatch {\n    width: 24px;\n    height: 24px;\n    border: 3px solid #fff;\n    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), inset 0 0 0 1px rgba(0, 0, 0, 0.1);\n    cursor: pointer;\n  }\n  \n  .popover {\n    position: absolute;\n    top: -210px;\n    left: -80px;\n    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);\n    z-index: 9999;\n    border-radius: 8px;\n  }\n"]))),ai=function(e){var t=e.name,n=e.value,r=e.onChange,a=ti(),o=$o(Zo(!1),2),i=o[0],l=o[1],c=$o(Zo(n),2),u=c[0],s=c[1];ei((function(){s(n)}),[n]);var f,m,d=ni((function(){u!==n&&r(u,t),l(!1)}),[u,n]);return ei((function(){var e=!1,t=!1,n=function(n){!e&&t&&f.current&&!f.current.contains(n.target)&&m(n)},r=function(n){t=f.current,e=f.current&&f.current.contains(n.target)};return document.addEventListener("mousedown",r),document.addEventListener("touchstart",r),document.addEventListener("click",n),function(){document.removeEventListener("mousedown",r),document.removeEventListener("touchstart",r),document.removeEventListener("click",n)}}),[f=a,m=d]),React.createElement(ri,{className:"neko-color-picker"},React.createElement("div",{className:"swatch",style:{backgroundColor:u},onClick:function(){return l(!0)}}),i&&React.createElement("div",{className:"popover",ref:a,style:{background:"white"}},React.createElement(Xo.jI,{color:u,onChange:s}),React.createElement("div",{style:{display:"flex",padding:5}},React.createElement(w.M,{style:{flex:1},onClick:function(){return r(u,t)}},"Apply"))))};const oi=function(e){var t,n,r,a,o,i,l,c,u,s,f,m,d,p,h,y,v,g,E,b,w,R=e.settings,O=e.onUpdateSettings;return React.createElement(React.Fragment,null,React.createElement(yo,null,React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:.66}},React.createElement("label",null,He.COMMON.SPACING,":"),React.createElement(Re.A,{id:"spacing",name:"spacing",value:null!==(t=null==R?void 0:R.spacing)&&void 0!==t?t:"15px",onBlur:O,onEnter:O})),React.createElement("div",{className:"mwai-builder-col",style:{flex:.66}},React.createElement("label",null,He.COMMON.BORDER_RADIUS,":"),React.createElement(Re.A,{id:"borderRadius",name:"borderRadius",value:null!==(n=null==R?void 0:R.borderRadius)&&void 0!==n?n:"10px",onBlur:O,onEnter:O})),React.createElement("div",{className:"mwai-builder-col",style:{flex:.66}},React.createElement("label",null,He.COMMON.FONT_SIZE,":"),React.createElement(Re.A,{id:"fontSize",name:"fontSize",value:null!==(r=null==R?void 0:R.fontSize)&&void 0!==r?r:"15px",onBlur:O,onEnter:O})),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.FONT_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"fontColor",name:"fontColor",value:null!==(a=null==R?void 0:R.fontColor)&&void 0!==a?a:"#FFFFFF",onBlur:O,onEnter:O}),React.createElement(ai,{id:"fontColor",name:"fontColor",value:null!==(o=null==R?void 0:R.fontColor)&&void 0!==o?o:"#FFFFFF",onChange:O})))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BACK_PRIMARY_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundPrimaryColor",name:"backgroundPrimaryColor",style:{flex:1},value:null!==(i=null==R?void 0:R.backgroundPrimaryColor)&&void 0!==i?i:"#454654",onBlur:O,onEnter:O}),React.createElement(ai,{id:"backgroundPrimaryColor",name:"backgroundPrimaryColor",value:null!==(l=null==R?void 0:R.backgroundPrimaryColor)&&void 0!==l?l:"#454654",onChange:O,onEnter:O}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BACK_SECONDARY_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundSecondaryColor",name:"backgroundSecondaryColor",style:{flex:1},value:null!==(c=null==R?void 0:R.backgroundSecondaryColor)&&void 0!==c?c:"#343541",onBlur:O,onEnter:O}),React.createElement(ai,{id:"backgroundSecondaryColor",name:"backgroundSecondaryColor",value:null!==(u=null==R?void 0:R.backgroundSecondaryColor)&&void 0!==u?u:"#343541",onChange:O,onEnter:O})))),React.createElement(_e.g,null),React.createElement(Se.Y,{title:He.COMMON.POPUP,isCollapsed:!1}),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:.75}},React.createElement("label",null,He.COMMON.WIDTH,":"),React.createElement(Re.A,{id:"width",name:"width",value:null!==(s=null==R?void 0:R.width)&&void 0!==s?s:"460px",onBlur:O,onEnter:O})),React.createElement("div",{className:"mwai-builder-col",style:{flex:.75}},React.createElement("label",null,He.COMMON.MAX_HEIGHT,":"),React.createElement(Re.A,{id:"maxHeight",name:"maxHeight",value:null!==(f=null==R?void 0:R.maxHeight)&&void 0!==f?f:"40vh",onBlur:O,onEnter:O})),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.AVATAR_MESSAGE_BACKGROUND_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"iconTextBackgroundColor",name:"iconTextBackgroundColor",value:null!==(m=null==R?void 0:R.iconTextBackgroundColor)&&void 0!==m?m:"#343541",onBlur:O,onEnter:O}),React.createElement(ai,{id:"iconTextBackgroundColor",name:"iconTextBackgroundColor",value:null!==(d=null==R?void 0:R.iconTextBackgroundColor)&&void 0!==d?d:"#343541",onChange:O,onEnter:O}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.AVATAR_MESSAGE_FONT_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"iconTextColor",name:"iconTextColor",value:null!==(p=null==R?void 0:R.iconTextColor)&&void 0!==p?p:"#FFFFFF",onBlur:O,onEnter:O}),React.createElement(ai,{id:"iconTextColor",name:"iconTextColor",value:null!==(h=null==R?void 0:R.iconTextColor)&&void 0!==h?h:"#FFFFFF",onChange:O,onEnter:O})))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BUBBLE_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"bubbleColor",name:"bubbleColor",style:{flex:1},value:null!==(y=null==R?void 0:R.bubbleColor)&&void 0!==y?y:"#343541",onBlur:O,onEnter:O}),React.createElement(ai,{id:"bubbleColor",name:"bubbleColor",value:null!==(v=null==R?void 0:R.bubbleColor)&&void 0!==v?v:"#343541",onChange:O,onEnter:O}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.HEADER_BACKGROUND_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundHeaderColor",name:"backgroundHeaderColor",style:{flex:1},value:null!==(g=null==R?void 0:R.backgroundHeaderColor)&&void 0!==g?g:"#343541",onBlur:O,onEnter:O}),React.createElement(ai,{id:"backgroundHeaderColor",name:"backgroundHeaderColor",value:null!==(E=null==R?void 0:R.backgroundHeaderColor)&&void 0!==E?E:"#343541",onChange:O,onEnter:O}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.HEADER_BUTTONS_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"headerButtonsColor",name:"headerButtonsColor",style:{flex:1},value:null!==(b=null==R?void 0:R.headerButtonsColor)&&void 0!==b?b:"#FFFFFF",onBlur:O,onEnter:O}),React.createElement(ai,{id:"headerButtonsColor",name:"headerButtonsColor",value:null!==(w=null==R?void 0:R.headerButtonsColor)&&void 0!==w?w:"#FFFFFF",onChange:O,onEnter:O}))))))};function ii(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 li=wp.element,ci=li.useMemo,ui=li.useState,si=li.useEffect;const fi=function(e){var t,n,r=e.theme,a=e.onUpdateTheme,o=(t=ui(""),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,n)||function(e,t){if(e){if("string"==typeof e)return ii(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)?ii(e,t):void 0}}(t,n)||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.")}()),i=o[0],l=o[1];si((function(){l(r.style)}),[r]);var c=ci((function(){return i!==r.style}),[i,r]);return React.createElement(yo,null,React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.NAME,":"),React.createElement(Re.A,{name:"name","data-form-type":"other",value:r.name,onBlur:a,onEnter:a})),React.createElement("div",{className:"mwai-builder-col"},React.createElement("div",null,React.createElement("label",{style:{display:"block"}},He.COMMON.ID,":"),React.createElement(Re.A,{name:"themeId",type:"text",placeholder:"Optional",value:r.themeId,onBlur:a,onEnter:a})))),React.createElement(_e.g,null),React.createElement("label",null,"Custom CSS:"),React.createElement(Wt.m,{name:"css",value:i,onChange:l,rows:16,tabToSpaces:2}),React.createElement("div",{style:{display:"flex"}},React.createElement(w.M,{fullWidth:!0,onClick:function(){var e=".mwai-THEME_ID-theme {\n  --mwai-spacing: 10px;\n  --mwai-fontSize: 14px;\n  --mwai-fontColor: #000;\n  --mwai-bgPrimary: #fff;\n  --mwai-primary: #0084ff;\n  --mwai-secondary: #f0f0f0;\n  --mwai-width: 300px;\n  --mwai-borderRadius: 5px;\n}\n\n.mwai-THEME_ID-theme .mwai-content {\n  background: var(--mwai-bgPrimary);\n  padding: var(--mwai-spacing);\n  font-size: var(--mwai-fontSize);\n  color: var(--mwai-fontColor);\n}\n\n.mwai-THEME_ID-theme .mwai-conversation {\n  display: flex;\n  flex-direction: column;\n}\n\n.mwai-THEME_ID-theme .mwai-reply {\n  margin-bottom: var(--mwai-spacing);\n  padding: var(--mwai-spacing);\n  display: flex;\n}\n\n.mwai-THEME_ID-theme .mwai-reply.mwai-ai {\n  background: var(--mwai-secondary);\n}\n\n.mwai-THEME_ID-theme .mwai-reply.mwai-user {\n  background: var(--mwai-primary);\n  color: #fff;\n}\n\n.mwai-THEME_ID-theme .mwai-name {\n  margin-right: var(--mwai-spacing);\n}\n\n.mwai-THEME_ID-theme .mwai-input {\n  display: flex;\n  align-items: center;\n  gap: 5px;\n}\n\n.mwai-THEME_ID-theme .mwai-input-text {\n  display: flex;\n  align-items: center;\n  flex: 1;\n}\n\n.mwai-THEME_ID-theme .mwai-input-text textarea {\n  flex: 1;\n}\n\n.mwai-THEME_ID-theme .mwai-trigger {\n  position: absolute;\n  right: 0;\n  bottom: 0;\n  transition: all 0.2s ease-out;\n  z-index: 9999;\n  display: flex;\n  flex-direction: column;\n  align-items: flex-end;\n}\n\n.mwai-THEME_ID-theme .mwai-trigger .mwai-icon-text-container {\n  display: flex;\n  flex-direction: column;\n  align-items: flex-end;\n}\n\n.mwai-THEME_ID-theme .mwai-trigger .mwai-icon-text {\n  background: var(--mwai-iconTextBackgroundColor);\n  color: var(--mwai-iconTextColor);\n  box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);\n  max-width: 200px;\n  font-size: 13px;\n  margin-bottom: 15px;\n  padding: 10px 15px;\n  border-radius: 8px;\n}\n\n.mwai-THEME_ID-theme .mwai-reply-actions .mwai-copy-button {\n  fill: var(--mwai-fontColor);\n  padding: 3px 5px;\n  width: 24px;\n  height: 24px;\n  background: var(--mwai-bgPrimary);\n  cursor: pointer;\n  border-radius: var(--mwai-borderRadius);\n  display: none;\n}\n\n.mwai-THEME_ID-theme .mwai-reply-actions:not(.mwai-hidden) .mwai-copy-button {\n  display: block;\n}\n\n.mwai-THEME_ID-theme.mwai-window {\n  position: fixed;\n  right: 30px;\n  bottom: 30px;\n  width: var(--mwai-width);\n  z-index: 9999;\n}\n\n.mwai-THEME_ID-theme.mwai-window .mwai-content {\n  display: none;\n  opacity: 0;\n  max-height: var(--mwai-maxHeight);\n  border-radius: 0 0 var(--mwai-borderRadius) var(--mwai-borderRadius);\n}\n\n.mwai-THEME_ID-theme.mwai-window.mwai-bottom-left,\n.mwai-THEME_ID-theme.mwai-window.mwai-top-left {\n  right: auto;\n  left: 30px;\n}\n\n.mwai-THEME_ID-theme.mwai-window.mwai-top-right,\n.mwai-THEME_ID-theme.mwai-window.mwai-top-left {\n  top: 30px;\n  bottom: auto;\n}\n\n.mwai-THEME_ID-theme.mwai-window.mwai-open .mwai-trigger {\n  display: none;\n}\n\n.mwai-THEME_ID-theme.mwai-window.mwai-open .mwai-content {\n  display: flex;\n  flex-direction: column;\n  transition: opacity 200ms ease-in-out;\n  opacity: 1;\n}\n\n.mwai-THEME_ID-theme.mwai-window .mwai-header {\n  display: none;\n  justify-content: flex-end;\n  height: 22px;\n}\n\n.mwai-THEME_ID-theme.mwai-window.mwai-open .mwai-header {\n  display: flex;\n}\n\n.mwai-THEME_ID-theme.mwai-window .mwai-header .mwai-buttons .mwai-close-button:after {\n  content: '╳';\n  cursor: pointer;\n}\n".replace(/THEME_ID/g,r.themeId);l(e)}},"Default CSS"),React.createElement(w.M,{fullWidth:!0,onClick:function(){a(i,"style")},disabled:!c},"Apply CSS")))},mi=function(e){var t,n,r,a,o,i,l,c,u,s,f,m,d,p,h,y,v,g,E,b,w,R,O,_,x,S=e.settings,T=e.onUpdateSettings;return React.createElement(React.Fragment,null,React.createElement(yo,null,React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:.66}},React.createElement("label",null,He.COMMON.SPACING,":"),React.createElement(Re.A,{id:"spacing",name:"spacing",value:null!==(t=null==S?void 0:S.spacing)&&void 0!==t?t:"15px",onBlur:T,onEnter:T})),React.createElement("div",{className:"mwai-builder-col",style:{flex:.66}},React.createElement("label",null,He.COMMON.BORDER_RADIUS,":"),React.createElement(Re.A,{id:"borderRadius",name:"borderRadius",value:null!==(n=null==S?void 0:S.borderRadius)&&void 0!==n?n:"10px",onBlur:T,onEnter:T})),React.createElement("div",{className:"mwai-builder-col",style:{flex:.66}},React.createElement("label",null,He.COMMON.FONT_SIZE,":"),React.createElement(Re.A,{id:"fontSize",name:"fontSize",value:null!==(r=null==S?void 0:S.fontSize)&&void 0!==r?r:"15px",onBlur:T,onEnter:T})),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.FONT_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"fontColor",name:"fontColor",value:null!==(a=null==S?void 0:S.fontColor)&&void 0!==a?a:"#FFFFFF",onBlur:T,onEnter:T}),React.createElement(ai,{id:"fontColor",name:"fontColor",value:null!==(o=null==S?void 0:S.fontColor)&&void 0!==o?o:"#FFFFFF",onChange:T})))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BACK_PRIMARY_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundPrimaryColor",name:"backgroundPrimaryColor",style:{flex:1},value:null!==(i=null==S?void 0:S.backgroundPrimaryColor)&&void 0!==i?i:"#fafafa",onBlur:T,onEnter:T}),React.createElement(ai,{id:"backgroundPrimaryColor",name:"backgroundPrimaryColor",value:null!==(l=null==S?void 0:S.backgroundPrimaryColor)&&void 0!==l?l:"#fafafa",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BACK_USER_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundUserColor",name:"backgroundUserColor",style:{flex:1},value:null!==(c=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==c?c:"#0084ff",onBlur:T,onEnter:T}),React.createElement(ai,{id:"backgroundUserColor",name:"backgroundUserColor",value:null!==(u=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==u?u:"#0084ff",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BACK_AI_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundAiColor",name:"backgroundAiColor",style:{flex:1},value:null!==(s=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==s?s:"#eee",onBlur:T,onEnter:T}),React.createElement(ai,{id:"backgroundAiColor",name:"backgroundAiColor",value:null!==(f=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==f?f:"#eee",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BACK_AI_SECONDARY_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundAiSecondaryColor",name:"backgroundAiSecondaryColor",style:{flex:1},value:null!==(m=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==m?m:"#ddd",onBlur:T,onEnter:T}),React.createElement(ai,{id:"backgroundAiSecondaryColor",name:"backgroundAiSecondaryColor",value:null!==(d=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==d?d:"#ddd",onChange:T,onEnter:T})))),React.createElement(_e.g,null),React.createElement(Se.Y,{title:He.COMMON.POPUP,isCollapsed:!1}),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:.75}},React.createElement("label",null,He.COMMON.WIDTH,":"),React.createElement(Re.A,{id:"width",name:"width",value:null!==(p=null==S?void 0:S.width)&&void 0!==p?p:"460px",onBlur:T,onEnter:T})),React.createElement("div",{className:"mwai-builder-col",style:{flex:.75}},React.createElement("label",null,He.COMMON.MAX_HEIGHT,":"),React.createElement(Re.A,{id:"maxHeight",name:"maxHeight",value:null!==(h=null==S?void 0:S.maxHeight)&&void 0!==h?h:"40vh",onBlur:T,onEnter:T})),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.AVATAR_MESSAGE_BACKGROUND_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"iconTextBackgroundColor",name:"iconTextBackgroundColor",value:null!==(y=null==S?void 0:S.iconTextBackgroundColor)&&void 0!==y?y:"#0084ff",onBlur:T,onEnter:T}),React.createElement(ai,{id:"iconTextBackgroundColor",name:"iconTextBackgroundColor",value:null!==(v=null==S?void 0:S.iconTextBackgroundColor)&&void 0!==v?v:"#0084ff",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.AVATAR_MESSAGE_FONT_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"iconTextColor",name:"iconTextColor",value:null!==(g=null==S?void 0:S.iconTextColor)&&void 0!==g?g:"#FFFFFF",onBlur:T,onEnter:T}),React.createElement(ai,{id:"iconTextColor",name:"iconTextColor",value:null!==(E=null==S?void 0:S.iconTextColor)&&void 0!==E?E:"#FFFFFF",onChange:T,onEnter:T})))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BUBBLE_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"bubbleColor",name:"bubbleColor",style:{flex:1},value:null!==(b=null==S?void 0:S.bubbleColor)&&void 0!==b?b:"#0084ff",onBlur:T,onEnter:T}),React.createElement(ai,{id:"bubbleColor",name:"bubbleColor",value:null!==(w=null==S?void 0:S.bubbleColor)&&void 0!==w?w:"#0084ff",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.HEADER_BACKGROUND_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundHeaderColor",name:"backgroundHeaderColor",style:{flex:1},value:null!==(R=null==S?void 0:S.backgroundHeaderColor)&&void 0!==R?R:"#0084ff",onBlur:T,onEnter:T}),React.createElement(ai,{id:"backgroundHeaderColor",name:"backgroundHeaderColor",value:null!==(O=null==S?void 0:S.backgroundHeaderColor)&&void 0!==O?O:"#0084ff",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.HEADER_BUTTONS_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"headerButtonsColor",name:"headerButtonsColor",style:{flex:1},value:null!==(_=null==S?void 0:S.headerButtonsColor)&&void 0!==_?_:"#FFFFFF",onBlur:T,onEnter:T}),React.createElement(ai,{id:"headerButtonsColor",name:"headerButtonsColor",value:null!==(x=null==S?void 0:S.headerButtonsColor)&&void 0!==x?x:"#FFFFFF",onChange:T,onEnter:T}))))))},di=function(e){var t,n,r,a,o,i,l,c,u,s,f,m,d,p,h,y,v,g,E,b,w,R,O,_,x,S=e.settings,T=e.onUpdateSettings;return React.createElement(React.Fragment,null,React.createElement(Ne.X,{variant:"danger"},"This theme is ",React.createElement("b",null,"still in development"),". The related settings will be available soon."),React.createElement(yo,null,React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:.66}},React.createElement("label",null,He.COMMON.SPACING,":"),React.createElement(Re.A,{id:"spacing",name:"spacing",value:null!==(t=null==S?void 0:S.spacing)&&void 0!==t?t:"15px",onBlur:T,onEnter:T})),React.createElement("div",{className:"mwai-builder-col",style:{flex:.66}},React.createElement("label",null,He.COMMON.BORDER_RADIUS,":"),React.createElement(Re.A,{id:"borderRadius",name:"borderRadius",value:null!==(n=null==S?void 0:S.borderRadius)&&void 0!==n?n:"10px",onBlur:T,onEnter:T})),React.createElement("div",{className:"mwai-builder-col",style:{flex:.66}},React.createElement("label",null,He.COMMON.FONT_SIZE,":"),React.createElement(Re.A,{id:"fontSize",name:"fontSize",value:null!==(r=null==S?void 0:S.fontSize)&&void 0!==r?r:"13px",onBlur:T,onEnter:T})),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.FONT_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"fontColor",name:"fontColor",value:null!==(a=null==S?void 0:S.fontColor)&&void 0!==a?a:"#FFFFFF",onBlur:T,onEnter:T}),React.createElement(ai,{id:"fontColor",name:"fontColor",value:null!==(o=null==S?void 0:S.fontColor)&&void 0!==o?o:"#FFFFFF",onChange:T})))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BACK_PRIMARY_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundPrimaryColor",name:"backgroundPrimaryColor",style:{flex:1},value:null!==(i=null==S?void 0:S.backgroundPrimaryColor)&&void 0!==i?i:"#fafafa",onBlur:T,onEnter:T}),React.createElement(ai,{id:"backgroundPrimaryColor",name:"backgroundPrimaryColor",value:null!==(l=null==S?void 0:S.backgroundPrimaryColor)&&void 0!==l?l:"#fafafa",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BACK_USER_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundUserColor",name:"backgroundUserColor",style:{flex:1},value:null!==(c=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==c?c:"#434cc5",onBlur:T,onEnter:T}),React.createElement(ai,{id:"backgroundUserColor",name:"backgroundUserColor",value:null!==(u=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==u?u:"#434cc5",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BACK_AI_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundAiColor",name:"backgroundAiColor",style:{flex:1},value:null!==(s=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==s?s:"#F1F3F7",onBlur:T,onEnter:T}),React.createElement(ai,{id:"backgroundAiColor",name:"backgroundAiColor",value:null!==(f=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==f?f:"#eee",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BACK_AI_SECONDARY_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundAiSecondaryColor",name:"backgroundAiSecondaryColor",style:{flex:1},value:null!==(m=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==m?m:"#ddd",onBlur:T,onEnter:T}),React.createElement(ai,{id:"backgroundAiSecondaryColor",name:"backgroundAiSecondaryColor",value:null!==(d=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==d?d:"#ddd",onChange:T,onEnter:T})))),React.createElement(_e.g,null),React.createElement(Se.Y,{title:He.COMMON.POPUP,isCollapsed:!1}),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:.75}},React.createElement("label",null,He.COMMON.WIDTH,":"),React.createElement(Re.A,{id:"width",name:"width",value:null!==(p=null==S?void 0:S.width)&&void 0!==p?p:"360px",onBlur:T,onEnter:T})),React.createElement("div",{className:"mwai-builder-col",style:{flex:.75}},React.createElement("label",null,He.COMMON.MAX_HEIGHT,":"),React.createElement(Re.A,{id:"maxHeight",name:"maxHeight",value:null!==(h=null==S?void 0:S.maxHeight)&&void 0!==h?h:"40vh",onBlur:T,onEnter:T})),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.AVATAR_MESSAGE_BACKGROUND_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"iconTextBackgroundColor",name:"iconTextBackgroundColor",value:null!==(y=null==S?void 0:S.iconTextBackgroundColor)&&void 0!==y?y:"#343541",onBlur:T,onEnter:T}),React.createElement(ai,{id:"iconTextBackgroundColor",name:"iconTextBackgroundColor",value:null!==(v=null==S?void 0:S.iconTextBackgroundColor)&&void 0!==v?v:"#343541",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.AVATAR_MESSAGE_FONT_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"iconTextColor",name:"iconTextColor",value:null!==(g=null==S?void 0:S.iconTextColor)&&void 0!==g?g:"#FFFFFF",onBlur:T,onEnter:T}),React.createElement(ai,{id:"iconTextColor",name:"iconTextColor",value:null!==(E=null==S?void 0:S.iconTextColor)&&void 0!==E?E:"#FFFFFF",onChange:T,onEnter:T})))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BUBBLE_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"bubbleColor",name:"bubbleColor",style:{flex:1},value:null!==(b=null==S?void 0:S.bubbleColor)&&void 0!==b?b:"#434cc5",onBlur:T,onEnter:T}),React.createElement(ai,{id:"bubbleColor",name:"bubbleColor",value:null!==(w=null==S?void 0:S.bubbleColor)&&void 0!==w?w:"#434cc5",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.HEADER_BACKGROUND_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundHeaderColor",name:"backgroundHeaderColor",style:{flex:1},value:null!==(R=null==S?void 0:S.backgroundHeaderColor)&&void 0!==R?R:"#434cc5",onBlur:T,onEnter:T}),React.createElement(ai,{id:"backgroundHeaderColor",name:"backgroundHeaderColor",value:null!==(O=null==S?void 0:S.backgroundHeaderColor)&&void 0!==O?O:"#434cc5",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.HEADER_BUTTONS_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"headerButtonsColor",name:"headerButtonsColor",style:{flex:1},value:null!==(_=null==S?void 0:S.headerButtonsColor)&&void 0!==_?_:"#FFFFFF",onBlur:T,onEnter:T}),React.createElement(ai,{id:"headerButtonsColor",name:"headerButtonsColor",value:null!==(x=null==S?void 0:S.headerButtonsColor)&&void 0!==x?x:"#FFFFFF",onChange:T,onEnter:T}))))))};function pi(e){return pi="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},pi(e)}function hi(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 yi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?hi(Object(n),!0).forEach((function(t){vi(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vi(e,t,n){var r;return r=function(e,t){if("object"!=pi(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=pi(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==pi(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const gi=function(e){var t,n,r,a=e.theme,o=e.updateTheme,i=e.resetTheme,l=e.deleteTheme,c=function(e,t){var n=yi(yi({},a.settings),{},vi({},t,e));o(n,"settings")};return React.createElement(React.Fragment,null,"internal"===a.type&&"chatgpt"===a.themeId&&React.createElement(oi,{settings:null!==(t=a.settings)&&void 0!==t?t:[],onUpdateSettings:c}),"internal"===a.type&&"messages"===a.themeId&&React.createElement(mi,{settings:null!==(n=a.settings)&&void 0!==n?n:[],onUpdateSettings:c}),"internal"===a.type&&"timeless"===a.themeId&&React.createElement(di,{settings:null!==(r=a.settings)&&void 0!==r?r:[],onUpdateSettings:c}),"internal"!==a.type&&React.createElement(fi,{theme:a,onUpdateTheme:o}),React.createElement(_e.g,null),React.createElement(Se.Y,{title:He.COMMON.ACTIONS}),React.createElement("div",{style:{display:"flex",marginTop:10}},React.createElement(w.M,{className:"secondary",onClick:function(){i()}},He.COMMON.RESET),React.createElement("div",{style:{flex:"auto"}}),React.createElement(w.M,{className:"danger",disabled:"internal"===a.type,onClick:l},He.COMMON.DELETE)))};function Ei(e){return Ei="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},Ei(e)}function bi(){bi=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Ei(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Ei(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 wi(e){return function(e){if(Array.isArray(e))return Ni(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ti(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 Ri(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 Oi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ri(Object(n),!0).forEach((function(t){_i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ri(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _i(e,t,n){var r;return r=function(e,t){if("object"!=Ei(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ei(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==Ei(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xi(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Si(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){xi(o,r,a,i,l,"next",e)}function l(e){xi(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Ti(e,t){if(e){if("string"==typeof e)return Ni(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)?Ni(e,t):void 0}}function Ni(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 Ci=wp.element.useState;const Ii=function(e){var t,n,r=(0,u.jE)(),a=e.onSwitchTheme,o=void 0===a?function(){}:a,i=(t=Ci(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,n)||Ti(t,n)||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.")}()),l=i[0],c=i[1],s=(0,f.I)({queryKey:["themes"],queryFn:mn,initialData:P}).data,m=e.currentTheme,d=function(){var e=Si(bi().mark((function e(t,n){var a,o,i;return bi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,c(!0),a=Oi(Oi({},m),{},_i({},n,t)),o=wi(s),i=o.findIndex((function(e){return e.themeId===m.themeId})),o[i]=a,e.next=8,dn(o);case 8:o=e.sent,r.setQueryData(["themes"],o),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),console.error(e.t0);case 15:c(!1);case 16:case"end":return e.stop()}}),e,null,[[0,12]])})));return function(t,n){return e.apply(this,arguments)}}(),p=function(){var e=Si(bi().mark((function e(){var t;return bi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c(!0),e.prev=1,e.next=4,dn([].concat(wi(s),[{type:"css",name:"New Theme",themeId:"theme-"+Rt(),settings:[],style:""}]));case 4:t=e.sent,r.setQueryData(["themes"],t),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),console.error(e.t0);case 11:c(!1);case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(){return e.apply(this,arguments)}}(),h=function(){var e=Si(bi().mark((function e(){var t,n;return bi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c(!0),t=wi(s.filter((function(e){return e.themeId!==m.themeId}))),n=t[0],o(n.themeId),e.next=6,dn(t);case 6:return e.next=8,r.setQueryData(["themes"],t);case 8:c(!1);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),y=function(){var e=Si(bi().mark((function e(){var t,n;return bi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c(!0),t=wi(s),n=t.findIndex((function(e){return e.themeId===m.themeId})),t[n]={type:t[n].type,name:t[n].name,themeId:t[n].themeId,settings:[],style:""},e.next=6,dn(t);case 6:return e.next=8,r.setQueryData(["themes"],t);case 8:c(!1);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return React.createElement(React.Fragment,null,React.createElement(b._,{inversed:!0,onChange:function(e,t){var n=s.find((function(e){return e.themeId===t.key}));n&&o(n.themeId)},currentTab:null==m?void 0:m.themeId,action:React.createElement(React.Fragment,null,React.createElement(w.M,{rounded:!0,className:"secondary",icon:"plus",onClick:p}))},null==s?void 0:s.map((function(e){return React.createElement(b.V,{key:e.themeId,title:e.name,busy:l},React.createElement(gi,{theme:e,updateTheme:d,resetTheme:y,deleteTheme:h}))}))))};var Ai=n(1469),ki=n(6966),Li=n(2902);function Mi(e){return Mi="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},Mi(e)}function Pi(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 ji(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pi(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=Mi(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Mi(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==Mi(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Fi=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:ji(ji({},t),{},{animationDelay:e})})}))))},Di=n(1137),Gi=["enabled","content","children","className"];function Ui(){return Ui=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},Ui.apply(this,arguments)}function Bi(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Hi(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)?Hi(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 Hi(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 Yi=wp.element,zi=Yi.useState,Wi=Yi.useEffect,Vi=Yi.useRef,Ki=Yi.useCallback;const qi=function(e){var t=e.enabled,n=e.content,r=e.children,a=e.className,o=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,Gi),i=(0,ki.gR)(),l=Bi(zi("idle"),2),c=l[0],u=l[1],s=Bi(zi(!0),2),f=s[0],m=s[1],d=Vi(null),p=Vi(!1),h=Ki((function(){p.current||(p.current=!0,d.current=setTimeout((function(){m(!1)}),500))}),[]),y=Ki((function(){d.current&&clearTimeout(d.current),m(!0),p.current=!1}),[]);Wi((function(){return function(){d.current&&clearTimeout(d.current)}}),[]);var v="success"===c?'<path d="M10.7673 18C10.3106 18 9.86749 17.8046 9.54432 17.4555L5.50694 13.1222C4.83102 12.3968 4.83102 11.2208 5.50694 10.4954C6.18287 9.76997 7.27871 9.76997 7.95505 10.4954L10.6794 13.4196L16.9621 5.63976C17.5874 4.86495 18.6832 4.78289 19.4031 5.45388C20.125 6.12487 20.2036 7.29638 19.5759 8.07391L12.0778 17.3589C11.7639 17.7475 11.3119 17.9801 10.8319 18C10.8087 18 10.788 18 10.7673 18Z" />':"error"===c?'<path d="M17.7623 17.7626C17.0831 18.4418 15.9549 18.416 15.244 17.705L5.79906 8.26012C5.08811 7.54917 5.0623 6.42098 5.74145 5.74183C6.4206 5.06267 7.54879 5.08849 8.25975 5.79944L17.7047 15.2443C18.4156 15.9553 18.4414 17.0835 17.7623 17.7626Z" /><path d="M17.5508 8.52848L8.52842 17.5509C7.84927 18.23 6.72108 18.2042 6.01012 17.4933C5.29917 16.7823 5.27336 15.6541 5.95251 14.975L14.9749 5.95257C15.6541 5.27342 16.7823 5.29923 17.4932 6.01019C18.2042 6.72114 18.23 7.84933 17.5508 8.52848Z" />':'<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 React.createElement("div",Ui({},o,{onMouseLeave:y,onMouseEnter:h,onMouseOver:h}),React.createElement("span",{className:a},r),React.createElement("div",{className:i("mwai-reply-actions",{"mwai-hidden":f})},t&&React.createElement("div",{className:"mwai-copy-button",onClick:function(){try{navigator.clipboard.writeText(n),u("success")}catch(e){u("error"),console.warn("Not allowed to copy to clipboard. Make sure your website uses HTTPS.",{content:n})}finally{setTimeout((function(){u("idle")}),2e3)}}},React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",dangerouslySetInnerHTML:{__html:v}}))))};function Xi(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 $i=wp.element.useMemo;const Qi=function(e){var t=e.role,n=void 0===t?"user":t,r=(0,Ai.o)().state,a=r.pluginUrl,o=r.iconUrl,i=r.userData,l=r.userName,c=r.aiName,u=r.guestName,s=r.userAvatar,f=r.aiAvatar,m=r.guestAvatar,d=r.userAvatarUrl,p=r.aiAvatarUrl,h=r.guestAvatarUrl,y=$i((function(){var e="assistant"===n,t=!i&&!e,r=function(e){return React.createElement("div",{className:"mwai-name-text"},e)},y=function(e,t,n,r){var o,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!e)return null;if((0,Lo.Ve)(t))return o=t,React.createElement("div",{className:"mwai-avatar mwai-emoji",style:{fontSize:"32px",lineHeight:"32px"}},o);var l=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,ki.mv)(e)?e:e&&!(0,Lo.Ve)(e)?t?e:"".concat(a,"/images/").concat(e):(t||(0,Lo.Ve)(e)||console.warn("Invalid URL for avatar:",e),null)}(t,i)||n;return l?function(e,t){return React.createElement("div",{className:"mwai-avatar"},React.createElement("img",{width:"32",height:"32",src:e,alt:t}))}(l,r):null};if(e){var v=y(f,p,o,"AI Avatar");return v?(null===p&&o&&console.warn("Using iconUrl as a temporary fallback for AI avatar. Please set aiAvatarUrl."),v):r(c)}return t?t?y(m,h,null,"Guest Avatar")||r(u||"Guest"):void 0:y(s,d,null==i?void 0:i.AVATAR_URL,"User Avatar",!0)||r(function(e,t,n){return n&&0!==Object.keys(n).length?Object.entries(n).reduce((function(e,t){var n,r,a=(r=2,function(e){if(Array.isArray(e))return e}(n=t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(n,r)||function(e,t){if(e){if("string"==typeof e)return Xi(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)?Xi(e,t):void 0}}(n,r)||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.")}()),o=a[0],i=a[1],l="{".concat(o,"}");return e.includes(l)?e.replace(l,i):e}),e):t||e||"Guest"}(l,u,i))}),[n,c,l,u,i,o,f,s,m,p,d,h,a]);return React.createElement("span",{className:"mwai-name"},y)};function Ji(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Zi(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)?Zi(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 Zi(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 el=wp.element,tl=el.useState,nl=el.useMemo,rl=el.useEffect,al=el.useRef,ol=function(e){var t=e.href,n=e.children;if(!t)return React.createElement("span",null,n);var r=window.location.hostname,a="_self";try{a=r===new URL(t,window.location.href).hostname?"_self":"_blank"}catch(e){console.error("Invalid URL:",e),a="_blank"}if("Uploaded File"===String(n)){var o=t.split("/").pop();return React.createElement("a",{href:t,target:a,rel:"noopener noreferrer",className:"mwai-filename"},React.createElement("span",null,"✓ ",o))}return React.createElement("a",{href:t,target:a,rel:"noopener noreferrer"},n)},il=function(e){var t,n=e.message,r=e.onRendered,a=void 0===r?function(){}:r,o=(0,Ai.o)().state.copyButton,i=Ji(tl(n.isQuerying||n.isStreaming),1)[0],l=n.isQuerying,c=n.isStreaming,u=null!==(t=n.content)&&void 0!==t?t:"";(u.match(/```/g)||[]).length%2!=0?u+="\n```":n.isStreaming&&(u+="<BlinkingCursor />"),rl((function(){i&&(!i||l||c)||a()}),[i,l,c]);var s=nl((function(){return{overrides:{BlinkingCursor:{component:Lo.rn},a:{component:ol},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"}}}}}),[]),f=nl((function(){var e="";try{e=(0,wa.cx)(u,s)}catch(t){console.error("Crash in markdown-to-jsx! Reverting to plain text.",{e:t,content:u}),e=u}return e}),[u,s]);return l||c&&!u?React.createElement(Fi,null):React.createElement(React.Fragment,null,React.createElement(Qi,{role:n.role}),React.createElement(qi,{content:n.content,enabled:o,className:"mwai-text"},f))},ll=function(e){var t=e.message,n=e.onRendered,r=void 0===n?function(){}:n,a=Ji(tl(null==t?void 0:t.images),2),o=a[0],i=a[1];return rl((function(){r()})),t.isQuerying?React.createElement(Fi,null):React.createElement(React.Fragment,null,React.createElement(Qi,{role:t.role}),React.createElement("span",{className:"mwai-text"},React.createElement("div",{className:"mwai-gallery"},null==o?void 0:o.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){i((function(t){return t.map((function(t,n){return n===e?"https://placehold.co/600x200?text=Expired+Image":t}))}))}(t)}}))})))))},cl=function(e){var t=e.message,n=e.conversationRef,r=e.onRendered,a=void 0===r?function(){}:r,o=al(null),i=Ji(tl(t.isQuerying),1)[0],l=Ji(tl(!t.isQuerying),2),c=l[0],u=l[1],s=t.content;rl((function(){console.warn("Do not use the Typewriter Effect. Use Streaming instead.")}),[]),(0,ki.$$)(200,(function(){null!=n&&n.current}),!c),rl((function(){if(i){if(o.current){var e={strings:[s],typeSpeed:(0,Di.W5)("typewriter.speed",15),showCursor:!1,onComplete:function(e){e.cursor&&e.cursor.remove(),a(),u((function(){return!0}))}},t=new Li.A(o.current,e);return function(){t.destroy()}}}else a()}),[t,t.isQuerying]);var f=nl((function(){var e="";try{e=(0,wa.cx)(s)}catch(t){console.error("Crash in markdown-to-jsx! Reverting to plain text.",{e:t,content:s}),e=s}return e}),[s]);return React.createElement(React.Fragment,null,t.isQuerying&&React.createElement(Fi,null),!t.isQuerying&&i&&React.createElement(React.Fragment,null,React.createElement(Qi,{role:t.role}),React.createElement("span",{className:"mwai-text",ref:o})),!t.isQuerying&&!i&&React.createElement(React.Fragment,null,React.createElement(Qi,{role:t.role}),React.createElement("span",{className:"mwai-text"},f)))};const ul=function(e){var t,n=e.message,r=e.conversationRef,a=(0,Ai.o)().state.typewriter,o=(0,ki.gR)(),i=al(),l=o("mwai-reply",{"mwai-ai":"assistant"===n.role,"mwai-user":"user"===n.role,"mwai-system":"system"===n.role}),c=(null==n||null===(t=n.images)||void 0===t?void 0:t.length)>0,u=function(){i.current&&(n.isQuerying||i.current.classList.contains("mwai-rendered")||"undefined"!=typeof hljs&&(i.current.classList.add("mwai-rendered"),i.current.querySelectorAll("pre code").forEach((function(e){hljs.highlightElement(e)}))))};return nl((function(){return"user"===n.role?React.createElement("div",{ref:i,className:l},React.createElement(il,{message:n})):"assistant"===n.role?c?React.createElement("div",{ref:i,className:l},React.createElement(ll,{message:n,conversationRef:r,onRendered:u})):a&&!n.isStreaming?(console.warn("The Typewriter effect is deprecated. Use Streaming instead."),React.createElement("div",{ref:i,className:l},React.createElement(cl,{message:n,conversationRef:r,onRendered:u}))):React.createElement("div",{ref:i,className:l},React.createElement(il,{message:n,conversationRef:r,onRendered:u})):"system"===n.role?React.createElement("div",{ref:i,className:l},React.createElement(il,{message:n,conversationRef:r,onRendered:u})):React.createElement("div",null,React.createElement("i",null,"Unhandled role."))}),[n,r,c,a])};var sl=n(2192);function fl(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 ml=wp.element,dl=ml.useState,pl=ml.useMemo,hl=ml.useRef;const yl=function(){var e,t,n=(0,ki.gR)(),r=(0,Ai.o)(),a=r.state,o=r.actions,i=a.uploadedFile,l=a.busy,c=a.imageUpload,u=a.fileSearch,s=a.draggingType,f=o.onUploadFile,m=(e=dl(!1),t=2,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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return fl(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)?fl(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.")}()),d=m[0],p=m[1],h=hl(),y=null==i?void 0:i.uploadedId,v=c||u,g=i,E=pl((function(){return null!=g&&g.localFile?g.localFile.type.startsWith("image/")?"image":"document":s}),[g,s]),b=pl((function(){var e="idle";null!=g&&g.uploadProgress?e="up":s?e="add":d&&y?e="del":y?e="ok":d&&!y&&(e="add");var t=E?E.toLowerCase():"idle";return"mwai-file-upload-icon mwai-".concat(t,"-").concat(e)}),[E,g,s,d,y]),w=pl((function(){return null!=g&&g.uploadProgress?g.uploadProgress>99?99:Math.round(g.uploadProgress):""}),[g]);return v?React.createElement("div",{disabled:l,onClick:function(){null!=i&&i.localFile?f(null):l||h.current.click()},onMouseEnter:function(){return p(!0)},onMouseLeave:function(){return p(!1)},className:n("mwai-file-upload",{"mwai-enabled":null==i?void 0:i.uploadedId,"mwai-busy":(null==i?void 0:i.localFile)&&!(null!=i&&i.uploadedId)}),style:{cursor:l?"default":"pointer"}},React.createElement("div",{className:b},React.createElement("span",{className:"mwai-file-upload-progress"},w)),React.createElement("input",{type:"file",ref:h,onChange:function(e){var t=e.target.files[0];t&&f(t)},style:{display:"none"}})):null};function vl(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 gl=wp.element,El=gl.useRef,bl=gl.useState,wl=gl.useEffect,Rl=gl.useImperativeHandle;const Ol=function(){var e,t,n=(0,ki.gR)(),r=(0,Ai.o)(),a=r.state,o=r.actions,i=a.inputText,l=a.textInputMaxLength,c=a.textInputPlaceholder,u=a.error,s=a.speechRecognitionAvailable,f=a.isMobile,m=a.conversationRef,d=a.open,p=a.uploadIconPosition,h=a.locked,y=a.isListening,v=a.busy,g=a.speechRecognition,E=a.chatbotInputRef,b=o.onSubmitAction,w=o.setIsListening,R=o.resetError,O=o.setInputText,_=(e=bl(!1),t=2,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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return vl(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)?vl(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.")}()),x=_[0],S=_[1],T=El();Rl(E,(function(){return{focusInput:function(){var e;null===(e=T.current)||void 0===e||e.focus()},currentElement:function(){return T.current}}})),wl((function(){!f&&d&&T.current.focus(),m.current&&(m.current.scrollTop=m.current.scrollHeight)}),[d,f,m]);var N=n("mwai-input-text",{});return React.createElement("div",{ref:E,className:N},"mwai-input"===p&&React.createElement(yl,null),React.createElement(sl.A,{ref:T,disabled:v||h,placeholder:c,value:i,maxLength:l,onCompositionStart:function(){return S(!0)},onCompositionEnd:function(){return S(!1)},onKeyDown:function(e){x||"Enter"!==e.code||e.shiftKey||(e.preventDefault(),b())},onChange:function(e){return t=e.target.value,y&&w(!1),u&&R(),void O(t);var t}}),g&&React.createElement(ki.tm,{active:y,disabled:!s||v,className:"mwai-microphone",onClick:function(){return w(!y)}}))};var _l=wp.element,xl=_l.useMemo,Sl=_l.useCallback;const Tl=function(){var e=(0,Ai.o)(),t=e.state,n=e.actions,r=n.onClear,a=n.onSubmitAction,o=n.setIsListening,i=t.textClear,l=t.textSend,c=t.uploadedFile,u=t.inputText,s=t.messages,f=t.isListening,m=t.timeElapsed,d=t.busy,p=t.submitButtonConf,h=t.locked,y=!(null==c||!c.uploadProgress),v=!(null!=c&&c.uploadedId)&&u.length<1&&(null==s?void 0:s.length)>1,g=xl((function(){return d?m?React.createElement("div",{className:"mwai-timer"},m):null:null!=p&&p.imageSend&&null!=p&&p.imageClear?React.createElement("img",{src:v?p.imageClear:p.imageSend,alt:v?i:l}):React.createElement("span",null,v?i:l)}),[d,m,v,i,l,p]),E=xl((function(){return"mwai-input-submit ".concat(d?"mwai-busy":"")}),[d]),b=Sl((function(){f&&o(!1),v?r():a()}),[v,f,r,a,o]),w=Sl((function(){d||b()}),[d,b]);return React.createElement("button",{className:E,disabled:d||y||h,onClick:w},g)};var Nl=wp.element.useMemo;const Cl=function(){var e=(0,Ai.o)(),t=e.state,n=e.actions,r=t.theme,a=t.isWindow,o=t.fullscreen,i=t.aiName,l=t.pluginUrl,c=t.open,u=t.iconUrl,s=t.aiAvatarUrl,f=t.windowed,m=n.setOpen,d=n.setWindowed,p=Nl((function(){if(!a)return null;var e="timeless"===(null==r?void 0:r.themeId),t=e?function(e,t,n,r){var a;if((0,Lo.Ve)(r||n))return a=r||n,React.createElement("div",{className:"mwai-avatar mwai-emoji",style:{fontSize:"48px",lineHeight:"48px"}},a);var o,i,l=(o=r,((0,ki.mv)(o)?o:o?"".concat(t,"/images/").concat(o):null)||n||"".concat(t,"/images/chat-openai.svg"));return l?(i=l,"AI Engine",React.createElement("div",{className:"mwai-avatar"},React.createElement("img",{alt:"AI Engine",src:i}))):React.createElement("div",{className:"mwai-name-text"},e)}(i,l,u,s):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,i)),React.createElement("div",{style:{flex:"auto"}})),React.createElement("div",{className:"mwai-buttons"},o&&React.createElement("div",{className:"mwai-resize-button",onClick:function(){return d(!f)}}),React.createElement("div",{className:"mwai-close-button",onClick:function(){return m(!c)}})))}),[a,null==r?void 0:r.themeId,i,l,u,s,o,d,f,m,c]);return React.createElement("div",{className:"mwai-header"},p)};var Il=wp.element,Al=Il.useMemo,kl=Il.useEffect;const Ll=function(){var e=(0,Ai.o)(),t=e.state,n=e.actions,r=t.isWindow,a=t.iconText,o=t.showIconMessage,i=t.iconAlt,l=t.iconUrl,c=t.open,u=n.setShowIconMessage,s=n.setOpen;kl((function(){c&&o&&u(!1)}),[c,u,o]);var f=Al((function(){return r?React.createElement("div",{className:"mwai-trigger mwai-open-button"},React.createElement(ki.bE,{className:"mwai-icon-text-container",if:a&&o},React.createElement("div",{className:"mwai-icon-text-close",onClick:function(){return u(!1)}},"✕"),React.createElement("div",{className:"mwai-icon-text",onClick:function(){return s(!0)}},a)),React.createElement("div",{className:"mwai-icon-container",onClick:function(){return s(!0)}},(0,Lo.Ve)(l)?React.createElement("div",{className:"mwai-icon mwai-emoji",style:{fontSize:"48px",lineHeight:"64px",width:"64px",height:"64px",display:"flex",justifyContent:"center",alignItems:"center"}},l):React.createElement("img",{className:"mwai-icon",width:"64",height:"64",alt:i,src:l}))):null}),[r,a,o,i,l,u,s]);return React.createElement(React.Fragment,null,f)};function Ml(e){return Ml="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},Ml(e)}function Pl(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 jl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pl(Object(n),!0).forEach((function(t){Fl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Fl(e,t,n){var r;return r=function(e,t){if("object"!=Ml(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ml(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==Ml(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dl(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 Gl=wp.element,Ul=Gl.useState,Bl=Gl.useMemo,Hl=Gl.useLayoutEffect,Yl=Gl.useCallback,zl=Gl.useEffect,Wl=Gl.useRef,Vl={overrides:{a:{props:{target:"_blank"}}}};const Kl=function(e){var t,n,r=(0,ki.gR)(),a=e.style,o=(t=Ul(!0),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Dl(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)?Dl(e,t):void 0}}(t,n)||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.")}()),i=o[0],l=o[1],c=(0,Ai.o)(),u=c.state,s=c.actions,f=u.theme,m=u.botId,d=u.customId,p=u.messages,h=u.textCompliance,y=u.isWindow,v=u.fullscreen,g=u.iconPosition,E=u.iconBubble,b=u.shortcuts,w=u.blocks,R=u.imageUpload,O=u.fileSearch,_=u.draggingType,x=u.isBlocked,S=u.virtualKeyboardFix,T=u.windowed,N=u.cssVariables,C=u.error,I=u.conversationRef,A=u.open,k=u.busy,L=u.uploadIconPosition,M=s.resetError,P=s.onSubmit,j=s.setIsBlocked,F=s.setDraggingType,D=s.onUploadFile,G=Bl((function(){return"css"===(null==f?void 0:f.type)?null==f?void 0:f.style:null}),[f]),U=R||O,B=U||h,H=Wl(null),Y=(0,ki.kW)(),z=Y.viewportHeight,W=Y.isIOS,V=Y.isAndroid;zl((function(){if(S&&(W||V)&&y){var e=document.querySelector(".mwai-window");e&&(A?(e.style.height="".concat(z,"px"),W&&function(){if("INPUT"===document.activeElement.tagName||"TEXTAREA"===document.activeElement.tagName){window.scrollTo({top:0});var e=setInterval((function(){window.scrollTo({top:0})}),100);setTimeout((function(){clearInterval(e)}),1e3)}}()):e.style.height="")}}),[v,V,W,y,T,A,z,S]);var K=r("mwai-chatbot",Fl(Fl(Fl(Fl(Fl(Fl(Fl(Fl({},"mwai-".concat(null==f?void 0:f.themeId,"-theme"),!0),"mwai-window",y),"mwai-bubble",E),"mwai-open",A),"mwai-fullscreen",!T||!y&&v),"mwai-bottom-left","bottom-left"===g),"mwai-top-right","top-right"===g),"mwai-top-left","top-left"===g));Hl((function(){i&&I.current&&(I.current.scrollTop=I.current.scrollHeight)}),[p,i,I,k]);var q=Wl(new Set);zl((function(){w&&w.length>0&&w.forEach((function(e){var t=e.type,n=e.data;"content"===t&&n.script&&function(e){var t=function(e){var t,n=0;if(0===e.length)return n;for(t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return n}(e);if(!q.current.has(t)){var n=document.createElement("script");n.type="text/javascript",n.textContent=e,document.body.appendChild(n),q.current.add(t)}}(n.script)}))}),[w]);var X=Bl((function(){return null==p?void 0:p.map((function(e){return React.createElement(ul,{key:e.id,message:e})}))}),[p]),$=Bl((function(){return b&&0!==b.length?React.createElement("div",{className:"mwai-shortcuts"},b.map((function(e,t){var n=e.type,a=e.data;if("message"!==n)return console.warn("This shortcut type is not supported: ".concat(n,".")),null;var o=a.label,i=a.message,l=a.variant,c=a.icon,u=r("mwai-shortcut",{"mwai-success":"success"===l,"mwai-danger":"danger"===l,"mwai-warning":"warning"===l,"mwai-info":"info"===l}),s=c&&c.startsWith("http"),f=c&&!s&&c.length>=1&&c.length<=2;return React.createElement("button",{className:u,key:t,onClick:function(){P(i)}},(s||f)&&React.createElement(React.Fragment,null,React.createElement("div",{className:"mwai-icon"},s&&React.createElement("img",{src:c,alt:o||"AI Shortcut"}),f&&React.createElement("span",{role:"img","aria-label":"AI Shortcut"},c)),React.createElement("div",{style:{flex:"auto"}})),React.createElement("div",{className:"mwai-label"},o||"N/A"))}))):null}),[r,P,b]),Q=Bl((function(){return w&&0!==w.length?React.createElement("div",{className:"mwai-blocks"},w.map((function(e,t){var n=e.type,a=e.data;if("content"!==n)return console.warn("Block type ".concat(n," is not supported.")),null;var o=a.html,i=a.variant,l=r("mwai-block",{"mwai-success":"success"===i,"mwai-danger":"danger"===i,"mwai-warning":"warning"===i,"mwai-info":"info"===i});return React.createElement("div",{className:l,key:t,dangerouslySetInnerHTML:{__html:o}})}))):null}),[r,w]),J=Yl((function(e,t){e.preventDefault(),e.stopPropagation();var n=e.dataTransfer.items[0];t?(H.current&&(clearTimeout(H.current),H.current=null),R&&function(e){return e.type.startsWith("image/")}(n)?(F("image"),j(!1)):O&&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)?(F("document"),j(!1)):(F(!1),j(!0))):H.current||(H.current=setTimeout((function(){F(!1),j(!1),H.current=null}),100))}),[R,O]),Z=Yl((function(e){if(e.preventDefault(),J(e,!1),!k){var t=e.dataTransfer.files[0];t&&("image"===_&&R||"document"===_&&O?D(t):(j(!0),setTimeout((function(){return j(!1)}),2e3)))}}),[k,_,R,O,D]),ee=r("mwai-input",{"mwai-dragging":_,"mwai-blocked":x});return React.createElement(ki.bE,{id:"mwai-chatbot-".concat(d||m),className:K,style:jl(jl({},N),a),if:!0,disableTransition:!y},G&&React.createElement("style",null,G),React.createElement(Ll,null),React.createElement(Cl,null),React.createElement("div",{className:"mwai-content"},React.createElement("div",{ref:I,className:"mwai-conversation",onScroll:function(){if(I.current){var e=I.current,t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;l(n-t<=r+1)}}},X,$),C&&React.createElement("div",{className:"mwai-error",onClick:function(){return M()}},React.createElement(wa.Ay,{options:Vl},C)),Q,React.createElement("div",{className:ee,onDrop:Z,onDragEnter:function(e){return J(e,!0)},onDragLeave:function(e){return J(e,!1)},onDragOver:function(e){return J(e,!0)}},React.createElement(Ol,null),React.createElement(Tl,null)),B&&React.createElement("div",{className:"mwai-footer"},U&&React.createElement("div",{className:"mwai-tools"},"mwai-tools"===L&&React.createElement(yl,null)),h&&React.createElement("div",{className:"mwai-compliance",dangerouslySetInnerHTML:{__html:h}}))))},ql=function(e){return React.createElement(Ai.G,e,React.createElement(Kl,e))};function Xl(e){return Xl="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},Xl(e)}function $l(){$l=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Xl(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Xl(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Ql(e){return function(e){if(Array.isArray(e))return oc(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ac(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 Jl(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 Zl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Jl(Object(n),!0).forEach((function(t){ec(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ec(e,t,n){var r;return r=function(e,t){if("object"!=Xl(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Xl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==Xl(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tc(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function nc(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){tc(o,r,a,i,l,"next",e)}function l(e){tc(o,r,a,i,l,"throw",e)}i(void 0)}))}}function rc(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||ac(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 ac(e,t){if(e){if("string"==typeof e)return oc(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)?oc(e,t):void 0}}function oc(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 ic=wp.element,lc=ic.useMemo,cc=ic.useState,uc=ic.useEffect,sc=function(e){e?localStorage.setItem("mwai-admin-chatbotKey",e):localStorage.removeItem("mwai-admin-chatbotKey")};const fc=function(e){var t,n,r=(0,u.jE)(),a=e.options,o=e.updateOption,i=e.busy,l=rc(cc("chatbots"),2),c=l[0],m=l[1],d=rc(cc(!1),2),p=d[0],h=d[1],y=rc(cc((function(){return localStorage.getItem("mwai-admin-chatbotKey")||"chatbot-key-0"})),2),v=y[0],g=y[1],R=null==a?void 0:a.chatbot_defaults,O=(0,s.z)().colors,_=(0,f.I)({queryKey:["chatbots"],queryFn:hn,initialData:F}).data,x=(0,f.I)({queryKey:["themes"],queryFn:mn,initialData:P}).data,T=null!==(t=null==a?void 0:a.botId)&&void 0!==t?t:"none",I=null!==(n=null==a?void 0:a.chatbot_select)&&void 0!==n?n:"tabs",A=i||p,L=rc(cc({}),2),D=L[0],G=L[1];uc((function(){if(_){var e={};if(_.forEach((function(t,n){e["chatbot-key-".concat(n)]=t.botId})),G(e),!v||!(v in e)){var t=Object.keys(e)[0];g(t),sc(t)}}}),[_,v]);var U=lc((function(){if(_)return _.find((function(e){return"default"===e.botId}))}),[_]),B=lc((function(){if(_&&v&&D[v]){var e=D[v];return _.find((function(t){return t.botId===e}))}return null}),[_,v,D]),H=lc((function(){return x&&B?x.find((function(e){return e.themeId===(null==B?void 0:B.themeId)})):x.find((function(e){return"chatgpt"===e.themeId}))}),[B,x]),Y=function(){var e=nc($l().mark((function e(t,n){var a,o,i;return $l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("botId"!==n||"default"!==t){e.next=3;break}return alert("You cannot name a chatbot 'default'. Please choose another name."),e.abrupt("return");case 3:if("botId"!==n||""!==t){e.next=6;break}return alert("Your chatbot must have an ID."),e.abrupt("return");case 6:if("botId"!==n||!_.find((function(e){return e.botId===t}))){e.next=9;break}return alert("This chatbot ID is already in use. Please choose another ID."),e.abrupt("return");case 9:if(h(!0),a=Zl(Zl({},B),{},ec({},n,t)),o=Ql(_),!B){e.next=21;break}if(-1===(i=o.findIndex((function(e){return e.botId===B.botId})))){e.next=21;break}return o[i]=a,e.next=18,yn(o);case 18:o=e.sent,r.setQueryData(["chatbots"],o),"botId"===n&&G((function(e){return Zl(Zl({},e),{},ec({},v,t))}));case 21:h(!1);case 22:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),z=function(){var e=nc($l().mark((function e(){var t,n,a,o,i,l=arguments;return $l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]?l[0]:R,h(!0),n="chatbot-"+Rt(),delete(a=Zl(Zl({},t),{},{botId:n,name:"New Chatbot"})).functions,e.next=8,yn([].concat(Ql(_),[a]));case 8:o=e.sent,r.setQueryData(["chatbots"],o),i="chatbot-key-".concat(Object.keys(D).length),G((function(e){return Zl(Zl({},e),{},ec({},i,n))})),g(i),sc(i),h(!1);case 15:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),W=function(){var e=nc($l().mark((function e(){var t,n,a,o;return $l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h(!0),t=D[v],n=Ql(_.filter((function(e){return e.botId!==t}))),e.next=5,yn(n);case 5:n=e.sent,r.setQueryData(["chatbots"],n),delete(a=Zl({},D))[v],G(a),o=Object.keys(a)[0],g(o),sc(o),h(!1);case 14:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),V=function(){var e=nc($l().mark((function e(){var t,n;return $l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h(!0),t=Ql(_),n=t.findIndex((function(e){return e.botId===B.botId})),t[n]=Zl(Zl({},R),{},{botId:B.botId,name:B.name}),e.next=6,yn(t);case 6:t=e.sent,r.setQueryData(["chatbots"],t),h(!1);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),K=function(){var e=nc($l().mark((function e(){return $l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:z(B);case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return React.createElement(React.Fragment,null,React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0,fullWidth:!0,style:{margin:10}},React.createElement(qt.V,null,React.createElement(ko,{currentChatbot:B}),React.createElement("label",{style:{marginLeft:5}},He.COMMON.CHATBOTS),React.createElement(Xt.S,{style:{marginLeft:5},disabled:A,onLabel:"",offLabel:"",width:42,offValue:"chatbots",onValue:"themes",offBackgroundColor:O.blue,onBackgroundColor:O.purple,checked:"themes"===c,onChange:m}),React.createElement("label",{style:{marginLeft:5}},He.COMMON.THEMES),React.createElement("div",{style:{flex:"auto"}}),React.createElement("label",null,He.COMMON.SITE_WIDE_CHATBOT,":"),React.createElement(we.u,{scrolldown:!0,name:"botId",disabled:A,style:{minWidth:160},value:T,onChange:o},React.createElement(we.j,{value:"none",label:"None"}),null==_?void 0:_.map((function(e){return React.createElement(we.j,{key:e.botId,value:e.botId,label:e.name})}))))),React.createElement(E.Y,{minimal:!0,style:{margin:10}},"chatbots"===c&&React.createElement(React.Fragment,null,"dropdown"===I&&React.createElement(React.Fragment,null,React.createElement("div",{style:{display:"flex",alignItems:"center",marginBottom:10}},React.createElement(we.u,{scrolldown:!0,textFiltering:!0,name:"botId",disabled:A,style:{flex:"auto",marginRight:10},value:v,onChange:g},null==_?void 0:_.map((function(e,t){return React.createElement(we.j,{key:e.botId,value:"chatbot-key-".concat(t),label:e.name})}))),React.createElement(w.M,{rounded:!0,className:"secondary",icon:"plus",disabled:A,onClick:function(){return z()}})),B&&React.createElement(xe.L,{style:{borderRadius:10}},React.createElement(Ko,{style:{margin:"-10px -10px"},options:a,themes:x,defaultChatbot:U,deleteCurrentChatbot:W,resetCurrentChatbot:V,duplicateCurrentChatbot:K,shortcodeParams:B,updateShortcodeParams:Y}))),"tabs"===I&&React.createElement(React.Fragment,null,React.createElement(b._,{inversed:!0,onChange:function(e,t){g(t.key),sc(t.key)},currentTab:v,action:React.createElement(w.M,{rounded:!0,className:"secondary",icon:"plus",disabled:A,onClick:function(){return z()}})},Object.entries(D).map((function(e){var t=rc(e,2),n=t[0],r=t[1],o=_.find((function(e){return e.botId===r}));return React.createElement(b.V,{key:n,title:o.name,busy:p},React.createElement(Ko,{options:a,themes:x,defaultChatbot:U,deleteCurrentChatbot:W,resetCurrentChatbot:V,duplicateCurrentChatbot:K,shortcodeParams:o,updateShortcodeParams:Y}))}))))),"themes"===c&&React.createElement(Ii,{themes:x,options:a,updateOption:o,currentTheme:H,onSwitchTheme:function(e){Y(e,"themeId")}})),React.createElement(E.Y,{minimal:!0,style:{maxWidth:"50%"}},React.createElement("small",{style:{marginLeft:15,marginBottom:-20}},"Chatbot: ",React.createElement("b",null,null==B?void 0:B.name)," - Theme: ",React.createElement("b",null,null==H?void 0:H.name)),React.createElement("div",{style:{position:"relative",margin:"5px 10px 10px 10px",minHeight:480,borderRadius:5,padding:10,border:"2px dashed rgb(0 0 0 / 20%)",background:"rgb(0 0 0 / 5%)"}},!!B&&React.createElement(ql,{system:{botId:B.botId,userData:C,sessionId:M,restNonce:k,pluginUrl:N,restUrl:S,stream:j,debugMode:null==a?void 0:a.debug_mode,typewriter:null==a?void 0:a.chatbot_typewriter,speech_recognition:null==a?void 0:a.shortcode_chat_speech_recognition,speech_synthesis:null==a?void 0:a.shortcode_chat_speech_synthesis},params:B,theme:H,style:B.window||B.fullscreen?{position:"absolute"}:{}})),React.createElement("div",{style:{marginLeft:10,fontSize:11,lineHeight:"140%",opacity:.5}},"This is the actual chatbot, but there might be some differences when run on your front-end, depending on your theme and the other plugins you use."))))};var mc=n(421);function dc(e){return dc="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},dc(e)}function pc(e){return function(e){if(Array.isArray(e))return Ec(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||gc(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 hc(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 yc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?hc(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=dc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=dc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==dc(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vc(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||gc(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 gc(e,t){if(e){if("string"==typeof e)return Ec(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)?Ec(e,t):void 0}}function Ec(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 bc(){bc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==dc(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(dc(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 wc(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Rc(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){wc(o,r,a,i,l,"next",e)}function l(e){wc(o,r,a,i,l,"throw",e)}i(void 0)}))}}var Oc=wp.element,_c=Oc.useMemo,xc=Oc.useState,Sc=Oc.useEffect,Tc=[{accessor:"id",visible:!1},{accessor:"time",title:"Time",width:"80px",sortable:!0},{accessor:"scope",title:"Scope",width:"90px",filters:{type:"checkbox",options:[{value:"chatbot",label:"Chatbot"},{value:"form",label:"Form"},{value:"playground",label:"Playground"}]}},{accessor:"user",title:"User",width:"85px",filters:{type:"text",description:"Type an User ID, or an IP."}},{accessor:"model",title:"Model"},{accessor:"units",title:"Units",width:"65px",align:"right",sortable:!0},{accessor:"price",title:"Price",width:"85px",align:"right",sortable:!0}],Nc=function(){var e=Rc(bc().mark((function e(t){var n;return bc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.offset=(t.page-1)*t.limit,e.next=3,(0,O.IU)("".concat(T,"/system/logs/list"),{nonce:k,method:"POST",json:t});case 3:return n=e.sent,e.abrupt("return",n?{total:n.total,logs:n.logs}:{total:0,logs:[]});case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Cc=function(){var e=Rc(bc().mark((function e(){var t,n,r=arguments;return bc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:[],e.next=3,(0,O.IU)("".concat(T,"/system/logs/delete"),{nonce:k,method:"POST",json:{logIds:t}});case 3:return n=e.sent,e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();const Ic=function(e){var t=e.setSelectedLogIds,n=e.selectedLogIds,r=(0,u.jE)(),a=vc(xc(!1),2),o=a[0],i=a[1],l=ft(L,null,!0).getModelName,c=vc(xc((function(){return Tc.filter((function(e){return e.filters})).map((function(e){return{accessor:e.accessor,value:[]}}))})),2),s=c[0],m=c[1],d=vc(xc({filters:s,sort:{accessor:"time",by:"desc"},page:1,limit:20}),2),p=d[0],h=d[1],y=(0,f.I)({queryKey:["logs",p],queryFn:function(){return Nc(p)}}),v=y.isFetching,g=y.data,E=y.error;Sc((function(){h(yc(yc({},p),{},{filters:s}))}),[s]);var b=_c((function(){return(null==g?void 0:g.total)||0}),[g]),O=_c((function(){return null!=g&&g.logs?null==g?void 0:g.logs.sort((function(e,t){return t.created_at-e.created_at})).map((function(e){var t,n=bt(e.time),r=wt(e.userId,e.ip),a=Math.round(1e3*e.price)/1e3,o=React.createElement(React.Fragment,null,"∞");e.price>=.001&&(o=React.createElement("b",null,"$",a.toFixed(3))),e.price>=.01&&(o=React.createElement("b",null,"$",a.toFixed(2))),e.price>=.1&&(o=React.createElement("b",{style:{color:"red"}},"$",a.toFixed(2)));var i=(null==L||null===(t=L.ai_envs)||void 0===t||null===(t=t.find((function(t){return t.id===e.envId})))||void 0===t?void 0:t.name)||e.envId,c=React.createElement("div",null,React.createElement("span",{title:e.model},l(e.model),"assistant"===e.mode&&React.createElement("i",null," (Assistant)")),React.createElement("br",null),React.createElement("small",null,i));return{id:e.id,scope:React.createElement("div",null,e.scope,React.createElement("br",null),React.createElement("small",null,e.session)),user:r,model:c,units:React.createElement("div",{style:{textAlign:"right"}},e.units,React.createElement("br",null),React.createElement("small",null,e.type)),price:React.createElement(React.Fragment,null,o,React.createElement("br",null),React.createElement("small",null,"$",e.price)),time:React.createElement("div",{style:{textAlign:"right"}},n)}})):[]}),[g]),_=function(){var e=Rc(bc().mark((function e(){return bc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i(!0),n.length){e.next=9;break}if(window.confirm(He.ALERTS.ARE_YOU_SURE)){e.next=5;break}return i(!1),e.abrupt("return");case 5:return e.next=7,Cc();case 7:e.next=12;break;case 9:return e.next=11,Cc(n);case 11:t([]);case 12:return e.next=14,r.invalidateQueries({queryKey:["logs"]});case 14:return e.next=16,r.refetchQueries({queryKey:["logs"]});case 16:i(!1);case 17:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),x=_c((function(){return null!=E&&E.message?React.createElement(Ne.X,{variant:"danger",style:{margin:"5px 5px"}},React.createElement("b",null,E.message),React.createElement("br",null),React.createElement("small",null,"Check your Console Logs and PHP Error Logs for more information.")):null}),[E]);return React.createElement(React.Fragment,null,React.createElement(R.z,{className:"primary",title:He.COMMON.QUERIES,action:React.createElement(React.Fragment,null,React.createElement("div",null,React.createElement(w.M,{className:"secondary",style:{marginLeft:5},disabled:v,onClick:Rc(bc().mark((function e(){return bc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.invalidateQueries({queryKey:["logs"]});case 2:r.refetchQueries({queryKey:["logs"]});case 3:case"end":return e.stop()}}),e)})))},He.COMMON.REFRESH),n.length>0&&React.createElement(React.Fragment,null,React.createElement(w.M,{className:"danger",disabled:!1,onClick:_},He.COMMON.DELETE))))},React.createElement(Kt.o,{busy:v||o,onSelectRow:function(e){1!==n.length||n[0]!==e?t([e]):t([])},onSelect:function(e){t([].concat(pc(n),pc(e)))},onUnselect:function(e){t(pc(null==n?void 0:n.filter((function(t){return!e.includes(t)}))))},selectedItems:n,sort:p.sort,onSortChange:function(e,t){h(yc(yc({},p),{},{sort:{accessor:e,by:t}}))},emptyMessage:x,filters:s,onFilterChange:function(e,t){var n=[].concat(pc(s.filter((function(t){return t.accessor!==e}))),[{accessor:e,value:t}]);m(n)},data:O,columns:Tc}),React.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:10,marginBottom:-5}},React.createElement(w.M,{className:"danger",disabled:n.length,onClick:_},He.COMMON.DELETE_ALL),React.createElement("div",{style:{flex:"auto"}}),React.createElement(Qt.Q,{currentPage:p.page,limit:p.limit,onCurrentPageChanged:function(e){return h(yc(yc({},p),{},{page:e}))},total:b,onClick:function(e){h(yc(yc({},p),{},{page:e}))}}))),React.createElement(R.z,{className:"primary",title:"Information"},React.createElement("p",null,React.createElement("b",null,"Prices and tokens counts aren't accurate in many cases.")),React.createElement("p",null,"For more information, check this: ",React.createElement("a",{href:"https://www.notion.so/meowarts/Cost-Usage-Calculation-d5ce4917d77f4939b232b20d0082368a?pvs=4",target:"_blank"},"Cost & Usage Calculation"),". You are also always welcome to discuss about it in the ",React.createElement("a",{href:"https://discord.gg/bHDGh38",target:"_blank"},"Discord Server"),".")))};function Ac(e){return Ac="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},Ac(e)}function kc(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 Lc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?kc(Object(n),!0).forEach((function(t){Mc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Mc(e,t,n){var r;return r=function(e,t){if("object"!=Ac(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ac(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==Ac(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pc(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return jc(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)?jc(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 jc(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 Fc(){Fc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Ac(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Ac(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Dc(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Gc(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Dc(o,r,a,i,l,"next",e)}function l(e){Dc(o,r,a,i,l,"throw",e)}i(void 0)}))}}var Uc=wp.element,Bc=Uc.useMemo,Hc=Uc.useState,Yc=function(){var e=Gc(Fc().mark((function e(t){var n;return Fc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",null);case 2:return e.next=4,(0,O.IU)("".concat(T,"/system/logs/meta"),{nonce:k,method:"POST",json:{logId:t,metaKeys:["query","reply","fields"]}});case 4:return n=e.sent,e.abrupt("return",n.data);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();const zc=function(e){var t,n=e.options,r=e.updateOption,a=e.busy,o=Pc(Hc([]),2),i=o[0],l=o[1],c=Pc(Hc("users"),2),u=c[0],s=c[1],m=Bc((function(){return 1===i.length?i[0]:null}),[i]),d=null==n?void 0:n.limits,p=null==n?void 0:n.default_limits,h=(0,f.I)({queryKey:["logsMeta",m],queryFn:function(){return Yc(m)},staleTime:864e5}),v=h.isFetching,g=h.data,_=function(){var e=Gc(Fc().mark((function e(t,n){var a;return Fc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=Lc(Lc({},d),{},Mc({},n,t)),e.next=3,r(a,"limits");case 3:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),x=Bc((function(){return null!=d&&d[u]?null==d?void 0:d[u]:{credits:1,creditType:"price",timeFrame:"month",isAbsolute:!1,overLimitMessage:"You have reached the limit.",ignoredUsers:""}}),[d,u]),S=function(){var e=Gc(Fc().mark((function e(t,n){var a,o;return Fc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"credits"===n&&(t=Math.max(0,t)),a=Lc(Lc({},x),{},Mc({},n,t)),o=Lc(Lc({},d),{},Mc({},u,a)),e.next=5,r(o,"limits");case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),T=function(){var e=Gc(Fc().mark((function e(){return Fc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!confirm(He.ALERTS.ARE_YOU_SURE)){e.next=3;break}return e.next=3,r(p,"limits");case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),N=Bc((function(){return Array.isArray(g)?null:g}),[g]);return React.createElement(React.Fragment,null,React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0,style:{flex:2.5}},React.createElement(Ic,{selectedLogIds:i,setSelectedLogIds:l})),React.createElement(E.Y,{minimal:!0},m&&React.createElement(React.Fragment,null,React.createElement(_e.g,{large:!0}),React.createElement(b._,{inversed:!0,style:{marginRight:10,marginLeft:10}},React.createElement(b.V,{title:"Query"},React.createElement("div",{style:{height:380,overflow:"auto",maxHeight:380}},v&&React.createElement("i",{style:{color:"gray"}},"Loading..."),!v&&!N&&React.createElement("i",{style:{color:"gray"}},He.COMMON.DATA_NOT_AVAILABLE),!v&&N&&React.createElement(mc.p2,{value:N.query,rootName:"query",indentWidth:2,displayDataTypes:!1,displayObjectSize:!1,displayArrayKey:!1,enableClipboard:!1,style:{fontSize:12}}))),React.createElement(b.V,{title:"Reply"},React.createElement("div",{style:{height:380,overflow:"auto",maxHeight:380}},v&&React.createElement("i",{style:{color:"gray"}},"Loading..."),!v&&!N&&React.createElement("i",{style:{color:"gray"}},He.COMMON.DATA_NOT_AVAILABLE),!v&&N&&React.createElement(mc.p2,{value:N.reply,rootName:"reply",indentWidth:2,displayDataTypes:!1,displayObjectSize:!1,displayArrayKey:!1,enableClipboard:!1,style:{fontSize:12}}))),N&&N.fields&&React.createElement(b.V,{title:"Fields"},React.createElement("div",{style:{height:380,overflow:"auto",maxHeight:380}},v&&React.createElement("i",{style:{color:"gray"}},"Loading..."),!v&&!N&&React.createElement("i",{style:{color:"gray"}},He.COMMON.DATA_NOT_AVAILABLE),!v&&N&&React.createElement(mc.p2,{value:N.fields,rootName:"fields",indentWidth:2,displayDataTypes:!1,displayObjectSize:!1,displayArrayKey:!1,enableClipboard:!1,style:{fontSize:12}}))))),React.createElement(yo,null,React.createElement(R.z,{className:"primary",busy:a,title:"Limits",style:{flex:1}},React.createElement(y.R,{name:"enabled",label:He.STATISTICS.ENABLE_LIMITS,checked:null==d?void 0:d.enabled,value:"1",onChange:_}),(null==d?void 0:d.enabled)&&React.createElement(React.Fragment,null,React.createElement(_e.g,null),React.createElement(Vt.o,{value:u,busy:a,onChange:function(e){s(e)}},React.createElement(Vt.K,{title:He.COMMON.USERS,value:"users",disabled:!(null!=d&&d.enabled)}),React.createElement(Vt.K,{title:He.COMMON.GUESTS,value:"guests"}),React.createElement(Vt.K,{title:He.COMMON.SYSTEM,value:"system"})),"userId"===(null==d?void 0:d.target)&&React.createElement(React.Fragment,null,React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,"Message for Guests:"),React.createElement(Re.A,{id:"guestMessage",name:"guestMessage",disabled:!(null!=d&&d.enabled),value:null==d?void 0:d.guestMessage,onEnter:S,onBlur:S})))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.CREDITS,":"),React.createElement(Re.A,{id:"credits",name:"credits",type:"number",min:"0",max:"1000000",disabled:!(null!=d&&d.enabled),value:x.credits,onEnter:S,onBlur:S})),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.TYPE,":"),React.createElement(we.u,{scrolldown:!0,id:"creditType",name:"creditType",disabled:!(null!=d&&d.enabled),value:x.creditType,onChange:S},React.createElement(we.j,{key:"queries",id:"queries",value:"queries",label:"Queries"}),React.createElement(we.j,{key:"units",id:"units",value:"units",label:"Tokens"}),React.createElement(we.j,{key:"price",id:"price",value:"price",label:"Dollars"})))),0!==x.credits&&React.createElement("p",null,"If you want to apply variable amount of credits, ",React.createElement("a",{href:"https://meowapps.com/ai-engine/faq/#limits",target:"_blank",rel:"noreferrer"},"click here"),"."),0!==x.credits&&"price"===x.creditType&&React.createElement("p",null,"The dollars represent the budget you spent through OpenAI."),0===x.credits&&React.createElement("p",null,"Since there are no credits, the Message for No Credits Message with be displayed."),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.TIMEFRAME,":"),React.createElement(we.u,{scrolldown:!0,id:"timeFrame",name:"timeFrame",disabled:!(null!=d&&d.enabled),value:x.timeFrame,onChange:S},React.createElement(we.j,{key:"second",id:"second",value:"second",label:"Second"}),React.createElement(we.j,{key:"minute",id:"minute",value:"minute",label:"Minute"}),React.createElement(we.j,{key:"hour",id:"hour",value:"hour",label:"Hour"}),React.createElement(we.j,{key:"day",id:"day",value:"day",label:"Day"}),React.createElement(we.j,{key:"week",id:"week",value:"week",label:"Week"}),React.createElement(we.j,{key:"month",id:"month",value:"month",label:"Month"}),React.createElement(we.j,{key:"year",id:"year",value:"year",label:"Year"}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.ABSOLUTE,":"),React.createElement(y.R,{name:"isAbsolute",label:"Yes",disabled:!(null!=d&&d.enabled),checked:x.isAbsolute,value:"1",onChange:S}))),x.isAbsolute&&React.createElement("p",null,(0,O.FE)(He.STATISTICS.ABSOLUTE_HELP)),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.STATISTICS.NO_CREDITS_MESSAGE,":"),React.createElement(Re.A,{id:"overLimitMessage",name:"overLimitMessage",disabled:!(null!=d&&d.enabled),value:x.overLimitMessage,onEnter:S,onBlur:S}))),"users"===u&&React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.STATISTICS.FULL_ACCESS_USERS,":"),React.createElement(we.u,{scrolldown:!0,id:"ignoredUsers",name:"ignoredUsers",disabled:!(null!=d&&d.enabled),value:null==d||null===(t=d.users)||void 0===t?void 0:t.ignoredUsers,description:"",onChange:S},React.createElement(we.j,{key:"none",id:"none",value:"",label:He.COMMON.NONE}),React.createElement(we.j,{key:"editor",id:"editor",value:"administrator,editor",label:He.COMMON.EDITORS_ADMINS}),React.createElement(we.j,{key:"admin",id:"admin",value:"administrator",label:He.COMMON.ADMINS_ONLY})))),React.createElement(_e.g,null),React.createElement(w.M,{fullWidth:!0,className:"danger",onClick:T},He.COMMON.RESET_LIMITS)))))))};var Wc=n(7392);function Vc(e){return Vc="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},Vc(e)}function Kc(){Kc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Vc(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Vc(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 qc(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}const Xc=function(e){var t=e.options,n=e.updateOption,r=(e.setOptions,null==t?void 0:t.debug_mode),a=null==t?void 0:t.server_debug_mode,o=function(){var e,t=(e=Kc().mark((function e(){var t,n,r,a,o;return Kc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=prompt("Enter the Post ID you want to retrieve the content from.")){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,gt(null,null,t);case 5:n=e.sent,console.log("Data for Post ID ".concat(t),n),null!=n&&n.content&&(r=n.content.trim().replace(/<[^>]*>?/gm,""),a=r.split(" ")[0],o=r.split(" ").pop(),console.log("Content First Word: ".concat(a)),console.log("Content Last Word: ".concat(o)));case 8:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){qc(o,r,a,i,l,"next",e)}function l(e){qc(o,r,a,i,l,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}(),i=React.createElement(p.d,{title:He.COMMON.CLIENT_DEBUG},React.createElement(y.R,{name:"debug_mode",label:He.COMMON.ENABLE,value:"1",checked:r,description:He.COMMON.CLIENT_DEBUG_HELP,onChange:n})),l=React.createElement(p.d,{title:He.COMMON.SERVER_DEBUG},React.createElement(y.R,{name:"server_debug_mode",label:He.COMMON.ENABLE,value:"1",checked:a,description:He.COMMON.SERVER_DEBUG_HELP,onChange:n}));return React.createElement(React.Fragment,null,React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(R.z,{title:"Debugging",className:"primary"},React.createElement(w.M,{onClick:o},"Get Content"),React.createElement("p",null,"This button will display the content of the post, as seen by AI Engine, in your Developer Tools Console. That allows you to check what AI Engine uses when using Content Aware, Embeddings Sync, etc."))),React.createElement(E.Y,{minimal:!0},React.createElement(R.z,{title:"Settings",className:"primary"},i,l),a&&React.createElement(Wc.k,{refreshQuery:bn,clearQuery:wn,i18n:He}))))};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}var Qc=wp.element.useMemo,Jc=function(e){var t=e.env,n=e.updateEnvironment,r=e.deleteEnvironment,a=e.ai_envs,o=e.options,i=ft(o,null==t?void 0:t.ai_embeddings_env).embeddingsModels,l=Qc((function(){return i.find((function(e){return e.model===t.ai_embeddings_model}))}),[i,t.ai_embeddings_model]);return React.createElement(React.Fragment,null,React.createElement(p.d,{title:He.COMMON.NAME},React.createElement(Re.A,{name:"name",value:t.name,onFinalChange:function(e){return n(t.id,{name:e})}})),React.createElement(p.d,{title:He.COMMON.TYPE},React.createElement(we.u,{scrolldown:!0,name:"type",value:t.type,description:"qdrant"===t.type?(0,O.FE)(He.HELP.QDRANT):null,onChange:function(e){return n(t.id,{type:e})}},React.createElement(we.j,{value:"pinecone",label:"Pinecone"}),React.createElement(we.j,{value:"qdrant",label:"Qdrant"}))),React.createElement(p.d,{title:He.COMMON.API_KEY},React.createElement(Re.A,{name:"apikey",value:t.apikey,description:(0,O.FE)("pinecone"===t.type?He.COMMON.PINECONE_APIKEY_HELP:He.COMMON.QDRANT_APIKEY_HELP),onFinalChange:function(e){return n(t.id,{apikey:e})}})),React.createElement(p.d,{title:He.COMMON.SERVER},React.createElement(Re.A,{name:"server",value:t.server,description:(0,O.FE)("qdrant"===t.type?He.COMMON.QDRANT_SERVER_HELP:He.COMMON.PINECONE_SERVER_HELP),onFinalChange:function(e){return n(t.id,{server:e})}})),"pinecone"===t.type&&React.createElement(React.Fragment,null,React.createElement(p.d,{title:He.COMMON.NAMESPACE},React.createElement(Re.A,{name:"namespace",value:t.namespace,description:(0,O.FE)(He.COMMON.PINECONE_NAMESPACE_HELP),onFinalChange:function(e){return n(t.id,{namespace:e})}}))),"qdrant"===t.type&&React.createElement(React.Fragment,null,React.createElement(p.d,{title:He.COMMON.QDRANT_COLLECTION},React.createElement(Re.A,{name:"collection",value:t.collection,description:(0,O.FE)(He.COMMON.QDRANT_COLLECTION_HELP),onFinalChange:function(e){return n(t.id,{collection:e})}}))),React.createElement(p.d,{title:He.COMMON.MIN_SCORE},React.createElement(Re.A,{name:"min_score",value:t.min_score||35,type:"number",min:"0",max:"100",step:"1",description:(0,O.FE)(He.HELP.MIN_SCORE),onFinalChange:function(e){return n(t.id,{min_score:e})}})),React.createElement(p.d,{title:He.COMMON.MAX_SELECT},React.createElement(Re.A,{name:"max_select",value:t.max_select||10,type:"number",min:"1",max:"100",step:"1",description:(0,O.FE)(He.HELP.MAX_SELECT),onFinalChange:function(e){return n(t.id,{max_select:e})}})),React.createElement(Se.a,{keepState:"embeddingsEnvs"},React.createElement(Se.Y,{title:He.COMMON.AI_ENVIRONMENT},React.createElement("div",{style:{marginTop:10}},React.createElement(p.d,{title:He.COMMON.OVERRIDE_DEFAULTS},React.createElement(y.R,{label:He.COMMON.ENABLE,value:"1",checked:null==t?void 0:t.ai_embeddings_override,onChange:function(e){return n(t.id,{ai_embeddings_override:e})}})),(null==t?void 0:t.ai_embeddings_override)&&React.createElement(React.Fragment,null,React.createElement(p.d,{title:He.COMMON.ENVIRONMENT},React.createElement(we.u,{scrolldown:!0,name:"ai_embeddings_env",value:null==t?void 0:t.ai_embeddings_env,onChange:function(e){return n(t.id,{ai_embeddings_env:e})}},a.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})})))),React.createElement(p.d,{title:He.COMMON.MODEL},React.createElement(we.u,{scrolldown:!0,name:"ai_embeddings_model",value:t.ai_embeddings_model,onChange:function(e){return n(t.id,{ai_embeddings_model:e})}},i.map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})})))),React.createElement(p.d,{title:He.COMMON.DIMENSIONS},React.createElement(we.u,{scrolldown:!0,name:"ai_embeddings_dimensions",value:t.ai_embeddings_dimensions||null,onChange:function(e){return n(t.id,{ai_embeddings_dimensions:e})}},null==l?void 0:l.dimensions.map((function(e,t){return React.createElement(we.j,{key:e,value:e,label:t===l.dimensions.length-1?"".concat(e," (Default)"):e})})),React.createElement(we.j,{key:null,value:null,label:"Not Set"})))))),React.createElement(Se.Y,{title:He.COMMON.ACTIONS},React.createElement("div",{style:{display:"flex",marginTop:10}},React.createElement("div",{style:{flex:"auto"}}),React.createElement(w.M,{className:"danger",onClick:function(){return r(t.id)}},He.COMMON.DELETE)))))};const Zc=function(e){var t=e.environments,n=e.updateEnvironment,r=e.updateOption,a=e.options,o=e.busy,i=function(e){if(1!==t.length){var n=t.filter((function(t){return t.id!==e}));r(n,"embeddings_envs")}else alert("You can't delete the last environment.")};return React.createElement("div",{style:{padding:"0px 10px 20px 10px",marginTop:-5}},React.createElement(d.s,{h2:!0,style:{color:"white"}},"Environments for Embeddings"),React.createElement(b._,{inversed:!0,keepTabOnReload:!0,style:{marginTop:-5},action:React.createElement(w.M,{rounded:!0,className:"secondary",icon:"plus",onClick:function(){var e,n=[].concat(function(e){if(Array.isArray(e))return $c(e)}(e=t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||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)||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.")}(),[{name:"New Environment",type:"pinecone",apikey:"",server:"",indexes:[],namespaces:[]}]);r(n,"embeddings_envs")}})},t.map((function(e){return React.createElement(b.V,{key:e.id,title:e.name,busy:o},React.createElement(Jc,{env:e,updateEnvironment:n,deleteEnvironment:i,ai_envs:(null==a?void 0:a.ai_envs)||[],options:a}))}))))};function eu(e){return eu="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},eu(e)}function tu(){tu=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==eu(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(eu(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 nu(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 ru(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?nu(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=eu(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=eu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==eu(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function au(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function ou(e){return function(e){if(Array.isArray(e))return lu(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||iu(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 iu(e,t){if(e){if("string"==typeof e)return lu(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)?lu(e,t):void 0}}function lu(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 cu=wp.element,uu=cu.useCallback,su=cu.useMemo,fu=cu.useState,mu=function(e){var t=e.updateEnvironment,n=e.environmentId,r=e.deployments,a=e.options,o=function(e,a,o){var i=JSON.parse((0,O.F1)(r));i[e][a]=o,t(n,{deployments:i})},i=su((function(){var e,t,n=null==a||null===(e=a.ai_engines)||void 0===e?void 0:e.find((function(e){return"openai"===e.type}));return null!==(t=null==n?void 0:n.models)&&void 0!==t?t:[]}),[a]);return React.createElement(p.d,{title:He.COMMON.OPENAI_AZURE_DEPLOYMENTS,style:{marginTop:10}},r.map((function(e,a){return React.createElement("div",{key:a,style:{display:"flex",marginBottom:10}},React.createElement(Re.A,{style:{flex:1},value:e.name,placeholder:He.COMMON.OPENAI_AZURE_DEPLOYMENT_NAME,onBlur:function(e){return o(a,"name",e)},onEnter:function(e){return o(a,"name",e)}}),React.createElement(we.u,{style:{flex:1,marginLeft:10},scrolldown:!0,id:"model",name:"model",value:e.model,onChange:function(e){return o(a,"model",e)}},i.map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})}))),React.createElement(w.M,{rounded:!0,isSmall:!0,style:{marginLeft:10,height:30},icon:"trash",onClick:function(){return function(e){var a=ou(r);a.splice(e,1),t(n,{deployments:a})}(a)}}))})),React.createElement(w.M,{fullWidth:!0,icon:"plus",onClick:function(){var e=[].concat(ou(r),[{name:"",model:""}]);t(n,{deployments:e})}}))},du=function(e){var t=e.updateEnvironment,n=e.environmentId,r=e.customModels,a=function(e,a,o){var i=JSON.parse((0,O.F1)(r));i[e][a]=o,t(n,{customModels:i})};return React.createElement(p.d,{title:He.COMMON.HUGGINGFACE_MODELS,style:{marginTop:10}},r.map((function(e,o){var i,l;return React.createElement("div",{key:o,style:{display:"flex",flexDirection:"column",marginBottom:10}},React.createElement("div",{key:o,style:{display:"flex",marginBottom:2}},React.createElement(Re.A,{style:{flex:1},value:e.name,placeholder:He.COMMON.HUGGINGFACE_MODEL_NAME,onBlur:function(e){return a(o,"name",e)},onEnter:function(e){return a(o,"name",e)}}),React.createElement(Re.A,{style:{flex:2,marginLeft:5},value:e.apiUrl,placeholder:He.COMMON.HUGGINGFACE_MODEL_URL,onBlur:function(e){return a(o,"apiUrl",e)},onEnter:function(e){return a(o,"apiUrl",e)}}),React.createElement(w.M,{rounded:!0,isSmall:!0,style:{marginLeft:5,height:30},icon:"trash",onClick:function(){return function(e){var a=ou(r);a.splice(e,1),t(n,{customModels:a})}(o)}})),React.createElement("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center"}},React.createElement("span",{style:{marginRight:5}},"Image Model"),React.createElement(y.R,{style:{marginTop:o?0:5,marginRight:10},disabled:!0,checked:null===(i=e.tags)||void 0===i?void 0:i.includes("image"),onChange:function(e){var a=JSON.parse((0,O.F1)(r));a[o].tags||(a[o].tags=["core","chat"]),e?a[o].tags.push("image"):a[o].tags=a[o].tags.filter((function(e){return"image"!==e})),t(n,{customModels:a})}}),React.createElement("span",{style:{marginRight:5}},"Vision Model"),React.createElement(y.R,{style:{marginTop:o?0:5,marginRight:33},disabled:!0,checked:null===(l=e.tags)||void 0===l?void 0:l.includes("vision"),onChange:function(e){var a=JSON.parse((0,O.F1)(r));a[o].tags||(a[o].tags=["core","chat"]),e?a[o].tags.push("vision"):a[o].tags=a[o].tags.filter((function(e){return"vision"!==e})),t(n,{customModels:a})}})))})),React.createElement(w.M,{fullWidth:!0,icon:"plus",onClick:function(){var e=[].concat(ou(r),[{name:"",apiUrl:"",tags:["core","chat"]}]);t(n,{customModels:e})}}))};const pu=function(e){var t,n,r,a=e.options,o=e.environments,i=e.updateEnvironment,l=e.updateOption,c=e.busy,u=(n=fu(!1),r=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(n,r)||iu(n,r)||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.")}()),s=u[0],f=u[1],m=null!==(t=null==a?void 0:a.ai_engines)&&void 0!==t?t:[],h=uu((function(e){switch(e.type){case"openai":return(0,O.FE)(He.HELP.OPENAI_API_KEY);case"azure":return(0,O.FE)(He.HELP.AZURE_API_KEY);case"openrouter":return(0,O.FE)(He.HELP.OPENROUTER_API_KEY);case"anthropic":return(0,O.FE)(He.HELP.ANTHROPIC_API_KEY);default:return""}}),[]),y=uu(function(){var e,t=(e=tu().mark((function e(t,n){var r,o,i,c,u;return tu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,f(!0),e.next=4,(0,O.IU)("".concat(T,"/ai/models"),{method:"POST",nonce:k,json:{envId:t}});case 4:if(i=e.sent,f(!1),c=null==i?void 0:i.models){e.next=9;break}throw new Error("Could not fetch models.");case 9:c=c.map((function(e){return ru(ru({},e),{},{envId:t,type:n})})),u=(u=null!==(r=null==a?void 0:a.ai_models)&&void 0!==r?r:[]).filter((function(e){return!(e.type===n&&(!e.envId||e.envId===t))})),(o=u).push.apply(o,ou(c)),l(u,"ai_models"),e.next=21;break;case 16:e.prev=16,e.t0=e.catch(0),alert(e.t0.message),console.log(e.t0),f(!1);case 21:case"end":return e.stop()}}),e,null,[[0,16]])})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){au(o,r,a,i,l,"next",e)}function l(e){au(o,r,a,i,l,"throw",e)}i(void 0)}))});return function(e,n){return t.apply(this,arguments)}}(),[l]);return React.createElement("div",{style:{padding:"0px 10px 5px 10px",marginTop:13,marginBottom:5}},React.createElement(d.s,{h2:!0,style:{color:"white",marginBottom:15}},He.COMMON.ENVIRONMENTS_FOR_AI),React.createElement(b._,{inversed:!0,style:{marginTop:-5},action:React.createElement(w.M,{rounded:!0,className:"secondary",icon:"plus",onClick:function(){var e=[].concat(ou(o),[{name:"New Environment",type:"openai",apikey:""}]);l(e,"ai_envs")}})},o.map((function(e){var t,n,r,u=0,f=m.find((function(t){return t.type===e.type}))||{},d=null===(t=f.inputs)||void 0===t?void 0:t.includes("dynamicModels");return Array.isArray(f.models)&&(u=f.models.length),React.createElement(b.V,{key:e.id,title:e.name,busy:c},React.createElement(p.d,{title:He.COMMON.NAME},React.createElement(Re.A,{name:"name",value:e.name,onFinalChange:function(t){return i(e.id,{name:t})}})),React.createElement(p.d,{title:He.COMMON.TYPE},React.createElement(we.u,{scrolldown:!0,name:"type",value:e.type,onChange:function(t){return i(e.id,{type:t})}},m.map((function(e){return React.createElement(we.j,{key:e.type,value:e.type,label:e.name})})))),function(e){var t=(m.find((function(t){return t.type===e.type}))||{}).inputs||[];return React.createElement(React.Fragment,null,t.includes("apikey")&&React.createElement(p.d,{title:He.COMMON.API_KEY},React.createElement(Re.A,{name:"apikey",value:e.apikey,description:h(e),onFinalChange:function(t){return i(e.id,{apikey:t})}})),t.includes("organizationId")&&React.createElement(p.d,{title:He.COMMON.OPENAI_ORGANIZATION_ID},React.createElement(Re.A,{name:"organizationId",value:e.organizationId,description:(0,O.FE)(He.HELP.OPENAI_ORGANIZATION_ID),onFinalChange:function(t){return i(e.id,{organizationId:t})}})),t.includes("endpoint")&&React.createElement(p.d,{title:He.COMMON.ENDPOINT},React.createElement(Re.A,{name:"endpoint",value:e.endpoint,onFinalChange:function(t){return i(e.id,{endpoint:t})}})),t.includes("region")&&React.createElement(p.d,{title:He.COMMON.REGION},React.createElement(Re.A,{name:"region",value:e.region,onFinalChange:function(t){return i(e.id,{region:t})}})),t.includes("projectId")&&React.createElement(p.d,{title:He.COMMON.PROJECT_ID},React.createElement(Re.A,{name:"projectId",value:e.projectId,onFinalChange:function(t){return i(e.id,{projectId:t})}})))}(e),"google"===e.type&&React.createElement(React.Fragment,null,React.createElement(Ne.X,{variant:"danger"},"Click ",React.createElement("a",{href:"https://aistudio.google.com/app/apikey",target:"_blank",rel:"noreferrer"},"here")," to access your Google AI. Gemini is still unstable, so if you encounter issues, let's discuss them on ",React.createElement("a",{href:"https://discord.gg/bHDGh38",target:"_blank",rel:"noreferrer"},"Discord"),"."),React.createElement(_e.g,null)),"huggingface"===e.type&&React.createElement(React.Fragment,null,React.createElement(Ne.X,{variant:"danger"},"Support for Hugging Face is experimental and may not work as expected. Also, AI Engine is ready for Image and Vision but Hugging Face is not (hence the disabled checkboxes). Let's discuss about Hugging Face on ",React.createElement("a",{href:"https://discord.gg/bHDGh38",target:"_blank",rel:"noreferrer"},"Discord"),"."),React.createElement(_e.g,null)),React.createElement(Se.a,{keepState:"environmentCategories"},d&&React.createElement(Se.Y,{title:He.COMMON.MODELS},"openrouter"===e.type&&React.createElement("p",null,"There are currently ",React.createElement("b",null,u)," models available. OpenRouter models need to be refresh regularly. This button will fetch the latest models and their prices."),"google"===e.type&&React.createElement("p",null,"There are currently ",React.createElement("b",null,u)," models available. Google models need to be refresh regularly. This button will fetch the latest models and their prices."),"openrouter"!==e.type&&"google"!==e.type&&React.createElement("p",null,"There are currently ",React.createElement("b",null,u)," models available. This button will fetch the latest models."),React.createElement(w.M,{fullWidth:!0,className:"primary",isBusy:s,onClick:function(){return y(e.id,e.type)}},He.COMMON.REFRESH_MODELS)),"azure"===e.type&&React.createElement(React.Fragment,null,React.createElement("p",null,He.HELP.AZURE_DEPLOYMENTS),React.createElement(Se.Y,{title:He.COMMON.OPENAI_AZURE_DEPLOYMENTS},React.createElement(mu,{deployments:null!==(n=e.deployments)&&void 0!==n?n:[],environmentId:e.id,updateEnvironment:i,options:a}))),"huggingface"===e.type&&React.createElement(Se.Y,{title:He.COMMON.HUGGINGFACE_MODELS},React.createElement("p",null,"Browse the ",React.createElement("a",{href:"https://huggingface.co/models",target:"_blank",rel:"noreferrer"},"Models on Hugging Face"),". Use the Deploy button (Inference API Serverless) in order to get the API URL. Paste it below with the name of your choice and you're done!"),React.createElement(du,{customModels:null!==(r=e.customModels)&&void 0!==r?r:[],environmentId:e.id,updateEnvironment:i,options:a})),React.createElement(Se.Y,{title:He.COMMON.ENVIRONMENT_ID},React.createElement("p",null,'The EnvID is "',React.createElement("b",null,e.id),'".')),React.createElement(Se.Y,{title:He.COMMON.ACTIONS},React.createElement("div",{style:{display:"flex",marginTop:10}},React.createElement("div",{style:{flex:"auto"}}),React.createElement(w.M,{className:"danger",onClick:function(){return function(e){if(1!==o.length){var t=o.filter((function(t){return t.id!==e}));l(t,"ai_envs")}else alert("You can't delete the last environment.")}(e.id)}},He.COMMON.DELETE)))))}))))};function hu(e){return hu="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},hu(e)}function yu(){yu=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==hu(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(hu(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 vu(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function gu(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Eu(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)?Eu(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 Eu(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 bu=wp.element,wu=bu.useState,Ru=bu.useEffect;const Ou=function(){var e=gu(wu(""),2),t=e[0],n=e[1],r=gu(wu(""),2),a=r[0],o=r[1],i=gu(wu(""),2),l=i[0],c=i[1],u=gu(wu(!1),2),s=u[0],f=u[1],m=gu(wu("imageToText"),2),d=m[0],p=m[1],h=gu(wu(null),2),y=h[0],v=h[1];Ru((function(){n(""),o(""),c("")}),[d]);var g=function(){var e,n=(e=yu().mark((function e(){var n,r,a,i,c,u=arguments;return yu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r="","textToJSON"!==(n=u.length>0&&void 0!==u[0]?u[0]:"imageToText")){e.next=6;break}r="".concat(T,"/ai/json"),e.next=16;break;case 6:if("imageToText"!==n){e.next=10;break}r="".concat(T,"/ai/transcribe_image"),e.next=16;break;case 10:if("audioToText"!==n){e.next=14;break}r="".concat(T,"/ai/transcribe_audio"),e.next=16;break;case 14:return alert("Unknown transcription type: ".concat(n)),e.abrupt("return");case 16:return f(n),v(Date.now()),e.prev=18,e.next=21,(0,O.IU)(r,{method:"POST",nonce:k,json:{url:t,message:l}});case 21:i=e.sent,null!=(c=i.data)&&null!==(a=c.error)&&void 0!==a&&a.message?alert(c.error.message):o(c),e.next=29;break;case 26:e.prev=26,e.t0=e.catch(18),alert(e.t0.message);case 29:return e.prev=29,f(!1),v(null),e.finish(29);case 33:case"end":return e.stop()}}),e,null,[[18,26,29,33]])})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){vu(o,r,a,i,l,"next",e)}function l(e){vu(o,r,a,i,l,"throw",e)}i(void 0)}))});return function(){return n.apply(this,arguments)}}();return React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(R.z,{title:"Features",className:"raw"},React.createElement(b._,{inversed:!0,onChange:function(e,t){p(t.key)}},React.createElement(b.V,{title:He.COMMON.IMAGE_TO_TEXT,key:"imageToText"},React.createElement("label",null,"Image URL:"),React.createElement(_e.g,{tiny:!0}),React.createElement(Wt.m,{name:"url",rows:2,value:t,onChange:n}),React.createElement(_e.g,null),React.createElement("label",null,"Prompt:"),React.createElement(_e.g,{tiny:!0}),React.createElement(Wt.m,{rows:2,value:l,onChange:c}),React.createElement(_e.g,null),React.createElement(w.M,{fullWidth:!0,style:{height:40},disabled:s,isBusy:"imageToText"===s,startTime:y,onClick:function(){g("imageToText")}},"Transcribe Image"),React.createElement(_e.g,{tiny:!0}),React.createElement("p",null,"If you are looking for beautiful images to play with this, here are some URLs: ",React.createElement("a",{target:"_blank",href:"https://offbeatjapan.org"},"Offbeat Japan"),", ",React.createElement("a",{target:"_blank",href:"https://unsplash.com"},"Unsplash"),", ",React.createElement("a",{target:"_blank",href:"https://www.pexels.com"},"Pexels"),".")),React.createElement(b.V,{title:He.COMMON.AUDIO_TO_TEXT,key:"audioToText"},React.createElement("label",null,"Audio URL:"),React.createElement(_e.g,{tiny:!0}),React.createElement(Wt.m,{name:"url",rows:2,value:t,onChange:n}),React.createElement(_e.g,null),React.createElement("label",null,"Prompt:"),React.createElement(_e.g,{tiny:!0}),React.createElement(Wt.m,{rows:2,value:l,onChange:c}),React.createElement(_e.g,null),React.createElement(w.M,{fullWidth:!0,style:{height:40},disabled:s,isBusy:"audioToText"===s,startTime:y,onClick:function(){g("audioToText")}},"Transcribe Audio")),React.createElement(b.V,{title:He.COMMON.PROMPT_TO_JSON,key:"textToJSON"},React.createElement("label",null,"Prompt:"),React.createElement(_e.g,{tiny:!0}),React.createElement(Wt.m,{rows:2,value:l,onChange:c}),React.createElement(_e.g,null),React.createElement(w.M,{fullWidth:!0,style:{height:40},disabled:s,isBusy:"textToJSON"===s,startTime:y,onClick:function(){g("textToJSON")}},"Query AI"),React.createElement(_e.g,null),React.createElement("label",null,"Examples:"),React.createElement("ul",null,React.createElement("li",null,"👽 List the best science fiction books. Include the title, author, publication year, and a short synopsis."),React.createElement("li",null,"🎋 Identify the most beautiful gardens in Japan. Provide the garden name, location (gps: [lng, lat]), best visiting season, and features."),React.createElement("li",null,"💰 Identify the current top 10 richest individuals globally. For each person, include their name, estimated net worth, source of wealth, country of residence, and key tags (such as 'technology', 'retail', 'investor', etc.). Additionally, provide a brief description of their most notable business ventures or achievements."),React.createElement("li",null,"🦁 Compile a list of significant archaeological discoveries in the last decade. Include the discovery, location, date, and significance.")),React.createElement(_e.g,null))))),React.createElement(E.Y,{minimal:!0},React.createElement(R.z,{title:"Transcription",className:"primary"},React.createElement(_e.g,{tiny:!0}),"textToJSON"===d&&React.createElement(mc.p2,{value:a,indentWidth:2,displayDataTypes:!1,displayObjectSize:!1,displayArrayKey:!1,enableClipboard:!1,style:{fontSize:12}}),"textToJSON"!==d&&React.createElement(Wt.m,{name:"context",rows:21,value:a,disabled:!a}))))};function _u(e){return _u="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},_u(e)}function xu(e){return function(e){if(Array.isArray(e))return Lu(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ku(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 Su(){Su=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==_u(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(_u(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Tu(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Nu(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Tu(o,r,a,i,l,"next",e)}function l(e){Tu(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Cu(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 Iu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Cu(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=_u(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=_u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==_u(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Au(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||ku(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 ku(e,t){if(e){if("string"==typeof e)return Lu(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)?Lu(e,t):void 0}}function Lu(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 Mu=wp.element,Pu=Mu.useState,ju=Mu.useMemo,Fu=Mu.useEffect,Du=[{accessor:"name",title:"Name",verticalAlign:"top"},{accessor:"instructions",title:"Instructions",width:220,verticalAlign:"top"},{accessor:"parameters",title:"Parameters",verticalAlign:"top"},{accessor:"createdOn",title:"Created On",verticalAlign:"top"}],Gu=[{accessor:"file",title:"File",verticalAlign:"top"},{accessor:"metadata",title:"Metadata",verticalAlign:"top"},{accessor:"userId",title:"User ID",verticalAlign:"top"},{accessor:"purpose",title:"Purpose",verticalAlign:"top"},{accessor:"created",title:"Created On",verticalAlign:"top"},{accessor:"actions",title:"Actions",verticalAlign:"top"}];const Uu=function(e){var t,n=e.options,r=e.refreshOptions,a=(0,u.jE)(),o=Au(Pu(null),2),i=o[0],l=o[1],c=Au(Pu(!1),2),m=c[0],p=c[1],h=Au(Pu(null==n||null===(t=n.ai_envs)||void 0===t||null===(t=t[0])||void 0===t?void 0:t.id),2),y=h[0],v=h[1],g=ju((function(){return(null==n?void 0:n.ai_envs)||[]}),[n]),_=Au(Pu("assistants"),2),x=_[0],S=_[1],T=Au(Pu([]),2),N=T[0],C=T[1],I=(0,s.z)().colors,A=ju((function(){return g.find((function(e){return e.id===y}))}),[y,g]),k=ju((function(){return(null==A?void 0:A.assistants)||[]}),[A]),L=Au(Pu({userId:null,purpose:["assistant-in","assistant-out"],metadata:null,envId:y,page:1,limit:10}),2),M=L[0],P=L[1],j=(0,O.F1)(M);Fu((function(){var e,t=function(){var e=localStorage.getItem("mwai-admin-assistants");try{return JSON.parse(e)}catch(e){return{}}}(),n=null!==(e=null==t?void 0:t.envId)&&void 0!==e?e:null;n&&v(n)}),[]),Fu((function(){var e;e={envId:y||null},localStorage.setItem("mwai-admin-assistants",(0,O.F1)(e))}),[y]),Fu((function(){P(Iu(Iu({},M),{},{envId:y}))}),[y]);var F=(0,f.I)({queryKey:["assistants-files",j],enabled:"files"===x,staleTime:3e5,queryFn:function(){return sn(M)}}),D=F.isFetching,G=F.data,U=function(){var e=Nu(Su().mark((function e(t){return Su().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return p(!0),e.prev=1,e.next=4,cn(t);case 4:return e.next=6,a.invalidateQueries("assistants-files");case 6:C([]),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),l(e.t0);case 12:p(!1);case 13:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t){return e.apply(this,arguments)}}(),B=ju((function(){return null==G?void 0:G.files.map((function(e){return Iu(Iu({},e),{},{file:(n=e.url,r=e.refId,React.createElement("div",{style:{display:"flex",flexDirection:"column"}},React.createElement("span",null,function(e){if(!e)return null;var t=e.split("/").pop();return React.createElement("a",{href:e,target:"_blank",rel:"noreferrer"},t)}(n)),React.createElement("small",null,r))),purpose:(a=e.purpose,"assistant-out"===a?"Generated":"assistant-in"===a?"Uploaded":a),metadata:(t=e.metadata,t?React.createElement("small",null,React.createElement("ul",{style:{margin:0,padding:0}},Object.keys(t).map((function(e){return React.createElement("li",{key:e,style:{margin:0}},React.createElement("i",null,e),": ",t[e]," ","assistant_id"===e?"(".concat((n=t[e],(null==(r=k.find((function(e){return e.id===n})))?void 0:r.name)||"N/A"),")"):"");var n,r})))):null),created:new Date(e.created).toLocaleDateString(),actions:React.createElement(React.Fragment,null,React.createElement(w.M,{className:"danger",rounded:!0,icon:"trash",disabled:V,onClick:function(){return U([e.id])}}))});var t,n,r,a}))}),[G]),H=ju((function(){return(null==G?void 0:G.total)||0}),[G]),Y=function(){var e=Nu(Su().mark((function e(){return Su().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return p(!0),e.next=3,vn(y);case 3:return e.next=5,r();case 5:p(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),z=function(){var e=Nu(Su().mark((function e(){return Su().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.invalidateQueries("assistants-files");case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),W=ju((function(){return k.map((function(e){var t;return Iu(Iu({},e),{},{name:React.createElement("div",{style:{display:"flex",flexDirection:"column"}},React.createElement("span",null,e.name),React.createElement("small",null,e.id)),instructions:(null===(t=e.instructions)||void 0===t?void 0:t.length)>100?"".concat(e.instructions.slice(0,100),"..."):e.instructions,parameters:React.createElement(React.Fragment,null,React.createElement("ul",{style:{margin:0,padding:0}},React.createElement("li",{style:{margin:0,display:"flex"}},React.createElement(Oe.z,{icon:"check",width:16,color:I.green}),React.createElement("span",{style:{marginLeft:3}},e.model)),React.createElement("li",{style:{margin:0,display:"flex"}},React.createElement(Oe.z,{icon:e.has_file_search?"check":"close",width:16,color:e.has_file_search?I.green:I.gray}),React.createElement("a",{style:{marginLeft:3},href:"https://platform.openai.com/docs/assistants/tools/file-search",target:"_blank",rel:"noreferrer"},"File Search")),React.createElement("li",{style:{margin:0,display:"flex"}},React.createElement(Oe.z,{icon:e.has_code_interpreter?"check":"close",width:16,color:e.has_code_interpreter?I.green:I.gray}),React.createElement("a",{style:{marginLeft:3},href:"https://platform.openai.com/docs/assistants/tools/code-interpreter",target:"_blank",rel:"noreferrer"},"Code Interpreter"))),React.createElement("p",{style:{lineHeight:"11px",margin:"5px 0"}},React.createElement("small",null,"Note: AI Engine currently uses the Assistants API v2. Retrieval have been deprecated by OpenAI. More information ",React.createElement("a",{href:"https://platform.openai.com/docs/assistants/whats-new",target:"_blank",rel:"noreferrer"},"here"),"."))),createdOn:new Date(e.createdOn).toLocaleDateString()})}))}),[k,I.gray,I.green]),V=m,K=ju((function(){return React.createElement(we.u,{scrolldown:!0,value:y,onChange:v,style:{marginLeft:5}},g.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})})))}),[y,g]),q=ju((function(){return React.createElement("div",null,React.createElement("div",{style:{display:"flex",flexDirection:"row"}},React.createElement(Qt.Q,{currentPage:M.page,limit:M.limit,total:H,onClick:function(e){P(Iu(Iu({},M),{},{page:e}))}})))}),[M,H]);return React.createElement(E.N,null,React.createElement(E.Y,{fullWidth:!0,minimal:!0,style:{margin:8}},React.createElement(b._,{inversed:!0,currentTab:x,onChange:function(e,t){S(t.key)},action:React.createElement(React.Fragment,null,React.createElement("div",{style:{flex:"auto"}}),N.length>0&&"files"===x&&React.createElement(React.Fragment,null,React.createElement(w.M,{className:"danger",disabled:!1,onClick:function(){return U(N)}},He.COMMON.DELETE)),"files"===x&&React.createElement(w.M,{disabled:V||!A,busy:V,onClick:z,className:"secondary"},He.COMMON.REFRESH),"assistants"===x&&React.createElement(w.M,{disabled:V||!A,busy:V,onClick:Y,className:"secondary"},He.COMMON.REFRESH),K)},React.createElement(b.V,{title:He.COMMON.ASSISTANTS,key:"assistants"},React.createElement(Kt.o,{busy:V,data:W,columns:Du,emptyMessage:He.NO_ASSISTANTS_YET})),React.createElement(b.V,{title:He.COMMON.FILES,key:"files"},React.createElement(Kt.o,{busy:D||V,data:B,columns:Gu,selectedItems:N,onSelect:function(e){C([].concat(xu(N),xu(e)))},onUnselect:function(e){C(xu(N.filter((function(t){return!e.includes(t)}))))},emptyMessage:He.NO_FILES_YET}),React.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:10}},React.createElement("div",{style:{flex:"auto"}}),q)))),React.createElement(E.Y,{fullWidth:!0,minimal:!0},React.createElement(R.z,{className:"primary"},React.createElement(d.s,{p:!0},(0,O.FE)(He.HELP.ASSISTANTS_INTRO)),React.createElement(Ne.X,{variant:"danger"},(0,O.FE)(He.HELP.ASSISTANTS_WARNINGS))),React.createElement(_e.g,{tiny:!0}),i&&React.createElement(Te.n,{isOpen:!!i,title:"Error",onRequestClose:function(){return l(null)},okButton:{label:"Ok",onClick:function(){return l(null)}},content:React.createElement("p",null,null==i?void 0:i.message)})))};var Bu;function Hu(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 Yu=wp.element,zu=Yu.useState,Wu=Yu.useMemo,Vu=G.Ay.div(Bu||(Bu=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n  display: grid;\n  grid-template-columns: 1fr 1fr 1fr;\n  grid-gap: 20px;\n"])));const Ku=function(e){var t,n,r=e.addons,a=r.some((function(e){return e.enabled}))?"enabled":"all",o=(t=zu(a),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Hu(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)?Hu(e,t):void 0}}(t,n)||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.")}()),i=o[0],l=o[1],c=Wu((function(){return"enabled"===i?r.filter((function(e){return e.enabled})):"disabled"===i?r.filter((function(e){return!e.enabled})):r}),[r,i]);return React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0,fullWidth:!0,style:{padding:10}},React.createElement(qt.V,null,React.createElement(Vt.o,{name:"filter",value:i,onChange:function(e){return l(e)}},React.createElement(Vt.K,{title:"All",value:"all"}),React.createElement(Vt.K,{title:"Enabled",value:"enabled"}),React.createElement(Vt.K,{title:"Disabled",value:"disabled"}))),React.createElement(_e.g,null),React.createElement(Vu,null,c.map((function(e){return React.createElement(xe.L,{key:e.id,style:{marginBottom:0},footer:React.createElement("div",{style:{display:"flex",width:"100%",alignItems:"center",marginLeft:10,minHeight:30}},React.createElement("span",{style:{fontSize:"11px",marginRight:15,color:e.enabled?"#4CAF50":"#666",textTransform:"uppercase",fontWeight:"bold"}},e.enabled?React.createElement("label",null,"Enabled"):React.createElement("label",null,"Disabled")),React.createElement("div",{style:{flex:"auto"}}),e.enabled&&e.settings_url&&React.createElement(w.M,{className:"primary",onClick:function(){return window.open(e.settings_url,"_self")}},"Settings"),!e.enabled&&React.createElement(w.M,{className:"primary",onClick:function(){return window.open(e.install_url,"_blank")}},"Install"))},React.createElement(d.s,{h3:!0},e.name),React.createElement("div",{className:"addon-description"},e.description))})))))};function qu(e){return qu="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},qu(e)}function Xu(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $u(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)?$u(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 $u(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 Qu(){Qu=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==qu(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(qu(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Ju(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 Zu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ju(Object(n),!0).forEach((function(t){es(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ju(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function es(e,t,n){var r;return r=function(e,t){if("object"!=qu(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=qu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==qu(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ts(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function ns(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){ts(o,r,a,i,l,"next",e)}function l(e){ts(o,r,a,i,l,"throw",e)}i(void 0)}))}}var rs=wp.element,as=rs.useMemo,os=rs.useState,is=rs.useEffect,ls=rs.useCallback,cs=function(){var e=ns(Qu().mark((function e(){var t,n;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/openai/incidents"),{nonce:k});case 2:if(null==(t=e.sent)||!t.incidents){e.next=6;break}return n=t.incidents.map((function(e){var t=e.date,n=(t=new Date(1e3*t)).toLocaleDateString("ja-JP",{year:"numeric",month:"2-digit",day:"2-digit"});return Zu(Zu({},e),{},{date:n})})),e.abrupt("return",n);case 6:return e.abrupt("return",null);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),us=[{envKey:"ai_embeddings_default_env",modelKey:"ai_embeddings_default_model",defaultModel:"text-embedding-ada-002"},{envKey:"ai_vision_default_env",modelKey:"ai_vision_default_model",defaultModel:"gpt-4o-mini"},{envKey:"ai_images_default_env",modelKey:"ai_images_default_model",defaultModel:"dall-e-3-hd"},{envKey:"ai_audio_default_env",modelKey:"ai_audio_default_model",defaultModel:"whisper-1"},{envKey:"ai_json_default_env",modelKey:"ai_json_default_model",defaultModel:"gpt-4o-mini"}],ss=["module_forms","module_statistics","module_embeddings","module_assistants"];const fs=function(){var e,t,n,r,a=Xu(os(L),2),o=a[0],i=a[1],l=Xu(os(null),2),c=l[0],u=l[1],s=Xu(os(!1),2),m=s[0],g=s[1],S=null==o?void 0:o.module_suggestions,N=null==o?void 0:o.module_advisor,C=null==o?void 0:o.module_forms,M=null==o?void 0:o.module_finetunes,P=null==o?void 0:o.module_statistics,j=null==o?void 0:o.module_playground,F=null==o?void 0:o.module_generator_content,D=null==o?void 0:o.module_generator_images,G=null==o?void 0:o.module_moderation,U=null==o?void 0:o.module_embeddings,B=null==o?void 0:o.module_assistants,H=null==o?void 0:o.module_transcription,Y=null==o?void 0:o.module_addons,z=null==o?void 0:o.module_devtools,W=null==o?void 0:o.module_chatbots,V=as((function(){return null!=o&&o.ai_envs?null==o?void 0:o.ai_envs:[]}),[o]),K=null==o?void 0:o.ai_default_env,q=null==o?void 0:o.ai_default_model,X=null==o?void 0:o.ai_vision_default_env,$=null==o?void 0:o.ai_vision_default_model,Q=null==o?void 0:o.ai_embeddings_default_env,J=null==o?void 0:o.ai_embeddings_default_model,Z=null==o?void 0:o.ai_images_default_env,ee=null==o?void 0:o.ai_images_default_model,te=null==o?void 0:o.ai_audio_default_env,ne=null==o?void 0:o.ai_audio_default_model,re=null==o?void 0:o.ai_json_default_env,ae=null==o?void 0:o.ai_json_default_model,oe=null==o?void 0:o.ai_streaming,ie=null!=o&&o.embeddings_envs?null==o?void 0:o.embeddings_envs:[],le=null==o?void 0:o.embeddings_default_env,ce=null==o?void 0:o.syntax_highlight,ue=null==o?void 0:o.chatbot_typewriter,se=null==o?void 0:o.chatbot_discussions,fe=null==o?void 0:o.virtual_keyboard_fix,me=null==o?void 0:o.chatbot_gdpr_consent,de=null==o?void 0:o.chatbot_gdpr_text,pe=null==o?void 0:o.chatbot_gdpr_button,he=null==o?void 0:o.speech_recognition,ye=null==o?void 0:o.speech_synthesis,ve=null==o?void 0:o.public_api,ge=null==o?void 0:o.statistics_data,Ee=null==o?void 0:o.statistics_forms_data,be=null==o?void 0:o.intro_message,Ne=null==o?void 0:o.module_addons,Ce=null==o?void 0:o.context_max_length,Ie=null==o?void 0:o.banned_ips,Ae=null==o?void 0:o.banned_words,ke=null!==(e=null==o?void 0:o.admin_bar)&&void 0!==e?e:["settings"],Le=null==o?void 0:o.resolve_shortcodes,Me=null==o?void 0:o.clean_uninstall,Pe=ft(o).completionModels,je=ft(o,null==o?void 0:o.ai_vision_default_env).visionModels,Fe=ft(o,null==o?void 0:o.ai_audio_default_env).audioModels,De=ft(o,null==o?void 0:o.ai_json_default_env).jsonModels,Ue=ft(o,null==o?void 0:o.ai_images_default_env).imageModels,Be=ft(o,null==o?void 0:o.ai_embeddings_default_env).embeddingsModels,Ye=as((function(){return Be.find((function(e){return e.model===J}))}),[Be,J]),ze=(0,f.I)({queryKey:["incidents"],queryFn:cs}),We=ze.isLoading,Ve=ze.data,Ke=as((function(){return null==Ve?void 0:Ve.filter((function(e){return new Date(e.date)>new Date(Date.now()-864e5)})).length}),[Ve]),qe=m;is((function(){var e=function(){var e=ns(Qu().mark((function e(){var t,n;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=!1,n=Zu({},o),us.forEach((function(e){var r=e.envKey,a=e.modelKey,i=e.defaultModel,l=!1;if(o[r]&&(l=!!V.find((function(e){return e.id===o[r]}))),!l){var c=V.find((function(e){return"openai"===(null==e?void 0:e.type)}));c?n[r]===c.id&&n[a]===i||(console.warn("Updating ".concat(r," and ").concat(a," to ").concat(c.id," and ").concat(i)),t=!0,n[r]=c.id,n[a]=i):null===n[r]&&null===n[a]||(console.warn("Updating ".concat(r," and ").concat(a," to null")),t=!0,n[r]=null,n[a]=null)}if("ai_embeddings_default_model"===a&&n[a]){var u=(null==n?void 0:n.ai_embeddings_default_dimensions)||null;if(null!==u){var s=Be.find((function(e){return e.model===n[a]}));if(null==s||!s.dimensions.includes(u)){var f=(null==s?void 0:s.dimensions[(null==s?void 0:s.dimensions.length)-1])||null;null!==f&&(n.ai_embeddings_default_dimensions=f,console.warn("Updating embeddings default dimensions to ".concat(f)),t=!0)}}}})),!t){e.next=6;break}return e.next=6,$e(n);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[V,o,$e,Be]);var Xe=function(){var e=ns(Qu().mark((function e(){var t;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return g(!0),e.prev=1,e.next=4,En();case 4:t=e.sent,i(t),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error(He.ERROR.GETTING_OPTIONS,null!==e.t0&&void 0!==e.t0&&e.t0.message?{message:e.t0.message}:{err:e.t0}),e.t0.message&&u(React.createElement(React.Fragment,null,React.createElement("div",null,He.ERROR.GETTING_OPTIONS),React.createElement("small",null,(0,O.FE)(He.ERROR.CHECK_YOUR_CONSOLE))));case 12:return e.prev=12,g(!1),e.finish(12);case 15:case"end":return e.stop()}}),e,null,[[1,8,12,15]])})));return function(){return e.apply(this,arguments)}}(),$e=ls(function(){var e=ns(Qu().mark((function e(t){var n;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,(0,O.F1)(t)!==(0,O.F1)(o)){e.next=3;break}return e.abrupt("return");case 3:return g(!0),e.next=6,(0,O.IU)("".concat(T,"/settings/update"),{method:"POST",nonce:k,json:{options:t}});case 6:n=e.sent,i(n.options),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(0),console.error(He.ERROR.UPDATING_OPTIONS,null!==e.t0&&void 0!==e.t0&&e.t0.message?{message:e.t0.message,options:o,newOptions:t}:{err:e.t0,options:o,newOptions:t}),e.t0.message&&u(React.createElement(React.Fragment,null,React.createElement("div",null,He.ERROR.UPDATING_OPTIONS),React.createElement("small",null,(0,O.FE)(He.ERROR.CHECK_YOUR_CONSOLE))));case 14:return e.prev=14,g(!1),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[0,10,14,17]])})));return function(t){return e.apply(this,arguments)}}(),[o]),Qe=function(){var e=ns(Qu().mark((function e(t,n){var r;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Zu(Zu({},o),{},es({},n,t)),console.log("Updating",n,t),e.next=4,$e(r);case 4:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Je=function(){var e=ns(Qu().mark((function e(t,n){var r;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=ie.map((function(e){return e.id===t?Zu(Zu({},e),n):e})),Qe(r,"embeddings_envs");case 2:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Ze=function(){var e=ns(Qu().mark((function e(t,n){var r;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=V.map((function(e){return e.id===t?Zu(Zu({},e),n):e})),Qe(r,"ai_envs");case 2:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),et=function(){var e=ns(Qu().mark((function e(){return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.confirm(He.ALERTS.ARE_YOU_SURE)){e.next=2;break}return e.abrupt("return");case 2:return g(!0),e.prev=3,e.next=6,(0,O.IU)("".concat(T,"/settings/reset"),{method:"POST",nonce:k});case 6:alert("Settings reset. The page will now reload to reflect the changes."),window.location.reload(),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(3),alert("Error while resetting settings. Please check your console."),console.log(e.t0);case 14:return e.prev=14,g(!1),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[3,10,14,17]])})));return function(){return e.apply(this,arguments)}}(),tt=function(){var e=ns(Qu().mark((function e(){var t,n,r,a,o,i,l,c,u;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return g("exportSettings"),e.prev=1,e.next=4,hn();case 4:return t=e.sent,e.next=7,mn();case 7:return n=e.sent,e.next=10,En();case 10:r=e.sent,a={chatbots:t,themes:n,options:r},o=new Blob([(0,O.F1)(a)],{type:"application/json"}),i=URL.createObjectURL(o),(l=document.createElement("a")).href=i,c=new Date,u="ai-engine-".concat(c.getFullYear(),"-").concat(c.getMonth()+1,"-").concat(c.getDate(),".json"),l.setAttribute("download",u),l.click(),e.next=26;break;case 22:e.prev=22,e.t0=e.catch(1),alert("Error while exporting settings. Please check your console."),console.log(e.t0);case 26:return e.prev=26,g(!1),e.finish(26);case 29:case"end":return e.stop()}}),e,null,[[1,22,26,29]])})));return function(){return e.apply(this,arguments)}}(),nt=function(){var e=ns(Qu().mark((function e(){var t;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:g("importSettings");try{(t=document.createElement("input")).type="file",t.accept="application/json",t.onchange=function(){var e=ns(Qu().mark((function e(t){var n,r;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.target.files[0]){e.next=3;break}return e.abrupt("return");case 3:(r=new FileReader).onload=function(){var e=ns(Qu().mark((function e(t){var n,r,a,o;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=JSON.parse(t.target.result),r=n.chatbots,a=n.themes,o=n.options,e.next=4,yn(r);case 4:return e.next=6,dn(a);case 6:return e.next=8,$e(o);case 8:alert("Settings imported. The page will now reload to reflect the changes."),window.location.reload();case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.readAsText(n);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t.click()}catch(e){alert("Error while importing settings. Please check your console."),console.log(e)}finally{g(!1)}case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();is((function(){if(!A){var e=Zu({},o),t=!1;ss.forEach((function(n){e[n]&&(e[n]=!1,console.warn("Resetting ".concat(n)),t=!0)})),t&&(0,O.F1)(e)!==(0,O.F1)(o)&&$e(e)}}),[]);var rt=React.createElement(p.d,{title:He.COMMON.UTILITIES},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"module_suggestions",label:He.COMMON.POSTS_SUGGESTIONS,value:"1",checked:S,description:He.COMMON.POSTS_SUGGESTIONS_HELP,onChange:Qe}))),at=React.createElement(p.d,{title:He.COMMON.ADVISOR},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"module_advisor",label:He.COMMON.ENABLE,value:"1",checked:N,description:He.HELP.ADVISOR,onChange:Qe}))),ot=React.createElement(p.d,{title:He.COMMON.GENERATORS},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"module_generator_content",label:He.COMMON.CONTENT_GENERATOR,value:"1",checked:F,description:He.COMMON.CONTENT_GENERATOR_HELP,onChange:Qe}),React.createElement(y.R,{name:"module_generator_images",label:He.COMMON.IMAGES_GENERATOR,value:"1",checked:D,description:He.COMMON.IMAGES_GENERATOR_HELP,onChange:Qe}))),it=React.createElement(p.d,{title:He.COMMON.PLAYGROUND},React.createElement(y.R,{name:"module_playground",label:He.COMMON.ENABLE,value:"1",checked:j,description:He.COMMON.PLAYGROUND_HELP,onChange:Qe})),lt=React.createElement(p.d,{title:React.createElement(React.Fragment,null,He.COMMON.FORMS,React.createElement("small",{style:{position:"relative",top:-3,fontSize:8}}," BETA"))},React.createElement(y.R,{name:"module_forms",label:He.COMMON.ENABLE,value:"1",checked:C,requirePro:!0,isPro:A,description:He.COMMON.FORMS_HELP,onChange:Qe})),ct=React.createElement(p.d,{title:He.COMMON.FINETUNES},React.createElement(y.R,{name:"module_finetunes",label:He.COMMON.ENABLE,value:"1",checked:M,description:React.createElement(React.Fragment,null,React.createElement(Ot,{disabled:!M,style:{marginRight:3}}),He.HELP.FINETUNES),onChange:Qe})),ut=React.createElement(p.d,{title:React.createElement(React.Fragment,null,He.COMMON.STATISTICS)},React.createElement(y.R,{name:"module_statistics",label:He.COMMON.ENABLE,value:"1",checked:P,requirePro:!0,isPro:A,description:He.COMMON.STATISTICS_HELP,onChange:Qe})),mt=React.createElement(p.d,{title:React.createElement(React.Fragment,null,He.COMMON.MODERATION)},React.createElement(y.R,{name:"module_moderation",label:He.COMMON.ENABLE,value:"1",checked:G,description:React.createElement(React.Fragment,null,React.createElement(Ot,{disabled:!G,style:{marginRight:3}}),He.COMMON.MODERATION_HELP),onChange:Qe})),dt=React.createElement(p.d,{title:React.createElement(React.Fragment,null,He.COMMON.TRANSCRIPTION)},React.createElement(y.R,{name:"module_transcription",label:He.COMMON.ENABLE,value:"1",checked:H,description:He.COMMON.TRANSCRIPTION_HELP,onChange:Qe})),pt=React.createElement(p.d,{title:React.createElement(React.Fragment,null,He.COMMON.EMBEDDINGS)},React.createElement(y.R,{name:"module_embeddings",label:He.COMMON.ENABLE,value:"1",checked:U,requirePro:!0,isPro:A,description:He.COMMON.EMBEDDINGS_HELP,onChange:Qe})),ht=React.createElement(p.d,{title:React.createElement(React.Fragment,null,He.COMMON.ASSISTANTS,React.createElement("small",{style:{position:"relative",top:-3,fontSize:8}}," BETA"))},React.createElement(y.R,{name:"module_assistants",label:He.COMMON.ENABLE,value:"1",checked:B,requirePro:!0,isPro:A,description:React.createElement(React.Fragment,null,React.createElement(Ot,{disabled:!B,style:{marginRight:3}}),He.HELP.ASSISTANTS),onChange:Qe})),yt=React.createElement(p.d,{title:He.COMMON.CHATBOT},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"module_chatbots",label:He.COMMON.ENABLE,value:"1",checked:W,description:He.COMMON.CHATBOT_HELP,onChange:Qe}))),vt=React.createElement(p.d,{title:He.COMMON.QUERIES_DATA},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"statistics_data",label:He.COMMON.ENABLE,value:"1",checked:ge,description:He.HELP.QUERIES_DATA,onChange:Qe}))),gt=React.createElement(p.d,{title:He.COMMON.QUERIES_FORMS_DATA},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"statistics_forms_data",label:He.COMMON.ENABLE,value:"1",checked:Ee,description:He.HELP.QUERIES_FORMS_DATA,onChange:Qe}))),Et=React.createElement(p.d,{title:He.COMMON.INTRO_MESSAGE},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"intro_message",label:He.COMMON.ENABLE,value:"1",checked:be,description:He.HELP.INTRO_MESSAGE,onChange:Qe}))),bt=React.createElement(p.d,{title:He.COMMON.ADDONS},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"module_addons",label:He.COMMON.ENABLE,value:"1",checked:Ne,description:He.HELP.ADDONS,onChange:Qe}))),wt=React.createElement(p.d,{title:He.COMMON.CHATBOT_SELECT},React.createElement(we.u,{scrolldown:!0,name:"chatbot_select",value:null==o?void 0:o.chatbot_select,onChange:Qe,description:He.HELP.CHATBOT_SELECT},React.createElement(we.j,{key:"tabs",value:"tabs",label:He.COMMON.TABS}),React.createElement(we.j,{key:"dropdown",value:"dropdown",label:He.COMMON.DROPDOWN}))),Rt=React.createElement(p.d,{title:He.COMMON.WEBSPEECH_API},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"speech_recognition",label:He.COMMON.SPEECH_RECOGNITION,value:"1",checked:he,description:He.HELP.SPEECH_RECOGNITION,onChange:Qe})),React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"speech_synthesis",label:He.COMMON.SPEECH_SYNTHESIS+" (SOON)",value:"1",disabled:!0,checked:ye,description:He.HELP.SPEECH_SYNTHESIS,onChange:Qe}))),_t=React.createElement(p.d,{title:He.COMMON.VIRTUAL_KEYBOARD},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"virtual_keyboard_fix",label:He.COMMON.FIX,value:"1",checked:fe,description:He.HELP.VIRTUAL_KEYBOARD,onChange:Qe}))),xt=React.createElement(p.d,{title:He.COMMON.GDPR_CONSENT},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"chatbot_gdpr_consent",label:He.COMMON.ENABLE,value:"1",checked:me,description:He.HELP.GDPR_CONSENT,onChange:Qe}))),St=React.createElement(p.d,{title:He.COMMON.GDPR_TEXT},React.createElement(Re.A,{name:"chatbot_gdpr_text",value:de,onBlur:Qe})),Tt=React.createElement(p.d,{title:He.COMMON.GDPR_BUTTON},React.createElement(Re.A,{name:"chatbot_gdpr_button",value:pe,onBlur:Qe})),Nt=React.createElement(p.d,{title:He.COMMON.STREAMING},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"ai_streaming",label:He.COMMON.ENABLE,value:"1",checked:oe,description:He.HELP.STREAMING,onChange:Qe}))),Ct=React.createElement(p.d,{title:He.SETTINGS.TYPEWRITER_EFFECT},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"chatbot_typewriter",label:He.COMMON.ENABLE,value:"1",checked:ue,description:(0,O.FE)(He.SETTINGS.TYPEWRITER_EFFECT_HELP),onChange:Qe}))),It=React.createElement(p.d,{title:He.COMMON.DISCUSSIONS},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"chatbot_discussions",label:He.COMMON.ENABLE,value:"1",checked:se,description:He.HELP.DISCUSSIONS,onChange:Qe}))),At=React.createElement(p.d,{title:He.COMMON.SYNTAX_HIGHLIGHT},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"syntax_highlight",label:He.COMMON.ENABLE,value:"1",checked:ce,description:He.HELP.SYNTAX_HIGHLIGHT,onChange:Qe}))),kt=React.createElement(p.d,{title:He.COMMON.PUBLIC_API},React.createElement(y.R,{name:"public_api",label:He.COMMON.ENABLE,value:"1",checked:ve,description:He.HELP.PUBLIC_API,onChange:Qe})),Lt=React.createElement(p.d,{title:He.COMMON.BEARER_TOKEN},React.createElement(Re.A,{name:"public_api_bearer_token",value:null==o?void 0:o.public_api_bearer_token,description:(0,O.FE)(He.HELP.BEARER_TOKEN),onBlur:Qe})),Mt=React.createElement(p.d,{title:"Local Upload"},React.createElement(we.u,{scrolldown:!0,name:"image_local_upload",value:null==o?void 0:o.image_local_upload,onChange:Qe,description:"Files can be stored either in the filesystem or the Media Library."},React.createElement(we.j,{key:"uploads",value:"uploads",label:"Filesystem"}),React.createElement(we.j,{key:"library",value:"library",label:"Media Library"}))),Pt=React.createElement(p.d,{title:"Remote Upload"},React.createElement(we.u,{scrolldown:!0,name:"image_remote_upload",value:null==o?void 0:o.image_remote_upload,onChange:Qe,description:"Select Upload Data for private sites; Share URLs requires your WordPress to be online and reachable."},React.createElement(we.j,{key:"data",value:"data",label:"Upload Data"}),React.createElement(we.j,{key:"url",value:"url",label:"Share URLs"}))),jt=React.createElement(p.d,{title:"Expiration"},React.createElement(we.u,{scrolldown:!0,name:"image_expires",value:null!==(t=null==o?void 0:o.image_expires)&&void 0!==t?t:"never",onChange:Qe,description:"Uploaded files will be deleted after a certain amount of time. This also affects files uploaded to OpenAI via the Assistants."},React.createElement(we.j,{key:300,value:300,label:"5 minutes"}),React.createElement(we.j,{key:3600,value:3600,label:"1 hour"}),React.createElement(we.j,{key:21600,value:21600,label:"6 hours"}),React.createElement(we.j,{key:86400,value:86400,label:"1 day"}),React.createElement(we.j,{key:604800,value:604800,label:"1 week"}),React.createElement(we.j,{key:2592e3,value:2592e3,label:"1 month"}),React.createElement(we.j,{key:"Never",value:"never",label:"Never"}))),Ft=React.createElement(p.d,{title:"Local Download"},React.createElement(we.u,{scrolldown:!0,name:"image_local_download",value:null!==(n=null==o?void 0:o.image_local_download)&&void 0!==n?n:null,onChange:Qe,description:"Files can be stored either in the filesystem or the Media Library."},React.createElement(we.j,{key:null,value:null,label:"None"}),React.createElement(we.j,{key:"uploads",value:"uploads",label:"Filesystem"}),React.createElement(we.j,{key:"library",value:"library",label:"Media Library"}))),Dt=React.createElement(p.d,{title:"Expiration"},React.createElement(we.u,{scrolldown:!0,name:"image_expires_download",value:null!==(r=null==o?void 0:o.image_expires_download)&&void 0!==r?r:"never",onChange:Qe,description:"Downloaded files will be deleted after a certain amount of time."},React.createElement(we.j,{key:300,value:300,label:"5 minutes"}),React.createElement(we.j,{key:3600,value:3600,label:"1 hour"}),React.createElement(we.j,{key:21600,value:21600,label:"6 hours"}),React.createElement(we.j,{key:86400,value:86400,label:"1 day"}),React.createElement(we.j,{key:604800,value:604800,label:"1 week"}),React.createElement(we.j,{key:2592e3,value:2592e3,label:"1 month"}),React.createElement(we.j,{key:"Never",value:"never",label:"Never"}))),Gt=React.createElement(p.d,{title:He.COMMON.DEV_TOOLS},React.createElement(y.R,{name:"module_devtools",label:He.COMMON.ENABLE,value:"1",checked:z,description:He.HELP.DEV_TOOLS,onChange:Qe})),Bt=React.createElement(p.d,{title:He.COMMON.SHORTCODES},React.createElement(y.R,{name:"resolve_shortcodes",label:He.COMMON.RESOLVE,value:"1",checked:Le,description:He.HELP.RESOLVE_SHORTCODE,onChange:Qe})),Ht=React.createElement(p.d,{title:He.COMMON.CONTEXT_MAX_LENGTH},React.createElement(Re.A,{name:"context_max_length",value:Ce,type:"number",step:"1",description:He.HELP.CONTEXT_MAX_LENGTH,onBlur:Qe})),Yt=React.createElement(p.d,{title:He.COMMON.BANNED_WORDS},React.createElement(Re.A,{id:"banned_words",name:"banned_words",value:Ae,isCommaSeparatedArray:!0,description:He.HELP.BANNED_WORDS,onBlur:Qe})),zt=React.createElement(p.d,{title:He.COMMON.MODEL},React.createElement(we.u,{scrolldown:!0,name:"ai_default_model",value:q,onChange:Qe},Pe.map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})})))),Wt=React.createElement(p.d,{title:He.COMMON.MODEL},React.createElement(we.u,{scrolldown:!0,name:"ai_embeddings_default_model",value:J,onChange:Qe},Be.map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})})))),Vt=React.createElement(p.d,{title:He.COMMON.DIMENSIONS},React.createElement(we.u,{scrolldown:!0,name:"ai_embeddings_default_dimensions",value:(null==o?void 0:o.ai_embeddings_default_dimensions)||null,onChange:Qe},null==Ye?void 0:Ye.dimensions.map((function(e,t){return React.createElement(we.j,{key:e,value:e,label:t===Ye.dimensions.length-1?"".concat(e," (Default)"):e})})),React.createElement(we.j,{key:null,value:null,label:"Not Set"}))),Kt=React.createElement(p.d,{title:He.COMMON.MODEL},React.createElement(we.u,{scrolldown:!0,name:"ai_vision_default_model",value:$,onChange:Qe},je.map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})})))),qt=React.createElement(p.d,{title:He.COMMON.MODEL},React.createElement(we.u,{scrolldown:!0,name:"ai_audio_default_model",value:ne,onChange:Qe},Fe.map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})})))),Xt=React.createElement(p.d,{title:He.COMMON.MODEL},React.createElement(we.u,{scrolldown:!0,name:"ai_json_default_model",value:ae,onChange:Qe},De.map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})})))),$t=React.createElement(p.d,{title:He.COMMON.MODEL},React.createElement(we.u,{scrolldown:!0,name:"ai_images_default_model",value:ee,onChange:Qe},Ue.map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})})))),Qt=React.createElement(p.d,{title:He.COMMON.BANNED_IPS},React.createElement(Re.A,{id:"banned_ips",name:"banned_ips",value:Ie,isCommaSeparatedArray:!0,description:He.HELP.BANNED_IPS,onBlur:Qe})),Jt=React.createElement(p.d,{title:He.COMMON.PLAYGROUND},React.createElement(y.R,{label:He.COMMON.ENABLE,value:"1",checked:null==ke?void 0:ke.playground,onChange:function(e){var t=Zu(Zu({},ke),{},{playground:e});Qe(t,"admin_bar")}})),Zt=React.createElement(p.d,{title:He.COMMON.GENERATE_CONTENT},React.createElement(y.R,{label:He.COMMON.ENABLE,value:"1",checked:null==ke?void 0:ke.content_generator,onChange:function(e){var t=Zu(Zu({},ke),{},{content_generator:e});Qe(t,"admin_bar")}})),en=React.createElement(p.d,{title:He.COMMON.GENERATE_IMAGES},React.createElement(y.R,{label:He.COMMON.ENABLE,value:"1",checked:null==ke?void 0:ke.images_generator,onChange:function(e){var t=Zu(Zu({},ke),{},{images_generator:e});Qe(t,"admin_bar")}})),tn=React.createElement(p.d,{title:"AI Engine"},React.createElement(y.R,{label:He.COMMON.ENABLE,value:"1",checked:null==ke?void 0:ke.settings,onChange:function(e){var t=Zu(Zu({},ke),{},{settings:e});Qe(t,"admin_bar")}})),nn=React.createElement("div",null,React.createElement(ba,{options:o}),React.createElement("div",{style:{fontSize:12,marginTop:15,lineHeight:1.3,color:"#666"}},(0,O.FE)(He.COMMON.USAGE_HELP))),rn=Ke>0?React.createElement(Oe.z,{style:{marginLeft:5,marginRight:-5,display:"inline"},width:"16",icon:"alert",variant:"warning"}):null,an=React.createElement(React.Fragment,null,React.createElement(_e.g,{height:5}),React.createElement(p.d,{title:He.COMMON.ENVIRONMENT},React.createElement(we.u,{scrolldown:!0,name:"ai_default_env",value:K,onChange:Qe},V.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})}))))),on=React.createElement(React.Fragment,null,React.createElement(_e.g,{height:5}),React.createElement(p.d,{title:He.COMMON.ENVIRONMENT},React.createElement(we.u,{scrolldown:!0,name:"ai_embeddings_default_env",value:Q,onChange:Qe},V.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})}))))),ln=React.createElement(React.Fragment,null,React.createElement(_e.g,{height:5}),React.createElement(p.d,{title:He.COMMON.ENVIRONMENT},React.createElement(we.u,{scrolldown:!0,name:"ai_vision_default_env",value:X,onChange:Qe},V.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})}))))),cn=React.createElement(React.Fragment,null,React.createElement(_e.g,{height:5}),React.createElement(p.d,{title:He.COMMON.ENVIRONMENT},React.createElement(we.u,{scrolldown:!0,name:"ai_audio_default_env",value:te,onChange:Qe},V.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})}))))),un=React.createElement(React.Fragment,null,React.createElement(_e.g,{height:5}),React.createElement(p.d,{title:He.COMMON.ENVIRONMENT},React.createElement(we.u,{scrolldown:!0,name:"ai_json_default_env",value:re,onChange:Qe},V.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})}))))),sn=React.createElement(React.Fragment,null,React.createElement(_e.g,{height:5}),React.createElement(p.d,{title:He.COMMON.ENVIRONMENT},React.createElement(we.u,{scrolldown:!0,name:"ai_images_default_env",value:Z,onChange:Qe},V.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})}))))),fn=React.createElement(we.u,{scrolldown:!0,name:"embeddings_default_env",value:le,onChange:Qe},ie.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})}))),pn=React.createElement(p.d,{title:He.COMMON.PLUGIN_DATA},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"clean_uninstall",label:He.COMMON.DELETE_ALL,description:He.COMMON.PLUGIN_DATA_DESCRIPTION,value:"1",checked:Me,onChange:Qe})));return React.createElement(v.z,null,React.createElement(Ut,{options:o}),React.createElement(E.N,null,React.createElement(E.Y,{fullWidth:!0},React.createElement(st,{options:o}),be&&React.createElement(xe.L,null,(0,O.FE)(He.SETTINGS.INTRO)),React.createElement(b._,{keepTabOnReload:!0},React.createElement(b.V,{key:"dashboard",title:He.COMMON.DASHBOARD},React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(R.z,{busy:qe,title:He.COMMON.CLIENT_MODULES,className:"primary"},React.createElement("p",null,He.SETTINGS.MODULES_INTRO),React.createElement(_e.g,null),yt,lt),React.createElement(R.z,{busy:qe,title:He.COMMON.SERVER_MODULES,className:"primary"},React.createElement("p",null,He.SETTINGS.MODULES_INTRO),React.createElement(_e.g,null),ut,pt,ct,mt,ht),React.createElement(R.z,{busy:qe,title:He.COMMON.BACKEND_MODULES,className:"primary"},React.createElement("p",null,He.SETTINGS.MODULES_INTRO),React.createElement(_e.g,null),at,ot,it,rt,dt)),React.createElement(E.Y,{minimal:!0},React.createElement(R.z,{busy:qe,title:He.COMMON.USAGE,className:"primary"},nn)))),W&&React.createElement(b.V,{key:"chatbots",title:He.COMMON.CHATBOTS},React.createElement(fc,{options:o,updateOption:Qe,busy:qe})),W&&se&&React.createElement(b.V,{key:"discussions",title:He.COMMON.DISCUSSIONS},React.createElement(co,null)),P&&React.createElement(b.V,{key:"queries",title:He.COMMON.QUERIES},React.createElement(zc,{options:o,updateOption:Qe,busy:qe})),U&&React.createElement(b.V,{key:"embeddings",title:He.COMMON.EMBEDDINGS},React.createElement(fa,{options:o,updateEnvironment:Je,updateOption:Qe})),B&&React.createElement(b.V,{key:"assistants",title:He.COMMON.ASSISTANTS},React.createElement(Uu,{options:o,updateOption:Qe,refreshOptions:Xe})),M&&React.createElement(b.V,{key:"finetunes",title:He.COMMON.FINETUNES},React.createElement(tr,{options:o,updateOption:Qe,refreshOptions:Xe})),G&&React.createElement(b.V,{key:"moderation",title:He.COMMON.MODERATION},React.createElement(dr,{options:o,updateOption:Qe,busy:qe})),H&&React.createElement(b.V,{key:"transcription",title:He.COMMON.TRANSCRIPTION},React.createElement(Ou,{options:o,updateOption:Qe})),Y&&React.createElement(b.V,{key:"addons",title:He.COMMON.ADDONS},React.createElement(Ku,{addons:null==o?void 0:o.addons,updateOption:Qe})),React.createElement(b.V,{key:"settings",title:React.createElement(React.Fragment,null,He.COMMON.SETTINGS,rn)},React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(pu,{busy:qe,options:o,environments:V,updateEnvironment:Ze,updateOption:Qe}),React.createElement("div",{style:{padding:"0px 10px 15px 10px",marginTop:13,marginBottom:5}},React.createElement(d.s,{h2:!0,style:{color:"white",marginBottom:15}},He.COMMON.AI_ENVIRONMENT_DEFAULTS),React.createElement(b._,{inversed:!0},React.createElement(b.V,{key:"ai",title:He.COMMON.DEFAULT,busy:qe},an,zt),React.createElement(b.V,{key:"vision",title:He.COMMON.VISION,busy:qe},ln,Kt),React.createElement(b.V,{key:"images",title:He.COMMON.IMAGES,busy:qe},sn,$t),React.createElement(b.V,{key:"embeddings",title:He.COMMON.EMBEDDINGS,busy:qe},on,Wt,Vt),React.createElement(b.V,{key:"audio",title:He.COMMON.AUDIO,busy:qe},cn,qt),React.createElement(b.V,{key:"json",title:He.COMMON.JSON,busy:qe},un,Xt))),U&&React.createElement(React.Fragment,null,React.createElement(Zc,{busy:qe,options:o,environments:ie,updateEnvironment:Je,updateOption:Qe}),React.createElement(R.z,{busy:qe,title:He.COMMON.EMBEDDINGS_ENVIRONMENT_DEFAULT,className:"primary"},fn)),React.createElement(R.z,{busy:We,title:React.createElement("div",{style:{display:"flex"}},He.COMMON.INCIDENTS_OPENAI,rn),className:"primary",contentStyle:{padding:0}},React.createElement(ir,{incidents:Ve,isLoading:We})),React.createElement(R.z,{busy:qe,title:He.COMMON.MAINTENANCE,className:"primary"},React.createElement(w.M,{className:"blue",onClick:tt},"Export Settings"),React.createElement(w.M,{className:"danger",onClick:nt},"Import Settings"),React.createElement(w.M,{className:"danger",onClick:et},"Reset Settings"))),React.createElement(E.Y,{minimal:!0},React.createElement(R.z,{busy:qe,title:He.COMMON.GENERAL,className:"primary"},Nt),React.createElement(R.z,{busy:qe,title:He.COMMON.USER_INTERFACE,className:"primary"},Et,bt,wt),React.createElement(R.z,{busy:qe,title:He.COMMON.CHATBOT,className:"primary"},It,At,Rt,_t,xt,me&&React.createElement(React.Fragment,null,St,Tt)),P&&React.createElement(R.z,{busy:qe,title:He.COMMON.STATISTICS,className:"primary"},React.createElement("p",null,He.HELP.STATISTICS),vt,gt),React.createElement(R.z,{busy:qe,title:He.COMMON.IMAGES_AND_FILES,className:"primary"},React.createElement("p",null,React.createElement("b",null,"Uploaded by Users")),Mt,Pt,jt,React.createElement("p",null,React.createElement("b",null,"Generated by AI")),Ft,null!==(null==o?void 0:o.image_local_download)&&Dt),React.createElement(R.z,{busy:qe,title:He.COMMON.ADMIN_TOOLS,className:"primary"},React.createElement(Se.Y,{title:He.COMMON.ADMIN_BAR}),tn,Jt,Zt,en),React.createElement(R.z,{busy:qe,title:He.COMMON.ADVANCED,className:"primary"},Bt,Ht,kt,Lt,Gt,pn),React.createElement(R.z,{busy:qe,title:He.COMMON.SECURITY,className:"primary"},Yt,Qt),React.createElement(R.z,{busy:qe,title:He.COMMON.LEGACY_FEATURES,className:"primary"},Ct)))),z&&React.createElement(b.V,{key:"devtools",title:He.COMMON.DEV_TOOLS},React.createElement(Xc,{options:o,setOptions:i,updateOption:Qe})),React.createElement(b.V,{key:"license",title:He.COMMON.LICENSE_TAB},React.createElement(Ge,{domain:x,prefix:_,isPro:I,isRegistered:A}))))),React.createElement(Te.n,{isOpen:c,title:He.COMMON.ERROR,content:c,onRequestClose:function(){return u(!1)},okButton:{label:"Close",onClick:function(){return u(!1)}}}))};var ms=n(6087),ds=[{value:"informative",label:"Informative"},{value:"descriptive",label:"Descriptive"},{value:"creative",label:"Creative"},{value:"narrative",label:"Narrative"},{value:"persuasive",label:"Persuasive"},{value:"reflective",label:"Reflective"},{value:"argumentative",label:"Argumentative"},{value:"analytical",label:"Analytical"},{value:"evaluative",label:"Evaluative"},{value:"journalistic",label:"Journalistic"},{value:"technical",label:"Technical"}],ps=[{value:"neutral",label:"Neutral"},{value:"formal",label:"Formal"},{value:"assertive",label:"Assertive"},{value:"cheerful",label:"Cheerful"},{value:"humorous",label:"Humorous"},{value:"informal",label:"Informal"},{value:"inspirational",label:"Inspirational"},{value:"professional",label:"Professional"},{value:"confluent",label:"Confluent"},{value:"emotional",label:"Emotional"},{value:"persuasive",label:"Persuasive"},{value:"supportive",label:"Supportive"},{value:"sarcastic",label:"Sarcastic"},{value:"condescending",label:"Condescending"},{value:"skeptical",label:"Skeptical"},{value:"narrative",label:"Narrative"},{value:"journalistic",label:"Journalistic"}],hs="gpt-3.5-turbo",ys=[{id:"default",name:"Default",mode:"query",model:hs,temperature:.8,stopSequence:"",maxTokens:2048,prompt:""},{id:"article_translator",name:"Text Translator",mode:"query",model:hs,temperature:.3,stopSequence:"",maxTokens:2048,prompt:"Translate this article into French:\n\nUchiko is located in Ehime prefecture, in the west of the island. The town was prosperous at the end of the 19th century thanks to its production of very good quality white wax. This economic boom allowed wealthy local merchants to build beautiful properties, whose heritage is still visible throughout the town.\n"},{id:"restaurant_review",name:"Restaurant Review Writer",mode:"query",model:hs,temperature:.8,stopSequence:"",maxTokens:2048,prompt:"Write a review for a French restaurant located in Kagurazaka, Tokyo. Looks like an old restaurant, food is traditional, chef is talkative, it is always full. Not expensive, but not fancy.\n"},{id:"article_corrector",name:"Text Corrector",mode:"query",model:hs,temperature:.2,stopSequence:"",maxTokens:2048,prompt:"Fix the grammar and spelling mistakes in this text:\n\nI wake up at eleben yesderday, I will go bed eary tonigt.\n"},{id:"seo_assistant",name:"SEO Optimizer",mode:"query",model:hs,temperature:.6,stopSequence:"",maxTokens:1024,prompt:"For the following article, write a SEO-friendly and short title, keywords for Google, and a short excerpt to introduce it. Use this format:\n\nTitle: \nKeywords: \nExcerpt:\n\nArticle:\nUchiko is located in Ehime prefecture, in the west of the island. The town was prosperous at the end of the 19th century thanks to its production of very good quality white wax. This economic boom allowed wealthy local merchants to build beautiful properties, whose heritage is still visible throughout the town."}],vs=[{id:"default",name:"Default",model:"dall-e-3",maxResults:1,prompt:""},{id:"japan",name:"Ghibli Scene",model:"dall-e-3",maxResults:1,prompt:"Create an image in the style of a Ghibli-inspired anime oil painting, depicting a quaint, old house in the Japanese countryside. This house, reminiscent of a traditional izakaya, is surrounded by lush trees and overlooks vibrant rice fields. The scene is bathed in the warm, soft glow of a setting sun, casting gentle shadows and creating a tranquil, nostalgic atmosphere. The composition should be rich in texture, capturing the serene beauty of rural Japan in a whimsical, Ghibli-like manner."},{id:"steampunk",name:"Steampunk Architecture",model:"dall-e-3",maxResults:1,prompt:"Create an image showcasing steampunk architecture, focusing on the exterior view of a grand theater. The style should reflect award-winning architectural photography from a science fiction magazine. The theater, a masterpiece of steampunk design, combines Victorian influences with futuristic, mechanical elements. Its intricate facade features exposed gears, brass pipes, and steam vents, all integrated into the ornate, classical structure. The building should be set against a dramatic sky, highlighting its unique features and the interplay of light and shadow, capturing the essence of a high-quality, professional architectural photograph."},{id:"nyao-illustration",name:"Nyao Illustration",model:"dall-e-3",maxResults:1,prompt:"The character is an anthropomorphic cat with a whimsical and endearing design, featuring a blend of white and blue fur. The right side of the cat's face has a patch of blue fur that also covers the outer part of the ear, while the left side remains predominantly white, except that the eye is surrounded by a green patch of fur. The tail mirrors this pattern with white fur leading to a blue tip. The character's facial expression is joyous, with a wide, open-mouthed smile showcasing a single front tooth and a small, black nose.  The cat's paws are also white, with defined fingers that suggest human-like dexterity. An orange collar encircles the neck, contrasting with the green and blue tones of the body. This collar is adorned with a blue and white emblem in the center, reminiscent of the WordPress logo. The drawing style of this image can be defined as a digital illustration with a cartoonish and whimsical aesthetic. It features bold outlines, flat colors, and simplified shapes which are typical of contemporary character design aimed at a broad, family-friendly audience. The style is reminiscent of modern vector art, which is often used for web graphics, animation, and media aimed at engaging a casual viewer with its clear, approachable, and vibrant visuals."}],gs=[{id:"default",name:"Default",mode:"single",topic:"",topics:"",topicsAreTitles:!1,title:"",sections:"",model:hs,temperature:.8,maxTokens:2048,sectionsCount:2,paragraphsCount:3,language:"en",customLanguage:"",writingStyle:"creative",writingTone:"cheerful",titlePromptFormat:'Write a title for an article about "{TOPIC}" in {LANGUAGE}. Style: {WRITING_STYLE}. Tone: {WRITING_TONE}. Must be between 40 and 60 characters.',sectionsPromptFormat:'Write {SECTIONS_COUNT} consecutive headings for an article about "{TITLE}", in {LANGUAGE}. Style: {WRITING_STYLE}. Tone: {WRITING_TONE}. Each heading is between 40 and 60 characters. Use Markdown for the headings (## ).',contentPromptFormat:'Write an article about "{TITLE}" in {LANGUAGE}. The article is organized by the following headings:\n\n{SECTIONS}\n\nWrite {PARAGRAPHS_PER_SECTION} paragraphs per heading. Use Markdown for formatting. Add an introduction prefixed by "===INTRO: ", and a conclusion prefixed by "===OUTRO: ". Style: {WRITING_STYLE}. Tone: {WRITING_TONE}.',excerptPromptFormat:'Write an excerpt for an article about "{TITLE}" in {LANGUAGE}. Style: {WRITING_STYLE}. Tone: {WRITING_TONE}. Must be between 40 and 60 characters.'},{id:"",name:"Expore Japan",mode:"single",topic:"Tokyo, its main areas and attractions, one day tour for a first-time visitor. Simple vocabulary, short paragraphs.",topics:"",topicsAreTitles:!1,title:"",sections:"",model:hs,temperature:.8,maxTokens:2048,sectionsCount:3,paragraphsCount:2,language:"en",customLanguage:"",writingStyle:"informative",writingTone:"informal",titlePromptFormat:'Write a title for an article about "{TOPIC}" in {LANGUAGE}. Style: {WRITING_STYLE}. Tone: {WRITING_TONE}. Must be between 40 and 60 characters.',sectionsPromptFormat:'Write {SECTIONS_COUNT} consecutive headings for an article about "{TITLE}", in {LANGUAGE}. Style: {WRITING_STYLE}. Tone: {WRITING_TONE}. Each heading is between 40 and 60 characters. Use Markdown for the headings (## ).',contentPromptFormat:'Write an article about "{TITLE}" in {LANGUAGE}. The article is organized by the following headings:\n\n{SECTIONS}\n\nWrite {PARAGRAPHS_PER_SECTION} paragraphs per heading. Use Markdown for formatting. Add an introduction prefixed by "===INTRO: ", and a conclusion prefixed by "===OUTRO: ". Style: {WRITING_STYLE}. Tone: {WRITING_TONE}.',excerptPromptFormat:'Write an excerpt for an article about "{TITLE}" in {LANGUAGE}. Style: {WRITING_STYLE}. Tone: {WRITING_TONE}. Must be between 40 and 60 characters.'}];function Es(e){return Es="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},Es(e)}function bs(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 ws(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bs(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=Es(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Es(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==Es(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bs(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Rs(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||Ts(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 Os(){Os=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Es(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Es(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 _s(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function xs(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){_s(o,r,a,i,l,"next",e)}function l(e){_s(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Ss(e){return function(e){if(Array.isArray(e))return Ns(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ts(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 Ts(e,t){if(e){if("string"==typeof e)return Ns(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)?Ns(e,t):void 0}}function Ns(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 Cs=wp.element,Is=Cs.useState,As=Cs.useEffect,ks=Cs.useMemo;function Ls(){return(new Date).getTime().toString(36)+Math.random().toString(36).substr(2,9)}var Ms=function(e){var t=Ss(e);return t.sort((function(e,t){return e.name.localeCompare(t.name)})),t},Ps=function(){var e=xs(Os().mark((function e(t){var n,r,a;return Os().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,O.IU)("".concat(T,"/system/templates?category=").concat(t),{nonce:k});case 3:return n=e.sent,r=[],"imagesGenerator"===t?r=vs:"playground"===t?r=ys:"contentGenerator"===t&&(r=gs),a=r.find((function(e){return"default"===e.id})),null!=n&&n.templates&&n.templates.length>0&&(r=Ms(n.templates)),a?r.forEach((function(e){Object.keys(a).forEach((function(t){void 0===e[t]&&(e[t]=a[t])}))})):console.warn("Default template not found for category: "+t),e.abrupt("return",r);case 12:e.prev=12,e.t0=e.catch(0),console.error(e.t0),alert(e.t0.message);case 16:case"end":return e.stop()}}),e,null,[[0,12]])})));return function(t){return e.apply(this,arguments)}}();const js=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"playground",t=Rs(Is(),2),n=t[0],r=t[1],a=Rs(Is(!1),2),o=a[0],i=a[1],l=Rs(Is([]),2),c=l[0],u=l[1],s=(0,f.I)({queryKey:["templates-".concat(e)],queryFn:function(){return Ps(e)}}),m=s.isLoading,d=s.data;As((function(){for(var t=0;t<c.length;t++){var n=c[t],r=!1;if(n&&(!n.envId||!n.model)){var a=(null==L?void 0:L.ai_default_env)||null,o=(null==L?void 0:L.ai_default_model)||null;"imagesGenerator"===e&&(o="dall-e-3-hd"),a&&o&&(n.envId=a,n.model=o,r=!0)}r&&u(Ss(c))}}),[c]),As((function(){d&&(u(d),r(d[0]))}),[d]);var p=function(){var t=xs(Os().mark((function t(n){var r;return Os().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Ms(n),u(n),t.prev=2,t.next=5,(0,O.IU)("".concat(T,"/system/templates"),{method:"POST",nonce:k,json:{category:e,templates:n}});case 5:return r=t.sent,t.abrupt("return",r);case 9:t.prev=9,t.t0=t.catch(2),console.error(t.t0),alert(t.t0.message);case 13:case"end":return t.stop()}}),t,null,[[2,9]])})));return function(e){return t.apply(this,arguments)}}(),h=ks((function(){if(!n||0===c.length)return!1;if(Object.keys(n).length!==Object.keys(c.find((function(e){return e.id===n.id}))).length)return!0;var e=c.find((function(e){return e.id===n.id}));return Object.keys(e).some((function(t){return e[t]!==n[t]}))}),[n,c]),y=function(){var e=c.find((function(e){return e.id===n.id}));e&&r(ws({},e))},v=function(){var e=prompt(He.COMMON.NAME,n.name||He.TEMPLATES.NEW_TEMPLATE_NAME);if(!e)return!1;var t=ws(ws({},n),{},{id:Ls(),name:e});p([].concat(Ss(c),[t])),r(ws({},t))},g=function(){var e=c.map((function(e){return e.id===n.id?n:e}));p(e),r(ws({},n))},E=function(){var e=prompt("Template Name",n.name),t=ws(ws({},c[0]),{},{id:Ls(),name:e});p([].concat(Ss(c),[t])),r(ws({},t))},b=function(){var e=prompt("Template Name",n.name);if(e){var t=c.map((function(t){return t.id===n.id?ws(ws({},t),{},{name:e}):t}));p(Ss(t)),r(ws({},t.find((function(e){return e.id===n.id}))))}},R=function(){if(confirm(He.TEMPLATES.DELETE_ALL_CONFIRM)){var t=[];"imagesGenerator"===e?t=Ss(vs):"playground"===e?t=Ss(ys):"contentGenerator"===e&&(t=Ss(gs)),p(t),r(ws({},t[0]))}},_=ks((function(){return h&&n&&"default"!==n.id}),[h,n]),x=ks((function(){return n&&"default"!==n.id}),[n]),S=ks((function(){return n&&"default"!==n.id}),[n]),N=ks((function(){return React.createElement("div",{style:{margin:"0"}},React.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},React.createElement("h3",{style:{margin:0}},He.TEMPLATES.TEMPLATE),React.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},React.createElement(Xt.S,{small:!0,onLabel:He.TEMPLATES.EDIT,offLabel:He.TEMPLATES.EDIT,width:60,onChange:i,checked:o}))),m&&React.createElement("div",{style:{display:"flex",marginTop:30,justifyContent:"center"}},React.createElement("div",{style:{width:60}},React.createElement(ms.X,{width:20}))),React.createElement(_e.g,null),o&&React.createElement(React.Fragment,null,React.createElement("div",{style:{display:"flex"}},React.createElement(w.M,{className:"primary",style:{flex:3},onClick:E},"New"),React.createElement(w.M,{onClick:v,style:{flex:1}},"Duplicate")),React.createElement(_e.g,{tiny:!0})),React.createElement(we.u,{scrolldown:!0,name:"template",value:null==n?void 0:n.id,onChange:function(e){var t=c.find((function(t){return t.id===e}));r(ws({},t))}},c.filter((function(e){return"default"!==e.id})).map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})}))),(h||o)&&React.createElement("div",null,React.createElement(_e.g,{tiny:!0}),React.createElement("div",{style:{display:"flex"}},React.createElement(w.M,{className:"secondary",style:{flex:1},disabled:!_,onClick:y},"Reset"),React.createElement(w.M,{className:"primary",style:{flex:3},disabled:!_,onClick:g},"Save")),o&&React.createElement(React.Fragment,null,React.createElement(_e.g,{tiny:!0}),React.createElement("div",{style:{display:"flex"}},React.createElement(w.M,{small:!0,className:"danger",style:{flex:1},disabled:!S,onClick:function(){return function(e){if(confirm(He.TEMPLATES.DELETE_CONFIRM)){var t=c.filter((function(t){return t.id!==e.id}));p(Ss(t)),r(ws({},t[0]))}}(n)}},"Delete"),React.createElement(w.M,{small:!0,className:"secondary",style:{flex:3},disabled:!x,onClick:b},"Rename")))),o&&React.createElement(React.Fragment,null,React.createElement(_e.g,null),React.createElement("div",{style:{display:"flex"}},React.createElement(w.M,{className:"danger",style:{flex:1},onClick:R},"Reset All Templates"))))}),[c,n,o,h,_,m]);return{template:n,clearTemplate:y,setTemplate:function(e){r(e)},jsxTemplates:N,isEdit:o}};function Fs(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ds(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)?Ds(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 Ds(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 Gs=wp.element,Us=Gs.useState,Bs=Gs.useMemo;const Hs=function(e){var t=Fs(Us(0),2),n=t[0],r=t[1],a=Fs(Us(0),2),o=a[0],i=a[1],l=function(){r(0),i(0)};return{addUsage:function(t,a,o){var l=e(t,a,o);i(l),r(n+l)},jsxUsageCosts:Bs((function(){var e=(0,O.FE)(He.COMMON.USAGE_HELP);return A||(e=React.createElement(React.Fragment,null,e," ",(0,O.FE)(He.COMMON.USAGE_PRO_HELP))),React.createElement(po,null,React.createElement("h3",null,He.COMMON.USAGE),React.createElement("div",null,"Session: ",React.createElement("span",{style:{float:"right"}},"$",n.toFixed(4))),React.createElement("div",null,"Last Request: ",React.createElement("span",{style:{float:"right"}},"$",o.toFixed(4))),React.createElement(_e.g,{height:30}),React.createElement("p",{style:{fontSize:12,lineHeight:1.2,color:"var(--neko-dark-gray)"}},e),React.createElement(w.M,{fullWidth:!0,onClick:l},"Reset Usage"))}),[n,o])}};function Ys(e){return Ys="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},Ys(e)}var zs;function Ws(){Ws=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Ys(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Ys(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Vs(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Ks(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 qs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ks(Object(n),!0).forEach((function(t){Xs(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ks(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Xs(e,t,n){var r;return r=function(e,t){if("object"!=Ys(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ys(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==Ys(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $s(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Qs(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)?Qs(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 Qs(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 Js=wp.element,Zs=Js.useState,ef=Js.useEffect,tf=(0,G.Ay)(Wt.m)(zs||(zs=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n  .neko-textarea-container {\n  \n    textarea {\n      color: white;\n      font-size: 13px;\n      padding: 10px;\n      font-family: monospace;\n      background: #333d4e;\n      border: none;\n\n      &:focus {\n        background-color: #333d4e;\n      }\n    }\n  }\n"])));const nf=function(){var e,t,n,r,a,o,i,l=js("playground"),c=l.template,u=l.setTemplate,s=l.jsxTemplates,f=$s(Zs(""),2),m=f[0],p=f[1],h=$s(Zs(!1),2),y=h[0],g=h[1],b=$s(Zs(""),2),R=b[0],_=b[1],x=$s(Zs(),2),S=x[0],N=x[1],C=$s(Zs(),2),I=C[0],A=C[1],P=null!==(e=null==c?void 0:c.prompt)&&void 0!==e?e:"",F=null!==(t=null==c?void 0:c.model)&&void 0!==t?t:"gpt-3.5-turbo",D=null!==(n=null==c?void 0:c.mode)&&void 0!==n?n:"query",G=null!==(r=null==c?void 0:c.temperature)&&void 0!==r?r:1,U=null!==(a=null==c?void 0:c.envId)&&void 0!==a?a:"",B=null!==(o=null==c?void 0:c.stopSequence)&&void 0!==o?o:"",H=null!==(i=null==c?void 0:c.maxTokens)&&void 0!==i?i:2048,Y=ft(L,U||null),z=Y.calculatePrice,W=Y.completionModels,V=Hs(z),K=V.addUsage,q=V.jsxUsageCosts,X=(null==L?void 0:L.ai_envs)||[],$=function(e,t){u(qs(qs({},c),{},Xs({},t,e)))},Q=function(e){u(qs(qs({},c),{},{prompt:e}))};ef((function(){c&&p("")}),[c]);var J=function(){var e,t=(e=Ws().mark((function e(){var t,n,r,a,o,i,l,c=arguments;return Ws().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=c.length>0&&void 0!==c[0]?c[0]:P,g(!0),N(new Date),e.prev=3,a=B.replace(/\\n/g,"\n"),o=j?function(e){p(e)}:null,e.next=8,(0,Lo.ti)("".concat(T,"/ai/completions"),{scope:"playground",session:M,message:t,temperature:G,envId:U,model:F,maxTokens:H,stop:a,stream:j},k,j);case 8:return i=e.sent,e.next=12,(0,Lo.Pn)(i,o,null);case 12:if(!1!==(null==(l=e.sent)?void 0:l.success)){e.next=15;break}throw new Error(null==l?void 0:l.message);case 15:console.log("Completions",{prompt:t,result:l}),"continuous"===D?Q(t+"\n"+l.data+"\n"):p(l.data),K(F,(null==l||null===(n=l.usage)||void 0===n?void 0:n.prompt_tokens)||0,(null==l||null===(r=l.usage)||void 0===r?void 0:r.completion_tokens)||0),e.next=23;break;case 20:e.prev=20,e.t0=e.catch(3),A(e.t0.message);case 23:N(),g(!1);case 25:case"end":return e.stop()}}),e,null,[[3,20]])})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Vs(o,r,a,i,l,"next",e)}function l(e){Vs(o,r,a,i,l,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}();return React.createElement(v.z,{nekoErrors:[]},React.createElement(Ut,{title:He.COMMON.PLAYGROUND}),React.createElement(E.N,null,React.createElement(E.Y,{fullWidth:!0},React.createElement(st,{options:L}),React.createElement(xe.L,{style:{marginBottom:0}},React.createElement(d.s,{p:!0},(0,O.FE)(He.PLAYGROUND.INTRO)))),React.createElement(E.Y,null,React.createElement(po,null,s)),React.createElement(E.Y,{style:{flex:3}},React.createElement(po,null,"continuous"!==D&&React.createElement(React.Fragment,null,React.createElement(tf,{rows:12,onChange:Q,value:P})),"continuous"===D&&React.createElement(React.Fragment,null,React.createElement(tf,{rows:18,onChange:Q,value:P}),React.createElement("div",{style:{display:"flex"}},React.createElement("span",{className:"dashicons dashicons-format-continuous",style:{position:"absolute",color:"white",zIndex:200,fontSize:28,marginTop:12,marginLeft:10}}),React.createElement(ho,{name:"continuousEntry",value:R,onChange:_,onEnter:function(){var e=P+"Human: "+R;Q(e),_(""),J(e)},disabled:y})))),React.createElement(_e.g,null),(m||y)&&React.createElement(po,null,React.createElement(Lo.CI,{content:m,isStreaming:j&&y}))),React.createElement(E.Y,null,"query"===D&&React.createElement(React.Fragment,null,React.createElement(po,null,React.createElement(w.M,{fullWidth:!0,onClick:function(){J()},isBusy:y,startTime:S,style:{height:50,fontSize:14,flex:4}},He.COMMON.SUBMIT)),React.createElement(_e.g,null)),React.createElement(po,null,React.createElement("h3",null,He.COMMON.SETTINGS),React.createElement("label",null,He.COMMON.ENVIRONMENT,":"),React.createElement(we.u,{scrolldown:!0,name:"envId",value:null!=U?U:"",onChange:$},X.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})})),React.createElement(we.j,{value:"",label:"None"})),React.createElement("label",null,He.COMMON.MODEL,":"),React.createElement(we.u,{name:"model",value:F,scrolldown:!0,onChange:$},W.map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})}))),React.createElement("label",null,He.COMMON.TEMPERATURE,":"),React.createElement(Re.A,{name:"temperature",value:G,type:"number",onChange:function(e){return $(parseFloat(e),"temperature")},description:React.createElement(React.Fragment,null,React.createElement("span",{style:{color:G>=0&&G<=1?"inherit":"red"}},He.HELP.TEMPERATURE))}),React.createElement("label",null,He.COMMON.MAX_TOKENS,":"),React.createElement(Re.A,{name:"maxTokens",value:H,type:"number",onChange:function(e){return $(parseInt(e),"maxTokens")},description:React.createElement(React.Fragment,null,React.createElement("span",null,He.HELP.MAX_TOKENS))}),React.createElement("label",null,He.COMMON.STOP_SEQUENCE,":"),React.createElement(Re.A,{name:"stopSequence",value:B,type:"text",onChange:$,description:React.createElement(React.Fragment,null,React.createElement("span",null,He.HELP.STOP_SEQUENCE))})),React.createElement(_e.g,null),q)),React.createElement(Te.n,{isOpen:I,onRequestClose:function(){A()},okButton:{onClick:function(){A()}},title:"Error",content:React.createElement("p",null,I)}))};var rf,af;function of(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var lf=G.Ay.div(rf||(rf=of(["\n  margin-bottom: 5px;\n"]))),cf=G.Ay.div(af||(af=of(["\n  margin-top: 5px;\n  padding: 10px;\n  font-size: 14px;\n  cursor: pointer;\n  background: #dbf2ff;\n\n  &:hover {\n    background: #037cba;\n    color: white;\n  }\n"])));function uf(e){return uf="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},uf(e)}function sf(){sf=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==uf(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(uf(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 ff(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function mf(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){ff(o,r,a,i,l,"next",e)}function l(e){ff(o,r,a,i,l,"throw",e)}i(void 0)}))}}function df(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return pf(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)?pf(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 pf(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 hf=wp.element,yf=hf.useState,vf=hf.useEffect,gf=hf.useMemo;const Ef=function(e){var t=e.post,n=e.onTitleClick,r=void 0===n?{}:n,a=e.onClose,o=void 0===a?{}:a,i=df(yf([]),2),l=i[0],c=i[1],u=df(yf(!1),2),s=u[0],f=u[1],m=df(yf(!1),2),d=m[0],p=m[1];vf((function(){t&&h(t)}),[t]);var h=function(){var e=mf(sf().mark((function e(t){var n,r,a;return sf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.postId,t.postTitle,f(!0),e.prev=2,e.next=5,(0,O.IU)("".concat(T,"/ai/magic_wand"),{method:"POST",nonce:k,json:{action:"suggestTitles",data:{postId:n}}});case 5:a=e.sent,c(null===(r=a.data)||void 0===r?void 0:r.results),e.next=13;break;case 9:e.prev=9,e.t0=e.catch(2),console.error(e.t0),p(e.t0.message);case 13:f(!1);case 14:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(t){return e.apply(this,arguments)}}(),y=function(){var e=mf(sf().mark((function e(t){return sf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.prev=1,e.next=4,r(t);case 4:v(),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(1),p(e.t0.message);case 10:f(!1);case 11:case"end":return e.stop()}}),e,null,[[1,7]])})));return function(t){return e.apply(this,arguments)}}(),v=function(){var e=mf(sf().mark((function e(){return sf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o(),c([]),p(),f(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),g=gf((function(){return s?React.createElement(ms.X,{type:"circle",size:"10%"}):d?React.createElement(React.Fragment,null,"Error: ",d):(null==l?void 0:l.length)>0?React.createElement(React.Fragment,null,"Pick a new title by clicking on it.",React.createElement(lf,null,l.map((function(e){return React.createElement(cf,{key:e,onClick:function(){y(e)}},e)})))):React.createElement(React.Fragment,null,"Nothing to display.")}),[s,l,d]);return React.createElement(E.N,null,React.createElement(Te.n,{isOpen:t,onRequestClose:v,title:'New title for "'.concat(null==t?void 0:t.postTitle,'"'),content:g,okButton:{label:"Close",onClick:v}}))};function bf(e){return bf="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},bf(e)}function wf(){wf=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==bf(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(bf(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Rf(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Of(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Rf(o,r,a,i,l,"next",e)}function l(e){Rf(o,r,a,i,l,"throw",e)}i(void 0)}))}}function _f(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return xf(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)?xf(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 xf(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 Sf=wp.element,Tf=Sf.useState,Nf=Sf.useEffect,Cf=Sf.useMemo;const If=function(e){var t=e.post,n=e.onExcerptClick,r=void 0===n?{}:n,a=e.onClose,o=void 0===a?{}:a,i=_f(Tf([]),2),l=i[0],c=i[1],u=_f(Tf(!1),2),s=u[0],f=u[1],m=_f(Tf(!1),2),d=m[0],p=m[1];Nf((function(){t&&h(t)}),[t]);var h=function(){var e=Of(wf().mark((function e(t){var n,r,a;return wf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.postId,f(!0),e.prev=2,e.next=5,(0,O.IU)("".concat(T,"/ai/magic_wand"),{method:"POST",nonce:k,json:{action:"suggestExcerpts",data:{postId:n}}});case 5:a=e.sent,c(null===(r=a.data)||void 0===r?void 0:r.results),e.next=13;break;case 9:e.prev=9,e.t0=e.catch(2),console.error(e.t0),p(e.t0.message);case 13:f(!1);case 14:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(t){return e.apply(this,arguments)}}(),y=function(){var e=Of(wf().mark((function e(t){return wf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.prev=1,e.next=4,r(t);case 4:v(),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(1),p(e.t0.message);case 10:f(!1);case 11:case"end":return e.stop()}}),e,null,[[1,7]])})));return function(t){return e.apply(this,arguments)}}(),v=function(){var e=Of(wf().mark((function e(){return wf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o(),c([]),p(),f(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),g=Cf((function(){return s?React.createElement(ms.X,{type:"circle",size:"10%"}):d?React.createElement(React.Fragment,null,"Error: ",d):(null==l?void 0:l.length)>0?React.createElement(React.Fragment,null,"Pick a new excerpt by clicking on it.",React.createElement(lf,null,l.map((function(e){return React.createElement(cf,{key:e,onClick:function(){y(e)}},e)})))):React.createElement(React.Fragment,null,"Nothing to display.")}),[s,l,d]);return React.createElement(E.N,null,React.createElement(Te.n,{isOpen:t,onRequestClose:v,title:'New excerpt for "'.concat(null==t?void 0:t.postTitle,'"'),content:g,okButton:{label:"Close",onClick:v}}))};function Af(e){return Af="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},Af(e)}function kf(){kf=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Af(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Af(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Lf(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Mf(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Lf(o,r,a,i,l,"next",e)}function l(e){Lf(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Pf(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 jf=wp.element,Ff=jf.useState,Df=jf.useEffect;const Gf=function(){var e,t,n=(e=Ff(),t=2,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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Pf(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)?Pf(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.")}()),r=n[0],a=n[1];Df((function(){document.querySelectorAll(".mwai-link-title").forEach((function(e){var t=e.getAttribute("data-id"),n=e.getAttribute("data-title");e.addEventListener("click",(function(){a({postId:t,postTitle:n,mode:"title"})}),!1)})),document.querySelectorAll(".mwai-link-excerpt").forEach((function(e){var t=e.getAttribute("data-id"),n=e.getAttribute("data-title");e.addEventListener("click",(function(){a({postId:t,postTitle:n,mode:"excerpt"})}),!1)}))}),[]);var o=function(){var e=Mf(kf().mark((function e(t){var n,o,i,l;return kf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/helpers/update_post_title"),{method:"POST",nonce:k,json:{postId:r.postId,title:t}});case 2:if((n=e.sent).success){e.next=7;break}throw new Error(n.message);case 7:a(),(o=document.querySelector('tr[id="post-'.concat(r.postId,'"]')))&&(i=o.querySelector(".row-title"))&&(i.innerHTML=t),(l=o.querySelector(".hidden .post_title"))&&(l.innerHTML=t);case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),i=function(){var e=Mf(kf().mark((function e(t){var n;return kf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/helpers/update_post_excerpt"),{method:"POST",nonce:k,json:{postId:r.postId,excerpt:t}});case 2:if((n=e.sent).success){e.next=7;break}throw new Error(n.message);case 7:a();case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return React.createElement(s.A,null,React.createElement(E.N,null,React.createElement(Ef,{post:"title"===(null==r?void 0:r.mode)?r:null,onTitleClick:o,onClose:function(){a()}}),React.createElement(If,{post:"excerpt"===(null==r?void 0:r.mode)?r:null,onExcerptClick:i,onClose:function(){a()}})))};function Uf(e){return Uf="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},Uf(e)}function Bf(){Bf=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Uf(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Uf(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Hf(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Yf(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Hf(o,r,a,i,l,"next",e)}function l(e){Hf(o,r,a,i,l,"throw",e)}i(void 0)}))}}function zf(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 Wf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zf(Object(n),!0).forEach((function(t){Vf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zf(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Vf(e,t,n){var r;return r=function(e,t){if("object"!=Uf(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Uf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==Uf(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Kf(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||qf(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 qf(e,t){if(e){if("string"==typeof e)return Xf(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)?Xf(e,t):void 0}}function Xf(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 $f=wp.element,Qf=$f.useState,Jf=$f.useEffect,Zf=$f.useMemo;const em=function(){var e,t,n,r,a,o,i,l,c,u,s,m,p,h,g,b,R,_,x,S=Kf(Qf(""),2),N=S[0],C=S[1],I=Kf(Qf(""),2),A=I[0],P=I[1],j=js("contentGenerator"),F=j.template,D=j.setTemplate,G=j.clearTemplate,U=j.jsxTemplates,B=(0,Zt.XS)(),H=Kf(Qf(!1),2),Y=H[0],z=H[1],W=Kf(Qf(),2),V=W[0],K=W[1],q=Kf(Qf(!1),2),X=q[0],$=q[1],Q=Kf(Qf(!1),2),J=Q[0],Z=Q[1],ee=Kf(Qf(!1),2),te=ee[0],ne=ee[1],re=Kf(Qf(),2),ae=re[0],oe=re[1],ie=Kf(Qf("post"),2),le=ie[0],ce=ie[1],ue=Kf(Qf([]),2),se=ue[0],fe=ue[1],me=Kf(Qf([]),2),de=me[0],pe=me[1],he=Kf(Qf({}),2),ye=he[0],ve=he[1],ge=Zf((function(){return function(e){if(!e)return null;var t=e.split(" ").length,n=e.length,r=[];return n?(t<3?r.push(He.CONTENT_GENERATOR.TITLE_TOO_SHORT):t>8?r.push(He.CONTENT_GENERATOR.TITLE_TOO_LONG):n<40?r.push(He.CONTENT_GENERATOR.TITLE_TOO_SHORT):n>70&&r.push(He.CONTENT_GENERATOR.TITLE_TOO_LONG_2),r.join(" ")):void 0}(Se)}),[Se]),Ee=(0,f.I)({queryKey:["postTypes"],queryFn:an}),be=Ee.isLoading,Oe=Ee.data,xe=B.busy||Y||be,Se=null!==(e=null==F?void 0:F.title)&&void 0!==e?e:"",Ne=null!==(t=null==F?void 0:F.sections)&&void 0!==t?t:"",Ce=null!==(n=null==F?void 0:F.mode)&&void 0!==n?n:"single",Ie=null!==(r=null==F?void 0:F.topic)&&void 0!==r?r:"",Ae=null!==(a=null==F?void 0:F.topics)&&void 0!==a?a:"",ke=null!==(o=null!==(i=null==F?void 0:F.model)&&void 0!==i?i:null==L?void 0:L.ai_default_model)&&void 0!==o?o:null,Le=null!==(l=null==F?void 0:F.sectionsCount)&&void 0!==l?l:2,Me=null!==(c=null==F?void 0:F.paragraphsCount)&&void 0!==c?c:3,Pe=null!==(u=null==F?void 0:F.writingStyle)&&void 0!==u?u:"creative",je=null!==(s=null==F?void 0:F.writingTone)&&void 0!==s?s:"cheerful",Fe=null!==(m=null==F?void 0:F.titlePromptFormat)&&void 0!==m?m:"",De=null!==(p=null==F?void 0:F.sectionsPromptFormat)&&void 0!==p?p:"",Ge=null!==(h=null==F?void 0:F.contentPromptFormat)&&void 0!==h?h:"",Ue=null!==(g=null==F?void 0:F.excerptPromptFormat)&&void 0!==g?g:"",Be=null!==(b=null==F?void 0:F.envId)&&void 0!==b?b:"",Ye=null!==(R=null==F?void 0:F.temperature)&&void 0!==R?R:.6,ze=null!==(_=null==F?void 0:F.maxTokens)&&void 0!==_?_:2048,We=null!==(x=null==F?void 0:F.topicsAreTitles)&&void 0!==x&&x,Ve=!De||!Le,Ke=ft(L,Be||null),qe=Ke.completionModels,Xe=Ke.calculatePrice,$e=Hs(Xe),Qe=$e.addUsage,Je=$e.jsxUsageCosts,Ze=(null==L?void 0:L.ai_envs)||[],et=function(e){var t=e.disabled,n=e.options,r=e.language,a=e.customLanguage,o=nt(lt(null!=r?r:"en"),2),i=o[0],l=o[1],c=nt(lt(!1),2),u=c[0],s=c[1],f=nt(lt(""),2),m=f[0],d=f[1],p=(null==n?void 0:n.languages)||[],h=it((function(){return Object.keys(p).map((function(e){return{value:e,label:p[e]}}))}),[p]);ct((function(){a?(s(!0),d(a)):(s(!1),d(""),l(null!=r?r:"en"))}),[a]),ct((function(){l(r)}),[r]),ct((function(){var e=localStorage.getItem("mwai_preferred_language");if(e&&h.find((function(t){return t.value===e})))l(e);else{var t=(document.querySelector("html").lang||navigator.language||navigator.userLanguage).substr(0,2);h.find((function(e){return e.value===t}))&&l(t)}}),[]);var y=it((function(){if(u)return m;var e=h.find((function(e){return e.value===i}));return e?e.label:(console.warn("A system language or a custom language should be set."),"English")}),[i,m]),v=function(e,t){"custom"!==e?(l(e,t),localStorage.setItem("mwai_preferred_language",e)):s(!0)};return{jsxLanguageSelector:it((function(){return React.createElement(React.Fragment,null,u&&React.createElement(Re.A,{name:"customLanguage",disabled:t,onReset:function(){s(!1)},description:(0,O.FE)(He.CONTENT_GENERATOR.CUSTOM_LANGUAGE_HELP),value:m,onChange:d}),!u&&React.createElement(we.u,{scrolldown:!0,name:"language",disabled:t,description:(0,O.FE)(He.CONTENT_GENERATOR.CUSTOM_LANGUAGE_HELP),value:i,onChange:v},h.map((function(e){return React.createElement(we.j,{key:e.value,value:e.value,label:e.label})})),React.createElement(we.j,{key:"custom",value:"custom",label:"Other"})))}),[i,y,h,u]),currentLanguage:u?"custom":i,currentHumanLanguage:y,isCustom:u}}({options:L,language:null==F?void 0:F.language,customLanguage:null==F?void 0:F.customLanguage}),tt=et.jsxLanguageSelector,rt=et.currentLanguage,at=et.isCustom,ot=et.currentHumanLanguage,ut=function(e,t){D((function(n){return Wf(Wf({},n),{},Vf({},t,e))}))};Jf((function(){var e=Ae.split("\n").map((function(e){return e.trim()})).filter((function(e){return!!e}));fe(e)}),[Ae]),Jf((function(){F&&ut("","sections")}),[Se,Le]),Jf((function(){C(""),P(""),oe()}),[Ne,Me]),Jf((function(){F&&(!at&&F.customLanguage&&ut(null,"customLanguage"),at&&F.customLanguage!==ot&&ut(ot,"customLanguage"),F.language!==rt&&ut(rt,"language"))}),[at,rt,ot]);var mt=function(e){return e.replace("{LANGUAGE}",ot).replace("{WRITING_STYLE}",Pe).replace("{WRITING_TONE}",je).replace("{PARAGRAPHS_PER_SECTION}",Me).replace("{SECTIONS_COUNT}",Le)},dt=Zf((function(){var e=function(e,t){return!!t.find((function(t){return t.includes(e)}))},t=[Fe,De,Ge,Ue];return{language:e("{LANGUAGE}",t),writingStyle:e("{WRITING_STYLE}",t),writingTone:e("{WRITING_TONE}",t),sectionsCount:e("{SECTIONS_COUNT}",t),paragraphsCount:e("{PARAGRAPHS_PER_SECTION}",t)}}),[Fe,De,Ge,Ue,Le,Me]),pt=function(){var e=Yf(Bf().mark((function e(t){var n,r,a,o,i,l,c=arguments;return Bf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=c.length>1&&void 0!==c[1]?c[1]:2048,r=c.length>2&&void 0!==c[2]&&c[2],e.prev=2,e.next=5,(0,O.IU)("".concat(T,"/ai/completions"),{method:"POST",nonce:k,json:{scope:"admin-tools",envId:Be||null,model:ke||null,session:M,message:t,temperature:Ye,maxTokens:n}});case 5:return i=e.sent,Qe(ke,(null==i||null===(a=i.usage)||void 0===a?void 0:a.prompt_tokens)||0,(null==i||null===(o=i.usage)||void 0===o?void 0:o.completion_tokens)||0),(l=i.data.trim()).startsWith('"')&&l.endsWith('"')&&(l=l.substring(1,l.length-1)),e.abrupt("return",l);case 12:if(e.prev=12,e.t0=e.catch(2),!r){e.next=16;break}throw new Error(e.t0.message);case 16:return console.error(e.t0),K(e.t0.message),e.abrupt("return",null);case 19:case"end":return e.stop()}}),e,null,[[2,12]])})));return function(t){return e.apply(this,arguments)}}(),ht=function(){var e=Yf(Bf().mark((function e(){var t,n,r,a,o,i=arguments;return Bf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:Ie,r=i.length>2&&void 0!==i[2]&&i[2],n=i.length>1&&void 0!==i[1]?i[1]:Se){e.next=6;break}return alert(He.CONTENT_GENERATOR.TITLE_MISSING),e.abrupt("return");case 6:return z(!0),ut("","sections"),console.log("Sections Prompt:",{inTopic:t,inTitle:n,sectionsPromptFormat:De}),a=(a=De.replace("{TITLE}",n)).replace("{TOPIC}",t),a=mt(a),e.next=14,pt(a,512,r);case 14:return o=(l=o=e.sent)?l.split("\n").map((function(e){return(e=e.replace(/^\d+\.\s/,"")).startsWith('"')&&(e=e.slice(1)).endsWith('"')&&(e=e.slice(0,-1)),e})).filter((function(e){return e})).join("\n"):l,console.log("Sections:",{prompt:a,sections:o}),o&&ut(o,"sections"),z(!1),e.abrupt("return",o);case 20:case"end":return e.stop()}var l}),e)})));return function(){return e.apply(this,arguments)}}(),yt=function(){var e=Yf(Bf().mark((function e(){var t,n,r,a,o,i,l=arguments;return Bf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=l.length>0&&void 0!==l[0]?l[0]:Ie,r=l.length>2&&void 0!==l[2]?l[2]:Ne,a=l.length>3&&void 0!==l[3]&&l[3],n=l.length>1&&void 0!==l[1]?l[1]:Se){e.next=7;break}return alert(He.CONTENT_GENERATOR.TITLE_MISSING),e.abrupt("return");case 7:if(Ve||r){e.next=10;break}return alert(He.CONTENT_GENERATOR.SECTIONS_MISSING),e.abrupt("return");case 10:return z(!0),C((function(e){return""})),o=(o=(o=Ge.replace("{TITLE}",n)).replace("{SECTIONS}",r)).replace("{TOPIC}",t),o=mt(o),e.next=18,pt(o,ze,a);case 18:return(i=e.sent)&&(i=(i=(i=(i=(i=(i=i.replace(/^===INTRO:\n/,"")).replace(/^===INTRO: \n/,"")).replace(/===INTRO: /,"")).replace(/===OUTRO:\n/,"")).replace(/===OUTRO: \n/,"")).replace(/===OUTRO: /,""),C((function(e){return i}))),console.log("Content:",{prompt:o,content:i}),z(!1),e.abrupt("return",i);case 23:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),vt=function(){var e=Yf(Bf().mark((function e(){var t,n,r,a,o,i=arguments;return Bf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:Ie,r=i.length>2&&void 0!==i[2]&&i[2],n=i.length>1&&void 0!==i[1]?i[1]:Se){e.next=6;break}return alert(He.CONTENT_GENERATOR.TITLE_MISSING),e.abrupt("return");case 6:return z(!0),P((function(e){return""})),a=(a=Ue.replace("{TITLE}",n)).replace("{TOPIC}",t),a=mt(a),e.next=13,pt(a,256,r);case 13:return(o=e.sent)&&P((function(e){return o})),console.log("Excerpt:",{prompt:a,excerpt:o}),z(!1),e.abrupt("return",o);case 18:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),gt=function(){var e=Yf(Bf().mark((function e(){var t,n,r,a,o,i,l,c=arguments;return Bf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=c.length>0&&void 0!==c[0]?c[0]:Ie,n=c.length>1&&void 0!==c[1]&&c[1],z(!0),ve((function(){return Wf(Wf({},ye),{},{all:new Date})})),e.prev=4,r=t,We&&n){e.next=12;break}return a=mt(Fe.replace("{TOPIC}",t)),e.next=10,pt(a,64,n);case 10:r=e.sent,console.log("Title:",{prompt:a,title:r});case 12:if(o=null,i=null,l=null,z(!1),!r){e.next=41;break}if(ut(r,"title"),Ve){e.next=25;break}return ve((function(e){return Wf(Wf({},e),{},{sections:new Date})})),e.next=22,ht(t,r,n);case 22:return o=e.sent,e.next=25,ve((function(e){return Wf(Wf({},e),{},{sections:null})}));case 25:if(!o&&!Ve){e.next=41;break}return e.next=28,ve((function(e){return Wf(Wf({},e),{},{content:new Date})}));case 28:return e.next=30,yt(t,r,o,n);case 30:return i=e.sent,e.next=33,ve((function(e){return Wf(Wf({},e),{},{content:null})}));case 33:if(!i){e.next=41;break}return e.next=36,ve((function(e){return Wf(Wf({},e),{},{excerpt:new Date})}));case 36:return e.next=38,vt(t,r,n);case 38:return l=e.sent,e.next=41,ve((function(e){return Wf(Wf({},e),{},{excerpt:null})}));case 41:return e.abrupt("return",{title:r,heads:o,content:i,excerpt:l});case 44:throw e.prev=44,e.t0=e.catch(4),console.error(e.t0),z(!1),ve({}),e.t0;case 50:case"end":return e.stop()}}),e,null,[[4,44]])})));return function(){return e.apply(this,arguments)}}(),Et=function(){var e=Yf(Bf().mark((function e(){var t,n,r,a,o,i=arguments;return Bf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:Se,n=i.length>1&&void 0!==i[1]?i[1]:N,r=i.length>2&&void 0!==i[2]?i[2]:A,a=i.length>3&&void 0!==i[3]&&i[3],z(!0),e.prev=5,e.next=8,(0,O.IU)("".concat(T,"/helpers/create_post"),{method:"POST",nonce:k,json:{title:t,content:n,excerpt:r,postType:le}});case 8:return o=e.sent,a||oe(o.postId),e.abrupt("return",o.postId);case 13:return e.prev=13,e.t0=e.catch(5),console.error(e.t0),K(e.t0.message),e.abrupt("return",null);case 18:return e.prev=18,z(!1),e.finish(18);case 21:case"end":return e.stop()}}),e,null,[[5,13,18,21]])})));return function(){return e.apply(this,arguments)}}(),bt=function(){var e=Yf(Bf().mark((function e(){var t;return Bf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return pe([]),t=se.map((function(e,t){return Yf(Bf().mark((function n(){var r,a,o,i,l;return Bf().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return console.log("Topic "+t),n.prev=1,n.next=4,gt(e,!0);case 4:if(r=n.sent,a=r.title,o=r.content,i=r.excerpt,!(a&&o&&i)){n.next=15;break}return n.next=11,Et(a,o,i,!0);case 11:l=n.sent,pe((function(t){return[].concat(function(e){if(Array.isArray(e))return Xf(e)}(n=t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||qf(n)||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.")}(),[{postId:l,topic:e,title:a,content:o,excerpt:i}]);var n})),n.next=16;break;case 15:console.warn("Could not generate the post for: "+e);case 16:n.next=21;break;case 18:n.prev=18,n.t0=n.catch(1),confirm("An error was caught ("+n.t0.message+"). Should we continue?")||(B.stop(),B.reset(),z(!1));case 21:return n.abrupt("return",{success:!0});case 22:case"end":return n.stop()}}),n,null,[[1,18]])})))})),e.next=4,B.start(t);case 4:B.reset();case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return React.createElement(v.z,{nekoErrors:[]},React.createElement(Ut,{title:He.COMMON.CONTENT_GENERATOR}),React.createElement(E.N,null,React.createElement(E.Y,{fullWidth:!0},React.createElement(st,{options:L}),React.createElement(d.s,{p:!0,style:{marginTop:0,marginBottom:0}},(0,O.FE)(He.CONTENT_GENERATOR.INTRO))),React.createElement(E.Y,{style:{flex:1}},React.createElement(po,null,React.createElement("h2",{style:{marginTop:0}},"Topic"),React.createElement(Wt.m,{name:"topic",disabled:xe||"bulk"===Ce,rows:5,value:Ie,onChange:ut}),React.createElement(_e.g,null),React.createElement(w.M,{fullWidth:!0,disabled:!Ie||"bulk"===Ce,isBusy:xe,startTime:null==ye?void 0:ye.all,onClick:function(){return gt()}},He.COMMON.GENERATE)),React.createElement(_e.g,null),React.createElement(po,null,U)),React.createElement(E.Y,{style:{flex:3}},React.createElement(Vt.o,{name:"mode",value:Ce,disabled:xe,onChange:ut},React.createElement(Vt.K,{title:He.CONTENT_GENERATOR.SINGLE_GENERATE,value:"single"}),React.createElement(Vt.K,{title:He.CONTENT_GENERATOR.BULK_GENERATE,value:"bulk",count:se.length})),React.createElement(_e.g,null),"bulk"===Ce&&React.createElement(po,null,React.createElement("p",{style:{marginTop:0,marginBottom:20}},(0,O.FE)(He.CONTENT_GENERATOR.TOPICS_HELP)),React.createElement("div",{style:{display:"flex"}},React.createElement(w.M,{disabled:xe||!se.length,onClick:bt},He.COMMON.GENERATE),React.createElement(Jt.j,{busy:B.busy,style:{marginLeft:10,flex:"auto"},value:B.value,max:B.max,onStopClick:B.stop})),React.createElement(_e.g,null),React.createElement("h3",null,"Topics"),React.createElement(Wt.m,{name:"topics",rows:10,value:Ae,onChange:ut}),React.createElement(y.R,{name:"topicsAreTitles",label:"Use Topics as Titles",value:"1",checked:We,onChange:ut}),React.createElement("h3",null,He.CONTENT_GENERATOR.GENERATED_POSTS),!de.length&&React.createElement("i",null,"Nothing yet."),de.length>0&&React.createElement("ul",null,de.map((function(e){return React.createElement("li",{key:e.postId},e.title," ",React.createElement("a",{target:"_blank",href:"/?p=".concat(e.postId),rel:"noreferrer"},"View")," or ",React.createElement("a",{target:"_blank",href:"/wp-admin/post.php?post=".concat(e.postId,"&action=edit"),rel:"noreferrer"},"Edit"))})))),"single"===Ce&&React.createElement(po,null,React.createElement("h2",{style:{marginTop:0}},"Title"),React.createElement(Re.A,{name:"title",disabled:xe,value:Se,onChange:ut}),ge&&React.createElement("div",{className:"information"},"Advice: ",ge),De&&React.createElement(React.Fragment,null,React.createElement(_e.g,null),React.createElement(Bt,null,React.createElement("h2",null,He.CONTENT_GENERATOR.SECTIONS),React.createElement("div",{style:{display:"flex",alignItems:"center"}},dt.sectionsCount&&React.createElement(React.Fragment,null,React.createElement("label",{style:{margin:"0 5px 0 0"}},"# of Sections: "),React.createElement(we.u,{scrolldown:!0,name:"sectionsCount",disabled:xe,style:{marginRight:10},value:Le,description:"",onChange:ut},React.createElement(we.j,{key:2,value:2,label:2}),React.createElement(we.j,{key:3,value:3,label:3}),React.createElement(we.j,{key:4,value:4,label:4}),React.createElement(we.j,{key:6,value:6,label:6}),React.createElement(we.j,{key:8,value:8,label:8}),React.createElement(we.j,{key:10,value:10,label:10}),React.createElement(we.j,{key:12,value:12,label:12}))),Le>0&&React.createElement(w.M,{disabled:!Se,isBusy:xe,startTime:null==ye?void 0:ye.sections,onClick:function(){return ht()}},He.CONTENT_GENERATOR.GENERATE_SECTIONS))),Le>0&&React.createElement(React.Fragment,null,React.createElement(_e.g,null),React.createElement(Wt.m,{name:"sections",disabled:xe,rows:4,value:Ne,description:He.CONTENT_GENERATOR.SECTIONS_HELP,onChange:ut}))),React.createElement(_e.g,null),React.createElement(Bt,null,React.createElement("h2",null,He.COMMON.CONTENT),React.createElement("div",{style:{display:"flex",alignItems:"center"}},dt.paragraphsCount&&React.createElement(React.Fragment,null,React.createElement("label",{style:{margin:"0 5px 0 0"}},He.CONTENT_GENERATOR.PARAGRAPHS_PER_SECTION,": "),React.createElement(we.u,{scrolldown:!0,name:"paragraphsCount",disabled:xe,style:{marginRight:10},value:Me,description:"",onChange:ut},React.createElement(we.j,{key:1,value:1,label:1}),React.createElement(we.j,{key:2,value:2,label:2}),React.createElement(we.j,{key:3,value:3,label:3}),React.createElement(we.j,{key:4,value:4,label:4}),React.createElement(we.j,{key:6,value:6,label:6}),React.createElement(we.j,{key:8,value:8,label:8}),React.createElement(we.j,{key:10,value:10,label:10}))),React.createElement(w.M,{disabled:!Se,isBusy:xe,startTime:null==ye?void 0:ye.content,onClick:function(){return yt()}},He.CONTENT_GENERATOR.GENERATE_CONTENT))),React.createElement(_e.g,null),React.createElement(Wt.m,{countable:"words",disabled:xe,rows:12,value:N,description:He.CONTENT_GENERATOR.CONTENT_HELP,onChange:C}),React.createElement(_e.g,null),React.createElement(Bt,null,React.createElement("h2",null,He.COMMON.EXCERPT),React.createElement(w.M,{disabled:!Se,isBusy:xe,startTime:null==ye?void 0:ye.excerpt,onClick:function(){return vt()}},He.CONTENT_GENERATOR.GENERATE_EXCERPT)),React.createElement(_e.g,null),React.createElement(Wt.m,{disabled:xe,value:A,onBlur:P,rows:3}),React.createElement(_e.g,{line:!0,height:40}),React.createElement(we.u,{scrolldown:!0,disabled:xe,name:"postType",onChange:ce,value:le},null==Oe?void 0:Oe.map((function(e){return React.createElement(we.j,{key:e.type,value:e.type,label:e.name})}))),React.createElement(_e.g,null),React.createElement(w.M,{fullWidth:!0,style:{height:60},onClick:function(){return Et()},isBusy:xe,disabled:!Se||!N},He.CONTENT_GENERATOR.CREATE_POST))),React.createElement(E.Y,null,React.createElement(po,null,React.createElement("h2",{style:{marginTop:0}},He.CONTENT_GENERATOR.CONTENT_PARAMS),!dt.language&&!dt.writingStyle&&!dt.writingTone&&React.createElement("div",{style:{fontSize:11,lineHeight:"14px"}},He.CONTENT_GENERATOR.CONTENT_PARAMS_INTRO),dt.language&&React.createElement(React.Fragment,null,React.createElement("label",null,He.COMMON.LANGUAGE,":"),tt),dt.writingStyle&&React.createElement(React.Fragment,null,React.createElement("label",null,He.CONTENT_GENERATOR.WRITING_STYLE,":"),React.createElement(we.u,{scrolldown:!0,name:"writingStyle",disabled:xe,value:Pe,description:"",onChange:ut},ds.map((function(e){return React.createElement(we.j,{key:e.value,value:e.value,label:e.label})})))),dt.writingTone&&React.createElement(React.Fragment,null,React.createElement("label",null,He.CONTENT_GENERATOR.WRITING_TONE,":"),React.createElement(we.u,{scrolldown:!0,name:"writingTone",disabled:xe,value:je,description:"",onChange:ut},ps.map((function(e){return React.createElement(we.j,{key:e.value,value:e.value,label:e.label})}))))),React.createElement(_e.g,null),React.createElement(po,null,React.createElement(Bt,null,React.createElement("h2",null,He.CONTENT_GENERATOR.POST_PARAMS),React.createElement(w.M,{onClick:function(){return Z(!J)}},J?He.COMMON.HIDE:He.COMMON.SHOW)),J&&React.createElement(React.Fragment,null,React.createElement("label",null,He.COMMON.POST_TYPE,":"),React.createElement(we.u,{scrolldown:!0,disabled:xe,name:"postType",onChange:ce,value:le},null==Oe?void 0:Oe.map((function(e){return React.createElement(we.j,{key:e.type,value:e.type,label:e.name})}))))),React.createElement(_e.g,null),React.createElement(po,null,React.createElement(Bt,null,React.createElement("h2",null,He.COMMON.MODEL_PARAMS),React.createElement(w.M,{onClick:function(){return $(!X)}},X?He.COMMON.HIDE:He.COMMON.SHOW)),X&&React.createElement(React.Fragment,null,React.createElement("label",null,He.COMMON.ENVIRONMENT,":"),React.createElement(we.u,{scrolldown:!0,name:"envId",value:null!=Be?Be:"",onChange:ut},Ze.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})})),React.createElement(we.j,{value:"",label:"None"})),React.createElement("label",null,He.COMMON.MODEL,":"),React.createElement(we.u,{name:"model",value:ke,description:He.CONTENT_GENERATOR.MODEL_HELP,scrolldown:!0,onChange:ut},qe.map((function(e){return React.createElement(we.j,{value:e.model,label:e.name})}))),React.createElement("label",null,He.COMMON.TEMPERATURE,":"),React.createElement(Re.A,{name:"temperature",value:Ye,type:"number",onChange:ut,onBlur:ut,description:He.HELP.TEMPERATURE}),React.createElement("label",null,He.COMMON.MAX_TOKENS,":"),React.createElement(Re.A,{name:"maxTokens",value:ze,type:"number",onChange:ut,onBlur:ut,description:He.HELP.MAX_TOKENS}))),React.createElement(_e.g,null),React.createElement(po,null,React.createElement(Bt,null,React.createElement("h2",null,(0,O.FE)(He.COMMON.PROMPTS)),React.createElement(w.M,{onClick:function(){return ne(!te)}},te?"Hide":"Show")),te&&React.createElement(React.Fragment,null,React.createElement("p",{style:{fontSize:11,lineHeight:"14px"}},He.CONTENT_GENERATOR.PROMPTS_INTRO),React.createElement("label",null,(0,O.FE)(He.CONTENT_GENERATOR.PROMPT_TITLE)),React.createElement(Wt.m,{disabled:xe,name:"titlePromptFormat",value:Fe,onChange:ut}),React.createElement("label",null,(0,O.FE)(He.CONTENT_GENERATOR.PROMPT_SECTIONS)),React.createElement(Wt.m,{disabled:xe,name:"sectionsPromptFormat",value:De,onChange:ut}),React.createElement("label",null,(0,O.FE)(He.CONTENT_GENERATOR.PROMPT_CONTENT)),React.createElement(Wt.m,{disabled:xe,name:"contentPromptFormat",value:Ge,onChange:ut}),React.createElement("label",null,(0,O.FE)(He.CONTENT_GENERATOR.PROMPT_EXCERPT)),React.createElement(Wt.m,{disabled:xe,name:"excerptPromptFormat",value:Ue,onChange:ut}))),React.createElement(_e.g,null),Je)),React.createElement(Te.n,{isOpen:ae,onRequestClose:function(){return oe()},okButton:{label:He.CONTENT_GENERATOR.EDIT_POST,onClick:function(){window.open("/wp-admin/post.php?post=".concat(ae,"&action=edit"),"_blank"),G(),oe()}},cancelButton:{label:"Close",onClick:function(){oe()}},title:He.CONTENT_GENERATOR.POST_CREATED,content:React.createElement("p",null,He.CONTENT_GENERATOR.POST_CREATED_AS_DRAFT)}),React.createElement(Te.n,{isOpen:V,onRequestClose:function(){K()},okButton:{onClick:function(){K()}},title:"Error",content:React.createElement("p",null,V)}))};function tm(e){return tm="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},tm(e)}var nm;function rm(){rm=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==tm(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(tm(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 am(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function om(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){am(o,r,a,i,l,"next",e)}function l(e){am(o,r,a,i,l,"throw",e)}i(void 0)}))}}function im(e){return function(e){if(Array.isArray(e))return mm(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||fm(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 lm(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 cm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lm(Object(n),!0).forEach((function(t){um(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lm(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function um(e,t,n){var r;return r=function(e,t){if("object"!=tm(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=tm(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==tm(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sm(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||fm(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 fm(e,t){if(e){if("string"==typeof e)return mm(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)?mm(e,t):void 0}}function mm(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 dm=wp.element,pm=dm.useState,hm=dm.useEffect,ym=dm.useMemo,vm=[1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,40,60,80,100],gm=G.Ay.div(nm||(nm=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n  margin-bottom: 5px;\n  label {\n    margin-bottom: 5px;\n    display: block;\n  }\n"])));const Em=function(){var e,t,n,r,a=js("imagesGenerator"),o=a.template,i=a.setTemplate,l=a.jsxTemplates,c=sm(pm(),2),u=c[0],s=c[1],f=sm(pm(!0),2),m=f[0],p=f[1],h=sm(pm(!1),2),g=h[0],b=h[1],R=sm(pm(!1),2),_=R[0],x=R[1],S=(null==L?void 0:L.ai_envs)||[],N=ft(L,(null==o?void 0:o.envId)||null),C=N.imageModels,I=(0,N.getModel)(null==o?void 0:o.model),A=sm(pm([]),2),P=A[0],j=A[1],F=sm(pm([]),2),D=F[0],G=F[1],U=sm(pm(),2),B=U[0],H=U[1],Y=sm(pm(""),2),z=Y[0],W=Y[1],V=sm(pm(""),2),K=V[0],q=V[1],X=sm(pm(""),2),$=X[0],Q=X[1],J=sm(pm(""),2),Z=J[0],ee=J[1],te=sm(pm(""),2),ne=te[0],re=te[1],ae=sm(pm([]),2),oe=ae[0],ie=ae[1],le=ym((function(){return D.indexOf(B)}),[B,D]),ce=null==o?void 0:o.prompt,ue=sm(pm(1),2),se=ue[0],fe=ue[1],me=sm(pm(0),2),de=me[0],pe=me[1],he=sm(pm(0),2),ye=he[0],ve=he[1],ge=new AbortController,Ee=null!==(e=null==o?void 0:o.style)&&void 0!==e?e:null,be=function(e,t){i((function(n){return cm(cm({},n),{},um({},t,e))}))};hm((function(){var e;if(null!=o&&o.envId&&(null==o||!o.model)&&(null==C?void 0:C.length)>0){var t=C.find((function(e){return"dall-e-3"===e.model}))||C[0];i(cm(cm({},o),{},{model:t.model}))}if(null!=o&&o.model&&(null==o||!o.resolution)&&(null==I||null===(e=I.resolutions)||void 0===e?void 0:e.length)>0){var n=I.resolutions.map((function(e){return e.name})),r=n.includes("1024x1024")?"1024x1024":n[0];i(cm(cm({},o),{},{resolution:r}))}}),[o]),hm((function(){if(B){var e=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:42,n=e.replace(/[\s|,]+/g,"-"),r=(n=n.replace(/--+/g,"-")).split("-"),a=r[0],o=1;o<r.length&&r[o]&&a.length+r[o].length<t;)a+="-"+r[o],o++;return a.length>t+1&&(a=a.slice(0,t+2)),a}(ce)+".png";re(e),W(ce),q(ce),Q(ce),ee(ce)}}),[B]);var Oe=function(){if(ce){for(var e=function(){var e={prompt:ce,envId:o.envId,model:o.model,resolution:o.resolution,style:o.style};j((function(t){return[].concat(im(t),[e])}))},t=0;t<se;t++)e();pe((function(e){return e+se}))}else console.error("Prompt is empty, cannot add to queue.")},Se=function(){var e=om(rm().mark((function e(){var t,n;return rm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==P.length&&!g){e.next=2;break}return e.abrupt("return");case 2:return b(!0),t=P[0],e.prev=4,e.next=7,(0,O.IU)("".concat(T,"/ai/images"),{method:"POST",nonce:k,signal:ge.signal,json:{env:"admin-tools",envId:t.envId,model:t.model,resolution:t.resolution,style:t.style,scope:"admin-tools",session:M,message:t.prompt,maxResults:1}});case 7:(n=e.sent).data&&n.data.length>0&&G((function(e){return[].concat(im(e),[n.data[0]])})),j((function(e){return e.slice(1)})),ve((function(e){return e+1})),1===P.length&&(pe(0),ve(0)),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(4),"AbortError"!==e.t0.name&&(console.error(e.t0),s(e.t0.message+(P.length>1?" The other tasks will continue.":"")),j((function(e){return e.slice(1)})),pe((function(e){return e-1})));case 17:return e.prev=17,b(!1),e.finish(17);case 20:case"end":return e.stop()}}),e,null,[[4,14,17,20]])})));return function(){return e.apply(this,arguments)}}();hm((function(){P.length>0&&!g&&Se()}),[P,g]);var Ce=function(){var e=om(rm().mark((function e(){var t;return rm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return x(!0),e.prev=1,e.next=4,(0,O.IU)("".concat(T,"/helpers/create_image"),{method:"POST",nonce:k,json:{url:B,title:z,description:K,caption:$,alt:Z,filename:ne}});case 4:t=e.sent,ie([].concat(im(oe),[{id:t.attachmentId,url:B}])),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error(e.t0),s(e.t0.message);case 12:return e.prev=12,x(!1),e.finish(12);case 15:case"end":return e.stop()}}),e,null,[[1,8,12,15]])})));return function(){return e.apply(this,arguments)}}(),Ie=ym((function(){var e=oe.find((function(e){return e.url===B}));return e?e.id:null}),[B,oe]);return React.createElement(v.z,{nekoErrors:[]},React.createElement(Ut,{title:He.COMMON.IMAGES_GENERATOR}),React.createElement(E.N,null,React.createElement(E.Y,{fullWidth:!0},React.createElement(st,{options:L}),React.createElement(d.s,{p:!0,style:{marginTop:0,marginBottom:0}},"This will also be available in the Post Editor soon. If you have any idea or request, please join us on the ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/support/plugin/ai-engine/",rel:"noreferrer"},"Support Forum"),"! 🎵")),React.createElement(E.Y,null,React.createElement(po,{style:{marginBottom:25}},l),React.createElement(xe.L,{style:{marginBottom:25}},React.createElement("h3",{style:{marginTop:0}},"Parameters"),React.createElement("label",null,He.COMMON.ENVIRONMENT,":"),React.createElement(_e.g,{tiny:!0}),React.createElement(we.u,{scrolldown:!0,name:"envId",value:null!==(t=null==o?void 0:o.envId)&&void 0!==t?t:"",onChange:be},S.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})})),React.createElement(we.j,{value:"",label:"None"})),React.createElement(_e.g,{tiny:!0}),React.createElement("label",null,He.COMMON.MODEL,":"),React.createElement(_e.g,{tiny:!0}),React.createElement(we.u,{scrolldown:!0,name:"model",value:null==o?void 0:o.model,onChange:be},C.map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})}))),React.createElement(_e.g,{tiny:!0}),React.createElement("label",null,He.COMMON.RESOLUTION,":"),React.createElement(_e.g,{tiny:!0}),React.createElement(we.u,{scrolldown:!0,name:"resolution",value:null==o?void 0:o.resolution,onChange:be},null==I||null===(n=I.resolutions)||void 0===n?void 0:n.map((function(e){return React.createElement(we.j,{key:e.name,value:e.name,label:e.label})}))),"custom"===(null==o?void 0:o.resolution)&&React.createElement(React.Fragment,null,React.createElement(_e.g,{tiny:!0}),React.createElement("label",null,"Custom Resolution:"),React.createElement(_e.g,{tiny:!0}),React.createElement(Re.A,{name:"customResolution",value:null==o?void 0:o.customResolution,onChange:function(e){return be(e,"customResolution")}})),(null==I||null===(r=I.model)||void 0===r?void 0:r.startsWith("dall-e-3"))&&React.createElement(React.Fragment,null,React.createElement(_e.g,{tiny:!0}),React.createElement("label",null,He.COMMON.STYLE,":"),React.createElement(_e.g,{tiny:!0}),React.createElement(we.u,{scrolldown:!0,name:"style",value:Ee,onChange:be},React.createElement(we.j,{key:"none",value:null,label:"None"}),React.createElement(we.j,{key:"natural",value:"natural",label:"Natural"}),React.createElement(we.j,{key:"vivid",value:"vivid",label:"Vivid"})))),React.createElement(xe.L,{style:{marginBottom:25}},React.createElement("h2",{style:{marginTop:0}},"Settings"),React.createElement(y.R,{id:"continuous_mode ",label:"Continuous",value:"1",checked:m,description:"New images will be added to the already generated images.",onChange:p}))),React.createElement(E.Y,{style:{flex:3}},React.createElement(Jt.j,{busy:g,value:ye,max:de,onStopClick:function(){ge.abort(),j([]),pe(0),ve(0),b(!1)},status:function(){return"".concat(ye," / ").concat(de)}}),React.createElement(_e.g,null),React.createElement(xe.L,null,B&&React.createElement(React.Fragment,null,React.createElement(Bt,{style:{paddingBottom:10}},React.createElement("div",{style:{display:"flex",alignItems:"center"}},React.createElement(w.M,{disabled:le<1||g,onClick:function(){le>0&&H(D[le-1])}},"<"),React.createElement(w.M,{onClick:function(){return H()}},"Back to Results"),React.createElement(w.M,{disabled:le>=D.length-1||g,onClick:function(){le<D.length-1&&H(D[le+1])}},">"))),React.createElement("div",{style:{display:"flex",flexDirection:"column"}},React.createElement("div",{style:{flex:2}},React.createElement("a",{href:B,target:"_blank",rel:"noreferrer"},React.createElement("img",{src:B,style:{width:"100%"}}))),React.createElement("div",{style:{flex:1,marginLeft:10,display:"flex",flexDirection:"column"}},React.createElement(gm,null,React.createElement("label",null,"Title:"),React.createElement(Wt.m,{value:z,onBlur:W,rows:2})),React.createElement(gm,null,React.createElement("label",null,"Caption:"),React.createElement(Wt.m,{value:$,onBlur:Q,rows:2})),React.createElement(gm,null,React.createElement("label",null,"Description:"),React.createElement(Wt.m,{value:K,onBlur:q,rows:2})),React.createElement(gm,null,React.createElement("label",null,"Alternative Text:"),React.createElement(Wt.m,{value:Z,onBlur:ee,rows:2})),React.createElement(gm,null,React.createElement("label",null,"Filename:"),React.createElement(Re.A,{value:ne,onChange:re})),React.createElement(_e.g,null),React.createElement(w.M,{fullWidth:!0,style:{height:42},onClick:Ce,isBusy:_},"Add to Media Library"),React.createElement(_e.g,{tiny:!0}),Ie&&React.createElement(React.Fragment,null,React.createElement(_e.g,null),React.createElement(Ne.X,{variant:"success"},"The media has been created! You can edit it here: ",React.createElement("a",{href:"/wp-admin/post.php?post=".concat(Ie,"&action=edit"),target:"_blank",rel:"noreferrer"},"Edit Media #",Ie),"."))))),!B&&React.createElement(React.Fragment,null,React.createElement(Bt,null,React.createElement("div",{style:{display:"flex",alignItems:"center"}},React.createElement(w.M,{disabled:!ce,isBusy:g,onClick:Oe},"Generate"),React.createElement(we.u,{scrolldown:!0,id:"totalImagesToGenerate",name:"totalImagesToGenerate",style:{marginLeft:10,marginRight:10,width:120},value:se,onChange:function(e){return fe(e)}},vm.map((function(e){return React.createElement(we.j,{key:e,id:e,value:e,label:"".concat(e," ").concat(e>1?"Images":"Image")})}))),g&&React.createElement(w.M,{disabled:!ce,onClick:Oe},"Add to Queue"),D.length>0&&React.createElement(w.M,{onClick:function(){G([])}},"Clear"))),React.createElement(_e.g,null),React.createElement(Wt.m,{value:ce,onChange:function(e){i(cm(cm({},o),{},{prompt:e}))}}),React.createElement(Ht,null,D.map((function(e){return React.createElement("img",{key:e,src:e,onClick:function(){return H(e)}})})),im(Array(Math.max(3-D.length,0)).keys()).map((function(){return React.createElement("div",{className:"empty-image"})}))))))),React.createElement(Te.n,{isOpen:u,onRequestClose:function(){s()},okButton:{onClick:function(){s()}},title:"Error",content:React.createElement("p",null,u)}))};var bm=wp.element,wm=(bm.useState,bm.useEffect,bm.useMemo);const Rm=function(e){var t=e.isOpen,n=void 0!==t&&t,r=e.title,a=e.error,o=e.results,i=e.busy,l=void 0!==i&&i,c=e.onClick,u=void 0===c?function(){}:c,f=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t},m=wm((function(){return l?React.createElement(ms.X,{type:"circle",size:"10%"}):a?React.createElement(React.Fragment,null,"Error: ",a):(null==o?void 0:o.length)>0?React.createElement(React.Fragment,null,"Pick one of those results:",React.createElement(lf,null,o.map((function(e){return React.createElement(cf,{key:f(e),onClick:function(){u(e)}},e)})))):React.createElement(React.Fragment,null,"Nothing to display.")}),[o,a]);return React.createElement(s.A,null,React.createElement(E.N,null,React.createElement(Te.n,{isOpen:n,title:null!=r?r:"Results",content:m,onRequestClose:function(){return u()},okButton:{label:"Close",onClick:function(){return u()}}})))};function Om(e){return Om="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},Om(e)}function _m(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Cm(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}function xm(){xm=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Om(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Om(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Sm(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Tm(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Sm(o,r,a,i,l,"next",e)}function l(e){Sm(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Nm(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||Cm(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 Cm(e,t){if(e){if("string"==typeof e)return Im(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)?Im(e,t):void 0}}function Im(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 Am=wp.element,km=Am.useState,Lm=Am.useEffect,Mm=wp.i18n.__,Pm=wp.plugins.registerPlugin,jm=wp.components,Fm=jm.Button,Dm=jm.ToolbarDropdownMenu,Gm=jm.ToolbarGroup,Um=jm.Spinner,Bm=jm.MenuGroup,Hm=jm.MenuItem,Ym=wp.blockEditor.BlockControls,zm=wp.editor.PluginDocumentSettingPanel,Wm=wp.richText.registerFormatType,Vm=wp.data.useSelect;function Km(){var e=Nm(km(!1),2),t=e[0],n=e[1],r=Nm(km([]),2),a=r[0],o=r[1],i=Vm((function(e){return e("core/block-editor").getSelectedBlock()}),[]);if(!i)return null;if("core/paragraph"===i.name){var l=function(e){e.style.opacity=.15,e.style.pointerEvents="none",e.style.userSelect="none",e.style.animation="neko-fade-animation 0.85s infinite linear"},c=function(e){e.style.opacity=1,e.style.pointerEvents="auto",e.style.userSelect="auto",e.style.animation="none"};Lm((function(){if(null!=i&&i.clientId){var e=document.getElementById("block-"+i.clientId);e?t?l(e):c(e):console.warn("AI Engine: Could not find block element.")}}),[t,i]);var u=function(){var e=document.getElementById("block-"+i.clientId);e?c(e):console.warn("AI Engine: Could not find block element.")},s=function(e){wp.data.dispatch("core/block-editor").updateBlockAttributes(i.clientId,{content:e})},f=i.attributes.content,m=window.getSelection().toString(),d=function(){var e=Tm(xm().mark((function e(t){var r,a,c,d,p,h,y,v,g,E,b,w,R,_,x,S;return xm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=wp.data.select("core/editor"),a=r.getSelectedBlockClientId,c=r.getBlockIndex,d=r.getCurrentPost,p=a(),h=c(p),y=d(),v=y.id,n(!0),void 0,(N=document.getElementById("block-"+i.clientId))?l(N):console.warn("AI Engine: Could not find block element."),document.activeElement.blur(),e.prev=7,e.next=10,(0,O.IU)("".concat(T,"/ai/magic_wand"),{method:"POST",nonce:k,json:{action:t,data:{postId:v,text:f,selectedText:m}}});case 10:g=e.sent,u(),n(!1),E=g.data,b=E.mode,w=E.result,R=E.results,"replace"===b?s(w):"suggest"===b?o(R):"insertMedia"===b&&(_=g.data.media,x=wp.blocks.createBlock,S=x("core/image",{id:_.id,url:_.url,title:_.title,caption:_.caption,alt:_.alt}),wp.data.dispatch("core/block-editor").insertBlock(S,h+1)),e.next=23;break;case 17:e.prev=17,e.t0=e.catch(7),u(),n(!1),alert("Error: "+e.t0.message),console.log("ERROR",e.t0);case 23:case"end":return e.stop()}var N}),e,null,[[7,17]])})));return function(t){return e.apply(this,arguments)}}();return React.createElement(React.Fragment,null,React.createElement("style",null,"\n        @keyframes neko-fade-animation {\n          0% { opacity: 0.15; }\n          50% { opacity: 0.3; }\n          100% { opacity: 0.15; }\n        }\n    "),React.createElement(Ym,null,React.createElement(Gm,null,React.createElement(Dm,{icon:t?React.createElement(Um,null):React.createElement(Pt,{icon:"wand",style:{marginRight:0}}),label:Mm("AI Wand")},(function(){return React.createElement(React.Fragment,null,React.createElement(Bm,null,React.createElement(Hm,{onClick:function(){return d("correctText")}},React.createElement("div",{style:{display:"flex",flexDirection:"column"}},React.createElement("b",null,"Correct Text"),React.createElement("small",null,"Grammar & Spelling"))),React.createElement(Hm,{onClick:function(){return d("enhanceText")}},React.createElement("div",{style:{display:"flex",flexDirection:"column"}},React.createElement("b",null,"Enhance Text"),React.createElement("small",null,"Readibility & Quality"))),React.createElement(Hm,{onClick:function(){return d("longerText")}},React.createElement("div",{style:{display:"flex",flexDirection:"column"}},React.createElement("b",null,"Longer Text"),React.createElement("small",null,"Readibility"))),React.createElement(Hm,{onClick:function(){return d("shorterText")}},React.createElement("div",{style:{display:"flex",flexDirection:"column"}},React.createElement("b",null,"Shorter Text"),React.createElement("small",null,"Readibility"))),React.createElement(Hm,{onClick:function(){return d("translateText")}},React.createElement("div",{style:{display:"flex",flexDirection:"column"}},React.createElement("b",null,"Translate Text"),React.createElement("small",null,"To Post Language")))),React.createElement(Bm,null,React.createElement(Hm,{disabled:!m,onClick:function(){return d("suggestSynonyms")}},React.createElement("div",{style:{display:"flex",flexDirection:"column"}},React.createElement("b",null,"Suggest Synonyms"),React.createElement("small",null,"For Selected Words")))),React.createElement(Bm,null,React.createElement(Hm,{onClick:function(){return d("generateImage")}},React.createElement("div",{style:{display:"flex",flexDirection:"column"}},React.createElement("b",null,"Generate Image"),React.createElement("small",null,"For this Text")))))})))),React.createElement(Rm,{isOpen:null==a?void 0:a.length,results:a,onClick:function(e){o([]),e&&function(e){var t=wp.data.select("core/block-editor"),n=t.getSelectionStart,r=t.getSelectionEnd,a=wp.data.select("core/block-editor").getSelectedBlock(),o=a.attributes.content,i=n().offset,l=r().offset,c=o.substring(0,i)+e+o.substring(l);wp.data.dispatch("core/block-editor").updateBlockAttributes(a.clientId,{content:c})}(e)},onClose:function(){return o([])}}))}}var qm=function(){var e=Tm(xm().mark((function e(t,n){var r,a,o,i,l,c;return xm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",t);case 2:return r=wp.data.select("core/editor"),a=r.getCurrentPost,o=a(),i=o.id,e.next=6,(0,O.IU)("".concat(T,"/ai/magic_wand"),{method:"POST",nonce:k,json:{action:"translateSection",data:{postId:i,context:n,text:t}}});case 6:return l=e.sent,c=l.data.result,e.abrupt("return",c);case 9:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Xm=function(){var e=Tm(xm().mark((function e(){var t,n,r,a,o,i,l,c,u,s,f,m,d,p,h,y,v,g,E,b,w,R,O,_,x,S,T,N,C,I,A;return xm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=wp.data.select("core/block-editor"),n=t.getBlocks,r=t.getBlockAttributes,a=wp.data.dispatch("core/block-editor"),o=a.updateBlockAttributes,i=wp.data.dispatch("core/editor"),l=i.editPost,i.savePost,c=wp.data.dispatch("core/notices"),u=c.createInfoNotice,s=c.removeNotice,f=wp.data.select("core/editor"),m=f.getEditedPostAttribute,d="mwai-translation-progress-notice",p=n(),h=m("title"),y=Tt(),v=function(){var e=Tm(xm().mark((function e(t){return xm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u("Translating content... ".concat(t,"%"),{id:d,isDismissible:!1}),e.next=3,new Promise((function(e){return setTimeout(e,100)}));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),g=function(e){e.style.opacity=.15,e.style.pointerEvents="none",e.style.userSelect="none",e.style.animation="neko-fade-animation 0.85s infinite linear"},E=function(e){e.style.opacity=1,e.style.pointerEvents="auto",e.style.userSelect="auto",e.style.animation="none"},p.forEach((function(e){var t=document.querySelector('[data-block="'.concat(e.clientId,'"]'));t&&g(t)})),(b=document.querySelector(".editor-post-title__input"))&&g(b),e.next=17,v(0);case 17:return w=p.length+2,R=0,O="",e.prev=20,e.next=23,qm(h,y);case 23:return O=e.sent,R++,l({title:O}),b&&E(b),e.next=29,v(Math.round(R/w*100));case 29:_=_m(p),e.prev=30,_.s();case 32:if((x=_.n()).done){e.next=50;break}if(S=x.value,!["core/paragraph","core/heading","core/list","core/quote","core/table"].includes(S.name)){e.next=45;break}if(!(T=r(S.clientId).content)){e.next=42;break}return e.next=39,qm(T,y);case 39:return N=e.sent,e.next=42,o(S.clientId,{content:N});case 42:(C=document.querySelector('[data-block="'.concat(S.clientId,'"]')))&&E(C),wp.data.dispatch("core/block-editor").selectBlock(S.clientId);case 45:return R++,e.next=48,v(Math.round(R/w*100));case 48:e.next=32;break;case 50:e.next=55;break;case 52:e.prev=52,e.t0=e.catch(30),_.e(e.t0);case 55:return e.prev=55,_.f(),e.finish(55);case 58:if(!(I=m("excerpt"))){e.next=64;break}return e.next=62,qm(I,y);case 62:A=e.sent,l({excerpt:A});case 64:return e.prev=64,p.forEach((function(e){var t=document.querySelector('[data-block="'.concat(e.clientId,'"]'));t&&E(t)})),s(d),e.finish(64);case 68:case"end":return e.stop()}}),e,null,[[20,,64,68],[30,52,55,58]])})));return function(){return e.apply(this,arguments)}}(),$m=function(){var e=null==L?void 0:L.module_suggestions,t=Nm(km(),2),n=t[0],r=t[1],a=Nm(km(),2),o=a[0],i=a[1],l=function(){var e=Tm(xm().mark((function e(){return xm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Xm();case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),c=function(){var e=Tm(xm().mark((function e(t){return xm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:wp.data.dispatch("core/editor").editPost({title:t});case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),u=function(){var e=Tm(xm().mark((function e(t){return xm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:wp.data.dispatch("core/editor").editPost({excerpt:t});case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return e?React.createElement(s.A,null,React.createElement(zm,{name:"mwai-document-settings",title:React.createElement(React.Fragment,null,React.createElement(Pt,null)," AI Engine"),className:"mwai-document-settings"},React.createElement("p",null,"Suggest:"),React.createElement("div",{style:{display:"flex"}},React.createElement(Fm,{variant:"primary",onClick:function(){var e=(0,wp.data.select("core/editor").getCurrentPost)(),t=e.id,n=e.title;r({postId:t,postTitle:n})},style:{flex:1,marginRight:10,textAlign:"center"}},React.createElement(Pt,{icon:"wand",style:{marginRight:8}})," Titles"),React.createElement(Fm,{variant:"primary",onClick:function(){var e=(0,wp.data.select("core/editor").getCurrentPost)(),t=e.id,n=e.title;i({postId:t,postTitle:n})},style:{flex:1,textAlign:"center"}},React.createElement(Pt,{icon:"wand",style:{marginRight:8}})," Excerpts")),React.createElement("div",{style:{display:"flex"}},React.createElement(Fm,{variant:"primary",onClick:l,style:{flex:1,marginTop:10,textAlign:"center"}},React.createElement(Pt,{icon:"wand",style:{marginRight:8}})," Translate Post")),React.createElement(s.A,null,React.createElement(E.N,null,React.createElement(Ef,{post:n,onTitleClick:c,onClose:r}),React.createElement(If,{post:o,onExcerptClick:u,onClose:i}))))):null};function Qm(e){return Qm="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},Qm(e)}function Jm(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 Zm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Jm(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=Qm(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Qm(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==Qm(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jm(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ed(){return ed=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},ed.apply(this,arguments)}function td(){td=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Qm(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Qm(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 nd(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function rd(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){nd(o,r,a,i,l,"next",e)}function l(e){nd(o,r,a,i,l,"throw",e)}i(void 0)}))}}function ad(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return od(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)?od(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 od(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 id=wp.hooks.addFilter,ld=wp.element,cd=ld.useState,ud=ld.useRef,sd=ld.useEffect,fd=wp.components,md=fd.TextControl,dd=(fd.Spinner,fd.ProgressBar),pd=fd.ToggleControl,hd=fd.Card,yd=fd.CardBody,vd=wp.data.dispatch,gd="mwai-copilot/prevent-new-block";var Ed,bd=["children","type","title","hint","isSelected","isDisplayed"];function wd(){return wd=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},wd.apply(this,arguments)}var Rd=React.createElement(Pt,{icon:"ai",style:{width:20,height:20}}),Od=G.Ay.div(Ed||(Ed=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n  color: black;\n  display: flex;\n  flex-direction: column;\n  border: 1px solid black;\n  font-size: 15px;\n  box-sizing: content-box;\n  font-weight: 400;\n  font-size: 13px;\n  padding: 10px;\n  background: hsl(0deg 0% 100% / 75%);\n  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n  margin-bottom: 10px;\n\n\n  .mwai-title-container {\n    flex: inherit;\n    padding: 5px 0px 5px 10px;\n    display: flex;\n    align-items: center;\n    color: black;\n    font-weight: 600;\n    cursor: pointer;\n\n    .mwai-hint {\n      font-size: 10px;\n      font-weight: 400;\n      text-align: right;\n      flex: auto;\n\n      .mwai-pill {\n        background: var(--wp--preset--color--vivid-cyan-blue);\n        padding: 5px 10px;\n        border-radius: 8px;\n        color: white;\n      }\n\n      .mwai-pill-purple {\n        background: var(--wp--preset--color--vivid-purple);\n      }\n    }\n  }\n\n  .mwai-block-container-content {\n    flex: auto;\n    padding: 10px;\n    display: flex;\n    flex-direction: column;\n  }\n\n\t&.mwai-chatbot {\n\t\tbackground: var(--neko-main-color);\n\n\t\t.mwai-title-container {\n\t\t\tcolor: white;\n\t\t}\t\n\n\t\t.mwai-block-container-content {\n\t\t\tmargin-top: 10px;\n\t\t\tborder-radius: 5px;\n\t\t\tbackground: var(--neko-background-color);\n\t\t}\n\t}\n\n  &.is-selected {\n  }\n']))),_d=function(e){var t=e.children,n=e.type,r=void 0===n?"":n,a=e.title,o=void 0===a?"":a,i=e.hint,l=void 0===i?"":i,c=e.isSelected,u=e.isDisplayed,s=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,bd),f=(0,Zt.gR)("mwai-block-container","mwai-".concat(r),{"is-selected":c,"is-meow":!0});return React.createElement(Od,wd({className:f},s),React.createElement("div",{className:"mwai-title-container"},React.createElement(Pt,{icon:"ai",style:{width:20,height:20}}),React.createElement("div",null,o),React.createElement("div",{className:"mwai-hint"},l)),(c||u)&&React.createElement("div",{className:"mwai-block-container-content"},t))};function xd(e){return xd="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},xd(e)}function Sd(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 Td(e,t,n){var r;return r=function(e,t){if("object"!=xd(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=xd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==xd(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nd(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Cd(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)?Cd(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 Cd(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 Id=wp.blocks.registerBlockType,Ad=wp.element,kd=Ad.useMemo,Ld=Ad.useState,Md=wp.components,Pd=Md.PanelBody,jd=Md.SelectControl,Fd=Md.ToggleControl,Dd=wp.blockEditor,Gd=Dd.InspectorControls,Ud=Dd.useBlockProps,Bd=function(e){return e.replace(/[A-Z]/g,(function(e){return"_".concat(e.toLowerCase())}))},Hd=function(e){var t=e.attributes,n=t.chatbotId,r=t.isCustomChatbot,a=t.shortcodeParams;if(r){var o=Object.entries(a).filter((function(e){var t=Nd(e,2)[1];return null!=t&&""!==t})).reduce((function(e,t){var n=Nd(t,2),r=n[0],a=n[1],o=Bd(r);return"".concat(e," ").concat(o,'="').concat(a,'"')}),"[mwai_chatbot");return"".concat(o,"]")}var i={id:{value:n,insertIfNull:!0}},l=Object.entries(i).filter((function(e){var t=Nd(e,2)[1],n=t.value,r=t.insertIfNull;return!!n||r})).reduce((function(e,t){var n=Nd(t,2),r=n[0],a=n[1].value,o=Bd(r);return"".concat(e," ").concat(o,'="').concat(a,'"')}),"[mwai_chatbot");return"".concat(l,"]")},Yd=function(e){var t=e.attributes,n=t.chatbotId,r=t.isCustomChatbot,a=t.shortcodeParams,o=e.setAttributes,i=e.isSelected,l=Nd(Ld(a),2),c=l[0],u=l[1],s=Ud(),f=kd((function(){var e=F.map((function(e){return{label:e.name,value:e.botId}}));return e.unshift({label:"None",value:null}),e}),[F]),m=kd((function(){return F.find((function(e){return e.botId===n}))}),[n]),d=kd((function(){return r?"Custom Chatbot":m?"Chatbot (".concat(m.name,")"):"Chatbot"}),[r,n,m]);return React.createElement(React.Fragment,null,React.createElement("div",s,React.createElement(_d,{title:d,type:"chatbot",isSelected:i},r&&React.createElement(React.Fragment,null,React.createElement(Ko,{shortcodeParams:c,updateShortcodeParams:function(e,t){var n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Sd(Object(n),!0).forEach((function(t){Td(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sd(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},c);n[t]=e,u(n),o({shortcodeParams:n})},options:L,blockMode:!0})),!r&&React.createElement("p",null,"Selected chatbot: ",m?m.name:"None"))),React.createElement(Gd,null,React.createElement(Pd,{title:He.COMMON.CHATBOT},React.createElement(Fd,{label:"Custom Chatbot",checked:r,onChange:function(e){return o({isCustomChatbot:e})}}),!r&&f&&f.length>0&&React.createElement(jd,{label:He.COMMON.CHATBOT,value:n,options:f,onChange:function(e){return o({chatbotId:e})}})),!r&&React.createElement(Pd,{title:He.COMMON.SETTINGS})))};function zd(){return zd=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},zd.apply(this,arguments)}var Wd=wp.i18n.__,Vd=wp.blocks.registerBlockType,Kd=wp.element.useEffect,qd=wp.components,Xd=qd.PanelBody,$d=qd.SelectControl,Qd=qd.TextControl,Jd=wp.blockEditor,Zd=Jd.InspectorControls,ep=Jd.InnerBlocks,tp=Jd.useBlockProps,np=function(e){var t=tp.save(),n=e.attributes,r=n.id,a=n.theme,o='[mwai-form-container id="'.concat(r,'" theme="').concat(a,'"]');return React.createElement("div",zd({},t,{id:"mwai-form-container-".concat(r),className:"mwai-form-container"}),o,React.createElement(ep.Content,null))},rp=function(e){var t=e.attributes,n=t.id,r=t.theme,a=e.setAttributes,o=tp();return Kd((function(){if(!n){var e=Math.random().toString(36).substr(2,9);a({id:e})}}),[n]),React.createElement(React.Fragment,null,React.createElement("div",o,React.createElement(_d,{title:"Container",type:"container",isDisplayed:!0},React.createElement(ep,null))),React.createElement(Zd,null,React.createElement(Xd,{title:He.COMMON.STYLE},React.createElement("p",null,"The theme will be applied to all the AI elements in this container."),React.createElement($d,{label:"Theme",value:r,onChange:function(e){return a({theme:e})},options:[{label:"None",value:"none"},{label:"ChatGPT",value:"ChatGPT"},{label:"Timeless",value:"Timeless"}]}),React.createElement(Qd,{label:"ID",value:n,onChange:function(e){return a({id:e})}}))))};function ap(e){return function(e){if(Array.isArray(e))return op(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return op(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)?op(e,t):void 0}}(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 op(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 ip=wp.i18n.__,lp=wp.blocks.registerBlockType,cp=wp.element.useEffect,up=wp.components,sp=up.Button,fp=up.PanelBody,mp=up.TextControl,dp=up.SelectControl,pp=up.CheckboxControl,hp=wp.blockEditor,yp=hp.useBlockProps,vp=hp.InspectorControls,gp=function(e){var t=e.attributes,n=t.id,r=t.label,a=t.type,o=t.name,i=t.options,l=void 0===i?[]:i,c=t.placeholder,u=t.rows,s=t.defaultValue,f=t.maxlength,m=t.required,d=encodeURIComponent((0,O.F1)(l)),p=yp.save(),h="[mwai-form-field";return n&&(h+=' id="'.concat(n,'"')),r&&(h+=' label="'.concat(r,'"')),a&&(h+=' type="'.concat(a,'"')),o&&(h+=' name="'.concat(o,'"')),d&&(h+=' options="'.concat(d,'"')),c&&(h+=' placeholder="'.concat(c,'"')),"textarea"===a&&u&&(h+=' rows="'.concat(u,'"')),s&&(h+=' default="'.concat(s,'"')),f&&(h+=' maxlength="'.concat(f,'"')),m&&(h+=' required="'.concat(m,'"')),h+="]",React.createElement("div",p,h)},Ep=function(e){var t,n=e.attributes,r=n.id,a=n.type,o=n.name,i=n.options,l=void 0===i?[]:i,c=n.label,u=n.placeholder,s=n.rows,f=n.defaultValue,m=n.maxlength,d=n.required,p=e.setAttributes,h=e.isSelected,y=yp();return cp((function(){if(!r){var e=Math.random().toString(36).substr(2,9);p({id:"mwai-"+e})}}),[r]),React.createElement(React.Fragment,null,React.createElement("div",y,React.createElement(_d,{title:"".concat((t=a,t.charAt(0).toUpperCase()+t.slice(1))),type:"field",isSelected:h,hint:React.createElement("span",{className:"mwai-pill"},"{",o,"}")},React.createElement("div",null,c),React.createElement("div",{style:{flex:"auto"}}),React.createElement("div",null,o))),React.createElement(vp,null,React.createElement(fp,{title:ip("Field")},React.createElement(mp,{label:"Label Text",value:c,onChange:function(e){p({label:e});var t=e.trim().replace(/ /g,"_").replace(/[^\w-]+/g,"").toUpperCase();t&&p({name:t})}}),React.createElement(mp,{label:"Field Name",value:o,onChange:function(e){return p({name:e})}}),React.createElement(dp,{label:"Field Type",value:a,onChange:function(e){return p({type:e})},options:[{label:"Input",value:"input"},{label:"Select",value:"select"},{label:"Checkbox",value:"checkbox"},{label:"Radio",value:"radio"},{label:"Text Area",value:"textarea"}]}),("input"===a||"textarea"===a)&&React.createElement(mp,{label:"Placeholder",value:u,onChange:function(e){return p({placeholder:e})}}),("input"===a||"textarea"===a)&&React.createElement(mp,{label:"Default Value",value:f,onChange:function(e){return p({defaultValue:e})}}),("input"===a||"textarea"===a)&&React.createElement(mp,{label:"Max Length",value:m,onChange:function(e){return p({maxlength:e})}}),"textarea"===a&&React.createElement(mp,{label:He.COMMON.ROWS,value:s,onChange:function(e){return p({rows:e})},type:"number",step:"1",min:"1",max:"100"}),React.createElement(pp,{label:"Required",checked:d,onChange:function(e){return p({required:e})}})),("select"===a||"radio"===a||"checkbox"===a)&&React.createElement(fp,{title:React.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"}},React.createElement("div",null,ip("Options")))},l.map((function(e,t){return React.createElement("div",{key:t,style:{display:"flex",marginBottom:-25}},React.createElement("div",{style:{marginRight:5}},React.createElement(mp,{style:{marginRight:10},label:"Label",isInline:!0,value:e.label,onChange:function(e){var n=ap(l);n[t].label=e,p({options:n})}})),React.createElement(mp,{style:{},label:"Value",isSubtle:!0,value:e.value,onChange:function(e){var n=ap(l);n[t].value=e,p({options:n})}}),React.createElement("div",{style:{marginLeft:5,position:"relative",top:23}},React.createElement(sp,{style:{height:30},isDestructive:!0,icon:"trash",isSmall:!0,onClick:function(){var e=ap(l);e.splice(t,1),p({options:e})}})))})),React.createElement(sp,{isPrimary:!0,style:{width:"100%",marginTop:10},onClick:function(){var e=ap(l);e.push({label:"",value:""}),p({options:e})}},"Add Option")),React.createElement(fp,{title:He.COMMON.SYSTEM},React.createElement(mp,{label:"ID",value:r,onChange:function(e){return p({id:e})}}))))};function bp(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Rp(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)?Rp(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 Rp(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 Op=wp.i18n.__,_p=wp.blocks.registerBlockType,xp=wp.element.useEffect,Sp=wp.components,Tp=Sp.PanelBody,Np=Sp.TextControl,Cp=Sp.CheckboxControl,Ip=wp.blockEditor,Ap=Ip.InspectorControls,kp=Ip.useBlockProps,Lp=function(e){var t=e.attributes,n=t.id,r=t.copyButton,a=kp.save(),o={id:{value:n,insertIfNull:!0},copy_button:{value:r,insertIfNull:!1}},i=Object.entries(o).filter((function(e){var t=bp(e,2)[1],n=t.value,r=t.insertIfNull;return!1!==n&&""!==n||r})).reduce((function(e,t){var n=bp(t,2),r=n[0],a=n[1].value;return"".concat(e," ").concat(r,'="').concat(a,'"')}),"[mwai-form-output");return i="".concat(i,"]"),React.createElement("div",a,i)},Mp=function(e){var t=e.attributes,n=t.id,r=t.copyButton,a=e.setAttributes,o=e.isSelected,i=kp();return xp((function(){if(!n){var e=Math.random().toString(36).substr(2,9);a({id:"mwai-"+e})}}),[n]),React.createElement(React.Fragment,null,React.createElement("div",i,React.createElement(_d,{title:"Output",type:"output",isSelected:o,hint:React.createElement("span",{className:"mwai-pill mwai-pill-purple"},"#",n)},React.createElement("div",null),React.createElement("div",{style:{flex:"auto"}}),React.createElement("div",null,"#",n))),React.createElement(Ap,null,React.createElement(Tp,{title:He.FORMS.OUTPUT},React.createElement(Cp,{label:"Copy Button",checked:r,onChange:function(e){return a({copyButton:e})}}),React.createElement(Np,{label:"ID",value:n,onChange:function(e){return a({id:e})}}))))};function Pp(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return jp(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)?jp(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 jp(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 Fp=wp.i18n.__,Dp=wp.blocks.registerBlockType,Gp=wp.element,Up=Gp.useMemo,Bp=Gp.useEffect,Hp=wp.components,Yp=Hp.PanelBody,zp=Hp.TextControl,Wp=Hp.TextareaControl,Vp=Hp.SelectControl,Kp=Hp.CheckboxControl,qp=wp.blockEditor,Xp=qp.InspectorControls,$p=qp.useBlockProps,Qp=function(e){var t=e.attributes,n=t.id,r=t.label,a=t.prompt,o=t.message,i=t.outputElement,l=t.aiEnvId,c=t.embeddingsEnvId,u=t.index,s=t.namespace,f=t.model,m=t.temperature,d=t.maxTokens,p=t.isAssistant,h=t.assistantId,y=t.resolution,v=encodeURIComponent(a),g=encodeURIComponent(o),E=$p.save(),b={id:{value:n,insertIfNull:!0},label:{value:r,insertIfNull:!0},prompt:{value:v,insertIfNull:!1},message:{value:g,insertIfNull:!1},output_element:{value:i,insertIfNull:!0},model:{value:f,insertIfNull:!1},temperature:{value:m,insertIfNull:!1},max_tokens:{value:d,insertIfNull:!1},is_assistant:{value:p,insertIfNull:!1},env_id:{value:l,insertIfNull:!1},embeddings_env_id:{value:c,insertIfNull:!1},embeddings_index:{value:u,insertIfNull:!1},embeddings_namespace:{value:s,insertIfNull:!1},assistant_id:{value:h,insertIfNull:!1},resolution:{value:y,insertIfNull:!1}},w=Object.entries(b).filter((function(e){var t=Pp(e,2)[1],n=t.value,r=t.insertIfNull;return!!n||r})).reduce((function(e,t){var n=Pp(t,2),r=n[0],a=n[1].value;return"".concat(e," ").concat(r,'="').concat(a,'"')}),"[mwai-form-submit");return w="".concat(w,"]"),React.createElement("div",E,w)},Jp=function(e){var t,n=$p(),r=e.attributes,a=r.id,o=r.label,i=r.prompt,l=r.message,c=r.model,u=r.temperature,s=r.maxTokens,f=r.aiEnvId,m=r.embeddingsEnvId,d=r.index,p=r.namespace,h=r.assistantId,y=r.resolution,v=r.isAssistant,g=r.outputElement,E=r.placeholders,b=void 0===E?[]:E,w=e.setAttributes,R=e.isSelected,O=Up((function(){return L.embeddings_envs||[]}),[]),_=Up((function(){return O.find((function(e){return e.id===m}))||null}),[O,m]),x=Up((function(){return(null==_?void 0:_.indexes)||[]}),[_]),S=Up((function(){return(null==_?void 0:_.namespaces)||[]}),[_]),T=Up((function(){return L.ai_envs||[]}),[]),N=ft(L,f),C=N.models,I=(0,N.getModel)(c),A=null==I||null===(t=I.features)||void 0===t?void 0:t.includes("text-to-image"),k=Up((function(){return T.find((function(e){return e.id===f}))||null}),[T,f]),M=Up((function(){return(null==k?void 0:k.assistants)||[]}),[k]),P=Up((function(){return M.find((function(e){return e.id===h}))||null}),[M,h]);Bp((function(){!f&&!c||k||w({aiEnvId:null,model:null})}),[f]),Bp((function(){(m||d||p)&&!_&&w({embeddingsEnvId:null,index:null,namespace:null})}),[m]),Bp((function(){P&&P.model&&P.model!==c&&w({model:P.model})}),[P]),Bp((function(){v||w({assistantId:""})}),[v]),Bp((function(){if(!a){var e=Math.random().toString(36).substr(2,9);w({id:"mwai-"+e})}}),[a]),Bp((function(){var e=l.match(/{([^}]+)}/g);if(e){var t=e.map((function(e){return e.replace("{","").replace("}","")}));t.join(",")!==b.join(",")&&w({placeholders:t})}else w({placeholders:[]})}),[l]),Bp((function(){i&&w({message:i,prompt:null})}),[i]);var j=Up((function(){return b?b.length:0}),[b]),F=Up((function(){var e=M.map((function(e){return{label:e.name,value:e.id}}));return e.unshift({label:"None",value:""}),e}),[M]),D=Up((function(){var e=C.map((function(e){return{label:e.rawName,value:e.model}}));return e.unshift({label:"Default",value:""}),e}),[C]),G=Up((function(){var e;if(!I||!A)return[];var t=(null==I||null===(e=I.resolutions)||void 0===e?void 0:e.map((function(e){return{label:e.label,value:e.name}})))||[];return t.unshift({label:"None",value:""}),t}),[I,A]),U=Up((function(){var e=x.map((function(e){return{label:e.name,value:e.name}}));return e.unshift({label:"None",value:""}),e}),[x]),B=Up((function(){var e=T.map((function(e){return{label:e.name,value:e.id}}));return e.unshift({label:"Default",value:""}),e}),[T]),H=Up((function(){var e=O.map((function(e){return{label:e.name,value:e.id}}));return e.unshift({label:"None",value:""}),e}),[O]),Y=Up((function(){var e=S.map((function(e){return{label:e,value:e}}));return e.unshift({label:"None",value:""}),e}),[S]),z=Up((function(){return 0===j?"N/A":React.createElement("span",{className:"mwai-pill"},j," field",j>1?"s":"")}),[j]);return React.createElement(React.Fragment,null,React.createElement("div",n,React.createElement(_d,{title:"Submit",type:"submit",isSelected:R,hint:React.createElement(React.Fragment,null,"IN:"," ",React.createElement("span",{className:"mwai-pill"},z)," ","OUT:"," ",React.createElement("span",{className:"mwai-pill mwai-pill-purple"},g||"N/A"))},"Input Fields: ",b.join(", "),React.createElement("br",null),"Prompt: ",l,React.createElement("br",null),"Output Element: ",g)),React.createElement(Xp,null,React.createElement(Yp,{title:He.COMMON.OUTPUT},React.createElement(zp,{label:He.COMMON.LABEL,value:o,onChange:function(e){return w({label:e})}}),React.createElement(Wp,{label:He.COMMON.PROMPT,value:l,onChange:function(e){return w({message:e})},help:He.FORMS.PROMPT_INFO}),React.createElement(zp,{label:He.FORMS.OUTPUT_ELEMENT,value:g,onChange:function(e){return w({outputElement:e})},help:He.FORMS.OUTPUT_ELEMENT_INFO})),React.createElement(Yp,{title:He.COMMON.MODEL_PARAMS},T&&T.length>0&&React.createElement(Vp,{label:He.COMMON.ENVIRONMENT,value:f,options:B,onChange:function(e){return w({aiEnvId:e})}}),T&&T.length>0&&React.createElement(Kp,{label:"Assistant Mode",checked:v,onChange:function(e){return w({isAssistant:e})}}),v&&M&&M.length>0&&React.createElement(React.Fragment,null,React.createElement(Vp,{label:He.COMMON.ASSISTANT,value:h,options:F,onChange:function(e){return w({assistantId:e})}})),!v&&React.createElement(React.Fragment,null,C&&C.length>0&&React.createElement(Vp,{label:He.COMMON.MODEL,value:c,options:D,onChange:function(e){return w({model:e})}}),!A&&React.createElement(React.Fragment,null,React.createElement(zp,{label:He.COMMON.TEMPERATURE,value:u,onChange:function(e){return w({temperature:parseFloat(e)})},type:"number",step:"0.1",min:"0",max:"1",help:He.HELP.TEMPERATURE}),React.createElement(zp,{label:He.COMMON.MAX_TOKENS,value:s,onChange:function(e){return w({maxTokens:parseInt(e)})},type:"number",step:"16",min:"32",max:"4096",help:React.createElement(Eo,{model:I,maxTokens:s,onRecommendedClick:function(e){return w({maxTokens:e})}})})),A&&React.createElement(React.Fragment,null,React.createElement(Vp,{label:He.COMMON.RESOLUTION,value:y,options:G,onChange:function(e){return w({resolution:e})}})))),!A&&React.createElement(React.Fragment,null,React.createElement(Yp,{title:He.COMMON.CONTEXT_PARAMS},O&&O.length>0&&React.createElement(Vp,{label:He.COMMON.EMBEDDINGS_ENV,value:m,options:H,disabled:!(null!=H&&H.length),onChange:function(e){return w({embeddingsEnvId:e})}}),x&&x.length>0&&React.createElement(Vp,{label:He.COMMON.EMBEDDINGS_INDEX,value:d,options:U,disabled:!(null!=H&&H.length),onChange:function(e){return w({index:e})}}),"pinecone"===(null==_?void 0:_.type)&&S&&S.length>0&&React.createElement(Vp,{label:He.COMMON.NAMESPACE,value:p,options:Y,disabled:!(null!=H&&H.length),onChange:function(e){return w({namespace:e})}}))),React.createElement(Yp,{title:He.COMMON.SYSTEM},React.createElement(zp,{label:"ID",value:a,onChange:function(e){return w({id:e})}}))))};var Zp,eh=wp.element.render,th=new c.E({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnMount:!1,retry:!1,placeholderData:function(e){return e}}}}),nh=L.module_chatbots,rh=L.module_suggestions,ah=L.module_forms;nh&&Id("ai-engine/chatbot",{title:"AI Chatbot",description:"Embed an AI Engine Chatbot in your content.",icon:Rd,category:"layout",keywords:["ai","openai","chatbot"],attributes:{id:{type:"string",default:""},chatbotId:{type:"string",default:"default"},isCustomChatbot:{type:"boolean",default:!1},shortcodeParams:{type:"object",default:{}}},edit:Yd,save:Hd}),ah&&(lp("ai-engine/form-field",{apiVersion:3,title:"AI Form Field",description:"An AI Field for your AI Form.",icon:Rd,category:"layout",keywords:[ip("ai"),ip("openai"),ip("form")],supports:{dimensions:{width:!0}},attributes:{id:{type:"string",default:""},name:{type:"string",default:"LABEL"},type:{type:"string",default:"input"},options:{type:"array",default:[]},label:{type:"string",default:"Label: "},placeholder:{type:"string",default:""},defaultValue:{type:"string",default:""},maxlength:{type:"string",default:""},rows:{type:"rows",default:4},required:{type:"boolean",default:!0}},edit:Ep,save:gp}),_p("ai-engine/form-output",{title:"AI Form Output",description:"An Output Field for your AI Form.",icon:Rd,category:"layout",keywords:[Op("ai"),Op("openai"),Op("form")],supports:{dimensions:{minHeight:!0}},attributes:{id:{type:"string",default:""},copyButton:{type:"boolean",default:!0}},edit:Mp,save:Lp}),Dp("ai-engine/form-submit",{title:"AI Form Submit",description:"The Submit Button for your AI Form.",icon:Rd,category:"layout",keywords:[Fp("ai"),Fp("openai"),Fp("form")],supports:{dimensions:{minHeight:!1}},attributes:{id:{type:"string",default:""},label:{type:"string",default:"Submit"},prompt:{type:"string",default:""},message:{type:"string",default:""},outputElement:{type:"string",default:""},model:{type:"string",default:""},temperature:{type:"number",default:.8},maxTokens:{type:"number",default:4096},placeholders:{type:"array",default:[]},aiEnvId:{type:"string",default:""},embeddingsEnvId:{type:"string",default:""},index:{type:"string",default:""},namespace:{type:"string",default:null},isAssistant:{type:"boolean",default:!1},assistantId:{type:"string",default:""},resolution:{type:"string",default:null}},edit:Jp,save:Qp}),Vd("ai-engine/form-container",{title:"AI Form Container",description:"Container to embed the blocks relative to a specific AI Form.",icon:Rd,category:"layout",keywords:[Wd("ai"),Wd("openai"),Wd("form")],attributes:{id:{type:"string",default:""},theme:{type:"string",default:"ChatGPT"}},edit:rp,save:np})),rh&&(Pm("ai-engine-document-settings",{render:$m}),Wm("ai-wand/actions",{title:"AI Wand",tagName:"mwai",className:null,edit:Km}),Zp=function(e){var t=ud(),n=ad(cd(!1),2),r=n[0],a=n[1],o=ad(cd(""),2),i=o[0],l=o[1],c=ad(cd(!1),2),u=c[0],s=c[1],f=ad(cd(!1),2),m=f[0],d=f[1],p=ad(cd(!1),2),h=p[0],y=p[1],v=wp.data.select("core/editor").getCurrentPostId(),g=function(){var t=rd(td().mark((function t(n){var r,o,i,c,u,f,m,d,p,y;return td().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=Tt("[== CURRENT BLOCK ==]"),t.prev=1,s(!0),t.next=5,(0,O.IU)("".concat(T,"/ai/copilot"),{method:"POST",nonce:k,json:{action:h?"image":"text",message:n,context:r,postId:v}});case 5:o=t.sent,h?(i=o.data.media,c=wp.blocks.createBlock,u=wp.data.dispatch("core/block-editor"),f=u.replaceBlock,m=wp.data.select("core/block-editor"),d=m.getSelectedBlockClientId,p=c("core/image",{id:i.id,url:i.url,title:i.title,caption:i.caption,alt:i.alt}),y=d(),f(y,p)):e.setAttributes({content:o.data}),setTimeout((function(){var e=wp.data.select("core/block-editor").getSelectedBlockClientId,t=document.querySelector('[data-block="'.concat(e(),'"]'));if(t){var n=document.createRange(),r=window.getSelection();n.setStart(t,1),n.collapse(!0),r.removeAllRanges(),r.addRange(n)}}),50),t.next=14;break;case 10:t.prev=10,t.t0=t.catch(1),console.error("Error:",t.t0.message),vd("core/notices").createErrorNotice("AI Copilot error: ".concat(t.t0.message),{isDismissible:!0});case 14:return t.prev=14,s(!1),a(!1),l(""),t.finish(14);case 19:case"end":return t.stop()}}),t,null,[[1,10,14,19]])})));return function(e){return t.apply(this,arguments)}}(),E=function(){var e=rd(td().mark((function e(t){return td().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!m){e.next=2;break}return e.abrupt("return");case 2:if("Enter"!==t.key){e.next=9;break}return t.preventDefault(),t.stopPropagation(),e.next=7,g(i);case 7:e.next=10;break;case 9:("Escape"===t.key||"Backspace"===t.key&&!i)&&(t.preventDefault(),a(!1),l(""));case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return sd((function(){r&&t.current&&t.current.focus()}),[r]),sd((function(){var e=function(e){if(r&&"Enter"===e.key)return e.preventDefault(),!1};return vd("core/keyboard-shortcuts").registerShortcut({name:gd,category:"block",description:"Prevent new block creation when AI Copilot is active",keyCombination:{character:"enter"}}),window.addEventListener("keydown",e,!0),function(){window.removeEventListener("keydown",e,!0),vd("core/keyboard-shortcuts").unregisterShortcut(gd)}}),[r]),r?React.createElement(hd,null,React.createElement(yd,null,u?React.createElement("div",{style:{textAlign:"center",padding:20}},React.createElement(dd,null)):React.createElement(React.Fragment,null,React.createElement(md,{ref:t,label:React.createElement(React.Fragment,null,React.createElement(Pt,{icon:"wand",style:{marginBottom:-4}}),"AI Copilot"),value:i,placeholder:h?"Describe the image...":"Write about...",onChange:function(e){return l(e)},onKeyDown:E,onCompositionStart:function(){return d(!0)},onCompositionEnd:function(){return d(!1)}}),React.createElement("div",{style:{display:"flex",justifyContent:"end",marginBottom:-12}},React.createElement(pd,{label:"Image Mode",checked:h,onChange:y}))))):React.createElement("div",{onCompositionStart:function(){return d(!0)},onCompositionEnd:function(){return d(!1)},onKeyDown:function(e){var t,n;if(!m){var r=((null==e||null===(t=e.target)||void 0===t?void 0:t.innerText)||"").trim(),o=null==e||null===(n=e.target)||void 0===n?void 0:n.localName;"Space"!==e.code||r||"p"!==o||(e.preventDefault(),a(!0))}}},React.createElement(e.BlockEdit,e))},id("editor.BlockEdit","mwai-copilot/module",(function(e){return function(t){return"core/paragraph"===t.name?React.createElement(Zp,ed({BlockEdit:e},t)):React.createElement(e,t)}})),id("blocks.registerBlockType","mwai-copilot/placeholder",(function(e,t){if("core/paragraph"===t){var n=e.edit;e.edit=function(e){return e=Zm(Zm({},e),{},{attributes:Zm(Zm({},e.attributes),{},{placeholder:"Type / to choose a block, or press space to summon the AI Copilot"})}),n(e)}}return e}))),document.addEventListener("DOMContentLoaded",(function(){var e=document.getElementById("mwai-admin-settings");e&&eh(React.createElement(u.Ht,{client:th},React.createElement(s.A,null,React.createElement(fs,null))),e);var t=document.getElementById("mwai-content-generator");t&&eh(React.createElement(u.Ht,{client:th},React.createElement(s.A,null,React.createElement(em,null))),t);var n=document.getElementById("mwai-image-generator");n&&eh(React.createElement(u.Ht,{client:th},React.createElement(s.A,null,React.createElement(Em,null))),n);var r=document.getElementById("mwai-playground");if(r&&eh(React.createElement(u.Ht,{client:th},React.createElement(s.A,null,React.createElement(nf,null))),r),rh){var a=document.getElementById("mwai-admin-postsList");a&&eh(React.createElement(s.A,null,React.createElement(Gf,null)),a)}var o=document.getElementById("meow-common-dashboard");o&&eh(React.createElement(u.Ht,{client:th},React.createElement(s.A,null,React.createElement(be,null))),o)}))},1594:e=>{e.exports=React},5206:e=>{e.exports=ReactDOM}},__webpack_module_cache__={},deferred;function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(n.exports,n,n.exports,__webpack_require__),n.exports}__webpack_require__.m=__webpack_modules__,__webpack_require__.amdO={},deferred=[],__webpack_require__.O=(e,t,n,r)=>{if(!t){var a=1/0;for(c=0;c<deferred.length;c++){for(var[t,n,r]=deferred[c],o=!0,i=0;i<t.length;i++)(!1&r||a>=r)&&Object.keys(__webpack_require__.O).every((e=>__webpack_require__.O[e](t[i])))?t.splice(i--,1):(o=!1,r<a&&(a=r));if(o){deferred.splice(c--,1);var l=n();void 0!==l&&(e=l)}}return e}r=r||0;for(var c=deferred.length;c>0&&deferred[c-1][2]>r;c--)deferred[c]=deferred[c-1];deferred[c]=[t,n,r]},__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={57:0};__webpack_require__.O.j=t=>0===e[t];var t=(t,n)=>{var r,a,[o,i,l]=n,c=0;if(o.some((t=>0!==e[t]))){for(r in i)__webpack_require__.o(i,r)&&(__webpack_require__.m[r]=i[r]);if(l)var u=l(__webpack_require__)}for(t&&t(n);c<o.length;c++)a=o[c],__webpack_require__.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return __webpack_require__.O(u)},n=self.wpJsonMwai=self.wpJsonMwai||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),__webpack_require__.nc=void 0;var __webpack_exports__=__webpack_require__.O(void 0,[121],(()=>__webpack_require__(158)));__webpack_exports__=__webpack_require__.O(__webpack_exports__)})();
     2(()=>{"use strict";var __webpack_modules__={1469:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{G:()=>ChatbotContextProvider,o:()=>useChatbotContext});var _neko_ui__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(8135),_app_chatbot_helpers__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(6966),_app_chatbot_MwaiAPI__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(1137),_app_helpers__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(7678);function _typeof(e){return _typeof="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},_typeof(e)}var _excluded=["children"];function ownKeys(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 _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach((function(t){_defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _createForOfIteratorHelper(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){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 _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==_typeof(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(_typeof(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 asyncGeneratorStep(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){asyncGeneratorStep(o,r,a,i,l,"next",e)}function l(e){asyncGeneratorStep(o,r,a,i,l,"throw",e)}i(void 0)}))}}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(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)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(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 _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _objectWithoutProperties(e,t){if(null==e)return{};var n,r,a=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}var _wp$element=wp.element,useContext=_wp$element.useContext,createContext=_wp$element.createContext,useState=_wp$element.useState,useMemo=_wp$element.useMemo,useEffect=_wp$element.useEffect,useCallback=_wp$element.useCallback,useRef=_wp$element.useRef,rawAiName="AI: ",rawUserName="User: ",ChatbotContext=createContext(),useChatbotContext=function(){var e=useContext(ChatbotContext);if(!e)throw new Error("useChatbotContext must be used within a ChatbotContextProvider");return e},ChatbotContextProvider=function ChatbotContextProvider(_ref){var _system$typewriter,_system$speech_recogn,_system$speech_synthe,_params$startSentence,_params$startSentence2,children=_ref.children,rest=_objectWithoutProperties(_ref,_excluded),params=rest.params,system=rest.system,theme=rest.theme,atts=rest.atts,_useChrono=(0,_app_chatbot_helpers__WEBPACK_IMPORTED_MODULE_0__.dh)(),timeElapsed=_useChrono.timeElapsed,startChrono=_useChrono.startChrono,stopChrono=_useChrono.stopChrono,shortcodeStyles=useMemo((function(){return(null==theme?void 0:theme.settings)||{}}),[theme]),_useState=useState(system.restNonce),_useState2=_slicedToArray(_useState,2),restNonce=_useState2[0],setRestNonce=_useState2[1],_useState3=useState([]),_useState4=_slicedToArray(_useState3,2),messages=_useState4[0],setMessages=_useState4[1],_useState5=useState([]),_useState6=_slicedToArray(_useState5,2),shortcuts=_useState6[0],setShortcuts=_useState6[1],_useState7=useState([]),_useState8=_slicedToArray(_useState7,2),blocks=_useState8[0],setBlocks=_useState8[1],_useState9=useState(!1),_useState10=_slicedToArray(_useState9,2),locked=_useState10[0],setLocked=_useState10[1],_useState11=useState((0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.vx)()),_useState12=_slicedToArray(_useState11,2),chatId=_useState12[0],setChatId=_useState12[1],_useState13=useState(""),_useState14=_slicedToArray(_useState13,2),inputText=_useState14[0],setInputText=_useState14[1],_useState15=useState(!1),_useState16=_slicedToArray(_useState15,2),chatbotTriggered=_useState16[0],setChatbotTriggered=_useState16[1],_useState17=useState(!1),_useState18=_slicedToArray(_useState17,2),showIconMessage=_useState18[0],setShowIconMessage=_useState18[1],_useState19=useState({localFile:null,uploadedId:null,uploadedUrl:null,uploadProgress:null}),_useState20=_slicedToArray(_useState19,2),uploadedFile=_useState20[0],setUploadedFile=_useState20[1],_useState21=useState(!0),_useState22=_slicedToArray(_useState21,2),windowed=_useState22[0],setWindowed=_useState22[1],_useState23=useState(!1),_useState24=_slicedToArray(_useState23,2),open=_useState24[0],setOpen=_useState24[1],_useState25=useState(null),_useState26=_slicedToArray(_useState25,2),error=_useState26[0],setError=_useState26[1],_useState27=useState(!1),_useState28=_slicedToArray(_useState27,2),busy=_useState28[0],setBusy=_useState28[1],_useState29=useState(!1),_useState30=_slicedToArray(_useState29,2),busyNonce=_useState30[0],setBusyNonce=_useState30[1],_useState31=useState(),_useState32=_slicedToArray(_useState31,2),serverReply=_useState32[0],setServerReply=_useState32[1],chatbotInputRef=useRef(),conversationRef=useRef(),hasFocusRef=useRef(!1),_useSpeechRecognition=(0,_app_chatbot_helpers__WEBPACK_IMPORTED_MODULE_0__.Vw)((function(e){setInputText(e)})),isListening=_useSpeechRecognition.isListening,setIsListening=_useSpeechRecognition.setIsListening,speechRecognitionAvailable=_useSpeechRecognition.speechRecognitionAvailable,stream=system.stream||!1,internalId=useMemo((function(){return(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.vx)()}),[]),botId=system.botId,customId=system.customId,userData=system.userData,sessionId=system.sessionId,contextId=system.contextId,pluginUrl=system.pluginUrl,restUrl=system.restUrl,debugMode=system.debugMode,virtualKeyboardFix=system.virtual_keyboard_fix,typewriter=null!==(_system$typewriter=null==system?void 0:system.typewriter)&&void 0!==_system$typewriter&&_system$typewriter,speechRecognition=null!==(_system$speech_recogn=null==system?void 0:system.speech_recognition)&&void 0!==_system$speech_recogn&&_system$speech_recogn,speechSynthesis=null!==(_system$speech_synthe=null==system?void 0:system.speech_synthesis)&&void 0!==_system$speech_synthe&&_system$speech_synthe,startSentence=(0,_app_chatbot_helpers__WEBPACK_IMPORTED_MODULE_0__.Mc)(null!==(_params$startSentence=null===(_params$startSentence2=params.startSentence)||void 0===_params$startSentence2?void 0:_params$startSentence2.trim())&&void 0!==_params$startSentence?_params$startSentence:"",userData),initialActions=system.actions||[],initialShortcuts=system.shortcuts||[],initialBlocks=system.blocks||[],isMobile=document.innerWidth<=768,processedParams=(0,_app_chatbot_helpers__WEBPACK_IMPORTED_MODULE_0__._$)(params,userData),aiName=processedParams.aiName,userName=processedParams.userName,guestName=processedParams.guestName,aiAvatar=processedParams.aiAvatar,userAvatar=processedParams.userAvatar,guestAvatar=processedParams.guestAvatar,textSend=processedParams.textSend,textClear=processedParams.textClear,textInputMaxLength=processedParams.textInputMaxLength,textInputPlaceholder=processedParams.textInputPlaceholder,textCompliance=processedParams.textCompliance,isWindow=processedParams.window,copyButton=processedParams.copyButton,fullscreen=processedParams.fullscreen,localMemoryParam=processedParams.localMemory,icon=processedParams.icon,iconText=processedParams.iconText,iconTextDelay=processedParams.iconTextDelay,iconAlt=processedParams.iconAlt,iconPosition=processedParams.iconPosition,iconBubble=processedParams.iconBubble,imageUpload=processedParams.imageUpload,fileSearch=processedParams.fileSearch,localMemory=localMemoryParam&&(!!customId||!!botId),localStorageKey=localMemory?"mwai-chat-".concat(customId||botId):null,_useMemo=useMemo((function(){var e=function(e){return e?(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.Ve)(e)||(0,_app_chatbot_helpers__WEBPACK_IMPORTED_MODULE_0__.mv)(e)?e:"".concat(pluginUrl,"/images/").concat(e):null},t=icon?e(icon):"".concat(pluginUrl,"/images/chat-traditional-1.svg"),n=e(processedParams.aiAvatarUrl),r=e(processedParams.userAvatarUrl),a=e(processedParams.guestAvatarUrl);return{cssVariables:Object.keys(shortcodeStyles).reduce((function(e,t){return e["--mwai-".concat(t)]=shortcodeStyles[t],e}),{}),iconUrl:t,aiAvatarUrl:n,userAvatarUrl:r,guestAvatarUrl:a}}),[icon,pluginUrl,shortcodeStyles,processedParams]),cssVariables=_useMemo.cssVariables,iconUrl=_useMemo.iconUrl,aiAvatarUrl=_useMemo.aiAvatarUrl,userAvatarUrl=_useMemo.userAvatarUrl,guestAvatarUrl=_useMemo.guestAvatarUrl,_useState33=useState(!1),_useState34=_slicedToArray(_useState33,2),draggingType=_useState34[0],setDraggingType=_useState34[1],_useState35=useState(!1),_useState36=_slicedToArray(_useState35,2),isBlocked=_useState36[0],setIsBlocked=_useState36[1],uploadIconPosition=useMemo((function(){return"timeless"===(null==theme?void 0:theme.themeId)?"mwai-tools":"mwai-input"}),[null==theme?void 0:theme.themeId]),submitButtonConf=useMemo((function(){return{text:textSend,textSend,textClear,imageSend:"timeless"===(null==theme?void 0:theme.themeId)?pluginUrl+"/images/action-submit-blue.svg":null,imageClear:"timeless"===(null==theme?void 0:theme.themeId)?pluginUrl+"/images/action-clear-blue.svg":null}}),[pluginUrl,textClear,textSend,null==theme?void 0:theme.themeId]),resetMessages=function(){if(resetUploadedFile(),startSentence){var e=[{id:(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.vx)(),role:"assistant",content:startSentence,who:rawAiName,timestamp:(new Date).getTime()}];setMessages(e)}else setMessages([])},refreshRestNonce=useCallback(_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,n,r,a=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]&&a[0],e.prev=1,t||!restNonce){e.next=4;break}return e.abrupt("return",restNonce);case 4:return setBusyNonce(!0),e.next=7,(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.ti)("".concat(restUrl,"/mwai/v1/start_session"));case 7:return n=e.sent,e.next=10,n.json();case 10:return r=e.sent,setRestNonce(r.restNonce),e.abrupt("return",r.restNonce);case 15:e.prev=15,e.t0=e.catch(1),console.error("Error while fetching the restNonce.",e.t0);case 18:return e.prev=18,setBusyNonce(!1),e.finish(18);case 21:case"end":return e.stop()}}),e,null,[[1,15,18,21]])}))),[restNonce,setRestNonce,restUrl]);useEffect((function(){initialActions.length>0&&handleActions(initialActions),initialShortcuts.length>0&&handleShortcuts(initialShortcuts),initialBlocks.length>0&&handleBlocks(initialBlocks)}),[]),useEffect((function(){chatbotTriggered&&!restNonce&&refreshRestNonce()}),[chatbotTriggered]),useEffect((function(){inputText.length>0&&!chatbotTriggered&&setChatbotTriggered(!0)}),[chatbotTriggered,inputText]),useEffect((function(){resetMessages()}),[startSentence]),useEffect((function(){if(customId||botId){var e=_app_chatbot_MwaiAPI__WEBPACK_IMPORTED_MODULE_2__.HX.chatbots.findIndex((function(e){return e.internalId===internalId})),t={internalId,botId,chatId,customId,open:function(){setTasks((function(e){return[].concat(_toConsumableArray(e),[{action:"open"}])}))},close:function(){setTasks((function(e){return[].concat(_toConsumableArray(e),[{action:"close"}])}))},clear:function(){setTasks((function(e){return[].concat(_toConsumableArray(e),[{action:"clear"}])}))},toggle:function(){setTasks((function(e){return[].concat(_toConsumableArray(e),[{action:"toggle"}])}))},ask:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];setTasks((function(n){return[].concat(_toConsumableArray(n),[{action:"ask",data:{text:e,submit:t}}])}))},lock:function(){setLocked(!0)},unlock:function(){setLocked(!1)},setShortcuts:function(e){setTasks((function(t){return[].concat(_toConsumableArray(t),[{action:"setShortcuts",data:e}])}))},setBlocks:function(e){setTasks((function(t){return[].concat(_toConsumableArray(t),[{action:"setBlocks",data:e}])}))},setContext:function(e){var t=e.chatId,n=e.messages;setTasks((function(e){return[].concat(_toConsumableArray(e),[{action:"setContext",data:{chatId:t,messages:n}}])}))}};-1!==e?_app_chatbot_MwaiAPI__WEBPACK_IMPORTED_MODULE_2__.HX.chatbots[e]=t:_app_chatbot_MwaiAPI__WEBPACK_IMPORTED_MODULE_2__.HX.chatbots.push(t)}}),[botId,chatId,customId,internalId]),useEffect((function(){busy?startChrono():(!isMobile&&hasFocusRef.current&&chatbotInputRef.current.focusInput(),stopChrono())}),[busy,startChrono,stopChrono,isMobile]);var saveMessages=useCallback((function(e){localStorageKey&&localStorage.setItem(localStorageKey,(0,_neko_ui__WEBPACK_IMPORTED_MODULE_3__.F1)({chatId,messages:e}))}),[localStorageKey,chatId]),resetError=function(){setError(null)};useEffect((function(){var e=[];if(localStorageKey&&(e=localStorage.getItem(localStorageKey)))return e=JSON.parse(e),setMessages(e.messages),void setChatId(e.chatId);resetMessages()}),[botId]);var handleActions=useCallback((function(actions,lastMessage){actions=actions||[];var callsCount=0,_iterator=_createForOfIteratorHelper(actions),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var action=_step.value;if("function"===action.type){var data=action.data||{},_data$name=data.name,name=void 0===_data$name?null:_data$name,_data$args=data.args,args=void 0===_data$args?[]:_data$args,finalArgs=args?Object.values(args).map((function(e){return JSON.stringify(e)})):[];try{debugMode&&console.log("[CHATBOT] CALL ".concat(name,"(").concat(finalArgs.join(", "),")")),eval("".concat(name,"(").concat(finalArgs.join(", "),")")),callsCount++}catch(e){console.error("Error while executing an action.",e)}}}}catch(e){_iterator.e(e)}finally{_iterator.f()}!lastMessage.content&&callsCount>0&&(lastMessage.content="*Done!*")}),[debugMode]),handleShortcuts=useCallback((function(e){setShortcuts(e||[])}),[]),handleBlocks=useCallback((function(e){setBlocks(e||[])}),[]);useEffect((function(){if(serverReply){setBusy(!1);var e=_toConsumableArray(messages),t=e.length>0?e[e.length-1]:null;if(!serverReply.success)return"assistant"===t.role&&t.isQuerying&&e.pop(),e.pop(),e.push({id:(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.vx)(),role:"system",content:serverReply.message,who:rawAiName,timestamp:(new Date).getTime()}),setMessages(e),void saveMessages(e);if("assistant"===t.role&&t.isQuerying)t.content=(0,_app_chatbot_MwaiAPI__WEBPACK_IMPORTED_MODULE_2__.W5)("ai.reply",serverReply.reply,{chatId,botId}),serverReply.images&&(t.images=serverReply.images),t.timestamp=(new Date).getTime(),delete t.isQuerying,handleActions(null==serverReply?void 0:serverReply.actions,t),handleBlocks(null==serverReply?void 0:serverReply.blocks),handleShortcuts(null==serverReply?void 0:serverReply.shortcuts);else if("assistant"===t.role&&t.isStreaming)t.content=(0,_app_chatbot_MwaiAPI__WEBPACK_IMPORTED_MODULE_2__.W5)("ai.reply",serverReply.reply,{chatId,botId}),serverReply.images&&(t.images=serverReply.images),t.timestamp=(new Date).getTime(),delete t.isStreaming,handleActions(null==serverReply?void 0:serverReply.actions,t),handleBlocks(null==serverReply?void 0:serverReply.blocks),handleShortcuts(null==serverReply?void 0:serverReply.shortcuts);else{var n={id:(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.vx)(),role:"assistant",content:(0,_app_chatbot_MwaiAPI__WEBPACK_IMPORTED_MODULE_2__.W5)("ai.reply",serverReply.reply,{botId,chatId,customId}),who:rawAiName,timestamp:(new Date).getTime()};serverReply.images&&(n.images=serverReply.images),handleActions(null==serverReply?void 0:serverReply.actions,n),handleBlocks(null==serverReply?void 0:serverReply.blocks),handleShortcuts(null==serverReply?void 0:serverReply.shortcuts),e.push(n)}setMessages(e),saveMessages(e)}}),[serverReply]);var onClear=useCallback(_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,setChatId((0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.vx)());case 2:localStorageKey&&localStorage.removeItem(localStorageKey),resetMessages(),setInputText(""),setShortcuts([]),setBlocks([]);case 7:case"end":return e.stop()}}),e)}))),[botId]),onSubmit=useCallback(function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var n,r,a,o,i,l,c,u,s,f,m,d,p,h,y;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!busy){e.next=3;break}return console.error("AI Engine: There is already a query in progress."),e.abrupt("return");case 3:if("string"!=typeof t&&(t=inputText),r=uploadedFile,a=null==uploadedFile?void 0:uploadedFile.uploadedUrl,o=null==uploadedFile||null===(n=uploadedFile.localFile)||void 0===n?void 0:n.type,i=!!o&&o.startsWith("image"),l=t,a&&(l=i?"![Uploaded Image](".concat(a,")\n").concat(t):"[Uploaded File](".concat(a,")\n").concat(t)),setBusy(!0),setInputText(""),setShortcuts([]),setBlocks([]),resetUploadedFile(),c=[].concat(_toConsumableArray(messages),[{id:(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.vx)(),role:"user",content:l,who:rawUserName,timestamp:(new Date).getTime()}]),saveMessages(c),u=(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.vx)(),s=[].concat(_toConsumableArray(c),[{id:u,role:"assistant",content:null,who:rawAiName,timestamp:null,isQuerying:!stream,isStreaming:!!stream}]),setMessages(s),f=_objectSpread({botId,customId,session:sessionId,chatId,contextId,messages,newMessage:t,newFileId:null==r?void 0:r.uploadedId,stream},atts),e.prev=21,debugMode&&console.log("[CHATBOT] OUT: ",f),m=stream?function(e){setMessages((function(t){var n=_toConsumableArray(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,null==restNonce){e.next=28;break}e.t0=restNonce,e.next=31;break;case 28:return e.next=30,refreshRestNonce();case 30:e.t0=e.sent;case 31:return d=e.t0,e.next=34,(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.ti)("".concat(restUrl,"/mwai-ui/v1/chats/submit"),f,d,stream);case 34:return p=e.sent,e.next=37,(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.Pn)(p,m,debugMode?"CHATBOT":null);case 37:if((h=e.sent).success||!h.message){e.next=47;break}return setError(h.message),(y=_toConsumableArray(s)).pop(),y.pop(),setMessages(y),saveMessages(y),setBusy(!1),e.abrupt("return");case 47:setServerReply(h),e.next=54;break;case 50:e.prev=50,e.t1=e.catch(21),console.error("An error happened in the handling of the chatbot response.",{err:e.t1}),setBusy(!1);case 54:case"end":return e.stop()}}),e,null,[[21,50]])})));return function(t){return e.apply(this,arguments)}}(),[busy,uploadedFile,messages,saveMessages,stream,botId,customId,sessionId,chatId,contextId,atts,inputText,debugMode,restNonce,refreshRestNonce,restUrl]),onSubmitAction=useCallback((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=!(null==uploadedFile||!uploadedFile.uploadedId);hasFocusRef.current=document.activeElement===chatbotInputRef.current.currentElement(),e?onSubmit(e):(t||inputText.length>0)&&onSubmit(inputText)}),[inputText,onSubmit,null==uploadedFile?void 0:uploadedFile.uploadedId]),onFileUpload=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var n,r,a,o,i,l,c=arguments;return _regeneratorRuntime().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 resetUploadedFile(),e.abrupt("return");case 6:if(a={type:n,purpose:r},o="".concat(restUrl,"/mwai-ui/v1/files/upload"),null==restNonce){e.next=12;break}e.t0=restNonce,e.next=15;break;case 12:return e.next=14,refreshRestNonce();case 14:e.t0=e.sent;case 15:return i=e.t0,e.next=18,(0,_app_helpers__WEBPACK_IMPORTED_MODULE_1__.uE)(o,t,i,(function(e){setUploadedFile({localFile:t,uploadedId:null,uploadedUrl:null,uploadProgress:e})}),a);case 18:l=e.sent,setUploadedFile({localFile:t,uploadedId:l.data.id,uploadedUrl:l.data.url,uploadProgress:null}),e.next=27;break;case 22:e.prev=22,e.t1=e.catch(2),console.error("onFileUpload Error",e.t1),setError(e.t1.message||"An unknown error occurred"),resetUploadedFile();case 27:case"end":return e.stop()}}),e,null,[[2,22]])})));return function(t){return e.apply(this,arguments)}}(),onUploadFile=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return error&&resetError(),e.abrupt("return",onFileUpload(t));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),resetUploadedFile=function(){setUploadedFile({localFile:null,uploadedId:null,uploadedUrl:null,uploadProgress:null})},runTimer=useCallback((function(){var e=setTimeout((function(){setOpen((function(e){return e||setShowIconMessage(!0),e}))}),1e3*iconTextDelay);return function(){return clearTimeout(e)}}),[iconText,iconTextDelay]);useEffect((function(){if(iconText&&!iconTextDelay)setShowIconMessage(!0);else if(iconText&&iconTextDelay)return runTimer()}),[iconText]);var _useState37=useState([]),_useState38=_slicedToArray(_useState37,2),tasks=_useState38[0],setTasks=_useState38[1],runTasks=useCallback(_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,n,r,a,o,i,l,c;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:tasks.length>0&&("ask"===(t=tasks[0]).action?(n=t.data,r=n.text,n.submit?onSubmit(r):setInputText(r)):"toggle"===t.action?setOpen((function(e){return!e})):"open"===t.action?setOpen(!0):"close"===t.action?setOpen(!1):"clear"===t.action?onClear():"setContext"===t.action?(a=t.data,o=a.chatId,i=a.messages,setChatId(o),setMessages(i)):"setShortcuts"===t.action?(l=t.data,handleShortcuts(l)):"setBlocks"===t.action&&(c=t.data,handleBlocks(c)),setTasks((function(e){return e.slice(1)})));case 1:case"end":return e.stop()}}),e)}))),[tasks,onClear,onSubmit,setChatId,setInputText,setMessages,setOpen,handleShortcuts,handleBlocks]);useEffect((function(){runTasks()}),[runTasks]);var actions={setInputText,saveMessages,setMessages,resetMessages,resetError,onClear,onSubmit,onSubmitAction,onFileUpload,onUploadFile,setOpen,setWindowed,setShowIconMessage,setIsListening,setDraggingType,setIsBlocked},state={theme,botId,customId,userData,pluginUrl,inputText,messages,shortcuts,blocks,busy,error,setBusy,typewriter,speechRecognition,speechSynthesis,virtualKeyboardFix,localMemory,imageUpload,uploadedFile,fileSearch,textSend,textClear,textInputMaxLength,textInputPlaceholder,textCompliance,aiName,userName,guestName,aiAvatar,userAvatar,guestAvatar,aiAvatarUrl,userAvatarUrl,guestAvatarUrl,isWindow,copyButton,fullscreen,icon,iconText,iconAlt,iconPosition,iconBubble,cssVariables,iconUrl,chatbotInputRef,conversationRef,isMobile,open,locked,windowed,showIconMessage,timeElapsed,isListening,speechRecognitionAvailable,uploadIconPosition,submitButtonConf,draggingType,isBlocked,busyNonce};return React.createElement(ChatbotContext.Provider,{value:{state,actions}},children)}},1137:(e,t,n)=>{function r(e){return r="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},r(e)}function a(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,o(r.key),r)}}function o(e){var t=function(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,"string");if("object"!=r(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:String(t)}n.d(t,{HX:()=>l,W5:()=>c});var i=function(){function e(){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),"undefined"!=typeof window&&window.MwaiAPI)return window.MwaiAPI;this.chatbots=[],this.filters={},this.actions={},"undefined"!=typeof window&&(window.MwaiAPI=this)}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),a=2;a<n;a++)r[a-2]=arguments[a];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&&a(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),l=function(){if("undefined"!=typeof window&&window.MwaiAPI)return window.MwaiAPI;var e=new i;return"undefined"!=typeof window&&(window.MwaiAPI=e),e}(),c=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),a=2;a<n;a++)r[a-2]=arguments[a];return l.applyFilters.apply(l,[e,t].concat(r))}},6966:(e,t,n)=>{n.d(t,{$$:()=>y,Mc:()=>b,Vw:()=>R,_$:()=>w,bE:()=>O,dh:()=>E,gR:()=>v,kW:()=>_,mv:()=>g,tm:()=>h});var r=["active","disabled"],a=["if","className","disableTransition","children"];function o(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(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)?i(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 i(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 l(){return l=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},l.apply(this,arguments)}function c(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var u=wp.element,s=u.useState,f=u.useMemo,m=u.useEffect,d=u.useRef,p=u.useCallback,h=function(e){var t=e.active,n=e.disabled,a=c(e,r);return React.createElement("div",l({active:t?"true":"false",disabled:n},a),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"/>'}}))};function y(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=d();m((function(){r.current=t}),[t]),m((function(){if(null!==e&&n){var t=setInterval((function(){r.current()}),e);return function(){return clearInterval(t)}}}),[e,n])}var v=function(){return f((function(){return function(e,t){return Array.isArray(e)||(e=[e]),t&&Object.entries(t).forEach((function(t){var n=o(t,2),r=n[0];n[1]&&e.push(r)})),e.join(" ")}}),[])};function g(e){return!(!e||"string"!=typeof e)&&0===e.indexOf("http")}function E(){var e=o(s(null),2),t=e[0],n=e[1],r=d(null);return m((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,a,o=Math.floor((Date.now()-e)/1e3);n((t=o,r=Math.floor(t/60),a=t%60,"".concat(r,":").concat(a.toString().padStart(2,"0"))))}),500)}},stopChrono:function(){clearInterval(r.current),r.current=null,n(null)}}}var b=function(e,t){return"string"==typeof e&&t?(Object.entries(t).forEach((function(t){var n=o(t,2),r=n[0],a=n[1];e=e.replace(new RegExp("{".concat(r,"}"),"g"),a)})),e):e},w=function(e){var t,n,r,a,o,i,l,c,u,s,f,m,d,p,h,y,v,g,E,w,R,O,_,x,S,T,N,C,I=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],A=null!==(t=null===(n=e.guestName)||void 0===n?void 0:n.trim())&&void 0!==t?t:"",k=null!==(r=null===(a=e.textSend)||void 0===a?void 0:a.trim())&&void 0!==r?r:"",L=null!==(o=null===(i=e.textClear)||void 0===i?void 0:i.trim())&&void 0!==o?o:"",M=parseInt(e.textInputMaxLength),P=null!==(l=null===(c=e.textInputPlaceholder)||void 0===c?void 0:c.trim())&&void 0!==l?l:"",j=null!==(u=null===(s=e.textCompliance)||void 0===s?void 0:s.trim())&&void 0!==u?u:"",F=Boolean(e.window),D=Boolean(e.copyButton),G=Boolean(e.fullscreen),U=null!==(f=null===(m=e.icon)||void 0===m?void 0:m.trim())&&void 0!==f?f:"",B=null!==(d=null===(p=e.iconText)||void 0===p?void 0:p.trim())&&void 0!==d?d:"",H=parseInt(e.iconTextDelay||1),Y=null!==(h=null===(y=e.iconAlt)||void 0===y?void 0:y.trim())&&void 0!==h?h:"",z=null!==(v=null===(g=e.iconPosition)||void 0===g?void 0:g.trim())&&void 0!==v?v:"",W=Boolean(e.iconBubble),V=null!==(E=null===(w=e.aiName)||void 0===w?void 0:w.trim())&&void 0!==E?E:"",K=null!==(R=null===(O=e.userName)||void 0===O?void 0:O.trim())&&void 0!==R?R:"",q=Boolean(null==e?void 0:e.aiAvatar),X=Boolean(null==e?void 0:e.userAvatar),$=Boolean(null==e?void 0:e.guestAvatar),Q=q?null!==(_=null==e||null===(x=e.aiAvatarUrl)||void 0===x?void 0:x.trim())&&void 0!==_?_:"":null,J=X?null!==(S=null==e||null===(T=e.userAvatarUrl)||void 0===T?void 0:T.trim())&&void 0!==S?S:"":null,Z=$?null!==(N=null==e||null===(C=e.guestAvatarUrl)||void 0===C?void 0:C.trim())&&void 0!==N?N:"":null,ee=Boolean(e.localMemory),te=Boolean(e.imageUpload),ne=Boolean(e.fileSearch);return I&&(j=b(j,I),B=b(B,I)),{textSend:k,textClear:L,textInputMaxLength:M,textInputPlaceholder:P,textCompliance:j,window:F,copyButton:D,fullscreen:G,localMemory:ee,imageUpload:te,fileSearch:ne,icon:U,iconText:B,iconTextDelay:H,iconAlt:Y,iconPosition:z,iconBubble:W,aiName:V,userName:K,guestName:A,aiAvatar:q,userAvatar:X,guestAvatar:$,aiAvatarUrl:Q,userAvatarUrl:J,guestAvatarUrl:Z}},R=function(e){var t=o(s(!1),2),n=t[0],r=t[1],a=o(s(!1),2),i=a[0],l=a[1];return m((function(){"undefined"!=typeof window&&("SpeechRecognition"in window||"webkitSpeechRecognition"in window)&&l(!0)}),[]),m((function(){if(i){var t=new(window.SpeechRecognition||window.webkitSpeechRecognition),a=null;return navigator.userAgent.toLowerCase().indexOf("android")>-1?(t.interimResults=!1,t.continuous=!1,a=function(t){var n=Array.from(t.results).filter((function(e){return e.isFinal})).map((function(e){return e[0].transcript})).join("");e(n),r(!1)}):(t.interimResults=!0,t.continuous=!0,a=function(t){var n=Array.from(t.results).map((function(e){return e[0]})).map((function(e){return e.transcript})).join("");e(n)}),n?(t.addEventListener("result",a),t.start()):(t.removeEventListener("result",a),t.abort()),function(){t.abort()}}}),[n,i]),{isListening:n,setIsListening:r,speechRecognitionAvailable:i}},O=function(e){var t=e.if,n=e.className,r=e.disableTransition,i=void 0!==r&&r,u=e.children,f=c(e,a),d=o(s(!1),2),p=d[0],h=d[1],y=o(s("mwai-transition"),2),v=y[0],g=y[1];return m((function(){i?h(t):t?(h(!0),setTimeout((function(){g("mwai-transition mwai-transition-visible")}),150)):g("mwai-transition")}),[t,i]),p?React.createElement("div",l({className:"".concat(n," ").concat(i?"":v),onTransitionEnd:function(){"mwai-transition"!==v||i||h(!1)}},f),u):null},_=function(){var e=o(s(window.visualViewport.height),2),t=e[0],n=e[1],r=f((function(){return/Android/.test(navigator.userAgent)}),[]),a=f((function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream}),[]),i=d(window.visualViewport),l=p((function(){n(i.current.height)}),[]);return m((function(){var e=i.current;return e.addEventListener("resize",l),a?(window.addEventListener("resize",l),document.addEventListener("focusin",l)):e.addEventListener("scroll",l),function(){e.removeEventListener("resize",l),a?(window.removeEventListener("resize",l),document.removeEventListener("focusin",l)):e.removeEventListener("scroll",l)}}),[l,a]),{viewportHeight:t,isIOS:a,isAndroid:r}}},7678:(e,t,n)=>{n.d(t,{CI:()=>O,Pn:()=>h,Ve:()=>x,rn:()=>R,ti:()=>v,uE:()=>E,vx:()=>w});var r=n(8135),a=n(6841);function o(e){return o="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},o(e)}function i(){i=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},l="function"==typeof Symbol?Symbol:{},c=l.iterator||"@@iterator",u=l.asyncIterator||"@@asyncIterator",s=l.toStringTag||"@@toStringTag";function f(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,n){return e[t]=n}}function m(e,t,n,r){var o=t&&t.prototype instanceof E?t:E,i=Object.create(o.prototype),l=new k(r||[]);return a(i,"_invoke",{value:N(e,n,l)}),i}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=m;var p="suspendedStart",h="suspendedYield",y="executing",v="completed",g={};function E(){}function b(){}function w(){}var R={};f(R,c,(function(){return this}));var O=Object.getPrototypeOf,_=O&&O(O(L([])));_&&_!==n&&r.call(_,c)&&(R=_);var x=w.prototype=E.prototype=Object.create(R);function S(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function n(a,i,l,c){var u=d(e[a],e,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==o(f)&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,l,c)}),(function(e){n("throw",e,l,c)})):t.resolve(f).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,c)}))}c(u.arg)}var i;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return i=i?i.then(a,a):a()}})}function N(t,n,r){var a=p;return function(o,i){if(a===y)throw new Error("Generator is already running");if(a===v){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=C(l,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===p)throw a=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=y;var u=d(t,n,r);if("normal"===u.type){if(a=r.done?v:h,u.arg===g)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=v,r.method="throw",r.arg=u.arg)}}}function C(t,n){var r=n.method,a=t.iterator[r];if(a===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")),g;var o=d(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}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 A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[c];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,i=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(o(t)+" is not iterable")}return b.prototype=w,a(x,"constructor",{value:w,configurable:!0}),a(w,"constructor",{value:b,configurable:!0}),b.displayName=f(w,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,f(e,s,"GeneratorFunction")),e.prototype=Object.create(x),e},t.awrap=function(e){return{__await:e}},S(T.prototype),f(T.prototype,u,(function(){return this})),t.AsyncIterator=T,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new T(m(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},S(x),f(x,s,"Generator"),f(x,c,(function(){return this})),f(x,"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,k.prototype={constructor:k,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(i)},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),g},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),g}},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 a=r.arg;A(n)}return a}}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),g}},t}function l(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(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 u(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){u(o,r,a,i,l,"next",e)}function l(e){u(o,r,a,i,l,"throw",e)}i(void 0)}))}}var f=wp.element,m=f.useMemo,d=f.useEffect,p=f.useState;function h(e,t){return y.apply(this,arguments)}function y(){return y=s(i().mark((function e(t,n){var r,a,o,l,c,u,s,f,m,d,p,h,y,v,g=arguments;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=g.length>2&&void 0!==g[2]?g[2]:null,n){e.next=14;break}return e.prev=2,e.next=5,t.json();case 5:return a=e.sent,r&&console.log("[".concat(r,"] IN: "),a),e.abrupt("return",a);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:o=t.body.getReader(),l=new TextDecoder("utf-8"),c="",u="";case 18:return e.next=21,o.read();case 21:if(s=e.sent,f=s.value,m=s.done,c+=l.decode(f,{stream:!0}),!m){e.next=27;break}return e.abrupt("break",68);case 27:d=c.split("\n"),p=0;case 29:if(!(p<d.length-1)){e.next=65;break}if(0===d[p].indexOf("data: ")){e.next=32;break}return e.abrupt("continue",62);case 32:if("live"!==(h=JSON.parse(d[p].replace("data: ",""))).type){e.next=39;break}r&&console.log("[".concat(r," STREAM] LIVE: "),h),u+=h.data,n&&n(u,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,y=JSON.parse(h.data),r&&console.log("[".concat(r," STREAM] END: "),y),e.abrupt("return",y);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:p++,e.next=29;break;case 65:c=d[d.length-1],e.next=18;break;case 68:return e.prev=68,v=JSON.parse(c),r&&console.log("[".concat(r," STREAM] IN: "),v),e.abrupt("return",v);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]])}))),y.apply(this,arguments)}function v(e,t,n,r){return g.apply(this,arguments)}function g(){return(g=s(i().mark((function e(t,n,a,o){var l;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l={"Content-Type":"application/json"},a&&(l["X-WP-Nonce"]=a),o&&(l.Accept="text/event-stream"),e.next=5,fetch("".concat(t),{method:"POST",headers:l,body:(0,r.F1)(n)});case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function E(e,t,n,r){return b.apply(this,arguments)}function b(){return b=s(i().mark((function e(t,n,r,a){var o,c=arguments;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=c.length>4&&void 0!==c[4]?c[4]:{},e.abrupt("return",new Promise((function(e,i){var c=new FormData;c.append("file",n);for(var u=0,s=Object.entries(o);u<s.length;u++){var f=l(s[u],2),m=f[0],d=f[1];c.append(m,d)}var p=new XMLHttpRequest;p.open("POST",t,!0),r&&p.setRequestHeader("X-WP-Nonce",r),p.upload.onprogress=function(e){if(e.lengthComputable&&a){var t=e.loaded/e.total*100;a(t)}},p.onload=function(){if(p.status>=200&&p.status<300)try{var t=JSON.parse(p.responseText);e(t)}catch(e){i({status:p.status,statusText:p.statusText,error:"The server response is not valid JSON"})}else{try{var n=JSON.parse(p.responseText);return void i({status:p.status,message:n.message})}catch(e){}i({status:p.status,statusText:p.statusText})}},p.onerror=function(){i({status:p.status,statusText:p.statusText})},p.send(c)})));case 2:case"end":return e.stop()}}),e)}))),b.apply(this,arguments)}function w(){return Math.random().toString(36).substring(2)}var R=function(){var e=l(p(!0),2),t=e[0],n=e[1];d((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})},O=function(e){var t,n=e.content,r=e.error,o=e.isStreaming,i=e.baseClass,l=void 0===i?"mwai-output-handler":i,c=null!==(t=r||n)&&void 0!==t?t:"";(c.match(/```/g)||[]).length%2!=0?c+="\n```":o&&(c+="<BlinkingCursor />");var u=m((function(){var e=[l];return r&&e.push("mwai-error"),e}),[r]),s=m((function(){return{wrapper:"div",forceWrapper:!0,overrides:{BlinkingCursor:{component:R},a:{props:{target:"_blank"}}}}}),[]);return React.createElement(a.Ay,{options:s,className:u.join(" "),children:c})},_=/([\u2700-\u27BF]|[\uE000-\uF8FF]|[\uD800-\uDFFF]|[\uFE00-\uFE0F]|[\u1F100-\u1F1FF]|[\u1F200-\u1F2FF]|[\u1F300-\u1F5FF]|[\u1F600-\u1F64F]|[\u1F680-\u1F6FF]|[\u1F700-\u1F77F]|[\u1F780-\u1F7FF]|[\u1F800-\u1F8FF]|[\u1F900-\u1F9FF]|[\u1FA00-\u1FA6F])/;function x(e){return e&&2===e.length&&_.test(e)}},158:(e,t,n)=>{var r,a,o,i,l,c=n(5323),u=n(7665),s=n(2564),f=n(9270),m=n(7097),d=n(4977),p=n(7039),h=n(4536),y=n(5263),v=n(6913),g=n(3804),E=n(4547),b=n(3676),w=n(9296),R=n(4461),O=n(8135),_=mwai.prefix,x=mwai.domain,S=mwai.rest_url.replace(/\/+$/,""),T=mwai.api_url.replace(/\/+$/,""),N=mwai.plugin_url.replace(/\/+$/,""),C=mwai.user_data,I="1"===mwai.is_pro,A=I&&"1"===mwai.is_registered,k=mwai.rest_nonce,L=mwai.options,M=mwai.session,P=mwai.themes,j=!!mwai.stream,F=mwai.chatbots,D=n(197),G=n(3185);function U(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var B=G.Ay.div(r||(r=U(["\n  color: white;\n  padding: 15px;\n  margin-bottom: -15px;\n\n  a {\n    color: #7dedff;\n    text-decoration: none;\n  }\n\n  p {\n    font-size: 15px;\n  }\n"]))),H=(0,G.Ay)(R.z)(a||(a=U(["\n\n  .neko-block-title {\n    display: none;\n  }\n\n  .plugin-desc {\n    display: flex;\n    flex-direction: column;\n    margin-left: 15px;\n  }\n\n  .neko-block-content {\n    display: flex;\n    padding: 15px;\n\n    h2 {\n      font-size: 18px;\n      margin: 0;\n\n      a {\n        text-decoration: none;\n      }\n    }\n\n    p {\n      margin: 0px;\n      margin-top: 10px;\n      font-size: 13px;\n      line-height: 1.5;\n    }\n\n    .plugin-actual-desc {\n      font-size: 13px;\n      font-weight: 500;\n    }\n  }\n"]))),Y=G.Ay.img(o||(o=U(["\n  height: 125px;\n  width: auto;\n  border-radius: 10px;\n  background: lightgray;\n"]))),z=G.Ay.div(i||(i=U(["\n\n  margin: 15px;\n\n  .center {\n    background: white;\n    color: black;\n    border-radius: 10px;\n    padding: 10px;\n    max-width: 100%\n    overflow: none;\n\n    h2 {\n      font-size: 26px;\n    }\n\n    table {\n      width: 100%;\n\n      tr td:first-child {\n        width: 220px;\n        font-weight: bold;\n        color: #1e7cba;\n      }\n\n      * {\n        overflow-wrap: anywhere;\n      }\n    }\n  }\n\n  hr {\n    border-color: #1e7cba;\n  }\n"]))),W=G.Ay.ul(l||(l=U(["\n  margin-top: 10px;\n  background: rgb(0, 72, 88);\n  padding: 10px;\n  color: rgb(58, 212, 58);\n  max-height: 600px;\n  min-height: 200px;\n  display: block;\n  font-family: monospace;\n  font-size: 12px;\n  white-space: pre;\n  overflow-x: auto;\n  width: calc(100vw - 276px);\n  color: white;\n\n  .log-date {\n    color: var(--neko-yellow);\n    margin-left: 8px;\n  }\n\n  .log-type {\n    background: #0000004d;\n    padding: 2px 5px;\n    border-radius: 8px;\n    text-transform: uppercase;\n  }\n\n  .log-content {\n    display: block;\n  }\n\n  .log-warning .log-type {\n    background: var(--neko-yellow);\n    color: white;\n  }\n\n  .log-fatal .log-type {\n    background: var(--neko-red);\n    color: white;\n  }\n"])));function V(e){return V="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},V(e)}function K(){K=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==V(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(V(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 q(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function X(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){q(o,r,a,i,l,"next",e)}function l(e){q(o,r,a,i,l,"throw",e)}i(void 0)}))}}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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||Q(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 Q(e,t){if(e){if("string"==typeof e)return J(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)?J(e,t):void 0}}function J(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 Z=wp.element,ee=Z.useState,te=Z.useEffect,ne="".concat(S,"/meow-common/v1"),re=function(e){var t=e.request,n=e.title,r=e.max,a=$(ee(!1),2),o=a[0],i=a[1],l=$(ee([]),2),c=l[0],u=l[1],s=c.length>0?c.reduce((function(e,t){return e+t})):0,f=c.length>0?Math.ceil(s/c.length):0,m=!c.length&&o;return te((function(){o&&setTimeout(X(K().mark((function e(){var n,r,a;return K().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(new Date).getTime(),e.next=3,(0,O.IU)("".concat(ne,"/").concat(t),{method:"POST",nonce:k});case 3:r=(new Date).getTime(),a=r-n,u((function(e){return[].concat(function(e){if(Array.isArray(e))return J(e)}(t=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||Q(t)||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.")}(),[a]);var t}));case 6:case"end":return e.stop()}}),e)}))),1e3)}),[c]),React.createElement(B,{style:{width:200,textAlign:"center"}},React.createElement(d.s,{h2:!0,style:{color:"white"}},n),React.createElement(D.X,{size:200,value:m?r:f,max:r},React.createElement("span",{style:{fontSize:20}},m?"START":f+" ms"),React.createElement("span",{style:{fontSize:12}},m?"YOUR ENGINE":c.length+" requests")),React.createElement(w.M,{style:{width:"100%",marginTop:10},color:o?"#cc3627":"#ccb027",onClick:function(){o||u([]),i(!o)}},o?"Stop":"Start"))};function ae(e){return ae="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},ae(e)}function oe(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ie(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)?ie(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 ie(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 le(){le=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==ae(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(ae(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 ce(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function ue(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){ce(o,r,a,i,l,"next",e)}function l(e){ce(o,r,a,i,l,"throw",e)}i(void 0)}))}}var se=wp.element,fe=se.useState,me=se.useEffect;T&&S&&N||console.error("[@common/dashboard] apiUrl, restUrl and pluginUrl are mandatory.");var de="".concat(S,"/meow-common/v1"),pe=React.createElement(B,null,React.createElement(d.s,{p:!0,style:{lineHeight:"1.5",margin:"0 0 15px 0"}},"Hi! ☀️ Meow Apps isn't your typical plugin suite—it's a passion project led by me, ",React.createElement("a",{target:"_blank",href:"https://jordymeow.com"},"Jordy Meow"),", and a stellar team! 💕 Based in ",React.createElement("a",{target:"_blank",href:"https://offbeatjapan.org"},"Japan"),", we're all about making your WordPress experience smoother and speedier. Our plugins are all about boosting your site's performance and user-friendliness. Ready to level up your WordPress game? Check out ",React.createElement("a",{href:"http://meowapps.com",target:"_blank"},"Meow Apps")," and let's make magic happen! 🌴🙀")),he=React.createElement(B,null,React.createElement(d.s,{p:!0},"The ",React.createElement("b",null,"Empty Request Time")," measures your installation's basic performance by showing the average time needed to process an empty request on your server. To see how disabling plugins affects the results, turn some off and run the test again. Aim for a time under 2,000 ms, but ideally, keep it below 500 ms. The ",React.createElement("b",null,"File Operation Time")," creates a temporary 10MB file each time it runs. ",React.createElement("b",null,"The SQL Request Time")," calculates the total number of posts. This process should be quick and have a similar duration to the Empty Request Time.")),ye=React.createElement(B,null,React.createElement(d.s,{p:!0},"Maintain a streamlined WordPress setup by using essential plugins and a dependable hosting provider. Refrain from self-hosting unless you're an expert. Go further by reading our tutorials:",React.createElement("ul",null,React.createElement("li",null,"⭐️ ",React.createElement("a",{href:"https://meowapps.com/tutorial-improve-seo-wordpress/",target:"_blank"},"SEO Checklist & Optimization")),React.createElement("li",null,"⭐️ ",React.createElement("a",{href:"https://meowapps.com/tutorial-faster-wordpress-optimize/",target:"_blank"},"Optimize your WordPress Speed")),React.createElement("li",null,"⭐️ ",React.createElement("a",{href:"https://meowapps.com/tutorial-optimize-images-wordpress/",target:"_blank"},"Optimize Images (CDN, and so on)")),React.createElement("li",null,"⭐️ ",React.createElement("a",{href:"https://meowapps.com/tutorial-hosting-service-wordpress/",target:"_blank"},"The Best Hosting Services for WordPress"))))),ve=function(){var e=ue(le().mark((function e(){var t;return le().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(de,"/all_settings/"),{method:"POST",nonce:k});case 2:return t=e.sent,e.abrupt("return",t.data);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ge=function(){var e=ue(le().mark((function e(t){var n,r,a;return le().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.value,r=t.id,e.next=3,(0,O.IU)("".concat(de,"/update_option"),{method:"POST",nonce:k,json:{name:r,value:n}});case 3:return a=e.sent,e.abrupt("return",a);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ee=function(){var e=ue(le().mark((function e(){var t;return le().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(de,"/error_logs"),{method:"POST",nonce:k});case 2:return t=e.sent,e.abrupt("return",t.data.reverse());case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),be=function(){var e=(0,u.jE)(),t=oe(fe(!1),2),n=t[0],r=t[1],a=oe(fe(!1),2),o=a[0],i=(a[1],oe(fe(""),2)),l=i[0],c=i[1],s=(0,f.I)({queryKey:["all_settings"],queryFn:ve}),O=s.data,_=s.error,x=(s.isLoading,(0,m.n)({mutationFn:ge,onSuccess:function(){e.invalidateQueries(["all_settings"])}}).mutate),S=(0,m.n)({mutationFn:Ee}),T=S.mutate,N=S.data,C=void 0===N?[]:N,I=null==O?void 0:O.meowapps_hide_meowapps,A=null==O?void 0:O.force_sslverify;me((function(){_&&!n&&(r(!0),console.error("Error from useQuery",_.message))}),[_]),me((function(){var e=document.getElementById("meow-common-phpinfo");c(e.innerHTML)}),[]);var k=function(e,t){x({value:e,id:t})},L=React.createElement(p.d,{title:"Main Menu"},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"meowapps_hide_meowapps",label:"Hide (Not Recommended)",description:React.createElement(d.s,{p:!0},"This will hide the Meow Apps Menu (on the left side) and everything it contains. You can re-enable it through though an option that will be added in Settings → General."),value:"1",disabled:o,checked:I,onChange:k}))),M=React.createElement(p.d,{title:"SSL Verify"},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"force_sslverify",label:"Force (Not Recommended)",description:React.createElement(d.s,{p:!0},"This will enforce the usage of SSL when checking the license or updating the plugin."),value:"1",disabled:o,checked:A,onChange:k})));return React.createElement(v.z,{showRestError:n},React.createElement(g.n,{title:"The Dashboard"}),React.createElement(E.N,null,React.createElement(E.Y,{full:!0},React.createElement(b._,{keepTabOnReload:!0},React.createElement(b.V,{title:"Meow Apps"},pe,React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(H,{title:"AI Engine",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/ai-engine/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/ai-engine/"},"AI Engine")),React.createElement("p",{className:"plugin-actual-desc"},"This is the ultimate AI plugin for WordPress. From a chatbot adapted to your needs to an AI that can write your content for you, API, REST, and more."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/ai-engine/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/ai-engine/"},"Meow Apps"))))),React.createElement(H,{title:"Media Cleaner",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/media-cleaner/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/media-cleaner/"},"Media Cleaner")),React.createElement("p",{className:"plugin-actual-desc"},"Is your Media Library bloated, your database heavy, and your website running slow? Media Cleaner will clean your Media Library from the media entries (and files) which aren't used in your website, as well as broken entries."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/media-cleaner/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/media-cleaner/"},"Meow Apps"))))),React.createElement(H,{title:"Database Cleaner",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/database-cleaner/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/database-cleaner/"},"Database Cleaner")),React.createElement("p",{className:"plugin-actual-desc"},"Not only does Database Cleaner have a user-friendly UI, but it's also equipped to handle large DBs, giving it an edge over other plugins. It's a must-have for any WordPress site."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/database-cleaner/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/database-cleaner/"},"Meow Apps"))))),React.createElement(H,{title:"Media File Renamer",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/media-file-renamer/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/media-file-renamer/"},"Media File Renamer")),React.createElement("p",{className:"plugin-actual-desc"},"Rename and move files directly from the dashboard, manually, automatically or via AI, either individually or in bulk. It's the best way to rename your files."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/media-file-renamer/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/media-file-renamer/"},"Meow Apps"))))),React.createElement(H,{title:"Social Engine",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/social-engine/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/social-engine/"},"Social Engine")),React.createElement("p",{className:"plugin-actual-desc"},'Effortlessly schedule and automate the perfect posts for all your networks. Unlimited capabilities and infinite className="plugin-actual-desc" extensibility, for free!'),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/social-engine/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/social-engine/"},"Meow Apps"))))),React.createElement(H,{title:"Meow Analytics",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/meow-analytics/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/meow-analytics/"},"Meow Analytics")),React.createElement("p",{className:"plugin-actual-desc"},"Google Analytics for your website. Simple and fast."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/meow-analytics/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/meow-analytics/"},"Meow Apps")))))),React.createElement(E.Y,{minimal:!0},React.createElement(H,{title:"Contact Form Block",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/seo-engine/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/seo-engine/"},"SEO Engine")),React.createElement("p",{className:"plugin-actual-desc"},"Optimize your content for SEO and for the AI world, with AI assistants... while keeping everything simple and fast, as it should be! ✌️"),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/seo-engine/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/seo-engine/"},"Meow Apps"))))),React.createElement(H,{title:"Meow Gallery",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/meow-gallery/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/meow-gallery/"},"Meow Gallery")),React.createElement("p",{className:"plugin-actual-desc"},"Fast and beautiful galleries with many layouts. Forget the heavy and slow plugins, use the Meow Gallery for a better experience! 💕"),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/meow-gallery/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/meow-gallery/"},"Meow Apps"))))),React.createElement(H,{title:"Meow Lightbox",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/meow-lightbox/assets/icon-256x256.gif"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/meow-lightbox/"},"Meow Lightbox")),React.createElement("p",{className:"plugin-actual-desc"},"Sleek and performant lightbox with EXIF support."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/meow-lightbox/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/meow-lightbox/"},"Meow Apps"))))),React.createElement(H,{title:"Perfect Images (Retina)",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/wp-retina-2x/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/wp-retina-2x/"},"Perfect Images")),React.createElement("p",{className:"plugin-actual-desc"},"Manage, Optimize, Replace your images with Perfect Images."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/wp-retina-2x/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/wp-retina-2x/"},"Meow Apps"))))),React.createElement(H,{title:"Photo Engine",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/wplr-sync/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/wplr-sync/"},"Photo Engine")),React.createElement("p",{className:"plugin-actual-desc"},"Organize your photos in folders and collections. Synchronize with Lightroom. Simplify and speed up your workflow."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/wplr-sync/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/wplr-sync/"},"Meow Apps"))))),React.createElement(H,{title:"Contact Form Block",className:"primary"},React.createElement(Y,{src:"https://ps.w.org/contact-form-block/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/contact-form-block/"},"Contact Form Block")),React.createElement("p",{className:"plugin-actual-desc"},"Need a very simple but straightforward contact form? This is the one you need. It's fast, simple, and efficient."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/contact-form-block/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/contact-form-block/"},"Meow Apps")))))))),React.createElement(b.V,{title:"Performance"},he,React.createElement("div",{style:{display:"flex",justifyContent:"space-around",marginBottom:25}},React.createElement(re,{title:"Empty Request Time",request:"empty_request",max:2500}),React.createElement(re,{title:"File Operation Time",request:"file_operation",max:2600}),React.createElement(re,{title:"SQL Request Time",request:"sql_request",max:2800})),ye),React.createElement(b.V,{title:"PHP Info"},React.createElement(z,{dangerouslySetInnerHTML:{__html:l}})),React.createElement(b.V,{title:"PHP Error Logs"},React.createElement(B,null,React.createElement(w.M,{style:{marginBottom:10},color:"#ccb027",onClick:function(){T()},disabled:o,isBusy:"isLoadingErrorLogs"===o},"Load PHP Error Logs"),React.createElement(W,null,C.map((function(e){return React.createElement("li",{class:"log-".concat(e.type)},React.createElement("span",{class:"log-type"},e.type),React.createElement("span",{class:"log-date"},e.date),React.createElement("span",{class:"log-content"},e.content))}))),React.createElement(d.s,{p:!0},"If you don't see any errors, your host might not allow remote access to PHP error logs. Contact them for assistance, or look in your hosting control panel."))),React.createElement(b.V,{title:"Settings"},React.createElement(R.z,{title:"Settings",className:"primary"},L,M))))))},we=n(4677),Re=n(8696),Oe=n(8922),_e=n(6734),xe=n(1543),Se=n(8668),Te=n(9794),Ne=n(7213);function Ce(e){return Ce="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},Ce(e)}function Ie(){Ie=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Ce(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Ce(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Ae(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function ke(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Ae(o,r,a,i,l,"next",e)}function l(e){Ae(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Le(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Me(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)?Me(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 Me(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 Pe=wp.element,je=Pe.useState,Fe=Pe.useEffect,De="".concat(S,"/meow-licenser/").concat(_,"/v1"),Ge=function(){var e=Le(je(!1),2),t=e[0],n=e[1],r=Le(je(!1),2),a=r[0],o=r[1],i=Le(je(null),2),l=i[0],c=i[1],u=Le(je(null),2),s=u[0],f=u[1],m=Le(je(""),2),p=m[0],h=m[1],y=A&&(!s||"valid"!==s.license),v=function(){var e=ke(Ie().mark((function e(){var t;return Ie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I){e.next=2;break}return e.abrupt("return");case 2:return n(!0),e.prev=3,e.next=6,(0,O.IU)("".concat(De,"/get_license"),{method:"POST",nonce:k});case 6:t=e.sent,f(t.data),t.data.key&&h(t.data.key),e.next=15;break;case 11:e.prev=11,e.t0=e.catch(3),alert("Error while checking the license. Check your console for more information."),console.error(e.t0);case 15:n(!1);case 16:case"end":return e.stop()}}),e,null,[[3,11]])})));return function(){return e.apply(this,arguments)}}(),g=function(){var e=ke(Ie().mark((function e(){return Ie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n(!0),e.prev=1,e.next=4,(0,O.IU)("".concat(De,"/set_license"),{method:"POST",nonce:k,json:{serialKey:null}});case 4:e.sent.success&&(h(""),f(null),c("licenseRemoved")),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),alert("Error while removing the license. Check your console for more information."),console.error(e.t0);case 12:n(!1);case 13:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(){return e.apply(this,arguments)}}(),E=function(){var e=ke(Ie().mark((function e(){var t;return Ie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n(!0),e.prev=1,e.next=4,(0,O.IU)("".concat(De,"/set_license"),{method:"POST",nonce:k,json:{serialKey:p,override:!0}});case 4:(t=e.sent).success&&(f(t.data),t.data&&!t.data.issue&&c("licenseAdded")),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),alert("Error while forcing the license. Check your console for more information."),console.error(e.t0);case 12:n(!1);case 13:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(){return e.apply(this,arguments)}}(),b=function(){var e=ke(Ie().mark((function e(){var t;return Ie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("MEOW_OVERRIDE"!==p){e.next=5;break}return o(!0),f(null),h(""),e.abrupt("return");case 5:return n(!0),e.prev=6,e.next=9,(0,O.IU)("".concat(De,"/set_license"),{method:"POST",nonce:k,json:{serialKey:p}});case 9:(t=e.sent).success&&(f(t.data),t.data&&!t.data.issue&&c("licenseAdded")),e.next=17;break;case 13:e.prev=13,e.t0=e.catch(6),alert("Error while validating the license. Check your console for more information."),console.error(e.t0);case 17:n(!1);case 18:case"end":return e.stop()}}),e,null,[[6,13]])})));return function(){return e.apply(this,arguments)}}();Fe((function(){v()}),[]);var _=y?"Forced License":A?"Enabled":"Disabled",x=y||s&&"valid"===s.license,S="Your license is active. Thanks a lot for your support :)";y&&(S="This license has been force-enabled for you.",s&&s.check_url&&(S=React.createElement(React.Fragment,null,React.createElement("span",null,S),React.createElement("br",null),React.createElement("small",null,"To check your license status, please click ",React.createElement("a",{target:"_blank",href:s.check_url+"&cache="+642e3*Math.random(),rel:"noreferrer"},"here"),".")))),x||(s?"no_activations_left"===s.issue?S=React.createElement("span",null,"There are no activations left for this license. You can visit your account at ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com"},"Meow Apps"),", unregister a site, and click on ",React.createElement("i",null,"Retry to validate"),"."):"expired"===s.issue?S=React.createElement("span",null,"Your license has expired. You can get another license or renew the current one by visiting your account at ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com"},"Meow Apps"),"."):"missing"===s.issue?S="This license does not exist.":"disabled"===s.issue?S="This license has been disabled.":"item_name_mismatch"===s.issue?S="This license seems to be for a different plugin... isn't it? :)":"forced"===s.issue?S="ABC":(S=React.createElement("span",null,"There is an unknown error related to the system or this serial key. Really sorry about this! Make sure your security plugins and systems are off temporarily. If you are still experiencing an issue, please ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com/contact/"},"contact us"),"."),console.error({license:s})):S="Unknown error :(");var T=React.createElement(R.z,{title:"Pro Version (Not Installed)",className:"primary"},"You will find more information about the Pro Version ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com"},"here"),". If you actually bought the Pro Version already, please remove the current plugin and download the Pro Version from your account at ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com/"},"Meow Apps"),"."),N=React.createElement(R.z,{title:"Pro Version (".concat(_,")"),busy:t,className:"primary"},!y&&!(s&&s.key===p)&&React.createElement(React.Fragment,null,React.createElement("div",{style:{marginBottom:10}},"License Key:"),React.createElement(Re.A,{id:"mfrh_pro_serial",name:"mfrh_pro_serial",disabled:t,value:p,onChange:function(e){return h(e)},placeholder:"Type your license key..."}),React.createElement(d.s,{p:!0},"Insert your serial key above. If you don't have one yet, you can get one ",React.createElement("a",{href:"https://meowapps.com"},"here"),". If there was an error during the validation, try the ",React.createElement("i",null,"Retry")," to ",React.createElement("i",null,"validate")," button.")),s&&!x&&React.createElement(Ne.X,{variant:"danger"},S),(y||s)&&x&&React.createElement(Ne.X,{variant:"success"},S),React.createElement("div",{style:{marginTop:15,display:"flex",justifyContent:"end"}},s&&!x&&React.createElement(w.M,{className:"secondary",disabled:t||!p,onClick:b},"Retry to validate"),s&&s.key===p&&React.createElement(w.M,{className:"secondary",disabled:t||!p,onClick:g},"Remove License"),React.createElement(w.M,{disabled:t||!p||s&&s.key===p,onClick:b},"Validate License"),a&&!x&&React.createElement(w.M,{disabled:t||!p||s&&s.key===p,onClick:E,className:"danger"},"Force License")),React.createElement(Te.n,{isOpen:"licenseAdded"===l,title:"Thank you :)",content:"The Pro features have been enabled. This page should be now reloaded.",okButton:{label:"Reload",onClick:function(){return location.reload()}}}),React.createElement(Te.n,{isOpen:"licenseRemoved"===l,title:"Goodbye :(",content:"The Pro features have been disabled. This page should be now reloaded.",okButton:{label:"Reload",onClick:function(){return location.reload()}}}));return I?N:T};const{__:Ue}=wp.i18n,Be={};Be.COMMON={GENERAL:Ue("General","ai-engine"),MODULES:Ue("Modules","ai-engine"),CLIENT_MODULES:Ue("Client Modules","ai-engine"),BACKEND_MODULES:Ue("Admin Modules","ai-engine"),SERVER_MODULES:Ue("Server Modules","ai-engine"),ADVISOR:Ue("Advisor","ai-engine"),SETTINGS:Ue("Settings","ai-engine"),CHATBOT:Ue("Chatbot","ai-engine"),CHATBOTS:Ue("Chatbots","ai-engine"),CHATBOT_HELP:Ue("Highly customizable chatbot.","ai-engine"),STATISTICS:Ue("Statistics","ai-engine"),STYLE:Ue("Style","ai-engine"),ENABLE:Ue("Enable","ai-engine"),NAME:Ue("Name","ai-engine"),SUBMIT:Ue("Submit","ai-engine"),MODEL:Ue("Model","ai-engine"),AI_MODEL:Ue("AI Model","ai-engine"),TEMPERATURE:Ue("Temperature","ai-engine"),MAX_TOKENS:Ue("Max Tokens","ai-engine"),CONTEXT_MAX_LENGTH:Ue("Context Max Length","ai-engine"),STOP_SEQUENCE:Ue("Stop Sequence","ai-engine"),MODE:Ue("Mode","ai-engine"),CONTEXT:Ue("Context","ai-engine"),IMAGES_NUMBER:Ue("Number of Images","ai-engine"),AVATAR:Ue("Avatar","ai-engine"),AI_NAME:Ue("AI Name","ai-engine"),GUEST_NAME:Ue("Guest Name","ai-engine"),USER_NAME:Ue("User Name","ai-engine"),PLACEHOLDER:Ue("Placeholder","ai-engine"),START_SENTENCE:Ue("Start Sentence","ai-engine"),SEND:Ue("Send","ai-engine"),CLEAR:Ue("Clear","ai-engine"),SYSTEM_NAME:Ue("System Name","ai-engine"),ID:Ue("ID","ai-engine"),POPUP:Ue("Popup","ai-engine"),POSITION:Ue("Position","ai-engine"),ICON:Ue("Icon","ai-engine"),ICON_TEXT:Ue("Icon Text","ai-engine"),ICON_TEXT_DELAY:Ue("Icon Text Delay","ai-engine"),FULL_SCREEN:Ue("Full Screen","ai-engine"),CASUALLY_FINE_TUNED:Ue("Casually Fine-Tuned","ai-engine"),CONTENT_AWARE:Ue("Content Aware","ai-engine"),SPACING:Ue("Spacing","ai-engine"),BORDER_RADIUS:Ue("Border Radius","ai-engine"),FONT_SIZE:Ue("Font Size","ai-engine"),FONT_COLOR:Ue("Font Color","ai-engine"),BACK_PRIMARY_COLOR:Ue("Back Primary Color","ai-engine"),BACK_SECONDARY_COLOR:Ue("Back 2nd Color","ai-engine"),HEADER_BUTTONS_COLOR:Ue("Header Buttons Color","ai-engine"),HEADER_BACKGROUND_COLOR:Ue("Header Back Color","ai-engine"),BUBBLE_COLOR:Ue("Bubble Color","ai-engine"),BACK_USER_COLOR:Ue("Back User Color","ai-engine"),BACK_AI_COLOR:Ue("Back AI Color","ai-engine"),BACK_AI_SECONDARY_COLOR:Ue("Back AI 2nd Color","ai-engine"),AVATAR_MESSAGE_BACKGROUND_COLOR:Ue("Message Background","ai-engine"),AVATAR_MESSAGE_FONT_COLOR:Ue("Message Color","ai-engine"),POPUP_ICON:Ue("Popup Icon","ai-engine"),CUSTOM_ICON:Ue("Custom Icon (URL or Emoticon)","ai-engine"),FEATURES:Ue("Features","ai-engine"),TIMEFRAME:Ue("Timeframe","ai-engine"),ABSOLUTE:Ue("Absolute","ai-engine"),NONE:Ue("None","ai-engine"),EDITORS_ADMINS:Ue("Editors & Admins","ai-engine"),ADMINS_ONLY:Ue("Admins Only","ai-engine"),CREDITS:Ue("Credits","ai-engine"),TYPE:Ue("Type","ai-engine"),USERS:Ue("Users","ai-engine"),USER:Ue("User","ai-engine"),GUESTS:Ue("Guests","ai-engine"),GUEST:Ue("Guest","ai-engine"),OPENAI:Ue("Open AI","ai-engine"),LICENSE_TAB:Ue("License","ai-engine"),FINETUNES:Ue("Finetunes","ai-engine"),MODELS:Ue("Models","ai-engine"),FILES:Ue("Files","ai-engine"),ASSISTANT:Ue("Assistant","ai-engine"),ASSISTANTS:Ue("Assistants","ai-engine"),UTILITIES:Ue("Utilities","ai-engine"),POSTS_SUGGESTIONS:Ue("AI Copilot, AI Suggestions, Magic Wands","ai-engine"),POSTS_SUGGESTIONS_HELP:Ue("Tools to brainstorm/write faster and better.","ai-engine"),GENERATORS:Ue("Generators","ai-engine"),CONTENT_GENERATOR:Ue("Content Generator","ai-engine"),CONTENT_GENERATOR_HELP:Ue("Generate articles. Support templates.","ai-engine"),IMAGES_GENERATOR:Ue("Images Generator","ai-engine"),IMAGES_GENERATOR_HELP:Ue("Generate images. Support templates.","ai-engine"),PLAYGROUND:Ue("Playground","ai-engine"),PLAYGROUND_HELP:Ue("Play with AI or let it perform various tasks for you. Support templates.","ai-engine"),FORMS:Ue("Forms","ai-engine"),FORMS_HELP:Ue("Build AI forms. Based on fields, users will be given answers or suggestions.","ai-engine"),STATISTICS_HELP:Ue("Track AI interactions, check statistics, set limits, and more!","ai-engine"),CLIENT_DEBUG:Ue("Client Debug","ai-engine"),CLIENT_DEBUG_HELP:Ue("Debugging information will be displayed in the console.","ai-engine"),SERVER_DEBUG:Ue("Server Debug","ai-engine"),SERVER_DEBUG_HELP:Ue("Debugging information from your server will be displayed in a console on this tab.","ai-engine"),CLEAR_LOGS:Ue("Clear Logs","ai-engine"),REFRESH_LOGS:Ue("Refresh Logs","ai-engine"),API_KEY:Ue("API Key","ai-engine"),USAGE_HELP:Ue('Those values are for information only. They are not accurate and should not be used for billing purposes. The calculation of the number of tokens and the cost is very different from one service to another, and AI Engine does its best to estimate it. For the exact amounts, please check your accounts at the respective services. For OpenAI, you can check your <a href="https://platform.openai.com/usage" target="_blank">OpenAI account</a>.',"ai-engine"),USAGE_PRO_HELP:Ue('If you would like to have better control on the amounts, add conditions or set limits to the usage of the AI, consider <a href="https://meowapps.com/ai-engine/" target="_blank">AI Engine Pro</a>.',"ai-engine"),LANGUAGE:Ue("Language","ai-engine"),HIDE:Ue("Hide","ai-engine"),SHOW:Ue("Show","ai-engine"),CONTENT:Ue("Content","ai-engine"),IMAGES:Ue("Images","ai-engine"),IMAGES_AND_FILES:Ue("Images & Files","ai-engine"),EXCERPT:Ue("Excerpt","ai-engine"),GENERATE:Ue("Generate","ai-engine"),MODEL_PARAMS:Ue("Model Params","ai-engine"),CONTEXT_PARAMS:Ue("Context Params","ai-engine"),PROMPT:Ue("Prompt","ai-engine"),PROMPTS:Ue("Prompts","ai-engine"),LABEL:Ue("Label","ai-engine"),SYSTEM:Ue("System","ai-engine"),SHORTCODE:Ue("Shortcode","ai-engine"),SHORTCODES:Ue("Shortcodes","ai-engine"),RESOLVE:Ue("Resolve","ai-engine"),MAX_MESSAGES:Ue("Max Messages","ai-engine"),INPUT_MAX_LENGTH:Ue("Input Max Length","ai-engine"),COMPLIANCE_TEXT:Ue("Compliance Text","ai-engine"),MODERATION:Ue("Moderation","ai-engine"),MODERATION_HELP:Ue("Moderation features with AI.","ai-engine"),FORMATTING:Ue("Formatting","ai-engine"),FORMATTING_HELP:Ue("Format the reply from AI into HTML. This is already done automatically if Markdown is detected in the reply.","ai-engine"),LOGS:Ue("Logs","ai-engine"),CODE:Ue("Code","ai-engine"),EMBEDDINGS:Ue("Embeddings","ai-engine"),EMBEDDINGS_HELP:Ue("Create searchable data that can be reused to feed the chatbot and other AI or UI elements.","ai-engine"),OTHERS:Ue("Others","ai-engine"),PINECONE_APIKEY_HELP:Ue('You can get your API Keys in your <a href="https://app.pinecone.io/organizations/keys" target="_blank">Pinecone Account</a>.',"ai-engine"),QDRANT_APIKEY_HELP:Ue('You can get your API Keys in your <a href="https://cloud.qdrant.io/accounts/" target="_blank">Qdrant Account</a>.',"ai-engine"),SERVER:Ue("Server","ai-engine"),PINECONE_SERVER_HELP:Ue("The URL of your host (check your Indexes).","ai-engine"),PINECONE_NAMESPACE_HELP:Ue("The namespace is used to separate the data from other data. This allows you to use the same server/index on more than one website. This is optional.","ai-engine"),QDRANT_SERVER_HELP:Ue("The URL of your cluster (known as Cluster URL).","ai-engine"),QDRANT_COLLECTION_HELP:Ue("The collection keeps data apart so you can use one cluster for many websites. If there's no collection, Qdrant makes one with 1536 dimensions and uses cosine similarity.","ai-engine"),COST:Ue("Cost","ai-engine"),USAGE:Ue("Usage","ai-engine"),TRANSCRIPTION:Ue("Transcription","ai-engine"),TRANSCRIPTION_HELP:Ue("Introduces a 'Transcribe' tab to easily transform audio/images into text and get AI answers in JSON format.","ai-engine"),AUDIO_TRANSCRIPTION:Ue("Audio-to-Text","ai-engine"),IMAGE_TRANSCRIPTION:Ue("Image-to-Text","ai-engine"),AUDIO_TO_TEXT:Ue("Audio ➡ Text","ai-engine"),IMAGE_TO_TEXT:Ue("Image ➡ Text","ai-engine"),EMBEDDINGS_ENV:Ue("Environment","ai-engine"),EMBEDDINGS_INDEX:Ue("Index","ai-engine"),NAMESPACE:Ue("Namespace","ai-engine"),NAMESPACES:Ue("Namespaces","ai-engine"),NAMESPACE_HELP:Ue("The namespace is used to separate the data from other data. This allows you to use the same index on more than one website.","ai-engine"),NAMESPACES_HELP:Ue("Enter the namespaces you would like to use on this site, separated by commas.","ai-engine"),ERROR:Ue("Error","ai-engine"),RETRY:Ue("Retry","ai-engine"),AUTO_RETRY:Ue("Auto Retry","ai-engine"),SKIP:Ue("Skip","ai-engine"),AUTO_SKIP:Ue("Auto Skip","ai-engine"),STOP:Ue("Stop","ai-engine"),AUTO_RETRY_DESCRIPTION:Ue("Auto Retry retries actions up to 10 times with increasing delay to avoid timeouts.","ai-engine"),WIDTH:Ue("Width","ai-engine"),MAX_HEIGHT:Ue("Max Height","ai-engine"),APPEARANCE:Ue("Appearance","ai-engine"),THRESHOLDS:Ue("Thresholds","ai-engine"),DASHBOARD:Ue("Dashboard","ai-engine"),ADVANCED:Ue("Advanced","ai-engine"),DISCUSSIONS:Ue("Discussions","ai-engine"),ROWS:Ue("Rows","ai-engine"),POST_TYPE:Ue("Post Type","ai-engine"),GENERATE_CONTENT:Ue("Generate Content","ai-engine"),GENERATE_IMAGES:Ue("Generate Images","ai-engine"),ADMIN_BAR:Ue("Admin Bar","ai-engine"),ADMIN_TOOLS:Ue("Admin Tools","ai-engine"),REFRESH:Ue("Refresh","ai-engine"),DELETE:Ue("Delete","ai-engine"),DELETE_ALL:Ue("Delete All","ai-engine"),DELETE_SELECTED:Ue("Delete Selected","ai-engine"),OPENAI_ORGANIZATION_ID:Ue("Organization ID","ai-engine"),OPENAI_AZURE_API_KEY:Ue("API Key","ai-engine"),OPENAI_AZURE_DEPLOYMENT_NAME:Ue("Deployment Name","ai-engine"),OPENAI_AZURE_DEPLOYMENTS:Ue("Deployments","ai-engine"),ENDPOINT:Ue("Endpoint","ai-engine"),HUGGINGFACE_MODELS:Ue("Models","ai-engine"),HUGGINGFACE_MODEL_NAME:Ue("Name","ai-engine"),HUGGINGFACE_MODEL_URL:Ue("API URL","ai-engine"),THEME:Ue("Theme","ai-engine"),THEMES:Ue("Themes","ai-engine"),BANNED_WORDS:Ue("Banned Words","ai-engine"),BANNED_IPS:Ue("Banned IPs","ai-engine"),SECURITY:Ue("Security","ai-engine"),POST_TYPES:Ue("Post Types","ai-engine"),COPY_BUTTON:Ue("Copy Button","ai-engine"),AI_AVATAR:Ue("AI Avatar","ai-engine"),GUEST_AVATAR:Ue("Guest Avatar","ai-engine"),SITE_WIDE_CHATBOT:Ue("Site-Wide Chatbot","ai-engine"),QUERIES_DATA:Ue("Queries Data","ai-engine"),QUERIES_FORMS_DATA:Ue("Queries Form Data","ai-engine"),WEBSPEECH_API:Ue("Web Speech API","ai-engine"),VIRTUAL_KEYBOARD:Ue("Virtual Keyboard","ai-engine"),GDPR_CONSENT:Ue("GDPR Consent","ai-engine"),GDPR_TEXT:Ue("GDPR Text","ai-engine"),GDPR_BUTTON:Ue("GDPR Button","ai-engine"),FIX:Ue("Fix","ai-engine"),SPEECH_RECOGNITION:Ue("Speech Recognition","ai-engine"),SPEECH_SYNTHESIS:Ue("Speech Synthesis","ai-engine"),QUERY:Ue("Query","ai-engine"),QUERIES:Ue("Queries","ai-engine"),LOCAL_MEMORY:Ue("Local Memory","ai-engine"),ACTIONS:Ue("Actions","ai-engine"),RESET:Ue("Reset","ai-engine"),INCIDENTS_OPENAI:Ue("Incidents (OpenAI)","ai-engine"),PREVIEW:Ue("Preview","ai-engine"),LEGACY_FORMS:Ue("Legacy Forms","ai-engine"),LEGACY_FEATURES:Ue("Legacy Features","ai-engine"),DUPLICATE:Ue("Duplicate","ai-engine"),CHATBOT_EDITOR:Ue("Chatbot Editor","ai-engine"),THEME_EDITOR:Ue("Theme Editor","ai-engine"),STREAMING:Ue("Streaming","ai-engine"),SYNTAX_HIGHLIGHT:Ue("Syntax Highlight","ai-engine"),DATA_NOT_AVAILABLE:Ue("Data not available.","ai-engine"),EXPORT:Ue("Export","ai-engine"),IMPORT:Ue("Import","ai-engine"),MODIFY_EMBEDDING:Ue("Modify Embedding","ai-engine"),ADD_EMBEDDING:Ue("Add Embedding","ai-engine"),DEV_TOOLS:Ue("Dev Tools","ai-engine"),SINGLE_GENERATE:Ue("Single Generate","ai-engine"),PUBLIC_API:Ue("Public API","ai-engine"),USER_INTERFACE:Ue("User Interface","ai-engine"),INTRO_MESSAGE:Ue("Intro Message","ai-engine"),ADDONS:Ue("Add-ons","ai-engine"),AI_ENVIRONMENT_DEFAULTS:Ue("Default Environments for AI","ai-engine"),ENVIRONMENTS_FOR_AI:Ue("Environments for AI","ai-engine"),ENVIRONMENT_ID:Ue("Environment ID","ai-engine"),EMBEDDINGS_ENVIRONMENT_DEFAULT:Ue("Default Embeddings Environment","ai-engine"),ENVIRONMENT:Ue("Environment","ai-engine"),PLUGIN_DATA:Ue("Plugin Data","ai-engine"),PLUGIN_DATA_DESCRIPTION:Ue("The database and all the options of the plugin will be removed on uninstall.","ai-engine"),RESET_LIMITS:Ue("Reset Limits","ai-engine"),VISION:Ue("Vision","ai-engine"),FILE_SEARCH:Ue("File Search","ai-engine"),PROMPT_TO_JSON:Ue("Prompt ➡ JSON","ai-engine"),RESOLUTION:Ue("Resolution","ai-engine"),DEFAULT:Ue("Default","ai-engine"),REFRESH_MODELS:Ue("Refresh Models","ai-engine"),AUDIO:Ue("Audio","ai-engine"),JSON:Ue("JSON","ai-engine"),AI_ENVIRONMENT:Ue("AI Environment","ai-engine"),OVERRIDE_DEFAULTS:Ue("Override Defaults","ai-engine"),REGION:Ue("Region","ai-engine"),PROJECT_ID:Ue("Project ID","ai-engine"),BEARER_TOKEN:Ue("Bearer Token","ai-engine"),DIMENSIONS:Ue("Dimensions","ai-engine"),MIN_SCORE:Ue("Min Score","ai-engine"),MAX_SELECT:Ue("Max Results","ai-engine"),QDRANT_COLLECTION:Ue("Collection","ai-engine"),INSTRUCTIONS:Ue("Instructions","ai-engine"),FUNCTIONS:Ue("Functions","ai-engine"),BUBBLE:Ue("Bubble","ai-engine"),TABS:Ue("Tabs","ai-engine"),DROPDOWN:Ue("Dropdown","ai-engine"),CHATBOT_SELECT:Ue("Chatbot Select","ai-engine")},Be.FORMS={PROMPT_INFO:Ue("The template of your prompt. To re-use the data entered by the user, use the name of that field between curly braces. Example: Recommend me {MUSIC_TYPE} artists. You can also use an ID as an input, like this: ${#myfield}. Finally, if you wish the output to be formatted, add: 'Use Markdown.'.\"","ai-engine"),OUTPUT:Ue("Output","ai-engine"),OUTPUT_ELEMENT:Ue("Output Element","ai-engine"),OUTPUT_ELEMENT_INFO:Ue("The result will be written to this element. If you wish to simply display the result in an Output Block, use its ID. For instance, if its ID is mwai-666, use '#mwai-666'.","ai-engine")},Be.HELP={TEMPERATURE:Ue("Between 0 and 1. Higher values means the model will take more risks.","ai-engine"),MAX_TOKENS:Ue("The maximum number of tokens to generate. The model will stop generating once it hits this limit.","ai-engine"),STOP_SEQUENCE:Ue("The sequence of tokens that will cause the model to stop generating text. You absolutely need this with fine-tuned models.","ai-engine"),COST:Ue("Keeps track of the current costs.","ai-engine"),RESOLVE_SHORTCODE:Ue("Will resolve the shortcode in your content when needed (Content-Aware will use this, for instance).","ai-engine"),FINETUNES:Ue("Train your own AI models.","ai-engine"),DISCUSSIONS:Ue("Keep the conversations and enable browsing them via the Conversations tab.","ai-engine"),AZURE_DEPLOYMENTS:Ue("Add your deployments below and define what kind of model they are.","ai-engine"),BANNED_WORDS:Ue("Reject queries containing these words; separate with commas.","ai-engine"),BANNED_IPS:Ue("Block access from specified IP addresses or ranges using CIDR notation; separate with commas.","ai-engine"),VIRTUAL_KEYBOARD:Ue("Prevent the virtual keyboard from pushing the chatbot up on mobile devices. This is experimental and might cause issues.","ai-engine"),GDPR_CONSENT:Ue("If enabled, the user will have to accept the conditions before using the chatbot.","ai-engine"),POST_TYPES:Ue("Enable for these post types; separate with commas.","ai-engine"),POST_STATUS:Ue("Enable for these post statuses (publish, draft, future, private, etc); separate with commas.","ai-engine"),POST_CATEGORIES:Ue("Enable for these categories (slugs); separate with commas. If none, it will be enabled for all.","ai-engine"),CONTEXT_MAX_LENGTH:Ue("Truncate the context (Content-Aware, Embeddings, etc) to make sure it is below this number of characters.","ai-engine"),MAX_MESSAGES:Ue("Maximum number of historical messages that is sent to the AI model.","ai-engine"),INPUT_MAX_LENGTH:Ue("Maximum number of characters that can be input by the user.","ai-engine"),STATISTICS:Ue(" In the Queries tab, you can browse through all your users' activity. Contextual data is excluded unless you activate the options below. Make sure your users are aware of this.","ai-engine"),QUERIES_DATA:Ue("Record the queries and their replies.","ai-engine"),QUERIES_FORMS_DATA:Ue("Capture form data neatly for simple reuse.","ai-engine"),SPEECH_RECOGNITION:Ue("Enable speech-to-text. Depends on the browser and OS used by the user.","ai-engine"),SPEECH_SYNTHESIS:Ue("Enable text-to-speech.","ai-engine"),CUSTOM_SHORTCODE:Ue("Prefer the above version. If you need many chatbots, you can custom shortcodes, like the one below. Custom shortcodes are based on the default chatbot, and their attributes override the default ones.","ai-engine"),USER_FILTER:Ue("Type an User ID, or an IP.","ai-engine"),STREAMING:Ue("The AI's response will appear as it's being created. Be cautious: this feature's ability to manage statistics, limits, and filters is still in its beta phase.","ai-engine"),SYNTAX_HIGHLIGHT:Ue("Enable syntax highlighting for the code blocks.","ai-engine"),DEV_TOOLS:Ue("Enable a new tab with debugging tools. For developers only.","ai-engine"),PUBLIC_API:Ue("Enable the Public REST API.","ai-engine"),INTRO_MESSAGE:Ue("Enable the introduction text at the top of this page.","ai-engine"),ADDONS:Ue("Enable the AI Addons section under the Meow Apps menu.","ai-engine"),OPENAI_API_KEY:Ue('You can get your API Keys in your <a href="https://beta.openai.com/account/api-keys" target="_blank">OpenAI Account</a>.',"ai-engine"),OPENAI_ORGANIZATION_ID:Ue('You can link this environment to an <a href="https://platform.openai.com/account/organization" target="_blank">Organization</a>. This is optional.',"ai-engine"),AZURE_API_KEY:Ue('You can get your API Keys in your <a href="https://oai.azure.com/portal" target="_blank">Azure Account</a>.',"ai-engine"),ANTHROPIC_API_KEY:Ue('You can get your API Keys in your <a href="https://console.anthropic.com/settings/keys" target="_blank">Anthropic Account</a>.',"ai-engine"),OPENROUTER_API_KEY:Ue('You can get your API Keys in your <a href="https://openrouter.ai/keys" target="_blank">OpenRouter Account</a>.',"ai-engine"),QDRANT:Ue('Use the code <b>#AIENGINE5</b> when you <a href="https://qdrant.to/cloud" target="_blank">Create a Qdrant Account</a>. You will get 5% off.',"ai-engine"),ASSISTANTS:Ue("The Assistants API is designed to help developers build powerful AI assistants capable of performing a variety of tasks.","ai-engine"),ASSISTANTS_INTRO:Ue('The Assistants API is designed to help developers build powerful AI assistants capable of performing a variety of tasks. To create them, head to the <a href="https://beta.openai.com/assistants" target="_blank">OpenAI Assistants</a> dashboard, then <b>Refresh Assistants</b> here. You can use an assistant in your chatbots by switching the <b>Mode</b> to <b>Assistant</b>.',"ai-engine"),ASSISTANTS_WARNINGS:Ue('Assistants are also <a href="https://platform.openai.com/docs/api-reference/assistants" target="_blank">in beta</a>, both for OpenAI and AI Engine. OpenAI did not add streaming support for them yet. Pricing is still quite unclear and <a href="https://openai.com/pricing" target="_blank">tricky</a>. AI Engine can only perform an estimation. If you want to discuss assistants with other users, visit the <a href="https://discord.gg/bHDGh38" target="_blank">Meow Apps Discord Server</a>.',"ai-engine"),BEARER_TOKEN:Ue('The Public API will be usable by using this Bearer Token. If not set, you will need to <a href="https://meowapps.com/ai-engine/api/#public-rest-api" target="_blank">build your own authentication</a> by using the <i>mwai_allow_public_api</i> filter.',"ai-engine"),NO_EMBEDDINGS_RESULTS:Ue("No results for this search. Make sure the Minimum Score is not too high.","ai-engine"),NO_EMBEDDINGS_ROWS:Ue("No embeddings yet in this environment.","ai-engine"),MIN_SCORE:Ue("The minimum score the embeddings need to have to be returned. Between 0 and 100 and defaults to 35.","ai-engine"),MAX_SELECT:Ue("The maximum number of embeddings to return and to use as context. Between 1 and 100 and defaults to 10.","ai-engine"),FUNCTIONS:Ue("Select the functions to make available for the AI model's choice. It will use them to enhance responses and perform specific actions. This feature is known as Function Calling or Tools.","ai-engine"),FUNCTIONS_UNAVAILABLE:Ue('There are no functions available. Please use <a href="https://wordpress.org/plugins/snippet-vault/" target="_blank">Snippet Vault</a> to add some. The Pro Version of AI Engine is also required for this feature.',"ai-engine"),ADVISOR:Ue("In your Dashboard will be displayed daily recommendations tailored to your WordPress setup. Admins only.","ai-engine"),BUBBLE:Ue("The popup will be displayed as a bubble.","ai-engine"),ICON_TEXT:Ue("If set, this text will appear next to the icon/bubble.","ai-engine"),ICON_TEXT_DELAY:Ue("The delay before the text appears.","ai-engine"),CHATBOT_SELECT:Ue("Choose how you want to select the chatbot. By default, tabs are used, but you can also use a filterable dropdown if you have many chatbots.","ai-engine")},Be.SETTINGS={AI_ENV_SETUP:Ue('To leverage the functionalities of AI Engine, it needs to be connected directly to AI services. We recommend starting with OpenAI. Create an account and generate an API Key by visiting the <a href="https://beta.openai.com/account/api-keys" target="_blank">OpenAI</a> website. Once obtained, navigate to the <b>Settings</b> tab and input your OpenAI API Key in the "Environments for AI" section.',"ai-engine"),PINECONE_SETUP:Ue('You choose to use Embeddings. To use them, you need to a Pinecone account. Visit the <a href="https://app.pinecone.io" target="_blank">Pinecone</a> website to create an account, then insert your Pinecone API Key in the <b>Settings</b> tab.',"ai-engine"),INTRO:Ue('Boost your WordPress with AI, now! Please start with our <a href="https://meowapps.com/ai-engine/tutorial/" target="_blank">tutorial</a>. Then move to our <a href="https://docs.meowapps.com/" target="_blank">documentation</a>. Have a look at our <a href="https://meowapps.com/products/category/ai-add-ons/" target="_blank">add-ons</a>. And make sure you read the <a href="https://meowapps.com/ai-engine/disclaimer/" target="_blank">disclaimer</a>. Have fun! 🎵',"ai-engine"),MODULES_INTRO:Ue("To avoid cluttering the UI and your WP, only enable the features you need.","ai-engine"),ALERT_INJECT_BUT_NO_POPUP:Ue("You choose to inject the chatbot in your website. You probably also want to use the chatbot in a Popup.","ai-engine"),ALERT_CASUALLY_BUT_NO_FINETUNE:Ue("Normally, you should not check the Casually Fine Tuned option with a non-finetuned model. Make sure that's what you want.","ai-engine"),ALERT_CONTENTAWARE_BUT_NO_CONTENT:Ue('Content Aware requires your Context to use the {CONTENT} placeholder. It will be replaced by the content of page the chatbot is on. More info <a href="https://meowapps.com/ai-engine/tutorial/#contextualization" target="_blank">here</a>.',"ai-engine"),SET_AS_DEFAULT_PARAMETERS:Ue("Set as Default Parameters","ai-engine"),SET_AS_DEFAULT_PARAMETERS_HELP:Ue("Set the parameters above as the default parameters for the chatbot. You can then use the shortcode [mwai_chat] anywhere on your website.","ai-engine"),INJECT_DEFAULT_CHATBOT:Ue("Inject Default Chatbot in Entire Website","ai-engine"),INJECT_DEFAULT_CHATBOT_HELP:Ue("Inject the chatbot [mwai_chat] in the entire website.","ai-engine"),CHATGPT_STYLE_INTRO:Ue('Keep in mind that you can also style the chatbot (or a specific chatbot, if you use many) by injecting CSS. Have a look <a target="_blank" href="https://meowapps.com/ai-engine/tutorial/#apply-custom-style-to-the-chatbot">here</a>. More information in the <a target="_blank" href="https://meowapps.com/ai-engine/faq">FAQ</a>.',"ai-engine"),TYPEWRITER_EFFECT:Ue("Typewriter Effect","ai-engine"),TYPEWRITER_EFFECT_HELP:Ue("The reply from AI will be typewrited. This delays the final output! Absolutely not recommended. Please use <b>Streaming</b> instead.","ai-engine"),CHATBOT_MODERATION_HELP:Ue("If the conversation seems offensive, the chatbot will reject it.","ai-engine"),CUSTOM_URL:Ue("Custom URL","ai-engine"),ASSISTANT_NO_FILE_SEARCH:Ue('This assistant does not support File Search. You can activate it on the <a href="https://platform.openai.com/assistants" target="_blank">OpenAI Assistants</a> dashboard. Then, use the Refresh button in the Assistants tab.',"ai-engine"),ASSISTANT_FILE_SEARCH:Ue("File Search will be used when the users upload documents. If the user uploads images, those will be handled by AI Vision if the model supports it and if it is enabled.","ai-engine")},Be.CHATBOT={CHATBOT_BUILDER:Ue("Chatbot Builder","ai-engine"),RESET_PARAMS:Ue("Reset Parameters","ai-engine")},Be.STATISTICS={ABSOLUTE_HELP:Ue("Using Absolute, Day represents <i>today</i>. Otherwise, the <i>past 24 hours</i>. Same logic applies to the other timeframes.","ai-engine"),NO_CREDITS_MESSAGE:Ue("Message for No Credits","ai-engine"),FULL_ACCESS_USERS:Ue("Full-Access Users","ai-engine"),ENABLE_LIMITS:Ue("Enable Limits","ai-engine")},Be.CONTENT_GENERATOR={INTRO:Ue("The Content Generator is a powerful tool that can generate content for you. It can be used to generate articles, emails, or even code. It can also be used to generate content for your chatbot. <b>Let me know if there are any new features you would like to see!</b> Have fun 🥳","ai-engine"),TITLE_MISSING:Ue("Title is missing!","ai-engine"),SECTIONS_MISSING:Ue("Sections are missing!","ai-engine"),SINGLE_GENERATE:Ue("Single Generate","ai-engine"),BULK_GENERATE:Ue("Bulk Generate","ai-engine"),CONTENT_PARAMS:Ue("Content Params","ai-engine"),POST_PARAMS:Ue("Post Params","ai-engine"),CONTENT_PARAMS_INTRO:Ue("Input fields are displayed for certain placeholders used in prompts, such as {LANGUAGE} or {WRITING_TONE}","ai-engine"),CUSTOM_LANGUAGE:Ue("Custom Language","ai-engine"),WRITING_STYLE:Ue("Writing Style","ai-engine"),WRITING_TONE:Ue("Writing Tone","ai-engine"),CUSTOM_LANGUAGE_HELP:Ue('All the languages are <i>somehow</i> supported by AI. <a href="https://meowapps.com/ai-engine/faq/#languages" target="_blank">Learn more</a>.',"ai-engine"),MODEL_HELP:Ue("It is recommended to use Turbo or GPT-4 to write texts.","ai-engine"),PROMPTS_INTRO:Ue("Prompts represent the exact request sent to the AI. The variables between curly braces will be replaced by the content of the corresponding field. Prompts are saved in your templates.","ai-engine"),PROMPT_TITLE:Ue("Prompt for <b>Title</b>","ai-engine"),PROMPT_SECTIONS:Ue("Prompt for <b>Sections</b>","ai-engine"),PROMPT_CONTENT:Ue("Prompt for <b>Content</b>","ai-engine"),PROMPT_EXCERPT:Ue("Prompt for <b>Excerpt</b>","ai-engine"),POST_CREATED:Ue("Post Created","ai-engine"),POST_CREATED_AS_DRAFT:Ue("The post was created as a draft.","ai-engine"),CONTENT_HELP:Ue('You can modify the content before using "Create Post". Markdown is supported, and will be converted to HTML when the post is created.',"ai-engine"),SECTIONS_HELP:Ue('Add, rewrite, remove, or reorganize those sections as you wish before (re)clicking on "Generate Content". Markdown format is recommended.',"ai-engine"),GENERATE_EXCERPT:Ue("Generate Excerpt","ai-engine"),GENERATE_CONTENT:Ue("Generate Content","ai-engine"),GENERATE_SECTIONS:Ue("Generate Sections","ai-engine"),PARAGRAPHS_PER_SECTION:Ue("# of Paragraphs per Section","ai-engine"),SECTIONS:Ue("Sections","ai-engine"),TOPICS_HELP:Ue("Write or paste your topics below. Each line will be used as a topic. The same <b>Params</b> and <b>Prompts</b> will be used as with the <b>Single Generate</b>, so make sure you get satisfying results with it first. This <b>takes time</b>, so relax and enjoy some coffee ☕️ and tea 🍵 :)","ai-engine"),GENERATED_POSTS:Ue("Generated Posts","ai-engine"),GENERATE_ALL:Ue("Generate All","ai-engine"),EDIT_POST:Ue("Edit Post","ai-engine"),CREATE_POST:Ue("Create Post","ai-engine"),TITLE_TOO_SHORT:Ue("The title is too short. It should be at least 3 words.","ai-engine"),TITLE_TOO_SHORT_2:Ue("The title is too short.  It should be at least 40 characters.","ai-engine"),TITLE_TOO_LONG:Ue("The title is too long. It should be less than 8 words.","ai-engine"),TITLE_TOO_LONG_2:Ue("The title is too long. It should be less than 70 characters.","ai-engine")},Be.TEMPLATES={TEMPLATE:Ue("Template","ai-engine"),TEMPLATES:Ue("Templates","ai-engine"),DELETE_CONFIRM:Ue("Are you sure you want to delete this template?","ai-engine"),DELETE_ALL_CONFIRM:Ue("Are you sure you want to delete all the templates?","ai-engine"),NEW_TEMPLATE_NAME:Ue("New Template","ai-engine"),EDIT:Ue("EDIT","ai-engine")},Be.PLAYGROUND={INTRO:Ue("Welcome to the AI Playground! Here, you can play with different AI models and ask the UI to perform various tasks for you. You can ask it to write, rewrite, or translate an article, categorize words or elements into groups, write an email, etc. <b>Let me know if there are any new features you would like to see!</b> Have fun 🥳","ai-engine"),PROMPT:Ue("Query / Prompt","ai-engine"),REPLY:Ue("Reply","ai-engine")},Be.ALERTS={FINETUNING_STARTED:Ue("Fine-tuning started! Check its progress in the Models section. Depending on your dataset size, it may take a while (from a few minutes to days).","ai-engine"),RESET_BUILDER:Ue("This will delete all the rows in the builder. Are you sure?","ai-engine"),DELETE_FINETUNE:Ue("You are going to delete this fine-tune. Are you sure?\n\nPlease note that it will take a while before it is actually deleted. This might be a temporary issue of OpenAI.","ai-engine"),FINETUNE_ALREADY_DELETED:Ue("This fine-tune was already deleted. It will be removed from the list.","ai-engine"),CHECK_CONSOLE:Ue("Error! Check your console for more details.","ai-engine"),DATASET_UPLOADED:Ue("Uploaded successfully! You can now train a model based on this dataset.","ai-engine"),ONLY_SUPPORTS_FILES:Ue("This only supports JSON, JSONL, and CSV files.","ai-engine"),EMPTY_LINES_DATASET:Ue("Some lines were empty. Make sure the CSV has a header row and that the columns are named 'prompt' and 'completion'. For debugging, an empty line was logged to the console.","ai-engine"),EMPTY_LINES_EMBEDDINGS:Ue("Some lines were empty. Make sure the CSV has a header row and that the columns are named 'title' and 'content'. For debugging, an empty line was logged to the console.","ai-engine"),ARE_YOU_SURE:Ue("Are you sure?","ai-engine")},Be.FINETUNING={MODELS_INTRO:Ue("The AI models you have fine-tuned. To create more, visit <b>Files</b>.","ai-engine"),LEGACY_MODELS_INTRO:Ue('The AI models you have fine-tuned. <b>Do not use legacy fine-tuning anymore (based on models prior to GPT 3.5). Their deprecation has been <a href="https://platform.openai.com/docs/guides/legacy-fine-tuning" target="_blank">announced by OpenAI</a> for January 4th, 2024.</b><br />',"ai-engine"),FILES_INTRO:Ue("The files you have uploaded to OpenAI. To create a new dataset file, switch from <b>Model & Files</b> to <b>Dataset Editor</b>. To train a new model, click on the <i>magic wand</i>.","ai-engine"),MODEL_FINETUNE:Ue("Model Finetune","ai-engine"),MODELS_FILES:Ue("Models & Files","ai-engine"),DATASET_EDITOR:Ue("Dataset Editor","ai-engine"),EDITOR:Ue("Editor","ai-engine"),GENERATOR:Ue("Generator","ai-engine"),HUGE_DATASET_WARNING:Ue("Caution: The data is too large to be saved in your browser's local storage.","ai-engine"),NO_FINETUNES_YET:Ue("No fine-tunes found. Refresh the list, or create a new one (via a dataset).","ai-engine"),CLEAN_MODELS_LIST:Ue("Clean Models List","ai-engine"),DELETED_FINETUNE_ISSUE:Ue("For some reason, OpenAI still return the models even after you deleted them. Don't worry, AI Engine will do the cleanup for you! You can force the cleanup by using this button. It takes a bit of time depending on the total of models you have.","ai-engine")},Be.EMBEDDINGS={EDIT:Ue("EDIT","ai-engine"),AI_SEARCH:Ue("AI SEARCH","ai-engine"),SYNC_POSTS:Ue("Sync Posts","ai-engine"),AUTO_SYNC_POSTS:Ue("Auto-Sync Posts","ai-engine"),AUTO_SYNC_POSTS_DESCRIPTION:Ue("Embeddings will be created, updated or removed based on the activity related to your posts.","ai-engine"),REWRITE_CONTENT:Ue("Rewrite Content","ai-engine"),REWRITE_CONTENT_DESCRIPTION:Ue("Shorten and improve the content for your embedding using the default model.","ai-engine"),FORCE_RECREATE:Ue("Force Recreate","ai-engine"),FORCE_RECREATE_DESCRIPTION:Ue("Recreate embeddings on sync even if the content has not changed.","ai-engine"),REWRITE_PROMPT_DESCRIPTION:Ue("Prompt for the rewrite. Supports {CONTENT}, {TITLE}, {URL}, {EXCERPT}, {LANGUAGE}, {ID}.","ai-engine"),SYNC_ALL:Ue("Sync All","ai-engine"),SYNC_ONE:Ue("Sync One","ai-engine"),ADD_INDEX:Ue("Add Index","ai-engine"),ADD_INDEX_DESCRIPTION:Ue("An index is like a database, and contains embeddings. You can have many indexes and switch between them. The indexes are hosted on Pinecone.","ai-engine"),NO_NAMESPACE_SUPPORT:Ue("Note: This server does not support namespaces.","ai-engine")},Be.ERROR={UPDATING_OPTIONS:Ue("An error occured while updating the options."),GETTING_OPTIONS:Ue("An error occured while getting the options."),CHECK_YOUR_CONSOLE:Ue('For more information, check <a target="_blank" href="https://meowapps.com/tutorial-network-activity-dev-tools/">your console</a>. You might also want to check your <a target="_blank" href="https://meowapps.com/tutorial-php-error-logs/">PHP Error Logs</a>.',"ai-engine")};const He=Be;var Ye=["size","disabled","style"],ze=["size","disabled","style"],We=["size","disabled","style"],Ve=["size","disabled","style"];function Ke(){return Ke=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},Ke.apply(this,arguments)}function qe(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Xe(){Xe=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Je(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Je(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 $e(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Qe(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){$e(o,r,a,i,l,"next",e)}function l(e){$e(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Je(e){return Je="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},Je(e)}function Ze(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 et(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ze(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=Je(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Je(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==Je(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ze(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function tt(e){return function(e){if(Array.isArray(e))return at(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||rt(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 nt(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||rt(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 rt(e,t){if(e){if("string"==typeof e)return at(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)?at(e,t):void 0}}function at(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 ot=wp.element,it=ot.useMemo,lt=ot.useState,ct=ot.useEffect,ut={title:"",content:"",refId:null,type:"manual",behavior:"context"},st=function(e){var t=e.options,n=t.ai_envs.find((function(e){return e.apikey&&e.apikey.length>0})),r=!(null!=t&&t.module_embeddings)||(null==t?void 0:t.embeddings_envs)&&(null==t?void 0:t.embeddings_envs.length)>0;return React.createElement(React.Fragment,null,!n&&React.createElement(Ne.X,{variant:"danger",style:{marginTop:0,marginBottom:25}},(0,O.FE)(He.SETTINGS.AI_ENV_SETUP)),!r&&React.createElement(Ne.X,{variant:"danger",style:{marginTop:0,marginBottom:25}},(0,O.FE)(He.SETTINGS.PINECONE_SETUP)))},ft=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=nt(lt(null==e?void 0:e.ai_default_model),2),o=a[0],i=a[1],l=t||(null==e?void 0:e.ai_default_env),c=null!==(n=null==e?void 0:e.ai_envs)&&void 0!==n?n:[],u=it((function(){if(r&&null!=e&&e.ai_envs){var t={fake:!0,finetunes:[],legacy_finetunes:[],legacy_finetunes_deleted:[],finetunes_deleted:[],deployments:[]};return c.forEach((function(e){var n,r,a,o,i;e.finetunes&&(n=t.finetunes).push.apply(n,tt(e.finetunes)),e.legacy_finetunes&&(r=t.legacy_finetunes).push.apply(r,tt(e.legacy_finetunes)),e.legacy_finetunes_deleted&&(a=t.legacy_finetunes_deleted).push.apply(a,tt(e.legacy_finetunes_deleted)),e.finetunes_deleted&&(o=t.finetunes_deleted).push.apply(o,tt(e.finetunes_deleted)),e.deployments&&(i=t.deployments).push.apply(i,tt(e.deployments))})),t}return null}),[c,r]),s=it((function(){var t;return r?u:l?(null==e||null===(t=e.ai_envs)||void 0===t?void 0:t.find((function(e){return e.id===l})))||(console.warn("useModels: Environment with ID ".concat(l," could not be resolved."),{envs:c,envId:l}),null):(console.warn("useModels: Environment ID is null. Please provide a valid envId."),null)}),[c,l,r,u]),f=it((function(){var e=(null==s?void 0:s.finetunes_deleted)||[];return Array.isArray(null==s?void 0:s.legacy_finetunes_deleted)&&(e=[].concat(tt(e),tt(s.legacy_finetunes_deleted))),e}),[s]),m=function(e){return{background:{deprecated:"var(--neko-red)",tuned:"var(--neko-green)",preview:"var(--neko-orange)"}[e],color:"white",padding:"3px 4px",margin:"1px 0px 0px 3px",borderRadius:4,fontSize:9,lineHeight:"100%"}},d={deprecated:"DEPRECATED",tuned:"TUNED",preview:"PREVIEW"},p=function(e,t){var n,r,a,o=(null===(n=e.tags)||void 0===n?void 0:n.find((function(e){return["deprecated","preview"].includes(e)})))||(t?"tuned":"");return React.createElement(React.Fragment,null,null!==(r=null!==(a=e.name)&&void 0!==a?a:e.suffix)&&void 0!==r?r:e.model,o&&React.createElement("small",{style:m(o)},d[o]))},h=it((function(){var t,n=[];if(!0===(null==s?void 0:s.fake)){var r,a=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=rt(e))){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}(e.ai_engines);try{for(a.s();!(r=a.n()).done;){var o=r.value;Array.isArray(o.models)&&(n=[].concat(tt(n),tt(o.models)))}}catch(e){a.e(e)}finally{a.f()}}else if("azure"===(null==s?void 0:s.type)){var i,l,c=e.ai_engines.find((function(e){return"openai"===e.type})),u=null!==(i=null==c?void 0:c.models)&&void 0!==i?i:[];n=null!==(l=null==u?void 0:u.filter((function(e){var t;return null===(t=s.deployments)||void 0===t?void 0:t.find((function(t){return t.model===e.model}))})))&&void 0!==l?l:[]}else if("huggingface"===(null==s?void 0:s.type)){var f,m;n=null!==(f=null==s||null===(m=s.customModels)||void 0===m?void 0:m.map((function(e){var t=e.tags?tt(new Set([].concat(tt(e.tags),["core","chat"]))):["core","chat"],n=t.includes("image")?"text-to-image":"completion";return{model:e.name,name:e.name,features:n,tags:t,options:[]}})))&&void 0!==f?f:[]}else{var d,h=e.ai_engines.find((function(e){return e.type===(null==s?void 0:s.type)}));n=null!==(d=null==h?void 0:h.models)&&void 0!==d?d:[]}var y=null!==(t=null==s?void 0:s.finetunes)&&void 0!==t?t:[];return Array.isArray(null==s?void 0:s.legacy_finetunes)&&(y=[].concat(tt(y),tt(s.legacy_finetunes))),y=y.filter((function(e){return"succeeded"===e.status&&e.model})),n=n.map((function(e){return et(et({},e),{},{name:p(e),rawName:e.name})})),y.length&&(n=[].concat(tt(n),tt(y.map((function(e){var t=e.model.split(":")[0];return{model:e.model,name:p(e,!0),rawName:e.suffix,suffix:e.suffix,features:["completion"],family:t,description:"finetuned",finetuned:!0,tags:["chat","finetune"]}}))))),n}),[e,s]),y=it((function(){return h.filter((function(e){return!f.includes(e.model)}))}),[h,f]),v=it((function(){return h.filter((function(e){var t;return null==e||null===(t=e.tags)||void 0===t?void 0:t.includes("core")}))}),[h]),g=it((function(){return y.filter((function(e){var t;return null==e||null===(t=e.tags)||void 0===t?void 0:t.includes("image")}))}),[y]),E=it((function(){return y.filter((function(e){var t;return null==e||null===(t=e.tags)||void 0===t?void 0:t.includes("embedding")}))}),[y]),b=it((function(){return y.filter((function(e){var t;return null==e||null===(t=e.tags)||void 0===t?void 0:t.includes("vision")}))}),[y]),w=it((function(){return y.filter((function(e){var t;return null==e||null===(t=e.tags)||void 0===t?void 0:t.includes("chat")}))}),[y]),R=it((function(){return y.filter((function(e){var t;return null==e||null===(t=e.tags)||void 0===t?void 0:t.includes("audio")}))}),[y]),O=it((function(){return y.filter((function(e){var t;return null==e||null===(t=e.tags)||void 0===t?void 0:t.includes("json")}))}),[y]),_=function(t){if(!t)return null;t.startsWith("gpt-3.5-turbo-")||t.startsWith("gpt-35-turbo")?t="gpt-3.5-turbo":t.startsWith("gpt-4o-mini")?t="gpt-4o-mini":t.startsWith("gpt-4o")?t="gpt-4o":t.startsWith("gpt-4")&&(t="gpt-4");var n=h.find((function(e){return e.model===t}));return n||console.warn("Model ".concat(t," not found."),{allModels:h,options:e}),n},x=function(e){var t=_(e);return v.find((function(e){return(null==e?void 0:e.family)===(null==t?void 0:t.family)}))||null},S=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"1024x1024",n=x(e);if("image"===(null==n?void 0:n.type)&&null!=n&&n.resolutions){var r=n.resolutions.find((function(e){return e.name===t}));return(null==r?void 0:r.price)||null}return(null==n?void 0:n.price)||null};return{allModels:h,model:o,models:y,completionModels:w,imageModels:g,visionModels:b,coreModels:v,embeddingsModels:E,audioModels:R,jsonModels:O,setModel:i,isFineTunedModel:function(e){var t=_(e);return(null==t?void 0:t.finetuned)||!1},getModelName:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=_(e);return n?t&&n?n.rawName:(null==n?void 0:n.name)||(null==n?void 0:n.model)||e:e},getFamilyName:function(e){var t=_(e);return(null==t?void 0:t.family)||null},getPrice:S,getModel:_,calculatePrice:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"1024x1024",a=x(e),o=S(e,r),i=o,l=o;return"object"===Je(o)&&null!==o&&(i=o.in,l=o.out),i&&l?i*t*a.unit+l*n*a.unit:0}}},mt=function(){var e=Qe(Xe().mark((function e(t){var n;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/vectors/remote_list"),{nonce:k,method:"POST",json:t});case 2:return n=e.sent,e.abrupt("return",n?{total:n.total,vectors:n.vectors}:{total:0,vectors:[]});case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),dt=function(){var e=Qe(Xe().mark((function e(t,n){var r;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/vectors/add_from_remote"),{nonce:k,method:"POST",json:t,signal:n});case 2:return r=e.sent,e.abrupt("return",r);case 4:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),pt=function(){var e=Qe(Xe().mark((function e(t){var n;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.offset=(t.page-1)*t.limit,e.next=3,(0,O.IU)("".concat(T,"/discussions/list"),{nonce:k,method:"POST",json:t});case 3:return n=e.sent,e.abrupt("return",n?{total:n.total,chats:n.chats}:{total:0,chats:[]});case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ht=function(){var e=Qe(Xe().mark((function e(t){var n,r,a,o,i,l;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=null!==(null==t||null===(n=t.filters)||void 0===n?void 0:n.search),""!==(null==t||null===(r=t.filters)||void 0===r?void 0:r.search)){e.next=3;break}return e.abrupt("return",[]);case 3:if(t.filters.envId){e.next=5;break}return e.abrupt("return",{total:0,vectors:[]});case 5:return e.next=7,(0,O.IU)("".concat(T,"/vectors/list"),{nonce:k,method:"POST",json:t});case 7:return i=e.sent,o&&null!=i&&null!==(a=i.vectors)&&void 0!==a&&a.length&&(l=i.vectors.sort((function(e,n){var r;return"asc"===(null==t||null===(r=t.sort)||void 0===r?void 0:r.by)?e.score-n.score:n.score-e.score})),i.vectors=l),e.abrupt("return",i?{total:i.total,vectors:i.vectors}:{total:0,vectors:[]});case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),yt=function(){var e=Qe(Xe().mark((function e(t){var n,r,a=arguments;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:"publish",e.next=3,(0,O.IU)("".concat(T,"/helpers/count_posts?postType=").concat(t,"&postStatus=").concat(n),{nonce:k});case 3:return r=e.sent,e.abrupt("return",null!=r&&r.count?parseInt(null==r?void 0:r.count):null);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),vt=function(){var e=Qe(Xe().mark((function e(t){var n,r,a=arguments;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:"publish",e.next=3,(0,O.IU)("".concat(T,"/helpers/posts_ids?postType=").concat(t,"&postStatus=").concat(n),{nonce:k});case 3:return r=e.sent,e.abrupt("return",null!=r&&r.postIds?r.postIds:[]);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),gt=function(){var e=Qe(Xe().mark((function e(t){var n,r,a,o,i=arguments;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.length>1&&void 0!==i[1]?i[1]:0,r=i.length>2&&void 0!==i[2]?i[2]:0,a=i.length>3&&void 0!==i[3]?i[3]:"publish",e.next=5,(0,O.IU)("".concat(T,"/helpers/post_content?postType=").concat(t,"&postStatus=").concat(a,"&offset=").concat(n,"&postId=").concat(r),{nonce:k});case 5:return o=e.sent,e.abrupt("return",o);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Et=function(){var e=Qe(Xe().mark((function e(t){var n,r,a,o,i,l=arguments;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.vectorId,r=t.postId,a=t.envId,o=l.length>1&&void 0!==l[1]?l[1]:null,e.next=4,(0,O.IU)("".concat(T,"/vectors/sync"),{nonce:k,method:"POST",json:{vectorId:n,postId:r,envId:a},signal:o});case 4:return i=e.sent,e.abrupt("return",i);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function bt(e){var t=new Date(e),n=(t=new Date(t.getTime()-60*t.getTimezoneOffset()*1e3)).toLocaleDateString("ja-JP",{year:"numeric",month:"2-digit",day:"2-digit"}),r=t.toLocaleTimeString("ja-JP",{hour:"2-digit",minute:"2-digit",second:"2-digit"});return React.createElement(React.Fragment,null,n,React.createElement("br",null),React.createElement("small",null,r))}function wt(e,t){var n,r=t?(n=t.substring(0,12)).length<t.length?(n.endsWith(".")&&(n=n.slice(0,-1)),n+"~"):n:"";return React.createElement(React.Fragment,null,!e&&React.createElement(React.Fragment,null,He.COMMON.GUEST),e&&React.createElement(React.Fragment,null,React.createElement("a",{target:"_blank",href:"/wp-admin/user-edit.php?user_id=".concat(e),rel:"noreferrer"},He.COMMON.USER," #",e)),React.createElement("br",null),React.createElement("small",null,r))}var Rt=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6,t="",n=0;n<e;n++)t+="abcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(36*Math.random())];return t},Ot=function(e){var t=e.size,n=void 0===t?14:t,r=e.disabled,a=void 0!==r&&r,o=e.style,i=qe(e,Ye),l=et(et({},{position:"relative",top:2,borderRadius:2,filter:a?"grayscale(100%)":"none"}),o);return React.createElement("img",Ke({width:n,height:n},i,{style:l,alt:"OpenAI",src:N+"/images/chat-openai.svg"}))},_t=function(e){var t=e.size,n=void 0===t?14:t,r=e.disabled,a=void 0!==r&&r,o=e.style,i=qe(e,ze),l=et(et({},{position:"relative",top:2,borderRadius:2,filter:a?"grayscale(100%)":"none"}),o);return React.createElement("img",Ke({width:n,height:n},i,{style:l,alt:"Anthropic",src:N+"/images/chat-anthropic.svg"}))},xt=function(e){var t=e.size,n=void 0===t?14:t,r=e.disabled,a=void 0!==r&&r,o=e.style,i=qe(e,We),l=et(et({},{position:"relative",top:2,borderRadius:2,filter:a?"grayscale(100%)":"none"}),o);return React.createElement("img",Ke({width:n,height:n},i,{style:l,alt:"JavaScript",src:N+"/images/code-js.svg"}))},St=function(e){var t=e.size,n=void 0===t?14:t,r=e.disabled,a=void 0!==r&&r,o=e.style,i=qe(e,Ve),l=et(et({},{position:"relative",top:2,borderRadius:2,filter:a?"grayscale(100%)":"none"}),o);return React.createElement("img",Ke({width:n,height:n},i,{style:l,alt:"PHP",src:N+"/images/code-php.svg"}))},Tt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=wp.data.select("core/block-editor"),n=t.getBlocks,r=t.getSelectedBlockClientId,a=wp.data.select("core/editor").getEditedPostAttribute,o=n(),i=a("title"),l=r(),c=i+"\n\n";return o.forEach((function(t,n){e&&t.clientId===l?c+=e+"\n\n":c+=(t.attributes.content||"")+"\n\n"})),c.trim()};function Nt(e){return Nt="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},Nt(e)}function Ct(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 It(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ct(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=Nt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Nt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==Nt(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ct(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var At=wp.element,kt=(At.useState,At.useEffect,At.useMemo),Lt=React.createElement("g",null,React.createElement("g",null,React.createElement("path",{d:"m391 81h30v-66c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15z",fill:"#39326c"}),React.createElement("path",{d:"m331 81h30v-66c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15z",fill:"#39326c"}),React.createElement("path",{d:"m271 81h30v-66c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15z",fill:"#39326c"}),React.createElement("path",{d:"m211 81h30v-66c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15z",fill:"#5f55af"}),React.createElement("path",{d:"m151 81h30v-66c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15z",fill:"#5f55af"}),React.createElement("path",{d:"m91 81h30v-66c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15z",fill:"#5f55af"}),React.createElement("path",{d:"m406 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15z",fill:"#39326c"}),React.createElement("path",{d:"m346 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15z",fill:"#39326c"}),React.createElement("path",{d:"m286 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15z",fill:"#39326c"}),React.createElement("g",{fill:"#5f55af"},React.createElement("path",{d:"m226 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m166 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m106 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m15 121h66v-30h-66c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m15 181h66v-30h-66c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m15 241h66v-30h-66c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m15 301h66v-30h-66c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m15 361h66v-30h-66c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m15 421h66v-30h-66c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15z"})),React.createElement("path",{d:"m431 91v30h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15z",fill:"#39326c"}),React.createElement("path",{d:"m431 181h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15h-66z",fill:"#39326c"}),React.createElement("path",{d:"m431 241h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15h-66z",fill:"#39326c"}),React.createElement("path",{d:"m431 301h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15h-66z",fill:"#39326c"}),React.createElement("path",{d:"m431 361h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15h-66z",fill:"#39326c"}),React.createElement("path",{d:"m431 421h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15h-66z",fill:"#39326c"})),React.createElement("g",null,React.createElement("path",{d:"m446 51h-380c-8.284 0-15 6.716-15 15v380c0 8.284 6.716 15 15 15h380c8.284 0 15-6.716 15-15v-380c0-8.284-6.716-15-15-15z",fill:"#aed0ff"}),React.createElement("g",null,React.createElement("path",{d:"m461 446v-380c0-8.284-6.716-15-15-15h-190v410h190c8.284 0 15-6.716 15-15z",fill:"#7c84e8"})),React.createElement("path",{d:"m386 111h-260c-8.284 0-15 6.716-15 15v260c0 8.284 6.716 15 15 15h260c8.284 0 15-6.716 15-15v-260c0-8.284-6.716-15-15-15z",fill:"#5f55af"}),React.createElement("g",null,React.createElement("path",{d:"m401 386v-260c0-8.284-6.716-15-15-15h-130v290h130c8.284 0 15-6.716 15-15z",fill:"#39326c"}))),React.createElement("g",null,React.createElement("path",{d:"m247.626 192.389c-.052-.138-.106-.274-.162-.411-2.744-6.671-9.175-10.978-16.387-10.978-.006 0-.012 0-.018 0-7.219.007-13.65 4.329-16.383 11.01-.046.113-.091.227-.134.341l-45.06 118.31c-2.949 7.742.937 16.408 8.679 19.356 7.742 2.95 16.408-.937 19.356-8.679l7.543-19.804h51.691l7.458 19.762c2.267 6.007 7.974 9.708 14.036 9.708 1.76 0 3.55-.312 5.294-.97 7.75-2.925 11.663-11.579 8.737-19.33zm-31.14 79.146 14.538-38.171 14.406 38.171z",fill:"#f9f9f9"}),React.createElement("g",{fill:"#e2dff4"},React.createElement("path",{d:"m264.209 321.296c2.267 6.007 7.974 9.708 14.036 9.708 1.76 0 3.55-.312 5.294-.97 7.75-2.925 11.663-11.579 8.737-19.33l-36.276-96.126v86.956h.751z"}),React.createElement("path",{d:"m328.5 181c-8.284 0-15 6.716-15 15v120c0 8.284 6.716 15 15 15s15-6.716 15-15v-120c0-8.284-6.716-15-15-15z"})))),Mt=React.createElement("g",null,React.createElement("path",{d:"m213.46 341.461-139.26 156.08c-16.17 18.48-44.53 19.33-61.8 2.06-17.32-17.32-16.37-45.67 2.06-61.8l156.08-139.26s13.46-2.54 29.46 13.46 13.46 29.46 13.46 29.46z",fill:"#0052be"}),React.createElement("path",{d:"m213.46 341.461-139.26 156.08c-16.17 18.48-44.53 19.33-61.8 2.06l187.6-187.6c16 16 13.46 29.46 13.46 29.46z",fill:"#00429b"}),React.createElement("path",{d:"m304 240.001-90.54 101.46c-14.997-14.997-27.922-27.922-42.92-42.92l101.46-90.54z",fill:"#00429b"}),React.createElement("path",{d:"m304 240.001-90.54 101.46-21.46-21.46 96-96z",fill:"#00337a"}),React.createElement("path",{d:"m400 279.001h-64.4l-42.47 57.87c-7.88 10.735-24.824 6.606-26.91-6.52l-11.56-73.01-73.01-11.56c-13.139-2.087-17.244-19.042-6.52-26.91l57.87-42.47v-64.4c0-12.176 13.797-19.289 23.72-12.21l50.15 35.83 70.92-19.9c11.25-3.168 21.656 7.245 18.49 18.49l-19.9 70.92 35.83 50.15c7.071 9.913-.02 23.72-12.21 23.72z",fill:"#ffdd54"}),React.createElement("path",{d:"m412.21 255.281c7.071 9.913-.02 23.72-12.21 23.72h-64.4l-42.47 57.87c-7.875 10.728-24.823 6.616-26.91-6.52l-11.56-73.01 137.79-137.79c3.83 3.84 5.3 9.44 3.83 14.66l-19.9 70.92z",fill:"#ffb454"}),React.createElement("path",{d:"m512 39.001c0 8.28-6.72 15-15 15h-9v9c0 8.28-6.72 15-15 15s-15-6.72-15-15v-9h-9c-8.28 0-15-6.72-15-15s6.72-15 15-15h9v-9c0-8.28 6.72-15 15-15s15 6.72 15 15v9h9c8.28 0 15 6.719 15 15z",fill:"#bee75e"}),React.createElement("path",{d:"m512 39.001c0 8.28-6.72 15-15 15h-9v9c0 8.28-6.72 15-15 15s-15-6.72-15-15v-9l30-30h9c8.28 0 15 6.719 15 15z",fill:"#00cb75"}),React.createElement("path",{d:"m336 41.001h-9v-9c0-8.284-6.716-15-15-15s-15 6.716-15 15v9h-9c-8.284 0-15 6.716-15 15s6.716 15 15 15h9v9c0 8.284 6.716 15 15 15s15-6.716 15-15v-9h9c8.284 0 15-6.716 15-15s-6.716-15-15-15z",fill:"#f6f9f9"}),React.createElement("path",{d:"m441 224.001c0 8.284 6.716 15 15 15s15-6.716 15-15v-9h9c8.284 0 15-6.716 15-15s-6.716-15-15-15h-9v-9c0-8.284-6.716-15-15-15s-15 6.716-15 15v9h-9c-8.284 0-15 6.716-15 15s6.716 15 15 15h9z",fill:"#e2dff4"}),React.createElement("path",{d:"m497 329.001h-9v-9c0-8.284-6.716-15-15-15s-15 6.716-15 15v9h-9c-8.284 0-15 6.716-15 15s6.716 15 15 15h9v9c0 8.284 6.716 15 15 15s15-6.716 15-15v-9h9c8.284 0 15-6.716 15-15s-6.716-15-15-15z",fill:"#ff4a4a"}),React.createElement("path",{d:"m192 24.001h-9v-9c0-8.284-6.716-15-15-15s-15 6.716-15 15v9h-9c-8.284 0-15 6.716-15 15s6.716 15 15 15h9v9c0 8.284 6.716 15 15 15s15-6.716 15-15v-9h9c8.284 0 15-6.716 15-15s-6.716-15-15-15z",fill:"#ff8659"}),React.createElement("path",{d:"m159.442 122.977-56-32c-7.191-4.109-16.355-1.611-20.466 5.581-4.11 7.193-1.611 16.355 5.581 20.466l56 32c7.16 4.093 16.337 1.644 20.466-5.581 4.111-7.193 1.612-16.355-5.581-20.466z",fill:"#f6f9f9"}),React.createElement("path",{d:"m118.14 169.117-64 8c-8.221 1.027-14.052 8.524-13.023 16.744 1.027 8.218 8.523 14.054 16.744 13.023l64-8c8.221-1.027 14.052-8.524 13.023-16.744-1.028-8.22-8.527-14.062-16.744-13.023z",fill:"#acceff"}),React.createElement("path",{d:"m389.023 352.558c-4.111-7.193-13.274-9.693-20.466-5.581-7.192 4.11-9.691 13.272-5.581 20.466l32 56c2.769 4.845 7.83 7.561 13.037 7.561 11.319 0 18.784-12.341 13.01-22.445z",fill:"#e2dff4"}),React.createElement("path",{d:"m329.86 377.117c-8.222-1.031-15.717 4.804-16.744 13.023l-8 64c-1.117 8.925 5.834 16.862 14.902 16.862 7.455 0 13.917-5.553 14.865-13.142l8-64c1.029-8.219-4.802-15.716-13.023-16.743z",fill:"#6ba7ff"}));const Pt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.icon,n=void 0===t?"ai":t,r=e.size,a=void 0===r?20:r,o=e.style,i=void 0===o?{}:o,l=kt((function(){switch(n){case"ai":default:return Lt;case"wand":return Mt}}),[n]);return React.createElement("svg",{style:It({width:a,height:a,marginRight:5},i),"enable-background":"new 0 0 512 512",height:"512",viewBox:"0 0 512 512",width:"512",xmlns:"http://www.w3.org/2000/svg"},l)};var jt,Ft,Dt;function Gt(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Ut=function(e){var t=e.title,n=void 0===t?He.COMMON.SETTINGS:t,r=e.options,a=void 0===r?L:r,o=null==a?void 0:a.module_playground,i=null==a?void 0:a.module_generator_content,l=null==a?void 0:a.module_generator_images;return React.createElement(g.n,{title:"AI Engine | ".concat(n),subtitle:"🐱 Made by NyaoGPT"},React.createElement("div",{style:{display:"flex",justifyContent:"flex-end"}},i&&React.createElement(w.M,{className:"header",onClick:function(){return location.href="edit.php?page=mwai_content_generator"}},React.createElement(Pt,{icon:"wand",style:{marginRight:8}}),He.COMMON.CONTENT),l&&React.createElement(w.M,{className:"header",icon:"",onClick:function(){return location.href="edit.php?page=mwai_images_generator"}},React.createElement(Pt,{icon:"wand",style:{marginRight:8}}),He.COMMON.IMAGES),o&&React.createElement(w.M,{className:"header",icon:"",onClick:function(){return location.href="tools.php?page=mwai_dashboard"}},React.createElement(Pt,{icon:"wand",style:{marginRight:8}}),He.COMMON.PLAYGROUND),React.createElement(w.M,{className:"header",icon:"tools",onClick:function(){return location.href="admin.php?page=mwai_settings"}})))},Bt=((0,G.Ay)(w.M)(jt||(jt=Gt(["\n"]))),G.Ay.div(Ft||(Ft=Gt(["\n  display: flex;\n  justify-content: unset;\n  align-items: center;\n  justify-content: space-between;\n  padding: 0 0 2px 0;\n\n  h2 {\n    margin: 7px 0 0 0;\n    padding: 0;\n  }\n"])))),Ht=G.Ay.div(Dt||(Dt=Gt(["\n  display: grid;\n  grid-template-columns: repeat(auto-fit, minmax(30%, 1fr));\n  grid-template-rows: repeat(auto-fit, minmax(30%, 1fr));\n  grid-gap: 10px;\n  margin-top: 20px;\n\n  img, div {\n    width: 100%;\n    cursor: pointer;\n  }\n  .empty-image {\n    width: 100%;\n    padding-bottom: 100%;\n    background-color: #f5f5f5;\n  }\n"]))),Yt=n(4809),zt=n.n(Yt),Wt=n(3896),Vt=n(1843),Kt=n(5900),qt=n(7494),Xt=n(8482),$t=n(209),Qt=n(520),Jt=n(851),Zt=n(6897);function en(e){return en="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},en(e)}function tn(){tn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==en(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(en(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 nn(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function rn(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){nn(o,r,a,i,l,"next",e)}function l(e){nn(o,r,a,i,l,"throw",e)}i(void 0)}))}}var an=function(){var e=rn(tn().mark((function e(){var t;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/helpers/post_types"),{nonce:k});case 2:if((t=e.sent).success){e.next=5;break}throw new Error(t.message);case 5:return e.abrupt("return",t.postTypes);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),on=function(){var e=rn(tn().mark((function e(t){var n;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/helpers/count_posts?postType=").concat(t),{nonce:k});case 2:return n=e.sent,e.abrupt("return",null!=n&&n.count?parseInt(null==n?void 0:n.count):null);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ln=function(){var e=rn(tn().mark((function e(t){var n,r,a,o=arguments;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>1&&void 0!==o[1]?o[1]:0,r=o.length>2&&void 0!==o[2]?o[2]:0,e.next=4,(0,O.IU)("".concat(T,"/helpers/post_content?postType=").concat(t,"&offset=").concat(n,"&postId=").concat(r),{nonce:k});case 4:return a=e.sent,e.abrupt("return",a);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),cn=function(){var e=rn(tn().mark((function e(t){var n;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(S,"/mwai-ui/v1/files/delete"),{nonce:k,method:"POST",json:{files:t}});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(n.message);case 5:return e.abrupt("return",n);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),un=function(){var e=rn(tn().mark((function e(){var t,n,r,a,o,i=arguments;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.length>0&&void 0!==i[0]?i[0]:null,r=i.length>1&&void 0!==i[1]?i[1]:null,a="".concat(T,"/openai/files/list?envId=").concat(n),r&&(a+="&purpose=".concat(r)),e.next=6,(0,O.IU)(a,{nonce:k});case 6:if((o=e.sent).success){e.next=9;break}throw new Error(o.message);case 9:return e.abrupt("return",null==o||null===(t=o.files)||void 0===t?void 0:t.data);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),sn=function(){var e=rn(tn().mark((function e(t){var n,r,a,o,i,l,c,u,s,f,m,d,p;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.userId,r=void 0===n?null:n,a=t.purpose,o=void 0===a?null:a,i=t.metadata,l=void 0===i?null:i,c=t.envId,u=void 0===c?null:c,s=t.limit,f=void 0===s?10:s,m=t.page,d=void 0===m?0:m,e.next=3,(0,O.IU)("".concat(S,"/mwai-ui/v1/files/list"),{nonce:k,method:"POST",json:{userId:r,purpose:o,metadata:l,envId:u,limit:f,page:d}});case 3:if((p=e.sent).success){e.next=6;break}throw new Error(p.message);case 6:return e.abrupt("return",null==p?void 0:p.data);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),fn=function(){var e=rn(tn().mark((function e(){var t,n,r,a=arguments;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.length>0&&void 0!==a[0]?a[0]:null,n=a.length>1&&void 0!==a[1]&&a[1],e.next=4,(0,O.IU)("".concat(T,"/openai/finetunes/list_deleted?envId=").concat(t,"&legacy=").concat(n),{nonce:k});case 4:if((r=e.sent).success){e.next=7;break}throw new Error(r.message);case 7:return e.abrupt("return",null==r?void 0:r.finetunes);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),mn=function(){var e=rn(tn().mark((function e(){var t;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/settings/themes"),{method:"GET",nonce:k});case 2:return t=e.sent,e.abrupt("return",null==t?void 0:t.themes);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),dn=function(){var e=rn(tn().mark((function e(t){var n,r,a,o,i;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(n=[],r=0;r<t.length;r++){if(a=t[r].themeId,n.includes(a)){for(o=1;n.includes(a+"-"+o);)o++;a=a+"-"+o}n.push(a),t[r].themeId=a}return e.next=4,(0,O.IU)("".concat(T,"/settings/themes"),{method:"POST",nonce:k,json:{themes:t}});case 4:return i=e.sent,e.abrupt("return",null==i?void 0:i.themes);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),pn=function(){var e=rn(tn().mark((function e(){var t,n,r,a=arguments;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.length>0&&void 0!==a[0]?a[0]:null,n=a.length>1&&void 0!==a[1]&&a[1],e.next=4,(0,O.IU)("".concat(T,"/openai/finetunes/list?envId=").concat(t,"&legacy=").concat(n),{nonce:k});case 4:if((r=e.sent).success){e.next=7;break}throw new Error(r.message);case 7:return e.abrupt("return",null==r?void 0:r.finetunes);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),hn=function(){var e=rn(tn().mark((function e(){var t;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/settings/chatbots"),{method:"GET",nonce:k});case 2:if((t=e.sent).success){e.next=5;break}throw new Error(null==t?void 0:t.message);case 5:return e.abrupt("return",null==t?void 0:t.chatbots);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),yn=function(){var e=rn(tn().mark((function e(t){var n;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/settings/chatbots"),{method:"POST",nonce:k,json:{chatbots:t}});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",null==n?void 0:n.chatbots);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),vn=function(){var e=rn(tn().mark((function e(t){var n;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/openai/assistants/list?envId=").concat(t),{nonce:k});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(n.message);case 5:return e.abrupt("return",null==n?void 0:n.assistants);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),gn=function(){var e=rn(tn().mark((function e(t,n,r){var a;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/openai/assistants/set_functions"),{method:"POST",nonce:k,json:{envId:t,assistantId:n,functions:r}});case 2:if((a=e.sent).success){e.next=5;break}throw new Error(a.message);case 5:return e.abrupt("return",a);case 6:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),En=function(){var e=rn(tn().mark((function e(){var t;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/settings/options"),{method:"GET",nonce:k});case 2:return t=e.sent,e.abrupt("return",null==t?void 0:t.options);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),bn=function(){var e=rn(tn().mark((function e(){var t;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,O.IU)("".concat(T,"/get_logs"),{nonce:k,method:"GET"});case 3:return t=e.sent,e.abrupt("return",t.data);case 7:throw e.prev=7,e.t0=e.catch(0),new Error(e.t0.message);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}(),wn=function(){var e=rn(tn().mark((function e(){return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,O.IU)("".concat(T,"/clear_logs"),{nonce:k});case 3:e.next=8;break;case 5:throw e.prev=5,e.t0=e.catch(0),new Error(e.t0.message);case 8:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(){return e.apply(this,arguments)}}();function Rn(e){return Rn="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},Rn(e)}function On(){On=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Rn(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Rn(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 _n(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function xn(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){_n(o,r,a,i,l,"next",e)}function l(e){_n(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Sn(e){return function(e){if(Array.isArray(e))return Cn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Nn(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 Tn(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||Nn(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 Nn(e,t){if(e){if("string"==typeof e)return Cn(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)?Cn(e,t):void 0}}function Cn(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 In=wp.element.useState;const An=function(e){var t=e.instructions,n=e.setMessages,r=Tn(In("post"),2),a=r[0],o=r[1],i=Tn(In(0),2),l=i[0],c=i[1],u=Tn(In(!1),2),s=u[0],m=u[1],d=Tn(In("Generate 30 questions and answers from this text. Questions use a neutral tone. Answers use the same tone as the text."),2),p=d[0],h=d[1],y=(0,f.I)({queryKey:["postTypes"],queryFn:an}),v=y.isLoading,g=y.data,E=(0,f.I)({queryKey:["postsCount-"+a],queryFn:function(){return on(a)}}),b=E.isLoading,R=E.data,_=(0,Zt.XS)({i18n:He,onStop:function(){m(),_.reset()}}),x=s||_.busy||b||v,S=function(e){if(!e)return[];for(var n=e.split("\n").filter((function(e){return""!==e.trim()})),r=[],a=[],o=0;o<n.length;o++)n[o].startsWith("Q:")?(a.length&&(r.push({messages:Sn(a)}),a=[]),a.push({role:"system",content:t}),a.push({role:"user",content:n[o].slice(2).trim()})):n[o].startsWith("A:")&&(a.push({role:"assistant",content:n[o].slice(2).trim()}),r.push({messages:Sn(a)}),a=[]);return a.length&&r.push({messages:a}),r},N=function(){var e=xn(On().mark((function e(){var t,n,r,o,i,l,u,s,f,m,d,h,y,v,g,E,b,w=arguments;return On().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=w.length>0&&void 0!==w[0]?w[0]:0,n=w.length>1&&void 0!==w[1]?w[1]:void 0,r=w.length>2&&void 0!==w[2]?w[2]:void 0,o=p+"\n\nUse this format:\n\nQ: Question?\nA: Answer.\n\nQ: Question?\nA: Answer.\nText:\n\n{CONTENT}",e.next=6,ln(a,t,n||void 0);case 6:if(i=e.sent,l=null,u=null,s=null==i?void 0:i.content,f=null==i?void 0:i.url,m=null==i?void 0:i.title,d=0,i.success){e.next=18;break}alert(i.message),l=i.message,e.next=35;break;case 18:if(!(s.length<64)){e.next=22;break}console.log("Issue: Content is too short! Skipped.",{content:s}),e.next=35;break;case 22:return o=(o=(o=o.replace("{CONTENT}",s)).replace("{URL}",f)).replace("{TITLE}",m),e.next=27,(0,O.IU)("".concat(T,"/ai/completions"),{method:"POST",json:{scope:"admin-tools",session:M,message:o},signal:r,nonce:k});case 27:if((y=e.sent).success){e.next=33;break}if(null===(v=y.error)||void 0===v||!v.cancelledByUser){e.next=31;break}return e.abrupt("return",null);case 31:throw console.error(y),new Error(null!==(g=y.message)&&void 0!==g?g:"Unknown error, check your console logs.");case 33:u=null==y?void 0:y.data,null!=y&&null!==(h=y.usage)&&void 0!==h&&h.total_tokens&&(d=y.usage.total_tokens,c((function(e){return e+y.usage.total_tokens})));case 35:return null!=r&&r.aborted&&C(),E=S(u),b={content:s,prompt:o,rawData:u,entries:E,error:l,tokens:d},console.log("Result:",b),e.abrupt("return",b);case 40:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),C=function(){console.log("User aborted."),setBusy(!1),_.reset()},I=function(){var e=xn(On().mark((function e(){var t,r,a;return On().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c(0),t=Array.from(Array(R).keys()),r=prompt("There are "+t.length+" entries. If you want to start from a certain entry offset, type it here. Otherwise, just press OK, and everything will be processed."),a=t.map((function(e){return function(){var t=xn(On().mark((function t(a){var o,i;return On().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(console.log("Task "+e),!(r&&e<r)){t.next=3;break}return t.abrupt("return",{success:!0});case 3:return t.next=5,N(e,null,a);case 5:return(null==(i=t.sent)||null===(o=i.entries)||void 0===o?void 0:o.length)>0&&n((function(e){return[].concat(Sn(e),Sn(i.entries))})),t.abrupt("return",{success:!0});case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()})),e.next=6,_.start(a);case 6:m(!1),alert("All done!"),_.reset();case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),A=function(){var e=xn(On().mark((function e(){var t,r;return On().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,c(0),null!==(t=prompt("Enter the ID of a post (leave blank to use the very first one)."))){e.next=5;break}return e.abrupt("return");case 5:return m("singleGenerate"),e.next=8,N(0,t);case 8:(r=e.sent).entries.length?confirm("Got ".concat(r.entries.length," entries! Do you want to add them to your data? If not, they will be displayed in your console."))&&n((function(e){return[].concat(Sn(e),Sn(r.entries))})):alert("No entries were generated. Check the console for more information."),e.next=16;break;case 12:e.prev=12,e.t0=e.catch(0),console.error(e.t0),alert(e.t0.message);case 16:return e.prev=16,m(!1),e.finish(16);case 19:case"end":return e.stop()}}),e,null,[[0,12,16,19]])})));return function(){return e.apply(this,arguments)}}();return React.createElement(React.Fragment,null,React.createElement("div",{style:{display:"flex",width:"100%"}},React.createElement(w.M,{disabled:x,onClick:A,isBusy:"singleGenerate"===s},He.COMMON.SINGLE_GENERATE),React.createElement("span",{style:{color:"#d1e8f2",fontSize:"22px",padding:5}},"|"),React.createElement(w.M,{disabled:x,onClick:function(){return I()}},"Bulk Generate"),React.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",paddingLeft:10}},"Based on ",b&&"...",!b&&R),React.createElement(we.u,{id:"postType",scrolldown:!0,disabled:x,name:"postType",style:{width:100,marginLeft:10},onChange:o,value:a},null==g?void 0:g.map((function(e){return React.createElement(we.j,{key:e.type,value:e.type,label:e.name})}))),React.createElement(Jt.j,{busy:_.busy,style:{marginLeft:10,flex:"auto"},value:_.value,max:_.max,onStopClick:_.stop}),React.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",paddingLeft:10}},"Tokens: ",l)),React.createElement("div",{style:{width:"100%"}},React.createElement(Wt.m,{id:"generatePrompt",name:"generatePrompt",rows:2,style:{marginTop:10,marginBottom:5},value:p,onBlur:h,disabled:x})),_.TasksErrorModal)};function kn(e){return kn="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},kn(e)}function Ln(e){return function(e){if(Array.isArray(e))return Hn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Bn(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 Mn(){Mn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==kn(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(kn(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Pn(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 jn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pn(Object(n),!0).forEach((function(t){Fn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Fn(e,t,n){var r;return r=function(e,t){if("object"!=kn(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=kn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==kn(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dn(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Gn(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Dn(o,r,a,i,l,"next",e)}function l(e){Dn(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Un(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||Bn(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){if(e){if("string"==typeof e)return Hn(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)?Hn(e,t):void 0}}function Hn(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 Yn=wp.element,zn=Yn.useState,Wn=Yn.useMemo,Vn=Yn.useRef,Kn=Yn.useEffect,qn=function(e){var t=e.createdOn,n=e.estimatedOn;if(!t||!n)return null;var r=new Date;t=new Date(t),n=new Date(n);var a,o,i,l=function(e){return new Date(e).toLocaleString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})};return React.createElement("div",null,"Start: ",l(t),".",React.createElement("br",null),"Finish: ",l(n),".",React.createElement("br",null),"Time Left: ",React.createElement("b",null,(a=n-r,o=Math.floor(a/6e4),(i=Math.floor(o/60))>0?"".concat(i," hour").concat(i>1?"s":""," and ").concat(o%60," minute").concat(o%60!=1?"s":""):"".concat(o," minute").concat(1!==o?"s":""))),".",React.createElement("br",null),React.createElement("br",null),React.createElement("small",null,"Use Refresh Models to update the status."))},Xn=[{accessor:"row",title:"#",width:25,verticalAlign:"top"},{accessor:"question",title:"Question",verticalAlign:"top"},{accessor:"answer",title:"Answer",verticalAlign:"top"},{accessor:"actions",title:"",width:36,align:"center"}],$n=[{accessor:"row",title:"#",width:25,verticalAlign:"top"},{accessor:"messages",title:"Messages",verticalAlign:"top"},{accessor:"actions",title:"",width:68,align:"top"}],Qn=[{accessor:"status",title:"Status",sortable:!0,width:"120px"},{accessor:"id",title:"ID",width:"120px"},{accessor:"filename",title:"File"},{accessor:"purpose",title:"Purpose"},{accessor:"filesize",title:"Size",sortable:!0},{accessor:"createdOn",title:"Date",sortable:!0,width:"80px"},{accessor:"actions",title:"",width:"190px"}],Jn=[{accessor:"status",title:"Status",sortable:!0,width:"120px"},{accessor:"id",title:"ID",width:"120px"},{accessor:"suffix",title:"Suffix"},{accessor:"model",title:"Model"},{accessor:"base_model",title:"Based On",width:"200px"},{accessor:"createdOn",title:"Date",sortable:!0,width:"80px"},{accessor:"actions",title:""}],Zn=function(e){var t=e.status,n=e.includeText,r=void 0!==n&&n,a=(0,s.z)().colors,o=a.orange,i=a.green,l=a.red,c=null;switch(t){case"pending":case"running":c=React.createElement(Oe.z,{title:t,icon:"replay",spinning:!0,width:24,color:o});break;case"succeeded":case"processed":c=React.createElement(Oe.z,{title:t,icon:"check-circle",width:24,color:i});break;case"failed":c=React.createElement(Oe.z,{title:t,icon:"close",width:24,color:l});break;case"cancelled":c=React.createElement(Oe.z,{title:t,icon:"close",width:24,color:o});break;default:c=React.createElement(Oe.z,{title:t,icon:"alert",width:24,color:o})}return r?React.createElement("div",{style:{display:"flex",alignItems:"center"}},c,React.createElement("span",{style:{textTransform:"uppercase",fontSize:9,marginLeft:3}},t)):c},er=function(e){var t=e.children,n=e.data,r=e.onChange,a=void 0===r?function(){}:r,o=Un(zn(!1),2),i=o[0],l=o[1],c=function(e){l(!1),e!==n&&a(e)};return i?React.createElement("div",{onKeyUp:function(e){"Escape"===e.key&&c(n)},style:{height:"100%",display:"flex",flexDirection:"column",width:"100%"}},React.createElement(Wt.m,{onBlurForce:!0,autoFocus:!0,fullHeight:!0,rows:3,style:{height:"100%",width:"100%"},onEnter:c,onBlur:c,value:n}),React.createElement(w.M,{onClick:c,fullWidth:!0,style:{marginTop:2,height:35}},"Save")):React.createElement("pre",{style:{width:"100%",height:"100%",whiteSpace:"break-spaces",margin:0,padding:0,fontSize:13,fontFamily:"inherit"},onClick:function(){return l(!0)}},t)};const tr=function(e){var t,n=e.options,r=e.updateOption,a=e.refreshOptions,o=(0,s.z)().colors,i=(0,u.jE)(),l=Un(zn(!1),2),c=l[0],m=l[1],d=Un(zn(),2),p=d[0],h=d[1],v=Un(zn(!1),2),g=v[0],R=v[1],_=Un(zn("finetunes"),2),x=_[0],S=_[1],N=Un(zn("current"),2),C=N[0],I=N[1],A=Un(zn("fine-tune"),2),L=A[0],M=A[1],P=Un(zn("meow"),2),j=P[0],F=P[1],D=Un(zn(!1),2),G=D[0],U=D[1],B=Un(zn(4),2),H=B[0],Y=B[1],z=Un(zn(4),2),W=z[0],V=z[1],K=Un(zn(.1),2),q=K[0],X=K[1],$=Un(zn(.01),2),Q=$[0],J=$[1],Z=Un(zn(!1),2),ee=Z[0],te=Z[1],ne=Un(zn(null==n||null===(t=n.ai_envs)||void 0===t||null===(t=t[0])||void 0===t?void 0:t.id),2),re=ne[0],ae=ne[1],oe=Wn((function(){return(null==n?void 0:n.ai_envs)||[]}),[n]),ie=Wn((function(){return null==oe?void 0:oe.find((function(e){return e.id===re}))}),[re,oe]),le=(null==ie?void 0:ie.finetunes_deleted)||[],ce=(null==ie?void 0:ie.finetunes)||[],ue=(0,f.I)({queryKey:["datasets-"+re+"-"+L],enabled:ee,queryFn:function(){return un(re,L)}}),se=ue.isFetching,fe=ue.error,me=ue.data,de=Un(zn("gpt-4o-mini-2024-07-18"),2),pe=de[0],he=de[1],ye=function(){var e=Gn(Mn().mark((function e(t,n){var a;return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=oe.map((function(e){return e.id===re?jn(jn({},e),{},Fn({},t,n)):e})),e.abrupt("return",r(a,"ai_envs"));case 2:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}();Kn((function(){"files"!==x||ee||te(!0)}),[x]),Kn((function(){fe&&!c&&m(fe)}),[fe]);var ve=10,ge=Un(zn(!0),2),Ee=ge[0],be=ge[1],Oe=Un(zn(1),2),Ce=Oe[0],Ie=Oe[1],Ae=Un(zn([]),2),ke=Ae[0],Le=Ae[1],Me=Un(zn(!1),2),Pe=Me[0],je=Me[1],Fe=Un(zn("You are Chihiro, an AI Assistant. Your primary objective is to assist website visitors by directing them to the appropriate page or succinctly answering their questions with precision."),2),De=Fe[0],Ge=Fe[1],Ue=Un(zn(""),2),Be=Ue[0],Ye=Ue[1],ze=Un(zn(!1),2),We=ze[0],Ve=ze[1],Ke=Un(zn([]),2),qe=Ke[0],Xe=Ke[1],$e=Wn((function(){return ke.length}),[ke]);Kn((function(){if(0!==ke.length){var e=ke.map((function(e,t){if(!e.messages||e.messages.length<3)return t+1;if("system"!==e.messages[0].role||"user"!==e.messages[1].role||"assistant"!==e.messages[2].role)return t+1;for(var n=3;n<e.messages.length;n++)if(e.messages[n].role===e.messages[n-1].role)return t+1;return null})).filter((function(e){return null!==e}));Xe(e),Ve(0===e.length)}else Ve(!1)}),[ke]);var Qe=function(e){var t=e.messages,n=e.currentRow,r=e.onUpdateDataRow,a=e.onDeleteDataRow;return React.createElement(React.Fragment,null,t.map((function(e,t){return React.createElement("div",{key:t,style:{display:"flex"}},React.createElement(w.M,{rounded:!0,icon:"trash",onClick:function(){return a(n,t+1)}}),React.createElement("div",{style:{width:120,paddingLeft:5,paddingTop:0,paddingBottom:4,marginRight:10}},React.createElement(we.u,{scrolldown:!0,name:"role",value:e.role,style:{width:120},onChange:function(a){return r(n,a,e.content,t+1)}},React.createElement(we.j,{value:"assistant",label:"Assistant"}),React.createElement(we.j,{value:"user",label:"User"}),React.createElement(we.j,{value:"system",label:"System"}))),React.createElement(er,{data:e.content,style:{flex:"auto"},onChange:function(a){return r(n,e.role,a,t+1)}},e.content))})))},Je=function(){var e=Gn(Mn().mark((function e(){return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.invalidateQueries("datasets");case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ze=function(){var e=Gn(Mn().mark((function e(){return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return R(!0),e.next=3,Je();case 3:R(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),et=function(){var e=Gn(Mn().mark((function e(){var t,n,r,a;return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=p,n=j,R(!0),r={envId:re,fileId:t,model:pe,suffix:n},G&&(r=jn(jn({},r),{},{nEpochs:H,batchSize:W,learningRateMultiplier:q,promptLossWeight:Q})),e.prev=5,e.next=8,(0,O.IU)("".concat(T,"/openai/files/finetune"),{method:"POST",nonce:k,json:r});case 8:(a=e.sent).success?(tt(),alert(He.ALERTS.FINETUNING_STARTED),S("finetunes"),h()):alert(a.message),e.next=16;break;case 12:e.prev=12,e.t0=e.catch(5),console.log(e.t0.message),alert(e.t0.message);case 16:R(!1);case 17:case"end":return e.stop()}}),e,null,[[5,12]])})));return function(){return e.apply(this,arguments)}}(),tt=function(){var e=Gn(Mn().mark((function e(){return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(R("finetunes"),ce.length){e.next=6;break}return e.next=4,fn(re);case 4:e.next=8;break;case 6:return e.next=8,pn(re);case 8:return e.next=10,a();case 10:R(!1);case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),nt=function(){var e=Gn(Mn().mark((function e(){return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return R("clean"),e.next=3,fn(re);case 3:return e.next=5,a();case 5:R(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),rt=function(){(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&!confirm(He.ALERTS.RESET_BUILDER)||(Le([]),it({instructions:De,entries:[]}))};Kn((function(){if(!ke||0===ke.length){var e=localStorage.getItem("mwai_builder_data_v2");if(e){var t=JSON.parse(e);Le(t.entries),t.instructions&&Ge(t.instructions)}}}),[]);var at=function(e){for(var t,n=!1,r=!1,a=function(){var t=ke[o].messages;if(t&&t.length>0)if("system"===t[0].role){if(t[0].content!==e){if(!n){if(!confirm("The instructions in your data do not match the ones in your entries. Do you want to replace it for every entry?"))return{v:void 0};n=!0}var a=Ln(ke);a[o].messages[0].content=e,Le((function(){return a}))}}else{if(!r){if(!confirm("Some entries are missing the system role as the first message. Do you want to add it for every entry where it's missing?"))return{v:void 0};r=!0}var i=Ln(ke);i[o].messages.unshift({role:"system",content:e}),Le((function(){return i}))}else{if(!r){if(!confirm("Some entries are missing the system role as the first message. Do you want to add it for every entry where it's missing?"))return{v:void 0};r=!0}var l=Ln(ke);l[o].messages=[{role:"system",content:e}].concat(Ln(t)),Le((function(){return l}))}},o=0;o<ke.length;o++)if(t=a())return t.v},ot=function(e){Ge(e),Pe||at(e)},it=function(e){!function(){var e=new Date,t=e.toLocaleDateString("ja-JP",{year:"numeric",month:"2-digit",day:"2-digit"});t=t.replace(/\//g,"."),t+="-"+e.getHours().toString().padStart(2,"0")+"."+e.getMinutes().toString().padStart(2,"0"),Ye("MEOW-".concat(t,".jsonl"))}();try{e?localStorage.setItem("mwai_builder_data_v2",(0,O.F1)(e)):localStorage.removeItem("mwai_builder_data_v2"),be(!0)}catch(e){localStorage.removeItem("mwai_builder_data_v2"),be(!1)}};Kn((function(){ke&&(null==ke?void 0:ke.length)>0&&it({instructions:De,entries:ke})}),[ke]),Kn((function(){De&&(null==De?void 0:De.length)>0&&it({instructions:De,entries:ke})}),[De]);var lt=function(e,t){var n=Ln(ke);n[e-1].messages.splice(t-1,1),Le(n)},ct=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=ke.map((function(a,o){if(o===e-1){if(r)return jn(jn({},a),{},{messages:a.messages.map((function(e,a){return a===r-1?jn(jn({},e),{},{role:t,content:n}):e}))});if("assistant"===t)return jn(jn({},a),{},{messages:a.messages.map((function(e){return"assistant"===e.role?jn(jn({},e),{},{content:n}):e}))});if("user"===t)return jn(jn({},a),{},{messages:a.messages.map((function(e){return"user"===e.role?jn(jn({},e),{},{content:n}):e}))})}return a}));Le(a)},ut=Wn((function(){var e=(Ce-1)*ve,t=null==ke?void 0:ke.slice((Ce-1)*ve,(Ce-1)*ve+ve);return null==t?void 0:t.map((function(t){var n=++e,r="",a="",o=[];if(Pe)o=t.messages;else{var i=t.messages.find((function(e){return"user"===e.role}));i&&(r=i.content);var l=t.messages.find((function(e){return"assistant"===e.role}));l&&(a=l.content)}return{row:n,messages:React.createElement(Qe,{entries:ke,messages:o,currentRow:n,onUpdateDataRow:ct,onDeleteDataRow:lt}),question:React.createElement(er,{data:r,onChange:function(e){return ct(n,"user",e)}},r),answer:React.createElement(er,{data:a,onChange:function(e){return ct(n,"assistant",e)}},a),actions:React.createElement(React.Fragment,null,Pe&&React.createElement(w.M,{rounded:!0,icon:"plus",onClick:function(){return _t(n)}}),React.createElement(w.M,{rounded:!0,icon:"trash",onClick:function(){return e=n,t=ke.filter((function(t,n){return n!==e-1})),Le(t),void(0===t.length&&it({instructions:De,entries:[]}));var e,t}}))}}))}),[ke,Ce,ve,Pe,ct,lt]),st=function(){var e=Gn(Mn().mark((function e(t){var n;return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return R(!0),e.prev=1,e.next=4,(0,O.IU)("".concat(T,"/openai/files/delete"),{method:"POST",nonce:k,json:{envId:re,fileId:t}});case 4:if(!(n=e.sent).success){e.next=10;break}return e.next=8,Je();case 8:e.next=11;break;case 10:alert(n.message);case 11:e.next=17;break;case 13:e.prev=13,e.t0=e.catch(1),console.error(e.t0),alert(He.ALERTS.CHECK_CONSOLE);case 17:R(!1);case 18:case"end":return e.stop()}}),e,null,[[1,13]])})));return function(t){return e.apply(this,arguments)}}(),ft=function(){var e=Gn(Mn().mark((function e(t){var n;return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return R(!0),e.prev=1,e.next=4,(0,O.IU)("".concat(T,"/openai/finetunes/cancel"),{method:"POST",nonce:k,json:{envId:re,finetuneId:t}});case 4:(n=e.sent).success?tt():alert(n.message),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error(e.t0),alert(He.ALERTS.CHECK_CONSOLE);case 12:R(!1);case 13:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}(),mt=function(){var e=Gn(Mn().mark((function e(t){return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(confirm(He.ALERTS.DELETE_FINETUNE)){e.next=2;break}return e.abrupt("return");case 2:return R(!0),e.prev=3,e.next=6,ye("finetunes_deleted",[].concat(Ln(le),[t]));case 6:e.next=12;break;case 8:e.prev=8,e.t0=e.catch(3),console.error(e.t0),alert(He.ALERTS.CHECK_CONSOLE);case 12:R(!1);case 13:case"end":return e.stop()}}),e,null,[[3,8]])})));return function(t){return e.apply(this,arguments)}}(),dt=function(){var e=Gn(Mn().mark((function e(t){var n;return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(confirm(He.ALERTS.DELETE_FINETUNE)){e.next=2;break}return e.abrupt("return");case 2:return R(!0),e.prev=3,e.next=6,(0,O.IU)("".concat(T,"/openai/finetunes/delete"),{method:"POST",nonce:k,json:{envId:re,modelId:t}});case 6:if(!(n=e.sent).success){e.next=12;break}return e.next=10,ye("finetunes_deleted",[].concat(Ln(le),[t]));case 10:e.next=19;break;case 12:if(!(n.message.indexOf("does not exist")>-1)){e.next=18;break}return alert(He.ALERTS.FINETUNE_ALREADY_DELETED),e.next=16,ye("finetunes_deleted",[].concat(Ln(le),[t]));case 16:e.next=19;break;case 18:alert(n.message);case 19:e.next=25;break;case 21:e.prev=21,e.t0=e.catch(3),console.error(e.t0),alert(He.ALERTS.CHECK_CONSOLE);case 25:R(!1);case 26:case"end":return e.stop()}}),e,null,[[3,21]])})));return function(t){return e.apply(this,arguments)}}(),pt=function(){var e=Gn(Mn().mark((function e(t,n){var r,a,o,i;return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return R(!0),e.prev=1,e.next=4,(0,O.IU)("".concat(T,"/openai/files/download"),{method:"POST",nonce:k,json:{envId:re,fileId:t}});case 4:(r=e.sent).success?(a=new Blob([r.data],{type:"text/plain"}),o=window.URL.createObjectURL(a),(i=document.createElement("a")).setAttribute("href",o),i.setAttribute("download","".concat(n)),document.body.appendChild(i),i.click(),i.remove()):alert(r.message),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error(e.t0),alert(He.ALERTS.CHECK_CONSOLE);case 12:R(!1);case 13:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,n){return e.apply(this,arguments)}}(),ht=Wn((function(){return null==me?void 0:me.sort((function(e,t){return t.created_at-e.created_at})).map((function(e){var t=e.id,n=e.filename,r=new Date(1e3*e.created_at),a="fine-tune"===e.purpose;return{status:React.createElement(Zn,{status:e.status,includeText:!0}),id:t,filename:n,purpose:e.purpose,filesize:(0,O.z3)(e.bytes),createdOn:React.createElement(React.Fragment,null,r.toLocaleDateString(),React.createElement("br",null),r.toLocaleTimeString()),actions:React.createElement(React.Fragment,null,React.createElement(w.M,{disabled:!a,icon:"wand",onClick:function(){return h(t)}},"Train Model"),React.createElement(w.M,{rounded:!0,icon:"arrow-down",onClick:function(){return pt(t,n)}}),React.createElement(w.M,{className:"danger",rounded:!0,icon:"trash",onClick:function(){return st(t)}}))}}))}),[me]),yt=function(e){return le.includes(e.model)||le.includes(e.id)},vt=function(e){return"failed"===e.status||"cancelled"===e.status},gt=function(e){return!vt(e)&&!yt(e)},Et=Wn((function(){if(!ce)return[];var e=ce;return"current"===C?e=e.filter(gt):"deleted"===C?e=e.filter(yt):"failed"===C&&(e=e.filter(vt)),e.map((function(e){var t=new Date(e.createdOn);return jn(jn({},e),{},{model:e.model?e.model:React.createElement(qn,{createdOn:e.createdOn,estimatedOn:e.estimatedOn}),status:React.createElement(Zn,{status:e.status,includeText:!0}),createdOn:React.createElement(React.Fragment,null,t.toLocaleDateString(),React.createElement("br",null),t.toLocaleTimeString()),actions:React.createElement(React.Fragment,null,"succeeded"===e.status&&React.createElement(w.M,{className:"danger",rounded:!0,icon:"trash",onClick:function(){return dt(e.model)}}),"cancelled"===e.status&&React.createElement(w.M,{className:"danger",rounded:!0,icon:"trash",onClick:function(){return mt(e.id)}}),"failed"===e.status&&React.createElement(w.M,{className:"danger",rounded:!0,icon:"trash",onClick:function(){return mt(e.id)}}),"pending"===e.status&&React.createElement(w.M,{className:"danger",rounded:!0,icon:"close",onClick:function(){return ft(e.id)}}))})}))}),[C,le,ce]),bt=se||g,wt=function(){var e=Gn(Mn().mark((function e(){var t,n;return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return R(!0),e.prev=1,t=ke.map((function(e){return(0,O.F1)(e)})).join("\n"),e.next=5,(0,O.IU)("".concat(T,"/openai/files/upload"),{method:"POST",nonce:k,json:{envId:re,filename:Be,data:t}});case 5:return n=e.sent,e.next=8,Je();case 8:n.success?(rt(!1),alert(He.ALERTS.DATASET_UPLOADED),S("files")):alert(n.message),e.next=15;break;case 11:e.prev=11,e.t0=e.catch(1),console.error(e.t0),alert(He.ALERTS.CHECK_CONSOLE);case 15:R(!1);case 16:case"end":return e.stop()}}),e,null,[[1,11]])})));return function(){return e.apply(this,arguments)}}(),Rt=Wn((function(){var e=new Date,t=e.getFullYear(),n=e.getMonth()+1,r=e.getDate(),a=e.getHours(),o=e.getMinutes(),i=e.getSeconds();return"".concat(pe,":ft-your-org:").concat(j,"-").concat(t,"-").concat(n<10?"0"+n:n,"-").concat(r<10?"0"+r:r,"-").concat(a<10?"0"+a:a,"-").concat(o<10?"0"+o:o,"-").concat(i<10?"0"+i:i)}),[j,pe]),Ot=function(){var e=Gn(Mn().mark((function e(t){var n,r;return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Mn().mark((function e(){var n,a,o,i,l,c;return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t[r],a=new FileReader,o=n.name.endsWith(".json"),i=n.name.endsWith(".jsonl"),l=n.name.endsWith(".csv"),c=!1,o||i||l){e.next=10;break}return alert(He.ALERTS.ONLY_SUPPORTS_FILES),console.warn(n),e.abrupt("return",1);case 10:a.onload=function(){var e=Gn(Mn().mark((function e(t){var n,r,a,u;return Mn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.target.result,r=[],o?r=JSON.parse(n):i?(a=n.split("\n"),r=a.map((function(e){e=e.trim();try{return JSON.parse(e)}catch(t){return console.error(t,e),null}})),r.every((function(e){return e.messages}))||(c=!0)):l&&(u=zt().parse(n,{header:!0,skipEmptyLines:!0}),r=u.data,console.log("The CSV was loaded!",r),c=!0),c&&(r=r.map((function(e){var t=Object.keys(e).reduce((function(t,n){return t[n.toLowerCase()]=e[n],t}),{});c=!0;var n=["prompt","question","q"].find((function(e){return t[e]})),r=["completion","reply","a"].find((function(e){return t[e]})),a=t[n],o=t[r],i=null==o?void 0:o.replace(/\n\n$/g,""),l=null==a?void 0:a.replace(/\n\n###\n\n$/g,"");return a&&o?{messages:[{role:"system",content:De},{role:"user",content:l.trim()},{role:"assistant",content:i.trim()}]}:null}))),(r=r.filter((function(e){return e}))).every((function(e){return null==e?void 0:e.messages}))){e.next=9;break}return alert(He.ALERTS.ONLY_SUPPORTS_FILES),e.abrupt("return");case 9:Le(r);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),a.readAsText(n);case 12:case"end":return e.stop()}}),e)})),r=0;case 2:if(!(r<t.length)){e.next=9;break}return e.delegateYield(n(),"t0",4);case 4:if(!e.t0){e.next=6;break}return e.abrupt("continue",6);case 6:r++,e.next=2;break;case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),_t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"user",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Hello!",r=ke.map((function(r,a){return a===e-1?jn(jn({},r),{},{messages:[].concat(Ln(r.messages),[{role:t,content:n}])}):r}));Le(r)},xt=Vn(null),St=null==ce?void 0:ce.filter(gt).length,Tt=null==ce?void 0:ce.filter(vt).length,Nt=null==ce?void 0:ce.filter(yt).length,Ct=Wn((function(){return React.createElement(we.u,{scrolldown:!0,value:re,onChange:ae,style:{marginLeft:5}},oe.filter((function(e){return"openai"===e.type})).map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})})))}),[re,oe]),It=Wn((function(){if(0===qe.length)return null;var e=qe.slice(0,10).map((function(e,t){return React.createElement("span",{key:e,style:{cursor:"pointer",textDecoration:"underline"},onClick:function(){return function(e){var t=Math.floor(e/ve);Ie(t+1)}(e)}},e,t<qe.slice(0,10).length-1?", ":"")}));return qe.length>10?React.createElement(React.Fragment,null,"Some entries are invalid, for example those ones: ",e,", and ",qe.length-10," more."):React.createElement(React.Fragment,null,"Some entries are invalid, for example those ones: ",e)}),[qe,ve]);return React.createElement(React.Fragment,null,React.createElement(E.N,null,React.createElement(E.Y,{fullWidth:!0,minimal:!0,style:{margin:8}},React.createElement(b._,{inversed:!0,currentTab:x,onChange:function(e,t){S(t.key)},action:React.createElement(React.Fragment,null,React.createElement("div",{style:{flex:"auto"}}),"finetunes"===x&&React.createElement(React.Fragment,null,React.createElement(w.M,{disabled:g,busy:"finetunes"===g,onClick:tt,className:"secondary"},He.COMMON.REFRESH_MODELS),Ct),"files"===x&&React.createElement(React.Fragment,null,React.createElement(w.M,{disabled:g,onClick:Ze,className:"secondary"},"Refresh Files"),Ct),"editor"===x&&React.createElement(React.Fragment,null,React.createElement("label",{style:{marginRight:10}},"Filename:"),React.createElement(Re.A,{disabled:!$e||g,value:$e?Be:"",onChange:Ye,style:{width:220,marginRight:5}}),React.createElement(w.M,{className:"secondary",disabled:!We||g,icon:"upload",onClick:wt},"Upload to OpenAI"),Ct))},React.createElement(b.V,{title:He.COMMON.MODELS,key:"finetunes"},React.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},React.createElement("div",null,(0,O.FE)(He.FINETUNING.MODELS_INTRO)),React.createElement(Vt.o,{value:C,onChange:function(e){I(e)}},React.createElement(Vt.K,{title:"Current",value:"current",count:null!=St?St:"-"}),React.createElement(Vt.K,{title:"Failed",value:"failed",count:null!=Tt?Tt:"-"}),React.createElement(Vt.K,{title:"Deleted",value:"deleted",count:null!=Nt?Nt:"-"}))),React.createElement(_e.g,null),React.createElement(Kt.o,{busy:bt,data:Et,columns:Jn,emptyMessage:He.FINETUNING.NO_FINETUNES_YET}),React.createElement("div",{style:{marginTop:5,display:"flex",justifyContent:"end",lineHeight:"12px",alignItems:"center"}},React.createElement(w.M,{small:!0,disabled:g,busy:"clean"===g,onClick:nt,className:"primary"},He.FINETUNING.CLEAN_MODELS_LIST),React.createElement("small",{style:{marginLeft:5}},He.FINETUNING.DELETED_FINETUNE_ISSUE))),React.createElement(b.V,{title:He.COMMON.FILES,key:"files"},React.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},React.createElement("div",null,(0,O.FE)(He.FINETUNING.FILES_INTRO)),React.createElement(Vt.o,{value:L,onChange:function(e){M(e)}},React.createElement(Vt.K,{title:"Datasets",value:"fine-tune"}),React.createElement(Vt.K,{title:"All",value:null}))),React.createElement(_e.g,null),React.createElement(Kt.o,{busy:bt,data:ht,columns:Qn,emptyMessage:React.createElement(React.Fragment,null,"You do not have any dataset files yet.")})),React.createElement(b.V,{title:He.FINETUNING.DATASET_EDITOR,key:"editor"},!Ee&&React.createElement("p",{style:{color:"red"}},He.FINETUNING.HUGE_DATASET_WARNING),React.createElement(qt.V,{style:{display:"flex"}},React.createElement(w.M,{icon:"plus",onClick:function(){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Question?",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Answer.";Le([].concat(Ln(ke),[{messages:[{role:"system",content:De},{role:"user",content:e},{role:"assistant",content:t}]}]))}()},disabled:g},"Add Entry"),Pe&&React.createElement(w.M,{onClick:function(){return at(De)},disabled:g},"Rewrite Instructions"),React.createElement("div",{style:{flex:"auto"}}),React.createElement(Xt.S,{style:{marginLeft:5},onLabel:"Expert",offLabel:"Easy",width:90,onBackgroundColor:o.purple,offBackgroundColor:o.green,onChange:je,checked:Pe}),React.createElement($t.Z,{ref:xt,onSelectFiles:Ot,accept:"",style:{paddingLeft:5}},React.createElement(w.M,{className:"secondary",onClick:function(){return xt.current.click()}},"Import")),React.createElement(w.M,{disabled:!$e,onClick:rt,className:"secondary"},"Clear")),React.createElement(_e.g,null),ke.length>0&&(null==qe?void 0:qe.length)>0&&React.createElement(React.Fragment,null,React.createElement(Ne.X,{variant:"danger"},It),React.createElement(_e.g,null)),React.createElement(Se.a,{keepState:"datasetEditor"},React.createElement(Se.Y,{title:"Dataset"},React.createElement(_e.g,{tiny:!0}),React.createElement("div",{style:{display:"flex"}},React.createElement("div",{style:{flex:"auto"}}),React.createElement(Qt.Q,{currentPage:Ce,limit:ve,total:$e,onCurrentPageChanged:Ie,onClick:Ie})),React.createElement(_e.g,{tiny:!0}),React.createElement(Kt.o,{busy:g,data:ut,columns:Pe?$n:Xn,emptyMessage:React.createElement(React.Fragment,null,"You can import a file, or create manually each entry by clicking ",React.createElement("b",null,"Add"),".")}),React.createElement(_e.g,{tiny:!0}),React.createElement("div",{style:{display:"flex"}},React.createElement("div",{style:{flex:"auto"}}),React.createElement(Qt.Q,{currentPage:Ce,limit:ve,total:$e,onCurrentPageChanged:Ie,onClick:Ie}),React.createElement(w.M,{disabled:!$e,style:{marginLeft:5},onClick:function(){var e=(0,O.F1)(ke,2),t=new Blob([e],{type:"text/plain"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n;var a=new Date,o="".concat(a.getFullYear(),"-").concat(a.getMonth()+1,"-").concat(a.getDate(),"-WP.json");r.download=o,document.body.appendChild(r),r.click(),document.body.removeChild(r)}},"Export as JSON"))),React.createElement(Se.Y,{title:He.COMMON.CONTEXT},React.createElement(_e.g,null),React.createElement("span",null,"The instructions are the same for all entries. It is used as the ",React.createElement("i",null,"system")," (and first) message in each conversation. More information ",React.createElement("a",{href:"https://platform.openai.com/docs/guides/fine-tuning/preparing-your-dataset",target:"_blank",rel:"noreferrer"},"here"),"."),React.createElement(_e.g,null),React.createElement(Wt.m,{id:"instructions",name:"instructions",rows:2,value:De,onBlur:ot,onEnter:ot})),React.createElement(Se.Y,{title:"Generator"},React.createElement(_e.g,null),React.createElement(An,{options:n,instructions:De,setMessages:Le}),React.createElement(Ne.X,{variant:"danger"},"Use this feature with caution. The AI will generate questions and answers for each of your post based on the given prompt, and they will be added to your dataset. Keep in mind that this process may be ",React.createElement("u",null,"extremely slow")," and require a ",React.createElement("u",null,"significant number of API calls"),", resulting in a ",React.createElement("u",null,"high cost"),".")),React.createElement(Se.Y,{title:"Instructions"},React.createElement("p",null,"You can create your dataset by importing a file (two columns, in the CSV, JSON or JSONL format) or manually by clicking ",React.createElement("b",null,"Add Entry"),". To avoid losing your work, this data is kept in your browser's local storage. ",React.createElement("b",null,"This is actually complex, so learn how to write datasets by studying ",React.createElement("a",{href:"https://beta.openai.com/docs/guides/fine-tuning/conditional-generation",target:"_blank",rel:"noreferrer"},"case studies"),". Please also check the ",React.createElement("a",{href:"https://meowapps.com/wordpress-chatbot-finetuned-model-ai/",target:"_blank",rel:"noreferrer"},"simplified tutorial"),".")," Is your dataset ready? Modify the filename to your liking and click ",React.createElement("b",null,"Upload to OpenAI"),"! 😎"))))))),React.createElement(xe.L,{style:{margin:10}},React.createElement(Te.n,{isOpen:c,title:"Error",onRequestClose:function(){return m()},okButton:{label:"Ok",onClick:function(){return m()}},content:React.createElement(React.Fragment,null,React.createElement("p",null,null==c?void 0:c.message))}),React.createElement(Te.n,{isOpen:p,title:"Train a new model",onRequestClose:function(){return h()},okButton:{label:"Start",disabled:g,onClick:et},cancelButton:{label:"Close",disabled:g,onClick:function(){return h()}},content:React.createElement(React.Fragment,null,React.createElement("p",null,"Exciting! 🎵 You are about to create your own new model, based on your dataset. You simply need to select a base model, and optionally, to modify the ",React.createElement("a",{href:"https://beta.openai.com/docs/guides/fine-tuning/hyperparameters",target:"_blank",rel:"noreferrer"},"hyperparameters"),". Before starting the process, make sure that:"),React.createElement("ul",null,React.createElement("li",null,"✅ The dataset is well-defined."),React.createElement("li",null,"✅ You understand ",React.createElement("a",{href:"https://openai.com/api/pricing/#faq-fine-tuning-pricing-calculation",target:"_blank",rel:"noreferrer"},"OpenAI pricing")," about fine-tuning.")),React.createElement("label",null,"Base model:"),React.createElement(_e.g,{height:5}),React.createElement(Re.A,{value:pe,onChange:he,description:React.createElement(React.Fragment,null,"As of August 2024, you can use ",React.createElement("a",{href:"#",onClick:function(){return he("gpt-4o-mini-2024-07-18")}},"gpt-4o-mini-2024-07-18"),", ",React.createElement("a",{href:"#",onClick:function(){return he("gpt-3.5-turbo-0125")}},"gpt-3.5-turbo-0125"),", or any of your previously fine-tuned models. Check all the available models ",React.createElement("a",{href:"https://platform.openai.com/docs/guides/fine-tuning/which-models-can-be-fine-tuned",target:"_blank",rel:"noreferrer"},"here"),".")}),React.createElement(_e.g,{height:10}),React.createElement("label",null,"Suffix (for new model name):"),React.createElement(_e.g,{height:5}),React.createElement(Re.A,{value:j,onChange:F}),React.createElement(_e.g,{height:5}),React.createElement("small",null,"The name of the new model name will be decided by OpenAI. You can customize it a bit with a ",React.createElement("a",{href:"https://platform.openai.com/docs/guides/fine-tuning/create-a-fine-tuned-model",target:"_blank",rel:"noreferrer"},"suffix"),". Preview: ",React.createElement("b",null,Rt),"."),React.createElement(_e.g,{line:!0,height:20}),React.createElement(y.R,{label:"Enable HyperParams",checked:G,onChange:U}),G&&React.createElement(React.Fragment,null,React.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"}},React.createElement("label",{style:{marginRight:5}},"Number of Epochs:"),React.createElement(Re.A,{style:{marginRight:5},value:H,onChange:Y,type:"number"}),React.createElement("label",{style:{marginRight:5}},"Batch Size:"),React.createElement(Re.A,{value:W,onChange:V,type:"number"})),React.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"}},React.createElement("label",{style:{marginRight:5}},"Learning Rate Multiplier:"),React.createElement(Re.A,{style:{marginRight:5},value:q,onChange:X,type:"number"}),React.createElement("label",{style:{marginRight:5}},"Prompt Loss Weight:"),React.createElement(Re.A,{value:Q,onChange:J,type:"number"}))))})))};var nr;wp.element.useMemo;var rr,ar,or=G.Ay.div(nr||(rr=["\n  display: flex;\n  flex-direction: column;\n  width: 100%;\n  max-height: 290px;\n  overflow: auto;\n  box-sizing: border-box;\n  padding: 15px;\n\n  h3 {\n    margin-top: 20px;\n    padding-bottom: 5px;\n    font-size: 14px;\n    border-bottom: 1px solid black;\n  }\n\n  .description {\n    border-radius: 5px;\n\n    p {\n      small {\n        color: var(--neko-blue);\n        font-size: 12px;\n      }\n    }\n\n    p:first-child {\n      margin-top: 0;\n    }\n\n    p:last-child {\n      margin-bottom: 0;\n    }\n  }\n"],ar||(ar=rr.slice(0)),nr=Object.freeze(Object.defineProperties(rr,{raw:{value:Object.freeze(ar)}}))));const ir=function(e){var t,n,r=e.incidents,a=e.isLoading,o=(t=new Date,n=new Date(t.toLocaleString("en-US",{timeZone:"America/Los_Angeles"})),((t-n)/36e5).toFixed(0));return React.createElement(or,null,React.createElement(d.s,null,"Only the incidents which occured ",React.createElement("b",null,"less than a week ago")," are displayed. The time difference between the PST time used by OpenAI and your local time is ",o," hours."),!a&&null==r&&React.createElement("p",null,React.createElement("i",null,"Could not load the incidents.")),!a&&0===(null==r?void 0:r.length)&&React.createElement("p",null,React.createElement("i",null,"Currently no incidents.")),r&&r.map((function(e){return React.createElement("div",{key:e.guid},React.createElement("h3",null,e.date,": ",e.title),React.createElement("div",{className:"description",dangerouslySetInnerHTML:{__html:e.description}}))})))};function lr(e){return lr="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},lr(e)}function cr(){cr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==lr(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(lr(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 ur(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function sr(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return fr(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)?fr(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 fr(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 mr=wp.element.useState;const dr=function(e){var t=e.options,n=e.updateOption,r=e.busy,a=sr(mr("I would love to live on a tropical island with beautiful and sexy felines, where we could bask in the sun on the sandy beaches, sip on refreshing coconut milk, and enjoy each other's company. While we might occasionally fight in the trees, our days would mostly be spent in peaceful slumber. However, I am not sure of how we would handle any potential disruptions to our idyllic existence if human were to come..."),2),o=a[0],i=a[1],l=sr(mr([]),2),c=l[0],u=l[1],s=sr(mr(""),2),f=(s[0],s[1]),m=sr(mr(!1),2),d=m[0],h=m[1],v=null==t?void 0:t.chatbot_moderation,g=d||r,b=function(){var e,t=(e=cr().mark((function e(){var t,n;return cr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h(!0),e.next=3,(0,O.IU)("".concat(T,"/ai/moderate"),{method:"POST",nonce:k,json:{text:o}});case 3:(t=e.sent).success?(n=t.results,u(null==n?void 0:n.results)):f(t.message),h(!1);case 6:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){ur(o,r,a,i,l,"next",e)}function l(e){ur(o,r,a,i,l,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}(),_=React.createElement(p.d,{title:He.COMMON.CHATBOT},React.createElement(y.R,{name:"chatbot_moderation",label:He.COMMON.ENABLE,value:"1",checked:v,description:He.SETTINGS.CHATBOT_MODERATION_HELP,onChange:n}));return React.createElement(React.Fragment,null,React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(R.z,{busy:g,title:He.COMMON.SETTINGS,className:"primary"},React.createElement("p",null,"You can enable moderation various parts of WordPress. It will slow down the processing a little."),_)),React.createElement(E.Y,{minimal:!0},React.createElement(R.z,{busy:g,title:"AI Moderation Tester",className:"primary"},React.createElement("p",null,"Paste a text below, and check if it is safe for your website. ",React.createElement("b",null,"OpenAI Moderation Model is free!")," Learn more about it ",React.createElement("a",{href:"https://platform.openai.com/docs/guides/moderation/overview",target:"_blank"},"here"),"."),React.createElement(Wt.m,{name:"context",rows:8,value:o,onChange:i}),React.createElement(_e.g,null),React.createElement(w.M,{fullWidth:!0,onClick:b},"Moderation Check"),React.createElement(_e.g,null),React.createElement("label",null,"Results:"),React.createElement("pre",null,(0,O.F1)(c,2))))))};function pr(e){return pr="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},pr(e)}function hr(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 yr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?hr(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=pr(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=pr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==pr(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vr(){vr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==pr(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(pr(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 gr(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Er(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){gr(o,r,a,i,l,"next",e)}function l(e){gr(o,r,a,i,l,"throw",e)}i(void 0)}))}}function br(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,Rr=wr.useState,Or=wr.useEffect,_r=wr.useMemo;const xr=function(e){var t,n,r=e.modal,a=e.busy,o=e.setModal,i=e.onAddEmbedding,l=e.onModifyEmbedding,c=(t=Rr(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,n)||function(e,t){if(e){if("string"==typeof e)return br(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)?br(e,t):void 0}}(t,n)||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.")}()),u=c[0],s=c[1],f=a;Or((function(){"edit"!==(null==r?void 0:r.type)&&"add"!==(null==r?void 0:r.type)||s((null==r?void 0:r.data)||{})}),[r]);var m=_r((function(){var e,t,n,a,o;return null==r||!r.data||(null==r||null===(e=r.data)||void 0===e?void 0:e.title)!==(null==u?void 0:u.title)||(null==r||null===(t=r.data)||void 0===t?void 0:t.content)!==(null==u?void 0:u.content)||(null==r||null===(n=r.data)||void 0===n?void 0:n.behavior)!==(null==u?void 0:u.behavior)||(null==r||null===(a=r.data)||void 0===a?void 0:a.type)!==(null==u?void 0:u.type)||(null==r||null===(o=r.data)||void 0===o?void 0:o.refId)!==(null==u?void 0:u.refId)}),[r,u]),d=function(){var e=Er(vr().mark((function e(){return vr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,l(u);case 3:o(null),e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),alert(e.t0.message);case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(){return e.apply(this,arguments)}}(),p=function(){var e=Er(vr().mark((function e(){return vr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,i(u);case 3:o(null),e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),alert(e.t0.message);case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(){return e.apply(this,arguments)}}();return React.createElement(React.Fragment,null,React.createElement(Te.n,{isOpen:"edit"===(null==r?void 0:r.type)||"add"===(null==r?void 0:r.type),title:"edit"===(null==r?void 0:r.type)?He.COMMON.MODIFY_EMBEDDING:He.COMMON.ADD_EMBEDDING,okButton:{label:"edit"===(null==r?void 0:r.type)?He.COMMON.MODIFY_EMBEDDING:He.COMMON.ADD_EMBEDDING,disabled:!m||a,isBusy:"addEmbedding"===a,onClick:function(){"edit"===r.type?d():p()}},cancelButton:{disabled:a,onClick:function(){return o(null)}},onRequestClose:function(){return o(null)},content:React.createElement(React.Fragment,null,React.createElement("p",null,"A custom embedding can be a sentence, a paragraph or a whole article. When an user input is made, the AI will search for the best embedding that matches the user input and will be able to reply with more accuracy."),React.createElement(_e.g,null),React.createElement("label",null,"Title:"),React.createElement(_e.g,{tiny:!0}),React.createElement(Re.A,{value:null==u?void 0:u.title,placeholder:'Title, like "My Website Information"',description:"This is for your convenience only, it's not used anywhere.",onChange:function(e){return s(yr(yr({},u),{},{title:e}))}}),React.createElement(_e.g,null),React.createElement("label",null,"Content:"),React.createElement(_e.g,{tiny:!0}),React.createElement(Wt.m,{countable:"chars",maxLength:64e3,description:"The content of your embeddings that will be used by the AI if it matches the user input.",value:null==u?void 0:u.content,onChange:function(e){return s(yr(yr({},u),{},{content:e}))}}),React.createElement(_e.g,null),React.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},React.createElement("div",{style:{flex:3}},React.createElement("label",null,"Behavior:"),React.createElement(_e.g,{tiny:!0}),React.createElement(we.u,{scrolldown:!0,name:"behavior",disabled:f||!0,value:null==u?void 0:u.behavior,onChange:function(e){s(yr(yr({},u),{},{behavior:e}))}},React.createElement(we.j,{value:"context",label:"Context"}),React.createElement(we.j,{value:"reply",label:"Reply"}))),React.createElement("div",{style:{flex:3,marginLeft:5}},React.createElement("label",null,"Type:"),React.createElement(_e.g,{tiny:!0}),React.createElement(we.u,{scrolldown:!0,name:"type",disabled:f||!0,value:null==u?void 0:u.type,onChange:function(e){s(yr(yr({},u),{},{type:e}))}},React.createElement(we.j,{value:"manual",label:"Manual"}),React.createElement(we.j,{value:"postId",label:"Related to Post"}))),"postId"===(null==u?void 0:u.type)&&React.createElement("div",{style:{flex:1,marginLeft:5}},React.createElement("label",null,"Post ID:"),React.createElement(_e.g,{tiny:!0}),React.createElement(Re.A,{value:null==u?void 0:u.refId,disabled:!0,onChange:function(e){return s(yr(yr({},u),{},{refId:e}))}}))))}))};function Sr(e){return Sr="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},Sr(e)}function Tr(){Tr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Sr(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Sr(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Nr(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Cr(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Nr(o,r,a,i,l,"next",e)}function l(e){Nr(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Ir(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ar(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)?Ar(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 Ar(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 kr=wp.element.useState;function Lr(e,t){var n=new Blob([e],{type:"text/plain;charset=utf-8;"}),r=document.createElement("a");r.href=URL.createObjectURL(n),r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r)}const Mr=function(e){var t=e.modal,n=e.setModal,r=Ir(kr(!1),2),a=r[0],o=r[1],i=Ir(kr(0),2),l=i[0],c=i[1],u=Ir(kr(0),2),s=u[0],f=u[1],m=null==t?void 0:t.data,d=function(){var e=Cr(Tr().mark((function e(){var t,n,r,a,i,l;return Tr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,o(!0),e.next=4,h();case 4:t=e.sent,n=(0,O.F1)(t,2),r=new Date,a=r.getFullYear(),i=r.getMonth()+1,l=r.getDate(),Lr(n,"vectors-".concat(a,"-").concat(i,"-").concat(l,".json")),setTimeout((function(){c(0)}),1e3),e.next=18;break;case 14:e.prev=14,e.t0=e.catch(0),console.error(e.t0),alert("An error occured while exporting vectors. Check your console.");case 18:return e.prev=18,o(!1),e.finish(18);case 21:case"end":return e.stop()}}),e,null,[[0,14,18,21]])})));return function(){return e.apply(this,arguments)}}(),p=function(){var e=Cr(Tr().mark((function e(){var t,n,r,a,i,l;return Tr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,o(!0),e.next=4,h();case 4:t=e.sent,n=zt().unparse(t),r=new Date,a=r.getFullYear(),i=r.getMonth()+1,l=r.getDate(),Lr(n,"vectors-".concat(a,"-").concat(i,"-").concat(l,".csv")),setTimeout((function(){c(0)}),1e3),e.next=18;break;case 14:e.prev=14,e.t0=e.catch(0),console.error(e.t0),alert("An error occured while exporting vectors. Check your console.");case 18:return e.prev=18,o(!1),e.finish(18);case 21:case"end":return e.stop()}}),e,null,[[0,14,18,21]])})));return function(){return e.apply(this,arguments)}}(),h=function(){var e=Cr(Tr().mark((function e(){var t,n,r,a;return Tr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=!1,n={page:1,limit:20,filters:{envId:m.envId,dbIndex:m.dbIndex,dbNS:m.dbNS}},r=[],a=Tr().mark((function e(){var a;return Tr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ht(n);case 2:(a=e.sent).vectors.length<2&&(t=!0),c((function(){return a.total})),r=r.concat(a.vectors),f((function(){return r.length})),n.page++;case 8:case"end":return e.stop()}}),e)}));case 4:if(t){e.next=8;break}return e.delegateYield(a(),"t0",6);case 6:e.next=4;break;case 8:return e.abrupt("return",r);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return React.createElement(React.Fragment,null,React.createElement(Te.n,{isOpen:"export"===(null==t?void 0:t.type),title:"Export Embeddings",onRequestClose:function(){return n(null)},okButton:{label:"Close",disabled:a,onClick:function(){return n(null)}},customButtons:React.createElement(React.Fragment,null,React.createElement(w.M,{onClick:p,disabled:a},"Export CSV"),React.createElement(w.M,{onClick:d,disabled:a},"Export JSON")),content:React.createElement(React.Fragment,null,React.createElement(Jt.j,{busy:a,style:{flex:"auto"},value:s,max:l}))}))};function Pr(e){return Pr="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},Pr(e)}function jr(){jr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Pr(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Pr(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Fr(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 Dr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fr(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=Pr(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Pr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==Pr(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Gr(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Yr(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}function Ur(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Br(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Ur(o,r,a,i,l,"next",e)}function l(e){Ur(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Hr(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||Yr(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 Yr(e,t){if(e){if("string"==typeof e)return zr(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)?zr(e,t):void 0}}function zr(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.useState;const Vr=function(e){var t,n,r=e.modal,a=e.setModal,o=e.onAddEmbedding,i=e.onModifyEmbedding,l=Hr(Wr(!1),2),c=l[0],u=l[1],s=Hr(Wr(0),2),f=s[0],m=s[1],d=Hr(Wr(0),2),p=d[0],h=d[1],v=Hr(Wr({add:[],modify:[],same:[],total:0,isReady:!1}),2),g=v[0],E=v[1],b=null!==(t=null==r||null===(n=r.data)||void 0===n?void 0:n.importVectors)&&void 0!==t?t:[],R=Hr(Wr({envId:!1,dbId:!1,dbIndex:!1,dbNS:!1,title:!0,refId:!0}),2),O=R[0],_=R[1],x=null==r?void 0:r.data,S=function(e){var t,n,r,a,o,i,l,c,u,s;return{id:null!==(t=e.id)&&void 0!==t?t:null,type:null!==(n=e.type)&&void 0!==n?n:"manual",title:null!==(r=e.title)&&void 0!==r?r:"N/A",behavior:null!==(a=e.behavior)&&void 0!==a?a:"context",envId:null!==(o=null==x?void 0:x.envId)&&void 0!==o?o:null,dbId:null!==(i=e.dbId)&&void 0!==i?i:null,dbIndex:null!==(l=x.dbIndex)&&void 0!==l?l:null,dbNS:null!==(c=x.dbNS)&&void 0!==c?c:null,content:null!==(u=e.content)&&void 0!==u?u:"",refId:null!==(s=e.refId)&&void 0!==s?s:null}},T=function(e,t,n){return Object.keys(n).every((function(r){return!n[r]||e[r]===t[r]}))},N=function(){var e=Br(jr().mark((function e(t,n){var r,a,o,i,l,c,u;return jr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],a=[],o=[],console.log("Calculate Diff",{currentVectors:t,importVectors:n}),i=Gr(n),e.prev=5,c=jr().mark((function e(){var n,i,c,u;return jr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=l.value,i=S(n),c=t.find((function(e){return T(e,i,O)})),console.log("Matched Vector",{cleanVector:Dr({},i),matchedVector:Dr({},c)}),c?i.id=c.id:delete i.id,(u=t.find((function(e){return e.id===i.id})))&&i.content===u.content&&i.title===u.title?o.push(i):i.id?a.push(i):r.push(i);case 7:case"end":return e.stop()}}),e)})),i.s();case 8:if((l=i.n()).done){e.next=12;break}return e.delegateYield(c(),"t0",10);case 10:e.next=8;break;case 12:e.next=17;break;case 14:e.prev=14,e.t1=e.catch(5),i.e(e.t1);case 17:return e.prev=17,i.f(),e.finish(17);case 20:u=r.length+a.length,E({add:r,modify:a,same:o,total:u,isReady:!0}),console.log("Embeddings Diff",{add:r,modify:a,same:o,total:u});case 23:case"end":return e.stop()}}),e,null,[[5,14,17,20]])})));return function(t,n){return e.apply(this,arguments)}}(),C=function(){var e=Br(jr().mark((function e(){var t,n,r,a;return jr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0,t=!1,n={page:1,limit:20,filters:{envId:x.envId,dbIndex:x.dbIndex,dbNS:x.dbNS}},r=[],u("stepOne"),a=jr().mark((function e(){var a;return jr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ht(n);case 2:(a=e.sent).vectors.length<2&&(t=!0),m((function(){return a.total})),r=r.concat(a.vectors),h((function(){return r.length})),n.page++;case 8:case"end":return e.stop()}}),e)}));case 6:if(t){e.next=10;break}return e.delegateYield(a(),"t0",8);case 8:e.next=6;break;case 10:N(r,b),e.next=17;break;case 13:e.prev=13,e.t1=e.catch(0),console.error(e.t1),alert("An error occured while retrieving your current embeddings. Check your console.");case 17:return e.prev=17,u(!1),e.finish(17);case 20:case"end":return e.stop()}}),e,null,[[0,13,17,20]])})));return function(){return e.apply(this,arguments)}}(),I=function(){var e=Br(jr().mark((function e(){var t,n,r,a,l,c;return jr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0,m(g.add.length+g.modify.length),h(0),u("stepTwo"),t=Gr(g.add),e.prev=5,t.s();case 7:if((n=t.n()).done){e.next=14;break}return r=n.value,e.next=11,o(r,!0);case 11:h((function(e){return e+1}));case 12:e.next=7;break;case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(5),t.e(e.t0);case 19:return e.prev=19,t.f(),e.finish(19);case 22:a=Gr(g.modify),e.prev=23,a.s();case 25:if((l=a.n()).done){e.next=32;break}return c=l.value,e.next=29,i(c,!0);case 29:h((function(e){return e+1}));case 30:e.next=25;break;case 32:e.next=37;break;case 34:e.prev=34,e.t1=e.catch(23),a.e(e.t1);case 37:return e.prev=37,a.f(),e.finish(37);case 40:alert("All embeddings have been updated."),E({add:[],modify:[],same:[],total:0,isReady:!1}),A(),e.next=49;break;case 45:e.prev=45,e.t2=e.catch(0),console.error(e.t2),alert("An error occured while updating embeddings. Check your console.");case 49:return e.prev=49,u(!1),e.finish(49);case 52:case"end":return e.stop()}}),e,null,[[0,45,49,52],[5,16,19,22],[23,34,37,40]])})));return function(){return e.apply(this,arguments)}}(),A=function(){a(null),u(!1),m(0),h(0),E({add:[],modify:[],same:[],total:0,isReady:!1})};return React.createElement(React.Fragment,null,React.createElement(Te.n,{isOpen:"import"===(null==r?void 0:r.type),title:"Import Embeddings",onRequestClose:A,okButton:{label:"Close",onClick:A,disabled:c},customButtons:React.createElement(React.Fragment,null,React.createElement(w.M,{onClick:C,disabled:c},"Check Differences"),React.createElement(w.M,{onClick:I,disabled:c||0===g.total},"Apply Changes")),content:React.createElement(React.Fragment,null,React.createElement("p",null,"There are ",React.createElement("b",null,b.length," embeddings")," in the file."),React.createElement(_e.g,null),React.createElement(Se.Y,{title:"1 - Check Differences"}),React.createElement("p",null,"Calculates the differences between the embeddings in your file and the ones currently registered in AI Engine. Based on that, a list of changes will be created. Please note that the environment, index and namespace that might be set in the file will be ignored."),React.createElement("p",{style:{marginTop:10}},"An embedding will be considered the same entry based on:"),React.createElement(_e.g,null),React.createElement("div",{style:{display:"flex"}},React.createElement("div",{style:{marginLeft:15}},React.createElement(y.R,{small:!0,label:"DB ID",disabled:!1,checked:O.dbId,onChange:function(){return _(Dr(Dr({},O),{},{dbId:!O.dbId}))}})),React.createElement("div",{style:{marginLeft:15}},React.createElement(y.R,{small:!0,label:"Title",disabled:!1,checked:O.title,onChange:function(){return _(Dr(Dr({},O),{},{title:!O.title}))}})),React.createElement("div",{style:{marginLeft:15}},React.createElement(y.R,{small:!0,label:"Ref (Post ID)",disabled:!1,checked:O.refId,onChange:function(){return _(Dr(Dr({},O),{},{refId:!O.refId}))}}))),"stepOne"===c&&React.createElement(React.Fragment,null,React.createElement(_e.g,null),React.createElement(Jt.j,{busy:c,style:{flex:"auto"},value:p,max:f})),React.createElement(_e.g,null),React.createElement(Se.Y,{title:"2 - Apply Changes"}),!g.isReady&&React.createElement("i",null,"Waiting for diff..."),g.isReady&&React.createElement(React.Fragment,null,React.createElement("p",null,"There are ",g.same.length>=1&&React.createElement("span",null,React.createElement("b",null,g.same.length," identical embeddings")," (with the same title and content). They will be ignored. "),React.createElement("span",null,"Changes to apply:")),React.createElement("ul",null,React.createElement("li",null,"👉 Add: ",React.createElement("b",null,g.add.length)),React.createElement("li",null,"👉 Modify: ",React.createElement("b",null,g.modify.length)))),"stepTwo"===c&&React.createElement(React.Fragment,null,React.createElement(_e.g,null),React.createElement(Jt.j,{busy:c,style:{flex:"auto"},value:p,max:f})),React.createElement(_e.g,null))}))};function Kr(e){return Kr="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},Kr(e)}function qr(e){return function(e){if(Array.isArray(e))return na(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ta(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 Xr(){Xr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Kr(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Kr(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 $r(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 Qr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$r(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=Kr(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Kr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==Kr(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Jr(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Zr(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Jr(o,r,a,i,l,"next",e)}function l(e){Jr(o,r,a,i,l,"throw",e)}i(void 0)}))}}function ea(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||ta(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 ta(e,t){if(e){if("string"==typeof e)return na(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)?na(e,t):void 0}}function na(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 ra=wp.element,aa=ra.useState,oa=ra.useMemo,ia=ra.useEffect,la=ra.useRef,ca=[{accessor:"status",title:"Status",width:"80px"},{accessor:"title",title:"Title / Model",sortable:!1},{accessor:"type",title:"Ref",sortable:!1,width:"75px"},{accessor:"score",title:"Score",sortable:!0,width:"65px"},{accessor:"updated",title:"Updated",sortable:!1,width:"80px"},{accessor:"actions",title:"",width:"100px"}],ua=[{accessor:"status",title:"Status",sortable:!0,width:"80px"},{accessor:"title",title:"Title / Model",sortable:!1},{accessor:"type",title:"Ref",sortable:!0,width:"75px"},{accessor:"updated",title:"Updated",sortable:!0,width:"80px"},{accessor:"actions",title:"",width:"100px"}],sa=function(e){var t=e.embedding,n=e.envName,r=(0,s.z)().colors,a=t.status,o=t.content,i=t.error,l=oa((function(){if("ok"===a){if(!n)return"env_issue";if(!o)return"empty"}return a}),[a,n,o]),c=oa((function(){return"orphan"===l?"This embedding was retrieved from the Vector DB, but it has no content. Add some, or delete it.":"env_issue"===l?"This embedding is not related to any Embeddings Environment. Make sure you have an Embeddings Environment selected, and Sync/Refresh it; it will be linked to the current environment. You can also delete it.":"empty"===l?"This embedding has no content.":i||null}),[l,i]),u=oa((function(){var e={outdated:{icon:"alert",color:r.orange},ok:{icon:"check-circle",color:r.green},error:{icon:"alert",color:r.red},orphan:{icon:"pencil",color:r.orange},env_issue:{icon:"database",color:r.red},empty:{icon:"alert",color:r.orange},default:{icon:"alert",color:r.orange}};return e[l]||e.default}),[l,r]),f=u.icon,m=u.color;return React.createElement("div",{style:{display:"flex",alignItems:"center"},title:c},React.createElement(Oe.z,{icon:f,width:24,color:m,title:c}),React.createElement("span",{style:{textTransform:"uppercase",fontSize:9,marginLeft:3}},l))};const fa=function(e){var t,n=e.options,r=e.updateOption,a=(0,u.jE)(),o=(0,s.z)().colors,i=ea(aa("post"),2),l=i[0],c=i[1],m=ea(aa(!1),2),p=m[0],h=m[1],v=ea(aa("edit"),2),g=v[0],_=v[1],x=ea(aa(null),2),S=x[0],N=x[1],C=ea(aa(!1),2),I=C[0],A=C[1],L=ea(aa([]),2),M=L[0],P=L[1],j=ea(aa({type:null,data:null}),2),F=j[0],D=j[1],G=ea(aa(null),2),U=G[0],B=G[1],H=n.embeddings||{},Y=la(null),z=ft(n,!1,!0),W=n.embeddings_envs||[],V=ea(aa(function(){var e=localStorage.getItem("mwai-admin-embeddings");try{var t=JSON.parse(e);return{environmentId:(null==t?void 0:t.environmentId)||null}}catch(e){return{environmentId:null}}}().environmentId),2),K=V[0],q=V[1],X=oa((function(){return W.find((function(e){return e.id===K}))||null}),[W,K]),$=(null==X?void 0:X.min_score)>=0?X.min_score:35,Q=(null==X?void 0:X.max_select)>=0?X.max_select:10,J=oa((function(){return null!=X&&X.ai_embeddings_override&&null!=X&&X.ai_embeddings_env&&null!=X&&X.ai_embeddings_model?z.getModel(X.ai_embeddings_model):z.getModel(n.ai_embeddings_default_model)}),[X,H.model]),Z=(0,f.I)({queryKey:["postTypes"],queryFn:an}),ee=Z.isLoading,te=Z.data,ne=(0,f.I)({queryKey:[null!==(t="postsCount-"+l+"-"+(null==H?void 0:H.syncPostStatus))&&void 0!==t?t:"publish"],queryFn:function(){var e;return yt(l,null!==(e=null==H?void 0:H.syncPostStatus)&&void 0!==e?e:"publish")}}),re=ne.isLoading,ae=ne.data,oe=ea(aa({filters:{envId:K,search:S,debugMode:!1},sort:{accessor:"updated",by:"desc"},page:1,limit:20}),2),ie=oe[0],le=oe[1],ce=(0,f.I)({queryKey:["vectors",ie],queryFn:function(){return ht(ie)}}),ue=ce.isFetching,se=ce.data,fe=ce.error,me=ue||"searchVectors"===p,de="search"===g?ca:ua,pe=(0,Zt.XS)({i18n:He,onStop:function(){h(),pe.reset()}}),he=p||me||pe.isBusy||ee,ye=function(){var e=Zr(Xr().mark((function e(t){return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h("updateSettings"),e.next=3,r(Qr({},t),"embeddings");case 3:h(null);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ve=oa((function(){return H.syncPosts&&(null==H?void 0:H.syncPostsEnvId)!==K}),[K,H]);ia((function(){!H.syncPosts&&H.syncPostsEnvId&&ye(Qr(Qr({},H),{},{syncPostsEnvId:null}))}),[H.syncPosts]);var ge=oa((function(){return W.find((function(e){return e.id===H.syncPostsEnvId}))||null}),[H.syncPostsEnvId]);ia((function(){var e;le(Qr(Qr({},ie),{},{filters:{envId:K,search:S,debugMode:U}})),e={environmentId:K||null},localStorage.setItem("mwai-admin-embeddings",(0,O.F1)(e))}),[K,U]),ia((function(){var e="edit"===g?null:"";N("edit"===g?null:""),le(Qr(Qr({},ie),{},{filters:Qr(Qr({},ie.filters),{},{search:e}),sort:{accessor:"edit"===g?"created":"score",by:"desc"},page:1,limit:20}))}),[g]),ia((function(){var e,t;null!=H&&null!==(e=H.syncPostTypes)&&void 0!==e&&e.length&&null!=H&&null!==(t=H.syncPostStatus)&&void 0!==t&&t.length||ye(Qr(Qr({},H),{},{syncPostTypes:["post","page","product"],syncPostStatus:["publish"]}))}),[H.syncPostTypes]);var Ee=oa((function(){var e={padding:"8px 15px",textAlign:"center"};return H.syncPosts&&!ge?React.createElement(Ne.X,{variant:"danger",style:e},"Pick a valid environment for the sync."):H.syncPosts?React.createElement(Ne.X,{variant:"special",style:e},"Enabled on ",React.createElement("b",null,null==ge?void 0:ge.name)):React.createElement(Ne.X,{variant:"info",style:e},"Disabled")}),[H]),be=function(){var e=Zr(Xr().mark((function e(){return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(S!==ie.filters.search){e.next=3;break}return a.invalidateQueries({queryKey:["vectors"]}),e.abrupt("return");case 3:le(Qr(Qr({},ie),{},{filters:Qr(Qr({},ie.filters),{},{search:S})}));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Oe=function(){var e=Zr(Xr().mark((function e(){return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:N(""),le(Qr(Qr({},ie),{},{filters:Qr(Qr({},ie.filters),{},{search:""})}));case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),xe=function(){var e=Zr(Xr().mark((function e(){var t,n,r,a,o,i=arguments;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:I,(n=i.length>1&&void 0!==i[1]&&i[1])||h("addEmbedding"),e.prev=3,(r=Qr({},t)).envId||(r.envId=X.id),e.next=8,(0,O.IU)("".concat(T,"/vectors/add"),{nonce:k,method:"POST",json:{vector:r}});case 8:a=e.sent,Me(null==a?void 0:a.vector,!0),A(!1),console.log("Embedding Added",t),e.next=18;break;case 14:throw e.prev=14,e.t0=e.catch(3),console.error(e.t0),new Error(null!==(o=e.t0.message)&&void 0!==o?o:"Unknown error, check your console logs.");case 18:return e.prev=18,n||h(!1),e.finish(18);case 21:return e.abrupt("return",!0);case 22:case"end":return e.stop()}}),e,null,[[3,14,18,21]])})));return function(){return e.apply(this,arguments)}}(),Se=function(){var e=Zr(Xr().mark((function e(){var t,n,r,a,o,i=arguments;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:I,(n=i.length>1?i[1]:void 0)||h("addEmbedding"),e.prev=3,(r=Qr({},t)).envId=X.id,e.next=8,(0,O.IU)("".concat(T,"/vectors/update"),{nonce:k,method:"POST",json:{vector:r}});case 8:a=e.sent,Me(null==a?void 0:a.vector),A(!1),console.log("Embeddings updated.",a),e.next=18;break;case 14:throw e.prev=14,e.t0=e.catch(3),console.error(e.t0),new Error(null!==(o=e.t0.message)&&void 0!==o?o:"Unknown error, check your console logs.");case 18:return e.prev=18,n||h(!1),e.finish(18);case 21:return e.abrupt("return",!0);case 22:case"end":return e.stop()}}),e,null,[[3,14,18,21]])})));return function(){return e.apply(this,arguments)}}(),Te=function(){var e=Zr(Xr().mark((function e(t,n){var r;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n||h("deleteEmbedding"),e.prev=1,e.next=4,(0,O.IU)("".concat(T,"/vectors/delete"),{nonce:k,method:"POST",json:{envId:X.id,ids:t}});case 4:e.next=13;break;case 6:if(e.prev=6,e.t0=e.catch(1),console.error(e.t0),confirm("Got an error from the vector database:\n\n".concat(e.t0.message,"\n\nDo you want to force the deletion locally?"))){e.next=11;break}throw new Error(null!==(r=e.t0.message)&&void 0!==r?r:"Unknown error, check your console logs.");case 11:return e.next=13,(0,O.IU)("".concat(T,"/vectors/delete"),{nonce:k,method:"POST",json:{envId:X.id,ids:t,force:!0}});case 13:return e.prev=13,n||h(!1),e.finish(13);case 16:console.log("Embeddings deleted.",{ids:t}),a.invalidateQueries({queryKey:["vectors"]}),"search"===g&&console.error("We should update the vectors data with the deleted embeddings.");case 19:case"end":return e.stop()}}),e,null,[[1,6,13,16]])})));return function(t,n){return e.apply(this,arguments)}}(),Ce=function(){var e=Zr(Xr().mark((function e(t){var n,r;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Xr().mark((function e(){var n,a,o,i,l;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t[r],a=new FileReader,o=n.name.endsWith(".json"),i=n.name.endsWith(".jsonl"),l=n.name.endsWith(".csv"),o||i||l){e.next=8;break}return alert(He.ALERTS.ONLY_SUPPORTS_FILES),e.abrupt("return",1);case 8:a.onload=function(){var e=Zr(Xr().mark((function e(t){var n,r,a,c,u,s,f;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.target.result,r=[],o?r=JSON.parse(n):i?(a=n.split("\n"),r=a.map((function(e){e=e.trim();try{return JSON.parse(e)}catch(e){return console.error(e),null}}))):l&&(c=zt().parse(n,{header:!0,skipEmptyLines:!0}),r=c.data,console.log("The CSV for Embeddings Import was loaded.",r)),s=(u=r).filter((function(e){return e.title&&e.content})),u.length!==s.length&&(alert(He.ALERTS.EMPTY_LINES_EMBEDDINGS),f=u.find((function(e){return!e.prompt||!e.completion})),console.warn("Empty line: ",f)),D({type:"import",data:{importVectors:s,envId:K}});case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),a.readAsText(n);case 10:case"end":return e.stop()}}),e)})),r=0;case 2:if(!(r<t.length)){e.next=9;break}return e.delegateYield(n(),"t0",4);case 4:if(!e.t0){e.next=6;break}return e.abrupt("continue",6);case 6:r++,e.next=2;break;case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ie=function(){var e=Zr(Xr().mark((function e(){return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(confirm("Are you sure you want to delete the selected embeddings?")){e.next=2;break}return e.abrupt("return");case 2:return h("deleteEmbeddings"),e.next=5,Te(M);case 5:P([]),h(!1);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ae=oa((function(){return(null==se?void 0:se.total)||0}),[se]),ke=oa((function(){var e=se;return null!=e&&e.vectors?null==e?void 0:e.vectors.map((function(e){var t,n,r,a=new Date(e.updated),i=(a=new Date(a.getTime()-60*a.getTimezoneOffset()*1e3)).toLocaleDateString("ja-JP",{year:"numeric",month:"2-digit",day:"2-digit"}),l=a.toLocaleTimeString("ja-JP",{hour:"2-digit",minute:"2-digit",second:"2-digit"}),c=React.createElement("span",null,i,React.createElement("br",null),l),u=new Date(e.created),s=(u=new Date(u.getTime()-60*u.getTimezoneOffset()*1e3)).toLocaleDateString("ja-JP",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),f=e.score?React.createElement("span",{style:{color:e.score>$/100?"var(--neko-green)":"inherit"}},(100*e.score.toFixed(4)).toFixed(2)):"-",m=null;e.subType&&"string"==typeof e.subType&&(m=e.subType.toUpperCase());var d=null!==(t=null===(n=z.getModel(e.model))||void 0===n?void 0:n.name)&&void 0!==t?t:e.model,p=e.model&&e.model!==(null==J?void 0:J.model),h=e.envId!==K,y=null===(r=W.find((function(t){return t.id===e.envId})))||void 0===r?void 0:r.name,v="ok"!==e.status||p||h,g=null;return p&&(g=React.createElement("b",{style:{color:o.red}},"[WRONG MODEL: ",e.model,"] ")),h&&y&&(g=React.createElement("b",{style:{color:o.green}},"[ENV: ",y,"] ")),{id:e.id,type:React.createElement("small",null,e.refId?React.createElement(React.Fragment,null,"ID ",React.createElement("a",{href:"/wp-admin/post.php?post=".concat(e.refId,"&action=edit"),target:"_blank",rel:"noreferrer"},"#",e.refId),React.createElement("br",null),React.createElement("div",{style:{fontSize:"80%",marginTop:-5}},m)):"MANUAL"),score:f,title:React.createElement(React.Fragment,null,React.createElement("span",null,e.title),React.createElement("br",null),React.createElement("small",{style:{color:p?o.red:"inherit"}},g,d," ",e.dimensions&&React.createElement(React.Fragment,null," (",e.dimensions,")"))),status:React.createElement(sa,{embedding:e,envName:y}),updated:c,created:s,actions:React.createElement(React.Fragment,null,React.createElement(w.M,{className:"primary",rounded:!0,icon:"pencil",disabled:he,onClick:function(){return D({type:"edit",data:e})}}),React.createElement(w.M,{className:"primary",rounded:!0,icon:"replay",disabled:he||!v,onClick:function(){return Le(e.id)}}),React.createElement(w.M,{className:"danger",rounded:!0,icon:"trash",disabled:he,onClick:function(){return Te([e.id])}}))}})):[]}),[g,se,he]),Le=function(){var e=Zr(Xr().mark((function e(t){var n;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h("syncEmbedding"),e.prev=1,e.next=4,Pe(t);case 4:e.next=10;break;case 6:e.prev=6,e.t0=e.catch(1),console.error(e.t0),alert(null!==(n=null===e.t0||void 0===e.t0?void 0:e.t0.message)&&void 0!==n?n:e.t0);case 10:h(!1);case 11:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(t){return e.apply(this,arguments)}}(),Me=function(e){a.invalidateQueries({queryKey:["vectors"]})},Pe=function(){var e=Zr(Xr().mark((function e(){var t,n,r,a,o=arguments;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:null,n=o.length>1&&void 0!==o[1]?o[1]:null,r=o.length>2&&void 0!==o[2]?o[2]:void 0,e.next=5,Et({vectorId:t,postId:n,envId:K},r);case 5:(a=e.sent).success&&Me(a.vector);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),je=function(){var e=Zr(Xr().mark((function e(){var t,n,r,o,i,l,c,u;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:h("bulkPullAll"),t={page:1,limit:1e4,filters:{envId:K}},n=[],r=[],o=!1;case 5:if(o){e.next=14;break}return e.next=8,mt(t);case 8:(i=e.sent).vectors.length<t.limit&&(o=!0),n=n.concat(i.vectors),t.page++,e.next=5;break;case 14:console.log("Remote vectors retrieved.",{remoteVectors:n}),o=!1,t.limit=20,t.page=0;case 18:if(o){e.next=27;break}return e.next=21,ht(t);case 21:(l=e.sent).vectors.length<t.limit&&(o=!0),r=r.concat(l.vectors),t.page++,e.next=18;break;case 27:if(r=r.map((function(e){return e.dbId})),console.log("Local vectors retrieved.",{vectors:r}),c=n.filter((function(e){return!r.includes(e)})),console.log("Vectors to pull from Vector DB to AI Engine.",{vectorsToPull:c}),c.length){e.next=35;break}return h(!1),alert("".concat(n.length," vectors were pulled from the remote database. They are already synchronized with the local database.")),e.abrupt("return");case 35:return u=c.map((function(e){return function(){var t=Zr(Xr().mark((function t(n){return Xr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,dt({envId:K,dbId:e},n);case 2:return t.next=4,a.invalidateQueries({queryKey:["vectors"]});case 4:return t.abrupt("return",{success:!0});case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()})),e.next=38,pe.start(u);case 38:h(!1),alert("All done! For more information, check the console (Chrome Developer Tools)."),pe.reset();case 41:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Fe=function(){var e=Zr(Xr().mark((function e(){var t,n,r,a,o=arguments;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>0&&void 0!==o[0]&&o[0],h("bulkPushAll"),n=[],!t&&0!==M.length){e.next=10;break}return e.next=6,vt(l,H.syncPostStatus);case 6:r=e.sent,n=r.map((function(e){return function(){var t=Zr(Xr().mark((function t(n){return Xr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Pe(null,e,n);case 2:return t.abrupt("return",{success:!0});case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()})),e.next=12;break;case 10:a=se.vectors.filter((function(e){return M.includes(e.id)})),n=a.map((function(e){return function(){var t=Zr(Xr().mark((function t(n){return Xr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("postId"!==e.type){t.next=5;break}return t.next=3,Pe(e.id,null,n);case 3:t.next=8;break;case 5:if("manual"!==e.type){t.next=8;break}return t.next=8,Se(e,n);case 8:return t.abrupt("return",{success:!0});case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()}));case 12:return e.next=14,pe.start(n);case 14:h(!1),alert("All done! For more information, check the console (Chrome Developer Tools). Posts with very short content (or content that could not be retrieved) are skipped."),pe.reset();case 17:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),De=function(){var e=Zr(Xr().mark((function e(){var t,n;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=prompt("Enter the Post ID to synchronize with:")){e.next=3;break}return e.abrupt("return");case 3:return h("singleRun"),e.prev=4,e.next=7,Pe(null,t);case 7:e.next=13;break;case 9:e.prev=9,e.t0=e.catch(4),console.error(e.t0),alert(null!==(n=null===e.t0||void 0===e.t0?void 0:e.t0.message)&&void 0!==n?n:e.t0);case 13:h(!1);case 14:case"end":return e.stop()}}),e,null,[[4,9]])})));return function(){return e.apply(this,arguments)}}(),Ge=oa((function(){var e;return React.createElement(React.Fragment,null,React.createElement("div",{style:{display:"flex"}},React.createElement(we.u,{scrolldown:!0,name:"environment",style:{flex:1,marginBottom:5},disabled:he,value:null!==(e=null==X?void 0:X.id)&&void 0!==e?e:null,onChange:function(e){q(e)}},W.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})})),!(null!=W&&W.length)&&React.createElement(we.j,{value:null,label:"None"}))))}),[X,W,he]),Ue=oa((function(){return null!=fe&&fe.message?React.createElement(Ne.X,{variant:"danger",style:{margin:"5px 5px"}},React.createElement("b",null,fe.message),React.createElement("br",null),React.createElement("small",null,"Check your Console Logs and PHP Error Logs for more information.")):"search"===g?He.HELP.NO_EMBEDDINGS_RESULTS:He.HELP.NO_EMBEDDINGS_ROWS}),[g,fe]);return React.createElement(React.Fragment,null,React.createElement(E.N,null,React.createElement(E.Y,{fullWidth:!0,minimal:!0,style:{margin:10}},React.createElement("div",{style:{display:"flex"}},React.createElement(qt.V,{style:{flex:1,marginRight:15}},React.createElement(Xt.S,{style:{marginRight:10},disabled:he,onLabel:He.EMBEDDINGS.AI_SEARCH,offLabel:He.EMBEDDINGS.EDIT,width:110,onValue:"search",offValue:"edit",checked:"search"===g,onChange:_,onBackgroundColor:o.purple,offBackgroundColor:o.green}),"edit"===g&&React.createElement(React.Fragment,null,React.createElement(w.M,{className:"primary",disabled:!X||he,onClick:function(){return D({type:"add",data:ut})}},"Add"))),React.createElement(qt.V,{style:{flex:"auto"}},"edit"===g&&React.createElement(React.Fragment,null,M.length>0&&React.createElement(React.Fragment,null,React.createElement(w.M,{className:"primary",disabled:he,isBusy:"bulkPushAll"===p,onClick:function(){return Fe(!1)}},"Sync Selected"),React.createElement(w.M,{className:"danger",disabled:he,onClick:Ie},He.COMMON.DELETE_SELECTED)),M.length>0&&React.createElement("div",{style:{display:"flex",alignItems:"center",marginLeft:10,marginRight:10}},M.length," selected"),React.createElement(Jt.j,{busy:pe.busy,style:{flex:"auto"},value:pe.value,max:pe.max,onStopClick:pe.stop})),"search"===g&&React.createElement("div",{style:{flex:"auto",display:"flex"}},React.createElement(Re.A,{style:{flex:"auto",marginRight:5},placeholder:"Search",disabled:!X||he,value:S,onChange:N,onEnter:be,onReset:Oe}),React.createElement(w.M,{className:"primary",onClick:be,disabled:!X||he||!S,isBusy:"searchVectors"===p},"Search"))))),React.createElement(E.Y,{minimal:!0,style:{flex:3}},React.createElement(R.z,{className:"primary",title:"Embeddings",action:React.createElement(React.Fragment,null,React.createElement("div",{style:{display:"flex",alignItems:"center"}},React.createElement(we.u,{scrolldown:!0,name:"debugMode",style:{width:180},disabled:he,value:U||null,onChange:B},React.createElement(we.j,{value:null,label:"Current Environment"}),React.createElement(we.j,{value:"includeOrphans",label:"With Orphans"}),React.createElement(we.j,{value:"includeAll",label:"All Envs & Orphans"})),React.createElement(w.M,{className:"secondary",style:{marginLeft:5},disabled:!X||me,onClick:function(){a.invalidateQueries({queryKey:["vectors"]})}},He.COMMON.REFRESH)))},React.createElement(Kt.o,{busy:he,sort:ie.sort,onSortChange:function(e,t){le(Qr(Qr({},ie),{},{sort:{accessor:e,by:t}}))},emptyMessage:Ue,data:ke,columns:de,onSelectRow:function(e){1===M.length&&M[0]===e&&P([]),P([e])},onSelect:function(e){P([].concat(qr(M),qr(e)))},onUnselect:function(e){P(qr(M.filter((function(t){return!e.includes(t)}))))},selectedItems:M}),React.createElement(_e.g,null),"search"!==g&&React.createElement("div",{style:{display:"flex"}},React.createElement("div",{style:{flex:"auto"}}),React.createElement(Qt.Q,{currentPage:ie.page,limit:ie.limit,onCurrentPageChanged:function(e){return le(Qr(Qr({},ie),{},{page:e}))},total:Ae,onClick:function(e){le(Qr(Qr({},ie),{},{page:e}))}}),React.createElement(w.M,{className:"primary",style:{marginLeft:5},disabled:!X,onClick:function(){D({type:"export",data:{envId:K}})}},He.COMMON.EXPORT))),React.createElement(R.z,{className:"primary",title:"Information"},React.createElement("p",null,React.createElement("b",null,"If want to discuss embeddings with other users, visit the ",React.createElement("a",{href:"https://discord.gg/bHDGh38",target:"_blank",rel:"noreferrer"},"Meow Apps Discord Server"),".")),React.createElement("p",null,"An embedding is a textual piece of data (sentence, paragraph, a whole article) that has been converted by OpenAI into a vector. Vectors can then be used to find the most relevant data for a given query. In this dashboard, you can create embeddings, and they will be synchronized with ",React.createElement("a",{target:"_blank",href:"https://www.pinecone.io/",rel:"noreferrer"},"Pinecone"),", a very fast and affordable vector database."),React.createElement("p",null,"You can switch from EDIT to AI SEARCH and you will be able to query the database, and get your content, with a score. You can edit the content and it will be synchronized with Pinecone. Then make your content perfect so that the results are satisfying! You can use Sync and Sync One, it will go through your posts and create the embeddings if they don't exist yet, or update them if they do."),React.createElement("p",null,"Both the chatbots and the AI Forms can use embeddings to enrich their answers."))),React.createElement(E.Y,{minimal:!0},React.createElement(R.z,{className:"primary"},Ge,React.createElement("div",{style:{display:"flex"}},React.createElement("div",{style:{flex:1,marginRight:5}},React.createElement("label",null,"Minimum Score:"),React.createElement("br",null),React.createElement("span",{style:{color:"var(--neko-green)"}},$,"%")),React.createElement("div",{style:{flex:1,marginLeft:5}},React.createElement("label",null,"Max Embedding(s):"),React.createElement("br",null),React.createElement("span",{style:{color:"var(--neko-green)"}},Q))),React.createElement("p",null,"The best ",Q," embedding(s) with a score of ",$," or more will provide additional context.")),"search"!==g&&React.createElement("div",{style:{margin:8}},React.createElement(d.s,{h2:!0,style:{color:"white",marginBottom:10}},He.EMBEDDINGS.SYNC_POSTS),React.createElement(b._,{inversed:!0},React.createElement(b.V,{title:"Push",inversed:!0},React.createElement($t.Z,{ref:Y,onSelectFiles:Ce,accept:""},React.createElement(w.M,{fullWidth:!0,className:"secondary",disabled:!X||he,onClick:function(){return Y.current.click()}},"Import CSV or JSON")),React.createElement(_e.g,{line:!0}),React.createElement("div",{style:{display:"flex",alignItems:"center"}},React.createElement(we.u,{id:"postType",scrolldown:!0,disabled:he,name:"postType",style:{width:100},onChange:c,value:l},null==te?void 0:te.map((function(e){return React.createElement(we.j,{key:e.type,value:e.type,label:e.name})}))),React.createElement(w.M,{fullWidth:!0,className:"primary",style:{marginLeft:10},disabled:!X||he,isBusy:"bulkPushAll"===p,onClick:function(){return Fe(!0)}},He.EMBEDDINGS.SYNC_ALL," ",!re&&React.createElement(React.Fragment,null,"(","".concat(ae),")"))),React.createElement(_e.g,{tiny:!0}),React.createElement(w.M,{fullWidth:!0,className:"primary",disabled:!X||he,isBusy:"singleRun"===p,onClick:De},He.EMBEDDINGS.SYNC_ONE)),React.createElement(b.V,{title:"Pull",inversed:!0},React.createElement(w.M,{fullWidth:!0,className:"primary",disabled:!X||he,isBusy:"bulkPullAll"===p,onClick:function(){return je()}},He.EMBEDDINGS.SYNC_ALL)),React.createElement(b.V,{title:"Settings",inversed:!0},React.createElement(y.R,{label:He.EMBEDDINGS.REWRITE_CONTENT,disabled:p,checked:H.rewriteContent,onChange:function(e){ye(Qr(Qr({},H),{},{rewriteContent:e}))},description:He.EMBEDDINGS.REWRITE_CONTENT_DESCRIPTION}),H.rewriteContent&&React.createElement(React.Fragment,null,React.createElement(_e.g,null),React.createElement(Wt.m,{value:H.rewritePrompt,rows:5,disabled:p,onBlur:function(e){ye(Qr(Qr({},H),{},{rewritePrompt:e}))},description:He.EMBEDDINGS.REWRITE_PROMPT_DESCRIPTION}),React.createElement(_e.g,null)),React.createElement(y.R,{label:He.EMBEDDINGS.FORCE_RECREATE,checked:H.forceRecreate,disabled:p,onChange:function(e){ye(Qr(Qr({},H),{},{forceRecreate:e}))},description:He.EMBEDDINGS.FORCE_RECREATE_DESCRIPTION})))),"search"!==g&&React.createElement("div",{style:{margin:"20px 8px 8px 8px"}},React.createElement(d.s,{h2:!0,style:{color:"white",marginBottom:10}},He.EMBEDDINGS.AUTO_SYNC_POSTS),React.createElement(b._,{inversed:!0},React.createElement(b.V,{title:"Status",inversed:!0},Ee),React.createElement(b.V,{title:"Settings",inversed:!0},Ee,X&&ve&&React.createElement(React.Fragment,null,React.createElement(_e.g,{tiny:!0}),React.createElement(Ne.X,{variant:"danger",style:{padding:"10px 20px",marginBottom:5}},"The currently selected environment is not used for Auto-Sync. Do you want to use this one?"),React.createElement(w.M,{fullWidth:!0,className:"primary",disabled:he,onClick:function(){return ye(Qr(Qr({},H),{},{syncPostsEnvId:K}))},style:{flex:1}},"Use Current Environment"),React.createElement(_e.g,{tiny:!0})),React.createElement(_e.g,{tiny:!0}),React.createElement(y.R,{label:He.EMBEDDINGS.AUTO_SYNC_POSTS,checked:H.syncPosts,disabled:p,onChange:function(e){ye(Qr(Qr({},H),{},{syncPosts:e}))},description:He.EMBEDDINGS.AUTO_SYNC_POSTS_DESCRIPTION}),H.syncPosts&&React.createElement(React.Fragment,null,React.createElement(_e.g,null),React.createElement(Re.A,{name:"syncPostTypes",value:H.syncPostTypes,isCommaSeparatedArray:!0,description:He.HELP.POST_TYPES,onBlur:function(e){ye(Qr(Qr({},H),{},{syncPostTypes:e}))}}),React.createElement(_e.g,null),React.createElement(Re.A,{name:"syncPostStatus",value:H.syncPostStatus||"publish",isCommaSeparatedArray:!0,description:He.HELP.POST_STATUS,onBlur:function(e){ye(Qr(Qr({},H),{},{syncPostStatus:e}))}}),React.createElement(_e.g,null),React.createElement(Re.A,{name:"syncPostCategories",value:H.syncPostCategories||"publish",isCommaSeparatedArray:!0,description:He.HELP.POST_CATEGORIES,onBlur:function(e){ye(Qr(Qr({},H),{},{syncPostCategories:e}))}}))))))),React.createElement(xr,{modal:F,setModal:D,busy:p,onAddEmbedding:xe,onModifyEmbedding:Se}),React.createElement(Mr,{modal:F,setModal:D,busy:p}),React.createElement(Vr,{modal:F,setModal:D,busy:p,onAddEmbedding:xe,onModifyEmbedding:Se}),pe.TasksErrorModal)};var ma=n(2262),da=n(4731);function pa(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ha(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)?ha(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 ha(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 ya=wp.element,va=ya.useState,ga=ya.useMemo;ma.t1.register(ma.PP,ma.kc,ma.E8,ma.m_,ma.s$);var Ea=function(e){var t=e.month,n=e.usageData;return 0===n[t].length?React.createElement("div",{style:{width:"calc(100% - 36px)",margin:"5px 18px 0px 18px",fontStyle:"italic"}},"No data available."):React.createElement("table",{style:{width:"calc(100% - 36px)",margin:"5px 18px 0px 18px",borderCollapse:"collapse"}},React.createElement("tbody",null,n[t].map((function(e,t){var n=e.isImage?"images":e.isAudio?"seconds":"tokens",r=e.units.toLocaleString();return React.createElement("tr",{key:t},React.createElement("td",{style:{paddingRight:10}},"Unknown Model"===e.name?"⚠️ ".concat(e.rawName):e.name),React.createElement("td",{style:{textAlign:"right",paddingRight:10}},r),React.createElement("td",{style:{paddingRight:10}},n),React.createElement("td",{style:{textAlign:"right"}},e.price>0?"".concat(e.price.toFixed(4),"$"):"-"))}))))};const ba=function(e){var t=e.options,n=ft(t,null,!0),r=n.models,a=n.getModel,o=n.calculatePrice,i=null==t?void 0:t.ai_models_usage,l=(0,s.z)().colors,c=pa(va("model"),2),u=c[0],f=c[1],m=pa(va("tokens"),2),d=m[0],p=m[1],h=ga((function(){var e={};return Object.keys(i).forEach((function(t){var n=i[t];e[t]||(e[t]=[]);var r={};Object.keys(n).forEach((function(e){var t=n[e],i=a(e),l=null,c=null,u=!1,s=!1;i?"image"===i.type?(c=(null==t?void 0:t.images)||0,s=!0):"second"===i.type?(c=(null==t?void 0:t.seconds)||0,u=!0):(l=(null==t?void 0:t.prompt_tokens)||0,c=(null==t?void 0:t.completion_tokens)||0):(l=(null==t?void 0:t.prompt_tokens)||0,c=(null==t?void 0:t.completion_tokens)||0);var f=i?o(e,l,c):0,m=i?i.rawName:"Unknown Model",d=e;r[m]||(r[m]={name:m,rawName:d,units:0,price:0,isImage:s,isAudio:u,family:i?i.family:null}),r[m].units+=s?c:l+c,r[m].price+=f})),e[t]=Object.values(r),e[t].sort((function(e,t){return t.price-e.price}))})),e}),[i,r]),y=ga((function(){var e=Object.keys(h),t=[],n=[l.blue,l.green,l.yellow,l.orange,l.red,l.purple];if("model"===u){r.forEach((function(r,a){var o=r.rawName,i=e.map((function(e){var t,n=null===(t=h[e])||void 0===t?void 0:t.find((function(e){return e.name===o||e.rawName===o}));return"tokens"===d?n?Math.max(n.units,1):0:n?Math.max(n.price,.01):0}));i.some((function(e){return e>0}))&&t.push({label:o,data:i,backgroundColor:n[a%n.length]})}));var a=e.map((function(e){var t;return(null===(t=h[e])||void 0===t?void 0:t.filter((function(e){return"Unknown Model"===e.name}))).reduce((function(e,t){return e+("tokens"===d?Math.max(t.units,1):Math.max(t.price,.01))}),0)}));a.some((function(e){return e>0}))&&t.push({label:"Unknown Model",data:a,backgroundColor:"rgba(128, 128, 128, 0.5)"})}else if("family"===u){var o={};e.forEach((function(t){h[t].forEach((function(n){var r=n.family;if(r){o[r]||(o[r]=Array(e.length).fill(0));var a="tokens"===d?Math.max(n.units,1):Math.max(n.price,.01),i=e.indexOf(t);o[r][i]+=a}}))})),Object.keys(o).forEach((function(e,r){t.push({label:e,data:o[e],backgroundColor:n[r%n.length]})}))}return{labels:e,datasets:t}}),[h,r,u,d,l]),v=ga((function(){var e={};y.datasets.forEach((function(t){var n=t.label;e[n]||(e[n]=0),t.data.forEach((function(t){e[n]+=t}))}));var t=Object.entries(e).sort((function(e,t){var n=pa(e,2)[1];return pa(t,2)[1]-n})).slice(0,8).map((function(e){return pa(e,1)[0]}));return y.datasets.filter((function(e){return t.includes(e.label)}))}),[y]),g={plugins:{legend:{position:"bottom",labels:{filter:function(e){return v.some((function(t){return t.label===e.text}))}}}},responsive:!0,scales:{x:{stacked:!0},y:{stacked:!0}}};return React.createElement(React.Fragment,null,i&&Object.keys(i).length>0&&React.createElement(React.Fragment,null,React.createElement(Vt.o,{name:"groupBy",value:"".concat(u,"-").concat(d),onChange:function(e){var t=pa(e.split("-"),2),n=t[0],r=t[1];f(n),p(r)}},React.createElement(Vt.K,{title:"Units by Model",value:"model-tokens"}),React.createElement(Vt.K,{title:"Price by Model",value:"model-price"}),React.createElement(Vt.K,{title:"Units by Family",value:"family-tokens"}),React.createElement(Vt.K,{title:"Price by Family",value:"family-price"})),React.createElement(_e.g,{size:"medium"}),React.createElement(da.yP,{options:g,data:y}),React.createElement(_e.g,{size:"medium"}),React.createElement(Se.a,{keepState:"monthlyUsageCategories"},Object.keys(h).reverse().map((function(e,t){return React.createElement(Se.Y,{key:t,title:"🗓️ ".concat(e," (").concat(h[e].reduce((function(e,t){return e+t.price}),0).toFixed(2),"$)")},React.createElement(Ea,{month:e,usageData:h}))})))))};var wa=n(6841);function Ra(e){return Ra="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},Ra(e)}function Oa(){Oa=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Ra(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Ra(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 _a(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function xa(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){_a(o,r,a,i,l,"next",e)}function l(e){_a(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Sa(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ta(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)?Ta(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 Ta(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 Na=wp.element.useState;function Ca(e,t){var n=new Blob([e],{type:"text/plain;charset=utf-8;"}),r=document.createElement("a");r.href=URL.createObjectURL(n),r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r)}const Ia=function(e){var t=e.modal,n=e.setModal,r=Sa(Na(!1),2),a=r[0],o=r[1],i=Sa(Na(0),2),l=i[0],c=i[1],u=Sa(Na(0),2),s=u[0],f=u[1],m=function(){var e=xa(Oa().mark((function e(){var t,n,r,a,i,l;return Oa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,o(!0),e.next=4,d();case 4:t=e.sent,n=(0,O.F1)(t,2),r=new Date,a=r.getFullYear(),i=r.getMonth()+1,l=r.getDate(),Ca(n,"discussions-".concat(a,"-").concat(i,"-").concat(l,".json")),setTimeout((function(){c(0)}),1e3),e.next=18;break;case 14:e.prev=14,e.t0=e.catch(0),console.error(e.t0),alert("An error occured while exporting discussions. Check your console.");case 18:return e.prev=18,o(!1),e.finish(18);case 21:case"end":return e.stop()}}),e,null,[[0,14,18,21]])})));return function(){return e.apply(this,arguments)}}(),d=function(){var e=xa(Oa().mark((function e(){var t,n,r,a;return Oa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=!1,n={page:1,limit:20,filters:{}},r=[],a=Oa().mark((function e(){var a;return Oa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,pt(n);case 2:(a=e.sent).chats.length<2&&(t=!0),c((function(){return a.total})),a.chats.forEach((function(e){e.messages=JSON.parse(e.messages),e.extra=JSON.parse(e.extra)})),r=r.concat(a.chats),f((function(){return r.length})),n.page++;case 9:case"end":return e.stop()}}),e)}));case 4:if(t){e.next=8;break}return e.delegateYield(a(),"t0",6);case 6:e.next=4;break;case 8:return e.abrupt("return",r);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return React.createElement(React.Fragment,null,React.createElement(Te.n,{isOpen:"export"===(null==t?void 0:t.type),title:"Export Discussions",onRequestClose:function(){return n(null)},okButton:{label:"Close",disabled:a,onClick:function(){return n(null)}},customButtons:React.createElement(React.Fragment,null,React.createElement(w.M,{onClick:m,disabled:a},"Export JSON")),content:React.createElement(React.Fragment,null,React.createElement(Jt.j,{busy:a,style:{flex:"auto"},value:s,max:l}))}))};function Aa(e){return Aa="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},Aa(e)}var ka,La,Ma,Pa,ja=["children"],Fa=["children"],Da=["children"];function Ga(e){return function(e){if(Array.isArray(e))return Ka(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Va(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 Ua(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 Ba(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ua(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=Aa(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Aa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==Aa(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ua(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ha(){Ha=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Aa(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Aa(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Ya(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function za(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Ya(o,r,a,i,l,"next",e)}function l(e){Ya(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Wa(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||Va(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 Va(e,t){if(e){if("string"==typeof e)return Ka(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)?Ka(e,t):void 0}}function Ka(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 qa(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Xa(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var $a=wp.element,Qa=$a.useMemo,Ja=$a.useState,Za=$a.useEffect,eo=G.Ay.div(ka||(ka=Xa(["\n  font-size: 12px;\n  border-bottom: 1px solid black;\n"]))),to=G.Ay.span(La||(La=Xa(["\n  font-weight: bold;\n  text-transform: uppercase;\n"]))),no=G.Ay.div(Ma||(Ma=Xa(["\n  font-size: 12px;\n  color: #bdb8b8;\n  background: #eeeeee;\n  padding: 2px 8px;\n"]))),ro=G.Ay.div(Pa||(Pa=Xa(["\n  font-size: 14px;\n  padding: 10px;\n  border: 1px solid #eaeaea;\n  background: #f5f5f5;\n  color: #333333;\n  word-break: break-word;\n  overflow-wrap: break-word;\n  word-wrap: break-word;\n  hyphens: auto;\n\n  img {\n    max-width: 100%;\n    height: auto;\n  }\n\n  a {\n    color: #333333;\n    text-decoration: underline;\n  }\n\n  a:hover {\n    color: #333333;\n    text-decoration: none;\n  }\n\n  blockquote {\n    border-left: 4px solid #dddddd;\n    padding-left: 10px;\n    margin-left: 0;\n    font-style: italic;\n  }\n\n  pre {\n    background: #eeeeee;\n    padding: 10px;\n    border-radius: 5px;\n    overflow-x: auto;\n    text-wrap: pretty;\n  }\n\n  code {\n    background: #eeeeee;\n    padding: 2px 5px;\n    border-radius: 5px;\n  }\n\n  table {\n    border-collapse: collapse;\n    width: 100%;\n    margin-bottom: 10px;\n  }\n  \n  table td, table th {\n    border: 1px solid #dddddd;\n    text-align: left;\n    padding: 5px;\n  }\n\n  table tr:nth-child(even) {\n    background-color: #dddddd;\n  }\n\n  .mwai-dead-image {\n    color: #ab5252;\n    background: #ffd2d2;\n    padding: 8px 8px;\n    text-align: center;\n  }\n"]))),ao={overrides:{object:{component:function(e){var t=e.children,n=qa(e,ja);return"<object ".concat(Object.keys(n).map((function(e){return"".concat(e,'="').concat(n[e],'"')})).join(" "),">").concat(t,"</object>")}},script:{component:function(e){var t=e.children,n=qa(e,Fa);return"<script ".concat(Object.keys(n).map((function(e){return"".concat(e,'="').concat(n[e],'"')})).join(" "),">").concat(t,"<\/script>")}},iframe:{component:function(e){var t=e.children,n=qa(e,Da);return"<iframe ".concat(Object.keys(n).map((function(e){return"".concat(e,'="').concat(n[e],'"')})).join(" "),">").concat(t,"</iframe>")}}}},oo=function(e){var t=e.content,n=Wa(Ja(t||""),2),r=n[0],a=n[1],o=function(e){return new Promise((function(t){var n=new Image;n.onload=function(){return t(!0)},n.onerror=function(){return t(!1)},n.src=e}))},i=function(){var e=za(Ha().mark((function e(t){var n,r,i,l;return Ha().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=/!\[.*?\]\((.*?)\)/g,r=t;case 2:if(null===(i=n.exec(t))){e.next=10;break}return l=i[1],e.next=6,o(l);case 6:e.sent||(r=r.replace(i[0],'<div class="mwai-dead-image">Image not available</div>')),e.next=2;break;case 10:a(r);case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();Za((function(){t&&i(t)}),[t]);var l=Qa((function(){var e="";try{e=(0,wa.cx)(r,ao)}catch(t){console.error("Crash in markdown-to-jsx! Reverting to plain text.",{e:t,processedContent:r}),e=r}return e}),[r]);return React.createElement(ro,null,l)},io=function(e){var t,n,r,a,o=e.message,i=null!=o&&null!==(t=o.extra)&&void 0!==t&&t.embeddings?null==o||null===(n=o.extra)||void 0===n?void 0:n.embeddings:null!=o&&null!==(r=o.extra)&&void 0!==r&&r.embedding?[null==o||null===(a=o.extra)||void 0===a?void 0:a.embedding]:[];return React.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:5}},React.createElement(eo,null,React.createElement(to,null,o.role||o.type)),(null==i?void 0:i.length)>0&&React.createElement(no,null,i.map((function(e){return React.createElement("div",{key:i.id},React.createElement("span",null,e.title)," (",React.createElement("span",null,(100*e.score.toFixed(4)).toFixed(2)),")")}))),React.createElement(oo,{content:o.content||o.text}))},lo=function(){var e=za(Ha().mark((function e(){var t,n,r=arguments;return Ha().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:[],e.next=3,(0,O.IU)("".concat(T,"/discussions/delete"),{nonce:k,method:"POST",json:{chatIds:t}});case 3:return n=e.sent,e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();const co=function(){var e,t,n,r,a,o,i,l,c,s=(0,u.jE)(),m=Wa(Ja({type:null,data:null}),2),d=m[0],p=m[1],h=Wa(Ja(!1),2),v=h[0],g=h[1],b=Wa(Ja(!1),2),O=b[0],_=b[1],x=(0,f.I)({queryKey:["chatbots"],queryFn:hn,initialData:F}).data,S=Qa((function(){return[{accessor:"updated",title:"Time",width:"80px",sortable:!0},{accessor:"user",title:"User",width:"85px",filters:{type:"text",description:He.HELP.USER_FILTER}},{accessor:"botId",title:"Chatbot",width:"85px",filters:{type:"select",options:x.map((function(e){return{value:e.botId,label:e.name}}))}},{accessor:"preview",title:He.COMMON.PREVIEW,filters:{type:"text"}},{accessor:"messages",title:"#",width:"45px"}]}),[x]),T=Wa(Ja((function(){return S.filter((function(e){return e.filters})).map((function(e){return{accessor:e.accessor,value:null}}))})),2),N=T[0],C=T[1],I=Wa(Ja([]),2),A=I[0],k=I[1],L=Wa(Ja({filters:N,sort:{accessor:"created",by:"desc"},page:1,limit:10}),2),M=L[0],P=L[1],j=(0,f.I)({queryKey:["chats",M],queryFn:function(){return pt(M)},refetchInterval:O?5e3:null}),D=j.isFetching,G=j.data,U=j.error;Za((function(){P(Ba(Ba({},M),{},{filters:N}))}),[N]);var B=Qa((function(){return(null==G?void 0:G.total)||0}),[G]),H=Qa((function(){return null!=G&&G.chats?null==G?void 0:G.chats.sort((function(e,t){return t.created_at-e.created_at})).map((function(e){var t,n,r,a,o=JSON.parse(e.messages),i=JSON.parse(e.extra),l=bt(e.created),c=bt(e.updated),u=wt(null!==(t=e.userId)&&void 0!==t?t:null==i?void 0:i.userId,null!==(n=e.ip)&&void 0!==n?n:null==i?void 0:i.ip),s=null==o?void 0:o.filter((function(e){return"user"===e.role||"user"===e.type})),f=null!=s&&s.length?s[0].content||s[0].text:"",m=null!=s&&s.length?s[s.length-1].content||s[s.length-1].text:"",d=null===(r=x.find((function(t){return t.botId===e.botId})))||void 0===r?void 0:r.name;return{id:e.id,botId:React.createElement(React.Fragment,null,React.createElement("div",null,d),React.createElement("div",null,React.createElement("small",null,React.createElement("i",null,e.botId)))),user:u,messages:null!==(a=null==o?void 0:o.length)&&void 0!==a?a:0,preview:React.createElement(React.Fragment,null,React.createElement("div",null,f),React.createElement("small",null,m)),extra:i.model,created:React.createElement("div",{style:{textAlign:"right"}},l),updated:React.createElement("div",{style:{textAlign:"right"}},c)}})):[]}),[G]),Y=Qa((function(){if(1!==(null==A?void 0:A.length))return null;var e=null==G?void 0:G.chats.find((function(e){return e.id===A[0]}));if(!e)return null;var t=[],n={};try{t=JSON.parse(e.messages),n=JSON.parse(e.extra)}catch(t){console.error("Could not parse discussion messages or extra.",{e:t,currentDiscussion:e})}return{id:e.id,chatId:e.chatId,botId:e.botId,messages:t,extra:n,created:e.created,updated:e.updated}}),[A,G]),z=function(){var e=za(Ha().mark((function e(){var t,n;return Ha().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g(!0),A.length){e.next=9;break}if(window.confirm(He.ALERTS.ARE_YOU_SURE)){e.next=5;break}return g(!1),e.abrupt("return");case 5:return e.next=7,lo();case 7:e.next=14;break;case 9:return t=null==G?void 0:G.chats.filter((function(e){return A.includes(e.id)})),n=t.map((function(e){return e.chatId})),e.next=13,lo(n);case 13:k([]);case 14:return e.next=16,s.invalidateQueries({queryKey:["chats"]});case 16:s.refetchQueries({queryKey:["chats"]}),g(!1);case 18:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),W=Qa((function(){return React.createElement("div",null,React.createElement("div",{style:{display:"flex",flexDirection:"row"}},React.createElement(Qt.Q,{currentPage:M.page,limit:M.limit,onCurrentPageChanged:function(e){return P(Ba(Ba({},M),{},{page:e}))},total:B,onClick:function(e){P(Ba(Ba({},M),{},{page:e}))}}),React.createElement(w.M,{className:"primary",style:{marginLeft:5},onClick:function(){p({type:"export",data:{}})}},He.COMMON.EXPORT)))}),[M,B]),V=Qa((function(){return null!=U&&U.message?React.createElement(Ne.X,{variant:"danger",style:{margin:"5px 5px"}},React.createElement("b",null,U.message),React.createElement("br",null),React.createElement("small",null,"Check your Console Logs and PHP Error Logs for more information.")):null}),[U]),K=bt(null==Y?void 0:Y.created),q=bt(null==Y?void 0:Y.updated);return React.createElement(React.Fragment,null,React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0,style:{flex:2}},React.createElement(R.z,{className:"primary",title:He.COMMON.DISCUSSIONS,action:React.createElement(React.Fragment,null,React.createElement("div",null,!O&&React.createElement(w.M,{className:"secondary",style:{marginLeft:5},disabled:D,onClick:za(Ha().mark((function e(){return Ha().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.invalidateQueries({queryKey:["chats"]});case 2:s.refetchQueries({queryKey:["chats"]});case 3:case"end":return e.stop()}}),e)})))},He.COMMON.REFRESH),A.length>0&&React.createElement(React.Fragment,null,React.createElement(w.M,{className:"danger",disabled:!1,onClick:z},He.COMMON.DELETE))))},React.createElement(Kt.o,{busy:!O&&D||v,sort:M.sort,onSortChange:function(e,t){P(Ba(Ba({},M),{},{sort:{accessor:e,by:t}}))},emptyMessage:V,filters:N,onFilterChange:function(e,t){var n=[].concat(Ga(N.filter((function(t){return t.accessor!==e}))),[{accessor:e,value:t}]);C(n)},data:H,columns:S,selectedItems:A,onSelectRow:function(e){1!==A.length||A[0]!==e?k([e]):k([])},onSelect:function(e){k([].concat(Ga(A),Ga(e)))},onUnselect:function(e){k(Ga(A.filter((function(t){return!e.includes(t)}))))}}),React.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:10}},React.createElement(w.M,{className:"danger",disabled:A.length,style:{marginRight:10},onClick:z},He.COMMON.DELETE_ALL),React.createElement(y.R,{name:"auto-refresh",label:"Auto Refresh",value:"1",checked:O,style:{width:180},onChange:function(){return _(!O)}}),React.createElement("div",{style:{flex:"auto"}}),W))),React.createElement(E.Y,{minimal:!0,style:{flex:1}},React.createElement(R.z,{className:"primary",title:"Selected Discussion",action:React.createElement(React.Fragment,null)},!Y&&React.createElement("div",{style:{textAlign:"center",padding:10}},"No discussion selected."),null==Y||null===(e=Y.messages)||void 0===e?void 0:e.map((function(e,t){return React.createElement(io,{key:t,message:e})}))),!!Y&&React.createElement(R.z,{className:"primary",title:"Information"},React.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:5}},React.createElement("div",{style:{fontWeight:"bold"}},"Model"),React.createElement("div",null,null==Y||null===(t=Y.extra)||void 0===t?void 0:t.model)),React.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:5}},React.createElement("div",{style:{fontWeight:"bold"}},"Bot ID (or Custom ID)"),React.createElement("div",null,null==Y?void 0:Y.botId)),(null==Y||null===(n=Y.extra)||void 0===n?void 0:n.context)&&React.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:5}},React.createElement("div",{style:{fontWeight:"bold"}},"Context"),React.createElement("div",null,null==Y||null===(r=Y.extra)||void 0===r?void 0:r.context)),(null==Y||null===(a=Y.extra)||void 0===a?void 0:a.assistantId)&&React.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:5}},React.createElement("div",{style:{fontWeight:"bold"}},"Assistant ID"),React.createElement("div",null,null==Y||null===(o=Y.extra)||void 0===o?void 0:o.assistantId)),(null==Y||null===(i=Y.extra)||void 0===i?void 0:i.threadId)&&React.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:5}},React.createElement("div",{style:{fontWeight:"bold"}},"Thread ID"),React.createElement("div",null,null==Y||null===(l=Y.extra)||void 0===l?void 0:l.threadId)),React.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:5}},React.createElement("div",{style:{fontWeight:"bold"}},"Chat ID"),React.createElement("div",null,null==Y?void 0:Y.chatId)),React.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:5}},React.createElement("div",{style:{fontWeight:"bold"}},"Session"),React.createElement("div",null,null==Y||null===(c=Y.extra)||void 0===c?void 0:c.session)),React.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:5}},React.createElement("div",{style:{fontWeight:"bold"}},"Created"),React.createElement("div",null,K)),React.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:5}},React.createElement("div",{style:{fontWeight:"bold"}},"Updated"),React.createElement("div",null,q))))),React.createElement(Ia,{modal:d,setModal:p,busy:v}))};var uo,so,fo;function mo(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var po=G.Ay.div(uo||(uo=mo(["\n  background: white;\n  padding: 15px;\n  border-radius: 5px;\n\n  h2 {\n    margin-bottom: 8px;\n  }\n  \n  h2:first-child, h3:first-child {\n    margin-top: 0;\n  }\n\n  label {\n    display: block;\n    margin-bottom: 5px;\n  }\n\n  label {\n    margin-top: 10px;\n  }\n\n  ul {\n    margin: 20px 0 0 0;\n  }\n\n  li {\n    margin-bottom: 5px;\n    border: 1px solid #e5e5e5;\n    padding: 8px;\n    background: #f5f5f5;\n    border-radius: 5px;\n    cursor: pointer;\n    position: relative;\n\n    &:last-child {\n      margin-bottom: 0;\n    }\n\n    &:hover {\n      background: #e5e5e5;\n    }\n\n    &.active {\n      background: #007cba;\n      color: white;\n      border-color: #007cba;\n\n      &.modified {\n        background: #ff8c00;\n        border-color: #ff8c00;\n      }\n    }\n  }\n\n  .information {\n    color: #a3a3a3;\n    margin-top: 5px;\n    font-size: 12px;\n    line-height: 100%;\n  }\n"]))),ho=(0,G.Ay)(Re.A)(so||(so=mo(["\n  flex: auto !important;\n\n  input {\n    height: 50px !important;\n    font-size: 13px !important;\n    font-family: monospace !important;\n    padding: 20px !important;\n    border-color: #333d4e !important;\n    background: #333d4e !important;\n    color: white !important;\n  }\n"]))),yo=G.Ay.div(fo||(fo=mo(["\n  display: flex;\n  flex-direction: column;\n\n  label {\n    margin-bottom: 3px;\n  }\n\n  .mwai-builder-row {\n    margin-top: 10px;\n    display: flex;\n    flex-direction: row;\n\n    .neko-color-picker {\n      margin-left: 5px;\n    }\n  }\n\n  .mwai-builder-col {\n    flex: 1;\n    display: flex;\n    flex-direction: column;\n    margin-right: 5px;\n  }\n\n  .mwai-builder-col:last-child {\n    margin-right: 0;\n  }\n\n  pre {\n    white-space: pre-wrap;\n    background: #d4f0ff;\n    color: #037cba;\n    padding: 10px;\n    font-size: 13px;\n    font-weight: bold;\n    margin: 10px 0 10px 0;\n  }\n\n  .neko-spacer {\n    margin-bottom: 0 !important;\n  }\n\n  .neko-input {\n  }\n\n  .nui-select-option {\n  }\n\n\n"]))),vo=["model","maxTokens","onRecommendedClick"];var go=wp.element.useMemo;const Eo=function(e){var t=e.model,n=e.maxTokens,r=e.onRecommendedClick,a=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,vo),o=null==t?void 0:t.maxContextualTokens,i=null==t?void 0:t.maxCompletionTokens,l=null==t?void 0:t.maxTokens,c=!!r;n=Math.floor(parseInt(n),0);var u=go((function(){return t?i||(o?Math.floor(o/2):l?Math.floor(l/2):null):null}),[i,o,l]),s=go((function(){return t?u===n?"var(--neko-green)":n>i?"var(--neko-red)":"var(--neko-yellow)":null}),[i,n,u]);return React.createElement("span",a,!(null==t||!t.maxContextualTokens)&&React.createElement(React.Fragment,null,"Contextual: ",null==t?void 0:t.maxContextualTokens,React.createElement("br",null)),!(null==t||!t.maxCompletionTokens)&&React.createElement(React.Fragment,null,"Completion: ",null==t?void 0:t.maxCompletionTokens,React.createElement("br",null)),!(null!=t&&t.maxCompletionTokens)&&!(null==t||!t.maxTokens)&&React.createElement(React.Fragment,null,"Total Max Tokens: ",null==t?void 0:t.maxTokens,React.createElement("br",null)),!!u&&React.createElement(React.Fragment,null,"Recommended: ",React.createElement("b",{onClick:c?function(){return r(u)}:null,style:{color:s,cursor:c?"pointer":"inherit"}},u,n>i&&React.createElement(React.Fragment,null,"❗️")),React.createElement("br",null)))};var bo,wo=["currentChatbot","isCustom","defaultChatbot"];function Ro(){Ro=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==_o(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(_o(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Oo(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function _o(e){return _o="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},_o(e)}function xo(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return So(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)?So(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 So(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 To=wp.element,No=To.useState,Co=To.useMemo,Io=G.Ay.div(bo||(bo=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n  pre {\n    display: flex;\n    align-items: center;\n    background: #f8fcff;\n    color: #779bb8;\n    margin: 0px;\n    padding: 3px 8px;\n    font-size: 13px;\n    border: 2px solid rgb(210 228 243);\n    border-radius: 5px;\n    font-family: system-ui;\n    cursor: pointer;\n    font-weight: 500;\n  }\n\n  .mwai-name {\n    font-style: italic;\n  }\n\n  .mwai-value {\n    color: var(--neko-green);\n  }\n\n  .skipped-params {\n    margin-top: 10px;\n    color: #ff4d4f;\n  }\n"]))),Ao=function(e){return"string"!=typeof e?e:e.replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/\n/g,"\\n").replace(/\[/g,"&#91;").replace(/\]/g,"&#93;")};const ko=function(e){var t,n=e.currentChatbot,r=e.isCustom,a=void 0!==r&&r,o=e.defaultChatbot,i=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,wo),l=xo(No(null),2),c=l[0],u=l[1],s=Co((function(){if(!n)return{shortcodeHtml:null,shortcodeText:null,skipped:[]};var e,t=[],r=[];if(a){for(var i in n){var l=n[i];if(null==l||"botId"===i||"name"===i||""===l||o&&o[i]===l||"object"===_o(l)||Array.isArray(l)&&0===l.length)"object"===_o(l)&&Array.isArray(l)&&0!==l.length&&r.push(i);else{var c=Ao(l),u=i.replace(/([A-Z])/g,(function(e){return"_".concat(e.toLowerCase())}));t.push("".concat(u,'="').concat(c,'"'))}}e="[mwai_chatbot"+(t.length?" ".concat(t.join(" ")):"")+"]"}else{var s,f=null!==(s=n.botId)&&void 0!==s?s:"default";t.push('id="'.concat(f,'"')),e='[mwai_chatbot id="'.concat(f,'"]')}var m=React.createElement("span",null,"[mwai_chatbot"," ",t.map((function(e,n){var r=xo(e.split("="),2),a=r[0],o=r[1];return React.createElement("span",{key:n},React.createElement("span",{className:"mwai-name"},a),"=",React.createElement("span",{className:"mwai-value"},o),n<t.length-1?" ":"")})),"]");return{shortcodeHtml:m,shortcodeText:e,skipped:r}}),[n,a,o]),f=null!==(t=null==s?void 0:s.skipped)&&void 0!==t?t:[],m=function(){var e,t=(e=Ro().mark((function e(){return Ro().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.clipboard){e.next=3;break}return alert("Clipboard is not enabled (only works with https)."),e.abrupt("return");case 3:return e.next=5,navigator.clipboard.writeText(s.shortcodeText);case 5:u("Copied!"),setTimeout((function(){u(null)}),2e3);case 7:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Oo(o,r,a,i,l,"next",e)}function l(e){Oo(o,r,a,i,l,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}();return n?React.createElement(Io,i,React.createElement("pre",{onClick:m},!c&&s.shortcodeHtml,c&&React.createElement("span",null,c)),f.length>0&&React.createElement("div",{className:"skipped-params"},"Skipped parameters: ",f.join(", "))):null};var Lo=n(7678);function Mo(e){return Mo="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},Mo(e)}var Po=["themes","shortcodeParams","updateShortcodeParams","defaultChatbot","blockMode","deleteCurrentChatbot","resetCurrentChatbot","duplicateCurrentChatbot","options"];function jo(){return jo=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},jo.apply(this,arguments)}function Fo(){Fo=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Mo(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Mo(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Do(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Go(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 Uo=wp.element,Bo=Uo.useMemo,Ho=Uo.useState,Yo=Uo.useEffect,zo="drop-shadow(0 0 5px rgba(0,0,0,0.1))",Wo=["chat-openai.svg","chat-robot-1.svg","chat-robot-2.svg","chat-nyao-1.svg","chat-nyao-2.svg","chat-nyao-3.svg","chat-color-blue.svg","chat-color-green.svg","chat-color-red.svg","chat-traditional-1.svg","chat-traditional-2.svg","avatar-user.svg","avatar-woman-blond.svg","avatar-woman-indian.svg","avatar-woman-asian.svg","avatar-woman-doctor.svg","avatar-man-blond.svg","avatar-man-black.svg","avatar-man-sunglasses.svg","avatar-man-pirate.svg"],Vo=function(e){var t=e.label,n=e.valueName,r=e.updateShortcodeParams,a=e.icon||"chat-color-green.svg",o=(0,Lo.Ve)(a),i=o||(null==a?void 0:a.startsWith("https://"))||(null==a?void 0:a.startsWith("http://")),l=i?a:"".concat(N,"/images/").concat(a);return React.createElement(React.Fragment,null,React.createElement("div",{className:"mwai-builder-row"},React.createElement("label",null,t,":")),React.createElement("div",{style:{marginTop:0,border:"1.5px solid #d2e4f3",borderRadius:5,padding:"10px 10px 10px 10px",background:"#f5fcff"}},React.createElement("div",{className:"mwai-builder-row",style:{marginTop:0}},React.createElement("div",{className:"mwai-builder-col",style:{flex:2}},React.createElement("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center"}},Wo.map((function(e){return React.createElement("img",{key:e,style:{marginRight:2,marginBottom:2,cursor:"pointer",filter:zo},width:24,height:24,src:"".concat(N,"/images/").concat(e),onClick:function(){r(e,n)}})})),React.createElement("div",{style:{width:24,height:24,border:"1px solid #d2e4f3",background:"#f5fcff",borderRadius:5,cursor:"pointer",display:"flex",justifyContent:"center",alignItems:"center"},onClick:function(){r("".concat(N,"/images/chat-traditional-1.svg"),n)}},"..."))),React.createElement("div",{className:"mwai-builder-col",style:{width:48,display:"flex",alignItems:"end"}},o?React.createElement("div",{style:{fontSize:48,lineHeight:"48px",marginRight:0,paddingTop:0}},a):React.createElement("img",{style:{marginRight:0,paddingTop:0,filter:zo},width:48,height:48,src:"".concat(l)}))),i&&React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.CUSTOM_ICON,":"),React.createElement(Re.A,{name:"icon",value:a,onBlur:function(e){return r(e,n)},onEnter:function(e){return r(e,n)}})))))};const Ko=function(e){var t,n,r,a,o,i,l,c,u=e.themes,s=e.shortcodeParams,f=e.updateShortcodeParams,m=e.defaultChatbot,d=e.blockMode,p=e.deleteCurrentChatbot,h=e.resetCurrentChatbot,v=e.duplicateCurrentChatbot,g=e.options,b=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,Po),R=ft(g,s.envId||null),_=R.completionModels,x=R.imageModels,S=R.getModel,T=null!==(t="chat"===s.mode)&&void 0!==t?t:"chat",N=null!==(n="assistant"===s.mode)&&void 0!==n&&n,C=null!==(r="images"===s.mode)&&void 0!==r&&r,I=s.contentAware,k=Bo((function(){return(null==g?void 0:g.ai_envs)||[]}),[g.ai_envs]),L=null==g?void 0:g.module_embeddings,M=(null==g?void 0:g.functions)||[],P=s.functions||[],j=(l=Ho(!1),c=2,function(e){if(Array.isArray(e))return e}(l)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(l,c)||function(e,t){if(e){if("string"==typeof e)return Go(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)?Go(e,t):void 0}}(l,c)||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.")}()),F=j[0],D=j[1],G=Bo((function(){return s.instructions&&s.instructions.includes("{CONTENT}")}),[s.instructions]),U=Bo((function(){return k.find((function(e){return e.id===s.envId}))||null}),[k,s.envId]),B=Bo((function(){return(null==U?void 0:U.assistants)||[]}),[U]),H=Bo((function(){return B.find((function(e){return e.id===s.assistantId}))||null}),[B,s.assistantId]),Y=S(H?H.model:s.model),z=g.embeddings_envs||[],W=Bo((function(){var e;return null==Y||null===(e=Y.tags)||void 0===e?void 0:e.includes("functions")}),[Y]),V=Bo((function(){var e;return null==Y||null===(e=Y.tags)||void 0===e?void 0:e.includes("vision")}),[Y]),K=Bo((function(){var e;return null==Y||null===(e=Y.tags)||void 0===e?void 0:e.includes("image")}),[Y]);Yo((function(){var e=P.filter((function(e){return M.some((function(t){return t.id===e.id}))}));if(e.length!==P.length)console.warn("Update Params: Functions has been updated."),f(e,"functions");else if(K&&!s.resolution){if(console.warn("Update Params: Resolution has been set."),null!=Y&&Y.resolutions){var t=Y.resolutions.map((function(e){return e.name})),n=t.includes("1024x1024")?"1024x1024":t[0];f(n,"resolution")}}else!K&&s.resolution?(console.warn("Update Params: Resolution has been removed."),f(null,"resolution")):K&&T||N&&s.model?(console.warn("Update Params: Model has been removed."),f(null,"model")):!N&&s.assistantId?(console.warn("Update Params: Assistant has been removed."),f(null,"assistantId")):s.imageUpload&&!V?(console.warn("Update Params: Vision has been removed."),f(null,"imageUpload")):s.fileSearch&&!N?(console.warn("Update Params: File search has been removed."),f(null,"fileSearch")):s.model&&!s.envId?(console.warn("Update Params: Model has been removed."),f(null,"model")):s.envId&&!U?(console.warn("Update Params: Environment has been removed."),f(null,"envId")):!L&&s.embeddingsEnvId?(console.warn("Update Params: Embeddings environment has been removed."),f(null,"embeddingsEnvId")):!W&&P.length?(console.warn("Update Params: Functions have been removed."),f([],"functions")):!N||!s.fileSearch||null!=H&&H.has_file_search?s.aiAvatar||s.aiName?s.userAvatar||s.userName?s.guestAvatar||s.guestName||(console.warn("Update Params: Guest avatar has been set to true."),f(!0,"guestAvatar")):(console.warn("Update Params: User avatar has been set to true."),f(!0,"userAvatar")):(console.warn("Update Params: AI avatar has been set to true."),f(!0,"aiAvatar")):(console.warn("Update Params: File search has been removed."),f(null,"fileSearch"))}),[s]);var q=function(){var e,t=(e=Fo().mark((function e(){return Fo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return D(!0),e.prev=1,e.next=4,gn(s.envId,s.assistantId,P);case 4:alert("Functions have been set on the assistant."),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(1),alert(e.t0.message);case 10:D(!1);case 11:case"end":return e.stop()}}),e,null,[[1,7]])})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Do(o,r,a,i,l,"next",e)}function l(e){Do(o,r,a,i,l,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}(),X=Bo((function(){return K&&Y?Y.resolutions?null==Y?void 0:Y.resolutions:(console.error("This image model does not have resolutions.",Y),[]):[]}),[Y,K]);return React.createElement(React.Fragment,null,React.createElement(E.N,null,React.createElement(E.Y,jo({minimal:!0},b),React.createElement(yo,null,React.createElement(Se.a,{keepState:"chatbotParams"},React.createElement(Se.Y,{title:He.COMMON.CHATBOT},React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.NAME,":"),React.createElement(Re.A,{name:"name","data-form-type":"other",disabled:"default"===s.botId,value:s.name,onBlur:f,onEnter:f})),React.createElement("div",{className:"mwai-builder-col"},React.createElement("div",null,React.createElement("label",{style:{display:"block"}},He.COMMON.ID,":"),React.createElement(Re.A,{name:"botId",type:"text",placeholder:"Optional",disabled:"default"===s.botId,value:s.botId,onBlur:f,onEnter:f}))),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.LOCAL_MEMORY,":"),React.createElement(y.R,{name:"localMemory",label:"Yes",checked:s.localMemory,value:"1",onChange:f}))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{height:"chat"===s.mode?76:"inherit"}},React.createElement("label",null,He.COMMON.MODE,":"),React.createElement(we.u,{scrolldown:!0,id:"mode",name:"mode",value:s.mode,onChange:f},React.createElement(we.j,{value:"chat",label:"Chat"}),React.createElement(we.j,{value:"assistant",label:"Assistant",isPro:!0,requirePro:!A}),React.createElement(we.j,{value:"images",label:"Images"}))),(T||N)&&React.createElement("div",{className:"mwai-builder-col",style:{flex:5}},React.createElement("label",null,He.COMMON.INSTRUCTIONS,":"),React.createElement(Wt.m,{name:"instructions",rows:10,textAreaStyle:{resize:"none"},value:s.instructions,onBlur:f,onEnter:f})))),React.createElement(Se.Y,{title:He.COMMON.AI_MODEL},React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.ENVIRONMENT,":"),React.createElement(we.u,{scrolldown:!0,name:"envId",value:null!==(a=s.envId)&&void 0!==a?a:"",onChange:f},k.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})})),React.createElement(we.j,{value:"",label:"Default"}))),(T||C)&&React.createElement("div",{className:"mwai-builder-col",style:{flex:2}},React.createElement("label",null,He.COMMON.MODEL,":"),React.createElement(we.u,{scrolldown:!0,name:"model",value:s.model,onChange:f},React.createElement(we.j,{value:"",label:"Default"}),(null!==(o=C?x:_)&&void 0!==o?o:[]).map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})})))),N&&React.createElement("div",{className:"mwai-builder-col",style:{flex:2}},React.createElement("label",null,He.COMMON.ASSISTANT,":"),React.createElement(we.u,{scrolldown:!0,name:"assistantId",value:s.assistantId,onChange:f},React.createElement(we.j,{value:"",label:"None"}),B.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})})))),K&&React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.RESOLUTION,":"),React.createElement(we.u,{scrolldown:!0,name:"resolution",value:s.resolution,onChange:f},X.map((function(e){return React.createElement(we.j,{key:e.name,value:e.name,label:e.label})})))),V&&React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.VISION,":"),React.createElement(y.R,{name:"imageUpload",label:He.COMMON.ENABLE,checked:s.imageUpload,value:"1",onChange:f}))),T&&React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.TEMPERATURE,":"),React.createElement(Re.A,{name:"temperature",type:"number",step:"0.1",min:"0",max:"1",value:s.temperature,onBlur:f,onEnter:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.MAX_TOKENS,":"),React.createElement(Re.A,{name:"maxTokens",type:"number",description:React.createElement(Eo,{model:Y,maxTokens:s.maxTokens,onRecommendedClick:function(e){f(e,"maxTokens")},style:{fontSize:11,lineHeight:"8px"}}),value:s.maxTokens,onBlur:f,onEnter:f})))),N&&React.createElement(Se.Y,{title:He.COMMON.ASSISTANT},React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.FILE_SEARCH,":"),React.createElement(we.u,{scrolldown:!0,name:"fileSearch",disabled:!(null!=H&&H.has_file_search),description:(0,O.FE)(null!=H&&H.has_file_search?He.SETTINGS.ASSISTANT_FILE_SEARCH:He.SETTINGS.ASSISTANT_NO_FILE_SEARCH),value:s.fileSearch,onChange:f},React.createElement(we.j,{value:"",label:"None"}),React.createElement(we.j,{value:"discussion",label:"For Discussion"}))))),(T||N)&&React.createElement(Se.Y,{title:He.COMMON.CONTEXT},React.createElement("div",{style:{marginTop:15,fontWeight:"bold"}},He.COMMON.EMBEDDINGS),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.EMBEDDINGS_ENV,":"),React.createElement(we.u,{scrolldown:!0,name:"embeddingsEnvId",requirePro:!0,isPro:A,disabled:!L||!(null!=z&&z.length),value:s.embeddingsEnvId,onChange:f},z.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})})),React.createElement(we.j,{value:"",label:"None"})))),React.createElement("div",{style:{marginTop:15,fontWeight:"bold"}},He.COMMON.OTHERS),T&&React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.CONTENT_AWARE,":"),React.createElement(y.R,{name:"contentAware",label:"Yes",requirePro:!0,isPro:A,checked:s.contentAware,value:"1",onChange:f}))),I&&!G&&React.createElement(Ne.X,{variant:"danger",style:{marginTop:15,padding:"10px 15px"}},React.createElement("p",null,(0,O.FE)(He.SETTINGS.ALERT_CONTENTAWARE_BUT_NO_CONTENT)))),W&&!d&&React.createElement(Se.Y,{title:He.COMMON.FUNCTIONS},React.createElement("p",null,React.createElement(Ot,{style:{marginRight:3}}),React.createElement(_t,{style:{marginRight:5}}),(0,O.FE)(He.HELP.FUNCTIONS)),!(null!=M&&M.length)&&React.createElement(Ne.X,{variant:"danger"},(0,O.FE)(He.HELP.FUNCTIONS_UNAVAILABLE)),!(null==M||!M.length)&&React.createElement("div",{style:{maxHeight:200,overflowY:"auto",border:"1px solid #d1e3f2",marginTop:10,padding:"5px 6px",borderRadius:5}},null==M?void 0:M.map((function(e){return React.createElement(y.R,{key:e.id,name:"functions",label:React.createElement(React.Fragment,null,"js"===e.target&&React.createElement(xt,{style:{marginRight:5}}),"js"!==e.target&&React.createElement(St,{style:{marginRight:5}}),React.createElement("span",null,e.name)),description:e.desc,checked:P.some((function(t){return t.id===e.id})),value:e.id,onChange:function(t){var n=P.filter((function(t){return t.id!==e.id}));t&&n.push({type:e.type,id:e.id}),f(n,"functions")}})}))),N&&React.createElement(React.Fragment,null,React.createElement("p",null,"Assistant needs to be updated with the set of functions every time you modify them (including their names, arguments, descriptions, etc)."),React.createElement(w.M,{className:"primary",fullWidth:!0,onClick:q,isBusy:F},"Set Functions on Assistant"))),React.createElement(Se.Y,{title:He.COMMON.THRESHOLDS},React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.INPUT_MAX_LENGTH,":"),React.createElement(Re.A,{name:"textInputMaxLength",type:"number",description:He.HELP.INPUT_MAX_LENGTH,step:"1",min:"8",value:s.textInputMaxLength,onBlur:f,onEnter:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.MAX_MESSAGES,":"),React.createElement(Re.A,{name:"maxMessages",type:"number",description:He.HELP.MAX_MESSAGES,step:"1",min:"1",max:"1024",value:s.maxMessages,onBlur:f,onEnter:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.CONTEXT_MAX_LENGTH,":"),React.createElement(Re.A,{name:"contextMaxLength",type:"number",step:"1",description:He.HELP.CONTEXT_MAX_LENGTH,value:s.contextMaxLength||(null==g?void 0:g.context_max_length),onBlur:f,onEnter:f})))),React.createElement(Se.Y,{title:He.COMMON.APPEARANCE},React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:3}},React.createElement("label",null,He.COMMON.THEME,":"),React.createElement(we.u,{scrolldown:!0,name:"themeId",value:s.themeId,description:"",onChange:f},React.createElement(we.j,{value:"none",label:"None"}),React.createElement(we.j,{value:"chatgpt",label:"ChatGPT"}),React.createElement(we.j,{value:"timeless",label:"Timeless"}),React.createElement(we.j,{value:"messages",label:"Messages"}),null==u?void 0:u.filter((function(e){return"css"===e.type})).map((function(e){return React.createElement(we.j,{key:e.themeId,value:e.themeId,label:e.name})})))),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.POPUP,":"),React.createElement(y.R,{name:"window",label:"Yes",checked:s.window,value:"1",onChange:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.FULL_SCREEN,":"),React.createElement(y.R,{name:"fullscreen",label:"Yes",checked:s.fullscreen,value:"1",onChange:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.COPY_BUTTON,":"),React.createElement(y.R,{name:"copyButton",label:"Yes",checked:s.copyButton,value:"1",onChange:f}))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.AVATAR,":"),React.createElement(y.R,{name:"aiAvatar",label:"Yes",checked:s.aiAvatar,value:"1",onChange:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:3}},React.createElement("label",null,He.COMMON.AI_NAME,":"),React.createElement(Re.A,{name:"aiName","data-form-type":"other",value:s.aiName,onBlur:f,onEnter:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:7}},React.createElement("label",null,He.COMMON.START_SENTENCE,":"),React.createElement(Wt.m,{name:"startSentence",rows:1,value:s.startSentence,onBlur:f,onEnter:f}))),s.aiAvatar&&React.createElement(Vo,{label:He.COMMON.AI_AVATAR,updateShortcodeParams:f,valueName:"aiAvatarUrl",icon:s.aiAvatarUrl}),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.AVATAR,":"),React.createElement(y.R,{name:"userAvatar",label:"Yes",checked:s.userAvatar,value:"1",onChange:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:3}},React.createElement("label",null,He.COMMON.USER_NAME,":"),React.createElement(Re.A,{name:"userName","data-form-type":"other",value:s.userName,onBlur:f,onEnter:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:3}},React.createElement("label",null,He.COMMON.PLACEHOLDER,":"),React.createElement(Re.A,{name:"textInputPlaceholder",value:s.textInputPlaceholder,onBlur:f,onEnter:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:2}},React.createElement("label",null,He.COMMON.SEND,":"),React.createElement(Re.A,{name:"textSend",value:s.textSend,onBlur:f,onEnter:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:2}},React.createElement("label",null,He.COMMON.CLEAR,":"),React.createElement(Re.A,{name:"textClear",value:s.textClear,onBlur:f,onEnter:f}))),s.userAvatar&&React.createElement("p",null,React.createElement("i",null,"The ",React.createElement("a",{href:"https://gravatar.com/",target:"_blank",rel:"noreferrer"},"gravatar")," of this user will be used as the avatar.")),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.AVATAR,":"),React.createElement(y.R,{name:"guestAvatar",label:"Yes",checked:s.guestAvatar,value:"1",onChange:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:3}},React.createElement("label",null,He.COMMON.GUEST_NAME,":"),React.createElement(Re.A,{name:"guestName",value:s.guestName,onBlur:f,onEnter:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:7}},React.createElement("label",null,He.COMMON.COMPLIANCE_TEXT,":"),React.createElement(Re.A,{name:"textCompliance",value:s.textCompliance,onBlur:f,onEnter:f}))),s.guestAvatar&&React.createElement(Vo,{label:He.COMMON.GUEST_AVATAR,updateShortcodeParams:f,valueName:"guestAvatarUrl",icon:s.guestAvatarUrl})),React.createElement(Se.Y,{title:He.COMMON.POPUP,hide:!s.window},React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:4}},React.createElement("label",null,He.COMMON.POSITION,":"),React.createElement(we.u,{scrolldown:!0,name:"iconPosition",value:s.iconPosition,onChange:f},React.createElement(we.j,{value:"bottom-right",label:"Bottom Right"}),React.createElement(we.j,{value:"bottom-left",label:"Bottom Left"}),React.createElement(we.j,{value:"top-right",label:"Top Right"}),React.createElement(we.j,{value:"top-left",label:"Top Left"}))),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.BUBBLE,":"),React.createElement(y.R,{name:"iconBubble",label:"Yes",checked:s.iconBubble,value:"1",onChange:f}))),React.createElement(Vo,{label:He.COMMON.ICON,updateShortcodeParams:f,valueName:"icon",icon:s.icon}),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:4}},React.createElement("label",null,He.COMMON.ICON_TEXT,":"),React.createElement(Re.A,{name:"iconText",description:He.HELP.ICON_TEXT,value:s.iconText,onBlur:f,onEnter:f})),React.createElement("div",{className:"mwai-builder-col",style:{flex:2}},React.createElement("label",null,He.COMMON.ICON_TEXT_DELAY,":"),React.createElement(Re.A,{name:"iconTextDelay",type:"number",description:null!==(i=He.HELP.ICON_TEXT_DELAY)&&void 0!==i?i:1,value:s.iconTextDelay,onBlur:f,onEnter:f})))),!d&&React.createElement(Se.Y,{title:He.COMMON.SHORTCODES},React.createElement(ko,{currentChatbot:s,style:{marginTop:10}}),"default"!==s.botId&&React.createElement(React.Fragment,null,React.createElement("p",null,He.HELP.CUSTOM_SHORTCODE),React.createElement(ko,{currentChatbot:s,isCustom:!0,defaultChatbot:m,style:{marginTop:10}}))),!d&&React.createElement(Se.Y,{title:He.COMMON.ACTIONS},React.createElement("div",{style:{display:"flex",marginTop:10}},React.createElement(w.M,{className:"primary",onClick:v},He.COMMON.DUPLICATE),React.createElement(w.M,{className:"secondary",onClick:h},He.COMMON.RESET),React.createElement("div",{style:{flex:"auto"}}),React.createElement(w.M,{className:"danger",disabled:"Default"===s.name,onClick:p},He.COMMON.DELETE))))))))};var qo,Xo=n(7612);function $o(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Qo(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)?Qo(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 Qo(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 Jo=wp.element,Zo=Jo.useState,ei=Jo.useEffect,ti=Jo.useRef,ni=Jo.useCallback,ri=G.Ay.div(qo||(qo=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n  position: relative;\n\n  .swatch {\n    width: 24px;\n    height: 24px;\n    border: 3px solid #fff;\n    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), inset 0 0 0 1px rgba(0, 0, 0, 0.1);\n    cursor: pointer;\n  }\n  \n  .popover {\n    position: absolute;\n    top: -210px;\n    left: -80px;\n    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);\n    z-index: 9999;\n    border-radius: 8px;\n  }\n"]))),ai=function(e){var t=e.name,n=e.value,r=e.onChange,a=ti(),o=$o(Zo(!1),2),i=o[0],l=o[1],c=$o(Zo(n),2),u=c[0],s=c[1];ei((function(){s(n)}),[n]);var f,m,d=ni((function(){u!==n&&r(u,t),l(!1)}),[u,n]);return ei((function(){var e=!1,t=!1,n=function(n){!e&&t&&f.current&&!f.current.contains(n.target)&&m(n)},r=function(n){t=f.current,e=f.current&&f.current.contains(n.target)};return document.addEventListener("mousedown",r),document.addEventListener("touchstart",r),document.addEventListener("click",n),function(){document.removeEventListener("mousedown",r),document.removeEventListener("touchstart",r),document.removeEventListener("click",n)}}),[f=a,m=d]),React.createElement(ri,{className:"neko-color-picker"},React.createElement("div",{className:"swatch",style:{backgroundColor:u},onClick:function(){return l(!0)}}),i&&React.createElement("div",{className:"popover",ref:a,style:{background:"white"}},React.createElement(Xo.jI,{color:u,onChange:s}),React.createElement("div",{style:{display:"flex",padding:5}},React.createElement(w.M,{style:{flex:1},onClick:function(){return r(u,t)}},"Apply"))))};const oi=function(e){var t,n,r,a,o,i,l,c,u,s,f,m,d,p,h,y,v,g,E,b,w,R=e.settings,O=e.onUpdateSettings;return React.createElement(React.Fragment,null,React.createElement(yo,null,React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:.66}},React.createElement("label",null,He.COMMON.SPACING,":"),React.createElement(Re.A,{id:"spacing",name:"spacing",value:null!==(t=null==R?void 0:R.spacing)&&void 0!==t?t:"15px",onBlur:O,onEnter:O})),React.createElement("div",{className:"mwai-builder-col",style:{flex:.66}},React.createElement("label",null,He.COMMON.BORDER_RADIUS,":"),React.createElement(Re.A,{id:"borderRadius",name:"borderRadius",value:null!==(n=null==R?void 0:R.borderRadius)&&void 0!==n?n:"10px",onBlur:O,onEnter:O})),React.createElement("div",{className:"mwai-builder-col",style:{flex:.66}},React.createElement("label",null,He.COMMON.FONT_SIZE,":"),React.createElement(Re.A,{id:"fontSize",name:"fontSize",value:null!==(r=null==R?void 0:R.fontSize)&&void 0!==r?r:"15px",onBlur:O,onEnter:O})),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.FONT_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"fontColor",name:"fontColor",value:null!==(a=null==R?void 0:R.fontColor)&&void 0!==a?a:"#FFFFFF",onBlur:O,onEnter:O}),React.createElement(ai,{id:"fontColor",name:"fontColor",value:null!==(o=null==R?void 0:R.fontColor)&&void 0!==o?o:"#FFFFFF",onChange:O})))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BACK_PRIMARY_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundPrimaryColor",name:"backgroundPrimaryColor",style:{flex:1},value:null!==(i=null==R?void 0:R.backgroundPrimaryColor)&&void 0!==i?i:"#454654",onBlur:O,onEnter:O}),React.createElement(ai,{id:"backgroundPrimaryColor",name:"backgroundPrimaryColor",value:null!==(l=null==R?void 0:R.backgroundPrimaryColor)&&void 0!==l?l:"#454654",onChange:O,onEnter:O}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BACK_SECONDARY_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundSecondaryColor",name:"backgroundSecondaryColor",style:{flex:1},value:null!==(c=null==R?void 0:R.backgroundSecondaryColor)&&void 0!==c?c:"#343541",onBlur:O,onEnter:O}),React.createElement(ai,{id:"backgroundSecondaryColor",name:"backgroundSecondaryColor",value:null!==(u=null==R?void 0:R.backgroundSecondaryColor)&&void 0!==u?u:"#343541",onChange:O,onEnter:O})))),React.createElement(_e.g,null),React.createElement(Se.Y,{title:He.COMMON.POPUP,isCollapsed:!1}),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:.75}},React.createElement("label",null,He.COMMON.WIDTH,":"),React.createElement(Re.A,{id:"width",name:"width",value:null!==(s=null==R?void 0:R.width)&&void 0!==s?s:"460px",onBlur:O,onEnter:O})),React.createElement("div",{className:"mwai-builder-col",style:{flex:.75}},React.createElement("label",null,He.COMMON.MAX_HEIGHT,":"),React.createElement(Re.A,{id:"maxHeight",name:"maxHeight",value:null!==(f=null==R?void 0:R.maxHeight)&&void 0!==f?f:"40vh",onBlur:O,onEnter:O})),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.AVATAR_MESSAGE_BACKGROUND_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"iconTextBackgroundColor",name:"iconTextBackgroundColor",value:null!==(m=null==R?void 0:R.iconTextBackgroundColor)&&void 0!==m?m:"#343541",onBlur:O,onEnter:O}),React.createElement(ai,{id:"iconTextBackgroundColor",name:"iconTextBackgroundColor",value:null!==(d=null==R?void 0:R.iconTextBackgroundColor)&&void 0!==d?d:"#343541",onChange:O,onEnter:O}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.AVATAR_MESSAGE_FONT_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"iconTextColor",name:"iconTextColor",value:null!==(p=null==R?void 0:R.iconTextColor)&&void 0!==p?p:"#FFFFFF",onBlur:O,onEnter:O}),React.createElement(ai,{id:"iconTextColor",name:"iconTextColor",value:null!==(h=null==R?void 0:R.iconTextColor)&&void 0!==h?h:"#FFFFFF",onChange:O,onEnter:O})))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BUBBLE_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"bubbleColor",name:"bubbleColor",style:{flex:1},value:null!==(y=null==R?void 0:R.bubbleColor)&&void 0!==y?y:"#343541",onBlur:O,onEnter:O}),React.createElement(ai,{id:"bubbleColor",name:"bubbleColor",value:null!==(v=null==R?void 0:R.bubbleColor)&&void 0!==v?v:"#343541",onChange:O,onEnter:O}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.HEADER_BACKGROUND_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundHeaderColor",name:"backgroundHeaderColor",style:{flex:1},value:null!==(g=null==R?void 0:R.backgroundHeaderColor)&&void 0!==g?g:"#343541",onBlur:O,onEnter:O}),React.createElement(ai,{id:"backgroundHeaderColor",name:"backgroundHeaderColor",value:null!==(E=null==R?void 0:R.backgroundHeaderColor)&&void 0!==E?E:"#343541",onChange:O,onEnter:O}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.HEADER_BUTTONS_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"headerButtonsColor",name:"headerButtonsColor",style:{flex:1},value:null!==(b=null==R?void 0:R.headerButtonsColor)&&void 0!==b?b:"#FFFFFF",onBlur:O,onEnter:O}),React.createElement(ai,{id:"headerButtonsColor",name:"headerButtonsColor",value:null!==(w=null==R?void 0:R.headerButtonsColor)&&void 0!==w?w:"#FFFFFF",onChange:O,onEnter:O}))))))};function ii(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 li=wp.element,ci=li.useMemo,ui=li.useState,si=li.useEffect;const fi=function(e){var t,n,r=e.theme,a=e.onUpdateTheme,o=(t=ui(""),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,n)||function(e,t){if(e){if("string"==typeof e)return ii(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)?ii(e,t):void 0}}(t,n)||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.")}()),i=o[0],l=o[1];si((function(){l(r.style)}),[r]);var c=ci((function(){return i!==r.style}),[i,r]);return React.createElement(yo,null,React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.NAME,":"),React.createElement(Re.A,{name:"name","data-form-type":"other",value:r.name,onBlur:a,onEnter:a})),React.createElement("div",{className:"mwai-builder-col"},React.createElement("div",null,React.createElement("label",{style:{display:"block"}},He.COMMON.ID,":"),React.createElement(Re.A,{name:"themeId",type:"text",placeholder:"Optional",value:r.themeId,onBlur:a,onEnter:a})))),React.createElement(_e.g,null),React.createElement("label",null,"Custom CSS:"),React.createElement(Wt.m,{name:"css",value:i,onChange:l,rows:16,tabToSpaces:2}),React.createElement("div",{style:{display:"flex"}},React.createElement(w.M,{fullWidth:!0,onClick:function(){var e=".mwai-THEME_ID-theme {\n  --mwai-spacing: 10px;\n  --mwai-fontSize: 14px;\n  --mwai-fontColor: #000;\n  --mwai-bgPrimary: #fff;\n  --mwai-primary: #0084ff;\n  --mwai-secondary: #f0f0f0;\n  --mwai-width: 300px;\n  --mwai-borderRadius: 5px;\n}\n\n.mwai-THEME_ID-theme .mwai-content {\n  background: var(--mwai-bgPrimary);\n  padding: var(--mwai-spacing);\n  font-size: var(--mwai-fontSize);\n  color: var(--mwai-fontColor);\n}\n\n.mwai-THEME_ID-theme .mwai-conversation {\n  display: flex;\n  flex-direction: column;\n}\n\n.mwai-THEME_ID-theme .mwai-reply {\n  margin-bottom: var(--mwai-spacing);\n  padding: var(--mwai-spacing);\n  display: flex;\n}\n\n.mwai-THEME_ID-theme .mwai-reply.mwai-ai {\n  background: var(--mwai-secondary);\n}\n\n.mwai-THEME_ID-theme .mwai-reply.mwai-user {\n  background: var(--mwai-primary);\n  color: #fff;\n}\n\n.mwai-THEME_ID-theme .mwai-name {\n  margin-right: var(--mwai-spacing);\n}\n\n.mwai-THEME_ID-theme .mwai-input {\n  display: flex;\n  align-items: center;\n  gap: 5px;\n}\n\n.mwai-THEME_ID-theme .mwai-input-text {\n  display: flex;\n  align-items: center;\n  flex: 1;\n}\n\n.mwai-THEME_ID-theme .mwai-input-text textarea {\n  flex: 1;\n}\n\n.mwai-THEME_ID-theme .mwai-trigger {\n  position: absolute;\n  right: 0;\n  bottom: 0;\n  transition: all 0.2s ease-out;\n  z-index: 9999;\n  display: flex;\n  flex-direction: column;\n  align-items: flex-end;\n}\n\n.mwai-THEME_ID-theme .mwai-trigger .mwai-icon-text-container {\n  display: flex;\n  flex-direction: column;\n  align-items: flex-end;\n}\n\n.mwai-THEME_ID-theme .mwai-trigger .mwai-icon-text {\n  background: var(--mwai-iconTextBackgroundColor);\n  color: var(--mwai-iconTextColor);\n  box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);\n  max-width: 200px;\n  font-size: 13px;\n  margin-bottom: 15px;\n  padding: 10px 15px;\n  border-radius: 8px;\n}\n\n.mwai-THEME_ID-theme .mwai-reply-actions .mwai-copy-button {\n  fill: var(--mwai-fontColor);\n  padding: 3px 5px;\n  width: 24px;\n  height: 24px;\n  background: var(--mwai-bgPrimary);\n  cursor: pointer;\n  border-radius: var(--mwai-borderRadius);\n  display: none;\n}\n\n.mwai-THEME_ID-theme .mwai-reply-actions:not(.mwai-hidden) .mwai-copy-button {\n  display: block;\n}\n\n.mwai-THEME_ID-theme.mwai-window {\n  position: fixed;\n  right: 30px;\n  bottom: 30px;\n  width: var(--mwai-width);\n  z-index: 9999;\n}\n\n.mwai-THEME_ID-theme.mwai-window .mwai-content {\n  display: none;\n  opacity: 0;\n  max-height: var(--mwai-maxHeight);\n  border-radius: 0 0 var(--mwai-borderRadius) var(--mwai-borderRadius);\n}\n\n.mwai-THEME_ID-theme.mwai-window.mwai-bottom-left,\n.mwai-THEME_ID-theme.mwai-window.mwai-top-left {\n  right: auto;\n  left: 30px;\n}\n\n.mwai-THEME_ID-theme.mwai-window.mwai-top-right,\n.mwai-THEME_ID-theme.mwai-window.mwai-top-left {\n  top: 30px;\n  bottom: auto;\n}\n\n.mwai-THEME_ID-theme.mwai-window.mwai-open .mwai-trigger {\n  display: none;\n}\n\n.mwai-THEME_ID-theme.mwai-window.mwai-open .mwai-content {\n  display: flex;\n  flex-direction: column;\n  transition: opacity 200ms ease-in-out;\n  opacity: 1;\n}\n\n.mwai-THEME_ID-theme.mwai-window .mwai-header {\n  display: none;\n  justify-content: flex-end;\n  height: 22px;\n}\n\n.mwai-THEME_ID-theme.mwai-window.mwai-open .mwai-header {\n  display: flex;\n}\n\n.mwai-THEME_ID-theme.mwai-window .mwai-header .mwai-buttons .mwai-close-button:after {\n  content: '╳';\n  cursor: pointer;\n}\n".replace(/THEME_ID/g,r.themeId);l(e)}},"Default CSS"),React.createElement(w.M,{fullWidth:!0,onClick:function(){a(i,"style")},disabled:!c},"Apply CSS")))},mi=function(e){var t,n,r,a,o,i,l,c,u,s,f,m,d,p,h,y,v,g,E,b,w,R,O,_,x,S=e.settings,T=e.onUpdateSettings;return React.createElement(React.Fragment,null,React.createElement(yo,null,React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:.66}},React.createElement("label",null,He.COMMON.SPACING,":"),React.createElement(Re.A,{id:"spacing",name:"spacing",value:null!==(t=null==S?void 0:S.spacing)&&void 0!==t?t:"15px",onBlur:T,onEnter:T})),React.createElement("div",{className:"mwai-builder-col",style:{flex:.66}},React.createElement("label",null,He.COMMON.BORDER_RADIUS,":"),React.createElement(Re.A,{id:"borderRadius",name:"borderRadius",value:null!==(n=null==S?void 0:S.borderRadius)&&void 0!==n?n:"10px",onBlur:T,onEnter:T})),React.createElement("div",{className:"mwai-builder-col",style:{flex:.66}},React.createElement("label",null,He.COMMON.FONT_SIZE,":"),React.createElement(Re.A,{id:"fontSize",name:"fontSize",value:null!==(r=null==S?void 0:S.fontSize)&&void 0!==r?r:"15px",onBlur:T,onEnter:T})),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.FONT_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"fontColor",name:"fontColor",value:null!==(a=null==S?void 0:S.fontColor)&&void 0!==a?a:"#FFFFFF",onBlur:T,onEnter:T}),React.createElement(ai,{id:"fontColor",name:"fontColor",value:null!==(o=null==S?void 0:S.fontColor)&&void 0!==o?o:"#FFFFFF",onChange:T})))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BACK_PRIMARY_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundPrimaryColor",name:"backgroundPrimaryColor",style:{flex:1},value:null!==(i=null==S?void 0:S.backgroundPrimaryColor)&&void 0!==i?i:"#fafafa",onBlur:T,onEnter:T}),React.createElement(ai,{id:"backgroundPrimaryColor",name:"backgroundPrimaryColor",value:null!==(l=null==S?void 0:S.backgroundPrimaryColor)&&void 0!==l?l:"#fafafa",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BACK_USER_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundUserColor",name:"backgroundUserColor",style:{flex:1},value:null!==(c=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==c?c:"#0084ff",onBlur:T,onEnter:T}),React.createElement(ai,{id:"backgroundUserColor",name:"backgroundUserColor",value:null!==(u=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==u?u:"#0084ff",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BACK_AI_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundAiColor",name:"backgroundAiColor",style:{flex:1},value:null!==(s=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==s?s:"#eee",onBlur:T,onEnter:T}),React.createElement(ai,{id:"backgroundAiColor",name:"backgroundAiColor",value:null!==(f=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==f?f:"#eee",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BACK_AI_SECONDARY_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundAiSecondaryColor",name:"backgroundAiSecondaryColor",style:{flex:1},value:null!==(m=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==m?m:"#ddd",onBlur:T,onEnter:T}),React.createElement(ai,{id:"backgroundAiSecondaryColor",name:"backgroundAiSecondaryColor",value:null!==(d=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==d?d:"#ddd",onChange:T,onEnter:T})))),React.createElement(_e.g,null),React.createElement(Se.Y,{title:He.COMMON.POPUP,isCollapsed:!1}),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:.75}},React.createElement("label",null,He.COMMON.WIDTH,":"),React.createElement(Re.A,{id:"width",name:"width",value:null!==(p=null==S?void 0:S.width)&&void 0!==p?p:"460px",onBlur:T,onEnter:T})),React.createElement("div",{className:"mwai-builder-col",style:{flex:.75}},React.createElement("label",null,He.COMMON.MAX_HEIGHT,":"),React.createElement(Re.A,{id:"maxHeight",name:"maxHeight",value:null!==(h=null==S?void 0:S.maxHeight)&&void 0!==h?h:"40vh",onBlur:T,onEnter:T})),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.AVATAR_MESSAGE_BACKGROUND_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"iconTextBackgroundColor",name:"iconTextBackgroundColor",value:null!==(y=null==S?void 0:S.iconTextBackgroundColor)&&void 0!==y?y:"#0084ff",onBlur:T,onEnter:T}),React.createElement(ai,{id:"iconTextBackgroundColor",name:"iconTextBackgroundColor",value:null!==(v=null==S?void 0:S.iconTextBackgroundColor)&&void 0!==v?v:"#0084ff",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.AVATAR_MESSAGE_FONT_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"iconTextColor",name:"iconTextColor",value:null!==(g=null==S?void 0:S.iconTextColor)&&void 0!==g?g:"#FFFFFF",onBlur:T,onEnter:T}),React.createElement(ai,{id:"iconTextColor",name:"iconTextColor",value:null!==(E=null==S?void 0:S.iconTextColor)&&void 0!==E?E:"#FFFFFF",onChange:T,onEnter:T})))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BUBBLE_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"bubbleColor",name:"bubbleColor",style:{flex:1},value:null!==(b=null==S?void 0:S.bubbleColor)&&void 0!==b?b:"#0084ff",onBlur:T,onEnter:T}),React.createElement(ai,{id:"bubbleColor",name:"bubbleColor",value:null!==(w=null==S?void 0:S.bubbleColor)&&void 0!==w?w:"#0084ff",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.HEADER_BACKGROUND_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundHeaderColor",name:"backgroundHeaderColor",style:{flex:1},value:null!==(R=null==S?void 0:S.backgroundHeaderColor)&&void 0!==R?R:"#0084ff",onBlur:T,onEnter:T}),React.createElement(ai,{id:"backgroundHeaderColor",name:"backgroundHeaderColor",value:null!==(O=null==S?void 0:S.backgroundHeaderColor)&&void 0!==O?O:"#0084ff",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.HEADER_BUTTONS_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"headerButtonsColor",name:"headerButtonsColor",style:{flex:1},value:null!==(_=null==S?void 0:S.headerButtonsColor)&&void 0!==_?_:"#FFFFFF",onBlur:T,onEnter:T}),React.createElement(ai,{id:"headerButtonsColor",name:"headerButtonsColor",value:null!==(x=null==S?void 0:S.headerButtonsColor)&&void 0!==x?x:"#FFFFFF",onChange:T,onEnter:T}))))))},di=function(e){var t,n,r,a,o,i,l,c,u,s,f,m,d,p,h,y,v,g,E,b,w,R,O,_,x,S=e.settings,T=e.onUpdateSettings;return React.createElement(React.Fragment,null,React.createElement(Ne.X,{variant:"danger"},"This theme is ",React.createElement("b",null,"still in development"),". The related settings will be available soon."),React.createElement(yo,null,React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:.66}},React.createElement("label",null,He.COMMON.SPACING,":"),React.createElement(Re.A,{id:"spacing",name:"spacing",value:null!==(t=null==S?void 0:S.spacing)&&void 0!==t?t:"15px",onBlur:T,onEnter:T})),React.createElement("div",{className:"mwai-builder-col",style:{flex:.66}},React.createElement("label",null,He.COMMON.BORDER_RADIUS,":"),React.createElement(Re.A,{id:"borderRadius",name:"borderRadius",value:null!==(n=null==S?void 0:S.borderRadius)&&void 0!==n?n:"10px",onBlur:T,onEnter:T})),React.createElement("div",{className:"mwai-builder-col",style:{flex:.66}},React.createElement("label",null,He.COMMON.FONT_SIZE,":"),React.createElement(Re.A,{id:"fontSize",name:"fontSize",value:null!==(r=null==S?void 0:S.fontSize)&&void 0!==r?r:"13px",onBlur:T,onEnter:T})),React.createElement("div",{className:"mwai-builder-col",style:{flex:1}},React.createElement("label",null,He.COMMON.FONT_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"fontColor",name:"fontColor",value:null!==(a=null==S?void 0:S.fontColor)&&void 0!==a?a:"#FFFFFF",onBlur:T,onEnter:T}),React.createElement(ai,{id:"fontColor",name:"fontColor",value:null!==(o=null==S?void 0:S.fontColor)&&void 0!==o?o:"#FFFFFF",onChange:T})))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BACK_PRIMARY_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundPrimaryColor",name:"backgroundPrimaryColor",style:{flex:1},value:null!==(i=null==S?void 0:S.backgroundPrimaryColor)&&void 0!==i?i:"#fafafa",onBlur:T,onEnter:T}),React.createElement(ai,{id:"backgroundPrimaryColor",name:"backgroundPrimaryColor",value:null!==(l=null==S?void 0:S.backgroundPrimaryColor)&&void 0!==l?l:"#fafafa",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BACK_USER_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundUserColor",name:"backgroundUserColor",style:{flex:1},value:null!==(c=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==c?c:"#434cc5",onBlur:T,onEnter:T}),React.createElement(ai,{id:"backgroundUserColor",name:"backgroundUserColor",value:null!==(u=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==u?u:"#434cc5",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BACK_AI_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundAiColor",name:"backgroundAiColor",style:{flex:1},value:null!==(s=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==s?s:"#F1F3F7",onBlur:T,onEnter:T}),React.createElement(ai,{id:"backgroundAiColor",name:"backgroundAiColor",value:null!==(f=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==f?f:"#eee",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BACK_AI_SECONDARY_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundAiSecondaryColor",name:"backgroundAiSecondaryColor",style:{flex:1},value:null!==(m=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==m?m:"#ddd",onBlur:T,onEnter:T}),React.createElement(ai,{id:"backgroundAiSecondaryColor",name:"backgroundAiSecondaryColor",value:null!==(d=null==S?void 0:S.backgroundSecondaryColor)&&void 0!==d?d:"#ddd",onChange:T,onEnter:T})))),React.createElement(_e.g,null),React.createElement(Se.Y,{title:He.COMMON.POPUP,isCollapsed:!1}),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:.75}},React.createElement("label",null,He.COMMON.WIDTH,":"),React.createElement(Re.A,{id:"width",name:"width",value:null!==(p=null==S?void 0:S.width)&&void 0!==p?p:"360px",onBlur:T,onEnter:T})),React.createElement("div",{className:"mwai-builder-col",style:{flex:.75}},React.createElement("label",null,He.COMMON.MAX_HEIGHT,":"),React.createElement(Re.A,{id:"maxHeight",name:"maxHeight",value:null!==(h=null==S?void 0:S.maxHeight)&&void 0!==h?h:"40vh",onBlur:T,onEnter:T})),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.AVATAR_MESSAGE_BACKGROUND_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"iconTextBackgroundColor",name:"iconTextBackgroundColor",value:null!==(y=null==S?void 0:S.iconTextBackgroundColor)&&void 0!==y?y:"#343541",onBlur:T,onEnter:T}),React.createElement(ai,{id:"iconTextBackgroundColor",name:"iconTextBackgroundColor",value:null!==(v=null==S?void 0:S.iconTextBackgroundColor)&&void 0!==v?v:"#343541",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.AVATAR_MESSAGE_FONT_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"iconTextColor",name:"iconTextColor",value:null!==(g=null==S?void 0:S.iconTextColor)&&void 0!==g?g:"#FFFFFF",onBlur:T,onEnter:T}),React.createElement(ai,{id:"iconTextColor",name:"iconTextColor",value:null!==(E=null==S?void 0:S.iconTextColor)&&void 0!==E?E:"#FFFFFF",onChange:T,onEnter:T})))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.BUBBLE_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"bubbleColor",name:"bubbleColor",style:{flex:1},value:null!==(b=null==S?void 0:S.bubbleColor)&&void 0!==b?b:"#434cc5",onBlur:T,onEnter:T}),React.createElement(ai,{id:"bubbleColor",name:"bubbleColor",value:null!==(w=null==S?void 0:S.bubbleColor)&&void 0!==w?w:"#434cc5",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.HEADER_BACKGROUND_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"backgroundHeaderColor",name:"backgroundHeaderColor",style:{flex:1},value:null!==(R=null==S?void 0:S.backgroundHeaderColor)&&void 0!==R?R:"#434cc5",onBlur:T,onEnter:T}),React.createElement(ai,{id:"backgroundHeaderColor",name:"backgroundHeaderColor",value:null!==(O=null==S?void 0:S.backgroundHeaderColor)&&void 0!==O?O:"#434cc5",onChange:T,onEnter:T}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.HEADER_BUTTONS_COLOR,":"),React.createElement("div",{style:{display:"flex"}},React.createElement(Re.A,{id:"headerButtonsColor",name:"headerButtonsColor",style:{flex:1},value:null!==(_=null==S?void 0:S.headerButtonsColor)&&void 0!==_?_:"#FFFFFF",onBlur:T,onEnter:T}),React.createElement(ai,{id:"headerButtonsColor",name:"headerButtonsColor",value:null!==(x=null==S?void 0:S.headerButtonsColor)&&void 0!==x?x:"#FFFFFF",onChange:T,onEnter:T}))))))};function pi(e){return pi="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},pi(e)}function hi(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 yi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?hi(Object(n),!0).forEach((function(t){vi(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vi(e,t,n){var r;return r=function(e,t){if("object"!=pi(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=pi(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==pi(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const gi=function(e){var t,n,r,a=e.theme,o=e.updateTheme,i=e.resetTheme,l=e.deleteTheme,c=function(e,t){var n=yi(yi({},a.settings),{},vi({},t,e));o(n,"settings")};return React.createElement(React.Fragment,null,"internal"===a.type&&"chatgpt"===a.themeId&&React.createElement(oi,{settings:null!==(t=a.settings)&&void 0!==t?t:[],onUpdateSettings:c}),"internal"===a.type&&"messages"===a.themeId&&React.createElement(mi,{settings:null!==(n=a.settings)&&void 0!==n?n:[],onUpdateSettings:c}),"internal"===a.type&&"timeless"===a.themeId&&React.createElement(di,{settings:null!==(r=a.settings)&&void 0!==r?r:[],onUpdateSettings:c}),"internal"!==a.type&&React.createElement(fi,{theme:a,onUpdateTheme:o}),React.createElement(_e.g,null),React.createElement(Se.Y,{title:He.COMMON.ACTIONS}),React.createElement("div",{style:{display:"flex",marginTop:10}},React.createElement(w.M,{className:"secondary",onClick:function(){i()}},He.COMMON.RESET),React.createElement("div",{style:{flex:"auto"}}),React.createElement(w.M,{className:"danger",disabled:"internal"===a.type,onClick:l},He.COMMON.DELETE)))};function Ei(e){return Ei="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},Ei(e)}function bi(){bi=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Ei(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Ei(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 wi(e){return function(e){if(Array.isArray(e))return Ni(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ti(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 Ri(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 Oi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ri(Object(n),!0).forEach((function(t){_i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ri(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _i(e,t,n){var r;return r=function(e,t){if("object"!=Ei(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ei(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==Ei(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xi(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Si(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){xi(o,r,a,i,l,"next",e)}function l(e){xi(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Ti(e,t){if(e){if("string"==typeof e)return Ni(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)?Ni(e,t):void 0}}function Ni(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 Ci=wp.element.useState;const Ii=function(e){var t,n,r=(0,u.jE)(),a=e.onSwitchTheme,o=void 0===a?function(){}:a,i=(t=Ci(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,n)||Ti(t,n)||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.")}()),l=i[0],c=i[1],s=(0,f.I)({queryKey:["themes"],queryFn:mn,initialData:P}).data,m=e.currentTheme,d=function(){var e=Si(bi().mark((function e(t,n){var a,o,i;return bi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,c(!0),a=Oi(Oi({},m),{},_i({},n,t)),o=wi(s),i=o.findIndex((function(e){return e.themeId===m.themeId})),o[i]=a,e.next=8,dn(o);case 8:o=e.sent,r.setQueryData(["themes"],o),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),console.error(e.t0);case 15:c(!1);case 16:case"end":return e.stop()}}),e,null,[[0,12]])})));return function(t,n){return e.apply(this,arguments)}}(),p=function(){var e=Si(bi().mark((function e(){var t;return bi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c(!0),e.prev=1,e.next=4,dn([].concat(wi(s),[{type:"css",name:"New Theme",themeId:"theme-"+Rt(),settings:[],style:""}]));case 4:t=e.sent,r.setQueryData(["themes"],t),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),console.error(e.t0);case 11:c(!1);case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(){return e.apply(this,arguments)}}(),h=function(){var e=Si(bi().mark((function e(){var t,n;return bi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c(!0),t=wi(s.filter((function(e){return e.themeId!==m.themeId}))),n=t[0],o(n.themeId),e.next=6,dn(t);case 6:return e.next=8,r.setQueryData(["themes"],t);case 8:c(!1);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),y=function(){var e=Si(bi().mark((function e(){var t,n;return bi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c(!0),t=wi(s),n=t.findIndex((function(e){return e.themeId===m.themeId})),t[n]={type:t[n].type,name:t[n].name,themeId:t[n].themeId,settings:[],style:""},e.next=6,dn(t);case 6:return e.next=8,r.setQueryData(["themes"],t);case 8:c(!1);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return React.createElement(React.Fragment,null,React.createElement(b._,{inversed:!0,onChange:function(e,t){var n=s.find((function(e){return e.themeId===t.key}));n&&o(n.themeId)},currentTab:null==m?void 0:m.themeId,action:React.createElement(React.Fragment,null,React.createElement(w.M,{rounded:!0,className:"secondary",icon:"plus",onClick:p}))},null==s?void 0:s.map((function(e){return React.createElement(b.V,{key:e.themeId,title:e.name,busy:l},React.createElement(gi,{theme:e,updateTheme:d,resetTheme:y,deleteTheme:h}))}))))};var Ai=n(1469),ki=n(6966),Li=n(2902);function Mi(e){return Mi="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},Mi(e)}function Pi(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 ji(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pi(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=Mi(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Mi(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==Mi(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Fi=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:ji(ji({},t),{},{animationDelay:e})})}))))},Di=n(1137),Gi=["enabled","content","children","className"];function Ui(){return Ui=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},Ui.apply(this,arguments)}function Bi(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Hi(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)?Hi(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 Hi(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 Yi=wp.element,zi=Yi.useState,Wi=Yi.useEffect,Vi=Yi.useRef,Ki=Yi.useCallback;const qi=function(e){var t=e.enabled,n=e.content,r=e.children,a=e.className,o=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,Gi),i=(0,ki.gR)(),l=Bi(zi("idle"),2),c=l[0],u=l[1],s=Bi(zi(!0),2),f=s[0],m=s[1],d=Vi(null),p=Vi(!1),h=Ki((function(){p.current||(p.current=!0,d.current=setTimeout((function(){m(!1)}),500))}),[]),y=Ki((function(){d.current&&clearTimeout(d.current),m(!0),p.current=!1}),[]);Wi((function(){return function(){d.current&&clearTimeout(d.current)}}),[]);var v="success"===c?'<path d="M10.7673 18C10.3106 18 9.86749 17.8046 9.54432 17.4555L5.50694 13.1222C4.83102 12.3968 4.83102 11.2208 5.50694 10.4954C6.18287 9.76997 7.27871 9.76997 7.95505 10.4954L10.6794 13.4196L16.9621 5.63976C17.5874 4.86495 18.6832 4.78289 19.4031 5.45388C20.125 6.12487 20.2036 7.29638 19.5759 8.07391L12.0778 17.3589C11.7639 17.7475 11.3119 17.9801 10.8319 18C10.8087 18 10.788 18 10.7673 18Z" />':"error"===c?'<path d="M17.7623 17.7626C17.0831 18.4418 15.9549 18.416 15.244 17.705L5.79906 8.26012C5.08811 7.54917 5.0623 6.42098 5.74145 5.74183C6.4206 5.06267 7.54879 5.08849 8.25975 5.79944L17.7047 15.2443C18.4156 15.9553 18.4414 17.0835 17.7623 17.7626Z" /><path d="M17.5508 8.52848L8.52842 17.5509C7.84927 18.23 6.72108 18.2042 6.01012 17.4933C5.29917 16.7823 5.27336 15.6541 5.95251 14.975L14.9749 5.95257C15.6541 5.27342 16.7823 5.29923 17.4932 6.01019C18.2042 6.72114 18.23 7.84933 17.5508 8.52848Z" />':'<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 React.createElement("div",Ui({},o,{onMouseLeave:y,onMouseEnter:h,onMouseOver:h}),React.createElement("span",{className:a},r),React.createElement("div",{className:i("mwai-reply-actions",{"mwai-hidden":f})},t&&React.createElement("div",{className:"mwai-copy-button",onClick:function(){try{navigator.clipboard.writeText(n),u("success")}catch(e){u("error"),console.warn("Not allowed to copy to clipboard. Make sure your website uses HTTPS.",{content:n})}finally{setTimeout((function(){u("idle")}),2e3)}}},React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",dangerouslySetInnerHTML:{__html:v}}))))};function Xi(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 $i=wp.element.useMemo;const Qi=function(e){var t=e.role,n=void 0===t?"user":t,r=(0,Ai.o)().state,a=r.pluginUrl,o=r.iconUrl,i=r.userData,l=r.userName,c=r.aiName,u=r.guestName,s=r.userAvatar,f=r.aiAvatar,m=r.guestAvatar,d=r.userAvatarUrl,p=r.aiAvatarUrl,h=r.guestAvatarUrl,y=$i((function(){var e="assistant"===n,t=!i&&!e,r=function(e){return React.createElement("div",{className:"mwai-name-text"},e)},y=function(e,t,n,r){var o,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!e)return null;if((0,Lo.Ve)(t))return o=t,React.createElement("div",{className:"mwai-avatar mwai-emoji",style:{fontSize:"32px",lineHeight:"32px"}},o);var l=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,ki.mv)(e)?e:e&&!(0,Lo.Ve)(e)?t?e:"".concat(a,"/images/").concat(e):(t||(0,Lo.Ve)(e)||console.warn("Invalid URL for avatar:",e),null)}(t,i)||n;return l?function(e,t){return React.createElement("div",{className:"mwai-avatar"},React.createElement("img",{width:"32",height:"32",src:e,alt:t}))}(l,r):null};if(e){var v=y(f,p,o,"AI Avatar");return v?(null===p&&o&&console.warn("Using iconUrl as a temporary fallback for AI avatar. Please set aiAvatarUrl."),v):r(c)}return t?t?y(m,h,null,"Guest Avatar")||r(u||"Guest"):void 0:y(s,d,null==i?void 0:i.AVATAR_URL,"User Avatar",!0)||r(function(e,t,n){return n&&0!==Object.keys(n).length?Object.entries(n).reduce((function(e,t){var n,r,a=(r=2,function(e){if(Array.isArray(e))return e}(n=t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(n,r)||function(e,t){if(e){if("string"==typeof e)return Xi(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)?Xi(e,t):void 0}}(n,r)||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.")}()),o=a[0],i=a[1],l="{".concat(o,"}");return e.includes(l)?e.replace(l,i):e}),e):t||e||"Guest"}(l,u,i))}),[n,c,l,u,i,o,f,s,m,p,d,h,a]);return React.createElement("span",{className:"mwai-name"},y)};function Ji(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Zi(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)?Zi(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 Zi(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 el=wp.element,tl=el.useState,nl=el.useMemo,rl=el.useEffect,al=el.useRef,ol=function(e){var t=e.href,n=e.children;if(!t)return React.createElement("span",null,n);var r=window.location.hostname,a="_self";try{a=r===new URL(t,window.location.href).hostname?"_self":"_blank"}catch(e){console.error("Invalid URL:",e),a="_blank"}if("Uploaded File"===String(n)){var o=t.split("/").pop();return React.createElement("a",{href:t,target:a,rel:"noopener noreferrer",className:"mwai-filename"},React.createElement("span",null,"✓ ",o))}return React.createElement("a",{href:t,target:a,rel:"noopener noreferrer"},n)},il=function(e){var t,n=e.message,r=e.onRendered,a=void 0===r?function(){}:r,o=(0,Ai.o)().state.copyButton,i=Ji(tl(n.isQuerying||n.isStreaming),1)[0],l=n.isQuerying,c=n.isStreaming,u=null!==(t=n.content)&&void 0!==t?t:"";(u.match(/```/g)||[]).length%2!=0?u+="\n```":n.isStreaming&&(u+="<BlinkingCursor />"),rl((function(){i&&(!i||l||c)||a()}),[i,l,c]);var s=nl((function(){return{overrides:{BlinkingCursor:{component:Lo.rn},a:{component:ol},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"}}}}}),[]),f=nl((function(){var e="";try{e=(0,wa.cx)(u,s)}catch(t){console.error("Crash in markdown-to-jsx! Reverting to plain text.",{e:t,content:u}),e=u}return e}),[u,s]);return l||c&&!u?React.createElement(Fi,null):React.createElement(React.Fragment,null,React.createElement(Qi,{role:n.role}),React.createElement(qi,{content:n.content,enabled:o,className:"mwai-text"},f))},ll=function(e){var t=e.message,n=e.onRendered,r=void 0===n?function(){}:n,a=Ji(tl(null==t?void 0:t.images),2),o=a[0],i=a[1];return rl((function(){r()})),t.isQuerying?React.createElement(Fi,null):React.createElement(React.Fragment,null,React.createElement(Qi,{role:t.role}),React.createElement("span",{className:"mwai-text"},React.createElement("div",{className:"mwai-gallery"},null==o?void 0:o.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){i((function(t){return t.map((function(t,n){return n===e?"https://placehold.co/600x200?text=Expired+Image":t}))}))}(t)}}))})))))},cl=function(e){var t=e.message,n=e.conversationRef,r=e.onRendered,a=void 0===r?function(){}:r,o=al(null),i=Ji(tl(t.isQuerying),1)[0],l=Ji(tl(!t.isQuerying),2),c=l[0],u=l[1],s=t.content;rl((function(){console.warn("Do not use the Typewriter Effect. Use Streaming instead.")}),[]),(0,ki.$$)(200,(function(){null!=n&&n.current}),!c),rl((function(){if(i){if(o.current){var e={strings:[s],typeSpeed:(0,Di.W5)("typewriter.speed",15),showCursor:!1,onComplete:function(e){e.cursor&&e.cursor.remove(),a(),u((function(){return!0}))}},t=new Li.A(o.current,e);return function(){t.destroy()}}}else a()}),[t,t.isQuerying]);var f=nl((function(){var e="";try{e=(0,wa.cx)(s)}catch(t){console.error("Crash in markdown-to-jsx! Reverting to plain text.",{e:t,content:s}),e=s}return e}),[s]);return React.createElement(React.Fragment,null,t.isQuerying&&React.createElement(Fi,null),!t.isQuerying&&i&&React.createElement(React.Fragment,null,React.createElement(Qi,{role:t.role}),React.createElement("span",{className:"mwai-text",ref:o})),!t.isQuerying&&!i&&React.createElement(React.Fragment,null,React.createElement(Qi,{role:t.role}),React.createElement("span",{className:"mwai-text"},f)))};const ul=function(e){var t,n=e.message,r=e.conversationRef,a=(0,Ai.o)().state.typewriter,o=(0,ki.gR)(),i=al(),l=o("mwai-reply",{"mwai-ai":"assistant"===n.role,"mwai-user":"user"===n.role,"mwai-system":"system"===n.role}),c=(null==n||null===(t=n.images)||void 0===t?void 0:t.length)>0,u=function(){i.current&&(n.isQuerying||i.current.classList.contains("mwai-rendered")||"undefined"!=typeof hljs&&(i.current.classList.add("mwai-rendered"),i.current.querySelectorAll("pre code").forEach((function(e){hljs.highlightElement(e)}))))};return nl((function(){return"user"===n.role?React.createElement("div",{ref:i,className:l},React.createElement(il,{message:n})):"assistant"===n.role?c?React.createElement("div",{ref:i,className:l},React.createElement(ll,{message:n,conversationRef:r,onRendered:u})):a&&!n.isStreaming?(console.warn("The Typewriter effect is deprecated. Use Streaming instead."),React.createElement("div",{ref:i,className:l},React.createElement(cl,{message:n,conversationRef:r,onRendered:u}))):React.createElement("div",{ref:i,className:l},React.createElement(il,{message:n,conversationRef:r,onRendered:u})):"system"===n.role?React.createElement("div",{ref:i,className:l},React.createElement(il,{message:n,conversationRef:r,onRendered:u})):React.createElement("div",null,React.createElement("i",null,"Unhandled role."))}),[n,r,c,a])};var sl=n(2192);function fl(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 ml=wp.element,dl=ml.useState,pl=ml.useMemo,hl=ml.useRef;const yl=function(){var e,t,n=(0,ki.gR)(),r=(0,Ai.o)(),a=r.state,o=r.actions,i=a.uploadedFile,l=a.busy,c=a.imageUpload,u=a.fileSearch,s=a.draggingType,f=o.onUploadFile,m=(e=dl(!1),t=2,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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return fl(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)?fl(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.")}()),d=m[0],p=m[1],h=hl(),y=null==i?void 0:i.uploadedId,v=c||u,g=i,E=pl((function(){return null!=g&&g.localFile?g.localFile.type.startsWith("image/")?"image":"document":s}),[g,s]),b=pl((function(){var e="idle";null!=g&&g.uploadProgress?e="up":s?e="add":d&&y?e="del":y?e="ok":d&&!y&&(e="add");var t=E?E.toLowerCase():"idle";return"mwai-file-upload-icon mwai-".concat(t,"-").concat(e)}),[E,g,s,d,y]),w=pl((function(){return null!=g&&g.uploadProgress?g.uploadProgress>99?99:Math.round(g.uploadProgress):""}),[g]);return v?React.createElement("div",{disabled:l,onClick:function(){null!=i&&i.localFile?f(null):l||h.current.click()},onMouseEnter:function(){return p(!0)},onMouseLeave:function(){return p(!1)},className:n("mwai-file-upload",{"mwai-enabled":null==i?void 0:i.uploadedId,"mwai-busy":(null==i?void 0:i.localFile)&&!(null!=i&&i.uploadedId)}),style:{cursor:l?"default":"pointer"}},React.createElement("div",{className:b},React.createElement("span",{className:"mwai-file-upload-progress"},w)),React.createElement("input",{type:"file",ref:h,onChange:function(e){var t=e.target.files[0];t&&f(t)},style:{display:"none"}})):null};function vl(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 gl=wp.element,El=gl.useRef,bl=gl.useState,wl=gl.useEffect,Rl=gl.useImperativeHandle;const Ol=function(){var e,t,n=(0,ki.gR)(),r=(0,Ai.o)(),a=r.state,o=r.actions,i=a.inputText,l=a.textInputMaxLength,c=a.textInputPlaceholder,u=a.error,s=a.speechRecognitionAvailable,f=a.isMobile,m=a.conversationRef,d=a.open,p=a.uploadIconPosition,h=a.locked,y=a.isListening,v=a.busy,g=a.speechRecognition,E=a.chatbotInputRef,b=o.onSubmitAction,w=o.setIsListening,R=o.resetError,O=o.setInputText,_=(e=bl(!1),t=2,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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return vl(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)?vl(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.")}()),x=_[0],S=_[1],T=El();Rl(E,(function(){return{focusInput:function(){var e;null===(e=T.current)||void 0===e||e.focus()},currentElement:function(){return T.current}}})),wl((function(){!f&&d&&T.current.focus(),m.current&&(m.current.scrollTop=m.current.scrollHeight)}),[d,f,m]);var N=n("mwai-input-text",{});return React.createElement("div",{ref:E,className:N},"mwai-input"===p&&React.createElement(yl,null),React.createElement(sl.A,{ref:T,disabled:v||h,placeholder:c,value:i,maxLength:l,onCompositionStart:function(){return S(!0)},onCompositionEnd:function(){return S(!1)},onKeyDown:function(e){x||"Enter"!==e.code||e.shiftKey||(e.preventDefault(),b())},onChange:function(e){return t=e.target.value,y&&w(!1),u&&R(),void O(t);var t}}),g&&React.createElement(ki.tm,{active:y,disabled:!s||v,className:"mwai-microphone",onClick:function(){return w(!y)}}))};var _l=wp.element,xl=_l.useMemo,Sl=_l.useCallback;const Tl=function(){var e=(0,Ai.o)(),t=e.state,n=e.actions,r=n.onClear,a=n.onSubmitAction,o=n.setIsListening,i=t.textClear,l=t.textSend,c=t.uploadedFile,u=t.inputText,s=t.messages,f=t.isListening,m=t.timeElapsed,d=t.busy,p=t.submitButtonConf,h=t.locked,y=!(null==c||!c.uploadProgress),v=!(null!=c&&c.uploadedId)&&u.length<1&&(null==s?void 0:s.length)>1,g=xl((function(){return d?m?React.createElement("div",{className:"mwai-timer"},m):null:null!=p&&p.imageSend&&null!=p&&p.imageClear?React.createElement("img",{src:v?p.imageClear:p.imageSend,alt:v?i:l}):React.createElement("span",null,v?i:l)}),[d,m,v,i,l,p]),E=xl((function(){return"mwai-input-submit ".concat(d?"mwai-busy":"")}),[d]),b=Sl((function(){f&&o(!1),v?r():a()}),[v,f,r,a,o]),w=Sl((function(){d||b()}),[d,b]);return React.createElement("button",{className:E,disabled:d||y||h,onClick:w},g)};var Nl=wp.element.useMemo;const Cl=function(){var e=(0,Ai.o)(),t=e.state,n=e.actions,r=t.theme,a=t.isWindow,o=t.fullscreen,i=t.aiName,l=t.pluginUrl,c=t.open,u=t.iconUrl,s=t.aiAvatarUrl,f=t.windowed,m=n.setOpen,d=n.setWindowed,p=Nl((function(){if(!a)return null;var e="timeless"===(null==r?void 0:r.themeId),t=e?function(e,t,n,r){var a;if((0,Lo.Ve)(r||n))return a=r||n,React.createElement("div",{className:"mwai-avatar mwai-emoji",style:{fontSize:"48px",lineHeight:"48px"}},a);var o,i,l=(o=r,((0,ki.mv)(o)?o:o?"".concat(t,"/images/").concat(o):null)||n||"".concat(t,"/images/chat-openai.svg"));return l?(i=l,"AI Engine",React.createElement("div",{className:"mwai-avatar"},React.createElement("img",{alt:"AI Engine",src:i}))):React.createElement("div",{className:"mwai-name-text"},e)}(i,l,u,s):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,i)),React.createElement("div",{style:{flex:"auto"}})),React.createElement("div",{className:"mwai-buttons"},o&&React.createElement("div",{className:"mwai-resize-button",onClick:function(){return d(!f)}}),React.createElement("div",{className:"mwai-close-button",onClick:function(){return m(!c)}})))}),[a,null==r?void 0:r.themeId,i,l,u,s,o,d,f,m,c]);return React.createElement("div",{className:"mwai-header"},p)};var Il=wp.element,Al=Il.useMemo,kl=Il.useEffect;const Ll=function(){var e=(0,Ai.o)(),t=e.state,n=e.actions,r=t.isWindow,a=t.iconText,o=t.showIconMessage,i=t.iconAlt,l=t.iconUrl,c=t.open,u=n.setShowIconMessage,s=n.setOpen;kl((function(){c&&o&&u(!1)}),[c,u,o]);var f=Al((function(){return r?React.createElement("div",{className:"mwai-trigger mwai-open-button"},React.createElement(ki.bE,{className:"mwai-icon-text-container",if:a&&o},React.createElement("div",{className:"mwai-icon-text-close",onClick:function(){return u(!1)}},"✕"),React.createElement("div",{className:"mwai-icon-text",onClick:function(){return s(!0)}},a)),React.createElement("div",{className:"mwai-icon-container",onClick:function(){return s(!0)}},(0,Lo.Ve)(l)?React.createElement("div",{className:"mwai-icon mwai-emoji",style:{fontSize:"48px",lineHeight:"64px",width:"64px",height:"64px",display:"flex",justifyContent:"center",alignItems:"center"}},l):React.createElement("img",{className:"mwai-icon",width:"64",height:"64",alt:i,src:l}))):null}),[r,a,o,i,l,u,s]);return React.createElement(React.Fragment,null,f)};function Ml(e){return Ml="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},Ml(e)}function Pl(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 jl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pl(Object(n),!0).forEach((function(t){Fl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Fl(e,t,n){var r;return r=function(e,t){if("object"!=Ml(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ml(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==Ml(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dl(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 Gl=wp.element,Ul=Gl.useState,Bl=Gl.useMemo,Hl=Gl.useLayoutEffect,Yl=Gl.useCallback,zl=Gl.useEffect,Wl=Gl.useRef,Vl={overrides:{a:{props:{target:"_blank"}}}};const Kl=function(e){var t,n,r=(0,ki.gR)(),a=e.style,o=(t=Ul(!0),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Dl(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)?Dl(e,t):void 0}}(t,n)||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.")}()),i=o[0],l=o[1],c=(0,Ai.o)(),u=c.state,s=c.actions,f=u.theme,m=u.botId,d=u.customId,p=u.messages,h=u.textCompliance,y=u.isWindow,v=u.fullscreen,g=u.iconPosition,E=u.iconBubble,b=u.shortcuts,w=u.blocks,R=u.imageUpload,O=u.fileSearch,_=u.draggingType,x=u.isBlocked,S=u.virtualKeyboardFix,T=u.windowed,N=u.cssVariables,C=u.error,I=u.conversationRef,A=u.open,k=u.busy,L=u.uploadIconPosition,M=s.resetError,P=s.onSubmit,j=s.setIsBlocked,F=s.setDraggingType,D=s.onUploadFile,G=Bl((function(){return"css"===(null==f?void 0:f.type)?null==f?void 0:f.style:null}),[f]),U=R||O,B=U||h,H=Wl(null),Y=(0,ki.kW)(),z=Y.viewportHeight,W=Y.isIOS,V=Y.isAndroid;zl((function(){if(S&&(W||V)&&y){var e=document.querySelector(".mwai-window");e&&(A?(e.style.height="".concat(z,"px"),W&&function(){if("INPUT"===document.activeElement.tagName||"TEXTAREA"===document.activeElement.tagName){window.scrollTo({top:0});var e=setInterval((function(){window.scrollTo({top:0})}),100);setTimeout((function(){clearInterval(e)}),1e3)}}()):e.style.height="")}}),[v,V,W,y,T,A,z,S]);var K=r("mwai-chatbot",Fl(Fl(Fl(Fl(Fl(Fl(Fl(Fl({},"mwai-".concat(null==f?void 0:f.themeId,"-theme"),!0),"mwai-window",y),"mwai-bubble",E),"mwai-open",A),"mwai-fullscreen",!T||!y&&v),"mwai-bottom-left","bottom-left"===g),"mwai-top-right","top-right"===g),"mwai-top-left","top-left"===g));Hl((function(){i&&I.current&&(I.current.scrollTop=I.current.scrollHeight)}),[p,i,I,k]);var q=Wl(new Set);zl((function(){w&&w.length>0&&w.forEach((function(e){var t=e.type,n=e.data;"content"===t&&n.script&&function(e){var t=function(e){var t,n=0;if(0===e.length)return n;for(t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return n}(e);if(!q.current.has(t)){var n=document.createElement("script");n.type="text/javascript",n.textContent=e,document.body.appendChild(n),q.current.add(t)}}(n.script)}))}),[w]);var X=Bl((function(){return null==p?void 0:p.map((function(e){return React.createElement(ul,{key:e.id,message:e})}))}),[p]),$=Bl((function(){return b&&0!==b.length?React.createElement("div",{className:"mwai-shortcuts"},b.map((function(e,t){var n=e.type,a=e.data;if("message"!==n)return console.warn("This shortcut type is not supported: ".concat(n,".")),null;var o=a.label,i=a.message,l=a.variant,c=a.icon,u=r("mwai-shortcut",{"mwai-success":"success"===l,"mwai-danger":"danger"===l,"mwai-warning":"warning"===l,"mwai-info":"info"===l}),s=c&&c.startsWith("http"),f=c&&!s&&c.length>=1&&c.length<=2;return React.createElement("button",{className:u,key:t,onClick:function(){P(i)}},(s||f)&&React.createElement(React.Fragment,null,React.createElement("div",{className:"mwai-icon"},s&&React.createElement("img",{src:c,alt:o||"AI Shortcut"}),f&&React.createElement("span",{role:"img","aria-label":"AI Shortcut"},c)),React.createElement("div",{style:{flex:"auto"}})),React.createElement("div",{className:"mwai-label"},o||"N/A"))}))):null}),[r,P,b]),Q=Bl((function(){return w&&0!==w.length?React.createElement("div",{className:"mwai-blocks"},w.map((function(e,t){var n=e.type,a=e.data;if("content"!==n)return console.warn("Block type ".concat(n," is not supported.")),null;var o=a.html,i=a.variant,l=r("mwai-block",{"mwai-success":"success"===i,"mwai-danger":"danger"===i,"mwai-warning":"warning"===i,"mwai-info":"info"===i});return React.createElement("div",{className:l,key:t,dangerouslySetInnerHTML:{__html:o}})}))):null}),[r,w]),J=Yl((function(e,t){e.preventDefault(),e.stopPropagation();var n=e.dataTransfer.items[0];t?(H.current&&(clearTimeout(H.current),H.current=null),R&&function(e){return e.type.startsWith("image/")}(n)?(F("image"),j(!1)):O&&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)?(F("document"),j(!1)):(F(!1),j(!0))):H.current||(H.current=setTimeout((function(){F(!1),j(!1),H.current=null}),100))}),[R,O]),Z=Yl((function(e){if(e.preventDefault(),J(e,!1),!k){var t=e.dataTransfer.files[0];t&&("image"===_&&R||"document"===_&&O?D(t):(j(!0),setTimeout((function(){return j(!1)}),2e3)))}}),[k,_,R,O,D]),ee=r("mwai-input",{"mwai-dragging":_,"mwai-blocked":x});return React.createElement(ki.bE,{id:"mwai-chatbot-".concat(d||m),className:K,style:jl(jl({},N),a),if:!0,disableTransition:!y},G&&React.createElement("style",null,G),React.createElement(Ll,null),React.createElement(Cl,null),React.createElement("div",{className:"mwai-content"},React.createElement("div",{ref:I,className:"mwai-conversation",onScroll:function(){if(I.current){var e=I.current,t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;l(n-t<=r+1)}}},X,$),C&&React.createElement("div",{className:"mwai-error",onClick:function(){return M()}},React.createElement(wa.Ay,{options:Vl},C)),Q,React.createElement("div",{className:ee,onDrop:Z,onDragEnter:function(e){return J(e,!0)},onDragLeave:function(e){return J(e,!1)},onDragOver:function(e){return J(e,!0)}},React.createElement(Ol,null),React.createElement(Tl,null)),B&&React.createElement("div",{className:"mwai-footer"},U&&React.createElement("div",{className:"mwai-tools"},"mwai-tools"===L&&React.createElement(yl,null)),h&&React.createElement("div",{className:"mwai-compliance",dangerouslySetInnerHTML:{__html:h}}))))},ql=function(e){return React.createElement(Ai.G,e,React.createElement(Kl,e))};function Xl(e){return Xl="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},Xl(e)}function $l(){$l=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Xl(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Xl(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Ql(e){return function(e){if(Array.isArray(e))return oc(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ac(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 Jl(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 Zl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Jl(Object(n),!0).forEach((function(t){ec(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ec(e,t,n){var r;return r=function(e,t){if("object"!=Xl(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Xl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==Xl(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tc(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function nc(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){tc(o,r,a,i,l,"next",e)}function l(e){tc(o,r,a,i,l,"throw",e)}i(void 0)}))}}function rc(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||ac(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 ac(e,t){if(e){if("string"==typeof e)return oc(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)?oc(e,t):void 0}}function oc(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 ic=wp.element,lc=ic.useMemo,cc=ic.useState,uc=ic.useEffect,sc=function(e){e?localStorage.setItem("mwai-admin-chatbotKey",e):localStorage.removeItem("mwai-admin-chatbotKey")};const fc=function(e){var t,n,r=(0,u.jE)(),a=e.options,o=e.updateOption,i=e.busy,l=rc(cc("chatbots"),2),c=l[0],m=l[1],d=rc(cc(!1),2),p=d[0],h=d[1],y=rc(cc((function(){return localStorage.getItem("mwai-admin-chatbotKey")||"chatbot-key-0"})),2),v=y[0],g=y[1],R=null==a?void 0:a.chatbot_defaults,O=(0,s.z)().colors,_=(0,f.I)({queryKey:["chatbots"],queryFn:hn,initialData:F}).data,x=(0,f.I)({queryKey:["themes"],queryFn:mn,initialData:P}).data,T=null!==(t=null==a?void 0:a.botId)&&void 0!==t?t:"none",I=null!==(n=null==a?void 0:a.chatbot_select)&&void 0!==n?n:"tabs",A=i||p,L=rc(cc({}),2),D=L[0],G=L[1];uc((function(){if(_){var e={};if(_.forEach((function(t,n){e["chatbot-key-".concat(n)]=t.botId})),G(e),!v||!(v in e)){var t=Object.keys(e)[0];g(t),sc(t)}}}),[_,v]);var U=lc((function(){if(_)return _.find((function(e){return"default"===e.botId}))}),[_]),B=lc((function(){if(_&&v&&D[v]){var e=D[v];return _.find((function(t){return t.botId===e}))}return null}),[_,v,D]),H=lc((function(){return x&&B?x.find((function(e){return e.themeId===(null==B?void 0:B.themeId)})):x.find((function(e){return"chatgpt"===e.themeId}))}),[B,x]),Y=function(){var e=nc($l().mark((function e(t,n){var a,o,i;return $l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("botId"!==n||"default"!==t){e.next=3;break}return alert("You cannot name a chatbot 'default'. Please choose another name."),e.abrupt("return");case 3:if("botId"!==n||""!==t){e.next=6;break}return alert("Your chatbot must have an ID."),e.abrupt("return");case 6:if("botId"!==n||!_.find((function(e){return e.botId===t}))){e.next=9;break}return alert("This chatbot ID is already in use. Please choose another ID."),e.abrupt("return");case 9:if(h(!0),a=Zl(Zl({},B),{},ec({},n,t)),o=Ql(_),!B){e.next=21;break}if(-1===(i=o.findIndex((function(e){return e.botId===B.botId})))){e.next=21;break}return o[i]=a,e.next=18,yn(o);case 18:o=e.sent,r.setQueryData(["chatbots"],o),"botId"===n&&G((function(e){return Zl(Zl({},e),{},ec({},v,t))}));case 21:h(!1);case 22:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),z=function(){var e=nc($l().mark((function e(){var t,n,a,o,i,l=arguments;return $l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]?l[0]:R,h(!0),n="chatbot-"+Rt(),delete(a=Zl(Zl({},t),{},{botId:n,name:"New Chatbot"})).functions,e.next=8,yn([].concat(Ql(_),[a]));case 8:o=e.sent,r.setQueryData(["chatbots"],o),i="chatbot-key-".concat(Object.keys(D).length),G((function(e){return Zl(Zl({},e),{},ec({},i,n))})),g(i),sc(i),h(!1);case 15:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),W=function(){var e=nc($l().mark((function e(){var t,n,a,o,i,l;return $l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h(!0),t=D[v],n=Object.keys(D),a=n.indexOf(v),o=a>0?n[a-1]:n.length>1?n[a+1]:null,g(o),sc(o),i=_.filter((function(e){return e.botId!==t})),e.next=10,yn(i);case 10:i=e.sent,r.setQueryData(["chatbots"],i),delete(l=Zl({},D))[v],G(l),h(!1);case 16:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),V=function(){var e=nc($l().mark((function e(){var t,n;return $l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h(!0),t=Ql(_),n=t.findIndex((function(e){return e.botId===B.botId})),t[n]=Zl(Zl({},R),{},{botId:B.botId,name:B.name}),e.next=6,yn(t);case 6:t=e.sent,r.setQueryData(["chatbots"],t),h(!1);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),K=function(){var e=nc($l().mark((function e(){return $l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:z(B);case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return React.createElement(React.Fragment,null,React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0,fullWidth:!0,style:{margin:10}},React.createElement(qt.V,null,React.createElement(ko,{currentChatbot:B}),React.createElement("label",{style:{marginLeft:5}},He.COMMON.CHATBOTS),React.createElement(Xt.S,{style:{marginLeft:5},disabled:A,onLabel:"",offLabel:"",width:42,offValue:"chatbots",onValue:"themes",offBackgroundColor:O.blue,onBackgroundColor:O.purple,checked:"themes"===c,onChange:m}),React.createElement("label",{style:{marginLeft:5}},He.COMMON.THEMES),React.createElement("div",{style:{flex:"auto"}}),React.createElement("label",null,He.COMMON.SITE_WIDE_CHATBOT,":"),React.createElement(we.u,{scrolldown:!0,name:"botId",disabled:A,style:{minWidth:160},value:T,onChange:o},React.createElement(we.j,{value:"none",label:"None"}),null==_?void 0:_.map((function(e){return React.createElement(we.j,{key:e.botId,value:e.botId,label:e.name})}))))),React.createElement(E.Y,{minimal:!0,style:{margin:10,maxWidth:"50%"}},"chatbots"===c&&React.createElement(React.Fragment,null,"dropdown"===I&&React.createElement(React.Fragment,null,React.createElement("div",{style:{display:"flex",alignItems:"center",marginBottom:10}},React.createElement(we.u,{scrolldown:!0,textFiltering:!0,name:"botId",disabled:A,style:{flex:"auto",marginRight:10},value:v,onChange:g},null==_?void 0:_.map((function(e,t){return React.createElement(we.j,{key:e.botId,value:"chatbot-key-".concat(t),label:e.name})}))),React.createElement(w.M,{rounded:!0,className:"secondary",icon:"plus",disabled:A,onClick:function(){return z()}})),B&&React.createElement(xe.L,{style:{borderRadius:10}},React.createElement(Ko,{style:{margin:"-10px -10px"},options:a,themes:x,defaultChatbot:U,deleteCurrentChatbot:W,resetCurrentChatbot:V,duplicateCurrentChatbot:K,shortcodeParams:B,updateShortcodeParams:Y}))),"tabs"===I&&React.createElement(React.Fragment,null,React.createElement(b._,{inversed:!0,onChange:function(e,t){g(t.key),sc(t.key)},currentTab:v,action:React.createElement(w.M,{rounded:!0,className:"secondary",icon:"plus",disabled:A,onClick:function(){return z()}})},Object.entries(D).map((function(e){var t=rc(e,2),n=t[0],r=t[1],o=_.find((function(e){return e.botId===r}));return React.createElement(b.V,{key:n,title:o.name,busy:p},React.createElement(Ko,{options:a,themes:x,defaultChatbot:U,deleteCurrentChatbot:W,resetCurrentChatbot:V,duplicateCurrentChatbot:K,shortcodeParams:o,updateShortcodeParams:Y}))}))))),"themes"===c&&React.createElement(Ii,{themes:x,options:a,updateOption:o,currentTheme:H,onSwitchTheme:function(e){Y(e,"themeId")}})),React.createElement(E.Y,{minimal:!0,style:{maxWidth:"50%"}},React.createElement("small",{style:{marginLeft:15,marginBottom:-20}},"Chatbot: ",React.createElement("b",null,null==B?void 0:B.name)," - Theme: ",React.createElement("b",null,null==H?void 0:H.name)),React.createElement("div",{style:{position:"relative",margin:"5px 10px 10px 10px",minHeight:480,borderRadius:5,padding:10,border:"2px dashed rgb(0 0 0 / 20%)",background:"rgb(0 0 0 / 5%)"}},!!B&&React.createElement(ql,{system:{botId:B.botId,userData:C,sessionId:M,restNonce:k,pluginUrl:N,restUrl:S,stream:j,debugMode:null==a?void 0:a.debug_mode,typewriter:null==a?void 0:a.chatbot_typewriter,speech_recognition:null==a?void 0:a.shortcode_chat_speech_recognition,speech_synthesis:null==a?void 0:a.shortcode_chat_speech_synthesis},params:B,theme:H,style:B.window||B.fullscreen?{position:"absolute"}:{}})),React.createElement("div",{style:{marginLeft:10,fontSize:11,lineHeight:"140%",opacity:.5}},"This is the actual chatbot, but there might be some differences when run on your front-end, depending on your theme and the other plugins you use."))))};var mc=n(421);function dc(e){return dc="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},dc(e)}function pc(e){return function(e){if(Array.isArray(e))return Ec(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||gc(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 hc(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 yc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?hc(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=dc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=dc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==dc(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vc(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||gc(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 gc(e,t){if(e){if("string"==typeof e)return Ec(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)?Ec(e,t):void 0}}function Ec(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 bc(){bc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==dc(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(dc(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 wc(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Rc(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){wc(o,r,a,i,l,"next",e)}function l(e){wc(o,r,a,i,l,"throw",e)}i(void 0)}))}}var Oc=wp.element,_c=Oc.useMemo,xc=Oc.useState,Sc=Oc.useEffect,Tc=[{accessor:"id",visible:!1},{accessor:"time",title:"Time",width:"80px",sortable:!0},{accessor:"scope",title:"Scope",width:"90px",filters:{type:"checkbox",options:[{value:"chatbot",label:"Chatbot"},{value:"form",label:"Form"},{value:"playground",label:"Playground"}]}},{accessor:"user",title:"User",width:"85px",filters:{type:"text",description:"Type an User ID, or an IP."}},{accessor:"model",title:"Model"},{accessor:"units",title:"Units",width:"65px",align:"right",sortable:!0},{accessor:"price",title:"Price",width:"85px",align:"right",sortable:!0}],Nc=function(){var e=Rc(bc().mark((function e(t){var n;return bc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.offset=(t.page-1)*t.limit,e.next=3,(0,O.IU)("".concat(T,"/system/logs/list"),{nonce:k,method:"POST",json:t});case 3:return n=e.sent,e.abrupt("return",n?{total:n.total,logs:n.logs}:{total:0,logs:[]});case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Cc=function(){var e=Rc(bc().mark((function e(){var t,n,r=arguments;return bc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:[],e.next=3,(0,O.IU)("".concat(T,"/system/logs/delete"),{nonce:k,method:"POST",json:{logIds:t}});case 3:return n=e.sent,e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();const Ic=function(e){var t=e.setSelectedLogIds,n=e.selectedLogIds,r=(0,u.jE)(),a=vc(xc(!1),2),o=a[0],i=a[1],l=ft(L,null,!0).getModelName,c=vc(xc((function(){return Tc.filter((function(e){return e.filters})).map((function(e){return{accessor:e.accessor,value:[]}}))})),2),s=c[0],m=c[1],d=vc(xc({filters:s,sort:{accessor:"time",by:"desc"},page:1,limit:20}),2),p=d[0],h=d[1],y=(0,f.I)({queryKey:["logs",p],queryFn:function(){return Nc(p)}}),v=y.isFetching,g=y.data,E=y.error;Sc((function(){h(yc(yc({},p),{},{filters:s}))}),[s]);var b=_c((function(){return(null==g?void 0:g.total)||0}),[g]),O=_c((function(){return null!=g&&g.logs?null==g?void 0:g.logs.sort((function(e,t){return t.created_at-e.created_at})).map((function(e){var t,n=bt(e.time),r=wt(e.userId,e.ip),a=Math.round(1e3*e.price)/1e3,o=React.createElement(React.Fragment,null,"∞");e.price>=.001&&(o=React.createElement("b",null,"$",a.toFixed(3))),e.price>=.01&&(o=React.createElement("b",null,"$",a.toFixed(2))),e.price>=.1&&(o=React.createElement("b",{style:{color:"red"}},"$",a.toFixed(2)));var i=(null==L||null===(t=L.ai_envs)||void 0===t||null===(t=t.find((function(t){return t.id===e.envId})))||void 0===t?void 0:t.name)||e.envId,c=React.createElement("div",null,React.createElement("span",{title:e.model},l(e.model),"assistant"===e.mode&&React.createElement("i",null," (Assistant)")),React.createElement("br",null),React.createElement("small",null,i));return{id:e.id,scope:React.createElement("div",null,e.scope,React.createElement("br",null),React.createElement("small",null,e.session)),user:r,model:c,units:React.createElement("div",{style:{textAlign:"right"}},e.units,React.createElement("br",null),React.createElement("small",null,e.type)),price:React.createElement(React.Fragment,null,o,React.createElement("br",null),React.createElement("small",null,"$",e.price)),time:React.createElement("div",{style:{textAlign:"right"}},n)}})):[]}),[g]),_=function(){var e=Rc(bc().mark((function e(){return bc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i(!0),n.length){e.next=9;break}if(window.confirm(He.ALERTS.ARE_YOU_SURE)){e.next=5;break}return i(!1),e.abrupt("return");case 5:return e.next=7,Cc();case 7:e.next=12;break;case 9:return e.next=11,Cc(n);case 11:t([]);case 12:return e.next=14,r.invalidateQueries({queryKey:["logs"]});case 14:return e.next=16,r.refetchQueries({queryKey:["logs"]});case 16:i(!1);case 17:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),x=_c((function(){return null!=E&&E.message?React.createElement(Ne.X,{variant:"danger",style:{margin:"5px 5px"}},React.createElement("b",null,E.message),React.createElement("br",null),React.createElement("small",null,"Check your Console Logs and PHP Error Logs for more information.")):null}),[E]);return React.createElement(React.Fragment,null,React.createElement(R.z,{className:"primary",title:He.COMMON.QUERIES,action:React.createElement(React.Fragment,null,React.createElement("div",null,React.createElement(w.M,{className:"secondary",style:{marginLeft:5},disabled:v,onClick:Rc(bc().mark((function e(){return bc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.invalidateQueries({queryKey:["logs"]});case 2:r.refetchQueries({queryKey:["logs"]});case 3:case"end":return e.stop()}}),e)})))},He.COMMON.REFRESH),n.length>0&&React.createElement(React.Fragment,null,React.createElement(w.M,{className:"danger",disabled:!1,onClick:_},He.COMMON.DELETE))))},React.createElement(Kt.o,{busy:v||o,onSelectRow:function(e){1!==n.length||n[0]!==e?t([e]):t([])},onSelect:function(e){t([].concat(pc(n),pc(e)))},onUnselect:function(e){t(pc(null==n?void 0:n.filter((function(t){return!e.includes(t)}))))},selectedItems:n,sort:p.sort,onSortChange:function(e,t){h(yc(yc({},p),{},{sort:{accessor:e,by:t}}))},emptyMessage:x,filters:s,onFilterChange:function(e,t){var n=[].concat(pc(s.filter((function(t){return t.accessor!==e}))),[{accessor:e,value:t}]);m(n)},data:O,columns:Tc}),React.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:10,marginBottom:-5}},React.createElement(w.M,{className:"danger",disabled:n.length,onClick:_},He.COMMON.DELETE_ALL),React.createElement("div",{style:{flex:"auto"}}),React.createElement(Qt.Q,{currentPage:p.page,limit:p.limit,onCurrentPageChanged:function(e){return h(yc(yc({},p),{},{page:e}))},total:b,onClick:function(e){h(yc(yc({},p),{},{page:e}))}}))),React.createElement(R.z,{className:"primary",title:"Information"},React.createElement("p",null,React.createElement("b",null,"Prices and tokens counts aren't accurate in many cases.")),React.createElement("p",null,"For more information, check this: ",React.createElement("a",{href:"https://www.notion.so/meowarts/Cost-Usage-Calculation-d5ce4917d77f4939b232b20d0082368a?pvs=4",target:"_blank"},"Cost & Usage Calculation"),". You are also always welcome to discuss about it in the ",React.createElement("a",{href:"https://discord.gg/bHDGh38",target:"_blank"},"Discord Server"),".")))};function Ac(e){return Ac="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},Ac(e)}function kc(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 Lc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?kc(Object(n),!0).forEach((function(t){Mc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Mc(e,t,n){var r;return r=function(e,t){if("object"!=Ac(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ac(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==Ac(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pc(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return jc(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)?jc(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 jc(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 Fc(){Fc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Ac(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Ac(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Dc(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Gc(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Dc(o,r,a,i,l,"next",e)}function l(e){Dc(o,r,a,i,l,"throw",e)}i(void 0)}))}}var Uc=wp.element,Bc=Uc.useMemo,Hc=Uc.useState,Yc=function(){var e=Gc(Fc().mark((function e(t){var n;return Fc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",null);case 2:return e.next=4,(0,O.IU)("".concat(T,"/system/logs/meta"),{nonce:k,method:"POST",json:{logId:t,metaKeys:["query","reply","fields"]}});case 4:return n=e.sent,e.abrupt("return",n.data);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();const zc=function(e){var t,n=e.options,r=e.updateOption,a=e.busy,o=Pc(Hc([]),2),i=o[0],l=o[1],c=Pc(Hc("users"),2),u=c[0],s=c[1],m=Bc((function(){return 1===i.length?i[0]:null}),[i]),d=null==n?void 0:n.limits,p=null==n?void 0:n.default_limits,h=(0,f.I)({queryKey:["logsMeta",m],queryFn:function(){return Yc(m)},staleTime:864e5}),v=h.isFetching,g=h.data,_=function(){var e=Gc(Fc().mark((function e(t,n){var a;return Fc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=Lc(Lc({},d),{},Mc({},n,t)),e.next=3,r(a,"limits");case 3:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),x=Bc((function(){return null!=d&&d[u]?null==d?void 0:d[u]:{credits:1,creditType:"price",timeFrame:"month",isAbsolute:!1,overLimitMessage:"You have reached the limit.",ignoredUsers:""}}),[d,u]),S=function(){var e=Gc(Fc().mark((function e(t,n){var a,o;return Fc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"credits"===n&&(t=Math.max(0,t)),a=Lc(Lc({},x),{},Mc({},n,t)),o=Lc(Lc({},d),{},Mc({},u,a)),e.next=5,r(o,"limits");case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),T=function(){var e=Gc(Fc().mark((function e(){return Fc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!confirm(He.ALERTS.ARE_YOU_SURE)){e.next=3;break}return e.next=3,r(p,"limits");case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),N=Bc((function(){return Array.isArray(g)?null:g}),[g]);return React.createElement(React.Fragment,null,React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0,style:{flex:2.5}},React.createElement(Ic,{selectedLogIds:i,setSelectedLogIds:l})),React.createElement(E.Y,{minimal:!0},m&&React.createElement(React.Fragment,null,React.createElement(_e.g,{large:!0}),React.createElement(b._,{inversed:!0,style:{marginRight:10,marginLeft:10}},React.createElement(b.V,{title:"Query"},React.createElement("div",{style:{height:380,overflow:"auto",maxHeight:380}},v&&React.createElement("i",{style:{color:"gray"}},"Loading..."),!v&&!N&&React.createElement("i",{style:{color:"gray"}},He.COMMON.DATA_NOT_AVAILABLE),!v&&N&&React.createElement(mc.p2,{value:N.query,rootName:"query",indentWidth:2,displayDataTypes:!1,displayObjectSize:!1,displayArrayKey:!1,enableClipboard:!1,style:{fontSize:12}}))),React.createElement(b.V,{title:"Reply"},React.createElement("div",{style:{height:380,overflow:"auto",maxHeight:380}},v&&React.createElement("i",{style:{color:"gray"}},"Loading..."),!v&&!N&&React.createElement("i",{style:{color:"gray"}},He.COMMON.DATA_NOT_AVAILABLE),!v&&N&&React.createElement(mc.p2,{value:N.reply,rootName:"reply",indentWidth:2,displayDataTypes:!1,displayObjectSize:!1,displayArrayKey:!1,enableClipboard:!1,style:{fontSize:12}}))),N&&N.fields&&React.createElement(b.V,{title:"Fields"},React.createElement("div",{style:{height:380,overflow:"auto",maxHeight:380}},v&&React.createElement("i",{style:{color:"gray"}},"Loading..."),!v&&!N&&React.createElement("i",{style:{color:"gray"}},He.COMMON.DATA_NOT_AVAILABLE),!v&&N&&React.createElement(mc.p2,{value:N.fields,rootName:"fields",indentWidth:2,displayDataTypes:!1,displayObjectSize:!1,displayArrayKey:!1,enableClipboard:!1,style:{fontSize:12}}))))),React.createElement(yo,null,React.createElement(R.z,{className:"primary",busy:a,title:"Limits",style:{flex:1}},React.createElement(y.R,{name:"enabled",label:He.STATISTICS.ENABLE_LIMITS,checked:null==d?void 0:d.enabled,value:"1",onChange:_}),(null==d?void 0:d.enabled)&&React.createElement(React.Fragment,null,React.createElement(_e.g,null),React.createElement(Vt.o,{value:u,busy:a,onChange:function(e){s(e)}},React.createElement(Vt.K,{title:He.COMMON.USERS,value:"users",disabled:!(null!=d&&d.enabled)}),React.createElement(Vt.K,{title:He.COMMON.GUESTS,value:"guests"}),React.createElement(Vt.K,{title:He.COMMON.SYSTEM,value:"system"})),"userId"===(null==d?void 0:d.target)&&React.createElement(React.Fragment,null,React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,"Message for Guests:"),React.createElement(Re.A,{id:"guestMessage",name:"guestMessage",disabled:!(null!=d&&d.enabled),value:null==d?void 0:d.guestMessage,onEnter:S,onBlur:S})))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.CREDITS,":"),React.createElement(Re.A,{id:"credits",name:"credits",type:"number",min:"0",max:"1000000",disabled:!(null!=d&&d.enabled),value:x.credits,onEnter:S,onBlur:S})),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.TYPE,":"),React.createElement(we.u,{scrolldown:!0,id:"creditType",name:"creditType",disabled:!(null!=d&&d.enabled),value:x.creditType,onChange:S},React.createElement(we.j,{key:"queries",id:"queries",value:"queries",label:"Queries"}),React.createElement(we.j,{key:"units",id:"units",value:"units",label:"Tokens"}),React.createElement(we.j,{key:"price",id:"price",value:"price",label:"Dollars"})))),0!==x.credits&&React.createElement("p",null,"If you want to apply variable amount of credits, ",React.createElement("a",{href:"https://meowapps.com/ai-engine/faq/#limits",target:"_blank",rel:"noreferrer"},"click here"),"."),0!==x.credits&&"price"===x.creditType&&React.createElement("p",null,"The dollars represent the budget you spent through OpenAI."),0===x.credits&&React.createElement("p",null,"Since there are no credits, the Message for No Credits Message with be displayed."),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.TIMEFRAME,":"),React.createElement(we.u,{scrolldown:!0,id:"timeFrame",name:"timeFrame",disabled:!(null!=d&&d.enabled),value:x.timeFrame,onChange:S},React.createElement(we.j,{key:"second",id:"second",value:"second",label:"Second"}),React.createElement(we.j,{key:"minute",id:"minute",value:"minute",label:"Minute"}),React.createElement(we.j,{key:"hour",id:"hour",value:"hour",label:"Hour"}),React.createElement(we.j,{key:"day",id:"day",value:"day",label:"Day"}),React.createElement(we.j,{key:"week",id:"week",value:"week",label:"Week"}),React.createElement(we.j,{key:"month",id:"month",value:"month",label:"Month"}),React.createElement(we.j,{key:"year",id:"year",value:"year",label:"Year"}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.COMMON.ABSOLUTE,":"),React.createElement(y.R,{name:"isAbsolute",label:"Yes",disabled:!(null!=d&&d.enabled),checked:x.isAbsolute,value:"1",onChange:S}))),x.isAbsolute&&React.createElement("p",null,(0,O.FE)(He.STATISTICS.ABSOLUTE_HELP)),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.STATISTICS.NO_CREDITS_MESSAGE,":"),React.createElement(Re.A,{id:"overLimitMessage",name:"overLimitMessage",disabled:!(null!=d&&d.enabled),value:x.overLimitMessage,onEnter:S,onBlur:S}))),"users"===u&&React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,He.STATISTICS.FULL_ACCESS_USERS,":"),React.createElement(we.u,{scrolldown:!0,id:"ignoredUsers",name:"ignoredUsers",disabled:!(null!=d&&d.enabled),value:null==d||null===(t=d.users)||void 0===t?void 0:t.ignoredUsers,description:"",onChange:S},React.createElement(we.j,{key:"none",id:"none",value:"",label:He.COMMON.NONE}),React.createElement(we.j,{key:"editor",id:"editor",value:"administrator,editor",label:He.COMMON.EDITORS_ADMINS}),React.createElement(we.j,{key:"admin",id:"admin",value:"administrator",label:He.COMMON.ADMINS_ONLY})))),React.createElement(_e.g,null),React.createElement(w.M,{fullWidth:!0,className:"danger",onClick:T},He.COMMON.RESET_LIMITS)))))))};var Wc=n(7392);function Vc(e){return Vc="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},Vc(e)}function Kc(){Kc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Vc(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Vc(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 qc(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}const Xc=function(e){var t=e.options,n=e.updateOption,r=(e.setOptions,null==t?void 0:t.debug_mode),a=null==t?void 0:t.server_debug_mode,o=function(){var e,t=(e=Kc().mark((function e(){var t,n,r,a,o;return Kc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=prompt("Enter the Post ID you want to retrieve the content from.")){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,gt(null,null,t);case 5:n=e.sent,console.log("Data for Post ID ".concat(t),n),null!=n&&n.content&&(r=n.content.trim().replace(/<[^>]*>?/gm,""),a=r.split(" ")[0],o=r.split(" ").pop(),console.log("Content First Word: ".concat(a)),console.log("Content Last Word: ".concat(o)));case 8:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){qc(o,r,a,i,l,"next",e)}function l(e){qc(o,r,a,i,l,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}(),i=React.createElement(p.d,{title:He.COMMON.CLIENT_DEBUG},React.createElement(y.R,{name:"debug_mode",label:He.COMMON.ENABLE,value:"1",checked:r,description:He.COMMON.CLIENT_DEBUG_HELP,onChange:n})),l=React.createElement(p.d,{title:He.COMMON.SERVER_DEBUG},React.createElement(y.R,{name:"server_debug_mode",label:He.COMMON.ENABLE,value:"1",checked:a,description:He.COMMON.SERVER_DEBUG_HELP,onChange:n}));return React.createElement(React.Fragment,null,React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(R.z,{title:"Debugging",className:"primary"},React.createElement(w.M,{onClick:o},"Get Content"),React.createElement("p",null,"This button will display the content of the post, as seen by AI Engine, in your Developer Tools Console. That allows you to check what AI Engine uses when using Content Aware, Embeddings Sync, etc."))),React.createElement(E.Y,{minimal:!0},React.createElement(R.z,{title:"Settings",className:"primary"},i,l),a&&React.createElement(Wc.k,{refreshQuery:bn,clearQuery:wn,i18n:He}))))};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}var Qc=wp.element.useMemo,Jc=function(e){var t=e.env,n=e.updateEnvironment,r=e.deleteEnvironment,a=e.ai_envs,o=e.options,i=ft(o,null==t?void 0:t.ai_embeddings_env).embeddingsModels,l=Qc((function(){return i.find((function(e){return e.model===t.ai_embeddings_model}))}),[i,t.ai_embeddings_model]);return React.createElement(React.Fragment,null,React.createElement(p.d,{title:He.COMMON.NAME},React.createElement(Re.A,{name:"name",value:t.name,onFinalChange:function(e){return n(t.id,{name:e})}})),React.createElement(p.d,{title:He.COMMON.TYPE},React.createElement(we.u,{scrolldown:!0,name:"type",value:t.type,description:"qdrant"===t.type?(0,O.FE)(He.HELP.QDRANT):null,onChange:function(e){return n(t.id,{type:e})}},React.createElement(we.j,{value:"pinecone",label:"Pinecone"}),React.createElement(we.j,{value:"qdrant",label:"Qdrant"}))),React.createElement(p.d,{title:He.COMMON.API_KEY},React.createElement(Re.A,{name:"apikey",value:t.apikey,description:(0,O.FE)("pinecone"===t.type?He.COMMON.PINECONE_APIKEY_HELP:He.COMMON.QDRANT_APIKEY_HELP),onFinalChange:function(e){return n(t.id,{apikey:e})}})),React.createElement(p.d,{title:He.COMMON.SERVER},React.createElement(Re.A,{name:"server",value:t.server,description:(0,O.FE)("qdrant"===t.type?He.COMMON.QDRANT_SERVER_HELP:He.COMMON.PINECONE_SERVER_HELP),onFinalChange:function(e){return n(t.id,{server:e})}})),"pinecone"===t.type&&React.createElement(React.Fragment,null,React.createElement(p.d,{title:He.COMMON.NAMESPACE},React.createElement(Re.A,{name:"namespace",value:t.namespace,description:(0,O.FE)(He.COMMON.PINECONE_NAMESPACE_HELP),onFinalChange:function(e){return n(t.id,{namespace:e})}}))),"qdrant"===t.type&&React.createElement(React.Fragment,null,React.createElement(p.d,{title:He.COMMON.QDRANT_COLLECTION},React.createElement(Re.A,{name:"collection",value:t.collection,description:(0,O.FE)(He.COMMON.QDRANT_COLLECTION_HELP),onFinalChange:function(e){return n(t.id,{collection:e})}}))),React.createElement(p.d,{title:He.COMMON.MIN_SCORE},React.createElement(Re.A,{name:"min_score",value:t.min_score||35,type:"number",min:"0",max:"100",step:"1",description:(0,O.FE)(He.HELP.MIN_SCORE),onFinalChange:function(e){return n(t.id,{min_score:e})}})),React.createElement(p.d,{title:He.COMMON.MAX_SELECT},React.createElement(Re.A,{name:"max_select",value:t.max_select||10,type:"number",min:"1",max:"100",step:"1",description:(0,O.FE)(He.HELP.MAX_SELECT),onFinalChange:function(e){return n(t.id,{max_select:e})}})),React.createElement(Se.a,{keepState:"embeddingsEnvs"},React.createElement(Se.Y,{title:He.COMMON.AI_ENVIRONMENT},React.createElement("div",{style:{marginTop:10}},React.createElement(p.d,{title:He.COMMON.OVERRIDE_DEFAULTS},React.createElement(y.R,{label:He.COMMON.ENABLE,value:"1",checked:null==t?void 0:t.ai_embeddings_override,onChange:function(e){return n(t.id,{ai_embeddings_override:e})}})),(null==t?void 0:t.ai_embeddings_override)&&React.createElement(React.Fragment,null,React.createElement(p.d,{title:He.COMMON.ENVIRONMENT},React.createElement(we.u,{scrolldown:!0,name:"ai_embeddings_env",value:null==t?void 0:t.ai_embeddings_env,onChange:function(e){return n(t.id,{ai_embeddings_env:e})}},a.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})})))),React.createElement(p.d,{title:He.COMMON.MODEL},React.createElement(we.u,{scrolldown:!0,name:"ai_embeddings_model",value:t.ai_embeddings_model,onChange:function(e){return n(t.id,{ai_embeddings_model:e})}},i.map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})})))),React.createElement(p.d,{title:He.COMMON.DIMENSIONS},React.createElement(we.u,{scrolldown:!0,name:"ai_embeddings_dimensions",value:t.ai_embeddings_dimensions||null,onChange:function(e){return n(t.id,{ai_embeddings_dimensions:e})}},null==l?void 0:l.dimensions.map((function(e,t){return React.createElement(we.j,{key:e,value:e,label:t===l.dimensions.length-1?"".concat(e," (Default)"):e})})),React.createElement(we.j,{key:null,value:null,label:"Not Set"})))))),React.createElement(Se.Y,{title:He.COMMON.ACTIONS},React.createElement("div",{style:{display:"flex",marginTop:10}},React.createElement("div",{style:{flex:"auto"}}),React.createElement(w.M,{className:"danger",onClick:function(){return r(t.id)}},He.COMMON.DELETE)))))};const Zc=function(e){var t=e.environments,n=e.updateEnvironment,r=e.updateOption,a=e.options,o=e.busy,i=function(e){if(1!==t.length){var n=t.filter((function(t){return t.id!==e}));r(n,"embeddings_envs")}else alert("You can't delete the last environment.")};return React.createElement("div",{style:{padding:"0px 10px 20px 10px",marginTop:-5}},React.createElement(d.s,{h2:!0,style:{color:"white"}},"Environments for Embeddings"),React.createElement(b._,{inversed:!0,keepTabOnReload:!0,style:{marginTop:-5},action:React.createElement(w.M,{rounded:!0,className:"secondary",icon:"plus",onClick:function(){var e,n=[].concat(function(e){if(Array.isArray(e))return $c(e)}(e=t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||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)||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.")}(),[{name:"New Environment",type:"pinecone",apikey:"",server:"",indexes:[],namespaces:[]}]);r(n,"embeddings_envs")}})},t.map((function(e){return React.createElement(b.V,{key:e.id,title:e.name,busy:o},React.createElement(Jc,{env:e,updateEnvironment:n,deleteEnvironment:i,ai_envs:(null==a?void 0:a.ai_envs)||[],options:a}))}))))};function eu(e){return eu="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},eu(e)}function tu(){tu=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==eu(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(eu(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 nu(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 ru(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?nu(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=eu(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=eu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==eu(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function au(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function ou(e){return function(e){if(Array.isArray(e))return lu(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||iu(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 iu(e,t){if(e){if("string"==typeof e)return lu(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)?lu(e,t):void 0}}function lu(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 cu=wp.element,uu=cu.useCallback,su=cu.useMemo,fu=cu.useState,mu=function(e){var t=e.updateEnvironment,n=e.environmentId,r=e.deployments,a=e.options,o=function(e,a,o){var i=JSON.parse((0,O.F1)(r));i[e][a]=o,t(n,{deployments:i})},i=su((function(){var e,t,n=null==a||null===(e=a.ai_engines)||void 0===e?void 0:e.find((function(e){return"openai"===e.type}));return null!==(t=null==n?void 0:n.models)&&void 0!==t?t:[]}),[a]);return React.createElement(p.d,{title:He.COMMON.OPENAI_AZURE_DEPLOYMENTS,style:{marginTop:10}},r.map((function(e,a){return React.createElement("div",{key:a,style:{display:"flex",marginBottom:10}},React.createElement(Re.A,{style:{flex:1},value:e.name,placeholder:He.COMMON.OPENAI_AZURE_DEPLOYMENT_NAME,onBlur:function(e){return o(a,"name",e)},onEnter:function(e){return o(a,"name",e)}}),React.createElement(we.u,{style:{flex:1,marginLeft:10},scrolldown:!0,id:"model",name:"model",value:e.model,onChange:function(e){return o(a,"model",e)}},i.map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})}))),React.createElement(w.M,{rounded:!0,isSmall:!0,style:{marginLeft:10,height:30},icon:"trash",onClick:function(){return function(e){var a=ou(r);a.splice(e,1),t(n,{deployments:a})}(a)}}))})),React.createElement(w.M,{fullWidth:!0,icon:"plus",onClick:function(){var e=[].concat(ou(r),[{name:"",model:""}]);t(n,{deployments:e})}}))},du=function(e){var t=e.updateEnvironment,n=e.environmentId,r=e.customModels,a=function(e,a,o){var i=JSON.parse((0,O.F1)(r));i[e][a]=o,t(n,{customModels:i})};return React.createElement(p.d,{title:He.COMMON.HUGGINGFACE_MODELS,style:{marginTop:10}},r.map((function(e,o){var i,l;return React.createElement("div",{key:o,style:{display:"flex",flexDirection:"column",marginBottom:10}},React.createElement("div",{key:o,style:{display:"flex",marginBottom:2}},React.createElement(Re.A,{style:{flex:1},value:e.name,placeholder:He.COMMON.HUGGINGFACE_MODEL_NAME,onBlur:function(e){return a(o,"name",e)},onEnter:function(e){return a(o,"name",e)}}),React.createElement(Re.A,{style:{flex:2,marginLeft:5},value:e.apiUrl,placeholder:He.COMMON.HUGGINGFACE_MODEL_URL,onBlur:function(e){return a(o,"apiUrl",e)},onEnter:function(e){return a(o,"apiUrl",e)}}),React.createElement(w.M,{rounded:!0,isSmall:!0,style:{marginLeft:5,height:30},icon:"trash",onClick:function(){return function(e){var a=ou(r);a.splice(e,1),t(n,{customModels:a})}(o)}})),React.createElement("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center"}},React.createElement("span",{style:{marginRight:5}},"Image Model"),React.createElement(y.R,{style:{marginTop:o?0:5,marginRight:10},disabled:!0,checked:null===(i=e.tags)||void 0===i?void 0:i.includes("image"),onChange:function(e){var a=JSON.parse((0,O.F1)(r));a[o].tags||(a[o].tags=["core","chat"]),e?a[o].tags.push("image"):a[o].tags=a[o].tags.filter((function(e){return"image"!==e})),t(n,{customModels:a})}}),React.createElement("span",{style:{marginRight:5}},"Vision Model"),React.createElement(y.R,{style:{marginTop:o?0:5,marginRight:33},disabled:!0,checked:null===(l=e.tags)||void 0===l?void 0:l.includes("vision"),onChange:function(e){var a=JSON.parse((0,O.F1)(r));a[o].tags||(a[o].tags=["core","chat"]),e?a[o].tags.push("vision"):a[o].tags=a[o].tags.filter((function(e){return"vision"!==e})),t(n,{customModels:a})}})))})),React.createElement(w.M,{fullWidth:!0,icon:"plus",onClick:function(){var e=[].concat(ou(r),[{name:"",apiUrl:"",tags:["core","chat"]}]);t(n,{customModels:e})}}))};const pu=function(e){var t,n,r,a=e.options,o=e.environments,i=e.updateEnvironment,l=e.updateOption,c=e.busy,u=(n=fu(!1),r=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(n,r)||iu(n,r)||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.")}()),s=u[0],f=u[1],m=null!==(t=null==a?void 0:a.ai_engines)&&void 0!==t?t:[],h=uu((function(e){switch(e.type){case"openai":return(0,O.FE)(He.HELP.OPENAI_API_KEY);case"azure":return(0,O.FE)(He.HELP.AZURE_API_KEY);case"openrouter":return(0,O.FE)(He.HELP.OPENROUTER_API_KEY);case"anthropic":return(0,O.FE)(He.HELP.ANTHROPIC_API_KEY);default:return""}}),[]),y=uu(function(){var e,t=(e=tu().mark((function e(t,n){var r,o,i,c,u;return tu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,f(!0),e.next=4,(0,O.IU)("".concat(T,"/ai/models"),{method:"POST",nonce:k,json:{envId:t}});case 4:if(i=e.sent,f(!1),c=null==i?void 0:i.models){e.next=9;break}throw new Error("Could not fetch models.");case 9:c=c.map((function(e){return ru(ru({},e),{},{envId:t,type:n})})),u=(u=null!==(r=null==a?void 0:a.ai_models)&&void 0!==r?r:[]).filter((function(e){return!(e.type===n&&(!e.envId||e.envId===t))})),(o=u).push.apply(o,ou(c)),l(u,"ai_models"),e.next=21;break;case 16:e.prev=16,e.t0=e.catch(0),alert(e.t0.message),console.log(e.t0),f(!1);case 21:case"end":return e.stop()}}),e,null,[[0,16]])})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){au(o,r,a,i,l,"next",e)}function l(e){au(o,r,a,i,l,"throw",e)}i(void 0)}))});return function(e,n){return t.apply(this,arguments)}}(),[l]);return React.createElement("div",{style:{padding:"0px 10px 5px 10px",marginTop:13,marginBottom:5}},React.createElement(d.s,{h2:!0,style:{color:"white",marginBottom:15}},He.COMMON.ENVIRONMENTS_FOR_AI),React.createElement(b._,{inversed:!0,style:{marginTop:-5},action:React.createElement(w.M,{rounded:!0,className:"secondary",icon:"plus",onClick:function(){var e=[].concat(ou(o),[{name:"New Environment",type:"openai",apikey:""}]);l(e,"ai_envs")}})},o.map((function(e){var t,n,r,u=0,f=m.find((function(t){return t.type===e.type}))||{},d=null===(t=f.inputs)||void 0===t?void 0:t.includes("dynamicModels");return Array.isArray(f.models)&&(u=f.models.length),React.createElement(b.V,{key:e.id,title:e.name,busy:c},React.createElement(p.d,{title:He.COMMON.NAME},React.createElement(Re.A,{name:"name",value:e.name,onFinalChange:function(t){return i(e.id,{name:t})}})),React.createElement(p.d,{title:He.COMMON.TYPE},React.createElement(we.u,{scrolldown:!0,name:"type",value:e.type,onChange:function(t){return i(e.id,{type:t})}},m.map((function(e){return React.createElement(we.j,{key:e.type,value:e.type,label:e.name})})))),function(e){var t=(m.find((function(t){return t.type===e.type}))||{}).inputs||[];return React.createElement(React.Fragment,null,t.includes("apikey")&&React.createElement(p.d,{title:He.COMMON.API_KEY},React.createElement(Re.A,{name:"apikey",value:e.apikey,description:h(e),onFinalChange:function(t){return i(e.id,{apikey:t})}})),t.includes("organizationId")&&React.createElement(p.d,{title:He.COMMON.OPENAI_ORGANIZATION_ID},React.createElement(Re.A,{name:"organizationId",value:e.organizationId,description:(0,O.FE)(He.HELP.OPENAI_ORGANIZATION_ID),onFinalChange:function(t){return i(e.id,{organizationId:t})}})),t.includes("endpoint")&&React.createElement(p.d,{title:He.COMMON.ENDPOINT},React.createElement(Re.A,{name:"endpoint",value:e.endpoint,onFinalChange:function(t){return i(e.id,{endpoint:t})}})),t.includes("region")&&React.createElement(p.d,{title:He.COMMON.REGION},React.createElement(Re.A,{name:"region",value:e.region,onFinalChange:function(t){return i(e.id,{region:t})}})),t.includes("projectId")&&React.createElement(p.d,{title:He.COMMON.PROJECT_ID},React.createElement(Re.A,{name:"projectId",value:e.projectId,onFinalChange:function(t){return i(e.id,{projectId:t})}})))}(e),"google"===e.type&&React.createElement(React.Fragment,null,React.createElement(Ne.X,{variant:"danger"},"Click ",React.createElement("a",{href:"https://aistudio.google.com/app/apikey",target:"_blank",rel:"noreferrer"},"here")," to access your Google AI. Gemini is still unstable, so if you encounter issues, let's discuss them on ",React.createElement("a",{href:"https://discord.gg/bHDGh38",target:"_blank",rel:"noreferrer"},"Discord"),"."),React.createElement(_e.g,null)),"huggingface"===e.type&&React.createElement(React.Fragment,null,React.createElement(Ne.X,{variant:"danger"},"Support for Hugging Face is experimental and may not work as expected. Also, AI Engine is ready for Image and Vision but Hugging Face is not (hence the disabled checkboxes). Let's discuss about Hugging Face on ",React.createElement("a",{href:"https://discord.gg/bHDGh38",target:"_blank",rel:"noreferrer"},"Discord"),"."),React.createElement(_e.g,null)),React.createElement(Se.a,{keepState:"environmentCategories"},d&&React.createElement(Se.Y,{title:He.COMMON.MODELS},"openrouter"===e.type&&React.createElement("p",null,"There are currently ",React.createElement("b",null,u)," models available. OpenRouter models need to be refresh regularly. This button will fetch the latest models and their prices."),"google"===e.type&&React.createElement("p",null,"There are currently ",React.createElement("b",null,u)," models available. Google models need to be refresh regularly. This button will fetch the latest models and their prices."),"openrouter"!==e.type&&"google"!==e.type&&React.createElement("p",null,"There are currently ",React.createElement("b",null,u)," models available. This button will fetch the latest models."),React.createElement(w.M,{fullWidth:!0,className:"primary",isBusy:s,onClick:function(){return y(e.id,e.type)}},He.COMMON.REFRESH_MODELS)),"azure"===e.type&&React.createElement(React.Fragment,null,React.createElement("p",null,He.HELP.AZURE_DEPLOYMENTS),React.createElement(Se.Y,{title:He.COMMON.OPENAI_AZURE_DEPLOYMENTS},React.createElement(mu,{deployments:null!==(n=e.deployments)&&void 0!==n?n:[],environmentId:e.id,updateEnvironment:i,options:a}))),"huggingface"===e.type&&React.createElement(Se.Y,{title:He.COMMON.HUGGINGFACE_MODELS},React.createElement("p",null,"Browse the ",React.createElement("a",{href:"https://huggingface.co/models",target:"_blank",rel:"noreferrer"},"Models on Hugging Face"),". Use the Deploy button (Inference API Serverless) in order to get the API URL. Paste it below with the name of your choice and you're done!"),React.createElement(du,{customModels:null!==(r=e.customModels)&&void 0!==r?r:[],environmentId:e.id,updateEnvironment:i,options:a})),React.createElement(Se.Y,{title:He.COMMON.ENVIRONMENT_ID},React.createElement("p",null,'The EnvID is "',React.createElement("b",null,e.id),'".')),React.createElement(Se.Y,{title:He.COMMON.ACTIONS},React.createElement("div",{style:{display:"flex",marginTop:10}},React.createElement("div",{style:{flex:"auto"}}),React.createElement(w.M,{className:"danger",onClick:function(){return function(e){if(1!==o.length){var t=o.filter((function(t){return t.id!==e}));l(t,"ai_envs")}else alert("You can't delete the last environment.")}(e.id)}},He.COMMON.DELETE)))))}))))};function hu(e){return hu="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},hu(e)}function yu(){yu=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==hu(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(hu(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 vu(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function gu(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Eu(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)?Eu(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 Eu(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 bu=wp.element,wu=bu.useState,Ru=bu.useEffect;const Ou=function(){var e=gu(wu(""),2),t=e[0],n=e[1],r=gu(wu(""),2),a=r[0],o=r[1],i=gu(wu(""),2),l=i[0],c=i[1],u=gu(wu(!1),2),s=u[0],f=u[1],m=gu(wu("imageToText"),2),d=m[0],p=m[1],h=gu(wu(null),2),y=h[0],v=h[1];Ru((function(){n(""),o(""),c("")}),[d]);var g=function(){var e,n=(e=yu().mark((function e(){var n,r,a,i,c,u=arguments;return yu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r="","textToJSON"!==(n=u.length>0&&void 0!==u[0]?u[0]:"imageToText")){e.next=6;break}r="".concat(T,"/ai/json"),e.next=16;break;case 6:if("imageToText"!==n){e.next=10;break}r="".concat(T,"/ai/transcribe_image"),e.next=16;break;case 10:if("audioToText"!==n){e.next=14;break}r="".concat(T,"/ai/transcribe_audio"),e.next=16;break;case 14:return alert("Unknown transcription type: ".concat(n)),e.abrupt("return");case 16:return f(n),v(Date.now()),e.prev=18,e.next=21,(0,O.IU)(r,{method:"POST",nonce:k,json:{url:t,message:l}});case 21:i=e.sent,null!=(c=i.data)&&null!==(a=c.error)&&void 0!==a&&a.message?alert(c.error.message):o(c),e.next=29;break;case 26:e.prev=26,e.t0=e.catch(18),alert(e.t0.message);case 29:return e.prev=29,f(!1),v(null),e.finish(29);case 33:case"end":return e.stop()}}),e,null,[[18,26,29,33]])})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){vu(o,r,a,i,l,"next",e)}function l(e){vu(o,r,a,i,l,"throw",e)}i(void 0)}))});return function(){return n.apply(this,arguments)}}();return React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(R.z,{title:"Features",className:"raw"},React.createElement(b._,{inversed:!0,onChange:function(e,t){p(t.key)}},React.createElement(b.V,{title:He.COMMON.IMAGE_TO_TEXT,key:"imageToText"},React.createElement("label",null,"Image URL:"),React.createElement(_e.g,{tiny:!0}),React.createElement(Wt.m,{name:"url",rows:2,value:t,onChange:n}),React.createElement(_e.g,null),React.createElement("label",null,"Prompt:"),React.createElement(_e.g,{tiny:!0}),React.createElement(Wt.m,{rows:2,value:l,onChange:c}),React.createElement(_e.g,null),React.createElement(w.M,{fullWidth:!0,style:{height:40},disabled:s,isBusy:"imageToText"===s,startTime:y,onClick:function(){g("imageToText")}},"Transcribe Image"),React.createElement(_e.g,{tiny:!0}),React.createElement("p",null,"If you are looking for beautiful images to play with this, here are some URLs: ",React.createElement("a",{target:"_blank",href:"https://offbeatjapan.org"},"Offbeat Japan"),", ",React.createElement("a",{target:"_blank",href:"https://unsplash.com"},"Unsplash"),", ",React.createElement("a",{target:"_blank",href:"https://www.pexels.com"},"Pexels"),".")),React.createElement(b.V,{title:He.COMMON.AUDIO_TO_TEXT,key:"audioToText"},React.createElement("label",null,"Audio URL:"),React.createElement(_e.g,{tiny:!0}),React.createElement(Wt.m,{name:"url",rows:2,value:t,onChange:n}),React.createElement(_e.g,null),React.createElement("label",null,"Prompt:"),React.createElement(_e.g,{tiny:!0}),React.createElement(Wt.m,{rows:2,value:l,onChange:c}),React.createElement(_e.g,null),React.createElement(w.M,{fullWidth:!0,style:{height:40},disabled:s,isBusy:"audioToText"===s,startTime:y,onClick:function(){g("audioToText")}},"Transcribe Audio")),React.createElement(b.V,{title:He.COMMON.PROMPT_TO_JSON,key:"textToJSON"},React.createElement("label",null,"Prompt:"),React.createElement(_e.g,{tiny:!0}),React.createElement(Wt.m,{rows:2,value:l,onChange:c}),React.createElement(_e.g,null),React.createElement(w.M,{fullWidth:!0,style:{height:40},disabled:s,isBusy:"textToJSON"===s,startTime:y,onClick:function(){g("textToJSON")}},"Query AI"),React.createElement(_e.g,null),React.createElement("label",null,"Examples:"),React.createElement("ul",null,React.createElement("li",null,"👽 List the best science fiction books. Include the title, author, publication year, and a short synopsis."),React.createElement("li",null,"🎋 Identify the most beautiful gardens in Japan. Provide the garden name, location (gps: [lng, lat]), best visiting season, and features."),React.createElement("li",null,"💰 Identify the current top 10 richest individuals globally. For each person, include their name, estimated net worth, source of wealth, country of residence, and key tags (such as 'technology', 'retail', 'investor', etc.). Additionally, provide a brief description of their most notable business ventures or achievements."),React.createElement("li",null,"🦁 Compile a list of significant archaeological discoveries in the last decade. Include the discovery, location, date, and significance.")),React.createElement(_e.g,null))))),React.createElement(E.Y,{minimal:!0},React.createElement(R.z,{title:"Transcription",className:"primary"},React.createElement(_e.g,{tiny:!0}),"textToJSON"===d&&React.createElement(mc.p2,{value:a,indentWidth:2,displayDataTypes:!1,displayObjectSize:!1,displayArrayKey:!1,enableClipboard:!1,style:{fontSize:12}}),"textToJSON"!==d&&React.createElement(Wt.m,{name:"context",rows:21,value:a,disabled:!a}))))};function _u(e){return _u="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},_u(e)}function xu(e){return function(e){if(Array.isArray(e))return Lu(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ku(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 Su(){Su=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==_u(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(_u(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Tu(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Nu(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Tu(o,r,a,i,l,"next",e)}function l(e){Tu(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Cu(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 Iu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Cu(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=_u(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=_u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==_u(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Au(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||ku(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 ku(e,t){if(e){if("string"==typeof e)return Lu(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)?Lu(e,t):void 0}}function Lu(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 Mu=wp.element,Pu=Mu.useState,ju=Mu.useMemo,Fu=Mu.useEffect,Du=[{accessor:"name",title:"Name",verticalAlign:"top"},{accessor:"instructions",title:"Instructions",width:220,verticalAlign:"top"},{accessor:"parameters",title:"Parameters",verticalAlign:"top"},{accessor:"createdOn",title:"Created On",verticalAlign:"top"}],Gu=[{accessor:"file",title:"File",verticalAlign:"top"},{accessor:"metadata",title:"Metadata",verticalAlign:"top"},{accessor:"userId",title:"User ID",verticalAlign:"top"},{accessor:"purpose",title:"Purpose",verticalAlign:"top"},{accessor:"created",title:"Created On",verticalAlign:"top"},{accessor:"actions",title:"Actions",verticalAlign:"top"}];const Uu=function(e){var t,n=e.options,r=e.refreshOptions,a=(0,u.jE)(),o=Au(Pu(null),2),i=o[0],l=o[1],c=Au(Pu(!1),2),m=c[0],p=c[1],h=Au(Pu(null==n||null===(t=n.ai_envs)||void 0===t||null===(t=t[0])||void 0===t?void 0:t.id),2),y=h[0],v=h[1],g=ju((function(){return(null==n?void 0:n.ai_envs)||[]}),[n]),_=Au(Pu("assistants"),2),x=_[0],S=_[1],T=Au(Pu([]),2),N=T[0],C=T[1],I=(0,s.z)().colors,A=ju((function(){return g.find((function(e){return e.id===y}))}),[y,g]),k=ju((function(){return(null==A?void 0:A.assistants)||[]}),[A]),L=Au(Pu({userId:null,purpose:["assistant-in","assistant-out"],metadata:null,envId:y,page:1,limit:10}),2),M=L[0],P=L[1],j=(0,O.F1)(M);Fu((function(){var e,t=function(){var e=localStorage.getItem("mwai-admin-assistants");try{return JSON.parse(e)}catch(e){return{}}}(),n=null!==(e=null==t?void 0:t.envId)&&void 0!==e?e:null;n&&v(n)}),[]),Fu((function(){var e;e={envId:y||null},localStorage.setItem("mwai-admin-assistants",(0,O.F1)(e))}),[y]),Fu((function(){P(Iu(Iu({},M),{},{envId:y}))}),[y]);var F=(0,f.I)({queryKey:["assistants-files",j],enabled:"files"===x,staleTime:3e5,queryFn:function(){return sn(M)}}),D=F.isFetching,G=F.data,U=function(){var e=Nu(Su().mark((function e(t){return Su().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return p(!0),e.prev=1,e.next=4,cn(t);case 4:return e.next=6,a.invalidateQueries("assistants-files");case 6:C([]),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),l(e.t0);case 12:p(!1);case 13:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t){return e.apply(this,arguments)}}(),B=ju((function(){return null==G?void 0:G.files.map((function(e){return Iu(Iu({},e),{},{file:(n=e.url,r=e.refId,React.createElement("div",{style:{display:"flex",flexDirection:"column"}},React.createElement("span",null,function(e){if(!e)return null;var t=e.split("/").pop();return React.createElement("a",{href:e,target:"_blank",rel:"noreferrer"},t)}(n)),React.createElement("small",null,r))),purpose:(a=e.purpose,"assistant-out"===a?"Generated":"assistant-in"===a?"Uploaded":a),metadata:(t=e.metadata,t?React.createElement("small",null,React.createElement("ul",{style:{margin:0,padding:0}},Object.keys(t).map((function(e){return React.createElement("li",{key:e,style:{margin:0}},React.createElement("i",null,e),": ",t[e]," ","assistant_id"===e?"(".concat((n=t[e],(null==(r=k.find((function(e){return e.id===n})))?void 0:r.name)||"N/A"),")"):"");var n,r})))):null),created:new Date(e.created).toLocaleDateString(),actions:React.createElement(React.Fragment,null,React.createElement(w.M,{className:"danger",rounded:!0,icon:"trash",disabled:V,onClick:function(){return U([e.id])}}))});var t,n,r,a}))}),[G]),H=ju((function(){return(null==G?void 0:G.total)||0}),[G]),Y=function(){var e=Nu(Su().mark((function e(){return Su().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return p(!0),e.next=3,vn(y);case 3:return e.next=5,r();case 5:p(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),z=function(){var e=Nu(Su().mark((function e(){return Su().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.invalidateQueries("assistants-files");case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),W=ju((function(){return k.map((function(e){var t;return Iu(Iu({},e),{},{name:React.createElement("div",{style:{display:"flex",flexDirection:"column"}},React.createElement("span",null,e.name),React.createElement("small",null,e.id)),instructions:(null===(t=e.instructions)||void 0===t?void 0:t.length)>100?"".concat(e.instructions.slice(0,100),"..."):e.instructions,parameters:React.createElement(React.Fragment,null,React.createElement("ul",{style:{margin:0,padding:0}},React.createElement("li",{style:{margin:0,display:"flex"}},React.createElement(Oe.z,{icon:"check",width:16,color:I.green}),React.createElement("span",{style:{marginLeft:3}},e.model)),React.createElement("li",{style:{margin:0,display:"flex"}},React.createElement(Oe.z,{icon:e.has_file_search?"check":"close",width:16,color:e.has_file_search?I.green:I.gray}),React.createElement("a",{style:{marginLeft:3},href:"https://platform.openai.com/docs/assistants/tools/file-search",target:"_blank",rel:"noreferrer"},"File Search")),React.createElement("li",{style:{margin:0,display:"flex"}},React.createElement(Oe.z,{icon:e.has_code_interpreter?"check":"close",width:16,color:e.has_code_interpreter?I.green:I.gray}),React.createElement("a",{style:{marginLeft:3},href:"https://platform.openai.com/docs/assistants/tools/code-interpreter",target:"_blank",rel:"noreferrer"},"Code Interpreter"))),React.createElement("p",{style:{lineHeight:"11px",margin:"5px 0"}},React.createElement("small",null,"Note: AI Engine currently uses the Assistants API v2. Retrieval have been deprecated by OpenAI. More information ",React.createElement("a",{href:"https://platform.openai.com/docs/assistants/whats-new",target:"_blank",rel:"noreferrer"},"here"),"."))),createdOn:new Date(e.createdOn).toLocaleDateString()})}))}),[k,I.gray,I.green]),V=m,K=ju((function(){return React.createElement(we.u,{scrolldown:!0,value:y,onChange:v,style:{marginLeft:5}},g.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})})))}),[y,g]),q=ju((function(){return React.createElement("div",null,React.createElement("div",{style:{display:"flex",flexDirection:"row"}},React.createElement(Qt.Q,{currentPage:M.page,limit:M.limit,total:H,onClick:function(e){P(Iu(Iu({},M),{},{page:e}))}})))}),[M,H]);return React.createElement(E.N,null,React.createElement(E.Y,{fullWidth:!0,minimal:!0,style:{margin:8}},React.createElement(b._,{inversed:!0,currentTab:x,onChange:function(e,t){S(t.key)},action:React.createElement(React.Fragment,null,React.createElement("div",{style:{flex:"auto"}}),N.length>0&&"files"===x&&React.createElement(React.Fragment,null,React.createElement(w.M,{className:"danger",disabled:!1,onClick:function(){return U(N)}},He.COMMON.DELETE)),"files"===x&&React.createElement(w.M,{disabled:V||!A,busy:V,onClick:z,className:"secondary"},He.COMMON.REFRESH),"assistants"===x&&React.createElement(w.M,{disabled:V||!A,busy:V,onClick:Y,className:"secondary"},He.COMMON.REFRESH),K)},React.createElement(b.V,{title:He.COMMON.ASSISTANTS,key:"assistants"},React.createElement(Kt.o,{busy:V,data:W,columns:Du,emptyMessage:He.NO_ASSISTANTS_YET})),React.createElement(b.V,{title:He.COMMON.FILES,key:"files"},React.createElement(Kt.o,{busy:D||V,data:B,columns:Gu,selectedItems:N,onSelect:function(e){C([].concat(xu(N),xu(e)))},onUnselect:function(e){C(xu(N.filter((function(t){return!e.includes(t)}))))},emptyMessage:He.NO_FILES_YET}),React.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:10}},React.createElement("div",{style:{flex:"auto"}}),q)))),React.createElement(E.Y,{fullWidth:!0,minimal:!0},React.createElement(R.z,{className:"primary"},React.createElement(d.s,{p:!0},(0,O.FE)(He.HELP.ASSISTANTS_INTRO)),React.createElement(Ne.X,{variant:"danger"},(0,O.FE)(He.HELP.ASSISTANTS_WARNINGS))),React.createElement(_e.g,{tiny:!0}),i&&React.createElement(Te.n,{isOpen:!!i,title:"Error",onRequestClose:function(){return l(null)},okButton:{label:"Ok",onClick:function(){return l(null)}},content:React.createElement("p",null,null==i?void 0:i.message)})))};var Bu;function Hu(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 Yu=wp.element,zu=Yu.useState,Wu=Yu.useMemo,Vu=G.Ay.div(Bu||(Bu=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n  display: grid;\n  grid-template-columns: 1fr 1fr 1fr;\n  grid-gap: 20px;\n"])));const Ku=function(e){var t,n,r=e.addons,a=r.some((function(e){return e.enabled}))?"enabled":"all",o=(t=zu(a),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Hu(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)?Hu(e,t):void 0}}(t,n)||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.")}()),i=o[0],l=o[1],c=Wu((function(){return"enabled"===i?r.filter((function(e){return e.enabled})):"disabled"===i?r.filter((function(e){return!e.enabled})):r}),[r,i]);return React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0,fullWidth:!0,style:{padding:10}},React.createElement(qt.V,null,React.createElement(Vt.o,{name:"filter",value:i,onChange:function(e){return l(e)}},React.createElement(Vt.K,{title:"All",value:"all"}),React.createElement(Vt.K,{title:"Enabled",value:"enabled"}),React.createElement(Vt.K,{title:"Disabled",value:"disabled"}))),React.createElement(_e.g,null),React.createElement(Vu,null,c.map((function(e){return React.createElement(xe.L,{key:e.id,style:{marginBottom:0},footer:React.createElement("div",{style:{display:"flex",width:"100%",alignItems:"center",marginLeft:10,minHeight:30}},React.createElement("span",{style:{fontSize:"11px",marginRight:15,color:e.enabled?"#4CAF50":"#666",textTransform:"uppercase",fontWeight:"bold"}},e.enabled?React.createElement("label",null,"Enabled"):React.createElement("label",null,"Disabled")),React.createElement("div",{style:{flex:"auto"}}),e.enabled&&e.settings_url&&React.createElement(w.M,{className:"primary",onClick:function(){return window.open(e.settings_url,"_self")}},"Settings"),!e.enabled&&React.createElement(w.M,{className:"primary",onClick:function(){return window.open(e.install_url,"_blank")}},"Install"))},React.createElement(d.s,{h3:!0},e.name),React.createElement("div",{className:"addon-description"},e.description))})))))};function qu(e){return qu="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},qu(e)}function Xu(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $u(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)?$u(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 $u(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 Qu(){Qu=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==qu(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(qu(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Ju(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 Zu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ju(Object(n),!0).forEach((function(t){es(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ju(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function es(e,t,n){var r;return r=function(e,t){if("object"!=qu(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=qu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==qu(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ts(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function ns(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){ts(o,r,a,i,l,"next",e)}function l(e){ts(o,r,a,i,l,"throw",e)}i(void 0)}))}}var rs=wp.element,as=rs.useMemo,os=rs.useState,is=rs.useEffect,ls=rs.useCallback,cs=function(){var e=ns(Qu().mark((function e(){var t,n;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/openai/incidents"),{nonce:k});case 2:if(null==(t=e.sent)||!t.incidents){e.next=6;break}return n=t.incidents.map((function(e){var t=e.date,n=(t=new Date(1e3*t)).toLocaleDateString("ja-JP",{year:"numeric",month:"2-digit",day:"2-digit"});return Zu(Zu({},e),{},{date:n})})),e.abrupt("return",n);case 6:return e.abrupt("return",null);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),us=[{envKey:"ai_embeddings_default_env",modelKey:"ai_embeddings_default_model",defaultModel:"text-embedding-ada-002"},{envKey:"ai_vision_default_env",modelKey:"ai_vision_default_model",defaultModel:"gpt-4o-mini"},{envKey:"ai_images_default_env",modelKey:"ai_images_default_model",defaultModel:"dall-e-3-hd"},{envKey:"ai_audio_default_env",modelKey:"ai_audio_default_model",defaultModel:"whisper-1"},{envKey:"ai_json_default_env",modelKey:"ai_json_default_model",defaultModel:"gpt-4o-mini"}],ss=["module_forms","module_statistics","module_embeddings","module_assistants"];const fs=function(){var e,t,n,r,a=Xu(os(L),2),o=a[0],i=a[1],l=Xu(os(null),2),c=l[0],u=l[1],s=Xu(os(!1),2),m=s[0],g=s[1],S=null==o?void 0:o.module_suggestions,N=null==o?void 0:o.module_advisor,C=null==o?void 0:o.module_forms,M=null==o?void 0:o.module_finetunes,P=null==o?void 0:o.module_statistics,j=null==o?void 0:o.module_playground,F=null==o?void 0:o.module_generator_content,D=null==o?void 0:o.module_generator_images,G=null==o?void 0:o.module_moderation,U=null==o?void 0:o.module_embeddings,B=null==o?void 0:o.module_assistants,H=null==o?void 0:o.module_transcription,Y=null==o?void 0:o.module_addons,z=null==o?void 0:o.module_devtools,W=null==o?void 0:o.module_chatbots,V=as((function(){return null!=o&&o.ai_envs?null==o?void 0:o.ai_envs:[]}),[o]),K=null==o?void 0:o.ai_default_env,q=null==o?void 0:o.ai_default_model,X=null==o?void 0:o.ai_vision_default_env,$=null==o?void 0:o.ai_vision_default_model,Q=null==o?void 0:o.ai_embeddings_default_env,J=null==o?void 0:o.ai_embeddings_default_model,Z=null==o?void 0:o.ai_images_default_env,ee=null==o?void 0:o.ai_images_default_model,te=null==o?void 0:o.ai_audio_default_env,ne=null==o?void 0:o.ai_audio_default_model,re=null==o?void 0:o.ai_json_default_env,ae=null==o?void 0:o.ai_json_default_model,oe=null==o?void 0:o.ai_streaming,ie=null!=o&&o.embeddings_envs?null==o?void 0:o.embeddings_envs:[],le=null==o?void 0:o.embeddings_default_env,ce=null==o?void 0:o.syntax_highlight,ue=null==o?void 0:o.chatbot_typewriter,se=null==o?void 0:o.chatbot_discussions,fe=null==o?void 0:o.virtual_keyboard_fix,me=null==o?void 0:o.chatbot_gdpr_consent,de=null==o?void 0:o.chatbot_gdpr_text,pe=null==o?void 0:o.chatbot_gdpr_button,he=null==o?void 0:o.speech_recognition,ye=null==o?void 0:o.speech_synthesis,ve=null==o?void 0:o.public_api,ge=null==o?void 0:o.statistics_data,Ee=null==o?void 0:o.statistics_forms_data,be=null==o?void 0:o.intro_message,Ne=null==o?void 0:o.module_addons,Ce=null==o?void 0:o.context_max_length,Ie=null==o?void 0:o.banned_ips,Ae=null==o?void 0:o.banned_words,ke=null!==(e=null==o?void 0:o.admin_bar)&&void 0!==e?e:["settings"],Le=null==o?void 0:o.resolve_shortcodes,Me=null==o?void 0:o.clean_uninstall,Pe=ft(o).completionModels,je=ft(o,null==o?void 0:o.ai_vision_default_env).visionModels,Fe=ft(o,null==o?void 0:o.ai_audio_default_env).audioModels,De=ft(o,null==o?void 0:o.ai_json_default_env).jsonModels,Ue=ft(o,null==o?void 0:o.ai_images_default_env).imageModels,Be=ft(o,null==o?void 0:o.ai_embeddings_default_env).embeddingsModels,Ye=as((function(){return Be.find((function(e){return e.model===J}))}),[Be,J]),ze=(0,f.I)({queryKey:["incidents"],queryFn:cs}),We=ze.isLoading,Ve=ze.data,Ke=as((function(){return null==Ve?void 0:Ve.filter((function(e){return new Date(e.date)>new Date(Date.now()-864e5)})).length}),[Ve]),qe=m;is((function(){var e=function(){var e=ns(Qu().mark((function e(){var t,n;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=!1,n=Zu({},o),us.forEach((function(e){var r=e.envKey,a=e.modelKey,i=e.defaultModel,l=!1;if(o[r]&&(l=!!V.find((function(e){return e.id===o[r]}))),!l){var c=V.find((function(e){return"openai"===(null==e?void 0:e.type)}));c?n[r]===c.id&&n[a]===i||(console.warn("Updating ".concat(r," and ").concat(a," to ").concat(c.id," and ").concat(i)),t=!0,n[r]=c.id,n[a]=i):null===n[r]&&null===n[a]||(console.warn("Updating ".concat(r," and ").concat(a," to null")),t=!0,n[r]=null,n[a]=null)}if("ai_embeddings_default_model"===a&&n[a]){var u=(null==n?void 0:n.ai_embeddings_default_dimensions)||null;if(null!==u){var s=Be.find((function(e){return e.model===n[a]}));if(null==s||!s.dimensions.includes(u)){var f=(null==s?void 0:s.dimensions[(null==s?void 0:s.dimensions.length)-1])||null;null!==f&&(n.ai_embeddings_default_dimensions=f,console.warn("Updating embeddings default dimensions to ".concat(f)),t=!0)}}}})),!t){e.next=6;break}return e.next=6,$e(n);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[V,o,$e,Be]);var Xe=function(){var e=ns(Qu().mark((function e(){var t;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return g(!0),e.prev=1,e.next=4,En();case 4:t=e.sent,i(t),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error(He.ERROR.GETTING_OPTIONS,null!==e.t0&&void 0!==e.t0&&e.t0.message?{message:e.t0.message}:{err:e.t0}),e.t0.message&&u(React.createElement(React.Fragment,null,React.createElement("div",null,He.ERROR.GETTING_OPTIONS),React.createElement("small",null,(0,O.FE)(He.ERROR.CHECK_YOUR_CONSOLE))));case 12:return e.prev=12,g(!1),e.finish(12);case 15:case"end":return e.stop()}}),e,null,[[1,8,12,15]])})));return function(){return e.apply(this,arguments)}}(),$e=ls(function(){var e=ns(Qu().mark((function e(t){var n;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,(0,O.F1)(t)!==(0,O.F1)(o)){e.next=3;break}return e.abrupt("return");case 3:return g(!0),e.next=6,(0,O.IU)("".concat(T,"/settings/update"),{method:"POST",nonce:k,json:{options:t}});case 6:n=e.sent,i(n.options),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(0),console.error(He.ERROR.UPDATING_OPTIONS,null!==e.t0&&void 0!==e.t0&&e.t0.message?{message:e.t0.message,options:o,newOptions:t}:{err:e.t0,options:o,newOptions:t}),e.t0.message&&u(React.createElement(React.Fragment,null,React.createElement("div",null,He.ERROR.UPDATING_OPTIONS),React.createElement("small",null,(0,O.FE)(He.ERROR.CHECK_YOUR_CONSOLE))));case 14:return e.prev=14,g(!1),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[0,10,14,17]])})));return function(t){return e.apply(this,arguments)}}(),[o]),Qe=function(){var e=ns(Qu().mark((function e(t,n){var r;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Zu(Zu({},o),{},es({},n,t)),console.log("Updating",n,t),e.next=4,$e(r);case 4:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Je=function(){var e=ns(Qu().mark((function e(t,n){var r;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=ie.map((function(e){return e.id===t?Zu(Zu({},e),n):e})),Qe(r,"embeddings_envs");case 2:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Ze=function(){var e=ns(Qu().mark((function e(t,n){var r;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=V.map((function(e){return e.id===t?Zu(Zu({},e),n):e})),Qe(r,"ai_envs");case 2:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),et=function(){var e=ns(Qu().mark((function e(){return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.confirm(He.ALERTS.ARE_YOU_SURE)){e.next=2;break}return e.abrupt("return");case 2:return g(!0),e.prev=3,e.next=6,(0,O.IU)("".concat(T,"/settings/reset"),{method:"POST",nonce:k});case 6:alert("Settings reset. The page will now reload to reflect the changes."),window.location.reload(),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(3),alert("Error while resetting settings. Please check your console."),console.log(e.t0);case 14:return e.prev=14,g(!1),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[3,10,14,17]])})));return function(){return e.apply(this,arguments)}}(),tt=function(){var e=ns(Qu().mark((function e(){var t,n,r,a,o,i,l,c,u;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return g("exportSettings"),e.prev=1,e.next=4,hn();case 4:return t=e.sent,e.next=7,mn();case 7:return n=e.sent,e.next=10,En();case 10:r=e.sent,a={chatbots:t,themes:n,options:r},o=new Blob([(0,O.F1)(a)],{type:"application/json"}),i=URL.createObjectURL(o),(l=document.createElement("a")).href=i,c=new Date,u="ai-engine-".concat(c.getFullYear(),"-").concat(c.getMonth()+1,"-").concat(c.getDate(),".json"),l.setAttribute("download",u),l.click(),e.next=26;break;case 22:e.prev=22,e.t0=e.catch(1),alert("Error while exporting settings. Please check your console."),console.log(e.t0);case 26:return e.prev=26,g(!1),e.finish(26);case 29:case"end":return e.stop()}}),e,null,[[1,22,26,29]])})));return function(){return e.apply(this,arguments)}}(),nt=function(){var e=ns(Qu().mark((function e(){var t;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:g("importSettings");try{(t=document.createElement("input")).type="file",t.accept="application/json",t.onchange=function(){var e=ns(Qu().mark((function e(t){var n,r;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.target.files[0]){e.next=3;break}return e.abrupt("return");case 3:(r=new FileReader).onload=function(){var e=ns(Qu().mark((function e(t){var n,r,a,o;return Qu().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=JSON.parse(t.target.result),r=n.chatbots,a=n.themes,o=n.options,e.next=4,yn(r);case 4:return e.next=6,dn(a);case 6:return e.next=8,$e(o);case 8:alert("Settings imported. The page will now reload to reflect the changes."),window.location.reload();case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.readAsText(n);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t.click()}catch(e){alert("Error while importing settings. Please check your console."),console.log(e)}finally{g(!1)}case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();is((function(){if(!A){var e=Zu({},o),t=!1;ss.forEach((function(n){e[n]&&(e[n]=!1,console.warn("Resetting ".concat(n)),t=!0)})),t&&(0,O.F1)(e)!==(0,O.F1)(o)&&$e(e)}}),[]);var rt=React.createElement(p.d,{title:He.COMMON.UTILITIES},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"module_suggestions",label:He.COMMON.POSTS_SUGGESTIONS,value:"1",checked:S,description:He.COMMON.POSTS_SUGGESTIONS_HELP,onChange:Qe}))),at=React.createElement(p.d,{title:He.COMMON.ADVISOR},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"module_advisor",label:He.COMMON.ENABLE,value:"1",checked:N,description:He.HELP.ADVISOR,onChange:Qe}))),ot=React.createElement(p.d,{title:He.COMMON.GENERATORS},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"module_generator_content",label:He.COMMON.CONTENT_GENERATOR,value:"1",checked:F,description:He.COMMON.CONTENT_GENERATOR_HELP,onChange:Qe}),React.createElement(y.R,{name:"module_generator_images",label:He.COMMON.IMAGES_GENERATOR,value:"1",checked:D,description:He.COMMON.IMAGES_GENERATOR_HELP,onChange:Qe}))),it=React.createElement(p.d,{title:He.COMMON.PLAYGROUND},React.createElement(y.R,{name:"module_playground",label:He.COMMON.ENABLE,value:"1",checked:j,description:He.COMMON.PLAYGROUND_HELP,onChange:Qe})),lt=React.createElement(p.d,{title:React.createElement(React.Fragment,null,He.COMMON.FORMS,React.createElement("small",{style:{position:"relative",top:-3,fontSize:8}}," BETA"))},React.createElement(y.R,{name:"module_forms",label:He.COMMON.ENABLE,value:"1",checked:C,requirePro:!0,isPro:A,description:He.COMMON.FORMS_HELP,onChange:Qe})),ct=React.createElement(p.d,{title:He.COMMON.FINETUNES},React.createElement(y.R,{name:"module_finetunes",label:He.COMMON.ENABLE,value:"1",checked:M,description:React.createElement(React.Fragment,null,React.createElement(Ot,{disabled:!M,style:{marginRight:3}}),He.HELP.FINETUNES),onChange:Qe})),ut=React.createElement(p.d,{title:React.createElement(React.Fragment,null,He.COMMON.STATISTICS)},React.createElement(y.R,{name:"module_statistics",label:He.COMMON.ENABLE,value:"1",checked:P,requirePro:!0,isPro:A,description:He.COMMON.STATISTICS_HELP,onChange:Qe})),mt=React.createElement(p.d,{title:React.createElement(React.Fragment,null,He.COMMON.MODERATION)},React.createElement(y.R,{name:"module_moderation",label:He.COMMON.ENABLE,value:"1",checked:G,description:React.createElement(React.Fragment,null,React.createElement(Ot,{disabled:!G,style:{marginRight:3}}),He.COMMON.MODERATION_HELP),onChange:Qe})),dt=React.createElement(p.d,{title:React.createElement(React.Fragment,null,He.COMMON.TRANSCRIPTION)},React.createElement(y.R,{name:"module_transcription",label:He.COMMON.ENABLE,value:"1",checked:H,description:He.COMMON.TRANSCRIPTION_HELP,onChange:Qe})),pt=React.createElement(p.d,{title:React.createElement(React.Fragment,null,He.COMMON.EMBEDDINGS)},React.createElement(y.R,{name:"module_embeddings",label:He.COMMON.ENABLE,value:"1",checked:U,requirePro:!0,isPro:A,description:He.COMMON.EMBEDDINGS_HELP,onChange:Qe})),ht=React.createElement(p.d,{title:React.createElement(React.Fragment,null,He.COMMON.ASSISTANTS,React.createElement("small",{style:{position:"relative",top:-3,fontSize:8}}," BETA"))},React.createElement(y.R,{name:"module_assistants",label:He.COMMON.ENABLE,value:"1",checked:B,requirePro:!0,isPro:A,description:React.createElement(React.Fragment,null,React.createElement(Ot,{disabled:!B,style:{marginRight:3}}),He.HELP.ASSISTANTS),onChange:Qe})),yt=React.createElement(p.d,{title:He.COMMON.CHATBOT},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"module_chatbots",label:He.COMMON.ENABLE,value:"1",checked:W,description:He.COMMON.CHATBOT_HELP,onChange:Qe}))),vt=React.createElement(p.d,{title:He.COMMON.QUERIES_DATA},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"statistics_data",label:He.COMMON.ENABLE,value:"1",checked:ge,description:He.HELP.QUERIES_DATA,onChange:Qe}))),gt=React.createElement(p.d,{title:He.COMMON.QUERIES_FORMS_DATA},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"statistics_forms_data",label:He.COMMON.ENABLE,value:"1",checked:Ee,description:He.HELP.QUERIES_FORMS_DATA,onChange:Qe}))),Et=React.createElement(p.d,{title:He.COMMON.INTRO_MESSAGE},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"intro_message",label:He.COMMON.ENABLE,value:"1",checked:be,description:He.HELP.INTRO_MESSAGE,onChange:Qe}))),bt=React.createElement(p.d,{title:He.COMMON.ADDONS},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"module_addons",label:He.COMMON.ENABLE,value:"1",checked:Ne,description:He.HELP.ADDONS,onChange:Qe}))),wt=React.createElement(p.d,{title:He.COMMON.CHATBOT_SELECT},React.createElement(we.u,{scrolldown:!0,name:"chatbot_select",value:null==o?void 0:o.chatbot_select,onChange:Qe,description:He.HELP.CHATBOT_SELECT},React.createElement(we.j,{key:"tabs",value:"tabs",label:He.COMMON.TABS}),React.createElement(we.j,{key:"dropdown",value:"dropdown",label:He.COMMON.DROPDOWN}))),Rt=React.createElement(p.d,{title:He.COMMON.WEBSPEECH_API},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"speech_recognition",label:He.COMMON.SPEECH_RECOGNITION,value:"1",checked:he,description:He.HELP.SPEECH_RECOGNITION,onChange:Qe})),React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"speech_synthesis",label:He.COMMON.SPEECH_SYNTHESIS+" (SOON)",value:"1",disabled:!0,checked:ye,description:He.HELP.SPEECH_SYNTHESIS,onChange:Qe}))),_t=React.createElement(p.d,{title:He.COMMON.VIRTUAL_KEYBOARD},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"virtual_keyboard_fix",label:He.COMMON.FIX,value:"1",checked:fe,description:He.HELP.VIRTUAL_KEYBOARD,onChange:Qe}))),xt=React.createElement(p.d,{title:He.COMMON.GDPR_CONSENT},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"chatbot_gdpr_consent",label:He.COMMON.ENABLE,value:"1",checked:me,description:He.HELP.GDPR_CONSENT,onChange:Qe}))),St=React.createElement(p.d,{title:He.COMMON.GDPR_TEXT},React.createElement(Re.A,{name:"chatbot_gdpr_text",value:de,onBlur:Qe})),Tt=React.createElement(p.d,{title:He.COMMON.GDPR_BUTTON},React.createElement(Re.A,{name:"chatbot_gdpr_button",value:pe,onBlur:Qe})),Nt=React.createElement(p.d,{title:He.COMMON.STREAMING},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"ai_streaming",label:He.COMMON.ENABLE,value:"1",checked:oe,description:He.HELP.STREAMING,onChange:Qe}))),Ct=React.createElement(p.d,{title:He.SETTINGS.TYPEWRITER_EFFECT},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"chatbot_typewriter",label:He.COMMON.ENABLE,value:"1",checked:ue,description:(0,O.FE)(He.SETTINGS.TYPEWRITER_EFFECT_HELP),onChange:Qe}))),It=React.createElement(p.d,{title:He.COMMON.DISCUSSIONS},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"chatbot_discussions",label:He.COMMON.ENABLE,value:"1",checked:se,description:He.HELP.DISCUSSIONS,onChange:Qe}))),At=React.createElement(p.d,{title:He.COMMON.SYNTAX_HIGHLIGHT},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"syntax_highlight",label:He.COMMON.ENABLE,value:"1",checked:ce,description:He.HELP.SYNTAX_HIGHLIGHT,onChange:Qe}))),kt=React.createElement(p.d,{title:He.COMMON.PUBLIC_API},React.createElement(y.R,{name:"public_api",label:He.COMMON.ENABLE,value:"1",checked:ve,description:He.HELP.PUBLIC_API,onChange:Qe})),Lt=React.createElement(p.d,{title:He.COMMON.BEARER_TOKEN},React.createElement(Re.A,{name:"public_api_bearer_token",value:null==o?void 0:o.public_api_bearer_token,description:(0,O.FE)(He.HELP.BEARER_TOKEN),onBlur:Qe})),Mt=React.createElement(p.d,{title:"Local Upload"},React.createElement(we.u,{scrolldown:!0,name:"image_local_upload",value:null==o?void 0:o.image_local_upload,onChange:Qe,description:"Files can be stored either in the filesystem or the Media Library."},React.createElement(we.j,{key:"uploads",value:"uploads",label:"Filesystem"}),React.createElement(we.j,{key:"library",value:"library",label:"Media Library"}))),Pt=React.createElement(p.d,{title:"Remote Upload"},React.createElement(we.u,{scrolldown:!0,name:"image_remote_upload",value:null==o?void 0:o.image_remote_upload,onChange:Qe,description:"Select Upload Data for private sites; Share URLs requires your WordPress to be online and reachable."},React.createElement(we.j,{key:"data",value:"data",label:"Upload Data"}),React.createElement(we.j,{key:"url",value:"url",label:"Share URLs"}))),jt=React.createElement(p.d,{title:"Expiration"},React.createElement(we.u,{scrolldown:!0,name:"image_expires",value:null!==(t=null==o?void 0:o.image_expires)&&void 0!==t?t:"never",onChange:Qe,description:"Uploaded files will be deleted after a certain amount of time. This also affects files uploaded to OpenAI via the Assistants."},React.createElement(we.j,{key:300,value:300,label:"5 minutes"}),React.createElement(we.j,{key:3600,value:3600,label:"1 hour"}),React.createElement(we.j,{key:21600,value:21600,label:"6 hours"}),React.createElement(we.j,{key:86400,value:86400,label:"1 day"}),React.createElement(we.j,{key:604800,value:604800,label:"1 week"}),React.createElement(we.j,{key:2592e3,value:2592e3,label:"1 month"}),React.createElement(we.j,{key:"Never",value:"never",label:"Never"}))),Ft=React.createElement(p.d,{title:"Local Download"},React.createElement(we.u,{scrolldown:!0,name:"image_local_download",value:null!==(n=null==o?void 0:o.image_local_download)&&void 0!==n?n:null,onChange:Qe,description:"Files can be stored either in the filesystem or the Media Library."},React.createElement(we.j,{key:null,value:null,label:"None"}),React.createElement(we.j,{key:"uploads",value:"uploads",label:"Filesystem"}),React.createElement(we.j,{key:"library",value:"library",label:"Media Library"}))),Dt=React.createElement(p.d,{title:"Expiration"},React.createElement(we.u,{scrolldown:!0,name:"image_expires_download",value:null!==(r=null==o?void 0:o.image_expires_download)&&void 0!==r?r:"never",onChange:Qe,description:"Downloaded files will be deleted after a certain amount of time."},React.createElement(we.j,{key:300,value:300,label:"5 minutes"}),React.createElement(we.j,{key:3600,value:3600,label:"1 hour"}),React.createElement(we.j,{key:21600,value:21600,label:"6 hours"}),React.createElement(we.j,{key:86400,value:86400,label:"1 day"}),React.createElement(we.j,{key:604800,value:604800,label:"1 week"}),React.createElement(we.j,{key:2592e3,value:2592e3,label:"1 month"}),React.createElement(we.j,{key:"Never",value:"never",label:"Never"}))),Gt=React.createElement(p.d,{title:He.COMMON.DEV_TOOLS},React.createElement(y.R,{name:"module_devtools",label:He.COMMON.ENABLE,value:"1",checked:z,description:He.HELP.DEV_TOOLS,onChange:Qe})),Bt=React.createElement(p.d,{title:He.COMMON.SHORTCODES},React.createElement(y.R,{name:"resolve_shortcodes",label:He.COMMON.RESOLVE,value:"1",checked:Le,description:He.HELP.RESOLVE_SHORTCODE,onChange:Qe})),Ht=React.createElement(p.d,{title:He.COMMON.CONTEXT_MAX_LENGTH},React.createElement(Re.A,{name:"context_max_length",value:Ce,type:"number",step:"1",description:He.HELP.CONTEXT_MAX_LENGTH,onBlur:Qe})),Yt=React.createElement(p.d,{title:He.COMMON.BANNED_WORDS},React.createElement(Re.A,{id:"banned_words",name:"banned_words",value:Ae,isCommaSeparatedArray:!0,description:He.HELP.BANNED_WORDS,onBlur:Qe})),zt=React.createElement(p.d,{title:He.COMMON.MODEL},React.createElement(we.u,{scrolldown:!0,name:"ai_default_model",value:q,onChange:Qe},Pe.map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})})))),Wt=React.createElement(p.d,{title:He.COMMON.MODEL},React.createElement(we.u,{scrolldown:!0,name:"ai_embeddings_default_model",value:J,onChange:Qe},Be.map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})})))),Vt=React.createElement(p.d,{title:He.COMMON.DIMENSIONS},React.createElement(we.u,{scrolldown:!0,name:"ai_embeddings_default_dimensions",value:(null==o?void 0:o.ai_embeddings_default_dimensions)||null,onChange:Qe},null==Ye?void 0:Ye.dimensions.map((function(e,t){return React.createElement(we.j,{key:e,value:e,label:t===Ye.dimensions.length-1?"".concat(e," (Default)"):e})})),React.createElement(we.j,{key:null,value:null,label:"Not Set"}))),Kt=React.createElement(p.d,{title:He.COMMON.MODEL},React.createElement(we.u,{scrolldown:!0,name:"ai_vision_default_model",value:$,onChange:Qe},je.map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})})))),qt=React.createElement(p.d,{title:He.COMMON.MODEL},React.createElement(we.u,{scrolldown:!0,name:"ai_audio_default_model",value:ne,onChange:Qe},Fe.map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})})))),Xt=React.createElement(p.d,{title:He.COMMON.MODEL},React.createElement(we.u,{scrolldown:!0,name:"ai_json_default_model",value:ae,onChange:Qe},De.map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})})))),$t=React.createElement(p.d,{title:He.COMMON.MODEL},React.createElement(we.u,{scrolldown:!0,name:"ai_images_default_model",value:ee,onChange:Qe},Ue.map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})})))),Qt=React.createElement(p.d,{title:He.COMMON.BANNED_IPS},React.createElement(Re.A,{id:"banned_ips",name:"banned_ips",value:Ie,isCommaSeparatedArray:!0,description:He.HELP.BANNED_IPS,onBlur:Qe})),Jt=React.createElement(p.d,{title:He.COMMON.PLAYGROUND},React.createElement(y.R,{label:He.COMMON.ENABLE,value:"1",checked:null==ke?void 0:ke.playground,onChange:function(e){var t=Zu(Zu({},ke),{},{playground:e});Qe(t,"admin_bar")}})),Zt=React.createElement(p.d,{title:He.COMMON.GENERATE_CONTENT},React.createElement(y.R,{label:He.COMMON.ENABLE,value:"1",checked:null==ke?void 0:ke.content_generator,onChange:function(e){var t=Zu(Zu({},ke),{},{content_generator:e});Qe(t,"admin_bar")}})),en=React.createElement(p.d,{title:He.COMMON.GENERATE_IMAGES},React.createElement(y.R,{label:He.COMMON.ENABLE,value:"1",checked:null==ke?void 0:ke.images_generator,onChange:function(e){var t=Zu(Zu({},ke),{},{images_generator:e});Qe(t,"admin_bar")}})),tn=React.createElement(p.d,{title:"AI Engine"},React.createElement(y.R,{label:He.COMMON.ENABLE,value:"1",checked:null==ke?void 0:ke.settings,onChange:function(e){var t=Zu(Zu({},ke),{},{settings:e});Qe(t,"admin_bar")}})),nn=React.createElement("div",null,React.createElement(ba,{options:o}),React.createElement("div",{style:{fontSize:12,marginTop:15,lineHeight:1.3,color:"#666"}},(0,O.FE)(He.COMMON.USAGE_HELP))),rn=as((function(){return Ke>0?React.createElement(Oe.z,{style:{marginLeft:5,marginRight:-5,display:"inline"},width:"16",icon:"alert",variant:"warning"}):React.createElement(Oe.z,{style:{marginLeft:5,marginRight:-5,display:"inline"},width:"16",icon:"alert",variant:"success"})}),[Ke]),an=React.createElement(React.Fragment,null,React.createElement(_e.g,{height:5}),React.createElement(p.d,{title:He.COMMON.ENVIRONMENT},React.createElement(we.u,{scrolldown:!0,name:"ai_default_env",value:K,onChange:Qe},V.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})}))))),on=React.createElement(React.Fragment,null,React.createElement(_e.g,{height:5}),React.createElement(p.d,{title:He.COMMON.ENVIRONMENT},React.createElement(we.u,{scrolldown:!0,name:"ai_embeddings_default_env",value:Q,onChange:Qe},V.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})}))))),ln=React.createElement(React.Fragment,null,React.createElement(_e.g,{height:5}),React.createElement(p.d,{title:He.COMMON.ENVIRONMENT},React.createElement(we.u,{scrolldown:!0,name:"ai_vision_default_env",value:X,onChange:Qe},V.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})}))))),cn=React.createElement(React.Fragment,null,React.createElement(_e.g,{height:5}),React.createElement(p.d,{title:He.COMMON.ENVIRONMENT},React.createElement(we.u,{scrolldown:!0,name:"ai_audio_default_env",value:te,onChange:Qe},V.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})}))))),un=React.createElement(React.Fragment,null,React.createElement(_e.g,{height:5}),React.createElement(p.d,{title:He.COMMON.ENVIRONMENT},React.createElement(we.u,{scrolldown:!0,name:"ai_json_default_env",value:re,onChange:Qe},V.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})}))))),sn=React.createElement(React.Fragment,null,React.createElement(_e.g,{height:5}),React.createElement(p.d,{title:He.COMMON.ENVIRONMENT},React.createElement(we.u,{scrolldown:!0,name:"ai_images_default_env",value:Z,onChange:Qe},V.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})}))))),fn=React.createElement(we.u,{scrolldown:!0,name:"embeddings_default_env",value:le,onChange:Qe},ie.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})}))),pn=React.createElement(p.d,{title:He.COMMON.PLUGIN_DATA},React.createElement(h.E,{max:"1"},React.createElement(y.R,{name:"clean_uninstall",label:He.COMMON.DELETE_ALL,description:He.COMMON.PLUGIN_DATA_DESCRIPTION,value:"1",checked:Me,onChange:Qe})));return React.createElement(v.z,null,React.createElement(Ut,{options:o}),React.createElement(E.N,null,React.createElement(E.Y,{fullWidth:!0},React.createElement(st,{options:o}),be&&React.createElement(xe.L,null,(0,O.FE)(He.SETTINGS.INTRO)),React.createElement(b._,{keepTabOnReload:!0},React.createElement(b.V,{key:"dashboard",title:He.COMMON.DASHBOARD},React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(R.z,{busy:qe,title:He.COMMON.CLIENT_MODULES,className:"primary"},React.createElement("p",null,He.SETTINGS.MODULES_INTRO),React.createElement(_e.g,null),yt,lt),React.createElement(R.z,{busy:qe,title:He.COMMON.SERVER_MODULES,className:"primary"},React.createElement("p",null,He.SETTINGS.MODULES_INTRO),React.createElement(_e.g,null),ut,pt,ct,mt,ht),React.createElement(R.z,{busy:qe,title:He.COMMON.BACKEND_MODULES,className:"primary"},React.createElement("p",null,He.SETTINGS.MODULES_INTRO),React.createElement(_e.g,null),at,ot,it,rt,dt)),React.createElement(E.Y,{minimal:!0},React.createElement(R.z,{busy:qe,title:He.COMMON.USAGE,className:"primary"},nn)))),W&&React.createElement(b.V,{key:"chatbots",title:He.COMMON.CHATBOTS},React.createElement(fc,{options:o,updateOption:Qe,busy:qe})),W&&se&&React.createElement(b.V,{key:"discussions",title:He.COMMON.DISCUSSIONS},React.createElement(co,null)),P&&React.createElement(b.V,{key:"queries",title:He.COMMON.QUERIES},React.createElement(zc,{options:o,updateOption:Qe,busy:qe})),U&&React.createElement(b.V,{key:"embeddings",title:He.COMMON.EMBEDDINGS},React.createElement(fa,{options:o,updateEnvironment:Je,updateOption:Qe})),B&&React.createElement(b.V,{key:"assistants",title:He.COMMON.ASSISTANTS},React.createElement(Uu,{options:o,updateOption:Qe,refreshOptions:Xe})),M&&React.createElement(b.V,{key:"finetunes",title:He.COMMON.FINETUNES},React.createElement(tr,{options:o,updateOption:Qe,refreshOptions:Xe})),G&&React.createElement(b.V,{key:"moderation",title:He.COMMON.MODERATION},React.createElement(dr,{options:o,updateOption:Qe,busy:qe})),H&&React.createElement(b.V,{key:"transcription",title:He.COMMON.TRANSCRIPTION},React.createElement(Ou,{options:o,updateOption:Qe})),Y&&React.createElement(b.V,{key:"addons",title:He.COMMON.ADDONS},React.createElement(Ku,{addons:null==o?void 0:o.addons,updateOption:Qe})),React.createElement(b.V,{key:"settings",title:He.COMMON.SETTINGS},React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(pu,{busy:qe,options:o,environments:V,updateEnvironment:Ze,updateOption:Qe}),React.createElement("div",{style:{padding:"0px 10px 15px 10px",marginTop:13,marginBottom:5}},React.createElement(d.s,{h2:!0,style:{color:"white",marginBottom:15}},He.COMMON.AI_ENVIRONMENT_DEFAULTS),React.createElement(b._,{inversed:!0},React.createElement(b.V,{key:"ai",title:He.COMMON.DEFAULT,busy:qe},an,zt),React.createElement(b.V,{key:"vision",title:He.COMMON.VISION,busy:qe},ln,Kt),React.createElement(b.V,{key:"images",title:He.COMMON.IMAGES,busy:qe},sn,$t),React.createElement(b.V,{key:"embeddings",title:He.COMMON.EMBEDDINGS,busy:qe},on,Wt,Vt),React.createElement(b.V,{key:"audio",title:He.COMMON.AUDIO,busy:qe},cn,qt),React.createElement(b.V,{key:"json",title:He.COMMON.JSON,busy:qe},un,Xt))),U&&React.createElement(React.Fragment,null,React.createElement(Zc,{busy:qe,options:o,environments:ie,updateEnvironment:Je,updateOption:Qe}),React.createElement(R.z,{busy:qe,title:He.COMMON.EMBEDDINGS_ENVIRONMENT_DEFAULT,className:"primary"},fn)),React.createElement(R.z,{busy:We,title:React.createElement("div",{style:{display:"flex"}},He.COMMON.INCIDENTS_OPENAI,rn),className:"primary",contentStyle:{padding:0}},React.createElement(ir,{incidents:Ve,isLoading:We})),React.createElement(R.z,{busy:qe,title:He.COMMON.MAINTENANCE,className:"primary"},React.createElement(w.M,{className:"blue",onClick:tt},"Export Settings"),React.createElement(w.M,{className:"danger",onClick:nt},"Import Settings"),React.createElement(w.M,{className:"danger",onClick:et},"Reset Settings"))),React.createElement(E.Y,{minimal:!0},React.createElement(R.z,{busy:qe,title:He.COMMON.GENERAL,className:"primary"},Nt),React.createElement(R.z,{busy:qe,title:He.COMMON.USER_INTERFACE,className:"primary"},Et,bt,wt),React.createElement(R.z,{busy:qe,title:He.COMMON.CHATBOT,className:"primary"},It,At,Rt,_t,xt,me&&React.createElement(React.Fragment,null,St,Tt)),P&&React.createElement(R.z,{busy:qe,title:He.COMMON.STATISTICS,className:"primary"},React.createElement("p",null,He.HELP.STATISTICS),vt,gt),React.createElement(R.z,{busy:qe,title:He.COMMON.IMAGES_AND_FILES,className:"primary"},React.createElement("p",null,React.createElement("b",null,"Uploaded by Users")),Mt,Pt,jt,React.createElement("p",null,React.createElement("b",null,"Generated by AI")),Ft,null!==(null==o?void 0:o.image_local_download)&&Dt),React.createElement(R.z,{busy:qe,title:He.COMMON.ADMIN_TOOLS,className:"primary"},React.createElement(Se.Y,{title:He.COMMON.ADMIN_BAR}),tn,Jt,Zt,en),React.createElement(R.z,{busy:qe,title:He.COMMON.ADVANCED,className:"primary"},Bt,Ht,kt,Lt,Gt,pn),React.createElement(R.z,{busy:qe,title:He.COMMON.SECURITY,className:"primary"},Yt,Qt),React.createElement(R.z,{busy:qe,title:He.COMMON.LEGACY_FEATURES,className:"primary"},Ct)))),z&&React.createElement(b.V,{key:"devtools",title:He.COMMON.DEV_TOOLS},React.createElement(Xc,{options:o,setOptions:i,updateOption:Qe})),React.createElement(b.V,{key:"license",title:He.COMMON.LICENSE_TAB},React.createElement(Ge,{domain:x,prefix:_,isPro:I,isRegistered:A}))))),React.createElement(Te.n,{isOpen:c,title:He.COMMON.ERROR,content:c,onRequestClose:function(){return u(!1)},okButton:{label:"Close",onClick:function(){return u(!1)}}}))};var ms=n(6087),ds=[{value:"informative",label:"Informative"},{value:"descriptive",label:"Descriptive"},{value:"creative",label:"Creative"},{value:"narrative",label:"Narrative"},{value:"persuasive",label:"Persuasive"},{value:"reflective",label:"Reflective"},{value:"argumentative",label:"Argumentative"},{value:"analytical",label:"Analytical"},{value:"evaluative",label:"Evaluative"},{value:"journalistic",label:"Journalistic"},{value:"technical",label:"Technical"}],ps=[{value:"neutral",label:"Neutral"},{value:"formal",label:"Formal"},{value:"assertive",label:"Assertive"},{value:"cheerful",label:"Cheerful"},{value:"humorous",label:"Humorous"},{value:"informal",label:"Informal"},{value:"inspirational",label:"Inspirational"},{value:"professional",label:"Professional"},{value:"confluent",label:"Confluent"},{value:"emotional",label:"Emotional"},{value:"persuasive",label:"Persuasive"},{value:"supportive",label:"Supportive"},{value:"sarcastic",label:"Sarcastic"},{value:"condescending",label:"Condescending"},{value:"skeptical",label:"Skeptical"},{value:"narrative",label:"Narrative"},{value:"journalistic",label:"Journalistic"}],hs="gpt-3.5-turbo",ys=[{id:"default",name:"Default",mode:"query",model:hs,temperature:.8,stopSequence:"",maxTokens:2048,prompt:""},{id:"article_translator",name:"Text Translator",mode:"query",model:hs,temperature:.3,stopSequence:"",maxTokens:2048,prompt:"Translate this article into French:\n\nUchiko is located in Ehime prefecture, in the west of the island. The town was prosperous at the end of the 19th century thanks to its production of very good quality white wax. This economic boom allowed wealthy local merchants to build beautiful properties, whose heritage is still visible throughout the town.\n"},{id:"restaurant_review",name:"Restaurant Review Writer",mode:"query",model:hs,temperature:.8,stopSequence:"",maxTokens:2048,prompt:"Write a review for a French restaurant located in Kagurazaka, Tokyo. Looks like an old restaurant, food is traditional, chef is talkative, it is always full. Not expensive, but not fancy.\n"},{id:"article_corrector",name:"Text Corrector",mode:"query",model:hs,temperature:.2,stopSequence:"",maxTokens:2048,prompt:"Fix the grammar and spelling mistakes in this text:\n\nI wake up at eleben yesderday, I will go bed eary tonigt.\n"},{id:"seo_assistant",name:"SEO Optimizer",mode:"query",model:hs,temperature:.6,stopSequence:"",maxTokens:1024,prompt:"For the following article, write a SEO-friendly and short title, keywords for Google, and a short excerpt to introduce it. Use this format:\n\nTitle: \nKeywords: \nExcerpt:\n\nArticle:\nUchiko is located in Ehime prefecture, in the west of the island. The town was prosperous at the end of the 19th century thanks to its production of very good quality white wax. This economic boom allowed wealthy local merchants to build beautiful properties, whose heritage is still visible throughout the town."}],vs=[{id:"default",name:"Default",model:"dall-e-3",maxResults:1,prompt:""},{id:"japan",name:"Ghibli Scene",model:"dall-e-3",maxResults:1,prompt:"Create an image in the style of a Ghibli-inspired anime oil painting, depicting a quaint, old house in the Japanese countryside. This house, reminiscent of a traditional izakaya, is surrounded by lush trees and overlooks vibrant rice fields. The scene is bathed in the warm, soft glow of a setting sun, casting gentle shadows and creating a tranquil, nostalgic atmosphere. The composition should be rich in texture, capturing the serene beauty of rural Japan in a whimsical, Ghibli-like manner."},{id:"steampunk",name:"Steampunk Architecture",model:"dall-e-3",maxResults:1,prompt:"Create an image showcasing steampunk architecture, focusing on the exterior view of a grand theater. The style should reflect award-winning architectural photography from a science fiction magazine. The theater, a masterpiece of steampunk design, combines Victorian influences with futuristic, mechanical elements. Its intricate facade features exposed gears, brass pipes, and steam vents, all integrated into the ornate, classical structure. The building should be set against a dramatic sky, highlighting its unique features and the interplay of light and shadow, capturing the essence of a high-quality, professional architectural photograph."},{id:"nyao-illustration",name:"Nyao Illustration",model:"dall-e-3",maxResults:1,prompt:"The character is an anthropomorphic cat with a whimsical and endearing design, featuring a blend of white and blue fur. The right side of the cat's face has a patch of blue fur that also covers the outer part of the ear, while the left side remains predominantly white, except that the eye is surrounded by a green patch of fur. The tail mirrors this pattern with white fur leading to a blue tip. The character's facial expression is joyous, with a wide, open-mouthed smile showcasing a single front tooth and a small, black nose.  The cat's paws are also white, with defined fingers that suggest human-like dexterity. An orange collar encircles the neck, contrasting with the green and blue tones of the body. This collar is adorned with a blue and white emblem in the center, reminiscent of the WordPress logo. The drawing style of this image can be defined as a digital illustration with a cartoonish and whimsical aesthetic. It features bold outlines, flat colors, and simplified shapes which are typical of contemporary character design aimed at a broad, family-friendly audience. The style is reminiscent of modern vector art, which is often used for web graphics, animation, and media aimed at engaging a casual viewer with its clear, approachable, and vibrant visuals."}],gs=[{id:"default",name:"Default",mode:"single",topic:"",topics:"",topicsAreTitles:!1,title:"",sections:"",model:hs,temperature:.8,maxTokens:2048,sectionsCount:2,paragraphsCount:3,language:"en",customLanguage:"",writingStyle:"creative",writingTone:"cheerful",titlePromptFormat:'Write a title for an article about "{TOPIC}" in {LANGUAGE}. Style: {WRITING_STYLE}. Tone: {WRITING_TONE}. Must be between 40 and 60 characters.',sectionsPromptFormat:'Write {SECTIONS_COUNT} consecutive headings for an article about "{TITLE}", in {LANGUAGE}. Style: {WRITING_STYLE}. Tone: {WRITING_TONE}. Each heading is between 40 and 60 characters. Use Markdown for the headings (## ).',contentPromptFormat:'Write an article about "{TITLE}" in {LANGUAGE}. The article is organized by the following headings:\n\n{SECTIONS}\n\nWrite {PARAGRAPHS_PER_SECTION} paragraphs per heading. Use Markdown for formatting. Add an introduction prefixed by "===INTRO: ", and a conclusion prefixed by "===OUTRO: ". Style: {WRITING_STYLE}. Tone: {WRITING_TONE}.',excerptPromptFormat:'Write an excerpt for an article about "{TITLE}" in {LANGUAGE}. Style: {WRITING_STYLE}. Tone: {WRITING_TONE}. Must be between 40 and 60 characters.'},{id:"",name:"Expore Japan",mode:"single",topic:"Tokyo, its main areas and attractions, one day tour for a first-time visitor. Simple vocabulary, short paragraphs.",topics:"",topicsAreTitles:!1,title:"",sections:"",model:hs,temperature:.8,maxTokens:2048,sectionsCount:3,paragraphsCount:2,language:"en",customLanguage:"",writingStyle:"informative",writingTone:"informal",titlePromptFormat:'Write a title for an article about "{TOPIC}" in {LANGUAGE}. Style: {WRITING_STYLE}. Tone: {WRITING_TONE}. Must be between 40 and 60 characters.',sectionsPromptFormat:'Write {SECTIONS_COUNT} consecutive headings for an article about "{TITLE}", in {LANGUAGE}. Style: {WRITING_STYLE}. Tone: {WRITING_TONE}. Each heading is between 40 and 60 characters. Use Markdown for the headings (## ).',contentPromptFormat:'Write an article about "{TITLE}" in {LANGUAGE}. The article is organized by the following headings:\n\n{SECTIONS}\n\nWrite {PARAGRAPHS_PER_SECTION} paragraphs per heading. Use Markdown for formatting. Add an introduction prefixed by "===INTRO: ", and a conclusion prefixed by "===OUTRO: ". Style: {WRITING_STYLE}. Tone: {WRITING_TONE}.',excerptPromptFormat:'Write an excerpt for an article about "{TITLE}" in {LANGUAGE}. Style: {WRITING_STYLE}. Tone: {WRITING_TONE}. Must be between 40 and 60 characters.'}];function Es(e){return Es="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},Es(e)}function bs(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 ws(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bs(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=Es(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Es(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==Es(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bs(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Rs(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||Ts(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 Os(){Os=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Es(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Es(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 _s(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function xs(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){_s(o,r,a,i,l,"next",e)}function l(e){_s(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Ss(e){return function(e){if(Array.isArray(e))return Ns(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ts(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 Ts(e,t){if(e){if("string"==typeof e)return Ns(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)?Ns(e,t):void 0}}function Ns(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 Cs=wp.element,Is=Cs.useState,As=Cs.useEffect,ks=Cs.useMemo;function Ls(){return(new Date).getTime().toString(36)+Math.random().toString(36).substr(2,9)}var Ms=function(e){var t=Ss(e);return t.sort((function(e,t){return e.name.localeCompare(t.name)})),t},Ps=function(){var e=xs(Os().mark((function e(t){var n,r,a;return Os().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,O.IU)("".concat(T,"/system/templates?category=").concat(t),{nonce:k});case 3:return n=e.sent,r=[],"imagesGenerator"===t?r=vs:"playground"===t?r=ys:"contentGenerator"===t&&(r=gs),a=r.find((function(e){return"default"===e.id})),null!=n&&n.templates&&n.templates.length>0&&(r=Ms(n.templates)),a?r.forEach((function(e){Object.keys(a).forEach((function(t){void 0===e[t]&&(e[t]=a[t])}))})):console.warn("Default template not found for category: "+t),e.abrupt("return",r);case 12:e.prev=12,e.t0=e.catch(0),console.error(e.t0),alert(e.t0.message);case 16:case"end":return e.stop()}}),e,null,[[0,12]])})));return function(t){return e.apply(this,arguments)}}();const js=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"playground",t=Rs(Is(),2),n=t[0],r=t[1],a=Rs(Is(!1),2),o=a[0],i=a[1],l=Rs(Is([]),2),c=l[0],u=l[1],s=(0,f.I)({queryKey:["templates-".concat(e)],queryFn:function(){return Ps(e)}}),m=s.isLoading,d=s.data;As((function(){for(var t=0;t<c.length;t++){var n=c[t],r=!1;if(n&&(!n.envId||!n.model)){var a=(null==L?void 0:L.ai_default_env)||null,o=(null==L?void 0:L.ai_default_model)||null;"imagesGenerator"===e&&(o="dall-e-3-hd"),a&&o&&(n.envId=a,n.model=o,r=!0)}r&&u(Ss(c))}}),[c]),As((function(){d&&(u(d),r(d[0]))}),[d]);var p=function(){var t=xs(Os().mark((function t(n){var r;return Os().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Ms(n),u(n),t.prev=2,t.next=5,(0,O.IU)("".concat(T,"/system/templates"),{method:"POST",nonce:k,json:{category:e,templates:n}});case 5:return r=t.sent,t.abrupt("return",r);case 9:t.prev=9,t.t0=t.catch(2),console.error(t.t0),alert(t.t0.message);case 13:case"end":return t.stop()}}),t,null,[[2,9]])})));return function(e){return t.apply(this,arguments)}}(),h=ks((function(){if(!n||0===c.length)return!1;if(Object.keys(n).length!==Object.keys(c.find((function(e){return e.id===n.id}))).length)return!0;var e=c.find((function(e){return e.id===n.id}));return Object.keys(e).some((function(t){return e[t]!==n[t]}))}),[n,c]),y=function(){var e=c.find((function(e){return e.id===n.id}));e&&r(ws({},e))},v=function(){var e=prompt(He.COMMON.NAME,n.name||He.TEMPLATES.NEW_TEMPLATE_NAME);if(!e)return!1;var t=ws(ws({},n),{},{id:Ls(),name:e});p([].concat(Ss(c),[t])),r(ws({},t))},g=function(){var e=c.map((function(e){return e.id===n.id?n:e}));p(e),r(ws({},n))},E=function(){var e=prompt("Template Name",n.name),t=ws(ws({},c[0]),{},{id:Ls(),name:e});p([].concat(Ss(c),[t])),r(ws({},t))},b=function(){var e=prompt("Template Name",n.name);if(e){var t=c.map((function(t){return t.id===n.id?ws(ws({},t),{},{name:e}):t}));p(Ss(t)),r(ws({},t.find((function(e){return e.id===n.id}))))}},R=function(){if(confirm(He.TEMPLATES.DELETE_ALL_CONFIRM)){var t=[];"imagesGenerator"===e?t=Ss(vs):"playground"===e?t=Ss(ys):"contentGenerator"===e&&(t=Ss(gs)),p(t),r(ws({},t[0]))}},_=ks((function(){return h&&n&&"default"!==n.id}),[h,n]),x=ks((function(){return n&&"default"!==n.id}),[n]),S=ks((function(){return n&&"default"!==n.id}),[n]),N=ks((function(){return React.createElement("div",{style:{margin:"0"}},React.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},React.createElement("h3",{style:{margin:0}},He.TEMPLATES.TEMPLATE),React.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},React.createElement(Xt.S,{small:!0,onLabel:He.TEMPLATES.EDIT,offLabel:He.TEMPLATES.EDIT,width:60,onChange:i,checked:o}))),m&&React.createElement("div",{style:{display:"flex",marginTop:30,justifyContent:"center"}},React.createElement("div",{style:{width:60}},React.createElement(ms.X,{width:20}))),React.createElement(_e.g,null),o&&React.createElement(React.Fragment,null,React.createElement("div",{style:{display:"flex"}},React.createElement(w.M,{className:"primary",style:{flex:3},onClick:E},"New"),React.createElement(w.M,{onClick:v,style:{flex:1}},"Duplicate")),React.createElement(_e.g,{tiny:!0})),React.createElement(we.u,{scrolldown:!0,name:"template",value:null==n?void 0:n.id,onChange:function(e){var t=c.find((function(t){return t.id===e}));r(ws({},t))}},c.filter((function(e){return"default"!==e.id})).map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})}))),(h||o)&&React.createElement("div",null,React.createElement(_e.g,{tiny:!0}),React.createElement("div",{style:{display:"flex"}},React.createElement(w.M,{className:"secondary",style:{flex:1},disabled:!_,onClick:y},"Reset"),React.createElement(w.M,{className:"primary",style:{flex:3},disabled:!_,onClick:g},"Save")),o&&React.createElement(React.Fragment,null,React.createElement(_e.g,{tiny:!0}),React.createElement("div",{style:{display:"flex"}},React.createElement(w.M,{small:!0,className:"danger",style:{flex:1},disabled:!S,onClick:function(){return function(e){if(confirm(He.TEMPLATES.DELETE_CONFIRM)){var t=c.filter((function(t){return t.id!==e.id}));p(Ss(t)),r(ws({},t[0]))}}(n)}},"Delete"),React.createElement(w.M,{small:!0,className:"secondary",style:{flex:3},disabled:!x,onClick:b},"Rename")))),o&&React.createElement(React.Fragment,null,React.createElement(_e.g,null),React.createElement("div",{style:{display:"flex"}},React.createElement(w.M,{className:"danger",style:{flex:1},onClick:R},"Reset All Templates"))))}),[c,n,o,h,_,m]);return{template:n,clearTemplate:y,setTemplate:function(e){r(e)},jsxTemplates:N,isEdit:o}};function Fs(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ds(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)?Ds(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 Ds(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 Gs=wp.element,Us=Gs.useState,Bs=Gs.useMemo;const Hs=function(e){var t=Fs(Us(0),2),n=t[0],r=t[1],a=Fs(Us(0),2),o=a[0],i=a[1],l=function(){r(0),i(0)};return{addUsage:function(t,a,o){var l=e(t,a,o);i(l),r(n+l)},jsxUsageCosts:Bs((function(){var e=(0,O.FE)(He.COMMON.USAGE_HELP);return A||(e=React.createElement(React.Fragment,null,e," ",(0,O.FE)(He.COMMON.USAGE_PRO_HELP))),React.createElement(po,null,React.createElement("h3",null,He.COMMON.USAGE),React.createElement("div",null,"Session: ",React.createElement("span",{style:{float:"right"}},"$",n.toFixed(4))),React.createElement("div",null,"Last Request: ",React.createElement("span",{style:{float:"right"}},"$",o.toFixed(4))),React.createElement(_e.g,{height:30}),React.createElement("p",{style:{fontSize:12,lineHeight:1.2,color:"var(--neko-dark-gray)"}},e),React.createElement(w.M,{fullWidth:!0,onClick:l},"Reset Usage"))}),[n,o])}};function Ys(e){return Ys="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},Ys(e)}var zs;function Ws(){Ws=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Ys(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Ys(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Vs(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Ks(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 qs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ks(Object(n),!0).forEach((function(t){Xs(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ks(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Xs(e,t,n){var r;return r=function(e,t){if("object"!=Ys(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ys(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==Ys(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $s(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Qs(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)?Qs(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 Qs(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 Js=wp.element,Zs=Js.useState,ef=Js.useEffect,tf=(0,G.Ay)(Wt.m)(zs||(zs=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n  .neko-textarea-container {\n  \n    textarea {\n      color: white;\n      font-size: 13px;\n      padding: 10px;\n      font-family: monospace;\n      background: #333d4e;\n      border: none;\n\n      &:focus {\n        background-color: #333d4e;\n      }\n    }\n  }\n"])));const nf=function(){var e,t,n,r,a,o,i,l=js("playground"),c=l.template,u=l.setTemplate,s=l.jsxTemplates,f=$s(Zs(""),2),m=f[0],p=f[1],h=$s(Zs(!1),2),y=h[0],g=h[1],b=$s(Zs(""),2),R=b[0],_=b[1],x=$s(Zs(),2),S=x[0],N=x[1],C=$s(Zs(),2),I=C[0],A=C[1],P=null!==(e=null==c?void 0:c.prompt)&&void 0!==e?e:"",F=null!==(t=null==c?void 0:c.model)&&void 0!==t?t:"gpt-3.5-turbo",D=null!==(n=null==c?void 0:c.mode)&&void 0!==n?n:"query",G=null!==(r=null==c?void 0:c.temperature)&&void 0!==r?r:1,U=null!==(a=null==c?void 0:c.envId)&&void 0!==a?a:"",B=null!==(o=null==c?void 0:c.stopSequence)&&void 0!==o?o:"",H=null!==(i=null==c?void 0:c.maxTokens)&&void 0!==i?i:2048,Y=ft(L,U||null),z=Y.calculatePrice,W=Y.completionModels,V=Hs(z),K=V.addUsage,q=V.jsxUsageCosts,X=(null==L?void 0:L.ai_envs)||[],$=function(e,t){u(qs(qs({},c),{},Xs({},t,e)))},Q=function(e){u(qs(qs({},c),{},{prompt:e}))};ef((function(){c&&p("")}),[c]);var J=function(){var e,t=(e=Ws().mark((function e(){var t,n,r,a,o,i,l,c=arguments;return Ws().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=c.length>0&&void 0!==c[0]?c[0]:P,g(!0),N(new Date),e.prev=3,a=B.replace(/\\n/g,"\n"),o=j?function(e){p(e)}:null,e.next=8,(0,Lo.ti)("".concat(T,"/ai/completions"),{scope:"playground",session:M,message:t,temperature:G,envId:U,model:F,maxTokens:H,stop:a,stream:j},k,j);case 8:return i=e.sent,e.next=12,(0,Lo.Pn)(i,o,null);case 12:if(!1!==(null==(l=e.sent)?void 0:l.success)){e.next=15;break}throw new Error(null==l?void 0:l.message);case 15:console.log("Completions",{prompt:t,result:l}),"continuous"===D?Q(t+"\n"+l.data+"\n"):p(l.data),K(F,(null==l||null===(n=l.usage)||void 0===n?void 0:n.prompt_tokens)||0,(null==l||null===(r=l.usage)||void 0===r?void 0:r.completion_tokens)||0),e.next=23;break;case 20:e.prev=20,e.t0=e.catch(3),A(e.t0.message);case 23:N(),g(!1);case 25:case"end":return e.stop()}}),e,null,[[3,20]])})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Vs(o,r,a,i,l,"next",e)}function l(e){Vs(o,r,a,i,l,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}();return React.createElement(v.z,{nekoErrors:[]},React.createElement(Ut,{title:He.COMMON.PLAYGROUND}),React.createElement(E.N,null,React.createElement(E.Y,{fullWidth:!0},React.createElement(st,{options:L}),React.createElement(xe.L,{style:{marginBottom:0}},React.createElement(d.s,{p:!0},(0,O.FE)(He.PLAYGROUND.INTRO)))),React.createElement(E.Y,null,React.createElement(po,null,s)),React.createElement(E.Y,{style:{flex:3}},React.createElement(po,null,"continuous"!==D&&React.createElement(React.Fragment,null,React.createElement(tf,{rows:12,onChange:Q,value:P})),"continuous"===D&&React.createElement(React.Fragment,null,React.createElement(tf,{rows:18,onChange:Q,value:P}),React.createElement("div",{style:{display:"flex"}},React.createElement("span",{className:"dashicons dashicons-format-continuous",style:{position:"absolute",color:"white",zIndex:200,fontSize:28,marginTop:12,marginLeft:10}}),React.createElement(ho,{name:"continuousEntry",value:R,onChange:_,onEnter:function(){var e=P+"Human: "+R;Q(e),_(""),J(e)},disabled:y})))),React.createElement(_e.g,null),(m||y)&&React.createElement(po,null,React.createElement(Lo.CI,{content:m,isStreaming:j&&y}))),React.createElement(E.Y,null,"query"===D&&React.createElement(React.Fragment,null,React.createElement(po,null,React.createElement(w.M,{fullWidth:!0,onClick:function(){J()},isBusy:y,startTime:S,style:{height:50,fontSize:14,flex:4}},He.COMMON.SUBMIT)),React.createElement(_e.g,null)),React.createElement(po,null,React.createElement("h3",null,He.COMMON.SETTINGS),React.createElement("label",null,He.COMMON.ENVIRONMENT,":"),React.createElement(we.u,{scrolldown:!0,name:"envId",value:null!=U?U:"",onChange:$},X.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})})),React.createElement(we.j,{value:"",label:"None"})),React.createElement("label",null,He.COMMON.MODEL,":"),React.createElement(we.u,{name:"model",value:F,scrolldown:!0,onChange:$},W.map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})}))),React.createElement("label",null,He.COMMON.TEMPERATURE,":"),React.createElement(Re.A,{name:"temperature",value:G,type:"number",onChange:function(e){return $(parseFloat(e),"temperature")},description:React.createElement(React.Fragment,null,React.createElement("span",{style:{color:G>=0&&G<=1?"inherit":"red"}},He.HELP.TEMPERATURE))}),React.createElement("label",null,He.COMMON.MAX_TOKENS,":"),React.createElement(Re.A,{name:"maxTokens",value:H,type:"number",onChange:function(e){return $(parseInt(e),"maxTokens")},description:React.createElement(React.Fragment,null,React.createElement("span",null,He.HELP.MAX_TOKENS))}),React.createElement("label",null,He.COMMON.STOP_SEQUENCE,":"),React.createElement(Re.A,{name:"stopSequence",value:B,type:"text",onChange:$,description:React.createElement(React.Fragment,null,React.createElement("span",null,He.HELP.STOP_SEQUENCE))})),React.createElement(_e.g,null),q)),React.createElement(Te.n,{isOpen:I,onRequestClose:function(){A()},okButton:{onClick:function(){A()}},title:"Error",content:React.createElement("p",null,I)}))};var rf,af;function of(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var lf=G.Ay.div(rf||(rf=of(["\n  margin-bottom: 5px;\n"]))),cf=G.Ay.div(af||(af=of(["\n  margin-top: 5px;\n  padding: 10px;\n  font-size: 14px;\n  cursor: pointer;\n  background: #dbf2ff;\n\n  &:hover {\n    background: #037cba;\n    color: white;\n  }\n"])));function uf(e){return uf="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},uf(e)}function sf(){sf=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==uf(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(uf(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 ff(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function mf(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){ff(o,r,a,i,l,"next",e)}function l(e){ff(o,r,a,i,l,"throw",e)}i(void 0)}))}}function df(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return pf(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)?pf(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 pf(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 hf=wp.element,yf=hf.useState,vf=hf.useEffect,gf=hf.useMemo;const Ef=function(e){var t=e.post,n=e.onTitleClick,r=void 0===n?{}:n,a=e.onClose,o=void 0===a?{}:a,i=df(yf([]),2),l=i[0],c=i[1],u=df(yf(!1),2),s=u[0],f=u[1],m=df(yf(!1),2),d=m[0],p=m[1];vf((function(){t&&h(t)}),[t]);var h=function(){var e=mf(sf().mark((function e(t){var n,r,a;return sf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.postId,t.postTitle,f(!0),e.prev=2,e.next=5,(0,O.IU)("".concat(T,"/ai/magic_wand"),{method:"POST",nonce:k,json:{action:"suggestTitles",data:{postId:n}}});case 5:a=e.sent,c(null===(r=a.data)||void 0===r?void 0:r.results),e.next=13;break;case 9:e.prev=9,e.t0=e.catch(2),console.error(e.t0),p(e.t0.message);case 13:f(!1);case 14:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(t){return e.apply(this,arguments)}}(),y=function(){var e=mf(sf().mark((function e(t){return sf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.prev=1,e.next=4,r(t);case 4:v(),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(1),p(e.t0.message);case 10:f(!1);case 11:case"end":return e.stop()}}),e,null,[[1,7]])})));return function(t){return e.apply(this,arguments)}}(),v=function(){var e=mf(sf().mark((function e(){return sf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o(),c([]),p(),f(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),g=gf((function(){return s?React.createElement(ms.X,{type:"circle",size:"10%"}):d?React.createElement(React.Fragment,null,"Error: ",d):(null==l?void 0:l.length)>0?React.createElement(React.Fragment,null,"Pick a new title by clicking on it.",React.createElement(lf,null,l.map((function(e){return React.createElement(cf,{key:e,onClick:function(){y(e)}},e)})))):React.createElement(React.Fragment,null,"Nothing to display.")}),[s,l,d]);return React.createElement(E.N,null,React.createElement(Te.n,{isOpen:t,onRequestClose:v,title:'New title for "'.concat(null==t?void 0:t.postTitle,'"'),content:g,okButton:{label:"Close",onClick:v}}))};function bf(e){return bf="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},bf(e)}function wf(){wf=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==bf(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(bf(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Rf(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Of(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Rf(o,r,a,i,l,"next",e)}function l(e){Rf(o,r,a,i,l,"throw",e)}i(void 0)}))}}function _f(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return xf(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)?xf(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 xf(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 Sf=wp.element,Tf=Sf.useState,Nf=Sf.useEffect,Cf=Sf.useMemo;const If=function(e){var t=e.post,n=e.onExcerptClick,r=void 0===n?{}:n,a=e.onClose,o=void 0===a?{}:a,i=_f(Tf([]),2),l=i[0],c=i[1],u=_f(Tf(!1),2),s=u[0],f=u[1],m=_f(Tf(!1),2),d=m[0],p=m[1];Nf((function(){t&&h(t)}),[t]);var h=function(){var e=Of(wf().mark((function e(t){var n,r,a;return wf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.postId,f(!0),e.prev=2,e.next=5,(0,O.IU)("".concat(T,"/ai/magic_wand"),{method:"POST",nonce:k,json:{action:"suggestExcerpts",data:{postId:n}}});case 5:a=e.sent,c(null===(r=a.data)||void 0===r?void 0:r.results),e.next=13;break;case 9:e.prev=9,e.t0=e.catch(2),console.error(e.t0),p(e.t0.message);case 13:f(!1);case 14:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(t){return e.apply(this,arguments)}}(),y=function(){var e=Of(wf().mark((function e(t){return wf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.prev=1,e.next=4,r(t);case 4:v(),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(1),p(e.t0.message);case 10:f(!1);case 11:case"end":return e.stop()}}),e,null,[[1,7]])})));return function(t){return e.apply(this,arguments)}}(),v=function(){var e=Of(wf().mark((function e(){return wf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o(),c([]),p(),f(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),g=Cf((function(){return s?React.createElement(ms.X,{type:"circle",size:"10%"}):d?React.createElement(React.Fragment,null,"Error: ",d):(null==l?void 0:l.length)>0?React.createElement(React.Fragment,null,"Pick a new excerpt by clicking on it.",React.createElement(lf,null,l.map((function(e){return React.createElement(cf,{key:e,onClick:function(){y(e)}},e)})))):React.createElement(React.Fragment,null,"Nothing to display.")}),[s,l,d]);return React.createElement(E.N,null,React.createElement(Te.n,{isOpen:t,onRequestClose:v,title:'New excerpt for "'.concat(null==t?void 0:t.postTitle,'"'),content:g,okButton:{label:"Close",onClick:v}}))};function Af(e){return Af="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},Af(e)}function kf(){kf=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Af(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Af(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Lf(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Mf(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Lf(o,r,a,i,l,"next",e)}function l(e){Lf(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Pf(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 jf=wp.element,Ff=jf.useState,Df=jf.useEffect;const Gf=function(){var e,t,n=(e=Ff(),t=2,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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Pf(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)?Pf(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.")}()),r=n[0],a=n[1];Df((function(){document.querySelectorAll(".mwai-link-title").forEach((function(e){var t=e.getAttribute("data-id"),n=e.getAttribute("data-title");e.addEventListener("click",(function(){a({postId:t,postTitle:n,mode:"title"})}),!1)})),document.querySelectorAll(".mwai-link-excerpt").forEach((function(e){var t=e.getAttribute("data-id"),n=e.getAttribute("data-title");e.addEventListener("click",(function(){a({postId:t,postTitle:n,mode:"excerpt"})}),!1)}))}),[]);var o=function(){var e=Mf(kf().mark((function e(t){var n,o,i,l;return kf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/helpers/update_post_title"),{method:"POST",nonce:k,json:{postId:r.postId,title:t}});case 2:if((n=e.sent).success){e.next=7;break}throw new Error(n.message);case 7:a(),(o=document.querySelector('tr[id="post-'.concat(r.postId,'"]')))&&(i=o.querySelector(".row-title"))&&(i.innerHTML=t),(l=o.querySelector(".hidden .post_title"))&&(l.innerHTML=t);case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),i=function(){var e=Mf(kf().mark((function e(t){var n;return kf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.IU)("".concat(T,"/helpers/update_post_excerpt"),{method:"POST",nonce:k,json:{postId:r.postId,excerpt:t}});case 2:if((n=e.sent).success){e.next=7;break}throw new Error(n.message);case 7:a();case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return React.createElement(s.A,null,React.createElement(E.N,null,React.createElement(Ef,{post:"title"===(null==r?void 0:r.mode)?r:null,onTitleClick:o,onClose:function(){a()}}),React.createElement(If,{post:"excerpt"===(null==r?void 0:r.mode)?r:null,onExcerptClick:i,onClose:function(){a()}})))};function Uf(e){return Uf="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},Uf(e)}function Bf(){Bf=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Uf(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Uf(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Hf(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Yf(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Hf(o,r,a,i,l,"next",e)}function l(e){Hf(o,r,a,i,l,"throw",e)}i(void 0)}))}}function zf(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 Wf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zf(Object(n),!0).forEach((function(t){Vf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zf(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Vf(e,t,n){var r;return r=function(e,t){if("object"!=Uf(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Uf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==Uf(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Kf(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||qf(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 qf(e,t){if(e){if("string"==typeof e)return Xf(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)?Xf(e,t):void 0}}function Xf(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 $f=wp.element,Qf=$f.useState,Jf=$f.useEffect,Zf=$f.useMemo;const em=function(){var e,t,n,r,a,o,i,l,c,u,s,m,p,h,g,b,R,_,x,S=Kf(Qf(""),2),N=S[0],C=S[1],I=Kf(Qf(""),2),A=I[0],P=I[1],j=js("contentGenerator"),F=j.template,D=j.setTemplate,G=j.clearTemplate,U=j.jsxTemplates,B=(0,Zt.XS)(),H=Kf(Qf(!1),2),Y=H[0],z=H[1],W=Kf(Qf(),2),V=W[0],K=W[1],q=Kf(Qf(!1),2),X=q[0],$=q[1],Q=Kf(Qf(!1),2),J=Q[0],Z=Q[1],ee=Kf(Qf(!1),2),te=ee[0],ne=ee[1],re=Kf(Qf(),2),ae=re[0],oe=re[1],ie=Kf(Qf("post"),2),le=ie[0],ce=ie[1],ue=Kf(Qf([]),2),se=ue[0],fe=ue[1],me=Kf(Qf([]),2),de=me[0],pe=me[1],he=Kf(Qf({}),2),ye=he[0],ve=he[1],ge=Zf((function(){return function(e){if(!e)return null;var t=e.split(" ").length,n=e.length,r=[];return n?(t<3?r.push(He.CONTENT_GENERATOR.TITLE_TOO_SHORT):t>8?r.push(He.CONTENT_GENERATOR.TITLE_TOO_LONG):n<40?r.push(He.CONTENT_GENERATOR.TITLE_TOO_SHORT):n>70&&r.push(He.CONTENT_GENERATOR.TITLE_TOO_LONG_2),r.join(" ")):void 0}(Se)}),[Se]),Ee=(0,f.I)({queryKey:["postTypes"],queryFn:an}),be=Ee.isLoading,Oe=Ee.data,xe=B.busy||Y||be,Se=null!==(e=null==F?void 0:F.title)&&void 0!==e?e:"",Ne=null!==(t=null==F?void 0:F.sections)&&void 0!==t?t:"",Ce=null!==(n=null==F?void 0:F.mode)&&void 0!==n?n:"single",Ie=null!==(r=null==F?void 0:F.topic)&&void 0!==r?r:"",Ae=null!==(a=null==F?void 0:F.topics)&&void 0!==a?a:"",ke=null!==(o=null!==(i=null==F?void 0:F.model)&&void 0!==i?i:null==L?void 0:L.ai_default_model)&&void 0!==o?o:null,Le=null!==(l=null==F?void 0:F.sectionsCount)&&void 0!==l?l:2,Me=null!==(c=null==F?void 0:F.paragraphsCount)&&void 0!==c?c:3,Pe=null!==(u=null==F?void 0:F.writingStyle)&&void 0!==u?u:"creative",je=null!==(s=null==F?void 0:F.writingTone)&&void 0!==s?s:"cheerful",Fe=null!==(m=null==F?void 0:F.titlePromptFormat)&&void 0!==m?m:"",De=null!==(p=null==F?void 0:F.sectionsPromptFormat)&&void 0!==p?p:"",Ge=null!==(h=null==F?void 0:F.contentPromptFormat)&&void 0!==h?h:"",Ue=null!==(g=null==F?void 0:F.excerptPromptFormat)&&void 0!==g?g:"",Be=null!==(b=null==F?void 0:F.envId)&&void 0!==b?b:"",Ye=null!==(R=null==F?void 0:F.temperature)&&void 0!==R?R:.6,ze=null!==(_=null==F?void 0:F.maxTokens)&&void 0!==_?_:2048,We=null!==(x=null==F?void 0:F.topicsAreTitles)&&void 0!==x&&x,Ve=!De||!Le,Ke=ft(L,Be||null),qe=Ke.completionModels,Xe=Ke.calculatePrice,$e=Hs(Xe),Qe=$e.addUsage,Je=$e.jsxUsageCosts,Ze=(null==L?void 0:L.ai_envs)||[],et=function(e){var t=e.disabled,n=e.options,r=e.language,a=e.customLanguage,o=nt(lt(null!=r?r:"en"),2),i=o[0],l=o[1],c=nt(lt(!1),2),u=c[0],s=c[1],f=nt(lt(""),2),m=f[0],d=f[1],p=(null==n?void 0:n.languages)||[],h=it((function(){return Object.keys(p).map((function(e){return{value:e,label:p[e]}}))}),[p]);ct((function(){a?(s(!0),d(a)):(s(!1),d(""),l(null!=r?r:"en"))}),[a]),ct((function(){l(r)}),[r]),ct((function(){var e=localStorage.getItem("mwai_preferred_language");if(e&&h.find((function(t){return t.value===e})))l(e);else{var t=(document.querySelector("html").lang||navigator.language||navigator.userLanguage).substr(0,2);h.find((function(e){return e.value===t}))&&l(t)}}),[]);var y=it((function(){if(u)return m;var e=h.find((function(e){return e.value===i}));return e?e.label:(console.warn("A system language or a custom language should be set."),"English")}),[i,m]),v=function(e,t){"custom"!==e?(l(e,t),localStorage.setItem("mwai_preferred_language",e)):s(!0)};return{jsxLanguageSelector:it((function(){return React.createElement(React.Fragment,null,u&&React.createElement(Re.A,{name:"customLanguage",disabled:t,onReset:function(){s(!1)},description:(0,O.FE)(He.CONTENT_GENERATOR.CUSTOM_LANGUAGE_HELP),value:m,onChange:d}),!u&&React.createElement(we.u,{scrolldown:!0,name:"language",disabled:t,description:(0,O.FE)(He.CONTENT_GENERATOR.CUSTOM_LANGUAGE_HELP),value:i,onChange:v},h.map((function(e){return React.createElement(we.j,{key:e.value,value:e.value,label:e.label})})),React.createElement(we.j,{key:"custom",value:"custom",label:"Other"})))}),[i,y,h,u]),currentLanguage:u?"custom":i,currentHumanLanguage:y,isCustom:u}}({options:L,language:null==F?void 0:F.language,customLanguage:null==F?void 0:F.customLanguage}),tt=et.jsxLanguageSelector,rt=et.currentLanguage,at=et.isCustom,ot=et.currentHumanLanguage,ut=function(e,t){D((function(n){return Wf(Wf({},n),{},Vf({},t,e))}))};Jf((function(){var e=Ae.split("\n").map((function(e){return e.trim()})).filter((function(e){return!!e}));fe(e)}),[Ae]),Jf((function(){F&&ut("","sections")}),[Se,Le]),Jf((function(){C(""),P(""),oe()}),[Ne,Me]),Jf((function(){F&&(!at&&F.customLanguage&&ut(null,"customLanguage"),at&&F.customLanguage!==ot&&ut(ot,"customLanguage"),F.language!==rt&&ut(rt,"language"))}),[at,rt,ot]);var mt=function(e){return e.replace("{LANGUAGE}",ot).replace("{WRITING_STYLE}",Pe).replace("{WRITING_TONE}",je).replace("{PARAGRAPHS_PER_SECTION}",Me).replace("{SECTIONS_COUNT}",Le)},dt=Zf((function(){var e=function(e,t){return!!t.find((function(t){return t.includes(e)}))},t=[Fe,De,Ge,Ue];return{language:e("{LANGUAGE}",t),writingStyle:e("{WRITING_STYLE}",t),writingTone:e("{WRITING_TONE}",t),sectionsCount:e("{SECTIONS_COUNT}",t),paragraphsCount:e("{PARAGRAPHS_PER_SECTION}",t)}}),[Fe,De,Ge,Ue,Le,Me]),pt=function(){var e=Yf(Bf().mark((function e(t){var n,r,a,o,i,l,c=arguments;return Bf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=c.length>1&&void 0!==c[1]?c[1]:2048,r=c.length>2&&void 0!==c[2]&&c[2],e.prev=2,e.next=5,(0,O.IU)("".concat(T,"/ai/completions"),{method:"POST",nonce:k,json:{scope:"admin-tools",envId:Be||null,model:ke||null,session:M,message:t,temperature:Ye,maxTokens:n}});case 5:return i=e.sent,Qe(ke,(null==i||null===(a=i.usage)||void 0===a?void 0:a.prompt_tokens)||0,(null==i||null===(o=i.usage)||void 0===o?void 0:o.completion_tokens)||0),(l=i.data.trim()).startsWith('"')&&l.endsWith('"')&&(l=l.substring(1,l.length-1)),e.abrupt("return",l);case 12:if(e.prev=12,e.t0=e.catch(2),!r){e.next=16;break}throw new Error(e.t0.message);case 16:return console.error(e.t0),K(e.t0.message),e.abrupt("return",null);case 19:case"end":return e.stop()}}),e,null,[[2,12]])})));return function(t){return e.apply(this,arguments)}}(),ht=function(){var e=Yf(Bf().mark((function e(){var t,n,r,a,o,i=arguments;return Bf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:Ie,r=i.length>2&&void 0!==i[2]&&i[2],n=i.length>1&&void 0!==i[1]?i[1]:Se){e.next=6;break}return alert(He.CONTENT_GENERATOR.TITLE_MISSING),e.abrupt("return");case 6:return z(!0),ut("","sections"),console.log("Sections Prompt:",{inTopic:t,inTitle:n,sectionsPromptFormat:De}),a=(a=De.replace("{TITLE}",n)).replace("{TOPIC}",t),a=mt(a),e.next=14,pt(a,512,r);case 14:return o=(l=o=e.sent)?l.split("\n").map((function(e){return(e=e.replace(/^\d+\.\s/,"")).startsWith('"')&&(e=e.slice(1)).endsWith('"')&&(e=e.slice(0,-1)),e})).filter((function(e){return e})).join("\n"):l,console.log("Sections:",{prompt:a,sections:o}),o&&ut(o,"sections"),z(!1),e.abrupt("return",o);case 20:case"end":return e.stop()}var l}),e)})));return function(){return e.apply(this,arguments)}}(),yt=function(){var e=Yf(Bf().mark((function e(){var t,n,r,a,o,i,l=arguments;return Bf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=l.length>0&&void 0!==l[0]?l[0]:Ie,r=l.length>2&&void 0!==l[2]?l[2]:Ne,a=l.length>3&&void 0!==l[3]&&l[3],n=l.length>1&&void 0!==l[1]?l[1]:Se){e.next=7;break}return alert(He.CONTENT_GENERATOR.TITLE_MISSING),e.abrupt("return");case 7:if(Ve||r){e.next=10;break}return alert(He.CONTENT_GENERATOR.SECTIONS_MISSING),e.abrupt("return");case 10:return z(!0),C((function(e){return""})),o=(o=(o=Ge.replace("{TITLE}",n)).replace("{SECTIONS}",r)).replace("{TOPIC}",t),o=mt(o),e.next=18,pt(o,ze,a);case 18:return(i=e.sent)&&(i=(i=(i=(i=(i=(i=i.replace(/^===INTRO:\n/,"")).replace(/^===INTRO: \n/,"")).replace(/===INTRO: /,"")).replace(/===OUTRO:\n/,"")).replace(/===OUTRO: \n/,"")).replace(/===OUTRO: /,""),C((function(e){return i}))),console.log("Content:",{prompt:o,content:i}),z(!1),e.abrupt("return",i);case 23:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),vt=function(){var e=Yf(Bf().mark((function e(){var t,n,r,a,o,i=arguments;return Bf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:Ie,r=i.length>2&&void 0!==i[2]&&i[2],n=i.length>1&&void 0!==i[1]?i[1]:Se){e.next=6;break}return alert(He.CONTENT_GENERATOR.TITLE_MISSING),e.abrupt("return");case 6:return z(!0),P((function(e){return""})),a=(a=Ue.replace("{TITLE}",n)).replace("{TOPIC}",t),a=mt(a),e.next=13,pt(a,256,r);case 13:return(o=e.sent)&&P((function(e){return o})),console.log("Excerpt:",{prompt:a,excerpt:o}),z(!1),e.abrupt("return",o);case 18:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),gt=function(){var e=Yf(Bf().mark((function e(){var t,n,r,a,o,i,l,c=arguments;return Bf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=c.length>0&&void 0!==c[0]?c[0]:Ie,n=c.length>1&&void 0!==c[1]&&c[1],z(!0),ve((function(){return Wf(Wf({},ye),{},{all:new Date})})),e.prev=4,r=t,We&&n){e.next=12;break}return a=mt(Fe.replace("{TOPIC}",t)),e.next=10,pt(a,64,n);case 10:r=e.sent,console.log("Title:",{prompt:a,title:r});case 12:if(o=null,i=null,l=null,z(!1),!r){e.next=41;break}if(ut(r,"title"),Ve){e.next=25;break}return ve((function(e){return Wf(Wf({},e),{},{sections:new Date})})),e.next=22,ht(t,r,n);case 22:return o=e.sent,e.next=25,ve((function(e){return Wf(Wf({},e),{},{sections:null})}));case 25:if(!o&&!Ve){e.next=41;break}return e.next=28,ve((function(e){return Wf(Wf({},e),{},{content:new Date})}));case 28:return e.next=30,yt(t,r,o,n);case 30:return i=e.sent,e.next=33,ve((function(e){return Wf(Wf({},e),{},{content:null})}));case 33:if(!i){e.next=41;break}return e.next=36,ve((function(e){return Wf(Wf({},e),{},{excerpt:new Date})}));case 36:return e.next=38,vt(t,r,n);case 38:return l=e.sent,e.next=41,ve((function(e){return Wf(Wf({},e),{},{excerpt:null})}));case 41:return e.abrupt("return",{title:r,heads:o,content:i,excerpt:l});case 44:throw e.prev=44,e.t0=e.catch(4),console.error(e.t0),z(!1),ve({}),e.t0;case 50:case"end":return e.stop()}}),e,null,[[4,44]])})));return function(){return e.apply(this,arguments)}}(),Et=function(){var e=Yf(Bf().mark((function e(){var t,n,r,a,o,i=arguments;return Bf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:Se,n=i.length>1&&void 0!==i[1]?i[1]:N,r=i.length>2&&void 0!==i[2]?i[2]:A,a=i.length>3&&void 0!==i[3]&&i[3],z(!0),e.prev=5,e.next=8,(0,O.IU)("".concat(T,"/helpers/create_post"),{method:"POST",nonce:k,json:{title:t,content:n,excerpt:r,postType:le}});case 8:return o=e.sent,a||oe(o.postId),e.abrupt("return",o.postId);case 13:return e.prev=13,e.t0=e.catch(5),console.error(e.t0),K(e.t0.message),e.abrupt("return",null);case 18:return e.prev=18,z(!1),e.finish(18);case 21:case"end":return e.stop()}}),e,null,[[5,13,18,21]])})));return function(){return e.apply(this,arguments)}}(),bt=function(){var e=Yf(Bf().mark((function e(){var t;return Bf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return pe([]),t=se.map((function(e,t){return Yf(Bf().mark((function n(){var r,a,o,i,l;return Bf().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return console.log("Topic "+t),n.prev=1,n.next=4,gt(e,!0);case 4:if(r=n.sent,a=r.title,o=r.content,i=r.excerpt,!(a&&o&&i)){n.next=15;break}return n.next=11,Et(a,o,i,!0);case 11:l=n.sent,pe((function(t){return[].concat(function(e){if(Array.isArray(e))return Xf(e)}(n=t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||qf(n)||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.")}(),[{postId:l,topic:e,title:a,content:o,excerpt:i}]);var n})),n.next=16;break;case 15:console.warn("Could not generate the post for: "+e);case 16:n.next=21;break;case 18:n.prev=18,n.t0=n.catch(1),confirm("An error was caught ("+n.t0.message+"). Should we continue?")||(B.stop(),B.reset(),z(!1));case 21:return n.abrupt("return",{success:!0});case 22:case"end":return n.stop()}}),n,null,[[1,18]])})))})),e.next=4,B.start(t);case 4:B.reset();case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return React.createElement(v.z,{nekoErrors:[]},React.createElement(Ut,{title:He.COMMON.CONTENT_GENERATOR}),React.createElement(E.N,null,React.createElement(E.Y,{fullWidth:!0},React.createElement(st,{options:L}),React.createElement(d.s,{p:!0,style:{marginTop:0,marginBottom:0}},(0,O.FE)(He.CONTENT_GENERATOR.INTRO))),React.createElement(E.Y,{style:{flex:1}},React.createElement(po,null,React.createElement("h2",{style:{marginTop:0}},"Topic"),React.createElement(Wt.m,{name:"topic",disabled:xe||"bulk"===Ce,rows:5,value:Ie,onChange:ut}),React.createElement(_e.g,null),React.createElement(w.M,{fullWidth:!0,disabled:!Ie||"bulk"===Ce,isBusy:xe,startTime:null==ye?void 0:ye.all,onClick:function(){return gt()}},He.COMMON.GENERATE)),React.createElement(_e.g,null),React.createElement(po,null,U)),React.createElement(E.Y,{style:{flex:3}},React.createElement(Vt.o,{name:"mode",value:Ce,disabled:xe,onChange:ut},React.createElement(Vt.K,{title:He.CONTENT_GENERATOR.SINGLE_GENERATE,value:"single"}),React.createElement(Vt.K,{title:He.CONTENT_GENERATOR.BULK_GENERATE,value:"bulk",count:se.length})),React.createElement(_e.g,null),"bulk"===Ce&&React.createElement(po,null,React.createElement("p",{style:{marginTop:0,marginBottom:20}},(0,O.FE)(He.CONTENT_GENERATOR.TOPICS_HELP)),React.createElement("div",{style:{display:"flex"}},React.createElement(w.M,{disabled:xe||!se.length,onClick:bt},He.COMMON.GENERATE),React.createElement(Jt.j,{busy:B.busy,style:{marginLeft:10,flex:"auto"},value:B.value,max:B.max,onStopClick:B.stop})),React.createElement(_e.g,null),React.createElement("h3",null,"Topics"),React.createElement(Wt.m,{name:"topics",rows:10,value:Ae,onChange:ut}),React.createElement(y.R,{name:"topicsAreTitles",label:"Use Topics as Titles",value:"1",checked:We,onChange:ut}),React.createElement("h3",null,He.CONTENT_GENERATOR.GENERATED_POSTS),!de.length&&React.createElement("i",null,"Nothing yet."),de.length>0&&React.createElement("ul",null,de.map((function(e){return React.createElement("li",{key:e.postId},e.title," ",React.createElement("a",{target:"_blank",href:"/?p=".concat(e.postId),rel:"noreferrer"},"View")," or ",React.createElement("a",{target:"_blank",href:"/wp-admin/post.php?post=".concat(e.postId,"&action=edit"),rel:"noreferrer"},"Edit"))})))),"single"===Ce&&React.createElement(po,null,React.createElement("h2",{style:{marginTop:0}},"Title"),React.createElement(Re.A,{name:"title",disabled:xe,value:Se,onChange:ut}),ge&&React.createElement("div",{className:"information"},"Advice: ",ge),De&&React.createElement(React.Fragment,null,React.createElement(_e.g,null),React.createElement(Bt,null,React.createElement("h2",null,He.CONTENT_GENERATOR.SECTIONS),React.createElement("div",{style:{display:"flex",alignItems:"center"}},dt.sectionsCount&&React.createElement(React.Fragment,null,React.createElement("label",{style:{margin:"0 5px 0 0"}},"# of Sections: "),React.createElement(we.u,{scrolldown:!0,name:"sectionsCount",disabled:xe,style:{marginRight:10},value:Le,description:"",onChange:ut},React.createElement(we.j,{key:2,value:2,label:2}),React.createElement(we.j,{key:3,value:3,label:3}),React.createElement(we.j,{key:4,value:4,label:4}),React.createElement(we.j,{key:6,value:6,label:6}),React.createElement(we.j,{key:8,value:8,label:8}),React.createElement(we.j,{key:10,value:10,label:10}),React.createElement(we.j,{key:12,value:12,label:12}))),Le>0&&React.createElement(w.M,{disabled:!Se,isBusy:xe,startTime:null==ye?void 0:ye.sections,onClick:function(){return ht()}},He.CONTENT_GENERATOR.GENERATE_SECTIONS))),Le>0&&React.createElement(React.Fragment,null,React.createElement(_e.g,null),React.createElement(Wt.m,{name:"sections",disabled:xe,rows:4,value:Ne,description:He.CONTENT_GENERATOR.SECTIONS_HELP,onChange:ut}))),React.createElement(_e.g,null),React.createElement(Bt,null,React.createElement("h2",null,He.COMMON.CONTENT),React.createElement("div",{style:{display:"flex",alignItems:"center"}},dt.paragraphsCount&&React.createElement(React.Fragment,null,React.createElement("label",{style:{margin:"0 5px 0 0"}},He.CONTENT_GENERATOR.PARAGRAPHS_PER_SECTION,": "),React.createElement(we.u,{scrolldown:!0,name:"paragraphsCount",disabled:xe,style:{marginRight:10},value:Me,description:"",onChange:ut},React.createElement(we.j,{key:1,value:1,label:1}),React.createElement(we.j,{key:2,value:2,label:2}),React.createElement(we.j,{key:3,value:3,label:3}),React.createElement(we.j,{key:4,value:4,label:4}),React.createElement(we.j,{key:6,value:6,label:6}),React.createElement(we.j,{key:8,value:8,label:8}),React.createElement(we.j,{key:10,value:10,label:10}))),React.createElement(w.M,{disabled:!Se,isBusy:xe,startTime:null==ye?void 0:ye.content,onClick:function(){return yt()}},He.CONTENT_GENERATOR.GENERATE_CONTENT))),React.createElement(_e.g,null),React.createElement(Wt.m,{countable:"words",disabled:xe,rows:12,value:N,description:He.CONTENT_GENERATOR.CONTENT_HELP,onChange:C}),React.createElement(_e.g,null),React.createElement(Bt,null,React.createElement("h2",null,He.COMMON.EXCERPT),React.createElement(w.M,{disabled:!Se,isBusy:xe,startTime:null==ye?void 0:ye.excerpt,onClick:function(){return vt()}},He.CONTENT_GENERATOR.GENERATE_EXCERPT)),React.createElement(_e.g,null),React.createElement(Wt.m,{disabled:xe,value:A,onBlur:P,rows:3}),React.createElement(_e.g,{line:!0,height:40}),React.createElement(we.u,{scrolldown:!0,disabled:xe,name:"postType",onChange:ce,value:le},null==Oe?void 0:Oe.map((function(e){return React.createElement(we.j,{key:e.type,value:e.type,label:e.name})}))),React.createElement(_e.g,null),React.createElement(w.M,{fullWidth:!0,style:{height:60},onClick:function(){return Et()},isBusy:xe,disabled:!Se||!N},He.CONTENT_GENERATOR.CREATE_POST))),React.createElement(E.Y,null,React.createElement(po,null,React.createElement("h2",{style:{marginTop:0}},He.CONTENT_GENERATOR.CONTENT_PARAMS),!dt.language&&!dt.writingStyle&&!dt.writingTone&&React.createElement("div",{style:{fontSize:11,lineHeight:"14px"}},He.CONTENT_GENERATOR.CONTENT_PARAMS_INTRO),dt.language&&React.createElement(React.Fragment,null,React.createElement("label",null,He.COMMON.LANGUAGE,":"),tt),dt.writingStyle&&React.createElement(React.Fragment,null,React.createElement("label",null,He.CONTENT_GENERATOR.WRITING_STYLE,":"),React.createElement(we.u,{scrolldown:!0,name:"writingStyle",disabled:xe,value:Pe,description:"",onChange:ut},ds.map((function(e){return React.createElement(we.j,{key:e.value,value:e.value,label:e.label})})))),dt.writingTone&&React.createElement(React.Fragment,null,React.createElement("label",null,He.CONTENT_GENERATOR.WRITING_TONE,":"),React.createElement(we.u,{scrolldown:!0,name:"writingTone",disabled:xe,value:je,description:"",onChange:ut},ps.map((function(e){return React.createElement(we.j,{key:e.value,value:e.value,label:e.label})}))))),React.createElement(_e.g,null),React.createElement(po,null,React.createElement(Bt,null,React.createElement("h2",null,He.CONTENT_GENERATOR.POST_PARAMS),React.createElement(w.M,{onClick:function(){return Z(!J)}},J?He.COMMON.HIDE:He.COMMON.SHOW)),J&&React.createElement(React.Fragment,null,React.createElement("label",null,He.COMMON.POST_TYPE,":"),React.createElement(we.u,{scrolldown:!0,disabled:xe,name:"postType",onChange:ce,value:le},null==Oe?void 0:Oe.map((function(e){return React.createElement(we.j,{key:e.type,value:e.type,label:e.name})}))))),React.createElement(_e.g,null),React.createElement(po,null,React.createElement(Bt,null,React.createElement("h2",null,He.COMMON.MODEL_PARAMS),React.createElement(w.M,{onClick:function(){return $(!X)}},X?He.COMMON.HIDE:He.COMMON.SHOW)),X&&React.createElement(React.Fragment,null,React.createElement("label",null,He.COMMON.ENVIRONMENT,":"),React.createElement(we.u,{scrolldown:!0,name:"envId",value:null!=Be?Be:"",onChange:ut},Ze.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})})),React.createElement(we.j,{value:"",label:"None"})),React.createElement("label",null,He.COMMON.MODEL,":"),React.createElement(we.u,{name:"model",value:ke,description:He.CONTENT_GENERATOR.MODEL_HELP,scrolldown:!0,onChange:ut},qe.map((function(e){return React.createElement(we.j,{value:e.model,label:e.name})}))),React.createElement("label",null,He.COMMON.TEMPERATURE,":"),React.createElement(Re.A,{name:"temperature",value:Ye,type:"number",onChange:ut,onBlur:ut,description:He.HELP.TEMPERATURE}),React.createElement("label",null,He.COMMON.MAX_TOKENS,":"),React.createElement(Re.A,{name:"maxTokens",value:ze,type:"number",onChange:ut,onBlur:ut,description:He.HELP.MAX_TOKENS}))),React.createElement(_e.g,null),React.createElement(po,null,React.createElement(Bt,null,React.createElement("h2",null,(0,O.FE)(He.COMMON.PROMPTS)),React.createElement(w.M,{onClick:function(){return ne(!te)}},te?"Hide":"Show")),te&&React.createElement(React.Fragment,null,React.createElement("p",{style:{fontSize:11,lineHeight:"14px"}},He.CONTENT_GENERATOR.PROMPTS_INTRO),React.createElement("label",null,(0,O.FE)(He.CONTENT_GENERATOR.PROMPT_TITLE)),React.createElement(Wt.m,{disabled:xe,name:"titlePromptFormat",value:Fe,onChange:ut}),React.createElement("label",null,(0,O.FE)(He.CONTENT_GENERATOR.PROMPT_SECTIONS)),React.createElement(Wt.m,{disabled:xe,name:"sectionsPromptFormat",value:De,onChange:ut}),React.createElement("label",null,(0,O.FE)(He.CONTENT_GENERATOR.PROMPT_CONTENT)),React.createElement(Wt.m,{disabled:xe,name:"contentPromptFormat",value:Ge,onChange:ut}),React.createElement("label",null,(0,O.FE)(He.CONTENT_GENERATOR.PROMPT_EXCERPT)),React.createElement(Wt.m,{disabled:xe,name:"excerptPromptFormat",value:Ue,onChange:ut}))),React.createElement(_e.g,null),Je)),React.createElement(Te.n,{isOpen:ae,onRequestClose:function(){return oe()},okButton:{label:He.CONTENT_GENERATOR.EDIT_POST,onClick:function(){window.open("/wp-admin/post.php?post=".concat(ae,"&action=edit"),"_blank"),G(),oe()}},cancelButton:{label:"Close",onClick:function(){oe()}},title:He.CONTENT_GENERATOR.POST_CREATED,content:React.createElement("p",null,He.CONTENT_GENERATOR.POST_CREATED_AS_DRAFT)}),React.createElement(Te.n,{isOpen:V,onRequestClose:function(){K()},okButton:{onClick:function(){K()}},title:"Error",content:React.createElement("p",null,V)}))};function tm(e){return tm="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},tm(e)}var nm;function rm(){rm=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==tm(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(tm(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 am(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function om(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){am(o,r,a,i,l,"next",e)}function l(e){am(o,r,a,i,l,"throw",e)}i(void 0)}))}}function im(e){return function(e){if(Array.isArray(e))return mm(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||fm(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 lm(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 cm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lm(Object(n),!0).forEach((function(t){um(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lm(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function um(e,t,n){var r;return r=function(e,t){if("object"!=tm(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=tm(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==tm(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sm(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||fm(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 fm(e,t){if(e){if("string"==typeof e)return mm(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)?mm(e,t):void 0}}function mm(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 dm=wp.element,pm=dm.useState,hm=dm.useEffect,ym=dm.useMemo,vm=[1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,40,60,80,100],gm=G.Ay.div(nm||(nm=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n  margin-bottom: 5px;\n  label {\n    margin-bottom: 5px;\n    display: block;\n  }\n"])));const Em=function(){var e,t,n,r,a=js("imagesGenerator"),o=a.template,i=a.setTemplate,l=a.jsxTemplates,c=sm(pm(),2),u=c[0],s=c[1],f=sm(pm(!0),2),m=f[0],p=f[1],h=sm(pm(!1),2),g=h[0],b=h[1],R=sm(pm(!1),2),_=R[0],x=R[1],S=(null==L?void 0:L.ai_envs)||[],N=ft(L,(null==o?void 0:o.envId)||null),C=N.imageModels,I=(0,N.getModel)(null==o?void 0:o.model),A=sm(pm([]),2),P=A[0],j=A[1],F=sm(pm([]),2),D=F[0],G=F[1],U=sm(pm(),2),B=U[0],H=U[1],Y=sm(pm(""),2),z=Y[0],W=Y[1],V=sm(pm(""),2),K=V[0],q=V[1],X=sm(pm(""),2),$=X[0],Q=X[1],J=sm(pm(""),2),Z=J[0],ee=J[1],te=sm(pm(""),2),ne=te[0],re=te[1],ae=sm(pm([]),2),oe=ae[0],ie=ae[1],le=ym((function(){return D.indexOf(B)}),[B,D]),ce=null==o?void 0:o.prompt,ue=sm(pm(1),2),se=ue[0],fe=ue[1],me=sm(pm(0),2),de=me[0],pe=me[1],he=sm(pm(0),2),ye=he[0],ve=he[1],ge=new AbortController,Ee=null!==(e=null==o?void 0:o.style)&&void 0!==e?e:null,be=function(e,t){i((function(n){return cm(cm({},n),{},um({},t,e))}))};hm((function(){var e;if(null!=o&&o.envId&&(null==o||!o.model)&&(null==C?void 0:C.length)>0){var t=C.find((function(e){return"dall-e-3"===e.model}))||C[0];i(cm(cm({},o),{},{model:t.model}))}if(null!=o&&o.model&&(null==o||!o.resolution)&&(null==I||null===(e=I.resolutions)||void 0===e?void 0:e.length)>0){var n=I.resolutions.map((function(e){return e.name})),r=n.includes("1024x1024")?"1024x1024":n[0];i(cm(cm({},o),{},{resolution:r}))}}),[o]),hm((function(){if(B){var e=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:42,n=e.replace(/[\s|,]+/g,"-"),r=(n=n.replace(/--+/g,"-")).split("-"),a=r[0],o=1;o<r.length&&r[o]&&a.length+r[o].length<t;)a+="-"+r[o],o++;return a.length>t+1&&(a=a.slice(0,t+2)),a}(ce)+".png";re(e),W(ce),q(ce),Q(ce),ee(ce)}}),[B]);var Oe=function(){if(ce){for(var e=function(){var e={prompt:ce,envId:o.envId,model:o.model,resolution:o.resolution,style:o.style};j((function(t){return[].concat(im(t),[e])}))},t=0;t<se;t++)e();pe((function(e){return e+se}))}else console.error("Prompt is empty, cannot add to queue.")},Se=function(){var e=om(rm().mark((function e(){var t,n;return rm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==P.length&&!g){e.next=2;break}return e.abrupt("return");case 2:return b(!0),t=P[0],e.prev=4,e.next=7,(0,O.IU)("".concat(T,"/ai/images"),{method:"POST",nonce:k,signal:ge.signal,json:{env:"admin-tools",envId:t.envId,model:t.model,resolution:t.resolution,style:t.style,scope:"admin-tools",session:M,message:t.prompt,maxResults:1}});case 7:(n=e.sent).data&&n.data.length>0&&G((function(e){return[].concat(im(e),[n.data[0]])})),j((function(e){return e.slice(1)})),ve((function(e){return e+1})),1===P.length&&(pe(0),ve(0)),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(4),"AbortError"!==e.t0.name&&(console.error(e.t0),s(e.t0.message+(P.length>1?" The other tasks will continue.":"")),j((function(e){return e.slice(1)})),pe((function(e){return e-1})));case 17:return e.prev=17,b(!1),e.finish(17);case 20:case"end":return e.stop()}}),e,null,[[4,14,17,20]])})));return function(){return e.apply(this,arguments)}}();hm((function(){P.length>0&&!g&&Se()}),[P,g]);var Ce=function(){var e=om(rm().mark((function e(){var t;return rm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return x(!0),e.prev=1,e.next=4,(0,O.IU)("".concat(T,"/helpers/create_image"),{method:"POST",nonce:k,json:{url:B,title:z,description:K,caption:$,alt:Z,filename:ne}});case 4:t=e.sent,ie([].concat(im(oe),[{id:t.attachmentId,url:B}])),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error(e.t0),s(e.t0.message);case 12:return e.prev=12,x(!1),e.finish(12);case 15:case"end":return e.stop()}}),e,null,[[1,8,12,15]])})));return function(){return e.apply(this,arguments)}}(),Ie=ym((function(){var e=oe.find((function(e){return e.url===B}));return e?e.id:null}),[B,oe]);return React.createElement(v.z,{nekoErrors:[]},React.createElement(Ut,{title:He.COMMON.IMAGES_GENERATOR}),React.createElement(E.N,null,React.createElement(E.Y,{fullWidth:!0},React.createElement(st,{options:L}),React.createElement(d.s,{p:!0,style:{marginTop:0,marginBottom:0}},"This will also be available in the Post Editor soon. If you have any idea or request, please join us on the ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/support/plugin/ai-engine/",rel:"noreferrer"},"Support Forum"),"! 🎵")),React.createElement(E.Y,null,React.createElement(po,{style:{marginBottom:25}},l),React.createElement(xe.L,{style:{marginBottom:25}},React.createElement("h3",{style:{marginTop:0}},"Parameters"),React.createElement("label",null,He.COMMON.ENVIRONMENT,":"),React.createElement(_e.g,{tiny:!0}),React.createElement(we.u,{scrolldown:!0,name:"envId",value:null!==(t=null==o?void 0:o.envId)&&void 0!==t?t:"",onChange:be},S.map((function(e){return React.createElement(we.j,{key:e.id,value:e.id,label:e.name})})),React.createElement(we.j,{value:"",label:"None"})),React.createElement(_e.g,{tiny:!0}),React.createElement("label",null,He.COMMON.MODEL,":"),React.createElement(_e.g,{tiny:!0}),React.createElement(we.u,{scrolldown:!0,name:"model",value:null==o?void 0:o.model,onChange:be},C.map((function(e){return React.createElement(we.j,{key:e.model,value:e.model,label:e.name})}))),React.createElement(_e.g,{tiny:!0}),React.createElement("label",null,He.COMMON.RESOLUTION,":"),React.createElement(_e.g,{tiny:!0}),React.createElement(we.u,{scrolldown:!0,name:"resolution",value:null==o?void 0:o.resolution,onChange:be},null==I||null===(n=I.resolutions)||void 0===n?void 0:n.map((function(e){return React.createElement(we.j,{key:e.name,value:e.name,label:e.label})}))),"custom"===(null==o?void 0:o.resolution)&&React.createElement(React.Fragment,null,React.createElement(_e.g,{tiny:!0}),React.createElement("label",null,"Custom Resolution:"),React.createElement(_e.g,{tiny:!0}),React.createElement(Re.A,{name:"customResolution",value:null==o?void 0:o.customResolution,onChange:function(e){return be(e,"customResolution")}})),(null==I||null===(r=I.model)||void 0===r?void 0:r.startsWith("dall-e-3"))&&React.createElement(React.Fragment,null,React.createElement(_e.g,{tiny:!0}),React.createElement("label",null,He.COMMON.STYLE,":"),React.createElement(_e.g,{tiny:!0}),React.createElement(we.u,{scrolldown:!0,name:"style",value:Ee,onChange:be},React.createElement(we.j,{key:"none",value:null,label:"None"}),React.createElement(we.j,{key:"natural",value:"natural",label:"Natural"}),React.createElement(we.j,{key:"vivid",value:"vivid",label:"Vivid"})))),React.createElement(xe.L,{style:{marginBottom:25}},React.createElement("h2",{style:{marginTop:0}},"Settings"),React.createElement(y.R,{id:"continuous_mode ",label:"Continuous",value:"1",checked:m,description:"New images will be added to the already generated images.",onChange:p}))),React.createElement(E.Y,{style:{flex:3}},React.createElement(Jt.j,{busy:g,value:ye,max:de,onStopClick:function(){ge.abort(),j([]),pe(0),ve(0),b(!1)},status:function(){return"".concat(ye," / ").concat(de)}}),React.createElement(_e.g,null),React.createElement(xe.L,null,B&&React.createElement(React.Fragment,null,React.createElement(Bt,{style:{paddingBottom:10}},React.createElement("div",{style:{display:"flex",alignItems:"center"}},React.createElement(w.M,{disabled:le<1||g,onClick:function(){le>0&&H(D[le-1])}},"<"),React.createElement(w.M,{onClick:function(){return H()}},"Back to Results"),React.createElement(w.M,{disabled:le>=D.length-1||g,onClick:function(){le<D.length-1&&H(D[le+1])}},">"))),React.createElement("div",{style:{display:"flex",flexDirection:"column"}},React.createElement("div",{style:{flex:2}},React.createElement("a",{href:B,target:"_blank",rel:"noreferrer"},React.createElement("img",{src:B,style:{width:"100%"}}))),React.createElement("div",{style:{flex:1,marginLeft:10,display:"flex",flexDirection:"column"}},React.createElement(gm,null,React.createElement("label",null,"Title:"),React.createElement(Wt.m,{value:z,onBlur:W,rows:2})),React.createElement(gm,null,React.createElement("label",null,"Caption:"),React.createElement(Wt.m,{value:$,onBlur:Q,rows:2})),React.createElement(gm,null,React.createElement("label",null,"Description:"),React.createElement(Wt.m,{value:K,onBlur:q,rows:2})),React.createElement(gm,null,React.createElement("label",null,"Alternative Text:"),React.createElement(Wt.m,{value:Z,onBlur:ee,rows:2})),React.createElement(gm,null,React.createElement("label",null,"Filename:"),React.createElement(Re.A,{value:ne,onChange:re})),React.createElement(_e.g,null),React.createElement(w.M,{fullWidth:!0,style:{height:42},onClick:Ce,isBusy:_},"Add to Media Library"),React.createElement(_e.g,{tiny:!0}),Ie&&React.createElement(React.Fragment,null,React.createElement(_e.g,null),React.createElement(Ne.X,{variant:"success"},"The media has been created! You can edit it here: ",React.createElement("a",{href:"/wp-admin/post.php?post=".concat(Ie,"&action=edit"),target:"_blank",rel:"noreferrer"},"Edit Media #",Ie),"."))))),!B&&React.createElement(React.Fragment,null,React.createElement(Bt,null,React.createElement("div",{style:{display:"flex",alignItems:"center"}},React.createElement(w.M,{disabled:!ce,isBusy:g,onClick:Oe},"Generate"),React.createElement(we.u,{scrolldown:!0,id:"totalImagesToGenerate",name:"totalImagesToGenerate",style:{marginLeft:10,marginRight:10,width:120},value:se,onChange:function(e){return fe(e)}},vm.map((function(e){return React.createElement(we.j,{key:e,id:e,value:e,label:"".concat(e," ").concat(e>1?"Images":"Image")})}))),g&&React.createElement(w.M,{disabled:!ce,onClick:Oe},"Add to Queue"),D.length>0&&React.createElement(w.M,{onClick:function(){G([])}},"Clear"))),React.createElement(_e.g,null),React.createElement(Wt.m,{value:ce,onChange:function(e){i(cm(cm({},o),{},{prompt:e}))}}),React.createElement(Ht,null,D.map((function(e){return React.createElement("img",{key:e,src:e,onClick:function(){return H(e)}})})),im(Array(Math.max(3-D.length,0)).keys()).map((function(){return React.createElement("div",{className:"empty-image"})}))))))),React.createElement(Te.n,{isOpen:u,onRequestClose:function(){s()},okButton:{onClick:function(){s()}},title:"Error",content:React.createElement("p",null,u)}))};var bm=wp.element,wm=(bm.useState,bm.useEffect,bm.useMemo);const Rm=function(e){var t=e.isOpen,n=void 0!==t&&t,r=e.title,a=e.error,o=e.results,i=e.busy,l=void 0!==i&&i,c=e.onClick,u=void 0===c?function(){}:c,f=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t},m=wm((function(){return l?React.createElement(ms.X,{type:"circle",size:"10%"}):a?React.createElement(React.Fragment,null,"Error: ",a):(null==o?void 0:o.length)>0?React.createElement(React.Fragment,null,"Pick one of those results:",React.createElement(lf,null,o.map((function(e){return React.createElement(cf,{key:f(e),onClick:function(){u(e)}},e)})))):React.createElement(React.Fragment,null,"Nothing to display.")}),[o,a]);return React.createElement(s.A,null,React.createElement(E.N,null,React.createElement(Te.n,{isOpen:n,title:null!=r?r:"Results",content:m,onRequestClose:function(){return u()},okButton:{label:"Close",onClick:function(){return u()}}})))};function Om(e){return Om="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},Om(e)}function _m(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Cm(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}function xm(){xm=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Om(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Om(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 Sm(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function Tm(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Sm(o,r,a,i,l,"next",e)}function l(e){Sm(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Nm(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||Cm(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 Cm(e,t){if(e){if("string"==typeof e)return Im(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)?Im(e,t):void 0}}function Im(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 Am=wp.element,km=Am.useState,Lm=Am.useEffect,Mm=wp.i18n.__,Pm=wp.plugins.registerPlugin,jm=wp.components,Fm=jm.Button,Dm=jm.ToolbarDropdownMenu,Gm=jm.ToolbarGroup,Um=jm.Spinner,Bm=jm.MenuGroup,Hm=jm.MenuItem,Ym=wp.blockEditor.BlockControls,zm=wp.editor.PluginDocumentSettingPanel,Wm=wp.richText.registerFormatType,Vm=wp.data.useSelect;function Km(){var e=Nm(km(!1),2),t=e[0],n=e[1],r=Nm(km([]),2),a=r[0],o=r[1],i=Vm((function(e){return e("core/block-editor").getSelectedBlock()}),[]);if(!i)return null;if("core/paragraph"===i.name){var l=function(e){e.style.opacity=.15,e.style.pointerEvents="none",e.style.userSelect="none",e.style.animation="neko-fade-animation 0.85s infinite linear"},c=function(e){e.style.opacity=1,e.style.pointerEvents="auto",e.style.userSelect="auto",e.style.animation="none"};Lm((function(){if(null!=i&&i.clientId){var e=document.getElementById("block-"+i.clientId);e?t?l(e):c(e):console.warn("AI Engine: Could not find block element.")}}),[t,i]);var u=function(){var e=document.getElementById("block-"+i.clientId);e?c(e):console.warn("AI Engine: Could not find block element.")},s=function(e){wp.data.dispatch("core/block-editor").updateBlockAttributes(i.clientId,{content:e})},f=i.attributes.content,m=window.getSelection().toString(),d=function(){var e=Tm(xm().mark((function e(t){var r,a,c,d,p,h,y,v,g,E,b,w,R,_,x,S;return xm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=wp.data.select("core/editor"),a=r.getSelectedBlockClientId,c=r.getBlockIndex,d=r.getCurrentPost,p=a(),h=c(p),y=d(),v=y.id,n(!0),void 0,(N=document.getElementById("block-"+i.clientId))?l(N):console.warn("AI Engine: Could not find block element."),document.activeElement.blur(),e.prev=7,e.next=10,(0,O.IU)("".concat(T,"/ai/magic_wand"),{method:"POST",nonce:k,json:{action:t,data:{postId:v,text:f,selectedText:m}}});case 10:g=e.sent,u(),n(!1),E=g.data,b=E.mode,w=E.result,R=E.results,"replace"===b?s(w):"suggest"===b?o(R):"insertMedia"===b&&(_=g.data.media,x=wp.blocks.createBlock,S=x("core/image",{id:_.id,url:_.url,title:_.title,caption:_.caption,alt:_.alt}),wp.data.dispatch("core/block-editor").insertBlock(S,h+1)),e.next=23;break;case 17:e.prev=17,e.t0=e.catch(7),u(),n(!1),alert("Error: "+e.t0.message),console.log("ERROR",e.t0);case 23:case"end":return e.stop()}var N}),e,null,[[7,17]])})));return function(t){return e.apply(this,arguments)}}();return React.createElement(React.Fragment,null,React.createElement("style",null,"\n        @keyframes neko-fade-animation {\n          0% { opacity: 0.15; }\n          50% { opacity: 0.3; }\n          100% { opacity: 0.15; }\n        }\n    "),React.createElement(Ym,null,React.createElement(Gm,null,React.createElement(Dm,{icon:t?React.createElement(Um,null):React.createElement(Pt,{icon:"wand",style:{marginRight:0}}),label:Mm("AI Wand")},(function(){return React.createElement(React.Fragment,null,React.createElement(Bm,null,React.createElement(Hm,{onClick:function(){return d("correctText")}},React.createElement("div",{style:{display:"flex",flexDirection:"column"}},React.createElement("b",null,"Correct Text"),React.createElement("small",null,"Grammar & Spelling"))),React.createElement(Hm,{onClick:function(){return d("enhanceText")}},React.createElement("div",{style:{display:"flex",flexDirection:"column"}},React.createElement("b",null,"Enhance Text"),React.createElement("small",null,"Readibility & Quality"))),React.createElement(Hm,{onClick:function(){return d("longerText")}},React.createElement("div",{style:{display:"flex",flexDirection:"column"}},React.createElement("b",null,"Longer Text"),React.createElement("small",null,"Readibility"))),React.createElement(Hm,{onClick:function(){return d("shorterText")}},React.createElement("div",{style:{display:"flex",flexDirection:"column"}},React.createElement("b",null,"Shorter Text"),React.createElement("small",null,"Readibility"))),React.createElement(Hm,{onClick:function(){return d("translateText")}},React.createElement("div",{style:{display:"flex",flexDirection:"column"}},React.createElement("b",null,"Translate Text"),React.createElement("small",null,"To Post Language")))),React.createElement(Bm,null,React.createElement(Hm,{disabled:!m,onClick:function(){return d("suggestSynonyms")}},React.createElement("div",{style:{display:"flex",flexDirection:"column"}},React.createElement("b",null,"Suggest Synonyms"),React.createElement("small",null,"For Selected Words")))),React.createElement(Bm,null,React.createElement(Hm,{onClick:function(){return d("generateImage")}},React.createElement("div",{style:{display:"flex",flexDirection:"column"}},React.createElement("b",null,"Generate Image"),React.createElement("small",null,"For this Text")))))})))),React.createElement(Rm,{isOpen:null==a?void 0:a.length,results:a,onClick:function(e){o([]),e&&function(e){var t=wp.data.select("core/block-editor"),n=t.getSelectionStart,r=t.getSelectionEnd,a=wp.data.select("core/block-editor").getSelectedBlock(),o=a.attributes.content,i=n().offset,l=r().offset,c=o.substring(0,i)+e+o.substring(l);wp.data.dispatch("core/block-editor").updateBlockAttributes(a.clientId,{content:c})}(e)},onClose:function(){return o([])}}))}}var qm=function(){var e=Tm(xm().mark((function e(t,n){var r,a,o,i,l,c;return xm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",t);case 2:return r=wp.data.select("core/editor"),a=r.getCurrentPost,o=a(),i=o.id,e.next=6,(0,O.IU)("".concat(T,"/ai/magic_wand"),{method:"POST",nonce:k,json:{action:"translateSection",data:{postId:i,context:n,text:t}}});case 6:return l=e.sent,c=l.data.result,e.abrupt("return",c);case 9:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Xm=function(){var e=Tm(xm().mark((function e(){var t,n,r,a,o,i,l,c,u,s,f,m,d,p,h,y,v,g,E,b,w,R,O,_,x,S,T,N,C,I,A;return xm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=wp.data.select("core/block-editor"),n=t.getBlocks,r=t.getBlockAttributes,a=wp.data.dispatch("core/block-editor"),o=a.updateBlockAttributes,i=wp.data.dispatch("core/editor"),l=i.editPost,i.savePost,c=wp.data.dispatch("core/notices"),u=c.createInfoNotice,s=c.removeNotice,f=wp.data.select("core/editor"),m=f.getEditedPostAttribute,d="mwai-translation-progress-notice",p=n(),h=m("title"),y=Tt(),v=function(){var e=Tm(xm().mark((function e(t){return xm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u("Translating content... ".concat(t,"%"),{id:d,isDismissible:!1}),e.next=3,new Promise((function(e){return setTimeout(e,100)}));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),g=function(e){e.style.opacity=.15,e.style.pointerEvents="none",e.style.userSelect="none",e.style.animation="neko-fade-animation 0.85s infinite linear"},E=function(e){e.style.opacity=1,e.style.pointerEvents="auto",e.style.userSelect="auto",e.style.animation="none"},p.forEach((function(e){var t=document.querySelector('[data-block="'.concat(e.clientId,'"]'));t&&g(t)})),(b=document.querySelector(".editor-post-title__input"))&&g(b),e.next=17,v(0);case 17:return w=p.length+2,R=0,O="",e.prev=20,e.next=23,qm(h,y);case 23:return O=e.sent,R++,l({title:O}),b&&E(b),e.next=29,v(Math.round(R/w*100));case 29:_=_m(p),e.prev=30,_.s();case 32:if((x=_.n()).done){e.next=50;break}if(S=x.value,!["core/paragraph","core/heading","core/list","core/quote","core/table"].includes(S.name)){e.next=45;break}if(!(T=r(S.clientId).content)){e.next=42;break}return e.next=39,qm(T,y);case 39:return N=e.sent,e.next=42,o(S.clientId,{content:N});case 42:(C=document.querySelector('[data-block="'.concat(S.clientId,'"]')))&&E(C),wp.data.dispatch("core/block-editor").selectBlock(S.clientId);case 45:return R++,e.next=48,v(Math.round(R/w*100));case 48:e.next=32;break;case 50:e.next=55;break;case 52:e.prev=52,e.t0=e.catch(30),_.e(e.t0);case 55:return e.prev=55,_.f(),e.finish(55);case 58:if(!(I=m("excerpt"))){e.next=64;break}return e.next=62,qm(I,y);case 62:A=e.sent,l({excerpt:A});case 64:return e.prev=64,p.forEach((function(e){var t=document.querySelector('[data-block="'.concat(e.clientId,'"]'));t&&E(t)})),s(d),e.finish(64);case 68:case"end":return e.stop()}}),e,null,[[20,,64,68],[30,52,55,58]])})));return function(){return e.apply(this,arguments)}}(),$m=function(){var e=null==L?void 0:L.module_suggestions,t=Nm(km(),2),n=t[0],r=t[1],a=Nm(km(),2),o=a[0],i=a[1],l=function(){var e=Tm(xm().mark((function e(){return xm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Xm();case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),c=function(){var e=Tm(xm().mark((function e(t){return xm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:wp.data.dispatch("core/editor").editPost({title:t});case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),u=function(){var e=Tm(xm().mark((function e(t){return xm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:wp.data.dispatch("core/editor").editPost({excerpt:t});case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return e?React.createElement(s.A,null,React.createElement(zm,{name:"mwai-document-settings",title:React.createElement(React.Fragment,null,React.createElement(Pt,null)," AI Engine"),className:"mwai-document-settings"},React.createElement("p",null,"Suggest:"),React.createElement("div",{style:{display:"flex"}},React.createElement(Fm,{variant:"primary",onClick:function(){var e=(0,wp.data.select("core/editor").getCurrentPost)(),t=e.id,n=e.title;r({postId:t,postTitle:n})},style:{flex:1,marginRight:10,textAlign:"center"}},React.createElement(Pt,{icon:"wand",style:{marginRight:8}})," Titles"),React.createElement(Fm,{variant:"primary",onClick:function(){var e=(0,wp.data.select("core/editor").getCurrentPost)(),t=e.id,n=e.title;i({postId:t,postTitle:n})},style:{flex:1,textAlign:"center"}},React.createElement(Pt,{icon:"wand",style:{marginRight:8}})," Excerpts")),React.createElement("div",{style:{display:"flex"}},React.createElement(Fm,{variant:"primary",onClick:l,style:{flex:1,marginTop:10,textAlign:"center"}},React.createElement(Pt,{icon:"wand",style:{marginRight:8}})," Translate Post")),React.createElement(s.A,null,React.createElement(E.N,null,React.createElement(Ef,{post:n,onTitleClick:c,onClose:r}),React.createElement(If,{post:o,onExcerptClick:u,onClose:i}))))):null};function Qm(e){return Qm="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},Qm(e)}function Jm(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 Zm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Jm(Object(n),!0).forEach((function(t){var r,a,o,i;r=e,a=t,o=n[t],i=function(e,t){if("object"!=Qm(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Qm(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a),(a="symbol"==Qm(i)?i:String(i))in r?Object.defineProperty(r,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[a]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jm(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ed(){return ed=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},ed.apply(this,arguments)}function td(){td=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",c=o.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 s(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),l=new I(r||[]);return a(i,"_invoke",{value:S(e,n,l)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var m="suspendedStart",d="suspendedYield",p="executing",h="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,R=w&&w(w(A([])));R&&R!==n&&r.call(R,i)&&(b=R);var O=E.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(a,o,i,l){var c=f(e[a],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==Qm(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,l)}),(function(e){n("throw",e,i,l)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function S(t,n,r){var a=m;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===h){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var c=T(l,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===m)throw a=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var u=f(t,n,r);if("normal"===u.type){if(a=r.done?h:d,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(a=h,r.method="throw",r.arg=u.arg)}}}function T(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function N(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 I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(Qm(t)+" is not iterable")}return g.prototype=E,a(O,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,c,"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,E):(e.__proto__=E,u(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},t.awrap=function(e){return{__await:e}},_(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new x(s(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(O),u(O,c,"Generator"),u(O,i,(function(){return this})),u(O,"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,I.prototype={constructor:I,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 a(r,a){return l.type="throw",l.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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 a=r.arg;C(n)}return a}}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 nd(e,t,n,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function rd(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){nd(o,r,a,i,l,"next",e)}function l(e){nd(o,r,a,i,l,"throw",e)}i(void 0)}))}}function ad(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return od(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)?od(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 od(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 id=wp.hooks.addFilter,ld=wp.element,cd=ld.useState,ud=ld.useRef,sd=ld.useEffect,fd=wp.components,md=fd.TextControl,dd=(fd.Spinner,fd.ProgressBar),pd=fd.ToggleControl,hd=fd.Card,yd=fd.CardBody,vd=wp.data.dispatch,gd="mwai-copilot/prevent-new-block";var Ed,bd=["children","type","title","hint","isSelected","isDisplayed"];function wd(){return wd=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},wd.apply(this,arguments)}var Rd=React.createElement(Pt,{icon:"ai",style:{width:20,height:20}}),Od=G.Ay.div(Ed||(Ed=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n  color: black;\n  display: flex;\n  flex-direction: column;\n  border: 1px solid black;\n  font-size: 15px;\n  box-sizing: content-box;\n  font-weight: 400;\n  font-size: 13px;\n  padding: 10px;\n  background: hsl(0deg 0% 100% / 75%);\n  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n  margin-bottom: 10px;\n\n\n  .mwai-title-container {\n    flex: inherit;\n    padding: 5px 0px 5px 10px;\n    display: flex;\n    align-items: center;\n    color: black;\n    font-weight: 600;\n    cursor: pointer;\n\n    .mwai-hint {\n      font-size: 10px;\n      font-weight: 400;\n      text-align: right;\n      flex: auto;\n\n      .mwai-pill {\n        background: var(--wp--preset--color--vivid-cyan-blue);\n        padding: 5px 10px;\n        border-radius: 8px;\n        color: white;\n      }\n\n      .mwai-pill-purple {\n        background: var(--wp--preset--color--vivid-purple);\n      }\n    }\n  }\n\n  .mwai-block-container-content {\n    flex: auto;\n    padding: 10px;\n    display: flex;\n    flex-direction: column;\n  }\n\n\t&.mwai-chatbot {\n\t\tbackground: var(--neko-main-color);\n\n\t\t.mwai-title-container {\n\t\t\tcolor: white;\n\t\t}\t\n\n\t\t.mwai-block-container-content {\n\t\t\tmargin-top: 10px;\n\t\t\tborder-radius: 5px;\n\t\t\tbackground: var(--neko-background-color);\n\t\t}\n\t}\n\n  &.is-selected {\n  }\n']))),_d=function(e){var t=e.children,n=e.type,r=void 0===n?"":n,a=e.title,o=void 0===a?"":a,i=e.hint,l=void 0===i?"":i,c=e.isSelected,u=e.isDisplayed,s=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,bd),f=(0,Zt.gR)("mwai-block-container","mwai-".concat(r),{"is-selected":c,"is-meow":!0});return React.createElement(Od,wd({className:f},s),React.createElement("div",{className:"mwai-title-container"},React.createElement(Pt,{icon:"ai",style:{width:20,height:20}}),React.createElement("div",null,o),React.createElement("div",{className:"mwai-hint"},l)),(c||u)&&React.createElement("div",{className:"mwai-block-container-content"},t))};function xd(e){return xd="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},xd(e)}function Sd(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 Td(e,t,n){var r;return r=function(e,t){if("object"!=xd(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=xd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==xd(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nd(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Cd(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)?Cd(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 Cd(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 Id=wp.blocks.registerBlockType,Ad=wp.element,kd=Ad.useMemo,Ld=Ad.useState,Md=wp.components,Pd=Md.PanelBody,jd=Md.SelectControl,Fd=Md.ToggleControl,Dd=wp.blockEditor,Gd=Dd.InspectorControls,Ud=Dd.useBlockProps,Bd=function(e){return e.replace(/[A-Z]/g,(function(e){return"_".concat(e.toLowerCase())}))},Hd=function(e){var t=e.attributes,n=t.chatbotId,r=t.isCustomChatbot,a=t.shortcodeParams;if(r){var o=Object.entries(a).filter((function(e){var t=Nd(e,2)[1];return null!=t&&""!==t})).reduce((function(e,t){var n=Nd(t,2),r=n[0],a=n[1],o=Bd(r);return"".concat(e," ").concat(o,'="').concat(a,'"')}),"[mwai_chatbot");return"".concat(o,"]")}var i={id:{value:n,insertIfNull:!0}},l=Object.entries(i).filter((function(e){var t=Nd(e,2)[1],n=t.value,r=t.insertIfNull;return!!n||r})).reduce((function(e,t){var n=Nd(t,2),r=n[0],a=n[1].value,o=Bd(r);return"".concat(e," ").concat(o,'="').concat(a,'"')}),"[mwai_chatbot");return"".concat(l,"]")},Yd=function(e){var t=e.attributes,n=t.chatbotId,r=t.isCustomChatbot,a=t.shortcodeParams,o=e.setAttributes,i=e.isSelected,l=Nd(Ld(a),2),c=l[0],u=l[1],s=Ud(),f=kd((function(){var e=F.map((function(e){return{label:e.name,value:e.botId}}));return e.unshift({label:"None",value:null}),e}),[F]),m=kd((function(){return F.find((function(e){return e.botId===n}))}),[n]),d=kd((function(){return r?"Custom Chatbot":m?"Chatbot (".concat(m.name,")"):"Chatbot"}),[r,n,m]);return React.createElement(React.Fragment,null,React.createElement("div",s,React.createElement(_d,{title:d,type:"chatbot",isSelected:i},r&&React.createElement(React.Fragment,null,React.createElement(Ko,{shortcodeParams:c,updateShortcodeParams:function(e,t){var n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Sd(Object(n),!0).forEach((function(t){Td(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sd(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},c);n[t]=e,u(n),o({shortcodeParams:n})},options:L,blockMode:!0})),!r&&React.createElement("p",null,"Selected chatbot: ",m?m.name:"None"))),React.createElement(Gd,null,React.createElement(Pd,{title:He.COMMON.CHATBOT},React.createElement(Fd,{label:"Custom Chatbot",checked:r,onChange:function(e){return o({isCustomChatbot:e})}}),!r&&f&&f.length>0&&React.createElement(jd,{label:He.COMMON.CHATBOT,value:n,options:f,onChange:function(e){return o({chatbotId:e})}})),!r&&React.createElement(Pd,{title:He.COMMON.SETTINGS})))};function zd(){return zd=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},zd.apply(this,arguments)}var Wd=wp.i18n.__,Vd=wp.blocks.registerBlockType,Kd=wp.element.useEffect,qd=wp.components,Xd=qd.PanelBody,$d=qd.SelectControl,Qd=qd.TextControl,Jd=wp.blockEditor,Zd=Jd.InspectorControls,ep=Jd.InnerBlocks,tp=Jd.useBlockProps,np=function(e){var t=tp.save(),n=e.attributes,r=n.id,a=n.theme,o='[mwai-form-container id="'.concat(r,'" theme="').concat(a,'"]');return React.createElement("div",zd({},t,{id:"mwai-form-container-".concat(r),className:"mwai-form-container"}),o,React.createElement(ep.Content,null))},rp=function(e){var t=e.attributes,n=t.id,r=t.theme,a=e.setAttributes,o=tp();return Kd((function(){if(!n){var e=Math.random().toString(36).substr(2,9);a({id:e})}}),[n]),React.createElement(React.Fragment,null,React.createElement("div",o,React.createElement(_d,{title:"Container",type:"container",isDisplayed:!0},React.createElement(ep,null))),React.createElement(Zd,null,React.createElement(Xd,{title:He.COMMON.STYLE},React.createElement("p",null,"The theme will be applied to all the AI elements in this container."),React.createElement($d,{label:"Theme",value:r,onChange:function(e){return a({theme:e})},options:[{label:"None",value:"none"},{label:"ChatGPT",value:"ChatGPT"},{label:"Timeless",value:"Timeless"}]}),React.createElement(Qd,{label:"ID",value:n,onChange:function(e){return a({id:e})}}))))};function ap(e){return function(e){if(Array.isArray(e))return op(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return op(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)?op(e,t):void 0}}(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 op(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 ip=wp.i18n.__,lp=wp.blocks.registerBlockType,cp=wp.element.useEffect,up=wp.components,sp=up.Button,fp=up.PanelBody,mp=up.TextControl,dp=up.SelectControl,pp=up.CheckboxControl,hp=wp.blockEditor,yp=hp.useBlockProps,vp=hp.InspectorControls,gp=function(e){var t=e.attributes,n=t.id,r=t.label,a=t.type,o=t.name,i=t.options,l=void 0===i?[]:i,c=t.placeholder,u=t.rows,s=t.defaultValue,f=t.maxlength,m=t.required,d=encodeURIComponent((0,O.F1)(l)),p=yp.save(),h="[mwai-form-field";return n&&(h+=' id="'.concat(n,'"')),r&&(h+=' label="'.concat(r,'"')),a&&(h+=' type="'.concat(a,'"')),o&&(h+=' name="'.concat(o,'"')),d&&(h+=' options="'.concat(d,'"')),c&&(h+=' placeholder="'.concat(c,'"')),"textarea"===a&&u&&(h+=' rows="'.concat(u,'"')),s&&(h+=' default="'.concat(s,'"')),f&&(h+=' maxlength="'.concat(f,'"')),m&&(h+=' required="'.concat(m,'"')),h+="]",React.createElement("div",p,h)},Ep=function(e){var t,n=e.attributes,r=n.id,a=n.type,o=n.name,i=n.options,l=void 0===i?[]:i,c=n.label,u=n.placeholder,s=n.rows,f=n.defaultValue,m=n.maxlength,d=n.required,p=e.setAttributes,h=e.isSelected,y=yp();return cp((function(){if(!r){var e=Math.random().toString(36).substr(2,9);p({id:"mwai-"+e})}}),[r]),React.createElement(React.Fragment,null,React.createElement("div",y,React.createElement(_d,{title:"".concat((t=a,t.charAt(0).toUpperCase()+t.slice(1))),type:"field",isSelected:h,hint:React.createElement("span",{className:"mwai-pill"},"{",o,"}")},React.createElement("div",null,c),React.createElement("div",{style:{flex:"auto"}}),React.createElement("div",null,o))),React.createElement(vp,null,React.createElement(fp,{title:ip("Field")},React.createElement(mp,{label:"Label Text",value:c,onChange:function(e){p({label:e});var t=e.trim().replace(/ /g,"_").replace(/[^\w-]+/g,"").toUpperCase();t&&p({name:t})}}),React.createElement(mp,{label:"Field Name",value:o,onChange:function(e){return p({name:e})}}),React.createElement(dp,{label:"Field Type",value:a,onChange:function(e){return p({type:e})},options:[{label:"Input",value:"input"},{label:"Select",value:"select"},{label:"Checkbox",value:"checkbox"},{label:"Radio",value:"radio"},{label:"Text Area",value:"textarea"}]}),("input"===a||"textarea"===a)&&React.createElement(mp,{label:"Placeholder",value:u,onChange:function(e){return p({placeholder:e})}}),("input"===a||"textarea"===a)&&React.createElement(mp,{label:"Default Value",value:f,onChange:function(e){return p({defaultValue:e})}}),("input"===a||"textarea"===a)&&React.createElement(mp,{label:"Max Length",value:m,onChange:function(e){return p({maxlength:e})}}),"textarea"===a&&React.createElement(mp,{label:He.COMMON.ROWS,value:s,onChange:function(e){return p({rows:e})},type:"number",step:"1",min:"1",max:"100"}),React.createElement(pp,{label:"Required",checked:d,onChange:function(e){return p({required:e})}})),("select"===a||"radio"===a||"checkbox"===a)&&React.createElement(fp,{title:React.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"}},React.createElement("div",null,ip("Options")))},l.map((function(e,t){return React.createElement("div",{key:t,style:{display:"flex",marginBottom:-25}},React.createElement("div",{style:{marginRight:5}},React.createElement(mp,{style:{marginRight:10},label:"Label",isInline:!0,value:e.label,onChange:function(e){var n=ap(l);n[t].label=e,p({options:n})}})),React.createElement(mp,{style:{},label:"Value",isSubtle:!0,value:e.value,onChange:function(e){var n=ap(l);n[t].value=e,p({options:n})}}),React.createElement("div",{style:{marginLeft:5,position:"relative",top:23}},React.createElement(sp,{style:{height:30},isDestructive:!0,icon:"trash",isSmall:!0,onClick:function(){var e=ap(l);e.splice(t,1),p({options:e})}})))})),React.createElement(sp,{isPrimary:!0,style:{width:"100%",marginTop:10},onClick:function(){var e=ap(l);e.push({label:"",value:""}),p({options:e})}},"Add Option")),React.createElement(fp,{title:He.COMMON.SYSTEM},React.createElement(mp,{label:"ID",value:r,onChange:function(e){return p({id:e})}}))))};function bp(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Rp(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)?Rp(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 Rp(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 Op=wp.i18n.__,_p=wp.blocks.registerBlockType,xp=wp.element.useEffect,Sp=wp.components,Tp=Sp.PanelBody,Np=Sp.TextControl,Cp=Sp.CheckboxControl,Ip=wp.blockEditor,Ap=Ip.InspectorControls,kp=Ip.useBlockProps,Lp=function(e){var t=e.attributes,n=t.id,r=t.copyButton,a=kp.save(),o={id:{value:n,insertIfNull:!0},copy_button:{value:r,insertIfNull:!1}},i=Object.entries(o).filter((function(e){var t=bp(e,2)[1],n=t.value,r=t.insertIfNull;return!1!==n&&""!==n||r})).reduce((function(e,t){var n=bp(t,2),r=n[0],a=n[1].value;return"".concat(e," ").concat(r,'="').concat(a,'"')}),"[mwai-form-output");return i="".concat(i,"]"),React.createElement("div",a,i)},Mp=function(e){var t=e.attributes,n=t.id,r=t.copyButton,a=e.setAttributes,o=e.isSelected,i=kp();return xp((function(){if(!n){var e=Math.random().toString(36).substr(2,9);a({id:"mwai-"+e})}}),[n]),React.createElement(React.Fragment,null,React.createElement("div",i,React.createElement(_d,{title:"Output",type:"output",isSelected:o,hint:React.createElement("span",{className:"mwai-pill mwai-pill-purple"},"#",n)},React.createElement("div",null),React.createElement("div",{style:{flex:"auto"}}),React.createElement("div",null,"#",n))),React.createElement(Ap,null,React.createElement(Tp,{title:He.FORMS.OUTPUT},React.createElement(Cp,{label:"Copy Button",checked:r,onChange:function(e){return a({copyButton:e})}}),React.createElement(Np,{label:"ID",value:n,onChange:function(e){return a({id:e})}}))))};function Pp(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,a,o,i,l=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return jp(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)?jp(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 jp(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 Fp=wp.i18n.__,Dp=wp.blocks.registerBlockType,Gp=wp.element,Up=Gp.useMemo,Bp=Gp.useEffect,Hp=wp.components,Yp=Hp.PanelBody,zp=Hp.TextControl,Wp=Hp.TextareaControl,Vp=Hp.SelectControl,Kp=Hp.CheckboxControl,qp=wp.blockEditor,Xp=qp.InspectorControls,$p=qp.useBlockProps,Qp=function(e){var t=e.attributes,n=t.id,r=t.label,a=t.prompt,o=t.message,i=t.outputElement,l=t.aiEnvId,c=t.embeddingsEnvId,u=t.index,s=t.namespace,f=t.model,m=t.temperature,d=t.maxTokens,p=t.isAssistant,h=t.assistantId,y=t.resolution,v=encodeURIComponent(a),g=encodeURIComponent(o),E=$p.save(),b={id:{value:n,insertIfNull:!0},label:{value:r,insertIfNull:!0},prompt:{value:v,insertIfNull:!1},message:{value:g,insertIfNull:!1},output_element:{value:i,insertIfNull:!0},model:{value:f,insertIfNull:!1},temperature:{value:m,insertIfNull:!1},max_tokens:{value:d,insertIfNull:!1},is_assistant:{value:p,insertIfNull:!1},env_id:{value:l,insertIfNull:!1},embeddings_env_id:{value:c,insertIfNull:!1},embeddings_index:{value:u,insertIfNull:!1},embeddings_namespace:{value:s,insertIfNull:!1},assistant_id:{value:h,insertIfNull:!1},resolution:{value:y,insertIfNull:!1}},w=Object.entries(b).filter((function(e){var t=Pp(e,2)[1],n=t.value,r=t.insertIfNull;return!!n||r})).reduce((function(e,t){var n=Pp(t,2),r=n[0],a=n[1].value;return"".concat(e," ").concat(r,'="').concat(a,'"')}),"[mwai-form-submit");return w="".concat(w,"]"),React.createElement("div",E,w)},Jp=function(e){var t,n=$p(),r=e.attributes,a=r.id,o=r.label,i=r.prompt,l=r.message,c=r.model,u=r.temperature,s=r.maxTokens,f=r.aiEnvId,m=r.embeddingsEnvId,d=r.index,p=r.namespace,h=r.assistantId,y=r.resolution,v=r.isAssistant,g=r.outputElement,E=r.placeholders,b=void 0===E?[]:E,w=e.setAttributes,R=e.isSelected,O=Up((function(){return L.embeddings_envs||[]}),[]),_=Up((function(){return O.find((function(e){return e.id===m}))||null}),[O,m]),x=Up((function(){return(null==_?void 0:_.indexes)||[]}),[_]),S=Up((function(){return(null==_?void 0:_.namespaces)||[]}),[_]),T=Up((function(){return L.ai_envs||[]}),[]),N=ft(L,f),C=N.models,I=(0,N.getModel)(c),A=null==I||null===(t=I.features)||void 0===t?void 0:t.includes("text-to-image"),k=Up((function(){return T.find((function(e){return e.id===f}))||null}),[T,f]),M=Up((function(){return(null==k?void 0:k.assistants)||[]}),[k]),P=Up((function(){return M.find((function(e){return e.id===h}))||null}),[M,h]);Bp((function(){!f&&!c||k||w({aiEnvId:null,model:null})}),[f]),Bp((function(){(m||d||p)&&!_&&w({embeddingsEnvId:null,index:null,namespace:null})}),[m]),Bp((function(){P&&P.model&&P.model!==c&&w({model:P.model})}),[P]),Bp((function(){v||w({assistantId:""})}),[v]),Bp((function(){if(!a){var e=Math.random().toString(36).substr(2,9);w({id:"mwai-"+e})}}),[a]),Bp((function(){var e=l.match(/{([^}]+)}/g);if(e){var t=e.map((function(e){return e.replace("{","").replace("}","")}));t.join(",")!==b.join(",")&&w({placeholders:t})}else w({placeholders:[]})}),[l]),Bp((function(){i&&w({message:i,prompt:null})}),[i]);var j=Up((function(){return b?b.length:0}),[b]),F=Up((function(){var e=M.map((function(e){return{label:e.name,value:e.id}}));return e.unshift({label:"None",value:""}),e}),[M]),D=Up((function(){var e=C.map((function(e){return{label:e.rawName,value:e.model}}));return e.unshift({label:"Default",value:""}),e}),[C]),G=Up((function(){var e;if(!I||!A)return[];var t=(null==I||null===(e=I.resolutions)||void 0===e?void 0:e.map((function(e){return{label:e.label,value:e.name}})))||[];return t.unshift({label:"None",value:""}),t}),[I,A]),U=Up((function(){var e=x.map((function(e){return{label:e.name,value:e.name}}));return e.unshift({label:"None",value:""}),e}),[x]),B=Up((function(){var e=T.map((function(e){return{label:e.name,value:e.id}}));return e.unshift({label:"Default",value:""}),e}),[T]),H=Up((function(){var e=O.map((function(e){return{label:e.name,value:e.id}}));return e.unshift({label:"None",value:""}),e}),[O]),Y=Up((function(){var e=S.map((function(e){return{label:e,value:e}}));return e.unshift({label:"None",value:""}),e}),[S]),z=Up((function(){return 0===j?"N/A":React.createElement("span",{className:"mwai-pill"},j," field",j>1?"s":"")}),[j]);return React.createElement(React.Fragment,null,React.createElement("div",n,React.createElement(_d,{title:"Submit",type:"submit",isSelected:R,hint:React.createElement(React.Fragment,null,"IN:"," ",React.createElement("span",{className:"mwai-pill"},z)," ","OUT:"," ",React.createElement("span",{className:"mwai-pill mwai-pill-purple"},g||"N/A"))},"Input Fields: ",b.join(", "),React.createElement("br",null),"Prompt: ",l,React.createElement("br",null),"Output Element: ",g)),React.createElement(Xp,null,React.createElement(Yp,{title:He.COMMON.OUTPUT},React.createElement(zp,{label:He.COMMON.LABEL,value:o,onChange:function(e){return w({label:e})}}),React.createElement(Wp,{label:He.COMMON.PROMPT,value:l,onChange:function(e){return w({message:e})},help:He.FORMS.PROMPT_INFO}),React.createElement(zp,{label:He.FORMS.OUTPUT_ELEMENT,value:g,onChange:function(e){return w({outputElement:e})},help:He.FORMS.OUTPUT_ELEMENT_INFO})),React.createElement(Yp,{title:He.COMMON.MODEL_PARAMS},T&&T.length>0&&React.createElement(Vp,{label:He.COMMON.ENVIRONMENT,value:f,options:B,onChange:function(e){return w({aiEnvId:e})}}),T&&T.length>0&&React.createElement(Kp,{label:"Assistant Mode",checked:v,onChange:function(e){return w({isAssistant:e})}}),v&&M&&M.length>0&&React.createElement(React.Fragment,null,React.createElement(Vp,{label:He.COMMON.ASSISTANT,value:h,options:F,onChange:function(e){return w({assistantId:e})}})),!v&&React.createElement(React.Fragment,null,C&&C.length>0&&React.createElement(Vp,{label:He.COMMON.MODEL,value:c,options:D,onChange:function(e){return w({model:e})}}),!A&&React.createElement(React.Fragment,null,React.createElement(zp,{label:He.COMMON.TEMPERATURE,value:u,onChange:function(e){return w({temperature:parseFloat(e)})},type:"number",step:"0.1",min:"0",max:"1",help:He.HELP.TEMPERATURE}),React.createElement(zp,{label:He.COMMON.MAX_TOKENS,value:s,onChange:function(e){return w({maxTokens:parseInt(e)})},type:"number",step:"16",min:"32",max:"4096",help:React.createElement(Eo,{model:I,maxTokens:s,onRecommendedClick:function(e){return w({maxTokens:e})}})})),A&&React.createElement(React.Fragment,null,React.createElement(Vp,{label:He.COMMON.RESOLUTION,value:y,options:G,onChange:function(e){return w({resolution:e})}})))),!A&&React.createElement(React.Fragment,null,React.createElement(Yp,{title:He.COMMON.CONTEXT_PARAMS},O&&O.length>0&&React.createElement(Vp,{label:He.COMMON.EMBEDDINGS_ENV,value:m,options:H,disabled:!(null!=H&&H.length),onChange:function(e){return w({embeddingsEnvId:e})}}),x&&x.length>0&&React.createElement(Vp,{label:He.COMMON.EMBEDDINGS_INDEX,value:d,options:U,disabled:!(null!=H&&H.length),onChange:function(e){return w({index:e})}}),"pinecone"===(null==_?void 0:_.type)&&S&&S.length>0&&React.createElement(Vp,{label:He.COMMON.NAMESPACE,value:p,options:Y,disabled:!(null!=H&&H.length),onChange:function(e){return w({namespace:e})}}))),React.createElement(Yp,{title:He.COMMON.SYSTEM},React.createElement(zp,{label:"ID",value:a,onChange:function(e){return w({id:e})}}))))};var Zp,eh=wp.element.render,th=new c.E({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnMount:!1,retry:!1,placeholderData:function(e){return e}}}}),nh=L.module_chatbots,rh=L.module_suggestions,ah=L.module_forms;nh&&Id("ai-engine/chatbot",{title:"AI Chatbot",description:"Embed an AI Engine Chatbot in your content.",icon:Rd,category:"layout",keywords:["ai","openai","chatbot"],attributes:{id:{type:"string",default:""},chatbotId:{type:"string",default:"default"},isCustomChatbot:{type:"boolean",default:!1},shortcodeParams:{type:"object",default:{}}},edit:Yd,save:Hd}),ah&&(lp("ai-engine/form-field",{apiVersion:3,title:"AI Form Field",description:"An AI Field for your AI Form.",icon:Rd,category:"layout",keywords:[ip("ai"),ip("openai"),ip("form")],supports:{dimensions:{width:!0}},attributes:{id:{type:"string",default:""},name:{type:"string",default:"LABEL"},type:{type:"string",default:"input"},options:{type:"array",default:[]},label:{type:"string",default:"Label: "},placeholder:{type:"string",default:""},defaultValue:{type:"string",default:""},maxlength:{type:"string",default:""},rows:{type:"rows",default:4},required:{type:"boolean",default:!0}},edit:Ep,save:gp}),_p("ai-engine/form-output",{title:"AI Form Output",description:"An Output Field for your AI Form.",icon:Rd,category:"layout",keywords:[Op("ai"),Op("openai"),Op("form")],supports:{dimensions:{minHeight:!0}},attributes:{id:{type:"string",default:""},copyButton:{type:"boolean",default:!0}},edit:Mp,save:Lp}),Dp("ai-engine/form-submit",{title:"AI Form Submit",description:"The Submit Button for your AI Form.",icon:Rd,category:"layout",keywords:[Fp("ai"),Fp("openai"),Fp("form")],supports:{dimensions:{minHeight:!1}},attributes:{id:{type:"string",default:""},label:{type:"string",default:"Submit"},prompt:{type:"string",default:""},message:{type:"string",default:""},outputElement:{type:"string",default:""},model:{type:"string",default:""},temperature:{type:"number",default:.8},maxTokens:{type:"number",default:4096},placeholders:{type:"array",default:[]},aiEnvId:{type:"string",default:""},embeddingsEnvId:{type:"string",default:""},index:{type:"string",default:""},namespace:{type:"string",default:null},isAssistant:{type:"boolean",default:!1},assistantId:{type:"string",default:""},resolution:{type:"string",default:null}},edit:Jp,save:Qp}),Vd("ai-engine/form-container",{title:"AI Form Container",description:"Container to embed the blocks relative to a specific AI Form.",icon:Rd,category:"layout",keywords:[Wd("ai"),Wd("openai"),Wd("form")],attributes:{id:{type:"string",default:""},theme:{type:"string",default:"ChatGPT"}},edit:rp,save:np})),rh&&(Pm("ai-engine-document-settings",{render:$m}),Wm("ai-wand/actions",{title:"AI Wand",tagName:"mwai",className:null,edit:Km}),Zp=function(e){var t=ud(),n=ad(cd(!1),2),r=n[0],a=n[1],o=ad(cd(""),2),i=o[0],l=o[1],c=ad(cd(!1),2),u=c[0],s=c[1],f=ad(cd(!1),2),m=f[0],d=f[1],p=ad(cd(!1),2),h=p[0],y=p[1],v=wp.data.select("core/editor").getCurrentPostId(),g=function(){var t=rd(td().mark((function t(n){var r,o,i,c,u,f,m,d,p,y;return td().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=Tt("[== CURRENT BLOCK ==]"),t.prev=1,s(!0),t.next=5,(0,O.IU)("".concat(T,"/ai/copilot"),{method:"POST",nonce:k,json:{action:h?"image":"text",message:n,context:r,postId:v}});case 5:o=t.sent,h?(i=o.data.media,c=wp.blocks.createBlock,u=wp.data.dispatch("core/block-editor"),f=u.replaceBlock,m=wp.data.select("core/block-editor"),d=m.getSelectedBlockClientId,p=c("core/image",{id:i.id,url:i.url,title:i.title,caption:i.caption,alt:i.alt}),y=d(),f(y,p)):e.setAttributes({content:o.data}),setTimeout((function(){var e=wp.data.select("core/block-editor").getSelectedBlockClientId,t=document.querySelector('[data-block="'.concat(e(),'"]'));if(t){var n=document.createRange(),r=window.getSelection();n.setStart(t,1),n.collapse(!0),r.removeAllRanges(),r.addRange(n)}}),50),t.next=14;break;case 10:t.prev=10,t.t0=t.catch(1),console.error("Error:",t.t0.message),vd("core/notices").createErrorNotice("AI Copilot error: ".concat(t.t0.message),{isDismissible:!0});case 14:return t.prev=14,s(!1),a(!1),l(""),t.finish(14);case 19:case"end":return t.stop()}}),t,null,[[1,10,14,19]])})));return function(e){return t.apply(this,arguments)}}(),E=function(){var e=rd(td().mark((function e(t){return td().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!m){e.next=2;break}return e.abrupt("return");case 2:if("Enter"!==t.key){e.next=9;break}return t.preventDefault(),t.stopPropagation(),e.next=7,g(i);case 7:e.next=10;break;case 9:("Escape"===t.key||"Backspace"===t.key&&!i)&&(t.preventDefault(),a(!1),l(""));case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return sd((function(){r&&t.current&&t.current.focus()}),[r]),sd((function(){var e=function(e){if(r&&"Enter"===e.key)return e.preventDefault(),!1};return vd("core/keyboard-shortcuts").registerShortcut({name:gd,category:"block",description:"Prevent new block creation when AI Copilot is active",keyCombination:{character:"enter"}}),window.addEventListener("keydown",e,!0),function(){window.removeEventListener("keydown",e,!0),vd("core/keyboard-shortcuts").unregisterShortcut(gd)}}),[r]),r?React.createElement(hd,null,React.createElement(yd,null,u?React.createElement("div",{style:{textAlign:"center",padding:20}},React.createElement(dd,null)):React.createElement(React.Fragment,null,React.createElement(md,{ref:t,label:React.createElement(React.Fragment,null,React.createElement(Pt,{icon:"wand",style:{marginBottom:-4}}),"AI Copilot"),value:i,placeholder:h?"Describe the image...":"Write about...",onChange:function(e){return l(e)},onKeyDown:E,onCompositionStart:function(){return d(!0)},onCompositionEnd:function(){return d(!1)}}),React.createElement("div",{style:{display:"flex",justifyContent:"end",marginBottom:-12}},React.createElement(pd,{label:"Image Mode",checked:h,onChange:y}))))):React.createElement("div",{onCompositionStart:function(){return d(!0)},onCompositionEnd:function(){return d(!1)},onKeyDown:function(e){var t,n;if(!m){var r=((null==e||null===(t=e.target)||void 0===t?void 0:t.innerText)||"").trim(),o=null==e||null===(n=e.target)||void 0===n?void 0:n.localName;"Space"!==e.code||r||"p"!==o||(e.preventDefault(),a(!0))}}},React.createElement(e.BlockEdit,e))},id("editor.BlockEdit","mwai-copilot/module",(function(e){return function(t){return"core/paragraph"===t.name?React.createElement(Zp,ed({BlockEdit:e},t)):React.createElement(e,t)}})),id("blocks.registerBlockType","mwai-copilot/placeholder",(function(e,t){if("core/paragraph"===t){var n=e.edit;e.edit=function(e){return e=Zm(Zm({},e),{},{attributes:Zm(Zm({},e.attributes),{},{placeholder:"Type / to choose a block, or press space to summon the AI Copilot"})}),n(e)}}return e}))),document.addEventListener("DOMContentLoaded",(function(){var e=document.getElementById("mwai-admin-settings");e&&eh(React.createElement(u.Ht,{client:th},React.createElement(s.A,null,React.createElement(fs,null))),e);var t=document.getElementById("mwai-content-generator");t&&eh(React.createElement(u.Ht,{client:th},React.createElement(s.A,null,React.createElement(em,null))),t);var n=document.getElementById("mwai-image-generator");n&&eh(React.createElement(u.Ht,{client:th},React.createElement(s.A,null,React.createElement(Em,null))),n);var r=document.getElementById("mwai-playground");if(r&&eh(React.createElement(u.Ht,{client:th},React.createElement(s.A,null,React.createElement(nf,null))),r),rh){var a=document.getElementById("mwai-admin-postsList");a&&eh(React.createElement(s.A,null,React.createElement(Gf,null)),a)}var o=document.getElementById("meow-common-dashboard");o&&eh(React.createElement(u.Ht,{client:th},React.createElement(s.A,null,React.createElement(be,null))),o)}))},1594:e=>{e.exports=React},5206:e=>{e.exports=ReactDOM}},__webpack_module_cache__={},deferred;function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(n.exports,n,n.exports,__webpack_require__),n.exports}__webpack_require__.m=__webpack_modules__,__webpack_require__.amdO={},deferred=[],__webpack_require__.O=(e,t,n,r)=>{if(!t){var a=1/0;for(c=0;c<deferred.length;c++){for(var[t,n,r]=deferred[c],o=!0,i=0;i<t.length;i++)(!1&r||a>=r)&&Object.keys(__webpack_require__.O).every((e=>__webpack_require__.O[e](t[i])))?t.splice(i--,1):(o=!1,r<a&&(a=r));if(o){deferred.splice(c--,1);var l=n();void 0!==l&&(e=l)}}return e}r=r||0;for(var c=deferred.length;c>0&&deferred[c-1][2]>r;c--)deferred[c]=deferred[c-1];deferred[c]=[t,n,r]},__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={57:0};__webpack_require__.O.j=t=>0===e[t];var t=(t,n)=>{var r,a,[o,i,l]=n,c=0;if(o.some((t=>0!==e[t]))){for(r in i)__webpack_require__.o(i,r)&&(__webpack_require__.m[r]=i[r]);if(l)var u=l(__webpack_require__)}for(t&&t(n);c<o.length;c++)a=o[c],__webpack_require__.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return __webpack_require__.O(u)},n=self.wpJsonMwai=self.wpJsonMwai||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),__webpack_require__.nc=void 0;var __webpack_exports__=__webpack_require__.O(void 0,[121],(()=>__webpack_require__(158)));__webpack_exports__=__webpack_require__.O(__webpack_exports__)})();
  • ai-engine/trunk/app/vendor.js

    r3142784 r3153708  
    11/*! For license information please see vendor.js.LICENSE.txt */
    2 (self.wpJsonMwai=self.wpJsonMwai||[]).push([[121],{1919:(e,t,n)=>{"use strict";n.d(t,{A:()=>re});var r=function(){function e(e){var t=this;this._insertTag=function(e){var n;n=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,n),t.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(e){e.forEach(this._insertTag)},t.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(function(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}(this));var t=this.tags[this.tags.length-1];if(this.isSpeedy){var n=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(t);try{n.insertRule(e,n.cssRules.length)}catch(e){}}else t.appendChild(document.createTextNode(e));this.ctr++},t.flush=function(){this.tags.forEach((function(e){return e.parentNode&&e.parentNode.removeChild(e)})),this.tags=[],this.ctr=0},e}(),o=Math.abs,i=String.fromCharCode,a=Object.assign;function s(e){return e.trim()}function l(e,t,n){return e.replace(t,n)}function c(e,t){return e.indexOf(t)}function u(e,t){return 0|e.charCodeAt(t)}function h(e,t,n){return e.slice(t,n)}function f(e){return e.length}function d(e){return e.length}function p(e,t){return t.push(e),e}var m=1,g=1,y=0,v=0,b=0,x="";function w(e,t,n,r,o,i,a){return{value:e,root:t,parent:n,type:r,props:o,children:i,line:m,column:g,length:a,return:""}}function k(e,t){return a(w("",null,null,"",null,null,0),e,{length:-e.length},t)}function S(){return b=v>0?u(x,--v):0,g--,10===b&&(g=1,m--),b}function O(){return b=v<y?u(x,v++):0,g++,10===b&&(g=1,m++),b}function _(){return u(x,v)}function E(){return v}function C(e,t){return h(x,e,t)}function A(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function j(e){return m=g=1,y=f(x=e),v=0,[]}function P(e){return x="",e}function M(e){return s(C(v-1,L(91===e?e+2:40===e?e+1:e)))}function R(e){for(;(b=_())&&b<33;)O();return A(e)>2||A(b)>3?"":" "}function T(e,t){for(;--t&&O()&&!(b<48||b>102||b>57&&b<65||b>70&&b<97););return C(e,E()+(t<6&&32==_()&&32==O()))}function L(e){for(;O();)switch(b){case e:return v;case 34:case 39:34!==e&&39!==e&&L(b);break;case 40:41===e&&L(e);break;case 92:O()}return v}function I(e,t){for(;O()&&e+b!==57&&(e+b!==84||47!==_()););return"/*"+C(t,v-1)+"*"+i(47===e?e:O())}function N(e){for(;!A(_());)O();return C(e,v)}var z="-ms-",D="-moz-",F="-webkit-",B="comm",$="rule",H="decl",W="@keyframes";function q(e,t){for(var n="",r=d(e),o=0;o<r;o++)n+=t(e[o],o,e,t)||"";return n}function V(e,t,n,r){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case H:return e.return=e.return||e.value;case B:return"";case W:return e.return=e.value+"{"+q(e.children,r)+"}";case $:e.value=e.props.join(",")}return f(n=q(e.children,r))?e.return=e.value+"{"+n+"}":""}function U(e){return P(K("",null,null,null,[""],e=j(e),0,[0],e))}function K(e,t,n,r,o,a,s,h,d){for(var m=0,g=0,y=s,v=0,b=0,x=0,w=1,k=1,C=1,A=0,j="",P=o,L=a,z=r,D=j;k;)switch(x=A,A=O()){case 40:if(108!=x&&58==u(D,y-1)){-1!=c(D+=l(M(A),"&","&\f"),"&\f")&&(C=-1);break}case 34:case 39:case 91:D+=M(A);break;case 9:case 10:case 13:case 32:D+=R(x);break;case 92:D+=T(E()-1,7);continue;case 47:switch(_()){case 42:case 47:p(G(I(O(),E()),t,n),d);break;default:D+="/"}break;case 123*w:h[m++]=f(D)*C;case 125*w:case 59:case 0:switch(A){case 0:case 125:k=0;case 59+g:-1==C&&(D=l(D,/\f/g,"")),b>0&&f(D)-y&&p(b>32?Y(D+";",r,n,y-1):Y(l(D," ","")+";",r,n,y-2),d);break;case 59:D+=";";default:if(p(z=Q(D,t,n,m,g,o,h,j,P=[],L=[],y),a),123===A)if(0===g)K(D,t,z,z,P,a,y,h,L);else switch(99===v&&110===u(D,3)?100:v){case 100:case 108:case 109:case 115:K(e,z,z,r&&p(Q(e,z,z,0,0,o,h,j,o,P=[],y),L),o,L,y,h,r?P:L);break;default:K(D,z,z,z,[""],L,0,h,L)}}m=g=b=0,w=C=1,j=D="",y=s;break;case 58:y=1+f(D),b=x;default:if(w<1)if(123==A)--w;else if(125==A&&0==w++&&125==S())continue;switch(D+=i(A),A*w){case 38:C=g>0?1:(D+="\f",-1);break;case 44:h[m++]=(f(D)-1)*C,C=1;break;case 64:45===_()&&(D+=M(O())),v=_(),g=y=f(j=D+=N(E())),A++;break;case 45:45===x&&2==f(D)&&(w=0)}}return a}function Q(e,t,n,r,i,a,c,u,f,p,m){for(var g=i-1,y=0===i?a:[""],v=d(y),b=0,x=0,k=0;b<r;++b)for(var S=0,O=h(e,g+1,g=o(x=c[b])),_=e;S<v;++S)(_=s(x>0?y[S]+" "+O:l(O,/&\f/g,y[S])))&&(f[k++]=_);return w(e,t,n,0===i?$:u,f,p,m)}function G(e,t,n){return w(e,t,n,B,i(b),h(e,2,-2),0)}function Y(e,t,n,r){return w(e,t,n,H,h(e,0,r),h(e,r+1,-1),r)}var Z=function(e,t,n){for(var r=0,o=0;r=o,o=_(),38===r&&12===o&&(t[n]=1),!A(o);)O();return C(e,v)},X=new WeakMap,J=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||X.get(n))&&!r){X.set(e,!0);for(var o=[],a=function(e,t){return P(function(e,t){var n=-1,r=44;do{switch(A(r)){case 0:38===r&&12===_()&&(t[n]=1),e[n]+=Z(v-1,t,n);break;case 2:e[n]+=M(r);break;case 4:if(44===r){e[++n]=58===_()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=i(r)}}while(r=O());return e}(j(e),t))}(t,o),s=n.props,l=0,c=0;l<a.length;l++)for(var u=0;u<s.length;u++,c++)e.props[c]=o[l]?a[l].replace(/&\f/g,s[u]):s[u]+" "+a[l]}}},ee=function(e){if("decl"===e.type){var t=e.value;108===t.charCodeAt(0)&&98===t.charCodeAt(2)&&(e.return="",e.value="")}};function te(e,t){switch(function(e,t){return 45^u(e,0)?(((t<<2^u(e,0))<<2^u(e,1))<<2^u(e,2))<<2^u(e,3):0}(e,t)){case 5103:return F+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return F+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return F+e+D+e+z+e+e;case 6828:case 4268:return F+e+z+e+e;case 6165:return F+e+z+"flex-"+e+e;case 5187:return F+e+l(e,/(\w+).+(:[^]+)/,F+"box-$1$2"+z+"flex-$1$2")+e;case 5443:return F+e+z+"flex-item-"+l(e,/flex-|-self/,"")+e;case 4675:return F+e+z+"flex-line-pack"+l(e,/align-content|flex-|-self/,"")+e;case 5548:return F+e+z+l(e,"shrink","negative")+e;case 5292:return F+e+z+l(e,"basis","preferred-size")+e;case 6060:return F+"box-"+l(e,"-grow","")+F+e+z+l(e,"grow","positive")+e;case 4554:return F+l(e,/([^-])(transform)/g,"$1"+F+"$2")+e;case 6187:return l(l(l(e,/(zoom-|grab)/,F+"$1"),/(image-set)/,F+"$1"),e,"")+e;case 5495:case 3959:return l(e,/(image-set\([^]*)/,F+"$1$`$1");case 4968:return l(l(e,/(.+:)(flex-)?(.*)/,F+"box-pack:$3"+z+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+F+e+e;case 4095:case 3583:case 4068:case 2532:return l(e,/(.+)-inline(.+)/,F+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(f(e)-1-t>6)switch(u(e,t+1)){case 109:if(45!==u(e,t+4))break;case 102:return l(e,/(.+:)(.+)-([^]+)/,"$1"+F+"$2-$3$1"+D+(108==u(e,t+3)?"$3":"$2-$3"))+e;case 115:return~c(e,"stretch")?te(l(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==u(e,t+1))break;case 6444:switch(u(e,f(e)-3-(~c(e,"!important")&&10))){case 107:return l(e,":",":"+F)+e;case 101:return l(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+F+(45===u(e,14)?"inline-":"")+"box$3$1"+F+"$2$3$1"+z+"$2box$3")+e}break;case 5936:switch(u(e,t+11)){case 114:return F+e+z+l(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return F+e+z+l(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return F+e+z+l(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return F+e+z+e+e}return e}var ne=[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case H:e.return=te(e.value,e.length);break;case W:return q([k(e,{value:l(e.value,"@","@"+F)})],r);case $:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return q([k(e,{props:[l(t,/:(read-\w+)/,":-moz-$1")]})],r);case"::placeholder":return q([k(e,{props:[l(t,/:(plac\w+)/,":"+F+"input-$1")]}),k(e,{props:[l(t,/:(plac\w+)/,":-moz-$1")]}),k(e,{props:[l(t,/:(plac\w+)/,z+"input-$1")]})],r)}return""}))}}],re=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var o,i,a=e.stylisPlugins||ne,s={},l=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n<t.length;n++)s[t[n]]=!0;l.push(e)}));var c,u,h,f,p=[V,(f=function(e){c.insert(e)},function(e){e.root||(e=e.return)&&f(e)})],m=(u=[J,ee].concat(a,p),h=d(u),function(e,t,n,r){for(var o="",i=0;i<h;i++)o+=u[i](e,t,n,r)||"";return o});i=function(e,t,n,r){c=n,q(U(e?e+"{"+t.styles+"}":t.styles),m),r&&(g.inserted[t.name]=!0)};var g={key:t,sheet:new r({key:t,container:o,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:s,registered:{},insert:i};return g.sheet.hydrate(l),g}},6289:(e,t,n)=>{"use strict";function r(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}n.d(t,{A:()=>r})},85:(e,t,n)=>{"use strict";n.d(t,{C:()=>h,E:()=>y,T:()=>d,c:()=>m,h:()=>c,i:()=>l,w:()=>f});var r=n(1594),o=n(1919),i=n(41),a=n(2142),s=n(1287),l=!0,c={}.hasOwnProperty,u=r.createContext("undefined"!=typeof HTMLElement?(0,o.A)({key:"css"}):null),h=u.Provider,f=function(e){return(0,r.forwardRef)((function(t,n){var o=(0,r.useContext)(u);return e(t,o,n)}))};l||(f=function(e){return function(t){var n=(0,r.useContext)(u);return null===n?(n=(0,o.A)({key:"css"}),r.createElement(u.Provider,{value:n},e(t,n))):e(t,n)}});var d=r.createContext({}),p="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",m=function(e,t){var n={};for(var r in t)c.call(t,r)&&(n[r]=t[r]);return n[p]=e,n},g=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return(0,i.SF)(t,n,r),(0,s.s)((function(){return(0,i.sk)(t,n,r)})),null},y=f((function(e,t,n){var o=e.css;"string"==typeof o&&void 0!==t.registered[o]&&(o=t.registered[o]);var s=e[p],l=[o],u="";"string"==typeof e.className?u=(0,i.Rk)(t.registered,l,e.className):null!=e.className&&(u=e.className+" ");var h=(0,a.J)(l,void 0,r.useContext(d));u+=t.key+"-"+h.name;var f={};for(var m in e)c.call(e,m)&&"css"!==m&&m!==p&&(f[m]=e[m]);return f.ref=n,f.className=u,r.createElement(r.Fragment,null,r.createElement(g,{cache:t,serialized:h,isStringTag:"string"==typeof s}),r.createElement(s,f))}))},7437:(e,t,n)=>{"use strict";n.d(t,{AH:()=>c,i7:()=>u,mL:()=>l});var r=n(85),o=n(1594),i=n(41),a=n(1287),s=n(2142),l=(n(1919),n(4146),(0,r.w)((function(e,t){var n=e.styles,l=(0,s.J)([n],void 0,o.useContext(r.T));if(!r.i){for(var c,u=l.name,h=l.styles,f=l.next;void 0!==f;)u+=" "+f.name,h+=f.styles,f=f.next;var d=!0===t.compat,p=t.insert("",{name:u,styles:h},t.sheet,d);return d?null:o.createElement("style",((c={})["data-emotion"]=t.key+"-global "+u,c.dangerouslySetInnerHTML={__html:p},c.nonce=t.sheet.nonce,c))}var m=o.useRef();return(0,a.i)((function(){var e=t.key+"-global",n=new t.sheet.constructor({key:e,nonce:t.sheet.nonce,container:t.sheet.container,speedy:t.sheet.isSpeedy}),r=!1,o=document.querySelector('style[data-emotion="'+e+" "+l.name+'"]');return t.sheet.tags.length&&(n.before=t.sheet.tags[0]),null!==o&&(r=!0,o.setAttribute("data-emotion",e),n.hydrate([o])),m.current=[n,r],function(){n.flush()}}),[t]),(0,a.i)((function(){var e=m.current,n=e[0];if(e[1])e[1]=!1;else{if(void 0!==l.next&&(0,i.sk)(t,l.next,!0),n.tags.length){var r=n.tags[n.tags.length-1].nextElementSibling;n.before=r,n.flush()}t.insert("",l,n,!1)}}),[t,l.name]),null})));function c(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,s.J)(t)}var u=function(){var e=c.apply(void 0,arguments),t="animation-"+e.name;return{name:t,styles:"@keyframes "+t+"{"+e.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}},2142:(e,t,n)=>{"use strict";n.d(t,{J:()=>p});var r=n(3969),o=n(6289),i=/[A-Z]|^ms/g,a=/_EMO_([^_]+?)_([^]*?)_EMO_/g,s=function(e){return 45===e.charCodeAt(1)},l=function(e){return null!=e&&"boolean"!=typeof e},c=(0,o.A)((function(e){return s(e)?e:e.replace(i,"-$&").toLowerCase()})),u=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(a,(function(e,t,n){return f={name:t,styles:n,next:f},t}))}return 1===r.A[e]||s(e)||"number"!=typeof t||0===t?t:t+"px"};function h(e,t,n){if(null==n)return"";if(void 0!==n.__emotion_styles)return n;switch(typeof n){case"boolean":return"";case"object":if(1===n.anim)return f={name:n.name,styles:n.styles,next:f},n.name;if(void 0!==n.styles){var r=n.next;if(void 0!==r)for(;void 0!==r;)f={name:r.name,styles:r.styles,next:f},r=r.next;return n.styles+";"}return function(e,t,n){var r="";if(Array.isArray(n))for(var o=0;o<n.length;o++)r+=h(e,t,n[o])+";";else for(var i in n){var a=n[i];if("object"!=typeof a)null!=t&&void 0!==t[a]?r+=i+"{"+t[a]+"}":l(a)&&(r+=c(i)+":"+u(i,a)+";");else if(!Array.isArray(a)||"string"!=typeof a[0]||null!=t&&void 0!==t[a[0]]){var s=h(e,t,a);switch(i){case"animation":case"animationName":r+=c(i)+":"+s+";";break;default:r+=i+"{"+s+"}"}}else for(var f=0;f<a.length;f++)l(a[f])&&(r+=c(i)+":"+u(i,a[f])+";")}return r}(e,t,n);case"function":if(void 0!==e){var o=f,i=n(e);return f=o,h(e,t,i)}}if(null==t)return n;var a=t[n];return void 0!==a?a:n}var f,d=/label:\s*([^\s;\n{]+)\s*(;|$)/g,p=function(e,t,n){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var r=!0,o="";f=void 0;var i=e[0];null==i||void 0===i.raw?(r=!1,o+=h(n,t,i)):o+=i[0];for(var a=1;a<e.length;a++)o+=h(n,t,e[a]),r&&(o+=i[a]);d.lastIndex=0;for(var s,l="";null!==(s=d.exec(o));)l+="-"+s[1];var c=function(e){for(var t,n=0,r=0,o=e.length;o>=4;++r,o-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(o){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(o)+l;return{name:c,styles:o,next:f}}},3969:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var r={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1}},1287:(e,t,n)=>{"use strict";n.d(t,{i:()=>a,s:()=>i});var r=n(1594),o=!!r.useInsertionEffect&&r.useInsertionEffect,i=o||function(e){return e()},a=o||r.useLayoutEffect},41:(e,t,n)=>{"use strict";function r(e,t,n){var r="";return n.split(" ").forEach((function(n){void 0!==e[n]?t.push(e[n]+";"):r+=n+" "})),r}n.d(t,{Rk:()=>r,SF:()=>o,sk:()=>i});var o=function(e,t,n){var r=e.key+"-"+t.name;!1===n&&void 0===e.registered[r]&&(e.registered[r]=t.styles)},i=function(e,t,n){o(e,t,n);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var i=t;do{e.insert(t===i?"."+r:"",i,e.sheet,!0),i=i.next}while(void 0!==i)}}},9940:(e,t,n)=>{"use strict";n.d(t,{A:()=>i}),n(1594);var r=n(7437),o=n(4848);function i(e){const{styles:t,defaultTheme:n={}}=e,i="function"==typeof t?e=>{return t(null==(r=e)||0===Object.keys(r).length?n:e);var r}:t;return(0,o.jsx)(r.mL,{styles:i})}},2532:(e,t,n)=>{"use strict";n.r(t),n.d(t,{GlobalStyles:()=>S.A,StyledEngineProvider:()=>k,ThemeContext:()=>l.T,css:()=>v.AH,default:()=>O,internal_processStyles:()=>_,keyframes:()=>v.i7});var r=n(8168),o=n(1594),i=n(6289),a=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,s=(0,i.A)((function(e){return a.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91})),l=n(85),c=n(41),u=n(2142),h=n(1287),f=s,d=function(e){return"theme"!==e},p=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?f:d},m=function(e,t,n){var r;if(t){var o=t.shouldForwardProp;r=e.__emotion_forwardProp&&o?function(t){return e.__emotion_forwardProp(t)&&o(t)}:o}return"function"!=typeof r&&n&&(r=e.__emotion_forwardProp),r},g=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return(0,c.SF)(t,n,r),(0,h.s)((function(){return(0,c.sk)(t,n,r)})),null},y=function e(t,n){var i,a,s=t.__emotion_real===t,h=s&&t.__emotion_base||t;void 0!==n&&(i=n.label,a=n.target);var f=m(t,n,s),d=f||p(h),y=!d("as");return function(){var v=arguments,b=s&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==i&&b.push("label:"+i+";"),null==v[0]||void 0===v[0].raw)b.push.apply(b,v);else{b.push(v[0][0]);for(var x=v.length,w=1;w<x;w++)b.push(v[w],v[0][w])}var k=(0,l.w)((function(e,t,n){var r=y&&e.as||h,i="",s=[],m=e;if(null==e.theme){for(var v in m={},e)m[v]=e[v];m.theme=o.useContext(l.T)}"string"==typeof e.className?i=(0,c.Rk)(t.registered,s,e.className):null!=e.className&&(i=e.className+" ");var x=(0,u.J)(b.concat(s),t.registered,m);i+=t.key+"-"+x.name,void 0!==a&&(i+=" "+a);var w=y&&void 0===f?p(r):d,k={};for(var S in e)y&&"as"===S||w(S)&&(k[S]=e[S]);return k.className=i,k.ref=n,o.createElement(o.Fragment,null,o.createElement(g,{cache:t,serialized:x,isStringTag:"string"==typeof r}),o.createElement(r,k))}));return k.displayName=void 0!==i?i:"Styled("+("string"==typeof h?h:h.displayName||h.name||"Component")+")",k.defaultProps=t.defaultProps,k.__emotion_real=k,k.__emotion_base=h,k.__emotion_styles=b,k.__emotion_forwardProp=f,Object.defineProperty(k,"toString",{value:function(){return"."+a}}),k.withComponent=function(t,o){return e(t,(0,r.A)({},n,o,{shouldForwardProp:m(k,o,!0)})).apply(void 0,b)},k}}.bind();["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(e){y[e]=y(e)}));var v=n(7437),b=n(1919),x=n(4848);let w;function k(e){const{injectFirst:t,children:n}=e;return t&&w?(0,x.jsx)(l.C,{value:w,children:n}):n}"object"==typeof document&&(w=(0,b.A)({key:"css",prepend:!0}));var S=n(9940);function O(e,t){return y(e,t)}const _=(e,t)=>{Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}},771:(e,t,n)=>{"use strict";var r=n(4994);t.X4=function(e,t){return e=s(e),t=a(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,l(e)},t.e$=function(e,t){if(e=s(e),t=a(t),-1!==e.type.indexOf("hsl"))e.values[2]*=1-t;else if(-1!==e.type.indexOf("rgb")||-1!==e.type.indexOf("color"))for(let n=0;n<3;n+=1)e.values[n]*=1-t;return l(e)},t.eM=function(e,t){const n=c(e),r=c(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)},t.a=function(e,t){if(e=s(e),t=a(t),-1!==e.type.indexOf("hsl"))e.values[2]+=(100-e.values[2])*t;else if(-1!==e.type.indexOf("rgb"))for(let n=0;n<3;n+=1)e.values[n]+=(255-e.values[n])*t;else if(-1!==e.type.indexOf("color"))for(let n=0;n<3;n+=1)e.values[n]+=(1-e.values[n])*t;return l(e)};var o=r(n(2108)),i=r(n(6379));function a(e,t=0,n=1){return(0,i.default)(e,t,n)}function s(e){if(e.type)return e;if("#"===e.charAt(0))return s(function(e){e=e.slice(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&1===n[0].length&&(n=n.map((e=>e+e))),n?`rgb${4===n.length?"a":""}(${n.map(((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}(e));const t=e.indexOf("("),n=e.substring(0,t);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(n))throw new Error((0,o.default)(9,e));let r,i=e.substring(t+1,e.length-1);if("color"===n){if(i=i.split(" "),r=i.shift(),4===i.length&&"/"===i[3].charAt(0)&&(i[3]=i[3].slice(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(r))throw new Error((0,o.default)(10,r))}else i=i.split(",");return i=i.map((e=>parseFloat(e))),{type:n,values:i,colorSpace:r}}function l(e){const{type:t,colorSpace:n}=e;let{values:r}=e;return-1!==t.indexOf("rgb")?r=r.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(r[1]=`${r[1]}%`,r[2]=`${r[2]}%`),r=-1!==t.indexOf("color")?`${n} ${r.join(" ")}`:`${r.join(", ")}`,`${t}(${r})`}function c(e){let t="hsl"===(e=s(e)).type||"hsla"===e.type?s(function(e){e=s(e);const{values:t}=e,n=t[0],r=t[1]/100,o=t[2]/100,i=r*Math.min(o,1-o),a=(e,t=(e+n/30)%12)=>o-i*Math.max(Math.min(t-3,9-t,1),-1);let c="rgb";const u=[Math.round(255*a(0)),Math.round(255*a(8)),Math.round(255*a(4))];return"hsla"===e.type&&(c+="a",u.push(t[3])),l({type:c,values:u})}(e)).values:e.values;return t=t.map((t=>("color"!==e.type&&(t/=255),t<=.03928?t/12.92:((t+.055)/1.055)**2.4))),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}},6461:(e,t,n)=>{"use strict";var r=n(4994);t.Ay=function(e={}){const{themeId:t,defaultTheme:n=m,rootShouldForwardProp:r=p,slotShouldForwardProp:l=p}=e,u=e=>(0,c.default)((0,o.default)({},e,{theme:y((0,o.default)({},e,{defaultTheme:n,themeId:t}))}));return u.__mui_systemSx=!0,(e,c={})=>{(0,a.internal_processStyles)(e,(e=>e.filter((e=>!(null!=e&&e.__mui_systemSx)))));const{name:h,slot:d,skipVariantsResolver:m,skipSx:x,overridesResolver:w=v(g(d))}=c,k=(0,i.default)(c,f),S=void 0!==m?m:d&&"Root"!==d&&"root"!==d||!1,O=x||!1;let _=p;"Root"===d||"root"===d?_=r:d?_=l:function(e){return"string"==typeof e&&e.charCodeAt(0)>96}(e)&&(_=void 0);const E=(0,a.default)(e,(0,o.default)({shouldForwardProp:_,label:void 0},k)),C=e=>"function"==typeof e&&e.__emotion_real!==e||(0,s.isPlainObject)(e)?r=>b(e,(0,o.default)({},r,{theme:y({theme:r.theme,defaultTheme:n,themeId:t})})):e,A=(r,...i)=>{let a=C(r);const s=i?i.map(C):[];h&&w&&s.push((e=>{const r=y((0,o.default)({},e,{defaultTheme:n,themeId:t}));if(!r.components||!r.components[h]||!r.components[h].styleOverrides)return null;const i=r.components[h].styleOverrides,a={};return Object.entries(i).forEach((([t,n])=>{a[t]=b(n,(0,o.default)({},e,{theme:r}))})),w(e,a)})),h&&!S&&s.push((e=>{var r;const i=y((0,o.default)({},e,{defaultTheme:n,themeId:t}));return b({variants:null==i||null==(r=i.components)||null==(r=r[h])?void 0:r.variants},(0,o.default)({},e,{theme:i}))})),O||s.push(u);const l=s.length-i.length;if(Array.isArray(r)&&l>0){const e=new Array(l).fill("");a=[...r,...e],a.raw=[...r.raw,...e]}const c=E(a,...s);return e.muiName&&(c.muiName=e.muiName),c};return E.withConfig&&(A.withConfig=E.withConfig),A}},t.MC=p;var o=r(n(4634)),i=r(n(4893)),a=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(2532)),s=n(819),l=(r(n(8217)),r(n(1172)),r(n(3142))),c=r(n(3857));const u=["ownerState"],h=["variants"],f=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}function p(e){return"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e}const m=(0,l.default)(),g=e=>e?e.charAt(0).toLowerCase()+e.slice(1):e;function y({defaultTheme:e,theme:t,themeId:n}){return r=t,0===Object.keys(r).length?e:t[n]||t;var r}function v(e){return e?(t,n)=>n[e]:null}function b(e,t){let{ownerState:n}=t,r=(0,i.default)(t,u);const a="function"==typeof e?e((0,o.default)({ownerState:n},r)):e;if(Array.isArray(a))return a.flatMap((e=>b(e,(0,o.default)({ownerState:n},r))));if(a&&"object"==typeof a&&Array.isArray(a.variants)){const{variants:e=[]}=a;let t=(0,i.default)(a,h);return e.forEach((e=>{let i=!0;"function"==typeof e.props?i=e.props((0,o.default)({ownerState:n},r,n)):Object.keys(e.props).forEach((t=>{(null==n?void 0:n[t])!==e.props[t]&&r[t]!==e.props[t]&&(i=!1)})),i&&(Array.isArray(t)||(t=[t]),t.push("function"==typeof e.style?e.style((0,o.default)({ownerState:n},r,n)):e.style))})),t}return a}},9452:(e,t,n)=>{"use strict";n.d(t,{EU:()=>a,NI:()=>i,vf:()=>s,zu:()=>r});const r={xs:0,sm:600,md:900,lg:1200,xl:1536},o={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${r[e]}px)`};function i(e,t,n){const i=e.theme||{};if(Array.isArray(t)){const e=i.breakpoints||o;return t.reduce(((r,o,i)=>(r[e.up(e.keys[i])]=n(t[i]),r)),{})}if("object"==typeof t){const e=i.breakpoints||o;return Object.keys(t).reduce(((o,i)=>{if(-1!==Object.keys(e.values||r).indexOf(i))o[e.up(i)]=n(t[i],i);else{const e=i;o[e]=t[e]}return o}),{})}return n(t)}function a(e={}){var t;return(null==(t=e.keys)?void 0:t.reduce(((t,n)=>(t[e.up(n)]={},t)),{}))||{}}function s(e,t){return e.reduce(((e,t)=>{const n=e[t];return(!n||0===Object.keys(n).length)&&delete e[t],e}),t)}},8336:(e,t,n)=>{"use strict";function r(e,t){const n=this;return n.vars&&"function"==typeof n.getColorSchemeSelector?{[n.getColorSchemeSelector(e).replace(/(\[[^\]]+\])/,"*:where($1)")]:t}:n.palette.mode===e?t:{}}n.d(t,{A:()=>r})},8094:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var r=n(8587),o=n(8168);const i=["values","unit","step"],a=e=>{const t=Object.keys(e).map((t=>({key:t,val:e[t]})))||[];return t.sort(((e,t)=>e.val-t.val)),t.reduce(((e,t)=>(0,o.A)({},e,{[t.key]:t.val})),{})};function s(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:n="px",step:s=5}=e,l=(0,r.A)(e,i),c=a(t),u=Object.keys(c);function h(e){return`@media (min-width:${"number"==typeof t[e]?t[e]:e}${n})`}function f(e){return`@media (max-width:${("number"==typeof t[e]?t[e]:e)-s/100}${n})`}function d(e,r){const o=u.indexOf(r);return`@media (min-width:${"number"==typeof t[e]?t[e]:e}${n}) and (max-width:${(-1!==o&&"number"==typeof t[u[o]]?t[u[o]]:r)-s/100}${n})`}return(0,o.A)({keys:u,values:c,up:h,down:f,between:d,only:function(e){return u.indexOf(e)+1<u.length?d(e,u[u.indexOf(e)+1]):h(e)},not:function(e){const t=u.indexOf(e);return 0===t?h(u[1]):t===u.length-1?f(u[t]):d(e,u[u.indexOf(e)+1]).replace("@media","@media not all and")},unit:n},l)}},8749:(e,t,n)=>{"use strict";n.d(t,{A:()=>d});var r=n(8168),o=n(8587),i=n(4521),a=n(8094);const s={borderRadius:4};var l=n(8248),c=n(3571),u=n(4188),h=n(8336);const f=["breakpoints","palette","spacing","shape"],d=function(e={},...t){const{breakpoints:n={},palette:d={},spacing:p,shape:m={}}=e,g=(0,o.A)(e,f),y=(0,a.A)(n),v=function(e=8){if(e.mui)return e;const t=(0,l.LX)({spacing:e}),n=(...e)=>(0===e.length?[1]:e).map((e=>{const n=t(e);return"number"==typeof n?`${n}px`:n})).join(" ");return n.mui=!0,n}(p);let b=(0,i.A)({breakpoints:y,direction:"ltr",components:{},palette:(0,r.A)({mode:"light"},d),spacing:v,shape:(0,r.A)({},s,m)},g);return b.applyStyles=h.A,b=t.reduce(((e,t)=>(0,i.A)(e,t)),b),b.unstable_sxConfig=(0,r.A)({},u.A,null==g?void 0:g.unstable_sxConfig),b.unstable_sx=function(e){return(0,c.A)({sx:e,theme:this})},b}},3142:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r.A,private_createBreakpoints:()=>o.A,unstable_applyStyles:()=>i.A});var r=n(8749),o=n(8094),i=n(8336)},4620:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(4521);const o=function(e,t){return t?(0,r.A)(e,t,{clone:!1}):e}},8248:(e,t,n)=>{"use strict";n.d(t,{LX:()=>p,MA:()=>d,_W:()=>m,Lc:()=>y,Ms:()=>v});var r=n(9452),o=n(6481),i=n(4620);const a={m:"margin",p:"padding"},s={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},l={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},c=function(e){const t={};return e=>(void 0===t[e]&&(t[e]=(e=>{if(e.length>2){if(!l[e])return[e];e=l[e]}const[t,n]=e.split(""),r=a[t],o=s[n]||"";return Array.isArray(o)?o.map((e=>r+e)):[r+o]})(e)),t[e])}(),u=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],h=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],f=[...u,...h];function d(e,t,n,r){var i;const a=null!=(i=(0,o.Yn)(e,t,!1))?i:n;return"number"==typeof a?e=>"string"==typeof e?e:a*e:Array.isArray(a)?e=>"string"==typeof e?e:a[e]:"function"==typeof a?a:()=>{}}function p(e){return d(e,"spacing",8)}function m(e,t){if("string"==typeof t||null==t)return t;const n=e(Math.abs(t));return t>=0?n:"number"==typeof n?-n:`-${n}`}function g(e,t){const n=p(e.theme);return Object.keys(e).map((o=>function(e,t,n,o){if(-1===t.indexOf(n))return null;const i=function(e,t){return n=>e.reduce(((e,r)=>(e[r]=m(t,n),e)),{})}(c(n),o),a=e[n];return(0,r.NI)(e,a,i)}(e,t,o,n))).reduce(i.A,{})}function y(e){return g(e,u)}function v(e){return g(e,h)}function b(e){return g(e,f)}y.propTypes={},y.filterProps=u,v.propTypes={},v.filterProps=h,b.propTypes={},b.filterProps=f},6481:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>s,BO:()=>a,Yn:()=>i});var r=n(8659),o=n(9452);function i(e,t,n=!0){if(!t||"string"!=typeof t)return null;if(e&&e.vars&&n){const n=`vars.${t}`.split(".").reduce(((e,t)=>e&&e[t]?e[t]:null),e);if(null!=n)return n}return t.split(".").reduce(((e,t)=>e&&null!=e[t]?e[t]:null),e)}function a(e,t,n,r=n){let o;return o="function"==typeof e?e(n):Array.isArray(e)?e[n]||r:i(e,n)||r,t&&(o=t(o,r,e)),o}const s=function(e){const{prop:t,cssProperty:n=e.prop,themeKey:s,transform:l}=e,c=e=>{if(null==e[t])return null;const c=e[t],u=i(e.theme,s)||{};return(0,o.NI)(e,c,(e=>{let o=a(u,l,e);return e===o&&"string"==typeof e&&(o=a(u,l,`${t}${"default"===e?"":(0,r.A)(e)}`,e)),!1===n?o:{[n]:o}}))};return c.propTypes={},c.filterProps=[t],c}},4188:(e,t,n)=>{"use strict";n.d(t,{A:()=>L});var r=n(8248),o=n(6481),i=n(4620);const a=function(...e){const t=e.reduce(((e,t)=>(t.filterProps.forEach((n=>{e[n]=t})),e)),{}),n=e=>Object.keys(e).reduce(((n,r)=>t[r]?(0,i.A)(n,t[r](e)):n),{});return n.propTypes={},n.filterProps=e.reduce(((e,t)=>e.concat(t.filterProps)),[]),n};var s=n(9452);function l(e){return"number"!=typeof e?e:`${e}px solid`}function c(e,t){return(0,o.Ay)({prop:e,themeKey:"borders",transform:t})}const u=c("border",l),h=c("borderTop",l),f=c("borderRight",l),d=c("borderBottom",l),p=c("borderLeft",l),m=c("borderColor"),g=c("borderTopColor"),y=c("borderRightColor"),v=c("borderBottomColor"),b=c("borderLeftColor"),x=c("outline",l),w=c("outlineColor"),k=e=>{if(void 0!==e.borderRadius&&null!==e.borderRadius){const t=(0,r.MA)(e.theme,"shape.borderRadius",4,"borderRadius"),n=e=>({borderRadius:(0,r._W)(t,e)});return(0,s.NI)(e,e.borderRadius,n)}return null};k.propTypes={},k.filterProps=["borderRadius"],a(u,h,f,d,p,m,g,y,v,b,k,x,w);const S=e=>{if(void 0!==e.gap&&null!==e.gap){const t=(0,r.MA)(e.theme,"spacing",8,"gap"),n=e=>({gap:(0,r._W)(t,e)});return(0,s.NI)(e,e.gap,n)}return null};S.propTypes={},S.filterProps=["gap"];const O=e=>{if(void 0!==e.columnGap&&null!==e.columnGap){const t=(0,r.MA)(e.theme,"spacing",8,"columnGap"),n=e=>({columnGap:(0,r._W)(t,e)});return(0,s.NI)(e,e.columnGap,n)}return null};O.propTypes={},O.filterProps=["columnGap"];const _=e=>{if(void 0!==e.rowGap&&null!==e.rowGap){const t=(0,r.MA)(e.theme,"spacing",8,"rowGap"),n=e=>({rowGap:(0,r._W)(t,e)});return(0,s.NI)(e,e.rowGap,n)}return null};function E(e,t){return"grey"===t?t:e}function C(e){return e<=1&&0!==e?100*e+"%":e}_.propTypes={},_.filterProps=["rowGap"],a(S,O,_,(0,o.Ay)({prop:"gridColumn"}),(0,o.Ay)({prop:"gridRow"}),(0,o.Ay)({prop:"gridAutoFlow"}),(0,o.Ay)({prop:"gridAutoColumns"}),(0,o.Ay)({prop:"gridAutoRows"}),(0,o.Ay)({prop:"gridTemplateColumns"}),(0,o.Ay)({prop:"gridTemplateRows"}),(0,o.Ay)({prop:"gridTemplateAreas"}),(0,o.Ay)({prop:"gridArea"})),a((0,o.Ay)({prop:"color",themeKey:"palette",transform:E}),(0,o.Ay)({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:E}),(0,o.Ay)({prop:"backgroundColor",themeKey:"palette",transform:E}));const A=(0,o.Ay)({prop:"width",transform:C}),j=e=>{if(void 0!==e.maxWidth&&null!==e.maxWidth){const t=t=>{var n,r;const o=(null==(n=e.theme)||null==(n=n.breakpoints)||null==(n=n.values)?void 0:n[t])||s.zu[t];return o?"px"!==(null==(r=e.theme)||null==(r=r.breakpoints)?void 0:r.unit)?{maxWidth:`${o}${e.theme.breakpoints.unit}`}:{maxWidth:o}:{maxWidth:C(t)}};return(0,s.NI)(e,e.maxWidth,t)}return null};j.filterProps=["maxWidth"];const P=(0,o.Ay)({prop:"minWidth",transform:C}),M=(0,o.Ay)({prop:"height",transform:C}),R=(0,o.Ay)({prop:"maxHeight",transform:C}),T=(0,o.Ay)({prop:"minHeight",transform:C}),L=((0,o.Ay)({prop:"size",cssProperty:"width",transform:C}),(0,o.Ay)({prop:"size",cssProperty:"height",transform:C}),a(A,j,P,M,R,T,(0,o.Ay)({prop:"boxSizing"})),{border:{themeKey:"borders",transform:l},borderTop:{themeKey:"borders",transform:l},borderRight:{themeKey:"borders",transform:l},borderBottom:{themeKey:"borders",transform:l},borderLeft:{themeKey:"borders",transform:l},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:l},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:k},color:{themeKey:"palette",transform:E},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:E},backgroundColor:{themeKey:"palette",transform:E},p:{style:r.Ms},pt:{style:r.Ms},pr:{style:r.Ms},pb:{style:r.Ms},pl:{style:r.Ms},px:{style:r.Ms},py:{style:r.Ms},padding:{style:r.Ms},paddingTop:{style:r.Ms},paddingRight:{style:r.Ms},paddingBottom:{style:r.Ms},paddingLeft:{style:r.Ms},paddingX:{style:r.Ms},paddingY:{style:r.Ms},paddingInline:{style:r.Ms},paddingInlineStart:{style:r.Ms},paddingInlineEnd:{style:r.Ms},paddingBlock:{style:r.Ms},paddingBlockStart:{style:r.Ms},paddingBlockEnd:{style:r.Ms},m:{style:r.Lc},mt:{style:r.Lc},mr:{style:r.Lc},mb:{style:r.Lc},ml:{style:r.Lc},mx:{style:r.Lc},my:{style:r.Lc},margin:{style:r.Lc},marginTop:{style:r.Lc},marginRight:{style:r.Lc},marginBottom:{style:r.Lc},marginLeft:{style:r.Lc},marginX:{style:r.Lc},marginY:{style:r.Lc},marginInline:{style:r.Lc},marginInlineStart:{style:r.Lc},marginInlineEnd:{style:r.Lc},marginBlock:{style:r.Lc},marginBlockStart:{style:r.Lc},marginBlockEnd:{style:r.Lc},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:S},rowGap:{style:_},columnGap:{style:O},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:C},maxWidth:{style:j},minWidth:{transform:C},height:{transform:C},maxHeight:{transform:C},minHeight:{transform:C},boxSizing:{},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}})},9599:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});var r=n(8168),o=n(8587),i=n(4521),a=n(4188);const s=["sx"],l=e=>{var t,n;const r={systemProps:{},otherProps:{}},o=null!=(t=null==e||null==(n=e.theme)?void 0:n.unstable_sxConfig)?t:a.A;return Object.keys(e).forEach((t=>{o[t]?r.systemProps[t]=e[t]:r.otherProps[t]=e[t]})),r};function c(e){const{sx:t}=e,n=(0,o.A)(e,s),{systemProps:a,otherProps:c}=l(n);let u;return u=Array.isArray(t)?[a,...t]:"function"==typeof t?(...e)=>{const n=t(...e);return(0,i.Q)(n)?(0,r.A)({},a,n):a}:(0,r.A)({},a,t),(0,r.A)({},c,{sx:u})}},3857:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r.A,extendSxProp:()=>o.A,unstable_createStyleFunctionSx:()=>r.k,unstable_defaultSxConfig:()=>i.A});var r=n(3571),o=n(9599),i=n(4188)},3571:(e,t,n)=>{"use strict";n.d(t,{A:()=>u,k:()=>l});var r=n(8659),o=n(4620),i=n(6481),a=n(9452),s=n(4188);function l(){function e(e,t,n,o){const s={[e]:t,theme:n},l=o[e];if(!l)return{[e]:t};const{cssProperty:c=e,themeKey:u,transform:h,style:f}=l;if(null==t)return null;if("typography"===u&&"inherit"===t)return{[e]:t};const d=(0,i.Yn)(n,u)||{};return f?f(s):(0,a.NI)(s,t,(t=>{let n=(0,i.BO)(d,h,t);return t===n&&"string"==typeof t&&(n=(0,i.BO)(d,h,`${e}${"default"===t?"":(0,r.A)(t)}`,t)),!1===c?n:{[c]:n}}))}return function t(n){var r;const{sx:i,theme:l={}}=n||{};if(!i)return null;const c=null!=(r=l.unstable_sxConfig)?r:s.A;function u(n){let r=n;if("function"==typeof n)r=n(l);else if("object"!=typeof n)return n;if(!r)return null;const i=(0,a.EU)(l.breakpoints),s=Object.keys(i);let u=i;return Object.keys(r).forEach((n=>{const i="function"==typeof(s=r[n])?s(l):s;var s;if(null!=i)if("object"==typeof i)if(c[n])u=(0,o.A)(u,e(n,i,l,c));else{const e=(0,a.NI)({theme:l},i,(e=>({[n]:e})));!function(...e){const t=e.reduce(((e,t)=>e.concat(Object.keys(t))),[]),n=new Set(t);return e.every((e=>n.size===Object.keys(e).length))}(e,i)?u=(0,o.A)(u,e):u[n]=t({sx:i,theme:l})}else u=(0,o.A)(u,e(n,i,l,c))})),(0,a.vf)(s,u)}return Array.isArray(i)?i.map(u):u(i)}}const c=l();c.filterProps=["sx"];const u=c},8659:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(5697);function o(e){if("string"!=typeof e)throw new Error((0,r.A)(7));return e.charAt(0).toUpperCase()+e.slice(1)}},8217:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r.A});var r=n(8659)},6379:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r});const r=function(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}},4521:(e,t,n)=>{"use strict";n.d(t,{A:()=>a,Q:()=>o});var r=n(8168);function o(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}function i(e){if(!o(e))return e;const t={};return Object.keys(e).forEach((n=>{t[n]=i(e[n])})),t}function a(e,t,n={clone:!0}){const s=n.clone?(0,r.A)({},e):e;return o(e)&&o(t)&&Object.keys(t).forEach((r=>{"__proto__"!==r&&(o(t[r])&&r in e&&o(e[r])?s[r]=a(e[r],t[r],n):n.clone?s[r]=o(t[r])?i(t[r]):t[r]:s[r]=t[r])})),s}},819:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r.A,isPlainObject:()=>r.Q});var r=n(4521)},5697:(e,t,n)=>{"use strict";function r(e){let t="https://mui.com/production-error/?code="+e;for(let e=1;e<arguments.length;e+=1)t+="&args[]="+encodeURIComponent(arguments[e]);return"Minified MUI error #"+e+"; visit "+t+" for the full message."}n.d(t,{A:()=>r})},2108:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r.A});var r=n(5697)},1172:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>l,getFunctionName:()=>i});var r=n(5492);const o=/^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/;function i(e){const t=`${e}`.match(o);return t&&t[1]||""}function a(e,t=""){return e.displayName||e.name||i(e)||t}function s(e,t,n){const r=a(t);return e.displayName||(""!==r?`${n}(${r})`:n)}function l(e){if(null!=e){if("string"==typeof e)return e;if("function"==typeof e)return a(e,"Component");if("object"==typeof e)switch(e.$$typeof){case r.ForwardRef:return s(e,e.render,"ForwardRef");case r.Memo:return s(e,e.type,"memo");default:return}}}},7064:(e,t)=>{"use strict";Symbol.for("react.element"),Symbol.for("react.portal"),Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider"),Symbol.for("react.context"),Symbol.for("react.server_context");var n=Symbol.for("react.forward_ref"),r=(Symbol.for("react.suspense"),Symbol.for("react.suspense_list"),Symbol.for("react.memo"));Symbol.for("react.lazy"),Symbol.for("react.offscreen");Symbol.for("react.module.reference"),t.ForwardRef=n,t.Memo=r},5492:(e,t,n)=>{"use strict";e.exports=n(7064)},4300:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2Z"/>'}},9057:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M11 4h2v12l5.5-5.5l1.42 1.42L12 19.84l-7.92-7.92L5.5 10.5L11 16V4Z"/>'}},3860:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="m12 7l5 5h-3v4h-4v-4H7l5-5m0 15A10 10 0 0 1 2 12A10 10 0 0 1 12 2a10 10 0 0 1 10 10a10 10 0 0 1-10 10m0-2a8 8 0 0 0 8-8a8 8 0 0 0-8-8a8 8 0 0 0-8 8a8 8 0 0 0 8 8Z"/>'}},6304:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M13 20h-2V8l-5.5 5.5l-1.42-1.42L12 4.16l7.92 7.92l-1.42 1.42L13 8v12Z"/>'}},2600:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M7.5 5.6L5 7l1.4-2.5L5 2l2.5 1.4L10 2L8.6 4.5L10 7L7.5 5.6m12 9.8L22 14l-1.4 2.5L22 19l-2.5-1.4L17 19l1.4-2.5L17 14l2.5 1.4M22 2l-1.4 2.5L22 7l-2.5-1.4L17 7l1.4-2.5L17 2l2.5 1.4L22 2m-8.66 10.78l2.44-2.44l-2.12-2.12l-2.44 2.44l2.12 2.12m1.03-5.49l2.34 2.34c.39.37.39 1.02 0 1.41L5.04 22.71c-.39.39-1.04.39-1.41 0l-2.34-2.34c-.39-.37-.39-1.02 0-1.41L12.96 7.29c.39-.39 1.04-.39 1.41 0Z"/>'}},4196:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M9 10v2H7v-2h2m4 0v2h-2v-2h2m4 0v2h-2v-2h2m2-7a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h1V1h2v2h8V1h2v2h1m0 16V8H5v11h14M9 14v2H7v-2h2m4 0v2h-2v-2h2m4 0v2h-2v-2h2Z"/>'}},2849:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="m12 8l-1.33.09C9.81 7.07 7.4 4.5 5 4.5c0 0-1.97 2.96-.04 6.91c-.55.83-.89 1.26-.96 2.25l-1.93.29l.21.98l1.76-.26l.14.71l-1.57.94l.47.89l1.45-.89C5.68 18.76 8.59 20 12 20s6.32-1.24 7.47-3.68l1.45.89l.47-.89l-1.57-.94l.14-.71l1.76.26l.21-.98l-1.93-.29c-.07-.99-.41-1.42-.96-2.25C20.97 7.46 19 4.5 19 4.5c-2.4 0-4.81 2.57-5.67 3.59L12 8m-3 3a1 1 0 0 1 1 1a1 1 0 0 1-1 1a1 1 0 0 1-1-1a1 1 0 0 1 1-1m6 0a1 1 0 0 1 1 1a1 1 0 0 1-1 1a1 1 0 0 1-1-1a1 1 0 0 1 1-1m-4 3h2l-.7 1.39c.2.64.76 1.11 1.45 1.11a1.5 1.5 0 0 0 1.5-1.5h.5a2 2 0 0 1-2 2c-.75 0-1.4-.41-1.75-1c-.35.59-1 1-1.75 1a2 2 0 0 1-2-2h.5a1.5 1.5 0 0 0 1.5 1.5c.69 0 1.25-.47 1.45-1.11L11 14Z"/>'}},3594:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10s10-4.5 10-10S17.5 2 12 2m-2 15l-5-5l1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9Z"/>'}},4501:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M21 7L9 19l-5.5-5.5l1.41-1.41L9 16.17L19.59 5.59L21 7Z"/>'}},2027:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12 20a8 8 0 0 1-8-8a8 8 0 0 1 8-8a8 8 0 0 1 8 8a8 8 0 0 1-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2Z"/>'}},5962:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M18.41 7.41L17 6l-6 6l6 6l1.41-1.41L13.83 12l4.58-4.59m-6 0L11 6l-6 6l6 6l1.41-1.41L7.83 12l4.58-4.59Z"/>'}},6029:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M5.59 7.41L7 6l6 6l-6 6l-1.41-1.41L10.17 12L5.59 7.41m6 0L13 6l6 6l-6 6l-1.41-1.41L16.17 12l-4.58-4.59Z"/>'}},4555:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M7.41 8.58L12 13.17l4.59-4.59L18 10l-6 6l-6-6l1.41-1.42Z"/>'}},5074:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M15.41 16.58L10.83 12l4.58-4.59L14 6l-6 6l6 6l1.41-1.42Z"/>'}},21:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6l-1.41-1.42Z"/>'}},6382:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6l-6 6l1.41 1.41Z"/>'}},5241:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12L19 6.41Z"/>'}},858:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12 15.5A3.5 3.5 0 0 1 8.5 12A3.5 3.5 0 0 1 12 8.5a3.5 3.5 0 0 1 3.5 3.5a3.5 3.5 0 0 1-3.5 3.5m7.43-2.53c.04-.32.07-.64.07-.97c0-.33-.03-.66-.07-1l2.11-1.63c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.31-.61-.22l-2.49 1c-.52-.39-1.06-.73-1.69-.98l-.37-2.65A.506.506 0 0 0 14 2h-4c-.25 0-.46.18-.5.42l-.37 2.65c-.63.25-1.17.59-1.69.98l-2.49-1c-.22-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64L4.57 11c-.04.34-.07.67-.07 1c0 .33.03.65.07.97l-2.11 1.66c-.19.15-.25.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1.01c.52.4 1.06.74 1.69.99l.37 2.65c.04.24.25.42.5.42h4c.25 0 .46-.18.5-.42l.37-2.65c.63-.26 1.17-.59 1.69-.99l2.49 1.01c.22.08.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.66Z"/>'}},3104:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M11 17H4a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h12v2H4v12h7v-2l4 3l-4 3v-2m8 4V7H8v6H6V7a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2v-2h2v2h11Z"/>'}},9300:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M15 9H5V5h10m-3 14a3 3 0 0 1-3-3a3 3 0 0 1 3-3a3 3 0 0 1 3 3a3 3 0 0 1-3 3m5-16H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V7l-4-4Z"/>'}},7073:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M18.68 12.32a4.49 4.49 0 0 0-6.36.01a4.49 4.49 0 0 0 0 6.36a4.508 4.508 0 0 0 5.57.63L21 22.39L22.39 21l-3.09-3.11c1.13-1.77.87-4.09-.62-5.57m-1.41 4.95c-.98.98-2.56.97-3.54 0c-.97-.98-.97-2.56.01-3.54c.97-.97 2.55-.97 3.53 0c.97.98.97 2.56 0 3.54M10.9 20.1a6.527 6.527 0 0 1-1.48-2.32C6.27 17.25 4 15.76 4 14v3c0 2.21 3.58 4 8 4c-.4-.26-.77-.56-1.1-.9M4 9v3c0 1.68 2.07 3.12 5 3.7v-.2c0-.93.2-1.85.58-2.69C6.34 12.3 4 10.79 4 9m8-6C7.58 3 4 4.79 4 7c0 2 3 3.68 6.85 4h.05c1.2-1.26 2.86-2 4.6-2c.91 0 1.81.19 2.64.56A3.215 3.215 0 0 0 20 7c0-2.21-3.58-4-8-4Z"/>'}},1860:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12 3C7.58 3 4 4.79 4 7s3.58 4 8 4s8-1.79 8-4s-3.58-4-8-4M4 9v3c0 2.21 3.58 4 8 4s8-1.79 8-4V9c0 2.21-3.58 4-8 4s-8-1.79-8-4m0 5v3c0 2.21 3.58 4 8 4s8-1.79 8-4v-3c0 2.21-3.58 4-8 4s-8-1.79-8-4Z"/>'}},4142:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M19 4h-3.5l-1-1h-5l-1 1H5v2h14M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6v12Z"/>'}},9728:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12 9a3 3 0 0 0-3 3a3 3 0 0 0 3 3a3 3 0 0 0 3-3a3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5a5 5 0 0 1 5-5a5 5 0 0 1 5 5a5 5 0 0 1-5 5m0-12.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5Z"/>'}},257:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12 2.04c-5.5 0-10 4.49-10 10.02c0 5 3.66 9.15 8.44 9.9v-7H7.9v-2.9h2.54V9.85c0-2.51 1.49-3.89 3.78-3.89c1.09 0 2.23.19 2.23.19v2.47h-1.26c-1.24 0-1.63.77-1.63 1.56v1.88h2.78l-.45 2.9h-2.33v7a10 10 0 0 0 8.44-9.9c0-5.53-4.5-10.02-10-10.02Z"/>'}},7326:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M13 9h5.5L13 3.5V9M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m6.16 12.31c-1.56 0-2.97.58-4.05 1.52L6 13.72V19h5.28l-2.13-2.12c.82-.68 1.85-1.1 3.01-1.1c2.07 0 3.84 1.35 4.45 3.22l1.39-.46c-.81-2.45-3.12-4.23-5.84-4.23Z"/>'}},4611:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M14 12v7.88c.04.3-.06.62-.29.83a.996.996 0 0 1-1.41 0l-2.01-2.01a.989.989 0 0 1-.29-.83V12h-.03L4.21 4.62a1 1 0 0 1 .17-1.4c.19-.14.4-.22.62-.22h14c.22 0 .43.08.62.22a1 1 0 0 1 .17 1.4L14.03 12H14Z"/>'}},9538:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M19 20H4a2 2 0 0 1-2-2V6c0-1.11.89-2 2-2h6l2 2h7a2 2 0 0 1 2 2H4v10l2.14-8h17.07l-2.28 8.5c-.23.87-1.01 1.5-1.93 1.5Z"/>'}},9966:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M13 19c0 .34.04.67.09 1H4a2 2 0 0 1-2-2V6c0-1.11.89-2 2-2h6l2 2h8a2 2 0 0 1 2 2v5.81c-.88-.51-1.9-.81-3-.81c-3.31 0-6 2.69-6 6m7-1v-3h-2v3h-3v2h3v3h2v-3h3v-2h-3Z"/>'}},4613:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M10 4H4c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-8l-2-2Z"/>'}},2477:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M7 5h14v2H7V5m0 8v-2h14v2H7M4 4.5A1.5 1.5 0 0 1 5.5 6A1.5 1.5 0 0 1 4 7.5A1.5 1.5 0 0 1 2.5 6A1.5 1.5 0 0 1 4 4.5m0 6A1.5 1.5 0 0 1 5.5 12A1.5 1.5 0 0 1 4 13.5A1.5 1.5 0 0 1 2.5 12A1.5 1.5 0 0 1 4 10.5M7 19v-2h14v2H7m-3-2.5A1.5 1.5 0 0 1 5.5 18A1.5 1.5 0 0 1 4 19.5A1.5 1.5 0 0 1 2.5 18A1.5 1.5 0 0 1 4 16.5Z"/>'}},7894:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M21 17H7V3h14m0-2H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2M3 5H1v16a2 2 0 0 0 2 2h16v-2H3m12.96-10.71l-2.75 3.54l-1.96-2.36L8.5 15h11l-3.54-4.71Z"/>'}},6123:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M22 20.7L3.3 2L2 3.3l1 1V19c0 1.1.9 2 2 2h14.7l1 1l1.3-1.3M5 19V6.3l7.6 7.6l-1.5 1.9L9 13.1L6 17h9.7l2 2H5M8.8 5l-2-2H19c1.1 0 2 .9 2 2v12.2l-2-2V5H8.8"/>'}},9829:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M18 15v3h-3v2h3v3h2v-3h3v-2h-3v-3h-2m-4.7 6H5c-1.1 0-2-.9-2-2V5c0-1.1.9-2 2-2h14c1.1 0 2 .9 2 2v8.3c-.6-.2-1.3-.3-2-.3c-1.1 0-2.2.3-3.1.9L14.5 12L11 16.5l-2.5-3L5 18h8.1c-.1.3-.1.7-.1 1c0 .7.1 1.4.3 2Z"/>'}},3102:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8s8 3.59 8 8s-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z"/>'}},9077:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M7.8 2h8.4C19.4 2 22 4.6 22 7.8v8.4a5.8 5.8 0 0 1-5.8 5.8H7.8C4.6 22 2 19.4 2 16.2V7.8A5.8 5.8 0 0 1 7.8 2m-.2 2A3.6 3.6 0 0 0 4 7.6v8.8C4 18.39 5.61 20 7.6 20h8.8a3.6 3.6 0 0 0 3.6-3.6V7.6C20 5.61 18.39 4 16.4 4H7.6m9.65 1.5a1.25 1.25 0 0 1 1.25 1.25A1.25 1.25 0 0 1 17.25 8A1.25 1.25 0 0 1 16 6.75a1.25 1.25 0 0 1 1.25-1.25M12 7a5 5 0 0 1 5 5a5 5 0 0 1-5 5a5 5 0 0 1-5-5a5 5 0 0 1 5-5m0 2a3 3 0 0 0-3 3a3 3 0 0 0 3 3a3 3 0 0 0 3-3a3 3 0 0 0-3-3Z"/>'}},8841:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M16.84 2.73c-.39 0-.77.15-1.07.44l-2.12 2.12l5.3 5.31l2.12-2.1c.6-.61.6-1.56 0-2.14L17.9 3.17c-.3-.29-.68-.44-1.06-.44M12.94 6l-8.1 8.11l2.56.28l.18 2.29l2.28.17l.29 2.56l8.1-8.11m-14 3.74L2.5 21.73l6.7-1.79l-.24-2.16l-2.31-.17l-.18-2.32"/>'}},4753:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M10.59 13.41c.41.39.41 1.03 0 1.42c-.39.39-1.03.39-1.42 0a5.003 5.003 0 0 1 0-7.07l3.54-3.54a5.003 5.003 0 0 1 7.07 0a5.003 5.003 0 0 1 0 7.07l-1.49 1.49c.01-.82-.12-1.64-.4-2.42l.47-.48a2.982 2.982 0 0 0 0-4.24a2.982 2.982 0 0 0-4.24 0l-3.53 3.53a2.982 2.982 0 0 0 0 4.24m2.82-4.24c.39-.39 1.03-.39 1.42 0a5.003 5.003 0 0 1 0 7.07l-3.54 3.54a5.003 5.003 0 0 1-7.07 0a5.003 5.003 0 0 1 0-7.07l1.49-1.49c-.01.82.12 1.64.4 2.43l-.47.47a2.982 2.982 0 0 0 0 4.24a2.982 2.982 0 0 0 4.24 0l3.53-3.53a2.982 2.982 0 0 0 0-4.24a.973.973 0 0 1 0-1.42Z"/>'}},2079:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14m-.5 15.5v-5.3a3.26 3.26 0 0 0-3.26-3.26c-.85 0-1.84.52-2.32 1.3v-1.11h-2.79v8.37h2.79v-4.93c0-.77.62-1.4 1.39-1.4a1.4 1.4 0 0 1 1.4 1.4v4.93h2.79M6.88 8.56a1.68 1.68 0 0 0 1.68-1.68c0-.93-.75-1.69-1.68-1.69a1.69 1.69 0 0 0-1.69 1.69c0 .93.76 1.68 1.69 1.68m1.39 9.94v-8.37H5.5v8.37h2.77Z"/>'}},3271:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M19 13c.34 0 .67.04 1 .09V10a2 2 0 0 0-2-2h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6a2 2 0 0 0-2 2v10c0 1.11.89 2 2 2h7.81c-.51-.88-.81-1.9-.81-3c0-3.31 2.69-6 6-6M9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9V6m3 11a2 2 0 1 1 2-2c0 1.11-.89 2-2 2m10.5.25L17.75 22L15 19l1.16-1.16l1.59 1.59l3.59-3.59l1.16 1.41Z"/>'}},5207:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M18 1c-2.76 0-5 2.24-5 5v2H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12c1.11 0 2-.89 2-2V10a2 2 0 0 0-2-2h-1V6c0-1.66 1.34-3 3-3s3 1.34 3 3v2h2V6c0-2.76-2.24-5-5-5m-8 12a2 2 0 0 1 2 2c0 1.11-.89 2-2 2a2 2 0 1 1 0-4Z"/>'}},146:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M20.94 14c-.28 1.41-2.44 2.96-4.97 3.26c-1.31.15-2.6.3-3.97.24c-2.25-.11-4-.54-4-.54v.62c.32 2.22 2.22 2.35 4.03 2.42c1.82.05 3.44-.46 3.44-.46l.08 1.65s-1.28.68-3.55.81c-1.25.07-2.81-.03-4.62-.5c-3.92-1.05-4.6-5.24-4.7-9.5l-.01-3.43c0-4.34 2.83-5.61 2.83-5.61C6.95 2.3 9.41 2 11.97 2h.06c2.56 0 5.02.3 6.47.96c0 0 2.83 1.27 2.83 5.61c0 0 .04 3.21-.39 5.43M18 8.91c0-1.08-.3-1.91-.85-2.56c-.56-.63-1.3-.96-2.23-.96c-1.06 0-1.87.41-2.42 1.23l-.5.88l-.5-.88c-.56-.82-1.36-1.23-2.43-1.23c-.92 0-1.66.33-2.23.96C6.29 7 6 7.83 6 8.91v5.26h2.1V9.06c0-1.06.45-1.62 1.36-1.62c1 0 1.5.65 1.5 1.93v2.79h2.07V9.37c0-1.28.5-1.93 1.51-1.93c.9 0 1.35.56 1.35 1.62v5.11H18V8.91Z"/>'}},1299:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M14 19h4V5h-4M6 19h4V5H6v14Z"/>'}},6268:(e,t)=>{},9931:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M9.04 21.54c.96.29 1.93.46 2.96.46a10 10 0 0 0 10-10A10 10 0 0 0 12 2A10 10 0 0 0 2 12c0 4.25 2.67 7.9 6.44 9.34c-.09-.78-.18-2.07 0-2.96l1.15-4.94s-.29-.58-.29-1.5c0-1.38.86-2.41 1.84-2.41c.86 0 1.26.63 1.26 1.44c0 .86-.57 2.09-.86 3.27c-.17.98.52 1.84 1.52 1.84c1.78 0 3.16-1.9 3.16-4.58c0-2.4-1.72-4.04-4.19-4.04c-2.82 0-4.48 2.1-4.48 4.31c0 .86.28 1.73.74 2.3c.09.06.09.14.06.29l-.29 1.09c0 .17-.11.23-.28.11c-1.28-.56-2.02-2.38-2.02-3.85c0-3.16 2.24-6.03 6.56-6.03c3.44 0 6.12 2.47 6.12 5.75c0 3.44-2.13 6.2-5.18 6.2c-.97 0-1.92-.52-2.26-1.13l-.67 2.37c-.23.86-.86 2.01-1.29 2.7v-.03Z"/>'}},8843:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M8 5.14v14l11-7l-11-7Z"/>'}},7297:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2Z"/>'}},6761:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2m0 7a3 3 0 0 1 3 3a3 3 0 0 1-3 3a3 3 0 0 1-3-3a3 3 0 0 1 3-3Z"/>'}},1086:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12 5V1L7 6l5 5V7a6 6 0 0 1 6 6a6 6 0 0 1-6 6a6 6 0 0 1-6-6H4a8 8 0 0 0 8 8a8 8 0 0 0 8-8a8 8 0 0 0-8-8Z"/>'}},1097:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="m13.13 22.19l-1.63-3.83c1.57-.58 3.04-1.36 4.4-2.27l-2.77 6.1M5.64 12.5l-3.83-1.63l6.1-2.77C7 9.46 6.22 10.93 5.64 12.5M21.61 2.39S16.66.269 11 5.93c-2.19 2.19-3.5 4.6-4.35 6.71c-.28.75-.09 1.57.46 2.13l2.13 2.12c.55.56 1.37.74 2.12.46A19.1 19.1 0 0 0 18.07 13c5.66-5.66 3.54-10.61 3.54-10.61m-7.07 7.07c-.78-.78-.78-2.05 0-2.83s2.05-.78 2.83 0c.77.78.78 2.05 0 2.83c-.78.78-2.05.78-2.83 0m-5.66 7.07l-1.41-1.41l1.41 1.41M6.24 22l3.64-3.64c-.34-.09-.67-.24-.97-.45L4.83 22h1.41M2 22h1.41l4.77-4.76l-1.42-1.41L2 20.59V22m0-2.83l4.09-4.08c-.21-.3-.36-.62-.45-.97L2 17.76v1.41Z"/>'}},2693:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="m18 21l-4-4h3V7h-3l4-4l4 4h-3v10h3M2 19v-2h10v2M2 13v-2h7v2M2 7V5h4v2H2Z"/>'}},757:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.62L12 2L9.19 8.62L2 9.24l5.45 4.73L5.82 21L12 17.27Z"/>'}},8957:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M18 18H6V6h12v12Z"/>'}},67:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12 20a7 7 0 0 1-7-7a7 7 0 0 1 7-7a7 7 0 0 1 7 7a7 7 0 0 1-7 7m7.03-12.61l1.42-1.42c-.45-.51-.9-.97-1.41-1.41L17.62 6c-1.55-1.26-3.5-2-5.62-2a9 9 0 0 0-9 9a9 9 0 0 0 9 9c5 0 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61M11 14h2V8h-2m4-7H9v2h6V1Z"/>'}},6982:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="m21.71 20.29l-1.42 1.42a1 1 0 0 1-1.41 0L7 9.85A3.81 3.81 0 0 1 6 10a4 4 0 0 1-3.78-5.3l2.54 2.54l.53-.53l1.42-1.42l.53-.53L4.7 2.22A4 4 0 0 1 10 6a3.81 3.81 0 0 1-.15 1l11.86 11.88a1 1 0 0 1 0 1.41M2.29 18.88a1 1 0 0 0 0 1.41l1.42 1.42a1 1 0 0 0 1.41 0l5.47-5.46l-2.83-2.83M20 2l-4 2v2l-2.17 2.17l2 2L18 8h2l2-4Z"/>'}},552:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M9 3v1H4v2h1v13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6h1V4h-5V3H9m0 5h2v9H9V8m4 0h2v9h-2V8Z"/>'}},9014:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M22.46 6c-.77.35-1.6.58-2.46.69c.88-.53 1.56-1.37 1.88-2.38c-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29c0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15c0 1.49.75 2.81 1.91 3.56c-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07a4.28 4.28 0 0 0 4 2.98a8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21C16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56c.84-.6 1.56-1.36 2.14-2.23Z"/>'}},7695:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88c3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8Z"/>'}},1373:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M13 3v6h8V3m-8 18h8V11h-8M3 21h8v-6H3m0-2h8V3H3v10Z"/>'}},1333:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M3 11h8V3H3m0 18h8v-8H3m10 8h8v-8h-8m0-10v8h8V3"/>'}},6200:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M9 2a7 7 0 0 1 7 7c0 1.57-.5 3-1.39 4.19l.8.81H16l6 6l-2 2l-6-6v-.59l-.81-.8A6.916 6.916 0 0 1 9 16a7 7 0 0 1-7-7a7 7 0 0 1 7-7M8 5v3H5v2h3v3h2v-3h3V8h-3V5H8Z"/>'}},5977:(e,t,n)=>{"use strict";t.L3=t.In=void 0;var r,o=(r=n(1594))&&r.__esModule?r:{default:r};function i(e){return i="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},i(e)}function a(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,r.key,r)}}var s=0,l=/(-?[0-9.]*[0-9]+[0-9.]*)/g,c=/^-?[0-9.]*[0-9]+[0-9.]*$/g,u=["width","height","inline","hFlip","vFlip","flip","rotate","align","color","box"],h={left:0,top:0,width:16,height:16,rotate:0,hFlip:!1,vFlip:!1},f=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._item=t}var t,n,r;return t=e,r=[{key:"splitAttributes",value:function(e){var t={icon:Object.create(null),node:Object.create(null)};return Object.keys(e).forEach((function(n){t[-1===u.indexOf(n)?"node":"icon"][n]=e[n]})),t}},{key:"calculateDimension",value:function(e,t,n){if(1===t)return e;if(n=void 0===n?100:n,"number"==typeof e)return Math.ceil(e*t*n)/n;var r=e.split(l);if(null===r||!r.length)return null;for(var o,i=[],a=r.shift(),s=c.test(a);;){if(s?(o=parseFloat(a),isNaN(o)?i.push(a):i.push(Math.ceil(o*t*n)/n)):i.push(a),void 0===(a=r.shift()))return i.join("");s=!s}}},{key:"replaceIDs",value:function(e){var t,n,r=/\sid="(\S+)"/g,o=[];function i(e,t,n){for(var r=0;-1!==(r=n.indexOf(e,r));)n=n.slice(0,r)+t+n.slice(r+e.length),r+=t.length;return n}for(;t=r.exec(e);)o.push(t[1]);return o.length?(n="IconifyId-"+Date.now().toString(16)+"-"+(16777216*Math.random()|0).toString(16)+"-",o.forEach((function(t){var r=n+s;s++,e=i('="'+t+'"','="'+r+'"',e),e=i('="#'+t+'"','="#'+r+'"',e),e=i("(#"+t+")","(#"+r+")",e)})),e):e}}],(n=[{key:"getAttributes",value:function(t){var n=this._item;"object"!==i(t)&&(t=Object.create(null));var r={horizontal:"center",vertical:"middle",slice:!1},o={rotate:n.rotate,hFlip:n.hFlip,vFlip:n.vFlip},a=Object.create(null),s=Object.create(null),l=!0===t.inline||"true"===t.inline||"1"===t.inline,c={left:n.left,top:l?n.inlineTop:n.top,width:n.width,height:l?n.inlineHeight:n.height};if(["hFlip","vFlip"].forEach((function(e){void 0===t[e]||!0!==t[e]&&"true"!==t[e]&&"1"!==t[e]||(o[e]=!o[e])})),void 0!==t.flip&&t.flip.toLowerCase().split(/[\s,]+/).forEach((function(e){switch(e){case"horizontal":o.hFlip=!o.hFlip;break;case"vertical":o.vFlip=!o.vFlip}})),void 0!==t.rotate){var u=t.rotate;if("number"==typeof u)o.rotate+=u;else if("string"==typeof u){var h=u.replace(/^-?[0-9.]*/,"");if(""===h)u=parseInt(u),isNaN(u)||(o.rotate+=u);else if(h!==u){var f=!1;switch(h){case"%":f=25;break;case"deg":f=90}f&&(u=parseInt(u.slice(0,u.length-h.length)),isNaN(u)||(o.rotate+=Math.round(u/f)))}}}var d,p=[];switch(o.hFlip?o.vFlip?o.rotate+=2:(p.push("translate("+(c.width+c.left)+" "+(0-c.top)+")"),p.push("scale(-1 1)"),c.top=c.left=0):o.vFlip&&(p.push("translate("+(0-c.left)+" "+(c.height+c.top)+")"),p.push("scale(1 -1)"),c.top=c.left=0),o.rotate%4){case 1:d=c.height/2+c.top,p.unshift("rotate(90 "+d+" "+d+")"),0===c.left&&0===c.top||(d=c.left,c.left=c.top,c.top=d),c.width!==c.height&&(d=c.width,c.width=c.height,c.height=d);break;case 2:p.unshift("rotate(180 "+(c.width/2+c.left)+" "+(c.height/2+c.top)+")");break;case 3:d=c.width/2+c.left,p.unshift("rotate(-90 "+d+" "+d+")"),0===c.left&&0===c.top||(d=c.left,c.left=c.top,c.top=d),c.width!==c.height&&(d=c.width,c.width=c.height,c.height=d)}var m,g,y=t.width?t.width:null,v=t.height?t.height:null;null===y&&null===v&&(v="1em"),null!==y&&null!==v?(m=y,g=v):null!==y?(m=y,g=e.calculateDimension(m,c.height/c.width)):(g=v,m=e.calculateDimension(g,c.width/c.height)),!1!==m&&(s.width="auto"===m?c.width:m),!1!==g&&(s.height="auto"===g?c.height:g),l&&0!==n.verticalAlign&&(a["vertical-align"]=n.verticalAlign+"em"),void 0!==t.align&&t.align.toLowerCase().split(/[\s,]+/).forEach((function(e){switch(e){case"left":case"right":case"center":r.horizontal=e;break;case"top":case"bottom":case"middle":r.vertical=e;break;case"crop":r.slice=!0;break;case"meet":r.slice=!1}})),s.preserveAspectRatio=function(e){var t;switch(e.horizontal){case"left":t="xMin";break;case"right":t="xMax";break;default:t="xMid"}switch(e.vertical){case"top":t+="YMin";break;case"bottom":t+="YMax";break;default:t+="YMid"}return t+(e.slice?" slice":" meet")}(r),s.viewBox=c.left+" "+c.top+" "+c.width+" "+c.height;var b=e.replaceIDs(n.body);return void 0!==t.color&&(b=b.replace(/currentColor/g,t.color)),p.length&&(b='<g transform="'+p.join(" ")+'">'+b+"</g>"),!0!==t.box&&"true"!==t.box&&"1"!==t.box||(b+='<rect x="'+c.left+'" y="'+c.top+'" width="'+c.width+'" height="'+c.height+'" fill="rgba(0, 0, 0, 0)" />'),{attributes:s,body:b,style:a}}},{key:"getSVG",value:function(t,n){var r=e.splitAttributes(t),o=this.getAttributes(r.icon),i='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"';return n&&Object.keys(r.node).forEach((function(e){i+=" "+e+'="'+r.node[e]+'"'})),Object.keys(o.attributes).forEach((function(e){i+=" "+e+'="'+o.attributes[e]+'"'})),i+=' style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);',Object.keys(o.style).forEach((function(e){i+=" "+e+": "+o.style[e]+";"})),t&&void 0!==t.style&&(i+=t.style),i+='">',i+=o.body+"</svg>"}}])&&a(t.prototype,n),r&&a(t,r),e}();function d(e,t){if("object"!==i(e.icon))return null;var n=f.splitAttributes(e),r=n.icon,a=n.node;delete a.icon,void 0===r.inline&&(r.inline=t);var s=new f(function(e){var t,n=Object.create(null);for(t in h)n[t]=h[t];for(t in e)n[t]=e[t];return void 0===n.inlineTop&&(n.inlineTop=n.top),void 0===n.inlineHeight&&(n.inlineHeight=n.height),void 0===n.verticalAlign&&(n.verticalAlign=n.height%7==0&&n.height%8!=0?-.143:-.125),n}(e.icon)),l=s.getAttributes(r),c={transform:"rotate(360deg)"};if(void 0!==l.style["vertical-align"]&&(c.verticalAlign=l.style["vertical-align"]),void 0!==e.style)for(var u in e.style)c[u]=e.style[u];var d,p={xmlns:"http://www.w3.org/2000/svg",focusable:!1,style:c};for(d in a)p[d]=a[d];for(d in l.attributes)p[d]=l.attributes[d];return p.dangerouslySetInnerHTML={__html:l.body},o.default.createElement("svg",p,null)}t.In=function(e){return d(e,!1)},t.L3=function(e){return d(e,!0)}},5627:e=>{"use strict";var t=Object.prototype.hasOwnProperty,n="~";function r(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,r,i,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new o(r,i||e,a),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,r,o=[];if(0===this._eventsCount)return o;for(r in e=this._events)t.call(e,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,a=new Array(i);o<i;o++)a[o]=r[o].fn;return a},s.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,o,i,a){var s=n?n+e:e;if(!this._events[s])return!1;var l,c,u=this._events[s],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,o),!0;case 5:return u.fn.call(u.context,t,r,o,i),!0;case 6:return u.fn.call(u.context,t,r,o,i,a),!0}for(c=1,l=new Array(h-1);c<h;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var f,d=u.length;for(c=0;c<d;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),h){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,r);break;case 4:u[c].fn.call(u[c].context,t,r,o);break;default:if(!l)for(f=1,l=new Array(h-1);f<h;f++)l[f-1]=arguments[f];u[c].fn.apply(u[c].context,l)}}return!0},s.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,o){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return a(this,i),this;var s=this._events[i];if(s.fn)s.fn!==t||o&&!s.once||r&&s.context!==r||a(this,i);else{for(var l=0,c=[],u=s.length;l<u;l++)(s[l].fn!==t||o&&!s[l].once||r&&s[l].context!==r)&&c.push(s[l]);c.length?this._events[i]=1===c.length?c[0]:c:a(this,i)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s},3948:(e,t,n)=>{var r;function o(e){return o="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},o(e)}!function(){"use strict";var i=!("undefined"==typeof window||!window.document||!window.document.createElement),a={canUseDOM:i,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:i&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:i&&!!window.screen};"object"===o(n.amdO)&&n.amdO?void 0===(r=function(){return a}.call(t,n,t,e))||(e.exports=r):e.exports?e.exports=a:window.ExecutionEnvironment=a}()},9186:e=>{"use strict";e.exports=function(e,t){return t=t||function(){},e.then((function(e){return new Promise((function(e){e(t())})).then((function(){return e}))}),(function(e){return new Promise((function(e){e(t())})).then((function(){throw e}))}))}},6815:(e,t,n)=>{"use strict";function r(){r=function(){return t};var e,t={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},l=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function h(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(e){h=function(e,t,n){return e[t]=n}}function f(e,t,n,r){var o=t&&t.prototype instanceof b?t:b,a=Object.create(o.prototype),s=new R(r||[]);return i(a,"_invoke",{value:A(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=f;var p="suspendedStart",m="suspendedYield",g="executing",y="completed",v={};function b(){}function x(){}function w(){}var k={};h(k,l,(function(){return this}));var S=Object.getPrototypeOf,O=S&&S(S(T([])));O&&O!==n&&o.call(O,l)&&(k=O);var _=w.prototype=b.prototype=Object.create(k);function E(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(r,i,s,l){var c=d(e[r],e,i);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==a(h)&&o.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):t.resolve(h).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,l)}))}l(c.arg)}var r;i(this,"_invoke",{value:function(e,o){function i(){return new t((function(t,r){n(e,o,t,r)}))}return r=r?r.then(i,i):i()}})}function A(t,n,r){var o=p;return function(i,a){if(o===g)throw new Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var l=j(s,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=g;var c=d(t,n,r);if("normal"===c.type){if(o=r.done?y:m,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function j(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,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=d(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}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 M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function n(){for(;++r<t.length;)if(o.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(a(t)+" is not iterable")}return x.prototype=w,i(_,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:x,configurable:!0}),x.displayName=h(w,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,h(e,u,"GeneratorFunction")),e.prototype=Object.create(_),e},t.awrap=function(e){return{__await:e}},E(C.prototype),h(C.prototype,c,(function(){return this})),t.AsyncIterator=C,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new C(f(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(_),h(_,u,"Generator"),h(_,l,(function(){return this})),h(_,"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=T,R.prototype={constructor:R,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(M),!t)for(var n in this)"t"===n.charAt(0)&&o.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 r(r,o){return s.type="throw",s.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],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var l=o.call(a,"catchLoc"),c=o.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;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,v):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),v},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),M(n),v}},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;M(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function o(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function s(e){o(a,r,i,s,l,"next",e)}function l(e){o(a,r,i,s,l,"throw",e)}s(void 0)}))}}function a(e){return a="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},a(e)}function s(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,l(r.key),r)}}function l(e){var t=function(e,t){if("object"!=a(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:String(t)}function c(e,t,n){return t=h(t),function(e,t){if(t&&("object"===a(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],h(e).constructor):t.apply(e,n))}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(u=function(){return!!e})()}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}var d=n(5627),p=n(8198),m=n(4093),g=function(){},y=new p.TimeoutError,v=function(e){function t(e){var n,r,o,i,s;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=c(this,t))._intervalCount=0,n._intervalEnd=0,n._pendingCount=0,n._resolveEmpty=g,n._resolveIdle=g,!("number"==typeof(e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:m.default},e)).intervalCap&&e.intervalCap>=1))throw new TypeError("Expected `intervalCap` to be a number from 1 and up, got `".concat(null!==(o=null===(r=e.intervalCap)||void 0===r?void 0:r.toString())&&void 0!==o?o:"","` (").concat(a(e.intervalCap),")"));if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError("Expected `interval` to be a finite number >= 0, got `".concat(null!==(s=null===(i=e.interval)||void 0===i?void 0:i.toString())&&void 0!==s?s:"","` (").concat(a(e.interval),")"));return n._carryoverConcurrencyCount=e.carryoverConcurrencyCount,n._isIntervalIgnored=e.intervalCap===1/0||0===e.interval,n._intervalCap=e.intervalCap,n._interval=e.interval,n._queue=new e.queueClass,n._queueClass=e.queueClass,n.concurrency=e.concurrency,n._timeout=e.timeout,n._throwOnTimeout=!0===e.throwOnTimeout,n._isPaused=!1===e.autoStart,n}var n,o,l,u,h,d;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(t,e),n=t,o=[{key:"_doesIntervalAllowAnother",get:function(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}},{key:"_doesConcurrentAllowAnother",get:function(){return this._pendingCount<this._concurrency}},{key:"_next",value:function(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}},{key:"_resolvePromises",value:function(){this._resolveEmpty(),this._resolveEmpty=g,0===this._pendingCount&&(this._resolveIdle(),this._resolveIdle=g,this.emit("idle"))}},{key:"_onResumeInterval",value:function(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}},{key:"_isIntervalPaused",value:function(){var e=this,t=Date.now();if(void 0===this._intervalId){var n=this._intervalEnd-t;if(!(n<0))return void 0===this._timeoutId&&(this._timeoutId=setTimeout((function(){e._onResumeInterval()}),n)),!0;this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0}return!1}},{key:"_tryToStartAnother",value:function(){if(0===this._queue.size)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){var e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){var t=this._queue.dequeue();return!!t&&(this.emit("active"),t(),e&&this._initializeIntervalIfNeeded(),!0)}}return!1}},{key:"_initializeIntervalIfNeeded",value:function(){var e=this;this._isIntervalIgnored||void 0!==this._intervalId||(this._intervalId=setInterval((function(){e._onInterval()}),this._interval),this._intervalEnd=Date.now()+this._interval)}},{key:"_onInterval",value:function(){0===this._intervalCount&&0===this._pendingCount&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}},{key:"_processQueue",value:function(){for(;this._tryToStartAnother(););}},{key:"concurrency",get:function(){return this._concurrency},set:function(e){if(!("number"==typeof e&&e>=1))throw new TypeError("Expected `concurrency` to be a number from 1 and up, got `".concat(e,"` (").concat(a(e),")"));this._concurrency=e,this._processQueue()}},{key:"add",value:(d=i(r().mark((function e(t){var n,o=this,a=arguments;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:{},e.abrupt("return",new Promise((function(e,a){var s=function(){var s=i(r().mark((function i(){var s;return r().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o._pendingCount++,o._intervalCount++,r.prev=2,s=void 0===o._timeout&&void 0===n.timeout?t():p.default(Promise.resolve(t()),void 0===n.timeout?o._timeout:n.timeout,(function(){(void 0===n.throwOnTimeout?o._throwOnTimeout:n.throwOnTimeout)&&a(y)})),r.t0=e,r.next=7,s;case 7:r.t1=r.sent,(0,r.t0)(r.t1),r.next=14;break;case 11:r.prev=11,r.t2=r.catch(2),a(r.t2);case 14:o._next();case 15:case"end":return r.stop()}}),i,null,[[2,11]])})));return function(){return s.apply(this,arguments)}}();o._queue.enqueue(s,n),o._tryToStartAnother(),o.emit("add")})));case 2:case"end":return e.stop()}}),e)}))),function(e){return d.apply(this,arguments)})},{key:"addAll",value:(h=i(r().mark((function e(t,n){var o=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Promise.all(t.map(function(){var e=i(r().mark((function e(t){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o.add(t,n));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return h.apply(this,arguments)})},{key:"start",value:function(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}},{key:"pause",value:function(){this._isPaused=!0}},{key:"clear",value:function(){this._queue=new this._queueClass}},{key:"onEmpty",value:(u=i(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==this._queue.size){e.next=2;break}return e.abrupt("return");case 2:return e.abrupt("return",new Promise((function(e){var n=t._resolveEmpty;t._resolveEmpty=function(){n(),e()}})));case 3:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"onIdle",value:(l=i(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==this._pendingCount||0!==this._queue.size){e.next=2;break}return e.abrupt("return");case 2:return e.abrupt("return",new Promise((function(e){var n=t._resolveIdle;t._resolveIdle=function(){n(),e()}})));case 3:case"end":return e.stop()}}),e,this)}))),function(){return l.apply(this,arguments)})},{key:"size",get:function(){return this._queue.size}},{key:"sizeBy",value:function(e){return this._queue.filter(e).length}},{key:"pending",get:function(){return this._pendingCount}},{key:"isPaused",get:function(){return this._isPaused}},{key:"timeout",get:function(){return this._timeout},set:function(e){this._timeout=e}}],o&&s(n.prototype,o),Object.defineProperty(n,"prototype",{writable:!1}),t}(d);t.A=v},6011:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){for(var r=0,o=e.length;o>0;){var i=o/2|0,a=r+i;n(e[a],t)<=0?(r=++a,o-=i+1):o=i}return r}},4093:(e,t,n)=>{"use strict";function r(e){return r="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},r(e)}function o(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,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:String(t)}Object.defineProperty(t,"__esModule",{value:!0});var a=n(6011),s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._queue=[]}var t,n;return t=e,(n=[{key:"enqueue",value:function(e,t){var n={priority:(t=Object.assign({priority:0},t)).priority,run:e};if(this.size&&this._queue[this.size-1].priority>=t.priority)this._queue.push(n);else{var r=a.default(this._queue,n,(function(e,t){return t.priority-e.priority}));this._queue.splice(r,0,n)}}},{key:"dequeue",value:function(){var e=this._queue.shift();return null==e?void 0:e.run}},{key:"filter",value:function(e){return this._queue.filter((function(t){return t.priority===e.priority})).map((function(e){return e.run}))}},{key:"size",get:function(){return this._queue.length}}])&&o(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.default=s},8198:(e,t,n)=>{"use strict";function r(e){return r="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},r(e)}function o(e){var t="function"==typeof Map?new Map:void 0;return o=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(i())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&a(o,n.prototype),o}(e,arguments,s(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),a(n,e)},o(e)}function i(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(i=function(){return!!e})()}function a(e,t){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(e,t)}function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}var l=n(9186),c=function(e){function t(e){var n,o,a,l;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=this,a=t,l=[e],a=s(a),n=function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(o,i()?Reflect.construct(a,l||[],s(o).constructor):a.apply(o,l))).name="TimeoutError",n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)}(t,e),n=t,Object.defineProperty(n,"prototype",{writable:!1}),n;var n}(o(Error)),u=function(e,t,n){return new Promise((function(r,o){if("number"!=typeof t||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t!==1/0){var i=setTimeout((function(){if("function"!=typeof n){var i="string"==typeof n?n:"Promise timed out after ".concat(t," milliseconds"),a=n instanceof Error?n:new c(i);"function"==typeof e.cancel&&e.cancel(),o(a)}else try{r(n())}catch(e){o(e)}}),t);l(e.then(r,o),(function(){clearTimeout(i)}))}else r(e)}))};e.exports=u,e.exports.default=u,e.exports.TimeoutError=c},3873:(e,t,n)=>{"use strict";var r=n(1274);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,a){if(a!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},6365:(e,t,n)=>{e.exports=n(3873)()},1274:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},9092:(e,t,n)=>{"use strict";function r(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);null!=e&&this.setState(e)}function o(e){this.setState(function(t){var n=this.constructor.getDerivedStateFromProps(e,t);return null!=n?n:null}.bind(this))}function i(e,t){try{var n=this.props,r=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,r)}finally{this.props=n,this.state=r}}function a(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");if("function"!=typeof e.getDerivedStateFromProps&&"function"!=typeof t.getSnapshotBeforeUpdate)return e;var n=null,a=null,s=null;if("function"==typeof t.componentWillMount?n="componentWillMount":"function"==typeof t.UNSAFE_componentWillMount&&(n="UNSAFE_componentWillMount"),"function"==typeof t.componentWillReceiveProps?a="componentWillReceiveProps":"function"==typeof t.UNSAFE_componentWillReceiveProps&&(a="UNSAFE_componentWillReceiveProps"),"function"==typeof t.componentWillUpdate?s="componentWillUpdate":"function"==typeof t.UNSAFE_componentWillUpdate&&(s="UNSAFE_componentWillUpdate"),null!==n||null!==a||null!==s){var l=e.displayName||e.name,c="function"==typeof e.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+l+" uses "+c+" but also contains the following legacy lifecycles:"+(null!==n?"\n  "+n:"")+(null!==a?"\n  "+a:"")+(null!==s?"\n  "+s:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks")}if("function"==typeof e.getDerivedStateFromProps&&(t.componentWillMount=r,t.componentWillReceiveProps=o),"function"==typeof t.getSnapshotBeforeUpdate){if("function"!=typeof t.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=i;var u=t.componentDidUpdate;t.componentDidUpdate=function(e,t,n){var r=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;u.call(this,e,t,r)}}return e}n.r(t),n.d(t,{polyfill:()=>a}),r.__suppressDeprecationWarning=!0,o.__suppressDeprecationWarning=!0,i.__suppressDeprecationWarning=!0},2781:(e,t,n)=>{"use strict";function r(e){return r="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},r(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.bodyOpenClassName=t.portalClassName=void 0;var o=Object.assign||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},i=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(1594),s=m(a),l=m(n(5206)),c=m(n(6365)),u=m(n(9463)),h=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(915)),f=n(9853),d=m(f),p=n(9092);function m(e){return e&&e.__esModule?e:{default:e}}function g(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==r(t)&&"function"!=typeof t?e:t}var y=t.portalClassName="ReactModalPortal",v=t.bodyOpenClassName="ReactModal__Body--open",b=f.canUseDOM&&void 0!==l.default.createPortal,x=function(e){return document.createElement(e)},w=function(){return b?l.default.createPortal:l.default.unstable_renderSubtreeIntoContainer};function k(e){return e()}var S=function(e){function t(){var e,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,a=Array(i),c=0;c<i;c++)a[c]=arguments[c];return n=r=g(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.removePortal=function(){!b&&l.default.unmountComponentAtNode(r.node);var e=k(r.props.parentSelector);e&&e.contains(r.node)?e.removeChild(r.node):console.warn('React-Modal: "parentSelector" prop did not returned any DOM element. Make sure that the parent element is unmounted to avoid any memory leaks.')},r.portalRef=function(e){r.portal=e},r.renderPortal=function(e){var n=w()(r,s.default.createElement(u.default,o({defaultStyles:t.defaultStyles},e)),r.node);r.portalRef(n)},g(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+r(t));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"componentDidMount",value:function(){f.canUseDOM&&(b||(this.node=x("div")),this.node.className=this.props.portalClassName,k(this.props.parentSelector).appendChild(this.node),!b&&this.renderPortal(this.props))}},{key:"getSnapshotBeforeUpdate",value:function(e){return{prevParent:k(e.parentSelector),nextParent:k(this.props.parentSelector)}}},{key:"componentDidUpdate",value:function(e,t,n){if(f.canUseDOM){var r=this.props,o=r.isOpen,i=r.portalClassName;e.portalClassName!==i&&(this.node.className=i);var a=n.prevParent,s=n.nextParent;s!==a&&(a.removeChild(this.node),s.appendChild(this.node)),(e.isOpen||o)&&!b&&this.renderPortal(this.props)}}},{key:"componentWillUnmount",value:function(){if(f.canUseDOM&&this.node&&this.portal){var e=this.portal.state,t=Date.now(),n=e.isOpen&&this.props.closeTimeoutMS&&(e.closesAt||t+this.props.closeTimeoutMS);n?(e.beforeClose||this.portal.closeWithTimeout(),setTimeout(this.removePortal,n-t)):this.removePortal()}}},{key:"render",value:function(){return f.canUseDOM&&b?(!this.node&&b&&(this.node=x("div")),w()(s.default.createElement(u.default,o({ref:this.portalRef,defaultStyles:t.defaultStyles},this.props)),this.node)):null}}],[{key:"setAppElement",value:function(e){h.setElement(e)}}]),t}(a.Component);S.propTypes={isOpen:c.default.bool.isRequired,style:c.default.shape({content:c.default.object,overlay:c.default.object}),portalClassName:c.default.string,bodyOpenClassName:c.default.string,htmlOpenClassName:c.default.string,className:c.default.oneOfType([c.default.string,c.default.shape({base:c.default.string.isRequired,afterOpen:c.default.string.isRequired,beforeClose:c.default.string.isRequired})]),overlayClassName:c.default.oneOfType([c.default.string,c.default.shape({base:c.default.string.isRequired,afterOpen:c.default.string.isRequired,beforeClose:c.default.string.isRequired})]),appElement:c.default.oneOfType([c.default.instanceOf(d.default),c.default.instanceOf(f.SafeHTMLCollection),c.default.instanceOf(f.SafeNodeList),c.default.arrayOf(c.default.instanceOf(d.default))]),onAfterOpen:c.default.func,onRequestClose:c.default.func,closeTimeoutMS:c.default.number,ariaHideApp:c.default.bool,shouldFocusAfterRender:c.default.bool,shouldCloseOnOverlayClick:c.default.bool,shouldReturnFocusAfterClose:c.default.bool,preventScroll:c.default.bool,parentSelector:c.default.func,aria:c.default.object,data:c.default.object,role:c.default.string,contentLabel:c.default.string,shouldCloseOnEsc:c.default.bool,overlayRef:c.default.func,contentRef:c.default.func,id:c.default.string,overlayElement:c.default.func,contentElement:c.default.func},S.defaultProps={isOpen:!1,portalClassName:y,bodyOpenClassName:v,role:"dialog",ariaHideApp:!0,closeTimeoutMS:0,shouldFocusAfterRender:!0,shouldCloseOnEsc:!0,shouldCloseOnOverlayClick:!0,shouldReturnFocusAfterClose:!0,preventScroll:!1,parentSelector:function(){return document.body},overlayElement:function(e,t){return s.default.createElement("div",e,t)},contentElement:function(e,t){return s.default.createElement("div",e,t)}},S.defaultStyles={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.75)"},content:{position:"absolute",top:"40px",left:"40px",right:"40px",bottom:"40px",border:"1px solid #ccc",background:"#fff",overflow:"auto",WebkitOverflowScrolling:"touch",borderRadius:"4px",outline:"none",padding:"20px"}},(0,p.polyfill)(S),t.default=S},9463:(e,t,n)=>{"use strict";function r(e){return r="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},r(e)}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||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},i="function"==typeof Symbol&&"symbol"===r(Symbol.iterator)?function(e){return r(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":r(e)},a=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(1594),l=y(n(6365)),c=g(n(6518)),u=y(n(2374)),h=g(n(915)),f=g(n(5553)),d=n(9853),p=y(d),m=y(n(6551));function g(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function y(e){return e&&e.__esModule?e:{default:e}}n(9574);var v={overlay:"ReactModal__Overlay",content:"ReactModal__Content"},b=0,x=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==r(t)&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.setOverlayRef=function(e){n.overlay=e,n.props.overlayRef&&n.props.overlayRef(e)},n.setContentRef=function(e){n.content=e,n.props.contentRef&&n.props.contentRef(e)},n.afterClose=function(){var e=n.props,t=e.appElement,r=e.ariaHideApp,o=e.htmlOpenClassName,i=e.bodyOpenClassName,a=e.parentSelector,s=a&&a().ownerDocument||document;i&&f.remove(s.body,i),o&&f.remove(s.getElementsByTagName("html")[0],o),r&&b>0&&0==(b-=1)&&h.show(t),n.props.shouldFocusAfterRender&&(n.props.shouldReturnFocusAfterClose?(c.returnFocus(n.props.preventScroll),c.teardownScopedFocus()):c.popWithoutFocus()),n.props.onAfterClose&&n.props.onAfterClose(),m.default.deregister(n)},n.open=function(){n.beforeOpen(),n.state.afterOpen&&n.state.beforeClose?(clearTimeout(n.closeTimer),n.setState({beforeClose:!1})):(n.props.shouldFocusAfterRender&&(c.setupScopedFocus(n.node),c.markForFocusLater()),n.setState({isOpen:!0},(function(){n.openAnimationFrame=requestAnimationFrame((function(){n.setState({afterOpen:!0}),n.props.isOpen&&n.props.onAfterOpen&&n.props.onAfterOpen({overlayEl:n.overlay,contentEl:n.content})}))})))},n.close=function(){n.props.closeTimeoutMS>0?n.closeWithTimeout():n.closeWithoutTimeout()},n.focusContent=function(){return n.content&&!n.contentHasFocus()&&n.content.focus({preventScroll:!0})},n.closeWithTimeout=function(){var e=Date.now()+n.props.closeTimeoutMS;n.setState({beforeClose:!0,closesAt:e},(function(){n.closeTimer=setTimeout(n.closeWithoutTimeout,n.state.closesAt-Date.now())}))},n.closeWithoutTimeout=function(){n.setState({beforeClose:!1,isOpen:!1,afterOpen:!1,closesAt:null},n.afterClose)},n.handleKeyDown=function(e){(function(e){return"Tab"===e.code||9===e.keyCode})(e)&&(0,u.default)(n.content,e),n.props.shouldCloseOnEsc&&function(e){return"Escape"===e.code||27===e.keyCode}(e)&&(e.stopPropagation(),n.requestClose(e))},n.handleOverlayOnClick=function(e){null===n.shouldClose&&(n.shouldClose=!0),n.shouldClose&&n.props.shouldCloseOnOverlayClick&&(n.ownerHandlesClose()?n.requestClose(e):n.focusContent()),n.shouldClose=null},n.handleContentOnMouseUp=function(){n.shouldClose=!1},n.handleOverlayOnMouseDown=function(e){n.props.shouldCloseOnOverlayClick||e.target!=n.overlay||e.preventDefault()},n.handleContentOnClick=function(){n.shouldClose=!1},n.handleContentOnMouseDown=function(){n.shouldClose=!1},n.requestClose=function(e){return n.ownerHandlesClose()&&n.props.onRequestClose(e)},n.ownerHandlesClose=function(){return n.props.onRequestClose},n.shouldBeClosed=function(){return!n.state.isOpen&&!n.state.beforeClose},n.contentHasFocus=function(){return document.activeElement===n.content||n.content.contains(document.activeElement)},n.buildClassName=function(e,t){var r="object"===(void 0===t?"undefined":i(t))?t:{base:v[e],afterOpen:v[e]+"--after-open",beforeClose:v[e]+"--before-close"},o=r.base;return n.state.afterOpen&&(o=o+" "+r.afterOpen),n.state.beforeClose&&(o=o+" "+r.beforeClose),"string"==typeof t&&t?o+" "+t:o},n.attributesFromObject=function(e,t){return Object.keys(t).reduce((function(n,r){return n[e+"-"+r]=t[r],n}),{})},n.state={afterOpen:!1,beforeClose:!1},n.shouldClose=null,n.moveFromContentToOverlay=null,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+r(t));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),a(t,[{key:"componentDidMount",value:function(){this.props.isOpen&&this.open()}},{key:"componentDidUpdate",value:function(e,t){this.props.isOpen&&!e.isOpen?this.open():!this.props.isOpen&&e.isOpen&&this.close(),this.props.shouldFocusAfterRender&&this.state.isOpen&&!t.isOpen&&this.focusContent()}},{key:"componentWillUnmount",value:function(){this.state.isOpen&&this.afterClose(),clearTimeout(this.closeTimer),cancelAnimationFrame(this.openAnimationFrame)}},{key:"beforeOpen",value:function(){var e=this.props,t=e.appElement,n=e.ariaHideApp,r=e.htmlOpenClassName,o=e.bodyOpenClassName,i=e.parentSelector,a=i&&i().ownerDocument||document;o&&f.add(a.body,o),r&&f.add(a.getElementsByTagName("html")[0],r),n&&(b+=1,h.hide(t)),m.default.register(this)}},{key:"render",value:function(){var e=this.props,t=e.id,n=e.className,r=e.overlayClassName,i=e.defaultStyles,a=e.children,s=n?{}:i.content,l=r?{}:i.overlay;if(this.shouldBeClosed())return null;var c={ref:this.setOverlayRef,className:this.buildClassName("overlay",r),style:o({},l,this.props.style.overlay),onClick:this.handleOverlayOnClick,onMouseDown:this.handleOverlayOnMouseDown},u=o({id:t,ref:this.setContentRef,style:o({},s,this.props.style.content),className:this.buildClassName("content",n),tabIndex:"-1",onKeyDown:this.handleKeyDown,onMouseDown:this.handleContentOnMouseDown,onMouseUp:this.handleContentOnMouseUp,onClick:this.handleContentOnClick,role:this.props.role,"aria-label":this.props.contentLabel},this.attributesFromObject("aria",o({modal:!0},this.props.aria)),this.attributesFromObject("data",this.props.data||{}),{"data-testid":this.props.testId}),h=this.props.contentElement(u,a);return this.props.overlayElement(c,h)}}]),t}(s.Component);x.defaultProps={style:{overlay:{},content:{}},defaultStyles:{}},x.propTypes={isOpen:l.default.bool.isRequired,defaultStyles:l.default.shape({content:l.default.object,overlay:l.default.object}),style:l.default.shape({content:l.default.object,overlay:l.default.object}),className:l.default.oneOfType([l.default.string,l.default.object]),overlayClassName:l.default.oneOfType([l.default.string,l.default.object]),parentSelector:l.default.func,bodyOpenClassName:l.default.string,htmlOpenClassName:l.default.string,ariaHideApp:l.default.bool,appElement:l.default.oneOfType([l.default.instanceOf(p.default),l.default.instanceOf(d.SafeHTMLCollection),l.default.instanceOf(d.SafeNodeList),l.default.arrayOf(l.default.instanceOf(p.default))]),onAfterOpen:l.default.func,onAfterClose:l.default.func,onRequestClose:l.default.func,closeTimeoutMS:l.default.number,shouldFocusAfterRender:l.default.bool,shouldCloseOnOverlayClick:l.default.bool,shouldReturnFocusAfterClose:l.default.bool,preventScroll:l.default.bool,role:l.default.string,contentLabel:l.default.string,aria:l.default.object,data:l.default.object,children:l.default.node,shouldCloseOnEsc:l.default.bool,overlayRef:l.default.func,contentRef:l.default.func,id:l.default.string,overlayElement:l.default.func,contentElement:l.default.func,testId:l.default.string},t.default=x,e.exports=t.default},915:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetState=function(){a&&(a.removeAttribute?a.removeAttribute("aria-hidden"):null!=a.length?a.forEach((function(e){return e.removeAttribute("aria-hidden")})):document.querySelectorAll(a).forEach((function(e){return e.removeAttribute("aria-hidden")}))),a=null},t.log=function(){},t.assertNodeList=s,t.setElement=function(e){var t=e;if("string"==typeof t&&i.canUseDOM){var n=document.querySelectorAll(t);s(n,t),t=n}return a=t||a},t.validateElement=l,t.hide=function(e){var t=!0,n=!1,r=void 0;try{for(var o,i=l(e)[Symbol.iterator]();!(t=(o=i.next()).done);t=!0)o.value.setAttribute("aria-hidden","true")}catch(e){n=!0,r=e}finally{try{!t&&i.return&&i.return()}finally{if(n)throw r}}},t.show=function(e){var t=!0,n=!1,r=void 0;try{for(var o,i=l(e)[Symbol.iterator]();!(t=(o=i.next()).done);t=!0)o.value.removeAttribute("aria-hidden")}catch(e){n=!0,r=e}finally{try{!t&&i.return&&i.return()}finally{if(n)throw r}}},t.documentNotReadyOrSSRTesting=function(){a=null};var r,o=(r=n(1392))&&r.__esModule?r:{default:r},i=n(9853),a=null;function s(e,t){if(!e||!e.length)throw new Error("react-modal: No elements were found for selector "+t+".")}function l(e){var t=e||a;return t?Array.isArray(t)||t instanceof HTMLCollection||t instanceof NodeList?t:[t]:((0,o.default)(!1,["react-modal: App element is not defined.","Please use `Modal.setAppElement(el)` or set `appElement={el}`.","This is needed so screen readers don't see main content","when modal is opened. It is not recommended, but you can opt-out","by setting `ariaHideApp={false}`."].join(" ")),[])}},9574:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetState=function(){for(var e=[i,a],t=0;t<e.length;t++){var n=e[t];n&&n.parentNode&&n.parentNode.removeChild(n)}i=a=null,s=[]},t.log=function(){console.log("bodyTrap ----------"),console.log(s.length);for(var e=[i,a],t=0;t<e.length;t++){var n=e[t]||{};console.log(n.nodeName,n.className,n.id)}console.log("edn bodyTrap ----------")};var r,o=(r=n(6551))&&r.__esModule?r:{default:r},i=void 0,a=void 0,s=[];function l(){0!==s.length&&s[s.length-1].focusContent()}o.default.subscribe((function(e,t){i||a||((i=document.createElement("div")).setAttribute("data-react-modal-body-trap",""),i.style.position="absolute",i.style.opacity="0",i.setAttribute("tabindex","0"),i.addEventListener("focus",l),(a=i.cloneNode()).addEventListener("focus",l)),(s=t).length>0?(document.body.firstChild!==i&&document.body.insertBefore(i,document.body.firstChild),document.body.lastChild!==a&&document.body.appendChild(a)):(i.parentElement&&i.parentElement.removeChild(i),a.parentElement&&a.parentElement.removeChild(a))}))},5553:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetState=function(){var e=document.getElementsByTagName("html")[0];for(var t in n)o(e,n[t]);var i=document.body;for(var a in r)o(i,r[a]);n={},r={}},t.log=function(){};var n={},r={};function o(e,t){e.classList.remove(t)}t.add=function(e,t){return o=e.classList,i="html"==e.nodeName.toLowerCase()?n:r,void t.split(" ").forEach((function(e){!function(e,t){e[t]||(e[t]=0),e[t]+=1}(i,e),o.add(e)}));var o,i},t.remove=function(e,t){return o=e.classList,i="html"==e.nodeName.toLowerCase()?n:r,void t.split(" ").forEach((function(e){!function(e,t){e[t]&&(e[t]-=1)}(i,e),0===i[e]&&o.remove(e)}));var o,i}},6518:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetState=function(){i=[]},t.log=function(){},t.handleBlur=l,t.handleFocus=c,t.markForFocusLater=function(){i.push(document.activeElement)},t.returnFocus=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=null;try{return void(0!==i.length&&(t=i.pop()).focus({preventScroll:e}))}catch(e){console.warn(["You tried to return focus to",t,"but it is not in the DOM anymore"].join(" "))}},t.popWithoutFocus=function(){i.length>0&&i.pop()},t.setupScopedFocus=function(e){a=e,window.addEventListener?(window.addEventListener("blur",l,!1),document.addEventListener("focus",c,!0)):(window.attachEvent("onBlur",l),document.attachEvent("onFocus",c))},t.teardownScopedFocus=function(){a=null,window.addEventListener?(window.removeEventListener("blur",l),document.removeEventListener("focus",c)):(window.detachEvent("onBlur",l),document.detachEvent("onFocus",c))};var r,o=(r=n(1602))&&r.__esModule?r:{default:r},i=[],a=null,s=!1;function l(){s=!0}function c(){if(s){if(s=!1,!a)return;setTimeout((function(){a.contains(document.activeElement)||((0,o.default)(a)[0]||a).focus()}),0)}}},6551:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.log=function(){console.log("portalOpenInstances ----------"),console.log(r.openInstances.length),r.openInstances.forEach((function(e){return console.log(e)})),console.log("end portalOpenInstances ----------")},t.resetState=function(){r=new n};var n=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.register=function(e){-1===t.openInstances.indexOf(e)&&(t.openInstances.push(e),t.emit("register"))},this.deregister=function(e){var n=t.openInstances.indexOf(e);-1!==n&&(t.openInstances.splice(n,1),t.emit("deregister"))},this.subscribe=function(e){t.subscribers.push(e)},this.emit=function(e){t.subscribers.forEach((function(n){return n(e,t.openInstances.slice())}))},this.openInstances=[],this.subscribers=[]},r=new n;t.default=r},9853:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.canUseDOM=t.SafeNodeList=t.SafeHTMLCollection=void 0;var r,o=((r=n(3948))&&r.__esModule?r:{default:r}).default,i=o.canUseDOM?window.HTMLElement:{};t.SafeHTMLCollection=o.canUseDOM?window.HTMLCollection:{},t.SafeNodeList=o.canUseDOM?window.NodeList:{},t.canUseDOM=o.canUseDOM,t.default=i},2374:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=(0,o.default)(e);if(n.length){var r=void 0,a=t.shiftKey,s=n[0],l=n[n.length-1],c=i();if(e===c){if(!a)return;r=l}if(l!==c||a||(r=s),s===c&&a&&(r=l),r)return t.preventDefault(),void r.focus();var u=/(\bChrome\b|\bSafari\b)\//.exec(navigator.userAgent);if(null!=u&&"Chrome"!=u[1]&&null==/\biPod\b|\biPad\b/g.exec(navigator.userAgent)){var h=n.indexOf(c);if(h>-1&&(h+=a?-1:1),void 0===(r=n[h]))return t.preventDefault(),void(r=a?l:s).focus();t.preventDefault(),r.focus()}}else t.preventDefault()};var r,o=(r=n(1602))&&r.__esModule?r:{default:r};function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;return e.activeElement.shadowRoot?i(e.activeElement.shadowRoot):e.activeElement}e.exports=t.default},1602:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(t){return[].slice.call(t.querySelectorAll("*"),0).reduce((function(t,n){return t.concat(n.shadowRoot?e(n.shadowRoot):[n])}),[]).filter(a)};var n="none",r="contents",o=/input|select|textarea|button|object|iframe/;function i(e){var t=e.offsetWidth<=0&&e.offsetHeight<=0;if(t&&!e.innerHTML)return!0;try{var o=window.getComputedStyle(e),i=o.getPropertyValue("display");return t?i!==r&&function(e,t){return"visible"!==t.getPropertyValue("overflow")||e.scrollWidth<=0&&e.scrollHeight<=0}(e,o):i===n}catch(e){return console.warn("Failed to inspect element style"),!1}}function a(e){var t=e.getAttribute("tabindex");null===t&&(t=void 0);var n=isNaN(t);return(n||t>=0)&&function(e,t){var n=e.nodeName.toLowerCase();return(o.test(n)&&!e.disabled||"a"===n&&e.href||t)&&function(e){for(var t=e,n=e.getRootNode&&e.getRootNode();t&&t!==document.body;){if(n&&t===n&&(t=n.host.parentNode),i(t))return!1;t=t.parentNode}return!0}(e)}(e,!n)}e.exports=t.default},8187:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=(r=n(2781))&&r.__esModule?r:{default:r};t.default=o.default,e.exports=t.default},1392:e=>{"use strict";e.exports=function(){}},2564:(e,t,n)=>{"use strict";n.d(t,{A:()=>h,z:()=>c});var r,o,i,a=n(3185),s={white:"white",black:"black",blue:"hsl(204.25deg 100% 36.47%)",green:"hsl(165deg 100% 34.51%)",red:"hsl(22, 100%, 36%)",orange:"hsl(36deg 73.28% 54.51%)",yellow:"hsl(44.43deg 77.41% 53.14%)",purple:"hsl(270, 38%, 59%)",gray30:"hsl(200deg 10.45% 26.27%)",gray60:"hsl(200deg 10.45% 60%)",gray98:"hsl(0deg 0% 98%)"},l=(0,a.DU)(r||(o=["\n  :root {\n    // Base colors\n    --neko-blue: ",";\n    --neko-white: ",";\n    --neko-black: ",";\n    --neko-purple: ",";\n    --neko-orange: ",";\n    --neko-yellow: ",";\n    --neko-green: ",";\n    --neko-red: ",";\n\n    // Main color\n    --neko-main-color: var(--neko-blue);\n\n    // Variants\n    --neko-success: var(--neko-blue);\n    --neko-primary: var(--neko-main-color);\n    --neko-secondary: #EBF3FF; // TODO: This needs to be updated to a proper color\n    --neko-danger: var(--neko-red);\n\n    // Base styles\n    --neko-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n    --neko-font-size: 13px; \n    --neko-small-font-size: 12px; \n    --neko-h1-font-size: 23px;\n    --neko-h2-font-size: 20px;\n    --neko-h3-font-size: 18px;\n    --neko-h4-font-size: 16px;\n    --neko-h5-font-size: 14px;\n    --neko-font-color: var(--neko-gray-30);\n\n    // Gray shades\n    --neko-gray-30: ",";\n    --neko-gray-60: ",";\n    --neko-gray-98: ",";\n    --neko-wp-background-color: #f0f0f1;\n\n    // Main color shades\n    --neko-main-overlay-color: rgb(30 124 186 / 85%);\n    --neko-main-color-10: hsl(206deg 100% 22.35%);\n    --neko-main-color-50: hsl(206deg 61.04% 54.71%);\n    --neko-main-color-80: hsl(206deg 55.93% 88.43%);\n    --neko-main-color-98: hsl(200deg 100% 98.82%);\n\n    // Neko UI\n    --neko-background-color: var(--neko-wp-background-color);\n    --neko-disabled-color: var(--neko-gray-60);\n    --neko-main-color-alternative: var(--neko-main-color-10);\n    --neko-main-color-disabled: var(--neko-main-color-50);\n    --neko-input-background: var(--neko-main-color-98);\n    --neko-input-border: var(--neko-main-color-80);\n  }\n"],i||(i=o.slice(0)),r=Object.freeze(Object.defineProperties(o,{raw:{value:Object.freeze(i)}}))),s.blue,s.white,s.black,s.purple,s.orange,s.yellow,s.green,s.red,s.gray30,s.gray60,s.gray98),c=function(){return{colors:s}},u=function(e){var t=e.children;return React.createElement(React.Fragment,null,React.createElement(l,{key:"neko-ui-styles"}),t)};const h=function(e){var t=e.children;return React.createElement(u,null,t)}},9296:(e,t,n)=>{"use strict";n.d(t,{M:()=>x});var r,o=n(1594),i=n(6365),a=n.n(i),s=n(3185),l=n(5977),c=n(6087),u=n(8922),h=n(1329),f=n(6897),d=["className","disabled","icon","color","onClick","rounded","isBusy","spinning","disabledColor","busyText","hideBusyIcon","busyIconSize","requirePro","isPro","small","width","height","fullWidth","startTime","children"];function p(){return p=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},p.apply(this,arguments)}function m(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 g,y,v=(0,s.Ay)((function(e){var t=e.className,n=void 0===t?"primary":t,r=e.disabled,i=void 0!==r&&r,a=e.icon,s=void 0===a?null:a,l=e.color,g=void 0===l?null:l,y=e.onClick,v=void 0===y?function(){}:y,b=e.rounded,x=e.isBusy,w=void 0!==x&&x,k=e.spinning,S=void 0!==k&&k,O=(e.disabledColor,e.busyText),_=e.hideBusyIcon,E=void 0!==_&&_,C=e.busyIconSize,A=e.requirePro,j=void 0!==A&&A,P=e.isPro,M=void 0!==P&&P,R=e.small,T=e.width,L=(e.height,e.fullWidth),I=e.startTime,N=void 0===I?null:I,z=e.children,D=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,d);i=i&&!w;var F,B,$=!!s,H=j&&!M,W=(0,o.useMemo)((function(){var e=null!=T?T:30;return b?e-10:e-6}),[T,b]),q=(0,o.useMemo)((function(){return C||"22px"}),[C]),V=(F=(0,o.useState)(null),B=2,function(e){if(Array.isArray(e))return e}(F)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(F,B)||function(e,t){if(e){if("string"==typeof e)return m(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)?m(e,t):void 0}}(F,B)||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.")}()),U=V[0],K=V[1];(0,f.$$)((function(){return K(new Date)}),N?1e3:null),(0,o.useEffect)((function(){N||K(null)}),[N]);var Q=(0,o.useMemo)((function(){if(!N||!U)return null;var e=Math.floor((U-N)/1e3),t=Math.floor(e/60),n=e%60;return"".concat(t.toString().padStart(2,"0"),":").concat(n.toString().padStart(2,"0"))}),[U,N]),G=(0,f.gR)("neko-button",n,{"has-icon":$},{"custom-color":g},{small:R},{rounded:b},{busy:w},{"is-pro":H},{full:L});return React.createElement("button",p({type:"button",className:G,onClick:function(e){i||v(),e.stopPropagation(),e.preventDefault()},disabled:i||H},D),w&&!E&&React.createElement(React.Fragment,null,React.createElement(c.X,{type:"circle",color:"#fff",size:q})),w&&Q&&React.createElement("span",{className:"chrono-time"},Q),w&&!!O&&React.createElement("span",{style:{marginLeft:E?0:"4px",marginRight:"2px"}},O),$&&!w&&React.createElement(u.z,{raw:!0,icon:s,width:W,height:W,spinning:S,style:b?{margin:"0 auto"}:{}}),!!z&&!w&&React.createElement("span",{style:{marginLeft:$?"4px":0,marginRight:$?"2px":0}},z),H&&React.createElement(h.K,{style:{marginLeft:"8px"}}))}))(r||(g=["\n  display: inline-flex;\n  align-items: center;\n  justify-content: center;\n  box-sizing: border-box;\n  height: 30px;\n  min-height: 30px;\n  min-width: 40px;\n  border: none;\n  border-radius: 4px;\n  text-align: center;\n  padding: 0 15px;\n  vertical-align: middle;\n  background-color: var(--neko-main-color);\n  color: white;\n\n  span {\n    white-space: nowrap;\n    text-overflow: ellipsis;\n    display: flex;\n    align-items: center;\n  }\n\n  .chrono-time {\n    font-size: 11px;\n    margin-left: 5px;\n  }\n\n  &:not([disabled]):hover {\n    cursor: pointer;\n    background-image: none;\n    filter: brightness(1.1);\n  }\n\n  &:disabled {\n    opacity: 0.35;\n  }\n\n  &:focus {\n    outline: none;\n  }\n\n  &.is-pro {\n    background-image: none;\n    background-color: var(--neko-main-color-disabled);\n    rgb(255 255 255 / 65%);\n    align-items: center;\n    opacity: 1;\n  }\n\n  &.has-icon {\n    align-items: center;\n    padding: 2.5px 8px;\n\n    svg {\n      color: white;\n    }\n  }\n\n  &.secondary {\n    background-image: none;\n    background-color: var(--neko-secondary);\n    color: var(--neko-main-color);\n    border: 1px solid var(--neko-input-border);\n\n    svg {\n      color: var(--neko-main-color);\n    }\n\n    &:hover {\n      background-color: var(--neko-secondary);\n      border: 1px solid var(--neko-input-border);\n      filter: brightness(1.025);\n    }\n  }\n\n  &.danger {\n    background-image: none;\n    background-color: var(--neko-danger);\n    border-color: var(--neko-danger);\n  }\n\n  &.success {\n    background-image: none;\n    background-color: var(--neko-green);\n    border-color: var(--neko-green);\n\n    &:hover {\n      background-color: var(--neko-lighten-green);\n    }\n  }\n\n  & + button {\n    margin-left: .25rem;\n  }\n\n  &.small {\n    font-size: var(--neko-small-font-size);\n    height: 24px;\n    min-height: 24px;\n  }\n\n  &.header {\n    background-image: none;\n    filter: brightness(1.1);\n    background-color: var(--neko-main-color);\n    height: 40px;\n    padding: 0 20px;\n\n    &:hover {\n      background-color: var(--neko-main-color);\n      filter: brightness(1.2);\n    }\n  }\n\n  &.rounded {\n    border-radius: 100%;\n    min-width: 30px;\n    height: ","px;\n    width: ","px;\n    padding: 3px;\n  }\n\n  &.busy {\n    pointer-events: none;\n  }\n\n  &.full {\n    width: 100%;\n  }\n\n  ","\n"],y||(y=g.slice(0)),r=Object.freeze(Object.defineProperties(g,{raw:{value:Object.freeze(y)}}))),(function(e){var t,n;return null!==(t=e.height)&&void 0!==t?t:null!==(n=e.width)&&void 0!==n?n:30}),(function(e){var t;return null!==(t=e.width)&&void 0!==t?t:30}),(function(e){return b(e.color)})),b=function(e){if(e)return"\n      &.custom-color {\n        background-color: ".concat(e,";\n        border: 1px solid ").concat(e,";\n\n        &:hover {\n          background-color: ").concat(e,";\n          filter: brightness(1.1);\n        }\n      }\n    ")},x=function(e){return React.createElement(v,e)};x.propTypes={className:a().oneOf(["primary","primary-block","secondary","danger","success","header"]),disabled:a().bool,icon:a().oneOfType([a().instanceOf(l.In),a().oneOf(["setting","edit","trash"])]),color:a().string,onClick:a().func.isRequired,rounded:a().bool,isBusy:a().bool,spinning:a().bool,busyText:a().string,hideBusyIcon:a().bool,busyIconSize:a().string,requirePro:a().bool,isPro:a().bool,disabledColor:a().string}},2557:(e,t,n)=>{"use strict";n.d(t,{A:()=>p});var r=n(1594),o=n.n(r),i=n(6365),a=n.n(i),s=n(6897);function l(e){return l="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},l(e)}function c(){return c=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},c.apply(this,arguments)}function u(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 h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(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"!=l(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==l(t)?t:String(t)}(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)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function f(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 d=function(e){var t,n,i=e.spinner,a=void 0===i||i,l=e.busy,u=void 0!==l&&l,d=e.overlayStyle,p=(t=(0,r.useState)(!0),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return f(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)?f(e,t):void 0}}(t,n)||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.")}()),m=p[0],g=p[1];(0,r.useEffect)((function(){var e;return u?g(!0):e=setTimeout((function(){g(!1),e=null}),250),function(){e&&clearTimeout(e)}}),[u]);var y=(0,s.gR)("neko-overlay",{overlayHidden:!u}),v=m?o().createElement(o().Fragment,null,o().createElement("div",{className:y,style:d},Boolean(a)&&o().createElement("div",{className:"lds-ellipsis "+(u?"":"spinnerHidden")},o().createElement("div",null),o().createElement("div",null),o().createElement("div",null),o().createElement("div",null))),o().createElement("style",{jsx:"true"},"\n        .neko-overlay {\n          position: absolute;\n          top: 0;\n          left: 0;\n          bottom: 0;\n          width: 100%;\n          height: 100%;\n          background: var(--neko-main-overlay-color);\n          border-radius: 8px;\n          transition: opacity 1s ease-out;\n          z-index: 10;\n          display: flex;\n          align-items: center;\n          flex-direction: column;\n          justify-content: center;\n          overflow: hidden;\n        }\n\n        .overlayHidden {\n          opacity: 0;\n          transition: opacity 0.25s ease-out;\n        }\n        .spinnerHidden {\n          opacity: 0;\n          transition: opacity 0.25s ease-out;\n        }\n        .lds-ellipsis {\n          position: relative;\n          width: 80px;\n          height: 80px;\n          display: flex;\n          justify-items: center;\n          align-items: center;\n        }\n        .lds-ellipsis div {\n          position: absolute;\n          width: 13px;\n          height: 13px;\n          border-radius: 50%;\n          background: white;\n          animation-timing-function: cubic-bezier(0, 1, 1, 0);\n        }\n        .lds-ellipsis div:nth-child(1) {\n          left: 8px;\n          animation: lds-ellipsis1 0.6s infinite;\n        }\n        .lds-ellipsis div:nth-child(2) {\n          left: 8px;\n          animation: lds-ellipsis2 0.6s infinite;\n        }\n        .lds-ellipsis div:nth-child(3) {\n          left: 32px;\n          animation: lds-ellipsis2 0.6s infinite;\n        }\n        .lds-ellipsis div:nth-child(4) {\n          left: 56px;\n          animation: lds-ellipsis3 0.6s infinite;\n        }\n        @keyframes lds-ellipsis1 {\n          0% {\n            transform: scale(0);\n          }\n          100% {\n            transform: scale(1);\n          }\n        }\n        @keyframes lds-ellipsis3 {\n          0% {\n            transform: scale(1);\n          }\n          100% {\n            transform: scale(0);\n          }\n        }\n        @keyframes lds-ellipsis2 {\n          0% {\n            transform: translate(0, 0);\n          }\n          100% {\n            transform: translate(24px, 0);\n          }\n        }\n      ")):null,b=h(h({},e),{},{busy:void 0,spinner:void 0});return o().createElement("div",c({style:{position:"relative"}},b),v,e.children)};d.propTypes={busy:a().bool.isRequired,spinner:a().bool,children:a().oneOfType([a().arrayOf(a().node),a().node]).isRequired};const p=d},5263:(e,t,n)=>{"use strict";n.d(t,{R:()=>y});var r,o=n(1594),i=n.n(o),a=n(6365),s=n.n(a),l=n(3185),c=n(1329),u=n(6087),h=n(6897),f=["name","checked","indeterminate","onChange","label","description","isPro","disabled","requirePro","isBusy","small"];function d(){return d=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},d.apply(this,arguments)}var p,m,g=l.Ay.div(r||(p=["\n  user-select: none;\n  transition: color 0.3s ease;\n\n  &.disabled {\n    color: var(--neko-disabled-color);\n\n    .neko-content {\n      cursor: default;\n    }\n\n    .neko-checkbox-check-container, .neko-label, .description {\n      opacity: 0.35;\n    }\n  }\n\n  input {\n    display: none;\n  }\n\n  .neko-content {\n    cursor: pointer;\n    display: flex;\n  }\n\n  .neko-checkbox-check-container {\n    display: flex;\n    padding-top: 2px;\n    align-content: center;\n\n    .neko-checkbox-busy-container {\n      position: relative;\n    }\n  }\n\n  .neko-checkbox-inner-container {\n    margin-left: 6px;\n\n    .neko-label-container {\n      display: flex;\n      margin-top: 5px;\n\n      .neko-label {\n        display: block;\n        ","\n      }\n    }\n\n    .neko-content {\n      display: block;\n      font-size: var(--neko-font-size);\n      line-height: 28px;\n    }\n\n    .description {\n      display: block;\n      font-size: var(--neko-small-font-size);\n      margin-top: 1px;\n      line-height: 14px;\n      color: var(--neko-gray-60);\n\n      * {\n        font-size: var(--neko-small-font-size);\n        line-height: inherit;\n        margin: 0;\n      }\n    }\n  }\n\n  .neko-checkbox {\n    width: 22px;\n    height: 22px;\n    border: 2px solid var(--neko-input-border);\n    border-radius: 5px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    position: relative;\n\n    .neko-checked-mark {\n      position: absolute;\n      opacity: 0;\n      transition: opacity 0.2s ease-in-out;\n      transform: rotate(45deg);\n      transform-origin: center;\n      margin-top: -8%;\n      height: 45%;\n      width: 18%;\n      border-bottom: 2.5px solid white;\n      border-right: 2.5px solid white;\n    }\n\n    &.small {\n      width: 20px;\n      height: 20px;\n      border: 2px solid var(--neko-input-border);\n      border-radius: 8px;\n\n      .neko-checked-mark {\n        border-bottom-width: 1.5px;\n        border-right-width: 1.5px;\n      }\n    }\n\n    .neko-indeterminate-mark {\n      position: absolute;\n      opacity: 0;\n      transition: opacity 0.2s ease-in-out;\n      width: 50%;\n      border-bottom: 1.5px solid white;\n      border-right: 1.5px solid white;\n    }\n\n    &.disabled {\n      border: 1.5px solid var(--neko-disabled-color);\n      cursor: not-allowed;\n      filter: grayscale(1);\n    }\n  }\n\n  .neko-checked {\n    border: 2px solid var(--neko-main-color);\n\n    &.neko-checkbox {\n      background-color: var(--neko-main-color);\n\n      .neko-checked-mark {\n        opacity: 1;\n      }\n    }\n  }\n\n  .neko-indeterminate {\n    &.neko-checkbox {\n      background-color: var(--neko-main-color);\n\n      .neko-indeterminate-mark {\n        opacity: 1;\n      }\n    }\n  }\n\n  &:hover {\n    .neko-checkbox {\n      ","\n    }\n\n    ","\n    }\n  }\n"],m||(m=p.slice(0)),r=Object.freeze(Object.defineProperties(p,{raw:{value:Object.freeze(m)}}))),(function(e){var t=e.checked;return!e.disabled&&t?"color: var(--neko-main-color); font-weight: 600;":""}),(function(e){var t=e.checked;return!e.disabled&&t?"filter: brightness(1.1);":""}),(function(e){var t=e.checked;return e.disabled||t?"":"border-color: var(--neko-main-color);"})),y=function(e){var t=e.name,n=e.checked,r=void 0!==n&&n,o=e.indeterminate,a=void 0!==o&&o,s=e.onChange,l=e.label,p=e.description,m=e.isPro,y=void 0!==m&&m,v=e.disabled,b=e.requirePro,x=void 0!==b&&b,w=e.isBusy,k=void 0!==w&&w,S=e.small,O=void 0!==S&&S,_=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,f),E=x&&!y,C=v||E,A=(0,h.gR)("neko-checkbox",e.className,{disabled:C},{small:O}),j=(0,h.gR)("neko-checkbox",{disabled:C,"neko-checked":r,"neko-indeterminate":a,small:O}),P=(0,h.gR)("neko-checked-mark"),M=(0,h.gR)("neko-indeterminate-mark");return i().createElement(g,d({className:A,checked:r,disabled:C,onClick:function(e){return e.stopPropagation()}},_),i().createElement("div",{className:"neko-checkbox-container"},i().createElement("div",{className:"neko-content",onClick:function(n){C||(s?s(!r,t,n):console.log("The onChange handler is not set for the NekoCheckbox.",e))}},i().createElement("div",{className:"neko-checkbox-check-container"},k&&i().createElement("div",{className:"neko-checkbox-busy-container"},i().createElement("div",{className:j},i().createElement(u.X,{type:"circle",size:"16px"}))),!k&&i().createElement(i().Fragment,null,i().createElement("div",{className:j},i().createElement("div",{className:P}),i().createElement("div",{className:M})))),(l||E||p)&&i().createElement("div",{className:"neko-checkbox-inner-container"},i().createElement("span",{className:"neko-label-container"},i().createElement("span",{className:"neko-label"},l),i().createElement(c.K,{className:"inline",show:E,style:{position:"relative",top:-1}})),p?i().createElement("small",{className:"description"},p):null))))};y.propTypes={name:s().string,checked:s().bool,label:s().string,description:s().string,isPro:s().bool,requirePro:s().bool,isBusy:s().bool,small:s().bool}},4536:(e,t,n)=>{"use strict";n.d(t,{E:()=>h});var r,o,i,a=n(1594),s=n.n(a),l=n(6365),c=n.n(l),u=(0,n(3185).Ay)((function(e){var t=e.name,n=(e.max,e.isPro),r=void 0!==n&&n;return s().Children.map(e.children,(function(e){return e.props.name?e:s().cloneElement(e,{name:t,isPro:r})}))}))(r||(o=["\n"],i||(i=o.slice(0)),r=Object.freeze(Object.defineProperties(o,{raw:{value:Object.freeze(i)}})))),h=function(e){return s().createElement(u,e)};h.propTypes={name:c().string,max:c().number,isPro:c().bool}},8696:(e,t,n)=>{"use strict";n.d(t,{A:()=>b});var r,o=n(1594),i=n.n(o),a=n(6365),s=n.n(a),l=n(3185),c=n(8922),u=n(6897),h=["type","name","value","description","placeholder","onChange","onEnter","onBlur","onFinalChange","readOnly","step","min","max","maxLength","natural","onReset","isCommaSeparatedArray","className","style","inputStyle"];function f(){return f=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},f.apply(this,arguments)}function d(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 p,m,g=function(e){return e.split(",").map((function(e){return e.trim()})).filter((function(e){return e.length>0}))},y=function(e,t){var n,r,a=e.type,s=void 0===a?"text":a,l=e.name,p=e.value,m=void 0===p?"":p,y=e.description,v=e.placeholder,b=void 0===v?"":v,x=e.onChange,w=e.onEnter,k=e.onBlur,S=e.onFinalChange,O=e.readOnly,_=void 0!==O&&O,E=e.step,C=void 0===E?1:E,A=e.min,j=void 0===A?0:A,P=e.max,M=void 0===P?null:P,R=e.maxLength,T=e.natural,L=void 0!==T&&T,I=e.onReset,N=e.isCommaSeparatedArray,z=void 0!==N&&N,D=e.className,F=e.style,B=e.inputStyle,$=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,h),H=(n=(0,o.useState)(m||0===m?m:""),r=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(n,r)||function(e,t){if(e){if("string"==typeof e)return d(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)?d(e,t):void 0}}(n,r)||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.")}()),W=H[0],q=H[1],V=!!x,U=R||("number"===s?3:void 0);(0,o.useEffect)((function(){S&&(w||k)&&console.warn("NekoInput: Since onFinalChange is used, onEnter and onBlur are redundant.")}),[S,w,k]),(0,o.useEffect)((function(){var e;V||q(z?(e=m,Array.isArray(e)||(console.warn("The provided value is not an array. Falling back to an empty array."),e=[]),e.join(", ")):m)}),[m]);var K=function(e){var t=e.target.value,n=z?g(t):t;e.stopPropagation(),e.preventDefault(),V?x(n,l):q(t)},Q=function(e){if("Enter"===e.key){e.preventDefault();var t=e.target.value,n=z?g(t):t;S?S(n,l):w&&w(n,l)}},G=function(e){var t=e.target.value,n=z?g(t):t;(z?function(e,t){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(m,n):m===n)||(S?S(n,l):k&&k(n,l))},Y=(0,u.gR)("neko-input",{natural:L});return i().createElement("div",{className:D,style:F},i().createElement("div",{style:{position:"relative"}},"number"===s?i().createElement("input",f({ref:t,className:Y,name:l,value:V?m:W,type:s,disabled:_,step:C,min:j,max:M,maxLength:U,autoComplete:"off","data-form-type":"other",placeholder:b,style:B,onChange:K,onKeyPress:Q,onBlur:function(e){!function(e){var t=Number(e.target.value);j&&t<Number(j)?e.target.value=j:M&&t>Number(M)&&(e.target.value=M)}(e),G(e)},readOnly:_},$)):i().createElement("input",f({ref:t,className:Y},$,{name:l,value:V?m:W,type:s,disabled:_,spellCheck:"false",autoComplete:"off","data-form-type":"other",placeholder:b,style:B,maxLength:U,onChange:K,onKeyPress:Q,onBlur:G,readOnly:_},$)),!!m&&!!I&&i().createElement(c.z,{icon:"close",width:24,style:{position:"absolute",top:"3px",right:"3px"},variant:"blue",onClick:function(){return I()}})),y&&i().createElement("p",{className:"neko-input-description"},y))},v=(0,l.Ay)((0,o.forwardRef)(y))(r||(p=["\n  .neko-input {\n    font-family: var(--neko-font-family);\n    font-size: var(--neko-font-size);\n    border: 1.5px solid var(--neko-input-border);\n    box-sizing: border-box;\n    height: 30px;\n    background: var(--neko-input-background);\n    color: black;\n    padding: 0 10px;\n    width: 100%;\n    transition: background 0.3s ease;\n\n    &.natural {\n      border-color: gray;\n      border-width: 1px;\n    }\n\n    &:placeholder {\n      color: rgba(0, 0, 0, 0.25);\n    }\n\n    &:focus {\n      background-color: white;\n    }\n\n    &:read-only {\n      color: var(--neko-gray-60);\n    }\n\n    &:disabled {\n      color: var(--neko-gray-60);\n      background: var(--neko-gray-98);\n      border: none;\n      box-shadow: none;\n    }\n  }\n\n  .neko-input-description {\n    font-size: var(--neko-small-font-size);\n    color: var(--neko-gray-60);\n    line-height: 14px;\n    margin-top: 5px;\n    margin-bottom: 0;\n  }\n"],m||(m=p.slice(0)),r=Object.freeze(Object.defineProperties(p,{raw:{value:Object.freeze(m)}})))),b=i().forwardRef((function(e,t){return i().createElement(v,f({ref:t},e))}));b.propTypes={type:s().oneOf(["number","text"]),name:s().string,value:s().oneOfType([s().string,s().array]),description:s().string,placeholder:s().string,onChange:s().func,onEnter:s().func,onBlur:s().func,onFinalChange:s().func,readOnly:s().bool,step:s().number,min:s().number,max:s().number,maxLength:s().number,natural:s().bool,onReset:s().func,isCommaSeparatedArray:s().bool}},4677:(e,t,n)=>{"use strict";n.d(t,{j:()=>$,u:()=>B});var r,o,i,a,s,l,c,u=n(1594),h=n.n(u),f=n(6365),d=n.n(f),p=n(1329),m=n(6897),g=n(6087),y=n(5977),v=n(2027),b=n(6761),x=n(4555),w=n(6382),k=n(8922),S=n(8696),O=n(374),_=n(3185);function E(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var C=_.Ay.div(r||(r=E(["\n  border-radius: 8px;\n  user-select: none;\n  cursor: pointer;\n  transition: background 0.3s ease, color 0.3s ease;\n  color: black;\n\n  .neko-select-option-label {\n    overflow: hidden;\n    height: 100%;\n    display: flex;\n    align-items: center;\n  }\n\n  &.show-options {\n    border-radius: 8px 8px 0 0;\n  }\n\n  &[data-is-disabled=true], &.disabled {\n    cursor: none;\n    pointer-events: none;\n    color: var(--neko-gray-60);\n\n    .neko-select-option {\n      pointer-events: none;\n      background: var(--neko-gray-98);\n      border-color: var(--neko-gray-60);\n    }\n  }\n\n  &.neko-dropdown-up {\n    background: red !important;\n  }\n"]))),A=_.Ay.div(o||(o=E(["\n  align-items: center;\n  background-color: var(--neko-input-background);\n  border: 1.5px solid var(--neko-input-border);\n  border-radius: 8px;\n  display: flex;\n  font-size: var(--neko-font-size); \n  padding: 0 5px 0 10px;\n  box-sizing: border-box;\n  height: 30px;\n\n  &.isBusy {\n    padding-left: 5px;\n  }\n\n  .rightContent {\n    align-items: center;\n    display: flex;\n    margin-left: auto;\n  }\n"]))),j=_.Ay.div(i||(i=E(["\n  display: block;\n  margin-top: 5px;\n  font-size: var(--neko-small-font-size);\n  line-height: 14px;\n  color: var(--neko-gray-60);\n\n  * {\n    line-height: inherit;\n    margin: 0;\n  }\n"]))),P=_.Ay.div(a||(a=E(["\n  border-radius: 8px;\n  overflow: hidden;\n  position: absolute;\n  top: 0;\n  width: 100%;\n\n  &.hidden {\n    opacity: 0;\n  }\n\n  &.neko-dropdown-up {\n    margin-top: calc(-200% + 22px);\n  }\n"]))),M=_.Ay.div(s||(s=E(["\n  overflow-y: auto;\n  max-height: 300px;\n  background-color: var(--neko-main-color-alternative);\n\n  &.neko-select-filter-container {\n    background-color: var(--neko-main-color-alternative);\n    padding: 6px;\n    margin-top: 2px;\n    overflow: hidden;\n\n    div {\n      overflow: hidden;\n    }\n  }\n"]))),R=_.Ay.div(l||(l=E(["\n  margin-bottom: 0px;\n\n  input {\n    display: none;\n  }\n\n  label {\n    cursor: pointer;\n    display: flex;\n\n    svg {\n      flex-shrink: 0;\n    }\n  }\n\n  .inner-container {\n    margin-left: 4px;\n\n    .label {\n      display: block;\n      font-size: var(--neko-font-size);\n      line-height: 17px;\n      padding-top: 4.5px;\n      padding-bottom: 4px;\n    }\n\n    .description {\n      display: block;\n      font-size: var(--neko-small-font-size);\n    }\n  }\n\n  &.disabled {\n    color: var(--neko-disabled-color);\n\n    label {\n      cursor: default;\n    }\n  }\n"]))),T=_.Ay.div(c||(c=E(["\n  background-color: var(--neko-main-color-alternative);\n  cursor: pointer;\n  font-size: var(--neko-font-size); \n  padding: 6px 12px;\n\n  &:hover {\n    filter: brightness(80%);\n  }\n\n  input {\n    display: none;\n  }\n\n  .option {\n    align-items: center;\n    color: var(--neko-white);\n    display: flex;\n    justify-content: space-between;\n    font-size: var(--neko-font-size); \n    line-height: 17px;\n\n    .option-group {\n      align-items: center;\n      display: flex;\n    }\n  }\n\n  &.disabled {\n    background-color: rgb(224 156 54);\n    pointer-events: none;\n\n    .option {\n      color: rgb(255 255 255 / 35%);\n    }\n  }\n"]))),L=["name","description","scrolldown","isPro","onChange","isBusy","chevronIconSize","textFiltering","value","className","disabled","requirePro"];function I(){return I=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},I.apply(this,arguments)}function N(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,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return z(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)?z(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 z(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 D=function(e){var t,n=e.name,r=e.description,o=e.scrolldown,i=void 0!==o&&o,a=e.isPro,s=void 0!==a&&a,l=e.onChange,c=e.isBusy,f=void 0!==c&&c,d=e.chevronIconSize,v=void 0===d?24:d,b=e.textFiltering,_=e.value,E=e.className,R=e.disabled,T=(e.requirePro,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,L)),z=null===(t=h().Children.toArray(e.children).find((function(e){return e.props.value===_||e.props.checked})))||void 0===t?void 0:t.props,D=(null==z?void 0:z.label)||"Select",F=(null==z?void 0:z.description)||r,B=(null==z?void 0:z.requirePro)||!1,$=null==z?void 0:z.icon,H=null==z?void 0:z.iconSize,W=N((0,u.useState)(!1),2),q=W[0],V=W[1],U=N((0,u.useState)(""),2),K=U[0],Q=U[1],G=(0,u.useRef)(),Y=B&&!s,Z=function(t){if(t!==_){if(!l)return void console.log("The onChange handler it not set for this checkbox.",e);l(t,n)}i&&V(!1)},X=h().Children.map(e.children,(function(e){return e?h().cloneElement(e,{name:e.props.name||n,checked:e.props.value===_||e.props.checked,onClick:Z,scrolldown:i,isPro:s,disabled:R}):null})),J=(0,u.useMemo)((function(){if(!K||!X.length)return X;var e=K.toLowerCase();return h().Children.toArray(X).filter((function(t){var n=t.props.label.toLowerCase(),r=t.props.value.toLowerCase();return n.includes(e)||r.includes(e)}))}),[X,K]),ee=(0,m.gR)("neko-select",E,{"show-options":q,disabled:R||f}),te=(0,m.gR)("neko-select-options",{hidden:!q}),ne=(0,m.gR)("neko-select-option",{isBusy:f});return i?h().createElement(C,I({name:n},T,{onClick:function(){return V(!q)},className:ee,"data-is-disabled":R||f}),h().createElement(A,{className:ne,ref:G},f?h().createElement(h().Fragment,null,h().createElement(g.X,{type:"circle",size:"20px"})):h().createElement(h().Fragment,null,$&&h().createElement(k.z,{icon:$,width:H,height:H,style:{marginRight:"".concat(Math.max(H-15,4),"px")}}),h().createElement("span",{className:"neko-select-option-label"},D),h().createElement("div",{className:"rightContent"},Y&&h().createElement(p.K,null),h().createElement(y.In,{icon:q?w.A:x.A,width:v})))),F&&h().createElement(j,null,F),h().createElement(O.G,{visible:q,targetRef:G,onClose:function(){q&&V(!1)}},h().createElement(P,{className:te},b&&h().createElement(M,{className:"neko-select-filter-container"},h().createElement(S.A,{value:K,placeholder:"Search...",onChange:function(e){return Q(e)},onClick:function(e){return e.stopPropagation()},style:{background:"var(--neko-white)"},inputStyle:{margin:0,borderRadius:0},autoFocus:!0})),h().createElement(M,null,[J])))):X},F=function(e){var t=e.id,n=e.name,r=e.value,o=e.checked,i=void 0!==o&&o,a=e.label,s=e.description,l=e.onClick,c=e.scrolldown,u=void 0!==c&&c,f=e.isPro,d=void 0!==f&&f,g=e.optionDisabled,x=void 0!==g&&g,w=e.requirePro,S=void 0!==w&&w,O=e.icon,_=e.iconSize,E=void 0===_?20:_,C=S&&!d,A=(0,m.gR)({"neko-radio":!u},{"neko-select-option":u},e.className,{disabled:C||x}),P=h().createElement(R,{className:A,onClick:function(){return l(r,n)}},h().createElement("label",{htmlFor:t},h().createElement(y.In,{icon:i?b.A:v.A,width:"24px",color:C?"var(--neko-disabled-color)":i?"var(--neko-main-color)":"var(--neko-input-border)"}),h().createElement("div",{className:"inner-container"},h().createElement("span",{className:"label"},a,h().createElement(p.K,{className:"inline",style:{top:-1},show:C})),s&&h().createElement(j,{style:{marginTop:0}},s)))),M=h().createElement(T,{className:A,onClick:function(){return l(r,n)}},h().createElement("div",{className:"option"},h().createElement("div",{className:"option-group"},O&&h().createElement(k.z,{icon:O,width:E,height:E,style:{marginRight:"".concat(Math.max(E-11,4),"px")}}),a),h().createElement(p.K,{show:C})));return u?M:P},B=function(e){return h().createElement(D,e)};B.propTypes={name:d().string,description:d().string,scrolldown:d().bool,isPro:d().bool,onChange:d().func,isBusy:d().bool,chevronIconSize:d().number,textFiltering:d().bool};var $=function(e){return h().createElement(F,e)};$.propTypes={id:d().string,name:d().string,value:d().string,checked:d().bool,label:d().string,description:d().string,onClick:d().func,scrolldown:d().bool,isPro:d().bool,optionDisabled:d().bool,requirePro:d().bool,icon:d().string,iconSize:d().number}},8482:(e,t,n)=>{"use strict";n.d(t,{S:()=>m});var r,o=n(1594),i=n(6365),a=n.n(i),s=n(3185),l=n(6897),c=["width","height","fontSize","onLabel","offLabel","onBackgroundColor","offBackgroundColor","onValue","offValue","small","checked","onChange","disabled"];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 h(e){return"number"==typeof e?"".concat(e,"px"):e}var f,d,p=s.Ay.div(r||(f=["\n  color: var(--neko-white);\n  font-family: var(--neko-font-family);\n  font-size: ",";\n  position: relative;\n  display: inline-block;\n  width: ",";\n  height: ",";\n\n  &[data-is-disabled=disabled] {\n    opacity: 0.4;\n\n    .neko-slider {\n      cursor: auto;\n    }\n  }\n\n  input {\n    opacity: 0;\n    width: 0;\n    height: 0;\n    border: 0;\n  }\n\n  .neko-slider {\n    background-color: ",';\n    border-radius: 35px;\n    align-items: center;\n    cursor: pointer;\n    display: inline-flex;\n    position: absolute;\n    top: 0;\n    left: 0;\n    right: 0;\n    bottom: 0;\n    transition: .4s;\n    margin-bottom: -2px;\n  }\n\n  .neko-slider:before {\n    border-radius: 50%;\n    position: absolute;\n    content: "";\n    height: ',";\n    width: ",';\n    left: 4px;\n    bottom: 5px;\n    background-color: white;\n    transition: .3s;\n  }\n\n  .neko-slider:after {\n    content: "','";\n    margin-left: auto;\n    margin-right: ',";\n  }\n\n  &.neko-checked .neko-slider {\n    background-color: ",";\n  }\n\n  &.neko-checked .neko-slider:before {\n    transform: translateX(",');\n  }\n\n  &.neko-checked .neko-slider:after {\n    content: "','";\n    margin-left: ',";\n    margin-right: auto;\n  }\n"],d||(d=f.slice(0)),r=Object.freeze(Object.defineProperties(f,{raw:{value:Object.freeze(d)}}))),(function(e){return e.fontSize}),(function(e){return h(e.width)}),(function(e){return h(e.height)}),(function(e){return e.$offBackgroundColor||"var(--neko-disabled-color)"}),(function(e){return"calc(".concat(h(e.height)," - 8px)")}),(function(e){return"calc(".concat(h(e.height)," - 8px)")}),(function(e){return e.$offLabel}),(function(e){return"calc(".concat(h(e.height)," / 2)")}),(function(e){return e.$onBackgroundColor}),(function(e){return"calc(".concat(h(e.width)," - ").concat(h(e.height),")")}),(function(e){return e.$onLabel}),(function(e){return"calc(".concat(h(e.height)," / 2)")})),m=function(e){var t=e.width,n=void 0===t?40:t,r=e.height,i=void 0===r?24:r,a=e.fontSize,s=void 0===a?"13px":a,h=e.onLabel,f=void 0===h?"Yes":h,d=e.offLabel,m=void 0===d?"No":d,g=e.onBackgroundColor,y=void 0===g?"var(--neko-success)":g,v=e.offBackgroundColor,b=void 0===v?"var(--neko-disabled-color)":v,x=e.onValue,w=e.offValue,k=e.small,S=e.checked,O=void 0!==S&&S,_=e.onChange,E=e.disabled,C=void 0!==E&&E,A=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,c),j=(0,l.gR)("neko-switch",{small:k,"neko-checked":O}),P=(0,o.useCallback)((function(e){C||_(e?void 0===x||x:void 0!==w&&w)}),[x,w,_,C]);return k&&(i=20,s="11px"),React.createElement(p,u({className:j,width:n,height:i,fontSize:s},A,{$offBackgroundColor:b,$onBackgroundColor:y,$onLabel:f,$offLabel:m,"data-is-disabled":C?"disabled":""}),React.createElement("span",{className:"neko-slider",onClick:function(){return P(!O)}}))};m.propTypes={width:a().number,height:a().number,fontSize:a().string,onValue:a().string,offValue:a().string,checked:a().bool,onBackgroundColor:a().string,offBackgroundColor:a().string,onLabel:a().string,offLabel:a().string}},3896:(e,t,n)=>{"use strict";n.d(t,{m:()=>x});var r=n(1594),o=n.n(r),i=n(6365),a=n.n(i),s=n(3185),l=n(6897);function c(e){return c="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},c(e)}var u,h=["name","value","rows","description","placeholder","onEnter","onBlurForce","readOnly","avoidOnEnterWithShift","fullHeight","maxLength","className","style","textAreaStyle","countable","disabled","tabToSpaces"];function f(){return f=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},f.apply(this,arguments)}function d(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 p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(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"!=c(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:String(t)}(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)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function m(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,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return g(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)?g(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 g(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 y,v,b=(0,s.Ay)((function(e){var t,n=e.name,i=e.value,a=void 0===i?"":i,s=e.rows,c=void 0===s?6:s,u=e.description,d=e.placeholder,g=void 0===d?"":d,y=e.onEnter,v=void 0===y?null:y,b=e.onBlurForce,x=void 0!==b&&b,w=e.readOnly,k=void 0!==w&&w,S=e.avoidOnEnterWithShift,O=void 0!==S&&S,_=e.fullHeight,E=void 0!==_&&_,C=e.maxLength,A=void 0===C?null:C,j=e.className,P=e.style,M=e.textAreaStyle,R=void 0===M?{}:M,T=e.countable,L=void 0!==T&&T,I=e.disabled,N=e.tabToSpaces,z=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,h),D=m((0,r.useState)(a),2),F=D[0],B=D[1],$=m((0,r.useState)(0),2),H=$[0],W=$[1],q=m((0,r.useState)(!1),2),V=q[0],U=q[1],K=!!e.onChange,Q=(0,r.useRef)(null),G=(0,r.useCallback)((function(e){if(N&&"Tab"===e.key){e.preventDefault();var t=Q.current.selectionStart,n=Q.current.selectionEnd,r=Q.current.value;Q.current.value=r.substring(0,t)+"  "+r.substring(n),Q.current.selectionStart=Q.current.selectionEnd=t+2}else U(e.shiftKey)}),[]),Y=(0,r.useCallback)((function(){U(!1)}),[]);(0,r.useEffect)((function(){return document.addEventListener("keydown",G,!1),document.addEventListener("keyup",Y,!1),function(){document.removeEventListener("keydown",G,!1),document.removeEventListener("keyup",Y,!1)}}),[]),(0,r.useEffect)((function(){if(K||B(a),"words"===L){var e=a.split(" ").filter((function(e){return""!==e})).length;W(e)}else L&&W(a.length)}),[a,L,K]);var Z=(0,r.useCallback)((function(t){var r=A?t.target.value.substr(0,A):t.target.value;t.stopPropagation(),K?e.onChange(r,n):B(r,n)}),[A,K,e,n]),X=(0,l.gR)(j,{disabled:I});return o().createElement("div",{className:X,style:P},o().createElement("div",{className:"neko-textarea-container"},o().createElement("textarea",f({ref:Q,className:"neko-textarea",rows:c,disabled:I},z,{name:n,spellCheck:"false",placeholder:g,onChange:Z,onKeyPress:function(t){if(v&&!t.shiftKey&&"Enter"===t.key){if(O&&V)return;t.preventDefault(),e.onEnter(t.target.value,n)}},onBlur:function(t){(x||e.onBlur&&a!==t.target.value)&&e.onBlur(t.target.value,n)},readOnly:k,style:p(p({},R),{},{height:E?"100%":null!==(t=R.height)&&void 0!==t?t:void 0}),value:K?a:F})),o().createElement("div",{className:"neko-text-area-extra"},u&&o().createElement("div",{className:"neko-input-description"},u),L&&o().createElement("div",{className:"neko-textarea-count"},H,A?" / ".concat(A):""," ","words"===L?"words":"chars"))))}))(u||(y=["\n  .neko-textarea-container {\n    position: relative;\n    height: ","\n  }\n\n  .neko-textarea {\n    font-size: var(--neko-font-size);\n    border: 1.5px solid var(--neko-input-border);\n    box-sizing: border-box;\n    background: var(--neko-input-background);\n    color: black;\n    padding: 5px 10px;\n    width: 100%;\n\n    &::placeholder {\n      color: rgba(0, 0, 0, 0.25);\n    }\n\n    :focus {\n      background-color: white;\n      border-color: #2271b1;\n      box-shadow: 0 0 0 1px #2271b1;\n      outline: 2px solid transparent;\n    }\n\n    :read-only {\n      background-color: var(--neko-gray-60);\n      border: none;\n    }\n  }\n\n  .neko-text-area-extra {\n    display: flex;\n    justify-content: space-between;\n    color: var(--neko-gray-60);\n    font-size: var(--neko-small-font-size);\n    line-height: 14px;\n\n    .neko-textarea-count {\n      margin: 5px 0 0 10px;\n      text-align: right;\n      min-width: 130px;\n      display: block;\n    }\n  \n    .neko-input-description {\n      margin-top: 5px;\n      margin-bottom: 0;\n      flex: auto;\n      font-size: var(--neko-small-font-size);\n    }\n  }\n\n  &.disabled {\n    .neko-textarea {\n      border: 1.5px solid var(--neko-disabled-color);\n      cursor: not-allowed;\n      opacity: 0.35;\n    }\n  }\n"],v||(v=y.slice(0)),u=Object.freeze(Object.defineProperties(y,{raw:{value:Object.freeze(v)}}))),(function(e){return e.fullHeight?"100%":void 0})),x=function(e){return o().createElement(b,e)};x.propTypes={name:a().string,value:a().string,rows:a().number,description:a().string,placeholder:a().string,onChange:a().func,onEnter:a().func,onBlur:a().func,onBlurForce:a().bool,readOnly:a().bool,avoidOnEnterWithShift:a().bool,fullHeight:a().bool}},8135:(e,t,n)=>{"use strict";n.d(t,{YS:()=>T,z3:()=>P,IU:()=>A,F1:()=>_,Tb:()=>j,yy:()=>M,FE:()=>R});var r=n(1594),o=n.n(r);function i(e){return i="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},i(e)}function a(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,l(r.key),r)}}function s(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:String(t)}var c=s((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=r,this.message=t,this.code=n,this.body=o,this.debug=i,this.cancelledByUser="USER-ABORTED"===n}));function u(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,m(r.key),r)}}function h(e,t,n){return t=d(t),function(e,t){if(t&&("object"===S(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,f()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(f=function(){return!!e})()}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function m(e){var t=function(e,t){if("object"!=S(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==S(t)?t:String(t)}function g(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,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||w(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 y(){y=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",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,a=Object.create(i.prototype),s=new R(r||[]);return o(a,"_invoke",{value:A(e,n,s)}),a}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",d="suspendedYield",p="executing",m="completed",g={};function v(){}function b(){}function x(){}var w={};c(w,a,(function(){return this}));var k=Object.getPrototypeOf,O=k&&k(k(T([])));O&&O!==n&&r.call(O,a)&&(w=O);var _=x.prototype=v.prototype=Object.create(w);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(o,i,a,s){var l=h(e[o],e,i);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==S(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.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 A(t,n,r){var o=f;return function(i,a){if(o===p)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 s=r.delegate;if(s){var l=j(s,r);if(l){if(l===g)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===f)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=p;var c=h(t,n,r);if("normal"===c.type){if(o=r.done?m:d,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=m,r.method="throw",r.arg=c.arg)}}}function j(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,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=h(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;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,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}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 M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function T(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(S(t)+" is not iterable")}return b.prototype=x,o(_,"constructor",{value:x,configurable:!0}),o(x,"constructor",{value:b,configurable:!0}),b.displayName=c(x,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,c(e,l,"GeneratorFunction")),e.prototype=Object.create(_),e},t.awrap=function(e){return{__await:e}},E(C.prototype),c(C.prototype,s,(function(){return this})),t.AsyncIterator=C,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new C(u(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(_),c(_,l,"Generator"),c(_,a,(function(){return this})),c(_,"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=T,R.prototype={constructor:R,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(M),!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 s.type="throw",s.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],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)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,g):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),g},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),M(n),g}},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;M(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function v(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function b(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){v(i,r,o,a,s,"next",e)}function s(e){v(i,r,o,a,s,"throw",e)}a(void 0)}))}}function w(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}function S(e){return S="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},S(e)}var O=function(e){var t=[];return function(n,r){if("object"===S(r)&&null!==r){if(-1!==t.indexOf(r)){if(!e)throw console.warn("Circular reference found.",{key:n,value:r,cache:t,cacheIndex:t.indexOf(r)}),new Error("Circular reference found. Cancelled.");return}t.push(r)}return r}};function _(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,O(n),t)}var E=function(e){if(!e.data)return e;if(e.data.length>0&&e.data[0].meta){var t,n=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=w(e))){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(e.data);try{for(n.s();!(t=n.n()).done;){var r=t.value;try{r.meta=JSON.parse(r.meta)}catch(e){console.error("[JsonFetcher]","Could not decode meta.",r.meta)}}}catch(e){n.e(e)}finally{n.f()}}else if(e.data.meta)try{e.data.meta=JSON.parse(e.data.meta)}catch(e){console.error("[JsonFetcher]","Could not decode meta.",x.meta)}return e},C=function(){var e=b(y().mark((function e(t){var n,r,o,i,a,s,l,u,h,f=arguments;return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},r=null,o={},i=null,a=null,e.prev=5,(n=n||{}).headers=n.headers?n.headers:{},n.headers.Pragma="no-cache",n.headers["Cache-Control"]="no-cache",e.next=12,fetch("".concat(t),n);case 12:return a=e.sent,e.next=15,a.text();case 15:r=e.sent,(o=JSON.parse(r)).success||(s=!1===o.success?"NOT-SUCCESS":"N/A",l=o.message?o.message:"Unknown error. Check your Console Logs.","rest_no_route"===o.code?(l="The API can't be accessed. Are you sure the WP REST API is enabled? Check this article: https://meowapps.com/fix-wordpress-rest-api/.",s="NO-ROUTE"):"internal_server_error"===o.code&&(l="Server error. Please check your PHP Error Logs.",s="SERVER-ERROR"),i=new c(l,s,t,r||a)),e.next=27;break;case 20:e.prev=20,e.t0=e.catch(5),console.error("[nekoFetch]",e.t0),u="BROKEN-REPLY",h="The reply sent by the server is broken.","AbortError"===e.t0.name?(u="USER-ABORTED",h="The request was aborted by the user."):a&&a.status&&408===a.status&&(u="REQUEST-TIMEOUT",h="The request generated a timeout."),i=new c(h,u,t,r||a,e.t0);case 27:return i&&(o.success=!1,o.message=i.message,o.error=i),e.abrupt("return",E(o));case 29:case"end":return e.stop()}}),e,null,[[5,20]])})));return function(t){return e.apply(this,arguments)}}(),A=function(){var e=b(y().mark((function e(t){var n,r,o,i,a,s,l,c,u,h,f,d,p,m,v,b,x,w,k,S,O=arguments;return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(n=O.length>1&&void 0!==O[1]?O[1]:{}).json,o=void 0===r?null:r,i=n.method,a=void 0===i?"GET":i,s=n.signal,l=n.file,c=n.nonce,u=n.bearerToken,"GET"!==a||!o){e.next=4;break}throw new Error("NekoFetch: GET method does not support json argument (".concat(t,")."));case 4:if(h=l?new FormData:null,l)for(h.append("file",l),f=0,d=Object.entries(o);f<d.length;f++)p=g(d[f],2),m=p[0],v=p[1],h.append(m,v);return b={},c&&(b["X-WP-Nonce"]=c),u&&(b.Authorization="Bearer ".concat(u)),h||(b["Content-Type"]="application/json"),x={method:a,headers:b,body:h||(o?_(o):null),signal:s},w=null,e.prev=12,e.next=15,C(t,x);case 15:if((w=e.sent).success){e.next=18;break}throw new Error(null!==(k=null===(S=w)||void 0===S?void 0:S.message)&&void 0!==k?k:"Unknown error.");case 18:return e.abrupt("return",w);case 21:throw e.prev=21,e.t0=e.catch(12),e.t0;case 24:case"end":return e.stop()}}),e,null,[[12,21]])})));return function(t){return e.apply(this,arguments)}}(),j=function(){var e=b(y().mark((function e(t){var n,r,o,i,a,s,l,c,u,h,f,d,p,m,v=arguments;return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(n=v.length>1&&void 0!==v[1]?v[1]:{}).json,o=void 0===r?{}:r,i=n.signal,a=n.file,s=n.nonce,l=n.bearerToken,c=a?new FormData:null,a)for(c.append("file",a),u=0,h=Object.entries(o);u<h.length;u++)f=g(h[u],2),d=f[0],p=f[1],c.append(d,p);return m=s?{"X-WP-Nonce":s}:{},l&&(m.Authorization="Bearer ".concat(l)),c||(m["Content-Type"]="application/json"),e.abrupt("return",C(t,{method:"POST",headers:m,body:c||_(o),signal:i}));case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),P=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=t<0?0:t,r=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],o=e>0?Math.floor(Math.log(e)/Math.log(1024)):0;return"Bytes"===r[o]&&(o=1),(e=parseFloat((e/Math.pow(1024,o)).toFixed(n))).toFixed(Math.max(n,(e.toString().split(".")[1]||[]).length))+" "+r[o]};function M(e){return new Promise((function(t){return setTimeout(t,e)}))}var R=function(e){return o().createElement("span",{style:{display:"inline"},dangerouslySetInnerHTML:{__html:e}})},T=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=h(this,t,[e])).state={hasError:!1},n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(t,e),n=t,i=[{key:"getDerivedStateFromError",value:function(e){return{hasError:e}}}],(r=[{key:"render",value:function(){if(this.state.hasError){var e;return e="string"==typeof this.state.hasError?this.state.hasError:this.state.hasError.message?this.state.hasError.message:this.state.hasError.toString?this.state.hasError.toString():_(this.state.hasError),o().createElement(o().Fragment,null,o().createElement("div",{style:{background:"var(--neko-red)",color:"white",margin:15,padding:15,borderRadius:15}},o().createElement("pre",{style:{margin:0,whiteSpace:"pre-wrap"}},"⚠️ ",o().createElement("b",null,"Error"),o().createElement("br",null),"Sorry, an error occured! Don't worry, I will fix this, so simply let me know about it.",o().createElement("br",null),"Here is some information about it:",o().createElement("br",null),o().createElement("br",null),e)))}return this.props.children}}])&&u(n.prototype,r),i&&u(n,i),Object.defineProperty(n,"prototype",{writable:!1}),t}(o().Component)},6897:(e,t,n)=>{"use strict";n.d(t,{$$:()=>b,G8:()=>w,XS:()=>y,gR:()=>x,jz:()=>g,v_:()=>v});var r=n(1594),o=n(6815),i=n(8135),a=n(9794),s=n(9296);function l(e){return l="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},l(e)}function c(){c=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",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function h(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(e){h=function(e,t,n){return e[t]=n}}function f(e,t,n,r){var i=t&&t.prototype instanceof b?t:b,a=Object.create(i.prototype),s=new R(r||[]);return o(a,"_invoke",{value:A(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=f;var p="suspendedStart",m="suspendedYield",g="executing",y="completed",v={};function b(){}function x(){}function w(){}var k={};h(k,a,(function(){return this}));var S=Object.getPrototypeOf,O=S&&S(S(T([])));O&&O!==n&&r.call(O,a)&&(k=O);var _=w.prototype=b.prototype=Object.create(k);function E(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(o,i,a,s){var c=d(e[o],e,i);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==l(h)&&r.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(h).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,s)}))}s(c.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 A(t,n,r){var o=p;return function(i,a){if(o===g)throw new Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var l=j(s,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=g;var c=d(t,n,r);if("normal"===c.type){if(o=r.done?y:m,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function j(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,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=d(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}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 M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function T(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(l(t)+" is not iterable")}return x.prototype=w,o(_,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:x,configurable:!0}),x.displayName=h(w,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,h(e,u,"GeneratorFunction")),e.prototype=Object.create(_),e},t.awrap=function(e){return{__await:e}},E(C.prototype),h(C.prototype,s,(function(){return this})),t.AsyncIterator=C,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new C(f(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(_),h(_,u,"Generator"),h(_,a,(function(){return this})),h(_,"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=T,R.prototype={constructor:R,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(M),!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 s.type="throw",s.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],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)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,v):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),v},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),M(n),v}},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;M(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function u(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function h(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){u(i,r,o,a,s,"next",e)}function s(e){u(i,r,o,a,s,"throw",e)}a(void 0)}))}}function f(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=p(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function d(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,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||p(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 p(e,t){if(e){if("string"==typeof e)return m(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)?m(e,t):void 0}}function m(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 g=function(e,t){var n=(0,r.useRef)(),o=t?Array.isArray(t)?t:[t]:[n],i=function(t){if(e){var n,r=!1,i=f(o);try{for(i.s();!(n=i.n()).done;){var a=n.value;if(null!=a&&a.current&&a.current.contains(t.target)){r=!0;break}}}catch(e){i.e(e)}finally{i.f()}r||e()}};return(0,r.useEffect)((function(){return document.addEventListener("mousedown",i),function(){document.removeEventListener("mousedown",i)}})),n},y=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.i18n,n=void 0===t?null:t,l=e.onStop,u=void 0===l?function(){}:l,p=d((0,r.useState)(new o.A({concurrency:1,autoStart:!1})),2),m=p[0],g=p[1],y=d((0,r.useState)(new AbortController),2),v=y[0],b=y[1],x=(0,r.useRef)(!1),w=(0,r.useRef)(0),k=(0,r.useRef)(null),S=(0,r.useRef)(0),O=(0,r.useRef)(0),_=d((0,r.useState)(!1),2),E=_[0],C=_[1],A=d((0,r.useState)(null),2),j=A[0],P=A[1],M=d((0,r.useState)(!1),2),R=M[0],T=M[1],L=d((0,r.useState)(0),2),I=L[0],N=L[1],z=d((0,r.useState)(!1),2),D=z[0],F=z[1],B=d((0,r.useState)(!1),2),$=B[0],H=B[1],W=d((0,r.useState)(0),2),q=W[0],V=W[1],U=function(){var e=h(c().mark((function e(){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=new AbortController,b(t),F(!1),w.current=0,x.current=!1,T(!1),H(!1),V(0),N(0),g(new o.A({concurrency:1,autoStart:!1}));case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),K=function(){var e=h(c().mark((function e(t){var n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Promise(function(){var e=h(c().mark((function e(n,r){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return F(!1),S.current=0,O.current=0,w.current=0,x.current=!1,T(!1),H(!1),ne(t),P(!0),m.start(),e.next=13,m.onIdle();case 13:J(),n();case 15:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()),e.abrupt("return",n);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Q=(0,r.useCallback)(h(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:m.pause(),T(!0);case 3:case"end":return e.stop()}}),e)}))),[m]),G=(0,r.useCallback)(h(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:F(!1),T(!1),m.start();case 4:case"end":return e.stop()}}),e)}))),[m]),Y=(0,r.useCallback)(h(c().mark((function e(){var t,n=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=n.length>0&&void 0!==n[0]?n[0]:5,S.current=t,O.current=t,Z();case 4:case"end":return e.stop()}}),e)}))),[Z]),Z=(0,r.useCallback)(h(c().mark((function e(){var t,n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(F(!1),T(!1),!(O.current>0)){e.next=13;break}if(!(O.current<S.current)){e.next=12;break}return t=S.current-O.current,C(!0),n=5e3*t,e.next=11,(0,i.yy)(n);case 11:C(!1);case 12:O.current--;case 13:if(!k.current){e.next=16;break}return e.next=16,ee(k.current,!0);case 16:case"end":return e.stop()}}),e)}))),[ee]),X=(0,r.useCallback)(h(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:m.pause(),v.abort(),P(!1),F(!1),H(!1),u();case 7:case"end":return e.stop()}}),e)}))),[v,u,m]),J=function(){var e=h(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:H(!0),P(!1);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ee=(0,r.useCallback)(function(){var e=h(c().mark((function e(t){var n,r,o=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>1&&void 0!==o[1]&&o[1],e.prev=1,n&&(w.current--,V((function(e){return e-1}))),k.current=t,e.next=6,t(v.signal);case 6:if(!1!==(null==(r=e.sent)?void 0:r.success)){e.next=9;break}throw new Error(r.message);case 9:n&&(O.current=S.current,m.start()),e.next=28;break;case 12:if(e.prev=12,e.t0=e.catch(1),"AbortError"!==(null===e.t0||void 0===e.t0?void 0:e.t0.name)){e.next=19;break}return console.log("[useNekoTasks] Aborted"),e.abrupt("return");case 19:if(w.current++,x.current){e.next=28;break}if(Q(),!(O.current>0)){e.next=27;break}return Z(),e.abrupt("return");case 27:F(e.t0);case 28:return e.prev=28,V((function(e){return e+1})),e.finish(28);case 31:case"end":return e.stop()}}),e,null,[[1,12,28,31]])})));return function(t){return e.apply(this,arguments)}}(),[v.signal,Q,Z,m]),te=function(){var e=h(c().mark((function e(t){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:m.add(h(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",ee(t));case 1:case"end":return e.stop()}}),e)})))),N((function(e){return e+1}));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ne=function(){var e=h(c().mark((function e(t){var n,r,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:m.clear(),n=f(t);try{for(n.s();!(r=n.n()).done;)o=r.value,te(o)}catch(e){n.e(e)}finally{n.f()}V(0);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),re=(0,r.useCallback)((function(){x.current=!0}),[]),oe=(0,r.useCallback)((function(){return w.current}),[]),ie=(0,r.useMemo)((function(){return React.createElement(a.n,{isOpen:D,onRequestClose:X,title:n?n.COMMON.ERROR:"Error",content:React.createElement(React.Fragment,null,React.createElement("b",null,null!=D&&D.message?D.message:D||"Unknown error."),React.createElement("p",null)),customButtons:React.createElement("div",{style:{display:"flex",width:"100%",flexDirection:"column"}},React.createElement("div",{style:{display:"flex",alignItems:"center"}},React.createElement(s.M,{style:{flex:2},className:"primary",onClick:Z},n?n.COMMON.RETRY:"Retry"),React.createElement(s.M,{style:{flex:1},className:"secondary",onClick:function(){Y(10)}},React.createElement("small",null,n?n.COMMON.AUTO_RETRY:"Auto Retry")),React.createElement(s.M,{style:{flex:2},className:"primary",onClick:G},n?n.COMMON.SKIP:"Skip"),React.createElement(s.M,{style:{flex:1},className:"secondary",onClick:function(){re(),G()}},React.createElement("small",null,n?n.COMMON.AUTO_SKIP:"Auto Skip")),React.createElement(s.M,{style:{flex:2},className:"danger",onClick:X},n?n.COMMON.STOP:"Stop")),React.createElement("small",{style:{marginTop:10,lineHeight:"13px"}},n?n.COMMON.AUTO_RETRY_DESCRIPTION:"Auto Retry will retry the task 10 times."))})}),[Y,D,n,G,Z,re,X]);return{start:K,stop:X,pause:Q,resume:G,reset:U,retry:Z,autoRetry:Y,isSleeping:E,addTask:te,setAlwaysSkip:re,getErrorCount:oe,TasksErrorModal:ie,error:D,success:$,busy:j,paused:R,value:q,max:I}},v=function(){var e=d((0,r.useState)(!1),2),t=e[0],n=e[1],o=d((0,r.useState)(!1),2),i=o[0],a=o[1],s=(0,r.useCallback)((function(e){n(e.shiftKey),a(e.ctrlKey||e.metaKey)}),[]),l=(0,r.useCallback)((function(){n(!1),a(!1)}),[]);return(0,r.useEffect)((function(){return document.addEventListener("keydown",s,!1),document.addEventListener("keyup",l,!1),function(){document.removeEventListener("keydown",s,!1),document.removeEventListener("keyup",l,!1)}}),[]),{pressShift:t,pressControl:i}},b=function(e,t){var n=(0,r.useRef)();(0,r.useEffect)((function(){n.current=e}),[e]),(0,r.useEffect)((function(){if(null!==t){var e=setInterval((function(){n.current()}),t);return function(){return clearInterval(e)}}}),[t])},x=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,r.useMemo)((function(){var e=[];return t.forEach((function(t){"string"==typeof t?t.trim().split(" ").filter((function(e){return e.length>0})).forEach((function(t){return e.push(t)})):"object"===l(t)&&Object.keys(t).forEach((function(n){t[n]&&e.push(n)}))})),e.join(" ")}),[t])},w=function(e,t){var n=(0,r.useRef)(null);return(0,r.useEffect)((function(){return function(){n.current&&clearTimeout(n.current)}}),[]),(0,r.useCallback)((function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];n.current&&clearTimeout(n.current),n.current=setTimeout((function(){e.apply(void 0,o)}),t)}),[e,t])}},1329:(e,t,n)=>{"use strict";n.d(t,{K:()=>g});var r,o=n(1594),i=n.n(o),a=n(6365),s=n.n(a),l=n(3185),c=n(6897),u=["show","className"];function h(){return h=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},h.apply(this,arguments)}var f,d,p=l.Ay.a(r||(f=["\n  background-color: var(--neko-yellow);\n  position: relative;\n  border-radius: 10px;\n  color: white !important;\n  font-size: 9px;\n  line-height: 10px;\n  padding: 5px 8px;\n  text-transform: uppercase;\n  text-decoration: none;\n  white-space: nowrap;\n\n  &:hover {\n    filter: brightness(1.1);\n  }\n\n  &.inline {\n    display: inline;\n    margin-left: 5px;\n    vertical-align: middle;\n  }\n"],d||(d=f.slice(0)),r=Object.freeze(Object.defineProperties(f,{raw:{value:Object.freeze(d)}})))),m=function(e){var t=e.show,n=void 0===t||t,r=e.className,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,u),a=(0,c.gR)("neko-pro-only",r);return n?i().createElement(p,h({href:"https://meowapps.com",target:"_blank",className:a},o),"Pro Only"):null},g=function(e){return i().createElement(m,e)};g.propTypes={show:s().bool,className:s().string}},4461:(e,t,n)=>{"use strict";n.d(t,{z:()=>g});var r,o,i,a=n(1594),s=n.n(a),l=n(6365),c=n.n(l),u=n(3185),h=n(4977),f=n(2557),d=n(6897),p=u.Ay.div(r||(o=["\n  font-size: var(--neko-font-size);\n  margin-bottom: 15px;\n\n  .neko-block-header {\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n  }\n\n  .neko-block-title {\n    padding: 5px 10px;\n    margin-bottom: 5px;\n  }\n\n  .neko-block-content {\n    background: white;\n    color: var(--neko-font-color);\n    padding: 15px 15px;\n    box-shadow: 0px 8px 8px -8px rgba(0, 0, 0, 0.35);\n    border-radius: 8px;\n\n    p:first-child {\n      margin-top: 0;\n    }\n\n    p:last-child {\n      margin-bottom: 0;\n    }\n  }\n\n  &.primary {\n    padding: 8px;\n    background-color: var(--neko-main-color);\n    color: white;\n\n    .neko-block-title {\n      color: white;\n    }\n\n    .neko-block-content {\n      background-color: white;\n    }\n  }\n\n  &.standard {\n    .neko-block-content {\n      box-shadow: none;\n    }\n  }\n\n  &.raw {\n    padding: 8px;\n    background-color: var(--neko-main-color);\n    color: white;\n\n    .neko-block-title {\n      color: white;\n    }\n\n    .neko-block-content {\n      padding: 0;\n      background: none;\n    }\n\n    .neko-block-content {\n      box-shadow: none;\n    }\n  }\n"],i||(i=o.slice(0)),r=Object.freeze(Object.defineProperties(o,{raw:{value:Object.freeze(i)}})))),m=function(e){var t=e.title,n=e.children,r=e.className,o=void 0===r?"":r,i=e.busy,a=void 0!==i&&i,l=e.style,c=void 0===l?{}:l,u=e.contentStyle,m=void 0===u?{}:u,g=e.action,y=(0,d.gR)("neko-block",o);return s().createElement(p,{className:y,style:c},t&&s().createElement("div",{className:"neko-block-header"},s().createElement(h.s,{h2:!0,className:"neko-block-title"},t),!!g&&g),s().createElement(f.A,{busy:a},s().createElement("div",{className:"neko-block-content",style:m},n)))},g=function(e){return s().createElement(m,e)};g.propTypes={title:c().string,className:c().oneOf(["","primary","standard","raw"]),style:c().object,action:c().element}},8668:(e,t,n)=>{"use strict";n.d(t,{Y:()=>x,a:()=>b});var r,o,i,a,s=n(1594),l=n.n(s),c=n(6365),u=n.n(c),h=n(3185);function f(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,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(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)?d(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 d(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){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var m=h.Ay.div(r||(r=p(["\n  margin-bottom: 10px;\n"]))),g=h.Ay.div(o||(o=p(["\n  margin-bottom: 0px;\n  padding-bottom: 2px;\n  border-bottom: 2px solid #d1e3f2;\n  color: var(--neko-main-color);\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  cursor: pointer;\n  font-weight: 600;\n"]))),y=h.Ay.span(i||(i=p(["\n  border: solid var(--neko-main-color);\n  border-width: 0 2px 2px 0;\n  display: inline-block;\n  padding: 3px;\n  transform: ",";\n  transition: transform 0.15s ease-in-out;\n"])),(function(e){return e.$isCollapsed?"rotate(45deg)":"rotate(-135deg)"})),v=h.Ay.div(a||(a=p(["\n  max-height: ",";\n  overflow: hidden;\n  transition: ",";\n"])),(function(e){return e.$isCollapsed?"0":"".concat(e.$contentHeight+15,"px")}),(function(e){return e.$animate?"max-height 0.15s ease-in-out":"none"})),b=function(e){var t=e.children,n=e.keepState,r=f((0,s.useState)(n?JSON.parse(localStorage.getItem(n)):null),2),o=r[0],i=r[1];return(0,s.useEffect)((function(){n&&localStorage.setItem(n,JSON.stringify(o))}),[o,n]),l().createElement("div",null,l().Children.map(t,(function(e,t){return(null==e?void 0:e.type)===x?l().cloneElement(e,{isCollapsed:o!==t,onClick:function(){var e;i(o===(e=t)?null:e)},keepState:n?"".concat(n,"-").concat(t):e.props.keepState}):e})))};b.propTypes={children:u().node.isRequired,keepState:u().string};var x=function(e){var t,n,r=e.isCollapsed,o=void 0!==r&&r,i=e.children,a=e.onClick,c=void 0===a?function(){}:a,u=e.keepState,h=e.disabled,d=void 0!==h&&h,p=e.hide,b=void 0!==p&&p,x=e.title,w=e.style,k=f((0,s.useState)(o),2),S=k[0],O=k[1],_=f((0,s.useState)(!1),2),E=_[0],C=_[1],A=l().Children.count(i)>0,j=(0,s.useRef)(null),P=f((0,s.useState)(0),2),M=P[0],R=P[1];return t=j,n=function(){j.current&&R(j.current.scrollHeight)},(0,s.useEffect)((function(){var e=t.current;if(e){var r=new ResizeObserver((function(e){n()}));return r.observe(e),function(){return r.disconnect()}}}),[t,n]),(0,s.useEffect)((function(){if(u){var e=JSON.parse(localStorage.getItem(u));O(null!==e?e:o)}}),[u,o]),(0,s.useEffect)((function(){u&&localStorage.setItem(u,JSON.stringify(S))}),[S,u]),(0,s.useEffect)((function(){O(o)}),[o]),b?null:l().createElement(m,{style:w},l().createElement(g,{onClick:function(){A&&!d&&(C(!0),O(!S),c())},style:{opacity:d?.5:1,pointerEvents:d?"none":"auto"}},x,A&&l().createElement(y,{$isCollapsed:S})),l().createElement(v,{$isCollapsed:S,$contentHeight:M,$animate:E},l().createElement("div",{ref:j},i)))};x.propTypes={title:u().string.isRequired,isCollapsed:u().bool,children:u().node,onClick:u().func,keepState:u().string,disabled:u().bool,hide:u().bool}},1543:(e,t,n)=>{"use strict";n.d(t,{L:()=>m});var r,o,i=n(1594),a=n.n(i),s=n(6365),l=n.n(s),c=n(3185),u=n(6897);function h(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var f=c.Ay.div(r||(r=h(["\n  font-size: var(--neko-font-size);\n  font-family: var(--neko-font-family);\n  background-color: white;\n  color: var(--neko-font-color);\n  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.05);\n  margin-bottom: 25px;\n  display: flex;\n  flex-direction: column;\n\n  &.primary {\n    background-color: var(--neko-main-color);\n  }\n\n  p:first-child {\n    margin-top: 0px;\n  }\n\n  p:last-child {\n    margin-bottom: 0px;\n  }\n\n  .neko-container-content {\n    padding: 20px 20px;\n  }\n"]))),d=c.Ay.div(o||(o=h(["\n  justify-content: flex-start;\n  background-color: var(--neko-gray-98);\n  display: flex;\n  align-items: center;\n  padding: 8px 10px;\n\n  &.align-right {\n    justify-content: flex-end;\n  }\n"]))),p=function(e){var t=e.header,n=e.headerAlign,r=void 0===n?"left":n,o=e.footer,i=e.footerAlign,s=void 0===i?"right":i,l=e.className,c=e.style,h=void 0===c?{}:c,p=e.contentStyle,m=void 0===p?{}:p,g=e.children,y=(0,u.gR)("neko-container",l);return a().createElement(f,{className:y,style:h},t&&a().createElement(d,{className:"align-".concat(r)},t),a().createElement("div",{className:"neko-container-content",style:m},g),o&&a().createElement(a().Fragment,null,a().createElement("div",{style:{flex:"auto"}}),a().createElement(d,{className:"align-".concat(s)},o)))},m=function(e){return a().createElement(p,e)};m.propTypes={header:l().element,headerAlign:l().oneOf(["left","right"]),footer:l().element,footerAlign:l().oneOf(["left","right"]),className:l().string,style:l().object,contentStyle:l().object}},6913:(e,t,n)=>{"use strict";n.d(t,{z:()=>v});var r,o=n(1594),i=n.n(o),a=n(6365),s=n.n(a),l=n(3185),c=n(9296),u=n(6897);function h(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,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||f(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 f(e,t){if(e){if("string"==typeof e)return d(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)?d(e,t):void 0}}function d(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 p,m,g=l.Ay.div(r||(p=["\n  position: relative;\n  margin-left: -20px;\n  background: var(--neko-background-color);\n  padding-bottom: 50px;\n  margin-bottom: -26px;\n\n  .neko-rest-error {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    background: #1e232deb;\n    z-index: 100;\n\n    .container {\n      color: white;\n      padding: 5px 20px 15px 20px;\n      min-width: 480px;\n      max-width: 600px;\n      border-radius: 20px;\n      background: #883131;\n      margin-left: 50%;\n      transform: translateX(-50%);\n      margin-top: 100px;\n\n      h3 {\n        color: white;\n      }\n\n      .neko-debug {\n        padding: 5px 10px;\n        background: #692426;\n        border-radius: 10px;\n\n        * {\n          margin: 0px;\n          padding: 0px;\n        }\n      }\n    }\n  }\n"],m||(m=p.slice(0)),r=Object.freeze(Object.defineProperties(p,{raw:{value:Object.freeze(m)}})))),y=function(e){var t=e.className,n=e.children,r=e.nekoErrors,a=void 0===r?[]:r,s=e.style,l=void 0===s?{}:s,d=h((0,o.useState)(!1),2),p=d[0],m=d[1],y=h((0,o.useState)(!1),2),v=y[0],b=y[1],x=(0,u.gR)("neko-page",t);if(a&&!p){var w,k=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=f(e))){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(a);try{for(k.s();!(w=k.n()).done;){var S=w.value;if(S){m(S);break}}}catch(e){k.e(e)}finally{k.f()}}return i().createElement(g,{className:x,style:l},p&&i().createElement("div",{className:"neko-rest-error"},i().createElement("div",{className:"container"},!v&&i().createElement(i().Fragment,null,i().createElement("h3",null,"The Rest API is disabled or broken 😢"),i().createElement("p",null,"The Rest API is required for this plugin to work. It is enabled in WordPress by default since December 2016 and used by the Gutenberg Editor since 2019. In short, it allows more robustness and a much cleaner infrastructure. Soon, Wordpress will entirely depends on it, so it is important to keep it enabled."),i().createElement("p",null,i().createElement("i",null,"Last but not least: check your PHP Error Logs and your Debugging Console.")),i().createElement("p",{className:"neko-debug"},i().createElement("small",null,"URL: ",p.url,i().createElement("br",null),"CODE: ",p.code,i().createElement("br",null),"MESSAGE: ",p.message,i().createElement("br",null)))),p.body&&v&&i().createElement("p",{className:"neko-debug"},i().createElement("div",{dangerouslySetInnerHTML:{__html:p.body}})),p.body&&i().createElement(c.M,{color:"#a94242",onClick:function(){return b(!v)}},v?"Hide":"Display"," response from server"),i().createElement(c.M,{color:"#a94242",onClick:function(){window.open("https://meowapps.com/fix-wordpress-rest-api/","_blank")}},"Learn about WordPress Debugging"))),n)},v=function(e){return i().createElement(y,e)};v.propTypes={className:s().string,style:s().object,nekoErrors:s().bool}},7039:(e,t,n)=>{"use strict";n.d(t,{d:()=>m});var r,o=n(1594),i=n.n(o),a=n(6365),s=n.n(a),l=n(3185),c=n(6897),u=["title","contentAlign","titleStyle"];function h(){return h=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},h.apply(this,arguments)}var f,d,p=(0,l.Ay)((function(e){var t=e.title,n=void 0===t?"":t,r=e.contentAlign,o=void 0===r?"left":r,a=e.titleStyle,s=void 0===a?{}:a,l=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,u),f=(0,c.gR)("neko-settings",e.className);return i().createElement("div",h({className:f},l),n?i().createElement("div",{className:"neko-settings-head",style:s},n):null,i().createElement("div",{className:"neko-settings-content neko-settings-content-align-".concat(o)},e.children))}))(r||(f=["\n  display: flex;\n  font-family: var(--neko-font-family);\n\n  > .neko-settings-head {\n    font-family: var(--neko-font-family);\n    font-size: var(--neko-font-size); \n    line-height: 17px;\n    width: 120px;\n    margin-right: 16px;\n    font-weight: 500;\n    color: var(--neko-main-color);\n  }\n\n  /* Select, Checkbox, Input need to be a bit higher to be in front of the settings title */\n\n  .neko-settings-content > .neko-select:first-child {\n    position: relative;\n    margin-top: -5px;\n  }\n  \n  .neko-settings-content > div:first-child .neko-checkbox-container {\n    margin-top: -5px;\n  }\n\n  .neko-settings-content > .neko-button:first-child {\n    position: relative;\n    margin-top: -5px;\n  }\n\n  .neko-settings-content > div:first-child > .neko-input {\n    position: relative;\n    margin-top: -5px;\n  }\n\n  > .neko-settings-content {\n    flex: 1;\n\n    &.neko-settings-content-align-right {\n      flex: none;\n      margin-left: auto;\n    }\n\n    input[type=text] {\n      width: 100%;\n    }\n\n\n  }\n\n  & + div {\n    margin-top: 10px;\n  }\n"],d||(d=f.slice(0)),r=Object.freeze(Object.defineProperties(f,{raw:{value:Object.freeze(d)}})))),m=function(e){return i().createElement(p,e)};m.propTypes={title:s().string,className:s().string,contentAlign:s().string,titleStyle:s().object}},6734:(e,t,n)=>{"use strict";n.d(t,{g:()=>y});var r,o,i,a=n(1594),s=n.n(a),l=n(6365),c=n.n(l),u=n(3185),h=["height","tiny","small","medium","large","line","style","children"];function f(){return f=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},f.apply(this,arguments)}function d(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var p=u.Ay.div(r||(r=d(["\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  width: 100%;\n  height: ",";\n"])),(function(e){var t=e.height;return"".concat(t,"px")})),m=u.Ay.div(o||(o=d(["\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  width: 100%;\n\n  hr {\n    width: 100%;\n    border: none;\n    border-top: 1px solid var(--neko-secondary);\n  }\n"]))),g=u.Ay.span(i||(i=d(["\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  position: relative;\n  width: 100%;\n  text-align: center;\n\n  &::before,\n  &::after {\n    content: '';\n    flex-grow: 1;\n    border-top: ",";\n    height: 0;\n  }\n\n  &::before {\n    margin-right: 0.5em;\n  }\n\n  &::after {\n    margin-left: 0.5em;\n  }\n"])),(function(e){return e.line?"1px solid var(--neko-secondary)":"none"})),y=function(e){var t=e.height,n=void 0===t?null:t,r=e.tiny,o=void 0!==r&&r,i=e.small,a=void 0===i||i,l=e.medium,c=void 0!==l&&l,u=e.large,d=void 0!==u&&u,y=e.line,v=void 0!==y&&y,b=e.style,x=e.children,w=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,h);return n||(x||c?n=30:o?n=5:d?n=45:a&&(n=15)),s().createElement(p,f({height:n,style:b},w),x&&s().createElement(g,{line:v},x),!x&&s().createElement(m,null,v&&s().createElement("hr",null)))};y.propTypes={height:c().number,line:c().bool,tiny:c().bool,small:c().bool,medium:c().bool,large:c().bool,style:c().object}},4547:(e,t,n)=>{"use strict";n.d(t,{N:()=>b,Y:()=>x});var r,o,i=n(1594),a=n.n(i),s=n(6365),l=n.n(s),c=n(3185),u=n(6897),h=n(8135),f=["fullWidth","minimal"];function d(){return d=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},d.apply(this,arguments)}function p(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var m=c.Ay.div(r||(r=p(["\n  display: flex;\n  flex-wrap: wrap;\n"]))),g=c.Ay.div(o||(o=p(["\n  flex: 1;\n  padding: 32px 30px;\n\n  .neko-block:not(:first-child) {\n    margin-top: -20px;\n  }\n\n  .neko-block:last-child {\n    margin-bottom: 0px;\n  }\n\n  &.minimal {\n    padding: 0;\n  }\n\n  &.full {\n    flex-basis: 100%;\n    padding-bottom: 0;\n  }\n\n  & + .full {\n    padding-bottom: 32px;\n    padding-top: 0;\n  }\n\n  &:not(.full) + div:not(.full) {\n    padding-left: 0;\n  }\n"]))),y=function(e){return a().createElement(m,{className:"neko-wrapper"},e.children)},v=function(e){var t=e.fullWidth,n=e.minimal,r=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,f),o=(0,u.gR)("neko-column",{full:t},{minimal:n});return a().createElement(g,d({className:o},r),e.children)},b=function(e){return a().createElement(h.YS,null,a().createElement(y,e))},x=function(e){return a().createElement(h.YS,null,a().createElement(v,e))};b.propTypes={},x.propTypes={fullWidth:l().any}},374:(e,t,n)=>{"use strict";n.d(t,{G:()=>h});var r=n(1594),o=n(5206),i=n.n(o),a=n(6365),s=n.n(a),l=n(6897),c=n(2564);function u(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 h=function(e){var t,n,o=e.children,a=e.visible,s=void 0!==a&&a,h=e.targetRef,f=e.onClose,d=(0,r.useRef)(),p=(t=(0,r.useState)(0),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return u(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)?u(e,t):void 0}}(t,n)||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.")}()),m=p[0],g=p[1];(0,l.jz)((function(){s&&f()}),[h,d]),(0,r.useEffect)((function(){var e=document.createElement("div");return d.current=e,function(){d.current=null}}),[]);var y=function(){s&&d.current&&h.current&&requestAnimationFrame((function(){for(var e=h.current.getBoundingClientRect(),t=window.innerHeight,n=d.current.querySelector(".neko-portal-content");n&&!n.offsetHeight;)n=n.firstChild;var r=n?n.offsetHeight:0,o=t-e.bottom<r?e.top-r:e.bottom;Object.assign(d.current.style,{position:"fixed",top:"".concat(o,"px"),left:"".concat(e.left,"px"),width:"".concat(e.width,"px"),zIndex:"9999"})}))};if((0,r.useEffect)((function(){if(s&&d.current){document.body.appendChild(d.current);var e=setTimeout((function(){y(),g(1)}),5);return function(){return clearTimeout(e)}}if(d.current){var t=d.current.parentNode;t&&t.removeChild(d.current),g(0)}}),[s,d,h]),(0,r.useLayoutEffect)((function(){y();var e=function(){return y()};return window.addEventListener("resize",e),window.addEventListener("scroll",e),function(){window.removeEventListener("resize",e),window.removeEventListener("scroll",e)}}),[s,d,h]),!s||!d.current)return null;var v={opacity:m,transition:"opacity 0.2s cubic-bezier(0.22, 0.61, 0.36, 1)"};return i().createPortal(React.createElement("div",{className:"neko-portal-content",style:v},React.createElement(c.A,null,o)),d.current)};h.propTypes={children:s().node.isRequired,visible:s().bool,targetRef:s().object.isRequired,onClose:s().func}},197:(e,t,n)=>{"use strict";n.d(t,{X:()=>h});var r,o,i,a=n(1594),s=n.n(a),l=n(6365),c=n.n(l),u=n(3185).Ay.section(r||(o=["\n  .mask {\n    position: absolute;\n    overflow: hidden;\n    display: block;\n    width: ","px;\n    height: ","px;\n  }\n\n  .semi-circle {\n    position: relative;\n    display: block;\n    width: ","px;\n    height: ",'px;\n    background: linear-gradient(to right, #27b775 0%, #f3f32c 50%, #f71b1b 100%);\n    border-radius: 50% 50% 50% 50% / 100% 100% 0% 0% ;\n\n    &::before {\n      content: "";\n      position: absolute;\n      bottom: 0;\n      left: 50%;\n      z-index: 2;\n      display: block;\n      width: 140px;\n      height: 70px;\n      margin-left: -70px;\n      background: ',";\n      border-radius: 50% 50% 50% 50% / 100% 100% 0% 0% ;\n    }      \n  }\n\n  .semi-circle--mask {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: ","px;\n    height: ",'px;\n    background: transparent;\n    transform-origin: center center;\n    backface-visibility: hidden;\n    transition: all .3s ease-in-out;\n\n    &::before {\n      content: "";\n      position: absolute;\n      top: 0;\n      left: 0%;\n      z-index: 2;\n      display: block;\n      width: ',"px;\n      height: ","px;\n      margin-top: -1px;\n      margin-left: -1px;\n      background: #5396c1d6;\n      border-radius: 50% 50% 50% 50% / 100% 100% 0% 0% ;\n    }      \n  }\n\n  .gauge { \n    width: ","px;\n    height: ","px;\n    \n    .semi-circle--mask {\n      transform: rotate(","deg) translate3d(0,0,0);\n    }\n  }\n\n  .child-container {\n    position: absolute;\n    font-size: 16px;\n    display: flex;\n    width: ","px;\n    height: ","px;\n    z-index: 10;\n\n    .spacing {\n      flex: auto;\n    }\n\n    .child {\n      color: white;\n      flex: 1;\n      display: flex;\n      flex-direction: column;\n      align-items: center;\n    }\n  }\n"],i||(i=o.slice(0)),r=Object.freeze(Object.defineProperties(o,{raw:{value:Object.freeze(i)}}))),(function(e){return e.width}),(function(e){return e.width/2}),(function(e){return e.width}),(function(e){return e.width/2}),(function(e){return e.backgroundColor}),(function(e){return e.width}),(function(e){return e.width}),(function(e){return e.width+2}),(function(e){return e.width/2+2}),(function(e){return e.width}),(function(e){return e.width/2}),(function(e){return e.degrees}),(function(e){return e.width+2}),(function(e){return e.width/2})),h=function(e){var t=e.value,n=void 0===t?1e3:t,r=(e.min,e.max),o=void 0===r?2500:r,i=e.width,a=void 0===i?200:i,l=e.background,c=void 0===l?"#007cba":l,h=e.children,f=180*(n<=o?n:o)/o;return s().createElement(u,{className:"neko-gauge",backgroundColor:c,degrees:f,width:a},s().createElement("div",{class:"gauge"},s().createElement("div",{class:"mask"},s().createElement("div",{class:"semi-circle"}),s().createElement("div",{class:"semi-circle--mask"})),s().createElement("div",{class:"child-container"},s().createElement("div",{class:"child"},s().createElement("div",{class:"spacing"}),h))))};h.propTypes={value:c().number,min:c().number,max:c().number,width:c().number,background:c().string}},3804:(e,t,n)=>{"use strict";n.d(t,{n:()=>b});var r,o,i,a=n(1594),s=n.n(a),l=n(6365),c=n.n(l),u=n(3185),h=u.Ay.div(r||(o=["\n  display: flex;\n  max-width: 128px;\n  max-height: 128px;\n\n  & > * {\n    width: 100%;\n    height: auto;\n    object-fit: contain;\n  }\n"],i||(i=o.slice(0)),r=Object.freeze(Object.defineProperties(o,{raw:{value:Object.freeze(i)}})))),f=function(){return s().createElement(h,{className:"neko-logo"},s().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 1434 947"},s().createElement("path",{fill:"#000",d:"M805 777a792 792 0 0 1-262-43 811 811 0 0 1-286-164A959 959 0 0 1 6 200 158 158 0 0 1 304 97c41 96 94 175 159 233a497 497 0 0 0 376 129 60 60 0 0 1 67 60l27 186c4 33-18 63-51 68-6 0-34 4-77 4ZM122 168l2 5a841 841 0 0 0 212 307 692 692 0 0 0 469 177l-11-76a616 616 0 0 1-412-162 769 769 0 0 1-188-276 38 38 0 0 0-50-20c-18 7-27 27-22 45Z"}),s().createElement("path",{fill:"#FDA960",d:"m64 184 4 12a900 900 0 0 0 228 329 752 752 0 0 0 577 188l-27-194a563 563 0 0 1-423-144 709 709 0 0 1-174-255 98 98 0 0 0-185 64Z"}),s().createElement("mask",{id:"a",width:"814",height:"657",x:"60",y:"60",maskUnits:"userSpaceOnUse"},s().createElement("path",{fill:"#fff",d:"m64 184 4 12a900 900 0 0 0 228 329 752 752 0 0 0 577 188l-27-194a563 563 0 0 1-423-144 709 709 0 0 1-174-255 98 98 0 0 0-185 64Z"})),s().createElement("g",{mask:"url(#a)"},s().createElement("path",{fill:"#804625",d:"M120 532c-41 0-84-5-130-15l31-145c101 21 180 12 233-27 70-51 80-141 80-142l149 13a363 363 0 0 1-139 248 351 351 0 0 1-224 68Zm369 175c47-31 84-71 110-116 32-56 46-123 42-192-3-51-15-87-16-91l-141 48a225 225 0 0 1-15 161c-33 58-101 99-203 120l30 146c76-16 141-41 193-76ZM62 269c64-4 122-22 174-53A413 413 0 0 0 421-47L184-92v-1s-16 71-73 103C92 21 70 27 44 29 7 31-37 24-86 8l-74 229a623 623 0 0 0 222 32Z"})),s().createElement("path",{fill:"#000",d:"M1373 947h-110c-33 0-60-27-60-60v-97l-36 87a62 62 0 0 1-56 37h-79c-25 0-46-14-56-37l-36-87v97c0 33-27 60-60 60H769c-33 0-60-27-60-60V316c0-33 27-60 60-60h141c24 0 46 15 55 37l106 258 107-258c9-22 31-37 55-37h140c34 0 60 27 60 60v571c0 33-26 60-60 60Zm-316-188 14 34 15-34-11 1h-7l-11-1Zm199-314h7c21 0 40 11 50 28v-97h-40l-29 70 12-1Zm-427-69v97c11-17 29-28 51-28h6l13 1-29-70h-41Z"}),s().createElement("path",{fill:"#fff",d:"M769 887V316h141l158 384h7l158-384h140v571h-110V505h-7l-145 349h-79L886 505h-6v382H769Z"})))},d=function(e){return s().createElement(f,e)};d.propTypes={};var p,m=n(8922),g=n(9300),y=u.Ay.div(p||(p=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n  position: relative;\n  color: white;\n  font-family: var(--neko-font-family);\n  font-size: var(--neko-font-size);\n  display: flex;\n  height: 60px;\n  overflow: hidden;\n  align-items: center;\n  padding: 15px 32px;\n  background-color: var(--neko-main-color);\n  display: flex;\n\n  .neko-header-logo-container {\n    width: 40px;\n    height: 40px;\n    padding: 10px;\n    margin-right: 15px;\n    background: rgba(0, 0, 0, 0.1);\n    border-radius: 100%;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n  }\n\n  .neko-header-title-container {\n    flex-direction: column;\n    display: flex;\n\n    .neko-header-title {\n      color: white;\n      font-family: var(--neko-font-family);\n      font-size: 23px;\n      line-height: normal;\n      margin: 0;\n    }\n\n    .neko-header-subtitle {\n      color: white;\n      font-family: var(--neko-font-family);\n      line-height: normal;\n      font-size: var(--neko-font-size);\n    }\n  }\n\n  .neko-header-extra-content {\n    flex: 1;\n    margin: 0 20px;\n  }\n"]))),v=function(e){var t=e.title,n=void 0===t?"NekoUI":t,r=e.subtitle,o=void 0===r?"♥️ By Meow Apps":r,i=e.children,a=e.saving,l=void 0!==a&&a;return s().createElement(y,{className:"neko-header"},s().createElement("div",{className:"neko-header-logo-container"},s().createElement(d,null)),s().createElement("div",{className:"neko-header-title-container"},s().createElement("h1",{className:"neko-header-title"},n),s().createElement("small",{className:"neko-header-subtitle"},s().createElement("a",{target:"_blank",href:"https://meowapps.com",style:{color:"white",textDecoration:"none"}},o))),s().createElement("div",{className:"neko-header-extra-content"},i),l&&s().createElement(m.z,{icon:g.A,width:"36",height:"36"}))},b=function(e){return s().createElement(v,e)};b.propTypes={title:c().string,subtitle:c().string,saving:c().bool}},8922:(e,t,n)=>{"use strict";n.d(t,{z:()=>Re});var r=n(1594),o=n.n(r),i=n(6365),a=n.n(i),s=n(3185),l=n(5977),c=n(3271),u=n(5207),h=n(7326),f=n(5962),d=n(6029),p=n(5074),m=n(21),g=n(4555),y=n(6382),v=n(1299),b=n(8843),x=n(1086),w=n(4501),k=n(3594),S=n(8957),O=n(4142),_=n(7695),E=n(4300),C=n(1860),A=(n(6268),n(6982)),j=n(858),P=n(5241),M=n(2849),R=n(552),T=n(8841),L=n(1373),I=n(7073),N=n(4613),z=n(9538),D=n(7894),F=n(7297),B=n(9966),$=n(9829),H=n(1333),W=n(2477),q=n(9014),V=n(9077),U=n(257),K=n(757),Q=n(67),G=n(3860),Y=n(4753),Z=n(2079),X=n(9931),J=n(6200),ee=n(3102),te=n(6123),ne=n(6304),re=n(9057),oe=n(2693),ie=n(9728),ae=n(1097),se=n(4196),le=n(2600),ce=n(146),ue=n(4611);const he={duplicate:n(3104).A,lock:c.A,"lock-open":u.A,"file-undo":h.A,"chevron-double-left":f.A,"chevron-double-right":d.A,"chevron-left":p.A,"chevron-right":m.A,"chevron-down":g.A,"chevron-up":y.A,pause:v.A,play:b.A,replay:x.A,check:w.A,"check-circle":k.A,stop:S.A,delete:O.A,undo:_.A,alert:E.A,database:C.A,tools:A.A,cog:j.A,close:P.A,cat:M.A,upload:G.A,trash:R.A,pencil:T.A,dashboard:L.A,search:I.A,folder:N.A,"folder-open":z.A,"image-multiple-outline":D.A,plus:F.A,"folder-plus":B.A,"image-plus":$.A,"view-grid":H.A,"format-list-bulleted":W.A,twitter:q.A,instagram:V.A,facebook:U.A,star:K.A,"timer-outline":Q.A,link:Y.A,linkedin:Z.A,pinterest:X.A,"zoom-in":J.A,"info-outline":ee.A,"image-off-outline":te.A,"arrow-up":ne.A,"arrow-down":re.A,sort:oe.A,eye:ie.A,"rocket-launch":ae.A,"calendar-month":se.A,wand:le.A,mastodon:ce.A,filter:ue.A};var fe,de,pe=n(6897);function me(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 ge(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var ye=s.Ay.div(fe||(fe=ge(["\n  display: inline-block;\n  position: relative;\n"]))),ve=s.Ay.div(de||(de=ge(["\n  background-color: rgba(0, 0, 0, 0.8);\n  border-radius: 4px;\n  color: var(--neko-white);\n  font-family: var(--neko-font-family);\n  font-weight: normal;\n  font-size: var(--neko-font-size);\n  padding: 8px 12px;\n  position: absolute;\n  max-width: ","px;\n  width: max-content;\n  word-break: break-word;\n  opacity: ",';\n  transition: opacity 0.11s ease-in-out, transform 0.11s ease-in-out;\n  z-index: 100;\n  white-space: normal;\n  &:before {\n    content: "";\n    position: absolute;\n    border: 4px solid transparent;\n  }\n  ',"\n"])),(function(e){return e.maxWidth}),(function(e){return e.visible?1:0}),(function(e){var t="5px";switch(e.position){case"top":return"\n          bottom: 100%;\n          left: 50%;\n          transform: translateX(-50%) translateY(".concat(e.visible?"0":t,");\n          &:before {\n            top: 100%;\n            left: 50%;\n            margin-left: -4px;\n            border-top: 4px solid rgba(0, 0, 0, 0.8);\n          }\n        ");case"bottom":return"\n          top: 100%;\n          left: 50%;\n          transform: translateX(-50%) translateY(".concat(e.visible?"0":"-".concat(t),");\n          &:before {\n            bottom: 100%;\n            left: 50%;\n            margin-left: -4px;\n            border-bottom: 4px solid rgba(0, 0, 0, 0.8);\n          }\n        ");case"left":return"\n          top: 50%;\n          right: 100%;\n          transform: translateY(-50%) translateX(".concat(e.visible?"0":"-".concat(t),");\n          &:before {\n            top: 50%;\n            left: 100%;\n            margin-top: -4px;\n            border-left: 4px solid rgba(0, 0, 0, 0.8);\n          }\n        ");case"right":return"\n          top: 50%;\n          left: 100%;\n          transform: translateY(-50%) translateX(".concat(e.visible?"0":t,");\n          &:before {\n            top: 50%;\n            right: 100%;\n            margin-top: -4px;\n            border-right: 4px solid rgba(0, 0, 0, 0.8);\n          }\n        ");default:return""}})),be=function(e){var t,n,i=e.text,a=void 0===i?"Hello world!":i,s=e.position,l=void 0===s?"top":s,c=e.maxWidth,u=void 0===c?160:c,h=(t=(0,r.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return me(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)?me(e,t):void 0}}(t,n)||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.")}()),f=h[0],d=h[1],p=(0,pe.G8)((function(e){return d(e)}),100);return o().createElement(ye,{className:"neko-tooltip"},o().createElement(ve,{visible:f,position:l,maxWidth:u},a),o().createElement("div",{onMouseEnter:function(){return a&&p(!0)},onMouseLeave:function(){return p(!1)}},e.children))},xe=function(e){return o().createElement(be,e)};xe.propTypes={text:a().string,position:a().oneOf(["top","right","bottom","left"]),maxWidth:a().number};var we,ke,Se,Oe=["icon","color","spinning","className","tooltip","raw","isBusy","variant","title","containerStyle","hoverColor","disabled"];function _e(){return _e=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},_e.apply(this,arguments)}function Ee(e){return Ee="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},Ee(e)}function Ce(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Ae=s.Ay.div(we||(we=Ce(["\n  display: flex;\n  align-items: center;\n"]))),je=(0,s.Ay)(l.In)(ke||(ke=Ce(["\n  path {\n    fill: ",";\n  }\n\n  ","\n\n  &.neko-clickable {\n    cursor: pointer;\n  }\n\n  &.spin {\n    animation-name: spin;\n    animation-duration: 700ms;\n    animation-iteration-count: infinite;\n    animation-timing-function: linear;\n\n    @keyframes spin {\n      from {\n        transform: rotate(0deg);\n      }\n      to {\n        transform: rotate(360deg);\n      }\n    }\n  }\n\n  &.disabled {\n    pointer-events: none;\n    opacity: 0.35;\n    cursor: default;\n  }\n"])),(function(e){return e.color}),(function(e){return t=e.color,(n=e.hoverColor)?"\n      &:hover {\n        path {\n          fill: ".concat(n,";\n        }\n      }\n    "):t?"\n      &:hover {\n        path {\n          filter: brightness(1.03);\n        }\n      }\n    ":void 0;var t,n})),Pe=s.Ay.div(Se||(Se=Ce(["\n  width: 25px;\n  height: auto;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n\n  img {\n    width: auto !important;\n    height: 25px !important;\n  }\n"]))),Me={primary:{color:"var(--neko-blue)"},success:{color:"var(--neko-green)"},warning:{color:"var(--neko-yellow)"},danger:{color:"var(--neko-red)"}},Re=function(e){var t=e.icon,n=e.color,i=e.spinning,a=void 0!==i&&i,s=e.className,l=void 0===s?"":s,c=e.tooltip,u=e.raw,h=e.isBusy,f=void 0!==h&&h,d=e.variant,p=e.title,m=e.containerStyle,g=e.hoverColor,y=e.disabled,v=void 0!==y&&y,b=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,Oe),x=d&&Me[d]?Me[d].color:n,w=d&&Me[d]?Me[d].hoverColor:g;b.width||b.height||(b.width=b.height=30);var k=(0,r.useMemo)((function(){return"string"==typeof t&&he[t]?he[t]:t}),[t]),S=(0,r.useMemo)((function(){return!!he[t]||"object"===Ee(t)}),[t]),O=(0,pe.gR)("neko-icon",l,{"neko-clickable":!!b.onClick},{spin:a},{disabled:v});return c?o().createElement(xe,{text:c.text,position:c.position||"top"},o().createElement(Ae,{style:m},o().createElement(je,_e({icon:k,className:O,color:x,hoverColor:w},b)))):u?S?o().createElement(je,_e({icon:k,className:O,color:x,hoverColor:w},b)):o().createElement(Pe,null,k):f&&!v?o().createElement(Pe,null,o().createElement("img",{src:"/wp-includes/images/spinner-2x.gif",alt:"loading"})):o().createElement(Ae,{style:m,title:p},S&&o().createElement(je,_e({icon:k,className:O,color:x,hoverColor:w},b)),!S&&o().createElement(Pe,_e({className:O,color:x,hoverColor:w},b),k),c?o().createElement(xe,null,c):null)};Re.propTypes={icon:a().oneOfType([a().instanceOf(l.In),a().oneOf(["duplicate","lock","lock-open","file-undo","chevron-double-left","chevron-double-right","chevron-left","chevron-right","chevron-down","chevron-up","pause","play","replay","check","check-circle","stop","delete","undo","alert","database","tools","cog","close","cat","upload","trash","pencil","dashboard","search","folder","folder-open","image-multiple-outline","plus","folder-plus","image-plus","view-grid","format-list-bulleted","twitter","instagram","facebook","star","timer-outline","link","linkedin","pinterest","zoom-in","info-outline","image-off-outline","arrow-up","arrow-down","sort","eye","rocket-launch","calendar-month","wand","mastodon","filter"])]),color:a().string,spinning:a().bool,className:a().string,tooltip:a().string,raw:a().bool,isBusy:a().bool,variant:a().string}},1843:(e,t,n)=>{"use strict";n.d(t,{K:()=>v,o:()=>y});var r,o,i=n(1594),a=n.n(i),s=n(6365),l=n.n(s),c=n(3185),u=n(8922),h=n(6897);function f(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var d=c.Ay.div(r||(r=f(["\n  display: flex;\n  align-items: center;\n"]))),p=c.Ay.span(o||(o=f(['\n  color: var(--neko-main-color);\n  cursor: pointer;\n  font-family: var(--neko-font-family);\n  font-style: normal;\n  font-weight: normal;\n  line-height: 17px;\n\n  &:hover:not(.active) {\n    filter: brightness(1.2);\n  }\n\n  &.active {\n    cursor: default;\n    color: var(--neko-gray-30);\n    font-weight: bold;\n  }\n\n  &::after {\n    content: "|";\n    color: var(--neko-disabled-color);\n    font-weight: normal;\n    padding: 0 4px;\n  }\n\n  &:last-child::after {\n    content: none;\n  }\n\n  span {\n    color: var(--neko-disabled-color);\n    font-weight: normal;\n    margin-left: 4px;\n  }\n']))),m=function(e){var t=e.name,n=e.value,r=e.onChange,o=e.busy,i=void 0!==o&&o,s=e.className,l=(0,h.gR)("neko-quick-links",s),c=a().Children.toArray(e.children).filter((function(e){return!!e})).map((function(e){return a().cloneElement(e,{busy:i,isActive:e.props.value===n,onClick:function(e){e!==n&&r(e,t)}})}));return a().createElement(d,{className:l},c)},g=function(e){var t=e.title,n=e.value,r=void 0===n?0:n,o=e.count,i=e.onClick,s=e.busy,l=e.isActive,c=void 0!==l&&l,f=e.className,d=(0,h.gR)("neko-link",f,{active:c});return a().createElement(p,{onClick:function(){return i(r)},className:d},t,void 0===o?null:a().createElement("span",null,"(",s?a().createElement(u.z,{icon:"replay",spinning:!0,width:12,containerStyle:{display:"inline"}}):o,")"))},y=function(e){return a().createElement(m,e)};y.propTypes={name:l().string,value:l().string,onChange:l().func};var v=function(e){return a().createElement(g,e)};v.propTypes={title:l().string,value:l().string,count:l().number,onClick:l().func,isActive:l().bool}},7392:(e,t,n)=>{"use strict";n.d(t,{k:()=>v});var r=n(6365),o=n.n(r),i=n(4461),a=n(9296);function s(e){return s="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},s(e)}function l(){l=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",u=i.toStringTag||"@@toStringTag";function h(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(e){h=function(e,t,n){return e[t]=n}}function f(e,t,n,r){var i=t&&t.prototype instanceof b?t:b,a=Object.create(i.prototype),s=new R(r||[]);return o(a,"_invoke",{value:A(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=f;var p="suspendedStart",m="suspendedYield",g="executing",y="completed",v={};function b(){}function x(){}function w(){}var k={};h(k,a,(function(){return this}));var S=Object.getPrototypeOf,O=S&&S(S(T([])));O&&O!==n&&r.call(O,a)&&(k=O);var _=w.prototype=b.prototype=Object.create(k);function E(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(o,i,a,l){var c=d(e[o],e,i);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==s(h)&&r.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,a,l)}),(function(e){n("throw",e,a,l)})):t.resolve(h).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,l)}))}l(c.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 A(t,n,r){var o=p;return function(i,a){if(o===g)throw new Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var l=j(s,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=g;var c=d(t,n,r);if("normal"===c.type){if(o=r.done?y:m,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function j(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,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=d(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}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 M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function T(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(s(t)+" is not iterable")}return x.prototype=w,o(_,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:x,configurable:!0}),x.displayName=h(w,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,h(e,u,"GeneratorFunction")),e.prototype=Object.create(_),e},t.awrap=function(e){return{__await:e}},E(C.prototype),h(C.prototype,c,(function(){return this})),t.AsyncIterator=C,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new C(f(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(_),h(_,u,"Generator"),h(_,a,(function(){return this})),h(_,"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=T,R.prototype={constructor:R,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(M),!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 s.type="throw",s.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],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)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,v):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),v},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),M(n),v}},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;M(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function c(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function u(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){c(i,r,o,a,s,"next",e)}function s(e){c(i,r,o,a,s,"throw",e)}a(void 0)}))}}function h(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,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(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)?f(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 f(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 d=wp.element,p=d.useEffect,m=d.useRef,g=d.useState,y={marginTop:10,background:"rgb(0, 72, 88)",padding:10,color:"rgb(58, 212, 58)",maxHeight:400,minHeight:200,display:"block",fontFamily:"monospace",fontSize:12,whiteSpace:"pre",overflowX:"auto",borderRadius:10,textWrap:"balance"},v=function(e){var t=e.refreshQuery,n=e.clearQuery,r=e.onRefresh,o=void 0===r?null:r,s=e.onClear,c=void 0===s?null:s,f=e.i18n,d=e.refreshOnMount,v=void 0===d||d,b=e.scrollToBottom,x=void 0!==b&&b,w=e.blockMaxWidth,k=void 0===w?800:w,S=m(null),O=h(g(""),2),_=O[0],E=O[1],C=h(g(!1),2),A=C[0],j=C[1],P=function(){var e=u(l().mark((function e(){var n;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return j(!0),e.next=3,t();case 3:n=e.sent,o&&o(n),E(n),j(!1);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),M=function(){var e=u(l().mark((function e(){var t;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return j(!0),e.next=3,n();case 3:t=e.sent,c&&c(t),E(""),j(!1);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return p((function(){v&&P()}),[]),p((function(){x&&S.current&&S.current.scrollTo(0,S.current.scrollHeight)}),[_]),React.createElement(i.z,{title:f.COMMON.LOGS,busy:A,className:"primary",style:{maxWidth:k}},React.createElement(a.M,{onClick:function(){return P()}},f.COMMON.REFRESH_LOGS),React.createElement(a.M,{className:"danger",onClick:function(){return M()}},f.COMMON.CLEAR_LOGS),React.createElement("div",{style:y,ref:S},_))};v.propTypes={refreshQuery:o().func,clearQuery:o().func,onRefresh:o().func,onClear:o().func,i18n:o().object,refreshOnMount:o().bool,scrollToBottom:o().bool,blockMaxWidth:o().number}},7213:(e,t,n)=>{"use strict";n.d(t,{X:()=>g});var r,o=n(1594),i=n.n(o),a=n(6365),s=n.n(a),l=n(3185),c=n(6897),u=["variant","children"];function h(){return h=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},h.apply(this,arguments)}var f,d,p=l.Ay.div(r||(f=["\n  padding: 20px;\n  color: white;\n  border-radius: 5px;\n\n  &.danger {\n    background: #ba341e;\n  }\n\n  &.success {\n    background: var(--neko-green);\n  }\n\n  &.special {\n    background: var(--neko-purple);\n  }\n\n  &.warning {\n    background: var(--neko-orange);\n  }\n\n  &.info {\n    background: var(--neko-blue);\n  }\n\n  a {\n    color: white;\n    font-weight: bold;\n  }\n"],d||(d=f.slice(0)),r=Object.freeze(Object.defineProperties(f,{raw:{value:Object.freeze(d)}})))),m=function(e){var t=e.variant,n=e.children,r=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,u);t||(t="info");var o=(0,c.gR)("neko-message",{danger:"danger"===t},{success:"success"===t},{info:"info"===t},{warning:"warning"===t},{special:"special"===t});return i().createElement(p,h({className:o},r),n)},g=function(e){return i().createElement(m,e)};g.propTypes={variant:s().string,children:s().node}},520:(e,t,n)=>{"use strict";n.d(t,{Q:()=>b});var r,o=n(1594),i=n.n(o),a=n(6365),s=n.n(a),l=n(3185),c=n(5977),u=n(5962),h=n(5074),f=n(6029),d=n(21);function p(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 m,g,y=l.Ay.div(r||(m=["\n  align-items: center;\n  display: flex;\n  user-select: none;\n\n  .neko-paging-text {\n    font-family: var(--neko-font-family);\n    font-style: normal;\n    font-weight: normal;\n    font-size: 15px;\n    line-height: 14px;\n    margin-right: 15px;\n  }\n\n  .neko-paging-controller {\n    box-sizing: border-box;\n    height: 30px;\n    align-items: center;\n    background: var(--neko-main-color);\n    border-radius: 15px;\n    display: flex;\n    padding: 3px 5px;\n\n    .nako-paging-controller-icon {\n      background-color: white;\n      border-radius: 100%;\n      cursor: pointer;\n      margin-right: 2px;\n      height: 22px;\n      width: 22px;\n      transition: transform 0.1s ease-in;\n      box-sizing: border-box;\n\n      :last-child {\n        margin-right: 0;\n      }\n\n      &.disabled {\n        color: var(--neko-disabled-color);\n        cursor: default;\n        pointer-events: none;\n      }\n\n      &:hover {\n        transform: scale(1.2) !important;\n        z-index: 10;\n        position: relative;\n      }\n    }\n\n    .nako-paging-controller-text {\n      color: white;\n      font-family: var(--neko-font-family);\n      font-style: normal;\n      font-weight: normal;\n      font-size: var(--neko-font-size);\n      margin: 0 40px;\n      user-select: none;\n    }\n\n    span.neko-paging-current-page {\n      cursor: pointer;\n      text-decoration: underline;\n    }\n\n    input.neko-paging-current-page {\n      width: 1.5rem;\n    }\n  }\n"],g||(g=m.slice(0)),r=Object.freeze(Object.defineProperties(m,{raw:{value:Object.freeze(g)}})))),v=function(e){var t,n,r=e.currentPage,a=e.limit,s=void 0===a?0:a,l=e.onClick,m=e.total,g=void 0===m?0:m,v=e.onCurrentPageChanged,b=e.infinite,x=void 0!==b&&b,w=e.maxInfinite,k=void 0!==w&&w,S=e.controllerText,O=!!v,_=(0,o.useMemo)((function(){return x||k?0:Math.ceil(0===g?1:s>0?g/s:1)}),[x,k,s,g]),E="nako-paging-controller-icon ".concat(x||1!==r?"":"disabled"),C="nako-paging-controller-icon ".concat(x||k||r!==_?"":"disabled"),A=(t=(0,o.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return p(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)?p(e,t):void 0}}(t,n)||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.")}()),j=A[0],P=A[1],M=function(e){P(!1),l(e)},R=function(e){if(x)return e;var t=Number(e);return k?t<1?1:t:t>_?_:t<1?1:t},T=function(e){var t=e.target.value;isNaN(t)||v(R(t)),P(!1)},L=function(e){if("Enter"===event.key){e.preventDefault();var t=e.target.value;isNaN(t)||v(R(t)),P(!1)}},I=(0,o.useMemo)((function(){return j?i().createElement("input",{autoFocus:!0,type:"text",className:O?"neko-paging-current-page":"",defaultValue:r,onBlur:T,onKeyPress:L}):i().createElement("span",{className:O?"neko-paging-current-page":"",onClick:function(){O&&P(!0)}},r)}),[r,j,v]),N=function(e){j&&e.target===e.currentTarget&&P(!1)};return i().createElement(y,{className:"nako-paging"},!!g&&i().createElement("span",{className:"neko-paging-text"},g," result",g>0?"s":""),i().createElement("div",{className:"neko-paging-controller",onClick:N},!x&&!k&&i().createElement(c.In,{icon:u.A,className:E,onClick:function(){return M(1)}}),i().createElement(c.In,{icon:h.A,className:E,onClick:function(){return M(r-1)}}),i().createElement("p",{className:"nako-paging-controller-text",onClick:N},S||i().createElement(i().Fragment,null,"Page ",I," of ",_)),i().createElement(c.In,{icon:d.A,className:C,onClick:function(){return M(r+1)}}),!x&&!k&&i().createElement(c.In,{icon:f.A,className:C,onClick:function(){return M(_)}})))},b=function(e){return i().createElement(v,e)};b.propTypes={currentPage:s().number,limit:s().number,total:s().number,onClick:s().func,lastPage:s().number,infinite:s().bool,maxInfinite:s().bool,controllerText:s().object}},851:(e,t,n)=>{"use strict";n.d(t,{j:()=>w});var r,o,i=n(1594),a=n.n(i),s=n(6365),l=n.n(s),c=n(3185),u=n(5977),h=n(1299),f=n(8957),d=n(8843),p=n(6897),m=["value","max","busy","paused","status","className"];function g(e){return g="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},g(e)}function y(){return y=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},y.apply(this,arguments)}function v(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var b=(0,c.Ay)((function(e){var t=e.value,n=void 0===t?0:t,r=e.max,o=void 0===r?100:r,i=e.busy,s=void 0!==i&&i,l=e.paused,c=void 0!==l&&l,g=e.status,v=e.className,b=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,m);n=Math.min(n,o);var w=parseFloat(n)/parseFloat(o),k=(0,p.gR)("neko-progress",v);return a().createElement("div",y({className:k},b),a().createElement(x,{ratio:w,busy:e.busy,status:g}),a().createElement("div",{className:"neko-progress-buttons"},s&&e.onPauseClick&&a().createElement("div",{className:"neko-progress-button pause",onClick:e.onPauseClick},c?a().createElement(u.L3,{icon:d.A}):a().createElement(u.L3,{icon:h.A})),s&&e.onStopClick&&a().createElement("div",{className:"neko-progress-button stop",onClick:e.onStopClick},a().createElement(u.L3,{icon:f.A}))))}))(r||(r=v(["\n  position: relative;\n  box-sizing: border-box;\n  height: 30px;\n  background: linear-gradient(\n    180deg,\n    rgba(0, 0, 0, 0.06) 0%,\n    rgba(0, 0, 0, 0.02) 50%,\n    rgba(0, 0, 0, 0.10) 100%\n  );\n  border-radius: 12px;\n\n  .neko-progress-buttons {\n    position: absolute;\n    height: 100%;\n    right: 0px;\n    display: flex;\n    align-items: center;\n    padding-right: 5px;\n\n    .neko-progress-button {\n      border: none;\n      display: flex;\n      justify-content: center;\n      align-items: center;\n      margin-left: 2px;\n      border-radius: 100%;\n      color: white;\n      padding: 2px;\n      width: 18px;\n      height: 18px;\n      background-color: var(--neko-main-color);\n\n      &:hover {\n        background-color: var(--neko-lighten-blue);\n      }\n\n      &.stop {\n        background: var(--neko-red);\n\n        &:hover {\n          background-color: var(--neko-lighten-red);\n        }\n      }\n    }\n  }\n"]))),x=(0,c.Ay)((function(e){var t,n,r,o,i=isNaN(e.ratio)?0:parseInt(Math.round(100*e.ratio)),s=g(e.status),l=(0,p.gR)("neko-progress-current",e.className),c="undefined"!==s?"string"===s?e.status:e.status(i):"".concat(i,"%");return a().createElement("div",{className:l,style:(t={minWidth:28},n="minWidth",r=i+"%",o=function(e,t){if("object"!=g(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=g(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(n),(n="symbol"==g(o)?o:String(o))in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t)},a().createElement("div",null,c))}))(o||(o=v(["\n  box-sizing: border-box;\n  position: absolute;\n  overflow: hidden;\n  top: 0; left: 0;\n  height: 100%;\n  background-color: var(--neko-main-color);\n  border-radius: 12px;\n  text-align: center;\n  padding: 0 10px;\n  vertical-align: middle;\n  color: white;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  transition: min-width .2s ease-out;\n  background-size: 30px 30px;\n  background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%,\n                    transparent 25%,\n                    transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,\n                    transparent 75%, transparent);\n  animation: ",";\n\n  @keyframes animate-stripes {\n    0% { background-position: 0 0; }\n    100% { background-position: 60px 0; }\n  }\n"])),(function(e){return e.busy?"animate-stripes 1.6s linear infinite":"none"})),w=function(e){return a().createElement(b,e)};w.propTypes={value:l().number,max:l().number,busy:l().bool,paused:l().bool,onPauseClick:l().func,onStopClick:l().func,status:l().oneOf([l().string,l().func])}},6087:(e,t,n)=>{"use strict";n.d(t,{X:()=>b});var r,o=n(1594),i=n.n(o),a=n(6365),s=n.n(a),l=n(3185),c=n(6897),u=["className","size"],h=["type"];function f(){return f=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},f.apply(this,arguments)}function d(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 p,m,g=l.Ay.div(r||(p=["\n  width: ",";\n  padding-top: ",";\n  position: relative;\n  margin: 0 auto;\n\n  .double-bounce1, .double-bounce2 {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    background-color: ",";\n    opacity: 0.6;\n    position: absolute;\n    top: 0;\n    left: 0;\n\n    -webkit-animation: sk-bounce 2.0s infinite ease-in-out;\n    animation: sk-bounce 2.0s infinite ease-in-out;\n  }\n\n  .double-bounce2 {\n    -webkit-animation-delay: -1.0s;\n    animation-delay: -1.0s;\n  }\n\n  @-webkit-keyframes sk-bounce {\n    0%, 100% { -webkit-transform: scale(0.0) }\n    50% { -webkit-transform: scale(1.0) }\n  }\n\n  @keyframes sk-bounce {\n    0%, 100% {\n      transform: scale(0.0);\n      -webkit-transform: scale(0.0);\n    } 50% {\n      transform: scale(1.0);\n      -webkit-transform: scale(1.0);\n    }\n  }\n"],m||(m=p.slice(0)),r=Object.freeze(Object.defineProperties(p,{raw:{value:Object.freeze(m)}}))),(function(e){return e.size||"50%"}),(function(e){return e.size||"50%"}),(function(e){return e.color||"#333"})),y=function(e){e.className;var t=e.size,n=d(e,u),r=(0,c.gR)("neko-spinner",n.className);return i().createElement(g,f({className:r,size:t},n),i().createElement("div",{className:"double-bounce1"}),i().createElement("div",{className:"double-bounce2"}))},v=function(e){var t=e.type,n=void 0===t?"circle":t,r=d(e,h);return"circle"===n?i().createElement(y,r):null},b=function(e){return i().createElement(v,e)};b.propTypes={type:s().string}},4977:(e,t,n)=>{"use strict";n.d(t,{s:()=>I});var r=n(1594),o=n.n(r),i=n(6365),a=n.n(i),s=n(3185),l=n(6897);function c(e){return c="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},c(e)}var u,h,f,d,p,m,g,y,v,b=["children","style","className","bold","h1","h2","h3","h4","h5","h6","p","span","label"];function x(){return x=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},x.apply(this,arguments)}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 k(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"!=c(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:String(t)}(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 S(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var O="\n  font-family: var(--neko-font-family);\n  font-weight: normal;\n  line-height: normal;\n  margin-top: 0;\n  margin-bottom: 16px;\n  padding: 0;\n",_=s.Ay.h1(u||(u=S(["\n  ","\n  font-size: var(--neko-h1-font-size);\n"])),O),E=s.Ay.h2(h||(h=S(["\n  ","\n  font-size: var(--neko-h2-font-size);\n"])),O),C=s.Ay.h3(f||(f=S(["\n  ","\n  font-size: var(--neko-h3-font-size);\n"])),O),A=s.Ay.h4(d||(d=S(["\n  ","\n  font-size: var(--neko-h4-font-size);\n"])),O),j=s.Ay.h5(p||(p=S(["\n  ","\n  font-size: var(--neko-h5-font-size);\n"])),O),P=s.Ay.h6(m||(m=S(["\n  ","\n  font-size: var(--neko-h6-font-size);\n"])),O),M=s.Ay.p(g||(g=S(["\n  font-family: var(--neko-font-family);\n  font-size: var(--neko-font-size);\n  line-height: normal;\n  margin: 16px 0 24px;\n  padding: 0;\n"]))),R=s.Ay.span(y||(y=S(["\n  font-family: var(--neko-font-family);\n  font-size: var(--neko-font-size);\n  line-height: normal;\n  margin: 0;\n  padding: 0;\n"]))),T=s.Ay.label(v||(v=S(["\n  font-family: var(--neko-font-family);\n  font-size: var(--neko-font-size);\n  line-height: normal;\n  margin: 0;\n  padding: 0;\n"]))),L=function(e){var t=e.children,n=void 0===t?null:t,r=e.style,i=void 0===r?{}:r,a=e.className,s=void 0===a?"":a,c=e.bold,u=void 0!==c&&c,h=e.h1,f=e.h2,d=e.h3,p=e.h4,m=e.h5,g=e.h6,y=e.p,v=(e.span,e.label),w=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,b),S=u?{fontWeight:"bold"}:{},O=(0,l.gR)("neko-typo",s,{"neko-typo-h1":h},{"neko-typo-h2":f},{"neko-typo-h3":d},{"neko-typo-h4":p},{"neko-typo-h5":m},{"neko-typo-h6":g},{"neko-typo-p":y},{"neko-typo-label":v});return h?o().createElement(_,x({style:k(k({},S),i),className:O},w),n):f?o().createElement(E,x({style:k(k({},S),i),className:O},w),n):d?o().createElement(C,x({style:k(k({},S),i),className:O},w),n):p?o().createElement(A,x({style:k(k({},S),i),className:O},w),n):m?o().createElement(j,x({style:k(k({},S),i),className:O},w),n):g?o().createElement(P,x({style:k(k({},S),i),className:O},w),n):y?o().createElement(M,x({style:k(k({},S),i),className:O},w),n):v?o().createElement(T,x({style:k(k({},S),i),className:O},w),n):o().createElement(R,x({style:k(k({},S),i),className:O},w),n)},I=function(e){return o().createElement(L,e)};I.propTypes={h1:a().any,h2:a().any,h3:a().any,h4:a().any,h5:a().any,h6:a().any,p:a().any,span:a().any,label:a().any,bold:a().bool,style:a().object,className:a().string,children:a().node}},209:(e,t,n)=>{"use strict";n.d(t,{Z:()=>_});var r=n(1594),o=n.n(r),i=n(6365),a=n.n(i),s=n(3185),l=n(8135),c=n(2557),u=n(6897);function h(e){return h="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},h(e)}var f,d=["onSuccess","onFailure","apiUrl","onSelectFiles","apiConfig","className","disabled","children","multiple","accept"];function p(){return p=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},p.apply(this,arguments)}function m(e){return function(e){if(Array.isArray(e))return w(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||x(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 g(){g=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",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var i=t&&t.prototype instanceof b?t:b,a=Object.create(i.prototype),s=new R(r||[]);return o(a,"_invoke",{value:A(e,n,s)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",y="completed",v={};function b(){}function x(){}function w(){}var k={};c(k,a,(function(){return this}));var S=Object.getPrototypeOf,O=S&&S(S(T([])));O&&O!==n&&r.call(O,a)&&(k=O);var _=w.prototype=b.prototype=Object.create(k);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(o,i,a,s){var l=f(e[o],e,i);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==h(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.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 A(t,n,r){var o=d;return function(i,a){if(o===m)throw new Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var l=j(s,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=m;var c=f(t,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function j(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,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}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 M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function T(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(h(t)+" is not iterable")}return x.prototype=w,o(_,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:x,configurable:!0}),x.displayName=c(w,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,c(e,l,"GeneratorFunction")),e.prototype=Object.create(_),e},t.awrap=function(e){return{__await:e}},E(C.prototype),c(C.prototype,s,(function(){return this})),t.AsyncIterator=C,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new C(u(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(_),c(_,l,"Generator"),c(_,a,(function(){return this})),c(_,"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=T,R.prototype={constructor:R,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(M),!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 s.type="throw",s.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],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)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,v):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),v},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),M(n),v}},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;M(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function y(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function v(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){y(i,r,o,a,s,"next",e)}function s(e){y(i,r,o,a,s,"throw",e)}a(void 0)}))}}function b(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,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||x(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 x(e,t){if(e){if("string"==typeof e)return w(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)?w(e,t):void 0}}function w(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 k,S,O=s.Ay.div(f||(k=["\n  &.dropping {\n    background: #a4d5ff;\n  }\n"],S||(S=k.slice(0)),f=Object.freeze(Object.defineProperties(k,{raw:{value:Object.freeze(S)}})))),_=(0,r.forwardRef)((function(e,t){var n=e.onSuccess,i=void 0===n?function(){}:n,a=e.onFailure,s=void 0===a?function(){}:a,h=e.apiUrl,f=e.onSelectFiles,y=void 0===f?function(){}:f,x=e.apiConfig,w=e.className,k=e.disabled,S=void 0!==k&&k,_=e.children,E=e.multiple,C=(e.accept,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,d)),A=b((0,r.useState)(!1),2),j=A[0],P=A[1],M=b((0,r.useState)(!1),2),R=M[0],T=M[1],L=h,I=(0,r.useCallback)(function(){var e=v(g().mark((function e(t){var n,r,o,a;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return T(!0),n=function(){var e=v(g().mark((function e(t){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return x.file=t,e.next=3,(0,l.Tb)(h,x);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),e.next=4,Promise.all(t.map(function(){var e=v(g().mark((function e(t){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 4:r=e.sent,o=r.filter((function(e){return e.success})),a=r.filter((function(e){return!e.success})),o.length&&i(E?o:o[0]),a.length&&s(E?a:a[0]),T(!1);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[h,E,x,i,s]),N=(0,r.useCallback)((function(e,t){t.preventDefault(),t.stopPropagation(),P(!1),L?I(e):y(e)}),[L,I]),z=(0,r.useCallback)((function(e){e.preventDefault(),e.stopPropagation()}),[]),D=(0,r.useCallback)((function(e){e.preventDefault(),e.stopPropagation(),S||P(!0)}),[S]),F=(0,r.useCallback)((function(e){e.preventDefault(),e.stopPropagation(),S||P(!1)}),[S]),B=(0,r.useCallback)((function(e){if(!S){var t=m(e.dataTransfer.files);e.target.value=null,N(t,e)}}),[S,N]),$=(0,r.useCallback)((function(e){var t=m(e.target.files);e.target.value=null,N(t,e)}),[N]),H=(0,u.gR)("neko-upload-drop-area",w,{dropping:j});return o().createElement(c.A,{busy:R},o().createElement("input",{type:"file",accept:".csv, .json, .jsonl, .txt",ref:t,onChange:$,style:{display:"none"},multiple:E,disabled:S}),o().createElement(O,p({className:H,onDragOver:z,onDragEnter:D,onDragLeave:F,onDrop:B},C),_))}));_.propTypes={ref:a().ref,onSuccess:a().func,onFailure:a().func,onSelectFiles:a().func,apiUrl:a().string,apiConfig:a().object,disabled:a().bool}},9794:(e,t,n)=>{"use strict";n.d(t,{n:()=>O});var r,o,i=n(1594),a=n.n(i),s=n(6365),l=n.n(s),c=n(8187),u=n.n(c),h=n(3185),f=n(9296),d=n(6897),p=["className","style","title","content","contentWidth","customButtons","okOnEnter","thumbnail","okButton","cancelButton","isOpen","children","customButtonsPosition","fullSize"],m=["label"],g=["label"];function y(){return y=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},y.apply(this,arguments)}function v(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}function b(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var x=(0,h.DU)(r||(r=b(["\n  .ReactModal__Overlay {\n    z-index: 9999;\n    display: flex;\n    justify-content: center;\n    flex-direction: column;\n    align-items: center;\n    backdrop-filter: blur(2px);\n    background-color: rgba(0, 0, 0, 0.35) !important;\n    opacity: 0;\n    transition: opacity 200ms ease-in-out;\n  }\n  .ReactModal__Overlay--after-open {\n    opacity: 1;\n  }\n  .ReactModal__Overlay--before-close {\n    opacity: 0;\n  }\n  .ReactModal__Overlay .neko-modal {\n    opacity: 0;\n    transform: scale(0.85);\n    transition: all 200ms ease-in-out;\n  }\n  .ReactModal__Overlay--after-open .neko-modal {\n    transform: scale(1);\n    opacity: 1;\n  }\n  .ReactModal__Overlay--before-close .neko-modal {\n    transform: scale(0.85);\n    opacity: 0;\n  }\n  .neko-modal {\n    background: white;\n    color: var(--neko-font-color);\n    position: relative;\n    box-shadow: 0 1px 2px rgba(0,0,0,0.07), \n                0 2px 4px rgba(0,0,0,0.07), \n                0 4px 8px rgba(0,0,0,0.07), \n                0 8px 16px rgba(0,0,0,0.07),\n                0 16px 32px rgba(0,0,0,0.07), \n                0 32px 64px rgba(0,0,0,0.07);\n    outline: none;\n    padding: 15px;\n    max-width: 1200px;\n    border-radius: 5px;\n    display: flex;\n    flex-direction: column;\n  }\n  .neko-modal.full-size {\n    margin-top: 32px;\n    width: 90vw;\n    height: 85vh;\n    max-width: none;\n    max-height: none;\n  }\n"]))),w=h.Ay.div(o||(o=b(["\n  width: ",";\n  flex: 1;\n  display: flex;\n  flex-direction: column;\n\n  p {\n    margin: 0;\n  }\n  .title {\n    font-family: var(--neko-font-family);\n    font-style: normal;\n    font-weight: bold;\n    font-size: 18px;\n    line-height: 22px;\n    margin-bottom: 15px;\n  }\n  .content-container {\n    display: flex;\n    position: relative;\n    z-index: 1;\n    flex: 1;\n    overflow-y: clip;\n\n    .thumbnail {\n      margin-right: 15px;\n      width: 240px;\n      overflow: hidden;\n\n      img {\n        width: 100%;\n        height: 100%;\n        object-fit: cover;\n      }\n    }\n    .content {\n      flex: auto;\n      font-family: var(--neko-font-family);\n      font-style: normal;\n      font-weight: normal;\n      font-size: var(--neko-font-size);\n      line-height: 14px;\n      width: 100%;\n      margin: 0px !important;\n      padding: 0px !important;\n    }\n  }\n  .button-group {\n    align-items: center;\n    display: flex;\n    justify-content: flex-end;\n    margin-top: 15px;\n    font-size: inherit;\n    white-space: normal;\n  }\n"])),(function(e){var t;return e.fullSize?"100%":null!==(t=e.width)&&void 0!==t?t:"518px"})),k=["disabled","ok","okOnClick","okDisabled","cancel","cancelOnClick","cancelDisabled"],S=function(e){var t=e.className,n=e.style,r=e.title,o=void 0===r?"":r,s=e.content,l=void 0===s?"":s,c=e.contentWidth,h=e.customButtons,b=void 0===h?null:h,S=e.okOnEnter,O=void 0!==S&&S,_=e.thumbnail,E=e.okButton,C=void 0===E?{}:E,A=e.cancelButton,j=void 0===A?{}:A,P=e.isOpen,M=e.children,R=e.customButtonsPosition,T=void 0===R?"right":R,L=e.fullSize,I=void 0!==L&&L,N=v(e,p),z=null!==b,D=(0,d.gR)("neko-modal",t,{"custom-modal":n,"full-size":I}),F=C.label,B=void 0===F?"OK":F,$=v(C,m),H=j.label,W=void 0===H?"Cancel":H,q=v(j,g);(0,i.useEffect)((function(){var t=[];k.forEach((function(n){void 0!==e[n]&&t.push(n)})),t.length>0&&console.warn("[Deprecated] NekoUI: The button attributes, ".concat(t.join(", "),', are deprecated in the NekoModal. Please use an object attribute like this: okButton={{ label: “OK", onClick, disabled }} cancelButton={{ label: “OK", onClick, disabled }}\''),{props:e})}),[e]);var V=(0,i.useRef)(null),U=((0,i.useCallback)((function(){return V.current}),[]),(0,i.useCallback)((function(e){"Enter"===e.key&&$.onClick()}),[$.onClick]));(0,i.useEffect)((function(){if(O&&P)return window.addEventListener("keyup",U),function(){window.removeEventListener("keyup",U)}}),[O,P,U]);var K=M||a().createElement(w,{width:c,fullSize:I},o&&a().createElement("p",{className:"title"},o),a().createElement("div",{className:"content-container"},_&&a().createElement("div",{className:"thumbnail"},_),l&&a().createElement("p",{className:"content"},l)),a().createElement("div",{className:"button-group ".concat(t)},z&&"left"===T&&b,q.onClick&&a().createElement(f.M,y({className:"danger"},q),W),$.onClick&&a().createElement(f.M,$,B),z&&"right"===T&&b));return a().createElement(a().Fragment,null,a().createElement(x,null),a().createElement(u(),y({ariaHideApp:!1,closeTimeoutMS:200,className:D,isOpen:P},N),K))},O=function(e){return a().createElement(S,e)};O.propTypes={className:l().string,style:l().object,title:l().string,content:l().string,contentWidth:l().string,customButtons:l().object,okOnEnter:l().bool,thumbnail:l().element,okButton:l().object,cancelButton:l().object,fullSize:l().bool}},5900:(e,t,n)=>{"use strict";n.d(t,{o:()=>W});var r=n(1594),o=n.n(r),i=n(6365),a=n.n(i),s=n(3185),l=n(5977),c=n(4555),u=n(6382),h=n(2557),f=n(5263),d=n(6897);function p(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return m(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)?m(e,t):void 0}}(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 m(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 g,y=n(8922),v=n(374),b=n(4536),x=n(4677),w=n(9296),k=n(6734),S=n(8696);function O(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,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||_(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 _(e,t){if(e){if("string"==typeof e)return E(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)?E(e,t):void 0}}function E(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 C,A,j,P=s.Ay.div(g||(C=["\n  min-width: 160px;\n  padding: 8px;\n  border-radius: 8px;\n  overflow: hidden;\n  background: var(--neko-main-color-alternative);\n  color: white;\n  \n  .neko-context-content {\n    max-height: 202px;\n    overflow-y: auto;\n  }\n\n  .neko-checkbox {\n    margin-bottom: 5px;\n\n    &:last-child {\n      margin-bottom: 0;\n    }\n  }\n\n  .neko-radio:last-child {\n    margin-bottom: 0;\n  }\n\n  svg {\n    color: var(--neko-disabled-color);\n\n    &.neko-active {\n      color: white;\n    }\n  }\n"],A||(A=C.slice(0)),g=Object.freeze(Object.defineProperties(C,{raw:{value:Object.freeze(A)}})))),M=function(e){var t=e.accessor,n=e.options,o=e.type,i=void 0===o?"checkbox":o,a=e.onChange,s=e.description,l=e.filters,c=O((0,r.useState)(!1),2),u=c[0],h=c[1],d=O((0,r.useState)(""),2),p=d[0],m=d[1],g=O((0,r.useState)(""),2),C=g[0],A=g[1],j=(0,r.useRef)(null),M=(0,r.useRef)(null),R=l&&l.length>0||p.length>0,T="checkbox"===i,L="select"===i,I="text"===i,N=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;void 0!==e&&e!==p&&m((function(){return e})),C!==p&&(a(t,C),m(C))};return(0,r.useEffect)((function(){N(),u&&setTimeout((function(){M.current&&M.current.focus()}),10)}),[u]),React.createElement(React.Fragment,null,React.createElement("div",{ref:j},React.createElement(y.z,{icon:"filter",className:R?"neko-active":"",onClick:function(){return h(!u)},width:16,height:16})),React.createElement(v.G,{visible:u,targetRef:j,onClose:function(){return h(!1)}},React.createElement(P,null,React.createElement("div",{className:"neko-context-menu"},!!s&&React.createElement("p",{style:{marginTop:0,marginBottom:5}},s),React.createElement("div",{className:"neko-context-content"},T&&React.createElement(b.E,{name:"neko-context-menu-checkboxes"},n.map((function(e){return React.createElement(f.R,{small:!0,key:e.value,label:e.label,checked:null==l?void 0:l.includes(e.value),onChange:function(n){if(l)return a(t,n?[].concat(function(e){if(Array.isArray(e))return E(e)}(r=l)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||_(r)||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.")}(),[e.value]):l.filter((function(t){return t!=e.value})));var r;console.error("[NekoUI] filters needs to be set for the NekoTable.",{accessor:t,option:e.value})}})}))),L&&React.createElement(x.u,{name:"neko-context-menu-select",onChange:function(e){return a(t,e)}},n.map((function(e){return React.createElement(x.j,{id:e.value,key:e.value,label:e.label,value:e.value,checked:l===e.value})})))),I&&React.createElement(S.A,{ref:M,name:"neko-context-menu-text",value:C,onChange:function(e){return A(e)},onEnter:function(e){N(e),h(!1)}}),React.createElement(k.g,{tiny:!0}),React.createElement("div",{className:"neko-context-menu-bottom-actions"},React.createElement(w.M,{fullWidth:!0,disabled:!R,onClick:function(){a(t,T?[]:null),A(""),h(!1),m("")}},"Reset"))))))};function R(e){return R="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},R(e)}function T(){return T=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},T.apply(this,arguments)}function L(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 I(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?L(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"!=R(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=R(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==R(t)?t:String(t)}(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)):L(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}M.propTypes={accessor:a().string,options:a().array,type:a().oneOf(["checkbox","select","text"]),onChange:a().func,filters:a().oneOfType([a().string,a().array])};var N=s.Ay.table(j||(j=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n  font-family: var(--neko-font-family);\n  border-spacing: 0;\n  width: 100%;\n  word-break: break-all;\n\n  th, td {\n    margin: 0;\n    padding: 5px;\n    border-bottom: 1px solid rgba(0, 0, 0, 0.05);\n    border-right: 1px solid rgba(0, 0, 0, 0.05);\n    height: 1px;\n\n    a {\n      text-decoration: none;\n    }\n  }\n\n  th:last-child, td:last-child {\n    border-right: 0;\n  }\n\n  th, tfoot td {\n    height: 30px;\n    background-color: var(--neko-main-color);\n    color: var(--neko-white);\n    font-style: normal;\n    font-weight: normal;\n    font-size: var(--neko-font-size);\n    line-height: 16px;\n    text-align: left;\n\n    div {\n      display: flex;\n      align-items: center;\n      justify-content: space-between;\n\n      &.neko-column-action {\n        cursor: pointer;\n\n        svg {\n          color: rgba(255, 255, 255, 0.5);\n        }\n\n        svg.neko-active {\n          color: white;\n        }\n      }\n    }\n  }\n\n  &.neko-table-raw {\n    th, td {\n      border: 0;\n\n      .neko-column-action {\n\n        > svg {\n          color: black;\n          opacity: 0.5;\n        }\n\n        > svg.neko-active {\n          opacity: 1;\n        }\n      }\n    }\n  }\n\n  &.neko-table-raw {\n    th {\n      font-weight: bold;\n    }\n    th, tfoot td {\n      background-color: white;\n      color: var(--neko-font-color);\n    }\n  }\n\n  tbody {\n    background-color: white;\n    color: var(--neko-font-color);\n    \n    tr:nth-child(even) {\n        background-color: var(--neko-gray-98);\n    }\n\n    tr.selected, tr.selected:nth-child(even) {\n        background-color: var(--neko-main-color);\n        filter: brightness(1.2);\n        color: white;\n\n        a {\n          color: #81e8ff;\n        }\n    }\n    \n    img {\n      vertical-align: bottom;\n    }\n}\n\n  &.neko-table-raw {\n\n    svg {\n      &.neko-active {\n        color: var(--neko-main-color) !important;\n        opacity: 1;\n      }\n    }\n\n    tbody {\n      tr {\n        &.selected, &.selected :nth-child(even) {\n          background-color: white;\n          color: var(--neko-black);\n        }\n      }\n    }\n  }\n\n  tfoot tr:last-child {\n    td {\n      border-bottom: 0;\n    }\n  }\n\n  .table-checkbox-cell {\n    width: 23px;\n    text-align: center;\n\n    svg {\n      padding: 5px;\n      cursor: pointer;\n    }\n  }\n\n  &.neko-row-selectable {\n    tbody tr {\n      cursor: pointer;\n    }\n  }\n"]))),z=function(e){var t=e.checked,n=e.indeterminate,r=e.onSelect,i=void 0===r?function(){}:r,a=e.onUnselect,s=void 0===a?function(){}:a,l=e.isBusy,c=void 0!==l&&l;return o().createElement(f.R,{small:!0,onChange:function(e,t,n){return e?i(n):s(n)},checked:t,indeterminate:n,isBusy:t&&c,disabled:c})},D={left:"start",center:"center",right:"end"},F=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={};return e.align&&(n={textAlign:e.align,justifyContent:D[e.align]}),t&&e.verticalAlign&&(n=I(I({},n),{},{verticalAlign:e.verticalAlign})),e.width&&(n=I(I({},n),{},{width:e.width})),e.style&&(n=I(I({},n),e.style)),n},B=function(e){return!0===e?"#edf8ff":e},$=function(e,t){console.log("[NekoUI] Missing implementation for onFilterChange.",{filter:e,value:t})},H=function(e){var t=e.data,n=void 0===t?[]:t,i=e.selectedItems,a=void 0===i?[]:i,s=e.selectedRow,f=e.filters,m=e.onFilterChange,g=void 0===m?$:m,y=e.columns,v=void 0===y?[]:y,b=e.busy,x=void 0!==b&&b,w=e.onSelect,k=e.onSelectRow,S=e.selectOnRowClick,O=void 0===S||S,_=e.onUnselect,E=e.onSortChange,C=void 0===E?function(){}:E,A=e.variant,j=void 0===A?"default":A,P=e.alternateRowColor,R=void 0!==P&&P,L=e.sort,D=e.emptyMessage,H=void 0===D?"Empty.":D,W=v.length+(w?1:0);n.some((function(e){return void 0===e.id}))&&(console.warn('Table data is missing the "id" field. Using the index as id instead, and disabling the row selection.'),n.forEach((function(e,t){e.id||(e.disabled_row=!0,e.id=-t)})));var q,V,U,K,Q,G,Y,Z,X=function(e){return e?{backgroundColor:B(e)}:{}}(R),J=n.map((function(e){var t=v.map((function(t){return{value:e[t.accessor],style:F(t,!0)}}));return{id:e.id,disabled_row:null==e?void 0:e.disabled_row,isBusy:e.isBusy||!1,cells:t}})),ee=(q={list:n.map((function(e){return{id:e.id}})),selectedList:a,callback:w},V=q.list,U=q.selectedList,K=q.callback,G=void 0===(Q=q.key)?"id":Q,Y=(0,d.v_)().pressShift,Z=(0,r.useMemo)((function(){if(!Y||!U.length)return null;var e=U[U.length-1];return V.findIndex((function(t){return t[G]===e}))}),[G,V,Y,U]),{onSelect:(0,r.useCallback)((function(e){if(K)if(null!==Z){var t=e[0],n=V.findIndex((function(e){return e[G]===t})),r=(Z<n?Z:n)+1,o=Z<n?n:Z,i=V.slice(r,o).map((function(e){return e[G]})).filter((function(e){return!U.some((function(t){return t===e}))}));K([].concat(p(i),p(e)))}else K(p(e))}),[Z,V,K,U,G])}).onSelect,te=J.map((function(e){return e.id})),ne=0===te.length,re=te.filter((function(e){return a.includes(e)})),oe=!ne&&re.length===te.length,ie=!oe&&a.length>0,ae=v.reduce((function(e,t,n){return!1===t.visible&&e.push(n),e}),[]),se=o().createElement("tr",null,w&&!ne&&o().createElement("th",{className:"table-checkbox-cell"},o().createElement(z,{checked:oe,indeterminate:ie,onSelect:function(e){return w(te,e)},onUnselect:function(e){_(ie?a:te,e)}})),v.filter((function(e,t){return!ae.includes(t)})).map((function(e){var t,n,r,i=L&&L.accessor===e.accessor,a=L&&"asc"===L.by,s=F(e);return o().createElement("th",{style:s,key:e.accessor},o().createElement("div",{style:I(I({},s),{},{width:"auto"})},o().createElement("div",null,e.title),o().createElement("div",{style:{flex:"auto"}}),o().createElement("div",{className:"neko-column-action"},e.filters&&o().createElement(M,T({accessor:e.accessor},e.filters,{onChange:function(e,t){return g(e,t)},filters:(r=null!==(t=null==f?void 0:f.find((function(t){return t.accessor===e.accessor})))&&void 0!==t?t:null,null!==(n=null==r?void 0:r.value)&&void 0!==n?n:null)}))),o().createElement("div",{className:"neko-column-action",onClick:e.sortable?function(t){var n=L&&L.accessor!==e.accessor;C(e.accessor,n||i&&a?"desc":"asc",t)}:void 0},e.sortable&&o().createElement(l.In,{className:i?"neko-active":"",icon:i&&a?u.A:c.A,width:"26px",height:"26px"}))))}))),le=(0,d.gR)("neko-table","neko-table-".concat(j),{"neko-row-selectable":!!k});return o().createElement(h.A,{busy:x,overlaystyle:{top:"36px",height:"calc(100% - 76px)"}},o().createElement(N,{className:le},o().createElement("thead",null,se),o().createElement("tbody",null,!J.length&&o().createElement("tr",null,o().createElement("td",{colspan:W,style:{textAlign:"center",height:40,color:"gray"}},H)),J.map((function(e,t){var n=t%2==0?X:{},r=!!s&&s===e.id||a.includes(e.id);return o().createElement("tr",{key:"neko-row-".concat(e.id),className:r?"selected":"",style:n,onClick:function(t){t.stopPropagation(),k&&O&&k(e.id,t)}},w&&o().createElement("td",{className:"table-checkbox-cell"},o().createElement(z,{checked:a.includes(e.id),onSelect:function(t){t.stopPropagation(),ee([e.id],t)},onUnselect:function(t){t.stopPropagation(),_([e.id],t)},isBusy:e.isBusy||(null==e?void 0:e.disabled_row)})),e.cells.filter((function(e,t){return!ae.includes(t)})).map((function(n,r){return o().createElement("td",{key:"".concat(e.id).concat(t).concat(r),style:n.style},n.value)})))}))),"default"===j&&o().createElement("tfoot",null,se)))},W=function(e){return o().createElement(H,e)};W.propTypes={columns:a().arrayOf(a().any),data:a().arrayOf(a().any),busy:a().bool,onSelect:a().func,onSelectRow:a().func,selectOnRowClick:a().bool,onUnselect:a().func,selectedItems:a().arrayOf(a().any),onSortChange:a().func,variant:a().string,alternateRowColor:a().oneOfType([a().bool,a().string])}},3676:(e,t,n)=>{"use strict";n.d(t,{V:()=>L,_:()=>T});var r,o,i,a,s,l,c=n(1594),u=n.n(c),h=n(6365),f=n.n(h),d=n(3185),p=n(1329),m=n(8922),g=n(6897),y=n(2557),v=n(9296),b=["inversed","children","action"];function x(){return x=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},x.apply(this,arguments)}function w(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,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(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}}(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 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}function S(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var O=d.Ay.div(r||(r=S(["\n  display: flex;\n  justify-content: space-between;\n  position: relative;\n  height: 39px;\n"]))),_=d.Ay.div(o||(o=S(["\n  display: flex;\n  height: 39px;\n  position: absolute;\n  overflow: hidden;\n  max-width: ",";\n"])),(function(e){return e.$needsMoreSpace?"calc(100% - 75px - ".concat(e.$actionWidth,"px)"):"100%"})),E=d.Ay.div(i||(i=S(["\n  z-index: 1;\n  display: flex;\n  align-items: center;\n  height: 39px;\n  margin-left: auto;\n"]))),C=d.Ay.div(a||(a=S(["\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  height: 39px;\n  margin-right: 5px;\n"]))),A=d.Ay.button(s||(s=S(["\n  border-radius: 8px 8px 0px 0px;\n  border: 0;\n  background-color: var(--neko-main-color-disabled);\n  color: rgb(255 255 255 / 65%);\n  display: flex;\n  align-items: center;\n\n  cursor: pointer;\n  margin: 0 5px 0 0;\n  text-align: left;\n  padding: 12px 15px 12px 15px;\n\n  &:not(.active):not(.disabled):hover {\n    filter: brightness(1.1);\n  }\n\n  &:focus {\n    outline: none;\n  }\n\n  &.active {\n    background-color: var(--neko-main-color);\n    color: var(--neko-white);\n  }\n\n  &.disabled {\n    cursor: default;\n    display: inline-flex;\n    padding-bottom: 7px;\n  }\n\n  &.hidden {\n    display: none;\n  }\n\n  &.inversed {\n    &.active {\n      background-color: var(--neko-white);\n      color: var(--neko-font-color);\n    }\n  }\n"]))),j=d.Ay.div(l||(l=S(["\n  background-color: var(--neko-main-color);\n  color: white;\n  display: none;\n  padding: 10px;\n  border-radius: 0px 0px 8px 8px;\n  box-shadow: 0px 8px 8px -8px rgba(0, 0, 0, 0.35);\n\n  &.active {\n    display: block;\n  }\n\n  &.inversed {\n    background-color: var(--neko-white);\n    color: var(--neko-black);\n  }\n"]))),P=function(e,t){var n=e.props,r="tab-"+(t+1);return e.key?r=e.key:"string"==typeof n.title&&(r=(r=n.title.toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5\u3040-\u309f\u30a0-\u30ff\u2e80-\u2eff\u31f0-\u31ff\u3200-\u32ff\u3400-\u4dbf\uf900-\ufaff ]/gi,"")).replace(/ /g,"-")),r},M=function(e){var t,n=e.inversed,r=e.children,o=e.action,i=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,b),a=(0,c.useRef)(null),s=(0,c.useRef)(null),l=(0,c.useRef)(null),h=w((0,c.useState)([]),2),f=h[0],d=h[1],y=w((0,c.useState)([]),2),k=y[0],S=y[1],j=w((0,c.useState)(0),2),M=j[0],R=j[1],T=w((0,c.useState)(0),2),L=T[0],I=T[1],N=w((0,c.useState)(!1),2),z=N[0],D=N[1],F=w((0,c.useState)(!1),2),B=F[0],$=F[1],H=w((0,c.useState)(null!==(t=e.currentTab)&&void 0!==t?t:f[0]),2),W=H[0],q=H[1],V=(0,c.useRef)([]),U=(0,c.useCallback)((function(e){if(history.pushState&&"string"==typeof e){var t=new URLSearchParams(window.location.search);t.set("nekoTab",e);var n=window.location.protocol+"//"+window.location.host+window.location.pathname+"?"+t.toString();window.history.replaceState({path:n},"",n)}}),[]),K=(0,c.useCallback)((function(t,n,r){n&&!n.requirePro&&(void 0===e.currentTab&&q(n.key),e.onChange&&e.onChange(t,n,r),e.keepTabOnReload&&U(n.key))}),[e,U]);(0,c.useLayoutEffect)((function(){s.current&&(R(s.current.offsetWidth),$(!0)),l.current&&I(l.current.offsetWidth)}),[]),(0,c.useLayoutEffect)((function(){var e=V.current.reduce((function(e,t){return e+(t?t.offsetWidth+10:0)}),0);D(e>M-L)}),[f,M,L]);var Q=(0,c.useMemo)((function(){return r?r.length?r.filter((function(e){return!!e})):[r]:[]}),[r]);(0,c.useEffect)((function(){var e=[],t=u().Children.map(Q,(function(t,n){var r=P(t,n);return-1!==e.indexOf(r)&&(console.log("NekoTabs: Duplicated key found!",r,t),r=r+"-"+function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6,t="",n=0;n<e;n++)t+="abcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(36*Math.random())];return t}()),e.push(r),r}));t.length===f.length||d(t)}),[Q]),(0,c.useEffect)((function(){var t=u().Children.map(Q,(function(t,n){var r=t.props.title||"Untitled Tab ".concat(n+1);return{key:P(t,n),title:r,onClick:t.props.onClick||null,requirePro:!e.isPro&&(t.props.requirePro||!1),hidden:t.props.hidden||!1,icon:t.props.icon||!1}}));S(t)}),[Q,e.isPro]),(0,c.useEffect)((function(){void 0!==e.currentTab?f.includes(e.currentTab)?q(e.currentTab):f.length>0&&q(f[0]):!f.includes(W)&&f.length>0&&q(f[0])}),[e.currentTab,f,W]),(0,c.useLayoutEffect)((function(){if(e.keepTabOnReload){var t=new URL(window.location.href).searchParams.get("nekoTab");if(!t)return q(f[0]),void(e.callOnTabChangeFirst&&K(0,k[0]));var n=decodeURIComponent(t),r=f.indexOf(n);if(-1===r)return q(f[0]),void(e.callOnTabChangeFirst&&K(0,k[0]));q(f[r]),e.callOnTabChangeFirst&&K(r,k[r])}else if(e.callOnTabChangeFirst){var o=f.indexOf(W);K(o,k[o])}}),[e.keepTabOnReload,e.callOnTabChangeFirst,f,W,k,K]);var G=(0,c.useMemo)((function(){return u().Children.map(Q,(function(e,t){var r=P(e,t),o=r===W,i=e.props.hidden;if(o&&i){var a=f.find((function(e){var t;return!(null!==(t=k.find((function(t){return t.key===e})))&&void 0!==t&&t.hidden)}));q(a)}return u().cloneElement(e,{isActive:o&&!i,inversed:n,key:r})}))}),[Q,W,f,n,k]),Y=(0,g.gR)("neko-tabs",{inversed:n});return u().createElement("div",x({ref:s,className:Y},i),u().createElement(O,null,u().createElement(_,{ref:a,$needsMoreSpace:z,$actionWidth:L},B&&k.map((function(e,t){return u().createElement(A,{key:e.key,ref:function(e){return V.current[t]=e},onClick:function(n){return K(t,e,n)},className:"neko-tab-title ".concat(e.key===W?"active":""," ").concat(e.requirePro?"disabled":""," ").concat(e.hidden?"hidden":""," ").concat(n?"inversed":"")},e.icon&&u().createElement(m.z,{icon:e.icon,width:15,height:15,style:{marginRight:"2px"},raw:!0}),e.title,u().createElement(p.K,{className:"inline",show:e.requirePro,style:{marginLeft:10,marginRight:-5,top:-1}}))}))),(!!o||z)&&u().createElement(E,{ref:l},z&&u().createElement(C,null,u().createElement(v.M,{rounded:!0,className:"secondary",icon:"chevron-left",onClick:function(){a.current&&a.current.scrollTo({left:a.current.scrollLeft-200,behavior:"smooth"})}}),u().createElement(v.M,{rounded:!0,className:"secondary",icon:"chevron-right",onClick:function(){a.current&&a.current.scrollTo({left:a.current.scrollLeft+200,behavior:"smooth"})}})),!!o&&o)),G)},R=function(e){var t=e.children,n=e.isActive,r=void 0!==n&&n,o=e.busy,i=void 0!==o&&o,a=e.inversed,s=(0,g.gR)("neko-tab-content",{active:r,inversed:a});return u().createElement(y.A,{busy:i},u().createElement(j,{className:s},r&&t))},T=function(e){return u().createElement(M,e)};T.propTypes={isPro:f().bool,onChange:f().func,action:f().node,currentTab:f().string,keepTabOnReload:f().bool,callOnTabChangeFirst:f().bool};var L=function(e){return u().createElement(R,e)};L.propTypes={isActive:f().bool,requirePro:f().bool,title:f().string,icon:f().string}},7494:(e,t,n)=>{"use strict";n.d(t,{V:()=>m});var r,o=n(1594),i=n.n(o),a=n(6365),s=n.n(a),l=n(3185),c=["align"];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)}var h,f,d=l.Ay.div(r||(h=["\n  box-sizing: border-box;\n  display: flex;\n  width: 100%;\n  padding: 10px 10px;\n  background: white;\n  color: var(--neko-font-color);\n  border-radius: 10px;\n  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);\n  align-items: center;\n\n  &.neko-align-left {\n    justify-content: flex-start;\n  }\n\n  &.neko-align-right {\n    justify-content: flex-end;\n  }\n\n  > *:not(:last-child) {\n    margin-right: 5px;\n  }\n"],f||(f=h.slice(0)),r=Object.freeze(Object.defineProperties(h,{raw:{value:Object.freeze(f)}})))),p=function(e){var t=e.align,n=void 0===t?"left":t,r=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,c);return i().createElement(d,u({className:"neko-toolbar neko-align-".concat(n)},r),r.children)},m=function(e){return i().createElement(p,e)};m.propTypes={align:s().oneOf(["left","right"])}},7965:(e,t,n)=>{"use strict";var r=n(6426),o={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var n,i,a,s,l,c,u=!1;t||(t={}),n=t.debug||!1;try{if(a=r(),s=document.createRange(),l=document.getSelection(),(c=document.createElement("span")).textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var i=o[t.format]||o.default;window.clipboardData.setData(i,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(c),s.selectNodeContents(c),l.addRange(s),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");u=!0}catch(r){n&&console.error("unable to copy using execCommand: ",r),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),u=!0}catch(r){n&&console.error("unable to copy using clipboardData: ",r),n&&console.error("falling back to prompt"),i=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(i,e)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(s):l.removeAllRanges()),c&&document.body.removeChild(c),a()}return u}},4146:(e,t,n)=>{"use strict";var r=n(4363),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},s={};function l(e){return r.isMemo(e)?a:s[e.$$typeof]||o}s[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},s[r.Memo]=a;var c=Object.defineProperty,u=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,p=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(p){var o=d(n);o&&o!==p&&e(t,o,r)}var a=u(n);h&&(a=a.concat(h(n)));for(var s=l(t),m=l(n),g=0;g<a.length;++g){var y=a[g];if(!(i[y]||r&&r[y]||m&&m[y]||s&&s[y])){var v=f(n,y);try{c(t,y,v)}catch(e){}}}}return t}},4809:function(e,t){var n,r;n=function e(){"use strict";var t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:{},n=!t.document&&!!t.postMessage,r=t.IS_PAPA_WORKER||!1,o={},i=0,a={parse:function(n,r){var s=(r=r||{}).dynamicTyping||!1;if(w(s)&&(r.dynamicTypingFunction=s,s={}),r.dynamicTyping=s,r.transform=!!w(r.transform)&&r.transform,r.worker&&a.WORKERS_SUPPORTED){var l=function(){if(!a.WORKERS_SUPPORTED)return!1;var n,r,s=(n=t.URL||t.webkitURL||null,r=e.toString(),a.BLOB_URL||(a.BLOB_URL=n.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",r,")();"],{type:"text/javascript"})))),l=new t.Worker(s);return l.onmessage=g,l.id=i++,o[l.id]=l}();return l.userStep=r.step,l.userChunk=r.chunk,l.userComplete=r.complete,l.userError=r.error,r.step=w(r.step),r.chunk=w(r.chunk),r.complete=w(r.complete),r.error=w(r.error),delete r.worker,void l.postMessage({input:n,config:r,workerId:l.id})}var d=null;return a.NODE_STREAM_INPUT,"string"==typeof n?(n=function(e){return 65279===e.charCodeAt(0)?e.slice(1):e}(n),d=r.download?new c(r):new h(r)):!0===n.readable&&w(n.read)&&w(n.on)?d=new f(r):(t.File&&n instanceof File||n instanceof Object)&&(d=new u(r)),d.stream(n)},unparse:function(e,t){var n=!1,r=!0,o=",",i="\r\n",s='"',l=s+s,c=!1,u=null,h=!1;!function(){if("object"==typeof t){if("string"!=typeof t.delimiter||a.BAD_DELIMITERS.filter((function(e){return-1!==t.delimiter.indexOf(e)})).length||(o=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(n=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(c=t.skipEmptyLines),"string"==typeof t.newline&&(i=t.newline),"string"==typeof t.quoteChar&&(s=t.quoteChar),"boolean"==typeof t.header&&(r=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");u=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+s),("boolean"==typeof t.escapeFormulae||t.escapeFormulae instanceof RegExp)&&(h=t.escapeFormulae instanceof RegExp?t.escapeFormulae:/^[=+\-@\t\r].*$/)}}();var f=new RegExp(p(s),"g");if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return d(null,e,c);if("object"==typeof e[0])return d(u||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||u),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),d(e.fields||[],e.data||[],c);throw new Error("Unable to serialize unrecognized input");function d(e,t,n){var a="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var s=Array.isArray(e)&&0<e.length,l=!Array.isArray(t[0]);if(s&&r){for(var c=0;c<e.length;c++)0<c&&(a+=o),a+=m(e[c],c);0<t.length&&(a+=i)}for(var u=0;u<t.length;u++){var h=s?e.length:t[u].length,f=!1,d=s?0===Object.keys(t[u]).length:0===t[u].length;if(n&&!s&&(f="greedy"===n?""===t[u].join("").trim():1===t[u].length&&0===t[u][0].length),"greedy"===n&&s){for(var p=[],g=0;g<h;g++){var y=l?e[g]:g;p.push(t[u][y])}f=""===p.join("").trim()}if(!f){for(var v=0;v<h;v++){0<v&&!d&&(a+=o);var b=s&&l?e[v]:v;a+=m(t[u][b],v)}u<t.length-1&&(!n||0<h&&!d)&&(a+=i)}}return a}function m(e,t){if(null==e)return"";if(e.constructor===Date)return JSON.stringify(e).slice(1,25);var r=!1;h&&"string"==typeof e&&h.test(e)&&(e="'"+e,r=!0);var i=e.toString().replace(f,l);return(r=r||!0===n||"function"==typeof n&&n(e,t)||Array.isArray(n)&&n[t]||function(e,t){for(var n=0;n<t.length;n++)if(-1<e.indexOf(t[n]))return!0;return!1}(i,a.BAD_DELIMITERS)||-1<i.indexOf(o)||" "===i.charAt(0)||" "===i.charAt(i.length-1))?s+i+s:i}}};if(a.RECORD_SEP=String.fromCharCode(30),a.UNIT_SEP=String.fromCharCode(31),a.BYTE_ORDER_MARK="\ufeff",a.BAD_DELIMITERS=["\r","\n",'"',a.BYTE_ORDER_MARK],a.WORKERS_SUPPORTED=!n&&!!t.Worker,a.NODE_STREAM_INPUT=1,a.LocalChunkSize=10485760,a.RemoteChunkSize=5242880,a.DefaultDelimiter=",",a.Parser=m,a.ParserHandle=d,a.NetworkStreamer=c,a.FileStreamer=u,a.StringStreamer=h,a.ReadableStreamStreamer=f,t.jQuery){var s=t.jQuery;s.fn.parse=function(e){var n=e.config||{},r=[];return this.each((function(e){if("INPUT"!==s(this).prop("tagName").toUpperCase()||"file"!==s(this).attr("type").toLowerCase()||!t.FileReader||!this.files||0===this.files.length)return!0;for(var o=0;o<this.files.length;o++)r.push({file:this.files[o],inputElem:this,instanceConfig:s.extend({},n)})})),o(),this;function o(){if(0!==r.length){var t,n,o,l=r[0];if(w(e.before)){var c=e.before(l.file,l.inputElem);if("object"==typeof c){if("abort"===c.action)return"AbortError",t=l.file,n=l.inputElem,o=c.reason,void(w(e.error)&&e.error({name:"AbortError"},t,n,o));if("skip"===c.action)return void i();"object"==typeof c.config&&(l.instanceConfig=s.extend(l.instanceConfig,c.config))}else if("skip"===c)return void i()}var u=l.instanceConfig.complete;l.instanceConfig.complete=function(e){w(u)&&u(e,l.file,l.inputElem),i()},a.parse(l.file,l.instanceConfig)}else w(e.complete)&&e.complete()}function i(){r.splice(0,1),o()}}}function l(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=b(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new d(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,n){if(this.isFirstChunk&&w(this._config.beforeFirstChunk)){var o=this._config.beforeFirstChunk(e);void 0!==o&&(e=o)}this.isFirstChunk=!1,this._halted=!1;var i=this._partialLine+e;this._partialLine="";var s=this._handle.parse(i,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var l=s.meta.cursor;this._finished||(this._partialLine=i.substring(l-this._baseIndex),this._baseIndex=l),s&&s.data&&(this._rowCount+=s.data.length);var c=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(r)t.postMessage({results:s,workerId:a.WORKER_ID,finished:c});else if(w(this._config.chunk)&&!n){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);s=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),this._completed||!c||!w(this._config.complete)||s&&s.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),c||s&&s.meta.paused||this._nextChunk(),s}this._halted=!0},this._sendError=function(e){w(this._config.error)?this._config.error(e):r&&this._config.error&&t.postMessage({workerId:a.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=a.RemoteChunkSize),l.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=x(this._chunkLoaded,this),t.onerror=x(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e=this._config.downloadRequestHeaders;for(var r in e)t.setRequestHeader(r,e[r])}if(this._config.chunkSize){var o=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+o)}try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:t.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(e){var t=e.getResponseHeader("Content-Range");return null===t?-1:parseInt(t.substring(t.lastIndexOf("/")+1))}(t),this.parseChunk(t.responseText)))},this._chunkError=function(e){var n=t.statusText||e;this._sendError(new Error(n))}}function u(e){var t,n;(e=e||{}).chunkSize||(e.chunkSize=a.LocalChunkSize),l.call(this,e);var r="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,r?((t=new FileReader).onload=x(this._chunkLoaded,this),t.onerror=x(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input;if(this._config.chunkSize){var o=Math.min(this._start+this._config.chunkSize,this._input.size);e=n.call(e,this._start,o)}var i=t.readAsText(e,this._config.encoding);r||this._chunkLoaded({target:{result:i}})},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function h(e){var t;l.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e,n=this._config.chunkSize;return n?(e=t.substring(0,n),t=t.substring(n)):(e=t,t=""),this._finished=!t,this.parseChunk(e)}}}function f(e){l.call(this,e=e||{});var t=[],n=!0,r=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):n=!0},this._streamData=x((function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),n&&(n=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}}),this),this._streamError=x((function(e){this._streamCleanUp(),this._sendError(e)}),this),this._streamEnd=x((function(){this._streamCleanUp(),r=!0,this._streamData("")}),this),this._streamCleanUp=x((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function d(e){var t,n,r,o=Math.pow(2,53),i=-o,s=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,l=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,c=this,u=0,h=0,f=!1,d=!1,g=[],y={data:[],errors:[],meta:{}};if(w(e.step)){var v=e.step;e.step=function(t){if(y=t,S())k();else{if(k(),0===y.data.length)return;u+=t.data.length,e.preview&&u>e.preview?n.abort():(y.data=y.data[0],v(y,c))}}}function x(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function k(){return y&&r&&(_("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines&&(y.data=y.data.filter((function(e){return!x(e)}))),S()&&function(){if(y)if(Array.isArray(y.data[0])){for(var t=0;S()&&t<y.data.length;t++)y.data[t].forEach(n);y.data.splice(0,1)}else y.data.forEach(n);function n(t,n){w(e.transformHeader)&&(t=e.transformHeader(t,n)),g.push(t)}}(),function(){if(!y||!e.header&&!e.dynamicTyping&&!e.transform)return y;function t(t,n){var r,o=e.header?{}:[];for(r=0;r<t.length;r++){var i=r,a=t[r];e.header&&(i=r>=g.length?"__parsed_extra":g[r]),e.transform&&(a=e.transform(a,i)),a=O(i,a),"__parsed_extra"===i?(o[i]=o[i]||[],o[i].push(a)):o[i]=a}return e.header&&(r>g.length?_("FieldMismatch","TooManyFields","Too many fields: expected "+g.length+" fields but parsed "+r,h+n):r<g.length&&_("FieldMismatch","TooFewFields","Too few fields: expected "+g.length+" fields but parsed "+r,h+n)),o}var n=1;return!y.data.length||Array.isArray(y.data[0])?(y.data=y.data.map(t),n=y.data.length):y.data=t(y.data,0),e.header&&y.meta&&(y.meta.fields=g),h+=n,y}()}function S(){return e.header&&0===g.length}function O(t,n){return r=t,e.dynamicTypingFunction&&void 0===e.dynamicTyping[r]&&(e.dynamicTyping[r]=e.dynamicTypingFunction(r)),!0===(e.dynamicTyping[r]||e.dynamicTyping)?"true"===n||"TRUE"===n||"false"!==n&&"FALSE"!==n&&(function(e){if(s.test(e)){var t=parseFloat(e);if(i<t&&t<o)return!0}return!1}(n)?parseFloat(n):l.test(n)?new Date(n):""===n?null:n):n;var r}function _(e,t,n,r){var o={type:e,code:t,message:n};void 0!==r&&(o.row=r),y.errors.push(o)}this.parse=function(o,i,s){var l=e.quoteChar||'"';if(e.newline||(e.newline=function(e,t){e=e.substring(0,1048576);var n=new RegExp(p(t)+"([^]*?)"+p(t),"gm"),r=(e=e.replace(n,"")).split("\r"),o=e.split("\n"),i=1<o.length&&o[0].length<r[0].length;if(1===r.length||i)return"\n";for(var a=0,s=0;s<r.length;s++)"\n"===r[s][0]&&a++;return a>=r.length/2?"\r\n":"\r"}(o,l)),r=!1,e.delimiter)w(e.delimiter)&&(e.delimiter=e.delimiter(o),y.meta.delimiter=e.delimiter);else{var c=function(t,n,r,o,i){var s,l,c,u;i=i||[",","\t","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var h=0;h<i.length;h++){var f=i[h],d=0,p=0,g=0;c=void 0;for(var y=new m({comments:o,delimiter:f,newline:n,preview:10}).parse(t),v=0;v<y.data.length;v++)if(r&&x(y.data[v]))g++;else{var b=y.data[v].length;p+=b,void 0!==c?0<b&&(d+=Math.abs(b-c),c=b):c=b}0<y.data.length&&(p/=y.data.length-g),(void 0===l||d<=l)&&(void 0===u||u<p)&&1.99<p&&(l=d,s=f,u=p)}return{successful:!!(e.delimiter=s),bestDelimiter:s}}(o,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);c.successful?e.delimiter=c.bestDelimiter:(r=!0,e.delimiter=a.DefaultDelimiter),y.meta.delimiter=e.delimiter}var u=b(e);return e.preview&&e.header&&u.preview++,t=o,n=new m(u),y=n.parse(t,i,s),k(),f?{meta:{paused:!0}}:y||{meta:{paused:!1}}},this.paused=function(){return f},this.pause=function(){f=!0,n.abort(),t=w(e.chunk)?"":t.substring(n.getCharIndex())},this.resume=function(){c.streamer._halted?(f=!1,c.streamer.parseChunk(t,!0)):setTimeout(c.resume,3)},this.aborted=function(){return d},this.abort=function(){d=!0,n.abort(),y.meta.aborted=!0,w(e.complete)&&e.complete(y),t=""}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m(e){var t,n=(e=e||{}).delimiter,r=e.newline,o=e.comments,i=e.step,s=e.preview,l=e.fastMode,c=t=void 0===e.quoteChar||null===e.quoteChar?'"':e.quoteChar;if(void 0!==e.escapeChar&&(c=e.escapeChar),("string"!=typeof n||-1<a.BAD_DELIMITERS.indexOf(n))&&(n=","),o===n)throw new Error("Comment character same as delimiter");!0===o?o="#":("string"!=typeof o||-1<a.BAD_DELIMITERS.indexOf(o))&&(o=!1),"\n"!==r&&"\r"!==r&&"\r\n"!==r&&(r="\n");var u=0,h=!1;this.parse=function(a,f,d){if("string"!=typeof a)throw new Error("Input must be a string");var m=a.length,g=n.length,y=r.length,v=o.length,b=w(i),x=[],k=[],S=[],O=u=0;if(!a)return U();if(e.header&&!f){var _=a.split(r)[0].split(n),E=[],C={},A=!1;for(var j in _){var P=_[j];w(e.transformHeader)&&(P=e.transformHeader(P,j));var M=P,R=C[P]||0;for(0<R&&(A=!0,M=P+"_"+R),C[P]=R+1;E.includes(M);)M=M+"_"+R;E.push(M)}if(A){var T=a.split(r);T[0]=E.join(n),a=T.join(r)}}if(l||!1!==l&&-1===a.indexOf(t)){for(var L=a.split(r),I=0;I<L.length;I++){if(S=L[I],u+=S.length,I!==L.length-1)u+=r.length;else if(d)return U();if(!o||S.substring(0,v)!==o){if(b){if(x=[],H(S.split(n)),K(),h)return U()}else H(S.split(n));if(s&&s<=I)return x=x.slice(0,s),U(!0)}}return U()}for(var N=a.indexOf(n,u),z=a.indexOf(r,u),D=new RegExp(p(c)+p(t),"g"),F=a.indexOf(t,u);;)if(a[u]!==t)if(o&&0===S.length&&a.substring(u,u+v)===o){if(-1===z)return U();u=z+y,z=a.indexOf(r,u),N=a.indexOf(n,u)}else if(-1!==N&&(N<z||-1===z))S.push(a.substring(u,N)),u=N+g,N=a.indexOf(n,u);else{if(-1===z)break;if(S.push(a.substring(u,z)),V(z+y),b&&(K(),h))return U();if(s&&x.length>=s)return U(!0)}else for(F=u,u++;;){if(-1===(F=a.indexOf(t,F+1)))return d||k.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:x.length,index:u}),q();if(F===m-1)return q(a.substring(u,F).replace(D,t));if(t!==c||a[F+1]!==c){if(t===c||0===F||a[F-1]!==c){-1!==N&&N<F+1&&(N=a.indexOf(n,F+1)),-1!==z&&z<F+1&&(z=a.indexOf(r,F+1));var B=W(-1===z?N:Math.min(N,z));if(a.substr(F+1+B,g)===n){S.push(a.substring(u,F).replace(D,t)),a[u=F+1+B+g]!==t&&(F=a.indexOf(t,u)),N=a.indexOf(n,u),z=a.indexOf(r,u);break}var $=W(z);if(a.substring(F+1+$,F+1+$+y)===r){if(S.push(a.substring(u,F).replace(D,t)),V(F+1+$+y),N=a.indexOf(n,u),F=a.indexOf(t,u),b&&(K(),h))return U();if(s&&x.length>=s)return U(!0);break}k.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:x.length,index:u}),F++}}else F++}return q();function H(e){x.push(e),O=u}function W(e){var t=0;if(-1!==e){var n=a.substring(F+1,e);n&&""===n.trim()&&(t=n.length)}return t}function q(e){return d||(void 0===e&&(e=a.substring(u)),S.push(e),u=m,H(S),b&&K()),U()}function V(e){u=e,H(S),S=[],z=a.indexOf(r,u)}function U(e){return{data:x,errors:k,meta:{delimiter:n,linebreak:r,aborted:h,truncated:!!e,cursor:O+(f||0)}}}function K(){i(U()),x=[],k=[]}},this.abort=function(){h=!0},this.getCharIndex=function(){return u}}function g(e){var t=e.data,n=o[t.workerId],r=!1;if(t.error)n.userError(t.error,t.file);else if(t.results&&t.results.data){var i={abort:function(){r=!0,y(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:v,resume:v};if(w(n.userStep)){for(var a=0;a<t.results.data.length&&(n.userStep({data:t.results.data[a],errors:t.results.errors,meta:t.results.meta},i),!r);a++);delete t.results}else w(n.userChunk)&&(n.userChunk(t.results,i,t.file),delete t.results)}t.finished&&!r&&y(t.workerId,t.results)}function y(e,t){var n=o[e];w(n.userComplete)&&n.userComplete(t),n.terminate(),delete o[e]}function v(){throw new Error("Not implemented.")}function b(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var n in e)t[n]=b(e[n]);return t}function x(e,t){return function(){e.apply(t,arguments)}}function w(e){return"function"==typeof e}return r&&(t.onmessage=function(e){var n=e.data;if(void 0===a.WORKER_ID&&n&&(a.WORKER_ID=n.workerId),"string"==typeof n.input)t.postMessage({workerId:a.WORKER_ID,results:a.parse(n.input,n.config),finished:!0});else if(t.File&&n.input instanceof File||n.input instanceof Object){var r=a.parse(n.input,n.config);r&&t.postMessage({workerId:a.WORKER_ID,results:r,finished:!0})}}),(c.prototype=Object.create(l.prototype)).constructor=c,(u.prototype=Object.create(l.prototype)).constructor=u,(h.prototype=Object.create(h.prototype)).constructor=h,(f.prototype=Object.create(l.prototype)).constructor=f,a},void 0===(r=n.apply(t,[]))||(e.exports=r)},2799:(e,t)=>{"use strict";var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,i=n?Symbol.for("react.fragment"):60107,a=n?Symbol.for("react.strict_mode"):60108,s=n?Symbol.for("react.profiler"):60114,l=n?Symbol.for("react.provider"):60109,c=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,h=n?Symbol.for("react.concurrent_mode"):60111,f=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,p=n?Symbol.for("react.suspense_list"):60120,m=n?Symbol.for("react.memo"):60115,g=n?Symbol.for("react.lazy"):60116,y=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,b=n?Symbol.for("react.responder"):60118,x=n?Symbol.for("react.scope"):60119;function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case h:case i:case s:case a:case d:return e;default:switch(e=e&&e.$$typeof){case c:case f:case g:case m:case l:return e;default:return t}}case o:return t}}}function k(e){return w(e)===h}t.AsyncMode=u,t.ConcurrentMode=h,t.ContextConsumer=c,t.ContextProvider=l,t.Element=r,t.ForwardRef=f,t.Fragment=i,t.Lazy=g,t.Memo=m,t.Portal=o,t.Profiler=s,t.StrictMode=a,t.Suspense=d,t.isAsyncMode=function(e){return k(e)||w(e)===u},t.isConcurrentMode=k,t.isContextConsumer=function(e){return w(e)===c},t.isContextProvider=function(e){return w(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return w(e)===f},t.isFragment=function(e){return w(e)===i},t.isLazy=function(e){return w(e)===g},t.isMemo=function(e){return w(e)===m},t.isPortal=function(e){return w(e)===o},t.isProfiler=function(e){return w(e)===s},t.isStrictMode=function(e){return w(e)===a},t.isSuspense=function(e){return w(e)===d},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===h||e===s||e===a||e===d||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===m||e.$$typeof===l||e.$$typeof===c||e.$$typeof===f||e.$$typeof===v||e.$$typeof===b||e.$$typeof===x||e.$$typeof===y)},t.typeOf=w},4363:(e,t,n)=>{"use strict";e.exports=n(2799)},2192:(e,t,n)=>{"use strict";function r(){return r=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},r.apply(this,arguments)}n.d(t,{A:()=>y});var o=n(1594);const i=o.useLayoutEffect;var a=function(e,t){"function"!=typeof e?e.current=t:e(t)};var s={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},l=function(e){Object.keys(s).forEach((function(t){e.style.setProperty(t,s[t],"important")}))},c=null,u=function(e,t){var n=e.scrollHeight;return"border-box"===t.sizingStyle.boxSizing?n+t.borderSize:n-t.paddingSize},h=function(){},f=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak"],d=!!document.documentElement.currentStyle;function p(e,t,n){var r,a,s=(r=n,a=o.useRef(r),i((function(){a.current=r})),a);o.useLayoutEffect((function(){var n=function(e){return s.current(e)};if(e)return e.addEventListener(t,n),function(){return e.removeEventListener(t,n)}}),[])}var m=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],g=function(e,t){var n,i=e.cacheMeasurements,s=e.maxRows,g=e.minRows,y=e.onChange,v=void 0===y?h:y,b=e.onHeightChange,x=void 0===b?h:b,w=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,m),k=void 0!==w.value,S=o.useRef(null),O=function(e,t){var n=(0,o.useRef)();return(0,o.useCallback)((function(r){e.current=r,n.current&&a(n.current,null),n.current=t,t&&a(t,r)}),[t])}(S,t),_=o.useRef(0),E=o.useRef(),C=function(){var e=S.current,t=i&&E.current?E.current:function(e){var t=window.getComputedStyle(e);if(null===t)return null;var n,r=(n=t,f.reduce((function(e,t){return e[t]=n[t],e}),{})),o=r.boxSizing;return""===o?null:(d&&"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){E.current=t;var n=function(e,t,n,r){void 0===n&&(n=1),void 0===r&&(r=1/0),c||((c=document.createElement("textarea")).setAttribute("tabindex","-1"),c.setAttribute("aria-hidden","true"),l(c)),null===c.parentNode&&document.body.appendChild(c);var o=e.paddingSize,i=e.borderSize,a=e.sizingStyle,s=a.boxSizing;Object.keys(a).forEach((function(e){var t=e;c.style[t]=a[t]})),l(c),c.value=t;var h=u(c,e);c.value=t,h=u(c,e),c.value="x";var f=c.scrollHeight-o,d=f*n;"border-box"===s&&(d=d+o+i),h=Math.max(d,h);var p=f*r;return"border-box"===s&&(p=p+o+i),[h=Math.min(p,h),f]}(t,e.value||e.placeholder||"x",g,s),r=n[0],o=n[1];_.current!==r&&(_.current=r,e.style.setProperty("height",r+"px","important"),x(r,{rowHeight:o}))}};return o.useLayoutEffect(C),p(window,"resize",C),n=C,p(document.fonts,"loadingdone",n),o.createElement("textarea",r({},w,{onChange:function(e){k||C(),v(e)},ref:O}))},y=o.forwardRef(g)},1020:(e,t,n)=>{"use strict";var r=n(1594),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,n){var r,i={},c=null,u=null;for(r in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)a.call(t,r)&&!l.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===i[r]&&(i[r]=t[r]);return{$$typeof:o,type:e,key:c,ref:u,props:i,_owner:s.current}}t.Fragment=i,t.jsx=c,t.jsxs=c},4848:(e,t,n)=>{"use strict";e.exports=n(1020)},2833:e=>{e.exports=function(e,t,n,r){var o=n?n.call(r,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(t),l=0;l<i.length;l++){var c=i[l];if(!s(c))return!1;var u=e[c],h=t[c];if(!1===(o=n?n.call(r,u,h,c):void 0)||void 0===o&&u!==h)return!1}return!0}},3185:(e,t,n)=>{"use strict";n.d(t,{DU:()=>Yt,Ay:()=>Qt});var r=function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)};function o(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var i=n(1594),a=n.n(i),s=n(2833),l=n.n(s),c="-ms-",u="-moz-",h="-webkit-",f="comm",d="rule",p="decl",m="@import",g="@keyframes",y="@layer",v=Math.abs,b=String.fromCharCode,x=Object.assign;function w(e){return e.trim()}function k(e,t){return(e=t.exec(e))?e[0]:e}function S(e,t,n){return e.replace(t,n)}function O(e,t,n){return e.indexOf(t,n)}function _(e,t){return 0|e.charCodeAt(t)}function E(e,t,n){return e.slice(t,n)}function C(e){return e.length}function A(e){return e.length}function j(e,t){return t.push(e),e}function P(e,t){return e.filter((function(e){return!k(e,t)}))}var M=1,R=1,T=0,L=0,I=0,N="";function z(e,t,n,r,o,i,a,s){return{value:e,root:t,parent:n,type:r,props:o,children:i,line:M,column:R,length:a,return:"",siblings:s}}function D(e,t){return x(z("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},t)}function F(e){for(;e.root;)e=D(e.root,{children:[e]});j(e,e.siblings)}function B(){return I=L>0?_(N,--L):0,R--,10===I&&(R=1,M--),I}function $(){return I=L<T?_(N,L++):0,R++,10===I&&(R=1,M++),I}function H(){return _(N,L)}function W(){return L}function q(e,t){return E(N,e,t)}function V(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function U(e){return w(q(L-1,G(91===e?e+2:40===e?e+1:e)))}function K(e){for(;(I=H())&&I<33;)$();return V(e)>2||V(I)>3?"":" "}function Q(e,t){for(;--t&&$()&&!(I<48||I>102||I>57&&I<65||I>70&&I<97););return q(e,W()+(t<6&&32==H()&&32==$()))}function G(e){for(;$();)switch(I){case e:return L;case 34:case 39:34!==e&&39!==e&&G(I);break;case 40:41===e&&G(e);break;case 92:$()}return L}function Y(e,t){for(;$()&&e+I!==57&&(e+I!==84||47!==H()););return"/*"+q(t,L-1)+"*"+b(47===e?e:$())}function Z(e){for(;!V(H());)$();return q(e,L)}function X(e,t){for(var n="",r=0;r<e.length;r++)n+=t(e[r],r,e,t)||"";return n}function J(e,t,n,r){switch(e.type){case y:if(e.children.length)break;case m:case p:return e.return=e.return||e.value;case f:return"";case g:return e.return=e.value+"{"+X(e.children,r)+"}";case d:if(!C(e.value=e.props.join(",")))return""}return C(n=X(e.children,r))?e.return=e.value+"{"+n+"}":""}function ee(e,t,n){switch(function(e,t){return 45^_(e,0)?(((t<<2^_(e,0))<<2^_(e,1))<<2^_(e,2))<<2^_(e,3):0}(e,t)){case 5103:return h+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return h+e+e;case 4789:return u+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return h+e+u+e+c+e+e;case 5936:switch(_(e,t+11)){case 114:return h+e+c+S(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return h+e+c+S(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return h+e+c+S(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return h+e+c+e+e;case 6165:return h+e+c+"flex-"+e+e;case 5187:return h+e+S(e,/(\w+).+(:[^]+)/,h+"box-$1$2"+c+"flex-$1$2")+e;case 5443:return h+e+c+"flex-item-"+S(e,/flex-|-self/g,"")+(k(e,/flex-|baseline/)?"":c+"grid-row-"+S(e,/flex-|-self/g,""))+e;case 4675:return h+e+c+"flex-line-pack"+S(e,/align-content|flex-|-self/g,"")+e;case 5548:return h+e+c+S(e,"shrink","negative")+e;case 5292:return h+e+c+S(e,"basis","preferred-size")+e;case 6060:return h+"box-"+S(e,"-grow","")+h+e+c+S(e,"grow","positive")+e;case 4554:return h+S(e,/([^-])(transform)/g,"$1"+h+"$2")+e;case 6187:return S(S(S(e,/(zoom-|grab)/,h+"$1"),/(image-set)/,h+"$1"),e,"")+e;case 5495:case 3959:return S(e,/(image-set\([^]*)/,h+"$1$`$1");case 4968:return S(S(e,/(.+:)(flex-)?(.*)/,h+"box-pack:$3"+c+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+h+e+e;case 4200:if(!k(e,/flex-|baseline/))return c+"grid-column-align"+E(e,t)+e;break;case 2592:case 3360:return c+S(e,"template-","")+e;case 4384:case 3616:return n&&n.some((function(e,n){return t=n,k(e.props,/grid-\w+-end/)}))?~O(e+(n=n[t].value),"span",0)?e:c+S(e,"-start","")+e+c+"grid-row-span:"+(~O(n,"span",0)?k(n,/\d+/):+k(n,/\d+/)-+k(e,/\d+/))+";":c+S(e,"-start","")+e;case 4896:case 4128:return n&&n.some((function(e){return k(e.props,/grid-\w+-start/)}))?e:c+S(S(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return S(e,/(.+)-inline(.+)/,h+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(C(e)-1-t>6)switch(_(e,t+1)){case 109:if(45!==_(e,t+4))break;case 102:return S(e,/(.+:)(.+)-([^]+)/,"$1"+h+"$2-$3$1"+u+(108==_(e,t+3)?"$3":"$2-$3"))+e;case 115:return~O(e,"stretch",0)?ee(S(e,"stretch","fill-available"),t,n)+e:e}break;case 5152:case 5920:return S(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,(function(t,n,r,o,i,a,s){return c+n+":"+r+s+(o?c+n+"-span:"+(i?a:+a-+r)+s:"")+e}));case 4949:if(121===_(e,t+6))return S(e,":",":"+h)+e;break;case 6444:switch(_(e,45===_(e,14)?18:11)){case 120:return S(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+h+(45===_(e,14)?"inline-":"")+"box$3$1"+h+"$2$3$1"+c+"$2box$3")+e;case 100:return S(e,":",":"+c)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return S(e,"scroll-","scroll-snap-")+e}return e}function te(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case p:return void(e.return=ee(e.value,e.length,n));case g:return X([D(e,{value:S(e.value,"@","@"+h)})],r);case d:if(e.length)return function(e,t){return e.map(t).join("")}(n=e.props,(function(t){switch(k(t,r=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":F(D(e,{props:[S(t,/:(read-\w+)/,":"+u+"$1")]})),F(D(e,{props:[t]})),x(e,{props:P(n,r)});break;case"::placeholder":F(D(e,{props:[S(t,/:(plac\w+)/,":"+h+"input-$1")]})),F(D(e,{props:[S(t,/:(plac\w+)/,":"+u+"$1")]})),F(D(e,{props:[S(t,/:(plac\w+)/,c+"input-$1")]})),F(D(e,{props:[t]})),x(e,{props:P(n,r)})}return""}))}}function ne(e){return function(e){return N="",e}(re("",null,null,null,[""],e=function(e){return M=R=1,T=C(N=e),L=0,[]}(e),0,[0],e))}function re(e,t,n,r,o,i,a,s,l){for(var c=0,u=0,h=a,f=0,d=0,p=0,m=1,g=1,y=1,x=0,w="",k=o,E=i,A=r,P=w;g;)switch(p=x,x=$()){case 40:if(108!=p&&58==_(P,h-1)){-1!=O(P+=S(U(x),"&","&\f"),"&\f",v(c?s[c-1]:0))&&(y=-1);break}case 34:case 39:case 91:P+=U(x);break;case 9:case 10:case 13:case 32:P+=K(p);break;case 92:P+=Q(W()-1,7);continue;case 47:switch(H()){case 42:case 47:j(ie(Y($(),W()),t,n,l),l);break;default:P+="/"}break;case 123*m:s[c++]=C(P)*y;case 125*m:case 59:case 0:switch(x){case 0:case 125:g=0;case 59+u:-1==y&&(P=S(P,/\f/g,"")),d>0&&C(P)-h&&j(d>32?ae(P+";",r,n,h-1,l):ae(S(P," ","")+";",r,n,h-2,l),l);break;case 59:P+=";";default:if(j(A=oe(P,t,n,c,u,o,s,w,k=[],E=[],h,i),i),123===x)if(0===u)re(P,t,A,A,k,i,h,s,E);else switch(99===f&&110===_(P,3)?100:f){case 100:case 108:case 109:case 115:re(e,A,A,r&&j(oe(e,A,A,0,0,o,s,w,o,k=[],h,E),E),o,E,h,s,r?k:E);break;default:re(P,A,A,A,[""],E,0,s,E)}}c=u=d=0,m=y=1,w=P="",h=a;break;case 58:h=1+C(P),d=p;default:if(m<1)if(123==x)--m;else if(125==x&&0==m++&&125==B())continue;switch(P+=b(x),x*m){case 38:y=u>0?1:(P+="\f",-1);break;case 44:s[c++]=(C(P)-1)*y,y=1;break;case 64:45===H()&&(P+=U($())),f=H(),u=h=C(w=P+=Z(W())),x++;break;case 45:45===p&&2==C(P)&&(m=0)}}return i}function oe(e,t,n,r,o,i,a,s,l,c,u,h){for(var f=o-1,p=0===o?i:[""],m=A(p),g=0,y=0,b=0;g<r;++g)for(var x=0,k=E(e,f+1,f=v(y=a[g])),O=e;x<m;++x)(O=w(y>0?p[x]+" "+k:S(k,/&\f/g,p[x])))&&(l[b++]=O);return z(e,t,n,0===o?d:s,l,c,u,h)}function ie(e,t,n,r){return z(e,t,n,f,b(I),E(e,2,-2),0,r)}function ae(e,t,n,r,o){return z(e,t,n,p,E(e,0,r),E(e,r+1,-1),r,o)}var se=n(3969),le="undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",ce="active",ue="data-styled-version",he="6.1.12",fe="/*!sc*/\n",de="undefined"!=typeof window&&"HTMLElement"in window,pe=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==process.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&process.env.REACT_APP_SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.SC_DISABLE_SPEEDY&&""!==process.env.SC_DISABLE_SPEEDY&&"false"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY),me={},ge=(new Set,Object.freeze([])),ye=Object.freeze({});function ve(e,t,n){return void 0===n&&(n=ye),e.theme!==n.theme&&e.theme||t||n.theme}var be=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),xe=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,we=/(^-|-$)/g;function ke(e){return e.replace(xe,"-").replace(we,"")}var Se=/(a)(d)/gi,Oe=52,_e=function(e){return String.fromCharCode(e+(e>25?39:97))};function Ee(e){var t,n="";for(t=Math.abs(e);t>Oe;t=t/Oe|0)n=_e(t%Oe)+n;return(_e(t%Oe)+n).replace(Se,"$1-$2")}var Ce,Ae=5381,je=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},Pe=function(e){return je(Ae,e)};function Me(e){return Ee(Pe(e)>>>0)}function Re(e){return"string"==typeof e&&!0}var Te="function"==typeof Symbol&&Symbol.for,Le=Te?Symbol.for("react.memo"):60115,Ie=Te?Symbol.for("react.forward_ref"):60112,Ne={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},ze={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},De={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Fe=((Ce={})[Ie]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Ce[Le]=De,Ce);function Be(e){return("type"in(t=e)&&t.type.$$typeof)===Le?De:"$$typeof"in e?Fe[e.$$typeof]:Ne;var t}var $e=Object.defineProperty,He=Object.getOwnPropertyNames,We=Object.getOwnPropertySymbols,qe=Object.getOwnPropertyDescriptor,Ve=Object.getPrototypeOf,Ue=Object.prototype;function Ke(e,t,n){if("string"!=typeof t){if(Ue){var r=Ve(t);r&&r!==Ue&&Ke(e,r,n)}var o=He(t);We&&(o=o.concat(We(t)));for(var i=Be(e),a=Be(t),s=0;s<o.length;++s){var l=o[s];if(!(l in ze||n&&n[l]||a&&l in a||i&&l in i)){var c=qe(t,l);try{$e(e,l,c)}catch(e){}}}}return e}function Qe(e){return"function"==typeof e}function Ge(e){return"object"==typeof e&&"styledComponentId"in e}function Ye(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function Ze(e,t){if(0===e.length)return"";for(var n=e[0],r=1;r<e.length;r++)n+=t?t+e[r]:e[r];return n}function Xe(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function Je(e,t,n){if(void 0===n&&(n=!1),!n&&!Xe(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var r=0;r<t.length;r++)e[r]=Je(e[r],t[r]);else if(Xe(t))for(var r in t)e[r]=Je(e[r],t[r]);return e}function et(e,t){Object.defineProperty(e,"toString",{value:t})}function tt(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):""))}var nt=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return e.prototype.indexOfGroup=function(e){for(var t=0,n=0;n<e;n++)t+=this.groupSizes[n];return t},e.prototype.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,o=r;e>=o;)if((o<<=1)<0)throw tt(16,"".concat(e));this.groupSizes=new Uint32Array(o),this.groupSizes.set(n),this.length=o;for(var i=r;i<o;i++)this.groupSizes[i]=0}for(var a=this.indexOfGroup(e+1),s=(i=0,t.length);i<s;i++)this.tag.insertRule(a,t[i])&&(this.groupSizes[e]++,a++)},e.prototype.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),r=n+t;this.groupSizes[e]=0;for(var o=n;o<r;o++)this.tag.deleteRule(n)}},e.prototype.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),o=r+n,i=r;i<o;i++)t+="".concat(this.tag.getRule(i)).concat(fe);return t},e}(),rt=new Map,ot=new Map,it=1,at=function(e){if(rt.has(e))return rt.get(e);for(;ot.has(it);)it++;var t=it++;return rt.set(e,t),ot.set(t,e),t},st=function(e,t){it=t+1,rt.set(e,t),ot.set(t,e)},lt="style[".concat(le,"][").concat(ue,'="').concat(he,'"]'),ct=new RegExp("^".concat(le,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),ut=function(e,t,n){for(var r,o=n.split(","),i=0,a=o.length;i<a;i++)(r=o[i])&&e.registerName(t,r)},ht=function(e,t){for(var n,r=(null!==(n=t.textContent)&&void 0!==n?n:"").split(fe),o=[],i=0,a=r.length;i<a;i++){var s=r[i].trim();if(s){var l=s.match(ct);if(l){var c=0|parseInt(l[1],10),u=l[2];0!==c&&(st(u,c),ut(e,u,l[3]),e.getTag().insertRules(c,o)),o.length=0}else o.push(s)}}},ft=function(e){for(var t=document.querySelectorAll(lt),n=0,r=t.length;n<r;n++){var o=t[n];o&&o.getAttribute(le)!==ce&&(ht(e,o),o.parentNode&&o.parentNode.removeChild(o))}};function dt(){return n.nc}var pt=function(e){var t=document.head,n=e||t,r=document.createElement("style"),o=function(e){var t=Array.from(e.querySelectorAll("style[".concat(le,"]")));return t[t.length-1]}(n),i=void 0!==o?o.nextSibling:null;r.setAttribute(le,ce),r.setAttribute(ue,he);var a=dt();return a&&r.setAttribute("nonce",a),n.insertBefore(r,i),r},mt=function(){function e(e){this.element=pt(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n<r;n++){var o=t[n];if(o.ownerNode===e)return o}throw tt(17)}(this.element),this.length=0}return e.prototype.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}},e.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},e.prototype.getRule=function(e){var t=this.sheet.cssRules[e];return t&&t.cssText?t.cssText:""},e}(),gt=function(){function e(e){this.element=pt(e),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t);return this.element.insertBefore(n,this.nodes[e]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},e.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),yt=function(){function e(e){this.rules=[],this.length=0}return e.prototype.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},e.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--},e.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),vt=de,bt={isServer:!de,useCSSOMInjection:!pe},xt=function(){function e(e,t,n){void 0===e&&(e=ye),void 0===t&&(t={});var o=this;this.options=r(r({},bt),e),this.gs=t,this.names=new Map(n),this.server=!!e.isServer,!this.server&&de&&vt&&(vt=!1,ft(this)),et(this,(function(){return function(e){for(var t=e.getTag(),n=t.length,r="",o=function(n){var o=function(e){return ot.get(e)}(n);if(void 0===o)return"continue";var i=e.names.get(o),a=t.getGroup(n);if(void 0===i||!i.size||0===a.length)return"continue";var s="".concat(le,".g").concat(n,'[id="').concat(o,'"]'),l="";void 0!==i&&i.forEach((function(e){e.length>0&&(l+="".concat(e,","))})),r+="".concat(a).concat(s,'{content:"').concat(l,'"}').concat(fe)},i=0;i<n;i++)o(i);return r}(o)}))}return e.registerId=function(e){return at(e)},e.prototype.rehydrate=function(){!this.server&&de&&ft(this)},e.prototype.reconstructWithOptions=function(t,n){return void 0===n&&(n=!0),new e(r(r({},this.options),t),this.gs,n&&this.names||void 0)},e.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(e=function(e){var t=e.useCSSOMInjection,n=e.target;return e.isServer?new yt(n):t?new mt(n):new gt(n)}(this.options),new nt(e)));var e},e.prototype.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},e.prototype.registerName=function(e,t){if(at(e),this.names.has(e))this.names.get(e).add(t);else{var n=new Set;n.add(t),this.names.set(e,n)}},e.prototype.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(at(e),n)},e.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},e.prototype.clearRules=function(e){this.getTag().clearGroup(at(e)),this.clearNames(e)},e.prototype.clearTag=function(){this.tag=void 0},e}(),wt=/&/g,kt=/^\s*\/\/.*$/gm;function St(e,t){return e.map((function(e){return"rule"===e.type&&(e.value="".concat(t," ").concat(e.value),e.value=e.value.replaceAll(",",",".concat(t," ")),e.props=e.props.map((function(e){return"".concat(t," ").concat(e)}))),Array.isArray(e.children)&&"@keyframes"!==e.type&&(e.children=St(e.children,t)),e}))}function Ot(e){var t,n,r,o=void 0===e?ye:e,i=o.options,a=void 0===i?ye:i,s=o.plugins,l=void 0===s?ge:s,c=function(e,r,o){return o.startsWith(n)&&o.endsWith(n)&&o.replaceAll(n,"").length>0?".".concat(t):e},u=l.slice();u.push((function(e){e.type===d&&e.value.includes("&")&&(e.props[0]=e.props[0].replace(wt,n).replace(r,c))})),a.prefix&&u.push(te),u.push(J);var h=function(e,o,i,s){void 0===o&&(o=""),void 0===i&&(i=""),void 0===s&&(s="&"),t=s,n=o,r=new RegExp("\\".concat(n,"\\b"),"g");var l=e.replace(kt,""),c=ne(i||o?"".concat(i," ").concat(o," { ").concat(l," }"):l);a.namespace&&(c=St(c,a.namespace));var h,f,d,p=[];return X(c,(h=u.concat((d=function(e){return p.push(e)},function(e){e.root||(e=e.return)&&d(e)})),f=A(h),function(e,t,n,r){for(var o="",i=0;i<f;i++)o+=h[i](e,t,n,r)||"";return o})),p};return h.hash=l.length?l.reduce((function(e,t){return t.name||tt(15),je(e,t.name)}),Ae).toString():"",h}var _t=new xt,Et=Ot(),Ct=a().createContext({shouldForwardProp:void 0,styleSheet:_t,stylis:Et}),At=(Ct.Consumer,a().createContext(void 0));function jt(){return(0,i.useContext)(Ct)}function Pt(e){var t=(0,i.useState)(e.stylisPlugins),n=t[0],r=t[1],o=jt().styleSheet,s=(0,i.useMemo)((function(){var t=o;return e.sheet?t=e.sheet:e.target&&(t=t.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(t=t.reconstructWithOptions({useCSSOMInjection:!1})),t}),[e.disableCSSOMInjection,e.sheet,e.target,o]),c=(0,i.useMemo)((function(){return Ot({options:{namespace:e.namespace,prefix:e.enableVendorPrefixes},plugins:n})}),[e.enableVendorPrefixes,e.namespace,n]);(0,i.useEffect)((function(){l()(n,e.stylisPlugins)||r(e.stylisPlugins)}),[e.stylisPlugins]);var u=(0,i.useMemo)((function(){return{shouldForwardProp:e.shouldForwardProp,styleSheet:s,stylis:c}}),[e.shouldForwardProp,s,c]);return a().createElement(Ct.Provider,{value:u},a().createElement(At.Provider,{value:c},e.children))}var Mt=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=Et);var r=n.name+t.hash;e.hasNameForId(n.id,r)||e.insertRules(n.id,r,t(n.rules,r,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,et(this,(function(){throw tt(12,String(n.name))}))}return e.prototype.getName=function(e){return void 0===e&&(e=Et),this.name+e.hash},e}(),Rt=function(e){return e>="A"&&e<="Z"};function Tt(e){for(var t="",n=0;n<e.length;n++){var r=e[n];if(1===n&&"-"===r&&"-"===e[0])return e;Rt(r)?t+="-"+r.toLowerCase():t+=r}return t.startsWith("ms-")?"-"+t:t}var Lt=function(e){return null==e||!1===e||""===e},It=function(e){var t,n,r=[];for(var i in e){var a=e[i];e.hasOwnProperty(i)&&!Lt(a)&&(Array.isArray(a)&&a.isCss||Qe(a)?r.push("".concat(Tt(i),":"),a,";"):Xe(a)?r.push.apply(r,o(o(["".concat(i," {")],It(a),!1),["}"],!1)):r.push("".concat(Tt(i),": ").concat((t=i,null==(n=a)||"boolean"==typeof n||""===n?"":"number"!=typeof n||0===n||t in se.A||t.startsWith("--")?String(n).trim():"".concat(n,"px")),";")))}return r};function Nt(e,t,n,r){return Lt(e)?[]:Ge(e)?[".".concat(e.styledComponentId)]:Qe(e)?!Qe(o=e)||o.prototype&&o.prototype.isReactComponent||!t?[e]:Nt(e(t),t,n,r):e instanceof Mt?n?(e.inject(n,r),[e.getName(r)]):[e]:Xe(e)?It(e):Array.isArray(e)?Array.prototype.concat.apply(ge,e.map((function(e){return Nt(e,t,n,r)}))):[e.toString()];var o}function zt(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(Qe(n)&&!Ge(n))return!1}return!0}var Dt=Pe(he),Ft=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic=(void 0===n||n.isStatic)&&zt(e),this.componentId=t,this.baseHash=je(Dt,t),this.baseStyle=n,xt.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,n){var r=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(this.componentId,this.staticRulesId))r=Ye(r,this.staticRulesId);else{var o=Ze(Nt(this.rules,e,t,n)),i=Ee(je(this.baseHash,o)>>>0);if(!t.hasNameForId(this.componentId,i)){var a=n(o,".".concat(i),void 0,this.componentId);t.insertRules(this.componentId,i,a)}r=Ye(r,i),this.staticRulesId=i}else{for(var s=je(this.baseHash,n.hash),l="",c=0;c<this.rules.length;c++){var u=this.rules[c];if("string"==typeof u)l+=u;else if(u){var h=Ze(Nt(u,e,t,n));s=je(s,h+c),l+=h}}if(l){var f=Ee(s>>>0);t.hasNameForId(this.componentId,f)||t.insertRules(this.componentId,f,n(l,".".concat(f),void 0,this.componentId)),r=Ye(r,f)}}return r},e}(),Bt=a().createContext(void 0);Bt.Consumer;var $t={};function Ht(e,t,n){var o=Ge(e),s=e,l=!Re(e),c=t.attrs,u=void 0===c?ge:c,h=t.componentId,f=void 0===h?function(e,t){var n="string"!=typeof e?"sc":ke(e);$t[n]=($t[n]||0)+1;var r="".concat(n,"-").concat(Me(he+n+$t[n]));return t?"".concat(t,"-").concat(r):r}(t.displayName,t.parentComponentId):h,d=t.displayName,p=void 0===d?function(e){return Re(e)?"styled.".concat(e):"Styled(".concat(function(e){return e.displayName||e.name||"Component"}(e),")")}(e):d,m=t.displayName&&t.componentId?"".concat(ke(t.displayName),"-").concat(t.componentId):t.componentId||f,g=o&&s.attrs?s.attrs.concat(u).filter(Boolean):u,y=t.shouldForwardProp;if(o&&s.shouldForwardProp){var v=s.shouldForwardProp;if(t.shouldForwardProp){var b=t.shouldForwardProp;y=function(e,t){return v(e,t)&&b(e,t)}}else y=v}var x=new Ft(n,m,o?s.componentStyle:void 0);function w(e,t){return function(e,t,n){var o=e.attrs,s=e.componentStyle,l=e.defaultProps,c=e.foldedComponentIds,u=e.styledComponentId,h=e.target,f=a().useContext(Bt),d=jt(),p=e.shouldForwardProp||d.shouldForwardProp,m=ve(t,f,l)||ye,g=function(e,t,n){for(var o,i=r(r({},t),{className:void 0,theme:n}),a=0;a<e.length;a+=1){var s=Qe(o=e[a])?o(i):o;for(var l in s)i[l]="className"===l?Ye(i[l],s[l]):"style"===l?r(r({},i[l]),s[l]):s[l]}return t.className&&(i.className=Ye(i.className,t.className)),i}(o,t,m),y=g.as||h,v={};for(var b in g)void 0===g[b]||"$"===b[0]||"as"===b||"theme"===b&&g.theme===m||("forwardedAs"===b?v.as=g.forwardedAs:p&&!p(b,y)||(v[b]=g[b]));var x=function(e,t){var n=jt();return e.generateAndInjectStyles(t,n.styleSheet,n.stylis)}(s,g),w=Ye(c,u);return x&&(w+=" "+x),g.className&&(w+=" "+g.className),v[Re(y)&&!be.has(y)?"class":"className"]=w,v.ref=n,(0,i.createElement)(y,v)}(k,e,t)}w.displayName=p;var k=a().forwardRef(w);return k.attrs=g,k.componentStyle=x,k.displayName=p,k.shouldForwardProp=y,k.foldedComponentIds=o?Ye(s.foldedComponentIds,s.styledComponentId):"",k.styledComponentId=m,k.target=o?s.target:e,Object.defineProperty(k,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=o?function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=0,o=t;r<o.length;r++)Je(e,o[r],!0);return e}({},s.defaultProps,e):e}}),et(k,(function(){return".".concat(k.styledComponentId)})),l&&Ke(k,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),k}function Wt(e,t){for(var n=[e[0]],r=0,o=t.length;r<o;r+=1)n.push(t[r],e[r+1]);return n}new Set;var qt=function(e){return Object.assign(e,{isCss:!0})};function Vt(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(Qe(e)||Xe(e))return qt(Nt(Wt(ge,o([e],t,!0))));var r=e;return 0===t.length&&1===r.length&&"string"==typeof r[0]?Nt(r):qt(Nt(Wt(r,t)))}function Ut(e,t,n){if(void 0===n&&(n=ye),!t)throw tt(1,t);var i=function(r){for(var i=[],a=1;a<arguments.length;a++)i[a-1]=arguments[a];return e(t,n,Vt.apply(void 0,o([r],i,!1)))};return i.attrs=function(o){return Ut(e,t,r(r({},n),{attrs:Array.prototype.concat(n.attrs,o).filter(Boolean)}))},i.withConfig=function(o){return Ut(e,t,r(r({},n),o))},i}var Kt=function(e){return Ut(Ht,e)},Qt=Kt;be.forEach((function(e){Qt[e]=Kt(e)}));var Gt=function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=zt(e),xt.registerId(this.componentId+1)}return e.prototype.createStyles=function(e,t,n,r){var o=r(Ze(Nt(this.rules,t,n,r)),""),i=this.componentId+e;n.insertRules(i,i,o)},e.prototype.removeStyles=function(e,t){t.clearRules(this.componentId+e)},e.prototype.renderStyles=function(e,t,n,r){e>2&&xt.registerId(this.componentId+e),this.removeStyles(e,n),this.createStyles(e,t,n,r)},e}();function Yt(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=Vt.apply(void 0,o([e],t,!1)),s="sc-global-".concat(Me(JSON.stringify(i))),l=new Gt(i,s),c=function(e){var t=jt(),n=a().useContext(Bt),r=a().useRef(t.styleSheet.allocateGSInstance(s)).current;return t.styleSheet.server&&u(r,e,t.styleSheet,n,t.stylis),a().useLayoutEffect((function(){if(!t.styleSheet.server)return u(r,e,t.styleSheet,n,t.stylis),function(){return l.removeStyles(r,t.styleSheet)}}),[r,e,t.styleSheet,n,t.stylis]),null};function u(e,t,n,o,i){if(l.isStatic)l.renderStyles(e,me,n,i);else{var a=r(r({},t),{theme:ve(t,o,c.defaultProps)});l.renderStyles(e,a,n,i)}}return a().memo(c)}(function(){function e(){var e=this;this._emitSheetCSS=function(){var t=e.instance.toString();if(!t)return"";var n=dt(),r=Ze([n&&'nonce="'.concat(n,'"'),"".concat(le,'="true"'),"".concat(ue,'="').concat(he,'"')].filter(Boolean)," ");return"<style ".concat(r,">").concat(t,"</style>")},this.getStyleTags=function(){if(e.sealed)throw tt(2);return e._emitSheetCSS()},this.getStyleElement=function(){var t;if(e.sealed)throw tt(2);var n=e.instance.toString();if(!n)return[];var o=((t={})[le]="",t[ue]=he,t.dangerouslySetInnerHTML={__html:n},t),i=dt();return i&&(o.nonce=i),[a().createElement("style",r({},o,{key:"sc-0-0"}))]},this.seal=function(){e.sealed=!0},this.instance=new xt({isServer:!0}),this.sealed=!1}e.prototype.collectStyles=function(e){if(this.sealed)throw tt(2);return a().createElement(Pt,{sheet:this.instance},e)},e.prototype.interleaveWithNodeStream=function(e){throw tt(3)}})(),"__sc-".concat(le,"__")},6426:e=>{e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}}},1063:(e,t,n)=>{"use strict";var r=n(1594),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=r.useState,a=r.useEffect,s=r.useLayoutEffect,l=r.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),o=r[0].inst,u=r[1];return s((function(){o.value=n,o.getSnapshot=t,c(o)&&u({inst:o})}),[e,n,t]),a((function(){return c(o)&&u({inst:o}),e((function(){c(o)&&u({inst:o})}))}),[e]),l(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},8940:(e,t,n)=>{"use strict";var r=n(1594),o=n(9888),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=o.useSyncExternalStore,s=r.useRef,l=r.useEffect,c=r.useMemo,u=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var h=s(null);if(null===h.current){var f={hasValue:!1,value:null};h.current=f}else f=h.current;h=c((function(){function e(e){if(!l){if(l=!0,a=e,e=r(e),void 0!==o&&f.hasValue){var t=f.value;if(o(t,e))return s=t}return s=e}if(t=s,i(a,e))return t;var n=r(e);return void 0!==o&&o(t,n)?t:(a=e,s=n)}var a,s,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]}),[t,n,r,o]);var d=a(e,h[0],h[1]);return l((function(){f.hasValue=!0,f.value=d}),[d]),u(d),d}},9888:(e,t,n)=>{"use strict";e.exports=n(1063)},9242:(e,t,n)=>{"use strict";e.exports=n(8940)},4634:e=>{function t(){return e.exports=t=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},e.exports.__esModule=!0,e.exports.default=e.exports,t.apply(this,arguments)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4994:e=>{e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports},4893:e=>{e.exports=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.exports.__esModule=!0,e.exports.default=e.exports},8168:(e,t,n)=>{"use strict";function r(){return r=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},r.apply(this,arguments)}n.d(t,{A:()=>r})},8587:(e,t,n)=>{"use strict";function r(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}n.d(t,{A:()=>r})},9658:(e,t,n)=>{"use strict";n.d(t,{m:()=>i});var r=n(6500),o=n(4880),i=new class extends r.Q{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!o.S$&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e((e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()}))}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){this.listeners.forEach((e=>{e()}))}isFocused(){return"boolean"==typeof this.#e?this.#e:"hidden"!==globalThis.document?.visibilityState}}},6158:(e,t,n)=>{"use strict";n.d(t,{$:()=>s,s:()=>a});var r=n(6261),o=n(1692),i=n(8904),a=class extends o.k{#r;#o;#i;#a;constructor(e){super(),this.mutationId=e.mutationId,this.#o=e.defaultOptions,this.#i=e.mutationCache,this.#r=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options={...this.#o,...e},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#r.includes(e)||(this.#r.push(e),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#r=this.#r.filter((t=>t!==e)),this.scheduleGc(),this.#i.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#r.length||("pending"===this.state.status?this.scheduleGc():this.#i.remove(this))}continue(){return this.#a?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>(this.#a=(0,i.II)({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(e,t)=>{this.#s({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode}),this.#a.promise),n="pending"===this.state.status;try{if(!n){this.#s({type:"pending",variables:e}),await(this.#i.config.onMutate?.(e,this));const t=await(this.options.onMutate?.(e));t!==this.state.context&&this.#s({type:"pending",context:t,variables:e})}const r=await t();return await(this.#i.config.onSuccess?.(r,e,this.state.context,this)),await(this.options.onSuccess?.(r,e,this.state.context)),await(this.#i.config.onSettled?.(r,null,this.state.variables,this.state.context,this)),await(this.options.onSettled?.(r,null,e,this.state.context)),this.#s({type:"success",data:r}),r}catch(t){try{throw await(this.#i.config.onError?.(t,e,this.state.context,this)),await(this.options.onError?.(t,e,this.state.context)),await(this.#i.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this)),await(this.options.onSettled?.(void 0,t,e,this.state.context)),t}finally{this.#s({type:"error",error:t})}}}#s(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!(0,i.v_)(this.options.networkMode),status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),r.j.batch((()=>{this.#r.forEach((t=>{t.onMutationUpdate(e)})),this.#i.notify({mutation:this,type:"updated",action:e})}))}};function s(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},6261:(e,t,n)=>{"use strict";n.d(t,{j:()=>r});var r=function(){let e=[],t=0,n=e=>{e()},r=e=>{e()},o=e=>setTimeout(e,0);const i=r=>{t?e.push(r):o((()=>{n(r)}))};return{batch:i=>{let a;t++;try{a=i()}finally{t--,t||(()=>{const t=e;e=[],t.length&&o((()=>{r((()=>{t.forEach((e=>{n(e)}))}))}))})()}return a},batchCalls:e=>(...t)=>{i((()=>{e(...t)}))},schedule:i,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{o=e}}}()},6035:(e,t,n)=>{"use strict";n.d(t,{t:()=>i});var r=n(6500),o=n(4880),i=new class extends r.Q{#l=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!o.S$&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#l!==e&&(this.#l=e,this.listeners.forEach((t=>{t(e)})))}isOnline(){return this.#l}}},5323:(e,t,n)=>{"use strict";n.d(t,{E:()=>g});var r=n(4880),o=n(6261),i=n(8904),a=n(1692),s=class extends a.k{#c;#u;#h;#f;#a;#r;#o;#d;constructor(e){super(),this.#d=!1,this.#o=e.defaultOptions,this.#p(e.options),this.#r=[],this.#h=e.cache,this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#c=e.state||function(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,n=void 0!==t,r=n?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}(this.options),this.state=this.#c,this.scheduleGc()}get meta(){return this.options.meta}#p(e){this.options={...this.#o,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){this.#r.length||"idle"!==this.state.fetchStatus||this.#h.remove(this)}setData(e,t){const n=(0,r.pl)(this.state.data,e,this.options);return this.#s({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#s({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#f;return this.#a?.cancel(e),t?t.then(r.lQ).catch(r.lQ):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#c)}isActive(){return this.#r.some((e=>!1!==e.options.enabled))}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||void 0===this.state.data||this.#r.some((e=>e.getCurrentResult().isStale))}isStaleByTime(e=0){return this.state.isInvalidated||void 0===this.state.data||!(0,r.j3)(this.state.dataUpdatedAt,e)}onFocus(){const e=this.#r.find((e=>e.shouldFetchOnWindowFocus()));e?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){const e=this.#r.find((e=>e.shouldFetchOnReconnect()));e?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.#r.includes(e)||(this.#r.push(e),this.clearGcTimeout(),this.#h.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.#r.includes(e)&&(this.#r=this.#r.filter((t=>t!==e)),this.#r.length||(this.#a&&(this.#d?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#h.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.#r.length}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}fetch(e,t){if("idle"!==this.state.fetchStatus)if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#f)return this.#a?.continueRetry(),this.#f;if(e&&this.#p(e),!this.options.queryFn){const e=this.#r.find((e=>e.options.queryFn));e&&this.#p(e.options)}const n=new AbortController,o={queryKey:this.queryKey,meta:this.meta},a=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#d=!0,n.signal)})};a(o);const s={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:()=>this.options.queryFn&&this.options.queryFn!==r.hT?(this.#d=!1,this.options.persister?this.options.persister(this.options.queryFn,o,this):this.options.queryFn(o)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`))};a(s),this.options.behavior?.onFetch(s,this),this.#u=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===s.fetchOptions?.meta||this.#s({type:"fetch",meta:s.fetchOptions?.meta});const l=e=>{(0,i.wm)(e)&&e.silent||this.#s({type:"error",error:e}),(0,i.wm)(e)||(this.#h.config.onError?.(e,this),this.#h.config.onSettled?.(this.state.data,e,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return this.#a=(0,i.II)({fn:s.fetchFn,abort:n.abort.bind(n),onSuccess:e=>{void 0!==e?(this.setData(e),this.#h.config.onSuccess?.(e,this),this.#h.config.onSettled?.(e,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1):l(new Error(`${this.queryHash} data is undefined`))},onError:l,onFail:(e,t)=>{this.#s({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode}),this.#f=this.#a.promise,this.#f}#s(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:e.meta??null,fetchStatus:(0,i.v_)(this.options.networkMode)?"fetching":"paused",...void 0===t.data&&{error:null,status:"pending"}};case"success":return{...t,data:e.data,dataUpdateCount:t.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=e.error;return(0,i.wm)(n)&&n.revert&&this.#u?{...this.#u,fetchStatus:"idle"}:{...t,error:n,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),o.j.batch((()=>{this.#r.forEach((e=>{e.onQueryUpdate()})),this.#h.notify({query:this,type:"updated",action:e})}))}},l=n(6500),c=class extends l.Q{constructor(e={}){super(),this.config=e,this.#m=new Map}#m;build(e,t,n){const o=t.queryKey,i=t.queryHash??(0,r.F$)(o,t);let a=this.get(i);return a||(a=new s({cache:this,queryKey:o,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(o)}),this.add(a)),a}add(e){this.#m.has(e.queryHash)||(this.#m.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#m.get(e.queryHash);t&&(e.destroy(),t===e&&this.#m.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){o.j.batch((()=>{this.getAll().forEach((e=>{this.remove(e)}))}))}get(e){return this.#m.get(e)}getAll(){return[...this.#m.values()]}find(e){const t={exact:!0,...e};return this.getAll().find((e=>(0,r.MK)(t,e)))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter((t=>(0,r.MK)(e,t))):t}notify(e){o.j.batch((()=>{this.listeners.forEach((t=>{t(e)}))}))}onFocus(){o.j.batch((()=>{this.getAll().forEach((e=>{e.onFocus()}))}))}onOnline(){o.j.batch((()=>{this.getAll().forEach((e=>{e.onOnline()}))}))}},u=n(6158),h=class extends l.Q{constructor(e={}){super(),this.config=e,this.#g=[],this.#y=0}#g;#y;#v;build(e,t,n){const r=new u.s({mutationCache:this,mutationId:++this.#y,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#g.push(e),this.notify({type:"added",mutation:e})}remove(e){this.#g=this.#g.filter((t=>t!==e)),this.notify({type:"removed",mutation:e})}clear(){o.j.batch((()=>{this.#g.forEach((e=>{this.remove(e)}))}))}getAll(){return this.#g}find(e){const t={exact:!0,...e};return this.#g.find((e=>(0,r.nJ)(t,e)))}findAll(e={}){return this.#g.filter((t=>(0,r.nJ)(e,t)))}notify(e){o.j.batch((()=>{this.listeners.forEach((t=>{t(e)}))}))}resumePausedMutations(){return this.#v=(this.#v??Promise.resolve()).then((()=>{const e=this.#g.filter((e=>e.state.isPaused));return o.j.batch((()=>e.reduce(((e,t)=>e.then((()=>t.continue().catch(r.lQ)))),Promise.resolve())))})).then((()=>{this.#v=void 0})),this.#v}},f=n(9658),d=n(6035);function p(e,{pages:t,pageParams:n}){const r=t.length-1;return e.getNextPageParam(t[r],t,n[r],n)}function m(e,{pages:t,pageParams:n}){return e.getPreviousPageParam?.(t[0],t,n[0],n)}var g=class{#b;#i;#o;#x;#w;#k;#S;#O;constructor(e={}){this.#b=e.queryCache||new c,this.#i=e.mutationCache||new h,this.#o=e.defaultOptions||{},this.#x=new Map,this.#w=new Map,this.#k=0}mount(){this.#k++,1===this.#k&&(this.#S=f.m.subscribe((()=>{f.m.isFocused()&&(this.resumePausedMutations(),this.#b.onFocus())})),this.#O=d.t.subscribe((e=>{e&&(this.resumePausedMutations(),this.#b.onOnline())})))}unmount(){this.#k--,0===this.#k&&(this.#S?.(),this.#S=void 0,this.#O?.(),this.#O=void 0)}isFetching(e){return this.#b.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#i.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#b.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);return void 0!==t?Promise.resolve(t):this.fetchQuery(e)}getQueriesData(e){return this.getQueryCache().findAll(e).map((({queryKey:e,state:t})=>[e,t.data]))}setQueryData(e,t,n){const o=this.defaultQueryOptions({queryKey:e}),i=this.#b.get(o.queryHash),a=i?.state.data,s=(0,r.Zw)(t,a);if(void 0!==s)return this.#b.build(this,o).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return o.j.batch((()=>this.getQueryCache().findAll(e).map((({queryKey:e})=>[e,this.setQueryData(e,t,n)]))))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#b.get(t.queryHash)?.state}removeQueries(e){const t=this.#b;o.j.batch((()=>{t.findAll(e).forEach((e=>{t.remove(e)}))}))}resetQueries(e,t){const n=this.#b,r={type:"active",...e};return o.j.batch((()=>(n.findAll(e).forEach((e=>{e.reset()})),this.refetchQueries(r,t))))}cancelQueries(e={},t={}){const n={revert:!0,...t},i=o.j.batch((()=>this.#b.findAll(e).map((e=>e.cancel(n)))));return Promise.all(i).then(r.lQ).catch(r.lQ)}invalidateQueries(e={},t={}){return o.j.batch((()=>{if(this.#b.findAll(e).forEach((e=>{e.invalidate()})),"none"===e.refetchType)return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)}))}refetchQueries(e={},t){const n={...t,cancelRefetch:t?.cancelRefetch??!0},i=o.j.batch((()=>this.#b.findAll(e).filter((e=>!e.isDisabled())).map((e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(r.lQ)),"paused"===e.state.fetchStatus?Promise.resolve():t}))));return Promise.all(i).then(r.lQ)}fetchQuery(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const n=this.#b.build(this,t);return n.isStaleByTime(t.staleTime)?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(r.lQ).catch(r.lQ)}fetchInfiniteQuery(e){return e.behavior=(t=e.pages,{onFetch:(e,n)=>{const o=async()=>{const n=e.options,o=e.fetchOptions?.meta?.fetchMore?.direction,i=e.state.data?.pages||[],a=e.state.data?.pageParams||[],s={pages:[],pageParams:[]};let l=!1;const c=e.options.queryFn&&e.options.queryFn!==r.hT?e.options.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${e.options.queryHash}'`)),u=async(t,n,o)=>{if(l)return Promise.reject();if(null==n&&t.pages.length)return Promise.resolve(t);const i={queryKey:e.queryKey,pageParam:n,direction:o?"backward":"forward",meta:e.options.meta};var a;a=i,Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(e.signal.aborted?l=!0:e.signal.addEventListener("abort",(()=>{l=!0})),e.signal)});const s=await c(i),{maxPages:u}=e.options,h=o?r.ZZ:r.y9;return{pages:h(t.pages,s,u),pageParams:h(t.pageParams,n,u)}};let h;if(o&&i.length){const e="backward"===o,t={pages:i,pageParams:a},r=(e?m:p)(n,t);h=await u(t,r,e)}else{h=await u(s,a[0]??n.initialPageParam);const e=t??i.length;for(let t=1;t<e;t++){const e=p(n,h);h=await u(h,e)}}return h};e.options.persister?e.fetchFn=()=>e.options.persister?.(o,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n):e.fetchFn=o}}),this.fetchQuery(e);var t}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(r.lQ).catch(r.lQ)}resumePausedMutations(){return d.t.isOnline()?this.#i.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#b}getMutationCache(){return this.#i}getDefaultOptions(){return this.#o}setDefaultOptions(e){this.#o=e}setQueryDefaults(e,t){this.#x.set((0,r.EN)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#x.values()];let n={};return t.forEach((t=>{(0,r.Cp)(e,t.queryKey)&&(n={...n,...t.defaultOptions})})),n}setMutationDefaults(e,t){this.#w.set((0,r.EN)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#w.values()];let n={};return t.forEach((t=>{(0,r.Cp)(e,t.mutationKey)&&(n={...n,...t.defaultOptions})})),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#o.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,r.F$)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),!0!==t.enabled&&t.queryFn===r.hT&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#o.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#b.clear(),this.#i.clear()}}},1692:(e,t,n)=>{"use strict";n.d(t,{k:()=>o});var r=n(4880),o=class{#_;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),(0,r.gn)(this.gcTime)&&(this.#_=setTimeout((()=>{this.optionalRemove()}),this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(r.S$?1/0:3e5))}clearGcTimeout(){this.#_&&(clearTimeout(this.#_),this.#_=void 0)}}},8904:(e,t,n)=>{"use strict";n.d(t,{II:()=>u,v_:()=>s,wm:()=>c});var r=n(9658),o=n(6035),i=n(4880);function a(e){return Math.min(1e3*2**e,3e4)}function s(e){return"online"!==(e??"online")||o.t.isOnline()}var l=class{constructor(e){this.revert=e?.revert,this.silent=e?.silent}};function c(e){return e instanceof l}function u(e){let t,n,c,u=!1,h=0,f=!1;const d=new Promise(((e,t)=>{n=e,c=t})),p=()=>!r.m.isFocused()||"always"!==e.networkMode&&!o.t.isOnline(),m=r=>{f||(f=!0,e.onSuccess?.(r),t?.(),n(r))},g=n=>{f||(f=!0,e.onError?.(n),t?.(),c(n))},y=()=>new Promise((n=>{t=e=>{const t=f||!p();return t&&n(e),t},e.onPause?.()})).then((()=>{t=void 0,f||e.onContinue?.()})),v=()=>{if(f)return;let t;try{t=e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(m).catch((t=>{if(f)return;const n=e.retry??(i.S$?0:3),r=e.retryDelay??a,o="function"==typeof r?r(h,t):r,s=!0===n||"number"==typeof n&&h<n||"function"==typeof n&&n(h,t);!u&&s?(h++,e.onFail?.(h,t),(0,i.yy)(o).then((()=>{if(p())return y()})).then((()=>{u?g(t):v()}))):g(t)}))};return s(e.networkMode)?v():y().then(v),{promise:d,cancel:t=>{f||(g(new l(t)),e.abort?.())},continue:()=>{const e=t?.();return e?d:Promise.resolve()},cancelRetry:()=>{u=!0},continueRetry:()=>{u=!1}}}},6500:(e,t,n)=>{"use strict";n.d(t,{Q:()=>r});var r=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}},4880:(e,t,n)=>{"use strict";n.d(t,{Cp:()=>f,EN:()=>h,F$:()=>u,MK:()=>l,S$:()=>r,ZZ:()=>w,Zw:()=>i,f8:()=>p,gn:()=>a,hT:()=>k,j3:()=>s,lQ:()=>o,nJ:()=>c,pl:()=>b,y9:()=>x,yy:()=>v});var r="undefined"==typeof window||"Deno"in window;function o(){}function i(e,t){return"function"==typeof e?e(t):e}function a(e){return"number"==typeof e&&e>=0&&e!==1/0}function s(e,t){return Math.max(e+(t||0)-Date.now(),0)}function l(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:a,stale:s}=e;if(a)if(r){if(t.queryHash!==u(a,t.options))return!1}else if(!f(t.queryKey,a))return!1;if("all"!==n){const e=t.isActive();if("active"===n&&!e)return!1;if("inactive"===n&&e)return!1}return!("boolean"==typeof s&&t.isStale()!==s||o&&o!==t.state.fetchStatus||i&&!i(t))}function c(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(h(t.options.mutationKey)!==h(i))return!1}else if(!f(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function u(e,t){return(t?.queryKeyHashFn||h)(e)}function h(e){return JSON.stringify(e,((e,t)=>g(t)?Object.keys(t).sort().reduce(((e,n)=>(e[n]=t[n],e)),{}):t))}function f(e,t){return e===t||typeof e==typeof t&&!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&!Object.keys(t).some((n=>!f(e[n],t[n])))}function d(e,t){if(e===t)return e;const n=m(e)&&m(t);if(n||g(e)&&g(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),a=i.length,s=n?[]:{};let l=0;for(let o=0;o<a;o++){const a=n?o:i[o];!n&&void 0===e[a]&&void 0===t[a]&&r.includes(a)?(s[a]=void 0,l++):(s[a]=d(e[a],t[a]),s[a]===e[a]&&void 0!==e[a]&&l++)}return o===a&&l===o?e:s}return t}function p(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function m(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function g(e){if(!y(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!!y(n)&&!!n.hasOwnProperty("isPrototypeOf")}function y(e){return"[object Object]"===Object.prototype.toString.call(e)}function v(e){return new Promise((t=>{setTimeout(t,e)}))}function b(e,t,n){return"function"==typeof n.structuralSharing?n.structuralSharing(e,t):!1!==n.structuralSharing?d(e,t):t}function x(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function w(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var k=Symbol()},7665:(e,t,n)=>{"use strict";n.d(t,{Ht:()=>s,jE:()=>a});var r=n(1594),o=n(4848),i=r.createContext(void 0),a=e=>{const t=r.useContext(i);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},s=({client:e,children:t})=>(r.useEffect((()=>(e.mount(),()=>{e.unmount()})),[e]),(0,o.jsx)(i.Provider,{value:e,children:t}))},7097:(e,t,n)=>{"use strict";n.d(t,{n:()=>h});var r=n(1594),o=n(6158),i=n(6261),a=n(6500),s=n(4880),l=class extends a.Q{#E;#C=void 0;#A;#j;constructor(e,t){super(),this.#E=e,this.setOptions(t),this.bindMethods(),this.#P()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const t=this.options;this.options=this.#E.defaultMutationOptions(e),(0,s.f8)(this.options,t)||this.#E.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#A,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,s.EN)(t.mutationKey)!==(0,s.EN)(this.options.mutationKey)?this.reset():this.#A?.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#A?.removeObserver(this)}onMutationUpdate(e){this.#P(),this.#M(e)}getCurrentResult(){return this.#C}reset(){this.#A?.removeObserver(this),this.#A=void 0,this.#P(),this.#M()}mutate(e,t){return this.#j=t,this.#A?.removeObserver(this),this.#A=this.#E.getMutationCache().build(this.#E,this.options),this.#A.addObserver(this),this.#A.execute(e)}#P(){const e=this.#A?.state??(0,o.$)();this.#C={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#M(e){i.j.batch((()=>{if(this.#j&&this.hasListeners()){const t=this.#C.variables,n=this.#C.context;"success"===e?.type?(this.#j.onSuccess?.(e.data,t,n),this.#j.onSettled?.(e.data,null,t,n)):"error"===e?.type&&(this.#j.onError?.(e.error,t,n),this.#j.onSettled?.(void 0,e.error,t,n))}this.listeners.forEach((e=>{e(this.#C)}))}))}},c=n(7665),u=n(4362);function h(e,t){const n=(0,c.jE)(t),[o]=r.useState((()=>new l(n,e)));r.useEffect((()=>{o.setOptions(e)}),[o,e]);const a=r.useSyncExternalStore(r.useCallback((e=>o.subscribe(i.j.batchCalls(e))),[o]),(()=>o.getCurrentResult()),(()=>o.getCurrentResult())),s=r.useCallback(((e,t)=>{o.mutate(e,t).catch(u.l)}),[o]);if(a.error&&(0,u.G)(o.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:s,mutateAsync:a.mutate}}},9270:(e,t,n)=>{"use strict";n.d(t,{I:()=>E});var r=n(4880),o=n(6261),i=n(9658),a=n(6500),s=n(8904),l=class extends a.Q{constructor(e,t){super(),this.options=t,this.#E=e,this.#R=null,this.bindMethods(),this.setOptions(t)}#E;#T=void 0;#L=void 0;#C=void 0;#I;#N;#R;#z;#D;#F;#B;#$;#H;#W=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#T.addObserver(this),c(this.#T,this.options)?this.#q():this.updateResult(),this.#V())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return u(this.#T,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return u(this.#T,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#U(),this.#K(),this.#T.removeObserver(this)}setOptions(e,t){const n=this.options,o=this.#T;if(this.options=this.#E.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled)throw new Error("Expected enabled to be a boolean");this.#Q(),(0,r.f8)(this.options,n)||this.#E.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#T,observer:this});const i=this.hasListeners();i&&h(this.#T,o,this.options,n)&&this.#q(),this.updateResult(t),!i||this.#T===o&&this.options.enabled===n.enabled&&this.options.staleTime===n.staleTime||this.#G();const a=this.#Y();!i||this.#T===o&&this.options.enabled===n.enabled&&a===this.#H||this.#Z(a)}getOptimisticResult(e){const t=this.#E.getQueryCache().build(this.#E,e),n=this.createResult(t,e);return o=this,i=n,!(0,r.f8)(o.getCurrentResult(),i)&&(this.#C=n,this.#N=this.options,this.#I=this.#T.state),n;var o,i}getCurrentResult(){return this.#C}trackResult(e,t){const n={};return Object.keys(e).forEach((r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(r),t?.(r),e[r])})})),n}trackProp(e){this.#W.add(e)}getCurrentQuery(){return this.#T}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#E.defaultQueryOptions(e),n=this.#E.getQueryCache().build(this.#E,t);return n.isFetchingOptimistic=!0,n.fetch().then((()=>this.createResult(n,t)))}fetch(e){return this.#q({...e,cancelRefetch:e.cancelRefetch??!0}).then((()=>(this.updateResult(),this.#C)))}#q(e){this.#Q();let t=this.#T.fetch(this.options,e);return e?.throwOnError||(t=t.catch(r.lQ)),t}#G(){if(this.#U(),r.S$||this.#C.isStale||!(0,r.gn)(this.options.staleTime))return;const e=(0,r.j3)(this.#C.dataUpdatedAt,this.options.staleTime)+1;this.#B=setTimeout((()=>{this.#C.isStale||this.updateResult()}),e)}#Y(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#T):this.options.refetchInterval)??!1}#Z(e){this.#K(),this.#H=e,!r.S$&&!1!==this.options.enabled&&(0,r.gn)(this.#H)&&0!==this.#H&&(this.#$=setInterval((()=>{(this.options.refetchIntervalInBackground||i.m.isFocused())&&this.#q()}),this.#H))}#V(){this.#G(),this.#Z(this.#Y())}#U(){this.#B&&(clearTimeout(this.#B),this.#B=void 0)}#K(){this.#$&&(clearInterval(this.#$),this.#$=void 0)}createResult(e,t){const n=this.#T,o=this.options,i=this.#C,a=this.#I,l=this.#N,u=e!==n?e.state:this.#L,{state:d}=e;let p,{error:m,errorUpdatedAt:g,fetchStatus:y,status:v}=d,b=!1;if(t._optimisticResults){const r=this.hasListeners(),i=!r&&c(e,t),a=r&&h(e,n,t,o);(i||a)&&(y=(0,s.v_)(e.options.networkMode)?"fetching":"paused",void 0===d.data&&(v="pending")),"isRestoring"===t._optimisticResults&&(y="idle")}if(t.select&&void 0!==d.data)if(i&&d.data===a?.data&&t.select===this.#z)p=this.#D;else try{this.#z=t.select,p=t.select(d.data),p=(0,r.pl)(i?.data,p,t),this.#D=p,this.#R=null}catch(e){this.#R=e}else p=d.data;if(void 0!==t.placeholderData&&void 0===p&&"pending"===v){let e;if(i?.isPlaceholderData&&t.placeholderData===l?.placeholderData)e=i.data;else if(e="function"==typeof t.placeholderData?t.placeholderData(this.#F?.state.data,this.#F):t.placeholderData,t.select&&void 0!==e)try{e=t.select(e),this.#R=null}catch(e){this.#R=e}void 0!==e&&(v="success",p=(0,r.pl)(i?.data,e,t),b=!0)}this.#R&&(m=this.#R,p=this.#D,g=Date.now(),v="error");const x="fetching"===y,w="pending"===v,k="error"===v,S=w&&x,O=void 0!==d.data;return{status:v,fetchStatus:y,isPending:w,isSuccess:"success"===v,isError:k,isInitialLoading:S,isLoading:S,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>u.dataUpdateCount||d.errorUpdateCount>u.errorUpdateCount,isFetching:x,isRefetching:x&&!w,isLoadingError:k&&!O,isPaused:"paused"===y,isPlaceholderData:b,isRefetchError:k&&O,isStale:f(e,t),refetch:this.refetch}}updateResult(e){const t=this.#C,n=this.createResult(this.#T,this.options);if(this.#I=this.#T.state,this.#N=this.options,void 0!==this.#I.data&&(this.#F=this.#T),(0,r.f8)(n,t))return;this.#C=n;const o={};!1!==e?.listeners&&(()=>{if(!t)return!0;const{notifyOnChangeProps:e}=this.options,n="function"==typeof e?e():e;if("all"===n||!n&&!this.#W.size)return!0;const r=new Set(n??this.#W);return this.options.throwOnError&&r.add("error"),Object.keys(this.#C).some((e=>{const n=e;return this.#C[n]!==t[n]&&r.has(n)}))})()&&(o.listeners=!0),this.#M({...o,...e})}#Q(){const e=this.#E.getQueryCache().build(this.#E,this.options);if(e===this.#T)return;const t=this.#T;this.#T=e,this.#L=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#V()}#M(e){o.j.batch((()=>{e.listeners&&this.listeners.forEach((e=>{e(this.#C)})),this.#E.getQueryCache().notify({query:this.#T,type:"observerResultsUpdated"})}))}};function c(e,t){return function(e,t){return!1!==t.enabled&&void 0===e.state.data&&!("error"===e.state.status&&!1===t.retryOnMount)}(e,t)||void 0!==e.state.data&&u(e,t,t.refetchOnMount)}function u(e,t,n){if(!1!==t.enabled){const r="function"==typeof n?n(e):n;return"always"===r||!1!==r&&f(e,t)}return!1}function h(e,t,n,r){return!1!==n.enabled&&(e!==t||!1===r.enabled)&&(!n.suspense||"error"!==e.state.status)&&f(e,n)}function f(e,t){return e.isStaleByTime(t.staleTime)}var d=n(1594);n(4848);var p=d.createContext(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),m=()=>d.useContext(p),g=n(7665),y=d.createContext(!1),v=()=>d.useContext(y),b=(y.Provider,n(4362)),x=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},w=e=>{d.useEffect((()=>{e.clearReset()}),[e])},k=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(0,b.G)(n,[e.error,r]),S=e=>{e.suspense&&"number"!=typeof e.staleTime&&(e.staleTime=1e3)},O=(e,t)=>e?.suspense&&t.isPending,_=(e,t,n)=>t.fetchOptimistic(e).catch((()=>{n.clearReset()}));function E(e,t){return function(e,t,n){const r=(0,g.jE)(n),i=v(),a=m(),s=r.defaultQueryOptions(e);s._optimisticResults=i?"isRestoring":"optimistic",S(s),x(s,a),w(a);const[l]=d.useState((()=>new t(r,s))),c=l.getOptimisticResult(s);if(d.useSyncExternalStore(d.useCallback((e=>{const t=i?()=>{}:l.subscribe(o.j.batchCalls(e));return l.updateResult(),t}),[l,i]),(()=>l.getCurrentResult()),(()=>l.getCurrentResult())),d.useEffect((()=>{l.setOptions(s,{listeners:!1})}),[s,l]),O(s,c))throw _(s,l,a);if(k({result:c,errorResetBoundary:a,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash)}))throw c.error;return s.notifyOnChangeProps?c:l.trackResult(c)}(e,l,t)}},4362:(e,t,n)=>{"use strict";function r(e,t){return"function"==typeof e?e(...t):!!e}function o(){}n.d(t,{G:()=>r,l:()=>o})},421:(e,t,n)=>{"use strict";n.d(t,{p2:()=>cn});var r=n(4848),o=n(85),i=n(1594),a=(n(1919),n(4146),n(2142),n(1287),r.Fragment);function s(e,t,n){return o.h.call(t,"css")?r.jsx(o.E,(0,o.c)(e,t),n):r.jsx(e,t,n)}function l(e,t,n){return o.h.call(t,"css")?r.jsxs(o.E,(0,o.c)(e,t),n):r.jsxs(e,t,n)}var c=n(8168),u=n(8587);function h(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=h(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}const f=function(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=h(e))&&(r&&(r+=" "),r+=t);return r};var d=n(2532),p=n(3571),m=n(9599),g=n(8749);const y=function(e=null){const t=i.useContext(o.T);return t&&(n=t,0!==Object.keys(n).length)?t:e;var n},v=(0,g.A)(),b=function(e=v){return y(e)},x=["className","component"],w=e=>e,k=(()=>{let e=w;return{configure(t){e=t},generate:t=>e(t),reset(){e=w}}})();var S=n(5697),O=n(4521),_=n(4188),E=n(771);const C={black:"#000",white:"#fff"},A={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},j={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f9",A700:"#aa00ff"},P={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"},M={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"},R={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"},T={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"},L={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"},I=["mode","contrastThreshold","tonalOffset"],N={text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:C.white,default:C.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}},z={text:{primary:C.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:C.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}};function D(e,t,n,r){const o=r.light||r,i=r.dark||1.5*r;e[t]||(e.hasOwnProperty(n)?e[t]=e[n]:"light"===t?e.light=(0,E.a)(e.main,o):"dark"===t&&(e.dark=(0,E.e$)(e.main,i)))}const F=["fontFamily","fontSize","fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","htmlFontSize","allVariants","pxToRem"],B={textTransform:"uppercase"},$='"Roboto", "Helvetica", "Arial", sans-serif';function H(e,t){const n="function"==typeof t?t(e):t,{fontFamily:r=$,fontSize:o=14,fontWeightLight:i=300,fontWeightRegular:a=400,fontWeightMedium:s=500,fontWeightBold:l=700,htmlFontSize:h=16,allVariants:f,pxToRem:d}=n,p=(0,u.A)(n,F),m=o/14,g=d||(e=>e/h*m+"rem"),y=(e,t,n,o,i)=>{return(0,c.A)({fontFamily:r,fontWeight:e,fontSize:g(t),lineHeight:n},r===$?{letterSpacing:(a=o/t,Math.round(1e5*a)/1e5+"em")}:{},i,f);var a},v={h1:y(i,96,1.167,-1.5),h2:y(i,60,1.2,-.5),h3:y(a,48,1.167,0),h4:y(a,34,1.235,.25),h5:y(a,24,1.334,0),h6:y(s,20,1.6,.15),subtitle1:y(a,16,1.75,.15),subtitle2:y(s,14,1.57,.1),body1:y(a,16,1.5,.15),body2:y(a,14,1.43,.15),button:y(s,14,1.75,.4,B),caption:y(a,12,1.66,.4),overline:y(a,12,2.66,1,B),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return(0,O.A)((0,c.A)({htmlFontSize:h,pxToRem:g,fontFamily:r,fontSize:o,fontWeightLight:i,fontWeightRegular:a,fontWeightMedium:s,fontWeightBold:l},v),p,{clone:!1})}function W(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,0.2)`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,0.14)`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,0.12)`].join(",")}const q=["none",W(0,2,1,-1,0,1,1,0,0,1,3,0),W(0,3,1,-2,0,2,2,0,0,1,5,0),W(0,3,3,-2,0,3,4,0,0,1,8,0),W(0,2,4,-1,0,4,5,0,0,1,10,0),W(0,3,5,-1,0,5,8,0,0,1,14,0),W(0,3,5,-1,0,6,10,0,0,1,18,0),W(0,4,5,-2,0,7,10,1,0,2,16,1),W(0,5,5,-3,0,8,10,1,0,3,14,2),W(0,5,6,-3,0,9,12,1,0,3,16,2),W(0,6,6,-3,0,10,14,1,0,4,18,3),W(0,6,7,-4,0,11,15,1,0,4,20,3),W(0,7,8,-4,0,12,17,2,0,5,22,4),W(0,7,8,-4,0,13,19,2,0,5,24,4),W(0,7,9,-4,0,14,21,2,0,5,26,4),W(0,8,9,-5,0,15,22,2,0,6,28,5),W(0,8,10,-5,0,16,24,2,0,6,30,5),W(0,8,11,-5,0,17,26,2,0,6,32,5),W(0,9,11,-5,0,18,28,2,0,7,34,6),W(0,9,12,-6,0,19,29,2,0,7,36,6),W(0,10,13,-6,0,20,31,3,0,8,38,7),W(0,10,13,-6,0,21,33,3,0,8,40,7),W(0,10,14,-6,0,22,35,3,0,8,42,7),W(0,11,14,-7,0,23,36,3,0,9,44,8),W(0,11,15,-7,0,24,38,3,0,9,46,8)],V=["duration","easing","delay"],U={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},K={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function Q(e){return`${Math.round(e)}ms`}function G(e){if(!e)return 0;const t=e/36;return Math.round(10*(4+15*t**.25+t/5))}function Y(e){const t=(0,c.A)({},U,e.easing),n=(0,c.A)({},K,e.duration);return(0,c.A)({getAutoHeightDuration:G,create:(e=["all"],r={})=>{const{duration:o=n.standard,easing:i=t.easeInOut,delay:a=0}=r;return(0,u.A)(r,V),(Array.isArray(e)?e:[e]).map((e=>`${e} ${"string"==typeof o?o:Q(o)} ${i} ${"string"==typeof a?a:Q(a)}`)).join(",")}},e,{easing:t,duration:n})}const Z={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500},X=["breakpoints","mixins","spacing","palette","transitions","typography","shape"];const J=function(e={},...t){const{mixins:n={},palette:r={},transitions:o={},typography:i={}}=e,a=(0,u.A)(e,X);if(e.vars)throw new Error((0,S.A)(18));const s=function(e){const{mode:t="light",contrastThreshold:n=3,tonalOffset:r=.2}=e,o=(0,u.A)(e,I),i=e.primary||function(e="light"){return"dark"===e?{main:R[200],light:R[50],dark:R[400]}:{main:R[700],light:R[400],dark:R[800]}}(t),a=e.secondary||function(e="light"){return"dark"===e?{main:j[200],light:j[50],dark:j[400]}:{main:j[500],light:j[300],dark:j[700]}}(t),s=e.error||function(e="light"){return"dark"===e?{main:P[500],light:P[300],dark:P[700]}:{main:P[700],light:P[400],dark:P[800]}}(t),l=e.info||function(e="light"){return"dark"===e?{main:T[400],light:T[300],dark:T[700]}:{main:T[700],light:T[500],dark:T[900]}}(t),h=e.success||function(e="light"){return"dark"===e?{main:L[400],light:L[300],dark:L[700]}:{main:L[800],light:L[500],dark:L[900]}}(t),f=e.warning||function(e="light"){return"dark"===e?{main:M[400],light:M[300],dark:M[700]}:{main:"#ed6c02",light:M[500],dark:M[900]}}(t);function d(e){return(0,E.eM)(e,z.text.primary)>=n?z.text.primary:N.text.primary}const p=({color:e,name:t,mainShade:n=500,lightShade:o=300,darkShade:i=700})=>{if(!(e=(0,c.A)({},e)).main&&e[n]&&(e.main=e[n]),!e.hasOwnProperty("main"))throw new Error((0,S.A)(11,t?` (${t})`:"",n));if("string"!=typeof e.main)throw new Error((0,S.A)(12,t?` (${t})`:"",JSON.stringify(e.main)));return D(e,"light",o,r),D(e,"dark",i,r),e.contrastText||(e.contrastText=d(e.main)),e},m={dark:z,light:N};return(0,O.A)((0,c.A)({common:(0,c.A)({},C),mode:t,primary:p({color:i,name:"primary"}),secondary:p({color:a,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:p({color:s,name:"error"}),warning:p({color:f,name:"warning"}),info:p({color:l,name:"info"}),success:p({color:h,name:"success"}),grey:A,contrastThreshold:n,getContrastText:d,augmentColor:p,tonalOffset:r},m[t]),o)}(r),l=(0,g.A)(e);let h=(0,O.A)(l,{mixins:(f=l.breakpoints,d=n,(0,c.A)({toolbar:{minHeight:56,[f.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[f.up("sm")]:{minHeight:64}}},d)),palette:s,shadows:q.slice(),typography:H(s,i),transitions:Y(o),zIndex:(0,c.A)({},Z)});var f,d;return h=(0,O.A)(h,a),h=t.reduce(((e,t)=>(0,O.A)(e,t)),h),h.unstable_sxConfig=(0,c.A)({},_.A,null==a?void 0:a.unstable_sxConfig),h.unstable_sx=function(e){return(0,p.A)({sx:e,theme:this})},h},ee="$$material",te={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function ne(e,t,n="Mui"){const r=te[t];return r?`${n}-${r}`:`${k.generate(e)}-${t}`}function re(e,t,n="Mui"){const r={};return t.forEach((t=>{r[t]=ne(e,t,n)})),r}const oe=re("MuiBox",["root"]),ie=J(),ae=function(e={}){const{themeId:t,defaultTheme:n,defaultClassName:o="MuiBox-root",generateClassName:a}=e,s=(0,d.default)("div",{shouldForwardProp:e=>"theme"!==e&&"sx"!==e&&"as"!==e})(p.A);return i.forwardRef((function(e,i){const l=b(n),h=(0,m.A)(e),{className:d,component:p="div"}=h,g=(0,u.A)(h,x);return(0,r.jsx)(s,(0,c.A)({as:p,ref:i,className:f(d,a?a(o):o),theme:t&&l[t]||l},g))}))}({themeId:ee,defaultTheme:ie,defaultClassName:oe.root,generateClassName:k.generate}),se=ae;function le(...e){return i.useMemo((()=>e.every((e=>null==e))?null:t=>{e.forEach((e=>{!function(e,t){"function"==typeof e?e(t):e&&(e.current=t)}(e,t)}))}),e)}function ce(e){const t=function(e){return e&&e.ownerDocument||document}(e);return t.defaultView||window}const ue="undefined"!=typeof window?i.useLayoutEffect:i.useEffect,he=["onChange","maxRows","minRows","style","value"];function fe(e){return parseInt(e,10)||0}const de={visibility:"hidden",position:"absolute",overflow:"hidden",height:0,top:0,left:0,transform:"translateZ(0)"},pe=i.forwardRef((function(e,t){const{onChange:n,maxRows:o,minRows:a=1,style:s,value:l}=e,h=(0,u.A)(e,he),{current:f}=i.useRef(null!=l),d=i.useRef(null),p=le(t,d),m=i.useRef(null),g=i.useCallback((()=>{const t=d.current,n=ce(t).getComputedStyle(t);if("0px"===n.width)return{outerHeightStyle:0,overflowing:!1};const r=m.current;r.style.width=n.width,r.value=t.value||e.placeholder||"x","\n"===r.value.slice(-1)&&(r.value+=" ");const i=n.boxSizing,s=fe(n.paddingBottom)+fe(n.paddingTop),l=fe(n.borderBottomWidth)+fe(n.borderTopWidth),c=r.scrollHeight;r.value="x";const u=r.scrollHeight;let h=c;return a&&(h=Math.max(Number(a)*u,h)),o&&(h=Math.min(Number(o)*u,h)),h=Math.max(h,u),{outerHeightStyle:h+("border-box"===i?s+l:0),overflowing:Math.abs(h-c)<=1}}),[o,a,e.placeholder]),y=i.useCallback((()=>{const e=g();if(null==(t=e)||0===Object.keys(t).length||0===t.outerHeightStyle&&!t.overflowing)return;var t;const n=d.current;n.style.height=`${e.outerHeightStyle}px`,n.style.overflow=e.overflowing?"hidden":""}),[g]);return ue((()=>{const e=()=>{y()};const t=function(e,t=166){let n;function r(...r){clearTimeout(n),n=setTimeout((()=>{e.apply(this,r)}),t)}return r.clear=()=>{clearTimeout(n)},r}(e),n=d.current,r=ce(n);let o;return r.addEventListener("resize",t),"undefined"!=typeof ResizeObserver&&(o=new ResizeObserver(e),o.observe(n)),()=>{t.clear(),cancelAnimationFrame(undefined),r.removeEventListener("resize",t),o&&o.disconnect()}}),[g,y]),ue((()=>{y()})),(0,r.jsxs)(i.Fragment,{children:[(0,r.jsx)("textarea",(0,c.A)({value:l,onChange:e=>{f||y(),n&&n(e)},ref:p,rows:a},h)),(0,r.jsx)("textarea",{"aria-hidden":!0,className:e.className,readOnly:!0,ref:m,tabIndex:-1,style:(0,c.A)({},de,s,{paddingTop:0,paddingBottom:0})})]})}));function me(e){return"string"==typeof e}function ge(e,t,n=void 0){const r={};return Object.keys(e).forEach((o=>{r[o]=e[o].reduce(((e,r)=>{if(r){const o=t(r);""!==o&&e.push(o),n&&n[r]&&e.push(n[r])}return e}),[]).join(" ")})),r}const ye=i.createContext(void 0);var ve=n(6461);const be=J(),xe=(0,ve.Ay)({themeId:ee,defaultTheme:be,rootShouldForwardProp:e=>(0,ve.MC)(e)&&"classes"!==e});function we(e,t){const n=(0,c.A)({},t);return Object.keys(e).forEach((r=>{if(r.toString().match(/^(components|slots)$/))n[r]=(0,c.A)({},e[r],n[r]);else if(r.toString().match(/^(componentsProps|slotProps)$/)){const o=e[r]||{},i=t[r];n[r]={},i&&Object.keys(i)?o&&Object.keys(o)?(n[r]=(0,c.A)({},i),Object.keys(o).forEach((e=>{n[r][e]=we(o[e],i[e])}))):n[r]=i:n[r]=o}else void 0===n[r]&&(n[r]=e[r])})),n}function ke(e){const{theme:t,name:n,props:r}=e;return t&&t.components&&t.components[n]&&t.components[n].defaultProps?we(t.components[n].defaultProps,r):r}function Se({props:e,name:t}){return function({props:e,name:t,defaultTheme:n,themeId:r}){let o=b(n);return r&&(o=o[r]||o),ke({theme:o,name:t,props:e})}({props:e,name:t,defaultTheme:be,themeId:ee})}const Oe=n(8659).A,_e=le,Ee=ue;var Ce=n(9940);const Ae=function({styles:e,themeId:t,defaultTheme:n={}}){const o=b(n),i="function"==typeof e?e(t&&o[t]||o):e;return(0,r.jsx)(Ce.A,{styles:i})},je=function(e){return(0,r.jsx)(Ae,(0,c.A)({},e,{defaultTheme:be,themeId:ee}))};function Pe(e){return null!=e&&!(Array.isArray(e)&&0===e.length)}function Me(e){return ne("MuiInputBase",e)}const Re=re("MuiInputBase",["root","formControl","focused","disabled","adornedStart","adornedEnd","error","sizeSmall","multiline","colorSecondary","fullWidth","hiddenLabel","readOnly","input","inputSizeSmall","inputMultiline","inputTypeSearch","inputAdornedStart","inputAdornedEnd","inputHiddenLabel"]),Te=["aria-describedby","autoComplete","autoFocus","className","color","components","componentsProps","defaultValue","disabled","disableInjectingGlobalStyles","endAdornment","error","fullWidth","id","inputComponent","inputProps","inputRef","margin","maxRows","minRows","multiline","name","onBlur","onChange","onClick","onFocus","onKeyDown","onKeyUp","placeholder","readOnly","renderSuffix","rows","size","slotProps","slots","startAdornment","type","value"],Le=xe("div",{name:"MuiInputBase",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.formControl&&t.formControl,n.startAdornment&&t.adornedStart,n.endAdornment&&t.adornedEnd,n.error&&t.error,"small"===n.size&&t.sizeSmall,n.multiline&&t.multiline,n.color&&t[`color${Oe(n.color)}`],n.fullWidth&&t.fullWidth,n.hiddenLabel&&t.hiddenLabel]}})((({theme:e,ownerState:t})=>(0,c.A)({},e.typography.body1,{color:(e.vars||e).palette.text.primary,lineHeight:"1.4375em",boxSizing:"border-box",position:"relative",cursor:"text",display:"inline-flex",alignItems:"center",[`&.${Re.disabled}`]:{color:(e.vars||e).palette.text.disabled,cursor:"default"}},t.multiline&&(0,c.A)({padding:"4px 0 5px"},"small"===t.size&&{paddingTop:1}),t.fullWidth&&{width:"100%"}))),Ie=xe("input",{name:"MuiInputBase",slot:"Input",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.input,"small"===n.size&&t.inputSizeSmall,n.multiline&&t.inputMultiline,"search"===n.type&&t.inputTypeSearch,n.startAdornment&&t.inputAdornedStart,n.endAdornment&&t.inputAdornedEnd,n.hiddenLabel&&t.inputHiddenLabel]}})((({theme:e,ownerState:t})=>{const n="light"===e.palette.mode,r=(0,c.A)({color:"currentColor"},e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:n?.42:.5},{transition:e.transitions.create("opacity",{duration:e.transitions.duration.shorter})}),o={opacity:"0 !important"},i=e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:n?.42:.5};return(0,c.A)({font:"inherit",letterSpacing:"inherit",color:"currentColor",padding:"4px 0 5px",border:0,boxSizing:"content-box",background:"none",height:"1.4375em",margin:0,WebkitTapHighlightColor:"transparent",display:"block",minWidth:0,width:"100%",animationName:"mui-auto-fill-cancel",animationDuration:"10ms","&::-webkit-input-placeholder":r,"&::-moz-placeholder":r,"&:-ms-input-placeholder":r,"&::-ms-input-placeholder":r,"&:focus":{outline:0},"&:invalid":{boxShadow:"none"},"&::-webkit-search-decoration":{WebkitAppearance:"none"},[`label[data-shrink=false] + .${Re.formControl} &`]:{"&::-webkit-input-placeholder":o,"&::-moz-placeholder":o,"&:-ms-input-placeholder":o,"&::-ms-input-placeholder":o,"&:focus::-webkit-input-placeholder":i,"&:focus::-moz-placeholder":i,"&:focus:-ms-input-placeholder":i,"&:focus::-ms-input-placeholder":i},[`&.${Re.disabled}`]:{opacity:1,WebkitTextFillColor:(e.vars||e).palette.text.disabled},"&:-webkit-autofill":{animationDuration:"5000s",animationName:"mui-auto-fill"}},"small"===t.size&&{paddingTop:1},t.multiline&&{height:"auto",resize:"none",padding:0,paddingTop:0},"search"===t.type&&{MozAppearance:"textfield"})})),Ne=(0,r.jsx)(je,{styles:{"@keyframes mui-auto-fill":{from:{display:"block"}},"@keyframes mui-auto-fill-cancel":{from:{display:"block"}}}}),ze=i.forwardRef((function(e,t){var n;const o=Se({props:e,name:"MuiInputBase"}),{"aria-describedby":a,autoComplete:s,autoFocus:l,className:h,components:d={},componentsProps:p={},defaultValue:m,disabled:g,disableInjectingGlobalStyles:y,endAdornment:v,fullWidth:b=!1,id:x,inputComponent:w="input",inputProps:k={},inputRef:O,maxRows:_,minRows:E,multiline:C=!1,name:A,onBlur:j,onChange:P,onClick:M,onFocus:R,onKeyDown:T,onKeyUp:L,placeholder:I,readOnly:N,renderSuffix:z,rows:D,slotProps:F={},slots:B={},startAdornment:$,type:H="text",value:W}=o,q=(0,u.A)(o,Te),V=null!=k.value?k.value:W,{current:U}=i.useRef(null!=V),K=i.useRef(),Q=i.useCallback((e=>{}),[]),G=_e(K,O,k.ref,Q),[Y,Z]=i.useState(!1),X=i.useContext(ye),J=function({props:e,states:t,muiFormControl:n}){return t.reduce(((t,r)=>(t[r]=e[r],n&&void 0===e[r]&&(t[r]=n[r]),t)),{})}({props:o,muiFormControl:X,states:["color","disabled","error","hiddenLabel","size","required","filled"]});J.focused=X?X.focused:Y,i.useEffect((()=>{!X&&g&&Y&&(Z(!1),j&&j())}),[X,g,Y,j]);const ee=X&&X.onFilled,te=X&&X.onEmpty,ne=i.useCallback((e=>{!function(e,t=!1){return e&&(Pe(e.value)&&""!==e.value||t&&Pe(e.defaultValue)&&""!==e.defaultValue)}(e)?te&&te():ee&&ee()}),[ee,te]);Ee((()=>{U&&ne({value:V})}),[V,ne,U]),i.useEffect((()=>{ne(K.current)}),[]);let re=w,oe=k;C&&"input"===re&&(oe=D?(0,c.A)({type:void 0,minRows:D,maxRows:D},oe):(0,c.A)({type:void 0,maxRows:_,minRows:E},oe),re=pe),i.useEffect((()=>{X&&X.setAdornedStart(Boolean($))}),[X,$]);const ie=(0,c.A)({},o,{color:J.color||"primary",disabled:J.disabled,endAdornment:v,error:J.error,focused:J.focused,formControl:X,fullWidth:b,hiddenLabel:J.hiddenLabel,multiline:C,size:J.size,startAdornment:$,type:H}),ae=(e=>{const{classes:t,color:n,disabled:r,error:o,endAdornment:i,focused:a,formControl:s,fullWidth:l,hiddenLabel:c,multiline:u,readOnly:h,size:f,startAdornment:d,type:p}=e;return ge({root:["root",`color${Oe(n)}`,r&&"disabled",o&&"error",l&&"fullWidth",a&&"focused",s&&"formControl",f&&"medium"!==f&&`size${Oe(f)}`,u&&"multiline",d&&"adornedStart",i&&"adornedEnd",c&&"hiddenLabel",h&&"readOnly"],input:["input",r&&"disabled","search"===p&&"inputTypeSearch",u&&"inputMultiline","small"===f&&"inputSizeSmall",c&&"inputHiddenLabel",d&&"inputAdornedStart",i&&"inputAdornedEnd",h&&"readOnly"]},Me,t)})(ie),se=B.root||d.Root||Le,le=F.root||p.root||{},ce=B.input||d.Input||Ie;return oe=(0,c.A)({},oe,null!=(n=F.input)?n:p.input),(0,r.jsxs)(i.Fragment,{children:[!y&&Ne,(0,r.jsxs)(se,(0,c.A)({},le,!me(se)&&{ownerState:(0,c.A)({},ie,le.ownerState)},{ref:t,onClick:e=>{K.current&&e.currentTarget===e.target&&K.current.focus(),M&&M(e)}},q,{className:f(ae.root,le.className,h,N&&"MuiInputBase-readOnly"),children:[$,(0,r.jsx)(ye.Provider,{value:null,children:(0,r.jsx)(ce,(0,c.A)({ownerState:ie,"aria-invalid":J.error,"aria-describedby":a,autoComplete:s,autoFocus:l,defaultValue:m,disabled:J.disabled,id:x,onAnimationStart:e=>{ne("mui-auto-fill-cancel"===e.animationName?K.current:{value:"x"})},name:A,placeholder:I,readOnly:N,required:J.required,rows:D,value:V,onKeyDown:T,onKeyUp:L,type:H},oe,!me(ce)&&{as:re,ownerState:(0,c.A)({},ie,oe.ownerState)},{ref:G,className:f(ae.input,oe.className,N&&"MuiInputBase-readOnly"),onBlur:e=>{j&&j(e),k.onBlur&&k.onBlur(e),X&&X.onBlur?X.onBlur(e):Z(!1)},onChange:(e,...t)=>{if(!U){const t=e.target||K.current;if(null==t)throw new Error((0,S.A)(1));ne({value:t.value})}k.onChange&&k.onChange(e,...t),P&&P(e,...t)},onFocus:e=>{J.disabled?e.stopPropagation():(R&&R(e),k.onFocus&&k.onFocus(e),X&&X.onFocus?X.onFocus(e):Z(!0))}}))}),v,z?z((0,c.A)({},J,{startAdornment:$})):null]}))]})}));function De(e){const{children:t,defer:n=!1,fallback:o=null}=e,[a,s]=i.useState(!1);return ue((()=>{n||s(!0)}),[n]),i.useEffect((()=>{n&&s(!0)}),[n]),(0,r.jsx)(i.Fragment,{children:a?t:o})}function Fe(e){return ne("MuiSvgIcon",e)}re("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Be=["children","className","color","component","fontSize","htmlColor","inheritViewBox","titleAccess","viewBox"],$e=xe("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,"inherit"!==n.color&&t[`color${Oe(n.color)}`],t[`fontSize${Oe(n.fontSize)}`]]}})((({theme:e,ownerState:t})=>{var n,r,o,i,a,s,l,c,u,h,f,d,p;return{userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:t.hasSvgAsChild?void 0:"currentColor",flexShrink:0,transition:null==(n=e.transitions)||null==(r=n.create)?void 0:r.call(n,"fill",{duration:null==(o=e.transitions)||null==(o=o.duration)?void 0:o.shorter}),fontSize:{inherit:"inherit",small:(null==(i=e.typography)||null==(a=i.pxToRem)?void 0:a.call(i,20))||"1.25rem",medium:(null==(s=e.typography)||null==(l=s.pxToRem)?void 0:l.call(s,24))||"1.5rem",large:(null==(c=e.typography)||null==(u=c.pxToRem)?void 0:u.call(c,35))||"2.1875rem"}[t.fontSize],color:null!=(h=null==(f=(e.vars||e).palette)||null==(f=f[t.color])?void 0:f.main)?h:{action:null==(d=(e.vars||e).palette)||null==(d=d.action)?void 0:d.active,disabled:null==(p=(e.vars||e).palette)||null==(p=p.action)?void 0:p.disabled,inherit:void 0}[t.color]}})),He=i.forwardRef((function(e,t){const n=Se({props:e,name:"MuiSvgIcon"}),{children:o,className:a,color:s="inherit",component:l="svg",fontSize:h="medium",htmlColor:d,inheritViewBox:p=!1,titleAccess:m,viewBox:g="0 0 24 24"}=n,y=(0,u.A)(n,Be),v=i.isValidElement(o)&&"svg"===o.type,b=(0,c.A)({},n,{color:s,component:l,fontSize:h,instanceFontSize:e.fontSize,inheritViewBox:p,viewBox:g,hasSvgAsChild:v}),x={};p||(x.viewBox=g);const w=(e=>{const{color:t,fontSize:n,classes:r}=e;return ge({root:["root","inherit"!==t&&`color${Oe(t)}`,`fontSize${Oe(n)}`]},Fe,r)})(b);return(0,r.jsxs)($e,(0,c.A)({as:l,className:f(w.root,a),focusable:"false",color:d,"aria-hidden":!m||void 0,role:m?"img":void 0,ref:t},x,y,v&&o.props,{ownerState:b,children:[v?o.props.children:o,m?(0,r.jsx)("title",{children:m}):null]}))}));He.muiName="SvgIcon";const We=He,qe=e=>{let t;return t=e<1?5.11916*e**2:4.5*Math.log(e+1)+2,(t/100).toFixed(2)};function Ve(e){return ne("MuiPaper",e)}re("MuiPaper",["root","rounded","outlined","elevation","elevation0","elevation1","elevation2","elevation3","elevation4","elevation5","elevation6","elevation7","elevation8","elevation9","elevation10","elevation11","elevation12","elevation13","elevation14","elevation15","elevation16","elevation17","elevation18","elevation19","elevation20","elevation21","elevation22","elevation23","elevation24"]);const Ue=["className","component","elevation","square","variant"],Ke=xe("div",{name:"MuiPaper",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],!n.square&&t.rounded,"elevation"===n.variant&&t[`elevation${n.elevation}`]]}})((({theme:e,ownerState:t})=>{var n;return(0,c.A)({backgroundColor:(e.vars||e).palette.background.paper,color:(e.vars||e).palette.text.primary,transition:e.transitions.create("box-shadow")},!t.square&&{borderRadius:e.shape.borderRadius},"outlined"===t.variant&&{border:`1px solid ${(e.vars||e).palette.divider}`},"elevation"===t.variant&&(0,c.A)({boxShadow:(e.vars||e).shadows[t.elevation]},!e.vars&&"dark"===e.palette.mode&&{backgroundImage:`linear-gradient(${(0,E.X4)("#fff",qe(t.elevation))}, ${(0,E.X4)("#fff",qe(t.elevation))})`},e.vars&&{backgroundImage:null==(n=e.vars.overlays)?void 0:n[t.elevation]}))})),Qe=i.forwardRef((function(e,t){const n=Se({props:e,name:"MuiPaper"}),{className:o,component:i="div",elevation:a=1,square:s=!1,variant:l="elevation"}=n,h=(0,u.A)(n,Ue),d=(0,c.A)({},n,{component:i,elevation:a,square:s,variant:l}),p=(e=>{const{square:t,elevation:n,variant:r,classes:o}=e;return ge({root:["root",r,!t&&"rounded","elevation"===r&&`elevation${n}`]},Ve,o)})(d);return(0,r.jsx)(Ke,(0,c.A)({as:i,ownerState:d,className:f(p.root,o),ref:t},h))})),Ge=i.createContext(null);function Ye(){return i.useContext(Ge)}const Ze="function"==typeof Symbol&&Symbol.for?Symbol.for("mui.nested"):"__THEME_NESTED__",Xe=function(e){const{children:t,theme:n}=e,o=Ye(),a=i.useMemo((()=>{const e=null===o?n:function(e,t){return"function"==typeof t?t(e):(0,c.A)({},e,t)}(o,n);return null!=e&&(e[Ze]=null!==o),e}),[n,o]);return(0,r.jsx)(Ge.Provider,{value:a,children:t})},Je={};function et(e,t,n,r=!1){return i.useMemo((()=>{const o=e&&t[e]||t;if("function"==typeof n){const i=n(o),a=e?(0,c.A)({},t,{[e]:i}):i;return r?()=>a:a}return e?(0,c.A)({},t,{[e]:n}):(0,c.A)({},t,n)}),[e,t,n,r])}const tt=function(e){const{children:t,theme:n,themeId:i}=e,a=y(Je),s=Ye()||Je,l=et(i,a,n),c=et(i,s,n,!0);return(0,r.jsx)(Xe,{theme:c,children:(0,r.jsx)(o.T.Provider,{value:l,children:t})})},nt=["theme"];function rt(e){let{theme:t}=e,n=(0,u.A)(e,nt);const o=t[ee];return(0,r.jsx)(tt,(0,c.A)({},n,{themeId:o?ee:void 0,theme:o||t}))}const ot=e=>{let t;const n=new Set,r=(e,r)=>{const o="function"==typeof e?e(t):e;if(!Object.is(o,t)){const e=t;t=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},t,o),n.forEach((n=>n(t,e)))}},o=()=>t,i={setState:r,getState:o,getInitialState:()=>a,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},a=t=e(r,o,i);return i},it=e=>e?ot(e):ot;var at=n(9242);const{useDebugValue:st}=i,{useSyncExternalStoreWithSelector:lt}=at;let ct=!1;const ut=e=>e;function ht(e,t=ut,n){n&&!ct&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),ct=!0);const r=lt(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return st(r),r}const ft=e=>{"function"!=typeof e&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t="function"==typeof e?it(e):e,n=(e,n)=>ht(t,e,n);return Object.assign(n,t),n};var dt=n(7965);function pt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){pt(e,t,n[t])}))}return e}function gt(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function yt(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 vt(e,t){if(e){if("string"==typeof e)return yt(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(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yt(e,t):void 0}}function bt(e){return function(e){if(Array.isArray(e))return yt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||vt(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 xt(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=xt(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function wt(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=xt(e))&&(r&&(r+=" "),r+=t);return r}function kt(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=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){s=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw o}}return i}}(e,t)||vt(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 St(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Ot={scheme:"Light Theme",author:"mac gainor (https://github.com/mac-s-g)",base00:"rgba(0, 0, 0, 0)",base01:"rgb(245, 245, 245)",base02:"rgb(235, 235, 235)",base03:"#93a1a1",base04:"rgba(0, 0, 0, 0.3)",base05:"#586e75",base06:"#073642",base07:"#002b36",base08:"#d33682",base09:"#cb4b16",base0A:"#ffd500",base0B:"#859900",base0C:"#6c71c4",base0D:"#586e75",base0E:"#2aa198",base0F:"#268bd2"},_t={scheme:"Dark Theme",author:"Chris Kempson (http://chriskempson.com)",base00:"#181818",base01:"#282828",base02:"#383838",base03:"#585858",base04:"#b8b8b8",base05:"#d8d8d8",base06:"#e8e8e8",base07:"#f8f8f8",base08:"#ab4642",base09:"#dc9656",base0A:"#f7ca88",base0B:"#a1b56c",base0C:"#86c1b9",base0D:"#7cafc2",base0E:"#ba8baf",base0F:"#a16946"},Et=function(){return null};Et.when=function(){return!1};var Ct=(0,i.createContext)(void 0);Ct.Provider;var At=function(e,t){return ht((0,i.useContext)(Ct),e,t)},jt=function(){return At((function(e){return e.colorspace.base07}))};function Pt(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function Mt(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){Pt(i,r,o,a,s,"next",e)}function s(e){Pt(i,r,o,a,s,"throw",e)}a(void 0)}))}}function Rt(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function Tt(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}Object.prototype.constructor.toString();function Lt(e){return null===e?0:Array.isArray(e)?e.length:Tt(e,Map)||Tt(e,Set)?e.size:Tt(e,Date)?1:"object"==typeof e?Object.keys(e).length:"string"==typeof e?e.length:1}function It(e,t){for(var n=[],r=0;r<e.length;)n.push(e.slice(r,r+t)),r+=t;return n}function Nt(e){return zt.apply(this,arguments)}function zt(){return(zt=Mt((function(e){return Rt(this,(function(t){switch(t.label){case 0:if(!("clipboard"in navigator))return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.clipboard.writeText(e)];case 2:case 3:return t.sent(),[3,4];case 4:return dt(e),[2]}}))}))).apply(this,arguments)}function Dt(e,t){var n=At((function(e){return e.value}));return(0,i.useMemo)((function(){return function(e,t,n){if(null===e||null===n)return!1;if("object"!=typeof e)return!1;if("object"!=typeof n)return!1;if(Object.is(e,n)&&0!==t.length)return"";for(var r=[],o=bt(t),i=e;i!==n||0!==o.length;){if("object"!=typeof i||null===i)return!1;if(Object.is(i,n))return r.reduce((function(e,t,n){return"number"==typeof t?e+"[".concat(t,"]"):e+"".concat(0===n?"":".").concat(t)}),"");var a=o.shift();r.push(a),i=i[a]}return!1}(n,e,t)}),[e,t,n])}var Ft=function(e){return s(se,gt(mt({component:"div"},e),{sx:mt({display:"inline-block"},e.sx)}))},Bt=function(e){var t=e.dataType,n=e.enable;return void 0===n||n?s(Ft,{className:"data-type-label",sx:{mx:.5,fontSize:"0.7rem",opacity:.8,userSelect:"none"},children:t}):null};function $t(e,t,n){var r=n.fromString,o=n.colorKey,a=n.displayTypeLabel,c=void 0===a||a,u=(0,i.memo)(t),h=function(t){var n=At((function(e){return e.displayDataTypes})),r=At((function(e){return e.colorspace[o]})),i=At((function(e){return e.onSelect}));return l(Ft,{onClick:function(){return null==i?void 0:i(t.path,t.value)},sx:{color:r},children:[c&&n&&s(Bt,{dataType:e}),s(Ft,{className:"".concat(e,"-value"),children:s(u,{value:t.value})})]})};if(h.displayName="easy-".concat(e,"-type"),!r)return{Component:h};var f=function(e){var t=e.value,n=e.setValue,a=At((function(e){return e.colorspace[o]}));return s(ze,{value:t,onChange:(0,i.useCallback)((function(e){var t=r(e.target.value);n(t)}),[n]),size:"small",multiline:!0,sx:{color:a,padding:.5,borderStyle:"solid",borderColor:"black",borderWidth:1,fontSize:"0.8rem",fontFamily:"monospace",display:"inline-flex"}})};return f.displayName="easy-".concat(e,"-type-editor"),{Component:h,Editor:f}}var Ht=function(e){return l(De,{children:[s(Bt,{dataType:"function"}),l(se,{component:"span",className:"data-function-start",sx:{letterSpacing:.5},children:[(t=e.value,n=t.toString(),-1!==n.indexOf("function")?n.substring(8,n.indexOf("{")).trim():n.substring(0,n.indexOf("=>")+2).trim())," ","{"]})]});var t,n},Wt=function(){return s(De,{children:s(se,{component:"span",className:"data-function-end",children:"}"})})},qt=function(e){var t,n,r,o,i,a=At((function(e){return e.colorspace.base05}));return s(De,{children:s(se,{className:"data-function",sx:{display:e.inspect?"block":"inline-block",pl:e.inspect?2:0,color:a},children:e.inspect?(t=e.value,n=t.toString(),r=!0,o=n.indexOf(")"),i=n.indexOf("=>"),-1!==i&&i>o&&(r=!1),r?n.substring(n.indexOf("{",o)+1,n.lastIndexOf("}")):n.substring(n.indexOf("=>")+2)):s(se,{component:"span",className:"data-function-body",onClick:function(){return e.setInspect(!0)},sx:{"&:hover":{cursor:"pointer"},padding:.5},children:"…"})})})};var Vt=function(e){var t=e.d,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,["d"]);return s(We,gt(mt({},n),{children:s("path",{d:t})}))},Ut=function(e){return s(Vt,mt({d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"},e))},Kt=function(e){return s(Vt,mt({d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"},e))},Qt=function(e){return s(Vt,mt({d:"M 12 2 C 10.615 1.998 9.214625 2.2867656 7.890625 2.8847656 L 8.9003906 4.6328125 C 9.9043906 4.2098125 10.957 3.998 12 4 C 15.080783 4 17.738521 5.7633175 19.074219 8.3222656 L 17.125 9 L 21.25 11 L 22.875 7 L 20.998047 7.6523438 C 19.377701 4.3110398 15.95585 2 12 2 z M 6.5097656 4.4882812 L 2.2324219 5.0820312 L 3.734375 6.3808594 C 1.6515335 9.4550558 1.3615962 13.574578 3.3398438 17 C 4.0308437 18.201 4.9801562 19.268234 6.1601562 20.115234 L 7.1699219 18.367188 C 6.3019219 17.710187 5.5922656 16.904 5.0722656 16 C 3.5320014 13.332354 3.729203 10.148679 5.2773438 7.7128906 L 6.8398438 9.0625 L 6.5097656 4.4882812 z M 19.929688 13 C 19.794687 14.08 19.450734 15.098 18.927734 16 C 17.386985 18.668487 14.531361 20.090637 11.646484 19.966797 L 12.035156 17.9375 L 8.2402344 20.511719 L 10.892578 23.917969 L 11.265625 21.966797 C 14.968963 22.233766 18.681899 20.426323 20.660156 17 C 21.355156 15.801 21.805219 14.445 21.949219 13 L 19.929688 13 z"},e))},Gt=function(e){return s(Vt,mt({d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"},e))},Yt=function(e){return s(Vt,mt({d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"},e))},Zt=function(e){return s(Vt,mt({d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"},e))},Xt=function(e){return s(Vt,mt({d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"},e))};function Jt(e){var t=Lt(e),n="";return(Tt(e,Map)||Tt(e,Set))&&(n=e[Symbol.toStringTag]),Object.prototype.hasOwnProperty.call(e,Symbol.toStringTag)&&(n=e[Symbol.toStringTag]),"".concat(t," Items").concat(n?" (".concat(n,")"):"")}var en=(0,i.createContext)(void 0);en.Provider;var tn=function(e,t){return ht((0,i.useContext)(en),e,t)},nn={is:function(e){return"object"==typeof e},Component:function(e){var t=jt(),n=At((function(e){return e.colorspace.base02})),r=At((function(e){return e.groupArraysAfterLength})),o=Dt(e.path,e.value),a=kt((0,i.useState)(At((function(e){return e.maxDisplayLength}))),2),c=a[0],u=a[1],h=At((function(e){return e.objectSortKeys})),f=(0,i.useMemo)((function(){if(!e.inspect)return null;var n=e.value,o=function(e){return"function"==typeof(null==e?void 0:e[Symbol.iterator])}(n);if(o&&!Array.isArray(n)){var i=[];if(Tt(n,Map))n.forEach((function(t,n){var r=n.toString(),o=bt(e.path).concat([r]);i.push(s(on,{path:o,value:t,prevValue:Tt(e.prevValue,Map)?e.prevValue.get(n):void 0,editable:!1},r))}));else for(var a=n[Symbol.iterator](),f=a.next(),d=0;!f.done;)i.push(s(on,{path:bt(e.path).concat(["iterator:".concat(d)]),value:f.value,nestedIndex:d,editable:!1},d)),d++,f=a.next();return i}if(Array.isArray(n)){if(n.length<=r){var p=n.slice(0,c).map((function(t,n){var r=bt(e.path).concat([n]);return s(on,{path:r,value:t,prevValue:Array.isArray(e.prevValue)?e.prevValue[n]:void 0},n)}));if(n.length>c){var m=n.length-c;p.push(l(Ft,{sx:{cursor:"pointer",lineHeight:1.5,color:t,letterSpacing:.5,opacity:.8,userSelect:"none"},onClick:function(){return u((function(e){return 2*e}))},children:["hidden ",m," items…"]},"last"))}return p}var g=It(n,r),y=Array.isArray(e.prevValue)?It(e.prevValue,r):void 0;return g.map((function(t,n){var r=bt(e.path);return s(on,{path:r,value:t,nestedIndex:n,prevValue:null==y?void 0:y[n]},n)}))}var v=Object.entries(n);h&&(v=!0===h?v.sort((function(e,t){var n=kt(e,1)[0],r=kt(t,1)[0];return n.localeCompare(r)})):v.sort((function(e,t){var n=kt(e,1)[0],r=kt(t,1)[0];return h(n,r)})));var b=v.slice(0,c).map((function(t){var n,r=kt(t,2),o=r[0],i=r[1],a=bt(e.path).concat([o]);return s(on,{path:a,value:i,prevValue:null===(n=e.prevValue)||void 0===n?void 0:n[o]},o)}));if(v.length>c){var x=v.length-c;b.push(l(Ft,{sx:{cursor:"pointer",lineHeight:1.5,color:t,letterSpacing:.5,opacity:.8,userSelect:"none"},onClick:function(){return u((function(e){return 2*e}))},children:["hidden ",x," items…"]},"last"))}return b}),[e.inspect,e.value,e.prevValue,e.path,r,c,t,h]),d=e.inspect?.6:0,p=At((function(e){return e.indentWidth})),m=e.inspect?p-d:p;return(0,i.useMemo)((function(){return 0===Lt(e.value)}),[e.value])?null:s(se,{className:"data-object",sx:{display:e.inspect?"block":"inline-block",pl:e.inspect?m-.6:0,marginLeft:d,color:t,borderLeft:e.inspect?"1px solid ".concat(n):"none"},children:e.inspect?f:!o&&s(se,{component:"span",className:"data-object-body",onClick:function(){return e.setInspect(!0)},sx:{"&:hover":{cursor:"pointer"},padding:.5,userSelect:"none"},children:"…"})})},PreComponent:function(e){var t=At((function(e){return e.colorspace.base04})),n=jt(),r=(0,i.useMemo)((function(){return Array.isArray(e.value)}),[e.value]),o=(0,i.useMemo)((function(){return 0===Lt(e.value)}),[e.value]),c=(0,i.useMemo)((function(){return Jt(e.value)}),[e.value]),u=At((function(e){return e.displayObjectSize})),h=Dt(e.path,e.value);return l(se,{component:"span",className:"data-object-start",sx:{letterSpacing:.5},children:[r?"[":"{",u&&e.inspect&&!o&&s(se,{component:"span",sx:{pl:.5,fontStyle:"italic",color:t,userSelect:"none"},children:c}),h&&!e.inspect&&l(a,{children:[s(Qt,{sx:{fontSize:12,color:n,mx:.5}}),h]})]})},PostComponent:function(e){var t=At((function(e){return e.colorspace.base04})),n=(0,i.useMemo)((function(){return Array.isArray(e.value)}),[e.value]),r=At((function(e){return e.displayObjectSize})),o=(0,i.useMemo)((function(){return 0===Lt(e.value)}),[e.value]),a=(0,i.useMemo)((function(){return Jt(e.value)}),[e.value]);return l(se,{component:"span",className:"data-object-end",children:[n?"]":"}",!r||!o&&e.inspect?null:s(se,{component:"span",sx:{pl:.5,fontStyle:"italic",color:t,userSelect:"none"},children:a})]})}};var rn=function(e){return s(se,gt(mt({component:"span"},e),{sx:mt({cursor:"pointer",paddingLeft:"0.7rem"},e.sx)}))},on=function(e){var t,n=e.value,r=e.prevValue,o=e.path,c=e.nestedIndex,u=null!==(t=e.editable)&&void 0!==t?t:void 0,h=At((function(e){return e.editable})),f=(0,i.useMemo)((function(){return!1!==h&&!1!==u&&("function"==typeof h?!!h(o,n):h)}),[o,u,h,n]),d=kt((0,i.useState)("function"==typeof n?function(){return n}:n),2),p=d[0],m=d[1],g=o.length,y=o[g-1],v=At((function(e){return e.hoverPath})),b=(0,i.useMemo)((function(){return v&&o.every((function(e,t){return e===v.path[t]&&c===v.nestedIndex}))}),[v,o,c]),x=At((function(e){return e.setHover})),w=At((function(e){return e.value})),k=kt(function(e,t,n){var r=e.length,o=Dt(e,t),a=At((function(e){return e.getInspectCache})),s=At((function(e){return e.setInspectCache})),l=At((function(e){return e.defaultInspectDepth}));(0,i.useEffect)((function(){void 0===a(e,n)&&(void 0!==n?s(e,!1,n):s(e,!o&&r<l))}),[l,r,a,o,n,e,s]);var c=kt((0,i.useState)((function(){var t=a(e,n);return void 0!==t?t:void 0===n&&!o&&r<l})),2),u=c[0],h=c[1];return[u,(0,i.useCallback)((function(t){h((function(r){var o="boolean"==typeof t?t:t(r);return s(e,o,n),o}))}),[n,e,s])]}(o,n,c),2),S=k[0],O=k[1],_=kt((0,i.useState)(!1),2),E=_[0],C=_[1],A=At((function(e){return e.onChange})),j=jt(),P=At((function(e){return e.colorspace.base0C})),M=At((function(e){return e.colorspace.base0A})),R=function(e,t){var n=tn((function(e){return e.registry}));return(0,i.useMemo)((function(){return function(e,t,n){var r,o=!0,i=!1,a=void 0;try{for(var s,l=n[Symbol.iterator]();!(o=(s=l.next()).done);o=!0){var c=s.value;if(c.is(e,t)&&(r=c,"object"==typeof e))return c}}catch(e){i=!0,a=e}finally{try{o||null==l.return||l.return()}finally{if(i)throw a}}if(void 0===r){if("object"==typeof e)return nn;throw new Error("this is not possible")}return r}(e,t,n)}),[e,t,n])}(n,o),T=R.Component,L=R.PreComponent,I=R.PostComponent,N=R.Editor,z=At((function(e){return e.quotesOnKeys})),D=At((function(e){return e.rootName})),F=w===n,B=Number.isInteger(Number(y)),$=At((function(e){return e.enableClipboard})),H=function(){var e,t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).timeout,n=void 0===t?2e3:t,r=kt((0,i.useState)(!1),2),o=r[0],a=r[1],s=(0,i.useRef)(null),l=(0,i.useCallback)((function(e){var t=s.current;t&&window.clearTimeout(t),s.current=window.setTimeout((function(){return a(!1)}),n),a(e)}),[n]),c=At((function(e){return e.onCopy})),u=(0,i.useCallback)((e=Mt((function(e,t){var n,r,o;return Rt(this,(function(i){switch(i.label){case 0:if("function"!=typeof c)return[3,5];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,c(e,t,Nt)];case 2:return i.sent(),l(!0),[3,4];case 3:return n=i.sent(),console.error("error when copy ".concat(0===e.length?"src":"src[".concat(e.join(".")),"]"),n),[3,4];case 4:return[3,8];case 5:return i.trys.push([5,7,,8]),a="function"==typeof t?t.toString():t,s=[],r=JSON.stringify(a,(function(e,t){if("bigint"===(void 0===t?"undefined":St(t)))return t.toString();if(Tt(t,Map)){if("toJSON"in t&&"function"==typeof t.toJSON)return t.toJSON();if(0===t.size)return{};if(s.includes(t))return"[Circular]";s.push(t);var n=Array.from(t.entries());return n.every((function(e){var t=kt(e,1)[0];return"string"==typeof t||"number"==typeof t}))?Object.fromEntries(n):{}}if(Tt(t,Set))return"toJSON"in t&&"function"==typeof t.toJSON?t.toJSON():s.includes(t)?"[Circular]":(s.push(t),Array.from(t.values()));if("object"==typeof t&&null!==t&&Object.keys(t).length){var r=s.length;if(r){for(var o=r-1;o>=0&&s[o][e]!==t;--o)s.pop();if(s.includes(t))return"[Circular]"}s.push(t)}return t}),"  "),[4,Nt(r)];case 6:return i.sent(),l(!0),[3,8];case 7:return o=i.sent(),console.error("error when copy ".concat(0===e.length?"src":"src[".concat(e.join(".")),"]"),o),[3,8];case 8:return[2]}var a,s}))})),function(t,n){return e.apply(this,arguments)}),[l,c]);return{copy:u,reset:(0,i.useCallback)((function(){a(!1),s.current&&clearTimeout(s.current)}),[]),copied:o}}(),W=H.copy,q=H.copied,V=At((function(e){return e.highlightUpdates})),U=(0,i.useMemo)((function(){return!(!V||void 0===r||(void 0===n?"undefined":St(n))===(void 0===r?"undefined":St(r))&&("number"==typeof n?isNaN(n)&&isNaN(r)||n===r:Array.isArray(n)===Array.isArray(r)&&("object"==typeof n||"function"==typeof n||n===r)))}),[V,r,n]),K=(0,i.useRef)();(0,i.useEffect)((function(){K.current&&U&&"animate"in K.current&&K.current.animate([{backgroundColor:M},{backgroundColor:""}],{duration:1e3,easing:"ease-in"})}),[M,U,r,n]);var Q=(0,i.useMemo)((function(){return l(a,E?{children:[s(rn,{children:s(Gt,{sx:{fontSize:".8rem"},onClick:function(){C(!1),m(n)}})}),s(rn,{children:s(Ut,{sx:{fontSize:".8rem"},onClick:function(){C(!1),A(o,n,p)}})})]}:{children:[$&&s(rn,{onClick:function(e){e.preventDefault();try{W(o,n,Nt)}catch(e){console.error(e)}},children:s(q?Ut:Yt,{sx:{fontSize:".8rem"}})}),N&&f&&s(rn,{onClick:function(e){e.preventDefault(),C(!0),m(n)},children:s(Zt,{sx:{fontSize:".8rem"}})})]})}),[N,q,W,f,E,$,A,o,p,n]),G=(0,i.useMemo)((function(){return 0===Lt(n)}),[n]),Y=!G&&!(!L||!I),Z=At((function(e){return e.keyRenderer})),X=(0,i.useMemo)((function(){return{path:o,inspect:S,setInspect:O,value:n,prevValue:r}}),[S,o,O,n,r]);return l(se,{className:"data-key-pair","data-testid":"data-key-pair"+o.join("."),sx:{userSelect:"text"},onMouseEnter:(0,i.useCallback)((function(){return x(o,c)}),[x,o,c]),children:[l(Ft,{component:"span",className:"data-key",sx:{lineHeight:1.5,color:j,letterSpacing:.5,opacity:.8},onClick:(0,i.useCallback)((function(e){e.isDefaultPrevented()||G||O((function(e){return!e}))}),[G,O]),children:[Y?s(S?Xt:Kt,{sx:{fontSize:".8rem","&:hover":{cursor:"pointer"}}}):null,s(se,{ref:K,component:"span",children:F?!1!==D?z?l(a,{children:['"',D,'"']}):s(a,{children:D}):null:Z.when(X)?s(Z,mt({},X)):void 0===c&&(B?s(se,{component:"span",style:{color:P},children:y}):z?l(a,{children:['"',y,'"']}):s(a,{children:y}))}),F?!1!==D&&s(Ft,{sx:{mr:.5},children:":"}):void 0===c&&s(Ft,{sx:{mr:.5},children:":"}),L&&s(L,mt({},X)),b&&Y&&S&&Q]}),E&&f?N&&s(N,{value:p,setValue:m}):T?s(T,mt({},X)):s(se,{component:"span",className:"data-value-fallback",children:"fallback: ".concat(n)}),I&&s(I,mt({},X)),b&&Y&&!S&&Q,b&&!Y&&Q]})},an="(prefers-color-scheme: dark)";function sn(e,t){var n=(0,i.useContext)(Ct).setState;(0,i.useEffect)((function(){void 0!==t&&n(pt({},e,t))}),[e,t,n])}var ln=function(e){var t=(0,i.useContext)(Ct).setState;(0,i.useEffect)((function(){t((function(t){return{prevValue:t.value,value:e.value}}))}),[e.value,t]),sn("editable",e.editable),sn("indentWidth",e.indentWidth),sn("onChange",e.onChange),sn("groupArraysAfterLength",e.groupArraysAfterLength),sn("keyRenderer",e.keyRenderer),sn("maxDisplayLength",e.maxDisplayLength),sn("enableClipboard",e.enableClipboard),sn("highlightUpdates",e.highlightUpdates),sn("rootName",e.rootName),sn("displayDataTypes",e.displayDataTypes),sn("displayObjectSize",e.displayObjectSize),sn("onCopy",e.onCopy),sn("onSelect",e.onSelect),(0,i.useEffect)((function(){"light"===e.theme?t({colorspace:Ot}):"dark"===e.theme?t({colorspace:_t}):"object"==typeof e.theme&&t({colorspace:e.theme})}),[t,e.theme]);var n=(0,i.useMemo)((function(){return"object"==typeof e.theme?"json-viewer-theme-custom":"dark"===e.theme?"json-viewer-theme-dark":"json-viewer-theme-light"}),[e.theme]),r=(0,i.useRef)(!0),o=(0,i.useMemo)((function(){return function(){var e=function(e){function n(e,t){var n,r;return Object.is(e.value,t.value)&&e.inspect&&t.inspect&&(null===(n=e.path)||void 0===n?void 0:n.join("."))===(null===(r=t.path)||void 0===r?void 0:r.join("."))}e.Component=(0,i.memo)(e.Component,n),e.Editor&&(e.Editor=(0,i.memo)(e.Editor,(function(e,t){return Object.is(e.value,t.value)}))),e.PreComponent&&(e.PreComponent=(0,i.memo)(e.PreComponent,n)),e.PostComponent&&(e.PostComponent=(0,i.memo)(e.PostComponent,n)),t.push(e)},t=[];e(mt({is:function(e){return"boolean"==typeof e}},$t("bool",(function(e){var t=e.value;return s(a,{children:t?"true":"false"})}),{colorKey:"base0E",fromString:function(e){return Boolean(e)}})));var n={weekday:"short",year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};e(mt({is:function(e){return Tt(e,Date)}},$t("date",(function(e){var t=e.value;return s(a,{children:t.toLocaleTimeString("en-us",n)})}),{colorKey:"base0D"}))),e(mt({is:function(e){return null===e}},$t("null",(function(){var e=At((function(e){return e.colorspace.base02}));return s(se,{sx:{fontSize:"0.8rem",backgroundColor:e,fontWeight:"bold",borderRadius:"3px",padding:"0.5px 2px"},children:"NULL"})}),{colorKey:"base08",displayTypeLabel:!1}))),e(mt({is:function(e){return void 0===e}},$t("undefined",(function(){var e=At((function(e){return e.colorspace.base02}));return s(se,{sx:{fontSize:"0.7rem",backgroundColor:e,borderRadius:"3px",padding:"0.5px 2px"},children:"undefined"})}),{colorKey:"base05",displayTypeLabel:!1}))),e(mt({is:function(e){return"string"==typeof e}},$t("string",(function(e){var t=kt((0,i.useState)(!1),2),n=t[0],r=t[1],o=At((function(e){return e.collapseStringsAfterLength})),a=n?e.value:e.value.slice(0,o),c=e.value.length>o;return l(se,{component:"span",sx:{overflowWrap:"anywhere",cursor:c?"pointer":"inherit"},onClick:function(){c&&r((function(e){return!e}))},children:['"',a,c&&!n&&s(se,{component:"span",sx:{padding:.5},children:"…"}),'"']})}),{colorKey:"base09",fromString:function(e){return e}}))),e({is:function(e){return"function"==typeof e},Component:qt,PreComponent:Ht,PostComponent:Wt});var r=function(e){return e%1==0};return e(mt({is:function(e){return"number"==typeof e&&isNaN(e)}},$t("NaN",(function(){var e=At((function(e){return e.colorspace.base02}));return s(se,{sx:{backgroundColor:e,fontSize:"0.8rem",fontWeight:"bold",borderRadius:"3px"},children:"NaN"})}),{colorKey:"base08",displayTypeLabel:!1}))),e(mt({is:function(e){return"number"==typeof e&&!r(e)}},$t("float",(function(e){var t=e.value;return s(a,{children:t})}),{colorKey:"base0B",fromString:function(e){return parseFloat(e)}}))),e(mt({is:function(e){return"number"==typeof e&&r(e)}},$t("int",(function(e){var t=e.value;return s(a,{children:t})}),{colorKey:"base0F",fromString:function(e){return parseInt(e)}}))),e(mt({is:function(e){return"bigint"===(void 0===e?"undefined":St(e))}},$t("bigint",(function(e){var t=e.value;return s(a,{children:"".concat(t,"n")})}),{colorKey:"base0F",fromString:function(e){return BigInt(e.replace(/\D/g,""))}}))),t}()}),[]),c=tn((function(e){return e.registerTypes}));if(r.current){var u=e.valueTypes?bt(o).concat(bt(e.valueTypes)):bt(o);c(u),r.current=!1}(0,i.useEffect)((function(){var t=e.valueTypes?bt(o).concat(bt(e.valueTypes)):bt(o);c(t)}),[e.valueTypes,o,c]);var h=At((function(e){return e.value})),f=At((function(e){return e.prevValue})),d=At((function(e){return e.setHover})),p=(0,i.useCallback)((function(){return d(null)}),[d]);return s(Qe,{elevation:0,className:wt(n,e.className),style:e.style,sx:mt({fontFamily:"monospace",userSelect:"none",contentVisibility:"auto"},e.sx),onMouseLeave:p,children:s(on,{value:h,prevValue:f,path:(0,i.useMemo)((function(){return[]}),[])})})},cn=function(e){var t,n,r,o,a=(n=(t=kt((0,i.useState)(!1),2))[0],r=t[1],(0,i.useEffect)((function(){var e=function(e){r(e.matches)};r(window.matchMedia(an).matches);var t=window.matchMedia(an);return t.addEventListener("change",e),function(){return t.removeEventListener("change",e)}}),[]),n),l=(0,i.useMemo)((function(){return"auto"===e.theme?a?"light":"dark":null!==(o=e.theme)&&void 0!==o?o:"light"}),[a,e.theme]),c=(0,i.useMemo)((function(){var e="object"==typeof l?l.base00:"dark"===l?_t.base00:Ot.base00;return J({components:{MuiPaper:{styleOverrides:{root:{backgroundColor:e}}}},palette:{mode:"dark"===l?"dark":"light",background:{default:e}}})}),[l]),u=gt(mt({},e),{theme:l}),h=(0,i.useMemo)((function(){return function(e){var t,n,r,o,i,a,s,l,c,u,h,f,d,p,m,g,y,v;return(v?ft(v):ft)((function(v,b){return{enableClipboard:null===(t=e.enableClipboard)||void 0===t||t,highlightUpdates:null!==(n=e.highlightUpdates)&&void 0!==n&&n,indentWidth:null!==(r=e.indentWidth)&&void 0!==r?r:3,groupArraysAfterLength:null!==(o=e.groupArraysAfterLength)&&void 0!==o?o:100,collapseStringsAfterLength:!1===e.collapseStringsAfterLength?Number.MAX_VALUE:null!==(i=e.collapseStringsAfterLength)&&void 0!==i?i:50,maxDisplayLength:null!==(a=e.maxDisplayLength)&&void 0!==a?a:30,rootName:null!==(s=e.rootName)&&void 0!==s?s:"root",onChange:null!==(l=e.onChange)&&void 0!==l?l:function(){},onCopy:null!==(c=e.onCopy)&&void 0!==c?c:void 0,onSelect:null!==(u=e.onSelect)&&void 0!==u?u:void 0,keyRenderer:null!==(h=e.keyRenderer)&&void 0!==h?h:Et,editable:null!==(f=e.editable)&&void 0!==f&&f,defaultInspectDepth:null!==(d=e.defaultInspectDepth)&&void 0!==d?d:5,objectSortKeys:null!==(p=e.objectSortKeys)&&void 0!==p&&p,quotesOnKeys:null===(m=e.quotesOnKeys)||void 0===m||m,displayDataTypes:null===(g=e.displayDataTypes)||void 0===g||g,inspectCache:{},hoverPath:null,colorspace:Ot,value:e.value,prevValue:void 0,displayObjectSize:null===(y=e.displayObjectSize)||void 0===y||y,getInspectCache:function(e,t){var n=void 0!==t?e.join(".")+"[".concat(t,"]nt"):e.join(".");return b().inspectCache[n]},setInspectCache:function(e,t,n){var r=void 0!==n?e.join(".")+"[".concat(n,"]nt"):e.join(".");v((function(e){return{inspectCache:gt(mt({},e.inspectCache),pt({},r,"function"==typeof t?t(e.inspectCache[r]):t))}}))},setHover:function(e,t){v({hoverPath:e?{path:e,nestedIndex:t}:null})}}}))}(e)}),[]),f=(0,i.useMemo)((function(){return it()((function(e){return{registry:[],registerTypes:function(t){e((function(e){return{registry:"function"==typeof t?t(e.registry):t}}))}}}))}),[]);return s(rt,{theme:c,children:s(en.Provider,{value:f,children:s(Ct.Provider,{value:h,children:s(ln,mt({},u))})})})}},2262:(e,t,n)=>{"use strict";function r(e){return e+.5|0}n.d(t,{A6:()=>yn,E8:()=>Vr,PP:()=>fo,t1:()=>Dr,s$:()=>Gr,kc:()=>go,m_:()=>uo});const o=(e,t,n)=>Math.max(Math.min(e,n),t);function i(e){return o(r(2.55*e),0,255)}function a(e){return o(r(255*e),0,255)}function s(e){return o(r(e/2.55)/100,0,1)}function l(e){return o(r(100*e),0,100)}const c={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},u=[..."0123456789ABCDEF"],h=e=>u[15&e],f=e=>u[(240&e)>>4]+u[15&e],d=e=>(240&e)>>4==(15&e);const p=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function m(e,t,n){const r=t*Math.min(n,1-n),o=(t,o=(t+e/30)%12)=>n-r*Math.max(Math.min(o-3,9-o,1),-1);return[o(0),o(8),o(4)]}function g(e,t,n){const r=(r,o=(r+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[r(5),r(3),r(1)]}function y(e,t,n){const r=m(e,1,.5);let o;for(t+n>1&&(o=1/(t+n),t*=o,n*=o),o=0;o<3;o++)r[o]*=1-t-n,r[o]+=t;return r}function v(e){const t=e.r/255,n=e.g/255,r=e.b/255,o=Math.max(t,n,r),i=Math.min(t,n,r),a=(o+i)/2;let s,l,c;return o!==i&&(c=o-i,l=a>.5?c/(2-o-i):c/(o+i),s=function(e,t,n,r,o){return e===o?(t-n)/r+(t<n?6:0):t===o?(n-e)/r+2:(e-t)/r+4}(t,n,r,c,o),s=60*s+.5),[0|s,l||0,a]}function b(e,t,n,r){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,r)).map(a)}function x(e,t,n){return b(m,e,t,n)}function w(e){return(e%360+360)%360}const k={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},S={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};let O;const _=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/,E=e=>e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055,C=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function A(e,t,n){if(e){let r=v(e);r[t]=Math.max(0,Math.min(r[t]+r[t]*n,0===t?360:1)),r=x(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function j(e,t){return e?Object.assign(t||{},e):e}function P(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=a(e[3]))):(t=j(e,{r:0,g:0,b:0,a:1})).a=a(t.a),t}function M(e){return"r"===e.charAt(0)?function(e){const t=_.exec(e);let n,r,a,s=255;if(t){if(t[7]!==n){const e=+t[7];s=t[8]?i(e):o(255*e,0,255)}return n=+t[1],r=+t[3],a=+t[5],n=255&(t[2]?i(n):o(n,0,255)),r=255&(t[4]?i(r):o(r,0,255)),a=255&(t[6]?i(a):o(a,0,255)),{r:n,g:r,b:a,a:s}}}(e):function(e){const t=p.exec(e);let n,r=255;if(!t)return;t[5]!==n&&(r=t[6]?i(+t[5]):a(+t[5]));const o=w(+t[2]),s=+t[3]/100,l=+t[4]/100;return n="hwb"===t[1]?function(e,t,n){return b(y,e,t,n)}(o,s,l):"hsv"===t[1]?function(e,t,n){return b(g,e,t,n)}(o,s,l):x(o,s,l),{r:n[0],g:n[1],b:n[2],a:r}}(e)}class R{constructor(e){if(e instanceof R)return e;const t=typeof e;let n;var r,o,i;"object"===t?n=P(e):"string"===t&&(i=(r=e).length,"#"===r[0]&&(4===i||5===i?o={r:255&17*c[r[1]],g:255&17*c[r[2]],b:255&17*c[r[3]],a:5===i?17*c[r[4]]:255}:7!==i&&9!==i||(o={r:c[r[1]]<<4|c[r[2]],g:c[r[3]]<<4|c[r[4]],b:c[r[5]]<<4|c[r[6]],a:9===i?c[r[7]]<<4|c[r[8]]:255})),n=o||function(e){O||(O=function(){const e={},t=Object.keys(S),n=Object.keys(k);let r,o,i,a,s;for(r=0;r<t.length;r++){for(a=s=t[r],o=0;o<n.length;o++)i=n[o],s=s.replace(i,k[i]);i=parseInt(S[a],16),e[s]=[i>>16&255,i>>8&255,255&i]}return e}(),O.transparent=[0,0,0,0]);const t=O[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:4===t.length?t[3]:255}}(e)||M(e)),this._rgb=n,this._valid=!!n}get valid(){return this._valid}get rgb(){var e=j(this._rgb);return e&&(e.a=s(e.a)),e}set rgb(e){this._rgb=P(e)}rgbString(){return this._valid?(e=this._rgb)&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${s(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`):void 0;var e}hexString(){return this._valid?(e=this._rgb,t=(e=>d(e.r)&&d(e.g)&&d(e.b)&&d(e.a))(e)?h:f,e?"#"+t(e.r)+t(e.g)+t(e.b)+((e,t)=>e<255?t(e):"")(e.a,t):void 0):void 0;var e,t}hslString(){return this._valid?function(e){if(!e)return;const t=v(e),n=t[0],r=l(t[1]),o=l(t[2]);return e.a<255?`hsla(${n}, ${r}%, ${o}%, ${s(e.a)})`:`hsl(${n}, ${r}%, ${o}%)`}(this._rgb):void 0}mix(e,t){if(e){const n=this.rgb,r=e.rgb;let o;const i=t===o?.5:t,a=2*i-1,s=n.a-r.a,l=((a*s==-1?a:(a+s)/(1+a*s))+1)/2;o=1-l,n.r=255&l*n.r+o*r.r+.5,n.g=255&l*n.g+o*r.g+.5,n.b=255&l*n.b+o*r.b+.5,n.a=i*n.a+(1-i)*r.a,this.rgb=n}return this}interpolate(e,t){return e&&(this._rgb=function(e,t,n){const r=C(s(e.r)),o=C(s(e.g)),i=C(s(e.b));return{r:a(E(r+n*(C(s(t.r))-r))),g:a(E(o+n*(C(s(t.g))-o))),b:a(E(i+n*(C(s(t.b))-i))),a:e.a+n*(t.a-e.a)}}(this._rgb,e._rgb,t)),this}clone(){return new R(this.rgb)}alpha(e){return this._rgb.a=a(e),this}clearer(e){return this._rgb.a*=1-e,this}greyscale(){const e=this._rgb,t=r(.3*e.r+.59*e.g+.11*e.b);return e.r=e.g=e.b=t,this}opaquer(e){return this._rgb.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return A(this._rgb,2,e),this}darken(e){return A(this._rgb,2,-e),this}saturate(e){return A(this._rgb,1,e),this}desaturate(e){return A(this._rgb,1,-e),this}rotate(e){return function(e,t){var n=v(e);n[0]=w(n[0]+t),n=x(n),e.r=n[0],e.g=n[1],e.b=n[2]}(this._rgb,e),this}}function T(){}const L=(()=>{let e=0;return()=>e++})();function I(e){return null==e}function N(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return"[object"===t.slice(0,7)&&"Array]"===t.slice(-6)}function z(e){return null!==e&&"[object Object]"===Object.prototype.toString.call(e)}function D(e){return("number"==typeof e||e instanceof Number)&&isFinite(+e)}function F(e,t){return D(e)?e:t}function B(e,t){return void 0===e?t:e}function $(e,t,n){if(e&&"function"==typeof e.call)return e.apply(n,t)}function H(e,t,n,r){let o,i,a;if(N(e))if(i=e.length,r)for(o=i-1;o>=0;o--)t.call(n,e[o],o);else for(o=0;o<i;o++)t.call(n,e[o],o);else if(z(e))for(a=Object.keys(e),i=a.length,o=0;o<i;o++)t.call(n,e[a[o]],a[o])}function W(e,t){let n,r,o,i;if(!e||!t||e.length!==t.length)return!1;for(n=0,r=e.length;n<r;++n)if(o=e[n],i=t[n],o.datasetIndex!==i.datasetIndex||o.index!==i.index)return!1;return!0}function q(e){if(N(e))return e.map(q);if(z(e)){const t=Object.create(null),n=Object.keys(e),r=n.length;let o=0;for(;o<r;++o)t[n[o]]=q(e[n[o]]);return t}return e}function V(e){return-1===["__proto__","prototype","constructor"].indexOf(e)}function U(e,t,n,r){if(!V(e))return;const o=t[e],i=n[e];z(o)&&z(i)?K(o,i,r):t[e]=q(i)}function K(e,t,n){const r=N(t)?t:[t],o=r.length;if(!z(e))return e;const i=(n=n||{}).merger||U;let a;for(let t=0;t<o;++t){if(a=r[t],!z(a))continue;const o=Object.keys(a);for(let t=0,r=o.length;t<r;++t)i(o[t],e,a,n)}return e}function Q(e,t){return K(e,t,{merger:G})}function G(e,t,n){if(!V(e))return;const r=t[e],o=n[e];z(r)&&z(o)?Q(r,o):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=q(o))}const Y={"":e=>e,x:e=>e.x,y:e=>e.y};function Z(e,t){const n=Y[t]||(Y[t]=function(e){const t=function(e){const t=e.split("."),n=[];let r="";for(const e of t)r+=e,r.endsWith("\\")?r=r.slice(0,-1)+".":(n.push(r),r="");return n}(e);return e=>{for(const n of t){if(""===n)break;e=e&&e[n]}return e}}(t));return n(e)}function X(e){return e.charAt(0).toUpperCase()+e.slice(1)}const J=e=>void 0!==e,ee=e=>"function"==typeof e,te=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0},ne=Math.PI,re=2*ne,oe=Number.POSITIVE_INFINITY,ie=ne/180,ae=ne/2,se=ne/4,le=2*ne/3,ce=Math.log10,ue=Math.sign;function he(e,t,n){return Math.abs(e-t)<n}function fe(e){const t=Math.round(e);e=he(e,t,e/1e3)?t:e;const n=Math.pow(10,Math.floor(ce(e))),r=e/n;return(r<=1?1:r<=2?2:r<=5?5:10)*n}function de(e){return!isNaN(parseFloat(e))&&isFinite(e)}function pe(e){return e*(ne/180)}function me(e){if(!D(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function ge(e){return(e%re+re)%re}function ye(e,t,n){return Math.max(t,Math.min(n,e))}function ve(e,t,n,r=1e-6){return e>=Math.min(t,n)-r&&e<=Math.max(t,n)+r}function be(e,t,n){n=n||(n=>e[n]<t);let r,o=e.length-1,i=0;for(;o-i>1;)r=i+o>>1,n(r)?i=r:o=r;return{lo:i,hi:o}}const xe=(e,t,n,r)=>be(e,n,r?r=>{const o=e[r][t];return o<n||o===n&&e[r+1][t]===n}:r=>e[r][t]<n),we=(e,t,n)=>be(e,n,(r=>e[r][t]>=n)),ke=["push","pop","shift","splice","unshift"];function Se(e,t){const n=e._chartjs;if(!n)return;const r=n.listeners,o=r.indexOf(t);-1!==o&&r.splice(o,1),r.length>0||(ke.forEach((t=>{delete e[t]})),delete e._chartjs)}const Oe="undefined"==typeof window?function(e){return e()}:window.requestAnimationFrame;function _e(e,t){let n=[],r=!1;return function(...o){n=o,r||(r=!0,Oe.call(window,(()=>{r=!1,e.apply(t,n)})))}}const Ee=e=>"start"===e?"left":"end"===e?"right":"center",Ce=(e,t,n)=>"start"===e?t:"end"===e?n:(t+n)/2,Ae=e=>0===e||1===e,je=(e,t,n)=>-Math.pow(2,10*(e-=1))*Math.sin((e-t)*re/n),Pe=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*re/n)+1,Me={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>1-Math.cos(e*ae),easeOutSine:e=>Math.sin(e*ae),easeInOutSine:e=>-.5*(Math.cos(ne*e)-1),easeInExpo:e=>0===e?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>1===e?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>Ae(e)?e:e<.5?.5*Math.pow(2,10*(2*e-1)):.5*(2-Math.pow(2,-10*(2*e-1))),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>Ae(e)?e:je(e,.075,.3),easeOutElastic:e=>Ae(e)?e:Pe(e,.075,.3),easeInOutElastic(e){const t=.1125;return Ae(e)?e:e<.5?.5*je(2*e,t,.45):.5+.5*Pe(2*e-1,t,.45)},easeInBack(e){const t=1.70158;return e*e*((t+1)*e-t)},easeOutBack(e){const t=1.70158;return(e-=1)*e*((t+1)*e+t)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?e*e*((1+(t*=1.525))*e-t)*.5:.5*((e-=2)*e*((1+(t*=1.525))*e+t)+2)},easeInBounce:e=>1-Me.easeOutBounce(1-e),easeOutBounce(e){const t=7.5625,n=2.75;return e<1/n?t*e*e:e<2/n?t*(e-=1.5/n)*e+.75:e<2.5/n?t*(e-=2.25/n)*e+.9375:t*(e-=2.625/n)*e+.984375},easeInOutBounce:e=>e<.5?.5*Me.easeInBounce(2*e):.5*Me.easeOutBounce(2*e-1)+.5};function Re(e){if(e&&"object"==typeof e){const t=e.toString();return"[object CanvasPattern]"===t||"[object CanvasGradient]"===t}return!1}function Te(e){return Re(e)?e:new R(e)}function Le(e){return Re(e)?e:new R(e).saturate(.5).darken(.1).hexString()}const Ie=["x","y","borderWidth","radius","tension"],Ne=["color","borderColor","backgroundColor"],ze=new Map;function De(e,t,n){return function(e,t){t=t||{};const n=e+JSON.stringify(t);let r=ze.get(n);return r||(r=new Intl.NumberFormat(e,t),ze.set(n,r)),r}(t,n).format(e)}const Fe={values:e=>N(e)?e:""+e,numeric(e,t,n){if(0===e)return"0";const r=this.chart.options.locale;let o,i=e;if(n.length>1){const t=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(t<1e-4||t>1e15)&&(o="scientific"),i=function(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}(e,n)}const a=ce(Math.abs(i)),s=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:o,minimumFractionDigits:s,maximumFractionDigits:s};return Object.assign(l,this.options.ticks.format),De(e,r,l)},logarithmic(e,t,n){if(0===e)return"0";const r=n[t].significand||e/Math.pow(10,Math.floor(ce(e)));return[1,2,3,5,10,15].includes(r)||t>.8*n.length?Fe.numeric.call(this,e,t,n):""}};var Be={formatters:Fe};const $e=Object.create(null),He=Object.create(null);function We(e,t){if(!t)return e;const n=t.split(".");for(let t=0,r=n.length;t<r;++t){const r=n[t];e=e[r]||(e[r]=Object.create(null))}return e}function qe(e,t,n){return"string"==typeof t?K(We(e,t),n):K(We(e,""),t)}class Ve{constructor(e,t){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=e=>e.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(e,t)=>Le(t.backgroundColor),this.hoverBorderColor=(e,t)=>Le(t.borderColor),this.hoverColor=(e,t)=>Le(t.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e),this.apply(t)}set(e,t){return qe(this,e,t)}get(e){return We(this,e)}describe(e,t){return qe(He,e,t)}override(e,t){return qe($e,e,t)}route(e,t,n,r){const o=We(this,e),i=We(this,n),a="_"+t;Object.defineProperties(o,{[a]:{value:o[t],writable:!0},[t]:{enumerable:!0,get(){const e=this[a],t=i[r];return z(e)?Object.assign({},t,e):B(e,t)},set(e){this[a]=e}}})}apply(e){e.forEach((e=>e(this)))}}var Ue=new Ve({_scriptable:e=>!e.startsWith("on"),_indexable:e=>"events"!==e,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:e=>"onProgress"!==e&&"onComplete"!==e&&"fn"!==e}),e.set("animations",{colors:{type:"color",properties:Ne},numbers:{type:"number",properties:Ie}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:e=>0|e}}}})},function(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(e,t)=>t.lineWidth,tickColor:(e,t)=>t.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Be.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:e=>!e.startsWith("before")&&!e.startsWith("after")&&"callback"!==e&&"parser"!==e,_indexable:e=>"borderDash"!==e&&"tickBorderDash"!==e&&"dash"!==e}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:e=>"backdropPadding"!==e&&"callback"!==e,_indexable:e=>"backdropPadding"!==e})}]);function Ke(e,t,n,r,o){let i=t[o];return i||(i=t[o]=e.measureText(o).width,n.push(o)),i>r&&(r=i),r}function Qe(e,t,n){const r=e.currentDevicePixelRatio,o=0!==n?Math.max(n/2,.5):0;return Math.round((t-o)*r)/r+o}function Ge(e,t){(t||e)&&((t=t||e.getContext("2d")).save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function Ye(e,t,n,r){Ze(e,t,n,r,null)}function Ze(e,t,n,r,o){let i,a,s,l,c,u,h,f;const d=t.pointStyle,p=t.rotation,m=t.radius;let g=(p||0)*ie;if(d&&"object"==typeof d&&(i=d.toString(),"[object HTMLImageElement]"===i||"[object HTMLCanvasElement]"===i))return e.save(),e.translate(n,r),e.rotate(g),e.drawImage(d,-d.width/2,-d.height/2,d.width,d.height),void e.restore();if(!(isNaN(m)||m<=0)){switch(e.beginPath(),d){default:o?e.ellipse(n,r,o/2,m,0,0,re):e.arc(n,r,m,0,re),e.closePath();break;case"triangle":u=o?o/2:m,e.moveTo(n+Math.sin(g)*u,r-Math.cos(g)*m),g+=le,e.lineTo(n+Math.sin(g)*u,r-Math.cos(g)*m),g+=le,e.lineTo(n+Math.sin(g)*u,r-Math.cos(g)*m),e.closePath();break;case"rectRounded":c=.516*m,l=m-c,a=Math.cos(g+se)*l,h=Math.cos(g+se)*(o?o/2-c:l),s=Math.sin(g+se)*l,f=Math.sin(g+se)*(o?o/2-c:l),e.arc(n-h,r-s,c,g-ne,g-ae),e.arc(n+f,r-a,c,g-ae,g),e.arc(n+h,r+s,c,g,g+ae),e.arc(n-f,r+a,c,g+ae,g+ne),e.closePath();break;case"rect":if(!p){l=Math.SQRT1_2*m,u=o?o/2:l,e.rect(n-u,r-l,2*u,2*l);break}g+=se;case"rectRot":h=Math.cos(g)*(o?o/2:m),a=Math.cos(g)*m,s=Math.sin(g)*m,f=Math.sin(g)*(o?o/2:m),e.moveTo(n-h,r-s),e.lineTo(n+f,r-a),e.lineTo(n+h,r+s),e.lineTo(n-f,r+a),e.closePath();break;case"crossRot":g+=se;case"cross":h=Math.cos(g)*(o?o/2:m),a=Math.cos(g)*m,s=Math.sin(g)*m,f=Math.sin(g)*(o?o/2:m),e.moveTo(n-h,r-s),e.lineTo(n+h,r+s),e.moveTo(n+f,r-a),e.lineTo(n-f,r+a);break;case"star":h=Math.cos(g)*(o?o/2:m),a=Math.cos(g)*m,s=Math.sin(g)*m,f=Math.sin(g)*(o?o/2:m),e.moveTo(n-h,r-s),e.lineTo(n+h,r+s),e.moveTo(n+f,r-a),e.lineTo(n-f,r+a),g+=se,h=Math.cos(g)*(o?o/2:m),a=Math.cos(g)*m,s=Math.sin(g)*m,f=Math.sin(g)*(o?o/2:m),e.moveTo(n-h,r-s),e.lineTo(n+h,r+s),e.moveTo(n+f,r-a),e.lineTo(n-f,r+a);break;case"line":a=o?o/2:Math.cos(g)*m,s=Math.sin(g)*m,e.moveTo(n-a,r-s),e.lineTo(n+a,r+s);break;case"dash":e.moveTo(n,r),e.lineTo(n+Math.cos(g)*(o?o/2:m),r+Math.sin(g)*m);break;case!1:e.closePath()}e.fill(),t.borderWidth>0&&e.stroke()}}function Xe(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function Je(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function et(e){e.restore()}function tt(e,t,n,r,o){if(o.strikethrough||o.underline){const i=e.measureText(r),a=t-i.actualBoundingBoxLeft,s=t+i.actualBoundingBoxRight,l=n-i.actualBoundingBoxAscent,c=n+i.actualBoundingBoxDescent,u=o.strikethrough?(l+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=o.decorationWidth||2,e.moveTo(a,u),e.lineTo(s,u),e.stroke()}}function nt(e,t){const n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function rt(e,t,n,r,o,i={}){const a=N(t)?t:[t],s=i.strokeWidth>0&&""!==i.strokeColor;let l,c;for(e.save(),e.font=o.string,function(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),I(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}(e,i),l=0;l<a.length;++l)c=a[l],i.backdrop&&nt(e,i.backdrop),s&&(i.strokeColor&&(e.strokeStyle=i.strokeColor),I(i.strokeWidth)||(e.lineWidth=i.strokeWidth),e.strokeText(c,n,r,i.maxWidth)),e.fillText(c,n,r,i.maxWidth),tt(e,n,r,c,i),r+=Number(o.lineHeight);e.restore()}function ot(e,t){const{x:n,y:r,w:o,h:i,radius:a}=t;e.arc(n+a.topLeft,r+a.topLeft,a.topLeft,1.5*ne,ne,!0),e.lineTo(n,r+i-a.bottomLeft),e.arc(n+a.bottomLeft,r+i-a.bottomLeft,a.bottomLeft,ne,ae,!0),e.lineTo(n+o-a.bottomRight,r+i),e.arc(n+o-a.bottomRight,r+i-a.bottomRight,a.bottomRight,ae,0,!0),e.lineTo(n+o,r+a.topRight),e.arc(n+o-a.topRight,r+a.topRight,a.topRight,0,-ae,!0),e.lineTo(n+a.topLeft,r)}const it=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,at=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function st(e,t){const n=(""+e).match(it);if(!n||"normal"===n[1])return 1.2*t;switch(e=+n[2],n[3]){case"px":return e;case"%":e/=100}return t*e}const lt=e=>+e||0;function ct(e,t){const n={},r=z(t),o=r?Object.keys(t):t,i=z(e)?r?n=>B(e[n],e[t[n]]):t=>e[t]:()=>e;for(const e of o)n[e]=lt(i(e));return n}function ut(e){return ct(e,{top:"y",right:"x",bottom:"y",left:"x"})}function ht(e){return ct(e,["topLeft","topRight","bottomLeft","bottomRight"])}function ft(e){const t=ut(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function dt(e,t){e=e||{},t=t||Ue.font;let n=B(e.size,t.size);"string"==typeof n&&(n=parseInt(n,10));let r=B(e.style,t.style);r&&!(""+r).match(at)&&(console.warn('Invalid font style specified: "'+r+'"'),r=void 0);const o={family:B(e.family,t.family),lineHeight:st(B(e.lineHeight,t.lineHeight),n),size:n,style:r,weight:B(e.weight,t.weight),string:""};return o.string=function(e){return!e||I(e.size)||I(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}(o),o}function pt(e,t,n,r){let o,i,a,s=!0;for(o=0,i=e.length;o<i;++o)if(a=e[o],void 0!==a&&(void 0!==t&&"function"==typeof a&&(a=a(t),s=!1),void 0!==n&&N(a)&&(a=a[n%a.length],s=!1),void 0!==a))return r&&!s&&(r.cacheable=!1),a}function mt(e,t){return Object.assign(Object.create(e),t)}function gt(e,t=[""],n,r,o=(()=>e[0])){const i=n||e;void 0===r&&(r=Ct("_fallback",e));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:i,_fallback:r,_getTarget:o,override:n=>gt([n,...e],t,i,r)};return new Proxy(a,{deleteProperty:(t,n)=>(delete t[n],delete t._keys,delete e[0][n],!0),get:(n,r)=>wt(n,r,(()=>function(e,t,n,r){let o;for(const i of t)if(o=Ct(bt(i,e),n),void 0!==o)return xt(e,o)?_t(n,r,e,o):o}(r,t,e,n))),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(e._scopes[0],t),getPrototypeOf:()=>Reflect.getPrototypeOf(e[0]),has:(e,t)=>At(e).includes(t),ownKeys:e=>At(e),set(e,t,n){const r=e._storage||(e._storage=o());return e[t]=r[t]=n,delete e._keys,!0}})}function yt(e,t,n,r){const o={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:vt(e,r),setContext:t=>yt(e,t,n,r),override:o=>yt(e.override(o),t,n,r)};return new Proxy(o,{deleteProperty:(t,n)=>(delete t[n],delete e[n],!0),get:(e,t,n)=>wt(e,t,(()=>function(e,t,n){const{_proxy:r,_context:o,_subProxy:i,_descriptors:a}=e;let s=r[t];return ee(s)&&a.isScriptable(t)&&(s=function(e,t,n,r){const{_proxy:o,_context:i,_subProxy:a,_stack:s}=n;if(s.has(e))throw new Error("Recursion detected: "+Array.from(s).join("->")+"->"+e);s.add(e);let l=t(i,a||r);return s.delete(e),xt(e,l)&&(l=_t(o._scopes,o,e,l)),l}(t,s,e,n)),N(s)&&s.length&&(s=function(e,t,n,r){const{_proxy:o,_context:i,_subProxy:a,_descriptors:s}=n;if(void 0!==i.index&&r(e))return t[i.index%t.length];if(z(t[0])){const n=t,r=o._scopes.filter((e=>e!==n));t=[];for(const l of n){const n=_t(r,o,e,l);t.push(yt(n,i,a&&a[e],s))}}return t}(t,s,e,a.isIndexable)),xt(t,s)&&(s=yt(s,o,i&&i[t],a)),s}(e,t,n))),getOwnPropertyDescriptor:(t,n)=>t._descriptors.allKeys?Reflect.has(e,n)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,n),getPrototypeOf:()=>Reflect.getPrototypeOf(e),has:(t,n)=>Reflect.has(e,n),ownKeys:()=>Reflect.ownKeys(e),set:(t,n,r)=>(e[n]=r,delete t[n],!0)})}function vt(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:r=t.indexable,_allKeys:o=t.allKeys}=e;return{allKeys:o,scriptable:n,indexable:r,isScriptable:ee(n)?n:()=>n,isIndexable:ee(r)?r:()=>r}}const bt=(e,t)=>e?e+X(t):t,xt=(e,t)=>z(t)&&"adapters"!==e&&(null===Object.getPrototypeOf(t)||t.constructor===Object);function wt(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||"constructor"===t)return e[t];const r=n();return e[t]=r,r}function kt(e,t,n){return ee(e)?e(t,n):e}const St=(e,t)=>!0===e?t:"string"==typeof e?Z(t,e):void 0;function Ot(e,t,n,r,o){for(const i of t){const t=St(n,i);if(t){e.add(t);const i=kt(t._fallback,n,o);if(void 0!==i&&i!==n&&i!==r)return i}else if(!1===t&&void 0!==r&&n!==r)return null}return!1}function _t(e,t,n,r){const o=t._rootScopes,i=kt(t._fallback,n,r),a=[...e,...o],s=new Set;s.add(r);let l=Et(s,a,n,i||n,r);return null!==l&&(void 0===i||i===n||(l=Et(s,a,i,l,r),null!==l))&&gt(Array.from(s),[""],o,i,(()=>function(e,t,n){const r=e._getTarget();t in r||(r[t]={});const o=r[t];return N(o)&&z(n)?n:o||{}}(t,n,r)))}function Et(e,t,n,r,o){for(;n;)n=Ot(e,t,n,r,o);return n}function Ct(e,t){for(const n of t){if(!n)continue;const t=n[e];if(void 0!==t)return t}}function At(e){let t=e._keys;return t||(t=e._keys=function(e){const t=new Set;for(const n of e)for(const e of Object.keys(n).filter((e=>!e.startsWith("_"))))t.add(e);return Array.from(t)}(e._scopes)),t}function jt(){return"undefined"!=typeof window&&"undefined"!=typeof document}function Pt(e){let t=e.parentNode;return t&&"[object ShadowRoot]"===t.toString()&&(t=t.host),t}function Mt(e,t,n){let r;return"string"==typeof e?(r=parseInt(e,10),-1!==e.indexOf("%")&&(r=r/100*t.parentNode[n])):r=e,r}Number.EPSILON;const Rt=e=>e.ownerDocument.defaultView.getComputedStyle(e,null),Tt=["top","right","bottom","left"];function Lt(e,t,n){const r={};n=n?"-"+n:"";for(let o=0;o<4;o++){const i=Tt[o];r[i]=parseFloat(e[t+"-"+i+n])||0}return r.width=r.left+r.right,r.height=r.top+r.bottom,r}const It=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function Nt(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:r}=t,o=Rt(n),i="border-box"===o.boxSizing,a=Lt(o,"padding"),s=Lt(o,"border","width"),{x:l,y:c,box:u}=function(e,t){const n=e.touches,r=n&&n.length?n[0]:e,{offsetX:o,offsetY:i}=r;let a,s,l=!1;if(It(o,i,e.target))a=o,s=i;else{const e=t.getBoundingClientRect();a=r.clientX-e.left,s=r.clientY-e.top,l=!0}return{x:a,y:s,box:l}}(e,n),h=a.left+(u&&s.left),f=a.top+(u&&s.top);let{width:d,height:p}=t;return i&&(d-=a.width+s.width,p-=a.height+s.height),{x:Math.round((l-h)/d*n.width/r),y:Math.round((c-f)/p*n.height/r)}}const zt=e=>Math.round(10*e)/10;function Dt(e,t,n){const r=t||1,o=Math.floor(e.height*r),i=Math.floor(e.width*r);e.height=Math.floor(e.height),e.width=Math.floor(e.width);const a=e.canvas;return a.style&&(n||!a.style.height&&!a.style.width)&&(a.style.height=`${e.height}px`,a.style.width=`${e.width}px`),(e.currentDevicePixelRatio!==r||a.height!==o||a.width!==i)&&(e.currentDevicePixelRatio=r,a.height=o,a.width=i,e.ctx.setTransform(r,0,0,r,0,0),!0)}const Ft=function(){let e=!1;try{const t={get passive(){return e=!0,!1}};jt()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch(e){}return e}();function Bt(e,t){const n=function(e,t){return Rt(e).getPropertyValue(t)}(e,t),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?+r[1]:void 0}function $t(e,t,n){return e?function(e,t){return{x:n=>e+e+t-n,setWidth(e){t=e},textAlign:e=>"center"===e?e:"right"===e?"left":"right",xPlus:(e,t)=>e-t,leftForLtr:(e,t)=>e-t}}(t,n):{x:e=>e,setWidth(e){},textAlign:e=>e,xPlus:(e,t)=>e+t,leftForLtr:(e,t)=>e}}function Ht(e,t){let n,r;"ltr"!==t&&"rtl"!==t||(n=e.canvas.style,r=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=r)}function Wt(e,t){void 0!==t&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}class qt{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,n,r){const o=t.listeners[r],i=t.duration;o.forEach((r=>r({chart:e,initial:t.initial,numSteps:i,currentStep:Math.min(n-t.start,i)})))}_refresh(){this._request||(this._running=!0,this._request=Oe.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(e=Date.now()){let t=0;this._charts.forEach(((n,r)=>{if(!n.running||!n.items.length)return;const o=n.items;let i,a=o.length-1,s=!1;for(;a>=0;--a)i=o[a],i._active?(i._total>n.duration&&(n.duration=i._total),i.tick(e),s=!0):(o[a]=o[o.length-1],o.pop());s&&(r.draw(),this._notify(r,n,e,"progress")),o.length||(n.running=!1,this._notify(r,n,e,"complete"),n.initial=!1),t+=o.length})),this._lastDate=e,0===t&&(this._running=!1)}_getAnims(e){const t=this._charts;let n=t.get(e);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,n)),n}listen(e,t,n){this._getAnims(e).listeners[t].push(n)}add(e,t){t&&t.length&&this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){const t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce(((e,t)=>Math.max(e,t._duration)),0),this._refresh())}running(e){if(!this._running)return!1;const t=this._charts.get(e);return!!(t&&t.running&&t.items.length)}stop(e){const t=this._charts.get(e);if(!t||!t.items.length)return;const n=t.items;let r=n.length-1;for(;r>=0;--r)n[r].cancel();t.items=[],this._notify(e,t,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var Vt=new qt;const Ut="transparent",Kt={boolean:(e,t,n)=>n>.5?t:e,color(e,t,n){const r=Te(e||Ut),o=r.valid&&Te(t||Ut);return o&&o.valid?o.mix(r,n).hexString():t},number:(e,t,n)=>e+(t-e)*n};class Qt{constructor(e,t,n,r){const o=t[n];r=pt([e.to,r,o,e.from]);const i=pt([e.from,o,r]);this._active=!0,this._fn=e.fn||Kt[e.type||typeof i],this._easing=Me[e.easing]||Me.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=n,this._from=i,this._to=r,this._promises=void 0}active(){return this._active}update(e,t,n){if(this._active){this._notify(!1);const r=this._target[this._prop],o=n-this._start,i=this._duration-o;this._start=n,this._duration=Math.floor(Math.max(i,e.duration)),this._total+=o,this._loop=!!e.loop,this._to=pt([e.to,t,r,e.from]),this._from=pt([e.from,r,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const t=e-this._start,n=this._duration,r=this._prop,o=this._from,i=this._loop,a=this._to;let s;if(this._active=o!==a&&(i||t<n),!this._active)return this._target[r]=a,void this._notify(!0);t<0?this._target[r]=o:(s=t/n%2,s=i&&s>1?2-s:s,s=this._easing(Math.min(1,Math.max(0,s))),this._target[r]=this._fn(o,a,s))}wait(){const e=this._promises||(this._promises=[]);return new Promise(((t,n)=>{e.push({res:t,rej:n})}))}_notify(e){const t=e?"res":"rej",n=this._promises||[];for(let e=0;e<n.length;e++)n[e][t]()}}class Gt{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!z(e))return;const t=Object.keys(Ue.animation),n=this._properties;Object.getOwnPropertyNames(e).forEach((r=>{const o=e[r];if(!z(o))return;const i={};for(const e of t)i[e]=o[e];(N(o.properties)&&o.properties||[r]).forEach((e=>{e!==r&&n.has(e)||n.set(e,i)}))}))}_animateOptions(e,t){const n=t.options,r=function(e,t){if(!t)return;let n=e.options;if(n)return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n;e.options=t}(e,n);if(!r)return[];const o=this._createAnimations(r,n);return n.$shared&&function(e,t){const n=[],r=Object.keys(t);for(let t=0;t<r.length;t++){const o=e[r[t]];o&&o.active()&&n.push(o.wait())}return Promise.all(n)}(e.options.$animations,n).then((()=>{e.options=n}),(()=>{})),o}_createAnimations(e,t){const n=this._properties,r=[],o=e.$animations||(e.$animations={}),i=Object.keys(t),a=Date.now();let s;for(s=i.length-1;s>=0;--s){const l=i[s];if("$"===l.charAt(0))continue;if("options"===l){r.push(...this._animateOptions(e,t));continue}const c=t[l];let u=o[l];const h=n.get(l);if(u){if(h&&u.active()){u.update(h,c,a);continue}u.cancel()}h&&h.duration?(o[l]=u=new Qt(h,e,l,c),r.push(u)):e[l]=c}return r}update(e,t){if(0===this._properties.size)return void Object.assign(e,t);const n=this._createAnimations(e,t);return n.length?(Vt.add(this._chart,n),!0):void 0}}function Yt(e,t){const n=e&&e.options||{},r=n.reverse,o=void 0===n.min?t:0,i=void 0===n.max?t:0;return{start:r?i:o,end:r?o:i}}function Zt(e,t){const n=[],r=e._getSortedDatasetMetas(t);let o,i;for(o=0,i=r.length;o<i;++o)n.push(r[o].index);return n}function Xt(e,t,n,r={}){const o=e.keys,i="single"===r.mode;let a,s,l,c;if(null!==t){for(a=0,s=o.length;a<s;++a){if(l=+o[a],l===n){if(r.all)continue;break}c=e.values[l],D(c)&&(i||0===t||ue(t)===ue(c))&&(t+=c)}return t}}function Jt(e,t){const n=e&&e.options.stacked;return n||void 0===n&&void 0!==t.stack}function en(e,t,n){const r=e[t]||(e[t]={});return r[n]||(r[n]={})}function tn(e,t,n,r){for(const o of t.getMatchingVisibleMetas(r).reverse()){const t=e[o.index];if(n&&t>0||!n&&t<0)return o.index}return null}function nn(e,t){const{chart:n,_cachedMeta:r}=e,o=n._stacks||(n._stacks={}),{iScale:i,vScale:a,index:s}=r,l=i.axis,c=a.axis,u=function(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}(i,a,r),h=t.length;let f;for(let e=0;e<h;++e){const n=t[e],{[l]:i,[c]:h}=n;f=(n._stacks||(n._stacks={}))[c]=en(o,u,i),f[s]=h,f._top=tn(f,a,!0,r.type),f._bottom=tn(f,a,!1,r.type),(f._visualValues||(f._visualValues={}))[s]=h}}function rn(e,t){const n=e.scales;return Object.keys(n).filter((e=>n[e].axis===t)).shift()}function on(e,t){const n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t=t||e._parsed;for(const e of t){const t=e._stacks;if(!t||void 0===t[r]||void 0===t[r][n])return;delete t[r][n],void 0!==t[r]._visualValues&&void 0!==t[r]._visualValues[n]&&delete t[r]._visualValues[n]}}}const an=e=>"reset"===e||"none"===e,sn=(e,t)=>t?e:Object.assign({},e);class ln{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=Jt(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(e){this.index!==e&&on(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,t=this._cachedMeta,n=this.getDataset(),r=(e,t,n,r)=>"x"===e?t:"r"===e?r:n,o=t.xAxisID=B(n.xAxisID,rn(e,"x")),i=t.yAxisID=B(n.yAxisID,rn(e,"y")),a=t.rAxisID=B(n.rAxisID,rn(e,"r")),s=t.indexAxis,l=t.iAxisID=r(s,o,i,a),c=t.vAxisID=r(s,i,o,a);t.xScale=this.getScaleForId(o),t.yScale=this.getScaleForId(i),t.rScale=this.getScaleForId(a),t.iScale=this.getScaleForId(l),t.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&Se(this._data,this),e._stacked&&on(e)}_dataCheck(){const e=this.getDataset(),t=e.data||(e.data=[]),n=this._data;if(z(t)){const e=this._cachedMeta;this._data=function(e,t){const{iScale:n,vScale:r}=t,o="x"===n.axis?"x":"y",i="x"===r.axis?"x":"y",a=Object.keys(e),s=new Array(a.length);let l,c,u;for(l=0,c=a.length;l<c;++l)u=a[l],s[l]={[o]:u,[i]:e[u]};return s}(t,e)}else if(n!==t){if(n){Se(n,this);const e=this._cachedMeta;on(e),e._parsed=[]}t&&Object.isExtensible(t)&&(this,(r=t)._chartjs?r._chartjs.listeners.push(this):(Object.defineProperty(r,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[this]}}),ke.forEach((e=>{const t="_onData"+X(e),n=r[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,value(...e){const o=n.apply(this,e);return r._chartjs.listeners.forEach((n=>{"function"==typeof n[t]&&n[t](...e)})),o}})})))),this._syncList=[],this._data=t}var r}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const t=this._cachedMeta,n=this.getDataset();let r=!1;this._dataCheck();const o=t._stacked;t._stacked=Jt(t.vScale,t),t.stack!==n.stack&&(r=!0,on(t),t.stack=n.stack),this._resyncElements(e),(r||o!==t._stacked)&&nn(this,t._parsed)}configure(){const e=this.chart.config,t=e.datasetScopeKeys(this._type),n=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){const{_cachedMeta:n,_data:r}=this,{iScale:o,_stacked:i}=n,a=o.axis;let s,l,c,u=0===e&&t===r.length||n._sorted,h=e>0&&n._parsed[e-1];if(!1===this._parsing)n._parsed=r,n._sorted=!0,c=r;else{c=N(r[e])?this.parseArrayData(n,r,e,t):z(r[e])?this.parseObjectData(n,r,e,t):this.parsePrimitiveData(n,r,e,t);const o=()=>null===l[a]||h&&l[a]<h[a];for(s=0;s<t;++s)n._parsed[s+e]=l=c[s],u&&(o()&&(u=!1),h=l);n._sorted=u}i&&nn(this,c)}parsePrimitiveData(e,t,n,r){const{iScale:o,vScale:i}=e,a=o.axis,s=i.axis,l=o.getLabels(),c=o===i,u=new Array(r);let h,f,d;for(h=0,f=r;h<f;++h)d=h+n,u[h]={[a]:c||o.parse(l[d],d),[s]:i.parse(t[d],d)};return u}parseArrayData(e,t,n,r){const{xScale:o,yScale:i}=e,a=new Array(r);let s,l,c,u;for(s=0,l=r;s<l;++s)c=s+n,u=t[c],a[s]={x:o.parse(u[0],c),y:i.parse(u[1],c)};return a}parseObjectData(e,t,n,r){const{xScale:o,yScale:i}=e,{xAxisKey:a="x",yAxisKey:s="y"}=this._parsing,l=new Array(r);let c,u,h,f;for(c=0,u=r;c<u;++c)h=c+n,f=t[h],l[c]={x:o.parse(Z(f,a),h),y:i.parse(Z(f,s),h)};return l}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,t,n){const r=this.chart,o=this._cachedMeta,i=t[e.axis];return Xt({keys:Zt(r,!0),values:t._stacks[e.axis]._visualValues},i,o.index,{mode:n})}updateRangeFromParsed(e,t,n,r){const o=n[t.axis];let i=null===o?NaN:o;const a=r&&n._stacks[t.axis];r&&a&&(r.values=a,i=Xt(r,o,this._cachedMeta.index)),e.min=Math.min(e.min,i),e.max=Math.max(e.max,i)}getMinMax(e,t){const n=this._cachedMeta,r=n._parsed,o=n._sorted&&e===n.iScale,i=r.length,a=this._getOtherScale(e),s=((e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:Zt(n,!0),values:null})(t,n,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:u}=function(e){const{min:t,max:n,minDefined:r,maxDefined:o}=e.getUserBounds();return{min:r?t:Number.NEGATIVE_INFINITY,max:o?n:Number.POSITIVE_INFINITY}}(a);let h,f;function d(){f=r[h];const t=f[a.axis];return!D(f[e.axis])||c>t||u<t}for(h=0;h<i&&(d()||(this.updateRangeFromParsed(l,e,f,s),!o));++h);if(o)for(h=i-1;h>=0;--h)if(!d()){this.updateRangeFromParsed(l,e,f,s);break}return l}getAllParsedValues(e){const t=this._cachedMeta._parsed,n=[];let r,o,i;for(r=0,o=t.length;r<o;++r)i=t[r][e.axis],D(i)&&n.push(i);return n}getMaxOverflow(){return!1}getLabelAndValue(e){const t=this._cachedMeta,n=t.iScale,r=t.vScale,o=this.getParsed(e);return{label:n?""+n.getLabelForValue(o[n.axis]):"",value:r?""+r.getLabelForValue(o[r.axis]):""}}_update(e){const t=this._cachedMeta;this.update(e||"default"),t._clip=function(e){let t,n,r,o;return z(e)?(t=e.top,n=e.right,r=e.bottom,o=e.left):t=n=r=o=e,{top:t,right:n,bottom:r,left:o,disabled:!1===e}}(B(this.options.clip,function(e,t,n){if(!1===n)return!1;const r=Yt(e,n),o=Yt(t,n);return{top:o.end,right:r.end,bottom:o.start,left:r.start}}(t.xScale,t.yScale,this.getMaxOverflow())))}update(e){}draw(){const e=this._ctx,t=this.chart,n=this._cachedMeta,r=n.data||[],o=t.chartArea,i=[],a=this._drawStart||0,s=this._drawCount||r.length-a,l=this.options.drawActiveElementsOnTop;let c;for(n.dataset&&n.dataset.draw(e,o,a,s),c=a;c<a+s;++c){const t=r[c];t.hidden||(t.active&&l?i.push(t):t.draw(e,o))}for(c=0;c<i.length;++c)i[c].draw(e,o)}getStyle(e,t){const n=t?"active":"default";return void 0===e&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(e||0,n)}getContext(e,t,n){const r=this.getDataset();let o;if(e>=0&&e<this._cachedMeta.data.length){const t=this._cachedMeta.data[e];o=t.$context||(t.$context=function(e,t,n){return mt(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}(this.getContext(),e,t)),o.parsed=this.getParsed(e),o.raw=r.data[e],o.index=o.dataIndex=e}else o=this.$context||(this.$context=function(e,t){return mt(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),o.dataset=r,o.index=o.datasetIndex=this.index;return o.active=!!t,o.mode=n,o}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,t){return this._resolveElementOptions(this.dataElementType.id,t,e)}_resolveElementOptions(e,t="default",n){const r="active"===t,o=this._cachedDataOpts,i=e+"-"+t,a=o[i],s=this.enableOptionSharing&&J(n);if(a)return sn(a,s);const l=this.chart.config,c=l.datasetElementScopeKeys(this._type,e),u=r?[`${e}Hover`,"hover",e,""]:[e,""],h=l.getOptionScopes(this.getDataset(),c),f=Object.keys(Ue.elements[e]),d=l.resolveNamedOptions(h,f,(()=>this.getContext(n,r,t)),u);return d.$shared&&(d.$shared=s,o[i]=Object.freeze(sn(d,s))),d}_resolveAnimations(e,t,n){const r=this.chart,o=this._cachedDataOpts,i=`animation-${t}`,a=o[i];if(a)return a;let s;if(!1!==r.options.animation){const r=this.chart.config,o=r.datasetAnimationScopeKeys(this._type,t),i=r.getOptionScopes(this.getDataset(),o);s=r.createResolver(i,this.getContext(e,n,t))}const l=new Gt(r,s&&s.animations);return s&&s._cacheable&&(o[i]=Object.freeze(l)),l}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,t){return!t||an(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){const n=this.resolveDataElementOptions(e,t),r=this._sharedOptions,o=this.getSharedOptions(n),i=this.includeOptions(t,o)||o!==r;return this.updateSharedOptions(o,t,n),{sharedOptions:o,includeOptions:i}}updateElement(e,t,n,r){an(r)?Object.assign(e,n):this._resolveAnimations(t,r).update(e,n)}updateSharedOptions(e,t,n){e&&!an(t)&&this._resolveAnimations(void 0,t).update(e,n)}_setStyle(e,t,n,r){e.active=r;const o=this.getStyle(t,r);this._resolveAnimations(t,n,r).update(e,{options:!r&&this.getSharedOptions(o)||o})}removeHoverStyle(e,t,n){this._setStyle(e,n,"active",!1)}setHoverStyle(e,t,n){this._setStyle(e,n,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const t=this._data,n=this._cachedMeta.data;for(const[e,t,n]of this._syncList)this[e](t,n);this._syncList=[];const r=n.length,o=t.length,i=Math.min(o,r);i&&this.parse(0,i),o>r?this._insertElements(r,o-r,e):o<r&&this._removeElements(o,r-o)}_insertElements(e,t,n=!0){const r=this._cachedMeta,o=r.data,i=e+t;let a;const s=e=>{for(e.length+=t,a=e.length-1;a>=i;a--)e[a]=e[a-t]};for(s(o),a=e;a<i;++a)o[a]=new this.dataElementType;this._parsing&&s(r._parsed),this.parse(e,t),n&&this.updateElements(o,e,t,"reset")}updateElements(e,t,n,r){}_removeElements(e,t){const n=this._cachedMeta;if(this._parsing){const r=n._parsed.splice(e,t);n._stacked&&on(n,r)}n.data.splice(e,t)}_sync(e){if(this._parsing)this._syncList.push(e);else{const[t,n,r]=e;this[t](n,r)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){const e=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-e,e])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(e,t){t&&this._sync(["_removeElements",e,t]);const n=arguments.length-2;n&&this._sync(["_insertElements",e,n])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function cn(e){const t=e.iScale,n=function(e,t){if(!e._cache.$bar){const n=e.getMatchingVisibleMetas(t);let r=[];for(let t=0,o=n.length;t<o;t++)r=r.concat(n[t].controller.getAllParsedValues(e));e._cache.$bar=function(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}(r.sort(((e,t)=>e-t)))}return e._cache.$bar}(t,e.type);let r,o,i,a,s=t._length;const l=()=>{32767!==i&&-32768!==i&&(J(a)&&(s=Math.min(s,Math.abs(i-a)||s)),a=i)};for(r=0,o=n.length;r<o;++r)i=t.getPixelForValue(n[r]),l();for(a=void 0,r=0,o=t.ticks.length;r<o;++r)i=t.getPixelForTick(r),l();return s}function un(e,t,n,r){return N(e)?function(e,t,n,r){const o=n.parse(e[0],r),i=n.parse(e[1],r),a=Math.min(o,i),s=Math.max(o,i);let l=a,c=s;Math.abs(a)>Math.abs(s)&&(l=s,c=a),t[n.axis]=c,t._custom={barStart:l,barEnd:c,start:o,end:i,min:a,max:s}}(e,t,n,r):t[n.axis]=n.parse(e,r),t}function hn(e,t,n,r){const o=e.iScale,i=e.vScale,a=o.getLabels(),s=o===i,l=[];let c,u,h,f;for(c=n,u=n+r;c<u;++c)f=t[c],h={},h[o.axis]=s||o.parse(a[c],c),l.push(un(f,h,i,c));return l}function fn(e){return e&&void 0!==e.barStart&&void 0!==e.barEnd}function dn(e,t,n,r){let o=t.borderSkipped;const i={};if(!o)return void(e.borderSkipped=i);if(!0===o)return void(e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:a,end:s,reverse:l,top:c,bottom:u}=function(e){let t,n,r,o,i;return e.horizontal?(t=e.base>e.x,n="left",r="right"):(t=e.base<e.y,n="bottom",r="top"),t?(o="end",i="start"):(o="start",i="end"),{start:n,end:r,reverse:t,top:o,bottom:i}}(e);"middle"===o&&n&&(e.enableBorderRadius=!0,(n._top||0)===r?o=c:(n._bottom||0)===r?o=u:(i[pn(u,a,s,l)]=!0,o=c)),i[pn(o,a,s,l)]=!0,e.borderSkipped=i}function pn(e,t,n,r){var o,i,a;return r?(a=n,e=mn(e=(o=e)===(i=t)?a:o===a?i:o,n,t)):e=mn(e,t,n),e}function mn(e,t,n){return"start"===e?t:"end"===e?n:e}function gn(e,{inflateAmount:t},n){e.inflateAmount="auto"===t?1===n?.33:0:t}class yn extends ln{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(e,t,n,r){return hn(e,t,n,r)}parseArrayData(e,t,n,r){return hn(e,t,n,r)}parseObjectData(e,t,n,r){const{iScale:o,vScale:i}=e,{xAxisKey:a="x",yAxisKey:s="y"}=this._parsing,l="x"===o.axis?a:s,c="x"===i.axis?a:s,u=[];let h,f,d,p;for(h=n,f=n+r;h<f;++h)p=t[h],d={},d[o.axis]=o.parse(Z(p,l),h),u.push(un(Z(p,c),d,i,h));return u}updateRangeFromParsed(e,t,n,r){super.updateRangeFromParsed(e,t,n,r);const o=n._custom;o&&t===this._cachedMeta.vScale&&(e.min=Math.min(e.min,o.min),e.max=Math.max(e.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(e){const t=this._cachedMeta,{iScale:n,vScale:r}=t,o=this.getParsed(e),i=o._custom,a=fn(i)?"["+i.start+", "+i.end+"]":""+r.getLabelForValue(o[r.axis]);return{label:""+n.getLabelForValue(o[n.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize(),this._cachedMeta.stack=this.getDataset().stack}update(e){const t=this._cachedMeta;this.updateElements(t.data,0,t.data.length,e)}updateElements(e,t,n,r){const o="reset"===r,{index:i,_cachedMeta:{vScale:a}}=this,s=a.getBasePixel(),l=a.isHorizontal(),c=this._getRuler(),{sharedOptions:u,includeOptions:h}=this._getSharedOptions(t,r);for(let f=t;f<t+n;f++){const t=this.getParsed(f),n=o||I(t[a.axis])?{base:s,head:s}:this._calculateBarValuePixels(f),d=this._calculateBarIndexPixels(f,c),p=(t._stacks||{})[a.axis],m={horizontal:l,base:n.base,enableBorderRadius:!p||fn(t._custom)||i===p._top||i===p._bottom,x:l?n.head:d.center,y:l?d.center:n.head,height:l?d.size:Math.abs(n.size),width:l?Math.abs(n.size):d.size};h&&(m.options=u||this.resolveDataElementOptions(f,e[f].active?"active":r));const g=m.options||e[f].options;dn(m,g,p,i),gn(m,g,c.ratio),this.updateElement(e[f],f,m,r)}}_getStacks(e,t){const{iScale:n}=this._cachedMeta,r=n.getMatchingVisibleMetas(this._type).filter((e=>e.controller.options.grouped)),o=n.options.stacked,i=[],a=this._cachedMeta.controller.getParsed(t),s=a&&a[n.axis],l=e=>{const t=e._parsed.find((e=>e[n.axis]===s)),r=t&&t[e.vScale.axis];if(I(r)||isNaN(r))return!0};for(const n of r)if((void 0===t||!l(n))&&((!1===o||-1===i.indexOf(n.stack)||void 0===o&&void 0===n.stack)&&i.push(n.stack),n.index===e))break;return i.length||i.push(void 0),i}_getStackCount(e){return this._getStacks(void 0,e).length}_getStackIndex(e,t,n){const r=this._getStacks(e,n),o=void 0!==t?r.indexOf(t):-1;return-1===o?r.length-1:o}_getRuler(){const e=this.options,t=this._cachedMeta,n=t.iScale,r=[];let o,i;for(o=0,i=t.data.length;o<i;++o)r.push(n.getPixelForValue(this.getParsed(o)[n.axis],o));const a=e.barThickness;return{min:a||cn(t),pixels:r,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:e.grouped,ratio:a?1:e.categoryPercentage*e.barPercentage}}_calculateBarValuePixels(e){const{_cachedMeta:{vScale:t,_stacked:n,index:r},options:{base:o,minBarLength:i}}=this,a=o||0,s=this.getParsed(e),l=s._custom,c=fn(l);let u,h,f=s[t.axis],d=0,p=n?this.applyStack(t,s,n):f;p!==f&&(d=p-f,p=f),c&&(f=l.barStart,p=l.barEnd-l.barStart,0!==f&&ue(f)!==ue(l.barEnd)&&(d=0),d+=f);const m=I(o)||c?d:o;let g=t.getPixelForValue(m);if(u=this.chart.getDataVisibility(e)?t.getPixelForValue(d+p):g,h=u-g,Math.abs(h)<i){h=function(e,t,n){return 0!==e?ue(e):(t.isHorizontal()?1:-1)*(t.min>=n?1:-1)}(h,t,a)*i,f===a&&(g-=h/2);const e=t.getPixelForDecimal(0),o=t.getPixelForDecimal(1),l=Math.min(e,o),d=Math.max(e,o);g=Math.max(Math.min(g,d),l),u=g+h,n&&!c&&(s._stacks[t.axis]._visualValues[r]=t.getValueForPixel(u)-t.getValueForPixel(g))}if(g===t.getPixelForValue(a)){const e=ue(h)*t.getLineWidthForValue(a)/2;g+=e,h-=e}return{size:h,base:g,head:u,center:u+h/2}}_calculateBarIndexPixels(e,t){const n=t.scale,r=this.options,o=r.skipNull,i=B(r.maxBarThickness,1/0);let a,s;if(t.grouped){const n=o?this._getStackCount(e):t.stackCount,l="flex"===r.barThickness?function(e,t,n,r){const o=t.pixels,i=o[e];let a=e>0?o[e-1]:null,s=e<o.length-1?o[e+1]:null;const l=n.categoryPercentage;null===a&&(a=i-(null===s?t.end-t.start:s-i)),null===s&&(s=i+i-a);const c=i-(i-Math.min(a,s))/2*l;return{chunk:Math.abs(s-a)/2*l/r,ratio:n.barPercentage,start:c}}(e,t,r,n):function(e,t,n,r){const o=n.barThickness;let i,a;return I(o)?(i=t.min*n.categoryPercentage,a=n.barPercentage):(i=o*r,a=1),{chunk:i/r,ratio:a,start:t.pixels[e]-i/2}}(e,t,r,n),c=this._getStackIndex(this.index,this._cachedMeta.stack,o?e:void 0);a=l.start+l.chunk*c+l.chunk/2,s=Math.min(i,l.chunk*l.ratio)}else a=n.getPixelForValue(this.getParsed(e)[n.axis],e),s=Math.min(i,t.min*t.ratio);return{base:a-s/2,head:a+s/2,center:a,size:s}}draw(){const e=this._cachedMeta,t=e.vScale,n=e.data,r=n.length;let o=0;for(;o<r;++o)null===this.getParsed(o)[t.axis]||n[o].hidden||n[o].draw(this._ctx)}}function vn(e,t,n,r){const{controller:o,data:i,_sorted:a}=e,s=o._cachedMeta.iScale;if(s&&t===s.axis&&"r"!==t&&a&&i.length){const e=s._reversePixels?we:xe;if(!r)return e(i,t,n);if(o._sharedOptions){const r=i[0],o="function"==typeof r.getRange&&r.getRange(t);if(o){const r=e(i,t,n-o),a=e(i,t,n+o);return{lo:r.lo,hi:a.hi}}}}return{lo:0,hi:i.length-1}}function bn(e,t,n,r,o){const i=e.getSortedVisibleDatasetMetas(),a=n[t];for(let e=0,n=i.length;e<n;++e){const{index:n,data:s}=i[e],{lo:l,hi:c}=vn(i[e],t,a,o);for(let e=l;e<=c;++e){const t=s[e];t.skip||r(t,n,e)}}}function xn(e,t,n,r,o){const i=[];return o||e.isPointInArea(t)?(bn(e,n,t,(function(n,a,s){(o||Xe(n,e.chartArea,0))&&n.inRange(t.x,t.y,r)&&i.push({element:n,datasetIndex:a,index:s})}),!0),i):i}function wn(e,t,n,r,o,i){return i||e.isPointInArea(t)?"r"!==n||r?function(e,t,n,r,o,i){let a=[];const s=function(e){const t=-1!==e.indexOf("x"),n=-1!==e.indexOf("y");return function(e,r){const o=t?Math.abs(e.x-r.x):0,i=n?Math.abs(e.y-r.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(i,2))}}(n);let l=Number.POSITIVE_INFINITY;return bn(e,n,t,(function(n,c,u){const h=n.inRange(t.x,t.y,o);if(r&&!h)return;const f=n.getCenterPoint(o);if(!i&&!e.isPointInArea(f)&&!h)return;const d=s(t,f);d<l?(a=[{element:n,datasetIndex:c,index:u}],l=d):d===l&&a.push({element:n,datasetIndex:c,index:u})})),a}(e,t,n,r,o,i):function(e,t,n,r){let o=[];return bn(e,n,t,(function(e,n,i){const{startAngle:a,endAngle:s}=e.getProps(["startAngle","endAngle"],r),{angle:l}=function(e,t){const n=t.x-e.x,r=t.y-e.y,o=Math.sqrt(n*n+r*r);let i=Math.atan2(r,n);return i<-.5*ne&&(i+=re),{angle:i,distance:o}}(e,{x:t.x,y:t.y});(function(e,t,n,r){const o=ge(e),i=ge(t),a=ge(n),s=ge(i-o),l=ge(a-o),c=ge(o-i),u=ge(o-a);return o===i||o===a||r&&i===a||s>l&&c<u})(l,a,s)&&o.push({element:e,datasetIndex:n,index:i})})),o}(e,t,n,o):[]}function kn(e,t,n,r,o){const i=[],a="x"===n?"inXRange":"inYRange";let s=!1;return bn(e,n,t,((e,r,l)=>{e[a]&&e[a](t[n],o)&&(i.push({element:e,datasetIndex:r,index:l}),s=s||e.inRange(t.x,t.y,o))})),r&&!s?[]:i}var Sn={evaluateInteractionItems:bn,modes:{index(e,t,n,r){const o=Nt(t,e),i=n.axis||"x",a=n.includeInvisible||!1,s=n.intersect?xn(e,o,i,r,a):wn(e,o,i,!1,r,a),l=[];return s.length?(e.getSortedVisibleDatasetMetas().forEach((e=>{const t=s[0].index,n=e.data[t];n&&!n.skip&&l.push({element:n,datasetIndex:e.index,index:t})})),l):[]},dataset(e,t,n,r){const o=Nt(t,e),i=n.axis||"xy",a=n.includeInvisible||!1;let s=n.intersect?xn(e,o,i,r,a):wn(e,o,i,!1,r,a);if(s.length>0){const t=s[0].datasetIndex,n=e.getDatasetMeta(t).data;s=[];for(let e=0;e<n.length;++e)s.push({element:n[e],datasetIndex:t,index:e})}return s},point:(e,t,n,r)=>xn(e,Nt(t,e),n.axis||"xy",r,n.includeInvisible||!1),nearest(e,t,n,r){const o=Nt(t,e),i=n.axis||"xy",a=n.includeInvisible||!1;return wn(e,o,i,n.intersect,r,a)},x:(e,t,n,r)=>kn(e,Nt(t,e),"x",n.intersect,r),y:(e,t,n,r)=>kn(e,Nt(t,e),"y",n.intersect,r)}};const On=["left","top","right","bottom"];function _n(e,t){return e.filter((e=>e.pos===t))}function En(e,t){return e.filter((e=>-1===On.indexOf(e.pos)&&e.box.axis===t))}function Cn(e,t){return e.sort(((e,n)=>{const r=t?n:e,o=t?e:n;return r.weight===o.weight?r.index-o.index:r.weight-o.weight}))}function An(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function jn(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function Pn(e,t,n,r){const{pos:o,box:i}=n,a=e.maxPadding;if(!z(o)){n.size&&(e[o]-=n.size);const t=r[n.stack]||{size:0,count:1};t.size=Math.max(t.size,n.horizontal?i.height:i.width),n.size=t.size/t.count,e[o]+=n.size}i.getPadding&&jn(a,i.getPadding());const s=Math.max(0,t.outerWidth-An(a,e,"left","right")),l=Math.max(0,t.outerHeight-An(a,e,"top","bottom")),c=s!==e.w,u=l!==e.h;return e.w=s,e.h=l,n.horizontal?{same:c,other:u}:{same:u,other:c}}function Mn(e,t){const n=t.maxPadding;return function(e){const r={left:0,top:0,right:0,bottom:0};return e.forEach((e=>{r[e]=Math.max(t[e],n[e])})),r}(e?["left","right"]:["top","bottom"])}function Rn(e,t,n,r){const o=[];let i,a,s,l,c,u;for(i=0,a=e.length,c=0;i<a;++i){s=e[i],l=s.box,l.update(s.width||t.w,s.height||t.h,Mn(s.horizontal,t));const{same:a,other:h}=Pn(t,n,s,r);c|=a&&o.length,u=u||h,l.fullSize||o.push(s)}return c&&Rn(o,t,n,r)||u}function Tn(e,t,n,r,o){e.top=n,e.left=t,e.right=t+r,e.bottom=n+o,e.width=r,e.height=o}function Ln(e,t,n,r){const o=n.padding;let{x:i,y:a}=t;for(const s of e){const e=s.box,l=r[s.stack]||{count:1,placed:0,weight:1},c=s.stackWeight/l.weight||1;if(s.horizontal){const r=t.w*c,i=l.size||e.height;J(l.start)&&(a=l.start),e.fullSize?Tn(e,o.left,a,n.outerWidth-o.right-o.left,i):Tn(e,t.left+l.placed,a,r,i),l.start=a,l.placed+=r,a=e.bottom}else{const r=t.h*c,a=l.size||e.width;J(l.start)&&(i=l.start),e.fullSize?Tn(e,i,o.top,a,n.outerHeight-o.bottom-o.top):Tn(e,i,t.top+l.placed,a,r),l.start=i,l.placed+=r,i=e.right}}t.x=i,t.y=a}var In={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;-1!==n&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,r){if(!e)return;const o=ft(e.options.layout.padding),i=Math.max(t-o.width,0),a=Math.max(n-o.height,0),s=function(e){const t=function(e){const t=[];let n,r,o,i,a,s;for(n=0,r=(e||[]).length;n<r;++n)o=e[n],({position:i,options:{stack:a,stackWeight:s=1}}=o),t.push({index:n,box:o,pos:i,horizontal:o.isHorizontal(),weight:o.weight,stack:a&&i+a,stackWeight:s});return t}(e),n=Cn(t.filter((e=>e.box.fullSize)),!0),r=Cn(_n(t,"left"),!0),o=Cn(_n(t,"right")),i=Cn(_n(t,"top"),!0),a=Cn(_n(t,"bottom")),s=En(t,"x"),l=En(t,"y");return{fullSize:n,leftAndTop:r.concat(i),rightAndBottom:o.concat(l).concat(a).concat(s),chartArea:_n(t,"chartArea"),vertical:r.concat(o).concat(l),horizontal:i.concat(a).concat(s)}}(e.boxes),l=s.vertical,c=s.horizontal;H(e.boxes,(e=>{"function"==typeof e.beforeLayout&&e.beforeLayout()}));const u=l.reduce(((e,t)=>t.box.options&&!1===t.box.options.display?e:e+1),0)||1,h=Object.freeze({outerWidth:t,outerHeight:n,padding:o,availableWidth:i,availableHeight:a,vBoxMaxWidth:i/2/u,hBoxMaxHeight:a/2}),f=Object.assign({},o);jn(f,ft(r));const d=Object.assign({maxPadding:f,w:i,h:a,x:o.left,y:o.top},o),p=function(e,t){const n=function(e){const t={};for(const n of e){const{stack:e,pos:r,stackWeight:o}=n;if(!e||!On.includes(r))continue;const i=t[e]||(t[e]={count:0,placed:0,weight:0,size:0});i.count++,i.weight+=o}return t}(e),{vBoxMaxWidth:r,hBoxMaxHeight:o}=t;let i,a,s;for(i=0,a=e.length;i<a;++i){s=e[i];const{fullSize:a}=s.box,l=n[s.stack],c=l&&s.stackWeight/l.weight;s.horizontal?(s.width=c?c*r:a&&t.availableWidth,s.height=o):(s.width=r,s.height=c?c*o:a&&t.availableHeight)}return n}(l.concat(c),h);Rn(s.fullSize,d,h,p),Rn(l,d,h,p),Rn(c,d,h,p)&&Rn(l,d,h,p),function(e){const t=e.maxPadding;function n(n){const r=Math.max(t[n]-e[n],0);return e[n]+=r,r}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}(d),Ln(s.leftAndTop,d,h,p),d.x+=d.w,d.y+=d.h,Ln(s.rightAndBottom,d,h,p),e.chartArea={left:d.left,top:d.top,right:d.left+d.w,bottom:d.top+d.h,height:d.h,width:d.w},H(s.chartArea,(t=>{const n=t.box;Object.assign(n,e.chartArea),n.update(d.w,d.h,{left:0,top:0,right:0,bottom:0})}))}};class Nn{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,n){}removeEventListener(e,t,n){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,n,r){return t=Math.max(0,t||e.width),n=n||e.height,{width:t,height:Math.max(0,r?Math.floor(t/r):n)}}isAttached(e){return!0}updateConfig(e){}}class zn extends Nn{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const Dn="$chartjs",Fn={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Bn=e=>null===e||""===e,$n=!!Ft&&{passive:!0};function Hn(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,$n)}function Wn(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function qn(e,t,n){const r=e.canvas,o=new MutationObserver((e=>{let t=!1;for(const n of e)t=t||Wn(n.addedNodes,r),t=t&&!Wn(n.removedNodes,r);t&&n()}));return o.observe(document,{childList:!0,subtree:!0}),o}function Vn(e,t,n){const r=e.canvas,o=new MutationObserver((e=>{let t=!1;for(const n of e)t=t||Wn(n.removedNodes,r),t=t&&!Wn(n.addedNodes,r);t&&n()}));return o.observe(document,{childList:!0,subtree:!0}),o}const Un=new Map;let Kn=0;function Qn(){const e=window.devicePixelRatio;e!==Kn&&(Kn=e,Un.forEach(((t,n)=>{n.currentDevicePixelRatio!==e&&t()})))}function Gn(e,t,n){const r=e.canvas,o=r&&Pt(r);if(!o)return;const i=_e(((e,t)=>{const r=o.clientWidth;n(e,t),r<o.clientWidth&&n()}),window),a=new ResizeObserver((e=>{const t=e[0],n=t.contentRect.width,r=t.contentRect.height;0===n&&0===r||i(n,r)}));return a.observe(o),function(e,t){Un.size||window.addEventListener("resize",Qn),Un.set(e,t)}(e,i),a}function Yn(e,t,n){n&&n.disconnect(),"resize"===t&&function(e){Un.delete(e),Un.size||window.removeEventListener("resize",Qn)}(e)}function Zn(e,t,n){const r=e.canvas,o=_e((t=>{null!==e.ctx&&n(function(e,t){const n=Fn[e.type]||e.type,{x:r,y:o}=Nt(e,t);return{type:n,chart:t,native:e,x:void 0!==r?r:null,y:void 0!==o?o:null}}(t,e))}),e);return function(e,t,n){e&&e.addEventListener(t,n,$n)}(r,t,o),o}class Xn extends Nn{acquireContext(e,t){const n=e&&e.getContext&&e.getContext("2d");return n&&n.canvas===e?(function(e,t){const n=e.style,r=e.getAttribute("height"),o=e.getAttribute("width");if(e[Dn]={initial:{height:r,width:o,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",Bn(o)){const t=Bt(e,"width");void 0!==t&&(e.width=t)}if(Bn(r))if(""===e.style.height)e.height=e.width/(t||2);else{const t=Bt(e,"height");void 0!==t&&(e.height=t)}}(e,t),n):null}releaseContext(e){const t=e.canvas;if(!t[Dn])return!1;const n=t[Dn].initial;["height","width"].forEach((e=>{const r=n[e];I(r)?t.removeAttribute(e):t.setAttribute(e,r)}));const r=n.style||{};return Object.keys(r).forEach((e=>{t.style[e]=r[e]})),t.width=t.width,delete t[Dn],!0}addEventListener(e,t,n){this.removeEventListener(e,t);const r=e.$proxies||(e.$proxies={}),o={attach:qn,detach:Vn,resize:Gn}[t]||Zn;r[t]=o(e,t,n)}removeEventListener(e,t){const n=e.$proxies||(e.$proxies={}),r=n[t];r&&(({attach:Yn,detach:Yn,resize:Yn}[t]||Hn)(e,t,r),n[t]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,n,r){return function(e,t,n,r){const o=Rt(e),i=Lt(o,"margin"),a=Mt(o.maxWidth,e,"clientWidth")||oe,s=Mt(o.maxHeight,e,"clientHeight")||oe,l=function(e,t,n){let r,o;if(void 0===t||void 0===n){const i=e&&Pt(e);if(i){const e=i.getBoundingClientRect(),a=Rt(i),s=Lt(a,"border","width"),l=Lt(a,"padding");t=e.width-l.width-s.width,n=e.height-l.height-s.height,r=Mt(a.maxWidth,i,"clientWidth"),o=Mt(a.maxHeight,i,"clientHeight")}else t=e.clientWidth,n=e.clientHeight}return{width:t,height:n,maxWidth:r||oe,maxHeight:o||oe}}(e,t,n);let{width:c,height:u}=l;if("content-box"===o.boxSizing){const e=Lt(o,"border","width"),t=Lt(o,"padding");c-=t.width+e.width,u-=t.height+e.height}return c=Math.max(0,c-i.width),u=Math.max(0,r?c/r:u-i.height),c=zt(Math.min(c,a,l.maxWidth)),u=zt(Math.min(u,s,l.maxHeight)),c&&!u&&(u=zt(c/2)),(void 0!==t||void 0!==n)&&r&&l.height&&u>l.height&&(u=l.height,c=zt(Math.floor(u*r))),{width:c,height:u}}(e,t,n,r)}isAttached(e){const t=e&&Pt(e);return!(!t||!t.isConnected)}}class Jn{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(e){const{x:t,y:n}=this.getProps(["x","y"],e);return{x:t,y:n}}hasValue(){return de(this.x)&&de(this.y)}getProps(e,t){const n=this.$animations;if(!t||!n)return this;const r={};return e.forEach((e=>{r[e]=n[e]&&n[e].active()?n[e]._to:this[e]})),r}}function er(e,t,n,r,o){const i=B(r,0),a=Math.min(B(o,e.length),e.length);let s,l,c,u=0;for(n=Math.ceil(n),o&&(s=o-r,n=s/Math.floor(s/n)),c=i;c<0;)u++,c=Math.round(i+u*n);for(l=Math.max(i,0);l<a;l++)l===c&&(t.push(e[l]),u++,c=Math.round(i+u*n))}const tr=(e,t,n)=>"top"===t||"left"===t?e[t]+n:e[t]-n,nr=(e,t)=>Math.min(t||e,e);function rr(e,t){const n=[],r=e.length/t,o=e.length;let i=0;for(;i<o;i+=r)n.push(e[Math.floor(i)]);return n}function or(e,t,n){const r=e.ticks.length,o=Math.min(t,r-1),i=e._startPixel,a=e._endPixel,s=1e-6;let l,c=e.getPixelForTick(o);if(!(n&&(l=1===r?Math.max(c-i,a-c):0===t?(e.getPixelForTick(1)-c)/2:(c-e.getPixelForTick(o-1))/2,c+=o<t?l:-l,c<i-s||c>a+s)))return c}function ir(e){return e.drawTicks?e.tickLength:0}function ar(e,t){if(!e.display)return 0;const n=dt(e.font,t),r=ft(e.padding);return(N(e.text)?e.text.length:1)*n.lineHeight+r.height}function sr(e,t,n){let r=Ee(e);return(n&&"right"!==t||!n&&"right"===t)&&(r=(e=>"left"===e?"right":"right"===e?"left":e)(r)),r}class lr extends Jn{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,t){return e}getUserBounds(){let{_userMin:e,_userMax:t,_suggestedMin:n,_suggestedMax:r}=this;return e=F(e,Number.POSITIVE_INFINITY),t=F(t,Number.NEGATIVE_INFINITY),n=F(n,Number.POSITIVE_INFINITY),r=F(r,Number.NEGATIVE_INFINITY),{min:F(e,n),max:F(t,r),minDefined:D(e),maxDefined:D(t)}}getMinMax(e){let t,{min:n,max:r,minDefined:o,maxDefined:i}=this.getUserBounds();if(o&&i)return{min:n,max:r};const a=this.getMatchingVisibleMetas();for(let s=0,l=a.length;s<l;++s)t=a[s].controller.getMinMax(this,e),o||(n=Math.min(n,t.min)),i||(r=Math.max(r,t.max));return n=i&&n>r?r:n,r=o&&n>r?n:r,{min:F(n,F(r,n)),max:F(r,F(n,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){$(this.options.beforeUpdate,[this])}update(e,t,n){const{beginAtZero:r,grace:o,ticks:i}=this.options,a=i.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=function(e,t,n){const{min:r,max:o}=e,i=(l=(o-r)/2,"string"==typeof(s=t)&&s.endsWith("%")?parseFloat(s)/100*l:+s),a=(e,t)=>n&&0===e?0:e+t;var s,l;return{min:a(r,-Math.abs(i)),max:a(o,i)}}(this,o,r),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const s=a<this.ticks.length;this._convertTicksToLabels(s?rr(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),i.display&&(i.autoSkip||"auto"===i.source)&&(this.ticks=function(e,t){const n=e.options.ticks,r=function(e){const t=e.options.offset,n=e._tickSize(),r=e._length/n+(t?0:1),o=e._maxLength/n;return Math.floor(Math.min(r,o))}(e),o=Math.min(n.maxTicksLimit||r,r),i=n.major.enabled?function(e){const t=[];let n,r;for(n=0,r=e.length;n<r;n++)e[n].major&&t.push(n);return t}(t):[],a=i.length,s=i[0],l=i[a-1],c=[];if(a>o)return function(e,t,n,r){let o,i=0,a=n[0];for(r=Math.ceil(r),o=0;o<e.length;o++)o===a&&(t.push(e[o]),i++,a=n[i*r])}(t,c,i,a/o),c;const u=function(e,t,n){const r=function(e){const t=e.length;let n,r;if(t<2)return!1;for(r=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==r)return!1;return r}(e),o=t.length/n;if(!r)return Math.max(o,1);const i=function(e){const t=[],n=Math.sqrt(e);let r;for(r=1;r<n;r++)e%r==0&&(t.push(r),t.push(e/r));return n===(0|n)&&t.push(n),t.sort(((e,t)=>e-t)).pop(),t}(r);for(let e=0,t=i.length-1;e<t;e++){const t=i[e];if(t>o)return t}return Math.max(o,1)}(i,t,o);if(a>0){let e,n;const r=a>1?Math.round((l-s)/(a-1)):null;for(er(t,c,u,I(r)?0:s-r,s),e=0,n=a-1;e<n;e++)er(t,c,u,i[e],i[e+1]);return er(t,c,u,l,I(r)?t.length:l+r),c}return er(t,c,u),c}(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),s&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e,t,n=this.options.reverse;this.isHorizontal()?(e=this.left,t=this.right):(e=this.top,t=this.bottom,n=!n),this._startPixel=e,this._endPixel=t,this._reversePixels=n,this._length=t-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){$(this.options.afterUpdate,[this])}beforeSetDimensions(){$(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){$(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),$(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){$(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){const t=this.options.ticks;let n,r,o;for(n=0,r=e.length;n<r;n++)o=e[n],o.label=$(t.callback,[o.value,n,e],this)}afterTickToLabelConversion(){$(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){$(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const e=this.options,t=e.ticks,n=nr(this.ticks.length,e.ticks.maxTicksLimit),r=t.minRotation||0,o=t.maxRotation;let i,a,s,l=r;if(!this._isVisible()||!t.display||r>=o||n<=1||!this.isHorizontal())return void(this.labelRotation=r);const c=this._getLabelSizes(),u=c.widest.width,h=c.highest.height,f=ye(this.chart.width-u,0,this.maxWidth);i=e.offset?this.maxWidth/n:f/(n-1),u+6>i&&(i=f/(n-(e.offset?.5:1)),a=this.maxHeight-ir(e.grid)-t.padding-ar(e.title,this.chart.options.font),s=Math.sqrt(u*u+h*h),l=Math.min(Math.asin(ye((c.highest.height+6)/i,-1,1)),Math.asin(ye(a/s,-1,1))-Math.asin(ye(h/s,-1,1)))*(180/ne),l=Math.max(r,Math.min(o,l))),this.labelRotation=l}afterCalculateLabelRotation(){$(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){$(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:t,options:{ticks:n,title:r,grid:o}}=this,i=this._isVisible(),a=this.isHorizontal();if(i){const i=ar(r,t.options.font);if(a?(e.width=this.maxWidth,e.height=ir(o)+i):(e.height=this.maxHeight,e.width=ir(o)+i),n.display&&this.ticks.length){const{first:t,last:r,widest:o,highest:i}=this._getLabelSizes(),s=2*n.padding,l=pe(this.labelRotation),c=Math.cos(l),u=Math.sin(l);if(a){const t=n.mirror?0:u*o.width+c*i.height;e.height=Math.min(this.maxHeight,e.height+t+s)}else{const t=n.mirror?0:c*o.width+u*i.height;e.width=Math.min(this.maxWidth,e.width+t+s)}this._calculatePadding(t,r,u,c)}}this._handleMargins(),a?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,n,r){const{ticks:{align:o,padding:i},position:a}=this.options,s=0!==this.labelRotation,l="top"!==a&&"x"===this.axis;if(this.isHorizontal()){const a=this.getPixelForTick(0)-this.left,c=this.right-this.getPixelForTick(this.ticks.length-1);let u=0,h=0;s?l?(u=r*e.width,h=n*t.height):(u=n*e.height,h=r*t.width):"start"===o?h=t.width:"end"===o?u=e.width:"inner"!==o&&(u=e.width/2,h=t.width/2),this.paddingLeft=Math.max((u-a+i)*this.width/(this.width-a),0),this.paddingRight=Math.max((h-c+i)*this.width/(this.width-c),0)}else{let n=t.height/2,r=e.height/2;"start"===o?(n=0,r=e.height):"end"===o&&(n=t.height,r=0),this.paddingTop=n+i,this.paddingBottom=r+i}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){$(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:t}=this.options;return"top"===t||"bottom"===t||"x"===e}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){let t,n;for(this.beforeTickToLabelConversion(),this.generateTickLabels(e),t=0,n=e.length;t<n;t++)I(e[t].label)&&(e.splice(t,1),n--,t--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){const t=this.options.ticks.sampleSize;let n=this.ticks;t<n.length&&(n=rr(n,t)),this._labelSizes=e=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,t,n){const{ctx:r,_longestTextCache:o}=this,i=[],a=[],s=Math.floor(t/nr(t,n));let l,c,u,h,f,d,p,m,g,y,v,b=0,x=0;for(l=0;l<t;l+=s){if(h=e[l].label,f=this._resolveTickFontOptions(l),r.font=d=f.string,p=o[d]=o[d]||{data:{},gc:[]},m=f.lineHeight,g=y=0,I(h)||N(h)){if(N(h))for(c=0,u=h.length;c<u;++c)v=h[c],I(v)||N(v)||(g=Ke(r,p.data,p.gc,g,v),y+=m)}else g=Ke(r,p.data,p.gc,g,h),y=m;i.push(g),a.push(y),b=Math.max(g,b),x=Math.max(y,x)}!function(e,t){H(e,(e=>{const n=e.gc,r=n.length/2;let o;if(r>t){for(o=0;o<r;++o)delete e.data[n[o]];n.splice(0,r)}}))}(o,t);const w=i.indexOf(b),k=a.indexOf(x),S=e=>({width:i[e]||0,height:a[e]||0});return{first:S(0),last:S(t-1),widest:S(w),highest:S(k),widths:i,heights:a}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){const t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const t=this._startPixel+e*this._length;return ye(this._alignToPixels?Qe(this.chart,t,0):t,-32768,32767)}getDecimalForPixel(e){const t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){const t=this.ticks||[];if(e>=0&&e<t.length){const n=t[e];return n.$context||(n.$context=function(e,t,n){return mt(e,{tick:n,index:t,type:"tick"})}(this.getContext(),e,n))}return this.$context||(this.$context=mt(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const e=this.options.ticks,t=pe(this.labelRotation),n=Math.abs(Math.cos(t)),r=Math.abs(Math.sin(t)),o=this._getLabelSizes(),i=e.autoSkipPadding||0,a=o?o.widest.width+i:0,s=o?o.highest.height+i:0;return this.isHorizontal()?s*n>a*r?a/n:s/r:s*r<a*n?s/n:a/r}_isVisible(){const e=this.options.display;return"auto"!==e?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){const t=this.axis,n=this.chart,r=this.options,{grid:o,position:i,border:a}=r,s=o.offset,l=this.isHorizontal(),c=this.ticks.length+(s?1:0),u=ir(o),h=[],f=a.setContext(this.getContext()),d=f.display?f.width:0,p=d/2,m=function(e){return Qe(n,e,d)};let g,y,v,b,x,w,k,S,O,_,E,C;if("top"===i)g=m(this.bottom),w=this.bottom-u,S=g-p,_=m(e.top)+p,C=e.bottom;else if("bottom"===i)g=m(this.top),_=e.top,C=m(e.bottom)-p,w=g+p,S=this.top+u;else if("left"===i)g=m(this.right),x=this.right-u,k=g-p,O=m(e.left)+p,E=e.right;else if("right"===i)g=m(this.left),O=e.left,E=m(e.right)-p,x=g+p,k=this.left+u;else if("x"===t){if("center"===i)g=m((e.top+e.bottom)/2+.5);else if(z(i)){const e=Object.keys(i)[0],t=i[e];g=m(this.chart.scales[e].getPixelForValue(t))}_=e.top,C=e.bottom,w=g+p,S=w+u}else if("y"===t){if("center"===i)g=m((e.left+e.right)/2);else if(z(i)){const e=Object.keys(i)[0],t=i[e];g=m(this.chart.scales[e].getPixelForValue(t))}x=g-p,k=x-u,O=e.left,E=e.right}const A=B(r.ticks.maxTicksLimit,c),j=Math.max(1,Math.ceil(c/A));for(y=0;y<c;y+=j){const e=this.getContext(y),t=o.setContext(e),r=a.setContext(e),i=t.lineWidth,c=t.color,u=r.dash||[],f=r.dashOffset,d=t.tickWidth,p=t.tickColor,m=t.tickBorderDash||[],g=t.tickBorderDashOffset;v=or(this,y,s),void 0!==v&&(b=Qe(n,v,i),l?x=k=O=E=b:w=S=_=C=b,h.push({tx1:x,ty1:w,tx2:k,ty2:S,x1:O,y1:_,x2:E,y2:C,width:i,color:c,borderDash:u,borderDashOffset:f,tickWidth:d,tickColor:p,tickBorderDash:m,tickBorderDashOffset:g}))}return this._ticksLength=c,this._borderValue=g,h}_computeLabelItems(e){const t=this.axis,n=this.options,{position:r,ticks:o}=n,i=this.isHorizontal(),a=this.ticks,{align:s,crossAlign:l,padding:c,mirror:u}=o,h=ir(n.grid),f=h+c,d=u?-c:f,p=-pe(this.labelRotation),m=[];let g,y,v,b,x,w,k,S,O,_,E,C,A="middle";if("top"===r)w=this.bottom-d,k=this._getXAxisLabelAlignment();else if("bottom"===r)w=this.top+d,k=this._getXAxisLabelAlignment();else if("left"===r){const e=this._getYAxisLabelAlignment(h);k=e.textAlign,x=e.x}else if("right"===r){const e=this._getYAxisLabelAlignment(h);k=e.textAlign,x=e.x}else if("x"===t){if("center"===r)w=(e.top+e.bottom)/2+f;else if(z(r)){const e=Object.keys(r)[0],t=r[e];w=this.chart.scales[e].getPixelForValue(t)+f}k=this._getXAxisLabelAlignment()}else if("y"===t){if("center"===r)x=(e.left+e.right)/2-f;else if(z(r)){const e=Object.keys(r)[0],t=r[e];x=this.chart.scales[e].getPixelForValue(t)}k=this._getYAxisLabelAlignment(h).textAlign}"y"===t&&("start"===s?A="top":"end"===s&&(A="bottom"));const j=this._getLabelSizes();for(g=0,y=a.length;g<y;++g){v=a[g],b=v.label;const e=o.setContext(this.getContext(g));S=this.getPixelForTick(g)+o.labelOffset,O=this._resolveTickFontOptions(g),_=O.lineHeight,E=N(b)?b.length:1;const t=E/2,n=e.color,s=e.textStrokeColor,c=e.textStrokeWidth;let h,f=k;if(i?(x=S,"inner"===k&&(f=g===y-1?this.options.reverse?"left":"right":0===g?this.options.reverse?"right":"left":"center"),C="top"===r?"near"===l||0!==p?-E*_+_/2:"center"===l?-j.highest.height/2-t*_+_:-j.highest.height+_/2:"near"===l||0!==p?_/2:"center"===l?j.highest.height/2-t*_:j.highest.height-E*_,u&&(C*=-1),0===p||e.showLabelBackdrop||(x+=_/2*Math.sin(p))):(w=S,C=(1-E)*_/2),e.showLabelBackdrop){const t=ft(e.backdropPadding),n=j.heights[g],r=j.widths[g];let o=C-t.top,i=0-t.left;switch(A){case"middle":o-=n/2;break;case"bottom":o-=n}switch(k){case"center":i-=r/2;break;case"right":i-=r;break;case"inner":g===y-1?i-=r:g>0&&(i-=r/2)}h={left:i,top:o,width:r+t.width,height:n+t.height,color:e.backdropColor}}m.push({label:b,font:O,textOffset:C,options:{rotation:p,color:n,strokeColor:s,strokeWidth:c,textAlign:f,textBaseline:A,translation:[x,w],backdrop:h}})}return m}_getXAxisLabelAlignment(){const{position:e,ticks:t}=this.options;if(-pe(this.labelRotation))return"top"===e?"left":"right";let n="center";return"start"===t.align?n="left":"end"===t.align?n="right":"inner"===t.align&&(n="inner"),n}_getYAxisLabelAlignment(e){const{position:t,ticks:{crossAlign:n,mirror:r,padding:o}}=this.options,i=e+o,a=this._getLabelSizes().widest.width;let s,l;return"left"===t?r?(l=this.right+o,"near"===n?s="left":"center"===n?(s="center",l+=a/2):(s="right",l+=a)):(l=this.right-i,"near"===n?s="right":"center"===n?(s="center",l-=a/2):(s="left",l=this.left)):"right"===t?r?(l=this.left+o,"near"===n?s="right":"center"===n?(s="center",l-=a/2):(s="left",l-=a)):(l=this.left+i,"near"===n?s="left":"center"===n?(s="center",l+=a/2):(s="right",l=this.right)):s="right",{textAlign:s,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,t=this.options.position;return"left"===t||"right"===t?{top:0,left:this.left,bottom:e.height,right:this.right}:"top"===t||"bottom"===t?{top:this.top,left:0,bottom:this.bottom,right:e.width}:void 0}drawBackground(){const{ctx:e,options:{backgroundColor:t},left:n,top:r,width:o,height:i}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(n,r,o,i),e.restore())}getLineWidthForValue(e){const t=this.options.grid;if(!this._isVisible()||!t.display)return 0;const n=this.ticks.findIndex((t=>t.value===e));return n>=0?t.setContext(this.getContext(n)).lineWidth:0}drawGrid(e){const t=this.options.grid,n=this.ctx,r=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let o,i;const a=(e,t,r)=>{r.width&&r.color&&(n.save(),n.lineWidth=r.width,n.strokeStyle=r.color,n.setLineDash(r.borderDash||[]),n.lineDashOffset=r.borderDashOffset,n.beginPath(),n.moveTo(e.x,e.y),n.lineTo(t.x,t.y),n.stroke(),n.restore())};if(t.display)for(o=0,i=r.length;o<i;++o){const e=r[o];t.drawOnChartArea&&a({x:e.x1,y:e.y1},{x:e.x2,y:e.y2},e),t.drawTicks&&a({x:e.tx1,y:e.ty1},{x:e.tx2,y:e.ty2},{color:e.tickColor,width:e.tickWidth,borderDash:e.tickBorderDash,borderDashOffset:e.tickBorderDashOffset})}}drawBorder(){const{chart:e,ctx:t,options:{border:n,grid:r}}=this,o=n.setContext(this.getContext()),i=n.display?o.width:0;if(!i)return;const a=r.setContext(this.getContext(0)).lineWidth,s=this._borderValue;let l,c,u,h;this.isHorizontal()?(l=Qe(e,this.left,i)-i/2,c=Qe(e,this.right,a)+a/2,u=h=s):(u=Qe(e,this.top,i)-i/2,h=Qe(e,this.bottom,a)+a/2,l=c=s),t.save(),t.lineWidth=o.width,t.strokeStyle=o.color,t.beginPath(),t.moveTo(l,u),t.lineTo(c,h),t.stroke(),t.restore()}drawLabels(e){if(!this.options.ticks.display)return;const t=this.ctx,n=this._computeLabelArea();n&&Je(t,n);const r=this.getLabelItems(e);for(const e of r){const n=e.options,r=e.font;rt(t,e.label,0,e.textOffset,r,n)}n&&et(t)}drawTitle(){const{ctx:e,options:{position:t,title:n,reverse:r}}=this;if(!n.display)return;const o=dt(n.font),i=ft(n.padding),a=n.align;let s=o.lineHeight/2;"bottom"===t||"center"===t||z(t)?(s+=i.bottom,N(n.text)&&(s+=o.lineHeight*(n.text.length-1))):s+=i.top;const{titleX:l,titleY:c,maxWidth:u,rotation:h}=function(e,t,n,r){const{top:o,left:i,bottom:a,right:s,chart:l}=e,{chartArea:c,scales:u}=l;let h,f,d,p=0;const m=a-o,g=s-i;if(e.isHorizontal()){if(f=Ce(r,i,s),z(n)){const e=Object.keys(n)[0],r=n[e];d=u[e].getPixelForValue(r)+m-t}else d="center"===n?(c.bottom+c.top)/2+m-t:tr(e,n,t);h=s-i}else{if(z(n)){const e=Object.keys(n)[0],r=n[e];f=u[e].getPixelForValue(r)-g+t}else f="center"===n?(c.left+c.right)/2-g+t:tr(e,n,t);d=Ce(r,a,o),p="left"===n?-ae:ae}return{titleX:f,titleY:d,maxWidth:h,rotation:p}}(this,s,t,a);rt(e,n.text,0,0,o,{color:n.color,maxWidth:u,rotation:h,textAlign:sr(a,t,r),textBaseline:"middle",translation:[l,c]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){const e=this.options,t=e.ticks&&e.ticks.z||0,n=B(e.grid&&e.grid.z,-1),r=B(e.border&&e.border.z,0);return this._isVisible()&&this.draw===lr.prototype.draw?[{z:n,draw:e=>{this.drawBackground(),this.drawGrid(e),this.drawTitle()}},{z:r,draw:()=>{this.drawBorder()}},{z:t,draw:e=>{this.drawLabels(e)}}]:[{z:t,draw:e=>{this.draw(e)}}]}getMatchingVisibleMetas(e){const t=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",r=[];let o,i;for(o=0,i=t.length;o<i;++o){const i=t[o];i[n]!==this.id||e&&i.type!==e||r.push(i)}return r}_resolveTickFontOptions(e){return dt(this.options.ticks.setContext(this.getContext(e)).font)}_maxDigits(){const e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}}class cr{constructor(e,t,n){this.type=e,this.scope=t,this.override=n,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){const t=Object.getPrototypeOf(e);let n;(function(e){return"id"in e&&"defaults"in e})(t)&&(n=this.register(t));const r=this.items,o=e.id,i=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+e);return o in r||(r[o]=e,function(e,t,n){const r=K(Object.create(null),[n?Ue.get(n):{},Ue.get(t),e.defaults]);Ue.set(t,r),e.defaultRoutes&&function(e,t){Object.keys(t).forEach((n=>{const r=n.split("."),o=r.pop(),i=[e].concat(r).join("."),a=t[n].split("."),s=a.pop(),l=a.join(".");Ue.route(i,o,l,s)}))}(t,e.defaultRoutes),e.descriptors&&Ue.describe(t,e.descriptors)}(e,i,n),this.override&&Ue.override(e.id,e.overrides)),i}get(e){return this.items[e]}unregister(e){const t=this.items,n=e.id,r=this.scope;n in t&&delete t[n],r&&n in Ue[r]&&(delete Ue[r][n],this.override&&delete $e[n])}}class ur{constructor(){this.controllers=new cr(ln,"datasets",!0),this.elements=new cr(Jn,"elements"),this.plugins=new cr(Object,"plugins"),this.scales=new cr(lr,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,t,n){[...t].forEach((t=>{const r=n||this._getRegistryForType(t);n||r.isForType(t)||r===this.plugins&&t.id?this._exec(e,r,t):H(t,(t=>{const r=n||this._getRegistryForType(t);this._exec(e,r,t)}))}))}_exec(e,t,n){const r=X(e);$(n["before"+r],[],n),t[e](n),$(n["after"+r],[],n)}_getRegistryForType(e){for(let t=0;t<this._typedRegistries.length;t++){const n=this._typedRegistries[t];if(n.isForType(e))return n}return this.plugins}_get(e,t,n){const r=t.get(e);if(void 0===r)throw new Error('"'+e+'" is not a registered '+n+".");return r}}var hr=new ur;class fr{constructor(){this._init=[]}notify(e,t,n,r){"beforeInit"===t&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install"));const o=r?this._descriptors(e).filter(r):this._descriptors(e),i=this._notify(o,e,t,n);return"afterDestroy"===t&&(this._notify(o,e,"stop"),this._notify(this._init,e,"uninstall")),i}_notify(e,t,n,r){r=r||{};for(const o of e){const e=o.plugin;if(!1===$(e[n],[t,r,o.options],e)&&r.cancelable)return!1}return!0}invalidate(){I(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;const t=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),t}_createDescriptors(e,t){const n=e&&e.config,r=B(n.options&&n.options.plugins,{}),o=function(e){const t={},n=[],r=Object.keys(hr.plugins.items);for(let e=0;e<r.length;e++)n.push(hr.getPlugin(r[e]));const o=e.plugins||[];for(let e=0;e<o.length;e++){const r=o[e];-1===n.indexOf(r)&&(n.push(r),t[r.id]=!0)}return{plugins:n,localIds:t}}(n);return!1!==r||t?function(e,{plugins:t,localIds:n},r,o){const i=[],a=e.getContext();for(const s of t){const t=s.id,l=dr(r[t],o);null!==l&&i.push({plugin:s,options:pr(e.config,{plugin:s,local:n[t]},l,a)})}return i}(e,o,r,t):[]}_notifyStateChanges(e){const t=this._oldCache||[],n=this._cache,r=(e,t)=>e.filter((e=>!t.some((t=>e.plugin.id===t.plugin.id))));this._notify(r(t,n),e,"stop"),this._notify(r(n,t),e,"start")}}function dr(e,t){return t||!1!==e?!0===e?{}:e:null}function pr(e,{plugin:t,local:n},r,o){const i=e.pluginScopeKeys(t),a=e.getOptionScopes(r,i);return n&&t.defaults&&a.push(t.defaults),e.createResolver(a,o,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function mr(e,t){const n=Ue.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function gr(e){if("x"===e||"y"===e||"r"===e)return e}function yr(e,...t){if(gr(e))return e;for(const r of t){const t=r.axis||("top"===(n=r.position)||"bottom"===n?"x":"left"===n||"right"===n?"y":void 0)||e.length>1&&gr(e[0].toLowerCase());if(t)return t}var n;throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function vr(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function br(e){const t=e.options||(e.options={});t.plugins=B(t.plugins,{}),t.scales=function(e,t){const n=$e[e.type]||{scales:{}},r=t.scales||{},o=mr(e.type,t),i=Object.create(null);return Object.keys(r).forEach((t=>{const a=r[t];if(!z(a))return console.error(`Invalid scale configuration for scale: ${t}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);const s=yr(t,a,function(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter((t=>t.xAxisID===e||t.yAxisID===e));if(n.length)return vr(e,"x",n[0])||vr(e,"y",n[0])}return{}}(t,e),Ue.scales[a.type]),l=function(e,t){return e===t?"_index_":"_value_"}(s,o),c=n.scales||{};i[t]=Q(Object.create(null),[{axis:s},a,c[s],c[l]])})),e.data.datasets.forEach((n=>{const o=n.type||e.type,a=n.indexAxis||mr(o,t),s=($e[o]||{}).scales||{};Object.keys(s).forEach((e=>{const t=function(e,t){let n=e;return"_index_"===e?n=t:"_value_"===e&&(n="x"===t?"y":"x"),n}(e,a),o=n[t+"AxisID"]||t;i[o]=i[o]||Object.create(null),Q(i[o],[{axis:t},r[o],s[e]])}))})),Object.keys(i).forEach((e=>{const t=i[e];Q(t,[Ue.scales[t.type],Ue.scale])})),i}(e,t)}function xr(e){return(e=e||{}).datasets=e.datasets||[],e.labels=e.labels||[],e}const wr=new Map,kr=new Set;function Sr(e,t){let n=wr.get(e);return n||(n=t(),wr.set(e,n),kr.add(n)),n}const Or=(e,t,n)=>{const r=Z(t,n);void 0!==r&&e.add(r)};class _r{constructor(e){this._config=function(e){return(e=e||{}).data=xr(e.data),br(e),e}(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=xr(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),br(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return Sr(e,(()=>[[`datasets.${e}`,""]]))}datasetAnimationScopeKeys(e,t){return Sr(`${e}.transition.${t}`,(()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,""]]))}datasetElementScopeKeys(e,t){return Sr(`${e}-${t}`,(()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,""]]))}pluginScopeKeys(e){const t=e.id;return Sr(`${this.type}-plugin-${t}`,(()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]]))}_cachedScopes(e,t){const n=this._scopeCache;let r=n.get(e);return r&&!t||(r=new Map,n.set(e,r)),r}getOptionScopes(e,t,n){const{options:r,type:o}=this,i=this._cachedScopes(e,n),a=i.get(t);if(a)return a;const s=new Set;t.forEach((t=>{e&&(s.add(e),t.forEach((t=>Or(s,e,t)))),t.forEach((e=>Or(s,r,e))),t.forEach((e=>Or(s,$e[o]||{},e))),t.forEach((e=>Or(s,Ue,e))),t.forEach((e=>Or(s,He,e)))}));const l=Array.from(s);return 0===l.length&&l.push(Object.create(null)),kr.has(t)&&i.set(t,l),l}chartOptionScopes(){const{options:e,type:t}=this;return[e,$e[t]||{},Ue.datasets[t]||{},{type:t},Ue,He]}resolveNamedOptions(e,t,n,r=[""]){const o={$shared:!0},{resolver:i,subPrefixes:a}=Er(this._resolverCache,e,r);let s=i;(function(e,t){const{isScriptable:n,isIndexable:r}=vt(e);for(const o of t){const t=n(o),i=r(o),a=(i||t)&&e[o];if(t&&(ee(a)||Cr(a))||i&&N(a))return!0}return!1})(i,t)&&(o.$shared=!1,s=yt(i,n=ee(n)?n():n,this.createResolver(e,n,a)));for(const e of t)o[e]=s[e];return o}createResolver(e,t,n=[""],r){const{resolver:o}=Er(this._resolverCache,e,n);return z(t)?yt(o,t,void 0,r):o}}function Er(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));const o=n.join();let i=r.get(o);return i||(i={resolver:gt(t,n),subPrefixes:n.filter((e=>!e.toLowerCase().includes("hover")))},r.set(o,i)),i}const Cr=e=>z(e)&&Object.getOwnPropertyNames(e).some((t=>ee(e[t]))),Ar=["top","bottom","left","right","chartArea"];function jr(e,t){return"top"===e||"bottom"===e||-1===Ar.indexOf(e)&&"x"===t}function Pr(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function Mr(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),$(n&&n.onComplete,[e],t)}function Rr(e){const t=e.chart,n=t.options.animation;$(n&&n.onProgress,[e],t)}function Tr(e){return jt()&&"string"==typeof e?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Lr={},Ir=e=>{const t=Tr(e);return Object.values(Lr).filter((e=>e.canvas===t)).pop()};function Nr(e,t,n){const r=Object.keys(e);for(const o of r){const r=+o;if(r>=t){const i=e[o];delete e[o],(n>0||r>t)&&(e[r+n]=i)}}}function zr(e,t,n){return e.options.clip?e[n]:t[n]}class Dr{static defaults=Ue;static instances=Lr;static overrides=$e;static registry=hr;static version="4.4.4";static getChart=Ir;static register(...e){hr.add(...e),Fr()}static unregister(...e){hr.remove(...e),Fr()}constructor(e,t){const n=this.config=new _r(t),r=Tr(e),o=Ir(r);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const i=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||function(e){return!jt()||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?zn:Xn}(r)),this.platform.updateConfig(n);const a=this.platform.acquireContext(r,i.aspectRatio),s=a&&a.canvas,l=s&&s.height,c=s&&s.width;this.id=L(),this.ctx=a,this.canvas=s,this.width=c,this.height=l,this._options=i,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new fr,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(e,t){let n;return function(...r){return t?(clearTimeout(n),n=setTimeout(e,t,r)):e.apply(this,r),t}}((e=>this.update(e)),i.resizeDelay||0),this._dataChanges=[],Lr[this.id]=this,a&&s?(Vt.listen(this,"complete",Mr),Vt.listen(this,"progress",Rr),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:t},width:n,height:r,_aspectRatio:o}=this;return I(e)?t&&o?o:r?n/r:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return hr}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Dt(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Ge(this.canvas,this.ctx),this}stop(){return Vt.stop(this),this}resize(e,t){Vt.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){const n=this.options,r=this.canvas,o=n.maintainAspectRatio&&this.aspectRatio,i=this.platform.getMaximumSize(r,e,t,o),a=n.devicePixelRatio||this.platform.getDevicePixelRatio(),s=this.width?"resize":"attach";this.width=i.width,this.height=i.height,this._aspectRatio=this.aspectRatio,Dt(this,a,!0)&&(this.notifyPlugins("resize",{size:i}),$(n.onResize,[this,i],this),this.attached&&this._doResize(s)&&this.render())}ensureScalesHaveIDs(){H(this.options.scales||{},((e,t)=>{e.id=t}))}buildOrUpdateScales(){const e=this.options,t=e.scales,n=this.scales,r=Object.keys(n).reduce(((e,t)=>(e[t]=!1,e)),{});let o=[];t&&(o=o.concat(Object.keys(t).map((e=>{const n=t[e],r=yr(e,n),o="r"===r,i="x"===r;return{options:n,dposition:o?"chartArea":i?"bottom":"left",dtype:o?"radialLinear":i?"category":"linear"}})))),H(o,(t=>{const o=t.options,i=o.id,a=yr(i,o),s=B(o.type,t.dtype);void 0!==o.position&&jr(o.position,a)===jr(t.dposition)||(o.position=t.dposition),r[i]=!0;let l=null;i in n&&n[i].type===s?l=n[i]:(l=new(hr.getScale(s))({id:i,type:s,ctx:this.ctx,chart:this}),n[l.id]=l),l.init(o,e)})),H(r,((e,t)=>{e||delete n[t]})),H(n,(e=>{In.configure(this,e,e.options),In.addBox(this,e)}))}_updateMetasets(){const e=this._metasets,t=this.data.datasets.length,n=e.length;if(e.sort(((e,t)=>e.index-t.index)),n>t){for(let e=t;e<n;++e)this._destroyDatasetMeta(e);e.splice(t,n-t)}this._sortedMetasets=e.slice(0).sort(Pr("order","index"))}_removeUnreferencedMetasets(){const{_metasets:e,data:{datasets:t}}=this;e.length>t.length&&delete this._stacks,e.forEach(((e,n)=>{0===t.filter((t=>t===e._dataset)).length&&this._destroyDatasetMeta(n)}))}buildOrUpdateControllers(){const e=[],t=this.data.datasets;let n,r;for(this._removeUnreferencedMetasets(),n=0,r=t.length;n<r;n++){const r=t[n];let o=this.getDatasetMeta(n);const i=r.type||this.config.type;if(o.type&&o.type!==i&&(this._destroyDatasetMeta(n),o=this.getDatasetMeta(n)),o.type=i,o.indexAxis=r.indexAxis||mr(i,this.options),o.order=r.order||0,o.index=n,o.label=""+r.label,o.visible=this.isDatasetVisible(n),o.controller)o.controller.updateIndex(n),o.controller.linkScales();else{const t=hr.getController(i),{datasetElementType:r,dataElementType:a}=Ue.datasets[i];Object.assign(t,{dataElementType:hr.getElement(a),datasetElementType:r&&hr.getElement(r)}),o.controller=new t(this,n),e.push(o.controller)}}return this._updateMetasets(),e}_resetElements(){H(this.data.datasets,((e,t)=>{this.getDatasetMeta(t).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const t=this.config;t.update();const n=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0}))return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let i=0;for(let e=0,t=this.data.datasets.length;e<t;e++){const{controller:t}=this.getDatasetMeta(e),n=!r&&-1===o.indexOf(t);t.buildOrUpdateElements(n),i=Math.max(+t.getMaxOverflow(),i)}i=this._minPadding=n.layout.autoPadding?i:0,this._updateLayout(i),r||H(o,(e=>{e.reset()})),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(Pr("z","_idx"));const{_active:a,_lastEvent:s}=this;s?this._eventHandler(s,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){H(this.scales,(e=>{In.removeBox(this,e)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,t=new Set(Object.keys(this._listeners)),n=new Set(e.events);te(t,n)&&!!this._responsiveListeners===e.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(const{method:n,start:r,count:o}of t)Nr(e,r,"_removeElements"===n?-o:o)}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const t=this.data.datasets.length,n=t=>new Set(e.filter((e=>e[0]===t)).map(((e,t)=>t+","+e.splice(1).join(",")))),r=n(0);for(let e=1;e<t;e++)if(!te(r,n(e)))return;return Array.from(r).map((e=>e.split(","))).map((e=>({method:e[1],start:+e[2],count:+e[3]})))}_updateLayout(e){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;In.update(this,this.width,this.height,e);const t=this.chartArea,n=t.width<=0||t.height<=0;this._layers=[],H(this.boxes,(e=>{n&&"chartArea"===e.position||(e.configure&&e.configure(),this._layers.push(...e._layers()))}),this),this._layers.forEach(((e,t)=>{e._idx=t})),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})){for(let e=0,t=this.data.datasets.length;e<t;++e)this.getDatasetMeta(e).controller.configure();for(let t=0,n=this.data.datasets.length;t<n;++t)this._updateDataset(t,ee(e)?e({datasetIndex:t}):e);this.notifyPlugins("afterDatasetsUpdate",{mode:e})}}_updateDataset(e,t){const n=this.getDatasetMeta(e),r={meta:n,index:e,mode:t,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",r)&&(n.controller._update(t),r.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",r))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(Vt.has(this)?this.attached&&!Vt.running(this)&&Vt.start(this):(this.draw(),Mr({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){const{width:e,height:t}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(e,t)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const t=this._layers;for(e=0;e<t.length&&t[e].z<=0;++e)t[e].draw(this.chartArea);for(this._drawDatasets();e<t.length;++e)t[e].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(e){const t=this._sortedMetasets,n=[];let r,o;for(r=0,o=t.length;r<o;++r){const o=t[r];e&&!o.visible||n.push(o)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const e=this.getSortedVisibleDatasetMetas();for(let t=e.length-1;t>=0;--t)this._drawDataset(e[t]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const t=this.ctx,n=e._clip,r=!n.disabled,o=function(e,t){const{xScale:n,yScale:r}=e;return n&&r?{left:zr(n,t,"left"),right:zr(n,t,"right"),top:zr(r,t,"top"),bottom:zr(r,t,"bottom")}:t}(e,this.chartArea),i={meta:e,index:e.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",i)&&(r&&Je(t,{left:!1===n.left?0:o.left-n.left,right:!1===n.right?this.width:o.right+n.right,top:!1===n.top?0:o.top-n.top,bottom:!1===n.bottom?this.height:o.bottom+n.bottom}),e.controller.draw(),r&&et(t),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(e){return Xe(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,n,r){const o=Sn.modes[t];return"function"==typeof o?o(this,e,n,r):[]}getDatasetMeta(e){const t=this.data.datasets[e],n=this._metasets;let r=n.filter((e=>e&&e._dataset===t)).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},n.push(r)),r}getContext(){return this.$context||(this.$context=mt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const t=this.data.datasets[e];if(!t)return!1;const n=this.getDatasetMeta(e);return"boolean"==typeof n.hidden?!n.hidden:!t.hidden}setDatasetVisibility(e,t){this.getDatasetMeta(e).hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,n){const r=n?"show":"hide",o=this.getDatasetMeta(e),i=o.controller._resolveAnimations(void 0,r);J(t)?(o.data[t].hidden=!n,this.update()):(this.setDatasetVisibility(e,n),i.update(o,{visible:n}),this.update((t=>t.datasetIndex===e?r:void 0)))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){const t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),Vt.remove(this),e=0,t=this.data.datasets.length;e<t;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:e,ctx:t}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),Ge(e,t),this.platform.releaseContext(t),this.canvas=null,this.ctx=null),delete Lr[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const e=this._listeners,t=this.platform,n=(n,r)=>{t.addEventListener(this,n,r),e[n]=r},r=(e,t,n)=>{e.offsetX=t,e.offsetY=n,this._eventHandler(e)};H(this.options.events,(e=>n(e,r)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,t=this.platform,n=(n,r)=>{t.addEventListener(this,n,r),e[n]=r},r=(n,r)=>{e[n]&&(t.removeEventListener(this,n,r),delete e[n])},o=(e,t)=>{this.canvas&&this.resize(e,t)};let i;const a=()=>{r("attach",a),this.attached=!0,this.resize(),n("resize",o),n("detach",i)};i=()=>{this.attached=!1,r("resize",o),this._stop(),this._resize(0,0),n("attach",a)},t.isAttached(this.canvas)?a():i()}unbindEvents(){H(this._listeners,((e,t)=>{this.platform.removeEventListener(this,t,e)})),this._listeners={},H(this._responsiveListeners,((e,t)=>{this.platform.removeEventListener(this,t,e)})),this._responsiveListeners=void 0}updateHoverStyle(e,t,n){const r=n?"set":"remove";let o,i,a,s;for("dataset"===t&&(o=this.getDatasetMeta(e[0].datasetIndex),o.controller["_"+r+"DatasetHoverStyle"]()),a=0,s=e.length;a<s;++a){i=e[a];const t=i&&this.getDatasetMeta(i.datasetIndex).controller;t&&t[r+"HoverStyle"](i.element,i.datasetIndex,i.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){const t=this._active||[],n=e.map((({datasetIndex:e,index:t})=>{const n=this.getDatasetMeta(e);if(!n)throw new Error("No dataset found at index "+e);return{datasetIndex:e,element:n.data[t],index:t}}));!W(n,t)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,t))}notifyPlugins(e,t,n){return this._plugins.notify(this,e,t,n)}isPluginEnabled(e){return 1===this._plugins._cache.filter((t=>t.plugin.id===e)).length}_updateHoverStyles(e,t,n){const r=this.options.hover,o=(e,t)=>e.filter((e=>!t.some((t=>e.datasetIndex===t.datasetIndex&&e.index===t.index)))),i=o(t,e),a=n?e:o(e,t);i.length&&this.updateHoverStyle(i,r.mode,!1),a.length&&r.mode&&this.updateHoverStyle(a,r.mode,!0)}_eventHandler(e,t){const n={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},r=t=>(t.options.events||this.options.events).includes(e.native.type);if(!1===this.notifyPlugins("beforeEvent",n,r))return;const o=this._handleEvent(e,t,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,r),(o||n.changed)&&this.render(),this}_handleEvent(e,t,n){const{_active:r=[],options:o}=this,i=t,a=this._getActiveElements(e,r,n,i),s=function(e){return"mouseup"===e.type||"click"===e.type||"contextmenu"===e.type}(e),l=function(e,t,n,r){return n&&"mouseout"!==e.type?r?t:e:null}(e,this._lastEvent,n,s);n&&(this._lastEvent=null,$(o.onHover,[e,a,this],this),s&&$(o.onClick,[e,a,this],this));const c=!W(a,r);return(c||t)&&(this._active=a,this._updateHoverStyles(a,r,t)),this._lastEvent=l,c}_getActiveElements(e,t,n,r){if("mouseout"===e.type)return[];if(!n)return t;const o=this.options.hover;return this.getElementsAtEventForMode(e,o.mode,o,r)}}function Fr(){return H(Dr.instances,(e=>e._plugins.invalidate()))}function Br(e,t){const{x:n,y:r,base:o,width:i,height:a}=e.getProps(["x","y","base","width","height"],t);let s,l,c,u,h;return e.horizontal?(h=a/2,s=Math.min(n,o),l=Math.max(n,o),c=r-h,u=r+h):(h=i/2,s=n-h,l=n+h,c=Math.min(r,o),u=Math.max(r,o)),{left:s,top:c,right:l,bottom:u}}function $r(e,t,n,r){return e?0:ye(t,n,r)}function Hr(e,t,n,r){const o=null===t,i=null===n,a=e&&!(o&&i)&&Br(e,r);return a&&(o||ve(t,a.left,a.right))&&(i||ve(n,a.top,a.bottom))}function Wr(e,t){e.rect(t.x,t.y,t.w,t.h)}function qr(e,t,n={}){const r=e.x!==n.x?-t:0,o=e.y!==n.y?-t:0,i=(e.x+e.w!==n.x+n.w?t:0)-r,a=(e.y+e.h!==n.y+n.h?t:0)-o;return{x:e.x+r,y:e.y+o,w:e.w+i,h:e.h+a,radius:e.radius}}class Vr extends Jn{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(e){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,e&&Object.assign(this,e)}draw(e){const{inflateAmount:t,options:{borderColor:n,backgroundColor:r}}=this,{inner:o,outer:i}=function(e){const t=Br(e),n=t.right-t.left,r=t.bottom-t.top,o=function(e,t,n){const r=e.options.borderWidth,o=e.borderSkipped,i=ut(r);return{t:$r(o.top,i.top,0,n),r:$r(o.right,i.right,0,t),b:$r(o.bottom,i.bottom,0,n),l:$r(o.left,i.left,0,t)}}(e,n/2,r/2),i=function(e,t,n){const{enableBorderRadius:r}=e.getProps(["enableBorderRadius"]),o=e.options.borderRadius,i=ht(o),a=Math.min(t,n),s=e.borderSkipped,l=r||z(o);return{topLeft:$r(!l||s.top||s.left,i.topLeft,0,a),topRight:$r(!l||s.top||s.right,i.topRight,0,a),bottomLeft:$r(!l||s.bottom||s.left,i.bottomLeft,0,a),bottomRight:$r(!l||s.bottom||s.right,i.bottomRight,0,a)}}(e,n/2,r/2);return{outer:{x:t.left,y:t.top,w:n,h:r,radius:i},inner:{x:t.left+o.l,y:t.top+o.t,w:n-o.l-o.r,h:r-o.t-o.b,radius:{topLeft:Math.max(0,i.topLeft-Math.max(o.t,o.l)),topRight:Math.max(0,i.topRight-Math.max(o.t,o.r)),bottomLeft:Math.max(0,i.bottomLeft-Math.max(o.b,o.l)),bottomRight:Math.max(0,i.bottomRight-Math.max(o.b,o.r))}}}}(this),a=(s=i.radius).topLeft||s.topRight||s.bottomLeft||s.bottomRight?ot:Wr;var s;e.save(),i.w===o.w&&i.h===o.h||(e.beginPath(),a(e,qr(i,t,o)),e.clip(),a(e,qr(o,-t,i)),e.fillStyle=n,e.fill("evenodd")),e.beginPath(),a(e,qr(o,t)),e.fillStyle=r,e.fill(),e.restore()}inRange(e,t,n){return Hr(this,e,t,n)}inXRange(e,t){return Hr(this,e,null,t)}inYRange(e,t){return Hr(this,null,e,t)}getCenterPoint(e){const{x:t,y:n,base:r,horizontal:o}=this.getProps(["x","y","base","horizontal"],e);return{x:o?(t+r)/2:t,y:o?n:(n+r)/2}}getRange(e){return"x"===e?this.width/2:this.height/2}}const Ur=(e,t)=>{let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}};class Kr extends Jn{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t,n){this.maxWidth=e,this.maxHeight=t,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const e=this.options.labels||{};let t=$(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter((t=>e.filter(t,this.chart.data)))),e.sort&&(t=t.sort(((t,n)=>e.sort(t,n,this.chart.data)))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){const{options:e,ctx:t}=this;if(!e.display)return void(this.width=this.height=0);const n=e.labels,r=dt(n.font),o=r.size,i=this._computeTitleHeight(),{boxWidth:a,itemHeight:s}=Ur(n,o);let l,c;t.font=r.string,this.isHorizontal()?(l=this.maxWidth,c=this._fitRows(i,o,a,s)+10):(c=this.maxHeight,l=this._fitCols(i,r,a,s)+10),this.width=Math.min(l,e.maxWidth||this.maxWidth),this.height=Math.min(c,e.maxHeight||this.maxHeight)}_fitRows(e,t,n,r){const{ctx:o,maxWidth:i,options:{labels:{padding:a}}}=this,s=this.legendHitBoxes=[],l=this.lineWidths=[0],c=r+a;let u=e;o.textAlign="left",o.textBaseline="middle";let h=-1,f=-c;return this.legendItems.forEach(((e,d)=>{const p=n+t/2+o.measureText(e.text).width;(0===d||l[l.length-1]+p+2*a>i)&&(u+=c,l[l.length-(d>0?0:1)]=0,f+=c,h++),s[d]={left:0,top:f,row:h,width:p,height:r},l[l.length-1]+=p+a})),u}_fitCols(e,t,n,r){const{ctx:o,maxHeight:i,options:{labels:{padding:a}}}=this,s=this.legendHitBoxes=[],l=this.columnSizes=[],c=i-e;let u=a,h=0,f=0,d=0,p=0;return this.legendItems.forEach(((e,i)=>{const{itemWidth:m,itemHeight:g}=function(e,t,n,r,o){const i=function(e,t,n,r){let o=e.text;return o&&"string"!=typeof o&&(o=o.reduce(((e,t)=>e.length>t.length?e:t))),t+n.size/2+r.measureText(o).width}(r,e,t,n),a=function(e,t,n){let r=e;return"string"!=typeof t.text&&(r=Qr(t,n)),r}(o,r,t.lineHeight);return{itemWidth:i,itemHeight:a}}(n,t,o,e,r);i>0&&f+g+2*a>c&&(u+=h+a,l.push({width:h,height:f}),d+=h+a,p++,h=f=0),s[i]={left:d,top:f,col:p,width:m,height:g},h=Math.max(h,m),f+=g+a})),u+=h,l.push({width:h,height:f}),u}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:n,labels:{padding:r},rtl:o}}=this,i=$t(o,this.left,this.width);if(this.isHorizontal()){let o=0,a=Ce(n,this.left+r,this.right-this.lineWidths[o]);for(const s of t)o!==s.row&&(o=s.row,a=Ce(n,this.left+r,this.right-this.lineWidths[o])),s.top+=this.top+e+r,s.left=i.leftForLtr(i.x(a),s.width),a+=s.width+r}else{let o=0,a=Ce(n,this.top+e+r,this.bottom-this.columnSizes[o].height);for(const s of t)s.col!==o&&(o=s.col,a=Ce(n,this.top+e+r,this.bottom-this.columnSizes[o].height)),s.top=a,s.left+=this.left+r,s.left=i.leftForLtr(i.x(s.left),s.width),a+=s.height+r}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const e=this.ctx;Je(e,this),this._draw(),et(e)}}_draw(){const{options:e,columnSizes:t,lineWidths:n,ctx:r}=this,{align:o,labels:i}=e,a=Ue.color,s=$t(e.rtl,this.left,this.width),l=dt(i.font),{padding:c}=i,u=l.size,h=u/2;let f;this.drawTitle(),r.textAlign=s.textAlign("left"),r.textBaseline="middle",r.lineWidth=.5,r.font=l.string;const{boxWidth:d,boxHeight:p,itemHeight:m}=Ur(i,u),g=this.isHorizontal(),y=this._computeTitleHeight();f=g?{x:Ce(o,this.left+c,this.right-n[0]),y:this.top+c+y,line:0}:{x:this.left+c,y:Ce(o,this.top+y+c,this.bottom-t[0].height),line:0},Ht(this.ctx,e.textDirection);const v=m+c;this.legendItems.forEach(((b,x)=>{r.strokeStyle=b.fontColor,r.fillStyle=b.fontColor;const w=r.measureText(b.text).width,k=s.textAlign(b.textAlign||(b.textAlign=i.textAlign)),S=d+h+w;let O=f.x,_=f.y;if(s.setWidth(this.width),g?x>0&&O+S+c>this.right&&(_=f.y+=v,f.line++,O=f.x=Ce(o,this.left+c,this.right-n[f.line])):x>0&&_+v>this.bottom&&(O=f.x=O+t[f.line].width+c,f.line++,_=f.y=Ce(o,this.top+y+c,this.bottom-t[f.line].height)),function(e,t,n){if(isNaN(d)||d<=0||isNaN(p)||p<0)return;r.save();const o=B(n.lineWidth,1);if(r.fillStyle=B(n.fillStyle,a),r.lineCap=B(n.lineCap,"butt"),r.lineDashOffset=B(n.lineDashOffset,0),r.lineJoin=B(n.lineJoin,"miter"),r.lineWidth=o,r.strokeStyle=B(n.strokeStyle,a),r.setLineDash(B(n.lineDash,[])),i.usePointStyle){const a={radius:p*Math.SQRT2/2,pointStyle:n.pointStyle,rotation:n.rotation,borderWidth:o},l=s.xPlus(e,d/2);Ze(r,a,l,t+h,i.pointStyleWidth&&d)}else{const i=t+Math.max((u-p)/2,0),a=s.leftForLtr(e,d),l=ht(n.borderRadius);r.beginPath(),Object.values(l).some((e=>0!==e))?ot(r,{x:a,y:i,w:d,h:p,radius:l}):r.rect(a,i,d,p),r.fill(),0!==o&&r.stroke()}r.restore()}(s.x(O),_,b),O=((e,t,n,r)=>e===(r?"left":"right")?n:"center"===e?(t+n)/2:t)(k,O+d+h,g?O+S:this.right,e.rtl),function(e,t,n){rt(r,n.text,e,t+m/2,l,{strikethrough:n.hidden,textAlign:s.textAlign(n.textAlign)})}(s.x(O),_,b),g)f.x+=S+c;else if("string"!=typeof b.text){const e=l.lineHeight;f.y+=Qr(b,e)+c}else f.y+=v})),Wt(this.ctx,e.textDirection)}drawTitle(){const e=this.options,t=e.title,n=dt(t.font),r=ft(t.padding);if(!t.display)return;const o=$t(e.rtl,this.left,this.width),i=this.ctx,a=t.position,s=n.size/2,l=r.top+s;let c,u=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),c=this.top+l,u=Ce(e.align,u,this.right-h);else{const t=this.columnSizes.reduce(((e,t)=>Math.max(e,t.height)),0);c=l+Ce(e.align,this.top,this.bottom-t-e.labels.padding-this._computeTitleHeight())}const f=Ce(a,u,u+h);i.textAlign=o.textAlign(Ee(a)),i.textBaseline="middle",i.strokeStyle=t.color,i.fillStyle=t.color,i.font=n.string,rt(i,t.text,f,c,n)}_computeTitleHeight(){const e=this.options.title,t=dt(e.font),n=ft(e.padding);return e.display?t.lineHeight+n.height:0}_getLegendItemAt(e,t){let n,r,o;if(ve(e,this.left,this.right)&&ve(t,this.top,this.bottom))for(o=this.legendHitBoxes,n=0;n<o.length;++n)if(r=o[n],ve(e,r.left,r.left+r.width)&&ve(t,r.top,r.top+r.height))return this.legendItems[n];return null}handleEvent(e){const t=this.options;if(!function(e,t){return!("mousemove"!==e&&"mouseout"!==e||!t.onHover&&!t.onLeave)||!(!t.onClick||"click"!==e&&"mouseup"!==e)}(e.type,t))return;const n=this._getLegendItemAt(e.x,e.y);if("mousemove"===e.type||"mouseout"===e.type){const i=this._hoveredItem,a=(o=n,null!==(r=i)&&null!==o&&r.datasetIndex===o.datasetIndex&&r.index===o.index);i&&!a&&$(t.onLeave,[e,i,this],this),this._hoveredItem=n,n&&!a&&$(t.onHover,[e,n,this],this)}else n&&$(t.onClick,[e,n,this],this);var r,o}}function Qr(e,t){return t*(e.text?e.text.length:0)}var Gr={id:"legend",_element:Kr,start(e,t,n){const r=e.legend=new Kr({ctx:e.ctx,options:n,chart:e});In.configure(e,r,n),In.addBox(e,r)},stop(e){In.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const r=e.legend;In.configure(e,r,n),r.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const r=t.datasetIndex,o=n.chart;o.isDatasetVisible(r)?(o.hide(r),t.hidden=!0):(o.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:o,color:i,useBorderRadius:a,borderRadius:s}}=e.legend.options;return e._getSortedDatasetMetas().map((e=>{const l=e.controller.getStyle(n?0:void 0),c=ft(l.borderWidth);return{text:t[e.index].label,fillStyle:l.backgroundColor,fontColor:i,hidden:!e.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(c.width+c.height)/4,strokeStyle:l.borderColor,pointStyle:r||l.pointStyle,rotation:l.rotation,textAlign:o||l.textAlign,borderRadius:a&&(s||l.borderRadius),datasetIndex:e.index}}),this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};new WeakMap;const Yr={average(e){if(!e.length)return!1;let t,n,r=new Set,o=0,i=0;for(t=0,n=e.length;t<n;++t){const n=e[t].element;if(n&&n.hasValue()){const e=n.tooltipPosition();r.add(e.x),o+=e.y,++i}}return 0!==i&&0!==r.size&&{x:[...r].reduce(((e,t)=>e+t))/r.size,y:o/i}},nearest(e,t){if(!e.length)return!1;let n,r,o,i=t.x,a=t.y,s=Number.POSITIVE_INFINITY;for(n=0,r=e.length;n<r;++n){const r=e[n].element;if(r&&r.hasValue()){const e=(l=t,c=r.getCenterPoint(),Math.sqrt(Math.pow(c.x-l.x,2)+Math.pow(c.y-l.y,2)));e<s&&(s=e,o=r)}}var l,c;if(o){const e=o.tooltipPosition();i=e.x,a=e.y}return{x:i,y:a}}};function Zr(e,t){return t&&(N(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Xr(e){return("string"==typeof e||e instanceof String)&&e.indexOf("\n")>-1?e.split("\n"):e}function Jr(e,t){const{element:n,datasetIndex:r,index:o}=t,i=e.getDatasetMeta(r).controller,{label:a,value:s}=i.getLabelAndValue(o);return{chart:e,label:a,parsed:i.getParsed(o),raw:e.data.datasets[r].data[o],formattedValue:s,dataset:i.getDataset(),dataIndex:o,datasetIndex:r,element:n}}function eo(e,t){const n=e.chart.ctx,{body:r,footer:o,title:i}=e,{boxWidth:a,boxHeight:s}=t,l=dt(t.bodyFont),c=dt(t.titleFont),u=dt(t.footerFont),h=i.length,f=o.length,d=r.length,p=ft(t.padding);let m=p.height,g=0,y=r.reduce(((e,t)=>e+t.before.length+t.lines.length+t.after.length),0);y+=e.beforeBody.length+e.afterBody.length,h&&(m+=h*c.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),y&&(m+=d*(t.displayColors?Math.max(s,l.lineHeight):l.lineHeight)+(y-d)*l.lineHeight+(y-1)*t.bodySpacing),f&&(m+=t.footerMarginTop+f*u.lineHeight+(f-1)*t.footerSpacing);let v=0;const b=function(e){g=Math.max(g,n.measureText(e).width+v)};return n.save(),n.font=c.string,H(e.title,b),n.font=l.string,H(e.beforeBody.concat(e.afterBody),b),v=t.displayColors?a+2+t.boxPadding:0,H(r,(e=>{H(e.before,b),H(e.lines,b),H(e.after,b)})),v=0,n.font=u.string,H(e.footer,b),n.restore(),g+=p.width,{width:g,height:m}}function to(e,t,n,r){const{x:o,width:i}=n,{width:a,chartArea:{left:s,right:l}}=e;let c="center";return"center"===r?c=o<=(s+l)/2?"left":"right":o<=i/2?c="left":o>=a-i/2&&(c="right"),function(e,t,n,r){const{x:o,width:i}=r,a=n.caretSize+n.caretPadding;return"left"===e&&o+i+a>t.width||"right"===e&&o-i-a<0||void 0}(c,e,t,n)&&(c="center"),c}function no(e,t,n){const r=n.yAlign||t.yAlign||function(e,t){const{y:n,height:r}=t;return n<r/2?"top":n>e.height-r/2?"bottom":"center"}(e,n);return{xAlign:n.xAlign||t.xAlign||to(e,t,n,r),yAlign:r}}function ro(e,t,n,r){const{caretSize:o,caretPadding:i,cornerRadius:a}=e,{xAlign:s,yAlign:l}=n,c=o+i,{topLeft:u,topRight:h,bottomLeft:f,bottomRight:d}=ht(a);let p=function(e,t){let{x:n,width:r}=e;return"right"===t?n-=r:"center"===t&&(n-=r/2),n}(t,s);const m=function(e,t,n){let{y:r,height:o}=e;return"top"===t?r+=n:r-="bottom"===t?o+n:o/2,r}(t,l,c);return"center"===l?"left"===s?p+=c:"right"===s&&(p-=c):"left"===s?p-=Math.max(u,f)+o:"right"===s&&(p+=Math.max(h,d)+o),{x:ye(p,0,r.width-t.width),y:ye(m,0,r.height-t.height)}}function oo(e,t,n){const r=ft(n.padding);return"center"===t?e.x+e.width/2:"right"===t?e.x+e.width-r.right:e.x+r.left}function io(e){return Zr([],Xr(e))}function ao(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const so={beforeTitle:T,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&"dataset"===this.options.mode)return t.dataset.label||"";if(t.label)return t.label;if(r>0&&t.dataIndex<r)return n[t.dataIndex]}return""},afterTitle:T,beforeBody:T,beforeLabel:T,label(e){if(this&&this.options&&"dataset"===this.options.mode)return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return I(n)||(t+=n),t},labelColor(e){const t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:T,afterBody:T,beforeFooter:T,footer:T,afterFooter:T};function lo(e,t,n,r){const o=e[t].call(n,r);return void 0===o?so[t].call(n,r):o}class co extends Jn{static positioners=Yr;constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const t=this.chart,n=this.options.setContext(this.getContext()),r=n.enabled&&t.options.animation&&n.animations,o=new Gt(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=(this,mt(this.chart.getContext(),{tooltip:this,tooltipItems:this._tooltipItems,type:"tooltip"})))}getTitle(e,t){const{callbacks:n}=t,r=lo(n,"beforeTitle",this,e),o=lo(n,"title",this,e),i=lo(n,"afterTitle",this,e);let a=[];return a=Zr(a,Xr(r)),a=Zr(a,Xr(o)),a=Zr(a,Xr(i)),a}getBeforeBody(e,t){return io(lo(t.callbacks,"beforeBody",this,e))}getBody(e,t){const{callbacks:n}=t,r=[];return H(e,(e=>{const t={before:[],lines:[],after:[]},o=ao(n,e);Zr(t.before,Xr(lo(o,"beforeLabel",this,e))),Zr(t.lines,lo(o,"label",this,e)),Zr(t.after,Xr(lo(o,"afterLabel",this,e))),r.push(t)})),r}getAfterBody(e,t){return io(lo(t.callbacks,"afterBody",this,e))}getFooter(e,t){const{callbacks:n}=t,r=lo(n,"beforeFooter",this,e),o=lo(n,"footer",this,e),i=lo(n,"afterFooter",this,e);let a=[];return a=Zr(a,Xr(r)),a=Zr(a,Xr(o)),a=Zr(a,Xr(i)),a}_createItems(e){const t=this._active,n=this.chart.data,r=[],o=[],i=[];let a,s,l=[];for(a=0,s=t.length;a<s;++a)l.push(Jr(this.chart,t[a]));return e.filter&&(l=l.filter(((t,r,o)=>e.filter(t,r,o,n)))),e.itemSort&&(l=l.sort(((t,r)=>e.itemSort(t,r,n)))),H(l,(t=>{const n=ao(e.callbacks,t);r.push(lo(n,"labelColor",this,t)),o.push(lo(n,"labelPointStyle",this,t)),i.push(lo(n,"labelTextColor",this,t))})),this.labelColors=r,this.labelPointStyles=o,this.labelTextColors=i,this.dataPoints=l,l}update(e,t){const n=this.options.setContext(this.getContext()),r=this._active;let o,i=[];if(r.length){const e=Yr[n.position].call(this,r,this._eventPosition);i=this._createItems(n),this.title=this.getTitle(i,n),this.beforeBody=this.getBeforeBody(i,n),this.body=this.getBody(i,n),this.afterBody=this.getAfterBody(i,n),this.footer=this.getFooter(i,n);const t=this._size=eo(this,n),a=Object.assign({},e,t),s=no(this.chart,n,a),l=ro(n,a,s,this.chart);this.xAlign=s.xAlign,this.yAlign=s.yAlign,o={opacity:1,x:l.x,y:l.y,width:t.width,height:t.height,caretX:e.x,caretY:e.y}}else 0!==this.opacity&&(o={opacity:0});this._tooltipItems=i,this.$context=void 0,o&&this._resolveAnimations().update(this,o),e&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,n,r){const o=this.getCaretPosition(e,n,r);t.lineTo(o.x1,o.y1),t.lineTo(o.x2,o.y2),t.lineTo(o.x3,o.y3)}getCaretPosition(e,t,n){const{xAlign:r,yAlign:o}=this,{caretSize:i,cornerRadius:a}=n,{topLeft:s,topRight:l,bottomLeft:c,bottomRight:u}=ht(a),{x:h,y:f}=e,{width:d,height:p}=t;let m,g,y,v,b,x;return"center"===o?(b=f+p/2,"left"===r?(m=h,g=m-i,v=b+i,x=b-i):(m=h+d,g=m+i,v=b-i,x=b+i),y=m):(g="left"===r?h+Math.max(s,c)+i:"right"===r?h+d-Math.max(l,u)-i:this.caretX,"top"===o?(v=f,b=v-i,m=g-i,y=g+i):(v=f+p,b=v+i,m=g+i,y=g-i),x=v),{x1:m,x2:g,x3:y,y1:v,y2:b,y3:x}}drawTitle(e,t,n){const r=this.title,o=r.length;let i,a,s;if(o){const l=$t(n.rtl,this.x,this.width);for(e.x=oo(this,n.titleAlign,n),t.textAlign=l.textAlign(n.titleAlign),t.textBaseline="middle",i=dt(n.titleFont),a=n.titleSpacing,t.fillStyle=n.titleColor,t.font=i.string,s=0;s<o;++s)t.fillText(r[s],l.x(e.x),e.y+i.lineHeight/2),e.y+=i.lineHeight+a,s+1===o&&(e.y+=n.titleMarginBottom-a)}}_drawColorBox(e,t,n,r,o){const i=this.labelColors[n],a=this.labelPointStyles[n],{boxHeight:s,boxWidth:l}=o,c=dt(o.bodyFont),u=oo(this,"left",o),h=r.x(u),f=s<c.lineHeight?(c.lineHeight-s)/2:0,d=t.y+f;if(o.usePointStyle){const t={radius:Math.min(l,s)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},n=r.leftForLtr(h,l)+l/2,c=d+s/2;e.strokeStyle=o.multiKeyBackground,e.fillStyle=o.multiKeyBackground,Ye(e,t,n,c),e.strokeStyle=i.borderColor,e.fillStyle=i.backgroundColor,Ye(e,t,n,c)}else{e.lineWidth=z(i.borderWidth)?Math.max(...Object.values(i.borderWidth)):i.borderWidth||1,e.strokeStyle=i.borderColor,e.setLineDash(i.borderDash||[]),e.lineDashOffset=i.borderDashOffset||0;const t=r.leftForLtr(h,l),n=r.leftForLtr(r.xPlus(h,1),l-2),a=ht(i.borderRadius);Object.values(a).some((e=>0!==e))?(e.beginPath(),e.fillStyle=o.multiKeyBackground,ot(e,{x:t,y:d,w:l,h:s,radius:a}),e.fill(),e.stroke(),e.fillStyle=i.backgroundColor,e.beginPath(),ot(e,{x:n,y:d+1,w:l-2,h:s-2,radius:a}),e.fill()):(e.fillStyle=o.multiKeyBackground,e.fillRect(t,d,l,s),e.strokeRect(t,d,l,s),e.fillStyle=i.backgroundColor,e.fillRect(n,d+1,l-2,s-2))}e.fillStyle=this.labelTextColors[n]}drawBody(e,t,n){const{body:r}=this,{bodySpacing:o,bodyAlign:i,displayColors:a,boxHeight:s,boxWidth:l,boxPadding:c}=n,u=dt(n.bodyFont);let h=u.lineHeight,f=0;const d=$t(n.rtl,this.x,this.width),p=function(n){t.fillText(n,d.x(e.x+f),e.y+h/2),e.y+=h+o},m=d.textAlign(i);let g,y,v,b,x,w,k;for(t.textAlign=i,t.textBaseline="middle",t.font=u.string,e.x=oo(this,m,n),t.fillStyle=n.bodyColor,H(this.beforeBody,p),f=a&&"right"!==m?"center"===i?l/2+c:l+2+c:0,b=0,w=r.length;b<w;++b){for(g=r[b],y=this.labelTextColors[b],t.fillStyle=y,H(g.before,p),v=g.lines,a&&v.length&&(this._drawColorBox(t,e,b,d,n),h=Math.max(u.lineHeight,s)),x=0,k=v.length;x<k;++x)p(v[x]),h=u.lineHeight;H(g.after,p)}f=0,h=u.lineHeight,H(this.afterBody,p),e.y-=o}drawFooter(e,t,n){const r=this.footer,o=r.length;let i,a;if(o){const s=$t(n.rtl,this.x,this.width);for(e.x=oo(this,n.footerAlign,n),e.y+=n.footerMarginTop,t.textAlign=s.textAlign(n.footerAlign),t.textBaseline="middle",i=dt(n.footerFont),t.fillStyle=n.footerColor,t.font=i.string,a=0;a<o;++a)t.fillText(r[a],s.x(e.x),e.y+i.lineHeight/2),e.y+=i.lineHeight+n.footerSpacing}}drawBackground(e,t,n,r){const{xAlign:o,yAlign:i}=this,{x:a,y:s}=e,{width:l,height:c}=n,{topLeft:u,topRight:h,bottomLeft:f,bottomRight:d}=ht(r.cornerRadius);t.fillStyle=r.backgroundColor,t.strokeStyle=r.borderColor,t.lineWidth=r.borderWidth,t.beginPath(),t.moveTo(a+u,s),"top"===i&&this.drawCaret(e,t,n,r),t.lineTo(a+l-h,s),t.quadraticCurveTo(a+l,s,a+l,s+h),"center"===i&&"right"===o&&this.drawCaret(e,t,n,r),t.lineTo(a+l,s+c-d),t.quadraticCurveTo(a+l,s+c,a+l-d,s+c),"bottom"===i&&this.drawCaret(e,t,n,r),t.lineTo(a+f,s+c),t.quadraticCurveTo(a,s+c,a,s+c-f),"center"===i&&"left"===o&&this.drawCaret(e,t,n,r),t.lineTo(a,s+u),t.quadraticCurveTo(a,s,a+u,s),t.closePath(),t.fill(),r.borderWidth>0&&t.stroke()}_updateAnimationTarget(e){const t=this.chart,n=this.$animations,r=n&&n.x,o=n&&n.y;if(r||o){const n=Yr[e.position].call(this,this._active,this._eventPosition);if(!n)return;const i=this._size=eo(this,e),a=Object.assign({},n,this._size),s=no(t,e,a),l=ro(e,a,s,t);r._to===l.x&&o._to===l.y||(this.xAlign=s.xAlign,this.yAlign=s.yAlign,this.width=i.width,this.height=i.height,this.caretX=n.x,this.caretY=n.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(e){const t=this.options.setContext(this.getContext());let n=this.opacity;if(!n)return;this._updateAnimationTarget(t);const r={width:this.width,height:this.height},o={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;const i=ft(t.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&a&&(e.save(),e.globalAlpha=n,this.drawBackground(o,e,r,t),Ht(e,t.textDirection),o.y+=i.top,this.drawTitle(o,e,t),this.drawBody(o,e,t),this.drawFooter(o,e,t),Wt(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){const n=this._active,r=e.map((({datasetIndex:e,index:t})=>{const n=this.chart.getDatasetMeta(e);if(!n)throw new Error("Cannot find a dataset at index "+e);return{datasetIndex:e,element:n.data[t],index:t}})),o=!W(n,r),i=this._positionChanged(r,t);(o||i)&&(this._active=r,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,n=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const r=this.options,o=this._active||[],i=this._getActiveElements(e,o,t,n),a=this._positionChanged(i,e),s=t||!W(i,o)||a;return s&&(this._active=i,(r.enabled||r.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),s}_getActiveElements(e,t,n,r){const o=this.options;if("mouseout"===e.type)return[];if(!r)return t.filter((e=>this.chart.data.datasets[e.datasetIndex]&&void 0!==this.chart.getDatasetMeta(e.datasetIndex).controller.getParsed(e.index)));const i=this.chart.getElementsAtEventForMode(e,o.mode,o,n);return o.reverse&&i.reverse(),i}_positionChanged(e,t){const{caretX:n,caretY:r,options:o}=this,i=Yr[o.position].call(this,e,t);return!1!==i&&(n!==i.x||r!==i.y)}}var uo={id:"tooltip",_element:co,positioners:Yr,afterInit(e,t,n){n&&(e.tooltip=new co({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(!1===e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0}))return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:so},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>"filter"!==e&&"itemSort"!==e&&"external"!==e,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};function ho(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class fo extends lr{static id="category";static defaults={ticks:{callback:ho}};constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const t=this._addedLabels;if(t.length){const e=this.getLabels();for(const{index:n,label:r}of t)e[n]===r&&e.splice(n,1);this._addedLabels=[]}super.init(e)}parse(e,t){if(I(e))return null;const n=this.getLabels();return((e,t)=>null===e?null:ye(Math.round(e),0,t))(t=isFinite(t)&&n[t]===e?t:function(e,t,n,r){const o=e.indexOf(t);return-1===o?((e,t,n,r)=>("string"==typeof t?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n))(e,t,n,r):o!==e.lastIndexOf(t)?n:o}(n,e,B(t,e),this._addedLabels),n.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:t}=this.getUserBounds();let{min:n,max:r}=this.getMinMax(!0);"ticks"===this.options.bounds&&(e||(n=0),t||(r=this.getLabels().length-1)),this.min=n,this.max=r}buildTicks(){const e=this.min,t=this.max,n=this.options.offset,r=[];let o=this.getLabels();o=0===e&&t===o.length-1?o:o.slice(e,t+1),this._valueRange=Math.max(o.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let n=e;n<=t;n++)r.push({value:n});return r}getLabelForValue(e){return ho.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return"number"!=typeof e&&(e=this.parse(e)),null===e?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}function po(e,t,{horizontal:n,minRotation:r}){const o=pe(r),i=(n?Math.sin(o):Math.cos(o))||.001,a=.75*t*(""+e).length;return Math.min(t/i,a)}class mo extends lr{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return I(e)||("number"==typeof e||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:r,max:o}=this;const i=e=>r=t?r:e,a=e=>o=n?o:e;if(e){const e=ue(r),t=ue(o);e<0&&t<0?a(0):e>0&&t>0&&i(0)}if(r===o){let t=0===o?1:Math.abs(.05*o);a(o+t),e||i(r-t)}this.min=r,this.max=o}getTickLimit(){const e=this.options.ticks;let t,{maxTicksLimit:n,stepSize:r}=e;return r?(t=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,t>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${t} ticks. Limiting to 1000.`),t=1e3)):(t=this.computeTickLimit(),n=n||11),n&&(t=Math.min(n,t)),t}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,t=e.ticks;let n=this.getTickLimit();n=Math.max(2,n);const r=function(e,t){const n=[],{bounds:r,step:o,min:i,max:a,precision:s,count:l,maxTicks:c,maxDigits:u,includeBounds:h}=e,f=o||1,d=c-1,{min:p,max:m}=t,g=!I(i),y=!I(a),v=!I(l),b=(m-p)/(u+1);let x,w,k,S,O=fe((m-p)/d/f)*f;if(O<1e-14&&!g&&!y)return[{value:p},{value:m}];S=Math.ceil(m/O)-Math.floor(p/O),S>d&&(O=fe(S*O/d/f)*f),I(s)||(x=Math.pow(10,s),O=Math.ceil(O*x)/x),"ticks"===r?(w=Math.floor(p/O)*O,k=Math.ceil(m/O)*O):(w=p,k=m),g&&y&&o&&function(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}((a-i)/o,O/1e3)?(S=Math.round(Math.min((a-i)/O,c)),O=(a-i)/S,w=i,k=a):v?(w=g?i:w,k=y?a:k,S=l-1,O=(k-w)/S):(S=(k-w)/O,S=he(S,Math.round(S),O/1e3)?Math.round(S):Math.ceil(S));const _=Math.max(me(O),me(w));x=Math.pow(10,I(s)?_:s),w=Math.round(w*x)/x,k=Math.round(k*x)/x;let E=0;for(g&&(h&&w!==i?(n.push({value:i}),w<i&&E++,he(Math.round((w+E*O)*x)/x,i,po(i,b,e))&&E++):w<i&&E++);E<S;++E){const e=Math.round((w+E*O)*x)/x;if(y&&e>a)break;n.push({value:e})}return y&&h&&k!==a?n.length&&he(n[n.length-1].value,a,po(a,b,e))?n[n.length-1].value=a:n.push({value:a}):y&&k!==a||n.push({value:k}),n}({maxTicks:n,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:!1!==t.includeBounds},this._range||this);return"ticks"===e.bounds&&function(e,t,n){let r,o,i;for(r=0,o=e.length;r<o;r++)i=e[r][n],isNaN(i)||(t.min=Math.min(t.min,i),t.max=Math.max(t.max,i))}(r,this,"value"),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const e=this.ticks;let t=this.min,n=this.max;if(super.configure(),this.options.offset&&e.length){const r=(n-t)/Math.max(e.length-1,1)/2;t-=r,n+=r}this._startValue=t,this._endValue=n,this._valueRange=n-t}getLabelForValue(e){return De(e,this.chart.options.locale,this.options.ticks.format)}}class go extends mo{static id="linear";static defaults={ticks:{callback:Be.formatters.numeric}};determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=D(e)?e:0,this.max=D(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),t=e?this.width:this.height,n=pe(this.options.ticks.minRotation),r=(e?Math.sin(n):Math.cos(n))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,o.lineHeight/r))}getPixelForValue(e){return null===e?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}Be.formatters.logarithmic,Be.formatters.numeric},6841:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>Ze,cx:()=>Ye});var r=n(1594);function o(){return o=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},o.apply(this,arguments)}const i=["children","options"],a={blockQuote:"0",breakLine:"1",breakThematic:"2",codeBlock:"3",codeFenced:"4",codeInline:"5",footnote:"6",footnoteReference:"7",gfmTask:"8",heading:"9",headingSetext:"10",htmlBlock:"11",htmlComment:"12",htmlSelfClosing:"13",image:"14",link:"15",linkAngleBraceStyleDetector:"16",linkBareUrlDetector:"17",linkMailtoDetector:"18",newlineCoalescer:"19",orderedList:"20",paragraph:"21",ref:"22",refImage:"23",refLink:"24",table:"25",tableSeparator:"26",text:"27",textBolded:"28",textEmphasized:"29",textEscaped:"30",textMarked:"31",textStrikethroughed:"32",unorderedList:"33"};var s,l;(l=s||(s={}))[l.MAX=0]="MAX",l[l.HIGH=1]="HIGH",l[l.MED=2]="MED",l[l.LOW=3]="LOW",l[l.MIN=4]="MIN";const c=["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"}),u={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},h=["style","script"],f=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,d=/mailto:/i,p=/\n{2,}$/,m=/^(\s*>[\s\S]*?)(?=\n{2,})/,g=/^ *> ?/gm,y=/^ {2,}\n/,v=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,b=/^\s*(`{3,}|~{3,}) *(\S+)?([^\n]*?)?\n([\s\S]+?)\s*\1 *(?:\n *)*\n?/,x=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,w=/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,k=/^(?:\n *)*\n/,S=/\r\n?/g,O=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,_=/^\[\^([^\]]+)]/,E=/\f/g,C=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,A=/^\s*?\[(x|\s)\]/,j=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,P=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,M=/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/,R=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,T=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,L=/^<!--[\s\S]*?(?:-->)/,I=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,N=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,z=/^\{.*\}$/,D=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,F=/^<([^ >]+@[^ >]+)>/,B=/^<([^ >]+:\/[^ >]+)>/,$=/-([a-z])?/gi,H=/^(.*\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,W=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,q=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,V=/^\[([^\]]*)\] ?\[([^\]]*)\]/,U=/(\[|\])/g,K=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,Q=/\t/g,G=/(^ *\||\| *$)/g,Y=/^ *:-+: *$/,Z=/^ *:-+ *$/,X=/^ *-+: *$/,J="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~~.*?~~|==.*?==|.|\\n)*?)",ee=new RegExp(`^([*_])\\1${J}\\1\\1(?!\\1)`),te=new RegExp(`^([*_])${J}\\1(?!\\1|\\w)`),ne=new RegExp(`^==${J}==`),re=new RegExp(`^~~${J}~~`),oe=/^\\([^0-9A-Za-z\s])/,ie=/^[\s\S]+?(?=[^0-9A-Z\s\u00c0-\uffff&#;.()'"]|\d+\.|\n\n| {2,}\n|\w+:\S|$)/i,ae=/^\n+/,se=/^([ \t]*)/,le=/\\([^\\])/g,ce=/ *\n+$/,ue=/(?:^|\n)( *)$/,he="(?:\\d+\\.)",fe="(?:[*+-])";function de(e){return"( *)("+(1===e?he:fe)+") +"}const pe=de(1),me=de(2);function ge(e){return new RegExp("^"+(1===e?pe:me))}const ye=ge(1),ve=ge(2);function be(e){return new RegExp("^"+(1===e?pe:me)+"[^\\n]*(?:\\n(?!\\1"+(1===e?he:fe)+" )[^\\n]*)*(\\n|$)","gm")}const xe=be(1),we=be(2);function ke(e){const t=1===e?he:fe;return new RegExp("^( *)("+t+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+t+" (?!"+t+" ))\\n*|\\s*\\n*$)")}const Se=ke(1),Oe=ke(2);function _e(e,t){const n=1===t,r=n?Se:Oe,o=n?xe:we,i=n?ye:ve;return{match(e,t,n){const o=ue.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,s=e[0].replace(p,"\n").match(o);let l=!1;return{items:s.map((function(e,n){const o=i.exec(e)[0].length,a=new RegExp("^ {1,"+o+"}","gm"),c=e.replace(a,"").replace(i,""),u=n===s.length-1,h=-1!==c.indexOf("\n\n")||u&&l;l=h;const f=r.inline,d=r.list;let p;r.list=!0,h?(r.inline=!1,p=c.replace(ce,"\n\n")):(r.inline=!0,p=c.replace(ce,""));const m=t(p,r);return r.inline=f,r.list=d,m})),ordered:n,start:a}},render:(t,n,r)=>e(t.ordered?"ol":"ul",{key:r.key,start:t.type===a.orderedList?t.start:void 0},t.items.map((function(t,o){return e("li",{key:o},n(t,r))})))}}const Ee=new RegExp("^\\[((?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),Ce=/^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/,Ae=[m,b,x,j,M,P,L,H,xe,Se,we,Oe],je=[...Ae,/^[^\n]+(?:  \n|\n{2,})/,R,N];function Pe(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 Me(e){return X.test(e)?"right":Y.test(e)?"center":Z.test(e)?"left":null}function Re(e,t,n,r){const o=n.inTable;n.inTable=!0;let i=e.trim().split(/( *(?:`[^`]*`|<.*?>.*?<\/.*?>(?!<\/.*?>)|\\\||\|) *)/).reduce(((e,o)=>("|"===o.trim()?e.push(r?{type:a.tableSeparator}:{type:a.text,text:o}):""!==o&&e.push.apply(e,t(o,n)),e)),[]);n.inTable=o;let s=[[]];return i.forEach((function(e,t){e.type===a.tableSeparator?0!==t&&t!==i.length-1&&s.push([]):(e.type!==a.text||null!=i[t+1]&&i[t+1].type!==a.tableSeparator||(e.text=e.text.trimEnd()),s[s.length-1].push(e))})),s}function Te(e,t,n){n.inline=!0;const r=e[2]?e[2].replace(G,"").split("|").map(Me):[],o=e[3]?function(e,t,n){return e.trim().split("\n").map((function(e){return Re(e,t,n,!0)}))}(e[3],t,n):[],i=Re(e[1],t,n,!!o.length);return n.inline=!1,o.length?{align:r,cells:o,header:i,type:a.table}:{children:i,type:a.paragraph}}function Le(e,t){return null==e.align[t]?{}:{textAlign:e.align[t]}}function Ie(e){return function(t,n){return n.inline?e.exec(t):null}}function Ne(e){return function(t,n){return n.inline||n.simple?e.exec(t):null}}function ze(e){return function(t,n){return n.inline||n.simple?null:e.exec(t)}}function De(e){return function(t){return e.exec(t)}}function Fe(e,t,n){if(t.inline||t.simple)return null;if(n&&!n.endsWith("\n"))return null;let r="";e.split("\n").every((e=>!Ae.some((t=>t.test(e)))&&(r+=e+"\n",e.trim())));const o=r.trimEnd();return""==o?null:[r,o]}function Be(e){try{if(decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"").match(/^\s*(javascript|vbscript|data(?!:image)):/i))return null}catch(e){return null}return e}function $e(e){return e.replace(le,"$1")}function He(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 We(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 qe(e,t,n){const r=n.inline||!1;n.inline=!1;const o=e(t,n);return n.inline=r,o}const Ve=(e,t,n)=>({children:He(t,e[1],n)});function Ue(){return{}}function Ke(){return null}function Qe(...e){return e.filter(Boolean).join(" ")}function Ge(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 Ye(e="",t={}){function n(e,n,...r){const i=Ge(t.overrides,`${e}.props`,{});return t.createElement(function(e,t){const n=Ge(t,e);return n?"function"==typeof n||"object"==typeof n&&"render"in n?n:Ge(t,`${e}.component`,e):e}(e,t.overrides),o({},n,i,{className:Qe(null==n?void 0:n.className,i.className)||void 0}),...r)}function i(e){e=e.replace(C,"");let o=!1;t.forceInline?o=!0:t.forceBlock||(o=!1===K.test(e));const i=Z(Y(o?e:`${e.trimEnd().replace(ae,"")}\n\n`,{inline:o}));for(;"string"==typeof i[i.length-1]&&!i[i.length-1].trim();)i.pop();if(null===t.wrapper)return i;const a=t.wrapper||(o?"span":"div");let s;if(i.length>1||t.forceWrapper)s=i;else{if(1===i.length)return s=i[0],"string"==typeof s?n("span",{key:"outer"},s):s;s=null}return r.createElement(a,{key:"outer"},s)}function s(e,n){const o=n.match(f);return o?o.reduce((function(n,o,a){const s=o.indexOf("=");if(-1!==s){const l=function(e){return-1!==e.indexOf("-")&&null===e.match(I)&&(e=e.replace($,(function(e,t){return t.toUpperCase()}))),e}(o.slice(0,s)).trim(),u=function(e){const t=e[0];return('"'===t||"'"===t)&&e.length>=2&&e[e.length-1]===t?e.slice(1,-1):e}(o.slice(s+1).trim()),h=c[l]||l,f=n[h]=function(e,t,n,r){return"style"===t?n.split(/;\s?/).reduce((function(e,t){const n=t.slice(0,t.indexOf(":"));return e[n.trim().replace(/(-[a-z])/g,(e=>e[1].toUpperCase()))]=t.slice(n.length+1).trim(),e}),{}):"href"===t||"src"===t?r(n,e,t):(n.match(z)&&(n=n.slice(1,n.length-1)),"true"===n||"false"!==n&&n)}(e,l,u,t.sanitizer);"string"==typeof f&&(R.test(f)||N.test(f))&&(n[h]=r.cloneElement(i(f.trim()),{key:a}))}else"style"!==o&&(n[c[o]||o]=!0);return n}),{}):null}t.overrides=t.overrides||{},t.sanitizer=t.sanitizer||Be,t.slugify=t.slugify||Pe,t.namedCodesToUnicode=t.namedCodesToUnicode?o({},u,t.namedCodesToUnicode):u,t.createElement=t.createElement||r.createElement;const l=[],p={},G={[a.blockQuote]:{match:ze(m),order:1,parse:(e,t,n)=>({children:t(e[0].replace(g,""),n)}),render:(e,t,r)=>n("blockquote",{key:r.key},t(e.children,r))},[a.breakLine]:{match:De(y),order:1,parse:Ue,render:(e,t,r)=>n("br",{key:r.key})},[a.breakThematic]:{match:ze(v),order:1,parse:Ue,render:(e,t,r)=>n("hr",{key:r.key})},[a.codeBlock]:{match:ze(x),order:0,parse:e=>({lang:void 0,text:e[0].replace(/^ {4}/gm,"").replace(/\n+$/,"")}),render:(e,t,r)=>n("pre",{key:r.key},n("code",o({},e.attrs,{className:e.lang?`lang-${e.lang}`:""}),e.text))},[a.codeFenced]:{match:ze(b),order:0,parse:e=>({attrs:s("code",e[3]||""),lang:e[2]||void 0,text:e[4],type:a.codeBlock})},[a.codeInline]:{match:Ne(w),order:3,parse:e=>({text:e[2]}),render:(e,t,r)=>n("code",{key:r.key},e.text)},[a.footnote]:{match:ze(O),order:0,parse:e=>(l.push({footnote:e[2],identifier:e[1]}),{}),render:Ke},[a.footnoteReference]:{match:Ie(_),order:1,parse:e=>({target:`#${t.slugify(e[1],Pe)}`,text:e[1]}),render:(e,r,o)=>n("a",{key:o.key,href:t.sanitizer(e.target,"a","href")},n("sup",{key:o.key},e.text))},[a.gfmTask]:{match:Ie(A),order:1,parse:e=>({completed:"x"===e[1].toLowerCase()}),render:(e,t,r)=>n("input",{checked:e.completed,key:r.key,readOnly:!0,type:"checkbox"})},[a.heading]:{match:ze(t.enforceAtxHeadings?P:j),order:1,parse:(e,n,r)=>({children:He(n,e[2],r),id:t.slugify(e[2],Pe),level:e[1].length}),render:(e,t,r)=>n(`h${e.level}`,{id:e.id,key:r.key},t(e.children,r))},[a.headingSetext]:{match:ze(M),order:0,parse:(e,t,n)=>({children:He(t,e[1],n),level:"="===e[2]?1:2,type:a.heading})},[a.htmlBlock]:{match:De(R),order:1,parse(e,t,n){const[,r]=e[3].match(se),o=new RegExp(`^${r}`,"gm"),i=e[3].replace(o,""),a=(l=i,je.some((e=>e.test(l)))?qe:He);var l;const c=e[1].toLowerCase(),u=-1!==h.indexOf(c),f=(u?c:e[1]).trim(),d={attrs:s(f,e[2]),noInnerParse:u,tag:f};return n.inAnchor=n.inAnchor||"a"===c,u?d.text=e[3]:d.children=a(t,i,n),n.inAnchor=!1,d},render:(e,t,r)=>n(e.tag,o({key:r.key},e.attrs),e.text||t(e.children,r))},[a.htmlSelfClosing]:{match:De(N),order:1,parse(e){const t=e[1].trim();return{attrs:s(t,e[2]||""),tag:t}},render:(e,t,r)=>n(e.tag,o({},e.attrs,{key:r.key}))},[a.htmlComment]:{match:De(L),order:1,parse:()=>({}),render:Ke},[a.image]:{match:Ne(Ce),order:1,parse:e=>({alt:e[1],target:$e(e[2]),title:e[3]}),render:(e,r,o)=>n("img",{key:o.key,alt:e.alt||void 0,title:e.title||void 0,src:t.sanitizer(e.target,"img","src")})},[a.link]:{match:Ie(Ee),order:3,parse:(e,t,n)=>({children:We(t,e[1],n),target:$e(e[2]),title:e[3]}),render:(e,r,o)=>n("a",{key:o.key,href:t.sanitizer(e.target,"a","href"),title:e.title},r(e.children,o))},[a.linkAngleBraceStyleDetector]:{match:Ie(B),order:0,parse:e=>({children:[{text:e[1],type:a.text}],target:e[1],type:a.link})},[a.linkBareUrlDetector]:{match:(e,t)=>t.inAnchor?null:Ie(D)(e,t),order:0,parse:e=>({children:[{text:e[1],type:a.text}],target:e[1],title:void 0,type:a.link})},[a.linkMailtoDetector]:{match:Ie(F),order:0,parse(e){let t=e[1],n=e[1];return d.test(n)||(n="mailto:"+n),{children:[{text:t.replace("mailto:",""),type:a.text}],target:n,type:a.link}}},[a.orderedList]:_e(n,1),[a.unorderedList]:_e(n,2),[a.newlineCoalescer]:{match:ze(k),order:3,parse:Ue,render:()=>"\n"},[a.paragraph]:{match:Fe,order:3,parse:Ve,render:(e,t,r)=>n("p",{key:r.key},t(e.children,r))},[a.ref]:{match:Ie(W),order:0,parse:e=>(p[e[1]]={target:e[2],title:e[4]},{}),render:Ke},[a.refImage]:{match:Ne(q),order:0,parse:e=>({alt:e[1]||void 0,ref:e[2]}),render:(e,r,o)=>p[e.ref]?n("img",{key:o.key,alt:e.alt,src:t.sanitizer(p[e.ref].target,"img","src"),title:p[e.ref].title}):null},[a.refLink]:{match:Ie(V),order:0,parse:(e,t,n)=>({children:t(e[1],n),fallbackChildren:t(e[0].replace(U,"\\$1"),n),ref:e[2]}),render:(e,r,o)=>p[e.ref]?n("a",{key:o.key,href:t.sanitizer(p[e.ref].target,"a","href"),title:p[e.ref].title},r(e.children,o)):n("span",{key:o.key},r(e.fallbackChildren,o))},[a.table]:{match:ze(H),order:1,parse:Te,render(e,t,r){const o=e;return n("table",{key:r.key},n("thead",null,n("tr",null,o.header.map((function(e,i){return n("th",{key:i,style:Le(o,i)},t(e,r))})))),n("tbody",null,o.cells.map((function(e,i){return n("tr",{key:i},e.map((function(e,i){return n("td",{key:i,style:Le(o,i)},t(e,r))})))}))))}},[a.text]:{match:De(ie),order:4,parse:e=>({text:e[0].replace(T,((e,n)=>t.namedCodesToUnicode[n]?t.namedCodesToUnicode[n]:e))}),render:e=>e.text},[a.textBolded]:{match:Ne(ee),order:2,parse:(e,t,n)=>({children:t(e[2],n)}),render:(e,t,r)=>n("strong",{key:r.key},t(e.children,r))},[a.textEmphasized]:{match:Ne(te),order:3,parse:(e,t,n)=>({children:t(e[2],n)}),render:(e,t,r)=>n("em",{key:r.key},t(e.children,r))},[a.textEscaped]:{match:Ne(oe),order:1,parse:e=>({text:e[1],type:a.text})},[a.textMarked]:{match:Ne(ne),order:3,parse:Ve,render:(e,t,r)=>n("mark",{key:r.key},t(e.children,r))},[a.textStrikethroughed]:{match:Ne(re),order:3,parse:Ve,render:(e,t,r)=>n("del",{key:r.key},t(e.children,r))}};!0===t.disableParsingRawHTML&&(delete G[a.htmlBlock],delete G[a.htmlSelfClosing]);const Y=function(e){let t=Object.keys(e);function n(r,o){let i=[],a="";for(;r;){let s=0;for(;s<t.length;){const l=t[s],c=e[l],u=c.match(r,o,a);if(u){const e=u[0];r=r.substring(e.length);const t=c.parse(u,n,o);null==t.type&&(t.type=l),i.push(t),a=e;break}s++}}return i}return t.sort((function(t,n){let r=e[t].order,o=e[n].order;return r!==o?r-o:t<n?-1:1})),function(e,t){return n(function(e){return e.replace(S,"\n").replace(E,"").replace(Q,"    ")}(e),t)}}(G),Z=(X=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)}}(G,t.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),s="string"==typeof a;s&&i?o[o.length-1]+=a:null!==a&&o.push(a),i=s}return n.key=r,o}return X(t,e,n)});var X;const J=i(e);return l.length?n("div",null,J,n("footer",{key:"footer"},l.map((function(e){return n("div",{id:t.slugify(e.identifier,Pe),key:e.identifier},e.identifier,Z(Y(e.footnote,{inline:!0})))})))):J}const Ze=e=>{let{children:t="",options:n}=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,i);return r.cloneElement(Ye(t,n),o)}},4731:(e,t,n)=>{"use strict";n.d(t,{yP:()=>d});var r=n(1594),o=n(2262);const i="label";function a(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function s(e,t){e.labels=t}function l(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i;const r=[];e.datasets=t.map((t=>{const o=e.datasets.find((e=>e[n]===t[n]));return o&&t.data&&!r.includes(o)?(r.push(o),Object.assign(o,t),o):{...t}}))}function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i;const n={labels:[],datasets:[]};return s(n,e.labels),l(n,e.datasets,t),n}function u(e,t){const{height:n=150,width:i=300,redraw:u=!1,datasetIdKey:h,type:f,data:d,options:p,plugins:m=[],fallbackContent:g,updateMode:y,...v}=e,b=(0,r.useRef)(null),x=(0,r.useRef)(),w=()=>{b.current&&(x.current=new o.t1(b.current,{type:f,data:c(d,h),options:p&&{...p},plugins:m}),a(t,x.current))},k=()=>{a(t,null),x.current&&(x.current.destroy(),x.current=null)};return(0,r.useEffect)((()=>{!u&&x.current&&p&&function(e,t){const n=e.options;n&&t&&Object.assign(n,t)}(x.current,p)}),[u,p]),(0,r.useEffect)((()=>{!u&&x.current&&s(x.current.config.data,d.labels)}),[u,d.labels]),(0,r.useEffect)((()=>{!u&&x.current&&d.datasets&&l(x.current.config.data,d.datasets,h)}),[u,d.datasets]),(0,r.useEffect)((()=>{x.current&&(u?(k(),setTimeout(w)):x.current.update(y))}),[u,p,d.labels,d.datasets,y]),(0,r.useEffect)((()=>{x.current&&(k(),setTimeout(w))}),[f]),(0,r.useEffect)((()=>(w(),()=>k())),[]),r.createElement("canvas",Object.assign({ref:b,role:"img",height:n,width:i},v),g)}const h=(0,r.forwardRef)(u);function f(e,t){return o.t1.register(t),(0,r.forwardRef)(((t,n)=>r.createElement(h,Object.assign({},t,{ref:n,type:e}))))}const d=f("bar",o.A6)},7612:(e,t,n)=>{"use strict";n.d(t,{jI:()=>M});var r=n(1594);function o(){return(o=Object.assign||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}).apply(this,arguments)}function i(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}function a(e){var t=(0,r.useRef)(e),n=(0,r.useRef)((function(e){t.current&&t.current(e)}));return t.current=e,n.current}var s=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e<t?t:e},l=function(e){return"touches"in e},c=function(e){return e&&e.ownerDocument.defaultView||self},u=function(e,t,n){var r=e.getBoundingClientRect(),o=l(t)?function(e,t){for(var n=0;n<e.length;n++)if(e[n].identifier===t)return e[n];return e[0]}(t.touches,n):t;return{left:s((o.pageX-(r.left+c(e).pageXOffset))/r.width),top:s((o.pageY-(r.top+c(e).pageYOffset))/r.height)}},h=function(e){!l(e)&&e.preventDefault()},f=r.memo((function(e){var t=e.onMove,n=e.onKey,s=i(e,["onMove","onKey"]),f=(0,r.useRef)(null),d=a(t),p=a(n),m=(0,r.useRef)(null),g=(0,r.useRef)(!1),y=(0,r.useMemo)((function(){var e=function(e){h(e),(l(e)?e.touches.length>0:e.buttons>0)&&f.current?d(u(f.current,e,m.current)):n(!1)},t=function(){return n(!1)};function n(n){var r=g.current,o=c(f.current),i=n?o.addEventListener:o.removeEventListener;i(r?"touchmove":"mousemove",e),i(r?"touchend":"mouseup",t)}return[function(e){var t=e.nativeEvent,r=f.current;if(r&&(h(t),!function(e,t){return t&&!l(e)}(t,g.current)&&r)){if(l(t)){g.current=!0;var o=t.changedTouches||[];o.length&&(m.current=o[0].identifier)}r.focus(),d(u(r,t,m.current)),n(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),p({left:39===t?.05:37===t?-.05:0,top:40===t?.05:38===t?-.05:0}))},n]}),[p,d]),v=y[0],b=y[1],x=y[2];return(0,r.useEffect)((function(){return x}),[x]),r.createElement("div",o({},s,{onTouchStart:v,onMouseDown:v,className:"react-colorful__interactive",ref:f,onKeyDown:b,tabIndex:0,role:"slider"}))})),d=function(e){return e.filter(Boolean).join(" ")},p=function(e){var t=e.color,n=e.left,o=e.top,i=void 0===o?.5:o,a=d(["react-colorful__pointer",e.className]);return r.createElement("div",{className:a,style:{top:100*i+"%",left:100*n+"%"}},r.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},m=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n},g=(Math.PI,function(e){return k(y(e))}),y=function(e){return"#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?m(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?m(parseInt(e.substring(6,8),16)/255,2):1}},v=function(e){var t=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:m(e.h),s:m(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:m(o/2),a:m(r,2)}}(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},b=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var i=Math.floor(t),a=r*(1-n),s=r*(1-(t-i)*n),l=r*(1-(1-t+i)*n),c=i%6;return{r:m(255*[r,s,a,a,l,r][c]),g:m(255*[l,r,r,s,a,a][c]),b:m(255*[a,a,l,r,r,s][c]),a:m(o,2)}},x=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},w=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,i=o<1?x(m(255*o)):"";return"#"+x(t)+x(n)+x(r)+i},k=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,i=Math.max(t,n,r),a=i-Math.min(t,n,r),s=a?i===t?(n-r)/a:i===n?2+(r-t)/a:4+(t-n)/a:0;return{h:m(60*(s<0?s+6:s)),s:m(i?a/i*100:0),v:m(i/255*100),a:o}},S=r.memo((function(e){var t=e.hue,n=e.onChange,o=d(["react-colorful__hue",e.className]);return r.createElement("div",{className:o},r.createElement(f,{onMove:function(e){n({h:360*e.left})},onKey:function(e){n({h:s(t+360*e.left,0,360)})},"aria-label":"Hue","aria-valuenow":m(t),"aria-valuemax":"360","aria-valuemin":"0"},r.createElement(p,{className:"react-colorful__hue-pointer",left:t/360,color:v({h:t,s:100,v:100,a:1})})))})),O=r.memo((function(e){var t=e.hsva,n=e.onChange,o={backgroundColor:v({h:t.h,s:100,v:100,a:1})};return r.createElement("div",{className:"react-colorful__saturation",style:o},r.createElement(f,{onMove:function(e){n({s:100*e.left,v:100-100*e.top})},onKey:function(e){n({s:s(t.s+100*e.left,0,100),v:s(t.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+m(t.s)+"%, Brightness "+m(t.v)+"%"},r.createElement(p,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:v(t)})))})),_=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function E(e,t,n){var o=a(n),i=(0,r.useState)((function(){return e.toHsva(t)})),s=i[0],l=i[1],c=(0,r.useRef)({color:t,hsva:s});(0,r.useEffect)((function(){if(!e.equal(t,c.current.color)){var n=e.toHsva(t);c.current={hsva:n,color:t},l(n)}}),[t,e]),(0,r.useEffect)((function(){var t;_(s,c.current.hsva)||e.equal(t=e.fromHsva(s),c.current.color)||(c.current={hsva:s,color:t},o(t))}),[s,e,o]);var u=(0,r.useCallback)((function(e){l((function(t){return Object.assign({},t,e)}))}),[]);return[s,u]}var C="undefined"!=typeof window?r.useLayoutEffect:r.useEffect,A=new Map,j=function(e){var t,a=e.className,s=e.colorModel,l=e.color,c=void 0===l?s.defaultColor:l,u=e.onChange,h=i(e,["className","colorModel","color","onChange"]),f=(0,r.useRef)(null);t=f,C((function(){var e=t.current?t.current.ownerDocument:document;if(void 0!==e&&!A.has(e)){var r=e.createElement("style");r.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',A.set(e,r);var o=n.nc;o&&r.setAttribute("nonce",o),e.head.appendChild(r)}}),[]);var p=E(s,c,u),m=p[0],g=p[1],y=d(["react-colorful",a]);return r.createElement("div",o({},h,{ref:f,className:y}),r.createElement(O,{hsva:m,onChange:g}),r.createElement(S,{hue:m.h,onChange:g,className:"react-colorful__last-control"}))},P={defaultColor:"000",toHsva:g,fromHsva:function(e){return function(e){return w(b(e))}({h:e.h,s:e.s,v:e.v,a:1})},equal:function(e,t){return e.toLowerCase()===t.toLowerCase()||_(y(e),y(t))}},M=function(e){return r.createElement(j,o({},e,{colorModel:P}))}},2902:(e,t,n)=>{"use strict";function r(){return r=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},r.apply(this,arguments)}n.d(t,{A:()=>s});var o={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){}},i=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=r({},o,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 i=Array.prototype.slice.apply(e.stringsElement.children),a=i.length;if(a)for(var s=0;s<a;s+=1)e.strings.push(i[s].innerHTML.trim())}for(var l 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[l]=l;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}()),a=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}()),s=function(){function e(e,t){i.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=a.typeHtmlChars(e,t,n);var r=0,i=e.substring(t);if("^"===i.charAt(0)&&/^\^\d+/.test(i)){var s=1;s+=(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+s),n.toggleBlinking(!0)}if("`"===i.charAt(0)){for(;"`"!==e.substring(t+o).charAt(0)&&(o++,!(t+o>e.length)););var l=e.substring(0,t),c=e.substring(l.length+1,t+o),u=e.substring(t+o+1);e=l+c+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=a.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}()}}]);
     2(self.wpJsonMwai=self.wpJsonMwai||[]).push([[121],{1919:(e,t,n)=>{"use strict";n.d(t,{A:()=>re});var r=function(){function e(e){var t=this;this._insertTag=function(e){var n;n=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,n),t.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(e){e.forEach(this._insertTag)},t.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(function(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}(this));var t=this.tags[this.tags.length-1];if(this.isSpeedy){var n=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(t);try{n.insertRule(e,n.cssRules.length)}catch(e){}}else t.appendChild(document.createTextNode(e));this.ctr++},t.flush=function(){this.tags.forEach((function(e){return e.parentNode&&e.parentNode.removeChild(e)})),this.tags=[],this.ctr=0},e}(),o=Math.abs,i=String.fromCharCode,a=Object.assign;function s(e){return e.trim()}function l(e,t,n){return e.replace(t,n)}function c(e,t){return e.indexOf(t)}function u(e,t){return 0|e.charCodeAt(t)}function h(e,t,n){return e.slice(t,n)}function f(e){return e.length}function d(e){return e.length}function p(e,t){return t.push(e),e}var m=1,g=1,y=0,v=0,b=0,x="";function w(e,t,n,r,o,i,a){return{value:e,root:t,parent:n,type:r,props:o,children:i,line:m,column:g,length:a,return:""}}function k(e,t){return a(w("",null,null,"",null,null,0),e,{length:-e.length},t)}function S(){return b=v>0?u(x,--v):0,g--,10===b&&(g=1,m--),b}function O(){return b=v<y?u(x,v++):0,g++,10===b&&(g=1,m++),b}function _(){return u(x,v)}function E(){return v}function C(e,t){return h(x,e,t)}function A(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function j(e){return m=g=1,y=f(x=e),v=0,[]}function P(e){return x="",e}function M(e){return s(C(v-1,L(91===e?e+2:40===e?e+1:e)))}function R(e){for(;(b=_())&&b<33;)O();return A(e)>2||A(b)>3?"":" "}function T(e,t){for(;--t&&O()&&!(b<48||b>102||b>57&&b<65||b>70&&b<97););return C(e,E()+(t<6&&32==_()&&32==O()))}function L(e){for(;O();)switch(b){case e:return v;case 34:case 39:34!==e&&39!==e&&L(b);break;case 40:41===e&&L(e);break;case 92:O()}return v}function I(e,t){for(;O()&&e+b!==57&&(e+b!==84||47!==_()););return"/*"+C(t,v-1)+"*"+i(47===e?e:O())}function N(e){for(;!A(_());)O();return C(e,v)}var z="-ms-",D="-moz-",F="-webkit-",B="comm",$="rule",H="decl",W="@keyframes";function q(e,t){for(var n="",r=d(e),o=0;o<r;o++)n+=t(e[o],o,e,t)||"";return n}function V(e,t,n,r){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case H:return e.return=e.return||e.value;case B:return"";case W:return e.return=e.value+"{"+q(e.children,r)+"}";case $:e.value=e.props.join(",")}return f(n=q(e.children,r))?e.return=e.value+"{"+n+"}":""}function U(e){return P(K("",null,null,null,[""],e=j(e),0,[0],e))}function K(e,t,n,r,o,a,s,h,d){for(var m=0,g=0,y=s,v=0,b=0,x=0,w=1,k=1,C=1,A=0,j="",P=o,L=a,z=r,D=j;k;)switch(x=A,A=O()){case 40:if(108!=x&&58==u(D,y-1)){-1!=c(D+=l(M(A),"&","&\f"),"&\f")&&(C=-1);break}case 34:case 39:case 91:D+=M(A);break;case 9:case 10:case 13:case 32:D+=R(x);break;case 92:D+=T(E()-1,7);continue;case 47:switch(_()){case 42:case 47:p(G(I(O(),E()),t,n),d);break;default:D+="/"}break;case 123*w:h[m++]=f(D)*C;case 125*w:case 59:case 0:switch(A){case 0:case 125:k=0;case 59+g:-1==C&&(D=l(D,/\f/g,"")),b>0&&f(D)-y&&p(b>32?Y(D+";",r,n,y-1):Y(l(D," ","")+";",r,n,y-2),d);break;case 59:D+=";";default:if(p(z=Q(D,t,n,m,g,o,h,j,P=[],L=[],y),a),123===A)if(0===g)K(D,t,z,z,P,a,y,h,L);else switch(99===v&&110===u(D,3)?100:v){case 100:case 108:case 109:case 115:K(e,z,z,r&&p(Q(e,z,z,0,0,o,h,j,o,P=[],y),L),o,L,y,h,r?P:L);break;default:K(D,z,z,z,[""],L,0,h,L)}}m=g=b=0,w=C=1,j=D="",y=s;break;case 58:y=1+f(D),b=x;default:if(w<1)if(123==A)--w;else if(125==A&&0==w++&&125==S())continue;switch(D+=i(A),A*w){case 38:C=g>0?1:(D+="\f",-1);break;case 44:h[m++]=(f(D)-1)*C,C=1;break;case 64:45===_()&&(D+=M(O())),v=_(),g=y=f(j=D+=N(E())),A++;break;case 45:45===x&&2==f(D)&&(w=0)}}return a}function Q(e,t,n,r,i,a,c,u,f,p,m){for(var g=i-1,y=0===i?a:[""],v=d(y),b=0,x=0,k=0;b<r;++b)for(var S=0,O=h(e,g+1,g=o(x=c[b])),_=e;S<v;++S)(_=s(x>0?y[S]+" "+O:l(O,/&\f/g,y[S])))&&(f[k++]=_);return w(e,t,n,0===i?$:u,f,p,m)}function G(e,t,n){return w(e,t,n,B,i(b),h(e,2,-2),0)}function Y(e,t,n,r){return w(e,t,n,H,h(e,0,r),h(e,r+1,-1),r)}var Z=function(e,t,n){for(var r=0,o=0;r=o,o=_(),38===r&&12===o&&(t[n]=1),!A(o);)O();return C(e,v)},X=new WeakMap,J=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||X.get(n))&&!r){X.set(e,!0);for(var o=[],a=function(e,t){return P(function(e,t){var n=-1,r=44;do{switch(A(r)){case 0:38===r&&12===_()&&(t[n]=1),e[n]+=Z(v-1,t,n);break;case 2:e[n]+=M(r);break;case 4:if(44===r){e[++n]=58===_()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=i(r)}}while(r=O());return e}(j(e),t))}(t,o),s=n.props,l=0,c=0;l<a.length;l++)for(var u=0;u<s.length;u++,c++)e.props[c]=o[l]?a[l].replace(/&\f/g,s[u]):s[u]+" "+a[l]}}},ee=function(e){if("decl"===e.type){var t=e.value;108===t.charCodeAt(0)&&98===t.charCodeAt(2)&&(e.return="",e.value="")}};function te(e,t){switch(function(e,t){return 45^u(e,0)?(((t<<2^u(e,0))<<2^u(e,1))<<2^u(e,2))<<2^u(e,3):0}(e,t)){case 5103:return F+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return F+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return F+e+D+e+z+e+e;case 6828:case 4268:return F+e+z+e+e;case 6165:return F+e+z+"flex-"+e+e;case 5187:return F+e+l(e,/(\w+).+(:[^]+)/,F+"box-$1$2"+z+"flex-$1$2")+e;case 5443:return F+e+z+"flex-item-"+l(e,/flex-|-self/,"")+e;case 4675:return F+e+z+"flex-line-pack"+l(e,/align-content|flex-|-self/,"")+e;case 5548:return F+e+z+l(e,"shrink","negative")+e;case 5292:return F+e+z+l(e,"basis","preferred-size")+e;case 6060:return F+"box-"+l(e,"-grow","")+F+e+z+l(e,"grow","positive")+e;case 4554:return F+l(e,/([^-])(transform)/g,"$1"+F+"$2")+e;case 6187:return l(l(l(e,/(zoom-|grab)/,F+"$1"),/(image-set)/,F+"$1"),e,"")+e;case 5495:case 3959:return l(e,/(image-set\([^]*)/,F+"$1$`$1");case 4968:return l(l(e,/(.+:)(flex-)?(.*)/,F+"box-pack:$3"+z+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+F+e+e;case 4095:case 3583:case 4068:case 2532:return l(e,/(.+)-inline(.+)/,F+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(f(e)-1-t>6)switch(u(e,t+1)){case 109:if(45!==u(e,t+4))break;case 102:return l(e,/(.+:)(.+)-([^]+)/,"$1"+F+"$2-$3$1"+D+(108==u(e,t+3)?"$3":"$2-$3"))+e;case 115:return~c(e,"stretch")?te(l(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==u(e,t+1))break;case 6444:switch(u(e,f(e)-3-(~c(e,"!important")&&10))){case 107:return l(e,":",":"+F)+e;case 101:return l(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+F+(45===u(e,14)?"inline-":"")+"box$3$1"+F+"$2$3$1"+z+"$2box$3")+e}break;case 5936:switch(u(e,t+11)){case 114:return F+e+z+l(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return F+e+z+l(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return F+e+z+l(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return F+e+z+e+e}return e}var ne=[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case H:e.return=te(e.value,e.length);break;case W:return q([k(e,{value:l(e.value,"@","@"+F)})],r);case $:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return q([k(e,{props:[l(t,/:(read-\w+)/,":-moz-$1")]})],r);case"::placeholder":return q([k(e,{props:[l(t,/:(plac\w+)/,":"+F+"input-$1")]}),k(e,{props:[l(t,/:(plac\w+)/,":-moz-$1")]}),k(e,{props:[l(t,/:(plac\w+)/,z+"input-$1")]})],r)}return""}))}}],re=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var o,i,a=e.stylisPlugins||ne,s={},l=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n<t.length;n++)s[t[n]]=!0;l.push(e)}));var c,u,h,f,p=[V,(f=function(e){c.insert(e)},function(e){e.root||(e=e.return)&&f(e)})],m=(u=[J,ee].concat(a,p),h=d(u),function(e,t,n,r){for(var o="",i=0;i<h;i++)o+=u[i](e,t,n,r)||"";return o});i=function(e,t,n,r){c=n,q(U(e?e+"{"+t.styles+"}":t.styles),m),r&&(g.inserted[t.name]=!0)};var g={key:t,sheet:new r({key:t,container:o,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:s,registered:{},insert:i};return g.sheet.hydrate(l),g}},6289:(e,t,n)=>{"use strict";function r(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}n.d(t,{A:()=>r})},85:(e,t,n)=>{"use strict";n.d(t,{C:()=>h,E:()=>y,T:()=>d,c:()=>m,h:()=>c,i:()=>l,w:()=>f});var r=n(1594),o=n(1919),i=n(41),a=n(2142),s=n(1287),l=!0,c={}.hasOwnProperty,u=r.createContext("undefined"!=typeof HTMLElement?(0,o.A)({key:"css"}):null),h=u.Provider,f=function(e){return(0,r.forwardRef)((function(t,n){var o=(0,r.useContext)(u);return e(t,o,n)}))};l||(f=function(e){return function(t){var n=(0,r.useContext)(u);return null===n?(n=(0,o.A)({key:"css"}),r.createElement(u.Provider,{value:n},e(t,n))):e(t,n)}});var d=r.createContext({}),p="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",m=function(e,t){var n={};for(var r in t)c.call(t,r)&&(n[r]=t[r]);return n[p]=e,n},g=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return(0,i.SF)(t,n,r),(0,s.s)((function(){return(0,i.sk)(t,n,r)})),null},y=f((function(e,t,n){var o=e.css;"string"==typeof o&&void 0!==t.registered[o]&&(o=t.registered[o]);var s=e[p],l=[o],u="";"string"==typeof e.className?u=(0,i.Rk)(t.registered,l,e.className):null!=e.className&&(u=e.className+" ");var h=(0,a.J)(l,void 0,r.useContext(d));u+=t.key+"-"+h.name;var f={};for(var m in e)c.call(e,m)&&"css"!==m&&m!==p&&(f[m]=e[m]);return f.ref=n,f.className=u,r.createElement(r.Fragment,null,r.createElement(g,{cache:t,serialized:h,isStringTag:"string"==typeof s}),r.createElement(s,f))}))},7437:(e,t,n)=>{"use strict";n.d(t,{AH:()=>c,i7:()=>u,mL:()=>l});var r=n(85),o=n(1594),i=n(41),a=n(1287),s=n(2142),l=(n(1919),n(4146),(0,r.w)((function(e,t){var n=e.styles,l=(0,s.J)([n],void 0,o.useContext(r.T));if(!r.i){for(var c,u=l.name,h=l.styles,f=l.next;void 0!==f;)u+=" "+f.name,h+=f.styles,f=f.next;var d=!0===t.compat,p=t.insert("",{name:u,styles:h},t.sheet,d);return d?null:o.createElement("style",((c={})["data-emotion"]=t.key+"-global "+u,c.dangerouslySetInnerHTML={__html:p},c.nonce=t.sheet.nonce,c))}var m=o.useRef();return(0,a.i)((function(){var e=t.key+"-global",n=new t.sheet.constructor({key:e,nonce:t.sheet.nonce,container:t.sheet.container,speedy:t.sheet.isSpeedy}),r=!1,o=document.querySelector('style[data-emotion="'+e+" "+l.name+'"]');return t.sheet.tags.length&&(n.before=t.sheet.tags[0]),null!==o&&(r=!0,o.setAttribute("data-emotion",e),n.hydrate([o])),m.current=[n,r],function(){n.flush()}}),[t]),(0,a.i)((function(){var e=m.current,n=e[0];if(e[1])e[1]=!1;else{if(void 0!==l.next&&(0,i.sk)(t,l.next,!0),n.tags.length){var r=n.tags[n.tags.length-1].nextElementSibling;n.before=r,n.flush()}t.insert("",l,n,!1)}}),[t,l.name]),null})));function c(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,s.J)(t)}var u=function(){var e=c.apply(void 0,arguments),t="animation-"+e.name;return{name:t,styles:"@keyframes "+t+"{"+e.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}},2142:(e,t,n)=>{"use strict";n.d(t,{J:()=>p});var r=n(3969),o=n(6289),i=/[A-Z]|^ms/g,a=/_EMO_([^_]+?)_([^]*?)_EMO_/g,s=function(e){return 45===e.charCodeAt(1)},l=function(e){return null!=e&&"boolean"!=typeof e},c=(0,o.A)((function(e){return s(e)?e:e.replace(i,"-$&").toLowerCase()})),u=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(a,(function(e,t,n){return f={name:t,styles:n,next:f},t}))}return 1===r.A[e]||s(e)||"number"!=typeof t||0===t?t:t+"px"};function h(e,t,n){if(null==n)return"";if(void 0!==n.__emotion_styles)return n;switch(typeof n){case"boolean":return"";case"object":if(1===n.anim)return f={name:n.name,styles:n.styles,next:f},n.name;if(void 0!==n.styles){var r=n.next;if(void 0!==r)for(;void 0!==r;)f={name:r.name,styles:r.styles,next:f},r=r.next;return n.styles+";"}return function(e,t,n){var r="";if(Array.isArray(n))for(var o=0;o<n.length;o++)r+=h(e,t,n[o])+";";else for(var i in n){var a=n[i];if("object"!=typeof a)null!=t&&void 0!==t[a]?r+=i+"{"+t[a]+"}":l(a)&&(r+=c(i)+":"+u(i,a)+";");else if(!Array.isArray(a)||"string"!=typeof a[0]||null!=t&&void 0!==t[a[0]]){var s=h(e,t,a);switch(i){case"animation":case"animationName":r+=c(i)+":"+s+";";break;default:r+=i+"{"+s+"}"}}else for(var f=0;f<a.length;f++)l(a[f])&&(r+=c(i)+":"+u(i,a[f])+";")}return r}(e,t,n);case"function":if(void 0!==e){var o=f,i=n(e);return f=o,h(e,t,i)}}if(null==t)return n;var a=t[n];return void 0!==a?a:n}var f,d=/label:\s*([^\s;\n{]+)\s*(;|$)/g,p=function(e,t,n){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var r=!0,o="";f=void 0;var i=e[0];null==i||void 0===i.raw?(r=!1,o+=h(n,t,i)):o+=i[0];for(var a=1;a<e.length;a++)o+=h(n,t,e[a]),r&&(o+=i[a]);d.lastIndex=0;for(var s,l="";null!==(s=d.exec(o));)l+="-"+s[1];var c=function(e){for(var t,n=0,r=0,o=e.length;o>=4;++r,o-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(o){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(o)+l;return{name:c,styles:o,next:f}}},3969:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var r={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1}},1287:(e,t,n)=>{"use strict";n.d(t,{i:()=>a,s:()=>i});var r=n(1594),o=!!r.useInsertionEffect&&r.useInsertionEffect,i=o||function(e){return e()},a=o||r.useLayoutEffect},41:(e,t,n)=>{"use strict";function r(e,t,n){var r="";return n.split(" ").forEach((function(n){void 0!==e[n]?t.push(e[n]+";"):r+=n+" "})),r}n.d(t,{Rk:()=>r,SF:()=>o,sk:()=>i});var o=function(e,t,n){var r=e.key+"-"+t.name;!1===n&&void 0===e.registered[r]&&(e.registered[r]=t.styles)},i=function(e,t,n){o(e,t,n);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var i=t;do{e.insert(t===i?"."+r:"",i,e.sheet,!0),i=i.next}while(void 0!==i)}}},9940:(e,t,n)=>{"use strict";n.d(t,{A:()=>i}),n(1594);var r=n(7437),o=n(4848);function i(e){const{styles:t,defaultTheme:n={}}=e,i="function"==typeof t?e=>{return t(null==(r=e)||0===Object.keys(r).length?n:e);var r}:t;return(0,o.jsx)(r.mL,{styles:i})}},2532:(e,t,n)=>{"use strict";n.r(t),n.d(t,{GlobalStyles:()=>S.A,StyledEngineProvider:()=>k,ThemeContext:()=>l.T,css:()=>v.AH,default:()=>O,internal_processStyles:()=>_,keyframes:()=>v.i7});var r=n(8168),o=n(1594),i=n(6289),a=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,s=(0,i.A)((function(e){return a.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91})),l=n(85),c=n(41),u=n(2142),h=n(1287),f=s,d=function(e){return"theme"!==e},p=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?f:d},m=function(e,t,n){var r;if(t){var o=t.shouldForwardProp;r=e.__emotion_forwardProp&&o?function(t){return e.__emotion_forwardProp(t)&&o(t)}:o}return"function"!=typeof r&&n&&(r=e.__emotion_forwardProp),r},g=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;return(0,c.SF)(t,n,r),(0,h.s)((function(){return(0,c.sk)(t,n,r)})),null},y=function e(t,n){var i,a,s=t.__emotion_real===t,h=s&&t.__emotion_base||t;void 0!==n&&(i=n.label,a=n.target);var f=m(t,n,s),d=f||p(h),y=!d("as");return function(){var v=arguments,b=s&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==i&&b.push("label:"+i+";"),null==v[0]||void 0===v[0].raw)b.push.apply(b,v);else{b.push(v[0][0]);for(var x=v.length,w=1;w<x;w++)b.push(v[w],v[0][w])}var k=(0,l.w)((function(e,t,n){var r=y&&e.as||h,i="",s=[],m=e;if(null==e.theme){for(var v in m={},e)m[v]=e[v];m.theme=o.useContext(l.T)}"string"==typeof e.className?i=(0,c.Rk)(t.registered,s,e.className):null!=e.className&&(i=e.className+" ");var x=(0,u.J)(b.concat(s),t.registered,m);i+=t.key+"-"+x.name,void 0!==a&&(i+=" "+a);var w=y&&void 0===f?p(r):d,k={};for(var S in e)y&&"as"===S||w(S)&&(k[S]=e[S]);return k.className=i,k.ref=n,o.createElement(o.Fragment,null,o.createElement(g,{cache:t,serialized:x,isStringTag:"string"==typeof r}),o.createElement(r,k))}));return k.displayName=void 0!==i?i:"Styled("+("string"==typeof h?h:h.displayName||h.name||"Component")+")",k.defaultProps=t.defaultProps,k.__emotion_real=k,k.__emotion_base=h,k.__emotion_styles=b,k.__emotion_forwardProp=f,Object.defineProperty(k,"toString",{value:function(){return"."+a}}),k.withComponent=function(t,o){return e(t,(0,r.A)({},n,o,{shouldForwardProp:m(k,o,!0)})).apply(void 0,b)},k}}.bind();["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(e){y[e]=y(e)}));var v=n(7437),b=n(1919),x=n(4848);let w;function k(e){const{injectFirst:t,children:n}=e;return t&&w?(0,x.jsx)(l.C,{value:w,children:n}):n}"object"==typeof document&&(w=(0,b.A)({key:"css",prepend:!0}));var S=n(9940);function O(e,t){return y(e,t)}const _=(e,t)=>{Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}},771:(e,t,n)=>{"use strict";var r=n(4994);t.X4=function(e,t){return e=s(e),t=a(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,l(e)},t.e$=function(e,t){if(e=s(e),t=a(t),-1!==e.type.indexOf("hsl"))e.values[2]*=1-t;else if(-1!==e.type.indexOf("rgb")||-1!==e.type.indexOf("color"))for(let n=0;n<3;n+=1)e.values[n]*=1-t;return l(e)},t.eM=function(e,t){const n=c(e),r=c(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)},t.a=function(e,t){if(e=s(e),t=a(t),-1!==e.type.indexOf("hsl"))e.values[2]+=(100-e.values[2])*t;else if(-1!==e.type.indexOf("rgb"))for(let n=0;n<3;n+=1)e.values[n]+=(255-e.values[n])*t;else if(-1!==e.type.indexOf("color"))for(let n=0;n<3;n+=1)e.values[n]+=(1-e.values[n])*t;return l(e)};var o=r(n(2108)),i=r(n(6379));function a(e,t=0,n=1){return(0,i.default)(e,t,n)}function s(e){if(e.type)return e;if("#"===e.charAt(0))return s(function(e){e=e.slice(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&1===n[0].length&&(n=n.map((e=>e+e))),n?`rgb${4===n.length?"a":""}(${n.map(((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}(e));const t=e.indexOf("("),n=e.substring(0,t);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(n))throw new Error((0,o.default)(9,e));let r,i=e.substring(t+1,e.length-1);if("color"===n){if(i=i.split(" "),r=i.shift(),4===i.length&&"/"===i[3].charAt(0)&&(i[3]=i[3].slice(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(r))throw new Error((0,o.default)(10,r))}else i=i.split(",");return i=i.map((e=>parseFloat(e))),{type:n,values:i,colorSpace:r}}function l(e){const{type:t,colorSpace:n}=e;let{values:r}=e;return-1!==t.indexOf("rgb")?r=r.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(r[1]=`${r[1]}%`,r[2]=`${r[2]}%`),r=-1!==t.indexOf("color")?`${n} ${r.join(" ")}`:`${r.join(", ")}`,`${t}(${r})`}function c(e){let t="hsl"===(e=s(e)).type||"hsla"===e.type?s(function(e){e=s(e);const{values:t}=e,n=t[0],r=t[1]/100,o=t[2]/100,i=r*Math.min(o,1-o),a=(e,t=(e+n/30)%12)=>o-i*Math.max(Math.min(t-3,9-t,1),-1);let c="rgb";const u=[Math.round(255*a(0)),Math.round(255*a(8)),Math.round(255*a(4))];return"hsla"===e.type&&(c+="a",u.push(t[3])),l({type:c,values:u})}(e)).values:e.values;return t=t.map((t=>("color"!==e.type&&(t/=255),t<=.03928?t/12.92:((t+.055)/1.055)**2.4))),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}},6461:(e,t,n)=>{"use strict";var r=n(4994);t.Ay=function(e={}){const{themeId:t,defaultTheme:n=m,rootShouldForwardProp:r=p,slotShouldForwardProp:l=p}=e,u=e=>(0,c.default)((0,o.default)({},e,{theme:y((0,o.default)({},e,{defaultTheme:n,themeId:t}))}));return u.__mui_systemSx=!0,(e,c={})=>{(0,a.internal_processStyles)(e,(e=>e.filter((e=>!(null!=e&&e.__mui_systemSx)))));const{name:h,slot:d,skipVariantsResolver:m,skipSx:x,overridesResolver:w=v(g(d))}=c,k=(0,i.default)(c,f),S=void 0!==m?m:d&&"Root"!==d&&"root"!==d||!1,O=x||!1;let _=p;"Root"===d||"root"===d?_=r:d?_=l:function(e){return"string"==typeof e&&e.charCodeAt(0)>96}(e)&&(_=void 0);const E=(0,a.default)(e,(0,o.default)({shouldForwardProp:_,label:void 0},k)),C=e=>"function"==typeof e&&e.__emotion_real!==e||(0,s.isPlainObject)(e)?r=>b(e,(0,o.default)({},r,{theme:y({theme:r.theme,defaultTheme:n,themeId:t})})):e,A=(r,...i)=>{let a=C(r);const s=i?i.map(C):[];h&&w&&s.push((e=>{const r=y((0,o.default)({},e,{defaultTheme:n,themeId:t}));if(!r.components||!r.components[h]||!r.components[h].styleOverrides)return null;const i=r.components[h].styleOverrides,a={};return Object.entries(i).forEach((([t,n])=>{a[t]=b(n,(0,o.default)({},e,{theme:r}))})),w(e,a)})),h&&!S&&s.push((e=>{var r;const i=y((0,o.default)({},e,{defaultTheme:n,themeId:t}));return b({variants:null==i||null==(r=i.components)||null==(r=r[h])?void 0:r.variants},(0,o.default)({},e,{theme:i}))})),O||s.push(u);const l=s.length-i.length;if(Array.isArray(r)&&l>0){const e=new Array(l).fill("");a=[...r,...e],a.raw=[...r.raw,...e]}const c=E(a,...s);return e.muiName&&(c.muiName=e.muiName),c};return E.withConfig&&(A.withConfig=E.withConfig),A}},t.MC=p;var o=r(n(4634)),i=r(n(4893)),a=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}(n(2532)),s=n(819),l=(r(n(8217)),r(n(1172)),r(n(3142))),c=r(n(3857));const u=["ownerState"],h=["variants"],f=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}function p(e){return"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e}const m=(0,l.default)(),g=e=>e?e.charAt(0).toLowerCase()+e.slice(1):e;function y({defaultTheme:e,theme:t,themeId:n}){return r=t,0===Object.keys(r).length?e:t[n]||t;var r}function v(e){return e?(t,n)=>n[e]:null}function b(e,t){let{ownerState:n}=t,r=(0,i.default)(t,u);const a="function"==typeof e?e((0,o.default)({ownerState:n},r)):e;if(Array.isArray(a))return a.flatMap((e=>b(e,(0,o.default)({ownerState:n},r))));if(a&&"object"==typeof a&&Array.isArray(a.variants)){const{variants:e=[]}=a;let t=(0,i.default)(a,h);return e.forEach((e=>{let i=!0;"function"==typeof e.props?i=e.props((0,o.default)({ownerState:n},r,n)):Object.keys(e.props).forEach((t=>{(null==n?void 0:n[t])!==e.props[t]&&r[t]!==e.props[t]&&(i=!1)})),i&&(Array.isArray(t)||(t=[t]),t.push("function"==typeof e.style?e.style((0,o.default)({ownerState:n},r,n)):e.style))})),t}return a}},9452:(e,t,n)=>{"use strict";n.d(t,{EU:()=>a,NI:()=>i,vf:()=>s,zu:()=>r});const r={xs:0,sm:600,md:900,lg:1200,xl:1536},o={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${r[e]}px)`};function i(e,t,n){const i=e.theme||{};if(Array.isArray(t)){const e=i.breakpoints||o;return t.reduce(((r,o,i)=>(r[e.up(e.keys[i])]=n(t[i]),r)),{})}if("object"==typeof t){const e=i.breakpoints||o;return Object.keys(t).reduce(((o,i)=>{if(-1!==Object.keys(e.values||r).indexOf(i))o[e.up(i)]=n(t[i],i);else{const e=i;o[e]=t[e]}return o}),{})}return n(t)}function a(e={}){var t;return(null==(t=e.keys)?void 0:t.reduce(((t,n)=>(t[e.up(n)]={},t)),{}))||{}}function s(e,t){return e.reduce(((e,t)=>{const n=e[t];return(!n||0===Object.keys(n).length)&&delete e[t],e}),t)}},8336:(e,t,n)=>{"use strict";function r(e,t){const n=this;return n.vars&&"function"==typeof n.getColorSchemeSelector?{[n.getColorSchemeSelector(e).replace(/(\[[^\]]+\])/,"*:where($1)")]:t}:n.palette.mode===e?t:{}}n.d(t,{A:()=>r})},8094:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var r=n(8587),o=n(8168);const i=["values","unit","step"],a=e=>{const t=Object.keys(e).map((t=>({key:t,val:e[t]})))||[];return t.sort(((e,t)=>e.val-t.val)),t.reduce(((e,t)=>(0,o.A)({},e,{[t.key]:t.val})),{})};function s(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:n="px",step:s=5}=e,l=(0,r.A)(e,i),c=a(t),u=Object.keys(c);function h(e){return`@media (min-width:${"number"==typeof t[e]?t[e]:e}${n})`}function f(e){return`@media (max-width:${("number"==typeof t[e]?t[e]:e)-s/100}${n})`}function d(e,r){const o=u.indexOf(r);return`@media (min-width:${"number"==typeof t[e]?t[e]:e}${n}) and (max-width:${(-1!==o&&"number"==typeof t[u[o]]?t[u[o]]:r)-s/100}${n})`}return(0,o.A)({keys:u,values:c,up:h,down:f,between:d,only:function(e){return u.indexOf(e)+1<u.length?d(e,u[u.indexOf(e)+1]):h(e)},not:function(e){const t=u.indexOf(e);return 0===t?h(u[1]):t===u.length-1?f(u[t]):d(e,u[u.indexOf(e)+1]).replace("@media","@media not all and")},unit:n},l)}},8749:(e,t,n)=>{"use strict";n.d(t,{A:()=>d});var r=n(8168),o=n(8587),i=n(4521),a=n(8094);const s={borderRadius:4};var l=n(8248),c=n(3571),u=n(4188),h=n(8336);const f=["breakpoints","palette","spacing","shape"],d=function(e={},...t){const{breakpoints:n={},palette:d={},spacing:p,shape:m={}}=e,g=(0,o.A)(e,f),y=(0,a.A)(n),v=function(e=8){if(e.mui)return e;const t=(0,l.LX)({spacing:e}),n=(...e)=>(0===e.length?[1]:e).map((e=>{const n=t(e);return"number"==typeof n?`${n}px`:n})).join(" ");return n.mui=!0,n}(p);let b=(0,i.A)({breakpoints:y,direction:"ltr",components:{},palette:(0,r.A)({mode:"light"},d),spacing:v,shape:(0,r.A)({},s,m)},g);return b.applyStyles=h.A,b=t.reduce(((e,t)=>(0,i.A)(e,t)),b),b.unstable_sxConfig=(0,r.A)({},u.A,null==g?void 0:g.unstable_sxConfig),b.unstable_sx=function(e){return(0,c.A)({sx:e,theme:this})},b}},3142:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r.A,private_createBreakpoints:()=>o.A,unstable_applyStyles:()=>i.A});var r=n(8749),o=n(8094),i=n(8336)},4620:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(4521);const o=function(e,t){return t?(0,r.A)(e,t,{clone:!1}):e}},8248:(e,t,n)=>{"use strict";n.d(t,{LX:()=>p,MA:()=>d,_W:()=>m,Lc:()=>y,Ms:()=>v});var r=n(9452),o=n(6481),i=n(4620);const a={m:"margin",p:"padding"},s={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},l={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},c=function(e){const t={};return e=>(void 0===t[e]&&(t[e]=(e=>{if(e.length>2){if(!l[e])return[e];e=l[e]}const[t,n]=e.split(""),r=a[t],o=s[n]||"";return Array.isArray(o)?o.map((e=>r+e)):[r+o]})(e)),t[e])}(),u=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],h=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],f=[...u,...h];function d(e,t,n,r){var i;const a=null!=(i=(0,o.Yn)(e,t,!1))?i:n;return"number"==typeof a?e=>"string"==typeof e?e:a*e:Array.isArray(a)?e=>"string"==typeof e?e:a[e]:"function"==typeof a?a:()=>{}}function p(e){return d(e,"spacing",8)}function m(e,t){if("string"==typeof t||null==t)return t;const n=e(Math.abs(t));return t>=0?n:"number"==typeof n?-n:`-${n}`}function g(e,t){const n=p(e.theme);return Object.keys(e).map((o=>function(e,t,n,o){if(-1===t.indexOf(n))return null;const i=function(e,t){return n=>e.reduce(((e,r)=>(e[r]=m(t,n),e)),{})}(c(n),o),a=e[n];return(0,r.NI)(e,a,i)}(e,t,o,n))).reduce(i.A,{})}function y(e){return g(e,u)}function v(e){return g(e,h)}function b(e){return g(e,f)}y.propTypes={},y.filterProps=u,v.propTypes={},v.filterProps=h,b.propTypes={},b.filterProps=f},6481:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>s,BO:()=>a,Yn:()=>i});var r=n(8659),o=n(9452);function i(e,t,n=!0){if(!t||"string"!=typeof t)return null;if(e&&e.vars&&n){const n=`vars.${t}`.split(".").reduce(((e,t)=>e&&e[t]?e[t]:null),e);if(null!=n)return n}return t.split(".").reduce(((e,t)=>e&&null!=e[t]?e[t]:null),e)}function a(e,t,n,r=n){let o;return o="function"==typeof e?e(n):Array.isArray(e)?e[n]||r:i(e,n)||r,t&&(o=t(o,r,e)),o}const s=function(e){const{prop:t,cssProperty:n=e.prop,themeKey:s,transform:l}=e,c=e=>{if(null==e[t])return null;const c=e[t],u=i(e.theme,s)||{};return(0,o.NI)(e,c,(e=>{let o=a(u,l,e);return e===o&&"string"==typeof e&&(o=a(u,l,`${t}${"default"===e?"":(0,r.A)(e)}`,e)),!1===n?o:{[n]:o}}))};return c.propTypes={},c.filterProps=[t],c}},4188:(e,t,n)=>{"use strict";n.d(t,{A:()=>L});var r=n(8248),o=n(6481),i=n(4620);const a=function(...e){const t=e.reduce(((e,t)=>(t.filterProps.forEach((n=>{e[n]=t})),e)),{}),n=e=>Object.keys(e).reduce(((n,r)=>t[r]?(0,i.A)(n,t[r](e)):n),{});return n.propTypes={},n.filterProps=e.reduce(((e,t)=>e.concat(t.filterProps)),[]),n};var s=n(9452);function l(e){return"number"!=typeof e?e:`${e}px solid`}function c(e,t){return(0,o.Ay)({prop:e,themeKey:"borders",transform:t})}const u=c("border",l),h=c("borderTop",l),f=c("borderRight",l),d=c("borderBottom",l),p=c("borderLeft",l),m=c("borderColor"),g=c("borderTopColor"),y=c("borderRightColor"),v=c("borderBottomColor"),b=c("borderLeftColor"),x=c("outline",l),w=c("outlineColor"),k=e=>{if(void 0!==e.borderRadius&&null!==e.borderRadius){const t=(0,r.MA)(e.theme,"shape.borderRadius",4,"borderRadius"),n=e=>({borderRadius:(0,r._W)(t,e)});return(0,s.NI)(e,e.borderRadius,n)}return null};k.propTypes={},k.filterProps=["borderRadius"],a(u,h,f,d,p,m,g,y,v,b,k,x,w);const S=e=>{if(void 0!==e.gap&&null!==e.gap){const t=(0,r.MA)(e.theme,"spacing",8,"gap"),n=e=>({gap:(0,r._W)(t,e)});return(0,s.NI)(e,e.gap,n)}return null};S.propTypes={},S.filterProps=["gap"];const O=e=>{if(void 0!==e.columnGap&&null!==e.columnGap){const t=(0,r.MA)(e.theme,"spacing",8,"columnGap"),n=e=>({columnGap:(0,r._W)(t,e)});return(0,s.NI)(e,e.columnGap,n)}return null};O.propTypes={},O.filterProps=["columnGap"];const _=e=>{if(void 0!==e.rowGap&&null!==e.rowGap){const t=(0,r.MA)(e.theme,"spacing",8,"rowGap"),n=e=>({rowGap:(0,r._W)(t,e)});return(0,s.NI)(e,e.rowGap,n)}return null};function E(e,t){return"grey"===t?t:e}function C(e){return e<=1&&0!==e?100*e+"%":e}_.propTypes={},_.filterProps=["rowGap"],a(S,O,_,(0,o.Ay)({prop:"gridColumn"}),(0,o.Ay)({prop:"gridRow"}),(0,o.Ay)({prop:"gridAutoFlow"}),(0,o.Ay)({prop:"gridAutoColumns"}),(0,o.Ay)({prop:"gridAutoRows"}),(0,o.Ay)({prop:"gridTemplateColumns"}),(0,o.Ay)({prop:"gridTemplateRows"}),(0,o.Ay)({prop:"gridTemplateAreas"}),(0,o.Ay)({prop:"gridArea"})),a((0,o.Ay)({prop:"color",themeKey:"palette",transform:E}),(0,o.Ay)({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:E}),(0,o.Ay)({prop:"backgroundColor",themeKey:"palette",transform:E}));const A=(0,o.Ay)({prop:"width",transform:C}),j=e=>{if(void 0!==e.maxWidth&&null!==e.maxWidth){const t=t=>{var n,r;const o=(null==(n=e.theme)||null==(n=n.breakpoints)||null==(n=n.values)?void 0:n[t])||s.zu[t];return o?"px"!==(null==(r=e.theme)||null==(r=r.breakpoints)?void 0:r.unit)?{maxWidth:`${o}${e.theme.breakpoints.unit}`}:{maxWidth:o}:{maxWidth:C(t)}};return(0,s.NI)(e,e.maxWidth,t)}return null};j.filterProps=["maxWidth"];const P=(0,o.Ay)({prop:"minWidth",transform:C}),M=(0,o.Ay)({prop:"height",transform:C}),R=(0,o.Ay)({prop:"maxHeight",transform:C}),T=(0,o.Ay)({prop:"minHeight",transform:C}),L=((0,o.Ay)({prop:"size",cssProperty:"width",transform:C}),(0,o.Ay)({prop:"size",cssProperty:"height",transform:C}),a(A,j,P,M,R,T,(0,o.Ay)({prop:"boxSizing"})),{border:{themeKey:"borders",transform:l},borderTop:{themeKey:"borders",transform:l},borderRight:{themeKey:"borders",transform:l},borderBottom:{themeKey:"borders",transform:l},borderLeft:{themeKey:"borders",transform:l},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:l},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:k},color:{themeKey:"palette",transform:E},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:E},backgroundColor:{themeKey:"palette",transform:E},p:{style:r.Ms},pt:{style:r.Ms},pr:{style:r.Ms},pb:{style:r.Ms},pl:{style:r.Ms},px:{style:r.Ms},py:{style:r.Ms},padding:{style:r.Ms},paddingTop:{style:r.Ms},paddingRight:{style:r.Ms},paddingBottom:{style:r.Ms},paddingLeft:{style:r.Ms},paddingX:{style:r.Ms},paddingY:{style:r.Ms},paddingInline:{style:r.Ms},paddingInlineStart:{style:r.Ms},paddingInlineEnd:{style:r.Ms},paddingBlock:{style:r.Ms},paddingBlockStart:{style:r.Ms},paddingBlockEnd:{style:r.Ms},m:{style:r.Lc},mt:{style:r.Lc},mr:{style:r.Lc},mb:{style:r.Lc},ml:{style:r.Lc},mx:{style:r.Lc},my:{style:r.Lc},margin:{style:r.Lc},marginTop:{style:r.Lc},marginRight:{style:r.Lc},marginBottom:{style:r.Lc},marginLeft:{style:r.Lc},marginX:{style:r.Lc},marginY:{style:r.Lc},marginInline:{style:r.Lc},marginInlineStart:{style:r.Lc},marginInlineEnd:{style:r.Lc},marginBlock:{style:r.Lc},marginBlockStart:{style:r.Lc},marginBlockEnd:{style:r.Lc},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:S},rowGap:{style:_},columnGap:{style:O},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:C},maxWidth:{style:j},minWidth:{transform:C},height:{transform:C},maxHeight:{transform:C},minHeight:{transform:C},boxSizing:{},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}})},9599:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});var r=n(8168),o=n(8587),i=n(4521),a=n(4188);const s=["sx"],l=e=>{var t,n;const r={systemProps:{},otherProps:{}},o=null!=(t=null==e||null==(n=e.theme)?void 0:n.unstable_sxConfig)?t:a.A;return Object.keys(e).forEach((t=>{o[t]?r.systemProps[t]=e[t]:r.otherProps[t]=e[t]})),r};function c(e){const{sx:t}=e,n=(0,o.A)(e,s),{systemProps:a,otherProps:c}=l(n);let u;return u=Array.isArray(t)?[a,...t]:"function"==typeof t?(...e)=>{const n=t(...e);return(0,i.Q)(n)?(0,r.A)({},a,n):a}:(0,r.A)({},a,t),(0,r.A)({},c,{sx:u})}},3857:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r.A,extendSxProp:()=>o.A,unstable_createStyleFunctionSx:()=>r.k,unstable_defaultSxConfig:()=>i.A});var r=n(3571),o=n(9599),i=n(4188)},3571:(e,t,n)=>{"use strict";n.d(t,{A:()=>u,k:()=>l});var r=n(8659),o=n(4620),i=n(6481),a=n(9452),s=n(4188);function l(){function e(e,t,n,o){const s={[e]:t,theme:n},l=o[e];if(!l)return{[e]:t};const{cssProperty:c=e,themeKey:u,transform:h,style:f}=l;if(null==t)return null;if("typography"===u&&"inherit"===t)return{[e]:t};const d=(0,i.Yn)(n,u)||{};return f?f(s):(0,a.NI)(s,t,(t=>{let n=(0,i.BO)(d,h,t);return t===n&&"string"==typeof t&&(n=(0,i.BO)(d,h,`${e}${"default"===t?"":(0,r.A)(t)}`,t)),!1===c?n:{[c]:n}}))}return function t(n){var r;const{sx:i,theme:l={}}=n||{};if(!i)return null;const c=null!=(r=l.unstable_sxConfig)?r:s.A;function u(n){let r=n;if("function"==typeof n)r=n(l);else if("object"!=typeof n)return n;if(!r)return null;const i=(0,a.EU)(l.breakpoints),s=Object.keys(i);let u=i;return Object.keys(r).forEach((n=>{const i="function"==typeof(s=r[n])?s(l):s;var s;if(null!=i)if("object"==typeof i)if(c[n])u=(0,o.A)(u,e(n,i,l,c));else{const e=(0,a.NI)({theme:l},i,(e=>({[n]:e})));!function(...e){const t=e.reduce(((e,t)=>e.concat(Object.keys(t))),[]),n=new Set(t);return e.every((e=>n.size===Object.keys(e).length))}(e,i)?u=(0,o.A)(u,e):u[n]=t({sx:i,theme:l})}else u=(0,o.A)(u,e(n,i,l,c))})),(0,a.vf)(s,u)}return Array.isArray(i)?i.map(u):u(i)}}const c=l();c.filterProps=["sx"];const u=c},8659:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(5697);function o(e){if("string"!=typeof e)throw new Error((0,r.A)(7));return e.charAt(0).toUpperCase()+e.slice(1)}},8217:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r.A});var r=n(8659)},6379:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r});const r=function(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}},4521:(e,t,n)=>{"use strict";n.d(t,{A:()=>a,Q:()=>o});var r=n(8168);function o(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}function i(e){if(!o(e))return e;const t={};return Object.keys(e).forEach((n=>{t[n]=i(e[n])})),t}function a(e,t,n={clone:!0}){const s=n.clone?(0,r.A)({},e):e;return o(e)&&o(t)&&Object.keys(t).forEach((r=>{"__proto__"!==r&&(o(t[r])&&r in e&&o(e[r])?s[r]=a(e[r],t[r],n):n.clone?s[r]=o(t[r])?i(t[r]):t[r]:s[r]=t[r])})),s}},819:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r.A,isPlainObject:()=>r.Q});var r=n(4521)},5697:(e,t,n)=>{"use strict";function r(e){let t="https://mui.com/production-error/?code="+e;for(let e=1;e<arguments.length;e+=1)t+="&args[]="+encodeURIComponent(arguments[e]);return"Minified MUI error #"+e+"; visit "+t+" for the full message."}n.d(t,{A:()=>r})},2108:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r.A});var r=n(5697)},1172:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>l,getFunctionName:()=>i});var r=n(5492);const o=/^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/;function i(e){const t=`${e}`.match(o);return t&&t[1]||""}function a(e,t=""){return e.displayName||e.name||i(e)||t}function s(e,t,n){const r=a(t);return e.displayName||(""!==r?`${n}(${r})`:n)}function l(e){if(null!=e){if("string"==typeof e)return e;if("function"==typeof e)return a(e,"Component");if("object"==typeof e)switch(e.$$typeof){case r.ForwardRef:return s(e,e.render,"ForwardRef");case r.Memo:return s(e,e.type,"memo");default:return}}}},7064:(e,t)=>{"use strict";Symbol.for("react.element"),Symbol.for("react.portal"),Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider"),Symbol.for("react.context"),Symbol.for("react.server_context");var n=Symbol.for("react.forward_ref"),r=(Symbol.for("react.suspense"),Symbol.for("react.suspense_list"),Symbol.for("react.memo"));Symbol.for("react.lazy"),Symbol.for("react.offscreen");Symbol.for("react.module.reference"),t.ForwardRef=n,t.Memo=r},5492:(e,t,n)=>{"use strict";e.exports=n(7064)},4300:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2Z"/>'}},9057:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M11 4h2v12l5.5-5.5l1.42 1.42L12 19.84l-7.92-7.92L5.5 10.5L11 16V4Z"/>'}},3860:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="m12 7l5 5h-3v4h-4v-4H7l5-5m0 15A10 10 0 0 1 2 12A10 10 0 0 1 12 2a10 10 0 0 1 10 10a10 10 0 0 1-10 10m0-2a8 8 0 0 0 8-8a8 8 0 0 0-8-8a8 8 0 0 0-8 8a8 8 0 0 0 8 8Z"/>'}},6304:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M13 20h-2V8l-5.5 5.5l-1.42-1.42L12 4.16l7.92 7.92l-1.42 1.42L13 8v12Z"/>'}},2600:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M7.5 5.6L5 7l1.4-2.5L5 2l2.5 1.4L10 2L8.6 4.5L10 7L7.5 5.6m12 9.8L22 14l-1.4 2.5L22 19l-2.5-1.4L17 19l1.4-2.5L17 14l2.5 1.4M22 2l-1.4 2.5L22 7l-2.5-1.4L17 7l1.4-2.5L17 2l2.5 1.4L22 2m-8.66 10.78l2.44-2.44l-2.12-2.12l-2.44 2.44l2.12 2.12m1.03-5.49l2.34 2.34c.39.37.39 1.02 0 1.41L5.04 22.71c-.39.39-1.04.39-1.41 0l-2.34-2.34c-.39-.37-.39-1.02 0-1.41L12.96 7.29c.39-.39 1.04-.39 1.41 0Z"/>'}},4196:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M9 10v2H7v-2h2m4 0v2h-2v-2h2m4 0v2h-2v-2h2m2-7a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h1V1h2v2h8V1h2v2h1m0 16V8H5v11h14M9 14v2H7v-2h2m4 0v2h-2v-2h2m4 0v2h-2v-2h2Z"/>'}},2849:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="m12 8l-1.33.09C9.81 7.07 7.4 4.5 5 4.5c0 0-1.97 2.96-.04 6.91c-.55.83-.89 1.26-.96 2.25l-1.93.29l.21.98l1.76-.26l.14.71l-1.57.94l.47.89l1.45-.89C5.68 18.76 8.59 20 12 20s6.32-1.24 7.47-3.68l1.45.89l.47-.89l-1.57-.94l.14-.71l1.76.26l.21-.98l-1.93-.29c-.07-.99-.41-1.42-.96-2.25C20.97 7.46 19 4.5 19 4.5c-2.4 0-4.81 2.57-5.67 3.59L12 8m-3 3a1 1 0 0 1 1 1a1 1 0 0 1-1 1a1 1 0 0 1-1-1a1 1 0 0 1 1-1m6 0a1 1 0 0 1 1 1a1 1 0 0 1-1 1a1 1 0 0 1-1-1a1 1 0 0 1 1-1m-4 3h2l-.7 1.39c.2.64.76 1.11 1.45 1.11a1.5 1.5 0 0 0 1.5-1.5h.5a2 2 0 0 1-2 2c-.75 0-1.4-.41-1.75-1c-.35.59-1 1-1.75 1a2 2 0 0 1-2-2h.5a1.5 1.5 0 0 0 1.5 1.5c.69 0 1.25-.47 1.45-1.11L11 14Z"/>'}},3594:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10s10-4.5 10-10S17.5 2 12 2m-2 15l-5-5l1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9Z"/>'}},4501:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M21 7L9 19l-5.5-5.5l1.41-1.41L9 16.17L19.59 5.59L21 7Z"/>'}},2027:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12 20a8 8 0 0 1-8-8a8 8 0 0 1 8-8a8 8 0 0 1 8 8a8 8 0 0 1-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2Z"/>'}},5962:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M18.41 7.41L17 6l-6 6l6 6l1.41-1.41L13.83 12l4.58-4.59m-6 0L11 6l-6 6l6 6l1.41-1.41L7.83 12l4.58-4.59Z"/>'}},6029:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M5.59 7.41L7 6l6 6l-6 6l-1.41-1.41L10.17 12L5.59 7.41m6 0L13 6l6 6l-6 6l-1.41-1.41L16.17 12l-4.58-4.59Z"/>'}},4555:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M7.41 8.58L12 13.17l4.59-4.59L18 10l-6 6l-6-6l1.41-1.42Z"/>'}},5074:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M15.41 16.58L10.83 12l4.58-4.59L14 6l-6 6l6 6l1.41-1.42Z"/>'}},21:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6l-1.41-1.42Z"/>'}},6382:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6l-6 6l1.41 1.41Z"/>'}},5241:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12L19 6.41Z"/>'}},858:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12 15.5A3.5 3.5 0 0 1 8.5 12A3.5 3.5 0 0 1 12 8.5a3.5 3.5 0 0 1 3.5 3.5a3.5 3.5 0 0 1-3.5 3.5m7.43-2.53c.04-.32.07-.64.07-.97c0-.33-.03-.66-.07-1l2.11-1.63c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.31-.61-.22l-2.49 1c-.52-.39-1.06-.73-1.69-.98l-.37-2.65A.506.506 0 0 0 14 2h-4c-.25 0-.46.18-.5.42l-.37 2.65c-.63.25-1.17.59-1.69.98l-2.49-1c-.22-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64L4.57 11c-.04.34-.07.67-.07 1c0 .33.03.65.07.97l-2.11 1.66c-.19.15-.25.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1.01c.52.4 1.06.74 1.69.99l.37 2.65c.04.24.25.42.5.42h4c.25 0 .46-.18.5-.42l.37-2.65c.63-.26 1.17-.59 1.69-.99l2.49 1.01c.22.08.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.66Z"/>'}},3104:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M11 17H4a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h12v2H4v12h7v-2l4 3l-4 3v-2m8 4V7H8v6H6V7a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2v-2h2v2h11Z"/>'}},9300:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M15 9H5V5h10m-3 14a3 3 0 0 1-3-3a3 3 0 0 1 3-3a3 3 0 0 1 3 3a3 3 0 0 1-3 3m5-16H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V7l-4-4Z"/>'}},7073:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M18.68 12.32a4.49 4.49 0 0 0-6.36.01a4.49 4.49 0 0 0 0 6.36a4.508 4.508 0 0 0 5.57.63L21 22.39L22.39 21l-3.09-3.11c1.13-1.77.87-4.09-.62-5.57m-1.41 4.95c-.98.98-2.56.97-3.54 0c-.97-.98-.97-2.56.01-3.54c.97-.97 2.55-.97 3.53 0c.97.98.97 2.56 0 3.54M10.9 20.1a6.527 6.527 0 0 1-1.48-2.32C6.27 17.25 4 15.76 4 14v3c0 2.21 3.58 4 8 4c-.4-.26-.77-.56-1.1-.9M4 9v3c0 1.68 2.07 3.12 5 3.7v-.2c0-.93.2-1.85.58-2.69C6.34 12.3 4 10.79 4 9m8-6C7.58 3 4 4.79 4 7c0 2 3 3.68 6.85 4h.05c1.2-1.26 2.86-2 4.6-2c.91 0 1.81.19 2.64.56A3.215 3.215 0 0 0 20 7c0-2.21-3.58-4-8-4Z"/>'}},1860:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12 3C7.58 3 4 4.79 4 7s3.58 4 8 4s8-1.79 8-4s-3.58-4-8-4M4 9v3c0 2.21 3.58 4 8 4s8-1.79 8-4V9c0 2.21-3.58 4-8 4s-8-1.79-8-4m0 5v3c0 2.21 3.58 4 8 4s8-1.79 8-4v-3c0 2.21-3.58 4-8 4s-8-1.79-8-4Z"/>'}},4142:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M19 4h-3.5l-1-1h-5l-1 1H5v2h14M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6v12Z"/>'}},9728:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12 9a3 3 0 0 0-3 3a3 3 0 0 0 3 3a3 3 0 0 0 3-3a3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5a5 5 0 0 1 5-5a5 5 0 0 1 5 5a5 5 0 0 1-5 5m0-12.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5Z"/>'}},257:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12 2.04c-5.5 0-10 4.49-10 10.02c0 5 3.66 9.15 8.44 9.9v-7H7.9v-2.9h2.54V9.85c0-2.51 1.49-3.89 3.78-3.89c1.09 0 2.23.19 2.23.19v2.47h-1.26c-1.24 0-1.63.77-1.63 1.56v1.88h2.78l-.45 2.9h-2.33v7a10 10 0 0 0 8.44-9.9c0-5.53-4.5-10.02-10-10.02Z"/>'}},7326:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M13 9h5.5L13 3.5V9M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m6.16 12.31c-1.56 0-2.97.58-4.05 1.52L6 13.72V19h5.28l-2.13-2.12c.82-.68 1.85-1.1 3.01-1.1c2.07 0 3.84 1.35 4.45 3.22l1.39-.46c-.81-2.45-3.12-4.23-5.84-4.23Z"/>'}},4611:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M14 12v7.88c.04.3-.06.62-.29.83a.996.996 0 0 1-1.41 0l-2.01-2.01a.989.989 0 0 1-.29-.83V12h-.03L4.21 4.62a1 1 0 0 1 .17-1.4c.19-.14.4-.22.62-.22h14c.22 0 .43.08.62.22a1 1 0 0 1 .17 1.4L14.03 12H14Z"/>'}},9538:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M19 20H4a2 2 0 0 1-2-2V6c0-1.11.89-2 2-2h6l2 2h7a2 2 0 0 1 2 2H4v10l2.14-8h17.07l-2.28 8.5c-.23.87-1.01 1.5-1.93 1.5Z"/>'}},9966:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M13 19c0 .34.04.67.09 1H4a2 2 0 0 1-2-2V6c0-1.11.89-2 2-2h6l2 2h8a2 2 0 0 1 2 2v5.81c-.88-.51-1.9-.81-3-.81c-3.31 0-6 2.69-6 6m7-1v-3h-2v3h-3v2h3v3h2v-3h3v-2h-3Z"/>'}},4613:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M10 4H4c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-8l-2-2Z"/>'}},2477:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M7 5h14v2H7V5m0 8v-2h14v2H7M4 4.5A1.5 1.5 0 0 1 5.5 6A1.5 1.5 0 0 1 4 7.5A1.5 1.5 0 0 1 2.5 6A1.5 1.5 0 0 1 4 4.5m0 6A1.5 1.5 0 0 1 5.5 12A1.5 1.5 0 0 1 4 13.5A1.5 1.5 0 0 1 2.5 12A1.5 1.5 0 0 1 4 10.5M7 19v-2h14v2H7m-3-2.5A1.5 1.5 0 0 1 5.5 18A1.5 1.5 0 0 1 4 19.5A1.5 1.5 0 0 1 2.5 18A1.5 1.5 0 0 1 4 16.5Z"/>'}},7894:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M21 17H7V3h14m0-2H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2M3 5H1v16a2 2 0 0 0 2 2h16v-2H3m12.96-10.71l-2.75 3.54l-1.96-2.36L8.5 15h11l-3.54-4.71Z"/>'}},6123:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M22 20.7L3.3 2L2 3.3l1 1V19c0 1.1.9 2 2 2h14.7l1 1l1.3-1.3M5 19V6.3l7.6 7.6l-1.5 1.9L9 13.1L6 17h9.7l2 2H5M8.8 5l-2-2H19c1.1 0 2 .9 2 2v12.2l-2-2V5H8.8"/>'}},9829:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M18 15v3h-3v2h3v3h2v-3h3v-2h-3v-3h-2m-4.7 6H5c-1.1 0-2-.9-2-2V5c0-1.1.9-2 2-2h14c1.1 0 2 .9 2 2v8.3c-.6-.2-1.3-.3-2-.3c-1.1 0-2.2.3-3.1.9L14.5 12L11 16.5l-2.5-3L5 18h8.1c-.1.3-.1.7-.1 1c0 .7.1 1.4.3 2Z"/>'}},3102:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8s8 3.59 8 8s-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z"/>'}},9077:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M7.8 2h8.4C19.4 2 22 4.6 22 7.8v8.4a5.8 5.8 0 0 1-5.8 5.8H7.8C4.6 22 2 19.4 2 16.2V7.8A5.8 5.8 0 0 1 7.8 2m-.2 2A3.6 3.6 0 0 0 4 7.6v8.8C4 18.39 5.61 20 7.6 20h8.8a3.6 3.6 0 0 0 3.6-3.6V7.6C20 5.61 18.39 4 16.4 4H7.6m9.65 1.5a1.25 1.25 0 0 1 1.25 1.25A1.25 1.25 0 0 1 17.25 8A1.25 1.25 0 0 1 16 6.75a1.25 1.25 0 0 1 1.25-1.25M12 7a5 5 0 0 1 5 5a5 5 0 0 1-5 5a5 5 0 0 1-5-5a5 5 0 0 1 5-5m0 2a3 3 0 0 0-3 3a3 3 0 0 0 3 3a3 3 0 0 0 3-3a3 3 0 0 0-3-3Z"/>'}},8841:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M16.84 2.73c-.39 0-.77.15-1.07.44l-2.12 2.12l5.3 5.31l2.12-2.1c.6-.61.6-1.56 0-2.14L17.9 3.17c-.3-.29-.68-.44-1.06-.44M12.94 6l-8.1 8.11l2.56.28l.18 2.29l2.28.17l.29 2.56l8.1-8.11m-14 3.74L2.5 21.73l6.7-1.79l-.24-2.16l-2.31-.17l-.18-2.32"/>'}},4753:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M10.59 13.41c.41.39.41 1.03 0 1.42c-.39.39-1.03.39-1.42 0a5.003 5.003 0 0 1 0-7.07l3.54-3.54a5.003 5.003 0 0 1 7.07 0a5.003 5.003 0 0 1 0 7.07l-1.49 1.49c.01-.82-.12-1.64-.4-2.42l.47-.48a2.982 2.982 0 0 0 0-4.24a2.982 2.982 0 0 0-4.24 0l-3.53 3.53a2.982 2.982 0 0 0 0 4.24m2.82-4.24c.39-.39 1.03-.39 1.42 0a5.003 5.003 0 0 1 0 7.07l-3.54 3.54a5.003 5.003 0 0 1-7.07 0a5.003 5.003 0 0 1 0-7.07l1.49-1.49c-.01.82.12 1.64.4 2.43l-.47.47a2.982 2.982 0 0 0 0 4.24a2.982 2.982 0 0 0 4.24 0l3.53-3.53a2.982 2.982 0 0 0 0-4.24a.973.973 0 0 1 0-1.42Z"/>'}},2079:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14m-.5 15.5v-5.3a3.26 3.26 0 0 0-3.26-3.26c-.85 0-1.84.52-2.32 1.3v-1.11h-2.79v8.37h2.79v-4.93c0-.77.62-1.4 1.39-1.4a1.4 1.4 0 0 1 1.4 1.4v4.93h2.79M6.88 8.56a1.68 1.68 0 0 0 1.68-1.68c0-.93-.75-1.69-1.68-1.69a1.69 1.69 0 0 0-1.69 1.69c0 .93.76 1.68 1.69 1.68m1.39 9.94v-8.37H5.5v8.37h2.77Z"/>'}},3271:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M19 13c.34 0 .67.04 1 .09V10a2 2 0 0 0-2-2h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6a2 2 0 0 0-2 2v10c0 1.11.89 2 2 2h7.81c-.51-.88-.81-1.9-.81-3c0-3.31 2.69-6 6-6M9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9V6m3 11a2 2 0 1 1 2-2c0 1.11-.89 2-2 2m10.5.25L17.75 22L15 19l1.16-1.16l1.59 1.59l3.59-3.59l1.16 1.41Z"/>'}},5207:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M18 1c-2.76 0-5 2.24-5 5v2H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12c1.11 0 2-.89 2-2V10a2 2 0 0 0-2-2h-1V6c0-1.66 1.34-3 3-3s3 1.34 3 3v2h2V6c0-2.76-2.24-5-5-5m-8 12a2 2 0 0 1 2 2c0 1.11-.89 2-2 2a2 2 0 1 1 0-4Z"/>'}},146:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M20.94 14c-.28 1.41-2.44 2.96-4.97 3.26c-1.31.15-2.6.3-3.97.24c-2.25-.11-4-.54-4-.54v.62c.32 2.22 2.22 2.35 4.03 2.42c1.82.05 3.44-.46 3.44-.46l.08 1.65s-1.28.68-3.55.81c-1.25.07-2.81-.03-4.62-.5c-3.92-1.05-4.6-5.24-4.7-9.5l-.01-3.43c0-4.34 2.83-5.61 2.83-5.61C6.95 2.3 9.41 2 11.97 2h.06c2.56 0 5.02.3 6.47.96c0 0 2.83 1.27 2.83 5.61c0 0 .04 3.21-.39 5.43M18 8.91c0-1.08-.3-1.91-.85-2.56c-.56-.63-1.3-.96-2.23-.96c-1.06 0-1.87.41-2.42 1.23l-.5.88l-.5-.88c-.56-.82-1.36-1.23-2.43-1.23c-.92 0-1.66.33-2.23.96C6.29 7 6 7.83 6 8.91v5.26h2.1V9.06c0-1.06.45-1.62 1.36-1.62c1 0 1.5.65 1.5 1.93v2.79h2.07V9.37c0-1.28.5-1.93 1.51-1.93c.9 0 1.35.56 1.35 1.62v5.11H18V8.91Z"/>'}},1299:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M14 19h4V5h-4M6 19h4V5H6v14Z"/>'}},6268:(e,t)=>{},9931:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M9.04 21.54c.96.29 1.93.46 2.96.46a10 10 0 0 0 10-10A10 10 0 0 0 12 2A10 10 0 0 0 2 12c0 4.25 2.67 7.9 6.44 9.34c-.09-.78-.18-2.07 0-2.96l1.15-4.94s-.29-.58-.29-1.5c0-1.38.86-2.41 1.84-2.41c.86 0 1.26.63 1.26 1.44c0 .86-.57 2.09-.86 3.27c-.17.98.52 1.84 1.52 1.84c1.78 0 3.16-1.9 3.16-4.58c0-2.4-1.72-4.04-4.19-4.04c-2.82 0-4.48 2.1-4.48 4.31c0 .86.28 1.73.74 2.3c.09.06.09.14.06.29l-.29 1.09c0 .17-.11.23-.28.11c-1.28-.56-2.02-2.38-2.02-3.85c0-3.16 2.24-6.03 6.56-6.03c3.44 0 6.12 2.47 6.12 5.75c0 3.44-2.13 6.2-5.18 6.2c-.97 0-1.92-.52-2.26-1.13l-.67 2.37c-.23.86-.86 2.01-1.29 2.7v-.03Z"/>'}},8843:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M8 5.14v14l11-7l-11-7Z"/>'}},7297:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2Z"/>'}},6761:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2m0 7a3 3 0 0 1 3 3a3 3 0 0 1-3 3a3 3 0 0 1-3-3a3 3 0 0 1 3-3Z"/>'}},1086:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12 5V1L7 6l5 5V7a6 6 0 0 1 6 6a6 6 0 0 1-6 6a6 6 0 0 1-6-6H4a8 8 0 0 0 8 8a8 8 0 0 0 8-8a8 8 0 0 0-8-8Z"/>'}},1097:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="m13.13 22.19l-1.63-3.83c1.57-.58 3.04-1.36 4.4-2.27l-2.77 6.1M5.64 12.5l-3.83-1.63l6.1-2.77C7 9.46 6.22 10.93 5.64 12.5M21.61 2.39S16.66.269 11 5.93c-2.19 2.19-3.5 4.6-4.35 6.71c-.28.75-.09 1.57.46 2.13l2.13 2.12c.55.56 1.37.74 2.12.46A19.1 19.1 0 0 0 18.07 13c5.66-5.66 3.54-10.61 3.54-10.61m-7.07 7.07c-.78-.78-.78-2.05 0-2.83s2.05-.78 2.83 0c.77.78.78 2.05 0 2.83c-.78.78-2.05.78-2.83 0m-5.66 7.07l-1.41-1.41l1.41 1.41M6.24 22l3.64-3.64c-.34-.09-.67-.24-.97-.45L4.83 22h1.41M2 22h1.41l4.77-4.76l-1.42-1.41L2 20.59V22m0-2.83l4.09-4.08c-.21-.3-.36-.62-.45-.97L2 17.76v1.41Z"/>'}},2693:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="m18 21l-4-4h3V7h-3l4-4l4 4h-3v10h3M2 19v-2h10v2M2 13v-2h7v2M2 7V5h4v2H2Z"/>'}},757:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.62L12 2L9.19 8.62L2 9.24l5.45 4.73L5.82 21L12 17.27Z"/>'}},8957:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M18 18H6V6h12v12Z"/>'}},67:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12 20a7 7 0 0 1-7-7a7 7 0 0 1 7-7a7 7 0 0 1 7 7a7 7 0 0 1-7 7m7.03-12.61l1.42-1.42c-.45-.51-.9-.97-1.41-1.41L17.62 6c-1.55-1.26-3.5-2-5.62-2a9 9 0 0 0-9 9a9 9 0 0 0 9 9c5 0 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61M11 14h2V8h-2m4-7H9v2h6V1Z"/>'}},6982:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="m21.71 20.29l-1.42 1.42a1 1 0 0 1-1.41 0L7 9.85A3.81 3.81 0 0 1 6 10a4 4 0 0 1-3.78-5.3l2.54 2.54l.53-.53l1.42-1.42l.53-.53L4.7 2.22A4 4 0 0 1 10 6a3.81 3.81 0 0 1-.15 1l11.86 11.88a1 1 0 0 1 0 1.41M2.29 18.88a1 1 0 0 0 0 1.41l1.42 1.42a1 1 0 0 0 1.41 0l5.47-5.46l-2.83-2.83M20 2l-4 2v2l-2.17 2.17l2 2L18 8h2l2-4Z"/>'}},552:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M9 3v1H4v2h1v13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6h1V4h-5V3H9m0 5h2v9H9V8m4 0h2v9h-2V8Z"/>'}},9014:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M22.46 6c-.77.35-1.6.58-2.46.69c.88-.53 1.56-1.37 1.88-2.38c-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29c0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15c0 1.49.75 2.81 1.91 3.56c-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07a4.28 4.28 0 0 0 4 2.98a8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21C16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56c.84-.6 1.56-1.36 2.14-2.23Z"/>'}},7695:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88c3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8Z"/>'}},1373:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M13 3v6h8V3m-8 18h8V11h-8M3 21h8v-6H3m0-2h8V3H3v10Z"/>'}},1333:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M3 11h8V3H3m0 18h8v-8H3m10 8h8v-8h-8m0-10v8h8V3"/>'}},6200:(e,t)=>{t.A={width:24,height:24,body:'<path fill="currentColor" d="M9 2a7 7 0 0 1 7 7c0 1.57-.5 3-1.39 4.19l.8.81H16l6 6l-2 2l-6-6v-.59l-.81-.8A6.916 6.916 0 0 1 9 16a7 7 0 0 1-7-7a7 7 0 0 1 7-7M8 5v3H5v2h3v3h2v-3h3V8h-3V5H8Z"/>'}},5977:(e,t,n)=>{"use strict";t.L3=t.In=void 0;var r,o=(r=n(1594))&&r.__esModule?r:{default:r};function i(e){return i="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},i(e)}function a(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,r.key,r)}}var s=0,l=/(-?[0-9.]*[0-9]+[0-9.]*)/g,c=/^-?[0-9.]*[0-9]+[0-9.]*$/g,u=["width","height","inline","hFlip","vFlip","flip","rotate","align","color","box"],h={left:0,top:0,width:16,height:16,rotate:0,hFlip:!1,vFlip:!1},f=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._item=t}var t,n,r;return t=e,r=[{key:"splitAttributes",value:function(e){var t={icon:Object.create(null),node:Object.create(null)};return Object.keys(e).forEach((function(n){t[-1===u.indexOf(n)?"node":"icon"][n]=e[n]})),t}},{key:"calculateDimension",value:function(e,t,n){if(1===t)return e;if(n=void 0===n?100:n,"number"==typeof e)return Math.ceil(e*t*n)/n;var r=e.split(l);if(null===r||!r.length)return null;for(var o,i=[],a=r.shift(),s=c.test(a);;){if(s?(o=parseFloat(a),isNaN(o)?i.push(a):i.push(Math.ceil(o*t*n)/n)):i.push(a),void 0===(a=r.shift()))return i.join("");s=!s}}},{key:"replaceIDs",value:function(e){var t,n,r=/\sid="(\S+)"/g,o=[];function i(e,t,n){for(var r=0;-1!==(r=n.indexOf(e,r));)n=n.slice(0,r)+t+n.slice(r+e.length),r+=t.length;return n}for(;t=r.exec(e);)o.push(t[1]);return o.length?(n="IconifyId-"+Date.now().toString(16)+"-"+(16777216*Math.random()|0).toString(16)+"-",o.forEach((function(t){var r=n+s;s++,e=i('="'+t+'"','="'+r+'"',e),e=i('="#'+t+'"','="#'+r+'"',e),e=i("(#"+t+")","(#"+r+")",e)})),e):e}}],(n=[{key:"getAttributes",value:function(t){var n=this._item;"object"!==i(t)&&(t=Object.create(null));var r={horizontal:"center",vertical:"middle",slice:!1},o={rotate:n.rotate,hFlip:n.hFlip,vFlip:n.vFlip},a=Object.create(null),s=Object.create(null),l=!0===t.inline||"true"===t.inline||"1"===t.inline,c={left:n.left,top:l?n.inlineTop:n.top,width:n.width,height:l?n.inlineHeight:n.height};if(["hFlip","vFlip"].forEach((function(e){void 0===t[e]||!0!==t[e]&&"true"!==t[e]&&"1"!==t[e]||(o[e]=!o[e])})),void 0!==t.flip&&t.flip.toLowerCase().split(/[\s,]+/).forEach((function(e){switch(e){case"horizontal":o.hFlip=!o.hFlip;break;case"vertical":o.vFlip=!o.vFlip}})),void 0!==t.rotate){var u=t.rotate;if("number"==typeof u)o.rotate+=u;else if("string"==typeof u){var h=u.replace(/^-?[0-9.]*/,"");if(""===h)u=parseInt(u),isNaN(u)||(o.rotate+=u);else if(h!==u){var f=!1;switch(h){case"%":f=25;break;case"deg":f=90}f&&(u=parseInt(u.slice(0,u.length-h.length)),isNaN(u)||(o.rotate+=Math.round(u/f)))}}}var d,p=[];switch(o.hFlip?o.vFlip?o.rotate+=2:(p.push("translate("+(c.width+c.left)+" "+(0-c.top)+")"),p.push("scale(-1 1)"),c.top=c.left=0):o.vFlip&&(p.push("translate("+(0-c.left)+" "+(c.height+c.top)+")"),p.push("scale(1 -1)"),c.top=c.left=0),o.rotate%4){case 1:d=c.height/2+c.top,p.unshift("rotate(90 "+d+" "+d+")"),0===c.left&&0===c.top||(d=c.left,c.left=c.top,c.top=d),c.width!==c.height&&(d=c.width,c.width=c.height,c.height=d);break;case 2:p.unshift("rotate(180 "+(c.width/2+c.left)+" "+(c.height/2+c.top)+")");break;case 3:d=c.width/2+c.left,p.unshift("rotate(-90 "+d+" "+d+")"),0===c.left&&0===c.top||(d=c.left,c.left=c.top,c.top=d),c.width!==c.height&&(d=c.width,c.width=c.height,c.height=d)}var m,g,y=t.width?t.width:null,v=t.height?t.height:null;null===y&&null===v&&(v="1em"),null!==y&&null!==v?(m=y,g=v):null!==y?(m=y,g=e.calculateDimension(m,c.height/c.width)):(g=v,m=e.calculateDimension(g,c.width/c.height)),!1!==m&&(s.width="auto"===m?c.width:m),!1!==g&&(s.height="auto"===g?c.height:g),l&&0!==n.verticalAlign&&(a["vertical-align"]=n.verticalAlign+"em"),void 0!==t.align&&t.align.toLowerCase().split(/[\s,]+/).forEach((function(e){switch(e){case"left":case"right":case"center":r.horizontal=e;break;case"top":case"bottom":case"middle":r.vertical=e;break;case"crop":r.slice=!0;break;case"meet":r.slice=!1}})),s.preserveAspectRatio=function(e){var t;switch(e.horizontal){case"left":t="xMin";break;case"right":t="xMax";break;default:t="xMid"}switch(e.vertical){case"top":t+="YMin";break;case"bottom":t+="YMax";break;default:t+="YMid"}return t+(e.slice?" slice":" meet")}(r),s.viewBox=c.left+" "+c.top+" "+c.width+" "+c.height;var b=e.replaceIDs(n.body);return void 0!==t.color&&(b=b.replace(/currentColor/g,t.color)),p.length&&(b='<g transform="'+p.join(" ")+'">'+b+"</g>"),!0!==t.box&&"true"!==t.box&&"1"!==t.box||(b+='<rect x="'+c.left+'" y="'+c.top+'" width="'+c.width+'" height="'+c.height+'" fill="rgba(0, 0, 0, 0)" />'),{attributes:s,body:b,style:a}}},{key:"getSVG",value:function(t,n){var r=e.splitAttributes(t),o=this.getAttributes(r.icon),i='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"';return n&&Object.keys(r.node).forEach((function(e){i+=" "+e+'="'+r.node[e]+'"'})),Object.keys(o.attributes).forEach((function(e){i+=" "+e+'="'+o.attributes[e]+'"'})),i+=' style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);',Object.keys(o.style).forEach((function(e){i+=" "+e+": "+o.style[e]+";"})),t&&void 0!==t.style&&(i+=t.style),i+='">',i+=o.body+"</svg>"}}])&&a(t.prototype,n),r&&a(t,r),e}();function d(e,t){if("object"!==i(e.icon))return null;var n=f.splitAttributes(e),r=n.icon,a=n.node;delete a.icon,void 0===r.inline&&(r.inline=t);var s=new f(function(e){var t,n=Object.create(null);for(t in h)n[t]=h[t];for(t in e)n[t]=e[t];return void 0===n.inlineTop&&(n.inlineTop=n.top),void 0===n.inlineHeight&&(n.inlineHeight=n.height),void 0===n.verticalAlign&&(n.verticalAlign=n.height%7==0&&n.height%8!=0?-.143:-.125),n}(e.icon)),l=s.getAttributes(r),c={transform:"rotate(360deg)"};if(void 0!==l.style["vertical-align"]&&(c.verticalAlign=l.style["vertical-align"]),void 0!==e.style)for(var u in e.style)c[u]=e.style[u];var d,p={xmlns:"http://www.w3.org/2000/svg",focusable:!1,style:c};for(d in a)p[d]=a[d];for(d in l.attributes)p[d]=l.attributes[d];return p.dangerouslySetInnerHTML={__html:l.body},o.default.createElement("svg",p,null)}t.In=function(e){return d(e,!1)},t.L3=function(e){return d(e,!0)}},5627:e=>{"use strict";var t=Object.prototype.hasOwnProperty,n="~";function r(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,r,i,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new o(r,i||e,a),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,r,o=[];if(0===this._eventsCount)return o;for(r in e=this._events)t.call(e,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,a=new Array(i);o<i;o++)a[o]=r[o].fn;return a},s.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,o,i,a){var s=n?n+e:e;if(!this._events[s])return!1;var l,c,u=this._events[s],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,o),!0;case 5:return u.fn.call(u.context,t,r,o,i),!0;case 6:return u.fn.call(u.context,t,r,o,i,a),!0}for(c=1,l=new Array(h-1);c<h;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var f,d=u.length;for(c=0;c<d;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),h){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,r);break;case 4:u[c].fn.call(u[c].context,t,r,o);break;default:if(!l)for(f=1,l=new Array(h-1);f<h;f++)l[f-1]=arguments[f];u[c].fn.apply(u[c].context,l)}}return!0},s.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,o){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return a(this,i),this;var s=this._events[i];if(s.fn)s.fn!==t||o&&!s.once||r&&s.context!==r||a(this,i);else{for(var l=0,c=[],u=s.length;l<u;l++)(s[l].fn!==t||o&&!s[l].once||r&&s[l].context!==r)&&c.push(s[l]);c.length?this._events[i]=1===c.length?c[0]:c:a(this,i)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s},3948:(e,t,n)=>{var r;function o(e){return o="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},o(e)}!function(){"use strict";var i=!("undefined"==typeof window||!window.document||!window.document.createElement),a={canUseDOM:i,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:i&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:i&&!!window.screen};"object"===o(n.amdO)&&n.amdO?void 0===(r=function(){return a}.call(t,n,t,e))||(e.exports=r):e.exports?e.exports=a:window.ExecutionEnvironment=a}()},9186:e=>{"use strict";e.exports=function(e,t){return t=t||function(){},e.then((function(e){return new Promise((function(e){e(t())})).then((function(){return e}))}),(function(e){return new Promise((function(e){e(t())})).then((function(){throw e}))}))}},6815:(e,t,n)=>{"use strict";function r(){r=function(){return t};var e,t={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},l=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function h(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(e){h=function(e,t,n){return e[t]=n}}function f(e,t,n,r){var o=t&&t.prototype instanceof b?t:b,a=Object.create(o.prototype),s=new R(r||[]);return i(a,"_invoke",{value:A(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=f;var p="suspendedStart",m="suspendedYield",g="executing",y="completed",v={};function b(){}function x(){}function w(){}var k={};h(k,l,(function(){return this}));var S=Object.getPrototypeOf,O=S&&S(S(T([])));O&&O!==n&&o.call(O,l)&&(k=O);var _=w.prototype=b.prototype=Object.create(k);function E(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(r,i,s,l){var c=d(e[r],e,i);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==a(h)&&o.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):t.resolve(h).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,l)}))}l(c.arg)}var r;i(this,"_invoke",{value:function(e,o){function i(){return new t((function(t,r){n(e,o,t,r)}))}return r=r?r.then(i,i):i()}})}function A(t,n,r){var o=p;return function(i,a){if(o===g)throw new Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var l=j(s,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=g;var c=d(t,n,r);if("normal"===c.type){if(o=r.done?y:m,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function j(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,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=d(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}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 M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function n(){for(;++r<t.length;)if(o.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(a(t)+" is not iterable")}return x.prototype=w,i(_,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:x,configurable:!0}),x.displayName=h(w,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,h(e,u,"GeneratorFunction")),e.prototype=Object.create(_),e},t.awrap=function(e){return{__await:e}},E(C.prototype),h(C.prototype,c,(function(){return this})),t.AsyncIterator=C,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new C(f(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(_),h(_,u,"Generator"),h(_,l,(function(){return this})),h(_,"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=T,R.prototype={constructor:R,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(M),!t)for(var n in this)"t"===n.charAt(0)&&o.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 r(r,o){return s.type="throw",s.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],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var l=o.call(a,"catchLoc"),c=o.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;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,v):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),v},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),M(n),v}},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;M(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function o(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function s(e){o(a,r,i,s,l,"next",e)}function l(e){o(a,r,i,s,l,"throw",e)}s(void 0)}))}}function a(e){return a="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},a(e)}function s(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,l(r.key),r)}}function l(e){var t=function(e,t){if("object"!=a(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:String(t)}function c(e,t,n){return t=h(t),function(e,t){if(t&&("object"===a(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],h(e).constructor):t.apply(e,n))}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(u=function(){return!!e})()}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}var d=n(5627),p=n(8198),m=n(4093),g=function(){},y=new p.TimeoutError,v=function(e){function t(e){var n,r,o,i,s;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=c(this,t))._intervalCount=0,n._intervalEnd=0,n._pendingCount=0,n._resolveEmpty=g,n._resolveIdle=g,!("number"==typeof(e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:m.default},e)).intervalCap&&e.intervalCap>=1))throw new TypeError("Expected `intervalCap` to be a number from 1 and up, got `".concat(null!==(o=null===(r=e.intervalCap)||void 0===r?void 0:r.toString())&&void 0!==o?o:"","` (").concat(a(e.intervalCap),")"));if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError("Expected `interval` to be a finite number >= 0, got `".concat(null!==(s=null===(i=e.interval)||void 0===i?void 0:i.toString())&&void 0!==s?s:"","` (").concat(a(e.interval),")"));return n._carryoverConcurrencyCount=e.carryoverConcurrencyCount,n._isIntervalIgnored=e.intervalCap===1/0||0===e.interval,n._intervalCap=e.intervalCap,n._interval=e.interval,n._queue=new e.queueClass,n._queueClass=e.queueClass,n.concurrency=e.concurrency,n._timeout=e.timeout,n._throwOnTimeout=!0===e.throwOnTimeout,n._isPaused=!1===e.autoStart,n}var n,o,l,u,h,d;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(t,e),n=t,o=[{key:"_doesIntervalAllowAnother",get:function(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}},{key:"_doesConcurrentAllowAnother",get:function(){return this._pendingCount<this._concurrency}},{key:"_next",value:function(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}},{key:"_resolvePromises",value:function(){this._resolveEmpty(),this._resolveEmpty=g,0===this._pendingCount&&(this._resolveIdle(),this._resolveIdle=g,this.emit("idle"))}},{key:"_onResumeInterval",value:function(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}},{key:"_isIntervalPaused",value:function(){var e=this,t=Date.now();if(void 0===this._intervalId){var n=this._intervalEnd-t;if(!(n<0))return void 0===this._timeoutId&&(this._timeoutId=setTimeout((function(){e._onResumeInterval()}),n)),!0;this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0}return!1}},{key:"_tryToStartAnother",value:function(){if(0===this._queue.size)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){var e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){var t=this._queue.dequeue();return!!t&&(this.emit("active"),t(),e&&this._initializeIntervalIfNeeded(),!0)}}return!1}},{key:"_initializeIntervalIfNeeded",value:function(){var e=this;this._isIntervalIgnored||void 0!==this._intervalId||(this._intervalId=setInterval((function(){e._onInterval()}),this._interval),this._intervalEnd=Date.now()+this._interval)}},{key:"_onInterval",value:function(){0===this._intervalCount&&0===this._pendingCount&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}},{key:"_processQueue",value:function(){for(;this._tryToStartAnother(););}},{key:"concurrency",get:function(){return this._concurrency},set:function(e){if(!("number"==typeof e&&e>=1))throw new TypeError("Expected `concurrency` to be a number from 1 and up, got `".concat(e,"` (").concat(a(e),")"));this._concurrency=e,this._processQueue()}},{key:"add",value:(d=i(r().mark((function e(t){var n,o=this,a=arguments;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:{},e.abrupt("return",new Promise((function(e,a){var s=function(){var s=i(r().mark((function i(){var s;return r().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o._pendingCount++,o._intervalCount++,r.prev=2,s=void 0===o._timeout&&void 0===n.timeout?t():p.default(Promise.resolve(t()),void 0===n.timeout?o._timeout:n.timeout,(function(){(void 0===n.throwOnTimeout?o._throwOnTimeout:n.throwOnTimeout)&&a(y)})),r.t0=e,r.next=7,s;case 7:r.t1=r.sent,(0,r.t0)(r.t1),r.next=14;break;case 11:r.prev=11,r.t2=r.catch(2),a(r.t2);case 14:o._next();case 15:case"end":return r.stop()}}),i,null,[[2,11]])})));return function(){return s.apply(this,arguments)}}();o._queue.enqueue(s,n),o._tryToStartAnother(),o.emit("add")})));case 2:case"end":return e.stop()}}),e)}))),function(e){return d.apply(this,arguments)})},{key:"addAll",value:(h=i(r().mark((function e(t,n){var o=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Promise.all(t.map(function(){var e=i(r().mark((function e(t){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o.add(t,n));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return h.apply(this,arguments)})},{key:"start",value:function(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}},{key:"pause",value:function(){this._isPaused=!0}},{key:"clear",value:function(){this._queue=new this._queueClass}},{key:"onEmpty",value:(u=i(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==this._queue.size){e.next=2;break}return e.abrupt("return");case 2:return e.abrupt("return",new Promise((function(e){var n=t._resolveEmpty;t._resolveEmpty=function(){n(),e()}})));case 3:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"onIdle",value:(l=i(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==this._pendingCount||0!==this._queue.size){e.next=2;break}return e.abrupt("return");case 2:return e.abrupt("return",new Promise((function(e){var n=t._resolveIdle;t._resolveIdle=function(){n(),e()}})));case 3:case"end":return e.stop()}}),e,this)}))),function(){return l.apply(this,arguments)})},{key:"size",get:function(){return this._queue.size}},{key:"sizeBy",value:function(e){return this._queue.filter(e).length}},{key:"pending",get:function(){return this._pendingCount}},{key:"isPaused",get:function(){return this._isPaused}},{key:"timeout",get:function(){return this._timeout},set:function(e){this._timeout=e}}],o&&s(n.prototype,o),Object.defineProperty(n,"prototype",{writable:!1}),t}(d);t.A=v},6011:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){for(var r=0,o=e.length;o>0;){var i=o/2|0,a=r+i;n(e[a],t)<=0?(r=++a,o-=i+1):o=i}return r}},4093:(e,t,n)=>{"use strict";function r(e){return r="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},r(e)}function o(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,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:String(t)}Object.defineProperty(t,"__esModule",{value:!0});var a=n(6011),s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._queue=[]}var t,n;return t=e,(n=[{key:"enqueue",value:function(e,t){var n={priority:(t=Object.assign({priority:0},t)).priority,run:e};if(this.size&&this._queue[this.size-1].priority>=t.priority)this._queue.push(n);else{var r=a.default(this._queue,n,(function(e,t){return t.priority-e.priority}));this._queue.splice(r,0,n)}}},{key:"dequeue",value:function(){var e=this._queue.shift();return null==e?void 0:e.run}},{key:"filter",value:function(e){return this._queue.filter((function(t){return t.priority===e.priority})).map((function(e){return e.run}))}},{key:"size",get:function(){return this._queue.length}}])&&o(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.default=s},8198:(e,t,n)=>{"use strict";function r(e){return r="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},r(e)}function o(e){var t="function"==typeof Map?new Map:void 0;return o=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(i())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&a(o,n.prototype),o}(e,arguments,s(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),a(n,e)},o(e)}function i(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(i=function(){return!!e})()}function a(e,t){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(e,t)}function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}var l=n(9186),c=function(e){function t(e){var n,o,a,l;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=this,a=t,l=[e],a=s(a),n=function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(o,i()?Reflect.construct(a,l||[],s(o).constructor):a.apply(o,l))).name="TimeoutError",n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)}(t,e),n=t,Object.defineProperty(n,"prototype",{writable:!1}),n;var n}(o(Error)),u=function(e,t,n){return new Promise((function(r,o){if("number"!=typeof t||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t!==1/0){var i=setTimeout((function(){if("function"!=typeof n){var i="string"==typeof n?n:"Promise timed out after ".concat(t," milliseconds"),a=n instanceof Error?n:new c(i);"function"==typeof e.cancel&&e.cancel(),o(a)}else try{r(n())}catch(e){o(e)}}),t);l(e.then(r,o),(function(){clearTimeout(i)}))}else r(e)}))};e.exports=u,e.exports.default=u,e.exports.TimeoutError=c},3873:(e,t,n)=>{"use strict";var r=n(1274);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,a){if(a!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},6365:(e,t,n)=>{e.exports=n(3873)()},1274:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},9092:(e,t,n)=>{"use strict";function r(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);null!=e&&this.setState(e)}function o(e){this.setState(function(t){var n=this.constructor.getDerivedStateFromProps(e,t);return null!=n?n:null}.bind(this))}function i(e,t){try{var n=this.props,r=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,r)}finally{this.props=n,this.state=r}}function a(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");if("function"!=typeof e.getDerivedStateFromProps&&"function"!=typeof t.getSnapshotBeforeUpdate)return e;var n=null,a=null,s=null;if("function"==typeof t.componentWillMount?n="componentWillMount":"function"==typeof t.UNSAFE_componentWillMount&&(n="UNSAFE_componentWillMount"),"function"==typeof t.componentWillReceiveProps?a="componentWillReceiveProps":"function"==typeof t.UNSAFE_componentWillReceiveProps&&(a="UNSAFE_componentWillReceiveProps"),"function"==typeof t.componentWillUpdate?s="componentWillUpdate":"function"==typeof t.UNSAFE_componentWillUpdate&&(s="UNSAFE_componentWillUpdate"),null!==n||null!==a||null!==s){var l=e.displayName||e.name,c="function"==typeof e.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+l+" uses "+c+" but also contains the following legacy lifecycles:"+(null!==n?"\n  "+n:"")+(null!==a?"\n  "+a:"")+(null!==s?"\n  "+s:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks")}if("function"==typeof e.getDerivedStateFromProps&&(t.componentWillMount=r,t.componentWillReceiveProps=o),"function"==typeof t.getSnapshotBeforeUpdate){if("function"!=typeof t.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=i;var u=t.componentDidUpdate;t.componentDidUpdate=function(e,t,n){var r=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;u.call(this,e,t,r)}}return e}n.r(t),n.d(t,{polyfill:()=>a}),r.__suppressDeprecationWarning=!0,o.__suppressDeprecationWarning=!0,i.__suppressDeprecationWarning=!0},2781:(e,t,n)=>{"use strict";function r(e){return r="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},r(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.bodyOpenClassName=t.portalClassName=void 0;var o=Object.assign||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},i=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(1594),s=m(a),l=m(n(5206)),c=m(n(6365)),u=m(n(9463)),h=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(915)),f=n(9853),d=m(f),p=n(9092);function m(e){return e&&e.__esModule?e:{default:e}}function g(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==r(t)&&"function"!=typeof t?e:t}var y=t.portalClassName="ReactModalPortal",v=t.bodyOpenClassName="ReactModal__Body--open",b=f.canUseDOM&&void 0!==l.default.createPortal,x=function(e){return document.createElement(e)},w=function(){return b?l.default.createPortal:l.default.unstable_renderSubtreeIntoContainer};function k(e){return e()}var S=function(e){function t(){var e,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,a=Array(i),c=0;c<i;c++)a[c]=arguments[c];return n=r=g(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.removePortal=function(){!b&&l.default.unmountComponentAtNode(r.node);var e=k(r.props.parentSelector);e&&e.contains(r.node)?e.removeChild(r.node):console.warn('React-Modal: "parentSelector" prop did not returned any DOM element. Make sure that the parent element is unmounted to avoid any memory leaks.')},r.portalRef=function(e){r.portal=e},r.renderPortal=function(e){var n=w()(r,s.default.createElement(u.default,o({defaultStyles:t.defaultStyles},e)),r.node);r.portalRef(n)},g(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+r(t));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"componentDidMount",value:function(){f.canUseDOM&&(b||(this.node=x("div")),this.node.className=this.props.portalClassName,k(this.props.parentSelector).appendChild(this.node),!b&&this.renderPortal(this.props))}},{key:"getSnapshotBeforeUpdate",value:function(e){return{prevParent:k(e.parentSelector),nextParent:k(this.props.parentSelector)}}},{key:"componentDidUpdate",value:function(e,t,n){if(f.canUseDOM){var r=this.props,o=r.isOpen,i=r.portalClassName;e.portalClassName!==i&&(this.node.className=i);var a=n.prevParent,s=n.nextParent;s!==a&&(a.removeChild(this.node),s.appendChild(this.node)),(e.isOpen||o)&&!b&&this.renderPortal(this.props)}}},{key:"componentWillUnmount",value:function(){if(f.canUseDOM&&this.node&&this.portal){var e=this.portal.state,t=Date.now(),n=e.isOpen&&this.props.closeTimeoutMS&&(e.closesAt||t+this.props.closeTimeoutMS);n?(e.beforeClose||this.portal.closeWithTimeout(),setTimeout(this.removePortal,n-t)):this.removePortal()}}},{key:"render",value:function(){return f.canUseDOM&&b?(!this.node&&b&&(this.node=x("div")),w()(s.default.createElement(u.default,o({ref:this.portalRef,defaultStyles:t.defaultStyles},this.props)),this.node)):null}}],[{key:"setAppElement",value:function(e){h.setElement(e)}}]),t}(a.Component);S.propTypes={isOpen:c.default.bool.isRequired,style:c.default.shape({content:c.default.object,overlay:c.default.object}),portalClassName:c.default.string,bodyOpenClassName:c.default.string,htmlOpenClassName:c.default.string,className:c.default.oneOfType([c.default.string,c.default.shape({base:c.default.string.isRequired,afterOpen:c.default.string.isRequired,beforeClose:c.default.string.isRequired})]),overlayClassName:c.default.oneOfType([c.default.string,c.default.shape({base:c.default.string.isRequired,afterOpen:c.default.string.isRequired,beforeClose:c.default.string.isRequired})]),appElement:c.default.oneOfType([c.default.instanceOf(d.default),c.default.instanceOf(f.SafeHTMLCollection),c.default.instanceOf(f.SafeNodeList),c.default.arrayOf(c.default.instanceOf(d.default))]),onAfterOpen:c.default.func,onRequestClose:c.default.func,closeTimeoutMS:c.default.number,ariaHideApp:c.default.bool,shouldFocusAfterRender:c.default.bool,shouldCloseOnOverlayClick:c.default.bool,shouldReturnFocusAfterClose:c.default.bool,preventScroll:c.default.bool,parentSelector:c.default.func,aria:c.default.object,data:c.default.object,role:c.default.string,contentLabel:c.default.string,shouldCloseOnEsc:c.default.bool,overlayRef:c.default.func,contentRef:c.default.func,id:c.default.string,overlayElement:c.default.func,contentElement:c.default.func},S.defaultProps={isOpen:!1,portalClassName:y,bodyOpenClassName:v,role:"dialog",ariaHideApp:!0,closeTimeoutMS:0,shouldFocusAfterRender:!0,shouldCloseOnEsc:!0,shouldCloseOnOverlayClick:!0,shouldReturnFocusAfterClose:!0,preventScroll:!1,parentSelector:function(){return document.body},overlayElement:function(e,t){return s.default.createElement("div",e,t)},contentElement:function(e,t){return s.default.createElement("div",e,t)}},S.defaultStyles={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.75)"},content:{position:"absolute",top:"40px",left:"40px",right:"40px",bottom:"40px",border:"1px solid #ccc",background:"#fff",overflow:"auto",WebkitOverflowScrolling:"touch",borderRadius:"4px",outline:"none",padding:"20px"}},(0,p.polyfill)(S),t.default=S},9463:(e,t,n)=>{"use strict";function r(e){return r="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},r(e)}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||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},i="function"==typeof Symbol&&"symbol"===r(Symbol.iterator)?function(e){return r(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":r(e)},a=function(){function e(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,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(1594),l=y(n(6365)),c=g(n(6518)),u=y(n(2374)),h=g(n(915)),f=g(n(5553)),d=n(9853),p=y(d),m=y(n(6551));function g(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function y(e){return e&&e.__esModule?e:{default:e}}n(9574);var v={overlay:"ReactModal__Overlay",content:"ReactModal__Content"},b=0,x=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==r(t)&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.setOverlayRef=function(e){n.overlay=e,n.props.overlayRef&&n.props.overlayRef(e)},n.setContentRef=function(e){n.content=e,n.props.contentRef&&n.props.contentRef(e)},n.afterClose=function(){var e=n.props,t=e.appElement,r=e.ariaHideApp,o=e.htmlOpenClassName,i=e.bodyOpenClassName,a=e.parentSelector,s=a&&a().ownerDocument||document;i&&f.remove(s.body,i),o&&f.remove(s.getElementsByTagName("html")[0],o),r&&b>0&&0==(b-=1)&&h.show(t),n.props.shouldFocusAfterRender&&(n.props.shouldReturnFocusAfterClose?(c.returnFocus(n.props.preventScroll),c.teardownScopedFocus()):c.popWithoutFocus()),n.props.onAfterClose&&n.props.onAfterClose(),m.default.deregister(n)},n.open=function(){n.beforeOpen(),n.state.afterOpen&&n.state.beforeClose?(clearTimeout(n.closeTimer),n.setState({beforeClose:!1})):(n.props.shouldFocusAfterRender&&(c.setupScopedFocus(n.node),c.markForFocusLater()),n.setState({isOpen:!0},(function(){n.openAnimationFrame=requestAnimationFrame((function(){n.setState({afterOpen:!0}),n.props.isOpen&&n.props.onAfterOpen&&n.props.onAfterOpen({overlayEl:n.overlay,contentEl:n.content})}))})))},n.close=function(){n.props.closeTimeoutMS>0?n.closeWithTimeout():n.closeWithoutTimeout()},n.focusContent=function(){return n.content&&!n.contentHasFocus()&&n.content.focus({preventScroll:!0})},n.closeWithTimeout=function(){var e=Date.now()+n.props.closeTimeoutMS;n.setState({beforeClose:!0,closesAt:e},(function(){n.closeTimer=setTimeout(n.closeWithoutTimeout,n.state.closesAt-Date.now())}))},n.closeWithoutTimeout=function(){n.setState({beforeClose:!1,isOpen:!1,afterOpen:!1,closesAt:null},n.afterClose)},n.handleKeyDown=function(e){(function(e){return"Tab"===e.code||9===e.keyCode})(e)&&(0,u.default)(n.content,e),n.props.shouldCloseOnEsc&&function(e){return"Escape"===e.code||27===e.keyCode}(e)&&(e.stopPropagation(),n.requestClose(e))},n.handleOverlayOnClick=function(e){null===n.shouldClose&&(n.shouldClose=!0),n.shouldClose&&n.props.shouldCloseOnOverlayClick&&(n.ownerHandlesClose()?n.requestClose(e):n.focusContent()),n.shouldClose=null},n.handleContentOnMouseUp=function(){n.shouldClose=!1},n.handleOverlayOnMouseDown=function(e){n.props.shouldCloseOnOverlayClick||e.target!=n.overlay||e.preventDefault()},n.handleContentOnClick=function(){n.shouldClose=!1},n.handleContentOnMouseDown=function(){n.shouldClose=!1},n.requestClose=function(e){return n.ownerHandlesClose()&&n.props.onRequestClose(e)},n.ownerHandlesClose=function(){return n.props.onRequestClose},n.shouldBeClosed=function(){return!n.state.isOpen&&!n.state.beforeClose},n.contentHasFocus=function(){return document.activeElement===n.content||n.content.contains(document.activeElement)},n.buildClassName=function(e,t){var r="object"===(void 0===t?"undefined":i(t))?t:{base:v[e],afterOpen:v[e]+"--after-open",beforeClose:v[e]+"--before-close"},o=r.base;return n.state.afterOpen&&(o=o+" "+r.afterOpen),n.state.beforeClose&&(o=o+" "+r.beforeClose),"string"==typeof t&&t?o+" "+t:o},n.attributesFromObject=function(e,t){return Object.keys(t).reduce((function(n,r){return n[e+"-"+r]=t[r],n}),{})},n.state={afterOpen:!1,beforeClose:!1},n.shouldClose=null,n.moveFromContentToOverlay=null,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+r(t));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),a(t,[{key:"componentDidMount",value:function(){this.props.isOpen&&this.open()}},{key:"componentDidUpdate",value:function(e,t){this.props.isOpen&&!e.isOpen?this.open():!this.props.isOpen&&e.isOpen&&this.close(),this.props.shouldFocusAfterRender&&this.state.isOpen&&!t.isOpen&&this.focusContent()}},{key:"componentWillUnmount",value:function(){this.state.isOpen&&this.afterClose(),clearTimeout(this.closeTimer),cancelAnimationFrame(this.openAnimationFrame)}},{key:"beforeOpen",value:function(){var e=this.props,t=e.appElement,n=e.ariaHideApp,r=e.htmlOpenClassName,o=e.bodyOpenClassName,i=e.parentSelector,a=i&&i().ownerDocument||document;o&&f.add(a.body,o),r&&f.add(a.getElementsByTagName("html")[0],r),n&&(b+=1,h.hide(t)),m.default.register(this)}},{key:"render",value:function(){var e=this.props,t=e.id,n=e.className,r=e.overlayClassName,i=e.defaultStyles,a=e.children,s=n?{}:i.content,l=r?{}:i.overlay;if(this.shouldBeClosed())return null;var c={ref:this.setOverlayRef,className:this.buildClassName("overlay",r),style:o({},l,this.props.style.overlay),onClick:this.handleOverlayOnClick,onMouseDown:this.handleOverlayOnMouseDown},u=o({id:t,ref:this.setContentRef,style:o({},s,this.props.style.content),className:this.buildClassName("content",n),tabIndex:"-1",onKeyDown:this.handleKeyDown,onMouseDown:this.handleContentOnMouseDown,onMouseUp:this.handleContentOnMouseUp,onClick:this.handleContentOnClick,role:this.props.role,"aria-label":this.props.contentLabel},this.attributesFromObject("aria",o({modal:!0},this.props.aria)),this.attributesFromObject("data",this.props.data||{}),{"data-testid":this.props.testId}),h=this.props.contentElement(u,a);return this.props.overlayElement(c,h)}}]),t}(s.Component);x.defaultProps={style:{overlay:{},content:{}},defaultStyles:{}},x.propTypes={isOpen:l.default.bool.isRequired,defaultStyles:l.default.shape({content:l.default.object,overlay:l.default.object}),style:l.default.shape({content:l.default.object,overlay:l.default.object}),className:l.default.oneOfType([l.default.string,l.default.object]),overlayClassName:l.default.oneOfType([l.default.string,l.default.object]),parentSelector:l.default.func,bodyOpenClassName:l.default.string,htmlOpenClassName:l.default.string,ariaHideApp:l.default.bool,appElement:l.default.oneOfType([l.default.instanceOf(p.default),l.default.instanceOf(d.SafeHTMLCollection),l.default.instanceOf(d.SafeNodeList),l.default.arrayOf(l.default.instanceOf(p.default))]),onAfterOpen:l.default.func,onAfterClose:l.default.func,onRequestClose:l.default.func,closeTimeoutMS:l.default.number,shouldFocusAfterRender:l.default.bool,shouldCloseOnOverlayClick:l.default.bool,shouldReturnFocusAfterClose:l.default.bool,preventScroll:l.default.bool,role:l.default.string,contentLabel:l.default.string,aria:l.default.object,data:l.default.object,children:l.default.node,shouldCloseOnEsc:l.default.bool,overlayRef:l.default.func,contentRef:l.default.func,id:l.default.string,overlayElement:l.default.func,contentElement:l.default.func,testId:l.default.string},t.default=x,e.exports=t.default},915:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetState=function(){a&&(a.removeAttribute?a.removeAttribute("aria-hidden"):null!=a.length?a.forEach((function(e){return e.removeAttribute("aria-hidden")})):document.querySelectorAll(a).forEach((function(e){return e.removeAttribute("aria-hidden")}))),a=null},t.log=function(){},t.assertNodeList=s,t.setElement=function(e){var t=e;if("string"==typeof t&&i.canUseDOM){var n=document.querySelectorAll(t);s(n,t),t=n}return a=t||a},t.validateElement=l,t.hide=function(e){var t=!0,n=!1,r=void 0;try{for(var o,i=l(e)[Symbol.iterator]();!(t=(o=i.next()).done);t=!0)o.value.setAttribute("aria-hidden","true")}catch(e){n=!0,r=e}finally{try{!t&&i.return&&i.return()}finally{if(n)throw r}}},t.show=function(e){var t=!0,n=!1,r=void 0;try{for(var o,i=l(e)[Symbol.iterator]();!(t=(o=i.next()).done);t=!0)o.value.removeAttribute("aria-hidden")}catch(e){n=!0,r=e}finally{try{!t&&i.return&&i.return()}finally{if(n)throw r}}},t.documentNotReadyOrSSRTesting=function(){a=null};var r,o=(r=n(1392))&&r.__esModule?r:{default:r},i=n(9853),a=null;function s(e,t){if(!e||!e.length)throw new Error("react-modal: No elements were found for selector "+t+".")}function l(e){var t=e||a;return t?Array.isArray(t)||t instanceof HTMLCollection||t instanceof NodeList?t:[t]:((0,o.default)(!1,["react-modal: App element is not defined.","Please use `Modal.setAppElement(el)` or set `appElement={el}`.","This is needed so screen readers don't see main content","when modal is opened. It is not recommended, but you can opt-out","by setting `ariaHideApp={false}`."].join(" ")),[])}},9574:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetState=function(){for(var e=[i,a],t=0;t<e.length;t++){var n=e[t];n&&n.parentNode&&n.parentNode.removeChild(n)}i=a=null,s=[]},t.log=function(){console.log("bodyTrap ----------"),console.log(s.length);for(var e=[i,a],t=0;t<e.length;t++){var n=e[t]||{};console.log(n.nodeName,n.className,n.id)}console.log("edn bodyTrap ----------")};var r,o=(r=n(6551))&&r.__esModule?r:{default:r},i=void 0,a=void 0,s=[];function l(){0!==s.length&&s[s.length-1].focusContent()}o.default.subscribe((function(e,t){i||a||((i=document.createElement("div")).setAttribute("data-react-modal-body-trap",""),i.style.position="absolute",i.style.opacity="0",i.setAttribute("tabindex","0"),i.addEventListener("focus",l),(a=i.cloneNode()).addEventListener("focus",l)),(s=t).length>0?(document.body.firstChild!==i&&document.body.insertBefore(i,document.body.firstChild),document.body.lastChild!==a&&document.body.appendChild(a)):(i.parentElement&&i.parentElement.removeChild(i),a.parentElement&&a.parentElement.removeChild(a))}))},5553:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetState=function(){var e=document.getElementsByTagName("html")[0];for(var t in n)o(e,n[t]);var i=document.body;for(var a in r)o(i,r[a]);n={},r={}},t.log=function(){};var n={},r={};function o(e,t){e.classList.remove(t)}t.add=function(e,t){return o=e.classList,i="html"==e.nodeName.toLowerCase()?n:r,void t.split(" ").forEach((function(e){!function(e,t){e[t]||(e[t]=0),e[t]+=1}(i,e),o.add(e)}));var o,i},t.remove=function(e,t){return o=e.classList,i="html"==e.nodeName.toLowerCase()?n:r,void t.split(" ").forEach((function(e){!function(e,t){e[t]&&(e[t]-=1)}(i,e),0===i[e]&&o.remove(e)}));var o,i}},6518:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetState=function(){i=[]},t.log=function(){},t.handleBlur=l,t.handleFocus=c,t.markForFocusLater=function(){i.push(document.activeElement)},t.returnFocus=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=null;try{return void(0!==i.length&&(t=i.pop()).focus({preventScroll:e}))}catch(e){console.warn(["You tried to return focus to",t,"but it is not in the DOM anymore"].join(" "))}},t.popWithoutFocus=function(){i.length>0&&i.pop()},t.setupScopedFocus=function(e){a=e,window.addEventListener?(window.addEventListener("blur",l,!1),document.addEventListener("focus",c,!0)):(window.attachEvent("onBlur",l),document.attachEvent("onFocus",c))},t.teardownScopedFocus=function(){a=null,window.addEventListener?(window.removeEventListener("blur",l),document.removeEventListener("focus",c)):(window.detachEvent("onBlur",l),document.detachEvent("onFocus",c))};var r,o=(r=n(1602))&&r.__esModule?r:{default:r},i=[],a=null,s=!1;function l(){s=!0}function c(){if(s){if(s=!1,!a)return;setTimeout((function(){a.contains(document.activeElement)||((0,o.default)(a)[0]||a).focus()}),0)}}},6551:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.log=function(){console.log("portalOpenInstances ----------"),console.log(r.openInstances.length),r.openInstances.forEach((function(e){return console.log(e)})),console.log("end portalOpenInstances ----------")},t.resetState=function(){r=new n};var n=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.register=function(e){-1===t.openInstances.indexOf(e)&&(t.openInstances.push(e),t.emit("register"))},this.deregister=function(e){var n=t.openInstances.indexOf(e);-1!==n&&(t.openInstances.splice(n,1),t.emit("deregister"))},this.subscribe=function(e){t.subscribers.push(e)},this.emit=function(e){t.subscribers.forEach((function(n){return n(e,t.openInstances.slice())}))},this.openInstances=[],this.subscribers=[]},r=new n;t.default=r},9853:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.canUseDOM=t.SafeNodeList=t.SafeHTMLCollection=void 0;var r,o=((r=n(3948))&&r.__esModule?r:{default:r}).default,i=o.canUseDOM?window.HTMLElement:{};t.SafeHTMLCollection=o.canUseDOM?window.HTMLCollection:{},t.SafeNodeList=o.canUseDOM?window.NodeList:{},t.canUseDOM=o.canUseDOM,t.default=i},2374:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=(0,o.default)(e);if(n.length){var r=void 0,a=t.shiftKey,s=n[0],l=n[n.length-1],c=i();if(e===c){if(!a)return;r=l}if(l!==c||a||(r=s),s===c&&a&&(r=l),r)return t.preventDefault(),void r.focus();var u=/(\bChrome\b|\bSafari\b)\//.exec(navigator.userAgent);if(null!=u&&"Chrome"!=u[1]&&null==/\biPod\b|\biPad\b/g.exec(navigator.userAgent)){var h=n.indexOf(c);if(h>-1&&(h+=a?-1:1),void 0===(r=n[h]))return t.preventDefault(),void(r=a?l:s).focus();t.preventDefault(),r.focus()}}else t.preventDefault()};var r,o=(r=n(1602))&&r.__esModule?r:{default:r};function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;return e.activeElement.shadowRoot?i(e.activeElement.shadowRoot):e.activeElement}e.exports=t.default},1602:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(t){return[].slice.call(t.querySelectorAll("*"),0).reduce((function(t,n){return t.concat(n.shadowRoot?e(n.shadowRoot):[n])}),[]).filter(a)};var n="none",r="contents",o=/input|select|textarea|button|object|iframe/;function i(e){var t=e.offsetWidth<=0&&e.offsetHeight<=0;if(t&&!e.innerHTML)return!0;try{var o=window.getComputedStyle(e),i=o.getPropertyValue("display");return t?i!==r&&function(e,t){return"visible"!==t.getPropertyValue("overflow")||e.scrollWidth<=0&&e.scrollHeight<=0}(e,o):i===n}catch(e){return console.warn("Failed to inspect element style"),!1}}function a(e){var t=e.getAttribute("tabindex");null===t&&(t=void 0);var n=isNaN(t);return(n||t>=0)&&function(e,t){var n=e.nodeName.toLowerCase();return(o.test(n)&&!e.disabled||"a"===n&&e.href||t)&&function(e){for(var t=e,n=e.getRootNode&&e.getRootNode();t&&t!==document.body;){if(n&&t===n&&(t=n.host.parentNode),i(t))return!1;t=t.parentNode}return!0}(e)}(e,!n)}e.exports=t.default},8187:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=(r=n(2781))&&r.__esModule?r:{default:r};t.default=o.default,e.exports=t.default},1392:e=>{"use strict";e.exports=function(){}},2564:(e,t,n)=>{"use strict";n.d(t,{A:()=>h,z:()=>c});var r,o,i,a=n(3185),s={white:"white",black:"black",blue:"hsl(204.25deg 100% 36.47%)",green:"hsl(165deg 100% 34.51%)",red:"hsl(22, 100%, 36%)",orange:"hsl(36deg 73.28% 54.51%)",yellow:"hsl(44.43deg 77.41% 53.14%)",purple:"hsl(270, 38%, 59%)",gray30:"hsl(200deg 10.45% 26.27%)",gray60:"hsl(200deg 10.45% 60%)",gray98:"hsl(0deg 0% 98%)"},l=(0,a.DU)(r||(o=["\n  :root {\n    // Base colors\n    --neko-blue: ",";\n    --neko-white: ",";\n    --neko-black: ",";\n    --neko-purple: ",";\n    --neko-orange: ",";\n    --neko-yellow: ",";\n    --neko-green: ",";\n    --neko-red: ",";\n\n    // Main color\n    --neko-main-color: var(--neko-blue);\n\n    // Variants\n    --neko-success: var(--neko-blue);\n    --neko-primary: var(--neko-main-color);\n    --neko-secondary: #EBF3FF; // TODO: This needs to be updated to a proper color\n    --neko-danger: var(--neko-red);\n\n    // Base styles\n    --neko-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n    --neko-font-size: 13px; \n    --neko-small-font-size: 12px; \n    --neko-h1-font-size: 23px;\n    --neko-h2-font-size: 20px;\n    --neko-h3-font-size: 18px;\n    --neko-h4-font-size: 16px;\n    --neko-h5-font-size: 14px;\n    --neko-font-color: var(--neko-gray-30);\n\n    // Gray shades\n    --neko-gray-30: ",";\n    --neko-gray-60: ",";\n    --neko-gray-98: ",";\n    --neko-wp-background-color: #f0f0f1;\n\n    // Main color shades\n    --neko-main-overlay-color: rgb(30 124 186 / 85%);\n    --neko-main-color-10: hsl(206deg 100% 22.35%);\n    --neko-main-color-50: hsl(206deg 61.04% 54.71%);\n    --neko-main-color-80: hsl(206deg 55.93% 88.43%);\n    --neko-main-color-98: hsl(200deg 100% 98.82%);\n\n    // Neko UI\n    --neko-background-color: var(--neko-wp-background-color);\n    --neko-disabled-color: var(--neko-gray-60);\n    --neko-main-color-alternative: var(--neko-main-color-10);\n    --neko-main-color-disabled: var(--neko-main-color-50);\n    --neko-input-background: var(--neko-main-color-98);\n    --neko-input-border: var(--neko-main-color-80);\n  }\n"],i||(i=o.slice(0)),r=Object.freeze(Object.defineProperties(o,{raw:{value:Object.freeze(i)}}))),s.blue,s.white,s.black,s.purple,s.orange,s.yellow,s.green,s.red,s.gray30,s.gray60,s.gray98),c=function(){return{colors:s}},u=function(e){var t=e.children;return React.createElement(React.Fragment,null,React.createElement(l,{key:"neko-ui-styles"}),t)};const h=function(e){var t=e.children;return React.createElement(u,null,t)}},9296:(e,t,n)=>{"use strict";n.d(t,{M:()=>x});var r,o=n(1594),i=n(6365),a=n.n(i),s=n(3185),l=n(5977),c=n(6087),u=n(8922),h=n(1329),f=n(6897),d=["className","disabled","icon","color","onClick","rounded","isBusy","spinning","disabledColor","busyText","hideBusyIcon","busyIconSize","requirePro","isPro","small","width","height","fullWidth","startTime","children"];function p(){return p=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},p.apply(this,arguments)}function m(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 g,y,v=(0,s.Ay)((function(e){var t=e.className,n=void 0===t?"primary":t,r=e.disabled,i=void 0!==r&&r,a=e.icon,s=void 0===a?null:a,l=e.color,g=void 0===l?null:l,y=e.onClick,v=void 0===y?function(){}:y,b=e.rounded,x=e.isBusy,w=void 0!==x&&x,k=e.spinning,S=void 0!==k&&k,O=(e.disabledColor,e.busyText),_=e.hideBusyIcon,E=void 0!==_&&_,C=e.busyIconSize,A=e.requirePro,j=void 0!==A&&A,P=e.isPro,M=void 0!==P&&P,R=e.small,T=e.width,L=(e.height,e.fullWidth),I=e.startTime,N=void 0===I?null:I,z=e.children,D=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,d);i=i&&!w;var F,B,$=!!s,H=j&&!M,W=(0,o.useMemo)((function(){var e=null!=T?T:30;return b?e-10:e-6}),[T,b]),q=(0,o.useMemo)((function(){return C||"22px"}),[C]),V=(F=(0,o.useState)(null),B=2,function(e){if(Array.isArray(e))return e}(F)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(F,B)||function(e,t){if(e){if("string"==typeof e)return m(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)?m(e,t):void 0}}(F,B)||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.")}()),U=V[0],K=V[1];(0,f.$$)((function(){return K(new Date)}),N?1e3:null),(0,o.useEffect)((function(){N||K(null)}),[N]);var Q=(0,o.useMemo)((function(){if(!N||!U)return null;var e=Math.floor((U-N)/1e3),t=Math.floor(e/60),n=e%60;return"".concat(t.toString().padStart(2,"0"),":").concat(n.toString().padStart(2,"0"))}),[U,N]),G=(0,f.gR)("neko-button",n,{"has-icon":$},{"custom-color":g},{small:R},{rounded:b},{busy:w},{"is-pro":H},{full:L});return React.createElement("button",p({type:"button",className:G,onClick:function(e){i||v(),e.stopPropagation(),e.preventDefault()},disabled:i||H},D),w&&!E&&React.createElement(React.Fragment,null,React.createElement(c.X,{type:"circle",color:"#fff",size:q})),w&&Q&&React.createElement("span",{className:"chrono-time"},Q),w&&!!O&&React.createElement("span",{style:{marginLeft:E?0:"4px",marginRight:"2px"}},O),$&&!w&&React.createElement(u.z,{raw:!0,icon:s,width:W,height:W,spinning:S,style:b?{margin:"0 auto"}:{}}),!!z&&!w&&React.createElement("span",{style:{marginLeft:$?"4px":0,marginRight:$?"2px":0}},z),H&&React.createElement(h.K,{style:{marginLeft:"8px"}}))}))(r||(g=["\n  display: inline-flex;\n  align-items: center;\n  justify-content: center;\n  box-sizing: border-box;\n  height: 30px;\n  min-height: 30px;\n  min-width: 40px;\n  border: none;\n  border-radius: 4px;\n  text-align: center;\n  padding: 0 15px;\n  vertical-align: middle;\n  background-color: var(--neko-main-color);\n  color: white;\n\n  span {\n    white-space: nowrap;\n    text-overflow: ellipsis;\n    display: flex;\n    align-items: center;\n  }\n\n  .chrono-time {\n    font-size: 11px;\n    margin-left: 5px;\n  }\n\n  &:not([disabled]):hover {\n    cursor: pointer;\n    background-image: none;\n    filter: brightness(1.1);\n  }\n\n  &:disabled {\n    opacity: 0.35;\n  }\n\n  &:focus {\n    outline: none;\n  }\n\n  &.is-pro {\n    background-image: none;\n    background-color: var(--neko-main-color-disabled);\n    rgb(255 255 255 / 65%);\n    align-items: center;\n    opacity: 1;\n  }\n\n  &.has-icon {\n    align-items: center;\n    padding: 2.5px 8px;\n\n    svg {\n      color: white;\n    }\n  }\n\n  &.secondary {\n    background-image: none;\n    background-color: var(--neko-secondary);\n    color: var(--neko-main-color);\n    border: 1px solid var(--neko-input-border);\n\n    svg {\n      color: var(--neko-main-color);\n    }\n\n    &:hover {\n      background-color: var(--neko-secondary);\n      border: 1px solid var(--neko-input-border);\n      filter: brightness(1.025);\n    }\n  }\n\n  &.danger {\n    background-image: none;\n    background-color: var(--neko-danger);\n    border-color: var(--neko-danger);\n  }\n\n  &.success {\n    background-image: none;\n    background-color: var(--neko-green);\n    border-color: var(--neko-green);\n\n    &:hover {\n      background-color: var(--neko-lighten-green);\n    }\n  }\n\n  & + button {\n    margin-left: .25rem;\n  }\n\n  &.small {\n    font-size: var(--neko-small-font-size);\n    height: 24px;\n    min-height: 24px;\n  }\n\n  &.header {\n    background-image: none;\n    filter: brightness(1.1);\n    background-color: var(--neko-main-color);\n    height: 40px;\n    padding: 0 20px;\n\n    &:hover {\n      background-color: var(--neko-main-color);\n      filter: brightness(1.2);\n    }\n  }\n\n  &.rounded {\n    border-radius: 100%;\n    min-width: 30px;\n    height: ","px;\n    width: ","px;\n    padding: 3px;\n  }\n\n  &.busy {\n    pointer-events: none;\n  }\n\n  &.full {\n    width: 100%;\n  }\n\n  ","\n"],y||(y=g.slice(0)),r=Object.freeze(Object.defineProperties(g,{raw:{value:Object.freeze(y)}}))),(function(e){var t,n;return null!==(t=e.height)&&void 0!==t?t:null!==(n=e.width)&&void 0!==n?n:30}),(function(e){var t;return null!==(t=e.width)&&void 0!==t?t:30}),(function(e){return b(e.color)})),b=function(e){if(e)return"\n      &.custom-color {\n        background-color: ".concat(e,";\n        border: 1px solid ").concat(e,";\n\n        &:hover {\n          background-color: ").concat(e,";\n          filter: brightness(1.1);\n        }\n      }\n    ")},x=function(e){return React.createElement(v,e)};x.propTypes={className:a().oneOf(["primary","primary-block","secondary","danger","success","header"]),disabled:a().bool,icon:a().oneOfType([a().instanceOf(l.In),a().oneOf(["setting","edit","trash"])]),color:a().string,onClick:a().func.isRequired,rounded:a().bool,isBusy:a().bool,spinning:a().bool,busyText:a().string,hideBusyIcon:a().bool,busyIconSize:a().string,requirePro:a().bool,isPro:a().bool,disabledColor:a().string}},2557:(e,t,n)=>{"use strict";n.d(t,{A:()=>p});var r=n(1594),o=n.n(r),i=n(6365),a=n.n(i),s=n(6897);function l(e){return l="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},l(e)}function c(){return c=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},c.apply(this,arguments)}function u(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 h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(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"!=l(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==l(t)?t:String(t)}(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)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function f(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 d=function(e){var t,n,i=e.spinner,a=void 0===i||i,l=e.busy,u=void 0!==l&&l,d=e.overlayStyle,p=(t=(0,r.useState)(!0),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return f(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)?f(e,t):void 0}}(t,n)||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.")}()),m=p[0],g=p[1];(0,r.useEffect)((function(){var e;return u?g(!0):e=setTimeout((function(){g(!1),e=null}),250),function(){e&&clearTimeout(e)}}),[u]);var y=(0,s.gR)("neko-overlay",{overlayHidden:!u}),v=m?o().createElement(o().Fragment,null,o().createElement("div",{className:y,style:d},Boolean(a)&&o().createElement("div",{className:"lds-ellipsis "+(u?"":"spinnerHidden")},o().createElement("div",null),o().createElement("div",null),o().createElement("div",null),o().createElement("div",null))),o().createElement("style",{jsx:"true"},"\n        .neko-overlay {\n          position: absolute;\n          top: 0;\n          left: 0;\n          bottom: 0;\n          width: 100%;\n          height: 100%;\n          background: var(--neko-main-overlay-color);\n          border-radius: 8px;\n          transition: opacity 1s ease-out;\n          z-index: 10;\n          display: flex;\n          align-items: center;\n          flex-direction: column;\n          justify-content: center;\n          overflow: hidden;\n        }\n\n        .overlayHidden {\n          opacity: 0;\n          transition: opacity 0.25s ease-out;\n        }\n        .spinnerHidden {\n          opacity: 0;\n          transition: opacity 0.25s ease-out;\n        }\n        .lds-ellipsis {\n          position: relative;\n          width: 80px;\n          height: 80px;\n          display: flex;\n          justify-items: center;\n          align-items: center;\n        }\n        .lds-ellipsis div {\n          position: absolute;\n          width: 13px;\n          height: 13px;\n          border-radius: 50%;\n          background: white;\n          animation-timing-function: cubic-bezier(0, 1, 1, 0);\n        }\n        .lds-ellipsis div:nth-child(1) {\n          left: 8px;\n          animation: lds-ellipsis1 0.6s infinite;\n        }\n        .lds-ellipsis div:nth-child(2) {\n          left: 8px;\n          animation: lds-ellipsis2 0.6s infinite;\n        }\n        .lds-ellipsis div:nth-child(3) {\n          left: 32px;\n          animation: lds-ellipsis2 0.6s infinite;\n        }\n        .lds-ellipsis div:nth-child(4) {\n          left: 56px;\n          animation: lds-ellipsis3 0.6s infinite;\n        }\n        @keyframes lds-ellipsis1 {\n          0% {\n            transform: scale(0);\n          }\n          100% {\n            transform: scale(1);\n          }\n        }\n        @keyframes lds-ellipsis3 {\n          0% {\n            transform: scale(1);\n          }\n          100% {\n            transform: scale(0);\n          }\n        }\n        @keyframes lds-ellipsis2 {\n          0% {\n            transform: translate(0, 0);\n          }\n          100% {\n            transform: translate(24px, 0);\n          }\n        }\n      ")):null,b=h(h({},e),{},{busy:void 0,spinner:void 0});return o().createElement("div",c({style:{position:"relative"}},b),v,e.children)};d.propTypes={busy:a().bool.isRequired,spinner:a().bool,children:a().oneOfType([a().arrayOf(a().node),a().node]).isRequired};const p=d},5263:(e,t,n)=>{"use strict";n.d(t,{R:()=>y});var r,o=n(1594),i=n.n(o),a=n(6365),s=n.n(a),l=n(3185),c=n(1329),u=n(6087),h=n(6897),f=["name","checked","indeterminate","onChange","label","description","isPro","disabled","requirePro","isBusy","small"];function d(){return d=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},d.apply(this,arguments)}var p,m,g=l.Ay.div(r||(p=["\n  user-select: none;\n  transition: color 0.3s ease;\n\n  &.disabled {\n    color: var(--neko-disabled-color);\n\n    .neko-content {\n      cursor: default;\n    }\n\n    .neko-checkbox-check-container, .neko-label, .description {\n      opacity: 0.35;\n    }\n  }\n\n  input {\n    display: none;\n  }\n\n  .neko-content {\n    cursor: pointer;\n    display: flex;\n  }\n\n  .neko-checkbox-check-container {\n    display: flex;\n    padding-top: 2px;\n    align-content: center;\n\n    .neko-checkbox-busy-container {\n      position: relative;\n    }\n  }\n\n  .neko-checkbox-inner-container {\n    margin-left: 6px;\n\n    .neko-label-container {\n      display: flex;\n      margin-top: 5px;\n\n      .neko-label {\n        display: block;\n        ","\n      }\n    }\n\n    .neko-content {\n      display: block;\n      font-size: var(--neko-font-size);\n      line-height: 28px;\n    }\n\n    .description {\n      display: block;\n      font-size: var(--neko-small-font-size);\n      margin-top: 1px;\n      line-height: 14px;\n      color: var(--neko-gray-60);\n\n      * {\n        font-size: var(--neko-small-font-size);\n        line-height: inherit;\n        margin: 0;\n      }\n    }\n  }\n\n  .neko-checkbox {\n    width: 22px;\n    height: 22px;\n    border: 2px solid var(--neko-input-border);\n    border-radius: 5px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    position: relative;\n\n    .neko-checked-mark {\n      position: absolute;\n      opacity: 0;\n      transition: opacity 0.2s ease-in-out;\n      transform: rotate(45deg);\n      transform-origin: center;\n      margin-top: -8%;\n      height: 45%;\n      width: 18%;\n      border-bottom: 2.5px solid white;\n      border-right: 2.5px solid white;\n    }\n\n    &.small {\n      width: 20px;\n      height: 20px;\n      border: 2px solid var(--neko-input-border);\n      border-radius: 8px;\n\n      .neko-checked-mark {\n        border-bottom-width: 1.5px;\n        border-right-width: 1.5px;\n      }\n    }\n\n    .neko-indeterminate-mark {\n      position: absolute;\n      opacity: 0;\n      transition: opacity 0.2s ease-in-out;\n      width: 50%;\n      border-bottom: 1.5px solid white;\n      border-right: 1.5px solid white;\n    }\n\n    &.disabled {\n      border: 1.5px solid var(--neko-disabled-color);\n      cursor: not-allowed;\n      filter: grayscale(1);\n    }\n  }\n\n  .neko-checked {\n    border: 2px solid var(--neko-main-color);\n\n    &.neko-checkbox {\n      background-color: var(--neko-main-color);\n\n      .neko-checked-mark {\n        opacity: 1;\n      }\n    }\n  }\n\n  .neko-indeterminate {\n    &.neko-checkbox {\n      background-color: var(--neko-main-color);\n\n      .neko-indeterminate-mark {\n        opacity: 1;\n      }\n    }\n  }\n\n  &:hover {\n    .neko-checkbox {\n      ","\n    }\n\n    ","\n    }\n  }\n"],m||(m=p.slice(0)),r=Object.freeze(Object.defineProperties(p,{raw:{value:Object.freeze(m)}}))),(function(e){var t=e.checked;return!e.disabled&&t?"color: var(--neko-main-color); font-weight: 600;":""}),(function(e){var t=e.checked;return!e.disabled&&t?"filter: brightness(1.1);":""}),(function(e){var t=e.checked;return e.disabled||t?"":"border-color: var(--neko-main-color);"})),y=function(e){var t=e.name,n=e.checked,r=void 0!==n&&n,o=e.indeterminate,a=void 0!==o&&o,s=e.onChange,l=e.label,p=e.description,m=e.isPro,y=void 0!==m&&m,v=e.disabled,b=e.requirePro,x=void 0!==b&&b,w=e.isBusy,k=void 0!==w&&w,S=e.small,O=void 0!==S&&S,_=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,f),E=x&&!y,C=v||E,A=(0,h.gR)("neko-checkbox",e.className,{disabled:C},{small:O}),j=(0,h.gR)("neko-checkbox",{disabled:C,"neko-checked":r,"neko-indeterminate":a,small:O}),P=(0,h.gR)("neko-checked-mark"),M=(0,h.gR)("neko-indeterminate-mark");return i().createElement(g,d({className:A,checked:r,disabled:C,onClick:function(e){return e.stopPropagation()}},_),i().createElement("div",{className:"neko-checkbox-container"},i().createElement("div",{className:"neko-content",onClick:function(n){C||(s?s(!r,t,n):console.log("The onChange handler is not set for the NekoCheckbox.",e))}},i().createElement("div",{className:"neko-checkbox-check-container"},k&&i().createElement("div",{className:"neko-checkbox-busy-container"},i().createElement("div",{className:j},i().createElement(u.X,{type:"circle",size:"16px"}))),!k&&i().createElement(i().Fragment,null,i().createElement("div",{className:j},i().createElement("div",{className:P}),i().createElement("div",{className:M})))),(l||E||p)&&i().createElement("div",{className:"neko-checkbox-inner-container"},i().createElement("span",{className:"neko-label-container"},i().createElement("span",{className:"neko-label"},l),i().createElement(c.K,{className:"inline",show:E,style:{position:"relative",top:-1}})),p?i().createElement("small",{className:"description"},p):null))))};y.propTypes={name:s().string,checked:s().bool,label:s().string,description:s().string,isPro:s().bool,requirePro:s().bool,isBusy:s().bool,small:s().bool}},4536:(e,t,n)=>{"use strict";n.d(t,{E:()=>h});var r,o,i,a=n(1594),s=n.n(a),l=n(6365),c=n.n(l),u=(0,n(3185).Ay)((function(e){var t=e.name,n=(e.max,e.isPro),r=void 0!==n&&n;return s().Children.map(e.children,(function(e){return e.props.name?e:s().cloneElement(e,{name:t,isPro:r})}))}))(r||(o=["\n"],i||(i=o.slice(0)),r=Object.freeze(Object.defineProperties(o,{raw:{value:Object.freeze(i)}})))),h=function(e){return s().createElement(u,e)};h.propTypes={name:c().string,max:c().number,isPro:c().bool}},8696:(e,t,n)=>{"use strict";n.d(t,{A:()=>b});var r,o=n(1594),i=n.n(o),a=n(6365),s=n.n(a),l=n(3185),c=n(8922),u=n(6897),h=["type","name","value","description","placeholder","onChange","onEnter","onBlur","onFinalChange","readOnly","step","min","max","maxLength","natural","onReset","isCommaSeparatedArray","className","style","inputStyle"];function f(){return f=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},f.apply(this,arguments)}function d(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 p,m,g=function(e){return e.split(",").map((function(e){return e.trim()})).filter((function(e){return e.length>0}))},y=function(e,t){var n,r,a=e.type,s=void 0===a?"text":a,l=e.name,p=e.value,m=void 0===p?"":p,y=e.description,v=e.placeholder,b=void 0===v?"":v,x=e.onChange,w=e.onEnter,k=e.onBlur,S=e.onFinalChange,O=e.readOnly,_=void 0!==O&&O,E=e.step,C=void 0===E?1:E,A=e.min,j=void 0===A?0:A,P=e.max,M=void 0===P?null:P,R=e.maxLength,T=e.natural,L=void 0!==T&&T,I=e.onReset,N=e.isCommaSeparatedArray,z=void 0!==N&&N,D=e.className,F=e.style,B=e.inputStyle,$=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,h),H=(n=(0,o.useState)(m||0===m?m:""),r=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(n,r)||function(e,t){if(e){if("string"==typeof e)return d(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)?d(e,t):void 0}}(n,r)||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.")}()),W=H[0],q=H[1],V=!!x,U=R||("number"===s?3:void 0);(0,o.useEffect)((function(){S&&(w||k)&&console.warn("NekoInput: Since onFinalChange is used, onEnter and onBlur are redundant.")}),[S,w,k]),(0,o.useEffect)((function(){var e;V||q(z?(e=m,Array.isArray(e)||(console.warn("The provided value is not an array. Falling back to an empty array."),e=[]),e.join(", ")):m)}),[m]);var K=function(e){var t=e.target.value,n=z?g(t):t;e.stopPropagation(),e.preventDefault(),V?x(n,l):q(t)},Q=function(e){if("Enter"===e.key){e.preventDefault();var t=e.target.value,n=z?g(t):t;S?S(n,l):w&&w(n,l)}},G=function(e){var t=e.target.value,n=z?g(t):t;(z?function(e,t){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(m,n):m===n)||(S?S(n,l):k&&k(n,l))},Y=(0,u.gR)("neko-input",{natural:L});return i().createElement("div",{className:D,style:F},i().createElement("div",{style:{position:"relative"}},"number"===s?i().createElement("input",f({ref:t,className:Y,name:l,value:V?m:W,type:s,disabled:_,step:C,min:j,max:M,maxLength:U,autoComplete:"off","data-form-type":"other",placeholder:b,style:B,onChange:K,onKeyPress:Q,onBlur:function(e){!function(e){var t=Number(e.target.value);j&&t<Number(j)?e.target.value=j:M&&t>Number(M)&&(e.target.value=M)}(e),G(e)},readOnly:_},$)):i().createElement("input",f({ref:t,className:Y},$,{name:l,value:V?m:W,type:s,disabled:_,spellCheck:"false",autoComplete:"off","data-form-type":"other",placeholder:b,style:B,maxLength:U,onChange:K,onKeyPress:Q,onBlur:G,readOnly:_},$)),!!m&&!!I&&i().createElement(c.z,{icon:"close",width:24,style:{position:"absolute",top:"3px",right:"3px"},variant:"blue",onClick:function(){return I()}})),y&&i().createElement("p",{className:"neko-input-description"},y))},v=(0,l.Ay)((0,o.forwardRef)(y))(r||(p=["\n  .neko-input {\n    font-family: var(--neko-font-family);\n    font-size: var(--neko-font-size);\n    border: 1.5px solid var(--neko-input-border);\n    box-sizing: border-box;\n    height: 30px;\n    background: var(--neko-input-background);\n    color: black;\n    padding: 0 10px;\n    width: 100%;\n    transition: background 0.3s ease;\n\n    &.natural {\n      border-color: gray;\n      border-width: 1px;\n    }\n\n    &:placeholder {\n      color: rgba(0, 0, 0, 0.25);\n    }\n\n    &:focus {\n      background-color: white;\n    }\n\n    &:read-only {\n      color: var(--neko-gray-60);\n    }\n\n    &:disabled {\n      color: var(--neko-gray-60);\n      background: var(--neko-gray-98);\n      border: none;\n      box-shadow: none;\n    }\n  }\n\n  .neko-input-description {\n    font-size: var(--neko-small-font-size);\n    color: var(--neko-gray-60);\n    line-height: 14px;\n    margin-top: 5px;\n    margin-bottom: 0;\n  }\n"],m||(m=p.slice(0)),r=Object.freeze(Object.defineProperties(p,{raw:{value:Object.freeze(m)}})))),b=i().forwardRef((function(e,t){return i().createElement(v,f({ref:t},e))}));b.propTypes={type:s().oneOf(["number","text"]),name:s().string,value:s().oneOfType([s().string,s().array]),description:s().string,placeholder:s().string,onChange:s().func,onEnter:s().func,onBlur:s().func,onFinalChange:s().func,readOnly:s().bool,step:s().number,min:s().number,max:s().number,maxLength:s().number,natural:s().bool,onReset:s().func,isCommaSeparatedArray:s().bool}},4677:(e,t,n)=>{"use strict";n.d(t,{j:()=>$,u:()=>B});var r,o,i,a,s,l,c,u=n(1594),h=n.n(u),f=n(6365),d=n.n(f),p=n(1329),m=n(6897),g=n(6087),y=n(5977),v=n(2027),b=n(6761),x=n(4555),w=n(6382),k=n(8922),S=n(8696),O=n(374),_=n(3185);function E(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var C=_.Ay.div(r||(r=E(["\n  border-radius: 8px;\n  user-select: none;\n  cursor: pointer;\n  transition: background 0.3s ease, color 0.3s ease;\n  color: black;\n\n  .neko-select-option-label {\n    overflow: hidden;\n    height: 100%;\n    display: flex;\n    align-items: center;\n  }\n\n  &.show-options {\n    border-radius: 8px 8px 0 0;\n  }\n\n  &[data-is-disabled=true], &.disabled {\n    cursor: none;\n    pointer-events: none;\n    color: var(--neko-gray-60);\n\n    .neko-select-option {\n      pointer-events: none;\n      background: var(--neko-gray-98);\n      border-color: var(--neko-gray-60);\n    }\n  }\n\n  &.neko-dropdown-up {\n    background: red !important;\n  }\n"]))),A=_.Ay.div(o||(o=E(["\n  align-items: center;\n  background-color: var(--neko-input-background);\n  border: 1.5px solid var(--neko-input-border);\n  border-radius: 8px;\n  display: flex;\n  font-size: var(--neko-font-size); \n  padding: 0 5px 0 10px;\n  box-sizing: border-box;\n  height: 30px;\n\n  &.isBusy {\n    padding-left: 5px;\n  }\n\n  .rightContent {\n    align-items: center;\n    display: flex;\n    margin-left: auto;\n  }\n"]))),j=_.Ay.div(i||(i=E(["\n  display: block;\n  margin-top: 5px;\n  font-size: var(--neko-small-font-size);\n  line-height: 14px;\n  color: var(--neko-gray-60);\n\n  * {\n    line-height: inherit;\n    margin: 0;\n  }\n"]))),P=_.Ay.div(a||(a=E(["\n  border-radius: 8px;\n  overflow: hidden;\n  position: absolute;\n  top: 0;\n  width: 100%;\n\n  &.hidden {\n    opacity: 0;\n  }\n\n  &.neko-dropdown-up {\n    margin-top: calc(-200% + 22px);\n  }\n"]))),M=_.Ay.div(s||(s=E(["\n  overflow-y: auto;\n  max-height: 300px;\n  background-color: var(--neko-main-color-alternative);\n\n  &.neko-select-filter-container {\n    background-color: var(--neko-main-color-alternative);\n    padding: 6px;\n    margin-top: 2px;\n    overflow: hidden;\n\n    div {\n      overflow: hidden;\n    }\n  }\n"]))),R=_.Ay.div(l||(l=E(["\n  margin-bottom: 0px;\n\n  input {\n    display: none;\n  }\n\n  label {\n    cursor: pointer;\n    display: flex;\n\n    svg {\n      flex-shrink: 0;\n    }\n  }\n\n  .inner-container {\n    margin-left: 4px;\n\n    .label {\n      display: block;\n      font-size: var(--neko-font-size);\n      line-height: 17px;\n      padding-top: 4.5px;\n      padding-bottom: 4px;\n    }\n\n    .description {\n      display: block;\n      font-size: var(--neko-small-font-size);\n    }\n  }\n\n  &.disabled {\n    color: var(--neko-disabled-color);\n\n    label {\n      cursor: default;\n    }\n  }\n"]))),T=_.Ay.div(c||(c=E(["\n  background-color: var(--neko-main-color-alternative);\n  cursor: pointer;\n  font-size: var(--neko-font-size); \n  padding: 6px 12px;\n\n  &:hover {\n    filter: brightness(80%);\n  }\n\n  input {\n    display: none;\n  }\n\n  .option {\n    align-items: center;\n    color: var(--neko-white);\n    display: flex;\n    justify-content: space-between;\n    font-size: var(--neko-font-size); \n    line-height: 17px;\n\n    .option-group {\n      align-items: center;\n      display: flex;\n    }\n  }\n\n  &.disabled {\n    background-color: rgb(224 156 54);\n    pointer-events: none;\n\n    .option {\n      color: rgb(255 255 255 / 35%);\n    }\n  }\n"]))),L=["name","description","scrolldown","isPro","onChange","isBusy","chevronIconSize","textFiltering","value","className","disabled","requirePro"];function I(){return I=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},I.apply(this,arguments)}function N(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,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return z(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)?z(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 z(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 D=function(e){var t,n=e.name,r=e.description,o=e.scrolldown,i=void 0!==o&&o,a=e.isPro,s=void 0!==a&&a,l=e.onChange,c=e.isBusy,f=void 0!==c&&c,d=e.chevronIconSize,v=void 0===d?24:d,b=e.textFiltering,_=e.value,E=e.className,R=e.disabled,T=(e.requirePro,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,L)),z=null===(t=h().Children.toArray(e.children).find((function(e){return e.props.value===_||e.props.checked})))||void 0===t?void 0:t.props,D=(null==z?void 0:z.label)||"Select",F=(null==z?void 0:z.description)||r,B=(null==z?void 0:z.requirePro)||!1,$=null==z?void 0:z.icon,H=null==z?void 0:z.iconSize,W=N((0,u.useState)(!1),2),q=W[0],V=W[1],U=N((0,u.useState)(""),2),K=U[0],Q=U[1],G=(0,u.useRef)(),Y=B&&!s,Z=function(t){if(t!==_){if(!l)return void console.log("The onChange handler it not set for this checkbox.",e);l(t,n)}i&&V(!1)},X=h().Children.map(e.children,(function(e){return e?h().cloneElement(e,{name:e.props.name||n,checked:e.props.value===_||e.props.checked,onClick:Z,scrolldown:i,isPro:s,disabled:R}):null})),J=(0,u.useMemo)((function(){if(!K||!X.length)return X;var e=K.toLowerCase();return h().Children.toArray(X).filter((function(t){var n=t.props.label.toLowerCase(),r=t.props.value.toLowerCase();return n.includes(e)||r.includes(e)}))}),[X,K]),ee=(0,m.gR)("neko-select",E,{"show-options":q,disabled:R||f}),te=(0,m.gR)("neko-select-options",{hidden:!q}),ne=(0,m.gR)("neko-select-option",{isBusy:f});return i?h().createElement(C,I({name:n},T,{onClick:function(){return V(!q)},className:ee,"data-is-disabled":R||f}),h().createElement(A,{className:ne,ref:G},f?h().createElement(h().Fragment,null,h().createElement(g.X,{type:"circle",size:"20px"})):h().createElement(h().Fragment,null,$&&h().createElement(k.z,{icon:$,width:H,height:H,style:{marginRight:"".concat(Math.max(H-15,4),"px")}}),h().createElement("span",{className:"neko-select-option-label"},D),h().createElement("div",{className:"rightContent"},Y&&h().createElement(p.K,null),h().createElement(y.In,{icon:q?w.A:x.A,width:v})))),F&&h().createElement(j,null,F),h().createElement(O.G,{visible:q,targetRef:G,onClose:function(){q&&V(!1)}},h().createElement(P,{className:te},b&&h().createElement(M,{className:"neko-select-filter-container"},h().createElement(S.A,{value:K,placeholder:"Search...",onChange:function(e){return Q(e)},onClick:function(e){return e.stopPropagation()},style:{background:"var(--neko-white)"},inputStyle:{margin:0,borderRadius:0},autoFocus:!0})),h().createElement(M,null,[J])))):X},F=function(e){var t=e.id,n=e.name,r=e.value,o=e.checked,i=void 0!==o&&o,a=e.label,s=e.description,l=e.onClick,c=e.scrolldown,u=void 0!==c&&c,f=e.isPro,d=void 0!==f&&f,g=e.optionDisabled,x=void 0!==g&&g,w=e.requirePro,S=void 0!==w&&w,O=e.icon,_=e.iconSize,E=void 0===_?20:_,C=S&&!d,A=(0,m.gR)({"neko-radio":!u},{"neko-select-option":u},e.className,{disabled:C||x}),P=h().createElement(R,{className:A,onClick:function(){return l(r,n)}},h().createElement("label",{htmlFor:t},h().createElement(y.In,{icon:i?b.A:v.A,width:"24px",color:C?"var(--neko-disabled-color)":i?"var(--neko-main-color)":"var(--neko-input-border)"}),h().createElement("div",{className:"inner-container"},h().createElement("span",{className:"label"},a,h().createElement(p.K,{className:"inline",style:{top:-1},show:C})),s&&h().createElement(j,{style:{marginTop:0}},s)))),M=h().createElement(T,{className:A,onClick:function(){return l(r,n)}},h().createElement("div",{className:"option"},h().createElement("div",{className:"option-group"},O&&h().createElement(k.z,{icon:O,width:E,height:E,style:{marginRight:"".concat(Math.max(E-11,4),"px")}}),a),h().createElement(p.K,{show:C})));return u?M:P},B=function(e){return h().createElement(D,e)};B.propTypes={name:d().string,description:d().string,scrolldown:d().bool,isPro:d().bool,onChange:d().func,isBusy:d().bool,chevronIconSize:d().number,textFiltering:d().bool};var $=function(e){return h().createElement(F,e)};$.propTypes={id:d().string,name:d().string,value:d().string,checked:d().bool,label:d().string,description:d().string,onClick:d().func,scrolldown:d().bool,isPro:d().bool,optionDisabled:d().bool,requirePro:d().bool,icon:d().string,iconSize:d().number}},8482:(e,t,n)=>{"use strict";n.d(t,{S:()=>m});var r,o=n(1594),i=n(6365),a=n.n(i),s=n(3185),l=n(6897),c=["width","height","fontSize","onLabel","offLabel","onBackgroundColor","offBackgroundColor","onValue","offValue","small","checked","onChange","disabled"];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 h(e){return"number"==typeof e?"".concat(e,"px"):e}var f,d,p=s.Ay.div(r||(f=["\n  color: var(--neko-white);\n  font-family: var(--neko-font-family);\n  font-size: ",";\n  position: relative;\n  display: inline-block;\n  width: ",";\n  height: ",";\n\n  &[data-is-disabled=disabled] {\n    opacity: 0.4;\n\n    .neko-slider {\n      cursor: auto;\n    }\n  }\n\n  input {\n    opacity: 0;\n    width: 0;\n    height: 0;\n    border: 0;\n  }\n\n  .neko-slider {\n    background-color: ",';\n    border-radius: 35px;\n    align-items: center;\n    cursor: pointer;\n    display: inline-flex;\n    position: absolute;\n    top: 0;\n    left: 0;\n    right: 0;\n    bottom: 0;\n    transition: .4s;\n    margin-bottom: -2px;\n  }\n\n  .neko-slider:before {\n    border-radius: 50%;\n    position: absolute;\n    content: "";\n    height: ',";\n    width: ",';\n    left: 4px;\n    bottom: 5px;\n    background-color: white;\n    transition: .3s;\n  }\n\n  .neko-slider:after {\n    content: "','";\n    margin-left: auto;\n    margin-right: ',";\n  }\n\n  &.neko-checked .neko-slider {\n    background-color: ",";\n  }\n\n  &.neko-checked .neko-slider:before {\n    transform: translateX(",');\n  }\n\n  &.neko-checked .neko-slider:after {\n    content: "','";\n    margin-left: ',";\n    margin-right: auto;\n  }\n"],d||(d=f.slice(0)),r=Object.freeze(Object.defineProperties(f,{raw:{value:Object.freeze(d)}}))),(function(e){return e.fontSize}),(function(e){return h(e.width)}),(function(e){return h(e.height)}),(function(e){return e.$offBackgroundColor||"var(--neko-disabled-color)"}),(function(e){return"calc(".concat(h(e.height)," - 8px)")}),(function(e){return"calc(".concat(h(e.height)," - 8px)")}),(function(e){return e.$offLabel}),(function(e){return"calc(".concat(h(e.height)," / 2)")}),(function(e){return e.$onBackgroundColor}),(function(e){return"calc(".concat(h(e.width)," - ").concat(h(e.height),")")}),(function(e){return e.$onLabel}),(function(e){return"calc(".concat(h(e.height)," / 2)")})),m=function(e){var t=e.width,n=void 0===t?40:t,r=e.height,i=void 0===r?24:r,a=e.fontSize,s=void 0===a?"13px":a,h=e.onLabel,f=void 0===h?"Yes":h,d=e.offLabel,m=void 0===d?"No":d,g=e.onBackgroundColor,y=void 0===g?"var(--neko-success)":g,v=e.offBackgroundColor,b=void 0===v?"var(--neko-disabled-color)":v,x=e.onValue,w=e.offValue,k=e.small,S=e.checked,O=void 0!==S&&S,_=e.onChange,E=e.disabled,C=void 0!==E&&E,A=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,c),j=(0,l.gR)("neko-switch",{small:k,"neko-checked":O}),P=(0,o.useCallback)((function(e){C||_(e?void 0===x||x:void 0!==w&&w)}),[x,w,_,C]);return k&&(i=20,s="11px"),React.createElement(p,u({className:j,width:n,height:i,fontSize:s},A,{$offBackgroundColor:b,$onBackgroundColor:y,$onLabel:f,$offLabel:m,"data-is-disabled":C?"disabled":""}),React.createElement("span",{className:"neko-slider",onClick:function(){return P(!O)}}))};m.propTypes={width:a().number,height:a().number,fontSize:a().string,onValue:a().string,offValue:a().string,checked:a().bool,onBackgroundColor:a().string,offBackgroundColor:a().string,onLabel:a().string,offLabel:a().string}},3896:(e,t,n)=>{"use strict";n.d(t,{m:()=>x});var r=n(1594),o=n.n(r),i=n(6365),a=n.n(i),s=n(3185),l=n(6897);function c(e){return c="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},c(e)}var u,h=["name","value","rows","description","placeholder","onEnter","onBlurForce","readOnly","avoidOnEnterWithShift","fullHeight","maxLength","className","style","textAreaStyle","countable","disabled","tabToSpaces"];function f(){return f=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},f.apply(this,arguments)}function d(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 p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(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"!=c(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:String(t)}(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)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function m(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,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return g(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)?g(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 g(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 y,v,b=(0,s.Ay)((function(e){var t,n=e.name,i=e.value,a=void 0===i?"":i,s=e.rows,c=void 0===s?6:s,u=e.description,d=e.placeholder,g=void 0===d?"":d,y=e.onEnter,v=void 0===y?null:y,b=e.onBlurForce,x=void 0!==b&&b,w=e.readOnly,k=void 0!==w&&w,S=e.avoidOnEnterWithShift,O=void 0!==S&&S,_=e.fullHeight,E=void 0!==_&&_,C=e.maxLength,A=void 0===C?null:C,j=e.className,P=e.style,M=e.textAreaStyle,R=void 0===M?{}:M,T=e.countable,L=void 0!==T&&T,I=e.disabled,N=e.tabToSpaces,z=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,h),D=m((0,r.useState)(a),2),F=D[0],B=D[1],$=m((0,r.useState)(0),2),H=$[0],W=$[1],q=m((0,r.useState)(!1),2),V=q[0],U=q[1],K=!!e.onChange,Q=(0,r.useRef)(null),G=(0,r.useCallback)((function(e){if(N&&"Tab"===e.key){e.preventDefault();var t=Q.current.selectionStart,n=Q.current.selectionEnd,r=Q.current.value;Q.current.value=r.substring(0,t)+"  "+r.substring(n),Q.current.selectionStart=Q.current.selectionEnd=t+2}else U(e.shiftKey)}),[]),Y=(0,r.useCallback)((function(){U(!1)}),[]);(0,r.useEffect)((function(){return document.addEventListener("keydown",G,!1),document.addEventListener("keyup",Y,!1),function(){document.removeEventListener("keydown",G,!1),document.removeEventListener("keyup",Y,!1)}}),[]),(0,r.useEffect)((function(){if(K||B(a),"words"===L){var e=a.split(" ").filter((function(e){return""!==e})).length;W(e)}else L&&W(a.length)}),[a,L,K]);var Z=(0,r.useCallback)((function(t){var r=A?t.target.value.substr(0,A):t.target.value;t.stopPropagation(),K?e.onChange(r,n):B(r,n)}),[A,K,e,n]),X=(0,l.gR)(j,{disabled:I});return o().createElement("div",{className:X,style:P},o().createElement("div",{className:"neko-textarea-container"},o().createElement("textarea",f({ref:Q,className:"neko-textarea",rows:c,disabled:I},z,{name:n,spellCheck:"false",placeholder:g,onChange:Z,onKeyPress:function(t){if(v&&!t.shiftKey&&"Enter"===t.key){if(O&&V)return;t.preventDefault(),e.onEnter(t.target.value,n)}},onBlur:function(t){(x||e.onBlur&&a!==t.target.value)&&e.onBlur(t.target.value,n)},readOnly:k,style:p(p({},R),{},{height:E?"100%":null!==(t=R.height)&&void 0!==t?t:void 0}),value:K?a:F})),o().createElement("div",{className:"neko-text-area-extra"},u&&o().createElement("div",{className:"neko-input-description"},u),L&&o().createElement("div",{className:"neko-textarea-count"},H,A?" / ".concat(A):""," ","words"===L?"words":"chars"))))}))(u||(y=["\n  .neko-textarea-container {\n    position: relative;\n    height: ","\n  }\n\n  .neko-textarea {\n    font-size: var(--neko-font-size);\n    border: 1.5px solid var(--neko-input-border);\n    box-sizing: border-box;\n    background: var(--neko-input-background);\n    color: black;\n    padding: 5px 10px;\n    width: 100%;\n\n    &::placeholder {\n      color: rgba(0, 0, 0, 0.25);\n    }\n\n    :focus {\n      background-color: white;\n      border-color: #2271b1;\n      box-shadow: 0 0 0 1px #2271b1;\n      outline: 2px solid transparent;\n    }\n\n    :read-only {\n      background-color: var(--neko-gray-60);\n      border: none;\n    }\n  }\n\n  .neko-text-area-extra {\n    display: flex;\n    justify-content: space-between;\n    color: var(--neko-gray-60);\n    font-size: var(--neko-small-font-size);\n    line-height: 14px;\n\n    .neko-textarea-count {\n      margin: 5px 0 0 10px;\n      text-align: right;\n      min-width: 130px;\n      display: block;\n    }\n  \n    .neko-input-description {\n      margin-top: 5px;\n      margin-bottom: 0;\n      flex: auto;\n      font-size: var(--neko-small-font-size);\n    }\n  }\n\n  &.disabled {\n    .neko-textarea {\n      border: 1.5px solid var(--neko-disabled-color);\n      cursor: not-allowed;\n      opacity: 0.35;\n    }\n  }\n"],v||(v=y.slice(0)),u=Object.freeze(Object.defineProperties(y,{raw:{value:Object.freeze(v)}}))),(function(e){return e.fullHeight?"100%":void 0})),x=function(e){return o().createElement(b,e)};x.propTypes={name:a().string,value:a().string,rows:a().number,description:a().string,placeholder:a().string,onChange:a().func,onEnter:a().func,onBlur:a().func,onBlurForce:a().bool,readOnly:a().bool,avoidOnEnterWithShift:a().bool,fullHeight:a().bool}},8135:(e,t,n)=>{"use strict";n.d(t,{YS:()=>T,z3:()=>P,IU:()=>A,F1:()=>_,Tb:()=>j,yy:()=>M,FE:()=>R});var r=n(1594),o=n.n(r);function i(e){return i="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},i(e)}function a(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,l(r.key),r)}}function s(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:String(t)}var c=s((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=r,this.message=t,this.code=n,this.body=o,this.debug=i,this.cancelledByUser="USER-ABORTED"===n}));function u(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,m(r.key),r)}}function h(e,t,n){return t=d(t),function(e,t){if(t&&("object"===S(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,f()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(f=function(){return!!e})()}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function m(e){var t=function(e,t){if("object"!=S(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==S(t)?t:String(t)}function g(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,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||w(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 y(){y=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",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,a=Object.create(i.prototype),s=new R(r||[]);return o(a,"_invoke",{value:A(e,n,s)}),a}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var f="suspendedStart",d="suspendedYield",p="executing",m="completed",g={};function v(){}function b(){}function x(){}var w={};c(w,a,(function(){return this}));var k=Object.getPrototypeOf,O=k&&k(k(T([])));O&&O!==n&&r.call(O,a)&&(w=O);var _=x.prototype=v.prototype=Object.create(w);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(o,i,a,s){var l=h(e[o],e,i);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==S(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.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 A(t,n,r){var o=f;return function(i,a){if(o===p)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 s=r.delegate;if(s){var l=j(s,r);if(l){if(l===g)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===f)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=p;var c=h(t,n,r);if("normal"===c.type){if(o=r.done?m:d,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=m,r.method="throw",r.arg=c.arg)}}}function j(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,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=h(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;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,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}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 M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function T(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(S(t)+" is not iterable")}return b.prototype=x,o(_,"constructor",{value:x,configurable:!0}),o(x,"constructor",{value:b,configurable:!0}),b.displayName=c(x,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,c(e,l,"GeneratorFunction")),e.prototype=Object.create(_),e},t.awrap=function(e){return{__await:e}},E(C.prototype),c(C.prototype,s,(function(){return this})),t.AsyncIterator=C,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new C(u(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(_),c(_,l,"Generator"),c(_,a,(function(){return this})),c(_,"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=T,R.prototype={constructor:R,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(M),!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 s.type="throw",s.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],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)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,g):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),g},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),M(n),g}},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;M(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function v(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function b(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){v(i,r,o,a,s,"next",e)}function s(e){v(i,r,o,a,s,"throw",e)}a(void 0)}))}}function w(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}function S(e){return S="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},S(e)}var O=function(e){var t=[];return function(n,r){if("object"===S(r)&&null!==r){if(-1!==t.indexOf(r)){if(!e)throw console.warn("Circular reference found.",{key:n,value:r,cache:t,cacheIndex:t.indexOf(r)}),new Error("Circular reference found. Cancelled.");return}t.push(r)}return r}};function _(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,O(n),t)}var E=function(e){if(!e.data)return e;if(e.data.length>0&&e.data[0].meta){var t,n=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=w(e))){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(e.data);try{for(n.s();!(t=n.n()).done;){var r=t.value;try{r.meta=JSON.parse(r.meta)}catch(e){console.error("[JsonFetcher]","Could not decode meta.",r.meta)}}}catch(e){n.e(e)}finally{n.f()}}else if(e.data.meta)try{e.data.meta=JSON.parse(e.data.meta)}catch(e){console.error("[JsonFetcher]","Could not decode meta.",x.meta)}return e},C=function(){var e=b(y().mark((function e(t){var n,r,o,i,a,s,l,u,h,f=arguments;return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},r=null,o={},i=null,a=null,e.prev=5,(n=n||{}).headers=n.headers?n.headers:{},n.headers.Pragma="no-cache",n.headers["Cache-Control"]="no-cache",e.next=12,fetch("".concat(t),n);case 12:return a=e.sent,e.next=15,a.text();case 15:r=e.sent,(o=JSON.parse(r)).success||(s=!1===o.success?"NOT-SUCCESS":"N/A",l=o.message?o.message:"Unknown error. Check your Console Logs.","rest_no_route"===o.code?(l="The API can't be accessed. Are you sure the WP REST API is enabled? Check this article: https://meowapps.com/fix-wordpress-rest-api/.",s="NO-ROUTE"):"internal_server_error"===o.code&&(l="Server error. Please check your PHP Error Logs.",s="SERVER-ERROR"),i=new c(l,s,t,r||a)),e.next=27;break;case 20:e.prev=20,e.t0=e.catch(5),console.error("[nekoFetch]",e.t0),u="BROKEN-REPLY",h="The reply sent by the server is broken.","AbortError"===e.t0.name?(u="USER-ABORTED",h="The request was aborted by the user."):a&&a.status&&408===a.status&&(u="REQUEST-TIMEOUT",h="The request generated a timeout."),i=new c(h,u,t,r||a,e.t0);case 27:return i&&(o.success=!1,o.message=i.message,o.error=i),e.abrupt("return",E(o));case 29:case"end":return e.stop()}}),e,null,[[5,20]])})));return function(t){return e.apply(this,arguments)}}(),A=function(){var e=b(y().mark((function e(t){var n,r,o,i,a,s,l,c,u,h,f,d,p,m,v,b,x,w,k,S,O=arguments;return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(n=O.length>1&&void 0!==O[1]?O[1]:{}).json,o=void 0===r?null:r,i=n.method,a=void 0===i?"GET":i,s=n.signal,l=n.file,c=n.nonce,u=n.bearerToken,"GET"!==a||!o){e.next=4;break}throw new Error("NekoFetch: GET method does not support json argument (".concat(t,")."));case 4:if(h=l?new FormData:null,l)for(h.append("file",l),f=0,d=Object.entries(o);f<d.length;f++)p=g(d[f],2),m=p[0],v=p[1],h.append(m,v);return b={},c&&(b["X-WP-Nonce"]=c),u&&(b.Authorization="Bearer ".concat(u)),h||(b["Content-Type"]="application/json"),x={method:a,headers:b,body:h||(o?_(o):null),signal:s},w=null,e.prev=12,e.next=15,C(t,x);case 15:if((w=e.sent).success){e.next=18;break}throw new Error(null!==(k=null===(S=w)||void 0===S?void 0:S.message)&&void 0!==k?k:"Unknown error.");case 18:return e.abrupt("return",w);case 21:throw e.prev=21,e.t0=e.catch(12),e.t0;case 24:case"end":return e.stop()}}),e,null,[[12,21]])})));return function(t){return e.apply(this,arguments)}}(),j=function(){var e=b(y().mark((function e(t){var n,r,o,i,a,s,l,c,u,h,f,d,p,m,v=arguments;return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(n=v.length>1&&void 0!==v[1]?v[1]:{}).json,o=void 0===r?{}:r,i=n.signal,a=n.file,s=n.nonce,l=n.bearerToken,c=a?new FormData:null,a)for(c.append("file",a),u=0,h=Object.entries(o);u<h.length;u++)f=g(h[u],2),d=f[0],p=f[1],c.append(d,p);return m=s?{"X-WP-Nonce":s}:{},l&&(m.Authorization="Bearer ".concat(l)),c||(m["Content-Type"]="application/json"),e.abrupt("return",C(t,{method:"POST",headers:m,body:c||_(o),signal:i}));case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),P=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=t<0?0:t,r=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],o=e>0?Math.floor(Math.log(e)/Math.log(1024)):0;return"Bytes"===r[o]&&(o=1),(e=parseFloat((e/Math.pow(1024,o)).toFixed(n))).toFixed(Math.max(n,(e.toString().split(".")[1]||[]).length))+" "+r[o]};function M(e){return new Promise((function(t){return setTimeout(t,e)}))}var R=function(e){return o().createElement("span",{style:{display:"inline"},dangerouslySetInnerHTML:{__html:e}})},T=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=h(this,t,[e])).state={hasError:!1},n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(t,e),n=t,i=[{key:"getDerivedStateFromError",value:function(e){return{hasError:e}}}],(r=[{key:"render",value:function(){if(this.state.hasError){var e;return e="string"==typeof this.state.hasError?this.state.hasError:this.state.hasError.message?this.state.hasError.message:this.state.hasError.toString?this.state.hasError.toString():_(this.state.hasError),o().createElement(o().Fragment,null,o().createElement("div",{style:{background:"var(--neko-red)",color:"white",margin:15,padding:15,borderRadius:15}},o().createElement("pre",{style:{margin:0,whiteSpace:"pre-wrap"}},"⚠️ ",o().createElement("b",null,"Error"),o().createElement("br",null),"Sorry, an error occured! Don't worry, I will fix this, so simply let me know about it.",o().createElement("br",null),"Here is some information about it:",o().createElement("br",null),o().createElement("br",null),e)))}return this.props.children}}])&&u(n.prototype,r),i&&u(n,i),Object.defineProperty(n,"prototype",{writable:!1}),t}(o().Component)},6897:(e,t,n)=>{"use strict";n.d(t,{$$:()=>b,G8:()=>w,XS:()=>y,gR:()=>x,jz:()=>g,v_:()=>v});var r=n(1594),o=n(6815),i=n(8135),a=n(9794),s=n(9296);function l(e){return l="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},l(e)}function c(){c=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",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function h(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(e){h=function(e,t,n){return e[t]=n}}function f(e,t,n,r){var i=t&&t.prototype instanceof b?t:b,a=Object.create(i.prototype),s=new R(r||[]);return o(a,"_invoke",{value:A(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=f;var p="suspendedStart",m="suspendedYield",g="executing",y="completed",v={};function b(){}function x(){}function w(){}var k={};h(k,a,(function(){return this}));var S=Object.getPrototypeOf,O=S&&S(S(T([])));O&&O!==n&&r.call(O,a)&&(k=O);var _=w.prototype=b.prototype=Object.create(k);function E(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(o,i,a,s){var c=d(e[o],e,i);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==l(h)&&r.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(h).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,s)}))}s(c.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 A(t,n,r){var o=p;return function(i,a){if(o===g)throw new Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var l=j(s,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=g;var c=d(t,n,r);if("normal"===c.type){if(o=r.done?y:m,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function j(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,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=d(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}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 M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function T(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(l(t)+" is not iterable")}return x.prototype=w,o(_,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:x,configurable:!0}),x.displayName=h(w,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,h(e,u,"GeneratorFunction")),e.prototype=Object.create(_),e},t.awrap=function(e){return{__await:e}},E(C.prototype),h(C.prototype,s,(function(){return this})),t.AsyncIterator=C,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new C(f(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(_),h(_,u,"Generator"),h(_,a,(function(){return this})),h(_,"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=T,R.prototype={constructor:R,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(M),!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 s.type="throw",s.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],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)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,v):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),v},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),M(n),v}},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;M(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function u(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function h(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){u(i,r,o,a,s,"next",e)}function s(e){u(i,r,o,a,s,"throw",e)}a(void 0)}))}}function f(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=p(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function d(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,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||p(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 p(e,t){if(e){if("string"==typeof e)return m(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)?m(e,t):void 0}}function m(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 g=function(e,t){var n=(0,r.useRef)(),o=t?Array.isArray(t)?t:[t]:[n],i=function(t){if(e){var n,r=!1,i=f(o);try{for(i.s();!(n=i.n()).done;){var a=n.value;if(null!=a&&a.current&&a.current.contains(t.target)){r=!0;break}}}catch(e){i.e(e)}finally{i.f()}r||e()}};return(0,r.useEffect)((function(){return document.addEventListener("mousedown",i),function(){document.removeEventListener("mousedown",i)}})),n},y=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.i18n,n=void 0===t?null:t,l=e.onStop,u=void 0===l?function(){}:l,p=d((0,r.useState)(new o.A({concurrency:1,autoStart:!1})),2),m=p[0],g=p[1],y=d((0,r.useState)(new AbortController),2),v=y[0],b=y[1],x=(0,r.useRef)(!1),w=(0,r.useRef)(0),k=(0,r.useRef)(null),S=(0,r.useRef)(0),O=(0,r.useRef)(0),_=d((0,r.useState)(!1),2),E=_[0],C=_[1],A=d((0,r.useState)(null),2),j=A[0],P=A[1],M=d((0,r.useState)(!1),2),R=M[0],T=M[1],L=d((0,r.useState)(0),2),I=L[0],N=L[1],z=d((0,r.useState)(!1),2),D=z[0],F=z[1],B=d((0,r.useState)(!1),2),$=B[0],H=B[1],W=d((0,r.useState)(0),2),q=W[0],V=W[1],U=function(){var e=h(c().mark((function e(){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=new AbortController,b(t),F(!1),w.current=0,x.current=!1,T(!1),H(!1),V(0),N(0),g(new o.A({concurrency:1,autoStart:!1}));case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),K=function(){var e=h(c().mark((function e(t){var n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Promise(function(){var e=h(c().mark((function e(n,r){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return F(!1),S.current=0,O.current=0,w.current=0,x.current=!1,T(!1),H(!1),ne(t),P(!0),m.start(),e.next=13,m.onIdle();case 13:J(),n();case 15:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()),e.abrupt("return",n);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Q=(0,r.useCallback)(h(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:m.pause(),T(!0);case 3:case"end":return e.stop()}}),e)}))),[m]),G=(0,r.useCallback)(h(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:F(!1),T(!1),m.start();case 4:case"end":return e.stop()}}),e)}))),[m]),Y=(0,r.useCallback)(h(c().mark((function e(){var t,n=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=n.length>0&&void 0!==n[0]?n[0]:5,S.current=t,O.current=t,Z();case 4:case"end":return e.stop()}}),e)}))),[Z]),Z=(0,r.useCallback)(h(c().mark((function e(){var t,n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(F(!1),T(!1),!(O.current>0)){e.next=13;break}if(!(O.current<S.current)){e.next=12;break}return t=S.current-O.current,C(!0),n=5e3*t,e.next=11,(0,i.yy)(n);case 11:C(!1);case 12:O.current--;case 13:if(!k.current){e.next=16;break}return e.next=16,ee(k.current,!0);case 16:case"end":return e.stop()}}),e)}))),[ee]),X=(0,r.useCallback)(h(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:m.pause(),v.abort(),P(!1),F(!1),H(!1),u();case 7:case"end":return e.stop()}}),e)}))),[v,u,m]),J=function(){var e=h(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:H(!0),P(!1);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ee=(0,r.useCallback)(function(){var e=h(c().mark((function e(t){var n,r,o=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>1&&void 0!==o[1]&&o[1],e.prev=1,n&&(w.current--,V((function(e){return e-1}))),k.current=t,e.next=6,t(v.signal);case 6:if(!1!==(null==(r=e.sent)?void 0:r.success)){e.next=9;break}throw new Error(r.message);case 9:n&&(O.current=S.current,m.start()),e.next=28;break;case 12:if(e.prev=12,e.t0=e.catch(1),"AbortError"!==(null===e.t0||void 0===e.t0?void 0:e.t0.name)){e.next=19;break}return console.log("[useNekoTasks] Aborted"),e.abrupt("return");case 19:if(w.current++,x.current){e.next=28;break}if(Q(),!(O.current>0)){e.next=27;break}return Z(),e.abrupt("return");case 27:F(e.t0);case 28:return e.prev=28,V((function(e){return e+1})),e.finish(28);case 31:case"end":return e.stop()}}),e,null,[[1,12,28,31]])})));return function(t){return e.apply(this,arguments)}}(),[v.signal,Q,Z,m]),te=function(){var e=h(c().mark((function e(t){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:m.add(h(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",ee(t));case 1:case"end":return e.stop()}}),e)})))),N((function(e){return e+1}));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ne=function(){var e=h(c().mark((function e(t){var n,r,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:m.clear(),n=f(t);try{for(n.s();!(r=n.n()).done;)o=r.value,te(o)}catch(e){n.e(e)}finally{n.f()}V(0);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),re=(0,r.useCallback)((function(){x.current=!0}),[]),oe=(0,r.useCallback)((function(){return w.current}),[]),ie=(0,r.useMemo)((function(){return React.createElement(a.n,{isOpen:D,onRequestClose:X,title:n?n.COMMON.ERROR:"Error",content:React.createElement(React.Fragment,null,React.createElement("b",null,null!=D&&D.message?D.message:D||"Unknown error."),React.createElement("p",null)),customButtons:React.createElement("div",{style:{display:"flex",width:"100%",flexDirection:"column"}},React.createElement("div",{style:{display:"flex",alignItems:"center"}},React.createElement(s.M,{style:{flex:2},className:"primary",onClick:Z},n?n.COMMON.RETRY:"Retry"),React.createElement(s.M,{style:{flex:1},className:"secondary",onClick:function(){Y(10)}},React.createElement("small",null,n?n.COMMON.AUTO_RETRY:"Auto Retry")),React.createElement(s.M,{style:{flex:2},className:"primary",onClick:G},n?n.COMMON.SKIP:"Skip"),React.createElement(s.M,{style:{flex:1},className:"secondary",onClick:function(){re(),G()}},React.createElement("small",null,n?n.COMMON.AUTO_SKIP:"Auto Skip")),React.createElement(s.M,{style:{flex:2},className:"danger",onClick:X},n?n.COMMON.STOP:"Stop")),React.createElement("small",{style:{marginTop:10,lineHeight:"13px"}},n?n.COMMON.AUTO_RETRY_DESCRIPTION:"Auto Retry will retry the task 10 times."))})}),[Y,D,n,G,Z,re,X]);return{start:K,stop:X,pause:Q,resume:G,reset:U,retry:Z,autoRetry:Y,isSleeping:E,addTask:te,setAlwaysSkip:re,getErrorCount:oe,TasksErrorModal:ie,error:D,success:$,busy:j,paused:R,value:q,max:I}},v=function(){var e=d((0,r.useState)(!1),2),t=e[0],n=e[1],o=d((0,r.useState)(!1),2),i=o[0],a=o[1],s=(0,r.useCallback)((function(e){n(e.shiftKey),a(e.ctrlKey||e.metaKey)}),[]),l=(0,r.useCallback)((function(){n(!1),a(!1)}),[]);return(0,r.useEffect)((function(){return document.addEventListener("keydown",s,!1),document.addEventListener("keyup",l,!1),function(){document.removeEventListener("keydown",s,!1),document.removeEventListener("keyup",l,!1)}}),[]),{pressShift:t,pressControl:i}},b=function(e,t){var n=(0,r.useRef)();(0,r.useEffect)((function(){n.current=e}),[e]),(0,r.useEffect)((function(){if(null!==t){var e=setInterval((function(){n.current()}),t);return function(){return clearInterval(e)}}}),[t])},x=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,r.useMemo)((function(){var e=[];return t.forEach((function(t){"string"==typeof t?t.trim().split(" ").filter((function(e){return e.length>0})).forEach((function(t){return e.push(t)})):"object"===l(t)&&Object.keys(t).forEach((function(n){t[n]&&e.push(n)}))})),e.join(" ")}),[t])},w=function(e,t){var n=(0,r.useRef)(null);return(0,r.useEffect)((function(){return function(){n.current&&clearTimeout(n.current)}}),[]),(0,r.useCallback)((function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];n.current&&clearTimeout(n.current),n.current=setTimeout((function(){e.apply(void 0,o)}),t)}),[e,t])}},1329:(e,t,n)=>{"use strict";n.d(t,{K:()=>g});var r,o=n(1594),i=n.n(o),a=n(6365),s=n.n(a),l=n(3185),c=n(6897),u=["show","className"];function h(){return h=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},h.apply(this,arguments)}var f,d,p=l.Ay.a(r||(f=["\n  background-color: var(--neko-yellow);\n  position: relative;\n  border-radius: 10px;\n  color: white !important;\n  font-size: 9px;\n  line-height: 10px;\n  padding: 5px 8px;\n  text-transform: uppercase;\n  text-decoration: none;\n  white-space: nowrap;\n\n  &:hover {\n    filter: brightness(1.1);\n  }\n\n  &.inline {\n    display: inline;\n    margin-left: 5px;\n    vertical-align: middle;\n  }\n"],d||(d=f.slice(0)),r=Object.freeze(Object.defineProperties(f,{raw:{value:Object.freeze(d)}})))),m=function(e){var t=e.show,n=void 0===t||t,r=e.className,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,u),a=(0,c.gR)("neko-pro-only",r);return n?i().createElement(p,h({href:"https://meowapps.com",target:"_blank",className:a},o),"Pro Only"):null},g=function(e){return i().createElement(m,e)};g.propTypes={show:s().bool,className:s().string}},4461:(e,t,n)=>{"use strict";n.d(t,{z:()=>g});var r,o,i,a=n(1594),s=n.n(a),l=n(6365),c=n.n(l),u=n(3185),h=n(4977),f=n(2557),d=n(6897),p=u.Ay.div(r||(o=["\n  font-size: var(--neko-font-size);\n  margin-bottom: 15px;\n\n  .neko-block-header {\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n  }\n\n  .neko-block-title {\n    padding: 5px 10px;\n    margin-bottom: 5px;\n  }\n\n  .neko-block-content {\n    background: white;\n    color: var(--neko-font-color);\n    padding: 15px 15px;\n    box-shadow: 0px 8px 8px -8px rgba(0, 0, 0, 0.35);\n    border-radius: 8px;\n\n    p:first-child {\n      margin-top: 0;\n    }\n\n    p:last-child {\n      margin-bottom: 0;\n    }\n  }\n\n  &.primary {\n    padding: 8px;\n    background-color: var(--neko-main-color);\n    color: white;\n\n    .neko-block-title {\n      color: white;\n    }\n\n    .neko-block-content {\n      background-color: white;\n    }\n  }\n\n  &.standard {\n    .neko-block-content {\n      box-shadow: none;\n    }\n  }\n\n  &.raw {\n    padding: 8px;\n    background-color: var(--neko-main-color);\n    color: white;\n\n    .neko-block-title {\n      color: white;\n    }\n\n    .neko-block-content {\n      padding: 0;\n      background: none;\n    }\n\n    .neko-block-content {\n      box-shadow: none;\n    }\n  }\n"],i||(i=o.slice(0)),r=Object.freeze(Object.defineProperties(o,{raw:{value:Object.freeze(i)}})))),m=function(e){var t=e.title,n=e.children,r=e.className,o=void 0===r?"":r,i=e.busy,a=void 0!==i&&i,l=e.style,c=void 0===l?{}:l,u=e.contentStyle,m=void 0===u?{}:u,g=e.action,y=(0,d.gR)("neko-block",o);return s().createElement(p,{className:y,style:c},t&&s().createElement("div",{className:"neko-block-header"},s().createElement(h.s,{h2:!0,className:"neko-block-title"},t),!!g&&g),s().createElement(f.A,{busy:a},s().createElement("div",{className:"neko-block-content",style:m},n)))},g=function(e){return s().createElement(m,e)};g.propTypes={title:c().string,className:c().oneOf(["","primary","standard","raw"]),style:c().object,action:c().element}},8668:(e,t,n)=>{"use strict";n.d(t,{Y:()=>x,a:()=>b});var r,o,i,a,s=n(1594),l=n.n(s),c=n(6365),u=n.n(c),h=n(3185);function f(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,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(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)?d(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 d(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){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var m=h.Ay.div(r||(r=p(["\n  margin-bottom: 10px;\n"]))),g=h.Ay.div(o||(o=p(["\n  margin-bottom: 0px;\n  padding-bottom: 2px;\n  border-bottom: 2px solid #d1e3f2;\n  color: var(--neko-main-color);\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  cursor: pointer;\n  font-weight: 600;\n"]))),y=h.Ay.span(i||(i=p(["\n  border: solid var(--neko-main-color);\n  border-width: 0 2px 2px 0;\n  display: inline-block;\n  padding: 3px;\n  transform: ",";\n  transition: transform 0.15s ease-in-out;\n"])),(function(e){return e.$isCollapsed?"rotate(45deg)":"rotate(-135deg)"})),v=h.Ay.div(a||(a=p(["\n  max-height: ",";\n  overflow: hidden;\n  transition: ",";\n"])),(function(e){return e.$isCollapsed?"0":"".concat(e.$contentHeight+15,"px")}),(function(e){return e.$animate?"max-height 0.15s ease-in-out":"none"})),b=function(e){var t=e.children,n=e.keepState,r=f((0,s.useState)(n?JSON.parse(localStorage.getItem(n)):null),2),o=r[0],i=r[1];return(0,s.useEffect)((function(){n&&localStorage.setItem(n,JSON.stringify(o))}),[o,n]),l().createElement("div",null,l().Children.map(t,(function(e,t){return(null==e?void 0:e.type)===x?l().cloneElement(e,{isCollapsed:o!==t,onClick:function(){var e;i(o===(e=t)?null:e)},keepState:n?"".concat(n,"-").concat(t):e.props.keepState}):e})))};b.propTypes={children:u().node.isRequired,keepState:u().string};var x=function(e){var t,n,r=e.isCollapsed,o=void 0!==r&&r,i=e.children,a=e.onClick,c=void 0===a?function(){}:a,u=e.keepState,h=e.disabled,d=void 0!==h&&h,p=e.hide,b=void 0!==p&&p,x=e.title,w=e.style,k=f((0,s.useState)(o),2),S=k[0],O=k[1],_=f((0,s.useState)(!1),2),E=_[0],C=_[1],A=l().Children.count(i)>0,j=(0,s.useRef)(null),P=f((0,s.useState)(0),2),M=P[0],R=P[1];return t=j,n=function(){j.current&&R(j.current.scrollHeight)},(0,s.useEffect)((function(){var e=t.current;if(e){var r=new ResizeObserver((function(e){n()}));return r.observe(e),function(){return r.disconnect()}}}),[t,n]),(0,s.useEffect)((function(){if(u){var e=JSON.parse(localStorage.getItem(u));O(null!==e?e:o)}}),[u,o]),(0,s.useEffect)((function(){u&&localStorage.setItem(u,JSON.stringify(S))}),[S,u]),(0,s.useEffect)((function(){O(o)}),[o]),b?null:l().createElement(m,{style:w},l().createElement(g,{onClick:function(){A&&!d&&(C(!0),O(!S),c())},style:{opacity:d?.5:1,pointerEvents:d?"none":"auto"}},x,A&&l().createElement(y,{$isCollapsed:S})),l().createElement(v,{$isCollapsed:S,$contentHeight:M,$animate:E},l().createElement("div",{ref:j},i)))};x.propTypes={title:u().string.isRequired,isCollapsed:u().bool,children:u().node,onClick:u().func,keepState:u().string,disabled:u().bool,hide:u().bool}},1543:(e,t,n)=>{"use strict";n.d(t,{L:()=>m});var r,o,i=n(1594),a=n.n(i),s=n(6365),l=n.n(s),c=n(3185),u=n(6897);function h(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var f=c.Ay.div(r||(r=h(["\n  font-size: var(--neko-font-size);\n  font-family: var(--neko-font-family);\n  background-color: white;\n  color: var(--neko-font-color);\n  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.05);\n  margin-bottom: 25px;\n  display: flex;\n  flex-direction: column;\n\n  &.primary {\n    background-color: var(--neko-main-color);\n  }\n\n  p:first-child {\n    margin-top: 0px;\n  }\n\n  p:last-child {\n    margin-bottom: 0px;\n  }\n\n  .neko-container-content {\n    padding: 20px 20px;\n  }\n"]))),d=c.Ay.div(o||(o=h(["\n  justify-content: flex-start;\n  background-color: var(--neko-gray-98);\n  display: flex;\n  align-items: center;\n  padding: 8px 10px;\n\n  &.align-right {\n    justify-content: flex-end;\n  }\n"]))),p=function(e){var t=e.header,n=e.headerAlign,r=void 0===n?"left":n,o=e.footer,i=e.footerAlign,s=void 0===i?"right":i,l=e.className,c=e.style,h=void 0===c?{}:c,p=e.contentStyle,m=void 0===p?{}:p,g=e.children,y=(0,u.gR)("neko-container",l);return a().createElement(f,{className:y,style:h},t&&a().createElement(d,{className:"align-".concat(r)},t),a().createElement("div",{className:"neko-container-content",style:m},g),o&&a().createElement(a().Fragment,null,a().createElement("div",{style:{flex:"auto"}}),a().createElement(d,{className:"align-".concat(s)},o)))},m=function(e){return a().createElement(p,e)};m.propTypes={header:l().element,headerAlign:l().oneOf(["left","right"]),footer:l().element,footerAlign:l().oneOf(["left","right"]),className:l().string,style:l().object,contentStyle:l().object}},6913:(e,t,n)=>{"use strict";n.d(t,{z:()=>v});var r,o=n(1594),i=n.n(o),a=n(6365),s=n.n(a),l=n(3185),c=n(9296),u=n(6897);function h(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,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||f(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 f(e,t){if(e){if("string"==typeof e)return d(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)?d(e,t):void 0}}function d(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 p,m,g=l.Ay.div(r||(p=["\n  position: relative;\n  margin-left: -20px;\n  background: var(--neko-background-color);\n  padding-bottom: 50px;\n  margin-bottom: -26px;\n\n  .neko-rest-error {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    background: #1e232deb;\n    z-index: 100;\n\n    .container {\n      color: white;\n      padding: 5px 20px 15px 20px;\n      min-width: 480px;\n      max-width: 600px;\n      border-radius: 20px;\n      background: #883131;\n      margin-left: 50%;\n      transform: translateX(-50%);\n      margin-top: 100px;\n\n      h3 {\n        color: white;\n      }\n\n      .neko-debug {\n        padding: 5px 10px;\n        background: #692426;\n        border-radius: 10px;\n\n        * {\n          margin: 0px;\n          padding: 0px;\n        }\n      }\n    }\n  }\n"],m||(m=p.slice(0)),r=Object.freeze(Object.defineProperties(p,{raw:{value:Object.freeze(m)}})))),y=function(e){var t=e.className,n=e.children,r=e.nekoErrors,a=void 0===r?[]:r,s=e.style,l=void 0===s?{}:s,d=h((0,o.useState)(!1),2),p=d[0],m=d[1],y=h((0,o.useState)(!1),2),v=y[0],b=y[1],x=(0,u.gR)("neko-page",t);if(a&&!p){var w,k=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=f(e))){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(a);try{for(k.s();!(w=k.n()).done;){var S=w.value;if(S){m(S);break}}}catch(e){k.e(e)}finally{k.f()}}return i().createElement(g,{className:x,style:l},p&&i().createElement("div",{className:"neko-rest-error"},i().createElement("div",{className:"container"},!v&&i().createElement(i().Fragment,null,i().createElement("h3",null,"The Rest API is disabled or broken 😢"),i().createElement("p",null,"The Rest API is required for this plugin to work. It is enabled in WordPress by default since December 2016 and used by the Gutenberg Editor since 2019. In short, it allows more robustness and a much cleaner infrastructure. Soon, Wordpress will entirely depends on it, so it is important to keep it enabled."),i().createElement("p",null,i().createElement("i",null,"Last but not least: check your PHP Error Logs and your Debugging Console.")),i().createElement("p",{className:"neko-debug"},i().createElement("small",null,"URL: ",p.url,i().createElement("br",null),"CODE: ",p.code,i().createElement("br",null),"MESSAGE: ",p.message,i().createElement("br",null)))),p.body&&v&&i().createElement("p",{className:"neko-debug"},i().createElement("div",{dangerouslySetInnerHTML:{__html:p.body}})),p.body&&i().createElement(c.M,{color:"#a94242",onClick:function(){return b(!v)}},v?"Hide":"Display"," response from server"),i().createElement(c.M,{color:"#a94242",onClick:function(){window.open("https://meowapps.com/fix-wordpress-rest-api/","_blank")}},"Learn about WordPress Debugging"))),n)},v=function(e){return i().createElement(y,e)};v.propTypes={className:s().string,style:s().object,nekoErrors:s().bool}},7039:(e,t,n)=>{"use strict";n.d(t,{d:()=>m});var r,o=n(1594),i=n.n(o),a=n(6365),s=n.n(a),l=n(3185),c=n(6897),u=["title","contentAlign","titleStyle"];function h(){return h=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},h.apply(this,arguments)}var f,d,p=(0,l.Ay)((function(e){var t=e.title,n=void 0===t?"":t,r=e.contentAlign,o=void 0===r?"left":r,a=e.titleStyle,s=void 0===a?{}:a,l=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,u),f=(0,c.gR)("neko-settings",e.className);return i().createElement("div",h({className:f},l),n?i().createElement("div",{className:"neko-settings-head",style:s},n):null,i().createElement("div",{className:"neko-settings-content neko-settings-content-align-".concat(o)},e.children))}))(r||(f=["\n  display: flex;\n  font-family: var(--neko-font-family);\n\n  > .neko-settings-head {\n    font-family: var(--neko-font-family);\n    font-size: var(--neko-font-size); \n    line-height: 17px;\n    width: 120px;\n    margin-right: 16px;\n    font-weight: 500;\n    color: var(--neko-main-color);\n  }\n\n  /* Select, Checkbox, Input need to be a bit higher to be in front of the settings title */\n\n  .neko-settings-content > .neko-select:first-child {\n    position: relative;\n    margin-top: -5px;\n  }\n  \n  .neko-settings-content > div:first-child .neko-checkbox-container {\n    margin-top: -5px;\n  }\n\n  .neko-settings-content > .neko-button:first-child {\n    position: relative;\n    margin-top: -5px;\n  }\n\n  .neko-settings-content > div:first-child > .neko-input {\n    position: relative;\n    margin-top: -5px;\n  }\n\n  > .neko-settings-content {\n    flex: 1;\n\n    &.neko-settings-content-align-right {\n      flex: none;\n      margin-left: auto;\n    }\n\n    input[type=text] {\n      width: 100%;\n    }\n\n\n  }\n\n  & + div {\n    margin-top: 10px;\n  }\n"],d||(d=f.slice(0)),r=Object.freeze(Object.defineProperties(f,{raw:{value:Object.freeze(d)}})))),m=function(e){return i().createElement(p,e)};m.propTypes={title:s().string,className:s().string,contentAlign:s().string,titleStyle:s().object}},6734:(e,t,n)=>{"use strict";n.d(t,{g:()=>y});var r,o,i,a=n(1594),s=n.n(a),l=n(6365),c=n.n(l),u=n(3185),h=["height","tiny","small","medium","large","line","style","children"];function f(){return f=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},f.apply(this,arguments)}function d(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var p=u.Ay.div(r||(r=d(["\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  width: 100%;\n  height: ",";\n"])),(function(e){var t=e.height;return"".concat(t,"px")})),m=u.Ay.div(o||(o=d(["\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  width: 100%;\n\n  hr {\n    width: 100%;\n    border: none;\n    border-top: 1px solid var(--neko-secondary);\n  }\n"]))),g=u.Ay.span(i||(i=d(["\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  position: relative;\n  width: 100%;\n  text-align: center;\n\n  &::before,\n  &::after {\n    content: '';\n    flex-grow: 1;\n    border-top: ",";\n    height: 0;\n  }\n\n  &::before {\n    margin-right: 0.5em;\n  }\n\n  &::after {\n    margin-left: 0.5em;\n  }\n"])),(function(e){return e.line?"1px solid var(--neko-secondary)":"none"})),y=function(e){var t=e.height,n=void 0===t?null:t,r=e.tiny,o=void 0!==r&&r,i=e.small,a=void 0===i||i,l=e.medium,c=void 0!==l&&l,u=e.large,d=void 0!==u&&u,y=e.line,v=void 0!==y&&y,b=e.style,x=e.children,w=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,h);return n||(x||c?n=30:o?n=5:d?n=45:a&&(n=15)),s().createElement(p,f({height:n,style:b},w),x&&s().createElement(g,{line:v},x),!x&&s().createElement(m,null,v&&s().createElement("hr",null)))};y.propTypes={height:c().number,line:c().bool,tiny:c().bool,small:c().bool,medium:c().bool,large:c().bool,style:c().object}},4547:(e,t,n)=>{"use strict";n.d(t,{N:()=>b,Y:()=>x});var r,o,i=n(1594),a=n.n(i),s=n(6365),l=n.n(s),c=n(3185),u=n(6897),h=n(8135),f=["fullWidth","minimal"];function d(){return d=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},d.apply(this,arguments)}function p(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var m=c.Ay.div(r||(r=p(["\n  display: flex;\n  flex-wrap: wrap;\n"]))),g=c.Ay.div(o||(o=p(["\n  flex: 1;\n  padding: 32px 30px;\n\n  .neko-block:not(:first-child) {\n    margin-top: -20px;\n  }\n\n  .neko-block:last-child {\n    margin-bottom: 0px;\n  }\n\n  &.minimal {\n    padding: 0;\n  }\n\n  &.full {\n    flex-basis: 100%;\n    padding-bottom: 0;\n  }\n\n  & + .full {\n    padding-bottom: 32px;\n    padding-top: 0;\n  }\n\n  &:not(.full) + div:not(.full) {\n    padding-left: 0;\n  }\n"]))),y=function(e){return a().createElement(m,{className:"neko-wrapper"},e.children)},v=function(e){var t=e.fullWidth,n=e.minimal,r=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,f),o=(0,u.gR)("neko-column",{full:t},{minimal:n});return a().createElement(g,d({className:o},r),e.children)},b=function(e){return a().createElement(h.YS,null,a().createElement(y,e))},x=function(e){return a().createElement(h.YS,null,a().createElement(v,e))};b.propTypes={},x.propTypes={fullWidth:l().any}},374:(e,t,n)=>{"use strict";n.d(t,{G:()=>h});var r=n(1594),o=n(5206),i=n.n(o),a=n(6365),s=n.n(a),l=n(6897),c=n(2564);function u(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 h=function(e){var t,n,o=e.children,a=e.visible,s=void 0!==a&&a,h=e.targetRef,f=e.onClose,d=(0,r.useRef)(),p=(t=(0,r.useState)(0),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return u(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)?u(e,t):void 0}}(t,n)||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.")}()),m=p[0],g=p[1];(0,l.jz)((function(){s&&f()}),[h,d]),(0,r.useEffect)((function(){var e=document.createElement("div");return d.current=e,function(){d.current=null}}),[]);var y=function(){s&&d.current&&h.current&&requestAnimationFrame((function(){for(var e=h.current.getBoundingClientRect(),t=window.innerHeight,n=d.current.querySelector(".neko-portal-content");n&&!n.offsetHeight;)n=n.firstChild;var r=n?n.offsetHeight:0,o=t-e.bottom<r?e.top-r:e.bottom;Object.assign(d.current.style,{position:"fixed",top:"".concat(o,"px"),left:"".concat(e.left,"px"),width:"".concat(e.width,"px"),zIndex:"9999"})}))};if((0,r.useEffect)((function(){if(s&&d.current){document.body.appendChild(d.current);var e=setTimeout((function(){y(),g(1)}),5);return function(){return clearTimeout(e)}}if(d.current){var t=d.current.parentNode;t&&t.removeChild(d.current),g(0)}}),[s,d,h]),(0,r.useLayoutEffect)((function(){y();var e=function(){return y()};return window.addEventListener("resize",e),window.addEventListener("scroll",e),function(){window.removeEventListener("resize",e),window.removeEventListener("scroll",e)}}),[s,d,h]),!s||!d.current)return null;var v={opacity:m,transition:"opacity 0.2s cubic-bezier(0.22, 0.61, 0.36, 1)"};return i().createPortal(React.createElement("div",{className:"neko-portal-content",style:v},React.createElement(c.A,null,o)),d.current)};h.propTypes={children:s().node.isRequired,visible:s().bool,targetRef:s().object.isRequired,onClose:s().func}},197:(e,t,n)=>{"use strict";n.d(t,{X:()=>h});var r,o,i,a=n(1594),s=n.n(a),l=n(6365),c=n.n(l),u=n(3185).Ay.section(r||(o=["\n  .mask {\n    position: absolute;\n    overflow: hidden;\n    display: block;\n    width: ","px;\n    height: ","px;\n  }\n\n  .semi-circle {\n    position: relative;\n    display: block;\n    width: ","px;\n    height: ",'px;\n    background: linear-gradient(to right, #27b775 0%, #f3f32c 50%, #f71b1b 100%);\n    border-radius: 50% 50% 50% 50% / 100% 100% 0% 0% ;\n\n    &::before {\n      content: "";\n      position: absolute;\n      bottom: 0;\n      left: 50%;\n      z-index: 2;\n      display: block;\n      width: 140px;\n      height: 70px;\n      margin-left: -70px;\n      background: ',";\n      border-radius: 50% 50% 50% 50% / 100% 100% 0% 0% ;\n    }      \n  }\n\n  .semi-circle--mask {\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: ","px;\n    height: ",'px;\n    background: transparent;\n    transform-origin: center center;\n    backface-visibility: hidden;\n    transition: all .3s ease-in-out;\n\n    &::before {\n      content: "";\n      position: absolute;\n      top: 0;\n      left: 0%;\n      z-index: 2;\n      display: block;\n      width: ',"px;\n      height: ","px;\n      margin-top: -1px;\n      margin-left: -1px;\n      background: #5396c1d6;\n      border-radius: 50% 50% 50% 50% / 100% 100% 0% 0% ;\n    }      \n  }\n\n  .gauge { \n    width: ","px;\n    height: ","px;\n    \n    .semi-circle--mask {\n      transform: rotate(","deg) translate3d(0,0,0);\n    }\n  }\n\n  .child-container {\n    position: absolute;\n    font-size: 16px;\n    display: flex;\n    width: ","px;\n    height: ","px;\n    z-index: 10;\n\n    .spacing {\n      flex: auto;\n    }\n\n    .child {\n      color: white;\n      flex: 1;\n      display: flex;\n      flex-direction: column;\n      align-items: center;\n    }\n  }\n"],i||(i=o.slice(0)),r=Object.freeze(Object.defineProperties(o,{raw:{value:Object.freeze(i)}}))),(function(e){return e.width}),(function(e){return e.width/2}),(function(e){return e.width}),(function(e){return e.width/2}),(function(e){return e.backgroundColor}),(function(e){return e.width}),(function(e){return e.width}),(function(e){return e.width+2}),(function(e){return e.width/2+2}),(function(e){return e.width}),(function(e){return e.width/2}),(function(e){return e.degrees}),(function(e){return e.width+2}),(function(e){return e.width/2})),h=function(e){var t=e.value,n=void 0===t?1e3:t,r=(e.min,e.max),o=void 0===r?2500:r,i=e.width,a=void 0===i?200:i,l=e.background,c=void 0===l?"#007cba":l,h=e.children,f=180*(n<=o?n:o)/o;return s().createElement(u,{className:"neko-gauge",backgroundColor:c,degrees:f,width:a},s().createElement("div",{class:"gauge"},s().createElement("div",{class:"mask"},s().createElement("div",{class:"semi-circle"}),s().createElement("div",{class:"semi-circle--mask"})),s().createElement("div",{class:"child-container"},s().createElement("div",{class:"child"},s().createElement("div",{class:"spacing"}),h))))};h.propTypes={value:c().number,min:c().number,max:c().number,width:c().number,background:c().string}},3804:(e,t,n)=>{"use strict";n.d(t,{n:()=>b});var r,o,i,a=n(1594),s=n.n(a),l=n(6365),c=n.n(l),u=n(3185),h=u.Ay.div(r||(o=["\n  display: flex;\n  max-width: 128px;\n  max-height: 128px;\n\n  & > * {\n    width: 100%;\n    height: auto;\n    object-fit: contain;\n  }\n"],i||(i=o.slice(0)),r=Object.freeze(Object.defineProperties(o,{raw:{value:Object.freeze(i)}})))),f=function(){return s().createElement(h,{className:"neko-logo"},s().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 1434 947"},s().createElement("path",{fill:"#000",d:"M805 777a792 792 0 0 1-262-43 811 811 0 0 1-286-164A959 959 0 0 1 6 200 158 158 0 0 1 304 97c41 96 94 175 159 233a497 497 0 0 0 376 129 60 60 0 0 1 67 60l27 186c4 33-18 63-51 68-6 0-34 4-77 4ZM122 168l2 5a841 841 0 0 0 212 307 692 692 0 0 0 469 177l-11-76a616 616 0 0 1-412-162 769 769 0 0 1-188-276 38 38 0 0 0-50-20c-18 7-27 27-22 45Z"}),s().createElement("path",{fill:"#FDA960",d:"m64 184 4 12a900 900 0 0 0 228 329 752 752 0 0 0 577 188l-27-194a563 563 0 0 1-423-144 709 709 0 0 1-174-255 98 98 0 0 0-185 64Z"}),s().createElement("mask",{id:"a",width:"814",height:"657",x:"60",y:"60",maskUnits:"userSpaceOnUse"},s().createElement("path",{fill:"#fff",d:"m64 184 4 12a900 900 0 0 0 228 329 752 752 0 0 0 577 188l-27-194a563 563 0 0 1-423-144 709 709 0 0 1-174-255 98 98 0 0 0-185 64Z"})),s().createElement("g",{mask:"url(#a)"},s().createElement("path",{fill:"#804625",d:"M120 532c-41 0-84-5-130-15l31-145c101 21 180 12 233-27 70-51 80-141 80-142l149 13a363 363 0 0 1-139 248 351 351 0 0 1-224 68Zm369 175c47-31 84-71 110-116 32-56 46-123 42-192-3-51-15-87-16-91l-141 48a225 225 0 0 1-15 161c-33 58-101 99-203 120l30 146c76-16 141-41 193-76ZM62 269c64-4 122-22 174-53A413 413 0 0 0 421-47L184-92v-1s-16 71-73 103C92 21 70 27 44 29 7 31-37 24-86 8l-74 229a623 623 0 0 0 222 32Z"})),s().createElement("path",{fill:"#000",d:"M1373 947h-110c-33 0-60-27-60-60v-97l-36 87a62 62 0 0 1-56 37h-79c-25 0-46-14-56-37l-36-87v97c0 33-27 60-60 60H769c-33 0-60-27-60-60V316c0-33 27-60 60-60h141c24 0 46 15 55 37l106 258 107-258c9-22 31-37 55-37h140c34 0 60 27 60 60v571c0 33-26 60-60 60Zm-316-188 14 34 15-34-11 1h-7l-11-1Zm199-314h7c21 0 40 11 50 28v-97h-40l-29 70 12-1Zm-427-69v97c11-17 29-28 51-28h6l13 1-29-70h-41Z"}),s().createElement("path",{fill:"#fff",d:"M769 887V316h141l158 384h7l158-384h140v571h-110V505h-7l-145 349h-79L886 505h-6v382H769Z"})))},d=function(e){return s().createElement(f,e)};d.propTypes={};var p,m=n(8922),g=n(9300),y=u.Ay.div(p||(p=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n  position: relative;\n  color: white;\n  font-family: var(--neko-font-family);\n  font-size: var(--neko-font-size);\n  display: flex;\n  height: 60px;\n  overflow: hidden;\n  align-items: center;\n  padding: 15px 32px;\n  background-color: var(--neko-main-color);\n  display: flex;\n\n  .neko-header-logo-container {\n    width: 40px;\n    height: 40px;\n    padding: 10px;\n    margin-right: 15px;\n    background: rgba(0, 0, 0, 0.1);\n    border-radius: 100%;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n  }\n\n  .neko-header-title-container {\n    flex-direction: column;\n    display: flex;\n\n    .neko-header-title {\n      color: white;\n      font-family: var(--neko-font-family);\n      font-size: 23px;\n      line-height: normal;\n      margin: 0;\n    }\n\n    .neko-header-subtitle {\n      color: white;\n      font-family: var(--neko-font-family);\n      line-height: normal;\n      font-size: var(--neko-font-size);\n    }\n  }\n\n  .neko-header-extra-content {\n    flex: 1;\n    margin: 0 20px;\n  }\n"]))),v=function(e){var t=e.title,n=void 0===t?"NekoUI":t,r=e.subtitle,o=void 0===r?"♥️ By Meow Apps":r,i=e.children,a=e.saving,l=void 0!==a&&a;return s().createElement(y,{className:"neko-header"},s().createElement("div",{className:"neko-header-logo-container"},s().createElement(d,null)),s().createElement("div",{className:"neko-header-title-container"},s().createElement("h1",{className:"neko-header-title"},n),s().createElement("small",{className:"neko-header-subtitle"},s().createElement("a",{target:"_blank",href:"https://meowapps.com",style:{color:"white",textDecoration:"none"}},o))),s().createElement("div",{className:"neko-header-extra-content"},i),l&&s().createElement(m.z,{icon:g.A,width:"36",height:"36"}))},b=function(e){return s().createElement(v,e)};b.propTypes={title:c().string,subtitle:c().string,saving:c().bool}},8922:(e,t,n)=>{"use strict";n.d(t,{z:()=>Re});var r=n(1594),o=n.n(r),i=n(6365),a=n.n(i),s=n(3185),l=n(5977),c=n(3271),u=n(5207),h=n(7326),f=n(5962),d=n(6029),p=n(5074),m=n(21),g=n(4555),y=n(6382),v=n(1299),b=n(8843),x=n(1086),w=n(4501),k=n(3594),S=n(8957),O=n(4142),_=n(7695),E=n(4300),C=n(1860),A=(n(6268),n(6982)),j=n(858),P=n(5241),M=n(2849),R=n(552),T=n(8841),L=n(1373),I=n(7073),N=n(4613),z=n(9538),D=n(7894),F=n(7297),B=n(9966),$=n(9829),H=n(1333),W=n(2477),q=n(9014),V=n(9077),U=n(257),K=n(757),Q=n(67),G=n(3860),Y=n(4753),Z=n(2079),X=n(9931),J=n(6200),ee=n(3102),te=n(6123),ne=n(6304),re=n(9057),oe=n(2693),ie=n(9728),ae=n(1097),se=n(4196),le=n(2600),ce=n(146),ue=n(4611);const he={duplicate:n(3104).A,lock:c.A,"lock-open":u.A,"file-undo":h.A,"chevron-double-left":f.A,"chevron-double-right":d.A,"chevron-left":p.A,"chevron-right":m.A,"chevron-down":g.A,"chevron-up":y.A,pause:v.A,play:b.A,replay:x.A,check:w.A,"check-circle":k.A,stop:S.A,delete:O.A,undo:_.A,alert:E.A,database:C.A,tools:A.A,cog:j.A,close:P.A,cat:M.A,upload:G.A,trash:R.A,pencil:T.A,dashboard:L.A,search:I.A,folder:N.A,"folder-open":z.A,"image-multiple-outline":D.A,plus:F.A,"folder-plus":B.A,"image-plus":$.A,"view-grid":H.A,"format-list-bulleted":W.A,twitter:q.A,instagram:V.A,facebook:U.A,star:K.A,"timer-outline":Q.A,link:Y.A,linkedin:Z.A,pinterest:X.A,"zoom-in":J.A,"info-outline":ee.A,"image-off-outline":te.A,"arrow-up":ne.A,"arrow-down":re.A,sort:oe.A,eye:ie.A,"rocket-launch":ae.A,"calendar-month":se.A,wand:le.A,mastodon:ce.A,filter:ue.A};var fe,de,pe=n(6897);function me(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 ge(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var ye=s.Ay.div(fe||(fe=ge(["\n  display: inline-block;\n  position: relative;\n"]))),ve=s.Ay.div(de||(de=ge(["\n  background-color: rgba(0, 0, 0, 0.8);\n  border-radius: 4px;\n  color: var(--neko-white);\n  font-family: var(--neko-font-family);\n  font-weight: normal;\n  font-size: var(--neko-font-size);\n  padding: 8px 12px;\n  position: absolute;\n  max-width: ","px;\n  width: max-content;\n  word-break: break-word;\n  opacity: ",';\n  transition: opacity 0.11s ease-in-out, transform 0.11s ease-in-out;\n  z-index: 100;\n  white-space: normal;\n  &:before {\n    content: "";\n    position: absolute;\n    border: 4px solid transparent;\n  }\n  ',"\n"])),(function(e){return e.maxWidth}),(function(e){return e.visible?1:0}),(function(e){var t="5px";switch(e.position){case"top":return"\n          bottom: 100%;\n          left: 50%;\n          transform: translateX(-50%) translateY(".concat(e.visible?"0":t,");\n          &:before {\n            top: 100%;\n            left: 50%;\n            margin-left: -4px;\n            border-top: 4px solid rgba(0, 0, 0, 0.8);\n          }\n        ");case"bottom":return"\n          top: 100%;\n          left: 50%;\n          transform: translateX(-50%) translateY(".concat(e.visible?"0":"-".concat(t),");\n          &:before {\n            bottom: 100%;\n            left: 50%;\n            margin-left: -4px;\n            border-bottom: 4px solid rgba(0, 0, 0, 0.8);\n          }\n        ");case"left":return"\n          top: 50%;\n          right: 100%;\n          transform: translateY(-50%) translateX(".concat(e.visible?"0":"-".concat(t),");\n          &:before {\n            top: 50%;\n            left: 100%;\n            margin-top: -4px;\n            border-left: 4px solid rgba(0, 0, 0, 0.8);\n          }\n        ");case"right":return"\n          top: 50%;\n          left: 100%;\n          transform: translateY(-50%) translateX(".concat(e.visible?"0":t,");\n          &:before {\n            top: 50%;\n            right: 100%;\n            margin-top: -4px;\n            border-right: 4px solid rgba(0, 0, 0, 0.8);\n          }\n        ");default:return""}})),be=function(e){var t,n,i=e.text,a=void 0===i?"Hello world!":i,s=e.position,l=void 0===s?"top":s,c=e.maxWidth,u=void 0===c?160:c,h=(t=(0,r.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return me(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)?me(e,t):void 0}}(t,n)||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.")}()),f=h[0],d=h[1],p=(0,pe.G8)((function(e){return d(e)}),100);return o().createElement(ye,{className:"neko-tooltip"},o().createElement(ve,{visible:f,position:l,maxWidth:u},a),o().createElement("div",{onMouseEnter:function(){return a&&p(!0)},onMouseLeave:function(){return p(!1)}},e.children))},xe=function(e){return o().createElement(be,e)};xe.propTypes={text:a().string,position:a().oneOf(["top","right","bottom","left"]),maxWidth:a().number};var we,ke,Se,Oe=["icon","color","spinning","className","tooltip","raw","isBusy","variant","title","containerStyle","hoverColor","disabled"];function _e(){return _e=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},_e.apply(this,arguments)}function Ee(e){return Ee="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},Ee(e)}function Ce(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Ae=s.Ay.div(we||(we=Ce(["\n  display: flex;\n  align-items: center;\n"]))),je=(0,s.Ay)(l.In)(ke||(ke=Ce(["\n  path {\n    fill: ",";\n  }\n\n  ","\n\n  &.neko-clickable {\n    cursor: pointer;\n  }\n\n  &.spin {\n    animation-name: spin;\n    animation-duration: 700ms;\n    animation-iteration-count: infinite;\n    animation-timing-function: linear;\n\n    @keyframes spin {\n      from {\n        transform: rotate(0deg);\n      }\n      to {\n        transform: rotate(360deg);\n      }\n    }\n  }\n\n  &.disabled {\n    pointer-events: none;\n    opacity: 0.35;\n    cursor: default;\n  }\n"])),(function(e){return e.color}),(function(e){return t=e.color,(n=e.hoverColor)?"\n      &:hover {\n        path {\n          fill: ".concat(n,";\n        }\n      }\n    "):t?"\n      &:hover {\n        path {\n          filter: brightness(1.03);\n        }\n      }\n    ":void 0;var t,n})),Pe=s.Ay.div(Se||(Se=Ce(["\n  width: 25px;\n  height: auto;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n\n  img {\n    width: auto !important;\n    height: 25px !important;\n  }\n"]))),Me={primary:{color:"var(--neko-blue)"},success:{color:"var(--neko-green)"},warning:{color:"var(--neko-yellow)"},danger:{color:"var(--neko-red)"}},Re=function(e){var t=e.icon,n=e.color,i=e.spinning,a=void 0!==i&&i,s=e.className,l=void 0===s?"":s,c=e.tooltip,u=e.raw,h=e.isBusy,f=void 0!==h&&h,d=e.variant,p=e.title,m=e.containerStyle,g=e.hoverColor,y=e.disabled,v=void 0!==y&&y,b=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,Oe),x=d&&Me[d]?Me[d].color:n,w=d&&Me[d]?Me[d].hoverColor:g;b.width||b.height||(b.width=b.height=30);var k=(0,r.useMemo)((function(){return"string"==typeof t&&he[t]?he[t]:t}),[t]),S=(0,r.useMemo)((function(){return!!he[t]||"object"===Ee(t)}),[t]),O=(0,pe.gR)("neko-icon",l,{"neko-clickable":!!b.onClick},{spin:a},{disabled:v});return c?o().createElement(xe,{text:c.text,position:c.position||"top"},o().createElement(Ae,{style:m},o().createElement(je,_e({icon:k,className:O,color:x,hoverColor:w},b)))):u?S?o().createElement(je,_e({icon:k,className:O,color:x,hoverColor:w},b)):o().createElement(Pe,null,k):f&&!v?o().createElement(Pe,null,o().createElement("img",{src:"/wp-includes/images/spinner-2x.gif",alt:"loading"})):o().createElement(Ae,{style:m,title:p},S&&o().createElement(je,_e({icon:k,className:O,color:x,hoverColor:w},b)),!S&&o().createElement(Pe,_e({className:O,color:x,hoverColor:w},b),k),c?o().createElement(xe,null,c):null)};Re.propTypes={icon:a().oneOfType([a().instanceOf(l.In),a().oneOf(["duplicate","lock","lock-open","file-undo","chevron-double-left","chevron-double-right","chevron-left","chevron-right","chevron-down","chevron-up","pause","play","replay","check","check-circle","stop","delete","undo","alert","database","tools","cog","close","cat","upload","trash","pencil","dashboard","search","folder","folder-open","image-multiple-outline","plus","folder-plus","image-plus","view-grid","format-list-bulleted","twitter","instagram","facebook","star","timer-outline","link","linkedin","pinterest","zoom-in","info-outline","image-off-outline","arrow-up","arrow-down","sort","eye","rocket-launch","calendar-month","wand","mastodon","filter"])]),color:a().string,spinning:a().bool,className:a().string,tooltip:a().string,raw:a().bool,isBusy:a().bool,variant:a().string}},1843:(e,t,n)=>{"use strict";n.d(t,{K:()=>v,o:()=>y});var r,o,i=n(1594),a=n.n(i),s=n(6365),l=n.n(s),c=n(3185),u=n(8922),h=n(6897);function f(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var d=c.Ay.div(r||(r=f(["\n  display: flex;\n  align-items: center;\n"]))),p=c.Ay.span(o||(o=f(['\n  color: var(--neko-main-color);\n  cursor: pointer;\n  font-family: var(--neko-font-family);\n  font-style: normal;\n  font-weight: normal;\n  line-height: 17px;\n\n  &:hover:not(.active) {\n    filter: brightness(1.2);\n  }\n\n  &.active {\n    cursor: default;\n    color: var(--neko-gray-30);\n    font-weight: bold;\n  }\n\n  &::after {\n    content: "|";\n    color: var(--neko-disabled-color);\n    font-weight: normal;\n    padding: 0 4px;\n  }\n\n  &:last-child::after {\n    content: none;\n  }\n\n  span {\n    color: var(--neko-disabled-color);\n    font-weight: normal;\n    margin-left: 4px;\n  }\n']))),m=function(e){var t=e.name,n=e.value,r=e.onChange,o=e.busy,i=void 0!==o&&o,s=e.className,l=(0,h.gR)("neko-quick-links",s),c=a().Children.toArray(e.children).filter((function(e){return!!e})).map((function(e){return a().cloneElement(e,{busy:i,isActive:e.props.value===n,onClick:function(e){e!==n&&r(e,t)}})}));return a().createElement(d,{className:l},c)},g=function(e){var t=e.title,n=e.value,r=void 0===n?0:n,o=e.count,i=e.onClick,s=e.busy,l=e.isActive,c=void 0!==l&&l,f=e.className,d=(0,h.gR)("neko-link",f,{active:c});return a().createElement(p,{onClick:function(){return i(r)},className:d},t,void 0===o?null:a().createElement("span",null,"(",s?a().createElement(u.z,{icon:"replay",spinning:!0,width:12,containerStyle:{display:"inline"}}):o,")"))},y=function(e){return a().createElement(m,e)};y.propTypes={name:l().string,value:l().string,onChange:l().func};var v=function(e){return a().createElement(g,e)};v.propTypes={title:l().string,value:l().string,count:l().number,onClick:l().func,isActive:l().bool}},7392:(e,t,n)=>{"use strict";n.d(t,{k:()=>v});var r=n(6365),o=n.n(r),i=n(4461),a=n(9296);function s(e){return s="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},s(e)}function l(){l=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",u=i.toStringTag||"@@toStringTag";function h(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(e){h=function(e,t,n){return e[t]=n}}function f(e,t,n,r){var i=t&&t.prototype instanceof b?t:b,a=Object.create(i.prototype),s=new R(r||[]);return o(a,"_invoke",{value:A(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=f;var p="suspendedStart",m="suspendedYield",g="executing",y="completed",v={};function b(){}function x(){}function w(){}var k={};h(k,a,(function(){return this}));var S=Object.getPrototypeOf,O=S&&S(S(T([])));O&&O!==n&&r.call(O,a)&&(k=O);var _=w.prototype=b.prototype=Object.create(k);function E(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(o,i,a,l){var c=d(e[o],e,i);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==s(h)&&r.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,a,l)}),(function(e){n("throw",e,a,l)})):t.resolve(h).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,l)}))}l(c.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 A(t,n,r){var o=p;return function(i,a){if(o===g)throw new Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var l=j(s,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=g;var c=d(t,n,r);if("normal"===c.type){if(o=r.done?y:m,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function j(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,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=d(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}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 M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function T(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(s(t)+" is not iterable")}return x.prototype=w,o(_,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:x,configurable:!0}),x.displayName=h(w,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,h(e,u,"GeneratorFunction")),e.prototype=Object.create(_),e},t.awrap=function(e){return{__await:e}},E(C.prototype),h(C.prototype,c,(function(){return this})),t.AsyncIterator=C,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new C(f(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(_),h(_,u,"Generator"),h(_,a,(function(){return this})),h(_,"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=T,R.prototype={constructor:R,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(M),!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 s.type="throw",s.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],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)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,v):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),v},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),M(n),v}},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;M(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function c(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function u(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){c(i,r,o,a,s,"next",e)}function s(e){c(i,r,o,a,s,"throw",e)}a(void 0)}))}}function h(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,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(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)?f(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 f(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 d=wp.element,p=d.useEffect,m=d.useRef,g=d.useState,y={marginTop:10,background:"rgb(0, 72, 88)",padding:10,color:"rgb(58, 212, 58)",maxHeight:400,minHeight:200,display:"block",fontFamily:"monospace",fontSize:12,whiteSpace:"pre",overflowX:"auto",borderRadius:10,textWrap:"balance"},v=function(e){var t=e.refreshQuery,n=e.clearQuery,r=e.onRefresh,o=void 0===r?null:r,s=e.onClear,c=void 0===s?null:s,f=e.i18n,d=e.refreshOnMount,v=void 0===d||d,b=e.scrollToBottom,x=void 0!==b&&b,w=e.blockMaxWidth,k=void 0===w?800:w,S=m(null),O=h(g(""),2),_=O[0],E=O[1],C=h(g(!1),2),A=C[0],j=C[1],P=function(){var e=u(l().mark((function e(){var n;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return j(!0),e.next=3,t();case 3:n=e.sent,o&&o(n),E(n),j(!1);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),M=function(){var e=u(l().mark((function e(){var t;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return j(!0),e.next=3,n();case 3:t=e.sent,c&&c(t),E(""),j(!1);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return p((function(){v&&P()}),[]),p((function(){x&&S.current&&S.current.scrollTo(0,S.current.scrollHeight)}),[_]),React.createElement(i.z,{title:f.COMMON.LOGS,busy:A,className:"primary",style:{maxWidth:k}},React.createElement(a.M,{onClick:function(){return P()}},f.COMMON.REFRESH_LOGS),React.createElement(a.M,{className:"danger",onClick:function(){return M()}},f.COMMON.CLEAR_LOGS),React.createElement("div",{style:y,ref:S},_))};v.propTypes={refreshQuery:o().func,clearQuery:o().func,onRefresh:o().func,onClear:o().func,i18n:o().object,refreshOnMount:o().bool,scrollToBottom:o().bool,blockMaxWidth:o().number}},7213:(e,t,n)=>{"use strict";n.d(t,{X:()=>g});var r,o=n(1594),i=n.n(o),a=n(6365),s=n.n(a),l=n(3185),c=n(6897),u=["variant","children"];function h(){return h=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},h.apply(this,arguments)}var f,d,p=l.Ay.div(r||(f=["\n  padding: 20px;\n  color: white;\n  border-radius: 5px;\n\n  &.danger {\n    background: #ba341e;\n  }\n\n  &.success {\n    background: var(--neko-green);\n  }\n\n  &.special {\n    background: var(--neko-purple);\n  }\n\n  &.warning {\n    background: var(--neko-orange);\n  }\n\n  &.info {\n    background: var(--neko-blue);\n  }\n\n  a {\n    color: white;\n    font-weight: bold;\n  }\n"],d||(d=f.slice(0)),r=Object.freeze(Object.defineProperties(f,{raw:{value:Object.freeze(d)}})))),m=function(e){var t=e.variant,n=e.children,r=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,u);t||(t="info");var o=(0,c.gR)("neko-message",{danger:"danger"===t},{success:"success"===t},{info:"info"===t},{warning:"warning"===t},{special:"special"===t});return i().createElement(p,h({className:o},r),n)},g=function(e){return i().createElement(m,e)};g.propTypes={variant:s().string,children:s().node}},520:(e,t,n)=>{"use strict";n.d(t,{Q:()=>b});var r,o=n(1594),i=n.n(o),a=n(6365),s=n.n(a),l=n(3185),c=n(5977),u=n(5962),h=n(5074),f=n(6029),d=n(21);function p(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 m,g,y=l.Ay.div(r||(m=["\n  align-items: center;\n  display: flex;\n  user-select: none;\n\n  .neko-paging-text {\n    font-family: var(--neko-font-family);\n    font-style: normal;\n    font-weight: normal;\n    font-size: 15px;\n    line-height: 14px;\n    margin-right: 15px;\n  }\n\n  .neko-paging-controller {\n    box-sizing: border-box;\n    height: 30px;\n    align-items: center;\n    background: var(--neko-main-color);\n    border-radius: 15px;\n    display: flex;\n    padding: 3px 5px;\n\n    .nako-paging-controller-icon {\n      background-color: white;\n      border-radius: 100%;\n      cursor: pointer;\n      margin-right: 2px;\n      height: 22px;\n      width: 22px;\n      transition: transform 0.1s ease-in;\n      box-sizing: border-box;\n\n      :last-child {\n        margin-right: 0;\n      }\n\n      &.disabled {\n        color: var(--neko-disabled-color);\n        cursor: default;\n        pointer-events: none;\n      }\n\n      &:hover {\n        transform: scale(1.2) !important;\n        z-index: 10;\n        position: relative;\n      }\n    }\n\n    .nako-paging-controller-text {\n      color: white;\n      font-family: var(--neko-font-family);\n      font-style: normal;\n      font-weight: normal;\n      font-size: var(--neko-font-size);\n      margin: 0 40px;\n      user-select: none;\n    }\n\n    span.neko-paging-current-page {\n      cursor: pointer;\n      text-decoration: underline;\n    }\n\n    input.neko-paging-current-page {\n      width: 1.5rem;\n    }\n  }\n"],g||(g=m.slice(0)),r=Object.freeze(Object.defineProperties(m,{raw:{value:Object.freeze(g)}})))),v=function(e){var t,n,r=e.currentPage,a=e.limit,s=void 0===a?0:a,l=e.onClick,m=e.total,g=void 0===m?0:m,v=e.onCurrentPageChanged,b=e.infinite,x=void 0!==b&&b,w=e.maxInfinite,k=void 0!==w&&w,S=e.controllerText,O=!!v,_=(0,o.useMemo)((function(){return x||k?0:Math.ceil(0===g?1:s>0?g/s:1)}),[x,k,s,g]),E="nako-paging-controller-icon ".concat(x||1!==r?"":"disabled"),C="nako-paging-controller-icon ".concat(x||k||r!==_?"":"disabled"),A=(t=(0,o.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return p(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)?p(e,t):void 0}}(t,n)||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.")}()),j=A[0],P=A[1],M=function(e){P(!1),l(e)},R=function(e){if(x)return e;var t=Number(e);return k?t<1?1:t:t>_?_:t<1?1:t},T=function(e){var t=e.target.value;isNaN(t)||v(R(t)),P(!1)},L=function(e){if("Enter"===event.key){e.preventDefault();var t=e.target.value;isNaN(t)||v(R(t)),P(!1)}},I=(0,o.useMemo)((function(){return j?i().createElement("input",{autoFocus:!0,type:"text",className:O?"neko-paging-current-page":"",defaultValue:r,onBlur:T,onKeyPress:L}):i().createElement("span",{className:O?"neko-paging-current-page":"",onClick:function(){O&&P(!0)}},r)}),[r,j,v]),N=function(e){j&&e.target===e.currentTarget&&P(!1)};return i().createElement(y,{className:"nako-paging"},!!g&&i().createElement("span",{className:"neko-paging-text"},g," result",g>0?"s":""),i().createElement("div",{className:"neko-paging-controller",onClick:N},!x&&!k&&i().createElement(c.In,{icon:u.A,className:E,onClick:function(){return M(1)}}),i().createElement(c.In,{icon:h.A,className:E,onClick:function(){return M(r-1)}}),i().createElement("p",{className:"nako-paging-controller-text",onClick:N},S||i().createElement(i().Fragment,null,"Page ",I," of ",_)),i().createElement(c.In,{icon:d.A,className:C,onClick:function(){return M(r+1)}}),!x&&!k&&i().createElement(c.In,{icon:f.A,className:C,onClick:function(){return M(_)}})))},b=function(e){return i().createElement(v,e)};b.propTypes={currentPage:s().number,limit:s().number,total:s().number,onClick:s().func,lastPage:s().number,infinite:s().bool,maxInfinite:s().bool,controllerText:s().object}},851:(e,t,n)=>{"use strict";n.d(t,{j:()=>w});var r,o,i=n(1594),a=n.n(i),s=n(6365),l=n.n(s),c=n(3185),u=n(5977),h=n(1299),f=n(8957),d=n(8843),p=n(6897),m=["value","max","busy","paused","status","className"];function g(e){return g="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},g(e)}function y(){return y=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},y.apply(this,arguments)}function v(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var b=(0,c.Ay)((function(e){var t=e.value,n=void 0===t?0:t,r=e.max,o=void 0===r?100:r,i=e.busy,s=void 0!==i&&i,l=e.paused,c=void 0!==l&&l,g=e.status,v=e.className,b=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,m);n=Math.min(n,o);var w=parseFloat(n)/parseFloat(o),k=(0,p.gR)("neko-progress",v);return a().createElement("div",y({className:k},b),a().createElement(x,{ratio:w,busy:e.busy,status:g}),a().createElement("div",{className:"neko-progress-buttons"},s&&e.onPauseClick&&a().createElement("div",{className:"neko-progress-button pause",onClick:e.onPauseClick},c?a().createElement(u.L3,{icon:d.A}):a().createElement(u.L3,{icon:h.A})),s&&e.onStopClick&&a().createElement("div",{className:"neko-progress-button stop",onClick:e.onStopClick},a().createElement(u.L3,{icon:f.A}))))}))(r||(r=v(["\n  position: relative;\n  box-sizing: border-box;\n  height: 30px;\n  background: linear-gradient(\n    180deg,\n    rgba(0, 0, 0, 0.06) 0%,\n    rgba(0, 0, 0, 0.02) 50%,\n    rgba(0, 0, 0, 0.10) 100%\n  );\n  border-radius: 12px;\n\n  .neko-progress-buttons {\n    position: absolute;\n    height: 100%;\n    right: 0px;\n    display: flex;\n    align-items: center;\n    padding-right: 5px;\n\n    .neko-progress-button {\n      border: none;\n      display: flex;\n      justify-content: center;\n      align-items: center;\n      margin-left: 2px;\n      border-radius: 100%;\n      color: white;\n      padding: 2px;\n      width: 18px;\n      height: 18px;\n      background-color: var(--neko-main-color);\n\n      &:hover {\n        background-color: var(--neko-lighten-blue);\n      }\n\n      &.stop {\n        background: var(--neko-red);\n\n        &:hover {\n          background-color: var(--neko-lighten-red);\n        }\n      }\n    }\n  }\n"]))),x=(0,c.Ay)((function(e){var t,n,r,o,i=isNaN(e.ratio)?0:parseInt(Math.round(100*e.ratio)),s=g(e.status),l=(0,p.gR)("neko-progress-current",e.className),c="undefined"!==s?"string"===s?e.status:e.status(i):"".concat(i,"%");return a().createElement("div",{className:l,style:(t={minWidth:28},n="minWidth",r=i+"%",o=function(e,t){if("object"!=g(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=g(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(n),(n="symbol"==g(o)?o:String(o))in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t)},a().createElement("div",null,c))}))(o||(o=v(["\n  box-sizing: border-box;\n  position: absolute;\n  overflow: hidden;\n  top: 0; left: 0;\n  height: 100%;\n  background-color: var(--neko-main-color);\n  border-radius: 12px;\n  text-align: center;\n  padding: 0 10px;\n  vertical-align: middle;\n  color: white;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  transition: min-width .2s ease-out;\n  background-size: 30px 30px;\n  background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%,\n                    transparent 25%,\n                    transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,\n                    transparent 75%, transparent);\n  animation: ",";\n\n  @keyframes animate-stripes {\n    0% { background-position: 0 0; }\n    100% { background-position: 60px 0; }\n  }\n"])),(function(e){return e.busy?"animate-stripes 1.6s linear infinite":"none"})),w=function(e){return a().createElement(b,e)};w.propTypes={value:l().number,max:l().number,busy:l().bool,paused:l().bool,onPauseClick:l().func,onStopClick:l().func,status:l().oneOf([l().string,l().func])}},6087:(e,t,n)=>{"use strict";n.d(t,{X:()=>b});var r,o=n(1594),i=n.n(o),a=n(6365),s=n.n(a),l=n(3185),c=n(6897),u=["className","size"],h=["type"];function f(){return f=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},f.apply(this,arguments)}function d(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 p,m,g=l.Ay.div(r||(p=["\n  width: ",";\n  padding-top: ",";\n  position: relative;\n  margin: 0 auto;\n\n  .double-bounce1, .double-bounce2 {\n    width: 100%;\n    height: 100%;\n    border-radius: 50%;\n    background-color: ",";\n    opacity: 0.6;\n    position: absolute;\n    top: 0;\n    left: 0;\n\n    -webkit-animation: sk-bounce 2.0s infinite ease-in-out;\n    animation: sk-bounce 2.0s infinite ease-in-out;\n  }\n\n  .double-bounce2 {\n    -webkit-animation-delay: -1.0s;\n    animation-delay: -1.0s;\n  }\n\n  @-webkit-keyframes sk-bounce {\n    0%, 100% { -webkit-transform: scale(0.0) }\n    50% { -webkit-transform: scale(1.0) }\n  }\n\n  @keyframes sk-bounce {\n    0%, 100% {\n      transform: scale(0.0);\n      -webkit-transform: scale(0.0);\n    } 50% {\n      transform: scale(1.0);\n      -webkit-transform: scale(1.0);\n    }\n  }\n"],m||(m=p.slice(0)),r=Object.freeze(Object.defineProperties(p,{raw:{value:Object.freeze(m)}}))),(function(e){return e.size||"50%"}),(function(e){return e.size||"50%"}),(function(e){return e.color||"#333"})),y=function(e){e.className;var t=e.size,n=d(e,u),r=(0,c.gR)("neko-spinner",n.className);return i().createElement(g,f({className:r,size:t},n),i().createElement("div",{className:"double-bounce1"}),i().createElement("div",{className:"double-bounce2"}))},v=function(e){var t=e.type,n=void 0===t?"circle":t,r=d(e,h);return"circle"===n?i().createElement(y,r):null},b=function(e){return i().createElement(v,e)};b.propTypes={type:s().string}},4977:(e,t,n)=>{"use strict";n.d(t,{s:()=>I});var r=n(1594),o=n.n(r),i=n(6365),a=n.n(i),s=n(3185),l=n(6897);function c(e){return c="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},c(e)}var u,h,f,d,p,m,g,y,v,b=["children","style","className","bold","h1","h2","h3","h4","h5","h6","p","span","label"];function x(){return x=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},x.apply(this,arguments)}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 k(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"!=c(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:String(t)}(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 S(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var O="\n  font-family: var(--neko-font-family);\n  font-weight: normal;\n  line-height: normal;\n  margin-top: 0;\n  margin-bottom: 16px;\n  padding: 0;\n",_=s.Ay.h1(u||(u=S(["\n  ","\n  font-size: var(--neko-h1-font-size);\n"])),O),E=s.Ay.h2(h||(h=S(["\n  ","\n  font-size: var(--neko-h2-font-size);\n"])),O),C=s.Ay.h3(f||(f=S(["\n  ","\n  font-size: var(--neko-h3-font-size);\n"])),O),A=s.Ay.h4(d||(d=S(["\n  ","\n  font-size: var(--neko-h4-font-size);\n"])),O),j=s.Ay.h5(p||(p=S(["\n  ","\n  font-size: var(--neko-h5-font-size);\n"])),O),P=s.Ay.h6(m||(m=S(["\n  ","\n  font-size: var(--neko-h6-font-size);\n"])),O),M=s.Ay.p(g||(g=S(["\n  font-family: var(--neko-font-family);\n  font-size: var(--neko-font-size);\n  line-height: normal;\n  margin: 16px 0 24px;\n  padding: 0;\n"]))),R=s.Ay.span(y||(y=S(["\n  font-family: var(--neko-font-family);\n  font-size: var(--neko-font-size);\n  line-height: normal;\n  margin: 0;\n  padding: 0;\n"]))),T=s.Ay.label(v||(v=S(["\n  font-family: var(--neko-font-family);\n  font-size: var(--neko-font-size);\n  line-height: normal;\n  margin: 0;\n  padding: 0;\n"]))),L=function(e){var t=e.children,n=void 0===t?null:t,r=e.style,i=void 0===r?{}:r,a=e.className,s=void 0===a?"":a,c=e.bold,u=void 0!==c&&c,h=e.h1,f=e.h2,d=e.h3,p=e.h4,m=e.h5,g=e.h6,y=e.p,v=(e.span,e.label),w=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,b),S=u?{fontWeight:"bold"}:{},O=(0,l.gR)("neko-typo",s,{"neko-typo-h1":h},{"neko-typo-h2":f},{"neko-typo-h3":d},{"neko-typo-h4":p},{"neko-typo-h5":m},{"neko-typo-h6":g},{"neko-typo-p":y},{"neko-typo-label":v});return h?o().createElement(_,x({style:k(k({},S),i),className:O},w),n):f?o().createElement(E,x({style:k(k({},S),i),className:O},w),n):d?o().createElement(C,x({style:k(k({},S),i),className:O},w),n):p?o().createElement(A,x({style:k(k({},S),i),className:O},w),n):m?o().createElement(j,x({style:k(k({},S),i),className:O},w),n):g?o().createElement(P,x({style:k(k({},S),i),className:O},w),n):y?o().createElement(M,x({style:k(k({},S),i),className:O},w),n):v?o().createElement(T,x({style:k(k({},S),i),className:O},w),n):o().createElement(R,x({style:k(k({},S),i),className:O},w),n)},I=function(e){return o().createElement(L,e)};I.propTypes={h1:a().any,h2:a().any,h3:a().any,h4:a().any,h5:a().any,h6:a().any,p:a().any,span:a().any,label:a().any,bold:a().bool,style:a().object,className:a().string,children:a().node}},209:(e,t,n)=>{"use strict";n.d(t,{Z:()=>_});var r=n(1594),o=n.n(r),i=n(6365),a=n.n(i),s=n(3185),l=n(8135),c=n(2557),u=n(6897);function h(e){return h="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},h(e)}var f,d=["onSuccess","onFailure","apiUrl","onSelectFiles","apiConfig","className","disabled","children","multiple","accept"];function p(){return p=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},p.apply(this,arguments)}function m(e){return function(e){if(Array.isArray(e))return w(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||x(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 g(){g=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",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var i=t&&t.prototype instanceof b?t:b,a=Object.create(i.prototype),s=new R(r||[]);return o(a,"_invoke",{value:A(e,n,s)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",m="executing",y="completed",v={};function b(){}function x(){}function w(){}var k={};c(k,a,(function(){return this}));var S=Object.getPrototypeOf,O=S&&S(S(T([])));O&&O!==n&&r.call(O,a)&&(k=O);var _=w.prototype=b.prototype=Object.create(k);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(o,i,a,s){var l=f(e[o],e,i);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==h(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.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 A(t,n,r){var o=d;return function(i,a){if(o===m)throw new Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var l=j(s,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=m;var c=f(t,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function j(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,j(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;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,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}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 M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function T(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(h(t)+" is not iterable")}return x.prototype=w,o(_,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:x,configurable:!0}),x.displayName=c(w,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,c(e,l,"GeneratorFunction")),e.prototype=Object.create(_),e},t.awrap=function(e){return{__await:e}},E(C.prototype),c(C.prototype,s,(function(){return this})),t.AsyncIterator=C,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new C(u(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(_),c(_,l,"Generator"),c(_,a,(function(){return this})),c(_,"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=T,R.prototype={constructor:R,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(M),!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 s.type="throw",s.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],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)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,v):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),v},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),M(n),v}},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;M(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:T(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function y(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function v(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){y(i,r,o,a,s,"next",e)}function s(e){y(i,r,o,a,s,"throw",e)}a(void 0)}))}}function b(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,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||x(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 x(e,t){if(e){if("string"==typeof e)return w(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)?w(e,t):void 0}}function w(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 k,S,O=s.Ay.div(f||(k=["\n  &.dropping {\n    background: #a4d5ff;\n  }\n"],S||(S=k.slice(0)),f=Object.freeze(Object.defineProperties(k,{raw:{value:Object.freeze(S)}})))),_=(0,r.forwardRef)((function(e,t){var n=e.onSuccess,i=void 0===n?function(){}:n,a=e.onFailure,s=void 0===a?function(){}:a,h=e.apiUrl,f=e.onSelectFiles,y=void 0===f?function(){}:f,x=e.apiConfig,w=e.className,k=e.disabled,S=void 0!==k&&k,_=e.children,E=e.multiple,C=(e.accept,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,d)),A=b((0,r.useState)(!1),2),j=A[0],P=A[1],M=b((0,r.useState)(!1),2),R=M[0],T=M[1],L=h,I=(0,r.useCallback)(function(){var e=v(g().mark((function e(t){var n,r,o,a;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return T(!0),n=function(){var e=v(g().mark((function e(t){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return x.file=t,e.next=3,(0,l.Tb)(h,x);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),e.next=4,Promise.all(t.map(function(){var e=v(g().mark((function e(t){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 4:r=e.sent,o=r.filter((function(e){return e.success})),a=r.filter((function(e){return!e.success})),o.length&&i(E?o:o[0]),a.length&&s(E?a:a[0]),T(!1);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[h,E,x,i,s]),N=(0,r.useCallback)((function(e,t){t.preventDefault(),t.stopPropagation(),P(!1),L?I(e):y(e)}),[L,I]),z=(0,r.useCallback)((function(e){e.preventDefault(),e.stopPropagation()}),[]),D=(0,r.useCallback)((function(e){e.preventDefault(),e.stopPropagation(),S||P(!0)}),[S]),F=(0,r.useCallback)((function(e){e.preventDefault(),e.stopPropagation(),S||P(!1)}),[S]),B=(0,r.useCallback)((function(e){if(!S){var t=m(e.dataTransfer.files);e.target.value=null,N(t,e)}}),[S,N]),$=(0,r.useCallback)((function(e){var t=m(e.target.files);e.target.value=null,N(t,e)}),[N]),H=(0,u.gR)("neko-upload-drop-area",w,{dropping:j});return o().createElement(c.A,{busy:R},o().createElement("input",{type:"file",accept:".csv, .json, .jsonl, .txt",ref:t,onChange:$,style:{display:"none"},multiple:E,disabled:S}),o().createElement(O,p({className:H,onDragOver:z,onDragEnter:D,onDragLeave:F,onDrop:B},C),_))}));_.propTypes={ref:a().ref,onSuccess:a().func,onFailure:a().func,onSelectFiles:a().func,apiUrl:a().string,apiConfig:a().object,disabled:a().bool}},9794:(e,t,n)=>{"use strict";n.d(t,{n:()=>O});var r,o,i=n(1594),a=n.n(i),s=n(6365),l=n.n(s),c=n(8187),u=n.n(c),h=n(3185),f=n(9296),d=n(6897),p=["className","style","title","content","contentWidth","customButtons","okOnEnter","thumbnail","okButton","cancelButton","isOpen","children","customButtonsPosition","fullSize"],m=["label"],g=["label"];function y(){return y=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},y.apply(this,arguments)}function v(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}function b(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var x=(0,h.DU)(r||(r=b(["\n  .ReactModal__Overlay {\n    z-index: 9999;\n    display: flex;\n    justify-content: center;\n    flex-direction: column;\n    align-items: center;\n    backdrop-filter: blur(2px);\n    background-color: rgba(0, 0, 0, 0.35) !important;\n    opacity: 0;\n    transition: opacity 200ms ease-in-out;\n  }\n  .ReactModal__Overlay--after-open {\n    opacity: 1;\n  }\n  .ReactModal__Overlay--before-close {\n    opacity: 0;\n  }\n  .ReactModal__Overlay .neko-modal {\n    opacity: 0;\n    transform: scale(0.85);\n    transition: all 200ms ease-in-out;\n  }\n  .ReactModal__Overlay--after-open .neko-modal {\n    transform: scale(1);\n    opacity: 1;\n  }\n  .ReactModal__Overlay--before-close .neko-modal {\n    transform: scale(0.85);\n    opacity: 0;\n  }\n  .neko-modal {\n    background: white;\n    color: var(--neko-font-color);\n    position: relative;\n    box-shadow: 0 1px 2px rgba(0,0,0,0.07), \n                0 2px 4px rgba(0,0,0,0.07), \n                0 4px 8px rgba(0,0,0,0.07), \n                0 8px 16px rgba(0,0,0,0.07),\n                0 16px 32px rgba(0,0,0,0.07), \n                0 32px 64px rgba(0,0,0,0.07);\n    outline: none;\n    padding: 15px;\n    max-width: 1200px;\n    border-radius: 5px;\n    display: flex;\n    flex-direction: column;\n  }\n  .neko-modal.full-size {\n    margin-top: 32px;\n    width: 90vw;\n    height: 85vh;\n    max-width: none;\n    max-height: none;\n  }\n"]))),w=h.Ay.div(o||(o=b(["\n  width: ",";\n  flex: 1;\n  display: flex;\n  flex-direction: column;\n\n  p {\n    margin: 0;\n  }\n  .title {\n    font-family: var(--neko-font-family);\n    font-style: normal;\n    font-weight: bold;\n    font-size: 18px;\n    line-height: 22px;\n    margin-bottom: 15px;\n  }\n  .content-container {\n    display: flex;\n    position: relative;\n    z-index: 1;\n    flex: 1;\n    overflow-y: clip;\n\n    .thumbnail {\n      margin-right: 15px;\n      width: 240px;\n      overflow: hidden;\n\n      img {\n        width: 100%;\n        height: 100%;\n        object-fit: cover;\n      }\n    }\n    .content {\n      flex: auto;\n      font-family: var(--neko-font-family);\n      font-style: normal;\n      font-weight: normal;\n      font-size: var(--neko-font-size);\n      line-height: 14px;\n      width: 100%;\n      margin: 0px !important;\n      padding: 0px !important;\n    }\n  }\n  .button-group {\n    align-items: center;\n    display: flex;\n    justify-content: flex-end;\n    margin-top: 15px;\n    font-size: inherit;\n    white-space: normal;\n  }\n"])),(function(e){var t;return e.fullSize?"100%":null!==(t=e.width)&&void 0!==t?t:"518px"})),k=["disabled","ok","okOnClick","okDisabled","cancel","cancelOnClick","cancelDisabled"],S=function(e){var t=e.className,n=e.style,r=e.title,o=void 0===r?"":r,s=e.content,l=void 0===s?"":s,c=e.contentWidth,h=e.customButtons,b=void 0===h?null:h,S=e.okOnEnter,O=void 0!==S&&S,_=e.thumbnail,E=e.okButton,C=void 0===E?{}:E,A=e.cancelButton,j=void 0===A?{}:A,P=e.isOpen,M=e.children,R=e.customButtonsPosition,T=void 0===R?"right":R,L=e.fullSize,I=void 0!==L&&L,N=v(e,p),z=null!==b,D=(0,d.gR)("neko-modal",t,{"custom-modal":n,"full-size":I}),F=C.label,B=void 0===F?"OK":F,$=v(C,m),H=j.label,W=void 0===H?"Cancel":H,q=v(j,g);(0,i.useEffect)((function(){var t=[];k.forEach((function(n){void 0!==e[n]&&t.push(n)})),t.length>0&&console.warn("[Deprecated] NekoUI: The button attributes, ".concat(t.join(", "),', are deprecated in the NekoModal. Please use an object attribute like this: okButton={{ label: “OK", onClick, disabled }} cancelButton={{ label: “OK", onClick, disabled }}\''),{props:e})}),[e]);var V=(0,i.useRef)(null),U=((0,i.useCallback)((function(){return V.current}),[]),(0,i.useCallback)((function(e){"Enter"===e.key&&$.onClick()}),[$.onClick]));(0,i.useEffect)((function(){if(O&&P)return window.addEventListener("keyup",U),function(){window.removeEventListener("keyup",U)}}),[O,P,U]);var K=M||a().createElement(w,{width:c,fullSize:I},o&&a().createElement("p",{className:"title"},o),a().createElement("div",{className:"content-container"},_&&a().createElement("div",{className:"thumbnail"},_),l&&a().createElement("p",{className:"content"},l)),a().createElement("div",{className:"button-group ".concat(t)},z&&"left"===T&&b,q.onClick&&a().createElement(f.M,y({className:"danger"},q),W),$.onClick&&a().createElement(f.M,$,B),z&&"right"===T&&b));return a().createElement(a().Fragment,null,a().createElement(x,null),a().createElement(u(),y({ariaHideApp:!1,closeTimeoutMS:200,className:D,isOpen:P},N),K))},O=function(e){return a().createElement(S,e)};O.propTypes={className:l().string,style:l().object,title:l().string,content:l().string,contentWidth:l().string,customButtons:l().object,okOnEnter:l().bool,thumbnail:l().element,okButton:l().object,cancelButton:l().object,fullSize:l().bool}},5900:(e,t,n)=>{"use strict";n.d(t,{o:()=>W});var r=n(1594),o=n.n(r),i=n(6365),a=n.n(i),s=n(3185),l=n(5977),c=n(4555),u=n(6382),h=n(2557),f=n(5263),d=n(6897);function p(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return m(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)?m(e,t):void 0}}(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 m(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 g,y=n(8922),v=n(374),b=n(4536),x=n(4677),w=n(9296),k=n(6734),S=n(8696);function O(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,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||_(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 _(e,t){if(e){if("string"==typeof e)return E(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)?E(e,t):void 0}}function E(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 C,A,j,P=s.Ay.div(g||(C=["\n  min-width: 160px;\n  padding: 8px;\n  border-radius: 8px;\n  overflow: hidden;\n  background: var(--neko-main-color-alternative);\n  color: white;\n  \n  .neko-context-content {\n    max-height: 202px;\n    overflow-y: auto;\n  }\n\n  .neko-checkbox {\n    margin-bottom: 5px;\n\n    &:last-child {\n      margin-bottom: 0;\n    }\n  }\n\n  .neko-radio:last-child {\n    margin-bottom: 0;\n  }\n\n  svg {\n    color: var(--neko-disabled-color);\n\n    &.neko-active {\n      color: white;\n    }\n  }\n"],A||(A=C.slice(0)),g=Object.freeze(Object.defineProperties(C,{raw:{value:Object.freeze(A)}})))),M=function(e){var t=e.accessor,n=e.options,o=e.type,i=void 0===o?"checkbox":o,a=e.onChange,s=e.description,l=e.filters,c=O((0,r.useState)(!1),2),u=c[0],h=c[1],d=O((0,r.useState)(""),2),p=d[0],m=d[1],g=O((0,r.useState)(""),2),C=g[0],A=g[1],j=(0,r.useRef)(null),M=(0,r.useRef)(null),R=l&&l.length>0||p.length>0,T="checkbox"===i,L="select"===i,I="text"===i,N=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;void 0!==e&&e!==p&&m((function(){return e})),C!==p&&(a(t,C),m(C))};return(0,r.useEffect)((function(){N(),u&&setTimeout((function(){M.current&&M.current.focus()}),10)}),[u]),React.createElement(React.Fragment,null,React.createElement("div",{ref:j},React.createElement(y.z,{icon:"filter",className:R?"neko-active":"",onClick:function(){return h(!u)},width:16,height:16})),React.createElement(v.G,{visible:u,targetRef:j,onClose:function(){return h(!1)}},React.createElement(P,null,React.createElement("div",{className:"neko-context-menu"},!!s&&React.createElement("p",{style:{marginTop:0,marginBottom:5}},s),React.createElement("div",{className:"neko-context-content"},T&&React.createElement(b.E,{name:"neko-context-menu-checkboxes"},n.map((function(e){return React.createElement(f.R,{small:!0,key:e.value,label:e.label,checked:null==l?void 0:l.includes(e.value),onChange:function(n){if(l)return a(t,n?[].concat(function(e){if(Array.isArray(e))return E(e)}(r=l)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||_(r)||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.")}(),[e.value]):l.filter((function(t){return t!=e.value})));var r;console.error("[NekoUI] filters needs to be set for the NekoTable.",{accessor:t,option:e.value})}})}))),L&&React.createElement(x.u,{name:"neko-context-menu-select",onChange:function(e){return a(t,e)}},n.map((function(e){return React.createElement(x.j,{id:e.value,key:e.value,label:e.label,value:e.value,checked:l===e.value})})))),I&&React.createElement(S.A,{ref:M,name:"neko-context-menu-text",value:C,onChange:function(e){return A(e)},onEnter:function(e){N(e),h(!1)}}),React.createElement(k.g,{tiny:!0}),React.createElement("div",{className:"neko-context-menu-bottom-actions"},React.createElement(w.M,{fullWidth:!0,disabled:!R,onClick:function(){a(t,T?[]:null),A(""),h(!1),m("")}},"Reset"))))))};function R(e){return R="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},R(e)}function T(){return T=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},T.apply(this,arguments)}function L(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 I(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?L(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"!=R(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=R(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==R(t)?t:String(t)}(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)):L(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}M.propTypes={accessor:a().string,options:a().array,type:a().oneOf(["checkbox","select","text"]),onChange:a().func,filters:a().oneOfType([a().string,a().array])};var N=s.Ay.table(j||(j=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n  font-family: var(--neko-font-family);\n  border-spacing: 0;\n  width: 100%;\n  word-break: break-all;\n\n  th, td {\n    margin: 0;\n    padding: 5px;\n    border-bottom: 1px solid rgba(0, 0, 0, 0.05);\n    border-right: 1px solid rgba(0, 0, 0, 0.05);\n    height: 1px;\n\n    a {\n      text-decoration: none;\n    }\n  }\n\n  th:last-child, td:last-child {\n    border-right: 0;\n  }\n\n  th, tfoot td {\n    height: 30px;\n    background-color: var(--neko-main-color);\n    color: var(--neko-white);\n    font-style: normal;\n    font-weight: normal;\n    font-size: var(--neko-font-size);\n    line-height: 16px;\n    text-align: left;\n\n    div {\n      display: flex;\n      align-items: center;\n      justify-content: space-between;\n\n      &.neko-column-action {\n        cursor: pointer;\n\n        svg {\n          color: rgba(255, 255, 255, 0.5);\n        }\n\n        svg.neko-active {\n          color: white;\n        }\n      }\n    }\n  }\n\n  &.neko-table-raw {\n    th, td {\n      border: 0;\n\n      .neko-column-action {\n\n        > svg {\n          color: black;\n          opacity: 0.5;\n        }\n\n        > svg.neko-active {\n          opacity: 1;\n        }\n      }\n    }\n  }\n\n  &.neko-table-raw {\n    th {\n      font-weight: bold;\n    }\n    th, tfoot td {\n      background-color: white;\n      color: var(--neko-font-color);\n    }\n  }\n\n  tbody {\n    background-color: white;\n    color: var(--neko-font-color);\n    \n    tr:nth-child(even) {\n        background-color: var(--neko-gray-98);\n    }\n\n    tr.selected, tr.selected:nth-child(even) {\n        background-color: var(--neko-main-color);\n        filter: brightness(1.2);\n        color: white;\n\n        a {\n          color: #81e8ff;\n        }\n    }\n    \n    img {\n      vertical-align: bottom;\n    }\n}\n\n  &.neko-table-raw {\n\n    svg {\n      &.neko-active {\n        color: var(--neko-main-color) !important;\n        opacity: 1;\n      }\n    }\n\n    tbody {\n      tr {\n        &.selected, &.selected :nth-child(even) {\n          background-color: white;\n          color: var(--neko-black);\n        }\n      }\n    }\n  }\n\n  tfoot tr:last-child {\n    td {\n      border-bottom: 0;\n    }\n  }\n\n  .table-checkbox-cell {\n    width: 23px;\n    text-align: center;\n\n    svg {\n      padding: 5px;\n      cursor: pointer;\n    }\n  }\n\n  &.neko-row-selectable {\n    tbody tr {\n      cursor: pointer;\n    }\n  }\n"]))),z=function(e){var t=e.checked,n=e.indeterminate,r=e.onSelect,i=void 0===r?function(){}:r,a=e.onUnselect,s=void 0===a?function(){}:a,l=e.isBusy,c=void 0!==l&&l;return o().createElement(f.R,{small:!0,onChange:function(e,t,n){return e?i(n):s(n)},checked:t,indeterminate:n,isBusy:t&&c,disabled:c})},D={left:"start",center:"center",right:"end"},F=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={};return e.align&&(n={textAlign:e.align,justifyContent:D[e.align]}),t&&e.verticalAlign&&(n=I(I({},n),{},{verticalAlign:e.verticalAlign})),e.width&&(n=I(I({},n),{},{width:e.width})),e.style&&(n=I(I({},n),e.style)),n},B=function(e){return!0===e?"#edf8ff":e},$=function(e,t){console.log("[NekoUI] Missing implementation for onFilterChange.",{filter:e,value:t})},H=function(e){var t=e.data,n=void 0===t?[]:t,i=e.selectedItems,a=void 0===i?[]:i,s=e.selectedRow,f=e.filters,m=e.onFilterChange,g=void 0===m?$:m,y=e.columns,v=void 0===y?[]:y,b=e.busy,x=void 0!==b&&b,w=e.onSelect,k=e.onSelectRow,S=e.selectOnRowClick,O=void 0===S||S,_=e.onUnselect,E=e.onSortChange,C=void 0===E?function(){}:E,A=e.variant,j=void 0===A?"default":A,P=e.alternateRowColor,R=void 0!==P&&P,L=e.sort,D=e.emptyMessage,H=void 0===D?"Empty.":D,W=v.length+(w?1:0);n.some((function(e){return void 0===e.id}))&&(console.warn('Table data is missing the "id" field. Using the index as id instead, and disabling the row selection.'),n.forEach((function(e,t){e.id||(e.disabled_row=!0,e.id=-t)})));var q,V,U,K,Q,G,Y,Z,X=function(e){return e?{backgroundColor:B(e)}:{}}(R),J=n.map((function(e){var t=v.map((function(t){return{value:e[t.accessor],style:F(t,!0)}}));return{id:e.id,disabled_row:null==e?void 0:e.disabled_row,isBusy:e.isBusy||!1,cells:t}})),ee=(q={list:n.map((function(e){return{id:e.id}})),selectedList:a,callback:w},V=q.list,U=q.selectedList,K=q.callback,G=void 0===(Q=q.key)?"id":Q,Y=(0,d.v_)().pressShift,Z=(0,r.useMemo)((function(){if(!Y||!U.length)return null;var e=U[U.length-1];return V.findIndex((function(t){return t[G]===e}))}),[G,V,Y,U]),{onSelect:(0,r.useCallback)((function(e){if(K)if(null!==Z){var t=e[0],n=V.findIndex((function(e){return e[G]===t})),r=(Z<n?Z:n)+1,o=Z<n?n:Z,i=V.slice(r,o).map((function(e){return e[G]})).filter((function(e){return!U.some((function(t){return t===e}))}));K([].concat(p(i),p(e)))}else K(p(e))}),[Z,V,K,U,G])}).onSelect,te=J.map((function(e){return e.id})),ne=0===te.length,re=te.filter((function(e){return a.includes(e)})),oe=!ne&&re.length===te.length,ie=!oe&&a.length>0,ae=v.reduce((function(e,t,n){return!1===t.visible&&e.push(n),e}),[]),se=o().createElement("tr",null,w&&!ne&&o().createElement("th",{className:"table-checkbox-cell"},o().createElement(z,{checked:oe,indeterminate:ie,onSelect:function(e){return w(te,e)},onUnselect:function(e){_(ie?a:te,e)}})),v.filter((function(e,t){return!ae.includes(t)})).map((function(e){var t,n,r,i=L&&L.accessor===e.accessor,a=L&&"asc"===L.by,s=F(e);return o().createElement("th",{style:s,key:e.accessor},o().createElement("div",{style:I(I({},s),{},{width:"auto"})},o().createElement("div",null,e.title),o().createElement("div",{style:{flex:"auto"}}),o().createElement("div",{className:"neko-column-action"},e.filters&&o().createElement(M,T({accessor:e.accessor},e.filters,{onChange:function(e,t){return g(e,t)},filters:(r=null!==(t=null==f?void 0:f.find((function(t){return t.accessor===e.accessor})))&&void 0!==t?t:null,null!==(n=null==r?void 0:r.value)&&void 0!==n?n:null)}))),o().createElement("div",{className:"neko-column-action",onClick:e.sortable?function(t){var n=L&&L.accessor!==e.accessor;C(e.accessor,n||i&&a?"desc":"asc",t)}:void 0},e.sortable&&o().createElement(l.In,{className:i?"neko-active":"",icon:i&&a?u.A:c.A,width:"26px",height:"26px"}))))}))),le=(0,d.gR)("neko-table","neko-table-".concat(j),{"neko-row-selectable":!!k});return o().createElement(h.A,{busy:x,overlaystyle:{top:"36px",height:"calc(100% - 76px)"}},o().createElement(N,{className:le},o().createElement("thead",null,se),o().createElement("tbody",null,!J.length&&o().createElement("tr",null,o().createElement("td",{colspan:W,style:{textAlign:"center",height:40,color:"gray"}},H)),J.map((function(e,t){var n=t%2==0?X:{},r=!!s&&s===e.id||a.includes(e.id);return o().createElement("tr",{key:"neko-row-".concat(e.id),className:r?"selected":"",style:n,onClick:function(t){t.stopPropagation(),k&&O&&k(e.id,t)}},w&&o().createElement("td",{className:"table-checkbox-cell"},o().createElement(z,{checked:a.includes(e.id),onSelect:function(t){t.stopPropagation(),ee([e.id],t)},onUnselect:function(t){t.stopPropagation(),_([e.id],t)},isBusy:e.isBusy||(null==e?void 0:e.disabled_row)})),e.cells.filter((function(e,t){return!ae.includes(t)})).map((function(n,r){return o().createElement("td",{key:"".concat(e.id).concat(t).concat(r),style:n.style},n.value)})))}))),"default"===j&&o().createElement("tfoot",null,se)))},W=function(e){return o().createElement(H,e)};W.propTypes={columns:a().arrayOf(a().any),data:a().arrayOf(a().any),busy:a().bool,onSelect:a().func,onSelectRow:a().func,selectOnRowClick:a().bool,onUnselect:a().func,selectedItems:a().arrayOf(a().any),onSortChange:a().func,variant:a().string,alternateRowColor:a().oneOfType([a().bool,a().string])}},3676:(e,t,n)=>{"use strict";n.d(t,{V:()=>T,_:()=>R});var r,o,i,a,s,l,c=n(1594),u=n.n(c),h=n(6365),f=n.n(h),d=n(3185),p=n(1329),m=n(8922),g=n(6897),y=n(2557),v=n(9296),b=["inversed","children","action","isPro","currentTab","onChange","keepTabOnReload","callOnTabChangeFirst"];function x(){return x=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},x.apply(this,arguments)}function w(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,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(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}}(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 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}function S(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var O=d.Ay.div(r||(r=S(["\n  display: flex;\n  align-items: stretch;\n  position: relative;\n  height: 39px;\n"]))),_=d.Ay.div(o||(o=S(["\n  display: flex;\n  height: 39px;\n  overflow-x: hidden;\n\n  flex-grow: 1;\n  flex-shrink: 1;\n  max-width: 100%;\n\n  scrollbar-width: none;\n  -ms-overflow-style: none;\n  &::-webkit-scrollbar {\n    display: none;\n  }\n"]))),E=d.Ay.div(i||(i=S(["\n  display: flex;\n  align-items: center;\n  height: 39px;\n  margin-left: auto;\n  flex-shrink: 0;\n"]))),C=d.Ay.button(a||(a=S(["\n  border-radius: 8px 8px 0px 0px;\n  border: 0;\n  background-color: var(--neko-main-color-disabled);\n  color: rgb(255 255 255 / 65%);\n  display: flex;\n  align-items: center;\n  cursor: pointer;\n  text-align: left;\n  padding: 12px 15px;\n  white-space: nowrap;\n  overflow: hidden;\n  text-overflow: ellipsis;\n  margin: 0 5px 0 0;\n\n  ","\n\n  &:not(.active):not(.disabled):hover {\n    filter: brightness(1.1);\n  }\n\n  &:focus {\n    outline: none;\n  }\n\n  &.active {\n    background-color: var(--neko-main-color);\n    color: var(--neko-white);\n  }\n\n  &.disabled {\n    cursor: default;\n    display: inline-flex;\n    padding-bottom: 7px;\n  }\n\n  &.hidden {\n    display: none;\n  }\n\n  &.inversed {\n    &.active {\n      background-color: var(--neko-white);\n      color: var(--neko-font-color);\n    }\n  }\n"])),(function(e){return e.squeezed?"\n    flex: 1 1 ".concat(85,"px;\n    max-width: ").concat(160,"px;\n    min-width: ").concat(85,"px;\n  "):"\n    flex: 0 0 auto;\n    max-width: ".concat(320,"px;\n  ")})),A=d.Ay.div(s||(s=S(["\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  height: 39px;\n  margin-right: 5px;\n"]))),j=d.Ay.div(l||(l=S(["\n  background-color: var(--neko-main-color);\n  color: white;\n  display: none;\n  padding: 10px;\n  border-radius: 0px 0px 8px 8px;\n  box-shadow: 0px 8px 8px -8px rgba(0, 0, 0, 0.35);\n\n  &.active {\n    display: block;\n  }\n\n  &.inversed {\n    background-color: var(--neko-white);\n    color: var(--neko-black);\n  }\n"]))),P=function(e){var t=e.inversed,n=e.children,r=e.action,o=e.isPro,i=e.currentTab,a=e.onChange,s=e.keepTabOnReload,l=void 0===s||s,h=e.callOnTabChangeFirst,f=void 0===h||h,d=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,b),y=(0,c.useRef)(null),k=(0,c.useRef)(null),S=w((0,c.useState)(0),2),j=S[0],P=S[1],M=w((0,c.useState)(!1),2),R=M[0],T=M[1],L=w((0,c.useState)((function(){return void 0!==i?i:l&&new URL(window.location.href).searchParams.get("nekoTab")||""})),2),I=L[0],N=L[1],z=(0,c.useRef)(!1),D=(0,c.useRef)([]),F=(0,c.useCallback)((function(e){y.current&&(e.preventDefault(),y.current.scrollLeft+=e.deltaY)}),[]);(0,c.useEffect)((function(){var e=y.current;if(e)return e.addEventListener("wheel",F,{passive:!1}),function(){e.removeEventListener("wheel",F)}}),[F]);var B=(0,c.useCallback)((function(e){if(history.pushState&&"string"==typeof e){var t=new URLSearchParams(window.location.search);t.set("nekoTab",e);var n=window.location.protocol+"//"+window.location.host+window.location.pathname+"?"+t.toString();window.history.replaceState({path:n},"",n)}}),[]),$=(0,c.useCallback)((function(e,t,n){t&&!t.requirePro&&(void 0===i&&I!==t.key&&N(t.key),a&&a(e,t,n),l&&B(t.key))}),[i,I,a,l,B]);(0,c.useLayoutEffect)((function(){k.current&&P(k.current.offsetWidth)}),[]),(0,c.useLayoutEffect)((function(){}),[]),(0,c.useLayoutEffect)((function(){var e=y.current;if(e){var t=e.clientWidth,n=0;D.current.forEach((function(e){e&&(n+=e.scrollWidth)})),T(n>t)}}),[W,j]);var H=(0,c.useMemo)((function(){var e=[];return u().Children.forEach(n,(function(t){u().isValidElement(t)&&e.push(t)})),e}),[n]),W=(0,c.useMemo)((function(){var e=new Set,t=u().Children.map(H,(function(t,n){var r=t.key||function(e,t){var n=e.props,r="tab-"+(t+1);return e.key?r=e.key:"string"==typeof n.title&&(r=n.title.toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5\u3040-\u309f\u30a0-\u30ff\u2e80-\u2eff\u31f0-\u31ff\u3200-\u32ff\u3400-\u4dbf\uf900-\ufaff ]/gi,"").replace(/ /g,"-")),r}(t,n);e.has(r)&&(console.warn("Duplicate key '".concat(r,"' found in NekoTabs. Generating unique key.")),r+="-"+function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6,t="",n=0;n<e;n++)t+="abcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(36*Math.random())];return t}()),e.add(r);var i=t.props,a=i.title,s=void 0===a?"Untitled Tab ".concat(n+1):a,l=i.onClick,c=void 0===l?null:l,u=i.requirePro,h=void 0!==u&&u,f=i.hidden,d=void 0!==f&&f,p=i.icon;return{key:r,title:s,onClick:c,requirePro:!o&&h,hidden:d,icon:void 0===p?null:p}}));return t||[]}),[H,o]);(0,c.useEffect)((function(){if(0!==W.length){var e=W.map((function(e){return e.key})),t=void 0!==i?i:I;!e.includes(t)&&e.length>0&&(t=e[0]),t!==I&&N(t)}}),[i,W]),(0,c.useLayoutEffect)((function(){if(!z.current&&0!==W.length){z.current=!0;var e=W.map((function(e){return e.key}));if(l){var t=new URL(window.location.href).searchParams.get("nekoTab"),n=t&&e.includes(t)?t:e[0];if(n!==I){N(n);var r=e.indexOf(n);f&&W[r]&&$(r,W[r])}}else if(f){var o=e.indexOf(I);-1!==o&&W[o]&&$(o,W[o])}}}),[l,f,W,I,$]);var q=(0,c.useMemo)((function(){return u().Children.map(H,(function(e,n){var r=W[n];if(!r)return null;var o=r.key===I&&!r.hidden;if(o&&r.hidden){var i=W.find((function(e){return!e.hidden}));i&&N(i.key)}return u().cloneElement(e,{isActive:o,inversed:t,key:r.key})}))}),[H,I,t,W]),V=(0,g.gR)("neko-tabs",{inversed:t});return u().createElement("div",x({className:V},d),u().createElement(O,null,u().createElement(_,{ref:y,$needsMoreSpace:R,$actionWidth:j},W.map((function(e,n){return u().createElement(C,{key:e.key,ref:function(e){return D.current[n]=e},onClick:function(t){return $(n,e,t)},className:"neko-tab-title ".concat(e.key===I?"active":""," ").concat(e.requirePro?"disabled":""," ").concat(e.hidden?"hidden":""," ").concat(t?"inversed":""),squeezed:R},e.icon&&u().createElement(m.z,{icon:e.icon,width:15,height:15,style:{marginRight:"5px"},raw:!0}),u().createElement("div",{style:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",flex:"1 1 auto"}},e.title),u().createElement(p.K,{className:"inline",show:e.requirePro,style:{marginLeft:10,marginRight:-5,top:-1}}))}))),u().createElement(E,{ref:k},R&&u().createElement(A,null,u().createElement(v.M,{rounded:!0,className:"secondary",icon:"chevron-left",onClick:function(){y.current&&y.current.scrollTo({left:y.current.scrollLeft-200,behavior:"smooth"})}}),u().createElement(v.M,{rounded:!0,className:"secondary",icon:"chevron-right",onClick:function(){y.current&&y.current.scrollTo({left:y.current.scrollLeft+200,behavior:"smooth"})}})),r&&r)),q)},M=function(e){var t=e.children,n=e.isActive,r=void 0!==n&&n,o=e.busy,i=void 0!==o&&o,a=e.inversed,s=(0,g.gR)("neko-tab-content",{active:r,inversed:a});return u().createElement(y.A,{busy:i},u().createElement(j,{className:s},r&&t))},R=function(e){return u().createElement(P,e)};R.propTypes={isPro:f().bool,onChange:f().func,action:f().node,currentTab:f().string,keepTabOnReload:f().bool,callOnTabChangeFirst:f().bool},R.defaultProps={keepTabOnReload:!1,callOnTabChangeFirst:!0};var T=function(e){return u().createElement(M,e)};T.propTypes={isActive:f().bool,requirePro:f().bool,title:f().string,icon:f().string}},7494:(e,t,n)=>{"use strict";n.d(t,{V:()=>m});var r,o=n(1594),i=n.n(o),a=n(6365),s=n.n(a),l=n(3185),c=["align"];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)}var h,f,d=l.Ay.div(r||(h=["\n  box-sizing: border-box;\n  display: flex;\n  width: 100%;\n  padding: 10px 10px;\n  background: white;\n  color: var(--neko-font-color);\n  border-radius: 10px;\n  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);\n  align-items: center;\n\n  &.neko-align-left {\n    justify-content: flex-start;\n  }\n\n  &.neko-align-right {\n    justify-content: flex-end;\n  }\n\n  > *:not(:last-child) {\n    margin-right: 5px;\n  }\n"],f||(f=h.slice(0)),r=Object.freeze(Object.defineProperties(h,{raw:{value:Object.freeze(f)}})))),p=function(e){var t=e.align,n=void 0===t?"left":t,r=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,c);return i().createElement(d,u({className:"neko-toolbar neko-align-".concat(n)},r),r.children)},m=function(e){return i().createElement(p,e)};m.propTypes={align:s().oneOf(["left","right"])}},7965:(e,t,n)=>{"use strict";var r=n(6426),o={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var n,i,a,s,l,c,u=!1;t||(t={}),n=t.debug||!1;try{if(a=r(),s=document.createRange(),l=document.getSelection(),(c=document.createElement("span")).textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var i=o[t.format]||o.default;window.clipboardData.setData(i,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(c),s.selectNodeContents(c),l.addRange(s),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");u=!0}catch(r){n&&console.error("unable to copy using execCommand: ",r),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),u=!0}catch(r){n&&console.error("unable to copy using clipboardData: ",r),n&&console.error("falling back to prompt"),i=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(i,e)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(s):l.removeAllRanges()),c&&document.body.removeChild(c),a()}return u}},4146:(e,t,n)=>{"use strict";var r=n(4363),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},s={};function l(e){return r.isMemo(e)?a:s[e.$$typeof]||o}s[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},s[r.Memo]=a;var c=Object.defineProperty,u=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,p=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(p){var o=d(n);o&&o!==p&&e(t,o,r)}var a=u(n);h&&(a=a.concat(h(n)));for(var s=l(t),m=l(n),g=0;g<a.length;++g){var y=a[g];if(!(i[y]||r&&r[y]||m&&m[y]||s&&s[y])){var v=f(n,y);try{c(t,y,v)}catch(e){}}}}return t}},4809:function(e,t){var n,r;n=function e(){"use strict";var t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:{},n=!t.document&&!!t.postMessage,r=t.IS_PAPA_WORKER||!1,o={},i=0,a={parse:function(n,r){var s=(r=r||{}).dynamicTyping||!1;if(w(s)&&(r.dynamicTypingFunction=s,s={}),r.dynamicTyping=s,r.transform=!!w(r.transform)&&r.transform,r.worker&&a.WORKERS_SUPPORTED){var l=function(){if(!a.WORKERS_SUPPORTED)return!1;var n,r,s=(n=t.URL||t.webkitURL||null,r=e.toString(),a.BLOB_URL||(a.BLOB_URL=n.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",r,")();"],{type:"text/javascript"})))),l=new t.Worker(s);return l.onmessage=g,l.id=i++,o[l.id]=l}();return l.userStep=r.step,l.userChunk=r.chunk,l.userComplete=r.complete,l.userError=r.error,r.step=w(r.step),r.chunk=w(r.chunk),r.complete=w(r.complete),r.error=w(r.error),delete r.worker,void l.postMessage({input:n,config:r,workerId:l.id})}var d=null;return a.NODE_STREAM_INPUT,"string"==typeof n?(n=function(e){return 65279===e.charCodeAt(0)?e.slice(1):e}(n),d=r.download?new c(r):new h(r)):!0===n.readable&&w(n.read)&&w(n.on)?d=new f(r):(t.File&&n instanceof File||n instanceof Object)&&(d=new u(r)),d.stream(n)},unparse:function(e,t){var n=!1,r=!0,o=",",i="\r\n",s='"',l=s+s,c=!1,u=null,h=!1;!function(){if("object"==typeof t){if("string"!=typeof t.delimiter||a.BAD_DELIMITERS.filter((function(e){return-1!==t.delimiter.indexOf(e)})).length||(o=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(n=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(c=t.skipEmptyLines),"string"==typeof t.newline&&(i=t.newline),"string"==typeof t.quoteChar&&(s=t.quoteChar),"boolean"==typeof t.header&&(r=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");u=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+s),("boolean"==typeof t.escapeFormulae||t.escapeFormulae instanceof RegExp)&&(h=t.escapeFormulae instanceof RegExp?t.escapeFormulae:/^[=+\-@\t\r].*$/)}}();var f=new RegExp(p(s),"g");if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return d(null,e,c);if("object"==typeof e[0])return d(u||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||u),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),d(e.fields||[],e.data||[],c);throw new Error("Unable to serialize unrecognized input");function d(e,t,n){var a="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var s=Array.isArray(e)&&0<e.length,l=!Array.isArray(t[0]);if(s&&r){for(var c=0;c<e.length;c++)0<c&&(a+=o),a+=m(e[c],c);0<t.length&&(a+=i)}for(var u=0;u<t.length;u++){var h=s?e.length:t[u].length,f=!1,d=s?0===Object.keys(t[u]).length:0===t[u].length;if(n&&!s&&(f="greedy"===n?""===t[u].join("").trim():1===t[u].length&&0===t[u][0].length),"greedy"===n&&s){for(var p=[],g=0;g<h;g++){var y=l?e[g]:g;p.push(t[u][y])}f=""===p.join("").trim()}if(!f){for(var v=0;v<h;v++){0<v&&!d&&(a+=o);var b=s&&l?e[v]:v;a+=m(t[u][b],v)}u<t.length-1&&(!n||0<h&&!d)&&(a+=i)}}return a}function m(e,t){if(null==e)return"";if(e.constructor===Date)return JSON.stringify(e).slice(1,25);var r=!1;h&&"string"==typeof e&&h.test(e)&&(e="'"+e,r=!0);var i=e.toString().replace(f,l);return(r=r||!0===n||"function"==typeof n&&n(e,t)||Array.isArray(n)&&n[t]||function(e,t){for(var n=0;n<t.length;n++)if(-1<e.indexOf(t[n]))return!0;return!1}(i,a.BAD_DELIMITERS)||-1<i.indexOf(o)||" "===i.charAt(0)||" "===i.charAt(i.length-1))?s+i+s:i}}};if(a.RECORD_SEP=String.fromCharCode(30),a.UNIT_SEP=String.fromCharCode(31),a.BYTE_ORDER_MARK="\ufeff",a.BAD_DELIMITERS=["\r","\n",'"',a.BYTE_ORDER_MARK],a.WORKERS_SUPPORTED=!n&&!!t.Worker,a.NODE_STREAM_INPUT=1,a.LocalChunkSize=10485760,a.RemoteChunkSize=5242880,a.DefaultDelimiter=",",a.Parser=m,a.ParserHandle=d,a.NetworkStreamer=c,a.FileStreamer=u,a.StringStreamer=h,a.ReadableStreamStreamer=f,t.jQuery){var s=t.jQuery;s.fn.parse=function(e){var n=e.config||{},r=[];return this.each((function(e){if("INPUT"!==s(this).prop("tagName").toUpperCase()||"file"!==s(this).attr("type").toLowerCase()||!t.FileReader||!this.files||0===this.files.length)return!0;for(var o=0;o<this.files.length;o++)r.push({file:this.files[o],inputElem:this,instanceConfig:s.extend({},n)})})),o(),this;function o(){if(0!==r.length){var t,n,o,l=r[0];if(w(e.before)){var c=e.before(l.file,l.inputElem);if("object"==typeof c){if("abort"===c.action)return"AbortError",t=l.file,n=l.inputElem,o=c.reason,void(w(e.error)&&e.error({name:"AbortError"},t,n,o));if("skip"===c.action)return void i();"object"==typeof c.config&&(l.instanceConfig=s.extend(l.instanceConfig,c.config))}else if("skip"===c)return void i()}var u=l.instanceConfig.complete;l.instanceConfig.complete=function(e){w(u)&&u(e,l.file,l.inputElem),i()},a.parse(l.file,l.instanceConfig)}else w(e.complete)&&e.complete()}function i(){r.splice(0,1),o()}}}function l(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=b(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new d(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,n){if(this.isFirstChunk&&w(this._config.beforeFirstChunk)){var o=this._config.beforeFirstChunk(e);void 0!==o&&(e=o)}this.isFirstChunk=!1,this._halted=!1;var i=this._partialLine+e;this._partialLine="";var s=this._handle.parse(i,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var l=s.meta.cursor;this._finished||(this._partialLine=i.substring(l-this._baseIndex),this._baseIndex=l),s&&s.data&&(this._rowCount+=s.data.length);var c=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(r)t.postMessage({results:s,workerId:a.WORKER_ID,finished:c});else if(w(this._config.chunk)&&!n){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);s=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),this._completed||!c||!w(this._config.complete)||s&&s.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),c||s&&s.meta.paused||this._nextChunk(),s}this._halted=!0},this._sendError=function(e){w(this._config.error)?this._config.error(e):r&&this._config.error&&t.postMessage({workerId:a.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=a.RemoteChunkSize),l.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=x(this._chunkLoaded,this),t.onerror=x(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e=this._config.downloadRequestHeaders;for(var r in e)t.setRequestHeader(r,e[r])}if(this._config.chunkSize){var o=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+o)}try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:t.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(e){var t=e.getResponseHeader("Content-Range");return null===t?-1:parseInt(t.substring(t.lastIndexOf("/")+1))}(t),this.parseChunk(t.responseText)))},this._chunkError=function(e){var n=t.statusText||e;this._sendError(new Error(n))}}function u(e){var t,n;(e=e||{}).chunkSize||(e.chunkSize=a.LocalChunkSize),l.call(this,e);var r="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,r?((t=new FileReader).onload=x(this._chunkLoaded,this),t.onerror=x(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input;if(this._config.chunkSize){var o=Math.min(this._start+this._config.chunkSize,this._input.size);e=n.call(e,this._start,o)}var i=t.readAsText(e,this._config.encoding);r||this._chunkLoaded({target:{result:i}})},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function h(e){var t;l.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e,n=this._config.chunkSize;return n?(e=t.substring(0,n),t=t.substring(n)):(e=t,t=""),this._finished=!t,this.parseChunk(e)}}}function f(e){l.call(this,e=e||{});var t=[],n=!0,r=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):n=!0},this._streamData=x((function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),n&&(n=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}}),this),this._streamError=x((function(e){this._streamCleanUp(),this._sendError(e)}),this),this._streamEnd=x((function(){this._streamCleanUp(),r=!0,this._streamData("")}),this),this._streamCleanUp=x((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function d(e){var t,n,r,o=Math.pow(2,53),i=-o,s=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,l=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,c=this,u=0,h=0,f=!1,d=!1,g=[],y={data:[],errors:[],meta:{}};if(w(e.step)){var v=e.step;e.step=function(t){if(y=t,S())k();else{if(k(),0===y.data.length)return;u+=t.data.length,e.preview&&u>e.preview?n.abort():(y.data=y.data[0],v(y,c))}}}function x(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function k(){return y&&r&&(_("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines&&(y.data=y.data.filter((function(e){return!x(e)}))),S()&&function(){if(y)if(Array.isArray(y.data[0])){for(var t=0;S()&&t<y.data.length;t++)y.data[t].forEach(n);y.data.splice(0,1)}else y.data.forEach(n);function n(t,n){w(e.transformHeader)&&(t=e.transformHeader(t,n)),g.push(t)}}(),function(){if(!y||!e.header&&!e.dynamicTyping&&!e.transform)return y;function t(t,n){var r,o=e.header?{}:[];for(r=0;r<t.length;r++){var i=r,a=t[r];e.header&&(i=r>=g.length?"__parsed_extra":g[r]),e.transform&&(a=e.transform(a,i)),a=O(i,a),"__parsed_extra"===i?(o[i]=o[i]||[],o[i].push(a)):o[i]=a}return e.header&&(r>g.length?_("FieldMismatch","TooManyFields","Too many fields: expected "+g.length+" fields but parsed "+r,h+n):r<g.length&&_("FieldMismatch","TooFewFields","Too few fields: expected "+g.length+" fields but parsed "+r,h+n)),o}var n=1;return!y.data.length||Array.isArray(y.data[0])?(y.data=y.data.map(t),n=y.data.length):y.data=t(y.data,0),e.header&&y.meta&&(y.meta.fields=g),h+=n,y}()}function S(){return e.header&&0===g.length}function O(t,n){return r=t,e.dynamicTypingFunction&&void 0===e.dynamicTyping[r]&&(e.dynamicTyping[r]=e.dynamicTypingFunction(r)),!0===(e.dynamicTyping[r]||e.dynamicTyping)?"true"===n||"TRUE"===n||"false"!==n&&"FALSE"!==n&&(function(e){if(s.test(e)){var t=parseFloat(e);if(i<t&&t<o)return!0}return!1}(n)?parseFloat(n):l.test(n)?new Date(n):""===n?null:n):n;var r}function _(e,t,n,r){var o={type:e,code:t,message:n};void 0!==r&&(o.row=r),y.errors.push(o)}this.parse=function(o,i,s){var l=e.quoteChar||'"';if(e.newline||(e.newline=function(e,t){e=e.substring(0,1048576);var n=new RegExp(p(t)+"([^]*?)"+p(t),"gm"),r=(e=e.replace(n,"")).split("\r"),o=e.split("\n"),i=1<o.length&&o[0].length<r[0].length;if(1===r.length||i)return"\n";for(var a=0,s=0;s<r.length;s++)"\n"===r[s][0]&&a++;return a>=r.length/2?"\r\n":"\r"}(o,l)),r=!1,e.delimiter)w(e.delimiter)&&(e.delimiter=e.delimiter(o),y.meta.delimiter=e.delimiter);else{var c=function(t,n,r,o,i){var s,l,c,u;i=i||[",","\t","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var h=0;h<i.length;h++){var f=i[h],d=0,p=0,g=0;c=void 0;for(var y=new m({comments:o,delimiter:f,newline:n,preview:10}).parse(t),v=0;v<y.data.length;v++)if(r&&x(y.data[v]))g++;else{var b=y.data[v].length;p+=b,void 0!==c?0<b&&(d+=Math.abs(b-c),c=b):c=b}0<y.data.length&&(p/=y.data.length-g),(void 0===l||d<=l)&&(void 0===u||u<p)&&1.99<p&&(l=d,s=f,u=p)}return{successful:!!(e.delimiter=s),bestDelimiter:s}}(o,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);c.successful?e.delimiter=c.bestDelimiter:(r=!0,e.delimiter=a.DefaultDelimiter),y.meta.delimiter=e.delimiter}var u=b(e);return e.preview&&e.header&&u.preview++,t=o,n=new m(u),y=n.parse(t,i,s),k(),f?{meta:{paused:!0}}:y||{meta:{paused:!1}}},this.paused=function(){return f},this.pause=function(){f=!0,n.abort(),t=w(e.chunk)?"":t.substring(n.getCharIndex())},this.resume=function(){c.streamer._halted?(f=!1,c.streamer.parseChunk(t,!0)):setTimeout(c.resume,3)},this.aborted=function(){return d},this.abort=function(){d=!0,n.abort(),y.meta.aborted=!0,w(e.complete)&&e.complete(y),t=""}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m(e){var t,n=(e=e||{}).delimiter,r=e.newline,o=e.comments,i=e.step,s=e.preview,l=e.fastMode,c=t=void 0===e.quoteChar||null===e.quoteChar?'"':e.quoteChar;if(void 0!==e.escapeChar&&(c=e.escapeChar),("string"!=typeof n||-1<a.BAD_DELIMITERS.indexOf(n))&&(n=","),o===n)throw new Error("Comment character same as delimiter");!0===o?o="#":("string"!=typeof o||-1<a.BAD_DELIMITERS.indexOf(o))&&(o=!1),"\n"!==r&&"\r"!==r&&"\r\n"!==r&&(r="\n");var u=0,h=!1;this.parse=function(a,f,d){if("string"!=typeof a)throw new Error("Input must be a string");var m=a.length,g=n.length,y=r.length,v=o.length,b=w(i),x=[],k=[],S=[],O=u=0;if(!a)return U();if(e.header&&!f){var _=a.split(r)[0].split(n),E=[],C={},A=!1;for(var j in _){var P=_[j];w(e.transformHeader)&&(P=e.transformHeader(P,j));var M=P,R=C[P]||0;for(0<R&&(A=!0,M=P+"_"+R),C[P]=R+1;E.includes(M);)M=M+"_"+R;E.push(M)}if(A){var T=a.split(r);T[0]=E.join(n),a=T.join(r)}}if(l||!1!==l&&-1===a.indexOf(t)){for(var L=a.split(r),I=0;I<L.length;I++){if(S=L[I],u+=S.length,I!==L.length-1)u+=r.length;else if(d)return U();if(!o||S.substring(0,v)!==o){if(b){if(x=[],H(S.split(n)),K(),h)return U()}else H(S.split(n));if(s&&s<=I)return x=x.slice(0,s),U(!0)}}return U()}for(var N=a.indexOf(n,u),z=a.indexOf(r,u),D=new RegExp(p(c)+p(t),"g"),F=a.indexOf(t,u);;)if(a[u]!==t)if(o&&0===S.length&&a.substring(u,u+v)===o){if(-1===z)return U();u=z+y,z=a.indexOf(r,u),N=a.indexOf(n,u)}else if(-1!==N&&(N<z||-1===z))S.push(a.substring(u,N)),u=N+g,N=a.indexOf(n,u);else{if(-1===z)break;if(S.push(a.substring(u,z)),V(z+y),b&&(K(),h))return U();if(s&&x.length>=s)return U(!0)}else for(F=u,u++;;){if(-1===(F=a.indexOf(t,F+1)))return d||k.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:x.length,index:u}),q();if(F===m-1)return q(a.substring(u,F).replace(D,t));if(t!==c||a[F+1]!==c){if(t===c||0===F||a[F-1]!==c){-1!==N&&N<F+1&&(N=a.indexOf(n,F+1)),-1!==z&&z<F+1&&(z=a.indexOf(r,F+1));var B=W(-1===z?N:Math.min(N,z));if(a.substr(F+1+B,g)===n){S.push(a.substring(u,F).replace(D,t)),a[u=F+1+B+g]!==t&&(F=a.indexOf(t,u)),N=a.indexOf(n,u),z=a.indexOf(r,u);break}var $=W(z);if(a.substring(F+1+$,F+1+$+y)===r){if(S.push(a.substring(u,F).replace(D,t)),V(F+1+$+y),N=a.indexOf(n,u),F=a.indexOf(t,u),b&&(K(),h))return U();if(s&&x.length>=s)return U(!0);break}k.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:x.length,index:u}),F++}}else F++}return q();function H(e){x.push(e),O=u}function W(e){var t=0;if(-1!==e){var n=a.substring(F+1,e);n&&""===n.trim()&&(t=n.length)}return t}function q(e){return d||(void 0===e&&(e=a.substring(u)),S.push(e),u=m,H(S),b&&K()),U()}function V(e){u=e,H(S),S=[],z=a.indexOf(r,u)}function U(e){return{data:x,errors:k,meta:{delimiter:n,linebreak:r,aborted:h,truncated:!!e,cursor:O+(f||0)}}}function K(){i(U()),x=[],k=[]}},this.abort=function(){h=!0},this.getCharIndex=function(){return u}}function g(e){var t=e.data,n=o[t.workerId],r=!1;if(t.error)n.userError(t.error,t.file);else if(t.results&&t.results.data){var i={abort:function(){r=!0,y(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:v,resume:v};if(w(n.userStep)){for(var a=0;a<t.results.data.length&&(n.userStep({data:t.results.data[a],errors:t.results.errors,meta:t.results.meta},i),!r);a++);delete t.results}else w(n.userChunk)&&(n.userChunk(t.results,i,t.file),delete t.results)}t.finished&&!r&&y(t.workerId,t.results)}function y(e,t){var n=o[e];w(n.userComplete)&&n.userComplete(t),n.terminate(),delete o[e]}function v(){throw new Error("Not implemented.")}function b(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var n in e)t[n]=b(e[n]);return t}function x(e,t){return function(){e.apply(t,arguments)}}function w(e){return"function"==typeof e}return r&&(t.onmessage=function(e){var n=e.data;if(void 0===a.WORKER_ID&&n&&(a.WORKER_ID=n.workerId),"string"==typeof n.input)t.postMessage({workerId:a.WORKER_ID,results:a.parse(n.input,n.config),finished:!0});else if(t.File&&n.input instanceof File||n.input instanceof Object){var r=a.parse(n.input,n.config);r&&t.postMessage({workerId:a.WORKER_ID,results:r,finished:!0})}}),(c.prototype=Object.create(l.prototype)).constructor=c,(u.prototype=Object.create(l.prototype)).constructor=u,(h.prototype=Object.create(h.prototype)).constructor=h,(f.prototype=Object.create(l.prototype)).constructor=f,a},void 0===(r=n.apply(t,[]))||(e.exports=r)},2799:(e,t)=>{"use strict";var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,i=n?Symbol.for("react.fragment"):60107,a=n?Symbol.for("react.strict_mode"):60108,s=n?Symbol.for("react.profiler"):60114,l=n?Symbol.for("react.provider"):60109,c=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,h=n?Symbol.for("react.concurrent_mode"):60111,f=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,p=n?Symbol.for("react.suspense_list"):60120,m=n?Symbol.for("react.memo"):60115,g=n?Symbol.for("react.lazy"):60116,y=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,b=n?Symbol.for("react.responder"):60118,x=n?Symbol.for("react.scope"):60119;function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case h:case i:case s:case a:case d:return e;default:switch(e=e&&e.$$typeof){case c:case f:case g:case m:case l:return e;default:return t}}case o:return t}}}function k(e){return w(e)===h}t.AsyncMode=u,t.ConcurrentMode=h,t.ContextConsumer=c,t.ContextProvider=l,t.Element=r,t.ForwardRef=f,t.Fragment=i,t.Lazy=g,t.Memo=m,t.Portal=o,t.Profiler=s,t.StrictMode=a,t.Suspense=d,t.isAsyncMode=function(e){return k(e)||w(e)===u},t.isConcurrentMode=k,t.isContextConsumer=function(e){return w(e)===c},t.isContextProvider=function(e){return w(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return w(e)===f},t.isFragment=function(e){return w(e)===i},t.isLazy=function(e){return w(e)===g},t.isMemo=function(e){return w(e)===m},t.isPortal=function(e){return w(e)===o},t.isProfiler=function(e){return w(e)===s},t.isStrictMode=function(e){return w(e)===a},t.isSuspense=function(e){return w(e)===d},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===h||e===s||e===a||e===d||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===m||e.$$typeof===l||e.$$typeof===c||e.$$typeof===f||e.$$typeof===v||e.$$typeof===b||e.$$typeof===x||e.$$typeof===y)},t.typeOf=w},4363:(e,t,n)=>{"use strict";e.exports=n(2799)},2192:(e,t,n)=>{"use strict";function r(){return r=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},r.apply(this,arguments)}n.d(t,{A:()=>y});var o=n(1594);const i=o.useLayoutEffect;var a=function(e,t){"function"!=typeof e?e.current=t:e(t)};var s={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},l=function(e){Object.keys(s).forEach((function(t){e.style.setProperty(t,s[t],"important")}))},c=null,u=function(e,t){var n=e.scrollHeight;return"border-box"===t.sizingStyle.boxSizing?n+t.borderSize:n-t.paddingSize},h=function(){},f=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak"],d=!!document.documentElement.currentStyle;function p(e,t,n){var r,a,s=(r=n,a=o.useRef(r),i((function(){a.current=r})),a);o.useLayoutEffect((function(){var n=function(e){return s.current(e)};if(e)return e.addEventListener(t,n),function(){return e.removeEventListener(t,n)}}),[])}var m=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],g=function(e,t){var n,i=e.cacheMeasurements,s=e.maxRows,g=e.minRows,y=e.onChange,v=void 0===y?h:y,b=e.onHeightChange,x=void 0===b?h:b,w=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,m),k=void 0!==w.value,S=o.useRef(null),O=function(e,t){var n=(0,o.useRef)();return(0,o.useCallback)((function(r){e.current=r,n.current&&a(n.current,null),n.current=t,t&&a(t,r)}),[t])}(S,t),_=o.useRef(0),E=o.useRef(),C=function(){var e=S.current,t=i&&E.current?E.current:function(e){var t=window.getComputedStyle(e);if(null===t)return null;var n,r=(n=t,f.reduce((function(e,t){return e[t]=n[t],e}),{})),o=r.boxSizing;return""===o?null:(d&&"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){E.current=t;var n=function(e,t,n,r){void 0===n&&(n=1),void 0===r&&(r=1/0),c||((c=document.createElement("textarea")).setAttribute("tabindex","-1"),c.setAttribute("aria-hidden","true"),l(c)),null===c.parentNode&&document.body.appendChild(c);var o=e.paddingSize,i=e.borderSize,a=e.sizingStyle,s=a.boxSizing;Object.keys(a).forEach((function(e){var t=e;c.style[t]=a[t]})),l(c),c.value=t;var h=u(c,e);c.value=t,h=u(c,e),c.value="x";var f=c.scrollHeight-o,d=f*n;"border-box"===s&&(d=d+o+i),h=Math.max(d,h);var p=f*r;return"border-box"===s&&(p=p+o+i),[h=Math.min(p,h),f]}(t,e.value||e.placeholder||"x",g,s),r=n[0],o=n[1];_.current!==r&&(_.current=r,e.style.setProperty("height",r+"px","important"),x(r,{rowHeight:o}))}};return o.useLayoutEffect(C),p(window,"resize",C),n=C,p(document.fonts,"loadingdone",n),o.createElement("textarea",r({},w,{onChange:function(e){k||C(),v(e)},ref:O}))},y=o.forwardRef(g)},1020:(e,t,n)=>{"use strict";var r=n(1594),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,n){var r,i={},c=null,u=null;for(r in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)a.call(t,r)&&!l.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===i[r]&&(i[r]=t[r]);return{$$typeof:o,type:e,key:c,ref:u,props:i,_owner:s.current}}t.Fragment=i,t.jsx=c,t.jsxs=c},4848:(e,t,n)=>{"use strict";e.exports=n(1020)},2833:e=>{e.exports=function(e,t,n,r){var o=n?n.call(r,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(t),l=0;l<i.length;l++){var c=i[l];if(!s(c))return!1;var u=e[c],h=t[c];if(!1===(o=n?n.call(r,u,h,c):void 0)||void 0===o&&u!==h)return!1}return!0}},3185:(e,t,n)=>{"use strict";n.d(t,{DU:()=>Yt,Ay:()=>Qt});var r=function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)};function o(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var i=n(1594),a=n.n(i),s=n(2833),l=n.n(s),c="-ms-",u="-moz-",h="-webkit-",f="comm",d="rule",p="decl",m="@import",g="@keyframes",y="@layer",v=Math.abs,b=String.fromCharCode,x=Object.assign;function w(e){return e.trim()}function k(e,t){return(e=t.exec(e))?e[0]:e}function S(e,t,n){return e.replace(t,n)}function O(e,t,n){return e.indexOf(t,n)}function _(e,t){return 0|e.charCodeAt(t)}function E(e,t,n){return e.slice(t,n)}function C(e){return e.length}function A(e){return e.length}function j(e,t){return t.push(e),e}function P(e,t){return e.filter((function(e){return!k(e,t)}))}var M=1,R=1,T=0,L=0,I=0,N="";function z(e,t,n,r,o,i,a,s){return{value:e,root:t,parent:n,type:r,props:o,children:i,line:M,column:R,length:a,return:"",siblings:s}}function D(e,t){return x(z("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},t)}function F(e){for(;e.root;)e=D(e.root,{children:[e]});j(e,e.siblings)}function B(){return I=L>0?_(N,--L):0,R--,10===I&&(R=1,M--),I}function $(){return I=L<T?_(N,L++):0,R++,10===I&&(R=1,M++),I}function H(){return _(N,L)}function W(){return L}function q(e,t){return E(N,e,t)}function V(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function U(e){return w(q(L-1,G(91===e?e+2:40===e?e+1:e)))}function K(e){for(;(I=H())&&I<33;)$();return V(e)>2||V(I)>3?"":" "}function Q(e,t){for(;--t&&$()&&!(I<48||I>102||I>57&&I<65||I>70&&I<97););return q(e,W()+(t<6&&32==H()&&32==$()))}function G(e){for(;$();)switch(I){case e:return L;case 34:case 39:34!==e&&39!==e&&G(I);break;case 40:41===e&&G(e);break;case 92:$()}return L}function Y(e,t){for(;$()&&e+I!==57&&(e+I!==84||47!==H()););return"/*"+q(t,L-1)+"*"+b(47===e?e:$())}function Z(e){for(;!V(H());)$();return q(e,L)}function X(e,t){for(var n="",r=0;r<e.length;r++)n+=t(e[r],r,e,t)||"";return n}function J(e,t,n,r){switch(e.type){case y:if(e.children.length)break;case m:case p:return e.return=e.return||e.value;case f:return"";case g:return e.return=e.value+"{"+X(e.children,r)+"}";case d:if(!C(e.value=e.props.join(",")))return""}return C(n=X(e.children,r))?e.return=e.value+"{"+n+"}":""}function ee(e,t,n){switch(function(e,t){return 45^_(e,0)?(((t<<2^_(e,0))<<2^_(e,1))<<2^_(e,2))<<2^_(e,3):0}(e,t)){case 5103:return h+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return h+e+e;case 4789:return u+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return h+e+u+e+c+e+e;case 5936:switch(_(e,t+11)){case 114:return h+e+c+S(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return h+e+c+S(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return h+e+c+S(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return h+e+c+e+e;case 6165:return h+e+c+"flex-"+e+e;case 5187:return h+e+S(e,/(\w+).+(:[^]+)/,h+"box-$1$2"+c+"flex-$1$2")+e;case 5443:return h+e+c+"flex-item-"+S(e,/flex-|-self/g,"")+(k(e,/flex-|baseline/)?"":c+"grid-row-"+S(e,/flex-|-self/g,""))+e;case 4675:return h+e+c+"flex-line-pack"+S(e,/align-content|flex-|-self/g,"")+e;case 5548:return h+e+c+S(e,"shrink","negative")+e;case 5292:return h+e+c+S(e,"basis","preferred-size")+e;case 6060:return h+"box-"+S(e,"-grow","")+h+e+c+S(e,"grow","positive")+e;case 4554:return h+S(e,/([^-])(transform)/g,"$1"+h+"$2")+e;case 6187:return S(S(S(e,/(zoom-|grab)/,h+"$1"),/(image-set)/,h+"$1"),e,"")+e;case 5495:case 3959:return S(e,/(image-set\([^]*)/,h+"$1$`$1");case 4968:return S(S(e,/(.+:)(flex-)?(.*)/,h+"box-pack:$3"+c+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+h+e+e;case 4200:if(!k(e,/flex-|baseline/))return c+"grid-column-align"+E(e,t)+e;break;case 2592:case 3360:return c+S(e,"template-","")+e;case 4384:case 3616:return n&&n.some((function(e,n){return t=n,k(e.props,/grid-\w+-end/)}))?~O(e+(n=n[t].value),"span",0)?e:c+S(e,"-start","")+e+c+"grid-row-span:"+(~O(n,"span",0)?k(n,/\d+/):+k(n,/\d+/)-+k(e,/\d+/))+";":c+S(e,"-start","")+e;case 4896:case 4128:return n&&n.some((function(e){return k(e.props,/grid-\w+-start/)}))?e:c+S(S(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return S(e,/(.+)-inline(.+)/,h+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(C(e)-1-t>6)switch(_(e,t+1)){case 109:if(45!==_(e,t+4))break;case 102:return S(e,/(.+:)(.+)-([^]+)/,"$1"+h+"$2-$3$1"+u+(108==_(e,t+3)?"$3":"$2-$3"))+e;case 115:return~O(e,"stretch",0)?ee(S(e,"stretch","fill-available"),t,n)+e:e}break;case 5152:case 5920:return S(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,(function(t,n,r,o,i,a,s){return c+n+":"+r+s+(o?c+n+"-span:"+(i?a:+a-+r)+s:"")+e}));case 4949:if(121===_(e,t+6))return S(e,":",":"+h)+e;break;case 6444:switch(_(e,45===_(e,14)?18:11)){case 120:return S(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+h+(45===_(e,14)?"inline-":"")+"box$3$1"+h+"$2$3$1"+c+"$2box$3")+e;case 100:return S(e,":",":"+c)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return S(e,"scroll-","scroll-snap-")+e}return e}function te(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case p:return void(e.return=ee(e.value,e.length,n));case g:return X([D(e,{value:S(e.value,"@","@"+h)})],r);case d:if(e.length)return function(e,t){return e.map(t).join("")}(n=e.props,(function(t){switch(k(t,r=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":F(D(e,{props:[S(t,/:(read-\w+)/,":"+u+"$1")]})),F(D(e,{props:[t]})),x(e,{props:P(n,r)});break;case"::placeholder":F(D(e,{props:[S(t,/:(plac\w+)/,":"+h+"input-$1")]})),F(D(e,{props:[S(t,/:(plac\w+)/,":"+u+"$1")]})),F(D(e,{props:[S(t,/:(plac\w+)/,c+"input-$1")]})),F(D(e,{props:[t]})),x(e,{props:P(n,r)})}return""}))}}function ne(e){return function(e){return N="",e}(re("",null,null,null,[""],e=function(e){return M=R=1,T=C(N=e),L=0,[]}(e),0,[0],e))}function re(e,t,n,r,o,i,a,s,l){for(var c=0,u=0,h=a,f=0,d=0,p=0,m=1,g=1,y=1,x=0,w="",k=o,E=i,A=r,P=w;g;)switch(p=x,x=$()){case 40:if(108!=p&&58==_(P,h-1)){-1!=O(P+=S(U(x),"&","&\f"),"&\f",v(c?s[c-1]:0))&&(y=-1);break}case 34:case 39:case 91:P+=U(x);break;case 9:case 10:case 13:case 32:P+=K(p);break;case 92:P+=Q(W()-1,7);continue;case 47:switch(H()){case 42:case 47:j(ie(Y($(),W()),t,n,l),l);break;default:P+="/"}break;case 123*m:s[c++]=C(P)*y;case 125*m:case 59:case 0:switch(x){case 0:case 125:g=0;case 59+u:-1==y&&(P=S(P,/\f/g,"")),d>0&&C(P)-h&&j(d>32?ae(P+";",r,n,h-1,l):ae(S(P," ","")+";",r,n,h-2,l),l);break;case 59:P+=";";default:if(j(A=oe(P,t,n,c,u,o,s,w,k=[],E=[],h,i),i),123===x)if(0===u)re(P,t,A,A,k,i,h,s,E);else switch(99===f&&110===_(P,3)?100:f){case 100:case 108:case 109:case 115:re(e,A,A,r&&j(oe(e,A,A,0,0,o,s,w,o,k=[],h,E),E),o,E,h,s,r?k:E);break;default:re(P,A,A,A,[""],E,0,s,E)}}c=u=d=0,m=y=1,w=P="",h=a;break;case 58:h=1+C(P),d=p;default:if(m<1)if(123==x)--m;else if(125==x&&0==m++&&125==B())continue;switch(P+=b(x),x*m){case 38:y=u>0?1:(P+="\f",-1);break;case 44:s[c++]=(C(P)-1)*y,y=1;break;case 64:45===H()&&(P+=U($())),f=H(),u=h=C(w=P+=Z(W())),x++;break;case 45:45===p&&2==C(P)&&(m=0)}}return i}function oe(e,t,n,r,o,i,a,s,l,c,u,h){for(var f=o-1,p=0===o?i:[""],m=A(p),g=0,y=0,b=0;g<r;++g)for(var x=0,k=E(e,f+1,f=v(y=a[g])),O=e;x<m;++x)(O=w(y>0?p[x]+" "+k:S(k,/&\f/g,p[x])))&&(l[b++]=O);return z(e,t,n,0===o?d:s,l,c,u,h)}function ie(e,t,n,r){return z(e,t,n,f,b(I),E(e,2,-2),0,r)}function ae(e,t,n,r,o){return z(e,t,n,p,E(e,0,r),E(e,r+1,-1),r,o)}var se=n(3969),le="undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",ce="active",ue="data-styled-version",he="6.1.12",fe="/*!sc*/\n",de="undefined"!=typeof window&&"HTMLElement"in window,pe=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==process.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&process.env.REACT_APP_SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.SC_DISABLE_SPEEDY&&""!==process.env.SC_DISABLE_SPEEDY&&"false"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY),me={},ge=(new Set,Object.freeze([])),ye=Object.freeze({});function ve(e,t,n){return void 0===n&&(n=ye),e.theme!==n.theme&&e.theme||t||n.theme}var be=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),xe=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,we=/(^-|-$)/g;function ke(e){return e.replace(xe,"-").replace(we,"")}var Se=/(a)(d)/gi,Oe=52,_e=function(e){return String.fromCharCode(e+(e>25?39:97))};function Ee(e){var t,n="";for(t=Math.abs(e);t>Oe;t=t/Oe|0)n=_e(t%Oe)+n;return(_e(t%Oe)+n).replace(Se,"$1-$2")}var Ce,Ae=5381,je=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},Pe=function(e){return je(Ae,e)};function Me(e){return Ee(Pe(e)>>>0)}function Re(e){return"string"==typeof e&&!0}var Te="function"==typeof Symbol&&Symbol.for,Le=Te?Symbol.for("react.memo"):60115,Ie=Te?Symbol.for("react.forward_ref"):60112,Ne={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},ze={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},De={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Fe=((Ce={})[Ie]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Ce[Le]=De,Ce);function Be(e){return("type"in(t=e)&&t.type.$$typeof)===Le?De:"$$typeof"in e?Fe[e.$$typeof]:Ne;var t}var $e=Object.defineProperty,He=Object.getOwnPropertyNames,We=Object.getOwnPropertySymbols,qe=Object.getOwnPropertyDescriptor,Ve=Object.getPrototypeOf,Ue=Object.prototype;function Ke(e,t,n){if("string"!=typeof t){if(Ue){var r=Ve(t);r&&r!==Ue&&Ke(e,r,n)}var o=He(t);We&&(o=o.concat(We(t)));for(var i=Be(e),a=Be(t),s=0;s<o.length;++s){var l=o[s];if(!(l in ze||n&&n[l]||a&&l in a||i&&l in i)){var c=qe(t,l);try{$e(e,l,c)}catch(e){}}}}return e}function Qe(e){return"function"==typeof e}function Ge(e){return"object"==typeof e&&"styledComponentId"in e}function Ye(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function Ze(e,t){if(0===e.length)return"";for(var n=e[0],r=1;r<e.length;r++)n+=t?t+e[r]:e[r];return n}function Xe(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function Je(e,t,n){if(void 0===n&&(n=!1),!n&&!Xe(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var r=0;r<t.length;r++)e[r]=Je(e[r],t[r]);else if(Xe(t))for(var r in t)e[r]=Je(e[r],t[r]);return e}function et(e,t){Object.defineProperty(e,"toString",{value:t})}function tt(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):""))}var nt=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return e.prototype.indexOfGroup=function(e){for(var t=0,n=0;n<e;n++)t+=this.groupSizes[n];return t},e.prototype.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,o=r;e>=o;)if((o<<=1)<0)throw tt(16,"".concat(e));this.groupSizes=new Uint32Array(o),this.groupSizes.set(n),this.length=o;for(var i=r;i<o;i++)this.groupSizes[i]=0}for(var a=this.indexOfGroup(e+1),s=(i=0,t.length);i<s;i++)this.tag.insertRule(a,t[i])&&(this.groupSizes[e]++,a++)},e.prototype.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),r=n+t;this.groupSizes[e]=0;for(var o=n;o<r;o++)this.tag.deleteRule(n)}},e.prototype.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),o=r+n,i=r;i<o;i++)t+="".concat(this.tag.getRule(i)).concat(fe);return t},e}(),rt=new Map,ot=new Map,it=1,at=function(e){if(rt.has(e))return rt.get(e);for(;ot.has(it);)it++;var t=it++;return rt.set(e,t),ot.set(t,e),t},st=function(e,t){it=t+1,rt.set(e,t),ot.set(t,e)},lt="style[".concat(le,"][").concat(ue,'="').concat(he,'"]'),ct=new RegExp("^".concat(le,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),ut=function(e,t,n){for(var r,o=n.split(","),i=0,a=o.length;i<a;i++)(r=o[i])&&e.registerName(t,r)},ht=function(e,t){for(var n,r=(null!==(n=t.textContent)&&void 0!==n?n:"").split(fe),o=[],i=0,a=r.length;i<a;i++){var s=r[i].trim();if(s){var l=s.match(ct);if(l){var c=0|parseInt(l[1],10),u=l[2];0!==c&&(st(u,c),ut(e,u,l[3]),e.getTag().insertRules(c,o)),o.length=0}else o.push(s)}}},ft=function(e){for(var t=document.querySelectorAll(lt),n=0,r=t.length;n<r;n++){var o=t[n];o&&o.getAttribute(le)!==ce&&(ht(e,o),o.parentNode&&o.parentNode.removeChild(o))}};function dt(){return n.nc}var pt=function(e){var t=document.head,n=e||t,r=document.createElement("style"),o=function(e){var t=Array.from(e.querySelectorAll("style[".concat(le,"]")));return t[t.length-1]}(n),i=void 0!==o?o.nextSibling:null;r.setAttribute(le,ce),r.setAttribute(ue,he);var a=dt();return a&&r.setAttribute("nonce",a),n.insertBefore(r,i),r},mt=function(){function e(e){this.element=pt(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n<r;n++){var o=t[n];if(o.ownerNode===e)return o}throw tt(17)}(this.element),this.length=0}return e.prototype.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}},e.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},e.prototype.getRule=function(e){var t=this.sheet.cssRules[e];return t&&t.cssText?t.cssText:""},e}(),gt=function(){function e(e){this.element=pt(e),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t);return this.element.insertBefore(n,this.nodes[e]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},e.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),yt=function(){function e(e){this.rules=[],this.length=0}return e.prototype.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},e.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--},e.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),vt=de,bt={isServer:!de,useCSSOMInjection:!pe},xt=function(){function e(e,t,n){void 0===e&&(e=ye),void 0===t&&(t={});var o=this;this.options=r(r({},bt),e),this.gs=t,this.names=new Map(n),this.server=!!e.isServer,!this.server&&de&&vt&&(vt=!1,ft(this)),et(this,(function(){return function(e){for(var t=e.getTag(),n=t.length,r="",o=function(n){var o=function(e){return ot.get(e)}(n);if(void 0===o)return"continue";var i=e.names.get(o),a=t.getGroup(n);if(void 0===i||!i.size||0===a.length)return"continue";var s="".concat(le,".g").concat(n,'[id="').concat(o,'"]'),l="";void 0!==i&&i.forEach((function(e){e.length>0&&(l+="".concat(e,","))})),r+="".concat(a).concat(s,'{content:"').concat(l,'"}').concat(fe)},i=0;i<n;i++)o(i);return r}(o)}))}return e.registerId=function(e){return at(e)},e.prototype.rehydrate=function(){!this.server&&de&&ft(this)},e.prototype.reconstructWithOptions=function(t,n){return void 0===n&&(n=!0),new e(r(r({},this.options),t),this.gs,n&&this.names||void 0)},e.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(e=function(e){var t=e.useCSSOMInjection,n=e.target;return e.isServer?new yt(n):t?new mt(n):new gt(n)}(this.options),new nt(e)));var e},e.prototype.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},e.prototype.registerName=function(e,t){if(at(e),this.names.has(e))this.names.get(e).add(t);else{var n=new Set;n.add(t),this.names.set(e,n)}},e.prototype.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(at(e),n)},e.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},e.prototype.clearRules=function(e){this.getTag().clearGroup(at(e)),this.clearNames(e)},e.prototype.clearTag=function(){this.tag=void 0},e}(),wt=/&/g,kt=/^\s*\/\/.*$/gm;function St(e,t){return e.map((function(e){return"rule"===e.type&&(e.value="".concat(t," ").concat(e.value),e.value=e.value.replaceAll(",",",".concat(t," ")),e.props=e.props.map((function(e){return"".concat(t," ").concat(e)}))),Array.isArray(e.children)&&"@keyframes"!==e.type&&(e.children=St(e.children,t)),e}))}function Ot(e){var t,n,r,o=void 0===e?ye:e,i=o.options,a=void 0===i?ye:i,s=o.plugins,l=void 0===s?ge:s,c=function(e,r,o){return o.startsWith(n)&&o.endsWith(n)&&o.replaceAll(n,"").length>0?".".concat(t):e},u=l.slice();u.push((function(e){e.type===d&&e.value.includes("&")&&(e.props[0]=e.props[0].replace(wt,n).replace(r,c))})),a.prefix&&u.push(te),u.push(J);var h=function(e,o,i,s){void 0===o&&(o=""),void 0===i&&(i=""),void 0===s&&(s="&"),t=s,n=o,r=new RegExp("\\".concat(n,"\\b"),"g");var l=e.replace(kt,""),c=ne(i||o?"".concat(i," ").concat(o," { ").concat(l," }"):l);a.namespace&&(c=St(c,a.namespace));var h,f,d,p=[];return X(c,(h=u.concat((d=function(e){return p.push(e)},function(e){e.root||(e=e.return)&&d(e)})),f=A(h),function(e,t,n,r){for(var o="",i=0;i<f;i++)o+=h[i](e,t,n,r)||"";return o})),p};return h.hash=l.length?l.reduce((function(e,t){return t.name||tt(15),je(e,t.name)}),Ae).toString():"",h}var _t=new xt,Et=Ot(),Ct=a().createContext({shouldForwardProp:void 0,styleSheet:_t,stylis:Et}),At=(Ct.Consumer,a().createContext(void 0));function jt(){return(0,i.useContext)(Ct)}function Pt(e){var t=(0,i.useState)(e.stylisPlugins),n=t[0],r=t[1],o=jt().styleSheet,s=(0,i.useMemo)((function(){var t=o;return e.sheet?t=e.sheet:e.target&&(t=t.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(t=t.reconstructWithOptions({useCSSOMInjection:!1})),t}),[e.disableCSSOMInjection,e.sheet,e.target,o]),c=(0,i.useMemo)((function(){return Ot({options:{namespace:e.namespace,prefix:e.enableVendorPrefixes},plugins:n})}),[e.enableVendorPrefixes,e.namespace,n]);(0,i.useEffect)((function(){l()(n,e.stylisPlugins)||r(e.stylisPlugins)}),[e.stylisPlugins]);var u=(0,i.useMemo)((function(){return{shouldForwardProp:e.shouldForwardProp,styleSheet:s,stylis:c}}),[e.shouldForwardProp,s,c]);return a().createElement(Ct.Provider,{value:u},a().createElement(At.Provider,{value:c},e.children))}var Mt=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=Et);var r=n.name+t.hash;e.hasNameForId(n.id,r)||e.insertRules(n.id,r,t(n.rules,r,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,et(this,(function(){throw tt(12,String(n.name))}))}return e.prototype.getName=function(e){return void 0===e&&(e=Et),this.name+e.hash},e}(),Rt=function(e){return e>="A"&&e<="Z"};function Tt(e){for(var t="",n=0;n<e.length;n++){var r=e[n];if(1===n&&"-"===r&&"-"===e[0])return e;Rt(r)?t+="-"+r.toLowerCase():t+=r}return t.startsWith("ms-")?"-"+t:t}var Lt=function(e){return null==e||!1===e||""===e},It=function(e){var t,n,r=[];for(var i in e){var a=e[i];e.hasOwnProperty(i)&&!Lt(a)&&(Array.isArray(a)&&a.isCss||Qe(a)?r.push("".concat(Tt(i),":"),a,";"):Xe(a)?r.push.apply(r,o(o(["".concat(i," {")],It(a),!1),["}"],!1)):r.push("".concat(Tt(i),": ").concat((t=i,null==(n=a)||"boolean"==typeof n||""===n?"":"number"!=typeof n||0===n||t in se.A||t.startsWith("--")?String(n).trim():"".concat(n,"px")),";")))}return r};function Nt(e,t,n,r){return Lt(e)?[]:Ge(e)?[".".concat(e.styledComponentId)]:Qe(e)?!Qe(o=e)||o.prototype&&o.prototype.isReactComponent||!t?[e]:Nt(e(t),t,n,r):e instanceof Mt?n?(e.inject(n,r),[e.getName(r)]):[e]:Xe(e)?It(e):Array.isArray(e)?Array.prototype.concat.apply(ge,e.map((function(e){return Nt(e,t,n,r)}))):[e.toString()];var o}function zt(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(Qe(n)&&!Ge(n))return!1}return!0}var Dt=Pe(he),Ft=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic=(void 0===n||n.isStatic)&&zt(e),this.componentId=t,this.baseHash=je(Dt,t),this.baseStyle=n,xt.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,n){var r=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(this.componentId,this.staticRulesId))r=Ye(r,this.staticRulesId);else{var o=Ze(Nt(this.rules,e,t,n)),i=Ee(je(this.baseHash,o)>>>0);if(!t.hasNameForId(this.componentId,i)){var a=n(o,".".concat(i),void 0,this.componentId);t.insertRules(this.componentId,i,a)}r=Ye(r,i),this.staticRulesId=i}else{for(var s=je(this.baseHash,n.hash),l="",c=0;c<this.rules.length;c++){var u=this.rules[c];if("string"==typeof u)l+=u;else if(u){var h=Ze(Nt(u,e,t,n));s=je(s,h+c),l+=h}}if(l){var f=Ee(s>>>0);t.hasNameForId(this.componentId,f)||t.insertRules(this.componentId,f,n(l,".".concat(f),void 0,this.componentId)),r=Ye(r,f)}}return r},e}(),Bt=a().createContext(void 0);Bt.Consumer;var $t={};function Ht(e,t,n){var o=Ge(e),s=e,l=!Re(e),c=t.attrs,u=void 0===c?ge:c,h=t.componentId,f=void 0===h?function(e,t){var n="string"!=typeof e?"sc":ke(e);$t[n]=($t[n]||0)+1;var r="".concat(n,"-").concat(Me(he+n+$t[n]));return t?"".concat(t,"-").concat(r):r}(t.displayName,t.parentComponentId):h,d=t.displayName,p=void 0===d?function(e){return Re(e)?"styled.".concat(e):"Styled(".concat(function(e){return e.displayName||e.name||"Component"}(e),")")}(e):d,m=t.displayName&&t.componentId?"".concat(ke(t.displayName),"-").concat(t.componentId):t.componentId||f,g=o&&s.attrs?s.attrs.concat(u).filter(Boolean):u,y=t.shouldForwardProp;if(o&&s.shouldForwardProp){var v=s.shouldForwardProp;if(t.shouldForwardProp){var b=t.shouldForwardProp;y=function(e,t){return v(e,t)&&b(e,t)}}else y=v}var x=new Ft(n,m,o?s.componentStyle:void 0);function w(e,t){return function(e,t,n){var o=e.attrs,s=e.componentStyle,l=e.defaultProps,c=e.foldedComponentIds,u=e.styledComponentId,h=e.target,f=a().useContext(Bt),d=jt(),p=e.shouldForwardProp||d.shouldForwardProp,m=ve(t,f,l)||ye,g=function(e,t,n){for(var o,i=r(r({},t),{className:void 0,theme:n}),a=0;a<e.length;a+=1){var s=Qe(o=e[a])?o(i):o;for(var l in s)i[l]="className"===l?Ye(i[l],s[l]):"style"===l?r(r({},i[l]),s[l]):s[l]}return t.className&&(i.className=Ye(i.className,t.className)),i}(o,t,m),y=g.as||h,v={};for(var b in g)void 0===g[b]||"$"===b[0]||"as"===b||"theme"===b&&g.theme===m||("forwardedAs"===b?v.as=g.forwardedAs:p&&!p(b,y)||(v[b]=g[b]));var x=function(e,t){var n=jt();return e.generateAndInjectStyles(t,n.styleSheet,n.stylis)}(s,g),w=Ye(c,u);return x&&(w+=" "+x),g.className&&(w+=" "+g.className),v[Re(y)&&!be.has(y)?"class":"className"]=w,v.ref=n,(0,i.createElement)(y,v)}(k,e,t)}w.displayName=p;var k=a().forwardRef(w);return k.attrs=g,k.componentStyle=x,k.displayName=p,k.shouldForwardProp=y,k.foldedComponentIds=o?Ye(s.foldedComponentIds,s.styledComponentId):"",k.styledComponentId=m,k.target=o?s.target:e,Object.defineProperty(k,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=o?function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=0,o=t;r<o.length;r++)Je(e,o[r],!0);return e}({},s.defaultProps,e):e}}),et(k,(function(){return".".concat(k.styledComponentId)})),l&&Ke(k,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),k}function Wt(e,t){for(var n=[e[0]],r=0,o=t.length;r<o;r+=1)n.push(t[r],e[r+1]);return n}new Set;var qt=function(e){return Object.assign(e,{isCss:!0})};function Vt(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(Qe(e)||Xe(e))return qt(Nt(Wt(ge,o([e],t,!0))));var r=e;return 0===t.length&&1===r.length&&"string"==typeof r[0]?Nt(r):qt(Nt(Wt(r,t)))}function Ut(e,t,n){if(void 0===n&&(n=ye),!t)throw tt(1,t);var i=function(r){for(var i=[],a=1;a<arguments.length;a++)i[a-1]=arguments[a];return e(t,n,Vt.apply(void 0,o([r],i,!1)))};return i.attrs=function(o){return Ut(e,t,r(r({},n),{attrs:Array.prototype.concat(n.attrs,o).filter(Boolean)}))},i.withConfig=function(o){return Ut(e,t,r(r({},n),o))},i}var Kt=function(e){return Ut(Ht,e)},Qt=Kt;be.forEach((function(e){Qt[e]=Kt(e)}));var Gt=function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=zt(e),xt.registerId(this.componentId+1)}return e.prototype.createStyles=function(e,t,n,r){var o=r(Ze(Nt(this.rules,t,n,r)),""),i=this.componentId+e;n.insertRules(i,i,o)},e.prototype.removeStyles=function(e,t){t.clearRules(this.componentId+e)},e.prototype.renderStyles=function(e,t,n,r){e>2&&xt.registerId(this.componentId+e),this.removeStyles(e,n),this.createStyles(e,t,n,r)},e}();function Yt(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=Vt.apply(void 0,o([e],t,!1)),s="sc-global-".concat(Me(JSON.stringify(i))),l=new Gt(i,s),c=function(e){var t=jt(),n=a().useContext(Bt),r=a().useRef(t.styleSheet.allocateGSInstance(s)).current;return t.styleSheet.server&&u(r,e,t.styleSheet,n,t.stylis),a().useLayoutEffect((function(){if(!t.styleSheet.server)return u(r,e,t.styleSheet,n,t.stylis),function(){return l.removeStyles(r,t.styleSheet)}}),[r,e,t.styleSheet,n,t.stylis]),null};function u(e,t,n,o,i){if(l.isStatic)l.renderStyles(e,me,n,i);else{var a=r(r({},t),{theme:ve(t,o,c.defaultProps)});l.renderStyles(e,a,n,i)}}return a().memo(c)}(function(){function e(){var e=this;this._emitSheetCSS=function(){var t=e.instance.toString();if(!t)return"";var n=dt(),r=Ze([n&&'nonce="'.concat(n,'"'),"".concat(le,'="true"'),"".concat(ue,'="').concat(he,'"')].filter(Boolean)," ");return"<style ".concat(r,">").concat(t,"</style>")},this.getStyleTags=function(){if(e.sealed)throw tt(2);return e._emitSheetCSS()},this.getStyleElement=function(){var t;if(e.sealed)throw tt(2);var n=e.instance.toString();if(!n)return[];var o=((t={})[le]="",t[ue]=he,t.dangerouslySetInnerHTML={__html:n},t),i=dt();return i&&(o.nonce=i),[a().createElement("style",r({},o,{key:"sc-0-0"}))]},this.seal=function(){e.sealed=!0},this.instance=new xt({isServer:!0}),this.sealed=!1}e.prototype.collectStyles=function(e){if(this.sealed)throw tt(2);return a().createElement(Pt,{sheet:this.instance},e)},e.prototype.interleaveWithNodeStream=function(e){throw tt(3)}})(),"__sc-".concat(le,"__")},6426:e=>{e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}}},1063:(e,t,n)=>{"use strict";var r=n(1594),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=r.useState,a=r.useEffect,s=r.useLayoutEffect,l=r.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),o=r[0].inst,u=r[1];return s((function(){o.value=n,o.getSnapshot=t,c(o)&&u({inst:o})}),[e,n,t]),a((function(){return c(o)&&u({inst:o}),e((function(){c(o)&&u({inst:o})}))}),[e]),l(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},8940:(e,t,n)=>{"use strict";var r=n(1594),o=n(9888),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=o.useSyncExternalStore,s=r.useRef,l=r.useEffect,c=r.useMemo,u=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var h=s(null);if(null===h.current){var f={hasValue:!1,value:null};h.current=f}else f=h.current;h=c((function(){function e(e){if(!l){if(l=!0,a=e,e=r(e),void 0!==o&&f.hasValue){var t=f.value;if(o(t,e))return s=t}return s=e}if(t=s,i(a,e))return t;var n=r(e);return void 0!==o&&o(t,n)?t:(a=e,s=n)}var a,s,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]}),[t,n,r,o]);var d=a(e,h[0],h[1]);return l((function(){f.hasValue=!0,f.value=d}),[d]),u(d),d}},9888:(e,t,n)=>{"use strict";e.exports=n(1063)},9242:(e,t,n)=>{"use strict";e.exports=n(8940)},4634:e=>{function t(){return e.exports=t=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},e.exports.__esModule=!0,e.exports.default=e.exports,t.apply(this,arguments)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4994:e=>{e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports},4893:e=>{e.exports=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.exports.__esModule=!0,e.exports.default=e.exports},8168:(e,t,n)=>{"use strict";function r(){return r=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},r.apply(this,arguments)}n.d(t,{A:()=>r})},8587:(e,t,n)=>{"use strict";function r(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}n.d(t,{A:()=>r})},9658:(e,t,n)=>{"use strict";n.d(t,{m:()=>i});var r=n(6500),o=n(4880),i=new class extends r.Q{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!o.S$&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e((e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()}))}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){this.listeners.forEach((e=>{e()}))}isFocused(){return"boolean"==typeof this.#e?this.#e:"hidden"!==globalThis.document?.visibilityState}}},6158:(e,t,n)=>{"use strict";n.d(t,{$:()=>s,s:()=>a});var r=n(6261),o=n(1692),i=n(8904),a=class extends o.k{#r;#o;#i;#a;constructor(e){super(),this.mutationId=e.mutationId,this.#o=e.defaultOptions,this.#i=e.mutationCache,this.#r=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options={...this.#o,...e},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#r.includes(e)||(this.#r.push(e),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#r=this.#r.filter((t=>t!==e)),this.scheduleGc(),this.#i.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#r.length||("pending"===this.state.status?this.scheduleGc():this.#i.remove(this))}continue(){return this.#a?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>(this.#a=(0,i.II)({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(e,t)=>{this.#s({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode}),this.#a.promise),n="pending"===this.state.status;try{if(!n){this.#s({type:"pending",variables:e}),await(this.#i.config.onMutate?.(e,this));const t=await(this.options.onMutate?.(e));t!==this.state.context&&this.#s({type:"pending",context:t,variables:e})}const r=await t();return await(this.#i.config.onSuccess?.(r,e,this.state.context,this)),await(this.options.onSuccess?.(r,e,this.state.context)),await(this.#i.config.onSettled?.(r,null,this.state.variables,this.state.context,this)),await(this.options.onSettled?.(r,null,e,this.state.context)),this.#s({type:"success",data:r}),r}catch(t){try{throw await(this.#i.config.onError?.(t,e,this.state.context,this)),await(this.options.onError?.(t,e,this.state.context)),await(this.#i.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this)),await(this.options.onSettled?.(void 0,t,e,this.state.context)),t}finally{this.#s({type:"error",error:t})}}}#s(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!(0,i.v_)(this.options.networkMode),status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),r.j.batch((()=>{this.#r.forEach((t=>{t.onMutationUpdate(e)})),this.#i.notify({mutation:this,type:"updated",action:e})}))}};function s(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},6261:(e,t,n)=>{"use strict";n.d(t,{j:()=>r});var r=function(){let e=[],t=0,n=e=>{e()},r=e=>{e()},o=e=>setTimeout(e,0);const i=r=>{t?e.push(r):o((()=>{n(r)}))};return{batch:i=>{let a;t++;try{a=i()}finally{t--,t||(()=>{const t=e;e=[],t.length&&o((()=>{r((()=>{t.forEach((e=>{n(e)}))}))}))})()}return a},batchCalls:e=>(...t)=>{i((()=>{e(...t)}))},schedule:i,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{o=e}}}()},6035:(e,t,n)=>{"use strict";n.d(t,{t:()=>i});var r=n(6500),o=n(4880),i=new class extends r.Q{#l=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!o.S$&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#l!==e&&(this.#l=e,this.listeners.forEach((t=>{t(e)})))}isOnline(){return this.#l}}},5323:(e,t,n)=>{"use strict";n.d(t,{E:()=>g});var r=n(4880),o=n(6261),i=n(8904),a=n(1692),s=class extends a.k{#c;#u;#h;#f;#a;#r;#o;#d;constructor(e){super(),this.#d=!1,this.#o=e.defaultOptions,this.#p(e.options),this.#r=[],this.#h=e.cache,this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#c=e.state||function(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,n=void 0!==t,r=n?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}(this.options),this.state=this.#c,this.scheduleGc()}get meta(){return this.options.meta}#p(e){this.options={...this.#o,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){this.#r.length||"idle"!==this.state.fetchStatus||this.#h.remove(this)}setData(e,t){const n=(0,r.pl)(this.state.data,e,this.options);return this.#s({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#s({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#f;return this.#a?.cancel(e),t?t.then(r.lQ).catch(r.lQ):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#c)}isActive(){return this.#r.some((e=>!1!==e.options.enabled))}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||void 0===this.state.data||this.#r.some((e=>e.getCurrentResult().isStale))}isStaleByTime(e=0){return this.state.isInvalidated||void 0===this.state.data||!(0,r.j3)(this.state.dataUpdatedAt,e)}onFocus(){const e=this.#r.find((e=>e.shouldFetchOnWindowFocus()));e?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){const e=this.#r.find((e=>e.shouldFetchOnReconnect()));e?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.#r.includes(e)||(this.#r.push(e),this.clearGcTimeout(),this.#h.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.#r.includes(e)&&(this.#r=this.#r.filter((t=>t!==e)),this.#r.length||(this.#a&&(this.#d?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#h.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.#r.length}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}fetch(e,t){if("idle"!==this.state.fetchStatus)if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#f)return this.#a?.continueRetry(),this.#f;if(e&&this.#p(e),!this.options.queryFn){const e=this.#r.find((e=>e.options.queryFn));e&&this.#p(e.options)}const n=new AbortController,o={queryKey:this.queryKey,meta:this.meta},a=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#d=!0,n.signal)})};a(o);const s={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:()=>this.options.queryFn&&this.options.queryFn!==r.hT?(this.#d=!1,this.options.persister?this.options.persister(this.options.queryFn,o,this):this.options.queryFn(o)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`))};a(s),this.options.behavior?.onFetch(s,this),this.#u=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===s.fetchOptions?.meta||this.#s({type:"fetch",meta:s.fetchOptions?.meta});const l=e=>{(0,i.wm)(e)&&e.silent||this.#s({type:"error",error:e}),(0,i.wm)(e)||(this.#h.config.onError?.(e,this),this.#h.config.onSettled?.(this.state.data,e,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return this.#a=(0,i.II)({fn:s.fetchFn,abort:n.abort.bind(n),onSuccess:e=>{void 0!==e?(this.setData(e),this.#h.config.onSuccess?.(e,this),this.#h.config.onSettled?.(e,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1):l(new Error(`${this.queryHash} data is undefined`))},onError:l,onFail:(e,t)=>{this.#s({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode}),this.#f=this.#a.promise,this.#f}#s(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:e.meta??null,fetchStatus:(0,i.v_)(this.options.networkMode)?"fetching":"paused",...void 0===t.data&&{error:null,status:"pending"}};case"success":return{...t,data:e.data,dataUpdateCount:t.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=e.error;return(0,i.wm)(n)&&n.revert&&this.#u?{...this.#u,fetchStatus:"idle"}:{...t,error:n,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),o.j.batch((()=>{this.#r.forEach((e=>{e.onQueryUpdate()})),this.#h.notify({query:this,type:"updated",action:e})}))}},l=n(6500),c=class extends l.Q{constructor(e={}){super(),this.config=e,this.#m=new Map}#m;build(e,t,n){const o=t.queryKey,i=t.queryHash??(0,r.F$)(o,t);let a=this.get(i);return a||(a=new s({cache:this,queryKey:o,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(o)}),this.add(a)),a}add(e){this.#m.has(e.queryHash)||(this.#m.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#m.get(e.queryHash);t&&(e.destroy(),t===e&&this.#m.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){o.j.batch((()=>{this.getAll().forEach((e=>{this.remove(e)}))}))}get(e){return this.#m.get(e)}getAll(){return[...this.#m.values()]}find(e){const t={exact:!0,...e};return this.getAll().find((e=>(0,r.MK)(t,e)))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter((t=>(0,r.MK)(e,t))):t}notify(e){o.j.batch((()=>{this.listeners.forEach((t=>{t(e)}))}))}onFocus(){o.j.batch((()=>{this.getAll().forEach((e=>{e.onFocus()}))}))}onOnline(){o.j.batch((()=>{this.getAll().forEach((e=>{e.onOnline()}))}))}},u=n(6158),h=class extends l.Q{constructor(e={}){super(),this.config=e,this.#g=[],this.#y=0}#g;#y;#v;build(e,t,n){const r=new u.s({mutationCache:this,mutationId:++this.#y,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#g.push(e),this.notify({type:"added",mutation:e})}remove(e){this.#g=this.#g.filter((t=>t!==e)),this.notify({type:"removed",mutation:e})}clear(){o.j.batch((()=>{this.#g.forEach((e=>{this.remove(e)}))}))}getAll(){return this.#g}find(e){const t={exact:!0,...e};return this.#g.find((e=>(0,r.nJ)(t,e)))}findAll(e={}){return this.#g.filter((t=>(0,r.nJ)(e,t)))}notify(e){o.j.batch((()=>{this.listeners.forEach((t=>{t(e)}))}))}resumePausedMutations(){return this.#v=(this.#v??Promise.resolve()).then((()=>{const e=this.#g.filter((e=>e.state.isPaused));return o.j.batch((()=>e.reduce(((e,t)=>e.then((()=>t.continue().catch(r.lQ)))),Promise.resolve())))})).then((()=>{this.#v=void 0})),this.#v}},f=n(9658),d=n(6035);function p(e,{pages:t,pageParams:n}){const r=t.length-1;return e.getNextPageParam(t[r],t,n[r],n)}function m(e,{pages:t,pageParams:n}){return e.getPreviousPageParam?.(t[0],t,n[0],n)}var g=class{#b;#i;#o;#x;#w;#k;#S;#O;constructor(e={}){this.#b=e.queryCache||new c,this.#i=e.mutationCache||new h,this.#o=e.defaultOptions||{},this.#x=new Map,this.#w=new Map,this.#k=0}mount(){this.#k++,1===this.#k&&(this.#S=f.m.subscribe((()=>{f.m.isFocused()&&(this.resumePausedMutations(),this.#b.onFocus())})),this.#O=d.t.subscribe((e=>{e&&(this.resumePausedMutations(),this.#b.onOnline())})))}unmount(){this.#k--,0===this.#k&&(this.#S?.(),this.#S=void 0,this.#O?.(),this.#O=void 0)}isFetching(e){return this.#b.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#i.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#b.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);return void 0!==t?Promise.resolve(t):this.fetchQuery(e)}getQueriesData(e){return this.getQueryCache().findAll(e).map((({queryKey:e,state:t})=>[e,t.data]))}setQueryData(e,t,n){const o=this.defaultQueryOptions({queryKey:e}),i=this.#b.get(o.queryHash),a=i?.state.data,s=(0,r.Zw)(t,a);if(void 0!==s)return this.#b.build(this,o).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return o.j.batch((()=>this.getQueryCache().findAll(e).map((({queryKey:e})=>[e,this.setQueryData(e,t,n)]))))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#b.get(t.queryHash)?.state}removeQueries(e){const t=this.#b;o.j.batch((()=>{t.findAll(e).forEach((e=>{t.remove(e)}))}))}resetQueries(e,t){const n=this.#b,r={type:"active",...e};return o.j.batch((()=>(n.findAll(e).forEach((e=>{e.reset()})),this.refetchQueries(r,t))))}cancelQueries(e={},t={}){const n={revert:!0,...t},i=o.j.batch((()=>this.#b.findAll(e).map((e=>e.cancel(n)))));return Promise.all(i).then(r.lQ).catch(r.lQ)}invalidateQueries(e={},t={}){return o.j.batch((()=>{if(this.#b.findAll(e).forEach((e=>{e.invalidate()})),"none"===e.refetchType)return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)}))}refetchQueries(e={},t){const n={...t,cancelRefetch:t?.cancelRefetch??!0},i=o.j.batch((()=>this.#b.findAll(e).filter((e=>!e.isDisabled())).map((e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(r.lQ)),"paused"===e.state.fetchStatus?Promise.resolve():t}))));return Promise.all(i).then(r.lQ)}fetchQuery(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const n=this.#b.build(this,t);return n.isStaleByTime(t.staleTime)?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(r.lQ).catch(r.lQ)}fetchInfiniteQuery(e){return e.behavior=(t=e.pages,{onFetch:(e,n)=>{const o=async()=>{const n=e.options,o=e.fetchOptions?.meta?.fetchMore?.direction,i=e.state.data?.pages||[],a=e.state.data?.pageParams||[],s={pages:[],pageParams:[]};let l=!1;const c=e.options.queryFn&&e.options.queryFn!==r.hT?e.options.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${e.options.queryHash}'`)),u=async(t,n,o)=>{if(l)return Promise.reject();if(null==n&&t.pages.length)return Promise.resolve(t);const i={queryKey:e.queryKey,pageParam:n,direction:o?"backward":"forward",meta:e.options.meta};var a;a=i,Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(e.signal.aborted?l=!0:e.signal.addEventListener("abort",(()=>{l=!0})),e.signal)});const s=await c(i),{maxPages:u}=e.options,h=o?r.ZZ:r.y9;return{pages:h(t.pages,s,u),pageParams:h(t.pageParams,n,u)}};let h;if(o&&i.length){const e="backward"===o,t={pages:i,pageParams:a},r=(e?m:p)(n,t);h=await u(t,r,e)}else{h=await u(s,a[0]??n.initialPageParam);const e=t??i.length;for(let t=1;t<e;t++){const e=p(n,h);h=await u(h,e)}}return h};e.options.persister?e.fetchFn=()=>e.options.persister?.(o,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n):e.fetchFn=o}}),this.fetchQuery(e);var t}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(r.lQ).catch(r.lQ)}resumePausedMutations(){return d.t.isOnline()?this.#i.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#b}getMutationCache(){return this.#i}getDefaultOptions(){return this.#o}setDefaultOptions(e){this.#o=e}setQueryDefaults(e,t){this.#x.set((0,r.EN)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#x.values()];let n={};return t.forEach((t=>{(0,r.Cp)(e,t.queryKey)&&(n={...n,...t.defaultOptions})})),n}setMutationDefaults(e,t){this.#w.set((0,r.EN)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#w.values()];let n={};return t.forEach((t=>{(0,r.Cp)(e,t.mutationKey)&&(n={...n,...t.defaultOptions})})),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#o.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,r.F$)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),!0!==t.enabled&&t.queryFn===r.hT&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#o.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#b.clear(),this.#i.clear()}}},1692:(e,t,n)=>{"use strict";n.d(t,{k:()=>o});var r=n(4880),o=class{#_;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),(0,r.gn)(this.gcTime)&&(this.#_=setTimeout((()=>{this.optionalRemove()}),this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(r.S$?1/0:3e5))}clearGcTimeout(){this.#_&&(clearTimeout(this.#_),this.#_=void 0)}}},8904:(e,t,n)=>{"use strict";n.d(t,{II:()=>u,v_:()=>s,wm:()=>c});var r=n(9658),o=n(6035),i=n(4880);function a(e){return Math.min(1e3*2**e,3e4)}function s(e){return"online"!==(e??"online")||o.t.isOnline()}var l=class{constructor(e){this.revert=e?.revert,this.silent=e?.silent}};function c(e){return e instanceof l}function u(e){let t,n,c,u=!1,h=0,f=!1;const d=new Promise(((e,t)=>{n=e,c=t})),p=()=>!r.m.isFocused()||"always"!==e.networkMode&&!o.t.isOnline(),m=r=>{f||(f=!0,e.onSuccess?.(r),t?.(),n(r))},g=n=>{f||(f=!0,e.onError?.(n),t?.(),c(n))},y=()=>new Promise((n=>{t=e=>{const t=f||!p();return t&&n(e),t},e.onPause?.()})).then((()=>{t=void 0,f||e.onContinue?.()})),v=()=>{if(f)return;let t;try{t=e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(m).catch((t=>{if(f)return;const n=e.retry??(i.S$?0:3),r=e.retryDelay??a,o="function"==typeof r?r(h,t):r,s=!0===n||"number"==typeof n&&h<n||"function"==typeof n&&n(h,t);!u&&s?(h++,e.onFail?.(h,t),(0,i.yy)(o).then((()=>{if(p())return y()})).then((()=>{u?g(t):v()}))):g(t)}))};return s(e.networkMode)?v():y().then(v),{promise:d,cancel:t=>{f||(g(new l(t)),e.abort?.())},continue:()=>{const e=t?.();return e?d:Promise.resolve()},cancelRetry:()=>{u=!0},continueRetry:()=>{u=!1}}}},6500:(e,t,n)=>{"use strict";n.d(t,{Q:()=>r});var r=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}},4880:(e,t,n)=>{"use strict";n.d(t,{Cp:()=>f,EN:()=>h,F$:()=>u,MK:()=>l,S$:()=>r,ZZ:()=>w,Zw:()=>i,f8:()=>p,gn:()=>a,hT:()=>k,j3:()=>s,lQ:()=>o,nJ:()=>c,pl:()=>b,y9:()=>x,yy:()=>v});var r="undefined"==typeof window||"Deno"in window;function o(){}function i(e,t){return"function"==typeof e?e(t):e}function a(e){return"number"==typeof e&&e>=0&&e!==1/0}function s(e,t){return Math.max(e+(t||0)-Date.now(),0)}function l(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:a,stale:s}=e;if(a)if(r){if(t.queryHash!==u(a,t.options))return!1}else if(!f(t.queryKey,a))return!1;if("all"!==n){const e=t.isActive();if("active"===n&&!e)return!1;if("inactive"===n&&e)return!1}return!("boolean"==typeof s&&t.isStale()!==s||o&&o!==t.state.fetchStatus||i&&!i(t))}function c(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(h(t.options.mutationKey)!==h(i))return!1}else if(!f(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function u(e,t){return(t?.queryKeyHashFn||h)(e)}function h(e){return JSON.stringify(e,((e,t)=>g(t)?Object.keys(t).sort().reduce(((e,n)=>(e[n]=t[n],e)),{}):t))}function f(e,t){return e===t||typeof e==typeof t&&!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&!Object.keys(t).some((n=>!f(e[n],t[n])))}function d(e,t){if(e===t)return e;const n=m(e)&&m(t);if(n||g(e)&&g(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),a=i.length,s=n?[]:{};let l=0;for(let o=0;o<a;o++){const a=n?o:i[o];!n&&void 0===e[a]&&void 0===t[a]&&r.includes(a)?(s[a]=void 0,l++):(s[a]=d(e[a],t[a]),s[a]===e[a]&&void 0!==e[a]&&l++)}return o===a&&l===o?e:s}return t}function p(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function m(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function g(e){if(!y(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!!y(n)&&!!n.hasOwnProperty("isPrototypeOf")}function y(e){return"[object Object]"===Object.prototype.toString.call(e)}function v(e){return new Promise((t=>{setTimeout(t,e)}))}function b(e,t,n){return"function"==typeof n.structuralSharing?n.structuralSharing(e,t):!1!==n.structuralSharing?d(e,t):t}function x(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function w(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var k=Symbol()},7665:(e,t,n)=>{"use strict";n.d(t,{Ht:()=>s,jE:()=>a});var r=n(1594),o=n(4848),i=r.createContext(void 0),a=e=>{const t=r.useContext(i);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},s=({client:e,children:t})=>(r.useEffect((()=>(e.mount(),()=>{e.unmount()})),[e]),(0,o.jsx)(i.Provider,{value:e,children:t}))},7097:(e,t,n)=>{"use strict";n.d(t,{n:()=>h});var r=n(1594),o=n(6158),i=n(6261),a=n(6500),s=n(4880),l=class extends a.Q{#E;#C=void 0;#A;#j;constructor(e,t){super(),this.#E=e,this.setOptions(t),this.bindMethods(),this.#P()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const t=this.options;this.options=this.#E.defaultMutationOptions(e),(0,s.f8)(this.options,t)||this.#E.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#A,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,s.EN)(t.mutationKey)!==(0,s.EN)(this.options.mutationKey)?this.reset():this.#A?.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#A?.removeObserver(this)}onMutationUpdate(e){this.#P(),this.#M(e)}getCurrentResult(){return this.#C}reset(){this.#A?.removeObserver(this),this.#A=void 0,this.#P(),this.#M()}mutate(e,t){return this.#j=t,this.#A?.removeObserver(this),this.#A=this.#E.getMutationCache().build(this.#E,this.options),this.#A.addObserver(this),this.#A.execute(e)}#P(){const e=this.#A?.state??(0,o.$)();this.#C={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#M(e){i.j.batch((()=>{if(this.#j&&this.hasListeners()){const t=this.#C.variables,n=this.#C.context;"success"===e?.type?(this.#j.onSuccess?.(e.data,t,n),this.#j.onSettled?.(e.data,null,t,n)):"error"===e?.type&&(this.#j.onError?.(e.error,t,n),this.#j.onSettled?.(void 0,e.error,t,n))}this.listeners.forEach((e=>{e(this.#C)}))}))}},c=n(7665),u=n(4362);function h(e,t){const n=(0,c.jE)(t),[o]=r.useState((()=>new l(n,e)));r.useEffect((()=>{o.setOptions(e)}),[o,e]);const a=r.useSyncExternalStore(r.useCallback((e=>o.subscribe(i.j.batchCalls(e))),[o]),(()=>o.getCurrentResult()),(()=>o.getCurrentResult())),s=r.useCallback(((e,t)=>{o.mutate(e,t).catch(u.l)}),[o]);if(a.error&&(0,u.G)(o.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:s,mutateAsync:a.mutate}}},9270:(e,t,n)=>{"use strict";n.d(t,{I:()=>E});var r=n(4880),o=n(6261),i=n(9658),a=n(6500),s=n(8904),l=class extends a.Q{constructor(e,t){super(),this.options=t,this.#E=e,this.#R=null,this.bindMethods(),this.setOptions(t)}#E;#T=void 0;#L=void 0;#C=void 0;#I;#N;#R;#z;#D;#F;#B;#$;#H;#W=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#T.addObserver(this),c(this.#T,this.options)?this.#q():this.updateResult(),this.#V())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return u(this.#T,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return u(this.#T,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#U(),this.#K(),this.#T.removeObserver(this)}setOptions(e,t){const n=this.options,o=this.#T;if(this.options=this.#E.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled)throw new Error("Expected enabled to be a boolean");this.#Q(),(0,r.f8)(this.options,n)||this.#E.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#T,observer:this});const i=this.hasListeners();i&&h(this.#T,o,this.options,n)&&this.#q(),this.updateResult(t),!i||this.#T===o&&this.options.enabled===n.enabled&&this.options.staleTime===n.staleTime||this.#G();const a=this.#Y();!i||this.#T===o&&this.options.enabled===n.enabled&&a===this.#H||this.#Z(a)}getOptimisticResult(e){const t=this.#E.getQueryCache().build(this.#E,e),n=this.createResult(t,e);return o=this,i=n,!(0,r.f8)(o.getCurrentResult(),i)&&(this.#C=n,this.#N=this.options,this.#I=this.#T.state),n;var o,i}getCurrentResult(){return this.#C}trackResult(e,t){const n={};return Object.keys(e).forEach((r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(r),t?.(r),e[r])})})),n}trackProp(e){this.#W.add(e)}getCurrentQuery(){return this.#T}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#E.defaultQueryOptions(e),n=this.#E.getQueryCache().build(this.#E,t);return n.isFetchingOptimistic=!0,n.fetch().then((()=>this.createResult(n,t)))}fetch(e){return this.#q({...e,cancelRefetch:e.cancelRefetch??!0}).then((()=>(this.updateResult(),this.#C)))}#q(e){this.#Q();let t=this.#T.fetch(this.options,e);return e?.throwOnError||(t=t.catch(r.lQ)),t}#G(){if(this.#U(),r.S$||this.#C.isStale||!(0,r.gn)(this.options.staleTime))return;const e=(0,r.j3)(this.#C.dataUpdatedAt,this.options.staleTime)+1;this.#B=setTimeout((()=>{this.#C.isStale||this.updateResult()}),e)}#Y(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#T):this.options.refetchInterval)??!1}#Z(e){this.#K(),this.#H=e,!r.S$&&!1!==this.options.enabled&&(0,r.gn)(this.#H)&&0!==this.#H&&(this.#$=setInterval((()=>{(this.options.refetchIntervalInBackground||i.m.isFocused())&&this.#q()}),this.#H))}#V(){this.#G(),this.#Z(this.#Y())}#U(){this.#B&&(clearTimeout(this.#B),this.#B=void 0)}#K(){this.#$&&(clearInterval(this.#$),this.#$=void 0)}createResult(e,t){const n=this.#T,o=this.options,i=this.#C,a=this.#I,l=this.#N,u=e!==n?e.state:this.#L,{state:d}=e;let p,{error:m,errorUpdatedAt:g,fetchStatus:y,status:v}=d,b=!1;if(t._optimisticResults){const r=this.hasListeners(),i=!r&&c(e,t),a=r&&h(e,n,t,o);(i||a)&&(y=(0,s.v_)(e.options.networkMode)?"fetching":"paused",void 0===d.data&&(v="pending")),"isRestoring"===t._optimisticResults&&(y="idle")}if(t.select&&void 0!==d.data)if(i&&d.data===a?.data&&t.select===this.#z)p=this.#D;else try{this.#z=t.select,p=t.select(d.data),p=(0,r.pl)(i?.data,p,t),this.#D=p,this.#R=null}catch(e){this.#R=e}else p=d.data;if(void 0!==t.placeholderData&&void 0===p&&"pending"===v){let e;if(i?.isPlaceholderData&&t.placeholderData===l?.placeholderData)e=i.data;else if(e="function"==typeof t.placeholderData?t.placeholderData(this.#F?.state.data,this.#F):t.placeholderData,t.select&&void 0!==e)try{e=t.select(e),this.#R=null}catch(e){this.#R=e}void 0!==e&&(v="success",p=(0,r.pl)(i?.data,e,t),b=!0)}this.#R&&(m=this.#R,p=this.#D,g=Date.now(),v="error");const x="fetching"===y,w="pending"===v,k="error"===v,S=w&&x,O=void 0!==d.data;return{status:v,fetchStatus:y,isPending:w,isSuccess:"success"===v,isError:k,isInitialLoading:S,isLoading:S,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>u.dataUpdateCount||d.errorUpdateCount>u.errorUpdateCount,isFetching:x,isRefetching:x&&!w,isLoadingError:k&&!O,isPaused:"paused"===y,isPlaceholderData:b,isRefetchError:k&&O,isStale:f(e,t),refetch:this.refetch}}updateResult(e){const t=this.#C,n=this.createResult(this.#T,this.options);if(this.#I=this.#T.state,this.#N=this.options,void 0!==this.#I.data&&(this.#F=this.#T),(0,r.f8)(n,t))return;this.#C=n;const o={};!1!==e?.listeners&&(()=>{if(!t)return!0;const{notifyOnChangeProps:e}=this.options,n="function"==typeof e?e():e;if("all"===n||!n&&!this.#W.size)return!0;const r=new Set(n??this.#W);return this.options.throwOnError&&r.add("error"),Object.keys(this.#C).some((e=>{const n=e;return this.#C[n]!==t[n]&&r.has(n)}))})()&&(o.listeners=!0),this.#M({...o,...e})}#Q(){const e=this.#E.getQueryCache().build(this.#E,this.options);if(e===this.#T)return;const t=this.#T;this.#T=e,this.#L=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#V()}#M(e){o.j.batch((()=>{e.listeners&&this.listeners.forEach((e=>{e(this.#C)})),this.#E.getQueryCache().notify({query:this.#T,type:"observerResultsUpdated"})}))}};function c(e,t){return function(e,t){return!1!==t.enabled&&void 0===e.state.data&&!("error"===e.state.status&&!1===t.retryOnMount)}(e,t)||void 0!==e.state.data&&u(e,t,t.refetchOnMount)}function u(e,t,n){if(!1!==t.enabled){const r="function"==typeof n?n(e):n;return"always"===r||!1!==r&&f(e,t)}return!1}function h(e,t,n,r){return!1!==n.enabled&&(e!==t||!1===r.enabled)&&(!n.suspense||"error"!==e.state.status)&&f(e,n)}function f(e,t){return e.isStaleByTime(t.staleTime)}var d=n(1594);n(4848);var p=d.createContext(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),m=()=>d.useContext(p),g=n(7665),y=d.createContext(!1),v=()=>d.useContext(y),b=(y.Provider,n(4362)),x=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},w=e=>{d.useEffect((()=>{e.clearReset()}),[e])},k=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(0,b.G)(n,[e.error,r]),S=e=>{e.suspense&&"number"!=typeof e.staleTime&&(e.staleTime=1e3)},O=(e,t)=>e?.suspense&&t.isPending,_=(e,t,n)=>t.fetchOptimistic(e).catch((()=>{n.clearReset()}));function E(e,t){return function(e,t,n){const r=(0,g.jE)(n),i=v(),a=m(),s=r.defaultQueryOptions(e);s._optimisticResults=i?"isRestoring":"optimistic",S(s),x(s,a),w(a);const[l]=d.useState((()=>new t(r,s))),c=l.getOptimisticResult(s);if(d.useSyncExternalStore(d.useCallback((e=>{const t=i?()=>{}:l.subscribe(o.j.batchCalls(e));return l.updateResult(),t}),[l,i]),(()=>l.getCurrentResult()),(()=>l.getCurrentResult())),d.useEffect((()=>{l.setOptions(s,{listeners:!1})}),[s,l]),O(s,c))throw _(s,l,a);if(k({result:c,errorResetBoundary:a,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash)}))throw c.error;return s.notifyOnChangeProps?c:l.trackResult(c)}(e,l,t)}},4362:(e,t,n)=>{"use strict";function r(e,t){return"function"==typeof e?e(...t):!!e}function o(){}n.d(t,{G:()=>r,l:()=>o})},421:(e,t,n)=>{"use strict";n.d(t,{p2:()=>cn});var r=n(4848),o=n(85),i=n(1594),a=(n(1919),n(4146),n(2142),n(1287),r.Fragment);function s(e,t,n){return o.h.call(t,"css")?r.jsx(o.E,(0,o.c)(e,t),n):r.jsx(e,t,n)}function l(e,t,n){return o.h.call(t,"css")?r.jsxs(o.E,(0,o.c)(e,t),n):r.jsxs(e,t,n)}var c=n(8168),u=n(8587);function h(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=h(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}const f=function(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=h(e))&&(r&&(r+=" "),r+=t);return r};var d=n(2532),p=n(3571),m=n(9599),g=n(8749);const y=function(e=null){const t=i.useContext(o.T);return t&&(n=t,0!==Object.keys(n).length)?t:e;var n},v=(0,g.A)(),b=function(e=v){return y(e)},x=["className","component"],w=e=>e,k=(()=>{let e=w;return{configure(t){e=t},generate:t=>e(t),reset(){e=w}}})();var S=n(5697),O=n(4521),_=n(4188),E=n(771);const C={black:"#000",white:"#fff"},A={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},j={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f9",A700:"#aa00ff"},P={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"},M={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"},R={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"},T={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"},L={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"},I=["mode","contrastThreshold","tonalOffset"],N={text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:C.white,default:C.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}},z={text:{primary:C.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:C.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}};function D(e,t,n,r){const o=r.light||r,i=r.dark||1.5*r;e[t]||(e.hasOwnProperty(n)?e[t]=e[n]:"light"===t?e.light=(0,E.a)(e.main,o):"dark"===t&&(e.dark=(0,E.e$)(e.main,i)))}const F=["fontFamily","fontSize","fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","htmlFontSize","allVariants","pxToRem"],B={textTransform:"uppercase"},$='"Roboto", "Helvetica", "Arial", sans-serif';function H(e,t){const n="function"==typeof t?t(e):t,{fontFamily:r=$,fontSize:o=14,fontWeightLight:i=300,fontWeightRegular:a=400,fontWeightMedium:s=500,fontWeightBold:l=700,htmlFontSize:h=16,allVariants:f,pxToRem:d}=n,p=(0,u.A)(n,F),m=o/14,g=d||(e=>e/h*m+"rem"),y=(e,t,n,o,i)=>{return(0,c.A)({fontFamily:r,fontWeight:e,fontSize:g(t),lineHeight:n},r===$?{letterSpacing:(a=o/t,Math.round(1e5*a)/1e5+"em")}:{},i,f);var a},v={h1:y(i,96,1.167,-1.5),h2:y(i,60,1.2,-.5),h3:y(a,48,1.167,0),h4:y(a,34,1.235,.25),h5:y(a,24,1.334,0),h6:y(s,20,1.6,.15),subtitle1:y(a,16,1.75,.15),subtitle2:y(s,14,1.57,.1),body1:y(a,16,1.5,.15),body2:y(a,14,1.43,.15),button:y(s,14,1.75,.4,B),caption:y(a,12,1.66,.4),overline:y(a,12,2.66,1,B),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return(0,O.A)((0,c.A)({htmlFontSize:h,pxToRem:g,fontFamily:r,fontSize:o,fontWeightLight:i,fontWeightRegular:a,fontWeightMedium:s,fontWeightBold:l},v),p,{clone:!1})}function W(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,0.2)`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,0.14)`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,0.12)`].join(",")}const q=["none",W(0,2,1,-1,0,1,1,0,0,1,3,0),W(0,3,1,-2,0,2,2,0,0,1,5,0),W(0,3,3,-2,0,3,4,0,0,1,8,0),W(0,2,4,-1,0,4,5,0,0,1,10,0),W(0,3,5,-1,0,5,8,0,0,1,14,0),W(0,3,5,-1,0,6,10,0,0,1,18,0),W(0,4,5,-2,0,7,10,1,0,2,16,1),W(0,5,5,-3,0,8,10,1,0,3,14,2),W(0,5,6,-3,0,9,12,1,0,3,16,2),W(0,6,6,-3,0,10,14,1,0,4,18,3),W(0,6,7,-4,0,11,15,1,0,4,20,3),W(0,7,8,-4,0,12,17,2,0,5,22,4),W(0,7,8,-4,0,13,19,2,0,5,24,4),W(0,7,9,-4,0,14,21,2,0,5,26,4),W(0,8,9,-5,0,15,22,2,0,6,28,5),W(0,8,10,-5,0,16,24,2,0,6,30,5),W(0,8,11,-5,0,17,26,2,0,6,32,5),W(0,9,11,-5,0,18,28,2,0,7,34,6),W(0,9,12,-6,0,19,29,2,0,7,36,6),W(0,10,13,-6,0,20,31,3,0,8,38,7),W(0,10,13,-6,0,21,33,3,0,8,40,7),W(0,10,14,-6,0,22,35,3,0,8,42,7),W(0,11,14,-7,0,23,36,3,0,9,44,8),W(0,11,15,-7,0,24,38,3,0,9,46,8)],V=["duration","easing","delay"],U={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},K={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function Q(e){return`${Math.round(e)}ms`}function G(e){if(!e)return 0;const t=e/36;return Math.round(10*(4+15*t**.25+t/5))}function Y(e){const t=(0,c.A)({},U,e.easing),n=(0,c.A)({},K,e.duration);return(0,c.A)({getAutoHeightDuration:G,create:(e=["all"],r={})=>{const{duration:o=n.standard,easing:i=t.easeInOut,delay:a=0}=r;return(0,u.A)(r,V),(Array.isArray(e)?e:[e]).map((e=>`${e} ${"string"==typeof o?o:Q(o)} ${i} ${"string"==typeof a?a:Q(a)}`)).join(",")}},e,{easing:t,duration:n})}const Z={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500},X=["breakpoints","mixins","spacing","palette","transitions","typography","shape"];const J=function(e={},...t){const{mixins:n={},palette:r={},transitions:o={},typography:i={}}=e,a=(0,u.A)(e,X);if(e.vars)throw new Error((0,S.A)(18));const s=function(e){const{mode:t="light",contrastThreshold:n=3,tonalOffset:r=.2}=e,o=(0,u.A)(e,I),i=e.primary||function(e="light"){return"dark"===e?{main:R[200],light:R[50],dark:R[400]}:{main:R[700],light:R[400],dark:R[800]}}(t),a=e.secondary||function(e="light"){return"dark"===e?{main:j[200],light:j[50],dark:j[400]}:{main:j[500],light:j[300],dark:j[700]}}(t),s=e.error||function(e="light"){return"dark"===e?{main:P[500],light:P[300],dark:P[700]}:{main:P[700],light:P[400],dark:P[800]}}(t),l=e.info||function(e="light"){return"dark"===e?{main:T[400],light:T[300],dark:T[700]}:{main:T[700],light:T[500],dark:T[900]}}(t),h=e.success||function(e="light"){return"dark"===e?{main:L[400],light:L[300],dark:L[700]}:{main:L[800],light:L[500],dark:L[900]}}(t),f=e.warning||function(e="light"){return"dark"===e?{main:M[400],light:M[300],dark:M[700]}:{main:"#ed6c02",light:M[500],dark:M[900]}}(t);function d(e){return(0,E.eM)(e,z.text.primary)>=n?z.text.primary:N.text.primary}const p=({color:e,name:t,mainShade:n=500,lightShade:o=300,darkShade:i=700})=>{if(!(e=(0,c.A)({},e)).main&&e[n]&&(e.main=e[n]),!e.hasOwnProperty("main"))throw new Error((0,S.A)(11,t?` (${t})`:"",n));if("string"!=typeof e.main)throw new Error((0,S.A)(12,t?` (${t})`:"",JSON.stringify(e.main)));return D(e,"light",o,r),D(e,"dark",i,r),e.contrastText||(e.contrastText=d(e.main)),e},m={dark:z,light:N};return(0,O.A)((0,c.A)({common:(0,c.A)({},C),mode:t,primary:p({color:i,name:"primary"}),secondary:p({color:a,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:p({color:s,name:"error"}),warning:p({color:f,name:"warning"}),info:p({color:l,name:"info"}),success:p({color:h,name:"success"}),grey:A,contrastThreshold:n,getContrastText:d,augmentColor:p,tonalOffset:r},m[t]),o)}(r),l=(0,g.A)(e);let h=(0,O.A)(l,{mixins:(f=l.breakpoints,d=n,(0,c.A)({toolbar:{minHeight:56,[f.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[f.up("sm")]:{minHeight:64}}},d)),palette:s,shadows:q.slice(),typography:H(s,i),transitions:Y(o),zIndex:(0,c.A)({},Z)});var f,d;return h=(0,O.A)(h,a),h=t.reduce(((e,t)=>(0,O.A)(e,t)),h),h.unstable_sxConfig=(0,c.A)({},_.A,null==a?void 0:a.unstable_sxConfig),h.unstable_sx=function(e){return(0,p.A)({sx:e,theme:this})},h},ee="$$material",te={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function ne(e,t,n="Mui"){const r=te[t];return r?`${n}-${r}`:`${k.generate(e)}-${t}`}function re(e,t,n="Mui"){const r={};return t.forEach((t=>{r[t]=ne(e,t,n)})),r}const oe=re("MuiBox",["root"]),ie=J(),ae=function(e={}){const{themeId:t,defaultTheme:n,defaultClassName:o="MuiBox-root",generateClassName:a}=e,s=(0,d.default)("div",{shouldForwardProp:e=>"theme"!==e&&"sx"!==e&&"as"!==e})(p.A);return i.forwardRef((function(e,i){const l=b(n),h=(0,m.A)(e),{className:d,component:p="div"}=h,g=(0,u.A)(h,x);return(0,r.jsx)(s,(0,c.A)({as:p,ref:i,className:f(d,a?a(o):o),theme:t&&l[t]||l},g))}))}({themeId:ee,defaultTheme:ie,defaultClassName:oe.root,generateClassName:k.generate}),se=ae;function le(...e){return i.useMemo((()=>e.every((e=>null==e))?null:t=>{e.forEach((e=>{!function(e,t){"function"==typeof e?e(t):e&&(e.current=t)}(e,t)}))}),e)}function ce(e){const t=function(e){return e&&e.ownerDocument||document}(e);return t.defaultView||window}const ue="undefined"!=typeof window?i.useLayoutEffect:i.useEffect,he=["onChange","maxRows","minRows","style","value"];function fe(e){return parseInt(e,10)||0}const de={visibility:"hidden",position:"absolute",overflow:"hidden",height:0,top:0,left:0,transform:"translateZ(0)"},pe=i.forwardRef((function(e,t){const{onChange:n,maxRows:o,minRows:a=1,style:s,value:l}=e,h=(0,u.A)(e,he),{current:f}=i.useRef(null!=l),d=i.useRef(null),p=le(t,d),m=i.useRef(null),g=i.useCallback((()=>{const t=d.current,n=ce(t).getComputedStyle(t);if("0px"===n.width)return{outerHeightStyle:0,overflowing:!1};const r=m.current;r.style.width=n.width,r.value=t.value||e.placeholder||"x","\n"===r.value.slice(-1)&&(r.value+=" ");const i=n.boxSizing,s=fe(n.paddingBottom)+fe(n.paddingTop),l=fe(n.borderBottomWidth)+fe(n.borderTopWidth),c=r.scrollHeight;r.value="x";const u=r.scrollHeight;let h=c;return a&&(h=Math.max(Number(a)*u,h)),o&&(h=Math.min(Number(o)*u,h)),h=Math.max(h,u),{outerHeightStyle:h+("border-box"===i?s+l:0),overflowing:Math.abs(h-c)<=1}}),[o,a,e.placeholder]),y=i.useCallback((()=>{const e=g();if(null==(t=e)||0===Object.keys(t).length||0===t.outerHeightStyle&&!t.overflowing)return;var t;const n=d.current;n.style.height=`${e.outerHeightStyle}px`,n.style.overflow=e.overflowing?"hidden":""}),[g]);return ue((()=>{const e=()=>{y()};const t=function(e,t=166){let n;function r(...r){clearTimeout(n),n=setTimeout((()=>{e.apply(this,r)}),t)}return r.clear=()=>{clearTimeout(n)},r}(e),n=d.current,r=ce(n);let o;return r.addEventListener("resize",t),"undefined"!=typeof ResizeObserver&&(o=new ResizeObserver(e),o.observe(n)),()=>{t.clear(),cancelAnimationFrame(undefined),r.removeEventListener("resize",t),o&&o.disconnect()}}),[g,y]),ue((()=>{y()})),(0,r.jsxs)(i.Fragment,{children:[(0,r.jsx)("textarea",(0,c.A)({value:l,onChange:e=>{f||y(),n&&n(e)},ref:p,rows:a},h)),(0,r.jsx)("textarea",{"aria-hidden":!0,className:e.className,readOnly:!0,ref:m,tabIndex:-1,style:(0,c.A)({},de,s,{paddingTop:0,paddingBottom:0})})]})}));function me(e){return"string"==typeof e}function ge(e,t,n=void 0){const r={};return Object.keys(e).forEach((o=>{r[o]=e[o].reduce(((e,r)=>{if(r){const o=t(r);""!==o&&e.push(o),n&&n[r]&&e.push(n[r])}return e}),[]).join(" ")})),r}const ye=i.createContext(void 0);var ve=n(6461);const be=J(),xe=(0,ve.Ay)({themeId:ee,defaultTheme:be,rootShouldForwardProp:e=>(0,ve.MC)(e)&&"classes"!==e});function we(e,t){const n=(0,c.A)({},t);return Object.keys(e).forEach((r=>{if(r.toString().match(/^(components|slots)$/))n[r]=(0,c.A)({},e[r],n[r]);else if(r.toString().match(/^(componentsProps|slotProps)$/)){const o=e[r]||{},i=t[r];n[r]={},i&&Object.keys(i)?o&&Object.keys(o)?(n[r]=(0,c.A)({},i),Object.keys(o).forEach((e=>{n[r][e]=we(o[e],i[e])}))):n[r]=i:n[r]=o}else void 0===n[r]&&(n[r]=e[r])})),n}function ke(e){const{theme:t,name:n,props:r}=e;return t&&t.components&&t.components[n]&&t.components[n].defaultProps?we(t.components[n].defaultProps,r):r}function Se({props:e,name:t}){return function({props:e,name:t,defaultTheme:n,themeId:r}){let o=b(n);return r&&(o=o[r]||o),ke({theme:o,name:t,props:e})}({props:e,name:t,defaultTheme:be,themeId:ee})}const Oe=n(8659).A,_e=le,Ee=ue;var Ce=n(9940);const Ae=function({styles:e,themeId:t,defaultTheme:n={}}){const o=b(n),i="function"==typeof e?e(t&&o[t]||o):e;return(0,r.jsx)(Ce.A,{styles:i})},je=function(e){return(0,r.jsx)(Ae,(0,c.A)({},e,{defaultTheme:be,themeId:ee}))};function Pe(e){return null!=e&&!(Array.isArray(e)&&0===e.length)}function Me(e){return ne("MuiInputBase",e)}const Re=re("MuiInputBase",["root","formControl","focused","disabled","adornedStart","adornedEnd","error","sizeSmall","multiline","colorSecondary","fullWidth","hiddenLabel","readOnly","input","inputSizeSmall","inputMultiline","inputTypeSearch","inputAdornedStart","inputAdornedEnd","inputHiddenLabel"]),Te=["aria-describedby","autoComplete","autoFocus","className","color","components","componentsProps","defaultValue","disabled","disableInjectingGlobalStyles","endAdornment","error","fullWidth","id","inputComponent","inputProps","inputRef","margin","maxRows","minRows","multiline","name","onBlur","onChange","onClick","onFocus","onKeyDown","onKeyUp","placeholder","readOnly","renderSuffix","rows","size","slotProps","slots","startAdornment","type","value"],Le=xe("div",{name:"MuiInputBase",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.formControl&&t.formControl,n.startAdornment&&t.adornedStart,n.endAdornment&&t.adornedEnd,n.error&&t.error,"small"===n.size&&t.sizeSmall,n.multiline&&t.multiline,n.color&&t[`color${Oe(n.color)}`],n.fullWidth&&t.fullWidth,n.hiddenLabel&&t.hiddenLabel]}})((({theme:e,ownerState:t})=>(0,c.A)({},e.typography.body1,{color:(e.vars||e).palette.text.primary,lineHeight:"1.4375em",boxSizing:"border-box",position:"relative",cursor:"text",display:"inline-flex",alignItems:"center",[`&.${Re.disabled}`]:{color:(e.vars||e).palette.text.disabled,cursor:"default"}},t.multiline&&(0,c.A)({padding:"4px 0 5px"},"small"===t.size&&{paddingTop:1}),t.fullWidth&&{width:"100%"}))),Ie=xe("input",{name:"MuiInputBase",slot:"Input",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.input,"small"===n.size&&t.inputSizeSmall,n.multiline&&t.inputMultiline,"search"===n.type&&t.inputTypeSearch,n.startAdornment&&t.inputAdornedStart,n.endAdornment&&t.inputAdornedEnd,n.hiddenLabel&&t.inputHiddenLabel]}})((({theme:e,ownerState:t})=>{const n="light"===e.palette.mode,r=(0,c.A)({color:"currentColor"},e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:n?.42:.5},{transition:e.transitions.create("opacity",{duration:e.transitions.duration.shorter})}),o={opacity:"0 !important"},i=e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:n?.42:.5};return(0,c.A)({font:"inherit",letterSpacing:"inherit",color:"currentColor",padding:"4px 0 5px",border:0,boxSizing:"content-box",background:"none",height:"1.4375em",margin:0,WebkitTapHighlightColor:"transparent",display:"block",minWidth:0,width:"100%",animationName:"mui-auto-fill-cancel",animationDuration:"10ms","&::-webkit-input-placeholder":r,"&::-moz-placeholder":r,"&:-ms-input-placeholder":r,"&::-ms-input-placeholder":r,"&:focus":{outline:0},"&:invalid":{boxShadow:"none"},"&::-webkit-search-decoration":{WebkitAppearance:"none"},[`label[data-shrink=false] + .${Re.formControl} &`]:{"&::-webkit-input-placeholder":o,"&::-moz-placeholder":o,"&:-ms-input-placeholder":o,"&::-ms-input-placeholder":o,"&:focus::-webkit-input-placeholder":i,"&:focus::-moz-placeholder":i,"&:focus:-ms-input-placeholder":i,"&:focus::-ms-input-placeholder":i},[`&.${Re.disabled}`]:{opacity:1,WebkitTextFillColor:(e.vars||e).palette.text.disabled},"&:-webkit-autofill":{animationDuration:"5000s",animationName:"mui-auto-fill"}},"small"===t.size&&{paddingTop:1},t.multiline&&{height:"auto",resize:"none",padding:0,paddingTop:0},"search"===t.type&&{MozAppearance:"textfield"})})),Ne=(0,r.jsx)(je,{styles:{"@keyframes mui-auto-fill":{from:{display:"block"}},"@keyframes mui-auto-fill-cancel":{from:{display:"block"}}}}),ze=i.forwardRef((function(e,t){var n;const o=Se({props:e,name:"MuiInputBase"}),{"aria-describedby":a,autoComplete:s,autoFocus:l,className:h,components:d={},componentsProps:p={},defaultValue:m,disabled:g,disableInjectingGlobalStyles:y,endAdornment:v,fullWidth:b=!1,id:x,inputComponent:w="input",inputProps:k={},inputRef:O,maxRows:_,minRows:E,multiline:C=!1,name:A,onBlur:j,onChange:P,onClick:M,onFocus:R,onKeyDown:T,onKeyUp:L,placeholder:I,readOnly:N,renderSuffix:z,rows:D,slotProps:F={},slots:B={},startAdornment:$,type:H="text",value:W}=o,q=(0,u.A)(o,Te),V=null!=k.value?k.value:W,{current:U}=i.useRef(null!=V),K=i.useRef(),Q=i.useCallback((e=>{}),[]),G=_e(K,O,k.ref,Q),[Y,Z]=i.useState(!1),X=i.useContext(ye),J=function({props:e,states:t,muiFormControl:n}){return t.reduce(((t,r)=>(t[r]=e[r],n&&void 0===e[r]&&(t[r]=n[r]),t)),{})}({props:o,muiFormControl:X,states:["color","disabled","error","hiddenLabel","size","required","filled"]});J.focused=X?X.focused:Y,i.useEffect((()=>{!X&&g&&Y&&(Z(!1),j&&j())}),[X,g,Y,j]);const ee=X&&X.onFilled,te=X&&X.onEmpty,ne=i.useCallback((e=>{!function(e,t=!1){return e&&(Pe(e.value)&&""!==e.value||t&&Pe(e.defaultValue)&&""!==e.defaultValue)}(e)?te&&te():ee&&ee()}),[ee,te]);Ee((()=>{U&&ne({value:V})}),[V,ne,U]),i.useEffect((()=>{ne(K.current)}),[]);let re=w,oe=k;C&&"input"===re&&(oe=D?(0,c.A)({type:void 0,minRows:D,maxRows:D},oe):(0,c.A)({type:void 0,maxRows:_,minRows:E},oe),re=pe),i.useEffect((()=>{X&&X.setAdornedStart(Boolean($))}),[X,$]);const ie=(0,c.A)({},o,{color:J.color||"primary",disabled:J.disabled,endAdornment:v,error:J.error,focused:J.focused,formControl:X,fullWidth:b,hiddenLabel:J.hiddenLabel,multiline:C,size:J.size,startAdornment:$,type:H}),ae=(e=>{const{classes:t,color:n,disabled:r,error:o,endAdornment:i,focused:a,formControl:s,fullWidth:l,hiddenLabel:c,multiline:u,readOnly:h,size:f,startAdornment:d,type:p}=e;return ge({root:["root",`color${Oe(n)}`,r&&"disabled",o&&"error",l&&"fullWidth",a&&"focused",s&&"formControl",f&&"medium"!==f&&`size${Oe(f)}`,u&&"multiline",d&&"adornedStart",i&&"adornedEnd",c&&"hiddenLabel",h&&"readOnly"],input:["input",r&&"disabled","search"===p&&"inputTypeSearch",u&&"inputMultiline","small"===f&&"inputSizeSmall",c&&"inputHiddenLabel",d&&"inputAdornedStart",i&&"inputAdornedEnd",h&&"readOnly"]},Me,t)})(ie),se=B.root||d.Root||Le,le=F.root||p.root||{},ce=B.input||d.Input||Ie;return oe=(0,c.A)({},oe,null!=(n=F.input)?n:p.input),(0,r.jsxs)(i.Fragment,{children:[!y&&Ne,(0,r.jsxs)(se,(0,c.A)({},le,!me(se)&&{ownerState:(0,c.A)({},ie,le.ownerState)},{ref:t,onClick:e=>{K.current&&e.currentTarget===e.target&&K.current.focus(),M&&M(e)}},q,{className:f(ae.root,le.className,h,N&&"MuiInputBase-readOnly"),children:[$,(0,r.jsx)(ye.Provider,{value:null,children:(0,r.jsx)(ce,(0,c.A)({ownerState:ie,"aria-invalid":J.error,"aria-describedby":a,autoComplete:s,autoFocus:l,defaultValue:m,disabled:J.disabled,id:x,onAnimationStart:e=>{ne("mui-auto-fill-cancel"===e.animationName?K.current:{value:"x"})},name:A,placeholder:I,readOnly:N,required:J.required,rows:D,value:V,onKeyDown:T,onKeyUp:L,type:H},oe,!me(ce)&&{as:re,ownerState:(0,c.A)({},ie,oe.ownerState)},{ref:G,className:f(ae.input,oe.className,N&&"MuiInputBase-readOnly"),onBlur:e=>{j&&j(e),k.onBlur&&k.onBlur(e),X&&X.onBlur?X.onBlur(e):Z(!1)},onChange:(e,...t)=>{if(!U){const t=e.target||K.current;if(null==t)throw new Error((0,S.A)(1));ne({value:t.value})}k.onChange&&k.onChange(e,...t),P&&P(e,...t)},onFocus:e=>{J.disabled?e.stopPropagation():(R&&R(e),k.onFocus&&k.onFocus(e),X&&X.onFocus?X.onFocus(e):Z(!0))}}))}),v,z?z((0,c.A)({},J,{startAdornment:$})):null]}))]})}));function De(e){const{children:t,defer:n=!1,fallback:o=null}=e,[a,s]=i.useState(!1);return ue((()=>{n||s(!0)}),[n]),i.useEffect((()=>{n&&s(!0)}),[n]),(0,r.jsx)(i.Fragment,{children:a?t:o})}function Fe(e){return ne("MuiSvgIcon",e)}re("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Be=["children","className","color","component","fontSize","htmlColor","inheritViewBox","titleAccess","viewBox"],$e=xe("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,"inherit"!==n.color&&t[`color${Oe(n.color)}`],t[`fontSize${Oe(n.fontSize)}`]]}})((({theme:e,ownerState:t})=>{var n,r,o,i,a,s,l,c,u,h,f,d,p;return{userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:t.hasSvgAsChild?void 0:"currentColor",flexShrink:0,transition:null==(n=e.transitions)||null==(r=n.create)?void 0:r.call(n,"fill",{duration:null==(o=e.transitions)||null==(o=o.duration)?void 0:o.shorter}),fontSize:{inherit:"inherit",small:(null==(i=e.typography)||null==(a=i.pxToRem)?void 0:a.call(i,20))||"1.25rem",medium:(null==(s=e.typography)||null==(l=s.pxToRem)?void 0:l.call(s,24))||"1.5rem",large:(null==(c=e.typography)||null==(u=c.pxToRem)?void 0:u.call(c,35))||"2.1875rem"}[t.fontSize],color:null!=(h=null==(f=(e.vars||e).palette)||null==(f=f[t.color])?void 0:f.main)?h:{action:null==(d=(e.vars||e).palette)||null==(d=d.action)?void 0:d.active,disabled:null==(p=(e.vars||e).palette)||null==(p=p.action)?void 0:p.disabled,inherit:void 0}[t.color]}})),He=i.forwardRef((function(e,t){const n=Se({props:e,name:"MuiSvgIcon"}),{children:o,className:a,color:s="inherit",component:l="svg",fontSize:h="medium",htmlColor:d,inheritViewBox:p=!1,titleAccess:m,viewBox:g="0 0 24 24"}=n,y=(0,u.A)(n,Be),v=i.isValidElement(o)&&"svg"===o.type,b=(0,c.A)({},n,{color:s,component:l,fontSize:h,instanceFontSize:e.fontSize,inheritViewBox:p,viewBox:g,hasSvgAsChild:v}),x={};p||(x.viewBox=g);const w=(e=>{const{color:t,fontSize:n,classes:r}=e;return ge({root:["root","inherit"!==t&&`color${Oe(t)}`,`fontSize${Oe(n)}`]},Fe,r)})(b);return(0,r.jsxs)($e,(0,c.A)({as:l,className:f(w.root,a),focusable:"false",color:d,"aria-hidden":!m||void 0,role:m?"img":void 0,ref:t},x,y,v&&o.props,{ownerState:b,children:[v?o.props.children:o,m?(0,r.jsx)("title",{children:m}):null]}))}));He.muiName="SvgIcon";const We=He,qe=e=>{let t;return t=e<1?5.11916*e**2:4.5*Math.log(e+1)+2,(t/100).toFixed(2)};function Ve(e){return ne("MuiPaper",e)}re("MuiPaper",["root","rounded","outlined","elevation","elevation0","elevation1","elevation2","elevation3","elevation4","elevation5","elevation6","elevation7","elevation8","elevation9","elevation10","elevation11","elevation12","elevation13","elevation14","elevation15","elevation16","elevation17","elevation18","elevation19","elevation20","elevation21","elevation22","elevation23","elevation24"]);const Ue=["className","component","elevation","square","variant"],Ke=xe("div",{name:"MuiPaper",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],!n.square&&t.rounded,"elevation"===n.variant&&t[`elevation${n.elevation}`]]}})((({theme:e,ownerState:t})=>{var n;return(0,c.A)({backgroundColor:(e.vars||e).palette.background.paper,color:(e.vars||e).palette.text.primary,transition:e.transitions.create("box-shadow")},!t.square&&{borderRadius:e.shape.borderRadius},"outlined"===t.variant&&{border:`1px solid ${(e.vars||e).palette.divider}`},"elevation"===t.variant&&(0,c.A)({boxShadow:(e.vars||e).shadows[t.elevation]},!e.vars&&"dark"===e.palette.mode&&{backgroundImage:`linear-gradient(${(0,E.X4)("#fff",qe(t.elevation))}, ${(0,E.X4)("#fff",qe(t.elevation))})`},e.vars&&{backgroundImage:null==(n=e.vars.overlays)?void 0:n[t.elevation]}))})),Qe=i.forwardRef((function(e,t){const n=Se({props:e,name:"MuiPaper"}),{className:o,component:i="div",elevation:a=1,square:s=!1,variant:l="elevation"}=n,h=(0,u.A)(n,Ue),d=(0,c.A)({},n,{component:i,elevation:a,square:s,variant:l}),p=(e=>{const{square:t,elevation:n,variant:r,classes:o}=e;return ge({root:["root",r,!t&&"rounded","elevation"===r&&`elevation${n}`]},Ve,o)})(d);return(0,r.jsx)(Ke,(0,c.A)({as:i,ownerState:d,className:f(p.root,o),ref:t},h))})),Ge=i.createContext(null);function Ye(){return i.useContext(Ge)}const Ze="function"==typeof Symbol&&Symbol.for?Symbol.for("mui.nested"):"__THEME_NESTED__",Xe=function(e){const{children:t,theme:n}=e,o=Ye(),a=i.useMemo((()=>{const e=null===o?n:function(e,t){return"function"==typeof t?t(e):(0,c.A)({},e,t)}(o,n);return null!=e&&(e[Ze]=null!==o),e}),[n,o]);return(0,r.jsx)(Ge.Provider,{value:a,children:t})},Je={};function et(e,t,n,r=!1){return i.useMemo((()=>{const o=e&&t[e]||t;if("function"==typeof n){const i=n(o),a=e?(0,c.A)({},t,{[e]:i}):i;return r?()=>a:a}return e?(0,c.A)({},t,{[e]:n}):(0,c.A)({},t,n)}),[e,t,n,r])}const tt=function(e){const{children:t,theme:n,themeId:i}=e,a=y(Je),s=Ye()||Je,l=et(i,a,n),c=et(i,s,n,!0);return(0,r.jsx)(Xe,{theme:c,children:(0,r.jsx)(o.T.Provider,{value:l,children:t})})},nt=["theme"];function rt(e){let{theme:t}=e,n=(0,u.A)(e,nt);const o=t[ee];return(0,r.jsx)(tt,(0,c.A)({},n,{themeId:o?ee:void 0,theme:o||t}))}const ot=e=>{let t;const n=new Set,r=(e,r)=>{const o="function"==typeof e?e(t):e;if(!Object.is(o,t)){const e=t;t=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},t,o),n.forEach((n=>n(t,e)))}},o=()=>t,i={setState:r,getState:o,getInitialState:()=>a,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},a=t=e(r,o,i);return i},it=e=>e?ot(e):ot;var at=n(9242);const{useDebugValue:st}=i,{useSyncExternalStoreWithSelector:lt}=at;let ct=!1;const ut=e=>e;function ht(e,t=ut,n){n&&!ct&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),ct=!0);const r=lt(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return st(r),r}const ft=e=>{"function"!=typeof e&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t="function"==typeof e?it(e):e,n=(e,n)=>ht(t,e,n);return Object.assign(n,t),n};var dt=n(7965);function pt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){pt(e,t,n[t])}))}return e}function gt(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function yt(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 vt(e,t){if(e){if("string"==typeof e)return yt(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(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yt(e,t):void 0}}function bt(e){return function(e){if(Array.isArray(e))return yt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||vt(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 xt(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=xt(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function wt(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=xt(e))&&(r&&(r+=" "),r+=t);return r}function kt(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=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){s=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw o}}return i}}(e,t)||vt(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 St(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Ot={scheme:"Light Theme",author:"mac gainor (https://github.com/mac-s-g)",base00:"rgba(0, 0, 0, 0)",base01:"rgb(245, 245, 245)",base02:"rgb(235, 235, 235)",base03:"#93a1a1",base04:"rgba(0, 0, 0, 0.3)",base05:"#586e75",base06:"#073642",base07:"#002b36",base08:"#d33682",base09:"#cb4b16",base0A:"#ffd500",base0B:"#859900",base0C:"#6c71c4",base0D:"#586e75",base0E:"#2aa198",base0F:"#268bd2"},_t={scheme:"Dark Theme",author:"Chris Kempson (http://chriskempson.com)",base00:"#181818",base01:"#282828",base02:"#383838",base03:"#585858",base04:"#b8b8b8",base05:"#d8d8d8",base06:"#e8e8e8",base07:"#f8f8f8",base08:"#ab4642",base09:"#dc9656",base0A:"#f7ca88",base0B:"#a1b56c",base0C:"#86c1b9",base0D:"#7cafc2",base0E:"#ba8baf",base0F:"#a16946"},Et=function(){return null};Et.when=function(){return!1};var Ct=(0,i.createContext)(void 0);Ct.Provider;var At=function(e,t){return ht((0,i.useContext)(Ct),e,t)},jt=function(){return At((function(e){return e.colorspace.base07}))};function Pt(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function Mt(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){Pt(i,r,o,a,s,"next",e)}function s(e){Pt(i,r,o,a,s,"throw",e)}a(void 0)}))}}function Rt(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function Tt(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}Object.prototype.constructor.toString();function Lt(e){return null===e?0:Array.isArray(e)?e.length:Tt(e,Map)||Tt(e,Set)?e.size:Tt(e,Date)?1:"object"==typeof e?Object.keys(e).length:"string"==typeof e?e.length:1}function It(e,t){for(var n=[],r=0;r<e.length;)n.push(e.slice(r,r+t)),r+=t;return n}function Nt(e){return zt.apply(this,arguments)}function zt(){return(zt=Mt((function(e){return Rt(this,(function(t){switch(t.label){case 0:if(!("clipboard"in navigator))return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.clipboard.writeText(e)];case 2:case 3:return t.sent(),[3,4];case 4:return dt(e),[2]}}))}))).apply(this,arguments)}function Dt(e,t){var n=At((function(e){return e.value}));return(0,i.useMemo)((function(){return function(e,t,n){if(null===e||null===n)return!1;if("object"!=typeof e)return!1;if("object"!=typeof n)return!1;if(Object.is(e,n)&&0!==t.length)return"";for(var r=[],o=bt(t),i=e;i!==n||0!==o.length;){if("object"!=typeof i||null===i)return!1;if(Object.is(i,n))return r.reduce((function(e,t,n){return"number"==typeof t?e+"[".concat(t,"]"):e+"".concat(0===n?"":".").concat(t)}),"");var a=o.shift();r.push(a),i=i[a]}return!1}(n,e,t)}),[e,t,n])}var Ft=function(e){return s(se,gt(mt({component:"div"},e),{sx:mt({display:"inline-block"},e.sx)}))},Bt=function(e){var t=e.dataType,n=e.enable;return void 0===n||n?s(Ft,{className:"data-type-label",sx:{mx:.5,fontSize:"0.7rem",opacity:.8,userSelect:"none"},children:t}):null};function $t(e,t,n){var r=n.fromString,o=n.colorKey,a=n.displayTypeLabel,c=void 0===a||a,u=(0,i.memo)(t),h=function(t){var n=At((function(e){return e.displayDataTypes})),r=At((function(e){return e.colorspace[o]})),i=At((function(e){return e.onSelect}));return l(Ft,{onClick:function(){return null==i?void 0:i(t.path,t.value)},sx:{color:r},children:[c&&n&&s(Bt,{dataType:e}),s(Ft,{className:"".concat(e,"-value"),children:s(u,{value:t.value})})]})};if(h.displayName="easy-".concat(e,"-type"),!r)return{Component:h};var f=function(e){var t=e.value,n=e.setValue,a=At((function(e){return e.colorspace[o]}));return s(ze,{value:t,onChange:(0,i.useCallback)((function(e){var t=r(e.target.value);n(t)}),[n]),size:"small",multiline:!0,sx:{color:a,padding:.5,borderStyle:"solid",borderColor:"black",borderWidth:1,fontSize:"0.8rem",fontFamily:"monospace",display:"inline-flex"}})};return f.displayName="easy-".concat(e,"-type-editor"),{Component:h,Editor:f}}var Ht=function(e){return l(De,{children:[s(Bt,{dataType:"function"}),l(se,{component:"span",className:"data-function-start",sx:{letterSpacing:.5},children:[(t=e.value,n=t.toString(),-1!==n.indexOf("function")?n.substring(8,n.indexOf("{")).trim():n.substring(0,n.indexOf("=>")+2).trim())," ","{"]})]});var t,n},Wt=function(){return s(De,{children:s(se,{component:"span",className:"data-function-end",children:"}"})})},qt=function(e){var t,n,r,o,i,a=At((function(e){return e.colorspace.base05}));return s(De,{children:s(se,{className:"data-function",sx:{display:e.inspect?"block":"inline-block",pl:e.inspect?2:0,color:a},children:e.inspect?(t=e.value,n=t.toString(),r=!0,o=n.indexOf(")"),i=n.indexOf("=>"),-1!==i&&i>o&&(r=!1),r?n.substring(n.indexOf("{",o)+1,n.lastIndexOf("}")):n.substring(n.indexOf("=>")+2)):s(se,{component:"span",className:"data-function-body",onClick:function(){return e.setInspect(!0)},sx:{"&:hover":{cursor:"pointer"},padding:.5},children:"…"})})})};var Vt=function(e){var t=e.d,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,["d"]);return s(We,gt(mt({},n),{children:s("path",{d:t})}))},Ut=function(e){return s(Vt,mt({d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"},e))},Kt=function(e){return s(Vt,mt({d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"},e))},Qt=function(e){return s(Vt,mt({d:"M 12 2 C 10.615 1.998 9.214625 2.2867656 7.890625 2.8847656 L 8.9003906 4.6328125 C 9.9043906 4.2098125 10.957 3.998 12 4 C 15.080783 4 17.738521 5.7633175 19.074219 8.3222656 L 17.125 9 L 21.25 11 L 22.875 7 L 20.998047 7.6523438 C 19.377701 4.3110398 15.95585 2 12 2 z M 6.5097656 4.4882812 L 2.2324219 5.0820312 L 3.734375 6.3808594 C 1.6515335 9.4550558 1.3615962 13.574578 3.3398438 17 C 4.0308437 18.201 4.9801562 19.268234 6.1601562 20.115234 L 7.1699219 18.367188 C 6.3019219 17.710187 5.5922656 16.904 5.0722656 16 C 3.5320014 13.332354 3.729203 10.148679 5.2773438 7.7128906 L 6.8398438 9.0625 L 6.5097656 4.4882812 z M 19.929688 13 C 19.794687 14.08 19.450734 15.098 18.927734 16 C 17.386985 18.668487 14.531361 20.090637 11.646484 19.966797 L 12.035156 17.9375 L 8.2402344 20.511719 L 10.892578 23.917969 L 11.265625 21.966797 C 14.968963 22.233766 18.681899 20.426323 20.660156 17 C 21.355156 15.801 21.805219 14.445 21.949219 13 L 19.929688 13 z"},e))},Gt=function(e){return s(Vt,mt({d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"},e))},Yt=function(e){return s(Vt,mt({d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"},e))},Zt=function(e){return s(Vt,mt({d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"},e))},Xt=function(e){return s(Vt,mt({d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"},e))};function Jt(e){var t=Lt(e),n="";return(Tt(e,Map)||Tt(e,Set))&&(n=e[Symbol.toStringTag]),Object.prototype.hasOwnProperty.call(e,Symbol.toStringTag)&&(n=e[Symbol.toStringTag]),"".concat(t," Items").concat(n?" (".concat(n,")"):"")}var en=(0,i.createContext)(void 0);en.Provider;var tn=function(e,t){return ht((0,i.useContext)(en),e,t)},nn={is:function(e){return"object"==typeof e},Component:function(e){var t=jt(),n=At((function(e){return e.colorspace.base02})),r=At((function(e){return e.groupArraysAfterLength})),o=Dt(e.path,e.value),a=kt((0,i.useState)(At((function(e){return e.maxDisplayLength}))),2),c=a[0],u=a[1],h=At((function(e){return e.objectSortKeys})),f=(0,i.useMemo)((function(){if(!e.inspect)return null;var n=e.value,o=function(e){return"function"==typeof(null==e?void 0:e[Symbol.iterator])}(n);if(o&&!Array.isArray(n)){var i=[];if(Tt(n,Map))n.forEach((function(t,n){var r=n.toString(),o=bt(e.path).concat([r]);i.push(s(on,{path:o,value:t,prevValue:Tt(e.prevValue,Map)?e.prevValue.get(n):void 0,editable:!1},r))}));else for(var a=n[Symbol.iterator](),f=a.next(),d=0;!f.done;)i.push(s(on,{path:bt(e.path).concat(["iterator:".concat(d)]),value:f.value,nestedIndex:d,editable:!1},d)),d++,f=a.next();return i}if(Array.isArray(n)){if(n.length<=r){var p=n.slice(0,c).map((function(t,n){var r=bt(e.path).concat([n]);return s(on,{path:r,value:t,prevValue:Array.isArray(e.prevValue)?e.prevValue[n]:void 0},n)}));if(n.length>c){var m=n.length-c;p.push(l(Ft,{sx:{cursor:"pointer",lineHeight:1.5,color:t,letterSpacing:.5,opacity:.8,userSelect:"none"},onClick:function(){return u((function(e){return 2*e}))},children:["hidden ",m," items…"]},"last"))}return p}var g=It(n,r),y=Array.isArray(e.prevValue)?It(e.prevValue,r):void 0;return g.map((function(t,n){var r=bt(e.path);return s(on,{path:r,value:t,nestedIndex:n,prevValue:null==y?void 0:y[n]},n)}))}var v=Object.entries(n);h&&(v=!0===h?v.sort((function(e,t){var n=kt(e,1)[0],r=kt(t,1)[0];return n.localeCompare(r)})):v.sort((function(e,t){var n=kt(e,1)[0],r=kt(t,1)[0];return h(n,r)})));var b=v.slice(0,c).map((function(t){var n,r=kt(t,2),o=r[0],i=r[1],a=bt(e.path).concat([o]);return s(on,{path:a,value:i,prevValue:null===(n=e.prevValue)||void 0===n?void 0:n[o]},o)}));if(v.length>c){var x=v.length-c;b.push(l(Ft,{sx:{cursor:"pointer",lineHeight:1.5,color:t,letterSpacing:.5,opacity:.8,userSelect:"none"},onClick:function(){return u((function(e){return 2*e}))},children:["hidden ",x," items…"]},"last"))}return b}),[e.inspect,e.value,e.prevValue,e.path,r,c,t,h]),d=e.inspect?.6:0,p=At((function(e){return e.indentWidth})),m=e.inspect?p-d:p;return(0,i.useMemo)((function(){return 0===Lt(e.value)}),[e.value])?null:s(se,{className:"data-object",sx:{display:e.inspect?"block":"inline-block",pl:e.inspect?m-.6:0,marginLeft:d,color:t,borderLeft:e.inspect?"1px solid ".concat(n):"none"},children:e.inspect?f:!o&&s(se,{component:"span",className:"data-object-body",onClick:function(){return e.setInspect(!0)},sx:{"&:hover":{cursor:"pointer"},padding:.5,userSelect:"none"},children:"…"})})},PreComponent:function(e){var t=At((function(e){return e.colorspace.base04})),n=jt(),r=(0,i.useMemo)((function(){return Array.isArray(e.value)}),[e.value]),o=(0,i.useMemo)((function(){return 0===Lt(e.value)}),[e.value]),c=(0,i.useMemo)((function(){return Jt(e.value)}),[e.value]),u=At((function(e){return e.displayObjectSize})),h=Dt(e.path,e.value);return l(se,{component:"span",className:"data-object-start",sx:{letterSpacing:.5},children:[r?"[":"{",u&&e.inspect&&!o&&s(se,{component:"span",sx:{pl:.5,fontStyle:"italic",color:t,userSelect:"none"},children:c}),h&&!e.inspect&&l(a,{children:[s(Qt,{sx:{fontSize:12,color:n,mx:.5}}),h]})]})},PostComponent:function(e){var t=At((function(e){return e.colorspace.base04})),n=(0,i.useMemo)((function(){return Array.isArray(e.value)}),[e.value]),r=At((function(e){return e.displayObjectSize})),o=(0,i.useMemo)((function(){return 0===Lt(e.value)}),[e.value]),a=(0,i.useMemo)((function(){return Jt(e.value)}),[e.value]);return l(se,{component:"span",className:"data-object-end",children:[n?"]":"}",!r||!o&&e.inspect?null:s(se,{component:"span",sx:{pl:.5,fontStyle:"italic",color:t,userSelect:"none"},children:a})]})}};var rn=function(e){return s(se,gt(mt({component:"span"},e),{sx:mt({cursor:"pointer",paddingLeft:"0.7rem"},e.sx)}))},on=function(e){var t,n=e.value,r=e.prevValue,o=e.path,c=e.nestedIndex,u=null!==(t=e.editable)&&void 0!==t?t:void 0,h=At((function(e){return e.editable})),f=(0,i.useMemo)((function(){return!1!==h&&!1!==u&&("function"==typeof h?!!h(o,n):h)}),[o,u,h,n]),d=kt((0,i.useState)("function"==typeof n?function(){return n}:n),2),p=d[0],m=d[1],g=o.length,y=o[g-1],v=At((function(e){return e.hoverPath})),b=(0,i.useMemo)((function(){return v&&o.every((function(e,t){return e===v.path[t]&&c===v.nestedIndex}))}),[v,o,c]),x=At((function(e){return e.setHover})),w=At((function(e){return e.value})),k=kt(function(e,t,n){var r=e.length,o=Dt(e,t),a=At((function(e){return e.getInspectCache})),s=At((function(e){return e.setInspectCache})),l=At((function(e){return e.defaultInspectDepth}));(0,i.useEffect)((function(){void 0===a(e,n)&&(void 0!==n?s(e,!1,n):s(e,!o&&r<l))}),[l,r,a,o,n,e,s]);var c=kt((0,i.useState)((function(){var t=a(e,n);return void 0!==t?t:void 0===n&&!o&&r<l})),2),u=c[0],h=c[1];return[u,(0,i.useCallback)((function(t){h((function(r){var o="boolean"==typeof t?t:t(r);return s(e,o,n),o}))}),[n,e,s])]}(o,n,c),2),S=k[0],O=k[1],_=kt((0,i.useState)(!1),2),E=_[0],C=_[1],A=At((function(e){return e.onChange})),j=jt(),P=At((function(e){return e.colorspace.base0C})),M=At((function(e){return e.colorspace.base0A})),R=function(e,t){var n=tn((function(e){return e.registry}));return(0,i.useMemo)((function(){return function(e,t,n){var r,o=!0,i=!1,a=void 0;try{for(var s,l=n[Symbol.iterator]();!(o=(s=l.next()).done);o=!0){var c=s.value;if(c.is(e,t)&&(r=c,"object"==typeof e))return c}}catch(e){i=!0,a=e}finally{try{o||null==l.return||l.return()}finally{if(i)throw a}}if(void 0===r){if("object"==typeof e)return nn;throw new Error("this is not possible")}return r}(e,t,n)}),[e,t,n])}(n,o),T=R.Component,L=R.PreComponent,I=R.PostComponent,N=R.Editor,z=At((function(e){return e.quotesOnKeys})),D=At((function(e){return e.rootName})),F=w===n,B=Number.isInteger(Number(y)),$=At((function(e){return e.enableClipboard})),H=function(){var e,t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).timeout,n=void 0===t?2e3:t,r=kt((0,i.useState)(!1),2),o=r[0],a=r[1],s=(0,i.useRef)(null),l=(0,i.useCallback)((function(e){var t=s.current;t&&window.clearTimeout(t),s.current=window.setTimeout((function(){return a(!1)}),n),a(e)}),[n]),c=At((function(e){return e.onCopy})),u=(0,i.useCallback)((e=Mt((function(e,t){var n,r,o;return Rt(this,(function(i){switch(i.label){case 0:if("function"!=typeof c)return[3,5];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,c(e,t,Nt)];case 2:return i.sent(),l(!0),[3,4];case 3:return n=i.sent(),console.error("error when copy ".concat(0===e.length?"src":"src[".concat(e.join(".")),"]"),n),[3,4];case 4:return[3,8];case 5:return i.trys.push([5,7,,8]),a="function"==typeof t?t.toString():t,s=[],r=JSON.stringify(a,(function(e,t){if("bigint"===(void 0===t?"undefined":St(t)))return t.toString();if(Tt(t,Map)){if("toJSON"in t&&"function"==typeof t.toJSON)return t.toJSON();if(0===t.size)return{};if(s.includes(t))return"[Circular]";s.push(t);var n=Array.from(t.entries());return n.every((function(e){var t=kt(e,1)[0];return"string"==typeof t||"number"==typeof t}))?Object.fromEntries(n):{}}if(Tt(t,Set))return"toJSON"in t&&"function"==typeof t.toJSON?t.toJSON():s.includes(t)?"[Circular]":(s.push(t),Array.from(t.values()));if("object"==typeof t&&null!==t&&Object.keys(t).length){var r=s.length;if(r){for(var o=r-1;o>=0&&s[o][e]!==t;--o)s.pop();if(s.includes(t))return"[Circular]"}s.push(t)}return t}),"  "),[4,Nt(r)];case 6:return i.sent(),l(!0),[3,8];case 7:return o=i.sent(),console.error("error when copy ".concat(0===e.length?"src":"src[".concat(e.join(".")),"]"),o),[3,8];case 8:return[2]}var a,s}))})),function(t,n){return e.apply(this,arguments)}),[l,c]);return{copy:u,reset:(0,i.useCallback)((function(){a(!1),s.current&&clearTimeout(s.current)}),[]),copied:o}}(),W=H.copy,q=H.copied,V=At((function(e){return e.highlightUpdates})),U=(0,i.useMemo)((function(){return!(!V||void 0===r||(void 0===n?"undefined":St(n))===(void 0===r?"undefined":St(r))&&("number"==typeof n?isNaN(n)&&isNaN(r)||n===r:Array.isArray(n)===Array.isArray(r)&&("object"==typeof n||"function"==typeof n||n===r)))}),[V,r,n]),K=(0,i.useRef)();(0,i.useEffect)((function(){K.current&&U&&"animate"in K.current&&K.current.animate([{backgroundColor:M},{backgroundColor:""}],{duration:1e3,easing:"ease-in"})}),[M,U,r,n]);var Q=(0,i.useMemo)((function(){return l(a,E?{children:[s(rn,{children:s(Gt,{sx:{fontSize:".8rem"},onClick:function(){C(!1),m(n)}})}),s(rn,{children:s(Ut,{sx:{fontSize:".8rem"},onClick:function(){C(!1),A(o,n,p)}})})]}:{children:[$&&s(rn,{onClick:function(e){e.preventDefault();try{W(o,n,Nt)}catch(e){console.error(e)}},children:s(q?Ut:Yt,{sx:{fontSize:".8rem"}})}),N&&f&&s(rn,{onClick:function(e){e.preventDefault(),C(!0),m(n)},children:s(Zt,{sx:{fontSize:".8rem"}})})]})}),[N,q,W,f,E,$,A,o,p,n]),G=(0,i.useMemo)((function(){return 0===Lt(n)}),[n]),Y=!G&&!(!L||!I),Z=At((function(e){return e.keyRenderer})),X=(0,i.useMemo)((function(){return{path:o,inspect:S,setInspect:O,value:n,prevValue:r}}),[S,o,O,n,r]);return l(se,{className:"data-key-pair","data-testid":"data-key-pair"+o.join("."),sx:{userSelect:"text"},onMouseEnter:(0,i.useCallback)((function(){return x(o,c)}),[x,o,c]),children:[l(Ft,{component:"span",className:"data-key",sx:{lineHeight:1.5,color:j,letterSpacing:.5,opacity:.8},onClick:(0,i.useCallback)((function(e){e.isDefaultPrevented()||G||O((function(e){return!e}))}),[G,O]),children:[Y?s(S?Xt:Kt,{sx:{fontSize:".8rem","&:hover":{cursor:"pointer"}}}):null,s(se,{ref:K,component:"span",children:F?!1!==D?z?l(a,{children:['"',D,'"']}):s(a,{children:D}):null:Z.when(X)?s(Z,mt({},X)):void 0===c&&(B?s(se,{component:"span",style:{color:P},children:y}):z?l(a,{children:['"',y,'"']}):s(a,{children:y}))}),F?!1!==D&&s(Ft,{sx:{mr:.5},children:":"}):void 0===c&&s(Ft,{sx:{mr:.5},children:":"}),L&&s(L,mt({},X)),b&&Y&&S&&Q]}),E&&f?N&&s(N,{value:p,setValue:m}):T?s(T,mt({},X)):s(se,{component:"span",className:"data-value-fallback",children:"fallback: ".concat(n)}),I&&s(I,mt({},X)),b&&Y&&!S&&Q,b&&!Y&&Q]})},an="(prefers-color-scheme: dark)";function sn(e,t){var n=(0,i.useContext)(Ct).setState;(0,i.useEffect)((function(){void 0!==t&&n(pt({},e,t))}),[e,t,n])}var ln=function(e){var t=(0,i.useContext)(Ct).setState;(0,i.useEffect)((function(){t((function(t){return{prevValue:t.value,value:e.value}}))}),[e.value,t]),sn("editable",e.editable),sn("indentWidth",e.indentWidth),sn("onChange",e.onChange),sn("groupArraysAfterLength",e.groupArraysAfterLength),sn("keyRenderer",e.keyRenderer),sn("maxDisplayLength",e.maxDisplayLength),sn("enableClipboard",e.enableClipboard),sn("highlightUpdates",e.highlightUpdates),sn("rootName",e.rootName),sn("displayDataTypes",e.displayDataTypes),sn("displayObjectSize",e.displayObjectSize),sn("onCopy",e.onCopy),sn("onSelect",e.onSelect),(0,i.useEffect)((function(){"light"===e.theme?t({colorspace:Ot}):"dark"===e.theme?t({colorspace:_t}):"object"==typeof e.theme&&t({colorspace:e.theme})}),[t,e.theme]);var n=(0,i.useMemo)((function(){return"object"==typeof e.theme?"json-viewer-theme-custom":"dark"===e.theme?"json-viewer-theme-dark":"json-viewer-theme-light"}),[e.theme]),r=(0,i.useRef)(!0),o=(0,i.useMemo)((function(){return function(){var e=function(e){function n(e,t){var n,r;return Object.is(e.value,t.value)&&e.inspect&&t.inspect&&(null===(n=e.path)||void 0===n?void 0:n.join("."))===(null===(r=t.path)||void 0===r?void 0:r.join("."))}e.Component=(0,i.memo)(e.Component,n),e.Editor&&(e.Editor=(0,i.memo)(e.Editor,(function(e,t){return Object.is(e.value,t.value)}))),e.PreComponent&&(e.PreComponent=(0,i.memo)(e.PreComponent,n)),e.PostComponent&&(e.PostComponent=(0,i.memo)(e.PostComponent,n)),t.push(e)},t=[];e(mt({is:function(e){return"boolean"==typeof e}},$t("bool",(function(e){var t=e.value;return s(a,{children:t?"true":"false"})}),{colorKey:"base0E",fromString:function(e){return Boolean(e)}})));var n={weekday:"short",year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};e(mt({is:function(e){return Tt(e,Date)}},$t("date",(function(e){var t=e.value;return s(a,{children:t.toLocaleTimeString("en-us",n)})}),{colorKey:"base0D"}))),e(mt({is:function(e){return null===e}},$t("null",(function(){var e=At((function(e){return e.colorspace.base02}));return s(se,{sx:{fontSize:"0.8rem",backgroundColor:e,fontWeight:"bold",borderRadius:"3px",padding:"0.5px 2px"},children:"NULL"})}),{colorKey:"base08",displayTypeLabel:!1}))),e(mt({is:function(e){return void 0===e}},$t("undefined",(function(){var e=At((function(e){return e.colorspace.base02}));return s(se,{sx:{fontSize:"0.7rem",backgroundColor:e,borderRadius:"3px",padding:"0.5px 2px"},children:"undefined"})}),{colorKey:"base05",displayTypeLabel:!1}))),e(mt({is:function(e){return"string"==typeof e}},$t("string",(function(e){var t=kt((0,i.useState)(!1),2),n=t[0],r=t[1],o=At((function(e){return e.collapseStringsAfterLength})),a=n?e.value:e.value.slice(0,o),c=e.value.length>o;return l(se,{component:"span",sx:{overflowWrap:"anywhere",cursor:c?"pointer":"inherit"},onClick:function(){c&&r((function(e){return!e}))},children:['"',a,c&&!n&&s(se,{component:"span",sx:{padding:.5},children:"…"}),'"']})}),{colorKey:"base09",fromString:function(e){return e}}))),e({is:function(e){return"function"==typeof e},Component:qt,PreComponent:Ht,PostComponent:Wt});var r=function(e){return e%1==0};return e(mt({is:function(e){return"number"==typeof e&&isNaN(e)}},$t("NaN",(function(){var e=At((function(e){return e.colorspace.base02}));return s(se,{sx:{backgroundColor:e,fontSize:"0.8rem",fontWeight:"bold",borderRadius:"3px"},children:"NaN"})}),{colorKey:"base08",displayTypeLabel:!1}))),e(mt({is:function(e){return"number"==typeof e&&!r(e)}},$t("float",(function(e){var t=e.value;return s(a,{children:t})}),{colorKey:"base0B",fromString:function(e){return parseFloat(e)}}))),e(mt({is:function(e){return"number"==typeof e&&r(e)}},$t("int",(function(e){var t=e.value;return s(a,{children:t})}),{colorKey:"base0F",fromString:function(e){return parseInt(e)}}))),e(mt({is:function(e){return"bigint"===(void 0===e?"undefined":St(e))}},$t("bigint",(function(e){var t=e.value;return s(a,{children:"".concat(t,"n")})}),{colorKey:"base0F",fromString:function(e){return BigInt(e.replace(/\D/g,""))}}))),t}()}),[]),c=tn((function(e){return e.registerTypes}));if(r.current){var u=e.valueTypes?bt(o).concat(bt(e.valueTypes)):bt(o);c(u),r.current=!1}(0,i.useEffect)((function(){var t=e.valueTypes?bt(o).concat(bt(e.valueTypes)):bt(o);c(t)}),[e.valueTypes,o,c]);var h=At((function(e){return e.value})),f=At((function(e){return e.prevValue})),d=At((function(e){return e.setHover})),p=(0,i.useCallback)((function(){return d(null)}),[d]);return s(Qe,{elevation:0,className:wt(n,e.className),style:e.style,sx:mt({fontFamily:"monospace",userSelect:"none",contentVisibility:"auto"},e.sx),onMouseLeave:p,children:s(on,{value:h,prevValue:f,path:(0,i.useMemo)((function(){return[]}),[])})})},cn=function(e){var t,n,r,o,a=(n=(t=kt((0,i.useState)(!1),2))[0],r=t[1],(0,i.useEffect)((function(){var e=function(e){r(e.matches)};r(window.matchMedia(an).matches);var t=window.matchMedia(an);return t.addEventListener("change",e),function(){return t.removeEventListener("change",e)}}),[]),n),l=(0,i.useMemo)((function(){return"auto"===e.theme?a?"light":"dark":null!==(o=e.theme)&&void 0!==o?o:"light"}),[a,e.theme]),c=(0,i.useMemo)((function(){var e="object"==typeof l?l.base00:"dark"===l?_t.base00:Ot.base00;return J({components:{MuiPaper:{styleOverrides:{root:{backgroundColor:e}}}},palette:{mode:"dark"===l?"dark":"light",background:{default:e}}})}),[l]),u=gt(mt({},e),{theme:l}),h=(0,i.useMemo)((function(){return function(e){var t,n,r,o,i,a,s,l,c,u,h,f,d,p,m,g,y,v;return(v?ft(v):ft)((function(v,b){return{enableClipboard:null===(t=e.enableClipboard)||void 0===t||t,highlightUpdates:null!==(n=e.highlightUpdates)&&void 0!==n&&n,indentWidth:null!==(r=e.indentWidth)&&void 0!==r?r:3,groupArraysAfterLength:null!==(o=e.groupArraysAfterLength)&&void 0!==o?o:100,collapseStringsAfterLength:!1===e.collapseStringsAfterLength?Number.MAX_VALUE:null!==(i=e.collapseStringsAfterLength)&&void 0!==i?i:50,maxDisplayLength:null!==(a=e.maxDisplayLength)&&void 0!==a?a:30,rootName:null!==(s=e.rootName)&&void 0!==s?s:"root",onChange:null!==(l=e.onChange)&&void 0!==l?l:function(){},onCopy:null!==(c=e.onCopy)&&void 0!==c?c:void 0,onSelect:null!==(u=e.onSelect)&&void 0!==u?u:void 0,keyRenderer:null!==(h=e.keyRenderer)&&void 0!==h?h:Et,editable:null!==(f=e.editable)&&void 0!==f&&f,defaultInspectDepth:null!==(d=e.defaultInspectDepth)&&void 0!==d?d:5,objectSortKeys:null!==(p=e.objectSortKeys)&&void 0!==p&&p,quotesOnKeys:null===(m=e.quotesOnKeys)||void 0===m||m,displayDataTypes:null===(g=e.displayDataTypes)||void 0===g||g,inspectCache:{},hoverPath:null,colorspace:Ot,value:e.value,prevValue:void 0,displayObjectSize:null===(y=e.displayObjectSize)||void 0===y||y,getInspectCache:function(e,t){var n=void 0!==t?e.join(".")+"[".concat(t,"]nt"):e.join(".");return b().inspectCache[n]},setInspectCache:function(e,t,n){var r=void 0!==n?e.join(".")+"[".concat(n,"]nt"):e.join(".");v((function(e){return{inspectCache:gt(mt({},e.inspectCache),pt({},r,"function"==typeof t?t(e.inspectCache[r]):t))}}))},setHover:function(e,t){v({hoverPath:e?{path:e,nestedIndex:t}:null})}}}))}(e)}),[]),f=(0,i.useMemo)((function(){return it()((function(e){return{registry:[],registerTypes:function(t){e((function(e){return{registry:"function"==typeof t?t(e.registry):t}}))}}}))}),[]);return s(rt,{theme:c,children:s(en.Provider,{value:f,children:s(Ct.Provider,{value:h,children:s(ln,mt({},u))})})})}},2262:(e,t,n)=>{"use strict";function r(e){return e+.5|0}n.d(t,{A6:()=>yn,E8:()=>Vr,PP:()=>fo,t1:()=>Dr,s$:()=>Gr,kc:()=>go,m_:()=>uo});const o=(e,t,n)=>Math.max(Math.min(e,n),t);function i(e){return o(r(2.55*e),0,255)}function a(e){return o(r(255*e),0,255)}function s(e){return o(r(e/2.55)/100,0,1)}function l(e){return o(r(100*e),0,100)}const c={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},u=[..."0123456789ABCDEF"],h=e=>u[15&e],f=e=>u[(240&e)>>4]+u[15&e],d=e=>(240&e)>>4==(15&e);const p=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function m(e,t,n){const r=t*Math.min(n,1-n),o=(t,o=(t+e/30)%12)=>n-r*Math.max(Math.min(o-3,9-o,1),-1);return[o(0),o(8),o(4)]}function g(e,t,n){const r=(r,o=(r+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[r(5),r(3),r(1)]}function y(e,t,n){const r=m(e,1,.5);let o;for(t+n>1&&(o=1/(t+n),t*=o,n*=o),o=0;o<3;o++)r[o]*=1-t-n,r[o]+=t;return r}function v(e){const t=e.r/255,n=e.g/255,r=e.b/255,o=Math.max(t,n,r),i=Math.min(t,n,r),a=(o+i)/2;let s,l,c;return o!==i&&(c=o-i,l=a>.5?c/(2-o-i):c/(o+i),s=function(e,t,n,r,o){return e===o?(t-n)/r+(t<n?6:0):t===o?(n-e)/r+2:(e-t)/r+4}(t,n,r,c,o),s=60*s+.5),[0|s,l||0,a]}function b(e,t,n,r){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,r)).map(a)}function x(e,t,n){return b(m,e,t,n)}function w(e){return(e%360+360)%360}const k={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},S={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};let O;const _=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/,E=e=>e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055,C=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function A(e,t,n){if(e){let r=v(e);r[t]=Math.max(0,Math.min(r[t]+r[t]*n,0===t?360:1)),r=x(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function j(e,t){return e?Object.assign(t||{},e):e}function P(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=a(e[3]))):(t=j(e,{r:0,g:0,b:0,a:1})).a=a(t.a),t}function M(e){return"r"===e.charAt(0)?function(e){const t=_.exec(e);let n,r,a,s=255;if(t){if(t[7]!==n){const e=+t[7];s=t[8]?i(e):o(255*e,0,255)}return n=+t[1],r=+t[3],a=+t[5],n=255&(t[2]?i(n):o(n,0,255)),r=255&(t[4]?i(r):o(r,0,255)),a=255&(t[6]?i(a):o(a,0,255)),{r:n,g:r,b:a,a:s}}}(e):function(e){const t=p.exec(e);let n,r=255;if(!t)return;t[5]!==n&&(r=t[6]?i(+t[5]):a(+t[5]));const o=w(+t[2]),s=+t[3]/100,l=+t[4]/100;return n="hwb"===t[1]?function(e,t,n){return b(y,e,t,n)}(o,s,l):"hsv"===t[1]?function(e,t,n){return b(g,e,t,n)}(o,s,l):x(o,s,l),{r:n[0],g:n[1],b:n[2],a:r}}(e)}class R{constructor(e){if(e instanceof R)return e;const t=typeof e;let n;var r,o,i;"object"===t?n=P(e):"string"===t&&(i=(r=e).length,"#"===r[0]&&(4===i||5===i?o={r:255&17*c[r[1]],g:255&17*c[r[2]],b:255&17*c[r[3]],a:5===i?17*c[r[4]]:255}:7!==i&&9!==i||(o={r:c[r[1]]<<4|c[r[2]],g:c[r[3]]<<4|c[r[4]],b:c[r[5]]<<4|c[r[6]],a:9===i?c[r[7]]<<4|c[r[8]]:255})),n=o||function(e){O||(O=function(){const e={},t=Object.keys(S),n=Object.keys(k);let r,o,i,a,s;for(r=0;r<t.length;r++){for(a=s=t[r],o=0;o<n.length;o++)i=n[o],s=s.replace(i,k[i]);i=parseInt(S[a],16),e[s]=[i>>16&255,i>>8&255,255&i]}return e}(),O.transparent=[0,0,0,0]);const t=O[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:4===t.length?t[3]:255}}(e)||M(e)),this._rgb=n,this._valid=!!n}get valid(){return this._valid}get rgb(){var e=j(this._rgb);return e&&(e.a=s(e.a)),e}set rgb(e){this._rgb=P(e)}rgbString(){return this._valid?(e=this._rgb)&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${s(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`):void 0;var e}hexString(){return this._valid?(e=this._rgb,t=(e=>d(e.r)&&d(e.g)&&d(e.b)&&d(e.a))(e)?h:f,e?"#"+t(e.r)+t(e.g)+t(e.b)+((e,t)=>e<255?t(e):"")(e.a,t):void 0):void 0;var e,t}hslString(){return this._valid?function(e){if(!e)return;const t=v(e),n=t[0],r=l(t[1]),o=l(t[2]);return e.a<255?`hsla(${n}, ${r}%, ${o}%, ${s(e.a)})`:`hsl(${n}, ${r}%, ${o}%)`}(this._rgb):void 0}mix(e,t){if(e){const n=this.rgb,r=e.rgb;let o;const i=t===o?.5:t,a=2*i-1,s=n.a-r.a,l=((a*s==-1?a:(a+s)/(1+a*s))+1)/2;o=1-l,n.r=255&l*n.r+o*r.r+.5,n.g=255&l*n.g+o*r.g+.5,n.b=255&l*n.b+o*r.b+.5,n.a=i*n.a+(1-i)*r.a,this.rgb=n}return this}interpolate(e,t){return e&&(this._rgb=function(e,t,n){const r=C(s(e.r)),o=C(s(e.g)),i=C(s(e.b));return{r:a(E(r+n*(C(s(t.r))-r))),g:a(E(o+n*(C(s(t.g))-o))),b:a(E(i+n*(C(s(t.b))-i))),a:e.a+n*(t.a-e.a)}}(this._rgb,e._rgb,t)),this}clone(){return new R(this.rgb)}alpha(e){return this._rgb.a=a(e),this}clearer(e){return this._rgb.a*=1-e,this}greyscale(){const e=this._rgb,t=r(.3*e.r+.59*e.g+.11*e.b);return e.r=e.g=e.b=t,this}opaquer(e){return this._rgb.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return A(this._rgb,2,e),this}darken(e){return A(this._rgb,2,-e),this}saturate(e){return A(this._rgb,1,e),this}desaturate(e){return A(this._rgb,1,-e),this}rotate(e){return function(e,t){var n=v(e);n[0]=w(n[0]+t),n=x(n),e.r=n[0],e.g=n[1],e.b=n[2]}(this._rgb,e),this}}function T(){}const L=(()=>{let e=0;return()=>e++})();function I(e){return null==e}function N(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return"[object"===t.slice(0,7)&&"Array]"===t.slice(-6)}function z(e){return null!==e&&"[object Object]"===Object.prototype.toString.call(e)}function D(e){return("number"==typeof e||e instanceof Number)&&isFinite(+e)}function F(e,t){return D(e)?e:t}function B(e,t){return void 0===e?t:e}function $(e,t,n){if(e&&"function"==typeof e.call)return e.apply(n,t)}function H(e,t,n,r){let o,i,a;if(N(e))if(i=e.length,r)for(o=i-1;o>=0;o--)t.call(n,e[o],o);else for(o=0;o<i;o++)t.call(n,e[o],o);else if(z(e))for(a=Object.keys(e),i=a.length,o=0;o<i;o++)t.call(n,e[a[o]],a[o])}function W(e,t){let n,r,o,i;if(!e||!t||e.length!==t.length)return!1;for(n=0,r=e.length;n<r;++n)if(o=e[n],i=t[n],o.datasetIndex!==i.datasetIndex||o.index!==i.index)return!1;return!0}function q(e){if(N(e))return e.map(q);if(z(e)){const t=Object.create(null),n=Object.keys(e),r=n.length;let o=0;for(;o<r;++o)t[n[o]]=q(e[n[o]]);return t}return e}function V(e){return-1===["__proto__","prototype","constructor"].indexOf(e)}function U(e,t,n,r){if(!V(e))return;const o=t[e],i=n[e];z(o)&&z(i)?K(o,i,r):t[e]=q(i)}function K(e,t,n){const r=N(t)?t:[t],o=r.length;if(!z(e))return e;const i=(n=n||{}).merger||U;let a;for(let t=0;t<o;++t){if(a=r[t],!z(a))continue;const o=Object.keys(a);for(let t=0,r=o.length;t<r;++t)i(o[t],e,a,n)}return e}function Q(e,t){return K(e,t,{merger:G})}function G(e,t,n){if(!V(e))return;const r=t[e],o=n[e];z(r)&&z(o)?Q(r,o):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=q(o))}const Y={"":e=>e,x:e=>e.x,y:e=>e.y};function Z(e,t){const n=Y[t]||(Y[t]=function(e){const t=function(e){const t=e.split("."),n=[];let r="";for(const e of t)r+=e,r.endsWith("\\")?r=r.slice(0,-1)+".":(n.push(r),r="");return n}(e);return e=>{for(const n of t){if(""===n)break;e=e&&e[n]}return e}}(t));return n(e)}function X(e){return e.charAt(0).toUpperCase()+e.slice(1)}const J=e=>void 0!==e,ee=e=>"function"==typeof e,te=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0},ne=Math.PI,re=2*ne,oe=Number.POSITIVE_INFINITY,ie=ne/180,ae=ne/2,se=ne/4,le=2*ne/3,ce=Math.log10,ue=Math.sign;function he(e,t,n){return Math.abs(e-t)<n}function fe(e){const t=Math.round(e);e=he(e,t,e/1e3)?t:e;const n=Math.pow(10,Math.floor(ce(e))),r=e/n;return(r<=1?1:r<=2?2:r<=5?5:10)*n}function de(e){return!isNaN(parseFloat(e))&&isFinite(e)}function pe(e){return e*(ne/180)}function me(e){if(!D(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function ge(e){return(e%re+re)%re}function ye(e,t,n){return Math.max(t,Math.min(n,e))}function ve(e,t,n,r=1e-6){return e>=Math.min(t,n)-r&&e<=Math.max(t,n)+r}function be(e,t,n){n=n||(n=>e[n]<t);let r,o=e.length-1,i=0;for(;o-i>1;)r=i+o>>1,n(r)?i=r:o=r;return{lo:i,hi:o}}const xe=(e,t,n,r)=>be(e,n,r?r=>{const o=e[r][t];return o<n||o===n&&e[r+1][t]===n}:r=>e[r][t]<n),we=(e,t,n)=>be(e,n,(r=>e[r][t]>=n)),ke=["push","pop","shift","splice","unshift"];function Se(e,t){const n=e._chartjs;if(!n)return;const r=n.listeners,o=r.indexOf(t);-1!==o&&r.splice(o,1),r.length>0||(ke.forEach((t=>{delete e[t]})),delete e._chartjs)}const Oe="undefined"==typeof window?function(e){return e()}:window.requestAnimationFrame;function _e(e,t){let n=[],r=!1;return function(...o){n=o,r||(r=!0,Oe.call(window,(()=>{r=!1,e.apply(t,n)})))}}const Ee=e=>"start"===e?"left":"end"===e?"right":"center",Ce=(e,t,n)=>"start"===e?t:"end"===e?n:(t+n)/2,Ae=e=>0===e||1===e,je=(e,t,n)=>-Math.pow(2,10*(e-=1))*Math.sin((e-t)*re/n),Pe=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*re/n)+1,Me={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>1-Math.cos(e*ae),easeOutSine:e=>Math.sin(e*ae),easeInOutSine:e=>-.5*(Math.cos(ne*e)-1),easeInExpo:e=>0===e?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>1===e?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>Ae(e)?e:e<.5?.5*Math.pow(2,10*(2*e-1)):.5*(2-Math.pow(2,-10*(2*e-1))),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>Ae(e)?e:je(e,.075,.3),easeOutElastic:e=>Ae(e)?e:Pe(e,.075,.3),easeInOutElastic(e){const t=.1125;return Ae(e)?e:e<.5?.5*je(2*e,t,.45):.5+.5*Pe(2*e-1,t,.45)},easeInBack(e){const t=1.70158;return e*e*((t+1)*e-t)},easeOutBack(e){const t=1.70158;return(e-=1)*e*((t+1)*e+t)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?e*e*((1+(t*=1.525))*e-t)*.5:.5*((e-=2)*e*((1+(t*=1.525))*e+t)+2)},easeInBounce:e=>1-Me.easeOutBounce(1-e),easeOutBounce(e){const t=7.5625,n=2.75;return e<1/n?t*e*e:e<2/n?t*(e-=1.5/n)*e+.75:e<2.5/n?t*(e-=2.25/n)*e+.9375:t*(e-=2.625/n)*e+.984375},easeInOutBounce:e=>e<.5?.5*Me.easeInBounce(2*e):.5*Me.easeOutBounce(2*e-1)+.5};function Re(e){if(e&&"object"==typeof e){const t=e.toString();return"[object CanvasPattern]"===t||"[object CanvasGradient]"===t}return!1}function Te(e){return Re(e)?e:new R(e)}function Le(e){return Re(e)?e:new R(e).saturate(.5).darken(.1).hexString()}const Ie=["x","y","borderWidth","radius","tension"],Ne=["color","borderColor","backgroundColor"],ze=new Map;function De(e,t,n){return function(e,t){t=t||{};const n=e+JSON.stringify(t);let r=ze.get(n);return r||(r=new Intl.NumberFormat(e,t),ze.set(n,r)),r}(t,n).format(e)}const Fe={values:e=>N(e)?e:""+e,numeric(e,t,n){if(0===e)return"0";const r=this.chart.options.locale;let o,i=e;if(n.length>1){const t=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(t<1e-4||t>1e15)&&(o="scientific"),i=function(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}(e,n)}const a=ce(Math.abs(i)),s=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:o,minimumFractionDigits:s,maximumFractionDigits:s};return Object.assign(l,this.options.ticks.format),De(e,r,l)},logarithmic(e,t,n){if(0===e)return"0";const r=n[t].significand||e/Math.pow(10,Math.floor(ce(e)));return[1,2,3,5,10,15].includes(r)||t>.8*n.length?Fe.numeric.call(this,e,t,n):""}};var Be={formatters:Fe};const $e=Object.create(null),He=Object.create(null);function We(e,t){if(!t)return e;const n=t.split(".");for(let t=0,r=n.length;t<r;++t){const r=n[t];e=e[r]||(e[r]=Object.create(null))}return e}function qe(e,t,n){return"string"==typeof t?K(We(e,t),n):K(We(e,""),t)}class Ve{constructor(e,t){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=e=>e.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(e,t)=>Le(t.backgroundColor),this.hoverBorderColor=(e,t)=>Le(t.borderColor),this.hoverColor=(e,t)=>Le(t.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e),this.apply(t)}set(e,t){return qe(this,e,t)}get(e){return We(this,e)}describe(e,t){return qe(He,e,t)}override(e,t){return qe($e,e,t)}route(e,t,n,r){const o=We(this,e),i=We(this,n),a="_"+t;Object.defineProperties(o,{[a]:{value:o[t],writable:!0},[t]:{enumerable:!0,get(){const e=this[a],t=i[r];return z(e)?Object.assign({},t,e):B(e,t)},set(e){this[a]=e}}})}apply(e){e.forEach((e=>e(this)))}}var Ue=new Ve({_scriptable:e=>!e.startsWith("on"),_indexable:e=>"events"!==e,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:e=>"onProgress"!==e&&"onComplete"!==e&&"fn"!==e}),e.set("animations",{colors:{type:"color",properties:Ne},numbers:{type:"number",properties:Ie}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:e=>0|e}}}})},function(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(e,t)=>t.lineWidth,tickColor:(e,t)=>t.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Be.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:e=>!e.startsWith("before")&&!e.startsWith("after")&&"callback"!==e&&"parser"!==e,_indexable:e=>"borderDash"!==e&&"tickBorderDash"!==e&&"dash"!==e}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:e=>"backdropPadding"!==e&&"callback"!==e,_indexable:e=>"backdropPadding"!==e})}]);function Ke(e,t,n,r,o){let i=t[o];return i||(i=t[o]=e.measureText(o).width,n.push(o)),i>r&&(r=i),r}function Qe(e,t,n){const r=e.currentDevicePixelRatio,o=0!==n?Math.max(n/2,.5):0;return Math.round((t-o)*r)/r+o}function Ge(e,t){(t||e)&&((t=t||e.getContext("2d")).save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function Ye(e,t,n,r){Ze(e,t,n,r,null)}function Ze(e,t,n,r,o){let i,a,s,l,c,u,h,f;const d=t.pointStyle,p=t.rotation,m=t.radius;let g=(p||0)*ie;if(d&&"object"==typeof d&&(i=d.toString(),"[object HTMLImageElement]"===i||"[object HTMLCanvasElement]"===i))return e.save(),e.translate(n,r),e.rotate(g),e.drawImage(d,-d.width/2,-d.height/2,d.width,d.height),void e.restore();if(!(isNaN(m)||m<=0)){switch(e.beginPath(),d){default:o?e.ellipse(n,r,o/2,m,0,0,re):e.arc(n,r,m,0,re),e.closePath();break;case"triangle":u=o?o/2:m,e.moveTo(n+Math.sin(g)*u,r-Math.cos(g)*m),g+=le,e.lineTo(n+Math.sin(g)*u,r-Math.cos(g)*m),g+=le,e.lineTo(n+Math.sin(g)*u,r-Math.cos(g)*m),e.closePath();break;case"rectRounded":c=.516*m,l=m-c,a=Math.cos(g+se)*l,h=Math.cos(g+se)*(o?o/2-c:l),s=Math.sin(g+se)*l,f=Math.sin(g+se)*(o?o/2-c:l),e.arc(n-h,r-s,c,g-ne,g-ae),e.arc(n+f,r-a,c,g-ae,g),e.arc(n+h,r+s,c,g,g+ae),e.arc(n-f,r+a,c,g+ae,g+ne),e.closePath();break;case"rect":if(!p){l=Math.SQRT1_2*m,u=o?o/2:l,e.rect(n-u,r-l,2*u,2*l);break}g+=se;case"rectRot":h=Math.cos(g)*(o?o/2:m),a=Math.cos(g)*m,s=Math.sin(g)*m,f=Math.sin(g)*(o?o/2:m),e.moveTo(n-h,r-s),e.lineTo(n+f,r-a),e.lineTo(n+h,r+s),e.lineTo(n-f,r+a),e.closePath();break;case"crossRot":g+=se;case"cross":h=Math.cos(g)*(o?o/2:m),a=Math.cos(g)*m,s=Math.sin(g)*m,f=Math.sin(g)*(o?o/2:m),e.moveTo(n-h,r-s),e.lineTo(n+h,r+s),e.moveTo(n+f,r-a),e.lineTo(n-f,r+a);break;case"star":h=Math.cos(g)*(o?o/2:m),a=Math.cos(g)*m,s=Math.sin(g)*m,f=Math.sin(g)*(o?o/2:m),e.moveTo(n-h,r-s),e.lineTo(n+h,r+s),e.moveTo(n+f,r-a),e.lineTo(n-f,r+a),g+=se,h=Math.cos(g)*(o?o/2:m),a=Math.cos(g)*m,s=Math.sin(g)*m,f=Math.sin(g)*(o?o/2:m),e.moveTo(n-h,r-s),e.lineTo(n+h,r+s),e.moveTo(n+f,r-a),e.lineTo(n-f,r+a);break;case"line":a=o?o/2:Math.cos(g)*m,s=Math.sin(g)*m,e.moveTo(n-a,r-s),e.lineTo(n+a,r+s);break;case"dash":e.moveTo(n,r),e.lineTo(n+Math.cos(g)*(o?o/2:m),r+Math.sin(g)*m);break;case!1:e.closePath()}e.fill(),t.borderWidth>0&&e.stroke()}}function Xe(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function Je(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function et(e){e.restore()}function tt(e,t,n,r,o){if(o.strikethrough||o.underline){const i=e.measureText(r),a=t-i.actualBoundingBoxLeft,s=t+i.actualBoundingBoxRight,l=n-i.actualBoundingBoxAscent,c=n+i.actualBoundingBoxDescent,u=o.strikethrough?(l+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=o.decorationWidth||2,e.moveTo(a,u),e.lineTo(s,u),e.stroke()}}function nt(e,t){const n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function rt(e,t,n,r,o,i={}){const a=N(t)?t:[t],s=i.strokeWidth>0&&""!==i.strokeColor;let l,c;for(e.save(),e.font=o.string,function(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),I(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}(e,i),l=0;l<a.length;++l)c=a[l],i.backdrop&&nt(e,i.backdrop),s&&(i.strokeColor&&(e.strokeStyle=i.strokeColor),I(i.strokeWidth)||(e.lineWidth=i.strokeWidth),e.strokeText(c,n,r,i.maxWidth)),e.fillText(c,n,r,i.maxWidth),tt(e,n,r,c,i),r+=Number(o.lineHeight);e.restore()}function ot(e,t){const{x:n,y:r,w:o,h:i,radius:a}=t;e.arc(n+a.topLeft,r+a.topLeft,a.topLeft,1.5*ne,ne,!0),e.lineTo(n,r+i-a.bottomLeft),e.arc(n+a.bottomLeft,r+i-a.bottomLeft,a.bottomLeft,ne,ae,!0),e.lineTo(n+o-a.bottomRight,r+i),e.arc(n+o-a.bottomRight,r+i-a.bottomRight,a.bottomRight,ae,0,!0),e.lineTo(n+o,r+a.topRight),e.arc(n+o-a.topRight,r+a.topRight,a.topRight,0,-ae,!0),e.lineTo(n+a.topLeft,r)}const it=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,at=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function st(e,t){const n=(""+e).match(it);if(!n||"normal"===n[1])return 1.2*t;switch(e=+n[2],n[3]){case"px":return e;case"%":e/=100}return t*e}const lt=e=>+e||0;function ct(e,t){const n={},r=z(t),o=r?Object.keys(t):t,i=z(e)?r?n=>B(e[n],e[t[n]]):t=>e[t]:()=>e;for(const e of o)n[e]=lt(i(e));return n}function ut(e){return ct(e,{top:"y",right:"x",bottom:"y",left:"x"})}function ht(e){return ct(e,["topLeft","topRight","bottomLeft","bottomRight"])}function ft(e){const t=ut(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function dt(e,t){e=e||{},t=t||Ue.font;let n=B(e.size,t.size);"string"==typeof n&&(n=parseInt(n,10));let r=B(e.style,t.style);r&&!(""+r).match(at)&&(console.warn('Invalid font style specified: "'+r+'"'),r=void 0);const o={family:B(e.family,t.family),lineHeight:st(B(e.lineHeight,t.lineHeight),n),size:n,style:r,weight:B(e.weight,t.weight),string:""};return o.string=function(e){return!e||I(e.size)||I(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}(o),o}function pt(e,t,n,r){let o,i,a,s=!0;for(o=0,i=e.length;o<i;++o)if(a=e[o],void 0!==a&&(void 0!==t&&"function"==typeof a&&(a=a(t),s=!1),void 0!==n&&N(a)&&(a=a[n%a.length],s=!1),void 0!==a))return r&&!s&&(r.cacheable=!1),a}function mt(e,t){return Object.assign(Object.create(e),t)}function gt(e,t=[""],n,r,o=(()=>e[0])){const i=n||e;void 0===r&&(r=Ct("_fallback",e));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:i,_fallback:r,_getTarget:o,override:n=>gt([n,...e],t,i,r)};return new Proxy(a,{deleteProperty:(t,n)=>(delete t[n],delete t._keys,delete e[0][n],!0),get:(n,r)=>wt(n,r,(()=>function(e,t,n,r){let o;for(const i of t)if(o=Ct(bt(i,e),n),void 0!==o)return xt(e,o)?_t(n,r,e,o):o}(r,t,e,n))),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(e._scopes[0],t),getPrototypeOf:()=>Reflect.getPrototypeOf(e[0]),has:(e,t)=>At(e).includes(t),ownKeys:e=>At(e),set(e,t,n){const r=e._storage||(e._storage=o());return e[t]=r[t]=n,delete e._keys,!0}})}function yt(e,t,n,r){const o={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:vt(e,r),setContext:t=>yt(e,t,n,r),override:o=>yt(e.override(o),t,n,r)};return new Proxy(o,{deleteProperty:(t,n)=>(delete t[n],delete e[n],!0),get:(e,t,n)=>wt(e,t,(()=>function(e,t,n){const{_proxy:r,_context:o,_subProxy:i,_descriptors:a}=e;let s=r[t];return ee(s)&&a.isScriptable(t)&&(s=function(e,t,n,r){const{_proxy:o,_context:i,_subProxy:a,_stack:s}=n;if(s.has(e))throw new Error("Recursion detected: "+Array.from(s).join("->")+"->"+e);s.add(e);let l=t(i,a||r);return s.delete(e),xt(e,l)&&(l=_t(o._scopes,o,e,l)),l}(t,s,e,n)),N(s)&&s.length&&(s=function(e,t,n,r){const{_proxy:o,_context:i,_subProxy:a,_descriptors:s}=n;if(void 0!==i.index&&r(e))return t[i.index%t.length];if(z(t[0])){const n=t,r=o._scopes.filter((e=>e!==n));t=[];for(const l of n){const n=_t(r,o,e,l);t.push(yt(n,i,a&&a[e],s))}}return t}(t,s,e,a.isIndexable)),xt(t,s)&&(s=yt(s,o,i&&i[t],a)),s}(e,t,n))),getOwnPropertyDescriptor:(t,n)=>t._descriptors.allKeys?Reflect.has(e,n)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,n),getPrototypeOf:()=>Reflect.getPrototypeOf(e),has:(t,n)=>Reflect.has(e,n),ownKeys:()=>Reflect.ownKeys(e),set:(t,n,r)=>(e[n]=r,delete t[n],!0)})}function vt(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:r=t.indexable,_allKeys:o=t.allKeys}=e;return{allKeys:o,scriptable:n,indexable:r,isScriptable:ee(n)?n:()=>n,isIndexable:ee(r)?r:()=>r}}const bt=(e,t)=>e?e+X(t):t,xt=(e,t)=>z(t)&&"adapters"!==e&&(null===Object.getPrototypeOf(t)||t.constructor===Object);function wt(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||"constructor"===t)return e[t];const r=n();return e[t]=r,r}function kt(e,t,n){return ee(e)?e(t,n):e}const St=(e,t)=>!0===e?t:"string"==typeof e?Z(t,e):void 0;function Ot(e,t,n,r,o){for(const i of t){const t=St(n,i);if(t){e.add(t);const i=kt(t._fallback,n,o);if(void 0!==i&&i!==n&&i!==r)return i}else if(!1===t&&void 0!==r&&n!==r)return null}return!1}function _t(e,t,n,r){const o=t._rootScopes,i=kt(t._fallback,n,r),a=[...e,...o],s=new Set;s.add(r);let l=Et(s,a,n,i||n,r);return null!==l&&(void 0===i||i===n||(l=Et(s,a,i,l,r),null!==l))&&gt(Array.from(s),[""],o,i,(()=>function(e,t,n){const r=e._getTarget();t in r||(r[t]={});const o=r[t];return N(o)&&z(n)?n:o||{}}(t,n,r)))}function Et(e,t,n,r,o){for(;n;)n=Ot(e,t,n,r,o);return n}function Ct(e,t){for(const n of t){if(!n)continue;const t=n[e];if(void 0!==t)return t}}function At(e){let t=e._keys;return t||(t=e._keys=function(e){const t=new Set;for(const n of e)for(const e of Object.keys(n).filter((e=>!e.startsWith("_"))))t.add(e);return Array.from(t)}(e._scopes)),t}function jt(){return"undefined"!=typeof window&&"undefined"!=typeof document}function Pt(e){let t=e.parentNode;return t&&"[object ShadowRoot]"===t.toString()&&(t=t.host),t}function Mt(e,t,n){let r;return"string"==typeof e?(r=parseInt(e,10),-1!==e.indexOf("%")&&(r=r/100*t.parentNode[n])):r=e,r}Number.EPSILON;const Rt=e=>e.ownerDocument.defaultView.getComputedStyle(e,null),Tt=["top","right","bottom","left"];function Lt(e,t,n){const r={};n=n?"-"+n:"";for(let o=0;o<4;o++){const i=Tt[o];r[i]=parseFloat(e[t+"-"+i+n])||0}return r.width=r.left+r.right,r.height=r.top+r.bottom,r}const It=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function Nt(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:r}=t,o=Rt(n),i="border-box"===o.boxSizing,a=Lt(o,"padding"),s=Lt(o,"border","width"),{x:l,y:c,box:u}=function(e,t){const n=e.touches,r=n&&n.length?n[0]:e,{offsetX:o,offsetY:i}=r;let a,s,l=!1;if(It(o,i,e.target))a=o,s=i;else{const e=t.getBoundingClientRect();a=r.clientX-e.left,s=r.clientY-e.top,l=!0}return{x:a,y:s,box:l}}(e,n),h=a.left+(u&&s.left),f=a.top+(u&&s.top);let{width:d,height:p}=t;return i&&(d-=a.width+s.width,p-=a.height+s.height),{x:Math.round((l-h)/d*n.width/r),y:Math.round((c-f)/p*n.height/r)}}const zt=e=>Math.round(10*e)/10;function Dt(e,t,n){const r=t||1,o=Math.floor(e.height*r),i=Math.floor(e.width*r);e.height=Math.floor(e.height),e.width=Math.floor(e.width);const a=e.canvas;return a.style&&(n||!a.style.height&&!a.style.width)&&(a.style.height=`${e.height}px`,a.style.width=`${e.width}px`),(e.currentDevicePixelRatio!==r||a.height!==o||a.width!==i)&&(e.currentDevicePixelRatio=r,a.height=o,a.width=i,e.ctx.setTransform(r,0,0,r,0,0),!0)}const Ft=function(){let e=!1;try{const t={get passive(){return e=!0,!1}};jt()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch(e){}return e}();function Bt(e,t){const n=function(e,t){return Rt(e).getPropertyValue(t)}(e,t),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?+r[1]:void 0}function $t(e,t,n){return e?function(e,t){return{x:n=>e+e+t-n,setWidth(e){t=e},textAlign:e=>"center"===e?e:"right"===e?"left":"right",xPlus:(e,t)=>e-t,leftForLtr:(e,t)=>e-t}}(t,n):{x:e=>e,setWidth(e){},textAlign:e=>e,xPlus:(e,t)=>e+t,leftForLtr:(e,t)=>e}}function Ht(e,t){let n,r;"ltr"!==t&&"rtl"!==t||(n=e.canvas.style,r=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=r)}function Wt(e,t){void 0!==t&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}class qt{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,n,r){const o=t.listeners[r],i=t.duration;o.forEach((r=>r({chart:e,initial:t.initial,numSteps:i,currentStep:Math.min(n-t.start,i)})))}_refresh(){this._request||(this._running=!0,this._request=Oe.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(e=Date.now()){let t=0;this._charts.forEach(((n,r)=>{if(!n.running||!n.items.length)return;const o=n.items;let i,a=o.length-1,s=!1;for(;a>=0;--a)i=o[a],i._active?(i._total>n.duration&&(n.duration=i._total),i.tick(e),s=!0):(o[a]=o[o.length-1],o.pop());s&&(r.draw(),this._notify(r,n,e,"progress")),o.length||(n.running=!1,this._notify(r,n,e,"complete"),n.initial=!1),t+=o.length})),this._lastDate=e,0===t&&(this._running=!1)}_getAnims(e){const t=this._charts;let n=t.get(e);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,n)),n}listen(e,t,n){this._getAnims(e).listeners[t].push(n)}add(e,t){t&&t.length&&this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){const t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce(((e,t)=>Math.max(e,t._duration)),0),this._refresh())}running(e){if(!this._running)return!1;const t=this._charts.get(e);return!!(t&&t.running&&t.items.length)}stop(e){const t=this._charts.get(e);if(!t||!t.items.length)return;const n=t.items;let r=n.length-1;for(;r>=0;--r)n[r].cancel();t.items=[],this._notify(e,t,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var Vt=new qt;const Ut="transparent",Kt={boolean:(e,t,n)=>n>.5?t:e,color(e,t,n){const r=Te(e||Ut),o=r.valid&&Te(t||Ut);return o&&o.valid?o.mix(r,n).hexString():t},number:(e,t,n)=>e+(t-e)*n};class Qt{constructor(e,t,n,r){const o=t[n];r=pt([e.to,r,o,e.from]);const i=pt([e.from,o,r]);this._active=!0,this._fn=e.fn||Kt[e.type||typeof i],this._easing=Me[e.easing]||Me.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=n,this._from=i,this._to=r,this._promises=void 0}active(){return this._active}update(e,t,n){if(this._active){this._notify(!1);const r=this._target[this._prop],o=n-this._start,i=this._duration-o;this._start=n,this._duration=Math.floor(Math.max(i,e.duration)),this._total+=o,this._loop=!!e.loop,this._to=pt([e.to,t,r,e.from]),this._from=pt([e.from,r,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const t=e-this._start,n=this._duration,r=this._prop,o=this._from,i=this._loop,a=this._to;let s;if(this._active=o!==a&&(i||t<n),!this._active)return this._target[r]=a,void this._notify(!0);t<0?this._target[r]=o:(s=t/n%2,s=i&&s>1?2-s:s,s=this._easing(Math.min(1,Math.max(0,s))),this._target[r]=this._fn(o,a,s))}wait(){const e=this._promises||(this._promises=[]);return new Promise(((t,n)=>{e.push({res:t,rej:n})}))}_notify(e){const t=e?"res":"rej",n=this._promises||[];for(let e=0;e<n.length;e++)n[e][t]()}}class Gt{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!z(e))return;const t=Object.keys(Ue.animation),n=this._properties;Object.getOwnPropertyNames(e).forEach((r=>{const o=e[r];if(!z(o))return;const i={};for(const e of t)i[e]=o[e];(N(o.properties)&&o.properties||[r]).forEach((e=>{e!==r&&n.has(e)||n.set(e,i)}))}))}_animateOptions(e,t){const n=t.options,r=function(e,t){if(!t)return;let n=e.options;if(n)return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n;e.options=t}(e,n);if(!r)return[];const o=this._createAnimations(r,n);return n.$shared&&function(e,t){const n=[],r=Object.keys(t);for(let t=0;t<r.length;t++){const o=e[r[t]];o&&o.active()&&n.push(o.wait())}return Promise.all(n)}(e.options.$animations,n).then((()=>{e.options=n}),(()=>{})),o}_createAnimations(e,t){const n=this._properties,r=[],o=e.$animations||(e.$animations={}),i=Object.keys(t),a=Date.now();let s;for(s=i.length-1;s>=0;--s){const l=i[s];if("$"===l.charAt(0))continue;if("options"===l){r.push(...this._animateOptions(e,t));continue}const c=t[l];let u=o[l];const h=n.get(l);if(u){if(h&&u.active()){u.update(h,c,a);continue}u.cancel()}h&&h.duration?(o[l]=u=new Qt(h,e,l,c),r.push(u)):e[l]=c}return r}update(e,t){if(0===this._properties.size)return void Object.assign(e,t);const n=this._createAnimations(e,t);return n.length?(Vt.add(this._chart,n),!0):void 0}}function Yt(e,t){const n=e&&e.options||{},r=n.reverse,o=void 0===n.min?t:0,i=void 0===n.max?t:0;return{start:r?i:o,end:r?o:i}}function Zt(e,t){const n=[],r=e._getSortedDatasetMetas(t);let o,i;for(o=0,i=r.length;o<i;++o)n.push(r[o].index);return n}function Xt(e,t,n,r={}){const o=e.keys,i="single"===r.mode;let a,s,l,c;if(null!==t){for(a=0,s=o.length;a<s;++a){if(l=+o[a],l===n){if(r.all)continue;break}c=e.values[l],D(c)&&(i||0===t||ue(t)===ue(c))&&(t+=c)}return t}}function Jt(e,t){const n=e&&e.options.stacked;return n||void 0===n&&void 0!==t.stack}function en(e,t,n){const r=e[t]||(e[t]={});return r[n]||(r[n]={})}function tn(e,t,n,r){for(const o of t.getMatchingVisibleMetas(r).reverse()){const t=e[o.index];if(n&&t>0||!n&&t<0)return o.index}return null}function nn(e,t){const{chart:n,_cachedMeta:r}=e,o=n._stacks||(n._stacks={}),{iScale:i,vScale:a,index:s}=r,l=i.axis,c=a.axis,u=function(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}(i,a,r),h=t.length;let f;for(let e=0;e<h;++e){const n=t[e],{[l]:i,[c]:h}=n;f=(n._stacks||(n._stacks={}))[c]=en(o,u,i),f[s]=h,f._top=tn(f,a,!0,r.type),f._bottom=tn(f,a,!1,r.type),(f._visualValues||(f._visualValues={}))[s]=h}}function rn(e,t){const n=e.scales;return Object.keys(n).filter((e=>n[e].axis===t)).shift()}function on(e,t){const n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t=t||e._parsed;for(const e of t){const t=e._stacks;if(!t||void 0===t[r]||void 0===t[r][n])return;delete t[r][n],void 0!==t[r]._visualValues&&void 0!==t[r]._visualValues[n]&&delete t[r]._visualValues[n]}}}const an=e=>"reset"===e||"none"===e,sn=(e,t)=>t?e:Object.assign({},e);class ln{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=Jt(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(e){this.index!==e&&on(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,t=this._cachedMeta,n=this.getDataset(),r=(e,t,n,r)=>"x"===e?t:"r"===e?r:n,o=t.xAxisID=B(n.xAxisID,rn(e,"x")),i=t.yAxisID=B(n.yAxisID,rn(e,"y")),a=t.rAxisID=B(n.rAxisID,rn(e,"r")),s=t.indexAxis,l=t.iAxisID=r(s,o,i,a),c=t.vAxisID=r(s,i,o,a);t.xScale=this.getScaleForId(o),t.yScale=this.getScaleForId(i),t.rScale=this.getScaleForId(a),t.iScale=this.getScaleForId(l),t.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&Se(this._data,this),e._stacked&&on(e)}_dataCheck(){const e=this.getDataset(),t=e.data||(e.data=[]),n=this._data;if(z(t)){const e=this._cachedMeta;this._data=function(e,t){const{iScale:n,vScale:r}=t,o="x"===n.axis?"x":"y",i="x"===r.axis?"x":"y",a=Object.keys(e),s=new Array(a.length);let l,c,u;for(l=0,c=a.length;l<c;++l)u=a[l],s[l]={[o]:u,[i]:e[u]};return s}(t,e)}else if(n!==t){if(n){Se(n,this);const e=this._cachedMeta;on(e),e._parsed=[]}t&&Object.isExtensible(t)&&(this,(r=t)._chartjs?r._chartjs.listeners.push(this):(Object.defineProperty(r,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[this]}}),ke.forEach((e=>{const t="_onData"+X(e),n=r[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,value(...e){const o=n.apply(this,e);return r._chartjs.listeners.forEach((n=>{"function"==typeof n[t]&&n[t](...e)})),o}})})))),this._syncList=[],this._data=t}var r}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const t=this._cachedMeta,n=this.getDataset();let r=!1;this._dataCheck();const o=t._stacked;t._stacked=Jt(t.vScale,t),t.stack!==n.stack&&(r=!0,on(t),t.stack=n.stack),this._resyncElements(e),(r||o!==t._stacked)&&nn(this,t._parsed)}configure(){const e=this.chart.config,t=e.datasetScopeKeys(this._type),n=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){const{_cachedMeta:n,_data:r}=this,{iScale:o,_stacked:i}=n,a=o.axis;let s,l,c,u=0===e&&t===r.length||n._sorted,h=e>0&&n._parsed[e-1];if(!1===this._parsing)n._parsed=r,n._sorted=!0,c=r;else{c=N(r[e])?this.parseArrayData(n,r,e,t):z(r[e])?this.parseObjectData(n,r,e,t):this.parsePrimitiveData(n,r,e,t);const o=()=>null===l[a]||h&&l[a]<h[a];for(s=0;s<t;++s)n._parsed[s+e]=l=c[s],u&&(o()&&(u=!1),h=l);n._sorted=u}i&&nn(this,c)}parsePrimitiveData(e,t,n,r){const{iScale:o,vScale:i}=e,a=o.axis,s=i.axis,l=o.getLabels(),c=o===i,u=new Array(r);let h,f,d;for(h=0,f=r;h<f;++h)d=h+n,u[h]={[a]:c||o.parse(l[d],d),[s]:i.parse(t[d],d)};return u}parseArrayData(e,t,n,r){const{xScale:o,yScale:i}=e,a=new Array(r);let s,l,c,u;for(s=0,l=r;s<l;++s)c=s+n,u=t[c],a[s]={x:o.parse(u[0],c),y:i.parse(u[1],c)};return a}parseObjectData(e,t,n,r){const{xScale:o,yScale:i}=e,{xAxisKey:a="x",yAxisKey:s="y"}=this._parsing,l=new Array(r);let c,u,h,f;for(c=0,u=r;c<u;++c)h=c+n,f=t[h],l[c]={x:o.parse(Z(f,a),h),y:i.parse(Z(f,s),h)};return l}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,t,n){const r=this.chart,o=this._cachedMeta,i=t[e.axis];return Xt({keys:Zt(r,!0),values:t._stacks[e.axis]._visualValues},i,o.index,{mode:n})}updateRangeFromParsed(e,t,n,r){const o=n[t.axis];let i=null===o?NaN:o;const a=r&&n._stacks[t.axis];r&&a&&(r.values=a,i=Xt(r,o,this._cachedMeta.index)),e.min=Math.min(e.min,i),e.max=Math.max(e.max,i)}getMinMax(e,t){const n=this._cachedMeta,r=n._parsed,o=n._sorted&&e===n.iScale,i=r.length,a=this._getOtherScale(e),s=((e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:Zt(n,!0),values:null})(t,n,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:u}=function(e){const{min:t,max:n,minDefined:r,maxDefined:o}=e.getUserBounds();return{min:r?t:Number.NEGATIVE_INFINITY,max:o?n:Number.POSITIVE_INFINITY}}(a);let h,f;function d(){f=r[h];const t=f[a.axis];return!D(f[e.axis])||c>t||u<t}for(h=0;h<i&&(d()||(this.updateRangeFromParsed(l,e,f,s),!o));++h);if(o)for(h=i-1;h>=0;--h)if(!d()){this.updateRangeFromParsed(l,e,f,s);break}return l}getAllParsedValues(e){const t=this._cachedMeta._parsed,n=[];let r,o,i;for(r=0,o=t.length;r<o;++r)i=t[r][e.axis],D(i)&&n.push(i);return n}getMaxOverflow(){return!1}getLabelAndValue(e){const t=this._cachedMeta,n=t.iScale,r=t.vScale,o=this.getParsed(e);return{label:n?""+n.getLabelForValue(o[n.axis]):"",value:r?""+r.getLabelForValue(o[r.axis]):""}}_update(e){const t=this._cachedMeta;this.update(e||"default"),t._clip=function(e){let t,n,r,o;return z(e)?(t=e.top,n=e.right,r=e.bottom,o=e.left):t=n=r=o=e,{top:t,right:n,bottom:r,left:o,disabled:!1===e}}(B(this.options.clip,function(e,t,n){if(!1===n)return!1;const r=Yt(e,n),o=Yt(t,n);return{top:o.end,right:r.end,bottom:o.start,left:r.start}}(t.xScale,t.yScale,this.getMaxOverflow())))}update(e){}draw(){const e=this._ctx,t=this.chart,n=this._cachedMeta,r=n.data||[],o=t.chartArea,i=[],a=this._drawStart||0,s=this._drawCount||r.length-a,l=this.options.drawActiveElementsOnTop;let c;for(n.dataset&&n.dataset.draw(e,o,a,s),c=a;c<a+s;++c){const t=r[c];t.hidden||(t.active&&l?i.push(t):t.draw(e,o))}for(c=0;c<i.length;++c)i[c].draw(e,o)}getStyle(e,t){const n=t?"active":"default";return void 0===e&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(e||0,n)}getContext(e,t,n){const r=this.getDataset();let o;if(e>=0&&e<this._cachedMeta.data.length){const t=this._cachedMeta.data[e];o=t.$context||(t.$context=function(e,t,n){return mt(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}(this.getContext(),e,t)),o.parsed=this.getParsed(e),o.raw=r.data[e],o.index=o.dataIndex=e}else o=this.$context||(this.$context=function(e,t){return mt(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),o.dataset=r,o.index=o.datasetIndex=this.index;return o.active=!!t,o.mode=n,o}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,t){return this._resolveElementOptions(this.dataElementType.id,t,e)}_resolveElementOptions(e,t="default",n){const r="active"===t,o=this._cachedDataOpts,i=e+"-"+t,a=o[i],s=this.enableOptionSharing&&J(n);if(a)return sn(a,s);const l=this.chart.config,c=l.datasetElementScopeKeys(this._type,e),u=r?[`${e}Hover`,"hover",e,""]:[e,""],h=l.getOptionScopes(this.getDataset(),c),f=Object.keys(Ue.elements[e]),d=l.resolveNamedOptions(h,f,(()=>this.getContext(n,r,t)),u);return d.$shared&&(d.$shared=s,o[i]=Object.freeze(sn(d,s))),d}_resolveAnimations(e,t,n){const r=this.chart,o=this._cachedDataOpts,i=`animation-${t}`,a=o[i];if(a)return a;let s;if(!1!==r.options.animation){const r=this.chart.config,o=r.datasetAnimationScopeKeys(this._type,t),i=r.getOptionScopes(this.getDataset(),o);s=r.createResolver(i,this.getContext(e,n,t))}const l=new Gt(r,s&&s.animations);return s&&s._cacheable&&(o[i]=Object.freeze(l)),l}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,t){return!t||an(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){const n=this.resolveDataElementOptions(e,t),r=this._sharedOptions,o=this.getSharedOptions(n),i=this.includeOptions(t,o)||o!==r;return this.updateSharedOptions(o,t,n),{sharedOptions:o,includeOptions:i}}updateElement(e,t,n,r){an(r)?Object.assign(e,n):this._resolveAnimations(t,r).update(e,n)}updateSharedOptions(e,t,n){e&&!an(t)&&this._resolveAnimations(void 0,t).update(e,n)}_setStyle(e,t,n,r){e.active=r;const o=this.getStyle(t,r);this._resolveAnimations(t,n,r).update(e,{options:!r&&this.getSharedOptions(o)||o})}removeHoverStyle(e,t,n){this._setStyle(e,n,"active",!1)}setHoverStyle(e,t,n){this._setStyle(e,n,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const t=this._data,n=this._cachedMeta.data;for(const[e,t,n]of this._syncList)this[e](t,n);this._syncList=[];const r=n.length,o=t.length,i=Math.min(o,r);i&&this.parse(0,i),o>r?this._insertElements(r,o-r,e):o<r&&this._removeElements(o,r-o)}_insertElements(e,t,n=!0){const r=this._cachedMeta,o=r.data,i=e+t;let a;const s=e=>{for(e.length+=t,a=e.length-1;a>=i;a--)e[a]=e[a-t]};for(s(o),a=e;a<i;++a)o[a]=new this.dataElementType;this._parsing&&s(r._parsed),this.parse(e,t),n&&this.updateElements(o,e,t,"reset")}updateElements(e,t,n,r){}_removeElements(e,t){const n=this._cachedMeta;if(this._parsing){const r=n._parsed.splice(e,t);n._stacked&&on(n,r)}n.data.splice(e,t)}_sync(e){if(this._parsing)this._syncList.push(e);else{const[t,n,r]=e;this[t](n,r)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){const e=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-e,e])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(e,t){t&&this._sync(["_removeElements",e,t]);const n=arguments.length-2;n&&this._sync(["_insertElements",e,n])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function cn(e){const t=e.iScale,n=function(e,t){if(!e._cache.$bar){const n=e.getMatchingVisibleMetas(t);let r=[];for(let t=0,o=n.length;t<o;t++)r=r.concat(n[t].controller.getAllParsedValues(e));e._cache.$bar=function(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}(r.sort(((e,t)=>e-t)))}return e._cache.$bar}(t,e.type);let r,o,i,a,s=t._length;const l=()=>{32767!==i&&-32768!==i&&(J(a)&&(s=Math.min(s,Math.abs(i-a)||s)),a=i)};for(r=0,o=n.length;r<o;++r)i=t.getPixelForValue(n[r]),l();for(a=void 0,r=0,o=t.ticks.length;r<o;++r)i=t.getPixelForTick(r),l();return s}function un(e,t,n,r){return N(e)?function(e,t,n,r){const o=n.parse(e[0],r),i=n.parse(e[1],r),a=Math.min(o,i),s=Math.max(o,i);let l=a,c=s;Math.abs(a)>Math.abs(s)&&(l=s,c=a),t[n.axis]=c,t._custom={barStart:l,barEnd:c,start:o,end:i,min:a,max:s}}(e,t,n,r):t[n.axis]=n.parse(e,r),t}function hn(e,t,n,r){const o=e.iScale,i=e.vScale,a=o.getLabels(),s=o===i,l=[];let c,u,h,f;for(c=n,u=n+r;c<u;++c)f=t[c],h={},h[o.axis]=s||o.parse(a[c],c),l.push(un(f,h,i,c));return l}function fn(e){return e&&void 0!==e.barStart&&void 0!==e.barEnd}function dn(e,t,n,r){let o=t.borderSkipped;const i={};if(!o)return void(e.borderSkipped=i);if(!0===o)return void(e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:a,end:s,reverse:l,top:c,bottom:u}=function(e){let t,n,r,o,i;return e.horizontal?(t=e.base>e.x,n="left",r="right"):(t=e.base<e.y,n="bottom",r="top"),t?(o="end",i="start"):(o="start",i="end"),{start:n,end:r,reverse:t,top:o,bottom:i}}(e);"middle"===o&&n&&(e.enableBorderRadius=!0,(n._top||0)===r?o=c:(n._bottom||0)===r?o=u:(i[pn(u,a,s,l)]=!0,o=c)),i[pn(o,a,s,l)]=!0,e.borderSkipped=i}function pn(e,t,n,r){var o,i,a;return r?(a=n,e=mn(e=(o=e)===(i=t)?a:o===a?i:o,n,t)):e=mn(e,t,n),e}function mn(e,t,n){return"start"===e?t:"end"===e?n:e}function gn(e,{inflateAmount:t},n){e.inflateAmount="auto"===t?1===n?.33:0:t}class yn extends ln{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(e,t,n,r){return hn(e,t,n,r)}parseArrayData(e,t,n,r){return hn(e,t,n,r)}parseObjectData(e,t,n,r){const{iScale:o,vScale:i}=e,{xAxisKey:a="x",yAxisKey:s="y"}=this._parsing,l="x"===o.axis?a:s,c="x"===i.axis?a:s,u=[];let h,f,d,p;for(h=n,f=n+r;h<f;++h)p=t[h],d={},d[o.axis]=o.parse(Z(p,l),h),u.push(un(Z(p,c),d,i,h));return u}updateRangeFromParsed(e,t,n,r){super.updateRangeFromParsed(e,t,n,r);const o=n._custom;o&&t===this._cachedMeta.vScale&&(e.min=Math.min(e.min,o.min),e.max=Math.max(e.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(e){const t=this._cachedMeta,{iScale:n,vScale:r}=t,o=this.getParsed(e),i=o._custom,a=fn(i)?"["+i.start+", "+i.end+"]":""+r.getLabelForValue(o[r.axis]);return{label:""+n.getLabelForValue(o[n.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize(),this._cachedMeta.stack=this.getDataset().stack}update(e){const t=this._cachedMeta;this.updateElements(t.data,0,t.data.length,e)}updateElements(e,t,n,r){const o="reset"===r,{index:i,_cachedMeta:{vScale:a}}=this,s=a.getBasePixel(),l=a.isHorizontal(),c=this._getRuler(),{sharedOptions:u,includeOptions:h}=this._getSharedOptions(t,r);for(let f=t;f<t+n;f++){const t=this.getParsed(f),n=o||I(t[a.axis])?{base:s,head:s}:this._calculateBarValuePixels(f),d=this._calculateBarIndexPixels(f,c),p=(t._stacks||{})[a.axis],m={horizontal:l,base:n.base,enableBorderRadius:!p||fn(t._custom)||i===p._top||i===p._bottom,x:l?n.head:d.center,y:l?d.center:n.head,height:l?d.size:Math.abs(n.size),width:l?Math.abs(n.size):d.size};h&&(m.options=u||this.resolveDataElementOptions(f,e[f].active?"active":r));const g=m.options||e[f].options;dn(m,g,p,i),gn(m,g,c.ratio),this.updateElement(e[f],f,m,r)}}_getStacks(e,t){const{iScale:n}=this._cachedMeta,r=n.getMatchingVisibleMetas(this._type).filter((e=>e.controller.options.grouped)),o=n.options.stacked,i=[],a=this._cachedMeta.controller.getParsed(t),s=a&&a[n.axis],l=e=>{const t=e._parsed.find((e=>e[n.axis]===s)),r=t&&t[e.vScale.axis];if(I(r)||isNaN(r))return!0};for(const n of r)if((void 0===t||!l(n))&&((!1===o||-1===i.indexOf(n.stack)||void 0===o&&void 0===n.stack)&&i.push(n.stack),n.index===e))break;return i.length||i.push(void 0),i}_getStackCount(e){return this._getStacks(void 0,e).length}_getStackIndex(e,t,n){const r=this._getStacks(e,n),o=void 0!==t?r.indexOf(t):-1;return-1===o?r.length-1:o}_getRuler(){const e=this.options,t=this._cachedMeta,n=t.iScale,r=[];let o,i;for(o=0,i=t.data.length;o<i;++o)r.push(n.getPixelForValue(this.getParsed(o)[n.axis],o));const a=e.barThickness;return{min:a||cn(t),pixels:r,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:e.grouped,ratio:a?1:e.categoryPercentage*e.barPercentage}}_calculateBarValuePixels(e){const{_cachedMeta:{vScale:t,_stacked:n,index:r},options:{base:o,minBarLength:i}}=this,a=o||0,s=this.getParsed(e),l=s._custom,c=fn(l);let u,h,f=s[t.axis],d=0,p=n?this.applyStack(t,s,n):f;p!==f&&(d=p-f,p=f),c&&(f=l.barStart,p=l.barEnd-l.barStart,0!==f&&ue(f)!==ue(l.barEnd)&&(d=0),d+=f);const m=I(o)||c?d:o;let g=t.getPixelForValue(m);if(u=this.chart.getDataVisibility(e)?t.getPixelForValue(d+p):g,h=u-g,Math.abs(h)<i){h=function(e,t,n){return 0!==e?ue(e):(t.isHorizontal()?1:-1)*(t.min>=n?1:-1)}(h,t,a)*i,f===a&&(g-=h/2);const e=t.getPixelForDecimal(0),o=t.getPixelForDecimal(1),l=Math.min(e,o),d=Math.max(e,o);g=Math.max(Math.min(g,d),l),u=g+h,n&&!c&&(s._stacks[t.axis]._visualValues[r]=t.getValueForPixel(u)-t.getValueForPixel(g))}if(g===t.getPixelForValue(a)){const e=ue(h)*t.getLineWidthForValue(a)/2;g+=e,h-=e}return{size:h,base:g,head:u,center:u+h/2}}_calculateBarIndexPixels(e,t){const n=t.scale,r=this.options,o=r.skipNull,i=B(r.maxBarThickness,1/0);let a,s;if(t.grouped){const n=o?this._getStackCount(e):t.stackCount,l="flex"===r.barThickness?function(e,t,n,r){const o=t.pixels,i=o[e];let a=e>0?o[e-1]:null,s=e<o.length-1?o[e+1]:null;const l=n.categoryPercentage;null===a&&(a=i-(null===s?t.end-t.start:s-i)),null===s&&(s=i+i-a);const c=i-(i-Math.min(a,s))/2*l;return{chunk:Math.abs(s-a)/2*l/r,ratio:n.barPercentage,start:c}}(e,t,r,n):function(e,t,n,r){const o=n.barThickness;let i,a;return I(o)?(i=t.min*n.categoryPercentage,a=n.barPercentage):(i=o*r,a=1),{chunk:i/r,ratio:a,start:t.pixels[e]-i/2}}(e,t,r,n),c=this._getStackIndex(this.index,this._cachedMeta.stack,o?e:void 0);a=l.start+l.chunk*c+l.chunk/2,s=Math.min(i,l.chunk*l.ratio)}else a=n.getPixelForValue(this.getParsed(e)[n.axis],e),s=Math.min(i,t.min*t.ratio);return{base:a-s/2,head:a+s/2,center:a,size:s}}draw(){const e=this._cachedMeta,t=e.vScale,n=e.data,r=n.length;let o=0;for(;o<r;++o)null===this.getParsed(o)[t.axis]||n[o].hidden||n[o].draw(this._ctx)}}function vn(e,t,n,r){const{controller:o,data:i,_sorted:a}=e,s=o._cachedMeta.iScale;if(s&&t===s.axis&&"r"!==t&&a&&i.length){const e=s._reversePixels?we:xe;if(!r)return e(i,t,n);if(o._sharedOptions){const r=i[0],o="function"==typeof r.getRange&&r.getRange(t);if(o){const r=e(i,t,n-o),a=e(i,t,n+o);return{lo:r.lo,hi:a.hi}}}}return{lo:0,hi:i.length-1}}function bn(e,t,n,r,o){const i=e.getSortedVisibleDatasetMetas(),a=n[t];for(let e=0,n=i.length;e<n;++e){const{index:n,data:s}=i[e],{lo:l,hi:c}=vn(i[e],t,a,o);for(let e=l;e<=c;++e){const t=s[e];t.skip||r(t,n,e)}}}function xn(e,t,n,r,o){const i=[];return o||e.isPointInArea(t)?(bn(e,n,t,(function(n,a,s){(o||Xe(n,e.chartArea,0))&&n.inRange(t.x,t.y,r)&&i.push({element:n,datasetIndex:a,index:s})}),!0),i):i}function wn(e,t,n,r,o,i){return i||e.isPointInArea(t)?"r"!==n||r?function(e,t,n,r,o,i){let a=[];const s=function(e){const t=-1!==e.indexOf("x"),n=-1!==e.indexOf("y");return function(e,r){const o=t?Math.abs(e.x-r.x):0,i=n?Math.abs(e.y-r.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(i,2))}}(n);let l=Number.POSITIVE_INFINITY;return bn(e,n,t,(function(n,c,u){const h=n.inRange(t.x,t.y,o);if(r&&!h)return;const f=n.getCenterPoint(o);if(!i&&!e.isPointInArea(f)&&!h)return;const d=s(t,f);d<l?(a=[{element:n,datasetIndex:c,index:u}],l=d):d===l&&a.push({element:n,datasetIndex:c,index:u})})),a}(e,t,n,r,o,i):function(e,t,n,r){let o=[];return bn(e,n,t,(function(e,n,i){const{startAngle:a,endAngle:s}=e.getProps(["startAngle","endAngle"],r),{angle:l}=function(e,t){const n=t.x-e.x,r=t.y-e.y,o=Math.sqrt(n*n+r*r);let i=Math.atan2(r,n);return i<-.5*ne&&(i+=re),{angle:i,distance:o}}(e,{x:t.x,y:t.y});(function(e,t,n,r){const o=ge(e),i=ge(t),a=ge(n),s=ge(i-o),l=ge(a-o),c=ge(o-i),u=ge(o-a);return o===i||o===a||r&&i===a||s>l&&c<u})(l,a,s)&&o.push({element:e,datasetIndex:n,index:i})})),o}(e,t,n,o):[]}function kn(e,t,n,r,o){const i=[],a="x"===n?"inXRange":"inYRange";let s=!1;return bn(e,n,t,((e,r,l)=>{e[a]&&e[a](t[n],o)&&(i.push({element:e,datasetIndex:r,index:l}),s=s||e.inRange(t.x,t.y,o))})),r&&!s?[]:i}var Sn={evaluateInteractionItems:bn,modes:{index(e,t,n,r){const o=Nt(t,e),i=n.axis||"x",a=n.includeInvisible||!1,s=n.intersect?xn(e,o,i,r,a):wn(e,o,i,!1,r,a),l=[];return s.length?(e.getSortedVisibleDatasetMetas().forEach((e=>{const t=s[0].index,n=e.data[t];n&&!n.skip&&l.push({element:n,datasetIndex:e.index,index:t})})),l):[]},dataset(e,t,n,r){const o=Nt(t,e),i=n.axis||"xy",a=n.includeInvisible||!1;let s=n.intersect?xn(e,o,i,r,a):wn(e,o,i,!1,r,a);if(s.length>0){const t=s[0].datasetIndex,n=e.getDatasetMeta(t).data;s=[];for(let e=0;e<n.length;++e)s.push({element:n[e],datasetIndex:t,index:e})}return s},point:(e,t,n,r)=>xn(e,Nt(t,e),n.axis||"xy",r,n.includeInvisible||!1),nearest(e,t,n,r){const o=Nt(t,e),i=n.axis||"xy",a=n.includeInvisible||!1;return wn(e,o,i,n.intersect,r,a)},x:(e,t,n,r)=>kn(e,Nt(t,e),"x",n.intersect,r),y:(e,t,n,r)=>kn(e,Nt(t,e),"y",n.intersect,r)}};const On=["left","top","right","bottom"];function _n(e,t){return e.filter((e=>e.pos===t))}function En(e,t){return e.filter((e=>-1===On.indexOf(e.pos)&&e.box.axis===t))}function Cn(e,t){return e.sort(((e,n)=>{const r=t?n:e,o=t?e:n;return r.weight===o.weight?r.index-o.index:r.weight-o.weight}))}function An(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function jn(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function Pn(e,t,n,r){const{pos:o,box:i}=n,a=e.maxPadding;if(!z(o)){n.size&&(e[o]-=n.size);const t=r[n.stack]||{size:0,count:1};t.size=Math.max(t.size,n.horizontal?i.height:i.width),n.size=t.size/t.count,e[o]+=n.size}i.getPadding&&jn(a,i.getPadding());const s=Math.max(0,t.outerWidth-An(a,e,"left","right")),l=Math.max(0,t.outerHeight-An(a,e,"top","bottom")),c=s!==e.w,u=l!==e.h;return e.w=s,e.h=l,n.horizontal?{same:c,other:u}:{same:u,other:c}}function Mn(e,t){const n=t.maxPadding;return function(e){const r={left:0,top:0,right:0,bottom:0};return e.forEach((e=>{r[e]=Math.max(t[e],n[e])})),r}(e?["left","right"]:["top","bottom"])}function Rn(e,t,n,r){const o=[];let i,a,s,l,c,u;for(i=0,a=e.length,c=0;i<a;++i){s=e[i],l=s.box,l.update(s.width||t.w,s.height||t.h,Mn(s.horizontal,t));const{same:a,other:h}=Pn(t,n,s,r);c|=a&&o.length,u=u||h,l.fullSize||o.push(s)}return c&&Rn(o,t,n,r)||u}function Tn(e,t,n,r,o){e.top=n,e.left=t,e.right=t+r,e.bottom=n+o,e.width=r,e.height=o}function Ln(e,t,n,r){const o=n.padding;let{x:i,y:a}=t;for(const s of e){const e=s.box,l=r[s.stack]||{count:1,placed:0,weight:1},c=s.stackWeight/l.weight||1;if(s.horizontal){const r=t.w*c,i=l.size||e.height;J(l.start)&&(a=l.start),e.fullSize?Tn(e,o.left,a,n.outerWidth-o.right-o.left,i):Tn(e,t.left+l.placed,a,r,i),l.start=a,l.placed+=r,a=e.bottom}else{const r=t.h*c,a=l.size||e.width;J(l.start)&&(i=l.start),e.fullSize?Tn(e,i,o.top,a,n.outerHeight-o.bottom-o.top):Tn(e,i,t.top+l.placed,a,r),l.start=i,l.placed+=r,i=e.right}}t.x=i,t.y=a}var In={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;-1!==n&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,r){if(!e)return;const o=ft(e.options.layout.padding),i=Math.max(t-o.width,0),a=Math.max(n-o.height,0),s=function(e){const t=function(e){const t=[];let n,r,o,i,a,s;for(n=0,r=(e||[]).length;n<r;++n)o=e[n],({position:i,options:{stack:a,stackWeight:s=1}}=o),t.push({index:n,box:o,pos:i,horizontal:o.isHorizontal(),weight:o.weight,stack:a&&i+a,stackWeight:s});return t}(e),n=Cn(t.filter((e=>e.box.fullSize)),!0),r=Cn(_n(t,"left"),!0),o=Cn(_n(t,"right")),i=Cn(_n(t,"top"),!0),a=Cn(_n(t,"bottom")),s=En(t,"x"),l=En(t,"y");return{fullSize:n,leftAndTop:r.concat(i),rightAndBottom:o.concat(l).concat(a).concat(s),chartArea:_n(t,"chartArea"),vertical:r.concat(o).concat(l),horizontal:i.concat(a).concat(s)}}(e.boxes),l=s.vertical,c=s.horizontal;H(e.boxes,(e=>{"function"==typeof e.beforeLayout&&e.beforeLayout()}));const u=l.reduce(((e,t)=>t.box.options&&!1===t.box.options.display?e:e+1),0)||1,h=Object.freeze({outerWidth:t,outerHeight:n,padding:o,availableWidth:i,availableHeight:a,vBoxMaxWidth:i/2/u,hBoxMaxHeight:a/2}),f=Object.assign({},o);jn(f,ft(r));const d=Object.assign({maxPadding:f,w:i,h:a,x:o.left,y:o.top},o),p=function(e,t){const n=function(e){const t={};for(const n of e){const{stack:e,pos:r,stackWeight:o}=n;if(!e||!On.includes(r))continue;const i=t[e]||(t[e]={count:0,placed:0,weight:0,size:0});i.count++,i.weight+=o}return t}(e),{vBoxMaxWidth:r,hBoxMaxHeight:o}=t;let i,a,s;for(i=0,a=e.length;i<a;++i){s=e[i];const{fullSize:a}=s.box,l=n[s.stack],c=l&&s.stackWeight/l.weight;s.horizontal?(s.width=c?c*r:a&&t.availableWidth,s.height=o):(s.width=r,s.height=c?c*o:a&&t.availableHeight)}return n}(l.concat(c),h);Rn(s.fullSize,d,h,p),Rn(l,d,h,p),Rn(c,d,h,p)&&Rn(l,d,h,p),function(e){const t=e.maxPadding;function n(n){const r=Math.max(t[n]-e[n],0);return e[n]+=r,r}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}(d),Ln(s.leftAndTop,d,h,p),d.x+=d.w,d.y+=d.h,Ln(s.rightAndBottom,d,h,p),e.chartArea={left:d.left,top:d.top,right:d.left+d.w,bottom:d.top+d.h,height:d.h,width:d.w},H(s.chartArea,(t=>{const n=t.box;Object.assign(n,e.chartArea),n.update(d.w,d.h,{left:0,top:0,right:0,bottom:0})}))}};class Nn{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,n){}removeEventListener(e,t,n){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,n,r){return t=Math.max(0,t||e.width),n=n||e.height,{width:t,height:Math.max(0,r?Math.floor(t/r):n)}}isAttached(e){return!0}updateConfig(e){}}class zn extends Nn{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const Dn="$chartjs",Fn={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Bn=e=>null===e||""===e,$n=!!Ft&&{passive:!0};function Hn(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,$n)}function Wn(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function qn(e,t,n){const r=e.canvas,o=new MutationObserver((e=>{let t=!1;for(const n of e)t=t||Wn(n.addedNodes,r),t=t&&!Wn(n.removedNodes,r);t&&n()}));return o.observe(document,{childList:!0,subtree:!0}),o}function Vn(e,t,n){const r=e.canvas,o=new MutationObserver((e=>{let t=!1;for(const n of e)t=t||Wn(n.removedNodes,r),t=t&&!Wn(n.addedNodes,r);t&&n()}));return o.observe(document,{childList:!0,subtree:!0}),o}const Un=new Map;let Kn=0;function Qn(){const e=window.devicePixelRatio;e!==Kn&&(Kn=e,Un.forEach(((t,n)=>{n.currentDevicePixelRatio!==e&&t()})))}function Gn(e,t,n){const r=e.canvas,o=r&&Pt(r);if(!o)return;const i=_e(((e,t)=>{const r=o.clientWidth;n(e,t),r<o.clientWidth&&n()}),window),a=new ResizeObserver((e=>{const t=e[0],n=t.contentRect.width,r=t.contentRect.height;0===n&&0===r||i(n,r)}));return a.observe(o),function(e,t){Un.size||window.addEventListener("resize",Qn),Un.set(e,t)}(e,i),a}function Yn(e,t,n){n&&n.disconnect(),"resize"===t&&function(e){Un.delete(e),Un.size||window.removeEventListener("resize",Qn)}(e)}function Zn(e,t,n){const r=e.canvas,o=_e((t=>{null!==e.ctx&&n(function(e,t){const n=Fn[e.type]||e.type,{x:r,y:o}=Nt(e,t);return{type:n,chart:t,native:e,x:void 0!==r?r:null,y:void 0!==o?o:null}}(t,e))}),e);return function(e,t,n){e&&e.addEventListener(t,n,$n)}(r,t,o),o}class Xn extends Nn{acquireContext(e,t){const n=e&&e.getContext&&e.getContext("2d");return n&&n.canvas===e?(function(e,t){const n=e.style,r=e.getAttribute("height"),o=e.getAttribute("width");if(e[Dn]={initial:{height:r,width:o,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",Bn(o)){const t=Bt(e,"width");void 0!==t&&(e.width=t)}if(Bn(r))if(""===e.style.height)e.height=e.width/(t||2);else{const t=Bt(e,"height");void 0!==t&&(e.height=t)}}(e,t),n):null}releaseContext(e){const t=e.canvas;if(!t[Dn])return!1;const n=t[Dn].initial;["height","width"].forEach((e=>{const r=n[e];I(r)?t.removeAttribute(e):t.setAttribute(e,r)}));const r=n.style||{};return Object.keys(r).forEach((e=>{t.style[e]=r[e]})),t.width=t.width,delete t[Dn],!0}addEventListener(e,t,n){this.removeEventListener(e,t);const r=e.$proxies||(e.$proxies={}),o={attach:qn,detach:Vn,resize:Gn}[t]||Zn;r[t]=o(e,t,n)}removeEventListener(e,t){const n=e.$proxies||(e.$proxies={}),r=n[t];r&&(({attach:Yn,detach:Yn,resize:Yn}[t]||Hn)(e,t,r),n[t]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,n,r){return function(e,t,n,r){const o=Rt(e),i=Lt(o,"margin"),a=Mt(o.maxWidth,e,"clientWidth")||oe,s=Mt(o.maxHeight,e,"clientHeight")||oe,l=function(e,t,n){let r,o;if(void 0===t||void 0===n){const i=e&&Pt(e);if(i){const e=i.getBoundingClientRect(),a=Rt(i),s=Lt(a,"border","width"),l=Lt(a,"padding");t=e.width-l.width-s.width,n=e.height-l.height-s.height,r=Mt(a.maxWidth,i,"clientWidth"),o=Mt(a.maxHeight,i,"clientHeight")}else t=e.clientWidth,n=e.clientHeight}return{width:t,height:n,maxWidth:r||oe,maxHeight:o||oe}}(e,t,n);let{width:c,height:u}=l;if("content-box"===o.boxSizing){const e=Lt(o,"border","width"),t=Lt(o,"padding");c-=t.width+e.width,u-=t.height+e.height}return c=Math.max(0,c-i.width),u=Math.max(0,r?c/r:u-i.height),c=zt(Math.min(c,a,l.maxWidth)),u=zt(Math.min(u,s,l.maxHeight)),c&&!u&&(u=zt(c/2)),(void 0!==t||void 0!==n)&&r&&l.height&&u>l.height&&(u=l.height,c=zt(Math.floor(u*r))),{width:c,height:u}}(e,t,n,r)}isAttached(e){const t=e&&Pt(e);return!(!t||!t.isConnected)}}class Jn{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(e){const{x:t,y:n}=this.getProps(["x","y"],e);return{x:t,y:n}}hasValue(){return de(this.x)&&de(this.y)}getProps(e,t){const n=this.$animations;if(!t||!n)return this;const r={};return e.forEach((e=>{r[e]=n[e]&&n[e].active()?n[e]._to:this[e]})),r}}function er(e,t,n,r,o){const i=B(r,0),a=Math.min(B(o,e.length),e.length);let s,l,c,u=0;for(n=Math.ceil(n),o&&(s=o-r,n=s/Math.floor(s/n)),c=i;c<0;)u++,c=Math.round(i+u*n);for(l=Math.max(i,0);l<a;l++)l===c&&(t.push(e[l]),u++,c=Math.round(i+u*n))}const tr=(e,t,n)=>"top"===t||"left"===t?e[t]+n:e[t]-n,nr=(e,t)=>Math.min(t||e,e);function rr(e,t){const n=[],r=e.length/t,o=e.length;let i=0;for(;i<o;i+=r)n.push(e[Math.floor(i)]);return n}function or(e,t,n){const r=e.ticks.length,o=Math.min(t,r-1),i=e._startPixel,a=e._endPixel,s=1e-6;let l,c=e.getPixelForTick(o);if(!(n&&(l=1===r?Math.max(c-i,a-c):0===t?(e.getPixelForTick(1)-c)/2:(c-e.getPixelForTick(o-1))/2,c+=o<t?l:-l,c<i-s||c>a+s)))return c}function ir(e){return e.drawTicks?e.tickLength:0}function ar(e,t){if(!e.display)return 0;const n=dt(e.font,t),r=ft(e.padding);return(N(e.text)?e.text.length:1)*n.lineHeight+r.height}function sr(e,t,n){let r=Ee(e);return(n&&"right"!==t||!n&&"right"===t)&&(r=(e=>"left"===e?"right":"right"===e?"left":e)(r)),r}class lr extends Jn{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,t){return e}getUserBounds(){let{_userMin:e,_userMax:t,_suggestedMin:n,_suggestedMax:r}=this;return e=F(e,Number.POSITIVE_INFINITY),t=F(t,Number.NEGATIVE_INFINITY),n=F(n,Number.POSITIVE_INFINITY),r=F(r,Number.NEGATIVE_INFINITY),{min:F(e,n),max:F(t,r),minDefined:D(e),maxDefined:D(t)}}getMinMax(e){let t,{min:n,max:r,minDefined:o,maxDefined:i}=this.getUserBounds();if(o&&i)return{min:n,max:r};const a=this.getMatchingVisibleMetas();for(let s=0,l=a.length;s<l;++s)t=a[s].controller.getMinMax(this,e),o||(n=Math.min(n,t.min)),i||(r=Math.max(r,t.max));return n=i&&n>r?r:n,r=o&&n>r?n:r,{min:F(n,F(r,n)),max:F(r,F(n,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){$(this.options.beforeUpdate,[this])}update(e,t,n){const{beginAtZero:r,grace:o,ticks:i}=this.options,a=i.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=function(e,t,n){const{min:r,max:o}=e,i=(l=(o-r)/2,"string"==typeof(s=t)&&s.endsWith("%")?parseFloat(s)/100*l:+s),a=(e,t)=>n&&0===e?0:e+t;var s,l;return{min:a(r,-Math.abs(i)),max:a(o,i)}}(this,o,r),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const s=a<this.ticks.length;this._convertTicksToLabels(s?rr(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),i.display&&(i.autoSkip||"auto"===i.source)&&(this.ticks=function(e,t){const n=e.options.ticks,r=function(e){const t=e.options.offset,n=e._tickSize(),r=e._length/n+(t?0:1),o=e._maxLength/n;return Math.floor(Math.min(r,o))}(e),o=Math.min(n.maxTicksLimit||r,r),i=n.major.enabled?function(e){const t=[];let n,r;for(n=0,r=e.length;n<r;n++)e[n].major&&t.push(n);return t}(t):[],a=i.length,s=i[0],l=i[a-1],c=[];if(a>o)return function(e,t,n,r){let o,i=0,a=n[0];for(r=Math.ceil(r),o=0;o<e.length;o++)o===a&&(t.push(e[o]),i++,a=n[i*r])}(t,c,i,a/o),c;const u=function(e,t,n){const r=function(e){const t=e.length;let n,r;if(t<2)return!1;for(r=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==r)return!1;return r}(e),o=t.length/n;if(!r)return Math.max(o,1);const i=function(e){const t=[],n=Math.sqrt(e);let r;for(r=1;r<n;r++)e%r==0&&(t.push(r),t.push(e/r));return n===(0|n)&&t.push(n),t.sort(((e,t)=>e-t)).pop(),t}(r);for(let e=0,t=i.length-1;e<t;e++){const t=i[e];if(t>o)return t}return Math.max(o,1)}(i,t,o);if(a>0){let e,n;const r=a>1?Math.round((l-s)/(a-1)):null;for(er(t,c,u,I(r)?0:s-r,s),e=0,n=a-1;e<n;e++)er(t,c,u,i[e],i[e+1]);return er(t,c,u,l,I(r)?t.length:l+r),c}return er(t,c,u),c}(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),s&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e,t,n=this.options.reverse;this.isHorizontal()?(e=this.left,t=this.right):(e=this.top,t=this.bottom,n=!n),this._startPixel=e,this._endPixel=t,this._reversePixels=n,this._length=t-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){$(this.options.afterUpdate,[this])}beforeSetDimensions(){$(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){$(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),$(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){$(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){const t=this.options.ticks;let n,r,o;for(n=0,r=e.length;n<r;n++)o=e[n],o.label=$(t.callback,[o.value,n,e],this)}afterTickToLabelConversion(){$(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){$(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const e=this.options,t=e.ticks,n=nr(this.ticks.length,e.ticks.maxTicksLimit),r=t.minRotation||0,o=t.maxRotation;let i,a,s,l=r;if(!this._isVisible()||!t.display||r>=o||n<=1||!this.isHorizontal())return void(this.labelRotation=r);const c=this._getLabelSizes(),u=c.widest.width,h=c.highest.height,f=ye(this.chart.width-u,0,this.maxWidth);i=e.offset?this.maxWidth/n:f/(n-1),u+6>i&&(i=f/(n-(e.offset?.5:1)),a=this.maxHeight-ir(e.grid)-t.padding-ar(e.title,this.chart.options.font),s=Math.sqrt(u*u+h*h),l=Math.min(Math.asin(ye((c.highest.height+6)/i,-1,1)),Math.asin(ye(a/s,-1,1))-Math.asin(ye(h/s,-1,1)))*(180/ne),l=Math.max(r,Math.min(o,l))),this.labelRotation=l}afterCalculateLabelRotation(){$(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){$(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:t,options:{ticks:n,title:r,grid:o}}=this,i=this._isVisible(),a=this.isHorizontal();if(i){const i=ar(r,t.options.font);if(a?(e.width=this.maxWidth,e.height=ir(o)+i):(e.height=this.maxHeight,e.width=ir(o)+i),n.display&&this.ticks.length){const{first:t,last:r,widest:o,highest:i}=this._getLabelSizes(),s=2*n.padding,l=pe(this.labelRotation),c=Math.cos(l),u=Math.sin(l);if(a){const t=n.mirror?0:u*o.width+c*i.height;e.height=Math.min(this.maxHeight,e.height+t+s)}else{const t=n.mirror?0:c*o.width+u*i.height;e.width=Math.min(this.maxWidth,e.width+t+s)}this._calculatePadding(t,r,u,c)}}this._handleMargins(),a?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,n,r){const{ticks:{align:o,padding:i},position:a}=this.options,s=0!==this.labelRotation,l="top"!==a&&"x"===this.axis;if(this.isHorizontal()){const a=this.getPixelForTick(0)-this.left,c=this.right-this.getPixelForTick(this.ticks.length-1);let u=0,h=0;s?l?(u=r*e.width,h=n*t.height):(u=n*e.height,h=r*t.width):"start"===o?h=t.width:"end"===o?u=e.width:"inner"!==o&&(u=e.width/2,h=t.width/2),this.paddingLeft=Math.max((u-a+i)*this.width/(this.width-a),0),this.paddingRight=Math.max((h-c+i)*this.width/(this.width-c),0)}else{let n=t.height/2,r=e.height/2;"start"===o?(n=0,r=e.height):"end"===o&&(n=t.height,r=0),this.paddingTop=n+i,this.paddingBottom=r+i}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){$(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:t}=this.options;return"top"===t||"bottom"===t||"x"===e}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){let t,n;for(this.beforeTickToLabelConversion(),this.generateTickLabels(e),t=0,n=e.length;t<n;t++)I(e[t].label)&&(e.splice(t,1),n--,t--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){const t=this.options.ticks.sampleSize;let n=this.ticks;t<n.length&&(n=rr(n,t)),this._labelSizes=e=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,t,n){const{ctx:r,_longestTextCache:o}=this,i=[],a=[],s=Math.floor(t/nr(t,n));let l,c,u,h,f,d,p,m,g,y,v,b=0,x=0;for(l=0;l<t;l+=s){if(h=e[l].label,f=this._resolveTickFontOptions(l),r.font=d=f.string,p=o[d]=o[d]||{data:{},gc:[]},m=f.lineHeight,g=y=0,I(h)||N(h)){if(N(h))for(c=0,u=h.length;c<u;++c)v=h[c],I(v)||N(v)||(g=Ke(r,p.data,p.gc,g,v),y+=m)}else g=Ke(r,p.data,p.gc,g,h),y=m;i.push(g),a.push(y),b=Math.max(g,b),x=Math.max(y,x)}!function(e,t){H(e,(e=>{const n=e.gc,r=n.length/2;let o;if(r>t){for(o=0;o<r;++o)delete e.data[n[o]];n.splice(0,r)}}))}(o,t);const w=i.indexOf(b),k=a.indexOf(x),S=e=>({width:i[e]||0,height:a[e]||0});return{first:S(0),last:S(t-1),widest:S(w),highest:S(k),widths:i,heights:a}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){const t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const t=this._startPixel+e*this._length;return ye(this._alignToPixels?Qe(this.chart,t,0):t,-32768,32767)}getDecimalForPixel(e){const t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){const t=this.ticks||[];if(e>=0&&e<t.length){const n=t[e];return n.$context||(n.$context=function(e,t,n){return mt(e,{tick:n,index:t,type:"tick"})}(this.getContext(),e,n))}return this.$context||(this.$context=mt(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const e=this.options.ticks,t=pe(this.labelRotation),n=Math.abs(Math.cos(t)),r=Math.abs(Math.sin(t)),o=this._getLabelSizes(),i=e.autoSkipPadding||0,a=o?o.widest.width+i:0,s=o?o.highest.height+i:0;return this.isHorizontal()?s*n>a*r?a/n:s/r:s*r<a*n?s/n:a/r}_isVisible(){const e=this.options.display;return"auto"!==e?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){const t=this.axis,n=this.chart,r=this.options,{grid:o,position:i,border:a}=r,s=o.offset,l=this.isHorizontal(),c=this.ticks.length+(s?1:0),u=ir(o),h=[],f=a.setContext(this.getContext()),d=f.display?f.width:0,p=d/2,m=function(e){return Qe(n,e,d)};let g,y,v,b,x,w,k,S,O,_,E,C;if("top"===i)g=m(this.bottom),w=this.bottom-u,S=g-p,_=m(e.top)+p,C=e.bottom;else if("bottom"===i)g=m(this.top),_=e.top,C=m(e.bottom)-p,w=g+p,S=this.top+u;else if("left"===i)g=m(this.right),x=this.right-u,k=g-p,O=m(e.left)+p,E=e.right;else if("right"===i)g=m(this.left),O=e.left,E=m(e.right)-p,x=g+p,k=this.left+u;else if("x"===t){if("center"===i)g=m((e.top+e.bottom)/2+.5);else if(z(i)){const e=Object.keys(i)[0],t=i[e];g=m(this.chart.scales[e].getPixelForValue(t))}_=e.top,C=e.bottom,w=g+p,S=w+u}else if("y"===t){if("center"===i)g=m((e.left+e.right)/2);else if(z(i)){const e=Object.keys(i)[0],t=i[e];g=m(this.chart.scales[e].getPixelForValue(t))}x=g-p,k=x-u,O=e.left,E=e.right}const A=B(r.ticks.maxTicksLimit,c),j=Math.max(1,Math.ceil(c/A));for(y=0;y<c;y+=j){const e=this.getContext(y),t=o.setContext(e),r=a.setContext(e),i=t.lineWidth,c=t.color,u=r.dash||[],f=r.dashOffset,d=t.tickWidth,p=t.tickColor,m=t.tickBorderDash||[],g=t.tickBorderDashOffset;v=or(this,y,s),void 0!==v&&(b=Qe(n,v,i),l?x=k=O=E=b:w=S=_=C=b,h.push({tx1:x,ty1:w,tx2:k,ty2:S,x1:O,y1:_,x2:E,y2:C,width:i,color:c,borderDash:u,borderDashOffset:f,tickWidth:d,tickColor:p,tickBorderDash:m,tickBorderDashOffset:g}))}return this._ticksLength=c,this._borderValue=g,h}_computeLabelItems(e){const t=this.axis,n=this.options,{position:r,ticks:o}=n,i=this.isHorizontal(),a=this.ticks,{align:s,crossAlign:l,padding:c,mirror:u}=o,h=ir(n.grid),f=h+c,d=u?-c:f,p=-pe(this.labelRotation),m=[];let g,y,v,b,x,w,k,S,O,_,E,C,A="middle";if("top"===r)w=this.bottom-d,k=this._getXAxisLabelAlignment();else if("bottom"===r)w=this.top+d,k=this._getXAxisLabelAlignment();else if("left"===r){const e=this._getYAxisLabelAlignment(h);k=e.textAlign,x=e.x}else if("right"===r){const e=this._getYAxisLabelAlignment(h);k=e.textAlign,x=e.x}else if("x"===t){if("center"===r)w=(e.top+e.bottom)/2+f;else if(z(r)){const e=Object.keys(r)[0],t=r[e];w=this.chart.scales[e].getPixelForValue(t)+f}k=this._getXAxisLabelAlignment()}else if("y"===t){if("center"===r)x=(e.left+e.right)/2-f;else if(z(r)){const e=Object.keys(r)[0],t=r[e];x=this.chart.scales[e].getPixelForValue(t)}k=this._getYAxisLabelAlignment(h).textAlign}"y"===t&&("start"===s?A="top":"end"===s&&(A="bottom"));const j=this._getLabelSizes();for(g=0,y=a.length;g<y;++g){v=a[g],b=v.label;const e=o.setContext(this.getContext(g));S=this.getPixelForTick(g)+o.labelOffset,O=this._resolveTickFontOptions(g),_=O.lineHeight,E=N(b)?b.length:1;const t=E/2,n=e.color,s=e.textStrokeColor,c=e.textStrokeWidth;let h,f=k;if(i?(x=S,"inner"===k&&(f=g===y-1?this.options.reverse?"left":"right":0===g?this.options.reverse?"right":"left":"center"),C="top"===r?"near"===l||0!==p?-E*_+_/2:"center"===l?-j.highest.height/2-t*_+_:-j.highest.height+_/2:"near"===l||0!==p?_/2:"center"===l?j.highest.height/2-t*_:j.highest.height-E*_,u&&(C*=-1),0===p||e.showLabelBackdrop||(x+=_/2*Math.sin(p))):(w=S,C=(1-E)*_/2),e.showLabelBackdrop){const t=ft(e.backdropPadding),n=j.heights[g],r=j.widths[g];let o=C-t.top,i=0-t.left;switch(A){case"middle":o-=n/2;break;case"bottom":o-=n}switch(k){case"center":i-=r/2;break;case"right":i-=r;break;case"inner":g===y-1?i-=r:g>0&&(i-=r/2)}h={left:i,top:o,width:r+t.width,height:n+t.height,color:e.backdropColor}}m.push({label:b,font:O,textOffset:C,options:{rotation:p,color:n,strokeColor:s,strokeWidth:c,textAlign:f,textBaseline:A,translation:[x,w],backdrop:h}})}return m}_getXAxisLabelAlignment(){const{position:e,ticks:t}=this.options;if(-pe(this.labelRotation))return"top"===e?"left":"right";let n="center";return"start"===t.align?n="left":"end"===t.align?n="right":"inner"===t.align&&(n="inner"),n}_getYAxisLabelAlignment(e){const{position:t,ticks:{crossAlign:n,mirror:r,padding:o}}=this.options,i=e+o,a=this._getLabelSizes().widest.width;let s,l;return"left"===t?r?(l=this.right+o,"near"===n?s="left":"center"===n?(s="center",l+=a/2):(s="right",l+=a)):(l=this.right-i,"near"===n?s="right":"center"===n?(s="center",l-=a/2):(s="left",l=this.left)):"right"===t?r?(l=this.left+o,"near"===n?s="right":"center"===n?(s="center",l-=a/2):(s="left",l-=a)):(l=this.left+i,"near"===n?s="left":"center"===n?(s="center",l+=a/2):(s="right",l=this.right)):s="right",{textAlign:s,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,t=this.options.position;return"left"===t||"right"===t?{top:0,left:this.left,bottom:e.height,right:this.right}:"top"===t||"bottom"===t?{top:this.top,left:0,bottom:this.bottom,right:e.width}:void 0}drawBackground(){const{ctx:e,options:{backgroundColor:t},left:n,top:r,width:o,height:i}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(n,r,o,i),e.restore())}getLineWidthForValue(e){const t=this.options.grid;if(!this._isVisible()||!t.display)return 0;const n=this.ticks.findIndex((t=>t.value===e));return n>=0?t.setContext(this.getContext(n)).lineWidth:0}drawGrid(e){const t=this.options.grid,n=this.ctx,r=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let o,i;const a=(e,t,r)=>{r.width&&r.color&&(n.save(),n.lineWidth=r.width,n.strokeStyle=r.color,n.setLineDash(r.borderDash||[]),n.lineDashOffset=r.borderDashOffset,n.beginPath(),n.moveTo(e.x,e.y),n.lineTo(t.x,t.y),n.stroke(),n.restore())};if(t.display)for(o=0,i=r.length;o<i;++o){const e=r[o];t.drawOnChartArea&&a({x:e.x1,y:e.y1},{x:e.x2,y:e.y2},e),t.drawTicks&&a({x:e.tx1,y:e.ty1},{x:e.tx2,y:e.ty2},{color:e.tickColor,width:e.tickWidth,borderDash:e.tickBorderDash,borderDashOffset:e.tickBorderDashOffset})}}drawBorder(){const{chart:e,ctx:t,options:{border:n,grid:r}}=this,o=n.setContext(this.getContext()),i=n.display?o.width:0;if(!i)return;const a=r.setContext(this.getContext(0)).lineWidth,s=this._borderValue;let l,c,u,h;this.isHorizontal()?(l=Qe(e,this.left,i)-i/2,c=Qe(e,this.right,a)+a/2,u=h=s):(u=Qe(e,this.top,i)-i/2,h=Qe(e,this.bottom,a)+a/2,l=c=s),t.save(),t.lineWidth=o.width,t.strokeStyle=o.color,t.beginPath(),t.moveTo(l,u),t.lineTo(c,h),t.stroke(),t.restore()}drawLabels(e){if(!this.options.ticks.display)return;const t=this.ctx,n=this._computeLabelArea();n&&Je(t,n);const r=this.getLabelItems(e);for(const e of r){const n=e.options,r=e.font;rt(t,e.label,0,e.textOffset,r,n)}n&&et(t)}drawTitle(){const{ctx:e,options:{position:t,title:n,reverse:r}}=this;if(!n.display)return;const o=dt(n.font),i=ft(n.padding),a=n.align;let s=o.lineHeight/2;"bottom"===t||"center"===t||z(t)?(s+=i.bottom,N(n.text)&&(s+=o.lineHeight*(n.text.length-1))):s+=i.top;const{titleX:l,titleY:c,maxWidth:u,rotation:h}=function(e,t,n,r){const{top:o,left:i,bottom:a,right:s,chart:l}=e,{chartArea:c,scales:u}=l;let h,f,d,p=0;const m=a-o,g=s-i;if(e.isHorizontal()){if(f=Ce(r,i,s),z(n)){const e=Object.keys(n)[0],r=n[e];d=u[e].getPixelForValue(r)+m-t}else d="center"===n?(c.bottom+c.top)/2+m-t:tr(e,n,t);h=s-i}else{if(z(n)){const e=Object.keys(n)[0],r=n[e];f=u[e].getPixelForValue(r)-g+t}else f="center"===n?(c.left+c.right)/2-g+t:tr(e,n,t);d=Ce(r,a,o),p="left"===n?-ae:ae}return{titleX:f,titleY:d,maxWidth:h,rotation:p}}(this,s,t,a);rt(e,n.text,0,0,o,{color:n.color,maxWidth:u,rotation:h,textAlign:sr(a,t,r),textBaseline:"middle",translation:[l,c]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){const e=this.options,t=e.ticks&&e.ticks.z||0,n=B(e.grid&&e.grid.z,-1),r=B(e.border&&e.border.z,0);return this._isVisible()&&this.draw===lr.prototype.draw?[{z:n,draw:e=>{this.drawBackground(),this.drawGrid(e),this.drawTitle()}},{z:r,draw:()=>{this.drawBorder()}},{z:t,draw:e=>{this.drawLabels(e)}}]:[{z:t,draw:e=>{this.draw(e)}}]}getMatchingVisibleMetas(e){const t=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",r=[];let o,i;for(o=0,i=t.length;o<i;++o){const i=t[o];i[n]!==this.id||e&&i.type!==e||r.push(i)}return r}_resolveTickFontOptions(e){return dt(this.options.ticks.setContext(this.getContext(e)).font)}_maxDigits(){const e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}}class cr{constructor(e,t,n){this.type=e,this.scope=t,this.override=n,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){const t=Object.getPrototypeOf(e);let n;(function(e){return"id"in e&&"defaults"in e})(t)&&(n=this.register(t));const r=this.items,o=e.id,i=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+e);return o in r||(r[o]=e,function(e,t,n){const r=K(Object.create(null),[n?Ue.get(n):{},Ue.get(t),e.defaults]);Ue.set(t,r),e.defaultRoutes&&function(e,t){Object.keys(t).forEach((n=>{const r=n.split("."),o=r.pop(),i=[e].concat(r).join("."),a=t[n].split("."),s=a.pop(),l=a.join(".");Ue.route(i,o,l,s)}))}(t,e.defaultRoutes),e.descriptors&&Ue.describe(t,e.descriptors)}(e,i,n),this.override&&Ue.override(e.id,e.overrides)),i}get(e){return this.items[e]}unregister(e){const t=this.items,n=e.id,r=this.scope;n in t&&delete t[n],r&&n in Ue[r]&&(delete Ue[r][n],this.override&&delete $e[n])}}class ur{constructor(){this.controllers=new cr(ln,"datasets",!0),this.elements=new cr(Jn,"elements"),this.plugins=new cr(Object,"plugins"),this.scales=new cr(lr,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,t,n){[...t].forEach((t=>{const r=n||this._getRegistryForType(t);n||r.isForType(t)||r===this.plugins&&t.id?this._exec(e,r,t):H(t,(t=>{const r=n||this._getRegistryForType(t);this._exec(e,r,t)}))}))}_exec(e,t,n){const r=X(e);$(n["before"+r],[],n),t[e](n),$(n["after"+r],[],n)}_getRegistryForType(e){for(let t=0;t<this._typedRegistries.length;t++){const n=this._typedRegistries[t];if(n.isForType(e))return n}return this.plugins}_get(e,t,n){const r=t.get(e);if(void 0===r)throw new Error('"'+e+'" is not a registered '+n+".");return r}}var hr=new ur;class fr{constructor(){this._init=[]}notify(e,t,n,r){"beforeInit"===t&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install"));const o=r?this._descriptors(e).filter(r):this._descriptors(e),i=this._notify(o,e,t,n);return"afterDestroy"===t&&(this._notify(o,e,"stop"),this._notify(this._init,e,"uninstall")),i}_notify(e,t,n,r){r=r||{};for(const o of e){const e=o.plugin;if(!1===$(e[n],[t,r,o.options],e)&&r.cancelable)return!1}return!0}invalidate(){I(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;const t=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),t}_createDescriptors(e,t){const n=e&&e.config,r=B(n.options&&n.options.plugins,{}),o=function(e){const t={},n=[],r=Object.keys(hr.plugins.items);for(let e=0;e<r.length;e++)n.push(hr.getPlugin(r[e]));const o=e.plugins||[];for(let e=0;e<o.length;e++){const r=o[e];-1===n.indexOf(r)&&(n.push(r),t[r.id]=!0)}return{plugins:n,localIds:t}}(n);return!1!==r||t?function(e,{plugins:t,localIds:n},r,o){const i=[],a=e.getContext();for(const s of t){const t=s.id,l=dr(r[t],o);null!==l&&i.push({plugin:s,options:pr(e.config,{plugin:s,local:n[t]},l,a)})}return i}(e,o,r,t):[]}_notifyStateChanges(e){const t=this._oldCache||[],n=this._cache,r=(e,t)=>e.filter((e=>!t.some((t=>e.plugin.id===t.plugin.id))));this._notify(r(t,n),e,"stop"),this._notify(r(n,t),e,"start")}}function dr(e,t){return t||!1!==e?!0===e?{}:e:null}function pr(e,{plugin:t,local:n},r,o){const i=e.pluginScopeKeys(t),a=e.getOptionScopes(r,i);return n&&t.defaults&&a.push(t.defaults),e.createResolver(a,o,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function mr(e,t){const n=Ue.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function gr(e){if("x"===e||"y"===e||"r"===e)return e}function yr(e,...t){if(gr(e))return e;for(const r of t){const t=r.axis||("top"===(n=r.position)||"bottom"===n?"x":"left"===n||"right"===n?"y":void 0)||e.length>1&&gr(e[0].toLowerCase());if(t)return t}var n;throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function vr(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function br(e){const t=e.options||(e.options={});t.plugins=B(t.plugins,{}),t.scales=function(e,t){const n=$e[e.type]||{scales:{}},r=t.scales||{},o=mr(e.type,t),i=Object.create(null);return Object.keys(r).forEach((t=>{const a=r[t];if(!z(a))return console.error(`Invalid scale configuration for scale: ${t}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);const s=yr(t,a,function(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter((t=>t.xAxisID===e||t.yAxisID===e));if(n.length)return vr(e,"x",n[0])||vr(e,"y",n[0])}return{}}(t,e),Ue.scales[a.type]),l=function(e,t){return e===t?"_index_":"_value_"}(s,o),c=n.scales||{};i[t]=Q(Object.create(null),[{axis:s},a,c[s],c[l]])})),e.data.datasets.forEach((n=>{const o=n.type||e.type,a=n.indexAxis||mr(o,t),s=($e[o]||{}).scales||{};Object.keys(s).forEach((e=>{const t=function(e,t){let n=e;return"_index_"===e?n=t:"_value_"===e&&(n="x"===t?"y":"x"),n}(e,a),o=n[t+"AxisID"]||t;i[o]=i[o]||Object.create(null),Q(i[o],[{axis:t},r[o],s[e]])}))})),Object.keys(i).forEach((e=>{const t=i[e];Q(t,[Ue.scales[t.type],Ue.scale])})),i}(e,t)}function xr(e){return(e=e||{}).datasets=e.datasets||[],e.labels=e.labels||[],e}const wr=new Map,kr=new Set;function Sr(e,t){let n=wr.get(e);return n||(n=t(),wr.set(e,n),kr.add(n)),n}const Or=(e,t,n)=>{const r=Z(t,n);void 0!==r&&e.add(r)};class _r{constructor(e){this._config=function(e){return(e=e||{}).data=xr(e.data),br(e),e}(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=xr(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),br(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return Sr(e,(()=>[[`datasets.${e}`,""]]))}datasetAnimationScopeKeys(e,t){return Sr(`${e}.transition.${t}`,(()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,""]]))}datasetElementScopeKeys(e,t){return Sr(`${e}-${t}`,(()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,""]]))}pluginScopeKeys(e){const t=e.id;return Sr(`${this.type}-plugin-${t}`,(()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]]))}_cachedScopes(e,t){const n=this._scopeCache;let r=n.get(e);return r&&!t||(r=new Map,n.set(e,r)),r}getOptionScopes(e,t,n){const{options:r,type:o}=this,i=this._cachedScopes(e,n),a=i.get(t);if(a)return a;const s=new Set;t.forEach((t=>{e&&(s.add(e),t.forEach((t=>Or(s,e,t)))),t.forEach((e=>Or(s,r,e))),t.forEach((e=>Or(s,$e[o]||{},e))),t.forEach((e=>Or(s,Ue,e))),t.forEach((e=>Or(s,He,e)))}));const l=Array.from(s);return 0===l.length&&l.push(Object.create(null)),kr.has(t)&&i.set(t,l),l}chartOptionScopes(){const{options:e,type:t}=this;return[e,$e[t]||{},Ue.datasets[t]||{},{type:t},Ue,He]}resolveNamedOptions(e,t,n,r=[""]){const o={$shared:!0},{resolver:i,subPrefixes:a}=Er(this._resolverCache,e,r);let s=i;(function(e,t){const{isScriptable:n,isIndexable:r}=vt(e);for(const o of t){const t=n(o),i=r(o),a=(i||t)&&e[o];if(t&&(ee(a)||Cr(a))||i&&N(a))return!0}return!1})(i,t)&&(o.$shared=!1,s=yt(i,n=ee(n)?n():n,this.createResolver(e,n,a)));for(const e of t)o[e]=s[e];return o}createResolver(e,t,n=[""],r){const{resolver:o}=Er(this._resolverCache,e,n);return z(t)?yt(o,t,void 0,r):o}}function Er(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));const o=n.join();let i=r.get(o);return i||(i={resolver:gt(t,n),subPrefixes:n.filter((e=>!e.toLowerCase().includes("hover")))},r.set(o,i)),i}const Cr=e=>z(e)&&Object.getOwnPropertyNames(e).some((t=>ee(e[t]))),Ar=["top","bottom","left","right","chartArea"];function jr(e,t){return"top"===e||"bottom"===e||-1===Ar.indexOf(e)&&"x"===t}function Pr(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function Mr(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),$(n&&n.onComplete,[e],t)}function Rr(e){const t=e.chart,n=t.options.animation;$(n&&n.onProgress,[e],t)}function Tr(e){return jt()&&"string"==typeof e?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Lr={},Ir=e=>{const t=Tr(e);return Object.values(Lr).filter((e=>e.canvas===t)).pop()};function Nr(e,t,n){const r=Object.keys(e);for(const o of r){const r=+o;if(r>=t){const i=e[o];delete e[o],(n>0||r>t)&&(e[r+n]=i)}}}function zr(e,t,n){return e.options.clip?e[n]:t[n]}class Dr{static defaults=Ue;static instances=Lr;static overrides=$e;static registry=hr;static version="4.4.4";static getChart=Ir;static register(...e){hr.add(...e),Fr()}static unregister(...e){hr.remove(...e),Fr()}constructor(e,t){const n=this.config=new _r(t),r=Tr(e),o=Ir(r);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const i=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||function(e){return!jt()||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?zn:Xn}(r)),this.platform.updateConfig(n);const a=this.platform.acquireContext(r,i.aspectRatio),s=a&&a.canvas,l=s&&s.height,c=s&&s.width;this.id=L(),this.ctx=a,this.canvas=s,this.width=c,this.height=l,this._options=i,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new fr,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(e,t){let n;return function(...r){return t?(clearTimeout(n),n=setTimeout(e,t,r)):e.apply(this,r),t}}((e=>this.update(e)),i.resizeDelay||0),this._dataChanges=[],Lr[this.id]=this,a&&s?(Vt.listen(this,"complete",Mr),Vt.listen(this,"progress",Rr),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:t},width:n,height:r,_aspectRatio:o}=this;return I(e)?t&&o?o:r?n/r:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return hr}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Dt(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Ge(this.canvas,this.ctx),this}stop(){return Vt.stop(this),this}resize(e,t){Vt.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){const n=this.options,r=this.canvas,o=n.maintainAspectRatio&&this.aspectRatio,i=this.platform.getMaximumSize(r,e,t,o),a=n.devicePixelRatio||this.platform.getDevicePixelRatio(),s=this.width?"resize":"attach";this.width=i.width,this.height=i.height,this._aspectRatio=this.aspectRatio,Dt(this,a,!0)&&(this.notifyPlugins("resize",{size:i}),$(n.onResize,[this,i],this),this.attached&&this._doResize(s)&&this.render())}ensureScalesHaveIDs(){H(this.options.scales||{},((e,t)=>{e.id=t}))}buildOrUpdateScales(){const e=this.options,t=e.scales,n=this.scales,r=Object.keys(n).reduce(((e,t)=>(e[t]=!1,e)),{});let o=[];t&&(o=o.concat(Object.keys(t).map((e=>{const n=t[e],r=yr(e,n),o="r"===r,i="x"===r;return{options:n,dposition:o?"chartArea":i?"bottom":"left",dtype:o?"radialLinear":i?"category":"linear"}})))),H(o,(t=>{const o=t.options,i=o.id,a=yr(i,o),s=B(o.type,t.dtype);void 0!==o.position&&jr(o.position,a)===jr(t.dposition)||(o.position=t.dposition),r[i]=!0;let l=null;i in n&&n[i].type===s?l=n[i]:(l=new(hr.getScale(s))({id:i,type:s,ctx:this.ctx,chart:this}),n[l.id]=l),l.init(o,e)})),H(r,((e,t)=>{e||delete n[t]})),H(n,(e=>{In.configure(this,e,e.options),In.addBox(this,e)}))}_updateMetasets(){const e=this._metasets,t=this.data.datasets.length,n=e.length;if(e.sort(((e,t)=>e.index-t.index)),n>t){for(let e=t;e<n;++e)this._destroyDatasetMeta(e);e.splice(t,n-t)}this._sortedMetasets=e.slice(0).sort(Pr("order","index"))}_removeUnreferencedMetasets(){const{_metasets:e,data:{datasets:t}}=this;e.length>t.length&&delete this._stacks,e.forEach(((e,n)=>{0===t.filter((t=>t===e._dataset)).length&&this._destroyDatasetMeta(n)}))}buildOrUpdateControllers(){const e=[],t=this.data.datasets;let n,r;for(this._removeUnreferencedMetasets(),n=0,r=t.length;n<r;n++){const r=t[n];let o=this.getDatasetMeta(n);const i=r.type||this.config.type;if(o.type&&o.type!==i&&(this._destroyDatasetMeta(n),o=this.getDatasetMeta(n)),o.type=i,o.indexAxis=r.indexAxis||mr(i,this.options),o.order=r.order||0,o.index=n,o.label=""+r.label,o.visible=this.isDatasetVisible(n),o.controller)o.controller.updateIndex(n),o.controller.linkScales();else{const t=hr.getController(i),{datasetElementType:r,dataElementType:a}=Ue.datasets[i];Object.assign(t,{dataElementType:hr.getElement(a),datasetElementType:r&&hr.getElement(r)}),o.controller=new t(this,n),e.push(o.controller)}}return this._updateMetasets(),e}_resetElements(){H(this.data.datasets,((e,t)=>{this.getDatasetMeta(t).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const t=this.config;t.update();const n=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0}))return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let i=0;for(let e=0,t=this.data.datasets.length;e<t;e++){const{controller:t}=this.getDatasetMeta(e),n=!r&&-1===o.indexOf(t);t.buildOrUpdateElements(n),i=Math.max(+t.getMaxOverflow(),i)}i=this._minPadding=n.layout.autoPadding?i:0,this._updateLayout(i),r||H(o,(e=>{e.reset()})),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(Pr("z","_idx"));const{_active:a,_lastEvent:s}=this;s?this._eventHandler(s,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){H(this.scales,(e=>{In.removeBox(this,e)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,t=new Set(Object.keys(this._listeners)),n=new Set(e.events);te(t,n)&&!!this._responsiveListeners===e.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(const{method:n,start:r,count:o}of t)Nr(e,r,"_removeElements"===n?-o:o)}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const t=this.data.datasets.length,n=t=>new Set(e.filter((e=>e[0]===t)).map(((e,t)=>t+","+e.splice(1).join(",")))),r=n(0);for(let e=1;e<t;e++)if(!te(r,n(e)))return;return Array.from(r).map((e=>e.split(","))).map((e=>({method:e[1],start:+e[2],count:+e[3]})))}_updateLayout(e){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;In.update(this,this.width,this.height,e);const t=this.chartArea,n=t.width<=0||t.height<=0;this._layers=[],H(this.boxes,(e=>{n&&"chartArea"===e.position||(e.configure&&e.configure(),this._layers.push(...e._layers()))}),this),this._layers.forEach(((e,t)=>{e._idx=t})),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})){for(let e=0,t=this.data.datasets.length;e<t;++e)this.getDatasetMeta(e).controller.configure();for(let t=0,n=this.data.datasets.length;t<n;++t)this._updateDataset(t,ee(e)?e({datasetIndex:t}):e);this.notifyPlugins("afterDatasetsUpdate",{mode:e})}}_updateDataset(e,t){const n=this.getDatasetMeta(e),r={meta:n,index:e,mode:t,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",r)&&(n.controller._update(t),r.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",r))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(Vt.has(this)?this.attached&&!Vt.running(this)&&Vt.start(this):(this.draw(),Mr({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){const{width:e,height:t}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(e,t)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const t=this._layers;for(e=0;e<t.length&&t[e].z<=0;++e)t[e].draw(this.chartArea);for(this._drawDatasets();e<t.length;++e)t[e].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(e){const t=this._sortedMetasets,n=[];let r,o;for(r=0,o=t.length;r<o;++r){const o=t[r];e&&!o.visible||n.push(o)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const e=this.getSortedVisibleDatasetMetas();for(let t=e.length-1;t>=0;--t)this._drawDataset(e[t]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const t=this.ctx,n=e._clip,r=!n.disabled,o=function(e,t){const{xScale:n,yScale:r}=e;return n&&r?{left:zr(n,t,"left"),right:zr(n,t,"right"),top:zr(r,t,"top"),bottom:zr(r,t,"bottom")}:t}(e,this.chartArea),i={meta:e,index:e.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",i)&&(r&&Je(t,{left:!1===n.left?0:o.left-n.left,right:!1===n.right?this.width:o.right+n.right,top:!1===n.top?0:o.top-n.top,bottom:!1===n.bottom?this.height:o.bottom+n.bottom}),e.controller.draw(),r&&et(t),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(e){return Xe(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,n,r){const o=Sn.modes[t];return"function"==typeof o?o(this,e,n,r):[]}getDatasetMeta(e){const t=this.data.datasets[e],n=this._metasets;let r=n.filter((e=>e&&e._dataset===t)).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},n.push(r)),r}getContext(){return this.$context||(this.$context=mt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const t=this.data.datasets[e];if(!t)return!1;const n=this.getDatasetMeta(e);return"boolean"==typeof n.hidden?!n.hidden:!t.hidden}setDatasetVisibility(e,t){this.getDatasetMeta(e).hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,n){const r=n?"show":"hide",o=this.getDatasetMeta(e),i=o.controller._resolveAnimations(void 0,r);J(t)?(o.data[t].hidden=!n,this.update()):(this.setDatasetVisibility(e,n),i.update(o,{visible:n}),this.update((t=>t.datasetIndex===e?r:void 0)))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){const t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),Vt.remove(this),e=0,t=this.data.datasets.length;e<t;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:e,ctx:t}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),Ge(e,t),this.platform.releaseContext(t),this.canvas=null,this.ctx=null),delete Lr[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const e=this._listeners,t=this.platform,n=(n,r)=>{t.addEventListener(this,n,r),e[n]=r},r=(e,t,n)=>{e.offsetX=t,e.offsetY=n,this._eventHandler(e)};H(this.options.events,(e=>n(e,r)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,t=this.platform,n=(n,r)=>{t.addEventListener(this,n,r),e[n]=r},r=(n,r)=>{e[n]&&(t.removeEventListener(this,n,r),delete e[n])},o=(e,t)=>{this.canvas&&this.resize(e,t)};let i;const a=()=>{r("attach",a),this.attached=!0,this.resize(),n("resize",o),n("detach",i)};i=()=>{this.attached=!1,r("resize",o),this._stop(),this._resize(0,0),n("attach",a)},t.isAttached(this.canvas)?a():i()}unbindEvents(){H(this._listeners,((e,t)=>{this.platform.removeEventListener(this,t,e)})),this._listeners={},H(this._responsiveListeners,((e,t)=>{this.platform.removeEventListener(this,t,e)})),this._responsiveListeners=void 0}updateHoverStyle(e,t,n){const r=n?"set":"remove";let o,i,a,s;for("dataset"===t&&(o=this.getDatasetMeta(e[0].datasetIndex),o.controller["_"+r+"DatasetHoverStyle"]()),a=0,s=e.length;a<s;++a){i=e[a];const t=i&&this.getDatasetMeta(i.datasetIndex).controller;t&&t[r+"HoverStyle"](i.element,i.datasetIndex,i.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){const t=this._active||[],n=e.map((({datasetIndex:e,index:t})=>{const n=this.getDatasetMeta(e);if(!n)throw new Error("No dataset found at index "+e);return{datasetIndex:e,element:n.data[t],index:t}}));!W(n,t)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,t))}notifyPlugins(e,t,n){return this._plugins.notify(this,e,t,n)}isPluginEnabled(e){return 1===this._plugins._cache.filter((t=>t.plugin.id===e)).length}_updateHoverStyles(e,t,n){const r=this.options.hover,o=(e,t)=>e.filter((e=>!t.some((t=>e.datasetIndex===t.datasetIndex&&e.index===t.index)))),i=o(t,e),a=n?e:o(e,t);i.length&&this.updateHoverStyle(i,r.mode,!1),a.length&&r.mode&&this.updateHoverStyle(a,r.mode,!0)}_eventHandler(e,t){const n={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},r=t=>(t.options.events||this.options.events).includes(e.native.type);if(!1===this.notifyPlugins("beforeEvent",n,r))return;const o=this._handleEvent(e,t,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,r),(o||n.changed)&&this.render(),this}_handleEvent(e,t,n){const{_active:r=[],options:o}=this,i=t,a=this._getActiveElements(e,r,n,i),s=function(e){return"mouseup"===e.type||"click"===e.type||"contextmenu"===e.type}(e),l=function(e,t,n,r){return n&&"mouseout"!==e.type?r?t:e:null}(e,this._lastEvent,n,s);n&&(this._lastEvent=null,$(o.onHover,[e,a,this],this),s&&$(o.onClick,[e,a,this],this));const c=!W(a,r);return(c||t)&&(this._active=a,this._updateHoverStyles(a,r,t)),this._lastEvent=l,c}_getActiveElements(e,t,n,r){if("mouseout"===e.type)return[];if(!n)return t;const o=this.options.hover;return this.getElementsAtEventForMode(e,o.mode,o,r)}}function Fr(){return H(Dr.instances,(e=>e._plugins.invalidate()))}function Br(e,t){const{x:n,y:r,base:o,width:i,height:a}=e.getProps(["x","y","base","width","height"],t);let s,l,c,u,h;return e.horizontal?(h=a/2,s=Math.min(n,o),l=Math.max(n,o),c=r-h,u=r+h):(h=i/2,s=n-h,l=n+h,c=Math.min(r,o),u=Math.max(r,o)),{left:s,top:c,right:l,bottom:u}}function $r(e,t,n,r){return e?0:ye(t,n,r)}function Hr(e,t,n,r){const o=null===t,i=null===n,a=e&&!(o&&i)&&Br(e,r);return a&&(o||ve(t,a.left,a.right))&&(i||ve(n,a.top,a.bottom))}function Wr(e,t){e.rect(t.x,t.y,t.w,t.h)}function qr(e,t,n={}){const r=e.x!==n.x?-t:0,o=e.y!==n.y?-t:0,i=(e.x+e.w!==n.x+n.w?t:0)-r,a=(e.y+e.h!==n.y+n.h?t:0)-o;return{x:e.x+r,y:e.y+o,w:e.w+i,h:e.h+a,radius:e.radius}}class Vr extends Jn{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(e){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,e&&Object.assign(this,e)}draw(e){const{inflateAmount:t,options:{borderColor:n,backgroundColor:r}}=this,{inner:o,outer:i}=function(e){const t=Br(e),n=t.right-t.left,r=t.bottom-t.top,o=function(e,t,n){const r=e.options.borderWidth,o=e.borderSkipped,i=ut(r);return{t:$r(o.top,i.top,0,n),r:$r(o.right,i.right,0,t),b:$r(o.bottom,i.bottom,0,n),l:$r(o.left,i.left,0,t)}}(e,n/2,r/2),i=function(e,t,n){const{enableBorderRadius:r}=e.getProps(["enableBorderRadius"]),o=e.options.borderRadius,i=ht(o),a=Math.min(t,n),s=e.borderSkipped,l=r||z(o);return{topLeft:$r(!l||s.top||s.left,i.topLeft,0,a),topRight:$r(!l||s.top||s.right,i.topRight,0,a),bottomLeft:$r(!l||s.bottom||s.left,i.bottomLeft,0,a),bottomRight:$r(!l||s.bottom||s.right,i.bottomRight,0,a)}}(e,n/2,r/2);return{outer:{x:t.left,y:t.top,w:n,h:r,radius:i},inner:{x:t.left+o.l,y:t.top+o.t,w:n-o.l-o.r,h:r-o.t-o.b,radius:{topLeft:Math.max(0,i.topLeft-Math.max(o.t,o.l)),topRight:Math.max(0,i.topRight-Math.max(o.t,o.r)),bottomLeft:Math.max(0,i.bottomLeft-Math.max(o.b,o.l)),bottomRight:Math.max(0,i.bottomRight-Math.max(o.b,o.r))}}}}(this),a=(s=i.radius).topLeft||s.topRight||s.bottomLeft||s.bottomRight?ot:Wr;var s;e.save(),i.w===o.w&&i.h===o.h||(e.beginPath(),a(e,qr(i,t,o)),e.clip(),a(e,qr(o,-t,i)),e.fillStyle=n,e.fill("evenodd")),e.beginPath(),a(e,qr(o,t)),e.fillStyle=r,e.fill(),e.restore()}inRange(e,t,n){return Hr(this,e,t,n)}inXRange(e,t){return Hr(this,e,null,t)}inYRange(e,t){return Hr(this,null,e,t)}getCenterPoint(e){const{x:t,y:n,base:r,horizontal:o}=this.getProps(["x","y","base","horizontal"],e);return{x:o?(t+r)/2:t,y:o?n:(n+r)/2}}getRange(e){return"x"===e?this.width/2:this.height/2}}const Ur=(e,t)=>{let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}};class Kr extends Jn{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t,n){this.maxWidth=e,this.maxHeight=t,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const e=this.options.labels||{};let t=$(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter((t=>e.filter(t,this.chart.data)))),e.sort&&(t=t.sort(((t,n)=>e.sort(t,n,this.chart.data)))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){const{options:e,ctx:t}=this;if(!e.display)return void(this.width=this.height=0);const n=e.labels,r=dt(n.font),o=r.size,i=this._computeTitleHeight(),{boxWidth:a,itemHeight:s}=Ur(n,o);let l,c;t.font=r.string,this.isHorizontal()?(l=this.maxWidth,c=this._fitRows(i,o,a,s)+10):(c=this.maxHeight,l=this._fitCols(i,r,a,s)+10),this.width=Math.min(l,e.maxWidth||this.maxWidth),this.height=Math.min(c,e.maxHeight||this.maxHeight)}_fitRows(e,t,n,r){const{ctx:o,maxWidth:i,options:{labels:{padding:a}}}=this,s=this.legendHitBoxes=[],l=this.lineWidths=[0],c=r+a;let u=e;o.textAlign="left",o.textBaseline="middle";let h=-1,f=-c;return this.legendItems.forEach(((e,d)=>{const p=n+t/2+o.measureText(e.text).width;(0===d||l[l.length-1]+p+2*a>i)&&(u+=c,l[l.length-(d>0?0:1)]=0,f+=c,h++),s[d]={left:0,top:f,row:h,width:p,height:r},l[l.length-1]+=p+a})),u}_fitCols(e,t,n,r){const{ctx:o,maxHeight:i,options:{labels:{padding:a}}}=this,s=this.legendHitBoxes=[],l=this.columnSizes=[],c=i-e;let u=a,h=0,f=0,d=0,p=0;return this.legendItems.forEach(((e,i)=>{const{itemWidth:m,itemHeight:g}=function(e,t,n,r,o){const i=function(e,t,n,r){let o=e.text;return o&&"string"!=typeof o&&(o=o.reduce(((e,t)=>e.length>t.length?e:t))),t+n.size/2+r.measureText(o).width}(r,e,t,n),a=function(e,t,n){let r=e;return"string"!=typeof t.text&&(r=Qr(t,n)),r}(o,r,t.lineHeight);return{itemWidth:i,itemHeight:a}}(n,t,o,e,r);i>0&&f+g+2*a>c&&(u+=h+a,l.push({width:h,height:f}),d+=h+a,p++,h=f=0),s[i]={left:d,top:f,col:p,width:m,height:g},h=Math.max(h,m),f+=g+a})),u+=h,l.push({width:h,height:f}),u}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:n,labels:{padding:r},rtl:o}}=this,i=$t(o,this.left,this.width);if(this.isHorizontal()){let o=0,a=Ce(n,this.left+r,this.right-this.lineWidths[o]);for(const s of t)o!==s.row&&(o=s.row,a=Ce(n,this.left+r,this.right-this.lineWidths[o])),s.top+=this.top+e+r,s.left=i.leftForLtr(i.x(a),s.width),a+=s.width+r}else{let o=0,a=Ce(n,this.top+e+r,this.bottom-this.columnSizes[o].height);for(const s of t)s.col!==o&&(o=s.col,a=Ce(n,this.top+e+r,this.bottom-this.columnSizes[o].height)),s.top=a,s.left+=this.left+r,s.left=i.leftForLtr(i.x(s.left),s.width),a+=s.height+r}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const e=this.ctx;Je(e,this),this._draw(),et(e)}}_draw(){const{options:e,columnSizes:t,lineWidths:n,ctx:r}=this,{align:o,labels:i}=e,a=Ue.color,s=$t(e.rtl,this.left,this.width),l=dt(i.font),{padding:c}=i,u=l.size,h=u/2;let f;this.drawTitle(),r.textAlign=s.textAlign("left"),r.textBaseline="middle",r.lineWidth=.5,r.font=l.string;const{boxWidth:d,boxHeight:p,itemHeight:m}=Ur(i,u),g=this.isHorizontal(),y=this._computeTitleHeight();f=g?{x:Ce(o,this.left+c,this.right-n[0]),y:this.top+c+y,line:0}:{x:this.left+c,y:Ce(o,this.top+y+c,this.bottom-t[0].height),line:0},Ht(this.ctx,e.textDirection);const v=m+c;this.legendItems.forEach(((b,x)=>{r.strokeStyle=b.fontColor,r.fillStyle=b.fontColor;const w=r.measureText(b.text).width,k=s.textAlign(b.textAlign||(b.textAlign=i.textAlign)),S=d+h+w;let O=f.x,_=f.y;if(s.setWidth(this.width),g?x>0&&O+S+c>this.right&&(_=f.y+=v,f.line++,O=f.x=Ce(o,this.left+c,this.right-n[f.line])):x>0&&_+v>this.bottom&&(O=f.x=O+t[f.line].width+c,f.line++,_=f.y=Ce(o,this.top+y+c,this.bottom-t[f.line].height)),function(e,t,n){if(isNaN(d)||d<=0||isNaN(p)||p<0)return;r.save();const o=B(n.lineWidth,1);if(r.fillStyle=B(n.fillStyle,a),r.lineCap=B(n.lineCap,"butt"),r.lineDashOffset=B(n.lineDashOffset,0),r.lineJoin=B(n.lineJoin,"miter"),r.lineWidth=o,r.strokeStyle=B(n.strokeStyle,a),r.setLineDash(B(n.lineDash,[])),i.usePointStyle){const a={radius:p*Math.SQRT2/2,pointStyle:n.pointStyle,rotation:n.rotation,borderWidth:o},l=s.xPlus(e,d/2);Ze(r,a,l,t+h,i.pointStyleWidth&&d)}else{const i=t+Math.max((u-p)/2,0),a=s.leftForLtr(e,d),l=ht(n.borderRadius);r.beginPath(),Object.values(l).some((e=>0!==e))?ot(r,{x:a,y:i,w:d,h:p,radius:l}):r.rect(a,i,d,p),r.fill(),0!==o&&r.stroke()}r.restore()}(s.x(O),_,b),O=((e,t,n,r)=>e===(r?"left":"right")?n:"center"===e?(t+n)/2:t)(k,O+d+h,g?O+S:this.right,e.rtl),function(e,t,n){rt(r,n.text,e,t+m/2,l,{strikethrough:n.hidden,textAlign:s.textAlign(n.textAlign)})}(s.x(O),_,b),g)f.x+=S+c;else if("string"!=typeof b.text){const e=l.lineHeight;f.y+=Qr(b,e)+c}else f.y+=v})),Wt(this.ctx,e.textDirection)}drawTitle(){const e=this.options,t=e.title,n=dt(t.font),r=ft(t.padding);if(!t.display)return;const o=$t(e.rtl,this.left,this.width),i=this.ctx,a=t.position,s=n.size/2,l=r.top+s;let c,u=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),c=this.top+l,u=Ce(e.align,u,this.right-h);else{const t=this.columnSizes.reduce(((e,t)=>Math.max(e,t.height)),0);c=l+Ce(e.align,this.top,this.bottom-t-e.labels.padding-this._computeTitleHeight())}const f=Ce(a,u,u+h);i.textAlign=o.textAlign(Ee(a)),i.textBaseline="middle",i.strokeStyle=t.color,i.fillStyle=t.color,i.font=n.string,rt(i,t.text,f,c,n)}_computeTitleHeight(){const e=this.options.title,t=dt(e.font),n=ft(e.padding);return e.display?t.lineHeight+n.height:0}_getLegendItemAt(e,t){let n,r,o;if(ve(e,this.left,this.right)&&ve(t,this.top,this.bottom))for(o=this.legendHitBoxes,n=0;n<o.length;++n)if(r=o[n],ve(e,r.left,r.left+r.width)&&ve(t,r.top,r.top+r.height))return this.legendItems[n];return null}handleEvent(e){const t=this.options;if(!function(e,t){return!("mousemove"!==e&&"mouseout"!==e||!t.onHover&&!t.onLeave)||!(!t.onClick||"click"!==e&&"mouseup"!==e)}(e.type,t))return;const n=this._getLegendItemAt(e.x,e.y);if("mousemove"===e.type||"mouseout"===e.type){const i=this._hoveredItem,a=(o=n,null!==(r=i)&&null!==o&&r.datasetIndex===o.datasetIndex&&r.index===o.index);i&&!a&&$(t.onLeave,[e,i,this],this),this._hoveredItem=n,n&&!a&&$(t.onHover,[e,n,this],this)}else n&&$(t.onClick,[e,n,this],this);var r,o}}function Qr(e,t){return t*(e.text?e.text.length:0)}var Gr={id:"legend",_element:Kr,start(e,t,n){const r=e.legend=new Kr({ctx:e.ctx,options:n,chart:e});In.configure(e,r,n),In.addBox(e,r)},stop(e){In.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const r=e.legend;In.configure(e,r,n),r.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const r=t.datasetIndex,o=n.chart;o.isDatasetVisible(r)?(o.hide(r),t.hidden=!0):(o.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:o,color:i,useBorderRadius:a,borderRadius:s}}=e.legend.options;return e._getSortedDatasetMetas().map((e=>{const l=e.controller.getStyle(n?0:void 0),c=ft(l.borderWidth);return{text:t[e.index].label,fillStyle:l.backgroundColor,fontColor:i,hidden:!e.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(c.width+c.height)/4,strokeStyle:l.borderColor,pointStyle:r||l.pointStyle,rotation:l.rotation,textAlign:o||l.textAlign,borderRadius:a&&(s||l.borderRadius),datasetIndex:e.index}}),this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};new WeakMap;const Yr={average(e){if(!e.length)return!1;let t,n,r=new Set,o=0,i=0;for(t=0,n=e.length;t<n;++t){const n=e[t].element;if(n&&n.hasValue()){const e=n.tooltipPosition();r.add(e.x),o+=e.y,++i}}return 0!==i&&0!==r.size&&{x:[...r].reduce(((e,t)=>e+t))/r.size,y:o/i}},nearest(e,t){if(!e.length)return!1;let n,r,o,i=t.x,a=t.y,s=Number.POSITIVE_INFINITY;for(n=0,r=e.length;n<r;++n){const r=e[n].element;if(r&&r.hasValue()){const e=(l=t,c=r.getCenterPoint(),Math.sqrt(Math.pow(c.x-l.x,2)+Math.pow(c.y-l.y,2)));e<s&&(s=e,o=r)}}var l,c;if(o){const e=o.tooltipPosition();i=e.x,a=e.y}return{x:i,y:a}}};function Zr(e,t){return t&&(N(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Xr(e){return("string"==typeof e||e instanceof String)&&e.indexOf("\n")>-1?e.split("\n"):e}function Jr(e,t){const{element:n,datasetIndex:r,index:o}=t,i=e.getDatasetMeta(r).controller,{label:a,value:s}=i.getLabelAndValue(o);return{chart:e,label:a,parsed:i.getParsed(o),raw:e.data.datasets[r].data[o],formattedValue:s,dataset:i.getDataset(),dataIndex:o,datasetIndex:r,element:n}}function eo(e,t){const n=e.chart.ctx,{body:r,footer:o,title:i}=e,{boxWidth:a,boxHeight:s}=t,l=dt(t.bodyFont),c=dt(t.titleFont),u=dt(t.footerFont),h=i.length,f=o.length,d=r.length,p=ft(t.padding);let m=p.height,g=0,y=r.reduce(((e,t)=>e+t.before.length+t.lines.length+t.after.length),0);y+=e.beforeBody.length+e.afterBody.length,h&&(m+=h*c.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),y&&(m+=d*(t.displayColors?Math.max(s,l.lineHeight):l.lineHeight)+(y-d)*l.lineHeight+(y-1)*t.bodySpacing),f&&(m+=t.footerMarginTop+f*u.lineHeight+(f-1)*t.footerSpacing);let v=0;const b=function(e){g=Math.max(g,n.measureText(e).width+v)};return n.save(),n.font=c.string,H(e.title,b),n.font=l.string,H(e.beforeBody.concat(e.afterBody),b),v=t.displayColors?a+2+t.boxPadding:0,H(r,(e=>{H(e.before,b),H(e.lines,b),H(e.after,b)})),v=0,n.font=u.string,H(e.footer,b),n.restore(),g+=p.width,{width:g,height:m}}function to(e,t,n,r){const{x:o,width:i}=n,{width:a,chartArea:{left:s,right:l}}=e;let c="center";return"center"===r?c=o<=(s+l)/2?"left":"right":o<=i/2?c="left":o>=a-i/2&&(c="right"),function(e,t,n,r){const{x:o,width:i}=r,a=n.caretSize+n.caretPadding;return"left"===e&&o+i+a>t.width||"right"===e&&o-i-a<0||void 0}(c,e,t,n)&&(c="center"),c}function no(e,t,n){const r=n.yAlign||t.yAlign||function(e,t){const{y:n,height:r}=t;return n<r/2?"top":n>e.height-r/2?"bottom":"center"}(e,n);return{xAlign:n.xAlign||t.xAlign||to(e,t,n,r),yAlign:r}}function ro(e,t,n,r){const{caretSize:o,caretPadding:i,cornerRadius:a}=e,{xAlign:s,yAlign:l}=n,c=o+i,{topLeft:u,topRight:h,bottomLeft:f,bottomRight:d}=ht(a);let p=function(e,t){let{x:n,width:r}=e;return"right"===t?n-=r:"center"===t&&(n-=r/2),n}(t,s);const m=function(e,t,n){let{y:r,height:o}=e;return"top"===t?r+=n:r-="bottom"===t?o+n:o/2,r}(t,l,c);return"center"===l?"left"===s?p+=c:"right"===s&&(p-=c):"left"===s?p-=Math.max(u,f)+o:"right"===s&&(p+=Math.max(h,d)+o),{x:ye(p,0,r.width-t.width),y:ye(m,0,r.height-t.height)}}function oo(e,t,n){const r=ft(n.padding);return"center"===t?e.x+e.width/2:"right"===t?e.x+e.width-r.right:e.x+r.left}function io(e){return Zr([],Xr(e))}function ao(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const so={beforeTitle:T,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&"dataset"===this.options.mode)return t.dataset.label||"";if(t.label)return t.label;if(r>0&&t.dataIndex<r)return n[t.dataIndex]}return""},afterTitle:T,beforeBody:T,beforeLabel:T,label(e){if(this&&this.options&&"dataset"===this.options.mode)return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return I(n)||(t+=n),t},labelColor(e){const t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:T,afterBody:T,beforeFooter:T,footer:T,afterFooter:T};function lo(e,t,n,r){const o=e[t].call(n,r);return void 0===o?so[t].call(n,r):o}class co extends Jn{static positioners=Yr;constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const t=this.chart,n=this.options.setContext(this.getContext()),r=n.enabled&&t.options.animation&&n.animations,o=new Gt(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=(this,mt(this.chart.getContext(),{tooltip:this,tooltipItems:this._tooltipItems,type:"tooltip"})))}getTitle(e,t){const{callbacks:n}=t,r=lo(n,"beforeTitle",this,e),o=lo(n,"title",this,e),i=lo(n,"afterTitle",this,e);let a=[];return a=Zr(a,Xr(r)),a=Zr(a,Xr(o)),a=Zr(a,Xr(i)),a}getBeforeBody(e,t){return io(lo(t.callbacks,"beforeBody",this,e))}getBody(e,t){const{callbacks:n}=t,r=[];return H(e,(e=>{const t={before:[],lines:[],after:[]},o=ao(n,e);Zr(t.before,Xr(lo(o,"beforeLabel",this,e))),Zr(t.lines,lo(o,"label",this,e)),Zr(t.after,Xr(lo(o,"afterLabel",this,e))),r.push(t)})),r}getAfterBody(e,t){return io(lo(t.callbacks,"afterBody",this,e))}getFooter(e,t){const{callbacks:n}=t,r=lo(n,"beforeFooter",this,e),o=lo(n,"footer",this,e),i=lo(n,"afterFooter",this,e);let a=[];return a=Zr(a,Xr(r)),a=Zr(a,Xr(o)),a=Zr(a,Xr(i)),a}_createItems(e){const t=this._active,n=this.chart.data,r=[],o=[],i=[];let a,s,l=[];for(a=0,s=t.length;a<s;++a)l.push(Jr(this.chart,t[a]));return e.filter&&(l=l.filter(((t,r,o)=>e.filter(t,r,o,n)))),e.itemSort&&(l=l.sort(((t,r)=>e.itemSort(t,r,n)))),H(l,(t=>{const n=ao(e.callbacks,t);r.push(lo(n,"labelColor",this,t)),o.push(lo(n,"labelPointStyle",this,t)),i.push(lo(n,"labelTextColor",this,t))})),this.labelColors=r,this.labelPointStyles=o,this.labelTextColors=i,this.dataPoints=l,l}update(e,t){const n=this.options.setContext(this.getContext()),r=this._active;let o,i=[];if(r.length){const e=Yr[n.position].call(this,r,this._eventPosition);i=this._createItems(n),this.title=this.getTitle(i,n),this.beforeBody=this.getBeforeBody(i,n),this.body=this.getBody(i,n),this.afterBody=this.getAfterBody(i,n),this.footer=this.getFooter(i,n);const t=this._size=eo(this,n),a=Object.assign({},e,t),s=no(this.chart,n,a),l=ro(n,a,s,this.chart);this.xAlign=s.xAlign,this.yAlign=s.yAlign,o={opacity:1,x:l.x,y:l.y,width:t.width,height:t.height,caretX:e.x,caretY:e.y}}else 0!==this.opacity&&(o={opacity:0});this._tooltipItems=i,this.$context=void 0,o&&this._resolveAnimations().update(this,o),e&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,n,r){const o=this.getCaretPosition(e,n,r);t.lineTo(o.x1,o.y1),t.lineTo(o.x2,o.y2),t.lineTo(o.x3,o.y3)}getCaretPosition(e,t,n){const{xAlign:r,yAlign:o}=this,{caretSize:i,cornerRadius:a}=n,{topLeft:s,topRight:l,bottomLeft:c,bottomRight:u}=ht(a),{x:h,y:f}=e,{width:d,height:p}=t;let m,g,y,v,b,x;return"center"===o?(b=f+p/2,"left"===r?(m=h,g=m-i,v=b+i,x=b-i):(m=h+d,g=m+i,v=b-i,x=b+i),y=m):(g="left"===r?h+Math.max(s,c)+i:"right"===r?h+d-Math.max(l,u)-i:this.caretX,"top"===o?(v=f,b=v-i,m=g-i,y=g+i):(v=f+p,b=v+i,m=g+i,y=g-i),x=v),{x1:m,x2:g,x3:y,y1:v,y2:b,y3:x}}drawTitle(e,t,n){const r=this.title,o=r.length;let i,a,s;if(o){const l=$t(n.rtl,this.x,this.width);for(e.x=oo(this,n.titleAlign,n),t.textAlign=l.textAlign(n.titleAlign),t.textBaseline="middle",i=dt(n.titleFont),a=n.titleSpacing,t.fillStyle=n.titleColor,t.font=i.string,s=0;s<o;++s)t.fillText(r[s],l.x(e.x),e.y+i.lineHeight/2),e.y+=i.lineHeight+a,s+1===o&&(e.y+=n.titleMarginBottom-a)}}_drawColorBox(e,t,n,r,o){const i=this.labelColors[n],a=this.labelPointStyles[n],{boxHeight:s,boxWidth:l}=o,c=dt(o.bodyFont),u=oo(this,"left",o),h=r.x(u),f=s<c.lineHeight?(c.lineHeight-s)/2:0,d=t.y+f;if(o.usePointStyle){const t={radius:Math.min(l,s)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},n=r.leftForLtr(h,l)+l/2,c=d+s/2;e.strokeStyle=o.multiKeyBackground,e.fillStyle=o.multiKeyBackground,Ye(e,t,n,c),e.strokeStyle=i.borderColor,e.fillStyle=i.backgroundColor,Ye(e,t,n,c)}else{e.lineWidth=z(i.borderWidth)?Math.max(...Object.values(i.borderWidth)):i.borderWidth||1,e.strokeStyle=i.borderColor,e.setLineDash(i.borderDash||[]),e.lineDashOffset=i.borderDashOffset||0;const t=r.leftForLtr(h,l),n=r.leftForLtr(r.xPlus(h,1),l-2),a=ht(i.borderRadius);Object.values(a).some((e=>0!==e))?(e.beginPath(),e.fillStyle=o.multiKeyBackground,ot(e,{x:t,y:d,w:l,h:s,radius:a}),e.fill(),e.stroke(),e.fillStyle=i.backgroundColor,e.beginPath(),ot(e,{x:n,y:d+1,w:l-2,h:s-2,radius:a}),e.fill()):(e.fillStyle=o.multiKeyBackground,e.fillRect(t,d,l,s),e.strokeRect(t,d,l,s),e.fillStyle=i.backgroundColor,e.fillRect(n,d+1,l-2,s-2))}e.fillStyle=this.labelTextColors[n]}drawBody(e,t,n){const{body:r}=this,{bodySpacing:o,bodyAlign:i,displayColors:a,boxHeight:s,boxWidth:l,boxPadding:c}=n,u=dt(n.bodyFont);let h=u.lineHeight,f=0;const d=$t(n.rtl,this.x,this.width),p=function(n){t.fillText(n,d.x(e.x+f),e.y+h/2),e.y+=h+o},m=d.textAlign(i);let g,y,v,b,x,w,k;for(t.textAlign=i,t.textBaseline="middle",t.font=u.string,e.x=oo(this,m,n),t.fillStyle=n.bodyColor,H(this.beforeBody,p),f=a&&"right"!==m?"center"===i?l/2+c:l+2+c:0,b=0,w=r.length;b<w;++b){for(g=r[b],y=this.labelTextColors[b],t.fillStyle=y,H(g.before,p),v=g.lines,a&&v.length&&(this._drawColorBox(t,e,b,d,n),h=Math.max(u.lineHeight,s)),x=0,k=v.length;x<k;++x)p(v[x]),h=u.lineHeight;H(g.after,p)}f=0,h=u.lineHeight,H(this.afterBody,p),e.y-=o}drawFooter(e,t,n){const r=this.footer,o=r.length;let i,a;if(o){const s=$t(n.rtl,this.x,this.width);for(e.x=oo(this,n.footerAlign,n),e.y+=n.footerMarginTop,t.textAlign=s.textAlign(n.footerAlign),t.textBaseline="middle",i=dt(n.footerFont),t.fillStyle=n.footerColor,t.font=i.string,a=0;a<o;++a)t.fillText(r[a],s.x(e.x),e.y+i.lineHeight/2),e.y+=i.lineHeight+n.footerSpacing}}drawBackground(e,t,n,r){const{xAlign:o,yAlign:i}=this,{x:a,y:s}=e,{width:l,height:c}=n,{topLeft:u,topRight:h,bottomLeft:f,bottomRight:d}=ht(r.cornerRadius);t.fillStyle=r.backgroundColor,t.strokeStyle=r.borderColor,t.lineWidth=r.borderWidth,t.beginPath(),t.moveTo(a+u,s),"top"===i&&this.drawCaret(e,t,n,r),t.lineTo(a+l-h,s),t.quadraticCurveTo(a+l,s,a+l,s+h),"center"===i&&"right"===o&&this.drawCaret(e,t,n,r),t.lineTo(a+l,s+c-d),t.quadraticCurveTo(a+l,s+c,a+l-d,s+c),"bottom"===i&&this.drawCaret(e,t,n,r),t.lineTo(a+f,s+c),t.quadraticCurveTo(a,s+c,a,s+c-f),"center"===i&&"left"===o&&this.drawCaret(e,t,n,r),t.lineTo(a,s+u),t.quadraticCurveTo(a,s,a+u,s),t.closePath(),t.fill(),r.borderWidth>0&&t.stroke()}_updateAnimationTarget(e){const t=this.chart,n=this.$animations,r=n&&n.x,o=n&&n.y;if(r||o){const n=Yr[e.position].call(this,this._active,this._eventPosition);if(!n)return;const i=this._size=eo(this,e),a=Object.assign({},n,this._size),s=no(t,e,a),l=ro(e,a,s,t);r._to===l.x&&o._to===l.y||(this.xAlign=s.xAlign,this.yAlign=s.yAlign,this.width=i.width,this.height=i.height,this.caretX=n.x,this.caretY=n.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(e){const t=this.options.setContext(this.getContext());let n=this.opacity;if(!n)return;this._updateAnimationTarget(t);const r={width:this.width,height:this.height},o={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;const i=ft(t.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&a&&(e.save(),e.globalAlpha=n,this.drawBackground(o,e,r,t),Ht(e,t.textDirection),o.y+=i.top,this.drawTitle(o,e,t),this.drawBody(o,e,t),this.drawFooter(o,e,t),Wt(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){const n=this._active,r=e.map((({datasetIndex:e,index:t})=>{const n=this.chart.getDatasetMeta(e);if(!n)throw new Error("Cannot find a dataset at index "+e);return{datasetIndex:e,element:n.data[t],index:t}})),o=!W(n,r),i=this._positionChanged(r,t);(o||i)&&(this._active=r,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,n=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const r=this.options,o=this._active||[],i=this._getActiveElements(e,o,t,n),a=this._positionChanged(i,e),s=t||!W(i,o)||a;return s&&(this._active=i,(r.enabled||r.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),s}_getActiveElements(e,t,n,r){const o=this.options;if("mouseout"===e.type)return[];if(!r)return t.filter((e=>this.chart.data.datasets[e.datasetIndex]&&void 0!==this.chart.getDatasetMeta(e.datasetIndex).controller.getParsed(e.index)));const i=this.chart.getElementsAtEventForMode(e,o.mode,o,n);return o.reverse&&i.reverse(),i}_positionChanged(e,t){const{caretX:n,caretY:r,options:o}=this,i=Yr[o.position].call(this,e,t);return!1!==i&&(n!==i.x||r!==i.y)}}var uo={id:"tooltip",_element:co,positioners:Yr,afterInit(e,t,n){n&&(e.tooltip=new co({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(!1===e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0}))return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:so},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>"filter"!==e&&"itemSort"!==e&&"external"!==e,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};function ho(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class fo extends lr{static id="category";static defaults={ticks:{callback:ho}};constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const t=this._addedLabels;if(t.length){const e=this.getLabels();for(const{index:n,label:r}of t)e[n]===r&&e.splice(n,1);this._addedLabels=[]}super.init(e)}parse(e,t){if(I(e))return null;const n=this.getLabels();return((e,t)=>null===e?null:ye(Math.round(e),0,t))(t=isFinite(t)&&n[t]===e?t:function(e,t,n,r){const o=e.indexOf(t);return-1===o?((e,t,n,r)=>("string"==typeof t?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n))(e,t,n,r):o!==e.lastIndexOf(t)?n:o}(n,e,B(t,e),this._addedLabels),n.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:t}=this.getUserBounds();let{min:n,max:r}=this.getMinMax(!0);"ticks"===this.options.bounds&&(e||(n=0),t||(r=this.getLabels().length-1)),this.min=n,this.max=r}buildTicks(){const e=this.min,t=this.max,n=this.options.offset,r=[];let o=this.getLabels();o=0===e&&t===o.length-1?o:o.slice(e,t+1),this._valueRange=Math.max(o.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let n=e;n<=t;n++)r.push({value:n});return r}getLabelForValue(e){return ho.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return"number"!=typeof e&&(e=this.parse(e)),null===e?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}function po(e,t,{horizontal:n,minRotation:r}){const o=pe(r),i=(n?Math.sin(o):Math.cos(o))||.001,a=.75*t*(""+e).length;return Math.min(t/i,a)}class mo extends lr{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return I(e)||("number"==typeof e||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:r,max:o}=this;const i=e=>r=t?r:e,a=e=>o=n?o:e;if(e){const e=ue(r),t=ue(o);e<0&&t<0?a(0):e>0&&t>0&&i(0)}if(r===o){let t=0===o?1:Math.abs(.05*o);a(o+t),e||i(r-t)}this.min=r,this.max=o}getTickLimit(){const e=this.options.ticks;let t,{maxTicksLimit:n,stepSize:r}=e;return r?(t=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,t>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${t} ticks. Limiting to 1000.`),t=1e3)):(t=this.computeTickLimit(),n=n||11),n&&(t=Math.min(n,t)),t}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,t=e.ticks;let n=this.getTickLimit();n=Math.max(2,n);const r=function(e,t){const n=[],{bounds:r,step:o,min:i,max:a,precision:s,count:l,maxTicks:c,maxDigits:u,includeBounds:h}=e,f=o||1,d=c-1,{min:p,max:m}=t,g=!I(i),y=!I(a),v=!I(l),b=(m-p)/(u+1);let x,w,k,S,O=fe((m-p)/d/f)*f;if(O<1e-14&&!g&&!y)return[{value:p},{value:m}];S=Math.ceil(m/O)-Math.floor(p/O),S>d&&(O=fe(S*O/d/f)*f),I(s)||(x=Math.pow(10,s),O=Math.ceil(O*x)/x),"ticks"===r?(w=Math.floor(p/O)*O,k=Math.ceil(m/O)*O):(w=p,k=m),g&&y&&o&&function(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}((a-i)/o,O/1e3)?(S=Math.round(Math.min((a-i)/O,c)),O=(a-i)/S,w=i,k=a):v?(w=g?i:w,k=y?a:k,S=l-1,O=(k-w)/S):(S=(k-w)/O,S=he(S,Math.round(S),O/1e3)?Math.round(S):Math.ceil(S));const _=Math.max(me(O),me(w));x=Math.pow(10,I(s)?_:s),w=Math.round(w*x)/x,k=Math.round(k*x)/x;let E=0;for(g&&(h&&w!==i?(n.push({value:i}),w<i&&E++,he(Math.round((w+E*O)*x)/x,i,po(i,b,e))&&E++):w<i&&E++);E<S;++E){const e=Math.round((w+E*O)*x)/x;if(y&&e>a)break;n.push({value:e})}return y&&h&&k!==a?n.length&&he(n[n.length-1].value,a,po(a,b,e))?n[n.length-1].value=a:n.push({value:a}):y&&k!==a||n.push({value:k}),n}({maxTicks:n,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:!1!==t.includeBounds},this._range||this);return"ticks"===e.bounds&&function(e,t,n){let r,o,i;for(r=0,o=e.length;r<o;r++)i=e[r][n],isNaN(i)||(t.min=Math.min(t.min,i),t.max=Math.max(t.max,i))}(r,this,"value"),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const e=this.ticks;let t=this.min,n=this.max;if(super.configure(),this.options.offset&&e.length){const r=(n-t)/Math.max(e.length-1,1)/2;t-=r,n+=r}this._startValue=t,this._endValue=n,this._valueRange=n-t}getLabelForValue(e){return De(e,this.chart.options.locale,this.options.ticks.format)}}class go extends mo{static id="linear";static defaults={ticks:{callback:Be.formatters.numeric}};determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=D(e)?e:0,this.max=D(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),t=e?this.width:this.height,n=pe(this.options.ticks.minRotation),r=(e?Math.sin(n):Math.cos(n))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,o.lineHeight/r))}getPixelForValue(e){return null===e?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}Be.formatters.logarithmic,Be.formatters.numeric},6841:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>Ze,cx:()=>Ye});var r=n(1594);function o(){return o=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},o.apply(this,arguments)}const i=["children","options"],a={blockQuote:"0",breakLine:"1",breakThematic:"2",codeBlock:"3",codeFenced:"4",codeInline:"5",footnote:"6",footnoteReference:"7",gfmTask:"8",heading:"9",headingSetext:"10",htmlBlock:"11",htmlComment:"12",htmlSelfClosing:"13",image:"14",link:"15",linkAngleBraceStyleDetector:"16",linkBareUrlDetector:"17",linkMailtoDetector:"18",newlineCoalescer:"19",orderedList:"20",paragraph:"21",ref:"22",refImage:"23",refLink:"24",table:"25",tableSeparator:"26",text:"27",textBolded:"28",textEmphasized:"29",textEscaped:"30",textMarked:"31",textStrikethroughed:"32",unorderedList:"33"};var s,l;(l=s||(s={}))[l.MAX=0]="MAX",l[l.HIGH=1]="HIGH",l[l.MED=2]="MED",l[l.LOW=3]="LOW",l[l.MIN=4]="MIN";const c=["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"}),u={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},h=["style","script"],f=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,d=/mailto:/i,p=/\n{2,}$/,m=/^(\s*>[\s\S]*?)(?=\n{2,})/,g=/^ *> ?/gm,y=/^ {2,}\n/,v=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,b=/^\s*(`{3,}|~{3,}) *(\S+)?([^\n]*?)?\n([\s\S]+?)\s*\1 *(?:\n *)*\n?/,x=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,w=/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,k=/^(?:\n *)*\n/,S=/\r\n?/g,O=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,_=/^\[\^([^\]]+)]/,E=/\f/g,C=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,A=/^\s*?\[(x|\s)\]/,j=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,P=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,M=/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/,R=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,T=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,L=/^<!--[\s\S]*?(?:-->)/,I=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,N=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,z=/^\{.*\}$/,D=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,F=/^<([^ >]+@[^ >]+)>/,B=/^<([^ >]+:\/[^ >]+)>/,$=/-([a-z])?/gi,H=/^(.*\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,W=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,q=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,V=/^\[([^\]]*)\] ?\[([^\]]*)\]/,U=/(\[|\])/g,K=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,Q=/\t/g,G=/(^ *\||\| *$)/g,Y=/^ *:-+: *$/,Z=/^ *:-+ *$/,X=/^ *-+: *$/,J="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~~.*?~~|==.*?==|.|\\n)*?)",ee=new RegExp(`^([*_])\\1${J}\\1\\1(?!\\1)`),te=new RegExp(`^([*_])${J}\\1(?!\\1|\\w)`),ne=new RegExp(`^==${J}==`),re=new RegExp(`^~~${J}~~`),oe=/^\\([^0-9A-Za-z\s])/,ie=/^[\s\S]+?(?=[^0-9A-Z\s\u00c0-\uffff&#;.()'"]|\d+\.|\n\n| {2,}\n|\w+:\S|$)/i,ae=/^\n+/,se=/^([ \t]*)/,le=/\\([^\\])/g,ce=/ *\n+$/,ue=/(?:^|\n)( *)$/,he="(?:\\d+\\.)",fe="(?:[*+-])";function de(e){return"( *)("+(1===e?he:fe)+") +"}const pe=de(1),me=de(2);function ge(e){return new RegExp("^"+(1===e?pe:me))}const ye=ge(1),ve=ge(2);function be(e){return new RegExp("^"+(1===e?pe:me)+"[^\\n]*(?:\\n(?!\\1"+(1===e?he:fe)+" )[^\\n]*)*(\\n|$)","gm")}const xe=be(1),we=be(2);function ke(e){const t=1===e?he:fe;return new RegExp("^( *)("+t+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+t+" (?!"+t+" ))\\n*|\\s*\\n*$)")}const Se=ke(1),Oe=ke(2);function _e(e,t){const n=1===t,r=n?Se:Oe,o=n?xe:we,i=n?ye:ve;return{match(e,t,n){const o=ue.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,s=e[0].replace(p,"\n").match(o);let l=!1;return{items:s.map((function(e,n){const o=i.exec(e)[0].length,a=new RegExp("^ {1,"+o+"}","gm"),c=e.replace(a,"").replace(i,""),u=n===s.length-1,h=-1!==c.indexOf("\n\n")||u&&l;l=h;const f=r.inline,d=r.list;let p;r.list=!0,h?(r.inline=!1,p=c.replace(ce,"\n\n")):(r.inline=!0,p=c.replace(ce,""));const m=t(p,r);return r.inline=f,r.list=d,m})),ordered:n,start:a}},render:(t,n,r)=>e(t.ordered?"ol":"ul",{key:r.key,start:t.type===a.orderedList?t.start:void 0},t.items.map((function(t,o){return e("li",{key:o},n(t,r))})))}}const Ee=new RegExp("^\\[((?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),Ce=/^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/,Ae=[m,b,x,j,M,P,L,H,xe,Se,we,Oe],je=[...Ae,/^[^\n]+(?:  \n|\n{2,})/,R,N];function Pe(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 Me(e){return X.test(e)?"right":Y.test(e)?"center":Z.test(e)?"left":null}function Re(e,t,n,r){const o=n.inTable;n.inTable=!0;let i=e.trim().split(/( *(?:`[^`]*`|<.*?>.*?<\/.*?>(?!<\/.*?>)|\\\||\|) *)/).reduce(((e,o)=>("|"===o.trim()?e.push(r?{type:a.tableSeparator}:{type:a.text,text:o}):""!==o&&e.push.apply(e,t(o,n)),e)),[]);n.inTable=o;let s=[[]];return i.forEach((function(e,t){e.type===a.tableSeparator?0!==t&&t!==i.length-1&&s.push([]):(e.type!==a.text||null!=i[t+1]&&i[t+1].type!==a.tableSeparator||(e.text=e.text.trimEnd()),s[s.length-1].push(e))})),s}function Te(e,t,n){n.inline=!0;const r=e[2]?e[2].replace(G,"").split("|").map(Me):[],o=e[3]?function(e,t,n){return e.trim().split("\n").map((function(e){return Re(e,t,n,!0)}))}(e[3],t,n):[],i=Re(e[1],t,n,!!o.length);return n.inline=!1,o.length?{align:r,cells:o,header:i,type:a.table}:{children:i,type:a.paragraph}}function Le(e,t){return null==e.align[t]?{}:{textAlign:e.align[t]}}function Ie(e){return function(t,n){return n.inline?e.exec(t):null}}function Ne(e){return function(t,n){return n.inline||n.simple?e.exec(t):null}}function ze(e){return function(t,n){return n.inline||n.simple?null:e.exec(t)}}function De(e){return function(t){return e.exec(t)}}function Fe(e,t,n){if(t.inline||t.simple)return null;if(n&&!n.endsWith("\n"))return null;let r="";e.split("\n").every((e=>!Ae.some((t=>t.test(e)))&&(r+=e+"\n",e.trim())));const o=r.trimEnd();return""==o?null:[r,o]}function Be(e){try{if(decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"").match(/^\s*(javascript|vbscript|data(?!:image)):/i))return null}catch(e){return null}return e}function $e(e){return e.replace(le,"$1")}function He(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 We(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 qe(e,t,n){const r=n.inline||!1;n.inline=!1;const o=e(t,n);return n.inline=r,o}const Ve=(e,t,n)=>({children:He(t,e[1],n)});function Ue(){return{}}function Ke(){return null}function Qe(...e){return e.filter(Boolean).join(" ")}function Ge(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 Ye(e="",t={}){function n(e,n,...r){const i=Ge(t.overrides,`${e}.props`,{});return t.createElement(function(e,t){const n=Ge(t,e);return n?"function"==typeof n||"object"==typeof n&&"render"in n?n:Ge(t,`${e}.component`,e):e}(e,t.overrides),o({},n,i,{className:Qe(null==n?void 0:n.className,i.className)||void 0}),...r)}function i(e){e=e.replace(C,"");let o=!1;t.forceInline?o=!0:t.forceBlock||(o=!1===K.test(e));const i=Z(Y(o?e:`${e.trimEnd().replace(ae,"")}\n\n`,{inline:o}));for(;"string"==typeof i[i.length-1]&&!i[i.length-1].trim();)i.pop();if(null===t.wrapper)return i;const a=t.wrapper||(o?"span":"div");let s;if(i.length>1||t.forceWrapper)s=i;else{if(1===i.length)return s=i[0],"string"==typeof s?n("span",{key:"outer"},s):s;s=null}return r.createElement(a,{key:"outer"},s)}function s(e,n){const o=n.match(f);return o?o.reduce((function(n,o,a){const s=o.indexOf("=");if(-1!==s){const l=function(e){return-1!==e.indexOf("-")&&null===e.match(I)&&(e=e.replace($,(function(e,t){return t.toUpperCase()}))),e}(o.slice(0,s)).trim(),u=function(e){const t=e[0];return('"'===t||"'"===t)&&e.length>=2&&e[e.length-1]===t?e.slice(1,-1):e}(o.slice(s+1).trim()),h=c[l]||l,f=n[h]=function(e,t,n,r){return"style"===t?n.split(/;\s?/).reduce((function(e,t){const n=t.slice(0,t.indexOf(":"));return e[n.trim().replace(/(-[a-z])/g,(e=>e[1].toUpperCase()))]=t.slice(n.length+1).trim(),e}),{}):"href"===t||"src"===t?r(n,e,t):(n.match(z)&&(n=n.slice(1,n.length-1)),"true"===n||"false"!==n&&n)}(e,l,u,t.sanitizer);"string"==typeof f&&(R.test(f)||N.test(f))&&(n[h]=r.cloneElement(i(f.trim()),{key:a}))}else"style"!==o&&(n[c[o]||o]=!0);return n}),{}):null}t.overrides=t.overrides||{},t.sanitizer=t.sanitizer||Be,t.slugify=t.slugify||Pe,t.namedCodesToUnicode=t.namedCodesToUnicode?o({},u,t.namedCodesToUnicode):u,t.createElement=t.createElement||r.createElement;const l=[],p={},G={[a.blockQuote]:{match:ze(m),order:1,parse:(e,t,n)=>({children:t(e[0].replace(g,""),n)}),render:(e,t,r)=>n("blockquote",{key:r.key},t(e.children,r))},[a.breakLine]:{match:De(y),order:1,parse:Ue,render:(e,t,r)=>n("br",{key:r.key})},[a.breakThematic]:{match:ze(v),order:1,parse:Ue,render:(e,t,r)=>n("hr",{key:r.key})},[a.codeBlock]:{match:ze(x),order:0,parse:e=>({lang:void 0,text:e[0].replace(/^ {4}/gm,"").replace(/\n+$/,"")}),render:(e,t,r)=>n("pre",{key:r.key},n("code",o({},e.attrs,{className:e.lang?`lang-${e.lang}`:""}),e.text))},[a.codeFenced]:{match:ze(b),order:0,parse:e=>({attrs:s("code",e[3]||""),lang:e[2]||void 0,text:e[4],type:a.codeBlock})},[a.codeInline]:{match:Ne(w),order:3,parse:e=>({text:e[2]}),render:(e,t,r)=>n("code",{key:r.key},e.text)},[a.footnote]:{match:ze(O),order:0,parse:e=>(l.push({footnote:e[2],identifier:e[1]}),{}),render:Ke},[a.footnoteReference]:{match:Ie(_),order:1,parse:e=>({target:`#${t.slugify(e[1],Pe)}`,text:e[1]}),render:(e,r,o)=>n("a",{key:o.key,href:t.sanitizer(e.target,"a","href")},n("sup",{key:o.key},e.text))},[a.gfmTask]:{match:Ie(A),order:1,parse:e=>({completed:"x"===e[1].toLowerCase()}),render:(e,t,r)=>n("input",{checked:e.completed,key:r.key,readOnly:!0,type:"checkbox"})},[a.heading]:{match:ze(t.enforceAtxHeadings?P:j),order:1,parse:(e,n,r)=>({children:He(n,e[2],r),id:t.slugify(e[2],Pe),level:e[1].length}),render:(e,t,r)=>n(`h${e.level}`,{id:e.id,key:r.key},t(e.children,r))},[a.headingSetext]:{match:ze(M),order:0,parse:(e,t,n)=>({children:He(t,e[1],n),level:"="===e[2]?1:2,type:a.heading})},[a.htmlBlock]:{match:De(R),order:1,parse(e,t,n){const[,r]=e[3].match(se),o=new RegExp(`^${r}`,"gm"),i=e[3].replace(o,""),a=(l=i,je.some((e=>e.test(l)))?qe:He);var l;const c=e[1].toLowerCase(),u=-1!==h.indexOf(c),f=(u?c:e[1]).trim(),d={attrs:s(f,e[2]),noInnerParse:u,tag:f};return n.inAnchor=n.inAnchor||"a"===c,u?d.text=e[3]:d.children=a(t,i,n),n.inAnchor=!1,d},render:(e,t,r)=>n(e.tag,o({key:r.key},e.attrs),e.text||t(e.children,r))},[a.htmlSelfClosing]:{match:De(N),order:1,parse(e){const t=e[1].trim();return{attrs:s(t,e[2]||""),tag:t}},render:(e,t,r)=>n(e.tag,o({},e.attrs,{key:r.key}))},[a.htmlComment]:{match:De(L),order:1,parse:()=>({}),render:Ke},[a.image]:{match:Ne(Ce),order:1,parse:e=>({alt:e[1],target:$e(e[2]),title:e[3]}),render:(e,r,o)=>n("img",{key:o.key,alt:e.alt||void 0,title:e.title||void 0,src:t.sanitizer(e.target,"img","src")})},[a.link]:{match:Ie(Ee),order:3,parse:(e,t,n)=>({children:We(t,e[1],n),target:$e(e[2]),title:e[3]}),render:(e,r,o)=>n("a",{key:o.key,href:t.sanitizer(e.target,"a","href"),title:e.title},r(e.children,o))},[a.linkAngleBraceStyleDetector]:{match:Ie(B),order:0,parse:e=>({children:[{text:e[1],type:a.text}],target:e[1],type:a.link})},[a.linkBareUrlDetector]:{match:(e,t)=>t.inAnchor?null:Ie(D)(e,t),order:0,parse:e=>({children:[{text:e[1],type:a.text}],target:e[1],title:void 0,type:a.link})},[a.linkMailtoDetector]:{match:Ie(F),order:0,parse(e){let t=e[1],n=e[1];return d.test(n)||(n="mailto:"+n),{children:[{text:t.replace("mailto:",""),type:a.text}],target:n,type:a.link}}},[a.orderedList]:_e(n,1),[a.unorderedList]:_e(n,2),[a.newlineCoalescer]:{match:ze(k),order:3,parse:Ue,render:()=>"\n"},[a.paragraph]:{match:Fe,order:3,parse:Ve,render:(e,t,r)=>n("p",{key:r.key},t(e.children,r))},[a.ref]:{match:Ie(W),order:0,parse:e=>(p[e[1]]={target:e[2],title:e[4]},{}),render:Ke},[a.refImage]:{match:Ne(q),order:0,parse:e=>({alt:e[1]||void 0,ref:e[2]}),render:(e,r,o)=>p[e.ref]?n("img",{key:o.key,alt:e.alt,src:t.sanitizer(p[e.ref].target,"img","src"),title:p[e.ref].title}):null},[a.refLink]:{match:Ie(V),order:0,parse:(e,t,n)=>({children:t(e[1],n),fallbackChildren:t(e[0].replace(U,"\\$1"),n),ref:e[2]}),render:(e,r,o)=>p[e.ref]?n("a",{key:o.key,href:t.sanitizer(p[e.ref].target,"a","href"),title:p[e.ref].title},r(e.children,o)):n("span",{key:o.key},r(e.fallbackChildren,o))},[a.table]:{match:ze(H),order:1,parse:Te,render(e,t,r){const o=e;return n("table",{key:r.key},n("thead",null,n("tr",null,o.header.map((function(e,i){return n("th",{key:i,style:Le(o,i)},t(e,r))})))),n("tbody",null,o.cells.map((function(e,i){return n("tr",{key:i},e.map((function(e,i){return n("td",{key:i,style:Le(o,i)},t(e,r))})))}))))}},[a.text]:{match:De(ie),order:4,parse:e=>({text:e[0].replace(T,((e,n)=>t.namedCodesToUnicode[n]?t.namedCodesToUnicode[n]:e))}),render:e=>e.text},[a.textBolded]:{match:Ne(ee),order:2,parse:(e,t,n)=>({children:t(e[2],n)}),render:(e,t,r)=>n("strong",{key:r.key},t(e.children,r))},[a.textEmphasized]:{match:Ne(te),order:3,parse:(e,t,n)=>({children:t(e[2],n)}),render:(e,t,r)=>n("em",{key:r.key},t(e.children,r))},[a.textEscaped]:{match:Ne(oe),order:1,parse:e=>({text:e[1],type:a.text})},[a.textMarked]:{match:Ne(ne),order:3,parse:Ve,render:(e,t,r)=>n("mark",{key:r.key},t(e.children,r))},[a.textStrikethroughed]:{match:Ne(re),order:3,parse:Ve,render:(e,t,r)=>n("del",{key:r.key},t(e.children,r))}};!0===t.disableParsingRawHTML&&(delete G[a.htmlBlock],delete G[a.htmlSelfClosing]);const Y=function(e){let t=Object.keys(e);function n(r,o){let i=[],a="";for(;r;){let s=0;for(;s<t.length;){const l=t[s],c=e[l],u=c.match(r,o,a);if(u){const e=u[0];r=r.substring(e.length);const t=c.parse(u,n,o);null==t.type&&(t.type=l),i.push(t),a=e;break}s++}}return i}return t.sort((function(t,n){let r=e[t].order,o=e[n].order;return r!==o?r-o:t<n?-1:1})),function(e,t){return n(function(e){return e.replace(S,"\n").replace(E,"").replace(Q,"    ")}(e),t)}}(G),Z=(X=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)}}(G,t.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),s="string"==typeof a;s&&i?o[o.length-1]+=a:null!==a&&o.push(a),i=s}return n.key=r,o}return X(t,e,n)});var X;const J=i(e);return l.length?n("div",null,J,n("footer",{key:"footer"},l.map((function(e){return n("div",{id:t.slugify(e.identifier,Pe),key:e.identifier},e.identifier,Z(Y(e.footnote,{inline:!0})))})))):J}const Ze=e=>{let{children:t="",options:n}=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,i);return r.cloneElement(Ye(t,n),o)}},4731:(e,t,n)=>{"use strict";n.d(t,{yP:()=>d});var r=n(1594),o=n(2262);const i="label";function a(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function s(e,t){e.labels=t}function l(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i;const r=[];e.datasets=t.map((t=>{const o=e.datasets.find((e=>e[n]===t[n]));return o&&t.data&&!r.includes(o)?(r.push(o),Object.assign(o,t),o):{...t}}))}function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i;const n={labels:[],datasets:[]};return s(n,e.labels),l(n,e.datasets,t),n}function u(e,t){const{height:n=150,width:i=300,redraw:u=!1,datasetIdKey:h,type:f,data:d,options:p,plugins:m=[],fallbackContent:g,updateMode:y,...v}=e,b=(0,r.useRef)(null),x=(0,r.useRef)(),w=()=>{b.current&&(x.current=new o.t1(b.current,{type:f,data:c(d,h),options:p&&{...p},plugins:m}),a(t,x.current))},k=()=>{a(t,null),x.current&&(x.current.destroy(),x.current=null)};return(0,r.useEffect)((()=>{!u&&x.current&&p&&function(e,t){const n=e.options;n&&t&&Object.assign(n,t)}(x.current,p)}),[u,p]),(0,r.useEffect)((()=>{!u&&x.current&&s(x.current.config.data,d.labels)}),[u,d.labels]),(0,r.useEffect)((()=>{!u&&x.current&&d.datasets&&l(x.current.config.data,d.datasets,h)}),[u,d.datasets]),(0,r.useEffect)((()=>{x.current&&(u?(k(),setTimeout(w)):x.current.update(y))}),[u,p,d.labels,d.datasets,y]),(0,r.useEffect)((()=>{x.current&&(k(),setTimeout(w))}),[f]),(0,r.useEffect)((()=>(w(),()=>k())),[]),r.createElement("canvas",Object.assign({ref:b,role:"img",height:n,width:i},v),g)}const h=(0,r.forwardRef)(u);function f(e,t){return o.t1.register(t),(0,r.forwardRef)(((t,n)=>r.createElement(h,Object.assign({},t,{ref:n,type:e}))))}const d=f("bar",o.A6)},7612:(e,t,n)=>{"use strict";n.d(t,{jI:()=>M});var r=n(1594);function o(){return(o=Object.assign||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}).apply(this,arguments)}function i(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}function a(e){var t=(0,r.useRef)(e),n=(0,r.useRef)((function(e){t.current&&t.current(e)}));return t.current=e,n.current}var s=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e<t?t:e},l=function(e){return"touches"in e},c=function(e){return e&&e.ownerDocument.defaultView||self},u=function(e,t,n){var r=e.getBoundingClientRect(),o=l(t)?function(e,t){for(var n=0;n<e.length;n++)if(e[n].identifier===t)return e[n];return e[0]}(t.touches,n):t;return{left:s((o.pageX-(r.left+c(e).pageXOffset))/r.width),top:s((o.pageY-(r.top+c(e).pageYOffset))/r.height)}},h=function(e){!l(e)&&e.preventDefault()},f=r.memo((function(e){var t=e.onMove,n=e.onKey,s=i(e,["onMove","onKey"]),f=(0,r.useRef)(null),d=a(t),p=a(n),m=(0,r.useRef)(null),g=(0,r.useRef)(!1),y=(0,r.useMemo)((function(){var e=function(e){h(e),(l(e)?e.touches.length>0:e.buttons>0)&&f.current?d(u(f.current,e,m.current)):n(!1)},t=function(){return n(!1)};function n(n){var r=g.current,o=c(f.current),i=n?o.addEventListener:o.removeEventListener;i(r?"touchmove":"mousemove",e),i(r?"touchend":"mouseup",t)}return[function(e){var t=e.nativeEvent,r=f.current;if(r&&(h(t),!function(e,t){return t&&!l(e)}(t,g.current)&&r)){if(l(t)){g.current=!0;var o=t.changedTouches||[];o.length&&(m.current=o[0].identifier)}r.focus(),d(u(r,t,m.current)),n(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),p({left:39===t?.05:37===t?-.05:0,top:40===t?.05:38===t?-.05:0}))},n]}),[p,d]),v=y[0],b=y[1],x=y[2];return(0,r.useEffect)((function(){return x}),[x]),r.createElement("div",o({},s,{onTouchStart:v,onMouseDown:v,className:"react-colorful__interactive",ref:f,onKeyDown:b,tabIndex:0,role:"slider"}))})),d=function(e){return e.filter(Boolean).join(" ")},p=function(e){var t=e.color,n=e.left,o=e.top,i=void 0===o?.5:o,a=d(["react-colorful__pointer",e.className]);return r.createElement("div",{className:a,style:{top:100*i+"%",left:100*n+"%"}},r.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},m=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n},g=(Math.PI,function(e){return k(y(e))}),y=function(e){return"#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?m(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?m(parseInt(e.substring(6,8),16)/255,2):1}},v=function(e){var t=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:m(e.h),s:m(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:m(o/2),a:m(r,2)}}(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},b=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var i=Math.floor(t),a=r*(1-n),s=r*(1-(t-i)*n),l=r*(1-(1-t+i)*n),c=i%6;return{r:m(255*[r,s,a,a,l,r][c]),g:m(255*[l,r,r,s,a,a][c]),b:m(255*[a,a,l,r,r,s][c]),a:m(o,2)}},x=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},w=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,i=o<1?x(m(255*o)):"";return"#"+x(t)+x(n)+x(r)+i},k=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,i=Math.max(t,n,r),a=i-Math.min(t,n,r),s=a?i===t?(n-r)/a:i===n?2+(r-t)/a:4+(t-n)/a:0;return{h:m(60*(s<0?s+6:s)),s:m(i?a/i*100:0),v:m(i/255*100),a:o}},S=r.memo((function(e){var t=e.hue,n=e.onChange,o=d(["react-colorful__hue",e.className]);return r.createElement("div",{className:o},r.createElement(f,{onMove:function(e){n({h:360*e.left})},onKey:function(e){n({h:s(t+360*e.left,0,360)})},"aria-label":"Hue","aria-valuenow":m(t),"aria-valuemax":"360","aria-valuemin":"0"},r.createElement(p,{className:"react-colorful__hue-pointer",left:t/360,color:v({h:t,s:100,v:100,a:1})})))})),O=r.memo((function(e){var t=e.hsva,n=e.onChange,o={backgroundColor:v({h:t.h,s:100,v:100,a:1})};return r.createElement("div",{className:"react-colorful__saturation",style:o},r.createElement(f,{onMove:function(e){n({s:100*e.left,v:100-100*e.top})},onKey:function(e){n({s:s(t.s+100*e.left,0,100),v:s(t.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+m(t.s)+"%, Brightness "+m(t.v)+"%"},r.createElement(p,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:v(t)})))})),_=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function E(e,t,n){var o=a(n),i=(0,r.useState)((function(){return e.toHsva(t)})),s=i[0],l=i[1],c=(0,r.useRef)({color:t,hsva:s});(0,r.useEffect)((function(){if(!e.equal(t,c.current.color)){var n=e.toHsva(t);c.current={hsva:n,color:t},l(n)}}),[t,e]),(0,r.useEffect)((function(){var t;_(s,c.current.hsva)||e.equal(t=e.fromHsva(s),c.current.color)||(c.current={hsva:s,color:t},o(t))}),[s,e,o]);var u=(0,r.useCallback)((function(e){l((function(t){return Object.assign({},t,e)}))}),[]);return[s,u]}var C="undefined"!=typeof window?r.useLayoutEffect:r.useEffect,A=new Map,j=function(e){var t,a=e.className,s=e.colorModel,l=e.color,c=void 0===l?s.defaultColor:l,u=e.onChange,h=i(e,["className","colorModel","color","onChange"]),f=(0,r.useRef)(null);t=f,C((function(){var e=t.current?t.current.ownerDocument:document;if(void 0!==e&&!A.has(e)){var r=e.createElement("style");r.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',A.set(e,r);var o=n.nc;o&&r.setAttribute("nonce",o),e.head.appendChild(r)}}),[]);var p=E(s,c,u),m=p[0],g=p[1],y=d(["react-colorful",a]);return r.createElement("div",o({},h,{ref:f,className:y}),r.createElement(O,{hsva:m,onChange:g}),r.createElement(S,{hue:m.h,onChange:g,className:"react-colorful__last-control"}))},P={defaultColor:"000",toHsva:g,fromHsva:function(e){return function(e){return w(b(e))}({h:e.h,s:e.s,v:e.v,a:1})},equal:function(e,t){return e.toLowerCase()===t.toLowerCase()||_(y(e),y(t))}},M=function(e){return r.createElement(j,o({},e,{colorModel:P}))}},2902:(e,t,n)=>{"use strict";function r(){return r=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},r.apply(this,arguments)}n.d(t,{A:()=>s});var o={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){}},i=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=r({},o,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 i=Array.prototype.slice.apply(e.stringsElement.children),a=i.length;if(a)for(var s=0;s<a;s+=1)e.strings.push(i[s].innerHTML.trim())}for(var l 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[l]=l;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}()),a=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}()),s=function(){function e(e,t){i.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=a.typeHtmlChars(e,t,n);var r=0,i=e.substring(t);if("^"===i.charAt(0)&&/^\^\d+/.test(i)){var s=1;s+=(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+s),n.toggleBlinking(!0)}if("`"===i.charAt(0)){for(;"`"!==e.substring(t+o).charAt(0)&&(o++,!(t+o>e.length)););var l=e.substring(0,t),c=e.substring(l.length+1,t+o),u=e.substring(t+o+1);e=l+c+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=a.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}()}}]);
  • ai-engine/trunk/classes/engines/anthropic.php

    r3144578 r3153708  
    143143        "messages" => []
    144144      );
     145
     146      if ( !empty( $query->instructions ) ) {
     147        $body['system'] = $query->instructions;
     148      }
    145149
    146150      // Build the messages
  • ai-engine/trunk/classes/engines/openai.php

    r3144578 r3153708  
    8989  }
    9090
     91  private function is_o1_model( $model ) {
     92    $modelDef = $this->retrieve_model_info( $model );
     93    return !empty( $modelDef['tags'] ) && in_array( 'o1-model', $modelDef['tags'] );
     94  }
     95
    9196  protected function build_messages( $query ) {
    9297    $messages = [];
     
    9499    // First, we need to add the first message (the instructions).
    95100    if ( !empty( $query->instructions ) ) {
    96       $messages[] = [ 'role' => 'system', 'content' => $query->instructions ];
     101      if ( !$this->is_o1_model( $query->model ) ) {
     102        $messages[] = [ 'role' => 'system', 'content' => $query->instructions ];
     103      }
    97104    }
    98105
     
    147154
    148155      if ( !empty( $query->maxTokens ) ) {
    149         $body['max_tokens'] = $query->maxTokens;
     156        if ( !$this->is_o1_model( $query->model ) ) {
     157          $body['max_tokens'] = $query->maxTokens;
     158        }
     159        else {
     160          $body['max_completion_tokens'] = $query->maxTokens;
     161        }
    150162      }
    151163
    152164      if ( !empty( $query->temperature ) ) {
    153         $body['temperature'] = $query->temperature;
     165        if ( !$this->is_o1_model( $query->model ) ) {
     166          $body['temperature'] = $query->temperature;
     167        }
     168        else {
     169          $body['temperature'] = 1;
     170        }
    154171      }
    155172
     
    576593  }
    577594
     595  public function run( $query, $streamCallback = null, $maxDepth = 5 ) {
     596    if ( $streamCallback ) {
     597      // Disable streaming for o1 models
     598      if ( $this->is_o1_model( $query->model ) ) {
     599        $streamCallback = null;
     600      }
     601    }
     602    return parent::run( $query, $streamCallback, $maxDepth );
     603  }
     604
    578605  public function run_query( $url, $options, $isStream = false ) {
    579606    try {
  • ai-engine/trunk/constants/models.php

    r3140724 r3153708  
    3232        "type" => "token",
    3333        "unit" => 1 / 1000000,
    34         "maxCompletionTokens" => 4096,
     34        "maxCompletionTokens" => 16384,
    3535        "maxContextualTokens" => 128000,
    3636        "finetune" => [
     
    4040        ],
    4141        "tags" => ['core', 'chat', 'vision', 'functions', 'json', 'finetune']
     42    ],
     43    [
     44        "model" => "o1-preview",
     45        "name" => "o1 Preview",
     46        "family" => "o1",
     47        "features" => ['completion'],
     48        "price" => [
     49            "in" => 15.00,
     50            "out" => 60.00,
     51        ],
     52        "type" => "token",
     53        "unit" => 1 / 1000000,
     54        "maxCompletionTokens" => 32768,
     55        "maxContextualTokens" => 128000,
     56        "tags" => ['core', 'chat', 'o1-model']
     57    ],
     58    [
     59        "model" => "o1-mini",
     60        "name" => "o1 Mini",
     61        "family" => "o1",
     62        "features" => ['completion'],
     63        "price" => [
     64            "in" => 3.00,
     65            "out" => 12.00,
     66        ],
     67        "type" => "token",
     68        "unit" => 1 / 1000000,
     69        "maxCompletionTokens" => 65536,
     70        "maxContextualTokens" => 128000,
     71        "tags" => ['core', 'chat', 'o1-model']
    4272    ],
    4373    [
  • ai-engine/trunk/readme.txt

    r3144578 r3153708  
    66Tested up to: 6.6
    77Requires PHP: 7.4
    8 Stable tag: 2.6.1
     8Stable tag: 2.6.2
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    6666
    6767== Changelog ==
     68
     69= 2.6.2 (2024/09/18) =
     70* Add: Support for the new o1 models from OpenAI (preview and mini).
     71* Fix: A few minor fixes for developers.
     72* 🎵 Discuss with others about AI Engine on [the Discord](https://discord.gg/bHDGh38).
     73* 🌴 Keep us motivated with [a little review here](https://wordpress.org/support/plugin/ai-engine/reviews/). Thank you!
     74* 🥰 If you want to help us, we started a [Patreon](https://www.patreon.com/meowapps). Thank you!
     75* 🚀 [Click here](https://trello.com/b/8U9SdiMy/ai-engine-feature-requests) to vote for the features you want the most.
    6876
    6977= 2.6.1 (2024/08/31) =
     
    109117* Update: Finetuning features in AI Engine has been improved, like the way they are handled, displayed, calculated, etc.
    110118* Fix: Max Messages was missing in the custom shortcode.
    111 * ☀️ If you want to help us, we started a [Patreon](https://www.patreon.com/meowapps). Thank you!
    112119
    113120= 2.5.3 (2024/08/01) =
     
    135142* Fix: The expiration 'Never' was crashing when used with Assistants Upload.
    136143* Update: If DevTools is disabled, all the related debug options are disabled as well.
    137 * 🚀 [Click here](https://trello.com/b/8U9SdiMy/ai-engine-feature-requests) to vote for the features you want the most.
    138 * 🎵 Discuss with others about AI Engine on [my Discord](https://discord.gg/bHDGh38).
    139 * 🌴 Keep us motivated with [a little review here](https://wordpress.org/support/plugin/ai-engine/reviews/). Thank you!
    140144
    141145= 2.5.0 (2024/07/23) =
Note: See TracChangeset for help on using the changeset viewer.