muryshev commited on
Commit
28f3b46
·
1 Parent(s): 3b437b3
dist/assets/{index-CajeydU-.js → index--I6HCIVw.js} RENAMED
@@ -85,6 +85,6 @@ Error generating stack: `+l.message+`
85
  `});++r<e.length;)r&&n.push({type:"text",value:`
86
  `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
87
  `}),n}function Ed(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Cd(e,t){const n=HS(e,t),r=n.one(e,void 0),i=RS(n),l=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&l.children.push({type:"text",value:`
88
- `},i),l}function KS(e,t){return e&&"run"in e?async function(n,r){const i=Cd(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Cd(n,{file:r,...e||t})}}function Pd(e){if(e)throw e}var Vl=Object.prototype.hasOwnProperty,gy=Object.prototype.toString,_d=Object.defineProperty,Td=Object.getOwnPropertyDescriptor,Id=function(t){return typeof Array.isArray=="function"?Array.isArray(t):gy.call(t)==="[object Array]"},Od=function(t){if(!t||gy.call(t)!=="[object Object]")return!1;var n=Vl.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Vl.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||Vl.call(t,i)},Nd=function(t,n){_d&&n.name==="__proto__"?_d(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Rd=function(t,n){if(n==="__proto__")if(Vl.call(t,n)){if(Td)return Td(t,n).value}else return;return t[n]},qS=function e(){var t,n,r,i,l,o,u=arguments[0],s=1,a=arguments.length,c=!1;for(typeof u=="boolean"&&(c=u,u=arguments[1]||{},s=2),(u==null||typeof u!="object"&&typeof u!="function")&&(u={});s<a;++s)if(t=arguments[s],t!=null)for(n in t)r=Rd(u,n),i=Rd(t,n),u!==i&&(c&&i&&(Od(i)||(l=Id(i)))?(l?(l=!1,o=r&&Id(r)?r:[]):o=r&&Od(r)?r:{},Nd(u,{name:n,newValue:e(c,o,i)})):typeof i<"u"&&Nd(u,{name:n,newValue:i}));return u};const Au=la(qS);function Xs(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function GS(){const e=[],t={run:n,use:r};return t;function n(...i){let l=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);u(null,...i);function u(s,...a){const c=e[++l];let f=-1;if(s){o(s);return}for(;++f<i.length;)(a[f]===null||a[f]===void 0)&&(a[f]=i[f]);i=a,c?XS(c,u)(...a):o(null,...a)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function XS(e,t){let n;return r;function r(...o){const u=e.length>o.length;let s;u&&o.push(i);try{s=e.apply(this,o)}catch(a){const c=a;if(u&&n)throw c;return i(c)}u||(s&&s.then&&typeof s.then=="function"?s.then(l,i):s instanceof Error?i(s):l(s))}function i(o,...u){n||(n=!0,t(o,...u))}function l(o){i(null,o)}}const zt={basename:YS,dirname:JS,extname:ZS,join:eE,sep:"/"};function YS(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ol(e);let n=0,r=-1,i=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(l){n=i+1;break}}else r<0&&(l=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,u=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(l){n=i+1;break}}else o<0&&(l=!0,o=i+1),u>-1&&(e.codePointAt(i)===t.codePointAt(u--)?u<0&&(r=i):(u=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function JS(e){if(ol(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function ZS(e){ol(e);let t=e.length,n=-1,r=0,i=-1,l=0,o;for(;t--;){const u=e.codePointAt(t);if(u===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),u===46?i<0?i=t:l!==1&&(l=1):i>-1&&(l=-1)}return i<0||n<0||l===0||l===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function eE(...e){let t=-1,n;for(;++t<e.length;)ol(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":tE(n)}function tE(e){ol(e);const t=e.codePointAt(0)===47;let n=nE(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function nE(e,t){let n="",r=0,i=-1,l=0,o=-1,u,s;for(;++o<=e.length;){if(o<e.length)u=e.codePointAt(o);else{if(u===47)break;u=47}if(u===47){if(!(i===o-1||l===1))if(i!==o-1&&l===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(s=n.lastIndexOf("/"),s!==n.length-1){s<0?(n="",r=0):(n=n.slice(0,s),r=n.length-1-n.lastIndexOf("/")),i=o,l=0;continue}}else if(n.length>0){n="",r=0,i=o,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,l=0}else u===46&&l>-1?l++:l=-1}return n}function ol(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const rE={cwd:iE};function iE(){return"/"}function Ys(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function lE(e){if(typeof e=="string")e=new URL(e);else if(!Ys(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return oE(e)}function oE(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Mu=["history","path","basename","stem","extname","dirname"];class vy{constructor(t){let n;t?Ys(t)?n={path:t}:typeof t=="string"||uE(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":rE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Mu.length;){const l=Mu[r];l in n&&n[l]!==void 0&&n[l]!==null&&(this[l]=l==="history"?[...n[l]]:n[l])}let i;for(i in n)Mu.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?zt.basename(this.path):void 0}set basename(t){ju(t,"basename"),Fu(t,"basename"),this.path=zt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?zt.dirname(this.path):void 0}set dirname(t){zd(this.basename,"dirname"),this.path=zt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?zt.extname(this.path):void 0}set extname(t){if(Fu(t,"extname"),zd(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=zt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ys(t)&&(t=lE(t)),ju(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?zt.basename(this.path,this.extname):void 0}set stem(t){ju(t,"stem"),Fu(t,"stem"),this.path=zt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Ae(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Fu(e,t){if(e&&e.includes(zt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+zt.sep+"`")}function ju(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function zd(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function uE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const sE=function(e){const r=this.constructor.prototype,i=r[e],l=function(){return i.apply(l,arguments)};return Object.setPrototypeOf(l,r),l},aE={}.hasOwnProperty;class yc extends sE{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=GS()}copy(){const t=new yc;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Au(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Uu("data",this.frozen),this.namespace[t]=n,this):aE.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Uu("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Il(t),r=this.parser||this.Parser;return bu("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),bu("process",this.parser||this.Parser),Bu("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(l,o){const u=Il(t),s=r.parse(u);r.run(s,u,function(c,f,p){if(c||!f||!p)return a(c);const d=f,v=r.stringify(d,p);dE(v)?p.value=v:p.result=v,a(c,p)});function a(c,f){c||!f?o(c):l?l(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),bu("processSync",this.parser||this.Parser),Bu("processSync",this.compiler||this.Compiler),this.process(t,i),Dd("processSync","process",n),r;function i(l,o){n=!0,Pd(l),r=o}}run(t,n,r){Ld(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?l(void 0,r):new Promise(l);function l(o,u){const s=Il(n);i.run(t,s,a);function a(c,f,p){const d=f||t;c?u(c):o?o(d):r(void 0,d,p)}}}runSync(t,n){let r=!1,i;return this.run(t,n,l),Dd("runSync","run",r),i;function l(o,u){Pd(o),i=u,r=!0}}stringify(t,n){this.freeze();const r=Il(n),i=this.compiler||this.Compiler;return Bu("stringify",i),Ld(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Uu("use",this.frozen),t!=null)if(typeof t=="function")s(t,n);else if(typeof t=="object")Array.isArray(t)?u(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function l(a){if(typeof a=="function")s(a,[]);else if(typeof a=="object")if(Array.isArray(a)){const[c,...f]=a;s(c,f)}else o(a);else throw new TypeError("Expected usable value, not `"+a+"`")}function o(a){if(!("plugins"in a)&&!("settings"in a))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");u(a.plugins),a.settings&&(i.settings=Au(!0,i.settings,a.settings))}function u(a){let c=-1;if(a!=null)if(Array.isArray(a))for(;++c<a.length;){const f=a[c];l(f)}else throw new TypeError("Expected a list of plugins, not `"+a+"`")}function s(a,c){let f=-1,p=-1;for(;++f<r.length;)if(r[f][0]===a){p=f;break}if(p===-1)r.push([a,...c]);else if(c.length>0){let[d,...v]=c;const w=r[p][1];Xs(w)&&Xs(d)&&(d=Au(!0,w,d)),r[p]=[a,d,...v]}}}}const cE=new yc().freeze();function bu(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Bu(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Uu(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ld(e){if(!Xs(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Dd(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Il(e){return fE(e)?e:new vy(e)}function fE(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function dE(e){return typeof e=="string"||pE(e)}function pE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const hE="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ad=[],Md={allowDangerousHtml:!0},mE=/^(https?|ircs?|mailto|xmpp)$/i,yE=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function wy(e){const t=gE(e),n=vE(e);return wE(t.runSync(t.parse(n),n),e)}function gE(e){const t=e.rehypePlugins||Ad,n=e.remarkPlugins||Ad,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Md}:Md;return cE().use(Jk).use(n).use(KS,r).use(t)}function vE(e){const t=e.children||"",n=new vy;return typeof t=="string"&&(n.value=t),n}function wE(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,l=t.disallowedElements,o=t.skipHtml,u=t.unwrapDisallowed,s=t.urlTransform||xE;for(const c of yE)Object.hasOwn(t,c.from)&&(""+c.from+(c.to?"use `"+c.to+"` instead":"remove it")+hE+c.id,void 0);return yy(e,a),Rw(e,{Fragment:K.Fragment,components:i,ignoreInvalidStyle:!0,jsx:K.jsx,jsxs:K.jsxs,passKeys:!0,passNode:!0});function a(c,f,p){if(c.type==="raw"&&p&&typeof f=="number")return o?p.children.splice(f,1):p.children[f]={type:"text",value:c.value},f;if(c.type==="element"){let d;for(d in zu)if(Object.hasOwn(zu,d)&&Object.hasOwn(c.properties,d)){const v=c.properties[d],w=zu[d];(w===null||w.includes(c.tagName))&&(c.properties[d]=s(String(v||""),d,c))}}if(c.type==="element"){let d=n?!n.includes(c.tagName):l?l.includes(c.tagName):!1;if(!d&&r&&typeof f=="number"&&(d=!r(c,f,p)),d&&p&&typeof f=="number")return u&&c.children?p.children.splice(f,1,...c.children):p.children.splice(f,1),f}}}function xE(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||mE.test(e.slice(0,t))?e:""}const kE=({content:e})=>{const[t,n]=D.useState(!1);return K.jsxs("div",{className:"spoiler",children:[K.jsx("button",{className:"spoiler-toggle",onClick:()=>n(!t),children:t?"Скрыть результаты поиска":"Показать результаты поиска"}),t&&K.jsx("div",{className:"spoiler-content",children:K.jsx(wy,{children:e})})]})},Fd=({role:e,content:t,searchResults:n="",isLoading:r})=>K.jsx("div",{className:`message ${e}`,children:r?K.jsx("span",{children:"..."}):K.jsxs("div",{className:"message-content",children:[K.jsx(wy,{children:t}),n&&K.jsx(kE,{content:n})]})}),SE=({onSend:e,text:t,setText:n})=>{const r=i=>{i.key==="Enter"&&i.ctrlKey&&(i.preventDefault(),t.trim()&&e(t))};return K.jsx("div",{className:"input-wrapper",children:K.jsx("textarea",{value:t,onChange:i=>n(i.target.value),onKeyDown:r,placeholder:"Введите сообщение... (Ctrl+Enter для отправки)"})})};function Pe(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var EE=typeof Symbol=="function"&&Symbol.observable||"@@observable",jd=EE,Hu=()=>Math.random().toString(36).substring(7).split("").join("."),CE={INIT:`@@redux/INIT${Hu()}`,REPLACE:`@@redux/REPLACE${Hu()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Hu()}`},ko=CE;function gc(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function xy(e,t,n){if(typeof e!="function")throw new Error(Pe(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Pe(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Pe(1));return n(xy)(e,t)}let r=e,i=t,l=new Map,o=l,u=0,s=!1;function a(){o===l&&(o=new Map,l.forEach((E,h)=>{o.set(h,E)}))}function c(){if(s)throw new Error(Pe(3));return i}function f(E){if(typeof E!="function")throw new Error(Pe(4));if(s)throw new Error(Pe(5));let h=!0;a();const m=u++;return o.set(m,E),function(){if(h){if(s)throw new Error(Pe(6));h=!1,a(),o.delete(m),l=null}}}function p(E){if(!gc(E))throw new Error(Pe(7));if(typeof E.type>"u")throw new Error(Pe(8));if(typeof E.type!="string")throw new Error(Pe(17));if(s)throw new Error(Pe(9));try{s=!0,i=r(i,E)}finally{s=!1}return(l=o).forEach(m=>{m()}),E}function d(E){if(typeof E!="function")throw new Error(Pe(10));r=E,p({type:ko.REPLACE})}function v(){const E=f;return{subscribe(h){if(typeof h!="object"||h===null)throw new Error(Pe(11));function m(){const S=h;S.next&&S.next(c())}return m(),{unsubscribe:E(m)}},[jd](){return this}}}return p({type:ko.INIT}),{dispatch:p,subscribe:f,getState:c,replaceReducer:d,[jd]:v}}function PE(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:ko.INIT})>"u")throw new Error(Pe(12));if(typeof n(void 0,{type:ko.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Pe(13))})}function _E(e){const t=Object.keys(e),n={};for(let l=0;l<t.length;l++){const o=t[l];typeof e[o]=="function"&&(n[o]=e[o])}const r=Object.keys(n);let i;try{PE(n)}catch(l){i=l}return function(o={},u){if(i)throw i;let s=!1;const a={};for(let c=0;c<r.length;c++){const f=r[c],p=n[f],d=o[f],v=p(d,u);if(typeof v>"u")throw u&&u.type,new Error(Pe(14));a[f]=v,s=s||v!==d}return s=s||r.length!==Object.keys(o).length,s?a:o}}function So(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function TE(...e){return t=>(n,r)=>{const i=t(n,r);let l=()=>{throw new Error(Pe(15))};const o={getState:i.getState,dispatch:(s,...a)=>l(s,...a)},u=e.map(s=>s(o));return l=So(...u)(i.dispatch),{...i,dispatch:l}}}function IE(e){return gc(e)&&"type"in e&&typeof e.type=="string"}var ky=Symbol.for("immer-nothing"),bd=Symbol.for("immer-draftable"),it=Symbol.for("immer-state");function Pt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var qr=Object.getPrototypeOf;function tr(e){return!!e&&!!e[it]}function tn(e){var t;return e?Sy(e)||Array.isArray(e)||!!e[bd]||!!((t=e.constructor)!=null&&t[bd])||Yo(e)||Jo(e):!1}var OE=Object.prototype.constructor.toString();function Sy(e){if(!e||typeof e!="object")return!1;const t=qr(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===OE}function Eo(e,t){Xo(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Xo(e){const t=e[it];return t?t.type_:Array.isArray(e)?1:Yo(e)?2:Jo(e)?3:0}function Js(e,t){return Xo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ey(e,t,n){const r=Xo(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function NE(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Yo(e){return e instanceof Map}function Jo(e){return e instanceof Set}function jn(e){return e.copy_||e.base_}function Zs(e,t){if(Yo(e))return new Map(e);if(Jo(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Sy(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[it];let i=Reflect.ownKeys(r);for(let l=0;l<i.length;l++){const o=i[l],u=r[o];u.writable===!1&&(u.writable=!0,u.configurable=!0),(u.get||u.set)&&(r[o]={configurable:!0,writable:!0,enumerable:u.enumerable,value:e[o]})}return Object.create(qr(e),r)}else{const r=qr(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function vc(e,t=!1){return Zo(e)||tr(e)||!tn(e)||(Xo(e)>1&&(e.set=e.add=e.clear=e.delete=RE),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>vc(r,!0))),e}function RE(){Pt(2)}function Zo(e){return Object.isFrozen(e)}var zE={};function nr(e){const t=zE[e];return t||Pt(0,e),t}var Ki;function Cy(){return Ki}function LE(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Bd(e,t){t&&(nr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ea(e){ta(e),e.drafts_.forEach(DE),e.drafts_=null}function ta(e){e===Ki&&(Ki=e.parent_)}function Ud(e){return Ki=LE(Ki,e)}function DE(e){const t=e[it];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Hd(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[it].modified_&&(ea(t),Pt(4)),tn(e)&&(e=Co(t,e),t.parent_||Po(t,e)),t.patches_&&nr("Patches").generateReplacementPatches_(n[it].base_,e,t.patches_,t.inversePatches_)):e=Co(t,n,[]),ea(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ky?e:void 0}function Co(e,t,n){if(Zo(t))return t;const r=t[it];if(!r)return Eo(t,(i,l)=>$d(e,r,t,i,l,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Po(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let l=i,o=!1;r.type_===3&&(l=new Set(i),i.clear(),o=!0),Eo(l,(u,s)=>$d(e,r,i,u,s,n,o)),Po(e,i,!1),n&&e.patches_&&nr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function $d(e,t,n,r,i,l,o){if(tr(i)){const u=l&&t&&t.type_!==3&&!Js(t.assigned_,r)?l.concat(r):void 0,s=Co(e,i,u);if(Ey(n,r,s),tr(s))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(tn(i)&&!Zo(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Co(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Po(e,i)}}function Po(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&vc(t,n)}function AE(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Cy(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,l=wc;n&&(i=[r],l=qi);const{revoke:o,proxy:u}=Proxy.revocable(i,l);return r.draft_=u,r.revoke_=o,u}var wc={get(e,t){if(t===it)return e;const n=jn(e);if(!Js(n,t))return ME(e,n,t);const r=n[t];return e.finalized_||!tn(r)?r:r===$u(e.base_,t)?(Vu(e),e.copy_[t]=ra(r,e)):r},has(e,t){return t in jn(e)},ownKeys(e){return Reflect.ownKeys(jn(e))},set(e,t,n){const r=Py(jn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=$u(jn(e),t),l=i==null?void 0:i[it];if(l&&l.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(NE(n,i)&&(n!==void 0||Js(e.base_,t)))return!0;Vu(e),na(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return $u(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Vu(e),na(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=jn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Pt(11)},getPrototypeOf(e){return qr(e.base_)},setPrototypeOf(){Pt(12)}},qi={};Eo(wc,(e,t)=>{qi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});qi.deleteProperty=function(e,t){return qi.set.call(this,e,t,void 0)};qi.set=function(e,t,n){return wc.set.call(this,e[0],t,n,e[0])};function $u(e,t){const n=e[it];return(n?jn(n):e)[t]}function ME(e,t,n){var i;const r=Py(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function Py(e,t){if(!(t in e))return;let n=qr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=qr(n)}}function na(e){e.modified_||(e.modified_=!0,e.parent_&&na(e.parent_))}function Vu(e){e.copy_||(e.copy_=Zs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var FE=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const l=n;n=t;const o=this;return function(s=l,...a){return o.produce(s,c=>n.call(this,c,...a))}}typeof n!="function"&&Pt(6),r!==void 0&&typeof r!="function"&&Pt(7);let i;if(tn(t)){const l=Ud(this),o=ra(t,void 0);let u=!0;try{i=n(o),u=!1}finally{u?ea(l):ta(l)}return Bd(l,r),Hd(i,l)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===ky&&(i=void 0),this.autoFreeze_&&vc(i,!0),r){const l=[],o=[];nr("Patches").generateReplacementPatches_(t,i,l,o),r(l,o)}return i}else Pt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(o,...u)=>this.produceWithPatches(o,s=>t(s,...u));let r,i;return[this.produce(t,n,(o,u)=>{r=o,i=u}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){tn(e)||Pt(8),tr(e)&&(e=jE(e));const t=Ud(this),n=ra(e,void 0);return n[it].isManual_=!0,ta(t),n}finishDraft(e,t){const n=e&&e[it];(!n||!n.isManual_)&&Pt(9);const{scope_:r}=n;return Bd(r,t),Hd(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=nr("Patches").applyPatches_;return tr(e)?r(e,t):this.produce(e,i=>r(i,t))}};function ra(e,t){const n=Yo(e)?nr("MapSet").proxyMap_(e,t):Jo(e)?nr("MapSet").proxySet_(e,t):AE(e,t);return(t?t.scope_:Cy()).drafts_.push(n),n}function jE(e){return tr(e)||Pt(10,e),_y(e)}function _y(e){if(!tn(e)||Zo(e))return e;const t=e[it];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Zs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Zs(e,!0);return Eo(n,(r,i)=>{Ey(n,r,_y(i))}),t&&(t.finalized_=!1),n}var lt=new FE,Ty=lt.produce;lt.produceWithPatches.bind(lt);lt.setAutoFreeze.bind(lt);lt.setUseStrictShallowCopy.bind(lt);lt.applyPatches.bind(lt);lt.createDraft.bind(lt);lt.finishDraft.bind(lt);function Iy(e){return({dispatch:n,getState:r})=>i=>l=>typeof l=="function"?l(n,r,e):i(l)}var bE=Iy(),BE=Iy,UE=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?So:So.apply(null,arguments)};function Vd(e,t){function n(...r){if(t){let i=t(...r);if(!i)throw new Error(Xt(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>IE(r)&&r.type===e,n}var Oy=class yi extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,yi.prototype)}static get[Symbol.species](){return yi}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new yi(...t[0].concat(this)):new yi(...t.concat(this))}};function Qd(e){return tn(e)?Ty(e,()=>{}):e}function Wd(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function HE(e){return typeof e=="boolean"}var $E=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:l=!0}=t??{};let o=new Oy;return n&&(HE(n)?o.push(bE):o.push(BE(n.extraArgument))),o},VE="RTK_autoBatch",Kd=e=>t=>{setTimeout(t,e)},QE=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,l=!1,o=!1;const u=new Set,s=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Kd(10):e.type==="callback"?e.queueNotification:Kd(e.timeout),a=()=>{o=!1,l&&(l=!1,u.forEach(c=>c()))};return Object.assign({},r,{subscribe(c){const f=()=>i&&c(),p=r.subscribe(f);return u.add(c),()=>{p(),u.delete(c)}},dispatch(c){var f;try{return i=!((f=c==null?void 0:c.meta)!=null&&f[VE]),l=!i,l&&(o||(o=!0,s(a))),r.dispatch(c)}finally{i=!0}}})},WE=e=>function(n){const{autoBatch:r=!0}=n??{};let i=new Oy(e);return r&&i.push(QE(typeof r=="object"?r:void 0)),i};function KE(e){const t=$E(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:l=void 0,enhancers:o=void 0}=e||{};let u;if(typeof n=="function")u=n;else if(gc(n))u=_E(n);else throw new Error(Xt(1));let s;typeof r=="function"?s=r(t):s=t();let a=So;i&&(a=UE({trace:!1,...typeof i=="object"&&i}));const c=TE(...s),f=WE(c);let p=typeof o=="function"?o(f):f();const d=a(...p);return xy(u,l,d)}function Ny(e){const t={},n=[];let r;const i={addCase(l,o){const u=typeof l=="string"?l:l.type;if(!u)throw new Error(Xt(28));if(u in t)throw new Error(Xt(29));return t[u]=o,i},addMatcher(l,o){return n.push({matcher:l,reducer:o}),i},addDefaultCase(l){return r=l,i}};return e(i),[t,n,r]}function qE(e){return typeof e=="function"}function GE(e,t){let[n,r,i]=Ny(t),l;if(qE(e))l=()=>Qd(e());else{const u=Qd(e);l=()=>u}function o(u=l(),s){let a=[n[s.type],...r.filter(({matcher:c})=>c(s)).map(({reducer:c})=>c)];return a.filter(c=>!!c).length===0&&(a=[i]),a.reduce((c,f)=>{if(f)if(tr(c)){const d=f(c,s);return d===void 0?c:d}else{if(tn(c))return Ty(c,p=>f(p,s));{const p=f(c,s);if(p===void 0){if(c===null)return c;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return c},u)}return o.getInitialState=l,o}var XE=Symbol.for("rtk-slice-createasyncthunk");function YE(e,t){return`${e}/${t}`}function JE({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[XE];return function(i){const{name:l,reducerPath:o=l}=i;if(!l)throw new Error(Xt(11));const u=(typeof i.reducers=="function"?i.reducers(tC()):i.reducers)||{},s=Object.keys(u),a={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(y,S){const C=typeof y=="string"?y:y.type;if(!C)throw new Error(Xt(12));if(C in a.sliceCaseReducersByType)throw new Error(Xt(13));return a.sliceCaseReducersByType[C]=S,c},addMatcher(y,S){return a.sliceMatchers.push({matcher:y,reducer:S}),c},exposeAction(y,S){return a.actionCreators[y]=S,c},exposeCaseReducer(y,S){return a.sliceCaseReducersByName[y]=S,c}};s.forEach(y=>{const S=u[y],C={reducerName:y,type:YE(l,y),createNotation:typeof i.reducers=="function"};rC(S)?lC(C,S,c,t):nC(C,S,c)});function f(){const[y={},S=[],C=void 0]=typeof i.extraReducers=="function"?Ny(i.extraReducers):[i.extraReducers],k={...y,...a.sliceCaseReducersByType};return GE(i.initialState,I=>{for(let T in k)I.addCase(T,k[T]);for(let T of a.sliceMatchers)I.addMatcher(T.matcher,T.reducer);for(let T of S)I.addMatcher(T.matcher,T.reducer);C&&I.addDefaultCase(C)})}const p=y=>y,d=new Map;let v;function w(y,S){return v||(v=f()),v(y,S)}function E(){return v||(v=f()),v.getInitialState()}function h(y,S=!1){function C(I){let T=I[y];return typeof T>"u"&&S&&(T=E()),T}function k(I=p){const T=Wd(d,S,()=>new WeakMap);return Wd(T,I,()=>{const L={};for(const[M,F]of Object.entries(i.selectors??{}))L[M]=ZE(F,I,E,S);return L})}return{reducerPath:y,getSelectors:k,get selectors(){return k(C)},selectSlice:C}}const m={name:l,reducer:w,actions:a.actionCreators,caseReducers:a.sliceCaseReducersByName,getInitialState:E,...h(o),injectInto(y,{reducerPath:S,...C}={}){const k=S??o;return y.inject({reducerPath:k,reducer:w},C),{...m,...h(k,!0)}}};return m}}function ZE(e,t,n,r){function i(l,...o){let u=t(l);return typeof u>"u"&&r&&(u=n()),e(u,...o)}return i.unwrapped=e,i}var eC=JE();function tC(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function nC({type:e,reducerName:t,createNotation:n},r,i){let l,o;if("reducer"in r){if(n&&!iC(r))throw new Error(Xt(17));l=r.reducer,o=r.prepare}else l=r;i.addCase(e,l).exposeCaseReducer(t,l).exposeAction(t,o?Vd(e,o):Vd(e))}function rC(e){return e._reducerDefinitionType==="asyncThunk"}function iC(e){return e._reducerDefinitionType==="reducerWithPrepare"}function lC({type:e,reducerName:t},n,r,i){if(!i)throw new Error(Xt(18));const{payloadCreator:l,fulfilled:o,pending:u,rejected:s,settled:a,options:c}=n,f=i(e,l,c);r.exposeAction(t,f),o&&r.addCase(f.fulfilled,o),u&&r.addCase(f.pending,u),s&&r.addCase(f.rejected,s),a&&r.addMatcher(f.settled,a),r.exposeCaseReducer(t,{fulfilled:o||Ol,pending:u||Ol,rejected:s||Ol,settled:a||Ol})}function Ol(){}function Xt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const oC=()=>{const e=localStorage.getItem("chatHistory");if(e)try{return JSON.parse(e)}catch(t){return console.error("Failed to parse chat history from localStorage:",t),[]}return[]},uC={history:oC()},Ry=eC({name:"chat",initialState:uC,reducers:{addMessage:(e,t)=>{e.history.push(t.payload),localStorage.setItem("chatHistory",JSON.stringify(e.history))},clearHistory:e=>{e.history=[],localStorage.setItem("chatHistory",JSON.stringify([]))},setHistory:(e,t)=>{e.history=t.payload,localStorage.setItem("chatHistory",JSON.stringify(e.history))}}}),{addMessage:sC,clearHistory:aC,setHistory:Qu}=Ry.actions,cC=Ry.reducer,fC=()=>{const[e,t]=D.useState(""),[n,r]=D.useState(null),[i,l]=D.useState(!1),[o,u]=D.useState(!1),s=A0(v=>v.chat.history),a=z0(),c=D.useRef(null),f=()=>{const v=document.querySelector(".messages");if(v){const w=v.getBoundingClientRect(),E=window.innerHeight;return w.bottom<=E+10}return!0},p=()=>{c.current&&(c.current.abort(),l(!1),console.log("Generation stopped by user"))},d=async v=>{var h;if(!v.trim()||i)return;const w={role:"user",content:v,searchResults:""};a(sC(w)),t(""),l(!0),u(!1),console.log("Start request - isLoading:",i,"hasAssistantStarted:",o);const E="http://muryshev-generic-chatbot-backend.hf.space/llm/chat/stream";try{const m=new AbortController;c.current=m;const y=setTimeout(()=>{m.abort(),r("Сервер временно недоступен")},6e4),S=await fetch(E,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({history:[...s,w]}),signal:m.signal});if(clearTimeout(y),!S.ok)throw new Error(`HTTP error! status: ${S.status}`);const C=(h=S.body)==null?void 0:h.getReader();if(!C)throw new Error("Response body is not readable");const k=new TextDecoder;let I="",T="",L=[...s,w];for(;;){const{done:M,value:F}=await C.read();if(M)break;I+=k.decode(F,{stream:!0});const j=I.split(`
89
 
90
  `);for(let ee=0;ee<j.length-1;ee++){const V=j[ee].trim();if(V.startsWith("data: ")){const fe=V.slice(6);console.log("Received SSE event:",fe);try{const J=JSON.parse(fe);if(J.event==="done"){a(Qu(L)),l(!1),console.log("Done - isLoading:",i,"hasAssistantStarted:",o);break}else if(J.event==="error"){r(J.data),l(!1),console.log("Error - isLoading:",i,"hasAssistantStarted:",o);break}else if(J.event==="search_results")L=L.map((R,b)=>b===L.length-1&&R.role==="user"?{...R,searchResults:J.data}:R),a(Qu(L)),console.log("After search_results - isLoading:",i,"hasAssistantStarted:",o);else if(J.event==="token"){o||(u(!0),console.log("Before first token - isLoading:",i,"hasAssistantStarted:",o)),T+=J.data;const R=L.findLastIndex(g=>g.role==="user"),b=L.findIndex((g,Q)=>g.role==="assistant"&&Q>R);b>=0?L=L.map((g,Q)=>Q===b?{...g,content:T}:g):L=[...L,{role:"assistant",content:T,searchResults:""}],a(Qu(L))}}catch(J){console.error("Failed to parse SSE data:",J),r("Ошибка обработки данных от сервера")}}}I=j[j.length-1];const G=document.querySelector(".messages");if(G){const ee=G.querySelectorAll("div"),V=ee[ee.length-1];V&&f()&&setTimeout(()=>{V.scrollIntoView({behavior:"smooth",block:"start"}),console.log("Autoscroll triggered, isAtBottom:",f())},0)}}}catch(m){console.error("Stream error:",m),l(!1),console.log("Catch - isLoading:",i,"hasAssistantStarted:",o),m instanceof DOMException&&m.name==="AbortError"&&!c.current?r("Сервер временно недоступен"):m instanceof DOMException&&m.name==="AbortError"||r("Произошла ошибка при запросе")}finally{c.current=null}};return D.useEffect(()=>{if(console.log("State update - isLoading:",i,"hasAssistantStarted:",o),n){const v=setTimeout(()=>r(null),5e3);return()=>clearTimeout(v)}},[i,o,n]),K.jsxs("div",{className:"chat",children:[n&&K.jsx("div",{className:"error-toast",children:n}),K.jsxs("div",{className:"messages",children:[s.map((v,w)=>K.jsx("div",{children:K.jsx(Fd,{role:v.role,content:v.content,searchResults:v.searchResults})},w)),i&&!o&&K.jsx("div",{children:K.jsx(Fd,{role:"assistant",content:"",isLoading:!0,searchResults:""})})]}),K.jsxs("div",{className:"input-area",children:[K.jsx(SE,{onSend:d,text:e,setText:t}),K.jsxs("div",{className:"buttons",children:[i?K.jsx("button",{className:"stop-button",onClick:p,children:"Остановить"}):K.jsx("button",{className:"send-button",onClick:()=>d(e),children:"Отправить"}),K.jsx("a",{href:"#",className:"clear-link",onClick:v=>{v.preventDefault(),a(aC())},children:"Очистить"})]})]})]})},dC=KE({reducer:{chat:cC}}),pC=()=>K.jsx(O0,{store:dC,children:K.jsx(fC,{})});var eu=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(){}},tu=typeof window>"u"||"Deno"in globalThis;function xt(){}function hC(e,t){return typeof e=="function"?e(t):e}function mC(e){return typeof e=="number"&&e>=0&&e!==1/0}function yC(e,t){return Math.max(e+(t||0)-Date.now(),0)}function qd(e,t){return typeof e=="function"?e(t):e}function gC(e,t){return typeof e=="function"?e(t):e}function Gd(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:l,queryKey:o,stale:u}=e;if(o){if(r){if(t.queryHash!==xc(o,t.options))return!1}else if(!Xi(t.queryKey,o))return!1}if(n!=="all"){const s=t.isActive();if(n==="active"&&!s||n==="inactive"&&s)return!1}return!(typeof u=="boolean"&&t.isStale()!==u||i&&i!==t.state.fetchStatus||l&&!l(t))}function Xd(e,t){const{exact:n,status:r,predicate:i,mutationKey:l}=e;if(l){if(!t.options.mutationKey)return!1;if(n){if(Gi(t.options.mutationKey)!==Gi(l))return!1}else if(!Xi(t.options.mutationKey,l))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function xc(e,t){return((t==null?void 0:t.queryKeyHashFn)||Gi)(e)}function Gi(e){return JSON.stringify(e,(t,n)=>ia(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Xi(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!Xi(e[n],t[n])):!1}function zy(e,t){if(e===t)return e;const n=Yd(e)&&Yd(t);if(n||ia(e)&&ia(t)){const r=n?e:Object.keys(e),i=r.length,l=n?t:Object.keys(t),o=l.length,u=n?[]:{};let s=0;for(let a=0;a<o;a++){const c=n?a:l[a];(!n&&r.includes(c)||n)&&e[c]===void 0&&t[c]===void 0?(u[c]=void 0,s++):(u[c]=zy(e[c],t[c]),u[c]===e[c]&&e[c]!==void 0&&s++)}return i===o&&s===i?e:u}return t}function Yd(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ia(e){if(!Jd(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Jd(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Jd(e){return Object.prototype.toString.call(e)==="[object Object]"}function vC(e){return new Promise(t=>{setTimeout(t,e)})}function wC(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?zy(e,t):t}function xC(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function kC(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var kc=Symbol();function Ly(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===kc?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var $n,dn,zr,tp,SC=(tp=class extends eu{constructor(){super();Y(this,$n);Y(this,dn);Y(this,zr);H(this,zr,t=>{if(!tu&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){_(this,dn)||this.setEventListener(_(this,zr))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,dn))==null||t.call(this),H(this,dn,void 0))}setEventListener(t){var n;H(this,zr,t),(n=_(this,dn))==null||n.call(this),H(this,dn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){_(this,$n)!==t&&(H(this,$n,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof _(this,$n)=="boolean"?_(this,$n):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},$n=new WeakMap,dn=new WeakMap,zr=new WeakMap,tp),Dy=new SC,Lr,pn,Dr,np,EC=(np=class extends eu{constructor(){super();Y(this,Lr,!0);Y(this,pn);Y(this,Dr);H(this,Dr,t=>{if(!tu&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){_(this,pn)||this.setEventListener(_(this,Dr))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,pn))==null||t.call(this),H(this,pn,void 0))}setEventListener(t){var n;H(this,Dr,t),(n=_(this,pn))==null||n.call(this),H(this,pn,t(this.setOnline.bind(this)))}setOnline(t){_(this,Lr)!==t&&(H(this,Lr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return _(this,Lr)}},Lr=new WeakMap,pn=new WeakMap,Dr=new WeakMap,np),_o=new EC;function CC(){let e,t;const n=new Promise((i,l)=>{e=i,t=l});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}function PC(e){return Math.min(1e3*2**e,3e4)}function Ay(e){return(e??"online")==="online"?_o.isOnline():!0}var My=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Wu(e){return e instanceof My}function Fy(e){let t=!1,n=0,r=!1,i;const l=CC(),o=w=>{var E;r||(p(new My(w)),(E=e.abort)==null||E.call(e))},u=()=>{t=!0},s=()=>{t=!1},a=()=>Dy.isFocused()&&(e.networkMode==="always"||_o.isOnline())&&e.canRun(),c=()=>Ay(e.networkMode)&&e.canRun(),f=w=>{var E;r||(r=!0,(E=e.onSuccess)==null||E.call(e,w),i==null||i(),l.resolve(w))},p=w=>{var E;r||(r=!0,(E=e.onError)==null||E.call(e,w),i==null||i(),l.reject(w))},d=()=>new Promise(w=>{var E;i=h=>{(r||a())&&w(h)},(E=e.onPause)==null||E.call(e)}).then(()=>{var w;i=void 0,r||(w=e.onContinue)==null||w.call(e)}),v=()=>{if(r)return;let w;const E=n===0?e.initialPromise:void 0;try{w=E??e.fn()}catch(h){w=Promise.reject(h)}Promise.resolve(w).then(f).catch(h=>{var k;if(r)return;const m=e.retry??(tu?0:3),y=e.retryDelay??PC,S=typeof y=="function"?y(n,h):y,C=m===!0||typeof m=="number"&&n<m||typeof m=="function"&&m(n,h);if(t||!C){p(h);return}n++,(k=e.onFail)==null||k.call(e,n,h),vC(S).then(()=>a()?void 0:d()).then(()=>{t?p(h):v()})})};return{promise:l,cancel:o,continue:()=>(i==null||i(),l),cancelRetry:u,continueRetry:s,canStart:c,start:()=>(c()?v():d().then(v),l)}}function _C(){let e=[],t=0,n=u=>{u()},r=u=>{u()},i=u=>setTimeout(u,0);const l=u=>{t?e.push(u):i(()=>{n(u)})},o=()=>{const u=e;e=[],u.length&&i(()=>{r(()=>{u.forEach(s=>{n(s)})})})};return{batch:u=>{let s;t++;try{s=u()}finally{t--,t||o()}return s},batchCalls:u=>(...s)=>{l(()=>{u(...s)})},schedule:l,setNotifyFunction:u=>{n=u},setBatchNotifyFunction:u=>{r=u},setScheduler:u=>{i=u}}}var je=_C(),Vn,rp,jy=(rp=class{constructor(){Y(this,Vn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),mC(this.gcTime)&&H(this,Vn,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(tu?1/0:5*60*1e3))}clearGcTimeout(){_(this,Vn)&&(clearTimeout(_(this,Vn)),H(this,Vn,void 0))}},Vn=new WeakMap,rp),Ar,Mr,st,Qn,ze,Yi,Wn,kt,$t,ip,TC=(ip=class extends jy{constructor(t){super();Y(this,kt);Y(this,Ar);Y(this,Mr);Y(this,st);Y(this,Qn);Y(this,ze);Y(this,Yi);Y(this,Wn);H(this,Wn,!1),H(this,Yi,t.defaultOptions),this.setOptions(t.options),this.observers=[],H(this,Qn,t.client),H(this,st,_(this,Qn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,H(this,Ar,OC(this.options)),this.state=t.state??_(this,Ar),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=_(this,ze))==null?void 0:t.promise}setOptions(t){this.options={..._(this,Yi),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&_(this,st).remove(this)}setData(t,n){const r=wC(this.state.data,t,this.options);return Oe(this,kt,$t).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Oe(this,kt,$t).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,i;const n=(r=_(this,ze))==null?void 0:r.promise;return(i=_(this,ze))==null||i.cancel(t),n?n.then(xt).catch(xt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(_(this,Ar))}isActive(){return this.observers.some(t=>gC(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===kc||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!yC(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,ze))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,ze))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),_(this,st).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(_(this,ze)&&(_(this,Wn)?_(this,ze).cancel({revert:!0}):_(this,ze).cancelRetry()),this.scheduleGc()),_(this,st).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Oe(this,kt,$t).call(this,{type:"invalidate"})}fetch(t,n){var s,a,c;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(_(this,ze))return _(this,ze).continueRetry(),_(this,ze).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(p=>p.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,i=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(H(this,Wn,!0),r.signal)})},l=()=>{const f=Ly(this.options,n),p={client:_(this,Qn),queryKey:this.queryKey,meta:this.meta};return i(p),H(this,Wn,!1),this.options.persister?this.options.persister(f,p,this):f(p)},o={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:_(this,Qn),state:this.state,fetchFn:l};i(o),(s=this.options.behavior)==null||s.onFetch(o,this),H(this,Mr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((a=o.fetchOptions)==null?void 0:a.meta))&&Oe(this,kt,$t).call(this,{type:"fetch",meta:(c=o.fetchOptions)==null?void 0:c.meta});const u=f=>{var p,d,v,w;Wu(f)&&f.silent||Oe(this,kt,$t).call(this,{type:"error",error:f}),Wu(f)||((d=(p=_(this,st).config).onError)==null||d.call(p,f,this),(w=(v=_(this,st).config).onSettled)==null||w.call(v,this.state.data,f,this)),this.scheduleGc()};return H(this,ze,Fy({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var p,d,v,w;if(f===void 0){u(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(E){u(E);return}(d=(p=_(this,st).config).onSuccess)==null||d.call(p,f,this),(w=(v=_(this,st).config).onSettled)==null||w.call(v,f,this.state.error,this),this.scheduleGc()},onError:u,onFail:(f,p)=>{Oe(this,kt,$t).call(this,{type:"failed",failureCount:f,error:p})},onPause:()=>{Oe(this,kt,$t).call(this,{type:"pause"})},onContinue:()=>{Oe(this,kt,$t).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),_(this,ze).start()}},Ar=new WeakMap,Mr=new WeakMap,st=new WeakMap,Qn=new WeakMap,ze=new WeakMap,Yi=new WeakMap,Wn=new WeakMap,kt=new WeakSet,$t=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...IC(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=t.error;return Wu(i)&&i.revert&&_(this,Mr)?{..._(this,Mr),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),je.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),_(this,st).notify({query:this,type:"updated",action:t})})},ip);function IC(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ay(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function OC(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?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"}}var Lt,lp,NC=(lp=class extends eu{constructor(t={}){super();Y(this,Lt);this.config=t,H(this,Lt,new Map)}build(t,n,r){const i=n.queryKey,l=n.queryHash??xc(i,n);let o=this.get(l);return o||(o=new TC({client:t,queryKey:i,queryHash:l,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(o)),o}add(t){_(this,Lt).has(t.queryHash)||(_(this,Lt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=_(this,Lt).get(t.queryHash);n&&(t.destroy(),n===t&&_(this,Lt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){je.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return _(this,Lt).get(t)}getAll(){return[..._(this,Lt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Gd(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Gd(t,r)):n}notify(t){je.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){je.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){je.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Lt=new WeakMap,lp),Dt,Me,Kn,At,un,op,RC=(op=class extends jy{constructor(t){super();Y(this,At);Y(this,Dt);Y(this,Me);Y(this,Kn);this.mutationId=t.mutationId,H(this,Me,t.mutationCache),H(this,Dt,[]),this.state=t.state||zC(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){_(this,Dt).includes(t)||(_(this,Dt).push(t),this.clearGcTimeout(),_(this,Me).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){H(this,Dt,_(this,Dt).filter(n=>n!==t)),this.scheduleGc(),_(this,Me).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){_(this,Dt).length||(this.state.status==="pending"?this.scheduleGc():_(this,Me).remove(this))}continue(){var t;return((t=_(this,Kn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,l,o,u,s,a,c,f,p,d,v,w,E,h,m,y,S,C,k,I;H(this,Kn,Fy({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(T,L)=>{Oe(this,At,un).call(this,{type:"failed",failureCount:T,error:L})},onPause:()=>{Oe(this,At,un).call(this,{type:"pause"})},onContinue:()=>{Oe(this,At,un).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>_(this,Me).canRun(this)}));const n=this.state.status==="pending",r=!_(this,Kn).canStart();try{if(!n){Oe(this,At,un).call(this,{type:"pending",variables:t,isPaused:r}),await((l=(i=_(this,Me).config).onMutate)==null?void 0:l.call(i,t,this));const L=await((u=(o=this.options).onMutate)==null?void 0:u.call(o,t));L!==this.state.context&&Oe(this,At,un).call(this,{type:"pending",context:L,variables:t,isPaused:r})}const T=await _(this,Kn).start();return await((a=(s=_(this,Me).config).onSuccess)==null?void 0:a.call(s,T,t,this.state.context,this)),await((f=(c=this.options).onSuccess)==null?void 0:f.call(c,T,t,this.state.context)),await((d=(p=_(this,Me).config).onSettled)==null?void 0:d.call(p,T,null,this.state.variables,this.state.context,this)),await((w=(v=this.options).onSettled)==null?void 0:w.call(v,T,null,t,this.state.context)),Oe(this,At,un).call(this,{type:"success",data:T}),T}catch(T){try{throw await((h=(E=_(this,Me).config).onError)==null?void 0:h.call(E,T,t,this.state.context,this)),await((y=(m=this.options).onError)==null?void 0:y.call(m,T,t,this.state.context)),await((C=(S=_(this,Me).config).onSettled)==null?void 0:C.call(S,void 0,T,this.state.variables,this.state.context,this)),await((I=(k=this.options).onSettled)==null?void 0:I.call(k,void 0,T,t,this.state.context)),T}finally{Oe(this,At,un).call(this,{type:"error",error:T})}}finally{_(this,Me).runNext(this)}}},Dt=new WeakMap,Me=new WeakMap,Kn=new WeakMap,At=new WeakSet,un=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),je.batch(()=>{_(this,Dt).forEach(r=>{r.onMutationUpdate(t)}),_(this,Me).notify({mutation:this,type:"updated",action:t})})},op);function zC(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Wt,St,Ji,up,LC=(up=class extends eu{constructor(t={}){super();Y(this,Wt);Y(this,St);Y(this,Ji);this.config=t,H(this,Wt,new Set),H(this,St,new Map),H(this,Ji,0)}build(t,n,r){const i=new RC({mutationCache:this,mutationId:++sl(this,Ji)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){_(this,Wt).add(t);const n=Nl(t);if(typeof n=="string"){const r=_(this,St).get(n);r?r.push(t):_(this,St).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(_(this,Wt).delete(t)){const n=Nl(t);if(typeof n=="string"){const r=_(this,St).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&_(this,St).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Nl(t);if(typeof n=="string"){const r=_(this,St).get(n),i=r==null?void 0:r.find(l=>l.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r;const n=Nl(t);if(typeof n=="string"){const i=(r=_(this,St).get(n))==null?void 0:r.find(l=>l!==t&&l.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){je.batch(()=>{_(this,Wt).forEach(t=>{this.notify({type:"removed",mutation:t})}),_(this,Wt).clear(),_(this,St).clear()})}getAll(){return Array.from(_(this,Wt))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Xd(n,r))}findAll(t={}){return this.getAll().filter(n=>Xd(t,n))}notify(t){je.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return je.batch(()=>Promise.all(t.map(n=>n.continue().catch(xt))))}},Wt=new WeakMap,St=new WeakMap,Ji=new WeakMap,up);function Nl(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Zd(e){return{onFetch:(t,n)=>{var c,f,p,d,v;const r=t.options,i=(p=(f=(c=t.fetchOptions)==null?void 0:c.meta)==null?void 0:f.fetchMore)==null?void 0:p.direction,l=((d=t.state.data)==null?void 0:d.pages)||[],o=((v=t.state.data)==null?void 0:v.pageParams)||[];let u={pages:[],pageParams:[]},s=0;const a=async()=>{let w=!1;const E=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(t.signal.aborted?w=!0:t.signal.addEventListener("abort",()=>{w=!0}),t.signal)})},h=Ly(t.options,t.fetchOptions),m=async(y,S,C)=>{if(w)return Promise.reject();if(S==null&&y.pages.length)return Promise.resolve(y);const k={client:t.client,queryKey:t.queryKey,pageParam:S,direction:C?"backward":"forward",meta:t.options.meta};E(k);const I=await h(k),{maxPages:T}=t.options,L=C?kC:xC;return{pages:L(y.pages,I,T),pageParams:L(y.pageParams,S,T)}};if(i&&l.length){const y=i==="backward",S=y?DC:ep,C={pages:l,pageParams:o},k=S(r,C);u=await m(C,k,y)}else{const y=e??l.length;do{const S=s===0?o[0]??r.initialPageParam:ep(r,u);if(s>0&&S==null)break;u=await m(u,S),s++}while(s<y)}return u};t.options.persister?t.fetchFn=()=>{var w,E;return(E=(w=t.options).persister)==null?void 0:E.call(w,a,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=a}}}function ep(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function DC(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var me,hn,mn,Fr,jr,yn,br,Br,sp,AC=(sp=class{constructor(e={}){Y(this,me);Y(this,hn);Y(this,mn);Y(this,Fr);Y(this,jr);Y(this,yn);Y(this,br);Y(this,Br);H(this,me,e.queryCache||new NC),H(this,hn,e.mutationCache||new LC),H(this,mn,e.defaultOptions||{}),H(this,Fr,new Map),H(this,jr,new Map),H(this,yn,0)}mount(){sl(this,yn)._++,_(this,yn)===1&&(H(this,br,Dy.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,me).onFocus())})),H(this,Br,_o.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,me).onOnline())})))}unmount(){var e,t;sl(this,yn)._--,_(this,yn)===0&&((e=_(this,br))==null||e.call(this),H(this,br,void 0),(t=_(this,Br))==null||t.call(this),H(this,Br,void 0))}isFetching(e){return _(this,me).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return _(this,hn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,me).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=_(this,me).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(qd(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return _(this,me).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=_(this,me).get(r.queryHash),l=i==null?void 0:i.state.data,o=hC(t,l);if(o!==void 0)return _(this,me).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return je.batch(()=>_(this,me).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,me).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=_(this,me);je.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=_(this,me);return je.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=je.batch(()=>_(this,me).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(xt).catch(xt)}invalidateQueries(e,t={}){return je.batch(()=>(_(this,me).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=je.batch(()=>_(this,me).findAll(e).filter(i=>!i.isDisabled()).map(i=>{let l=i.fetch(void 0,n);return n.throwOnError||(l=l.catch(xt)),i.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(r).then(xt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=_(this,me).build(this,t);return n.isStaleByTime(qd(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(xt).catch(xt)}fetchInfiniteQuery(e){return e.behavior=Zd(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(xt).catch(xt)}ensureInfiniteQueryData(e){return e.behavior=Zd(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return _o.isOnline()?_(this,hn).resumePausedMutations():Promise.resolve()}getQueryCache(){return _(this,me)}getMutationCache(){return _(this,hn)}getDefaultOptions(){return _(this,mn)}setDefaultOptions(e){H(this,mn,e)}setQueryDefaults(e,t){_(this,Fr).set(Gi(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[..._(this,Fr).values()],n={};return t.forEach(r=>{Xi(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){_(this,jr).set(Gi(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[..._(this,jr).values()],n={};return t.forEach(r=>{Xi(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={..._(this,mn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=xc(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===kc&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{..._(this,mn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){_(this,me).clear(),_(this,hn).clear()}},me=new WeakMap,hn=new WeakMap,mn=new WeakMap,Fr=new WeakMap,jr=new WeakMap,yn=new WeakMap,br=new WeakMap,Br=new WeakMap,sp),MC=D.createContext(void 0),FC=({client:e,children:t})=>(D.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),K.jsx(MC.Provider,{value:e,children:t}));const jC=new AC;Ku.createRoot(document.getElementById("root")).render(K.jsx(wp.StrictMode,{children:K.jsx(FC,{client:jC,children:K.jsx(a0,{children:K.jsx(o0,{children:K.jsx(Rm,{path:"/",element:K.jsx(pC,{})})})})})}));
 
85
  `});++r<e.length;)r&&n.push({type:"text",value:`
86
  `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
87
  `}),n}function Ed(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Cd(e,t){const n=HS(e,t),r=n.one(e,void 0),i=RS(n),l=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&l.children.push({type:"text",value:`
88
+ `},i),l}function KS(e,t){return e&&"run"in e?async function(n,r){const i=Cd(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Cd(n,{file:r,...e||t})}}function Pd(e){if(e)throw e}var Vl=Object.prototype.hasOwnProperty,gy=Object.prototype.toString,_d=Object.defineProperty,Td=Object.getOwnPropertyDescriptor,Id=function(t){return typeof Array.isArray=="function"?Array.isArray(t):gy.call(t)==="[object Array]"},Od=function(t){if(!t||gy.call(t)!=="[object Object]")return!1;var n=Vl.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Vl.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||Vl.call(t,i)},Nd=function(t,n){_d&&n.name==="__proto__"?_d(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Rd=function(t,n){if(n==="__proto__")if(Vl.call(t,n)){if(Td)return Td(t,n).value}else return;return t[n]},qS=function e(){var t,n,r,i,l,o,u=arguments[0],s=1,a=arguments.length,c=!1;for(typeof u=="boolean"&&(c=u,u=arguments[1]||{},s=2),(u==null||typeof u!="object"&&typeof u!="function")&&(u={});s<a;++s)if(t=arguments[s],t!=null)for(n in t)r=Rd(u,n),i=Rd(t,n),u!==i&&(c&&i&&(Od(i)||(l=Id(i)))?(l?(l=!1,o=r&&Id(r)?r:[]):o=r&&Od(r)?r:{},Nd(u,{name:n,newValue:e(c,o,i)})):typeof i<"u"&&Nd(u,{name:n,newValue:i}));return u};const Au=la(qS);function Xs(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function GS(){const e=[],t={run:n,use:r};return t;function n(...i){let l=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);u(null,...i);function u(s,...a){const c=e[++l];let f=-1;if(s){o(s);return}for(;++f<i.length;)(a[f]===null||a[f]===void 0)&&(a[f]=i[f]);i=a,c?XS(c,u)(...a):o(null,...a)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function XS(e,t){let n;return r;function r(...o){const u=e.length>o.length;let s;u&&o.push(i);try{s=e.apply(this,o)}catch(a){const c=a;if(u&&n)throw c;return i(c)}u||(s&&s.then&&typeof s.then=="function"?s.then(l,i):s instanceof Error?i(s):l(s))}function i(o,...u){n||(n=!0,t(o,...u))}function l(o){i(null,o)}}const zt={basename:YS,dirname:JS,extname:ZS,join:eE,sep:"/"};function YS(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ol(e);let n=0,r=-1,i=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(l){n=i+1;break}}else r<0&&(l=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,u=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(l){n=i+1;break}}else o<0&&(l=!0,o=i+1),u>-1&&(e.codePointAt(i)===t.codePointAt(u--)?u<0&&(r=i):(u=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function JS(e){if(ol(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function ZS(e){ol(e);let t=e.length,n=-1,r=0,i=-1,l=0,o;for(;t--;){const u=e.codePointAt(t);if(u===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),u===46?i<0?i=t:l!==1&&(l=1):i>-1&&(l=-1)}return i<0||n<0||l===0||l===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function eE(...e){let t=-1,n;for(;++t<e.length;)ol(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":tE(n)}function tE(e){ol(e);const t=e.codePointAt(0)===47;let n=nE(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function nE(e,t){let n="",r=0,i=-1,l=0,o=-1,u,s;for(;++o<=e.length;){if(o<e.length)u=e.codePointAt(o);else{if(u===47)break;u=47}if(u===47){if(!(i===o-1||l===1))if(i!==o-1&&l===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(s=n.lastIndexOf("/"),s!==n.length-1){s<0?(n="",r=0):(n=n.slice(0,s),r=n.length-1-n.lastIndexOf("/")),i=o,l=0;continue}}else if(n.length>0){n="",r=0,i=o,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,l=0}else u===46&&l>-1?l++:l=-1}return n}function ol(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const rE={cwd:iE};function iE(){return"/"}function Ys(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function lE(e){if(typeof e=="string")e=new URL(e);else if(!Ys(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return oE(e)}function oE(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Mu=["history","path","basename","stem","extname","dirname"];class vy{constructor(t){let n;t?Ys(t)?n={path:t}:typeof t=="string"||uE(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":rE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Mu.length;){const l=Mu[r];l in n&&n[l]!==void 0&&n[l]!==null&&(this[l]=l==="history"?[...n[l]]:n[l])}let i;for(i in n)Mu.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?zt.basename(this.path):void 0}set basename(t){ju(t,"basename"),Fu(t,"basename"),this.path=zt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?zt.dirname(this.path):void 0}set dirname(t){zd(this.basename,"dirname"),this.path=zt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?zt.extname(this.path):void 0}set extname(t){if(Fu(t,"extname"),zd(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=zt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ys(t)&&(t=lE(t)),ju(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?zt.basename(this.path,this.extname):void 0}set stem(t){ju(t,"stem"),Fu(t,"stem"),this.path=zt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Ae(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Fu(e,t){if(e&&e.includes(zt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+zt.sep+"`")}function ju(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function zd(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function uE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const sE=function(e){const r=this.constructor.prototype,i=r[e],l=function(){return i.apply(l,arguments)};return Object.setPrototypeOf(l,r),l},aE={}.hasOwnProperty;class yc extends sE{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=GS()}copy(){const t=new yc;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Au(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Uu("data",this.frozen),this.namespace[t]=n,this):aE.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Uu("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Il(t),r=this.parser||this.Parser;return bu("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),bu("process",this.parser||this.Parser),Bu("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(l,o){const u=Il(t),s=r.parse(u);r.run(s,u,function(c,f,p){if(c||!f||!p)return a(c);const d=f,v=r.stringify(d,p);dE(v)?p.value=v:p.result=v,a(c,p)});function a(c,f){c||!f?o(c):l?l(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),bu("processSync",this.parser||this.Parser),Bu("processSync",this.compiler||this.Compiler),this.process(t,i),Dd("processSync","process",n),r;function i(l,o){n=!0,Pd(l),r=o}}run(t,n,r){Ld(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?l(void 0,r):new Promise(l);function l(o,u){const s=Il(n);i.run(t,s,a);function a(c,f,p){const d=f||t;c?u(c):o?o(d):r(void 0,d,p)}}}runSync(t,n){let r=!1,i;return this.run(t,n,l),Dd("runSync","run",r),i;function l(o,u){Pd(o),i=u,r=!0}}stringify(t,n){this.freeze();const r=Il(n),i=this.compiler||this.Compiler;return Bu("stringify",i),Ld(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Uu("use",this.frozen),t!=null)if(typeof t=="function")s(t,n);else if(typeof t=="object")Array.isArray(t)?u(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function l(a){if(typeof a=="function")s(a,[]);else if(typeof a=="object")if(Array.isArray(a)){const[c,...f]=a;s(c,f)}else o(a);else throw new TypeError("Expected usable value, not `"+a+"`")}function o(a){if(!("plugins"in a)&&!("settings"in a))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");u(a.plugins),a.settings&&(i.settings=Au(!0,i.settings,a.settings))}function u(a){let c=-1;if(a!=null)if(Array.isArray(a))for(;++c<a.length;){const f=a[c];l(f)}else throw new TypeError("Expected a list of plugins, not `"+a+"`")}function s(a,c){let f=-1,p=-1;for(;++f<r.length;)if(r[f][0]===a){p=f;break}if(p===-1)r.push([a,...c]);else if(c.length>0){let[d,...v]=c;const w=r[p][1];Xs(w)&&Xs(d)&&(d=Au(!0,w,d)),r[p]=[a,d,...v]}}}}const cE=new yc().freeze();function bu(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Bu(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Uu(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ld(e){if(!Xs(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Dd(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Il(e){return fE(e)?e:new vy(e)}function fE(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function dE(e){return typeof e=="string"||pE(e)}function pE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const hE="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ad=[],Md={allowDangerousHtml:!0},mE=/^(https?|ircs?|mailto|xmpp)$/i,yE=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function wy(e){const t=gE(e),n=vE(e);return wE(t.runSync(t.parse(n),n),e)}function gE(e){const t=e.rehypePlugins||Ad,n=e.remarkPlugins||Ad,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Md}:Md;return cE().use(Jk).use(n).use(KS,r).use(t)}function vE(e){const t=e.children||"",n=new vy;return typeof t=="string"&&(n.value=t),n}function wE(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,l=t.disallowedElements,o=t.skipHtml,u=t.unwrapDisallowed,s=t.urlTransform||xE;for(const c of yE)Object.hasOwn(t,c.from)&&(""+c.from+(c.to?"use `"+c.to+"` instead":"remove it")+hE+c.id,void 0);return yy(e,a),Rw(e,{Fragment:K.Fragment,components:i,ignoreInvalidStyle:!0,jsx:K.jsx,jsxs:K.jsxs,passKeys:!0,passNode:!0});function a(c,f,p){if(c.type==="raw"&&p&&typeof f=="number")return o?p.children.splice(f,1):p.children[f]={type:"text",value:c.value},f;if(c.type==="element"){let d;for(d in zu)if(Object.hasOwn(zu,d)&&Object.hasOwn(c.properties,d)){const v=c.properties[d],w=zu[d];(w===null||w.includes(c.tagName))&&(c.properties[d]=s(String(v||""),d,c))}}if(c.type==="element"){let d=n?!n.includes(c.tagName):l?l.includes(c.tagName):!1;if(!d&&r&&typeof f=="number"&&(d=!r(c,f,p)),d&&p&&typeof f=="number")return u&&c.children?p.children.splice(f,1,...c.children):p.children.splice(f,1),f}}}function xE(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||mE.test(e.slice(0,t))?e:""}const kE=({content:e})=>{const[t,n]=D.useState(!1);return K.jsxs("div",{className:"spoiler",children:[K.jsx("button",{className:"spoiler-toggle",onClick:()=>n(!t),children:t?"Скрыть результаты поиска":"Показать результаты поиска"}),t&&K.jsx("div",{className:"spoiler-content",children:K.jsx(wy,{children:e})})]})},Fd=({role:e,content:t,searchResults:n="",isLoading:r})=>K.jsx("div",{className:`message ${e}`,children:r?K.jsx("span",{children:"..."}):K.jsxs("div",{className:"message-content",children:[K.jsx(wy,{children:t}),n&&K.jsx(kE,{content:n})]})}),SE=({onSend:e,text:t,setText:n})=>{const r=i=>{i.key==="Enter"&&i.ctrlKey&&(i.preventDefault(),t.trim()&&e(t))};return K.jsx("div",{className:"input-wrapper",children:K.jsx("textarea",{value:t,onChange:i=>n(i.target.value),onKeyDown:r,placeholder:"Введите сообщение... (Ctrl+Enter для отправки)"})})};function Pe(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var EE=typeof Symbol=="function"&&Symbol.observable||"@@observable",jd=EE,Hu=()=>Math.random().toString(36).substring(7).split("").join("."),CE={INIT:`@@redux/INIT${Hu()}`,REPLACE:`@@redux/REPLACE${Hu()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Hu()}`},ko=CE;function gc(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function xy(e,t,n){if(typeof e!="function")throw new Error(Pe(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Pe(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Pe(1));return n(xy)(e,t)}let r=e,i=t,l=new Map,o=l,u=0,s=!1;function a(){o===l&&(o=new Map,l.forEach((E,h)=>{o.set(h,E)}))}function c(){if(s)throw new Error(Pe(3));return i}function f(E){if(typeof E!="function")throw new Error(Pe(4));if(s)throw new Error(Pe(5));let h=!0;a();const m=u++;return o.set(m,E),function(){if(h){if(s)throw new Error(Pe(6));h=!1,a(),o.delete(m),l=null}}}function p(E){if(!gc(E))throw new Error(Pe(7));if(typeof E.type>"u")throw new Error(Pe(8));if(typeof E.type!="string")throw new Error(Pe(17));if(s)throw new Error(Pe(9));try{s=!0,i=r(i,E)}finally{s=!1}return(l=o).forEach(m=>{m()}),E}function d(E){if(typeof E!="function")throw new Error(Pe(10));r=E,p({type:ko.REPLACE})}function v(){const E=f;return{subscribe(h){if(typeof h!="object"||h===null)throw new Error(Pe(11));function m(){const S=h;S.next&&S.next(c())}return m(),{unsubscribe:E(m)}},[jd](){return this}}}return p({type:ko.INIT}),{dispatch:p,subscribe:f,getState:c,replaceReducer:d,[jd]:v}}function PE(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:ko.INIT})>"u")throw new Error(Pe(12));if(typeof n(void 0,{type:ko.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Pe(13))})}function _E(e){const t=Object.keys(e),n={};for(let l=0;l<t.length;l++){const o=t[l];typeof e[o]=="function"&&(n[o]=e[o])}const r=Object.keys(n);let i;try{PE(n)}catch(l){i=l}return function(o={},u){if(i)throw i;let s=!1;const a={};for(let c=0;c<r.length;c++){const f=r[c],p=n[f],d=o[f],v=p(d,u);if(typeof v>"u")throw u&&u.type,new Error(Pe(14));a[f]=v,s=s||v!==d}return s=s||r.length!==Object.keys(o).length,s?a:o}}function So(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function TE(...e){return t=>(n,r)=>{const i=t(n,r);let l=()=>{throw new Error(Pe(15))};const o={getState:i.getState,dispatch:(s,...a)=>l(s,...a)},u=e.map(s=>s(o));return l=So(...u)(i.dispatch),{...i,dispatch:l}}}function IE(e){return gc(e)&&"type"in e&&typeof e.type=="string"}var ky=Symbol.for("immer-nothing"),bd=Symbol.for("immer-draftable"),it=Symbol.for("immer-state");function Pt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var qr=Object.getPrototypeOf;function tr(e){return!!e&&!!e[it]}function tn(e){var t;return e?Sy(e)||Array.isArray(e)||!!e[bd]||!!((t=e.constructor)!=null&&t[bd])||Yo(e)||Jo(e):!1}var OE=Object.prototype.constructor.toString();function Sy(e){if(!e||typeof e!="object")return!1;const t=qr(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===OE}function Eo(e,t){Xo(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Xo(e){const t=e[it];return t?t.type_:Array.isArray(e)?1:Yo(e)?2:Jo(e)?3:0}function Js(e,t){return Xo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ey(e,t,n){const r=Xo(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function NE(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Yo(e){return e instanceof Map}function Jo(e){return e instanceof Set}function jn(e){return e.copy_||e.base_}function Zs(e,t){if(Yo(e))return new Map(e);if(Jo(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Sy(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[it];let i=Reflect.ownKeys(r);for(let l=0;l<i.length;l++){const o=i[l],u=r[o];u.writable===!1&&(u.writable=!0,u.configurable=!0),(u.get||u.set)&&(r[o]={configurable:!0,writable:!0,enumerable:u.enumerable,value:e[o]})}return Object.create(qr(e),r)}else{const r=qr(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function vc(e,t=!1){return Zo(e)||tr(e)||!tn(e)||(Xo(e)>1&&(e.set=e.add=e.clear=e.delete=RE),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>vc(r,!0))),e}function RE(){Pt(2)}function Zo(e){return Object.isFrozen(e)}var zE={};function nr(e){const t=zE[e];return t||Pt(0,e),t}var Ki;function Cy(){return Ki}function LE(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Bd(e,t){t&&(nr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ea(e){ta(e),e.drafts_.forEach(DE),e.drafts_=null}function ta(e){e===Ki&&(Ki=e.parent_)}function Ud(e){return Ki=LE(Ki,e)}function DE(e){const t=e[it];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Hd(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[it].modified_&&(ea(t),Pt(4)),tn(e)&&(e=Co(t,e),t.parent_||Po(t,e)),t.patches_&&nr("Patches").generateReplacementPatches_(n[it].base_,e,t.patches_,t.inversePatches_)):e=Co(t,n,[]),ea(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ky?e:void 0}function Co(e,t,n){if(Zo(t))return t;const r=t[it];if(!r)return Eo(t,(i,l)=>$d(e,r,t,i,l,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Po(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let l=i,o=!1;r.type_===3&&(l=new Set(i),i.clear(),o=!0),Eo(l,(u,s)=>$d(e,r,i,u,s,n,o)),Po(e,i,!1),n&&e.patches_&&nr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function $d(e,t,n,r,i,l,o){if(tr(i)){const u=l&&t&&t.type_!==3&&!Js(t.assigned_,r)?l.concat(r):void 0,s=Co(e,i,u);if(Ey(n,r,s),tr(s))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(tn(i)&&!Zo(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Co(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Po(e,i)}}function Po(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&vc(t,n)}function AE(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Cy(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,l=wc;n&&(i=[r],l=qi);const{revoke:o,proxy:u}=Proxy.revocable(i,l);return r.draft_=u,r.revoke_=o,u}var wc={get(e,t){if(t===it)return e;const n=jn(e);if(!Js(n,t))return ME(e,n,t);const r=n[t];return e.finalized_||!tn(r)?r:r===$u(e.base_,t)?(Vu(e),e.copy_[t]=ra(r,e)):r},has(e,t){return t in jn(e)},ownKeys(e){return Reflect.ownKeys(jn(e))},set(e,t,n){const r=Py(jn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=$u(jn(e),t),l=i==null?void 0:i[it];if(l&&l.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(NE(n,i)&&(n!==void 0||Js(e.base_,t)))return!0;Vu(e),na(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return $u(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Vu(e),na(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=jn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Pt(11)},getPrototypeOf(e){return qr(e.base_)},setPrototypeOf(){Pt(12)}},qi={};Eo(wc,(e,t)=>{qi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});qi.deleteProperty=function(e,t){return qi.set.call(this,e,t,void 0)};qi.set=function(e,t,n){return wc.set.call(this,e[0],t,n,e[0])};function $u(e,t){const n=e[it];return(n?jn(n):e)[t]}function ME(e,t,n){var i;const r=Py(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function Py(e,t){if(!(t in e))return;let n=qr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=qr(n)}}function na(e){e.modified_||(e.modified_=!0,e.parent_&&na(e.parent_))}function Vu(e){e.copy_||(e.copy_=Zs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var FE=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const l=n;n=t;const o=this;return function(s=l,...a){return o.produce(s,c=>n.call(this,c,...a))}}typeof n!="function"&&Pt(6),r!==void 0&&typeof r!="function"&&Pt(7);let i;if(tn(t)){const l=Ud(this),o=ra(t,void 0);let u=!0;try{i=n(o),u=!1}finally{u?ea(l):ta(l)}return Bd(l,r),Hd(i,l)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===ky&&(i=void 0),this.autoFreeze_&&vc(i,!0),r){const l=[],o=[];nr("Patches").generateReplacementPatches_(t,i,l,o),r(l,o)}return i}else Pt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(o,...u)=>this.produceWithPatches(o,s=>t(s,...u));let r,i;return[this.produce(t,n,(o,u)=>{r=o,i=u}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){tn(e)||Pt(8),tr(e)&&(e=jE(e));const t=Ud(this),n=ra(e,void 0);return n[it].isManual_=!0,ta(t),n}finishDraft(e,t){const n=e&&e[it];(!n||!n.isManual_)&&Pt(9);const{scope_:r}=n;return Bd(r,t),Hd(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=nr("Patches").applyPatches_;return tr(e)?r(e,t):this.produce(e,i=>r(i,t))}};function ra(e,t){const n=Yo(e)?nr("MapSet").proxyMap_(e,t):Jo(e)?nr("MapSet").proxySet_(e,t):AE(e,t);return(t?t.scope_:Cy()).drafts_.push(n),n}function jE(e){return tr(e)||Pt(10,e),_y(e)}function _y(e){if(!tn(e)||Zo(e))return e;const t=e[it];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Zs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Zs(e,!0);return Eo(n,(r,i)=>{Ey(n,r,_y(i))}),t&&(t.finalized_=!1),n}var lt=new FE,Ty=lt.produce;lt.produceWithPatches.bind(lt);lt.setAutoFreeze.bind(lt);lt.setUseStrictShallowCopy.bind(lt);lt.applyPatches.bind(lt);lt.createDraft.bind(lt);lt.finishDraft.bind(lt);function Iy(e){return({dispatch:n,getState:r})=>i=>l=>typeof l=="function"?l(n,r,e):i(l)}var bE=Iy(),BE=Iy,UE=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?So:So.apply(null,arguments)};function Vd(e,t){function n(...r){if(t){let i=t(...r);if(!i)throw new Error(Xt(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>IE(r)&&r.type===e,n}var Oy=class yi extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,yi.prototype)}static get[Symbol.species](){return yi}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new yi(...t[0].concat(this)):new yi(...t.concat(this))}};function Qd(e){return tn(e)?Ty(e,()=>{}):e}function Wd(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function HE(e){return typeof e=="boolean"}var $E=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:l=!0}=t??{};let o=new Oy;return n&&(HE(n)?o.push(bE):o.push(BE(n.extraArgument))),o},VE="RTK_autoBatch",Kd=e=>t=>{setTimeout(t,e)},QE=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,l=!1,o=!1;const u=new Set,s=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Kd(10):e.type==="callback"?e.queueNotification:Kd(e.timeout),a=()=>{o=!1,l&&(l=!1,u.forEach(c=>c()))};return Object.assign({},r,{subscribe(c){const f=()=>i&&c(),p=r.subscribe(f);return u.add(c),()=>{p(),u.delete(c)}},dispatch(c){var f;try{return i=!((f=c==null?void 0:c.meta)!=null&&f[VE]),l=!i,l&&(o||(o=!0,s(a))),r.dispatch(c)}finally{i=!0}}})},WE=e=>function(n){const{autoBatch:r=!0}=n??{};let i=new Oy(e);return r&&i.push(QE(typeof r=="object"?r:void 0)),i};function KE(e){const t=$E(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:l=void 0,enhancers:o=void 0}=e||{};let u;if(typeof n=="function")u=n;else if(gc(n))u=_E(n);else throw new Error(Xt(1));let s;typeof r=="function"?s=r(t):s=t();let a=So;i&&(a=UE({trace:!1,...typeof i=="object"&&i}));const c=TE(...s),f=WE(c);let p=typeof o=="function"?o(f):f();const d=a(...p);return xy(u,l,d)}function Ny(e){const t={},n=[];let r;const i={addCase(l,o){const u=typeof l=="string"?l:l.type;if(!u)throw new Error(Xt(28));if(u in t)throw new Error(Xt(29));return t[u]=o,i},addMatcher(l,o){return n.push({matcher:l,reducer:o}),i},addDefaultCase(l){return r=l,i}};return e(i),[t,n,r]}function qE(e){return typeof e=="function"}function GE(e,t){let[n,r,i]=Ny(t),l;if(qE(e))l=()=>Qd(e());else{const u=Qd(e);l=()=>u}function o(u=l(),s){let a=[n[s.type],...r.filter(({matcher:c})=>c(s)).map(({reducer:c})=>c)];return a.filter(c=>!!c).length===0&&(a=[i]),a.reduce((c,f)=>{if(f)if(tr(c)){const d=f(c,s);return d===void 0?c:d}else{if(tn(c))return Ty(c,p=>f(p,s));{const p=f(c,s);if(p===void 0){if(c===null)return c;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return c},u)}return o.getInitialState=l,o}var XE=Symbol.for("rtk-slice-createasyncthunk");function YE(e,t){return`${e}/${t}`}function JE({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[XE];return function(i){const{name:l,reducerPath:o=l}=i;if(!l)throw new Error(Xt(11));const u=(typeof i.reducers=="function"?i.reducers(tC()):i.reducers)||{},s=Object.keys(u),a={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(y,S){const C=typeof y=="string"?y:y.type;if(!C)throw new Error(Xt(12));if(C in a.sliceCaseReducersByType)throw new Error(Xt(13));return a.sliceCaseReducersByType[C]=S,c},addMatcher(y,S){return a.sliceMatchers.push({matcher:y,reducer:S}),c},exposeAction(y,S){return a.actionCreators[y]=S,c},exposeCaseReducer(y,S){return a.sliceCaseReducersByName[y]=S,c}};s.forEach(y=>{const S=u[y],C={reducerName:y,type:YE(l,y),createNotation:typeof i.reducers=="function"};rC(S)?lC(C,S,c,t):nC(C,S,c)});function f(){const[y={},S=[],C=void 0]=typeof i.extraReducers=="function"?Ny(i.extraReducers):[i.extraReducers],k={...y,...a.sliceCaseReducersByType};return GE(i.initialState,I=>{for(let T in k)I.addCase(T,k[T]);for(let T of a.sliceMatchers)I.addMatcher(T.matcher,T.reducer);for(let T of S)I.addMatcher(T.matcher,T.reducer);C&&I.addDefaultCase(C)})}const p=y=>y,d=new Map;let v;function w(y,S){return v||(v=f()),v(y,S)}function E(){return v||(v=f()),v.getInitialState()}function h(y,S=!1){function C(I){let T=I[y];return typeof T>"u"&&S&&(T=E()),T}function k(I=p){const T=Wd(d,S,()=>new WeakMap);return Wd(T,I,()=>{const L={};for(const[M,F]of Object.entries(i.selectors??{}))L[M]=ZE(F,I,E,S);return L})}return{reducerPath:y,getSelectors:k,get selectors(){return k(C)},selectSlice:C}}const m={name:l,reducer:w,actions:a.actionCreators,caseReducers:a.sliceCaseReducersByName,getInitialState:E,...h(o),injectInto(y,{reducerPath:S,...C}={}){const k=S??o;return y.inject({reducerPath:k,reducer:w},C),{...m,...h(k,!0)}}};return m}}function ZE(e,t,n,r){function i(l,...o){let u=t(l);return typeof u>"u"&&r&&(u=n()),e(u,...o)}return i.unwrapped=e,i}var eC=JE();function tC(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function nC({type:e,reducerName:t,createNotation:n},r,i){let l,o;if("reducer"in r){if(n&&!iC(r))throw new Error(Xt(17));l=r.reducer,o=r.prepare}else l=r;i.addCase(e,l).exposeCaseReducer(t,l).exposeAction(t,o?Vd(e,o):Vd(e))}function rC(e){return e._reducerDefinitionType==="asyncThunk"}function iC(e){return e._reducerDefinitionType==="reducerWithPrepare"}function lC({type:e,reducerName:t},n,r,i){if(!i)throw new Error(Xt(18));const{payloadCreator:l,fulfilled:o,pending:u,rejected:s,settled:a,options:c}=n,f=i(e,l,c);r.exposeAction(t,f),o&&r.addCase(f.fulfilled,o),u&&r.addCase(f.pending,u),s&&r.addCase(f.rejected,s),a&&r.addMatcher(f.settled,a),r.exposeCaseReducer(t,{fulfilled:o||Ol,pending:u||Ol,rejected:s||Ol,settled:a||Ol})}function Ol(){}function Xt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const oC=()=>{const e=localStorage.getItem("chatHistory");if(e)try{return JSON.parse(e)}catch(t){return console.error("Failed to parse chat history from localStorage:",t),[]}return[]},uC={history:oC()},Ry=eC({name:"chat",initialState:uC,reducers:{addMessage:(e,t)=>{e.history.push(t.payload),localStorage.setItem("chatHistory",JSON.stringify(e.history))},clearHistory:e=>{e.history=[],localStorage.setItem("chatHistory",JSON.stringify([]))},setHistory:(e,t)=>{e.history=t.payload,localStorage.setItem("chatHistory",JSON.stringify(e.history))}}}),{addMessage:sC,clearHistory:aC,setHistory:Qu}=Ry.actions,cC=Ry.reducer,fC=()=>{const[e,t]=D.useState(""),[n,r]=D.useState(null),[i,l]=D.useState(!1),[o,u]=D.useState(!1),s=A0(v=>v.chat.history),a=z0(),c=D.useRef(null),f=()=>{const v=document.querySelector(".messages");if(v){const w=v.getBoundingClientRect(),E=window.innerHeight;return w.bottom<=E+10}return!0},p=()=>{c.current&&(c.current.abort(),l(!1),console.log("Generation stopped by user"))},d=async v=>{var h;if(!v.trim()||i)return;const w={role:"user",content:v,searchResults:""};a(sC(w)),t(""),l(!0),u(!1),console.log("Start request - isLoading:",i,"hasAssistantStarted:",o);const E="https://muryshev-generic-chatbot-backend.hf.space/llm/chat/stream";try{const m=new AbortController;c.current=m;const y=setTimeout(()=>{m.abort(),r("Сервер временно недоступен")},6e4),S=await fetch(E,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({history:[...s,w]}),signal:m.signal});if(clearTimeout(y),!S.ok)throw new Error(`HTTP error! status: ${S.status}`);const C=(h=S.body)==null?void 0:h.getReader();if(!C)throw new Error("Response body is not readable");const k=new TextDecoder;let I="",T="",L=[...s,w];for(;;){const{done:M,value:F}=await C.read();if(M)break;I+=k.decode(F,{stream:!0});const j=I.split(`
89
 
90
  `);for(let ee=0;ee<j.length-1;ee++){const V=j[ee].trim();if(V.startsWith("data: ")){const fe=V.slice(6);console.log("Received SSE event:",fe);try{const J=JSON.parse(fe);if(J.event==="done"){a(Qu(L)),l(!1),console.log("Done - isLoading:",i,"hasAssistantStarted:",o);break}else if(J.event==="error"){r(J.data),l(!1),console.log("Error - isLoading:",i,"hasAssistantStarted:",o);break}else if(J.event==="search_results")L=L.map((R,b)=>b===L.length-1&&R.role==="user"?{...R,searchResults:J.data}:R),a(Qu(L)),console.log("After search_results - isLoading:",i,"hasAssistantStarted:",o);else if(J.event==="token"){o||(u(!0),console.log("Before first token - isLoading:",i,"hasAssistantStarted:",o)),T+=J.data;const R=L.findLastIndex(g=>g.role==="user"),b=L.findIndex((g,Q)=>g.role==="assistant"&&Q>R);b>=0?L=L.map((g,Q)=>Q===b?{...g,content:T}:g):L=[...L,{role:"assistant",content:T,searchResults:""}],a(Qu(L))}}catch(J){console.error("Failed to parse SSE data:",J),r("Ошибка обработки данных от сервера")}}}I=j[j.length-1];const G=document.querySelector(".messages");if(G){const ee=G.querySelectorAll("div"),V=ee[ee.length-1];V&&f()&&setTimeout(()=>{V.scrollIntoView({behavior:"smooth",block:"start"}),console.log("Autoscroll triggered, isAtBottom:",f())},0)}}}catch(m){console.error("Stream error:",m),l(!1),console.log("Catch - isLoading:",i,"hasAssistantStarted:",o),m instanceof DOMException&&m.name==="AbortError"&&!c.current?r("Сервер временно недоступен"):m instanceof DOMException&&m.name==="AbortError"||r("Произошла ошибка при запросе")}finally{c.current=null}};return D.useEffect(()=>{if(console.log("State update - isLoading:",i,"hasAssistantStarted:",o),n){const v=setTimeout(()=>r(null),5e3);return()=>clearTimeout(v)}},[i,o,n]),K.jsxs("div",{className:"chat",children:[n&&K.jsx("div",{className:"error-toast",children:n}),K.jsxs("div",{className:"messages",children:[s.map((v,w)=>K.jsx("div",{children:K.jsx(Fd,{role:v.role,content:v.content,searchResults:v.searchResults})},w)),i&&!o&&K.jsx("div",{children:K.jsx(Fd,{role:"assistant",content:"",isLoading:!0,searchResults:""})})]}),K.jsxs("div",{className:"input-area",children:[K.jsx(SE,{onSend:d,text:e,setText:t}),K.jsxs("div",{className:"buttons",children:[i?K.jsx("button",{className:"stop-button",onClick:p,children:"Остановить"}):K.jsx("button",{className:"send-button",onClick:()=>d(e),children:"Отправить"}),K.jsx("a",{href:"#",className:"clear-link",onClick:v=>{v.preventDefault(),a(aC())},children:"Очистить"})]})]})]})},dC=KE({reducer:{chat:cC}}),pC=()=>K.jsx(O0,{store:dC,children:K.jsx(fC,{})});var eu=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(){}},tu=typeof window>"u"||"Deno"in globalThis;function xt(){}function hC(e,t){return typeof e=="function"?e(t):e}function mC(e){return typeof e=="number"&&e>=0&&e!==1/0}function yC(e,t){return Math.max(e+(t||0)-Date.now(),0)}function qd(e,t){return typeof e=="function"?e(t):e}function gC(e,t){return typeof e=="function"?e(t):e}function Gd(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:l,queryKey:o,stale:u}=e;if(o){if(r){if(t.queryHash!==xc(o,t.options))return!1}else if(!Xi(t.queryKey,o))return!1}if(n!=="all"){const s=t.isActive();if(n==="active"&&!s||n==="inactive"&&s)return!1}return!(typeof u=="boolean"&&t.isStale()!==u||i&&i!==t.state.fetchStatus||l&&!l(t))}function Xd(e,t){const{exact:n,status:r,predicate:i,mutationKey:l}=e;if(l){if(!t.options.mutationKey)return!1;if(n){if(Gi(t.options.mutationKey)!==Gi(l))return!1}else if(!Xi(t.options.mutationKey,l))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function xc(e,t){return((t==null?void 0:t.queryKeyHashFn)||Gi)(e)}function Gi(e){return JSON.stringify(e,(t,n)=>ia(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Xi(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!Xi(e[n],t[n])):!1}function zy(e,t){if(e===t)return e;const n=Yd(e)&&Yd(t);if(n||ia(e)&&ia(t)){const r=n?e:Object.keys(e),i=r.length,l=n?t:Object.keys(t),o=l.length,u=n?[]:{};let s=0;for(let a=0;a<o;a++){const c=n?a:l[a];(!n&&r.includes(c)||n)&&e[c]===void 0&&t[c]===void 0?(u[c]=void 0,s++):(u[c]=zy(e[c],t[c]),u[c]===e[c]&&e[c]!==void 0&&s++)}return i===o&&s===i?e:u}return t}function Yd(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ia(e){if(!Jd(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Jd(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Jd(e){return Object.prototype.toString.call(e)==="[object Object]"}function vC(e){return new Promise(t=>{setTimeout(t,e)})}function wC(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?zy(e,t):t}function xC(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function kC(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var kc=Symbol();function Ly(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===kc?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var $n,dn,zr,tp,SC=(tp=class extends eu{constructor(){super();Y(this,$n);Y(this,dn);Y(this,zr);H(this,zr,t=>{if(!tu&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){_(this,dn)||this.setEventListener(_(this,zr))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,dn))==null||t.call(this),H(this,dn,void 0))}setEventListener(t){var n;H(this,zr,t),(n=_(this,dn))==null||n.call(this),H(this,dn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){_(this,$n)!==t&&(H(this,$n,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof _(this,$n)=="boolean"?_(this,$n):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},$n=new WeakMap,dn=new WeakMap,zr=new WeakMap,tp),Dy=new SC,Lr,pn,Dr,np,EC=(np=class extends eu{constructor(){super();Y(this,Lr,!0);Y(this,pn);Y(this,Dr);H(this,Dr,t=>{if(!tu&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){_(this,pn)||this.setEventListener(_(this,Dr))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,pn))==null||t.call(this),H(this,pn,void 0))}setEventListener(t){var n;H(this,Dr,t),(n=_(this,pn))==null||n.call(this),H(this,pn,t(this.setOnline.bind(this)))}setOnline(t){_(this,Lr)!==t&&(H(this,Lr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return _(this,Lr)}},Lr=new WeakMap,pn=new WeakMap,Dr=new WeakMap,np),_o=new EC;function CC(){let e,t;const n=new Promise((i,l)=>{e=i,t=l});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}function PC(e){return Math.min(1e3*2**e,3e4)}function Ay(e){return(e??"online")==="online"?_o.isOnline():!0}var My=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Wu(e){return e instanceof My}function Fy(e){let t=!1,n=0,r=!1,i;const l=CC(),o=w=>{var E;r||(p(new My(w)),(E=e.abort)==null||E.call(e))},u=()=>{t=!0},s=()=>{t=!1},a=()=>Dy.isFocused()&&(e.networkMode==="always"||_o.isOnline())&&e.canRun(),c=()=>Ay(e.networkMode)&&e.canRun(),f=w=>{var E;r||(r=!0,(E=e.onSuccess)==null||E.call(e,w),i==null||i(),l.resolve(w))},p=w=>{var E;r||(r=!0,(E=e.onError)==null||E.call(e,w),i==null||i(),l.reject(w))},d=()=>new Promise(w=>{var E;i=h=>{(r||a())&&w(h)},(E=e.onPause)==null||E.call(e)}).then(()=>{var w;i=void 0,r||(w=e.onContinue)==null||w.call(e)}),v=()=>{if(r)return;let w;const E=n===0?e.initialPromise:void 0;try{w=E??e.fn()}catch(h){w=Promise.reject(h)}Promise.resolve(w).then(f).catch(h=>{var k;if(r)return;const m=e.retry??(tu?0:3),y=e.retryDelay??PC,S=typeof y=="function"?y(n,h):y,C=m===!0||typeof m=="number"&&n<m||typeof m=="function"&&m(n,h);if(t||!C){p(h);return}n++,(k=e.onFail)==null||k.call(e,n,h),vC(S).then(()=>a()?void 0:d()).then(()=>{t?p(h):v()})})};return{promise:l,cancel:o,continue:()=>(i==null||i(),l),cancelRetry:u,continueRetry:s,canStart:c,start:()=>(c()?v():d().then(v),l)}}function _C(){let e=[],t=0,n=u=>{u()},r=u=>{u()},i=u=>setTimeout(u,0);const l=u=>{t?e.push(u):i(()=>{n(u)})},o=()=>{const u=e;e=[],u.length&&i(()=>{r(()=>{u.forEach(s=>{n(s)})})})};return{batch:u=>{let s;t++;try{s=u()}finally{t--,t||o()}return s},batchCalls:u=>(...s)=>{l(()=>{u(...s)})},schedule:l,setNotifyFunction:u=>{n=u},setBatchNotifyFunction:u=>{r=u},setScheduler:u=>{i=u}}}var je=_C(),Vn,rp,jy=(rp=class{constructor(){Y(this,Vn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),mC(this.gcTime)&&H(this,Vn,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(tu?1/0:5*60*1e3))}clearGcTimeout(){_(this,Vn)&&(clearTimeout(_(this,Vn)),H(this,Vn,void 0))}},Vn=new WeakMap,rp),Ar,Mr,st,Qn,ze,Yi,Wn,kt,$t,ip,TC=(ip=class extends jy{constructor(t){super();Y(this,kt);Y(this,Ar);Y(this,Mr);Y(this,st);Y(this,Qn);Y(this,ze);Y(this,Yi);Y(this,Wn);H(this,Wn,!1),H(this,Yi,t.defaultOptions),this.setOptions(t.options),this.observers=[],H(this,Qn,t.client),H(this,st,_(this,Qn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,H(this,Ar,OC(this.options)),this.state=t.state??_(this,Ar),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=_(this,ze))==null?void 0:t.promise}setOptions(t){this.options={..._(this,Yi),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&_(this,st).remove(this)}setData(t,n){const r=wC(this.state.data,t,this.options);return Oe(this,kt,$t).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Oe(this,kt,$t).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,i;const n=(r=_(this,ze))==null?void 0:r.promise;return(i=_(this,ze))==null||i.cancel(t),n?n.then(xt).catch(xt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(_(this,Ar))}isActive(){return this.observers.some(t=>gC(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===kc||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!yC(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,ze))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,ze))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),_(this,st).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(_(this,ze)&&(_(this,Wn)?_(this,ze).cancel({revert:!0}):_(this,ze).cancelRetry()),this.scheduleGc()),_(this,st).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Oe(this,kt,$t).call(this,{type:"invalidate"})}fetch(t,n){var s,a,c;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(_(this,ze))return _(this,ze).continueRetry(),_(this,ze).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(p=>p.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,i=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(H(this,Wn,!0),r.signal)})},l=()=>{const f=Ly(this.options,n),p={client:_(this,Qn),queryKey:this.queryKey,meta:this.meta};return i(p),H(this,Wn,!1),this.options.persister?this.options.persister(f,p,this):f(p)},o={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:_(this,Qn),state:this.state,fetchFn:l};i(o),(s=this.options.behavior)==null||s.onFetch(o,this),H(this,Mr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((a=o.fetchOptions)==null?void 0:a.meta))&&Oe(this,kt,$t).call(this,{type:"fetch",meta:(c=o.fetchOptions)==null?void 0:c.meta});const u=f=>{var p,d,v,w;Wu(f)&&f.silent||Oe(this,kt,$t).call(this,{type:"error",error:f}),Wu(f)||((d=(p=_(this,st).config).onError)==null||d.call(p,f,this),(w=(v=_(this,st).config).onSettled)==null||w.call(v,this.state.data,f,this)),this.scheduleGc()};return H(this,ze,Fy({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var p,d,v,w;if(f===void 0){u(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(E){u(E);return}(d=(p=_(this,st).config).onSuccess)==null||d.call(p,f,this),(w=(v=_(this,st).config).onSettled)==null||w.call(v,f,this.state.error,this),this.scheduleGc()},onError:u,onFail:(f,p)=>{Oe(this,kt,$t).call(this,{type:"failed",failureCount:f,error:p})},onPause:()=>{Oe(this,kt,$t).call(this,{type:"pause"})},onContinue:()=>{Oe(this,kt,$t).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),_(this,ze).start()}},Ar=new WeakMap,Mr=new WeakMap,st=new WeakMap,Qn=new WeakMap,ze=new WeakMap,Yi=new WeakMap,Wn=new WeakMap,kt=new WeakSet,$t=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...IC(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=t.error;return Wu(i)&&i.revert&&_(this,Mr)?{..._(this,Mr),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),je.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),_(this,st).notify({query:this,type:"updated",action:t})})},ip);function IC(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ay(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function OC(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?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"}}var Lt,lp,NC=(lp=class extends eu{constructor(t={}){super();Y(this,Lt);this.config=t,H(this,Lt,new Map)}build(t,n,r){const i=n.queryKey,l=n.queryHash??xc(i,n);let o=this.get(l);return o||(o=new TC({client:t,queryKey:i,queryHash:l,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(o)),o}add(t){_(this,Lt).has(t.queryHash)||(_(this,Lt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=_(this,Lt).get(t.queryHash);n&&(t.destroy(),n===t&&_(this,Lt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){je.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return _(this,Lt).get(t)}getAll(){return[..._(this,Lt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Gd(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Gd(t,r)):n}notify(t){je.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){je.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){je.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Lt=new WeakMap,lp),Dt,Me,Kn,At,un,op,RC=(op=class extends jy{constructor(t){super();Y(this,At);Y(this,Dt);Y(this,Me);Y(this,Kn);this.mutationId=t.mutationId,H(this,Me,t.mutationCache),H(this,Dt,[]),this.state=t.state||zC(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){_(this,Dt).includes(t)||(_(this,Dt).push(t),this.clearGcTimeout(),_(this,Me).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){H(this,Dt,_(this,Dt).filter(n=>n!==t)),this.scheduleGc(),_(this,Me).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){_(this,Dt).length||(this.state.status==="pending"?this.scheduleGc():_(this,Me).remove(this))}continue(){var t;return((t=_(this,Kn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,l,o,u,s,a,c,f,p,d,v,w,E,h,m,y,S,C,k,I;H(this,Kn,Fy({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(T,L)=>{Oe(this,At,un).call(this,{type:"failed",failureCount:T,error:L})},onPause:()=>{Oe(this,At,un).call(this,{type:"pause"})},onContinue:()=>{Oe(this,At,un).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>_(this,Me).canRun(this)}));const n=this.state.status==="pending",r=!_(this,Kn).canStart();try{if(!n){Oe(this,At,un).call(this,{type:"pending",variables:t,isPaused:r}),await((l=(i=_(this,Me).config).onMutate)==null?void 0:l.call(i,t,this));const L=await((u=(o=this.options).onMutate)==null?void 0:u.call(o,t));L!==this.state.context&&Oe(this,At,un).call(this,{type:"pending",context:L,variables:t,isPaused:r})}const T=await _(this,Kn).start();return await((a=(s=_(this,Me).config).onSuccess)==null?void 0:a.call(s,T,t,this.state.context,this)),await((f=(c=this.options).onSuccess)==null?void 0:f.call(c,T,t,this.state.context)),await((d=(p=_(this,Me).config).onSettled)==null?void 0:d.call(p,T,null,this.state.variables,this.state.context,this)),await((w=(v=this.options).onSettled)==null?void 0:w.call(v,T,null,t,this.state.context)),Oe(this,At,un).call(this,{type:"success",data:T}),T}catch(T){try{throw await((h=(E=_(this,Me).config).onError)==null?void 0:h.call(E,T,t,this.state.context,this)),await((y=(m=this.options).onError)==null?void 0:y.call(m,T,t,this.state.context)),await((C=(S=_(this,Me).config).onSettled)==null?void 0:C.call(S,void 0,T,this.state.variables,this.state.context,this)),await((I=(k=this.options).onSettled)==null?void 0:I.call(k,void 0,T,t,this.state.context)),T}finally{Oe(this,At,un).call(this,{type:"error",error:T})}}finally{_(this,Me).runNext(this)}}},Dt=new WeakMap,Me=new WeakMap,Kn=new WeakMap,At=new WeakSet,un=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),je.batch(()=>{_(this,Dt).forEach(r=>{r.onMutationUpdate(t)}),_(this,Me).notify({mutation:this,type:"updated",action:t})})},op);function zC(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Wt,St,Ji,up,LC=(up=class extends eu{constructor(t={}){super();Y(this,Wt);Y(this,St);Y(this,Ji);this.config=t,H(this,Wt,new Set),H(this,St,new Map),H(this,Ji,0)}build(t,n,r){const i=new RC({mutationCache:this,mutationId:++sl(this,Ji)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){_(this,Wt).add(t);const n=Nl(t);if(typeof n=="string"){const r=_(this,St).get(n);r?r.push(t):_(this,St).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(_(this,Wt).delete(t)){const n=Nl(t);if(typeof n=="string"){const r=_(this,St).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&_(this,St).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Nl(t);if(typeof n=="string"){const r=_(this,St).get(n),i=r==null?void 0:r.find(l=>l.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r;const n=Nl(t);if(typeof n=="string"){const i=(r=_(this,St).get(n))==null?void 0:r.find(l=>l!==t&&l.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){je.batch(()=>{_(this,Wt).forEach(t=>{this.notify({type:"removed",mutation:t})}),_(this,Wt).clear(),_(this,St).clear()})}getAll(){return Array.from(_(this,Wt))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Xd(n,r))}findAll(t={}){return this.getAll().filter(n=>Xd(t,n))}notify(t){je.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return je.batch(()=>Promise.all(t.map(n=>n.continue().catch(xt))))}},Wt=new WeakMap,St=new WeakMap,Ji=new WeakMap,up);function Nl(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Zd(e){return{onFetch:(t,n)=>{var c,f,p,d,v;const r=t.options,i=(p=(f=(c=t.fetchOptions)==null?void 0:c.meta)==null?void 0:f.fetchMore)==null?void 0:p.direction,l=((d=t.state.data)==null?void 0:d.pages)||[],o=((v=t.state.data)==null?void 0:v.pageParams)||[];let u={pages:[],pageParams:[]},s=0;const a=async()=>{let w=!1;const E=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(t.signal.aborted?w=!0:t.signal.addEventListener("abort",()=>{w=!0}),t.signal)})},h=Ly(t.options,t.fetchOptions),m=async(y,S,C)=>{if(w)return Promise.reject();if(S==null&&y.pages.length)return Promise.resolve(y);const k={client:t.client,queryKey:t.queryKey,pageParam:S,direction:C?"backward":"forward",meta:t.options.meta};E(k);const I=await h(k),{maxPages:T}=t.options,L=C?kC:xC;return{pages:L(y.pages,I,T),pageParams:L(y.pageParams,S,T)}};if(i&&l.length){const y=i==="backward",S=y?DC:ep,C={pages:l,pageParams:o},k=S(r,C);u=await m(C,k,y)}else{const y=e??l.length;do{const S=s===0?o[0]??r.initialPageParam:ep(r,u);if(s>0&&S==null)break;u=await m(u,S),s++}while(s<y)}return u};t.options.persister?t.fetchFn=()=>{var w,E;return(E=(w=t.options).persister)==null?void 0:E.call(w,a,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=a}}}function ep(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function DC(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var me,hn,mn,Fr,jr,yn,br,Br,sp,AC=(sp=class{constructor(e={}){Y(this,me);Y(this,hn);Y(this,mn);Y(this,Fr);Y(this,jr);Y(this,yn);Y(this,br);Y(this,Br);H(this,me,e.queryCache||new NC),H(this,hn,e.mutationCache||new LC),H(this,mn,e.defaultOptions||{}),H(this,Fr,new Map),H(this,jr,new Map),H(this,yn,0)}mount(){sl(this,yn)._++,_(this,yn)===1&&(H(this,br,Dy.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,me).onFocus())})),H(this,Br,_o.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,me).onOnline())})))}unmount(){var e,t;sl(this,yn)._--,_(this,yn)===0&&((e=_(this,br))==null||e.call(this),H(this,br,void 0),(t=_(this,Br))==null||t.call(this),H(this,Br,void 0))}isFetching(e){return _(this,me).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return _(this,hn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,me).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=_(this,me).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(qd(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return _(this,me).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=_(this,me).get(r.queryHash),l=i==null?void 0:i.state.data,o=hC(t,l);if(o!==void 0)return _(this,me).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return je.batch(()=>_(this,me).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,me).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=_(this,me);je.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=_(this,me);return je.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=je.batch(()=>_(this,me).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(xt).catch(xt)}invalidateQueries(e,t={}){return je.batch(()=>(_(this,me).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=je.batch(()=>_(this,me).findAll(e).filter(i=>!i.isDisabled()).map(i=>{let l=i.fetch(void 0,n);return n.throwOnError||(l=l.catch(xt)),i.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(r).then(xt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=_(this,me).build(this,t);return n.isStaleByTime(qd(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(xt).catch(xt)}fetchInfiniteQuery(e){return e.behavior=Zd(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(xt).catch(xt)}ensureInfiniteQueryData(e){return e.behavior=Zd(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return _o.isOnline()?_(this,hn).resumePausedMutations():Promise.resolve()}getQueryCache(){return _(this,me)}getMutationCache(){return _(this,hn)}getDefaultOptions(){return _(this,mn)}setDefaultOptions(e){H(this,mn,e)}setQueryDefaults(e,t){_(this,Fr).set(Gi(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[..._(this,Fr).values()],n={};return t.forEach(r=>{Xi(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){_(this,jr).set(Gi(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[..._(this,jr).values()],n={};return t.forEach(r=>{Xi(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={..._(this,mn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=xc(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===kc&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{..._(this,mn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){_(this,me).clear(),_(this,hn).clear()}},me=new WeakMap,hn=new WeakMap,mn=new WeakMap,Fr=new WeakMap,jr=new WeakMap,yn=new WeakMap,br=new WeakMap,Br=new WeakMap,sp),MC=D.createContext(void 0),FC=({client:e,children:t})=>(D.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),K.jsx(MC.Provider,{value:e,children:t}));const jC=new AC;Ku.createRoot(document.getElementById("root")).render(K.jsx(wp.StrictMode,{children:K.jsx(FC,{client:jC,children:K.jsx(a0,{children:K.jsx(o0,{children:K.jsx(Rm,{path:"/",element:K.jsx(pC,{})})})})})}));
dist/index.html CHANGED
@@ -4,7 +4,7 @@
4
  <meta charset="UTF-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
  <title>Чат бот</title>
7
- <script type="module" crossorigin src="/assets/index-CajeydU-.js"></script>
8
  <link rel="stylesheet" crossorigin href="/assets/index-CkRcohXN.css">
9
  </head>
10
  <body>
 
4
  <meta charset="UTF-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
  <title>Чат бот</title>
7
+ <script type="module" crossorigin src="/assets/index--I6HCIVw.js"></script>
8
  <link rel="stylesheet" crossorigin href="/assets/index-CkRcohXN.css">
9
  </head>
10
  <body>