From e6ebf2cbff367d1a78966140353d433a2d315da1 Mon Sep 17 00:00:00 2001 From: Fovway Date: Thu, 6 Nov 2025 00:00:11 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D1=84=D0=B0=D0=B9=D0=BB=20.gitignore=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=B8=D1=81=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=BD=D0=BE=D0=B2=D1=8B=D1=85=20=D0=B2=D1=80=D0=B5?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=BD=D1=8B=D1=85=20=D0=B8=20=D0=BA=D1=8D?= =?UTF-8?q?=D1=88=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20?= =?UTF-8?q?=D1=84=D0=B0=D0=B9=D0=BB=D0=BE=D0=B2,=20=D0=B0=20=D1=82=D0=B0?= =?UTF-8?q?=D0=BA=D0=B6=D0=B5=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D0=B5=20=D0=BE=D0=BA=D1=80=D1=83=D0=B6=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=B4=D0=BB=D1=8F=20=D1=80=D0=B0=D0=B7=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D0=BA=D0=B8.=20=D0=9E=D0=B1=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B?= =?UTF-8?q?=20=D0=B4=D0=BE=D0=BA=D1=83=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D1=81=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC=20=D0=B8=D0=BD=D1=84=D0=BE=D1=80?= =?UTF-8?q?=D0=BC=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BE=20=D0=BA=D0=BB=D1=8E?= =?UTF-8?q?=D1=87=D0=B5=20=D1=88=D0=B8=D1=84=D1=80=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F.=20=D0=92=D0=BD=D0=B5=D1=81=D0=B5=D0=BD=D1=8B=20?= =?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2?= =?UTF-8?q?=20=D1=81=D0=B5=D1=80=D0=B2=D0=B5=D1=80=D0=BD=D1=8B=D0=B9=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=B4=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D0=BE=D0=B4?= =?UTF-8?q?=D0=B4=D0=B5=D1=80=D0=B6=D0=BA=D0=B8=20=D1=88=D0=B8=D1=84=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B8=20=D0=B4=D0=B5?= =?UTF-8?q?=D1=88=D0=B8=D1=84=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D1=81=D0=BE=D0=B4=D0=B5=D1=80=D0=B6=D0=B8=D0=BC=D0=BE=D0=B3?= =?UTF-8?q?=D0=BE=20=D0=B7=D0=B0=D0=BC=D0=B5=D1=82=D0=BE=D0=BA.=20=D0=9E?= =?UTF-8?q?=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BC=D0=BF=D0=BE=D0=BD=D0=B5=D0=BD=D1=82=D1=8B=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D1=83=D0=BB=D1=83=D1=87=D1=88=D0=B5=D0=BD=D0=B8=D1=8F?= =?UTF-8?q?=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20=D1=81=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=BC=D0=B5=D1=82=D0=BA=D0=B0=D0=BC=D0=B8=20=D0=B8=20=D0=B8?= =?UTF-8?q?=D1=85=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=D0=BC.=20=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8?= =?UTF-8?q?=D0=B7=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D1=8B=20=D1=81=D1=82?= =?UTF-8?q?=D0=B8=D0=BB=D0=B8=20=D0=B8=20=D1=81=D0=BA=D1=80=D0=B8=D0=BF?= =?UTF-8?q?=D1=82=D1=8B=20=D0=B4=D0=BB=D1=8F=20=D1=83=D0=BB=D1=83=D1=87?= =?UTF-8?q?=D1=88=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C=D1=81=D0=BA=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D0=B8=D0=BD=D1=82=D0=B5=D1=80=D1=84=D0=B5=D0=B9?= =?UTF-8?q?=D1=81=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 69 ++++- CHANGES.md | 3 + QUICK_START.md | 3 + README_RU.md | 6 + backend/README.md | 6 + backend/public/assets/index-42KwbWCP.js | 162 +++++++++++ backend/public/assets/index-CRKRzJj1.js | 272 ------------------ backend/public/assets/index-DK8OUj6L.css | 1 + backend/public/assets/index-QEK5TGz3.css | 1 - .../workbox-window.prod.es5-B9K5rw8f.js | 2 - backend/public/index.html | 76 ++++- backend/public/manifest.json | 17 -- backend/server.js | 55 ++-- backend/utils/encryption.js | 140 +++++++++ dev-dist/sw.js | 2 +- src/api/userApi.ts | 2 +- src/components/calendar/MiniCalendar.tsx | 2 +- src/components/layout/Sidebar.tsx | 1 - src/components/notes/MarkdownToolbar.tsx | 9 +- src/components/notes/NoteEditor.tsx | 8 +- src/components/notes/NoteItem.tsx | 42 ++- src/components/notes/NotesList.tsx | 4 +- src/components/search/SearchBar.tsx | 2 +- src/hooks/useNotification.ts | 5 +- src/pages/ProfilePage.tsx | 3 +- src/pages/SettingsPage.tsx | 21 +- src/services/syncService.ts | 8 +- src/store/slices/uiSlice.ts | 7 +- 28 files changed, 558 insertions(+), 371 deletions(-) create mode 100644 backend/public/assets/index-42KwbWCP.js delete mode 100644 backend/public/assets/index-CRKRzJj1.js create mode 100644 backend/public/assets/index-DK8OUj6L.css delete mode 100644 backend/public/assets/index-QEK5TGz3.css delete mode 100644 backend/public/assets/workbox-window.prod.es5-B9K5rw8f.js create mode 100644 backend/utils/encryption.js diff --git a/.gitignore b/.gitignore index 78a64ad..0d6245e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,17 +10,30 @@ lerna-debug.log* # Dependencies node_modules backend/node_modules +.pnp +.pnp.js # Build outputs dist dist-ssr +dev-dist +build *.local +# Vite +.vite +.vite/* + # Environment variables .env .env.local .env.*.local +.env.development.local +.env.test.local +.env.production.local backend/.env +backend/.env.local +backend/.env.*.local # Database files backend/database/*.db @@ -31,11 +44,29 @@ backend/database/*.db-wal backend/public/uploads/* !backend/public/uploads/.gitkeep +# Testing +coverage +*.lcov +.nyc_output +.coverage +coverage/ + +# Cache +.cache +.parcel-cache +.turbo +.eslintcache +.stylelintcache + # Editor directories and files .vscode/* !.vscode/extensions.json +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json .idea -.DS_Store +*.swp +*.swo *.suo *.ntvs* *.njsproj @@ -47,4 +78,40 @@ public/sw.js.map # OS Thumbs.db +Desktop.ini +$RECYCLE.BIN/ +.DS_Store +.AppleDouble +.LSOverride +# Temporary files +*.tmp +*.temp +*.bak +*.backup +*~ + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# Storybook build outputs +storybook-static + +# Deployment +.vercel +.netlify +.firebase +.aws-sam + +# TypeScript +*.tsbuildinfo +next-env.d.ts diff --git a/CHANGES.md b/CHANGES.md index e3d2f9b..c4b0dbe 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -110,8 +110,11 @@ cd .. PORT=3001 SESSION_SECRET=your-secret-key-here NODE_ENV=development +ENCRYPTION_KEY=your-encryption-key-min-32-chars ``` +**Важно:** `ENCRYPTION_KEY` используется для шифрования заметок в базе данных. Используйте надежный случайный ключ минимум 32 символа! + --- ## 📍 Порты diff --git a/QUICK_START.md b/QUICK_START.md index bfe193c..83137bc 100644 --- a/QUICK_START.md +++ b/QUICK_START.md @@ -92,8 +92,11 @@ npm run lint PORT=3001 SESSION_SECRET=замените-на-свой-секретный-ключ NODE_ENV=development +ENCRYPTION_KEY=замените-на-свой-ключ-минимум-32-символа ``` +**Важно:** `ENCRYPTION_KEY` используется для шифрования заметок в базе данных. Используйте надежный случайный ключ минимум 32 символа! + ### 2. Первый пользователь 1. Откройте http://localhost:5173 diff --git a/README_RU.md b/README_RU.md index 4134414..567e59b 100644 --- a/README_RU.md +++ b/README_RU.md @@ -171,8 +171,14 @@ npm run lint PORT=3001 SESSION_SECRET=your-secret-key-here NODE_ENV=development +ENCRYPTION_KEY=your-encryption-key-min-32-chars ``` +**Важно:** +- `ENCRYPTION_KEY` - ключ для шифрования заметок в базе данных (минимум 32 символа) +- В продакшене ОБЯЗАТЕЛЬНО используйте надежный случайный ключ +- Не используйте дефолтный ключ в продакшене! + ### AI настройки Настройки AI выполняются через интерфейс приложения в разделе "Настройки". diff --git a/backend/README.md b/backend/README.md index 6c55c2f..330dd20 100644 --- a/backend/README.md +++ b/backend/README.md @@ -16,8 +16,14 @@ npm install PORT=3001 SESSION_SECRET=your-secret-key-here-change-in-production NODE_ENV=development +ENCRYPTION_KEY=your-encryption-key-minimum-32-characters-long ``` +**Важно:** +- `ENCRYPTION_KEY` - ключ для шифрования заметок в базе данных (минимум 32 символа) +- В продакшене ОБЯЗАТЕЛЬНО используйте надежный случайный ключ +- Потеря ключа приведет к невозможности дешифрования существующих заметок! + ## Запуск ### Отдельный запуск бэкенда: diff --git a/backend/public/assets/index-42KwbWCP.js b/backend/public/assets/index-42KwbWCP.js new file mode 100644 index 0000000..5b539fd --- /dev/null +++ b/backend/public/assets/index-42KwbWCP.js @@ -0,0 +1,162 @@ +var Ay=Object.defineProperty;var $y=(e,t,n)=>t in e?Ay(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ce=(e,t,n)=>$y(e,typeof t!="symbol"?t+"":t,n);function Fy(e,t){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function zy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Th={exports:{}},Qa={},jh={exports:{}},le={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Zi=Symbol.for("react.element"),Uy=Symbol.for("react.portal"),By=Symbol.for("react.fragment"),Wy=Symbol.for("react.strict_mode"),Hy=Symbol.for("react.profiler"),Qy=Symbol.for("react.provider"),Vy=Symbol.for("react.context"),qy=Symbol.for("react.forward_ref"),Gy=Symbol.for("react.suspense"),Yy=Symbol.for("react.memo"),Ky=Symbol.for("react.lazy"),of=Symbol.iterator;function Xy(e){return e===null||typeof e!="object"?null:(e=of&&e[of]||e["@@iterator"],typeof e=="function"?e:null)}var Ph={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ih=Object.assign,Rh={};function Ds(e,t,n){this.props=e,this.context=t,this.refs=Rh,this.updater=n||Ph}Ds.prototype.isReactComponent={};Ds.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ds.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Oh(){}Oh.prototype=Ds.prototype;function Pu(e,t,n){this.props=e,this.context=t,this.refs=Rh,this.updater=n||Ph}var Iu=Pu.prototype=new Oh;Iu.constructor=Pu;Ih(Iu,Ds.prototype);Iu.isPureReactComponent=!0;var af=Array.isArray,Dh=Object.prototype.hasOwnProperty,Ru={current:null},Lh={key:!0,ref:!0,__self:!0,__source:!0};function Mh(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)Dh.call(t,r)&&!Lh.hasOwnProperty(r)&&(s[r]=t[r]);var a=arguments.length-2;if(a===1)s.children=n;else if(1>>1,F=$[E];if(0>>1;Es(G,V))Ks(Z,G)?($[E]=Z,$[K]=V,E=K):($[E]=G,$[z]=V,E=z);else if(Ks(Z,V))$[E]=Z,$[K]=V,E=K;else break e}}return B}function s($,B){var V=$.sortIndex-B.sortIndex;return V!==0?V:$.id-B.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,f=null,p=3,w=!1,h=!1,y=!1,S=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x($){for(var B=n(c);B!==null;){if(B.callback===null)r(c);else if(B.startTime<=$)r(c),B.sortIndex=B.expirationTime,t(l,B);else break;B=n(c)}}function C($){if(y=!1,x($),!h)if(n(l)!==null)h=!0,Q(T);else{var B=n(c);B!==null&&re(C,B.startTime-$)}}function T($,B){h=!1,y&&(y=!1,v(P),P=-1),w=!0;var V=p;try{for(x(B),f=n(l);f!==null&&(!(f.expirationTime>B)||$&&!q());){var E=f.callback;if(typeof E=="function"){f.callback=null,p=f.priorityLevel;var F=E(f.expirationTime<=B);B=e.unstable_now(),typeof F=="function"?f.callback=F:f===n(l)&&r(l),x(B)}else r(l);f=n(l)}if(f!==null)var W=!0;else{var z=n(c);z!==null&&re(C,z.startTime-B),W=!1}return W}finally{f=null,p=V,w=!1}}var b=!1,_=null,P=-1,I=5,R=-1;function q(){return!(e.unstable_now()-R$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function($){switch(p){case 1:case 2:case 3:var B=3;break;default:B=p}var V=p;p=B;try{return $()}finally{p=V}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,B){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var V=p;p=$;try{return B()}finally{p=V}},e.unstable_scheduleCallback=function($,B,V){var E=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0E?($.sortIndex=V,t(c,$),n(l)===null&&$===n(c)&&(y?(v(P),P=-1):y=!0,re(C,V-E))):($.sortIndex=F,t(l,$),h||w||(h=!0,Q(T))),$},e.unstable_shouldYield=q,e.unstable_wrapCallback=function($){var B=p;return function(){var V=p;p=B;try{return $.apply(this,arguments)}finally{p=V}}}})(Uh);zh.exports=Uh;var cw=zh.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var uw=k,Qt=cw;function L(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),uc=Object.prototype.hasOwnProperty,dw=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,cf={},uf={};function fw(e){return uc.call(uf,e)?!0:uc.call(cf,e)?!1:dw.test(e)?uf[e]=!0:(cf[e]=!0,!1)}function pw(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function hw(e,t,n,r){if(t===null||typeof t>"u"||pw(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Tt(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var ut={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ut[e]=new Tt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ut[t]=new Tt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ut[e]=new Tt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ut[e]=new Tt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ut[e]=new Tt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ut[e]=new Tt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ut[e]=new Tt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ut[e]=new Tt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ut[e]=new Tt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Du=/[\-:]([a-z])/g;function Lu(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Du,Lu);ut[t]=new Tt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Du,Lu);ut[t]=new Tt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Du,Lu);ut[t]=new Tt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ut[e]=new Tt(e,1,!1,e.toLowerCase(),null,!1,!1)});ut.xlinkHref=new Tt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ut[e]=new Tt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Mu(e,t,n,r){var s=ut.hasOwnProperty(t)?ut[t]:null;(s!==null?s.type!==0:r||!(2a||s[o]!==i[a]){var l=` +`+s[o].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{Cl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ai(e):""}function mw(e){switch(e.tag){case 5:return ai(e.type);case 16:return ai("Lazy");case 13:return ai("Suspense");case 19:return ai("SuspenseList");case 0:case 2:case 15:return e=El(e.type,!1),e;case 11:return e=El(e.type.render,!1),e;case 1:return e=El(e.type,!0),e;default:return""}}function hc(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case is:return"Fragment";case ss:return"Portal";case dc:return"Profiler";case Au:return"StrictMode";case fc:return"Suspense";case pc:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Hh:return(e.displayName||"Context")+".Consumer";case Wh:return(e._context.displayName||"Context")+".Provider";case $u:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Fu:return t=e.displayName||null,t!==null?t:hc(e.type)||"Memo";case Yn:t=e._payload,e=e._init;try{return hc(e(t))}catch{}}return null}function gw(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return hc(t);case 8:return t===Au?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function dr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Vh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function vw(e){var t=Vh(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function vo(e){e._valueTracker||(e._valueTracker=vw(e))}function qh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Vh(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function sa(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function mc(e,t){var n=t.checked;return Le({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ff(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=dr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Gh(e,t){t=t.checked,t!=null&&Mu(e,"checked",t,!1)}function gc(e,t){Gh(e,t);var n=dr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?vc(e,t.type,n):t.hasOwnProperty("defaultValue")&&vc(e,t.type,dr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function pf(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function vc(e,t,n){(t!=="number"||sa(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var li=Array.isArray;function vs(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=yo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ti(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var hi={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},yw=["Webkit","ms","Moz","O"];Object.keys(hi).forEach(function(e){yw.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),hi[t]=hi[e]})});function Jh(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||hi.hasOwnProperty(e)&&hi[e]?(""+t).trim():t+"px"}function Zh(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Jh(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var ww=Le({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function xc(e,t){if(t){if(ww[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(L(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(L(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(L(61))}if(t.style!=null&&typeof t.style!="object")throw Error(L(62))}}function Sc(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var kc=null;function zu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var bc=null,ys=null,ws=null;function gf(e){if(e=no(e)){if(typeof bc!="function")throw Error(L(280));var t=e.stateNode;t&&(t=Ka(t),bc(e.stateNode,e.type,t))}}function em(e){ys?ws?ws.push(e):ws=[e]:ys=e}function tm(){if(ys){var e=ys,t=ws;if(ws=ys=null,gf(e),t)for(e=0;e>>=0,e===0?32:31-(Pw(e)/Iw|0)|0}var wo=64,xo=4194304;function ci(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function la(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~s;a!==0?r=ci(a):(i&=o,i!==0&&(r=ci(i)))}else o=n&~s,o!==0?r=ci(o):i!==0&&(r=ci(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function eo(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-mn(t),e[t]=n}function Lw(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=gi),Ef=" ",Nf=!1;function Sm(e,t){switch(e){case"keyup":return cx.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function km(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var os=!1;function dx(e,t){switch(e){case"compositionend":return km(t);case"keypress":return t.which!==32?null:(Nf=!0,Ef);case"textInput":return e=t.data,e===Ef&&Nf?null:e;default:return null}}function fx(e,t){if(os)return e==="compositionend"||!Gu&&Sm(e,t)?(e=wm(),Ho=Qu=Zn=null,os=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Pf(n)}}function Nm(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Nm(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function _m(){for(var e=window,t=sa();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=sa(e.document)}return t}function Yu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Sx(e){var t=_m(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Nm(n.ownerDocument.documentElement,n)){if(r!==null&&Yu(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=If(n,i);var o=If(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,as=null,jc=null,yi=null,Pc=!1;function Rf(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Pc||as==null||as!==sa(r)||(r=as,"selectionStart"in r&&Yu(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),yi&&Di(yi,r)||(yi=r,r=da(jc,"onSelect"),0us||(e.current=Mc[us],Mc[us]=null,us--)}function Ee(e,t){us++,Mc[us]=e.current,e.current=t}var fr={},vt=mr(fr),Mt=mr(!1),Lr=fr;function Ns(e,t){var n=e.type.contextTypes;if(!n)return fr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function At(e){return e=e.childContextTypes,e!=null}function pa(){_e(Mt),_e(vt)}function Ff(e,t,n){if(vt.current!==fr)throw Error(L(168));Ee(vt,t),Ee(Mt,n)}function Mm(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(L(108,gw(e)||"Unknown",s));return Le({},n,r)}function ha(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||fr,Lr=vt.current,Ee(vt,e),Ee(Mt,Mt.current),!0}function zf(e,t,n){var r=e.stateNode;if(!r)throw Error(L(169));n?(e=Mm(e,t,Lr),r.__reactInternalMemoizedMergedChildContext=e,_e(Mt),_e(vt),Ee(vt,e)):_e(Mt),Ee(Mt,n)}var Dn=null,Xa=!1,Fl=!1;function Am(e){Dn===null?Dn=[e]:Dn.push(e)}function Ox(e){Xa=!0,Am(e)}function gr(){if(!Fl&&Dn!==null){Fl=!0;var e=0,t=we;try{var n=Dn;for(we=1;e>=o,s-=o,Ln=1<<32-mn(t)+s|n<P?(I=_,_=null):I=_.sibling;var R=p(v,_,x[P],C);if(R===null){_===null&&(_=I);break}e&&_&&R.alternate===null&&t(v,_),g=i(R,g,P),b===null?T=R:b.sibling=R,b=R,_=I}if(P===x.length)return n(v,_),je&&br(v,P),T;if(_===null){for(;PP?(I=_,_=null):I=_.sibling;var q=p(v,_,R.value,C);if(q===null){_===null&&(_=I);break}e&&_&&q.alternate===null&&t(v,_),g=i(q,g,P),b===null?T=q:b.sibling=q,b=q,_=I}if(R.done)return n(v,_),je&&br(v,P),T;if(_===null){for(;!R.done;P++,R=x.next())R=f(v,R.value,C),R!==null&&(g=i(R,g,P),b===null?T=R:b.sibling=R,b=R);return je&&br(v,P),T}for(_=r(v,_);!R.done;P++,R=x.next())R=w(_,v,P,R.value,C),R!==null&&(e&&R.alternate!==null&&_.delete(R.key===null?P:R.key),g=i(R,g,P),b===null?T=R:b.sibling=R,b=R);return e&&_.forEach(function(se){return t(v,se)}),je&&br(v,P),T}function S(v,g,x,C){if(typeof x=="object"&&x!==null&&x.type===is&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case go:e:{for(var T=x.key,b=g;b!==null;){if(b.key===T){if(T=x.type,T===is){if(b.tag===7){n(v,b.sibling),g=s(b,x.props.children),g.return=v,v=g;break e}}else if(b.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Yn&&Wf(T)===b.type){n(v,b.sibling),g=s(b,x.props),g.ref=Xs(v,b,x),g.return=v,v=g;break e}n(v,b);break}else t(v,b);b=b.sibling}x.type===is?(g=Or(x.props.children,v.mode,C,x.key),g.return=v,v=g):(C=Jo(x.type,x.key,x.props,null,v.mode,C),C.ref=Xs(v,g,x),C.return=v,v=C)}return o(v);case ss:e:{for(b=x.key;g!==null;){if(g.key===b)if(g.tag===4&&g.stateNode.containerInfo===x.containerInfo&&g.stateNode.implementation===x.implementation){n(v,g.sibling),g=s(g,x.children||[]),g.return=v,v=g;break e}else{n(v,g);break}else t(v,g);g=g.sibling}g=ql(x,v.mode,C),g.return=v,v=g}return o(v);case Yn:return b=x._init,S(v,g,b(x._payload),C)}if(li(x))return h(v,g,x,C);if(Vs(x))return y(v,g,x,C);_o(v,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,g!==null&&g.tag===6?(n(v,g.sibling),g=s(g,x),g.return=v,v=g):(n(v,g),g=Vl(x,v.mode,C),g.return=v,v=g),o(v)):n(v,g)}return S}var Ts=Um(!0),Bm=Um(!1),va=mr(null),ya=null,ps=null,Zu=null;function ed(){Zu=ps=ya=null}function td(e){var t=va.current;_e(va),e._currentValue=t}function Fc(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Ss(e,t){ya=e,Zu=ps=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Lt=!0),e.firstContext=null)}function nn(e){var t=e._currentValue;if(Zu!==e)if(e={context:e,memoizedValue:t,next:null},ps===null){if(ya===null)throw Error(L(308));ps=e,ya.dependencies={lanes:0,firstContext:e}}else ps=ps.next=e;return t}var jr=null;function nd(e){jr===null?jr=[e]:jr.push(e)}function Wm(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,nd(t)):(n.next=s.next,s.next=n),t.interleaved=n,Un(e,r)}function Un(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Kn=!1;function rd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Hm(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function An(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function or(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,fe&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Un(e,n)}return s=r.interleaved,s===null?(t.next=t,nd(r)):(t.next=s.next,s.next=t),r.interleaved=t,Un(e,n)}function Vo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bu(e,n)}}function Hf(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function wa(e,t,n,r){var s=e.updateQueue;Kn=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?i=c:o.next=c,o=l;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=c:a.next=c,d.lastBaseUpdate=l))}if(i!==null){var f=s.baseState;o=0,d=c=l=null,a=i;do{var p=a.lane,w=a.eventTime;if((r&p)===p){d!==null&&(d=d.next={eventTime:w,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var h=e,y=a;switch(p=t,w=n,y.tag){case 1:if(h=y.payload,typeof h=="function"){f=h.call(w,f,p);break e}f=h;break e;case 3:h.flags=h.flags&-65537|128;case 0:if(h=y.payload,p=typeof h=="function"?h.call(w,f,p):h,p==null)break e;f=Le({},f,p);break e;case 2:Kn=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,p=s.effects,p===null?s.effects=[a]:p.push(a))}else w={eventTime:w,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(c=d=w,l=f):d=d.next=w,o|=p;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;p=a,a=p.next,p.next=null,s.lastBaseUpdate=p,s.shared.pending=null}}while(!0);if(d===null&&(l=f),s.baseState=l,s.firstBaseUpdate=c,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);$r|=o,e.lanes=o,e.memoizedState=f}}function Qf(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Ul.transition;Ul.transition={};try{e(!1),t()}finally{we=n,Ul.transition=r}}function ag(){return rn().memoizedState}function Ax(e,t,n){var r=lr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},lg(e))cg(t,n);else if(n=Wm(e,t,n,r),n!==null){var s=Nt();gn(n,e,r,s),ug(n,t,r)}}function $x(e,t,n){var r=lr(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(lg(e))cg(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(s.hasEagerState=!0,s.eagerState=a,yn(a,o)){var l=t.interleaved;l===null?(s.next=s,nd(t)):(s.next=l.next,l.next=s),t.interleaved=s;return}}catch{}finally{}n=Wm(e,t,s,r),n!==null&&(s=Nt(),gn(n,e,r,s),ug(n,t,r))}}function lg(e){var t=e.alternate;return e===De||t!==null&&t===De}function cg(e,t){wi=Sa=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ug(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bu(e,n)}}var ka={readContext:nn,useCallback:pt,useContext:pt,useEffect:pt,useImperativeHandle:pt,useInsertionEffect:pt,useLayoutEffect:pt,useMemo:pt,useReducer:pt,useRef:pt,useState:pt,useDebugValue:pt,useDeferredValue:pt,useTransition:pt,useMutableSource:pt,useSyncExternalStore:pt,useId:pt,unstable_isNewReconciler:!1},Fx={readContext:nn,useCallback:function(e,t){return En().memoizedState=[e,t===void 0?null:t],e},useContext:nn,useEffect:qf,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Go(4194308,4,ng.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Go(4194308,4,e,t)},useInsertionEffect:function(e,t){return Go(4,2,e,t)},useMemo:function(e,t){var n=En();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=En();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Ax.bind(null,De,e),[r.memoizedState,e]},useRef:function(e){var t=En();return e={current:e},t.memoizedState=e},useState:Vf,useDebugValue:dd,useDeferredValue:function(e){return En().memoizedState=e},useTransition:function(){var e=Vf(!1),t=e[0];return e=Mx.bind(null,e[1]),En().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=De,s=En();if(je){if(n===void 0)throw Error(L(407));n=n()}else{if(n=t(),it===null)throw Error(L(349));Ar&30||Gm(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,qf(Km.bind(null,r,i,e),[e]),r.flags|=2048,Bi(9,Ym.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=En(),t=it.identifierPrefix;if(je){var n=Mn,r=Ln;n=(r&~(1<<32-mn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=zi++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Nn]=t,e[Ai]=r,xg(e,t,!1,!1),t.stateNode=e;e:{switch(o=Sc(n,r),n){case"dialog":Ne("cancel",e),Ne("close",e),s=r;break;case"iframe":case"object":case"embed":Ne("load",e),s=r;break;case"video":case"audio":for(s=0;sIs&&(t.flags|=128,r=!0,Js(i,!1),t.lanes=4194304)}else{if(!r)if(e=xa(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Js(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!je)return ht(t),null}else 2*ze()-i.renderingStartTime>Is&&n!==1073741824&&(t.flags|=128,r=!0,Js(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ze(),t.sibling=null,n=Oe.current,Ee(Oe,r?n&1|2:n&1),t):(ht(t),null);case 22:case 23:return vd(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Bt&1073741824&&(ht(t),t.subtreeFlags&6&&(t.flags|=8192)):ht(t),null;case 24:return null;case 25:return null}throw Error(L(156,t.tag))}function qx(e,t){switch(Xu(t),t.tag){case 1:return At(t.type)&&pa(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return js(),_e(Mt),_e(vt),od(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return id(t),null;case 13:if(_e(Oe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(L(340));_s()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _e(Oe),null;case 4:return js(),null;case 10:return td(t.type._context),null;case 22:case 23:return vd(),null;case 24:return null;default:return null}}var jo=!1,mt=!1,Gx=typeof WeakSet=="function"?WeakSet:Set,H=null;function hs(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Me(e,t,r)}else n.current=null}function Gc(e,t,n){try{n()}catch(r){Me(e,t,r)}}var sp=!1;function Yx(e,t){if(Ic=ca,e=_m(),Yu(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,c=0,d=0,f=e,p=null;t:for(;;){for(var w;f!==n||s!==0&&f.nodeType!==3||(a=o+s),f!==i||r!==0&&f.nodeType!==3||(l=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(w=f.firstChild)!==null;)p=f,f=w;for(;;){if(f===e)break t;if(p===n&&++c===s&&(a=o),p===i&&++d===r&&(l=o),(w=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=w}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Rc={focusedElem:e,selectionRange:n},ca=!1,H=t;H!==null;)if(t=H,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,H=e;else for(;H!==null;){t=H;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var y=h.memoizedProps,S=h.memoizedState,v=t.stateNode,g=v.getSnapshotBeforeUpdate(t.elementType===t.type?y:cn(t.type,y),S);v.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(L(163))}}catch(C){Me(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,H=e;break}H=t.return}return h=sp,sp=!1,h}function xi(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&Gc(t,n,i)}s=s.next}while(s!==r)}}function el(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Yc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function bg(e){var t=e.alternate;t!==null&&(e.alternate=null,bg(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Nn],delete t[Ai],delete t[Lc],delete t[Ix],delete t[Rx])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Cg(e){return e.tag===5||e.tag===3||e.tag===4}function ip(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Cg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Kc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=fa));else if(r!==4&&(e=e.child,e!==null))for(Kc(e,t,n),e=e.sibling;e!==null;)Kc(e,t,n),e=e.sibling}function Xc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Xc(e,t,n),e=e.sibling;e!==null;)Xc(e,t,n),e=e.sibling}var lt=null,un=!1;function qn(e,t,n){for(n=n.child;n!==null;)Eg(e,t,n),n=n.sibling}function Eg(e,t,n){if(jn&&typeof jn.onCommitFiberUnmount=="function")try{jn.onCommitFiberUnmount(Va,n)}catch{}switch(n.tag){case 5:mt||hs(n,t);case 6:var r=lt,s=un;lt=null,qn(e,t,n),lt=r,un=s,lt!==null&&(un?(e=lt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):lt.removeChild(n.stateNode));break;case 18:lt!==null&&(un?(e=lt,n=n.stateNode,e.nodeType===8?$l(e.parentNode,n):e.nodeType===1&&$l(e,n),Ri(e)):$l(lt,n.stateNode));break;case 4:r=lt,s=un,lt=n.stateNode.containerInfo,un=!0,qn(e,t,n),lt=r,un=s;break;case 0:case 11:case 14:case 15:if(!mt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Gc(n,t,o),s=s.next}while(s!==r)}qn(e,t,n);break;case 1:if(!mt&&(hs(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Me(n,t,a)}qn(e,t,n);break;case 21:qn(e,t,n);break;case 22:n.mode&1?(mt=(r=mt)||n.memoizedState!==null,qn(e,t,n),mt=r):qn(e,t,n);break;default:qn(e,t,n)}}function op(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Gx),t.forEach(function(r){var s=s0.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function ln(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=o),r&=~i}if(r=s,r=ze()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Xx(r/1960))-r,10e?16:e,er===null)var r=!1;else{if(e=er,er=null,Ea=0,fe&6)throw Error(L(331));var s=fe;for(fe|=4,H=e.current;H!==null;){var i=H,o=i.child;if(H.flags&16){var a=i.deletions;if(a!==null){for(var l=0;lze()-md?Rr(e,0):hd|=n),$t(e,t)}function Og(e,t){t===0&&(e.mode&1?(t=xo,xo<<=1,!(xo&130023424)&&(xo=4194304)):t=1);var n=Nt();e=Un(e,t),e!==null&&(eo(e,t,n),$t(e,n))}function r0(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Og(e,n)}function s0(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(L(314))}r!==null&&r.delete(t),Og(e,n)}var Dg;Dg=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Mt.current)Lt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Lt=!1,Qx(e,t,n);Lt=!!(e.flags&131072)}else Lt=!1,je&&t.flags&1048576&&$m(t,ga,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Yo(e,t),e=t.pendingProps;var s=Ns(t,vt.current);Ss(t,n),s=ld(null,t,r,e,s,n);var i=cd();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,At(r)?(i=!0,ha(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,rd(t),s.updater=Za,t.stateNode=s,s._reactInternals=t,Uc(t,r,e,n),t=Hc(null,t,r,!0,i,n)):(t.tag=0,je&&i&&Ku(t),bt(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Yo(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=o0(r),e=cn(r,e),s){case 0:t=Wc(null,t,r,e,n);break e;case 1:t=tp(null,t,r,e,n);break e;case 11:t=Zf(null,t,r,e,n);break e;case 14:t=ep(null,t,r,cn(r.type,e),n);break e}throw Error(L(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:cn(r,s),Wc(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:cn(r,s),tp(e,t,r,s,n);case 3:e:{if(vg(t),e===null)throw Error(L(387));r=t.pendingProps,i=t.memoizedState,s=i.element,Hm(e,t),wa(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=Ps(Error(L(423)),t),t=np(e,t,r,n,s);break e}else if(r!==s){s=Ps(Error(L(424)),t),t=np(e,t,r,n,s);break e}else for(Wt=ir(t.stateNode.containerInfo.firstChild),Ht=t,je=!0,dn=null,n=Bm(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(_s(),r===s){t=Bn(e,t,n);break e}bt(e,t,r,n)}t=t.child}return t;case 5:return Qm(t),e===null&&$c(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,Oc(r,s)?o=null:i!==null&&Oc(r,i)&&(t.flags|=32),gg(e,t),bt(e,t,o,n),t.child;case 6:return e===null&&$c(t),null;case 13:return yg(e,t,n);case 4:return sd(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ts(t,null,r,n):bt(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:cn(r,s),Zf(e,t,r,s,n);case 7:return bt(e,t,t.pendingProps,n),t.child;case 8:return bt(e,t,t.pendingProps.children,n),t.child;case 12:return bt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,Ee(va,r._currentValue),r._currentValue=o,i!==null)if(yn(i.value,o)){if(i.children===s.children&&!Mt.current){t=Bn(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=An(-1,n&-n),l.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?l.next=l:(l.next=d.next,d.next=l),c.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Fc(i.return,n,t),a.lanes|=n;break}l=l.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(L(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Fc(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}bt(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Ss(t,n),s=nn(s),r=r(s),t.flags|=1,bt(e,t,r,n),t.child;case 14:return r=t.type,s=cn(r,t.pendingProps),s=cn(r.type,s),ep(e,t,r,s,n);case 15:return hg(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:cn(r,s),Yo(e,t),t.tag=1,At(r)?(e=!0,ha(t)):e=!1,Ss(t,n),dg(t,r,s),Uc(t,r,s,n),Hc(null,t,r,!0,e,n);case 19:return wg(e,t,n);case 22:return mg(e,t,n)}throw Error(L(156,t.tag))};function Lg(e,t){return lm(e,t)}function i0(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function en(e,t,n,r){return new i0(e,t,n,r)}function wd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function o0(e){if(typeof e=="function")return wd(e)?1:0;if(e!=null){if(e=e.$$typeof,e===$u)return 11;if(e===Fu)return 14}return 2}function cr(e,t){var n=e.alternate;return n===null?(n=en(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Jo(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")wd(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case is:return Or(n.children,s,i,t);case Au:o=8,s|=8;break;case dc:return e=en(12,n,t,s|2),e.elementType=dc,e.lanes=i,e;case fc:return e=en(13,n,t,s),e.elementType=fc,e.lanes=i,e;case pc:return e=en(19,n,t,s),e.elementType=pc,e.lanes=i,e;case Qh:return nl(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Wh:o=10;break e;case Hh:o=9;break e;case $u:o=11;break e;case Fu:o=14;break e;case Yn:o=16,r=null;break e}throw Error(L(130,e==null?e:typeof e,""))}return t=en(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Or(e,t,n,r){return e=en(7,e,r,t),e.lanes=n,e}function nl(e,t,n,r){return e=en(22,e,r,t),e.elementType=Qh,e.lanes=n,e.stateNode={isHidden:!1},e}function Vl(e,t,n){return e=en(6,e,null,t),e.lanes=n,e}function ql(e,t,n){return t=en(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function a0(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=_l(0),this.expirationTimes=_l(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_l(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function xd(e,t,n,r,s,i,o,a,l){return e=new a0(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=en(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},rd(i),e}function l0(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Fg)}catch(e){console.error(e)}}Fg(),Fh.exports=qt;var p0=Fh.exports,hp=p0;cc.createRoot=hp.createRoot,cc.hydrateRoot=hp.hydrateRoot;/** + * @remix-run/router v1.23.0 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Hi(){return Hi=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function zg(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function m0(){return Math.random().toString(36).substr(2,8)}function gp(e,t){return{usr:e.state,key:e.key,idx:t}}function nu(e,t,n,r){return n===void 0&&(n=null),Hi({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?As(t):t,{state:n,key:t&&t.key||r||m0()})}function Ta(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function As(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function g0(e,t,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,a=tr.Pop,l=null,c=d();c==null&&(c=0,o.replaceState(Hi({},o.state,{idx:c}),""));function d(){return(o.state||{idx:null}).idx}function f(){a=tr.Pop;let S=d(),v=S==null?null:S-c;c=S,l&&l({action:a,location:y.location,delta:v})}function p(S,v){a=tr.Push;let g=nu(y.location,S,v);c=d()+1;let x=gp(g,c),C=y.createHref(g);try{o.pushState(x,"",C)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;s.location.assign(C)}i&&l&&l({action:a,location:y.location,delta:1})}function w(S,v){a=tr.Replace;let g=nu(y.location,S,v);c=d();let x=gp(g,c),C=y.createHref(g);o.replaceState(x,"",C),i&&l&&l({action:a,location:y.location,delta:0})}function h(S){let v=s.location.origin!=="null"?s.location.origin:s.location.href,g=typeof S=="string"?S:Ta(S);return g=g.replace(/ $/,"%20"),Ue(v,"No window.location.(origin|href) available to create URL for href: "+g),new URL(g,v)}let y={get action(){return a},get location(){return e(s,o)},listen(S){if(l)throw new Error("A history only accepts one active listener");return s.addEventListener(mp,f),l=S,()=>{s.removeEventListener(mp,f),l=null}},createHref(S){return t(s,S)},createURL:h,encodeLocation(S){let v=h(S);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:p,replace:w,go(S){return o.go(S)}};return y}var vp;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(vp||(vp={}));function v0(e,t,n){return n===void 0&&(n="/"),y0(e,t,n)}function y0(e,t,n,r){let s=typeof t=="string"?As(t):t,i=Cd(s.pathname||"/",n);if(i==null)return null;let o=Ug(e);w0(o);let a=null;for(let l=0;a==null&&l{let l={relativePath:a===void 0?i.path||"":a,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};l.relativePath.startsWith("/")&&(Ue(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let c=ur([r,l.relativePath]),d=n.concat(l);i.children&&i.children.length>0&&(Ue(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),Ug(i.children,t,d,c)),!(i.path==null&&!i.index)&&t.push({path:c,score:N0(c,i.index),routesMeta:d})};return e.forEach((i,o)=>{var a;if(i.path===""||!((a=i.path)!=null&&a.includes("?")))s(i,o);else for(let l of Bg(i.path))s(i,o,l)}),t}function Bg(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=Bg(r.join("/")),a=[];return a.push(...o.map(l=>l===""?i:[i,l].join("/"))),s&&a.push(...o),a.map(l=>e.startsWith("/")&&l===""?"/":l)}function w0(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:_0(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const x0=/^:[\w-]+$/,S0=3,k0=2,b0=1,C0=10,E0=-2,yp=e=>e==="*";function N0(e,t){let n=e.split("/"),r=n.length;return n.some(yp)&&(r+=E0),t&&(r+=k0),n.filter(s=>!yp(s)).reduce((s,i)=>s+(x0.test(i)?S0:i===""?b0:C0),r)}function _0(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function T0(e,t,n){let{routesMeta:r}=e,s={},i="/",o=[];for(let a=0;a{let{paramName:p,isOptional:w}=d;if(p==="*"){let y=a[f]||"";o=i.slice(0,i.length-y.length).replace(/(.)\/+$/,"$1")}const h=a[f];return w&&!h?c[p]=void 0:c[p]=(h||"").replace(/%2F/g,"/"),c},{}),pathname:i,pathnameBase:o,pattern:e}}function P0(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),zg(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function I0(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return zg(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Cd(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function R0(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?As(e):e;return{pathname:n?n.startsWith("/")?n:O0(n,t):t,search:M0(r),hash:A0(s)}}function O0(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Gl(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function D0(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Ed(e,t){let n=D0(e);return t?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Nd(e,t,n,r){r===void 0&&(r=!1);let s;typeof e=="string"?s=As(e):(s=Hi({},e),Ue(!s.pathname||!s.pathname.includes("?"),Gl("?","pathname","search",s)),Ue(!s.pathname||!s.pathname.includes("#"),Gl("#","pathname","hash",s)),Ue(!s.search||!s.search.includes("#"),Gl("#","search","hash",s)));let i=e===""||s.pathname==="",o=i?"/":s.pathname,a;if(o==null)a=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),f-=1;s.pathname=p.join("/")}a=f>=0?t[f]:"/"}let l=R0(s,a),c=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||d)&&(l.pathname+="/"),l}const ur=e=>e.join("/").replace(/\/\/+/g,"/"),L0=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),M0=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,A0=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function $0(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Wg=["post","put","patch","delete"];new Set(Wg);const F0=["get",...Wg];new Set(F0);/** + * React Router v6.30.1 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Qi(){return Qi=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),k.useCallback(function(c,d){if(d===void 0&&(d={}),!a.current)return;if(typeof c=="number"){r.go(c);return}let f=Nd(c,JSON.parse(o),i,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:ur([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,o,i,e])}function Vg(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=k.useContext(vr),{matches:s}=k.useContext(yr),{pathname:i}=Fs(),o=JSON.stringify(Ed(s,r.v7_relativeSplatPath));return k.useMemo(()=>Nd(e,JSON.parse(o),i,n==="path"),[e,o,i,n])}function W0(e,t){return H0(e,t)}function H0(e,t,n,r){$s()||Ue(!1);let{navigator:s}=k.useContext(vr),{matches:i}=k.useContext(yr),o=i[i.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let c=Fs(),d;if(t){var f;let S=typeof t=="string"?As(t):t;l==="/"||(f=S.pathname)!=null&&f.startsWith(l)||Ue(!1),d=S}else d=c;let p=d.pathname||"/",w=p;if(l!=="/"){let S=l.replace(/^\//,"").split("/");w="/"+p.replace(/^\//,"").split("/").slice(S.length).join("/")}let h=v0(e,{pathname:w}),y=Y0(h&&h.map(S=>Object.assign({},S,{params:Object.assign({},a,S.params),pathname:ur([l,s.encodeLocation?s.encodeLocation(S.pathname).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?l:ur([l,s.encodeLocation?s.encodeLocation(S.pathnameBase).pathname:S.pathnameBase])})),i,n,r);return t&&y?k.createElement(al.Provider,{value:{location:Qi({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:tr.Pop}},y):y}function Q0(){let e=Z0(),t=$0(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return k.createElement(k.Fragment,null,k.createElement("h2",null,"Unexpected Application Error!"),k.createElement("h3",{style:{fontStyle:"italic"}},t),n?k.createElement("pre",{style:s},n):null,null)}const V0=k.createElement(Q0,null);class q0 extends k.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?k.createElement(yr.Provider,{value:this.props.routeContext},k.createElement(Hg.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function G0(e){let{routeContext:t,match:n,children:r}=e,s=k.useContext(_d);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),k.createElement(yr.Provider,{value:t},r)}function Y0(e,t,n,r){var s;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,a=(s=n)==null?void 0:s.errors;if(a!=null){let d=o.findIndex(f=>f.route.id&&(a==null?void 0:a[f.route.id])!==void 0);d>=0||Ue(!1),o=o.slice(0,Math.min(o.length,d+1))}let l=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((d,f,p)=>{let w,h=!1,y=null,S=null;n&&(w=a&&f.route.id?a[f.route.id]:void 0,y=f.route.errorElement||V0,l&&(c<0&&p===0?(tS("route-fallback"),h=!0,S=null):c===p&&(h=!0,S=f.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,p+1)),g=()=>{let x;return w?x=y:h?x=S:f.route.Component?x=k.createElement(f.route.Component,null):f.route.element?x=f.route.element:x=d,k.createElement(G0,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:n!=null},children:x})};return n&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?k.createElement(q0,{location:n.location,revalidation:n.revalidation,component:y,error:w,children:g(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):g()},null)}var qg=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(qg||{}),Gg=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(Gg||{});function K0(e){let t=k.useContext(_d);return t||Ue(!1),t}function X0(e){let t=k.useContext(z0);return t||Ue(!1),t}function J0(e){let t=k.useContext(yr);return t||Ue(!1),t}function Yg(e){let t=J0(),n=t.matches[t.matches.length-1];return n.route.id||Ue(!1),n.route.id}function Z0(){var e;let t=k.useContext(Hg),n=X0(),r=Yg();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function eS(){let{router:e}=K0(qg.UseNavigateStable),t=Yg(Gg.UseNavigateStable),n=k.useRef(!1);return Qg(()=>{n.current=!0}),k.useCallback(function(s,i){i===void 0&&(i={}),n.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,Qi({fromRouteId:t},i)))},[e,t])}const wp={};function tS(e,t,n){wp[e]||(wp[e]=!0)}function nS(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Kg(e){let{to:t,replace:n,state:r,relative:s}=e;$s()||Ue(!1);let{future:i,static:o}=k.useContext(vr),{matches:a}=k.useContext(yr),{pathname:l}=Fs(),c=wr(),d=Nd(t,Ed(a,i.v7_relativeSplatPath),l,s==="path"),f=JSON.stringify(d);return k.useEffect(()=>c(JSON.parse(f),{replace:n,state:r,relative:s}),[c,f,s,n,r]),null}function Er(e){Ue(!1)}function rS(e){let{basename:t="/",children:n=null,location:r,navigationType:s=tr.Pop,navigator:i,static:o=!1,future:a}=e;$s()&&Ue(!1);let l=t.replace(/^\/*/,"/"),c=k.useMemo(()=>({basename:l,navigator:i,static:o,future:Qi({v7_relativeSplatPath:!1},a)}),[l,a,i,o]);typeof r=="string"&&(r=As(r));let{pathname:d="/",search:f="",hash:p="",state:w=null,key:h="default"}=r,y=k.useMemo(()=>{let S=Cd(d,l);return S==null?null:{location:{pathname:S,search:f,hash:p,state:w,key:h},navigationType:s}},[l,d,f,p,w,h,s]);return y==null?null:k.createElement(vr.Provider,{value:c},k.createElement(al.Provider,{children:n,value:y}))}function sS(e){let{children:t,location:n}=e;return W0(ru(t),n)}new Promise(()=>{});function ru(e,t){t===void 0&&(t=[]);let n=[];return k.Children.forEach(e,(r,s)=>{if(!k.isValidElement(r))return;let i=[...t,s];if(r.type===k.Fragment){n.push.apply(n,ru(r.props.children,i));return}r.type!==Er&&Ue(!1),!r.props.index||!r.props.children||Ue(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=ru(r.props.children,i)),n.push(o)}),n}/** + * React Router DOM v6.30.1 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function su(){return su=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[s]=e[s]);return n}function oS(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function aS(e,t){return e.button===0&&(!t||t==="_self")&&!oS(e)}function iu(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function lS(e,t){let n=iu(e);return t&&t.forEach((r,s)=>{n.has(s)||t.getAll(s).forEach(i=>{n.append(s,i)})}),n}const cS=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],uS="6";try{window.__reactRouterVersion=uS}catch{}const dS="startTransition",xp=nw[dS];function fS(e){let{basename:t,children:n,future:r,window:s}=e,i=k.useRef();i.current==null&&(i.current=h0({window:s,v5Compat:!0}));let o=i.current,[a,l]=k.useState({action:o.action,location:o.location}),{v7_startTransition:c}=r||{},d=k.useCallback(f=>{c&&xp?xp(()=>l(f)):l(f)},[l,c]);return k.useLayoutEffect(()=>o.listen(d),[o,d]),k.useEffect(()=>nS(r),[r]),k.createElement(rS,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:o,future:r})}const pS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",hS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Xg=k.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:i,replace:o,state:a,target:l,to:c,preventScrollReset:d,viewTransition:f}=t,p=iS(t,cS),{basename:w}=k.useContext(vr),h,y=!1;if(typeof c=="string"&&hS.test(c)&&(h=c,pS))try{let x=new URL(window.location.href),C=c.startsWith("//")?new URL(x.protocol+c):new URL(c),T=Cd(C.pathname,w);C.origin===x.origin&&T!=null?c=T+C.search+C.hash:y=!0}catch{}let S=U0(c,{relative:s}),v=mS(c,{replace:o,state:a,target:l,preventScrollReset:d,relative:s,viewTransition:f});function g(x){r&&r(x),x.defaultPrevented||v(x)}return k.createElement("a",su({},p,{href:h||S,onClick:y||i?r:g,ref:n,target:l}))});var Sp;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Sp||(Sp={}));var kp;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(kp||(kp={}));function mS(e,t){let{target:n,replace:r,state:s,preventScrollReset:i,relative:o,viewTransition:a}=t===void 0?{}:t,l=wr(),c=Fs(),d=Vg(e,{relative:o});return k.useCallback(f=>{if(aS(f,n)){f.preventDefault();let p=r!==void 0?r:Ta(c)===Ta(d);l(e,{replace:p,state:s,preventScrollReset:i,relative:o,viewTransition:a})}},[c,l,d,r,s,n,e,i,o,a])}function gS(e){let t=k.useRef(iu(e)),n=k.useRef(!1),r=Fs(),s=k.useMemo(()=>lS(r.search,n.current?null:t.current),[r.search]),i=wr(),o=k.useCallback((a,l)=>{const c=iu(typeof a=="function"?a(s):a);n.current=!0,i("?"+c,l)},[i,s]);return[s,o]}var Jg={exports:{}},Zg={};/** + * @license React + * use-sync-external-store-with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var so=k;function vS(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var yS=typeof Object.is=="function"?Object.is:vS,wS=so.useSyncExternalStore,xS=so.useRef,SS=so.useEffect,kS=so.useMemo,bS=so.useDebugValue;Zg.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=xS(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=kS(function(){function l(w){if(!c){if(c=!0,d=w,w=r(w),s!==void 0&&o.hasValue){var h=o.value;if(s(h,w))return f=h}return f=w}if(h=f,yS(d,w))return h;var y=r(w);return s!==void 0&&s(h,y)?(d=w,h):(d=w,f=y)}var c=!1,d,f,p=n===void 0?null:n;return[function(){return l(t())},p===null?void 0:function(){return l(p())}]},[t,n,r,s]);var a=wS(e,i[0],i[1]);return SS(function(){o.hasValue=!0,o.value=a},[a]),bS(a),a};Jg.exports=Zg;var CS=Jg.exports;function ES(e){e()}function NS(){let e=null,t=null;return{clear(){e=null,t=null},notify(){ES(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const s=t={callback:n,next:null,prev:t};return s.prev?s.prev.next=s:e=s,function(){!r||e===null||(r=!1,s.next?s.next.prev=s.prev:t=s.prev,s.prev?s.prev.next=s.next:e=s.next)}}}}var bp={notify(){},get:()=>[]};function _S(e,t){let n,r=bp,s=0,i=!1;function o(y){d();const S=r.subscribe(y);let v=!1;return()=>{v||(v=!0,S(),f())}}function a(){r.notify()}function l(){h.onStateChange&&h.onStateChange()}function c(){return i}function d(){s++,n||(n=e.subscribe(l),r=NS())}function f(){s--,n&&s===0&&(n(),n=void 0,r.clear(),r=bp)}function p(){i||(i=!0,d())}function w(){i&&(i=!1,f())}const h={addNestedSub:o,notifyNestedSubs:a,handleChangeWrapper:l,isSubscribed:c,trySubscribe:p,tryUnsubscribe:w,getListeners:()=>r};return h}var TS=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",jS=TS(),PS=()=>typeof navigator<"u"&&navigator.product==="ReactNative",IS=PS(),RS=()=>jS||IS?k.useLayoutEffect:k.useEffect,OS=RS(),Yl=Symbol.for("react-redux-context"),Kl=typeof globalThis<"u"?globalThis:{};function DS(){if(!k.createContext)return{};const e=Kl[Yl]??(Kl[Yl]=new Map);let t=e.get(k.createContext);return t||(t=k.createContext(null),e.set(k.createContext,t)),t}var pr=DS();function LS(e){const{children:t,context:n,serverState:r,store:s}=e,i=k.useMemo(()=>{const l=_S(s);return{store:s,subscription:l,getServerState:r?()=>r:void 0}},[s,r]),o=k.useMemo(()=>s.getState(),[s]);OS(()=>{const{subscription:l}=i;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),o!==s.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[i,o]);const a=n||pr;return k.createElement(a.Provider,{value:i},t)}var MS=LS;function Td(e=pr){return function(){return k.useContext(e)}}var ev=Td();function tv(e=pr){const t=e===pr?ev:Td(e),n=()=>{const{store:r}=t();return r};return Object.assign(n,{withTypes:()=>n}),n}var AS=tv();function $S(e=pr){const t=e===pr?AS:tv(e),n=()=>t().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var FS=$S(),zS=(e,t)=>e===t;function US(e=pr){const t=e===pr?ev:Td(e),n=(r,s={})=>{const{equalityFn:i=zS}=typeof s=="function"?{equalityFn:s}:s,o=t(),{store:a,subscription:l,getServerState:c}=o;k.useRef(!0);const d=k.useCallback({[r.name](p){return r(p)}}[r.name],[r]),f=CS.useSyncExternalStoreWithSelector(l.addNestedSub,a.getState,c||a.getState,d,i);return k.useDebugValue(f),f};return Object.assign(n,{withTypes:()=>n}),n}var BS=US();function at(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 WS=typeof Symbol=="function"&&Symbol.observable||"@@observable",Cp=WS,Xl=()=>Math.random().toString(36).substring(7).split("").join("."),HS={INIT:`@@redux/INIT${Xl()}`,REPLACE:`@@redux/REPLACE${Xl()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Xl()}`},ja=HS;function jd(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 nv(e,t,n){if(typeof e!="function")throw new Error(at(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(at(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(at(1));return n(nv)(e,t)}let r=e,s=t,i=new Map,o=i,a=0,l=!1;function c(){o===i&&(o=new Map,i.forEach((S,v)=>{o.set(v,S)}))}function d(){if(l)throw new Error(at(3));return s}function f(S){if(typeof S!="function")throw new Error(at(4));if(l)throw new Error(at(5));let v=!0;c();const g=a++;return o.set(g,S),function(){if(v){if(l)throw new Error(at(6));v=!1,c(),o.delete(g),i=null}}}function p(S){if(!jd(S))throw new Error(at(7));if(typeof S.type>"u")throw new Error(at(8));if(typeof S.type!="string")throw new Error(at(17));if(l)throw new Error(at(9));try{l=!0,s=r(s,S)}finally{l=!1}return(i=o).forEach(g=>{g()}),S}function w(S){if(typeof S!="function")throw new Error(at(10));r=S,p({type:ja.REPLACE})}function h(){const S=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(at(11));function g(){const C=v;C.next&&C.next(d())}return g(),{unsubscribe:S(g)}},[Cp](){return this}}}return p({type:ja.INIT}),{dispatch:p,subscribe:f,getState:d,replaceReducer:w,[Cp]:h}}function QS(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:ja.INIT})>"u")throw new Error(at(12));if(typeof n(void 0,{type:ja.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(at(13))})}function VS(e){const t=Object.keys(e),n={};for(let i=0;i"u")throw a&&a.type,new Error(at(14));c[f]=h,l=l||h!==w}return l=l||r.length!==Object.keys(o).length,l?c:o}}function Pa(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function qS(...e){return t=>(n,r)=>{const s=t(n,r);let i=()=>{throw new Error(at(15))};const o={getState:s.getState,dispatch:(l,...c)=>i(l,...c)},a=e.map(l=>l(o));return i=Pa(...a)(s.dispatch),{...s,dispatch:i}}}function GS(e){return jd(e)&&"type"in e&&typeof e.type=="string"}var rv=Symbol.for("immer-nothing"),Ep=Symbol.for("immer-draftable"),Vt=Symbol.for("immer-state");function hn(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Vi=Object.getPrototypeOf;function zr(e){return!!e&&!!e[Vt]}function Wn(e){var t;return e?sv(e)||Array.isArray(e)||!!e[Ep]||!!((t=e.constructor)!=null&&t[Ep])||io(e)||cl(e):!1}var YS=Object.prototype.constructor.toString(),Np=new WeakMap;function sv(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=Np.get(n);return r===void 0&&(r=Function.toString.call(n),Np.set(n,r)),r===YS}function Ia(e,t,n=!0){ll(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(s=>{t(s,e[s],e)}):e.forEach((r,s)=>t(s,r,e))}function ll(e){const t=e[Vt];return t?t.type_:Array.isArray(e)?1:io(e)?2:cl(e)?3:0}function ou(e,t){return ll(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function iv(e,t,n){const r=ll(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function KS(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function io(e){return e instanceof Map}function cl(e){return e instanceof Set}function Nr(e){return e.copy_||e.base_}function au(e,t){if(io(e))return new Map(e);if(cl(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=sv(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Vt];let s=Reflect.ownKeys(r);for(let i=0;i1&&Object.defineProperties(e,{set:Ro,add:Ro,clear:Ro,delete:Ro}),Object.freeze(e),t&&Object.values(e).forEach(n=>Pd(n,!0))),e}function XS(){hn(2)}var Ro={value:XS};function ul(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var JS={};function Ur(e){const t=JS[e];return t||hn(0,e),t}var qi;function ov(){return qi}function ZS(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function _p(e,t){t&&(Ur("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function lu(e){cu(e),e.drafts_.forEach(e1),e.drafts_=null}function cu(e){e===qi&&(qi=e.parent_)}function Tp(e){return qi=ZS(qi,e)}function e1(e){const t=e[Vt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function jp(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Vt].modified_&&(lu(t),hn(4)),Wn(e)&&(e=Ra(t,e),t.parent_||Oa(t,e)),t.patches_&&Ur("Patches").generateReplacementPatches_(n[Vt].base_,e,t.patches_,t.inversePatches_)):e=Ra(t,n,[]),lu(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==rv?e:void 0}function Ra(e,t,n){if(ul(t))return t;const r=e.immer_.shouldUseStrictIteration(),s=t[Vt];if(!s)return Ia(t,(i,o)=>Pp(e,s,t,i,o,n),r),t;if(s.scope_!==e)return t;if(!s.modified_)return Oa(e,s.base_,!0),s.base_;if(!s.finalized_){s.finalized_=!0,s.scope_.unfinalizedDrafts_--;const i=s.copy_;let o=i,a=!1;s.type_===3&&(o=new Set(i),i.clear(),a=!0),Ia(o,(l,c)=>Pp(e,s,i,l,c,n,a),r),Oa(e,i,!1),n&&e.patches_&&Ur("Patches").generatePatches_(s,n,e.patches_,e.inversePatches_)}return s.copy_}function Pp(e,t,n,r,s,i,o){if(s==null||typeof s!="object"&&!o)return;const a=ul(s);if(!(a&&!o)){if(zr(s)){const l=i&&t&&t.type_!==3&&!ou(t.assigned_,r)?i.concat(r):void 0,c=Ra(e,s,l);if(iv(n,r,c),zr(c))e.canAutoFreeze_=!1;else return}else o&&n.add(s);if(Wn(s)&&!a){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===s&&a)return;Ra(e,s),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(io(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&Oa(e,s)}}}function Oa(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Pd(t,n)}function t1(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:ov(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=r,i=Id;n&&(s=[r],i=Gi);const{revoke:o,proxy:a}=Proxy.revocable(s,i);return r.draft_=a,r.revoke_=o,a}var Id={get(e,t){if(t===Vt)return e;const n=Nr(e);if(!ou(n,t))return n1(e,n,t);const r=n[t];return e.finalized_||!Wn(r)?r:r===Jl(e.base_,t)?(Zl(e),e.copy_[t]=du(r,e)):r},has(e,t){return t in Nr(e)},ownKeys(e){return Reflect.ownKeys(Nr(e))},set(e,t,n){const r=av(Nr(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const s=Jl(Nr(e),t),i=s==null?void 0:s[Vt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(KS(n,s)&&(n!==void 0||ou(e.base_,t)))return!0;Zl(e),uu(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 Jl(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Zl(e),uu(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Nr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){hn(11)},getPrototypeOf(e){return Vi(e.base_)},setPrototypeOf(){hn(12)}},Gi={};Ia(Id,(e,t)=>{Gi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Gi.deleteProperty=function(e,t){return Gi.set.call(this,e,t,void 0)};Gi.set=function(e,t,n){return Id.set.call(this,e[0],t,n,e[0])};function Jl(e,t){const n=e[Vt];return(n?Nr(n):e)[t]}function n1(e,t,n){var s;const r=av(t,n);return r?"value"in r?r.value:(s=r.get)==null?void 0:s.call(e.draft_):void 0}function av(e,t){if(!(t in e))return;let n=Vi(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Vi(n)}}function uu(e){e.modified_||(e.modified_=!0,e.parent_&&uu(e.parent_))}function Zl(e){e.copy_||(e.copy_=au(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var r1=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const o=this;return function(l=i,...c){return o.produce(l,d=>n.call(this,d,...c))}}typeof n!="function"&&hn(6),r!==void 0&&typeof r!="function"&&hn(7);let s;if(Wn(t)){const i=Tp(this),o=du(t,void 0);let a=!0;try{s=n(o),a=!1}finally{a?lu(i):cu(i)}return _p(i,r),jp(s,i)}else if(!t||typeof t!="object"){if(s=n(t),s===void 0&&(s=t),s===rv&&(s=void 0),this.autoFreeze_&&Pd(s,!0),r){const i=[],o=[];Ur("Patches").generateReplacementPatches_(t,s,i,o),r(i,o)}return s}else hn(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(o,...a)=>this.produceWithPatches(o,l=>t(l,...a));let r,s;return[this.produce(t,n,(o,a)=>{r=o,s=a}),r,s]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Wn(e)||hn(8),zr(e)&&(e=s1(e));const t=Tp(this),n=du(e,void 0);return n[Vt].isManual_=!0,cu(t),n}finishDraft(e,t){const n=e&&e[Vt];(!n||!n.isManual_)&&hn(9);const{scope_:r}=n;return _p(r,t),jp(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const s=t[n];if(s.path.length===0&&s.op==="replace"){e=s.value;break}}n>-1&&(t=t.slice(n+1));const r=Ur("Patches").applyPatches_;return zr(e)?r(e,t):this.produce(e,s=>r(s,t))}};function du(e,t){const n=io(e)?Ur("MapSet").proxyMap_(e,t):cl(e)?Ur("MapSet").proxySet_(e,t):t1(e,t);return(t?t.scope_:ov()).drafts_.push(n),n}function s1(e){return zr(e)||hn(10,e),lv(e)}function lv(e){if(!Wn(e)||ul(e))return e;const t=e[Vt];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=au(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=au(e,!0);return Ia(n,(s,i)=>{iv(n,s,lv(i))},r),t&&(t.finalized_=!1),n}var i1=new r1,cv=i1.produce;function uv(e){return({dispatch:n,getState:r})=>s=>i=>typeof i=="function"?i(n,r,e):s(i)}var o1=uv(),a1=uv,l1=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Pa:Pa.apply(null,arguments)};function Ip(e,t){function n(...r){if(t){let s=t(...r);if(!s)throw new Error($n(0));return{type:e,payload:s.payload,..."meta"in s&&{meta:s.meta},..."error"in s&&{error:s.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>GS(r)&&r.type===e,n}var dv=class di extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,di.prototype)}static get[Symbol.species](){return di}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new di(...t[0].concat(this)):new di(...t.concat(this))}};function Rp(e){return Wn(e)?cv(e,()=>{}):e}function Oo(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function c1(e){return typeof e=="boolean"}var u1=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:s=!0,actionCreatorCheck:i=!0}=t??{};let o=new dv;return n&&(c1(n)?o.push(o1):o.push(a1(n.extraArgument))),o},d1="RTK_autoBatch",Op=e=>t=>{setTimeout(t,e)},f1=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let s=!0,i=!1,o=!1;const a=new Set,l=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Op(10):e.type==="callback"?e.queueNotification:Op(e.timeout),c=()=>{o=!1,i&&(i=!1,a.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>s&&d(),p=r.subscribe(f);return a.add(d),()=>{p(),a.delete(d)}},dispatch(d){var f;try{return s=!((f=d==null?void 0:d.meta)!=null&&f[d1]),i=!s,i&&(o||(o=!0,l(c))),r.dispatch(d)}finally{s=!0}}})},p1=e=>function(n){const{autoBatch:r=!0}=n??{};let s=new dv(e);return r&&s.push(f1(typeof r=="object"?r:void 0)),s};function h1(e){const t=u1(),{reducer:n=void 0,middleware:r,devTools:s=!0,preloadedState:i=void 0,enhancers:o=void 0}=e||{};let a;if(typeof n=="function")a=n;else if(jd(n))a=VS(n);else throw new Error($n(1));let l;typeof r=="function"?l=r(t):l=t();let c=Pa;s&&(c=l1({trace:!1,...typeof s=="object"&&s}));const d=qS(...l),f=p1(d);let p=typeof o=="function"?o(f):f();const w=c(...p);return nv(a,i,w)}function fv(e){const t={},n=[];let r;const s={addCase(i,o){const a=typeof i=="string"?i:i.type;if(!a)throw new Error($n(28));if(a in t)throw new Error($n(29));return t[a]=o,s},addAsyncThunk(i,o){return o.pending&&(t[i.pending.type]=o.pending),o.rejected&&(t[i.rejected.type]=o.rejected),o.fulfilled&&(t[i.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:i.settled,reducer:o.settled}),s},addMatcher(i,o){return n.push({matcher:i,reducer:o}),s},addDefaultCase(i){return r=i,s}};return e(s),[t,n,r]}function m1(e){return typeof e=="function"}function g1(e,t){let[n,r,s]=fv(t),i;if(m1(e))i=()=>Rp(e());else{const a=Rp(e);i=()=>a}function o(a=i(),l){let c=[n[l.type],...r.filter(({matcher:d})=>d(l)).map(({reducer:d})=>d)];return c.filter(d=>!!d).length===0&&(c=[s]),c.reduce((d,f)=>{if(f)if(zr(d)){const w=f(d,l);return w===void 0?d:w}else{if(Wn(d))return cv(d,p=>f(p,l));{const p=f(d,l);if(p===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return d},a)}return o.getInitialState=i,o}var v1=Symbol.for("rtk-slice-createasyncthunk");function y1(e,t){return`${e}/${t}`}function w1({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[v1];return function(s){const{name:i,reducerPath:o=i}=s;if(!i)throw new Error($n(11));const a=(typeof s.reducers=="function"?s.reducers(S1()):s.reducers)||{},l=Object.keys(a),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(C,T){const b=typeof C=="string"?C:C.type;if(!b)throw new Error($n(12));if(b in c.sliceCaseReducersByType)throw new Error($n(13));return c.sliceCaseReducersByType[b]=T,d},addMatcher(C,T){return c.sliceMatchers.push({matcher:C,reducer:T}),d},exposeAction(C,T){return c.actionCreators[C]=T,d},exposeCaseReducer(C,T){return c.sliceCaseReducersByName[C]=T,d}};l.forEach(C=>{const T=a[C],b={reducerName:C,type:y1(i,C),createNotation:typeof s.reducers=="function"};b1(T)?E1(b,T,d,t):k1(b,T,d)});function f(){const[C={},T=[],b=void 0]=typeof s.extraReducers=="function"?fv(s.extraReducers):[s.extraReducers],_={...C,...c.sliceCaseReducersByType};return g1(s.initialState,P=>{for(let I in _)P.addCase(I,_[I]);for(let I of c.sliceMatchers)P.addMatcher(I.matcher,I.reducer);for(let I of T)P.addMatcher(I.matcher,I.reducer);b&&P.addDefaultCase(b)})}const p=C=>C,w=new Map,h=new WeakMap;let y;function S(C,T){return y||(y=f()),y(C,T)}function v(){return y||(y=f()),y.getInitialState()}function g(C,T=!1){function b(P){let I=P[C];return typeof I>"u"&&T&&(I=Oo(h,b,v)),I}function _(P=p){const I=Oo(w,T,()=>new WeakMap);return Oo(I,P,()=>{const R={};for(const[q,se]of Object.entries(s.selectors??{}))R[q]=x1(se,P,()=>Oo(h,P,v),T);return R})}return{reducerPath:C,getSelectors:_,get selectors(){return _(b)},selectSlice:b}}const x={name:i,reducer:S,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:v,...g(o),injectInto(C,{reducerPath:T,...b}={}){const _=T??o;return C.inject({reducerPath:_,reducer:S},b),{...x,...g(_,!0)}}};return x}}function x1(e,t,n,r){function s(i,...o){let a=t(i);return typeof a>"u"&&r&&(a=n()),e(a,...o)}return s.unwrapped=e,s}var dl=w1();function S1(){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 k1({type:e,reducerName:t,createNotation:n},r,s){let i,o;if("reducer"in r){if(n&&!C1(r))throw new Error($n(17));i=r.reducer,o=r.prepare}else i=r;s.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,o?Ip(e,o):Ip(e))}function b1(e){return e._reducerDefinitionType==="asyncThunk"}function C1(e){return e._reducerDefinitionType==="reducerWithPrepare"}function E1({type:e,reducerName:t},n,r,s){if(!s)throw new Error($n(18));const{payloadCreator:i,fulfilled:o,pending:a,rejected:l,settled:c,options:d}=n,f=s(e,i,d);r.exposeAction(t,f),o&&r.addCase(f.fulfilled,o),a&&r.addCase(f.pending,a),l&&r.addCase(f.rejected,l),c&&r.addMatcher(f.settled,c),r.exposeCaseReducer(t,{fulfilled:o||Do,pending:a||Do,rejected:l||Do,settled:c||Do})}function Do(){}function $n(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 N1={isAuthenticated:localStorage.getItem("isAuthenticated")==="true",userId:null,username:localStorage.getItem("username")||null,loading:!1},pv=dl({name:"auth",initialState:N1,reducers:{setAuth:(e,t)=>{e.isAuthenticated=!0,e.userId=t.payload.userId,e.username=t.payload.username,localStorage.setItem("isAuthenticated","true"),localStorage.setItem("username",t.payload.username)},clearAuth:e=>{e.isAuthenticated=!1,e.userId=null,e.username=null,localStorage.removeItem("isAuthenticated"),localStorage.removeItem("username")}}}),{setAuth:Rd,clearAuth:Yi}=pv.actions,_1=pv.reducer,T1={notes:[],allNotes:[],archivedNotes:[],selectedDate:null,selectedTag:null,searchQuery:"",loading:!1,editingNoteId:null,offlineMode:!1,pendingSyncCount:0},hv=dl({name:"notes",initialState:T1,reducers:{setNotes:(e,t)=>{e.notes=t.payload},setAllNotes:(e,t)=>{e.allNotes=t.payload},addNote:(e,t)=>{e.notes.unshift(t.payload),e.allNotes.unshift(t.payload)},updateNote:(e,t)=>{const n=e.notes.findIndex(s=>s.id===t.payload.id);n!==-1&&(e.notes[n]=t.payload);const r=e.allNotes.findIndex(s=>s.id===t.payload.id);r!==-1&&(e.allNotes[r]=t.payload)},deleteNote:(e,t)=>{e.notes=e.notes.filter(n=>n.id!==t.payload),e.allNotes=e.allNotes.filter(n=>n.id!==t.payload)},setSelectedDate:(e,t)=>{e.selectedDate=t.payload},setSelectedTag:(e,t)=>{e.selectedTag=t.payload},setSearchQuery:(e,t)=>{e.searchQuery=t.payload},setEditingNote:(e,t)=>{e.editingNoteId=t.payload},setOfflineMode:(e,t)=>{e.offlineMode=t.payload},setPendingSyncCount:(e,t)=>{e.pendingSyncCount=t.payload},updateNoteSyncStatus:(e,t)=>{const n=e.notes.findIndex(s=>s.id===t.payload.id);n!==-1&&(e.notes[n].syncStatus=t.payload.syncStatus);const r=e.allNotes.findIndex(s=>s.id===t.payload.id);r!==-1&&(e.allNotes[r].syncStatus=t.payload.syncStatus)}}}),{setNotes:j1,setAllNotes:P1,addNote:Dp,updateNote:Fe,deleteNote:W_,setSelectedDate:fu,setSelectedTag:Da,setSearchQuery:pu,setEditingNote:H_,setOfflineMode:bi,setPendingSyncCount:Od,updateNoteSyncStatus:Q_}=hv.actions,I1=hv.reducer,R1=()=>{const e=localStorage.getItem("theme");return e==="dark"||e==="light"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"},O1={theme:R1(),accentColor:localStorage.getItem("accentColor")||"#007bff",notifications:[],isMobileSidebarOpen:!1,isPreviewMode:!1,syncStatus:"idle"},mv=dl({name:"ui",initialState:O1,reducers:{toggleTheme:e=>{e.theme=e.theme==="light"?"dark":"light",localStorage.setItem("theme",e.theme)},setTheme:(e,t)=>{e.theme=t.payload,localStorage.setItem("theme",e.theme)},setAccentColor:(e,t)=>{e.accentColor=t.payload,localStorage.setItem("accentColor",t.payload)},addNotification:(e,t)=>{const n=t.payload.id||`notification-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,{id:r,...s}=t.payload;e.notifications.push({...s,id:n})},removeNotification:(e,t)=>{e.notifications=e.notifications.filter(n=>n.id!==t.payload)},toggleMobileSidebar:e=>{e.isMobileSidebarOpen=!e.isMobileSidebarOpen},closeMobileSidebar:e=>{e.isMobileSidebarOpen=!1},togglePreviewMode:e=>{e.isPreviewMode=!e.isPreviewMode},setSyncStatus:(e,t)=>{e.syncStatus=t.payload}}}),{toggleTheme:D1,setTheme:L1,setAccentColor:La,addNotification:bs,removeNotification:gv,toggleMobileSidebar:V_,closeMobileSidebar:q_,togglePreviewMode:M1,setSyncStatus:ns}=mv.actions,A1=mv.reducer,$1={user:null,aiSettings:null,aiEnabled:!1,loading:!1},vv=dl({name:"profile",initialState:$1,reducers:{setUser:(e,t)=>{e.user=t.payload},setAiSettings:(e,t)=>{e.aiSettings=t.payload,e.aiEnabled=t.payload.ai_enabled===1},setLoading:(e,t)=>{e.loading=t.payload}}}),{setUser:Dd,setAiSettings:Ld,setLoading:G_}=vv.actions,F1=vv.reducer,ee=h1({reducer:{auth:_1,notes:I1,ui:A1,profile:F1}}),yt=()=>FS(),oe=BS;function yv(e,t){return function(){return e.apply(t,arguments)}}const{toString:z1}=Object.prototype,{getPrototypeOf:Md}=Object,{iterator:fl,toStringTag:wv}=Symbol,pl=(e=>t=>{const n=z1.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),wn=e=>(e=e.toLowerCase(),t=>pl(t)===e),hl=e=>t=>typeof t===e,{isArray:zs}=Array,Rs=hl("undefined");function oo(e){return e!==null&&!Rs(e)&&e.constructor!==null&&!Rs(e.constructor)&&Ft(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const xv=wn("ArrayBuffer");function U1(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&xv(e.buffer),t}const B1=hl("string"),Ft=hl("function"),Sv=hl("number"),ao=e=>e!==null&&typeof e=="object",W1=e=>e===!0||e===!1,Zo=e=>{if(pl(e)!=="object")return!1;const t=Md(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(wv in e)&&!(fl in e)},H1=e=>{if(!ao(e)||oo(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Q1=wn("Date"),V1=wn("File"),q1=wn("Blob"),G1=wn("FileList"),Y1=e=>ao(e)&&Ft(e.pipe),K1=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Ft(e.append)&&((t=pl(e))==="formdata"||t==="object"&&Ft(e.toString)&&e.toString()==="[object FormData]"))},X1=wn("URLSearchParams"),[J1,Z1,ek,tk]=["ReadableStream","Request","Response","Headers"].map(wn),nk=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function lo(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),zs(e))for(r=0,s=e.length;r0;)if(s=n[r],t===s.toLowerCase())return s;return null}const Ir=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,bv=e=>!Rs(e)&&e!==Ir;function hu(){const{caseless:e,skipUndefined:t}=bv(this)&&this||{},n={},r=(s,i)=>{const o=e&&kv(n,i)||i;Zo(n[o])&&Zo(s)?n[o]=hu(n[o],s):Zo(s)?n[o]=hu({},s):zs(s)?n[o]=s.slice():(!t||!Rs(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s(lo(t,(s,i)=>{n&&Ft(s)?e[i]=yv(s,n):e[i]=s},{allOwnKeys:r}),e),sk=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),ik=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},ok=(e,t,n,r)=>{let s,i,o;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=n!==!1&&Md(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},ak=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},lk=e=>{if(!e)return null;if(zs(e))return e;let t=e.length;if(!Sv(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},ck=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Md(Uint8Array)),uk=(e,t)=>{const r=(e&&e[fl]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},dk=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},fk=wn("HTMLFormElement"),pk=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Lp=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),hk=wn("RegExp"),Cv=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};lo(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},mk=e=>{Cv(e,(t,n)=>{if(Ft(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Ft(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},gk=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return zs(e)?r(e):r(String(e).split(t)),n},vk=()=>{},yk=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function wk(e){return!!(e&&Ft(e.append)&&e[wv]==="FormData"&&e[fl])}const xk=e=>{const t=new Array(10),n=(r,s)=>{if(ao(r)){if(t.indexOf(r)>=0)return;if(oo(r))return r;if(!("toJSON"in r)){t[s]=r;const i=zs(r)?[]:{};return lo(r,(o,a)=>{const l=n(o,s+1);!Rs(l)&&(i[a]=l)}),t[s]=void 0,i}}return r};return n(e,0)},Sk=wn("AsyncFunction"),kk=e=>e&&(ao(e)||Ft(e))&&Ft(e.then)&&Ft(e.catch),Ev=((e,t)=>e?setImmediate:t?((n,r)=>(Ir.addEventListener("message",({source:s,data:i})=>{s===Ir&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),Ir.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Ft(Ir.postMessage)),bk=typeof queueMicrotask<"u"?queueMicrotask.bind(Ir):typeof process<"u"&&process.nextTick||Ev,Ck=e=>e!=null&&Ft(e[fl]),N={isArray:zs,isArrayBuffer:xv,isBuffer:oo,isFormData:K1,isArrayBufferView:U1,isString:B1,isNumber:Sv,isBoolean:W1,isObject:ao,isPlainObject:Zo,isEmptyObject:H1,isReadableStream:J1,isRequest:Z1,isResponse:ek,isHeaders:tk,isUndefined:Rs,isDate:Q1,isFile:V1,isBlob:q1,isRegExp:hk,isFunction:Ft,isStream:Y1,isURLSearchParams:X1,isTypedArray:ck,isFileList:G1,forEach:lo,merge:hu,extend:rk,trim:nk,stripBOM:sk,inherits:ik,toFlatObject:ok,kindOf:pl,kindOfTest:wn,endsWith:ak,toArray:lk,forEachEntry:uk,matchAll:dk,isHTMLForm:fk,hasOwnProperty:Lp,hasOwnProp:Lp,reduceDescriptors:Cv,freezeMethods:mk,toObjectSet:gk,toCamelCase:pk,noop:vk,toFiniteNumber:yk,findKey:kv,global:Ir,isContextDefined:bv,isSpecCompliantForm:wk,toJSONObject:xk,isAsyncFn:Sk,isThenable:kk,setImmediate:Ev,asap:bk,isIterable:Ck};function te(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}N.inherits(te,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:N.toJSONObject(this.config),code:this.code,status:this.status}}});const Nv=te.prototype,_v={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{_v[e]={value:e}});Object.defineProperties(te,_v);Object.defineProperty(Nv,"isAxiosError",{value:!0});te.from=(e,t,n,r,s,i)=>{const o=Object.create(Nv);N.toFlatObject(e,o,function(d){return d!==Error.prototype},c=>c!=="isAxiosError");const a=e&&e.message?e.message:"Error",l=t==null&&e?e.code:t;return te.call(o,a,l,n,r,s),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",i&&Object.assign(o,i),o};const Ek=null;function mu(e){return N.isPlainObject(e)||N.isArray(e)}function Tv(e){return N.endsWith(e,"[]")?e.slice(0,-2):e}function Mp(e,t,n){return e?e.concat(t).map(function(s,i){return s=Tv(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function Nk(e){return N.isArray(e)&&!e.some(mu)}const _k=N.toFlatObject(N,{},null,function(t){return/^is[A-Z]/.test(t)});function ml(e,t,n){if(!N.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=N.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,S){return!N.isUndefined(S[y])});const r=n.metaTokens,s=n.visitor||d,i=n.dots,o=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&N.isSpecCompliantForm(t);if(!N.isFunction(s))throw new TypeError("visitor must be a function");function c(h){if(h===null)return"";if(N.isDate(h))return h.toISOString();if(N.isBoolean(h))return h.toString();if(!l&&N.isBlob(h))throw new te("Blob is not supported. Use a Buffer instead.");return N.isArrayBuffer(h)||N.isTypedArray(h)?l&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function d(h,y,S){let v=h;if(h&&!S&&typeof h=="object"){if(N.endsWith(y,"{}"))y=r?y:y.slice(0,-2),h=JSON.stringify(h);else if(N.isArray(h)&&Nk(h)||(N.isFileList(h)||N.endsWith(y,"[]"))&&(v=N.toArray(h)))return y=Tv(y),v.forEach(function(x,C){!(N.isUndefined(x)||x===null)&&t.append(o===!0?Mp([y],C,i):o===null?y:y+"[]",c(x))}),!1}return mu(h)?!0:(t.append(Mp(S,y,i),c(h)),!1)}const f=[],p=Object.assign(_k,{defaultVisitor:d,convertValue:c,isVisitable:mu});function w(h,y){if(!N.isUndefined(h)){if(f.indexOf(h)!==-1)throw Error("Circular reference detected in "+y.join("."));f.push(h),N.forEach(h,function(v,g){(!(N.isUndefined(v)||v===null)&&s.call(t,v,N.isString(g)?g.trim():g,y,p))===!0&&w(v,y?y.concat(g):[g])}),f.pop()}}if(!N.isObject(e))throw new TypeError("data must be an object");return w(e),t}function Ap(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Ad(e,t){this._pairs=[],e&&ml(e,this,t)}const jv=Ad.prototype;jv.append=function(t,n){this._pairs.push([t,n])};jv.toString=function(t){const n=t?function(r){return t.call(this,r,Ap)}:Ap;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function Tk(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Pv(e,t,n){if(!t)return e;const r=n&&n.encode||Tk;N.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(t,n):i=N.isURLSearchParams(t)?t.toString():new Ad(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class $p{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){N.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Iv={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},jk=typeof URLSearchParams<"u"?URLSearchParams:Ad,Pk=typeof FormData<"u"?FormData:null,Ik=typeof Blob<"u"?Blob:null,Rk={isBrowser:!0,classes:{URLSearchParams:jk,FormData:Pk,Blob:Ik},protocols:["http","https","file","blob","url","data"]},$d=typeof window<"u"&&typeof document<"u",gu=typeof navigator=="object"&&navigator||void 0,Ok=$d&&(!gu||["ReactNative","NativeScript","NS"].indexOf(gu.product)<0),Dk=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Lk=$d&&window.location.href||"http://localhost",Mk=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:$d,hasStandardBrowserEnv:Ok,hasStandardBrowserWebWorkerEnv:Dk,navigator:gu,origin:Lk},Symbol.toStringTag,{value:"Module"})),gt={...Mk,...Rk};function Ak(e,t){return ml(e,new gt.classes.URLSearchParams,{visitor:function(n,r,s,i){return gt.isNode&&N.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function $k(e){return N.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Fk(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r=n.length;return o=!o&&N.isArray(s)?s.length:o,l?(N.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!a):((!s[o]||!N.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&N.isArray(s[o])&&(s[o]=Fk(s[o])),!a)}if(N.isFormData(e)&&N.isFunction(e.entries)){const n={};return N.forEachEntry(e,(r,s)=>{t($k(r),s,n,0)}),n}return null}function zk(e,t,n){if(N.isString(e))try{return(t||JSON.parse)(e),N.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const co={transitional:Iv,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=N.isObject(t);if(i&&N.isHTMLForm(t)&&(t=new FormData(t)),N.isFormData(t))return s?JSON.stringify(Rv(t)):t;if(N.isArrayBuffer(t)||N.isBuffer(t)||N.isStream(t)||N.isFile(t)||N.isBlob(t)||N.isReadableStream(t))return t;if(N.isArrayBufferView(t))return t.buffer;if(N.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Ak(t,this.formSerializer).toString();if((a=N.isFileList(t))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return ml(a?{"files[]":t}:t,l&&new l,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),zk(t)):t}],transformResponse:[function(t){const n=this.transitional||co.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(N.isResponse(t)||N.isReadableStream(t))return t;if(t&&N.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(a){if(o)throw a.name==="SyntaxError"?te.from(a,te.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:gt.classes.FormData,Blob:gt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};N.forEach(["delete","get","head","post","put","patch"],e=>{co.headers[e]={}});const Uk=N.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Bk=e=>{const t={};let n,r,s;return e&&e.split(` +`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&Uk[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Fp=Symbol("internals");function ei(e){return e&&String(e).trim().toLowerCase()}function ea(e){return e===!1||e==null?e:N.isArray(e)?e.map(ea):String(e)}function Wk(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const Hk=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function ec(e,t,n,r,s){if(N.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!N.isString(t)){if(N.isString(r))return t.indexOf(r)!==-1;if(N.isRegExp(r))return r.test(t)}}function Qk(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function Vk(e,t){const n=N.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}let zt=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(a,l,c){const d=ei(l);if(!d)throw new Error("header name must be a non-empty string");const f=N.findKey(s,d);(!f||s[f]===void 0||c===!0||c===void 0&&s[f]!==!1)&&(s[f||l]=ea(a))}const o=(a,l)=>N.forEach(a,(c,d)=>i(c,d,l));if(N.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(N.isString(t)&&(t=t.trim())&&!Hk(t))o(Bk(t),n);else if(N.isObject(t)&&N.isIterable(t)){let a={},l,c;for(const d of t){if(!N.isArray(d))throw TypeError("Object iterator must return a key-value pair");a[c=d[0]]=(l=a[c])?N.isArray(l)?[...l,d[1]]:[l,d[1]]:d[1]}o(a,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=ei(t),t){const r=N.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return Wk(s);if(N.isFunction(n))return n.call(this,s,r);if(N.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=ei(t),t){const r=N.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||ec(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=ei(o),o){const a=N.findKey(r,o);a&&(!n||ec(r,r[a],a,n))&&(delete r[a],s=!0)}}return N.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||ec(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return N.forEach(this,(s,i)=>{const o=N.findKey(r,i);if(o){n[o]=ea(s),delete n[i];return}const a=t?Qk(i):String(i).trim();a!==i&&delete n[i],n[a]=ea(s),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return N.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&N.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` +`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Fp]=this[Fp]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=ei(o);r[a]||(Vk(s,o),r[a]=!0)}return N.isArray(t)?t.forEach(i):i(t),this}};zt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);N.reduceDescriptors(zt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});N.freezeMethods(zt);function tc(e,t){const n=this||co,r=t||n,s=zt.from(r.headers);let i=r.data;return N.forEach(e,function(a){i=a.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Ov(e){return!!(e&&e.__CANCEL__)}function Us(e,t,n){te.call(this,e??"canceled",te.ERR_CANCELED,t,n),this.name="CanceledError"}N.inherits(Us,te,{__CANCEL__:!0});function Dv(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new te("Request failed with status code "+n.status,[te.ERR_BAD_REQUEST,te.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function qk(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Gk(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(l){const c=Date.now(),d=r[i];o||(o=c),n[s]=l,r[s]=c;let f=i,p=0;for(;f!==s;)p+=n[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o{n=d,s=null,i&&(clearTimeout(i),i=null),e(...c)};return[(...c)=>{const d=Date.now(),f=d-n;f>=r?o(c,d):(s=c,i||(i=setTimeout(()=>{i=null,o(s)},r-f)))},()=>s&&o(s)]}const Ma=(e,t,n=3)=>{let r=0;const s=Gk(50,250);return Yk(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,l=o-r,c=s(l),d=o<=a;r=o;const f={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&d?(a-o)/c:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},n)},zp=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Up=e=>(...t)=>N.asap(()=>e(...t)),Kk=gt.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,gt.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(gt.origin),gt.navigator&&/(msie|trident)/i.test(gt.navigator.userAgent)):()=>!0,Xk=gt.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];N.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),N.isString(r)&&a.push(`path=${r}`),N.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),N.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Jk(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Zk(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Lv(e,t,n){let r=!Jk(t);return e&&(r||n==!1)?Zk(e,t):t}const Bp=e=>e instanceof zt?{...e}:e;function Br(e,t){t=t||{};const n={};function r(c,d,f,p){return N.isPlainObject(c)&&N.isPlainObject(d)?N.merge.call({caseless:p},c,d):N.isPlainObject(d)?N.merge({},d):N.isArray(d)?d.slice():d}function s(c,d,f,p){if(N.isUndefined(d)){if(!N.isUndefined(c))return r(void 0,c,f,p)}else return r(c,d,f,p)}function i(c,d){if(!N.isUndefined(d))return r(void 0,d)}function o(c,d){if(N.isUndefined(d)){if(!N.isUndefined(c))return r(void 0,c)}else return r(void 0,d)}function a(c,d,f){if(f in t)return r(c,d);if(f in e)return r(void 0,c)}const l={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,d,f)=>s(Bp(c),Bp(d),f,!0)};return N.forEach(Object.keys({...e,...t}),function(d){const f=l[d]||s,p=f(e[d],t[d],d);N.isUndefined(p)&&f!==a||(n[d]=p)}),n}const Mv=e=>{const t=Br({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:a}=t;if(t.headers=o=zt.from(o),t.url=Pv(Lv(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),N.isFormData(n)){if(gt.hasStandardBrowserEnv||gt.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(N.isFunction(n.getHeaders)){const l=n.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([d,f])=>{c.includes(d.toLowerCase())&&o.set(d,f)})}}if(gt.hasStandardBrowserEnv&&(r&&N.isFunction(r)&&(r=r(t)),r||r!==!1&&Kk(t.url))){const l=s&&i&&Xk.read(i);l&&o.set(s,l)}return t},eb=typeof XMLHttpRequest<"u",tb=eb&&function(e){return new Promise(function(n,r){const s=Mv(e);let i=s.data;const o=zt.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=s,d,f,p,w,h;function y(){w&&w(),h&&h(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let S=new XMLHttpRequest;S.open(s.method.toUpperCase(),s.url,!0),S.timeout=s.timeout;function v(){if(!S)return;const x=zt.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),T={data:!a||a==="text"||a==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:x,config:e,request:S};Dv(function(_){n(_),y()},function(_){r(_),y()},T),S=null}"onloadend"in S?S.onloadend=v:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(v)},S.onabort=function(){S&&(r(new te("Request aborted",te.ECONNABORTED,e,S)),S=null)},S.onerror=function(C){const T=C&&C.message?C.message:"Network Error",b=new te(T,te.ERR_NETWORK,e,S);b.event=C||null,r(b),S=null},S.ontimeout=function(){let C=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const T=s.transitional||Iv;s.timeoutErrorMessage&&(C=s.timeoutErrorMessage),r(new te(C,T.clarifyTimeoutError?te.ETIMEDOUT:te.ECONNABORTED,e,S)),S=null},i===void 0&&o.setContentType(null),"setRequestHeader"in S&&N.forEach(o.toJSON(),function(C,T){S.setRequestHeader(T,C)}),N.isUndefined(s.withCredentials)||(S.withCredentials=!!s.withCredentials),a&&a!=="json"&&(S.responseType=s.responseType),c&&([p,h]=Ma(c,!0),S.addEventListener("progress",p)),l&&S.upload&&([f,w]=Ma(l),S.upload.addEventListener("progress",f),S.upload.addEventListener("loadend",w)),(s.cancelToken||s.signal)&&(d=x=>{S&&(r(!x||x.type?new Us(null,e,S):x),S.abort(),S=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const g=qk(s.url);if(g&>.protocols.indexOf(g)===-1){r(new te("Unsupported protocol "+g+":",te.ERR_BAD_REQUEST,e));return}S.send(i||null)})},nb=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(c){if(!s){s=!0,a();const d=c instanceof Error?c:this.reason;r.abort(d instanceof te?d:new Us(d instanceof Error?d.message:d))}};let o=t&&setTimeout(()=>{o=null,i(new te(`timeout ${t} of ms exceeded`,te.ETIMEDOUT))},t);const a=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(i):c.removeEventListener("abort",i)}),e=null)};e.forEach(c=>c.addEventListener("abort",i));const{signal:l}=r;return l.unsubscribe=()=>N.asap(a),l}},rb=function*(e,t){let n=e.byteLength;if(n{const s=sb(e,t);let i=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:d}=await s.next();if(c){a(),l.close();return}let f=d.byteLength;if(n){let p=i+=f;n(p)}l.enqueue(new Uint8Array(d))}catch(c){throw a(c),c}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},Hp=64*1024,{isFunction:Lo}=N,ob=(({Request:e,Response:t})=>({Request:e,Response:t}))(N.global),{ReadableStream:Qp,TextEncoder:Vp}=N.global,qp=(e,...t)=>{try{return!!e(...t)}catch{return!1}},ab=e=>{e=N.merge.call({skipUndefined:!0},ob,e);const{fetch:t,Request:n,Response:r}=e,s=t?Lo(t):typeof fetch=="function",i=Lo(n),o=Lo(r);if(!s)return!1;const a=s&&Lo(Qp),l=s&&(typeof Vp=="function"?(h=>y=>h.encode(y))(new Vp):async h=>new Uint8Array(await new n(h).arrayBuffer())),c=i&&a&&qp(()=>{let h=!1;const y=new n(gt.origin,{body:new Qp,method:"POST",get duplex(){return h=!0,"half"}}).headers.has("Content-Type");return h&&!y}),d=o&&a&&qp(()=>N.isReadableStream(new r("").body)),f={stream:d&&(h=>h.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(h=>{!f[h]&&(f[h]=(y,S)=>{let v=y&&y[h];if(v)return v.call(y);throw new te(`Response type '${h}' is not supported`,te.ERR_NOT_SUPPORT,S)})});const p=async h=>{if(h==null)return 0;if(N.isBlob(h))return h.size;if(N.isSpecCompliantForm(h))return(await new n(gt.origin,{method:"POST",body:h}).arrayBuffer()).byteLength;if(N.isArrayBufferView(h)||N.isArrayBuffer(h))return h.byteLength;if(N.isURLSearchParams(h)&&(h=h+""),N.isString(h))return(await l(h)).byteLength},w=async(h,y)=>{const S=N.toFiniteNumber(h.getContentLength());return S??p(y)};return async h=>{let{url:y,method:S,data:v,signal:g,cancelToken:x,timeout:C,onDownloadProgress:T,onUploadProgress:b,responseType:_,headers:P,withCredentials:I="same-origin",fetchOptions:R}=Mv(h),q=t||fetch;_=_?(_+"").toLowerCase():"text";let se=nb([g,x&&x.toAbortSignal()],C),J=null;const ne=se&&se.unsubscribe&&(()=>{se.unsubscribe()});let A;try{if(b&&c&&S!=="get"&&S!=="head"&&(A=await w(P,v))!==0){let E=new n(y,{method:"POST",body:v,duplex:"half"}),F;if(N.isFormData(v)&&(F=E.headers.get("content-type"))&&P.setContentType(F),E.body){const[W,z]=zp(A,Ma(Up(b)));v=Wp(E.body,Hp,W,z)}}N.isString(I)||(I=I?"include":"omit");const Q=i&&"credentials"in n.prototype,re={...R,signal:se,method:S.toUpperCase(),headers:P.normalize().toJSON(),body:v,duplex:"half",credentials:Q?I:void 0};J=i&&new n(y,re);let $=await(i?q(J,R):q(y,re));const B=d&&(_==="stream"||_==="response");if(d&&(T||B&&ne)){const E={};["status","statusText","headers"].forEach(G=>{E[G]=$[G]});const F=N.toFiniteNumber($.headers.get("content-length")),[W,z]=T&&zp(F,Ma(Up(T),!0))||[];$=new r(Wp($.body,Hp,W,()=>{z&&z(),ne&&ne()}),E)}_=_||"text";let V=await f[N.findKey(f,_)||"text"]($,h);return!B&&ne&&ne(),await new Promise((E,F)=>{Dv(E,F,{data:V,headers:zt.from($.headers),status:$.status,statusText:$.statusText,config:h,request:J})})}catch(Q){throw ne&&ne(),Q&&Q.name==="TypeError"&&/Load failed|fetch/i.test(Q.message)?Object.assign(new te("Network Error",te.ERR_NETWORK,h,J),{cause:Q.cause||Q}):te.from(Q,Q&&Q.code,h,J)}}},lb=new Map,Av=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,a=o,l,c,d=lb;for(;a--;)l=i[a],c=d.get(l),c===void 0&&d.set(l,c=a?new Map:ab(t)),d=c;return c};Av();const Fd={http:Ek,xhr:tb,fetch:{get:Av}};N.forEach(Fd,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Gp=e=>`- ${e}`,cb=e=>N.isFunction(e)||e===null||e===!1;function ub(e,t){e=N.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since : +`+o.map(Gp).join(` +`):" "+Gp(o[0]):"as no adapter specified";throw new te("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const $v={getAdapter:ub,adapters:Fd};function nc(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Us(null,e)}function Yp(e){return nc(e),e.headers=zt.from(e.headers),e.data=tc.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),$v.getAdapter(e.adapter||co.adapter,e)(e).then(function(r){return nc(e),r.data=tc.call(e,e.transformResponse,r),r.headers=zt.from(r.headers),r},function(r){return Ov(r)||(nc(e),r&&r.response&&(r.response.data=tc.call(e,e.transformResponse,r.response),r.response.headers=zt.from(r.response.headers))),Promise.reject(r)})}const Fv="1.13.1",gl={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{gl[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Kp={};gl.transitional=function(t,n,r){function s(i,o){return"[Axios v"+Fv+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(t===!1)throw new te(s(o," has been removed"+(n?" in "+n:"")),te.ERR_DEPRECATED);return n&&!Kp[o]&&(Kp[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,a):!0}};gl.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function db(e,t,n){if(typeof e!="object")throw new te("options must be an object",te.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const a=e[i],l=a===void 0||o(a,i,e);if(l!==!0)throw new te("option "+i+" must be "+l,te.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new te("Unknown option "+i,te.ERR_BAD_OPTION)}}const ta={assertOptions:db,validators:gl},kn=ta.validators;let Dr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new $p,response:new $p}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Br(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&ta.assertOptions(r,{silentJSONParsing:kn.transitional(kn.boolean),forcedJSONParsing:kn.transitional(kn.boolean),clarifyTimeoutError:kn.transitional(kn.boolean)},!1),s!=null&&(N.isFunction(s)?n.paramsSerializer={serialize:s}:ta.assertOptions(s,{encode:kn.function,serialize:kn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ta.assertOptions(n,{baseUrl:kn.spelling("baseURL"),withXsrfToken:kn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&N.merge(i.common,i[n.method]);i&&N.forEach(["delete","get","head","post","put","patch","common"],h=>{delete i[h]}),n.headers=zt.concat(o,i);const a=[];let l=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(l=l&&y.synchronous,a.unshift(y.fulfilled,y.rejected))});const c=[];this.interceptors.response.forEach(function(y){c.push(y.fulfilled,y.rejected)});let d,f=0,p;if(!l){const h=[Yp.bind(this),void 0];for(h.unshift(...a),h.push(...c),p=h.length,d=Promise.resolve(n);f{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,a){r.reason||(r.reason=new Us(i,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new zv(function(s){t=s}),cancel:t}}};function pb(e){return function(n){return e.apply(null,n)}}function hb(e){return N.isObject(e)&&e.isAxiosError===!0}const vu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(vu).forEach(([e,t])=>{vu[t]=e});function Uv(e){const t=new Dr(e),n=yv(Dr.prototype.request,t);return N.extend(n,Dr.prototype,t,{allOwnKeys:!0}),N.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Uv(Br(e,s))},n}const We=Uv(co);We.Axios=Dr;We.CanceledError=Us;We.CancelToken=fb;We.isCancel=Ov;We.VERSION=Fv;We.toFormData=ml;We.AxiosError=te;We.Cancel=We.CanceledError;We.all=function(t){return Promise.all(t)};We.spread=pb;We.isAxiosError=hb;We.mergeConfig=Br;We.AxiosHeaders=zt;We.formToJSON=e=>Rv(N.isHTMLForm(e)?new FormData(e):e);We.getAdapter=$v.getAdapter;We.HttpStatusCode=vu;We.default=We;const{Axios:X_,AxiosError:J_,CanceledError:Z_,isCancel:eT,CancelToken:tT,VERSION:nT,all:rT,Cancel:sT,isAxiosError:iT,spread:oT,toFormData:aT,AxiosHeaders:lT,HttpStatusCode:cT,formToJSON:uT,getAdapter:dT,mergeConfig:fT}=We,mb="notesDB",gb=1;class vb{constructor(){ce(this,"db",null);ce(this,"initPromise",null)}async init(){return this.db?this.db:this.initPromise?this.initPromise:(this.initPromise=new Promise((t,n)=>{const r=indexedDB.open(mb,gb);r.onerror=()=>{n(r.error)},r.onsuccess=()=>{this.db=r.result,this.initPromise=null,t(this.db)},r.onupgradeneeded=s=>{const i=s.target.result;if(!i.objectStoreNames.contains("notes")){const o=i.createObjectStore("notes",{keyPath:"id"});o.createIndex("user_id","user_id",{unique:!1}),o.createIndex("created_at","created_at",{unique:!1}),o.createIndex("syncStatus","syncStatus",{unique:!1})}if(!i.objectStoreNames.contains("syncQueue")){const o=i.createObjectStore("syncQueue",{keyPath:"id"});o.createIndex("timestamp","timestamp",{unique:!1}),o.createIndex("noteId","noteId",{unique:!1})}}}),this.initPromise)}async getStore(t,n="readonly"){if(await this.init(),!this.db)throw new Error("Database not initialized");return this.db.transaction([t],n).objectStore(t)}async getAllNotes(){const t=await this.getStore("notes");return new Promise((n,r)=>{const s=t.getAll();s.onsuccess=()=>n(s.result),s.onerror=()=>r(s.error)})}async getNotesByUserId(t){const n=await this.getStore("notes");return new Promise((r,s)=>{const i=n.index("user_id").getAll(t);i.onsuccess=()=>r(i.result),i.onerror=()=>s(i.error)})}async getNote(t){const n=await this.getStore("notes");return new Promise((r,s)=>{const i=n.get(t);i.onsuccess=()=>r(i.result),i.onerror=()=>s(i.error)})}async saveNote(t){const n=await this.getStore("notes","readwrite");return new Promise((r,s)=>{const i=n.put(t);i.onsuccess=()=>r(),i.onerror=()=>s(i.error)})}async saveNotes(t){if(t.length===0)return;if(await this.init(),!this.db)throw new Error("Database not initialized");const r=this.db.transaction(["notes"],"readwrite").objectStore("notes");return new Promise((s,i)=>{let o=0;for(const a of t){const l=r.put(a);l.onerror=()=>i(l.error),l.onsuccess=()=>{o++,o===t.length&&s()}}})}async deleteNote(t){const n=await this.getStore("notes","readwrite");return new Promise((r,s)=>{const i=n.delete(t);i.onsuccess=()=>r(),i.onerror=()=>s(i.error)})}async clearAllNotes(){const t=await this.getStore("notes","readwrite");return new Promise((n,r)=>{const s=t.clear();s.onsuccess=()=>n(),s.onerror=()=>r(s.error)})}async addToSyncQueue(t){const n=await this.getStore("syncQueue","readwrite"),r=`sync-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,s={...t,id:r};return new Promise((i,o)=>{const a=n.add(s);a.onsuccess=()=>i(r),a.onerror=()=>o(a.error)})}async getSyncQueue(){const t=await this.getStore("syncQueue");return new Promise((n,r)=>{const s=t.index("timestamp").getAll();s.onsuccess=()=>n(s.result),s.onerror=()=>r(s.error)})}async getSyncQueueItem(t){const n=await this.getStore("syncQueue");return new Promise((r,s)=>{const i=n.get(t);i.onsuccess=()=>r(i.result),i.onerror=()=>s(i.error)})}async removeFromSyncQueue(t){const n=await this.getStore("syncQueue","readwrite");return new Promise((r,s)=>{const i=n.delete(t);i.onsuccess=()=>r(),i.onerror=()=>s(i.error)})}async updateSyncQueueItem(t,n){const r=await this.getSyncQueueItem(t);if(!r)throw new Error("Sync queue item not found");const s=await this.getStore("syncQueue","readwrite");return new Promise((i,o)=>{const a=s.put({...r,...n});a.onsuccess=()=>i(),a.onerror=()=>o(a.error)})}async clearSyncQueue(){const t=await this.getStore("syncQueue","readwrite");return new Promise((n,r)=>{const s=t.clear();s.onsuccess=()=>n(),s.onerror=()=>r(s.error)})}async clearAll(){await Promise.all([this.clearAllNotes(),this.clearSyncQueue()])}async getPendingSyncCount(){return(await this.getSyncQueue()).length}async isNoteSynced(t){const n=await this.getNote(t);return(n==null?void 0:n.syncStatus)==="synced"}async getDataVersion(){const n=(await this.getAllNotes()).filter(i=>i.is_archived===0);if(n.length===0)return{last_updated_at:null,last_created_at:null,total_notes:0};let r=null,s=null;for(const i of n)i.updated_at&&(!r||i.updated_at>r)&&(r=i.updated_at),i.created_at&&(!s||i.created_at>s)&&(s=i.created_at);return{last_updated_at:r,last_created_at:s,total_notes:n.length}}async getDataVersionByUserId(t){const r=(await this.getNotesByUserId(t)).filter(o=>o.is_archived===0);if(r.length===0)return{last_updated_at:null,last_created_at:null,total_notes:0};let s=null,i=null;for(const o of r)o.updated_at&&(!s||o.updated_at>s)&&(s=o.updated_at),o.created_at&&(!i||o.created_at>i)&&(i=o.created_at);return{last_updated_at:s,last_created_at:i,total_notes:r.length}}}const D=new vb,Y=We.create({baseURL:"/api",withCredentials:!0,headers:{"Content-Type":"application/json"}});Y.interceptors.request.use(e=>{var t;return console.log("API Request:",(t=e.method)==null?void 0:t.toUpperCase(),e.url),e},e=>Promise.reject(e));Y.interceptors.response.use(e=>(console.log("API Response:",e.status,e.config.url),e),e=>{var t,n,r,s;return console.error("API Error:",{url:(t=e.config)==null?void 0:t.url,status:(n=e.response)==null?void 0:n.status,message:e.message,data:(r=e.response)==null?void 0:r.data}),((s=e.response)==null?void 0:s.status)===401&&(["/login","/register","/notes/archived/all","/user/delete-account"].some(a=>{var l,c;return(c=(l=e.config)==null?void 0:l.url)==null?void 0:c.includes(a)})||(D.clearAll().catch(a=>{console.error("Ошибка очистки IndexedDB при 401:",a)}),localStorage.removeItem("isAuthenticated"),window.location.href="/")),e.response||console.error("Network error - server might be down or proxy not working"),Promise.reject(e)});const Wr={login:async(e,t)=>{const{data:n}=await Y.post("/login",{username:e,password:t});return n},register:async(e,t,n)=>{const{data:r}=await Y.post("/register",{username:e,password:t,confirmPassword:n});return r},checkStatus:async()=>{const{data:e}=await Y.get("/auth/status");return e},logout:async()=>{await Y.post("/logout")}},Gr=()=>{const e=yt();return{showNotification:k.useCallback((n,r="info")=>{const s=`notification-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;e(bs({message:n,type:r,id:s})),setTimeout(()=>{e(gv(s))},4e3)},[e])}},Ci=/^[a-z0-9]+(-[a-z0-9]+)*$/,vl=(e,t,n,r="")=>{const s=e.split(":");if(e.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;r=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const a=s.pop(),l=s.pop(),c={provider:s.length>0?s[0]:r,prefix:l,name:a};return t&&!na(c)?null:c}const i=s[0],o=i.split("-");if(o.length>1){const a={provider:r,prefix:o.shift(),name:o.join("-")};return t&&!na(a)?null:a}if(n&&r===""){const a={provider:r,prefix:"",name:i};return t&&!na(a,n)?null:a}return null},na=(e,t)=>e?!!((e.provider===""||e.provider.match(Ci))&&(t&&e.prefix===""||e.prefix.match(Ci))&&e.name.match(Ci)):!1,Bv=Object.freeze({left:0,top:0,width:16,height:16}),Aa=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),zd=Object.freeze({...Bv,...Aa}),yu=Object.freeze({...zd,body:"",hidden:!1});function yb(e,t){const n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);const r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function Xp(e,t){const n=yb(e,t);for(const r in yu)r in Aa?r in e&&!(r in n)&&(n[r]=Aa[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function wb(e,t){const n=e.icons,r=e.aliases||Object.create(null),s=Object.create(null);function i(o){if(n[o])return s[o]=[];if(!(o in s)){s[o]=null;const a=r[o]&&r[o].parent,l=a&&i(a);l&&(s[o]=[a].concat(l))}return s[o]}return Object.keys(n).concat(Object.keys(r)).forEach(i),s}function xb(e,t,n){const r=e.icons,s=e.aliases||Object.create(null);let i={};function o(a){i=Xp(r[a]||s[a],i)}return o(t),n.forEach(o),Xp(e,i)}function Wv(e,t){const n=[];if(typeof e!="object"||typeof e.icons!="object")return n;e.not_found instanceof Array&&e.not_found.forEach(s=>{t(s,null),n.push(s)});const r=wb(e);for(const s in r){const i=r[s];i&&(t(s,xb(e,s,i)),n.push(s))}return n}const Sb={provider:"",aliases:{},not_found:{},...Bv};function rc(e,t){for(const n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function Hv(e){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.prefix!="string"||!e.icons||typeof e.icons!="object"||!rc(e,Sb))return null;const n=t.icons;for(const s in n){const i=n[s];if(!s.match(Ci)||typeof i.body!="string"||!rc(i,yu))return null}const r=t.aliases||Object.create(null);for(const s in r){const i=r[s],o=i.parent;if(!s.match(Ci)||typeof o!="string"||!n[o]&&!r[o]||!rc(i,yu))return null}return t}const Jp=Object.create(null);function kb(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function Hr(e,t){const n=Jp[e]||(Jp[e]=Object.create(null));return n[t]||(n[t]=kb(e,t))}function Ud(e,t){return Hv(t)?Wv(t,(n,r)=>{r?e.icons[n]=r:e.missing.add(n)}):[]}function bb(e,t,n){try{if(typeof n.body=="string")return e.icons[t]={...n},!0}catch{}return!1}let Ki=!1;function Qv(e){return typeof e=="boolean"&&(Ki=e),Ki}function Cb(e){const t=typeof e=="string"?vl(e,!0,Ki):e;if(t){const n=Hr(t.provider,t.prefix),r=t.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function Eb(e,t){const n=vl(e,!0,Ki);if(!n)return!1;const r=Hr(n.provider,n.prefix);return bb(r,n.name,t)}function Nb(e,t){if(typeof e!="object")return!1;if(typeof t!="string"&&(t=e.provider||""),Ki&&!t&&!e.prefix){let s=!1;return Hv(e)&&(e.prefix="",Wv(e,(i,o)=>{o&&Eb(i,o)&&(s=!0)})),s}const n=e.prefix;if(!na({provider:t,prefix:n,name:"a"}))return!1;const r=Hr(t,n);return!!Ud(r,e)}const Vv=Object.freeze({width:null,height:null}),qv=Object.freeze({...Vv,...Aa}),_b=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Tb=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Zp(e,t,n){if(t===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*t*n)/n;if(typeof e!="string")return e;const r=e.split(_b);if(r===null||!r.length)return e;const s=[];let i=r.shift(),o=Tb.test(i);for(;;){if(o){const a=parseFloat(i);isNaN(a)?s.push(i):s.push(Math.ceil(a*t*n)/n)}else s.push(i);if(i=r.shift(),i===void 0)return s.join("");o=!o}}const jb=e=>e==="unset"||e==="undefined"||e==="none";function Pb(e,t){const n={...zd,...e},r={...qv,...t},s={left:n.left,top:n.top,width:n.width,height:n.height};let i=n.body;[n,r].forEach(h=>{const y=[],S=h.hFlip,v=h.vFlip;let g=h.rotate;S?v?g+=2:(y.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),y.push("scale(-1 1)"),s.top=s.left=0):v&&(y.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),y.push("scale(1 -1)"),s.top=s.left=0);let x;switch(g<0&&(g-=Math.floor(g/4)*4),g=g%4,g){case 1:x=s.height/2+s.top,y.unshift("rotate(90 "+x.toString()+" "+x.toString()+")");break;case 2:y.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:x=s.width/2+s.left,y.unshift("rotate(-90 "+x.toString()+" "+x.toString()+")");break}g%2===1&&(s.left!==s.top&&(x=s.left,s.left=s.top,s.top=x),s.width!==s.height&&(x=s.width,s.width=s.height,s.height=x)),y.length&&(i=''+i+"")});const o=r.width,a=r.height,l=s.width,c=s.height;let d,f;o===null?(f=a===null?"1em":a==="auto"?c:a,d=Zp(f,l/c)):(d=o==="auto"?l:o,f=a===null?Zp(d,c/l):a==="auto"?c:a);const p={},w=(h,y)=>{jb(y)||(p[h]=y.toString())};return w("width",d),w("height",f),p.viewBox=s.left.toString()+" "+s.top.toString()+" "+l.toString()+" "+c.toString(),{attributes:p,body:i}}const Ib=/\sid="(\S+)"/g,Rb="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Ob=0;function Db(e,t=Rb){const n=[];let r;for(;r=Ib.exec(e);)n.push(r[1]);if(!n.length)return e;const s="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(i=>{const o=typeof t=="function"?t(i):t+(Ob++).toString(),a=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+a+')([")]|\\.[a-z])',"g"),"$1"+o+s+"$3")}),e=e.replace(new RegExp(s,"g"),""),e}const wu=Object.create(null);function Lb(e,t){wu[e]=t}function xu(e){return wu[e]||wu[""]}function Bd(e){let t;if(typeof e.resources=="string")t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const Wd=Object.create(null),ti=["https://api.simplesvg.com","https://api.unisvg.com"],ra=[];for(;ti.length>0;)ti.length===1||Math.random()>.5?ra.push(ti.shift()):ra.push(ti.pop());Wd[""]=Bd({resources:["https://api.iconify.design"].concat(ra)});function Mb(e,t){const n=Bd(t);return n===null?!1:(Wd[e]=n,!0)}function Hd(e){return Wd[e]}const Ab=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let eh=Ab();function $b(e,t){const n=Hd(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let s=0;n.resources.forEach(o=>{s=Math.max(s,o.length)});const i=t+".json?icons=";r=n.maxURL-s-n.path.length-i.length}return r}function Fb(e){return e===404}const zb=(e,t,n)=>{const r=[],s=$b(e,t),i="icons";let o={type:i,provider:e,prefix:t,icons:[]},a=0;return n.forEach((l,c)=>{a+=l.length+1,a>=s&&c>0&&(r.push(o),o={type:i,provider:e,prefix:t,icons:[]},a=l.length),o.icons.push(l)}),r.push(o),r};function Ub(e){if(typeof e=="string"){const t=Hd(e);if(t)return t.path}return"/"}const Bb=(e,t,n)=>{if(!eh){n("abort",424);return}let r=Ub(t.provider);switch(t.type){case"icons":{const i=t.prefix,a=t.icons.join(","),l=new URLSearchParams({icons:a});r+=i+".json?"+l.toString();break}case"custom":{const i=t.uri;r+=i.slice(0,1)==="/"?i.slice(1):i;break}default:n("abort",400);return}let s=503;eh(e+r).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{n(Fb(o)?"abort":"next",o)});return}return s=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?n("abort",i):n("next",s)});return}setTimeout(()=>{n("success",i)})}).catch(()=>{n("next",s)})},Wb={prepare:zb,send:Bb};function Hb(e){const t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((s,i)=>s.provider!==i.provider?s.provider.localeCompare(i.provider):s.prefix!==i.prefix?s.prefix.localeCompare(i.prefix):s.name.localeCompare(i.name));let r={provider:"",prefix:"",name:""};return e.forEach(s=>{if(r.name===s.name&&r.prefix===s.prefix&&r.provider===s.provider)return;r=s;const i=s.provider,o=s.prefix,a=s.name,l=n[i]||(n[i]=Object.create(null)),c=l[o]||(l[o]=Hr(i,o));let d;a in c.icons?d=t.loaded:o===""||c.missing.has(a)?d=t.missing:d=t.pending;const f={provider:i,prefix:o,name:a};d.push(f)}),t}function Gv(e,t){e.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(s=>s.id!==t))})}function Qb(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1;const r=e.provider,s=e.prefix;t.forEach(i=>{const o=i.icons,a=o.pending.length;o.pending=o.pending.filter(l=>{if(l.prefix!==s)return!0;const c=l.name;if(e.icons[c])o.loaded.push({provider:r,prefix:s,name:c});else if(e.missing.has(c))o.missing.push({provider:r,prefix:s,name:c});else return n=!0,!0;return!1}),o.pending.length!==a&&(n||Gv([e],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let Vb=0;function qb(e,t,n){const r=Vb++,s=Gv.bind(null,n,r);if(!t.pending.length)return s;const i={id:r,icons:t,callback:e,abort:s};return n.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(i)}),s}function Gb(e,t=!0,n=!1){const r=[];return e.forEach(s=>{const i=typeof s=="string"?vl(s,t,n):s;i&&r.push(i)}),r}var Yb={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Kb(e,t,n,r){const s=e.resources.length,i=e.random?Math.floor(Math.random()*s):e.index;let o;if(e.random){let b=e.resources.slice(0);for(o=[];b.length>1;){const _=Math.floor(Math.random()*b.length);o.push(b[_]),b=b.slice(0,_).concat(b.slice(_+1))}o=o.concat(b)}else o=e.resources.slice(i).concat(e.resources.slice(0,i));const a=Date.now();let l="pending",c=0,d,f=null,p=[],w=[];typeof r=="function"&&w.push(r);function h(){f&&(clearTimeout(f),f=null)}function y(){l==="pending"&&(l="aborted"),h(),p.forEach(b=>{b.status==="pending"&&(b.status="aborted")}),p=[]}function S(b,_){_&&(w=[]),typeof b=="function"&&w.push(b)}function v(){return{startTime:a,payload:t,status:l,queriesSent:c,queriesPending:p.length,subscribe:S,abort:y}}function g(){l="failed",w.forEach(b=>{b(void 0,d)})}function x(){p.forEach(b=>{b.status==="pending"&&(b.status="aborted")}),p=[]}function C(b,_,P){const I=_!=="success";switch(p=p.filter(R=>R!==b),l){case"pending":break;case"failed":if(I||!e.dataAfterTimeout)return;break;default:return}if(_==="abort"){d=P,g();return}if(I){d=P,p.length||(o.length?T():g());return}if(h(),x(),!e.random){const R=e.resources.indexOf(b.resource);R!==-1&&R!==e.index&&(e.index=R)}l="completed",w.forEach(R=>{R(P)})}function T(){if(l!=="pending")return;h();const b=o.shift();if(b===void 0){if(p.length){f=setTimeout(()=>{h(),l==="pending"&&(x(),g())},e.timeout);return}g();return}const _={status:"pending",resource:b,callback:(P,I)=>{C(_,P,I)}};p.push(_),c++,f=setTimeout(T,e.rotate),n(b,t,_.callback)}return setTimeout(T),v}function Yv(e){const t={...Yb,...e};let n=[];function r(){n=n.filter(a=>a().status==="pending")}function s(a,l,c){const d=Kb(t,a,l,(f,p)=>{r(),c&&c(f,p)});return n.push(d),d}function i(a){return n.find(l=>a(l))||null}return{query:s,find:i,setIndex:a=>{t.index=a},getIndex:()=>t.index,cleanup:r}}function th(){}const sc=Object.create(null);function Xb(e){if(!sc[e]){const t=Hd(e);if(!t)return;const n=Yv(t),r={config:t,redundancy:n};sc[e]=r}return sc[e]}function Jb(e,t,n){let r,s;if(typeof e=="string"){const i=xu(e);if(!i)return n(void 0,424),th;s=i.send;const o=Xb(e);o&&(r=o.redundancy)}else{const i=Bd(e);if(i){r=Yv(i);const o=e.resources?e.resources[0]:"",a=xu(o);a&&(s=a.send)}}return!r||!s?(n(void 0,424),th):r.query(t,s,n)().abort}const nh="iconify2",Xi="iconify",Kv=Xi+"-count",rh=Xi+"-version",Xv=36e5,Zb=168;function Su(e,t){try{return e.getItem(t)}catch{}}function Qd(e,t,n){try{return e.setItem(t,n),!0}catch{}}function sh(e,t){try{e.removeItem(t)}catch{}}function ku(e,t){return Qd(e,Kv,t.toString())}function bu(e){return parseInt(Su(e,Kv))||0}const yl={local:!0,session:!0},Jv={local:new Set,session:new Set};let Vd=!1;function eC(e){Vd=e}let Mo=typeof window>"u"?{}:window;function Zv(e){const t=e+"Storage";try{if(Mo&&Mo[t]&&typeof Mo[t].length=="number")return Mo[t]}catch{}yl[e]=!1}function ey(e,t){const n=Zv(e);if(!n)return;const r=Su(n,rh);if(r!==nh){if(r){const a=bu(n);for(let l=0;l{const l=Xi+a.toString(),c=Su(n,l);if(typeof c=="string"){try{const d=JSON.parse(c);if(typeof d=="object"&&typeof d.cached=="number"&&d.cached>s&&typeof d.provider=="string"&&typeof d.data=="object"&&typeof d.data.prefix=="string"&&t(d,a))return!0}catch{}sh(n,l)}};let o=bu(n);for(let a=o-1;a>=0;a--)i(a)||(a===o-1?(o--,ku(n,o)):Jv[e].add(a))}function ty(){if(!Vd){eC(!0);for(const e in yl)ey(e,t=>{const n=t.data,r=t.provider,s=n.prefix,i=Hr(r,s);if(!Ud(i,n).length)return!1;const o=n.lastModified||-1;return i.lastModifiedCached=i.lastModifiedCached?Math.min(i.lastModifiedCached,o):o,!0})}}function tC(e,t){const n=e.lastModifiedCached;if(n&&n>=t)return n===t;if(e.lastModifiedCached=t,n)for(const r in yl)ey(r,s=>{const i=s.data;return s.provider!==e.provider||i.prefix!==e.prefix||i.lastModified===t});return!0}function nC(e,t){Vd||ty();function n(r){let s;if(!yl[r]||!(s=Zv(r)))return;const i=Jv[r];let o;if(i.size)i.delete(o=Array.from(i).shift());else if(o=bu(s),!ku(s,o+1))return;const a={cached:Math.floor(Date.now()/Xv),provider:e.provider,data:t};return Qd(s,Xi+o.toString(),JSON.stringify(a))}t.lastModified&&!tC(e,t.lastModified)||Object.keys(t.icons).length&&(t.not_found&&(t=Object.assign({},t),delete t.not_found),n("local")||n("session"))}function ih(){}function rC(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Qb(e)}))}function sC(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:n,prefix:r}=e,s=e.iconsToLoad;delete e.iconsToLoad;let i;if(!s||!(i=xu(n)))return;i.prepare(n,r,s).forEach(a=>{Jb(n,a,l=>{if(typeof l!="object")a.icons.forEach(c=>{e.missing.add(c)});else try{const c=Ud(e,l);if(!c.length)return;const d=e.pendingIcons;d&&c.forEach(f=>{d.delete(f)}),nC(e,l)}catch(c){console.error(c)}rC(e)})})}))}const iC=(e,t)=>{const n=Gb(e,!0,Qv()),r=Hb(n);if(!r.pending.length){let l=!0;return t&&setTimeout(()=>{l&&t(r.loaded,r.missing,r.pending,ih)}),()=>{l=!1}}const s=Object.create(null),i=[];let o,a;return r.pending.forEach(l=>{const{provider:c,prefix:d}=l;if(d===a&&c===o)return;o=c,a=d,i.push(Hr(c,d));const f=s[c]||(s[c]=Object.create(null));f[d]||(f[d]=[])}),r.pending.forEach(l=>{const{provider:c,prefix:d,name:f}=l,p=Hr(c,d),w=p.pendingIcons||(p.pendingIcons=new Set);w.has(f)||(w.add(f),s[c][d].push(f))}),i.forEach(l=>{const{provider:c,prefix:d}=l;s[c][d].length&&sC(l,s[c][d])}),t?qb(t,r,i):ih};function oC(e,t){const n={...e};for(const r in t){const s=t[r],i=typeof s;r in Vv?(s===null||s&&(i==="string"||i==="number"))&&(n[r]=s):i===typeof n[r]&&(n[r]=r==="rotate"?s%4:s)}return n}const aC=/[\s,]+/;function lC(e,t){t.split(aC).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function cC(e,t=0){const n=e.replace(/^-?[0-9.]*/,"");function r(s){for(;s<0;)s+=4;return s%4}if(n===""){const s=parseInt(e);return isNaN(s)?0:r(s)}else if(n!==e){let s=0;switch(n){case"%":s=25;break;case"deg":s=90}if(s){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i=i/s,i%1===0?r(i):0)}}return t}function uC(e,t){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in t)n+=" "+r+'="'+t[r]+'"';return'"+e+""}function dC(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function fC(e){return"data:image/svg+xml,"+dC(e)}function pC(e){return'url("'+fC(e)+'")'}let Ei;function hC(){try{Ei=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Ei=null}}function mC(e){return Ei===void 0&&hC(),Ei?Ei.createHTML(e):e}const ny={...qv,inline:!1},gC={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},vC={display:"inline-block"},Cu={backgroundColor:"currentColor"},ry={backgroundColor:"transparent"},oh={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},ah={WebkitMask:Cu,mask:Cu,background:ry};for(const e in ah){const t=ah[e];for(const n in oh)t[e+n]=oh[n]}const yC={...ny,inline:!0};function lh(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const wC=(e,t,n,r)=>{const s=n?yC:ny,i=oC(s,t),o=t.mode||"svg",a={},l=t.style||{},c={...o==="svg"?gC:{},ref:r};for(let v in t){const g=t[v];if(g!==void 0)switch(v){case"icon":case"style":case"children":case"onLoad":case"mode":case"_ref":case"_inline":break;case"inline":case"hFlip":case"vFlip":i[v]=g===!0||g==="true"||g===1;break;case"flip":typeof g=="string"&&lC(i,g);break;case"color":a.color=g;break;case"rotate":typeof g=="string"?i[v]=cC(g):typeof g=="number"&&(i[v]=g);break;case"ariaHidden":case"aria-hidden":g!==!0&&g!=="true"&&delete c["aria-hidden"];break;default:s[v]===void 0&&(c[v]=g)}}const d=Pb(e,i),f=d.attributes;if(i.inline&&(a.verticalAlign="-0.125em"),o==="svg"){c.style={...a,...l},Object.assign(c,f);let v=0,g=t.id;return typeof g=="string"&&(g=g.replace(/-/g,"_")),c.dangerouslySetInnerHTML={__html:mC(Db(d.body,g?()=>g+"ID"+v++:"iconifyReact"))},vn.createElement("svg",c)}const{body:p,width:w,height:h}=e,y=o==="mask"||(o==="bg"?!1:p.indexOf("currentColor")!==-1),S=uC(p,{...f,width:w+"",height:h+""});return c.style={...a,"--svg":pC(S),width:lh(f.width),height:lh(f.height),...vC,...y?Cu:ry,...l},vn.createElement("span",c)};Qv(!0);Lb("",Wb);if(typeof document<"u"&&typeof window<"u"){ty();const e=window;if(e.IconifyPreload!==void 0){const t=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof t=="object"&&t!==null&&(t instanceof Array?t:[t]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!Nb(r))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){const t=e.IconifyProviders;if(typeof t=="object"&&t!==null)for(let n in t){const r="IconifyProviders["+n+"] is invalid.";try{const s=t[n];if(typeof s!="object"||!s||s.resources===void 0)continue;Mb(n,s)||console.error(r)}catch{console.error(r)}}}}class sy extends vn.Component{constructor(t){super(t),this.state={icon:null}}_abortLoading(){this._loading&&(this._loading.abort(),this._loading=null)}_setData(t){this.state.icon!==t&&this.setState({icon:t})}_checkIcon(t){const n=this.state,r=this.props.icon;if(typeof r=="object"&&r!==null&&typeof r.body=="string"){this._icon="",this._abortLoading(),(t||n.icon===null)&&this._setData({data:r});return}let s;if(typeof r!="string"||(s=vl(r,!1,!0))===null){this._abortLoading(),this._setData(null);return}const i=Cb(s);if(!i){(!this._loading||this._loading.name!==r)&&(this._abortLoading(),this._icon="",this._setData(null),i!==null&&(this._loading={name:r,abort:iC([s],this._checkIcon.bind(this,!1))}));return}if(this._icon!==r||n.icon===null){this._abortLoading(),this._icon=r;const o=["iconify"];s.prefix!==""&&o.push("iconify--"+s.prefix),s.provider!==""&&o.push("iconify--"+s.provider),this._setData({data:i,classes:o}),this.props.onLoad&&this.props.onLoad(r)}}componentDidMount(){this._checkIcon(!1)}componentDidUpdate(t){t.icon!==this.props.icon&&this._checkIcon(!0)}componentWillUnmount(){this._abortLoading()}render(){const t=this.props,n=this.state.icon;if(n===null)return t.children?t.children:vn.createElement("span",{});let r=t;return n.classes&&(r={...t,className:(typeof t.className=="string"?t.className+" ":"")+n.classes.join(" ")}),wC({...zd,...n.data},r,t._inline,t._ref)}}const M=vn.forwardRef(function(t,n){const r={...t,_ref:n,_inline:!1};return vn.createElement(sy,r)});vn.forwardRef(function(t,n){const r={...t,_ref:n,_inline:!0};return vn.createElement(sy,r)});const xC=e=>{const t=e.replace("#",""),n=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),s=parseInt(t.substring(4,6),16);return`${n}, ${r}, ${s}`},Ji=e=>{document.documentElement.style.setProperty("--accent-color",e);const t=xC(e);document.documentElement.style.setProperty("--accent-color-rgb",t)},iy=()=>{const e=oe(r=>r.ui.theme),t=oe(r=>r.ui.accentColor),n=yt();return k.useEffect(()=>{document.documentElement.setAttribute("data-theme",e),Ji(t);const r=document.querySelector('meta[name="theme-color"]');r&&r.setAttribute("content",e==="dark"?"#1a1a1a":t)},[e,t]),k.useEffect(()=>{const r=window.matchMedia("(prefers-color-scheme: dark)"),s=i=>{localStorage.getItem("theme")||n(L1(i.matches?"dark":"light"))};return r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[n]),{theme:e,accentColor:t,toggleTheme:()=>n(D1())}},uo=()=>{const{theme:e,toggleTheme:t}=iy();return u.jsx("button",{id:"theme-toggle-btn",className:"theme-toggle-btn",onClick:t,title:"Переключить тему",children:u.jsx(M,{icon:e==="dark"?"mdi:weather-sunny":"mdi:weather-night"})})},SC=()=>{const[e,t]=k.useState(""),[n,r]=k.useState(""),[s,i]=k.useState(!1),o=wr(),a=yt(),{showNotification:l}=Gr(),c=oe(w=>w.auth.isAuthenticated),d=oe(w=>w.auth.userId),[f]=gS();k.useEffect(()=>{c&&o("/notes")},[c,o]),k.useEffect(()=>{f.get("error")==="invalid_password"&&l("Неверный пароль!","error")},[f,l]);const p=async w=>{var h;if(w.preventDefault(),!e.trim()||!n){l("Логин и пароль обязательны","error");return}i(!0);try{console.log("Attempting login...");const y=await Wr.login(e,n);if(console.log("Login response:",y),y.success){const S=await Wr.checkStatus(),v=S.userId;d&&d!==v&&(console.log(`[Login] User changed from ${d} to ${v}, clearing IndexedDB`),await D.clearAll()),a(Rd({userId:v,username:S.username})),l("Успешный вход!","success"),o("/notes")}else l(y.error||"Ошибка входа","error")}catch(y){console.error("Login error details:",y),console.error("Error response:",y.response),console.error("Error message:",y.message);let S="Ошибка соединения с сервером";y.response?S=((h=y.response.data)==null?void 0:h.error)||`Ошибка ${y.response.status}`:y.request?S="Сервер не отвечает. Проверьте, запущен ли backend на порту 3000":S=y.message||"Ошибка соединения с сервером",l(S,"error")}finally{i(!1)}};return u.jsxs("div",{className:"container",children:[u.jsx("header",{children:u.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[u.jsxs("span",{children:[u.jsx(M,{icon:"mdi:login"})," Вход в систему"]}),u.jsx(uo,{})]})}),u.jsxs("div",{className:"login-form",children:[u.jsxs("form",{id:"loginForm",onSubmit:p,children:[u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"username",children:"Логин:"}),u.jsx("input",{type:"text",id:"username",name:"username",value:e,onChange:w=>t(w.target.value),required:!0,placeholder:"Введите ваш логин"})]}),u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"password",children:"Пароль:"}),u.jsx("input",{type:"password",id:"password",name:"password",value:n,onChange:w=>r(w.target.value),required:!0,placeholder:"Введите пароль"})]}),u.jsx("button",{type:"submit",className:"btnSave",disabled:s,children:s?"Вход...":"Войти"})]}),u.jsxs("p",{className:"auth-link",children:["Нет аккаунта? ",u.jsx(Xg,{to:"/register",children:"Зарегистрируйтесь"})]})]})]})},kC=()=>{const[e,t]=k.useState(""),[n,r]=k.useState(""),[s,i]=k.useState(""),[o,a]=k.useState(!1),l=wr(),c=yt(),{showNotification:d}=Gr(),f=oe(w=>w.auth.isAuthenticated);k.useEffect(()=>{f&&l("/notes")},[f,l]);const p=async w=>{var h;if(w.preventDefault(),!e.trim()||!n||!s){d("Все поля обязательны","error");return}if(e.length<3){d("Логин должен быть не менее 3 символов","error");return}if(n.length<6){d("Пароль должен быть не менее 6 символов","error");return}if(n!==s){d("Пароли не совпадают","error");return}a(!0);try{console.log("Attempting registration...");const y=await Wr.register(e,n,s);if(console.log("Register response:",y),y.success){const S=await Wr.checkStatus(),v=S.userId;await D.clearAll(),c(Rd({userId:v,username:S.username})),d("Регистрация успешна!","success"),l("/notes")}else d(y.error||"Ошибка регистрации","error")}catch(y){console.error("Register error details:",y),console.error("Error response:",y.response),console.error("Error message:",y.message);let S="Ошибка соединения с сервером";y.response?S=((h=y.response.data)==null?void 0:h.error)||`Ошибка ${y.response.status}`:y.request?S="Сервер не отвечает. Проверьте, запущен ли backend на порту 3000":S=y.message||"Ошибка соединения с сервером",d(S,"error")}finally{a(!1)}};return u.jsxs("div",{className:"container",children:[u.jsx("header",{children:u.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[u.jsxs("span",{children:[u.jsx(M,{icon:"mdi:account-plus"})," Регистрация"]}),u.jsx(uo,{})]})}),u.jsxs("div",{className:"login-form",children:[u.jsxs("form",{id:"registerForm",onSubmit:p,children:[u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"username",children:"Логин:"}),u.jsx("input",{type:"text",id:"username",name:"username",value:e,onChange:w=>t(w.target.value),required:!0,placeholder:"Введите ваш логин (мин. 3 символа)"})]}),u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"password",children:"Пароль:"}),u.jsx("input",{type:"password",id:"password",name:"password",value:n,onChange:w=>r(w.target.value),required:!0,placeholder:"Введите пароль (мин. 6 символов)"})]}),u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"confirmPassword",children:"Подтвердите пароль:"}),u.jsx("input",{type:"password",id:"confirmPassword",name:"confirmPassword",value:s,onChange:w=>i(w.target.value),required:!0,placeholder:"Подтвердите пароль"})]}),u.jsx("button",{type:"submit",className:"btnSave",disabled:o,children:o?"Регистрация...":"Зарегистрироваться"})]}),u.jsxs("p",{className:"auth-link",children:["Уже есть аккаунт? ",u.jsx(Xg,{to:"/",children:"Войдите"})]})]})]})},Ct={getProfile:async()=>{const{data:e}=await Y.get("/user");return e},updateProfile:async e=>{const{data:t}=await Y.put("/user/profile",e);return t},uploadAvatar:async e=>{const t=new FormData;t.append("avatar",e);const{data:n}=await Y.post("/user/avatar",t,{headers:{"Content-Type":"multipart/form-data"}});return n},deleteAvatar:async()=>{await Y.delete("/user/avatar")},deleteAccount:async e=>{const{data:t}=await Y.delete("/user/delete-account",{data:{password:e}});return t},getAiSettings:async()=>{const{data:e}=await Y.get("/user/ai-settings");return e},updateAiSettings:async e=>{const{data:t}=await Y.put("/user/ai-settings",e);return t}};function ic(){return`temp-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function kr(e){return typeof e=="string"&&e.startsWith("temp-")}async function Eu(){if(!navigator.onLine)return!1;try{const e=new AbortController,t=setTimeout(()=>e.abort(),2e3),n=await fetch("/api/auth/status",{method:"GET",signal:e.signal,cache:"no-cache",credentials:"include"});return clearTimeout(t),n.ok}catch{return navigator.onLine}}function ch(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{typeof r.result=="string"?t(r.result):n(new Error("Failed to convert file to base64"))},r.onerror=n,r.readAsDataURL(e)})}function uh(e,t){const n=atob(e.split(",")[1]||e),r=new Array(n.length);for(let i=0;ia.timestamp-l.timestamp);for(const a of o){try{let l=a.noteId;i.has(a.noteId)&&(l=i.get(a.noteId),console.log(`[SyncService] Mapped temp ID ${a.noteId} to server ID ${l}`));const c={...a,noteId:l};await this.processSyncItem(c,i),await D.removeFromSyncQueue(a.id),r++,await this.updatePendingCount()}catch(l){console.error("[SyncService] Error processing item:",a,l),s++;const c={...a,retries:a.retries+1,lastError:l instanceof Error?l.message:"Unknown error"};if(c.retriessetTimeout(l,100))}if(console.log(`[SyncService] Sync complete. Success: ${r}, Errors: ${s}`),r>0){try{console.log("[SyncService] Performing full data sync...");const{data:a}=await Y.get("/notes"),l=a.map(p=>({...p,syncStatus:"synced"})),c=ee.getState().auth.userId,d=c?await D.getNotesByUserId(c):await D.getAllNotes(),f=new Set(l.map(p=>p.id));for(const p of d)typeof p.id=="string"&&p.id.startsWith("temp-")||f.has(p.id)||(console.log(`[SyncService] Removing deleted note from IndexedDB: ${p.id}`),await D.deleteNote(p.id));await D.saveNotes(l),console.log("[SyncService] Full data sync completed")}catch(a){console.error("[SyncService] Error during full data sync:",a)}ee.dispatch(bs({message:`Синхронизировано заметок: ${r}`,type:"success"}))}s>0&&s===o.length?ee.dispatch(ns("error")):ee.dispatch(ns("idle")),await this.updatePendingCount(),this.notifyListeners()}catch(n){console.error("[SyncService] Fatal sync error:",n),ee.dispatch(ns("error")),ee.dispatch(bs({message:"Ошибка синхронизации",type:"error"}))}finally{this.isSyncing=!1}}async processSyncItem(t,n){switch(console.log(`[SyncService] Processing ${t.type} for note ${t.noteId}`),t.type){case"create":await this.syncCreate(t,n);break;case"update":await this.syncUpdate(t,n);break;case"delete":await this.syncDelete(t);break;case"uploadImage":await this.syncUploadImage(t);break;case"uploadFile":await this.syncUploadFile(t);break;default:console.warn(`[SyncService] Unknown sync type: ${t.type}`)}}async syncCreate(t,n){const r=await D.getNote(t.noteId);if(!r)throw new Error("Note not found in local database");const{data:s}=await Y.post("/notes",{content:r.content,date:r.date,time:r.time});n&&typeof t.noteId=="string"&&n.set(t.noteId,s.id);const i={...s,images:await this.updateImageReferences(r,s),files:await this.updateFileReferences(r,s),syncStatus:"synced"};await D.deleteNote(t.noteId),await D.saveNote(i),ee.dispatch(Fe(i)),await this.syncAttachments(r,s.id)}async syncUpdate(t,n){if(typeof t.noteId=="string"&&t.noteId.startsWith("temp-")&&!(n!=null&&n.has(t.noteId))){await this.syncCreate(t,n);return}const r=await D.getNote(t.noteId);if(!r){console.warn(`[SyncService] Note ${t.noteId} not found, skipping update`);return}t.data.hasOwnProperty("is_pinned")?await Y.put(`/notes/${t.noteId}/pin`):t.data.hasOwnProperty("is_archived")?t.data.is_archived===1?await Y.put(`/notes/${t.noteId}/archive`):await Y.put(`/notes/${t.noteId}/unarchive`):await Y.put(`/notes/${t.noteId}`,{content:r.content,skipTimestamp:t.data.skipTimestamp});const s={...r,syncStatus:"synced"};await D.saveNote(s),ee.dispatch(Fe(s))}async syncDelete(t){if(typeof t.noteId=="string"&&t.noteId.startsWith("temp-")){await D.deleteNote(t.noteId);return}await Y.delete(`/notes/${t.noteId}`),await D.deleteNote(t.noteId)}async syncUploadImage(t){const n=await D.getNote(t.noteId);if(!n)throw new Error("Note not found");const r=t.data.imageId,s=n.images.find(f=>f.id===r);if(!s||!s.base64Data){console.warn("[SyncService] Temp image not found or no base64 data");return}const i=uh(s.base64Data,s.mime_type),o=new File([i],s.original_name,{type:s.mime_type}),a=new FormData;a.append("images",o);const{data:l}=await Y.post(`/notes/${t.noteId}/images`,a,{headers:{"Content-Type":"multipart/form-data"}}),c=n.images.map(f=>f.id===r?l[0]:f),d={...n,images:c,syncStatus:"synced"};await D.saveNote(d),ee.dispatch(Fe(d))}async syncUploadFile(t){const n=await D.getNote(t.noteId);if(!n)throw new Error("Note not found");const r=t.data.fileId,s=n.files.find(f=>f.id===r);if(!s||!s.base64Data){console.warn("[SyncService] Temp file not found or no base64 data");return}const i=uh(s.base64Data,s.mime_type),o=new File([i],s.original_name,{type:s.mime_type}),a=new FormData;a.append("files",o);const{data:l}=await Y.post(`/notes/${t.noteId}/files`,a,{headers:{"Content-Type":"multipart/form-data"}}),c=n.files.map(f=>f.id===r?l[0]:f),d={...n,files:c,syncStatus:"synced"};await D.saveNote(d),ee.dispatch(Fe(d))}async updateImageReferences(t,n){return t.images.some(s=>s.base64Data),t.images}async updateFileReferences(t,n){return t.files.some(s=>s.base64Data),t.files}async syncAttachments(t,n){if(t.images.some(s=>s.base64Data)||t.files.some(s=>s.base64Data)){for(const s of t.images)s.base64Data&&await D.addToSyncQueue({type:"uploadImage",noteId:n,data:{imageId:s.id},timestamp:Date.now(),retries:0});for(const s of t.files)s.base64Data&&await D.addToSyncQueue({type:"uploadFile",noteId:n,data:{fileId:s.id},timestamp:Date.now(),retries:0})}}scheduleRetry(){this.syncTimer&&clearTimeout(this.syncTimer),this.syncTimer=setTimeout(()=>{console.log("[SyncService] Retrying sync..."),this.startSync()},EC)}async updatePendingCount(){const t=await D.getPendingSyncCount();ee.dispatch(Od(t))}onSyncComplete(t){this.listeners.push(t)}notifyListeners(){this.listeners.forEach(t=>t())}stop(){this.syncTimer&&(clearTimeout(this.syncTimer),this.syncTimer=null),this.listeners=[]}}const $a=new NC,_C=({onFilterChange:e,onToggleSidebar:t})=>{const n=wr(),r=yt(),s=oe(w=>w.profile.user),i=oe(w=>w.notes.selectedDate),o=oe(w=>w.notes.selectedTag),a=oe(w=>w.notes.searchQuery),l=oe(w=>w.notes.offlineMode),c=oe(w=>w.notes.pendingSyncCount),d=oe(w=>w.ui.syncStatus);k.useEffect(()=>{f()},[]),k.useEffect(()=>{const w=!!(i||o||a);e==null||e(w)},[i,o,a,e]);const f=async()=>{try{const w=await Ct.getProfile();r(Dd(w));const h=w.accent_color||"#007bff";r(La(h)),Ji(h),(w.colored_icons!==void 0?w.colored_icons===1:!0)?document.body.classList.add("colored-icons"):document.body.classList.remove("colored-icons");try{const S=await Ct.getAiSettings();r(Ld(S))}catch(S){console.error("Ошибка загрузки AI настроек:",S)}}catch(w){console.error("Ошибка загрузки информации о пользователе:",w)}},p=async()=>{r(ns("syncing")),await $a.startSync()};return u.jsxs(u.Fragment,{children:[t&&u.jsx("button",{className:"mobile-menu-btn",onClick:t,children:u.jsx(M,{icon:"mdi:menu"})}),u.jsxs("header",{className:"notes-header",children:[u.jsx("div",{className:"notes-header-left",children:u.jsxs("span",{children:[u.jsx(M,{icon:"mdi:note-text"})," Мои заметки"]})}),u.jsxs("div",{className:"user-info",children:[l?u.jsx("div",{className:"offline-indicator",title:"Работаем в offline режиме",children:u.jsx(M,{icon:"mdi:wifi-off",style:{color:"#ff9800"}})}):c>0?u.jsx("button",{className:"sync-indicator",title:`Синхронизировать ${c} заметок`,onClick:p,disabled:d==="syncing",children:d==="syncing"?u.jsx(M,{icon:"mdi:loading",className:"spinning"}):u.jsxs(u.Fragment,{children:[u.jsx(M,{icon:"mdi:cloud-upload",style:{color:"#007bff"}}),u.jsx("span",{className:"sync-badge",children:c})]})}):d==="syncing"?u.jsx("div",{className:"sync-indicator",children:u.jsx(M,{icon:"mdi:loading",className:"spinning",style:{color:"#007bff"}})}):null,s!=null&&s.avatar?u.jsx("div",{className:"user-avatar-mini",style:{display:"block"},title:"Перейти в профиль",onClick:()=>n("/profile"),children:u.jsx("img",{src:s.avatar,alt:"Аватар",loading:"lazy"})}):u.jsx("div",{className:"user-avatar-mini user-avatar-placeholder-mini",style:{display:"flex"},title:"Перейти в профиль",onClick:()=>n("/profile"),children:u.jsx(M,{icon:"mdi:account"})}),u.jsx(uo,{}),u.jsx("button",{className:"settings-icon-btn",title:"Настройки",onClick:()=>n("/settings"),children:u.jsx(M,{icon:"mdi:cog"})})]})]})]})};function Fa(e){"@babel/helpers - typeof";return Fa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fa(e)}function sn(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function ke(e,t){if(t.length1?"s":"")+" required, but only "+t.length+" present")}function Be(e){ke(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||Fa(e)==="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):((typeof e=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function oy(e,t){ke(2,arguments);var n=Be(e),r=sn(t);if(isNaN(r))return new Date(NaN);if(!r)return n;var s=n.getDate(),i=new Date(n.getTime());i.setMonth(n.getMonth()+r+1,0);var o=i.getDate();return s>=o?i:(n.setFullYear(i.getFullYear(),i.getMonth(),s),n)}function TC(e,t){ke(2,arguments);var n=Be(e).getTime(),r=sn(t);return new Date(n+r)}var jC={};function Bs(){return jC}function PC(e,t){var n,r,s,i,o,a,l,c;ke(1,arguments);var d=Bs(),f=sn((n=(r=(s=(i=t==null?void 0:t.weekStartsOn)!==null&&i!==void 0?i:t==null||(o=t.locale)===null||o===void 0||(a=o.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&s!==void 0?s:d.weekStartsOn)!==null&&r!==void 0?r:(l=d.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=Be(e),w=p.getDay(),h=(w=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=Be(e),w=p.getDay(),h=(w=s.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function BC(e){ke(1,arguments);var t=cy(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var r=za(n);return r}var WC=6048e5;function HC(e){ke(1,arguments);var t=Be(e),n=za(t).getTime()-BC(t).getTime();return Math.round(n/WC)+1}function Os(e,t){var n,r,s,i,o,a,l,c;ke(1,arguments);var d=Bs(),f=sn((n=(r=(s=(i=t==null?void 0:t.weekStartsOn)!==null&&i!==void 0?i:t==null||(o=t.locale)===null||o===void 0||(a=o.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&s!==void 0?s:d.weekStartsOn)!==null&&r!==void 0?r:(l=d.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=Be(e),w=p.getUTCDay(),h=(w=1&&w<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=new Date(0);h.setUTCFullYear(f+1,0,w),h.setUTCHours(0,0,0,0);var y=Os(h,t),S=new Date(0);S.setUTCFullYear(f,0,w),S.setUTCHours(0,0,0,0);var v=Os(S,t);return d.getTime()>=y.getTime()?f+1:d.getTime()>=v.getTime()?f:f-1}function QC(e,t){var n,r,s,i,o,a,l,c;ke(1,arguments);var d=Bs(),f=sn((n=(r=(s=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(o=t.locale)===null||o===void 0||(a=o.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&s!==void 0?s:d.firstWeekContainsDate)!==null&&r!==void 0?r:(l=d.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1),p=uy(e,t),w=new Date(0);w.setUTCFullYear(p,0,f),w.setUTCHours(0,0,0,0);var h=Os(w,t);return h}var VC=6048e5;function qC(e,t){ke(1,arguments);var n=Be(e),r=Os(n,t).getTime()-QC(n,t).getTime();return Math.round(r/VC)+1}function ye(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length0?r:1-r;return ye(n==="yy"?s%100:s,n.length)},M:function(t,n){var r=t.getUTCMonth();return n==="M"?String(r+1):ye(r+1,2)},d:function(t,n){return ye(t.getUTCDate(),n.length)},a:function(t,n){var r=t.getUTCHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h:function(t,n){return ye(t.getUTCHours()%12||12,n.length)},H:function(t,n){return ye(t.getUTCHours(),n.length)},m:function(t,n){return ye(t.getUTCMinutes(),n.length)},s:function(t,n){return ye(t.getUTCSeconds(),n.length)},S:function(t,n){var r=n.length,s=t.getUTCMilliseconds(),i=Math.floor(s*Math.pow(10,r-3));return ye(i,n.length)}},ts={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},GC={G:function(t,n,r){var s=t.getUTCFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return r.era(s,{width:"abbreviated"});case"GGGGG":return r.era(s,{width:"narrow"});case"GGGG":default:return r.era(s,{width:"wide"})}},y:function(t,n,r){if(n==="yo"){var s=t.getUTCFullYear(),i=s>0?s:1-s;return r.ordinalNumber(i,{unit:"year"})}return Gn.y(t,n)},Y:function(t,n,r,s){var i=uy(t,s),o=i>0?i:1-i;if(n==="YY"){var a=o%100;return ye(a,2)}return n==="Yo"?r.ordinalNumber(o,{unit:"year"}):ye(o,n.length)},R:function(t,n){var r=cy(t);return ye(r,n.length)},u:function(t,n){var r=t.getUTCFullYear();return ye(r,n.length)},Q:function(t,n,r){var s=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"Q":return String(s);case"QQ":return ye(s,2);case"Qo":return r.ordinalNumber(s,{unit:"quarter"});case"QQQ":return r.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(s,{width:"wide",context:"formatting"})}},q:function(t,n,r){var s=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"q":return String(s);case"qq":return ye(s,2);case"qo":return r.ordinalNumber(s,{unit:"quarter"});case"qqq":return r.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(s,{width:"wide",context:"standalone"})}},M:function(t,n,r){var s=t.getUTCMonth();switch(n){case"M":case"MM":return Gn.M(t,n);case"Mo":return r.ordinalNumber(s+1,{unit:"month"});case"MMM":return r.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(s,{width:"wide",context:"formatting"})}},L:function(t,n,r){var s=t.getUTCMonth();switch(n){case"L":return String(s+1);case"LL":return ye(s+1,2);case"Lo":return r.ordinalNumber(s+1,{unit:"month"});case"LLL":return r.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(s,{width:"wide",context:"standalone"})}},w:function(t,n,r,s){var i=qC(t,s);return n==="wo"?r.ordinalNumber(i,{unit:"week"}):ye(i,n.length)},I:function(t,n,r){var s=HC(t);return n==="Io"?r.ordinalNumber(s,{unit:"week"}):ye(s,n.length)},d:function(t,n,r){return n==="do"?r.ordinalNumber(t.getUTCDate(),{unit:"date"}):Gn.d(t,n)},D:function(t,n,r){var s=UC(t);return n==="Do"?r.ordinalNumber(s,{unit:"dayOfYear"}):ye(s,n.length)},E:function(t,n,r){var s=t.getUTCDay();switch(n){case"E":case"EE":case"EEE":return r.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(s,{width:"short",context:"formatting"});case"EEEE":default:return r.day(s,{width:"wide",context:"formatting"})}},e:function(t,n,r,s){var i=t.getUTCDay(),o=(i-s.weekStartsOn+8)%7||7;switch(n){case"e":return String(o);case"ee":return ye(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(i,{width:"short",context:"formatting"});case"eeee":default:return r.day(i,{width:"wide",context:"formatting"})}},c:function(t,n,r,s){var i=t.getUTCDay(),o=(i-s.weekStartsOn+8)%7||7;switch(n){case"c":return String(o);case"cc":return ye(o,n.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(i,{width:"narrow",context:"standalone"});case"cccccc":return r.day(i,{width:"short",context:"standalone"});case"cccc":default:return r.day(i,{width:"wide",context:"standalone"})}},i:function(t,n,r){var s=t.getUTCDay(),i=s===0?7:s;switch(n){case"i":return String(i);case"ii":return ye(i,n.length);case"io":return r.ordinalNumber(i,{unit:"day"});case"iii":return r.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(s,{width:"short",context:"formatting"});case"iiii":default:return r.day(s,{width:"wide",context:"formatting"})}},a:function(t,n,r){var s=t.getUTCHours(),i=s/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,n,r){var s=t.getUTCHours(),i;switch(s===12?i=ts.noon:s===0?i=ts.midnight:i=s/12>=1?"pm":"am",n){case"b":case"bb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,n,r){var s=t.getUTCHours(),i;switch(s>=17?i=ts.evening:s>=12?i=ts.afternoon:s>=4?i=ts.morning:i=ts.night,n){case"B":case"BB":case"BBB":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,n,r){if(n==="ho"){var s=t.getUTCHours()%12;return s===0&&(s=12),r.ordinalNumber(s,{unit:"hour"})}return Gn.h(t,n)},H:function(t,n,r){return n==="Ho"?r.ordinalNumber(t.getUTCHours(),{unit:"hour"}):Gn.H(t,n)},K:function(t,n,r){var s=t.getUTCHours()%12;return n==="Ko"?r.ordinalNumber(s,{unit:"hour"}):ye(s,n.length)},k:function(t,n,r){var s=t.getUTCHours();return s===0&&(s=24),n==="ko"?r.ordinalNumber(s,{unit:"hour"}):ye(s,n.length)},m:function(t,n,r){return n==="mo"?r.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):Gn.m(t,n)},s:function(t,n,r){return n==="so"?r.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):Gn.s(t,n)},S:function(t,n){return Gn.S(t,n)},X:function(t,n,r,s){var i=s._originalDate||t,o=i.getTimezoneOffset();if(o===0)return"Z";switch(n){case"X":return hh(o);case"XXXX":case"XX":return _r(o);case"XXXXX":case"XXX":default:return _r(o,":")}},x:function(t,n,r,s){var i=s._originalDate||t,o=i.getTimezoneOffset();switch(n){case"x":return hh(o);case"xxxx":case"xx":return _r(o);case"xxxxx":case"xxx":default:return _r(o,":")}},O:function(t,n,r,s){var i=s._originalDate||t,o=i.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+ph(o,":");case"OOOO":default:return"GMT"+_r(o,":")}},z:function(t,n,r,s){var i=s._originalDate||t,o=i.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+ph(o,":");case"zzzz":default:return"GMT"+_r(o,":")}},t:function(t,n,r,s){var i=s._originalDate||t,o=Math.floor(i.getTime()/1e3);return ye(o,n.length)},T:function(t,n,r,s){var i=s._originalDate||t,o=i.getTime();return ye(o,n.length)}};function ph(e,t){var n=e>0?"-":"+",r=Math.abs(e),s=Math.floor(r/60),i=r%60;if(i===0)return n+String(s);var o=t;return n+String(s)+o+ye(i,2)}function hh(e,t){if(e%60===0){var n=e>0?"-":"+";return n+ye(Math.abs(e)/60,2)}return _r(e,t)}function _r(e,t){var n=t||"",r=e>0?"-":"+",s=Math.abs(e),i=ye(Math.floor(s/60),2),o=ye(s%60,2);return r+i+n+o}var mh=function(t,n){switch(t){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},dy=function(t,n){switch(t){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},YC=function(t,n){var r=t.match(/(P+)(p+)?/)||[],s=r[1],i=r[2];if(!i)return mh(t,n);var o;switch(s){case"P":o=n.dateTime({width:"short"});break;case"PP":o=n.dateTime({width:"medium"});break;case"PPP":o=n.dateTime({width:"long"});break;case"PPPP":default:o=n.dateTime({width:"full"});break}return o.replace("{{date}}",mh(s,n)).replace("{{time}}",dy(i,n))},KC={p:dy,P:YC},XC=["D","DD"],JC=["YY","YYYY"];function ZC(e){return XC.indexOf(e)!==-1}function eE(e){return JC.indexOf(e)!==-1}function gh(e,t,n){if(e==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var tE={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},nE=function(t,n,r){var s,i=tE[t];return typeof i=="string"?s=i:n===1?s=i.one:s=i.other.replace("{{count}}",n.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+s:s+" ago":s};function Cs(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,r=e.formats[n]||e.formats[e.defaultWidth];return r}}var rE={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},sE={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},iE={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},oE={date:Cs({formats:rE,defaultWidth:"full"}),time:Cs({formats:sE,defaultWidth:"full"}),dateTime:Cs({formats:iE,defaultWidth:"full"})},aE={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},lE=function(t,n,r,s){return aE[t]};function _n(e){return function(t,n){var r=n!=null&&n.context?String(n.context):"standalone",s;if(r==="formatting"&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,o=n!=null&&n.width?String(n.width):i;s=e.formattingValues[o]||e.formattingValues[i]}else{var a=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;s=e.values[l]||e.values[a]}var c=e.argumentCallback?e.argumentCallback(t):t;return s[c]}}var cE={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},uE={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},dE={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},fE={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},pE={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},hE={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},mE=function(t,n){var r=Number(t),s=r%100;if(s>20||s<10)switch(s%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},gE={ordinalNumber:mE,era:_n({values:cE,defaultWidth:"wide"}),quarter:_n({values:uE,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:_n({values:dE,defaultWidth:"wide"}),day:_n({values:fE,defaultWidth:"wide"}),dayPeriod:_n({values:pE,defaultWidth:"wide",formattingValues:hE,defaultFormattingWidth:"wide"})};function Tn(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.width,s=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(s);if(!i)return null;var o=i[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(a)?yE(a,function(f){return f.test(o)}):vE(a,function(f){return f.test(o)}),c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;var d=t.slice(o.length);return{value:c,rest:d}}}function vE(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function yE(e,t){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=t.match(e.matchPattern);if(!r)return null;var s=r[0],i=t.match(e.parsePattern);if(!i)return null;var o=e.valueCallback?e.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;var a=t.slice(s.length);return{value:o,rest:a}}}var wE=/^(\d+)(th|st|nd|rd)?/i,xE=/\d+/i,SE={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},kE={any:[/^b/i,/^(a|c)/i]},bE={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},CE={any:[/1/i,/2/i,/3/i,/4/i]},EE={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},NE={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},_E={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},TE={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},jE={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},PE={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},IE={ordinalNumber:fy({matchPattern:wE,parsePattern:xE,valueCallback:function(t){return parseInt(t,10)}}),era:Tn({matchPatterns:SE,defaultMatchWidth:"wide",parsePatterns:kE,defaultParseWidth:"any"}),quarter:Tn({matchPatterns:bE,defaultMatchWidth:"wide",parsePatterns:CE,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:Tn({matchPatterns:EE,defaultMatchWidth:"wide",parsePatterns:NE,defaultParseWidth:"any"}),day:Tn({matchPatterns:_E,defaultMatchWidth:"wide",parsePatterns:TE,defaultParseWidth:"any"}),dayPeriod:Tn({matchPatterns:jE,defaultMatchWidth:"any",parsePatterns:PE,defaultParseWidth:"any"})},RE={code:"en-US",formatDistance:nE,formatLong:oE,formatRelative:lE,localize:gE,match:IE,options:{weekStartsOn:0,firstWeekContainsDate:1}},OE=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,DE=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,LE=/^'([^]*?)'?$/,ME=/''/g,AE=/[a-zA-Z]/;function fi(e,t,n){var r,s,i,o,a,l,c,d,f,p,w,h,y,S,v,g,x,C;ke(2,arguments);var T=String(t),b=Bs(),_=(r=(s=n==null?void 0:n.locale)!==null&&s!==void 0?s:b.locale)!==null&&r!==void 0?r:RE,P=sn((i=(o=(a=(l=n==null?void 0:n.firstWeekContainsDate)!==null&&l!==void 0?l:n==null||(c=n.locale)===null||c===void 0||(d=c.options)===null||d===void 0?void 0:d.firstWeekContainsDate)!==null&&a!==void 0?a:b.firstWeekContainsDate)!==null&&o!==void 0?o:(f=b.locale)===null||f===void 0||(p=f.options)===null||p===void 0?void 0:p.firstWeekContainsDate)!==null&&i!==void 0?i:1);if(!(P>=1&&P<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var I=sn((w=(h=(y=(S=n==null?void 0:n.weekStartsOn)!==null&&S!==void 0?S:n==null||(v=n.locale)===null||v===void 0||(g=v.options)===null||g===void 0?void 0:g.weekStartsOn)!==null&&y!==void 0?y:b.weekStartsOn)!==null&&h!==void 0?h:(x=b.locale)===null||x===void 0||(C=x.options)===null||C===void 0?void 0:C.weekStartsOn)!==null&&w!==void 0?w:0);if(!(I>=0&&I<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!_.localize)throw new RangeError("locale must contain localize property");if(!_.formatLong)throw new RangeError("locale must contain formatLong property");var R=Be(e);if(!DC(R))throw new RangeError("Invalid time value");var q=IC(R),se=FC(R,q),J={firstWeekContainsDate:P,weekStartsOn:I,locale:_,_originalDate:R},ne=T.match(DE).map(function(A){var Q=A[0];if(Q==="p"||Q==="P"){var re=KC[Q];return re(A,_.formatLong)}return A}).join("").match(OE).map(function(A){if(A==="''")return"'";var Q=A[0];if(Q==="'")return $E(A);var re=GC[Q];if(re)return!(n!=null&&n.useAdditionalWeekYearTokens)&&eE(A)&&gh(A,t,String(e)),!(n!=null&&n.useAdditionalDayOfYearTokens)&&ZC(A)&&gh(A,t,String(e)),re(se,A,_.localize,J);if(Q.match(AE))throw new RangeError("Format string contains an unescaped latin alphabet character `"+Q+"`");return A}).join("");return ne}function $E(e){var t=e.match(LE);return t?t[1].replace(ME,"'"):e}function FE(e,t){ke(2,arguments);var n=Be(e),r=Be(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function zE(e,t){var n;ke(1,arguments);var r=sn((n=void 0)!==null&&n!==void 0?n:2);if(r!==2&&r!==1&&r!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(!(typeof e=="string"||Object.prototype.toString.call(e)==="[object String]"))return new Date(NaN);var s=HE(e),i;if(s.date){var o=QE(s.date,r);i=VE(o.restDateString,o.year)}if(!i||isNaN(i.getTime()))return new Date(NaN);var a=i.getTime(),l=0,c;if(s.time&&(l=qE(s.time),isNaN(l)))return new Date(NaN);if(s.timezone){if(c=GE(s.timezone),isNaN(c))return new Date(NaN)}else{var d=new Date(a+l),f=new Date(0);return f.setFullYear(d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate()),f.setHours(d.getUTCHours(),d.getUTCMinutes(),d.getUTCSeconds(),d.getUTCMilliseconds()),f}return new Date(a+l+c)}var Ao={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},UE=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,BE=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,WE=/^([+-])(\d{2})(?::?(\d{2}))?$/;function HE(e){var t={},n=e.split(Ao.dateTimeDelimiter),r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],Ao.timeZoneDelimiter.test(t.date)&&(t.date=e.split(Ao.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){var s=Ao.timezone.exec(r);s?(t.time=r.replace(s[1],""),t.timezone=s[1]):t.time=r}return t}function QE(e,t){var n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),r=e.match(n);if(!r)return{year:NaN,restDateString:""};var s=r[1]?parseInt(r[1]):null,i=r[2]?parseInt(r[2]):null;return{year:i===null?s:i*100,restDateString:e.slice((r[1]||r[2]).length)}}function VE(e,t){if(t===null)return new Date(NaN);var n=e.match(UE);if(!n)return new Date(NaN);var r=!!n[4],s=ni(n[1]),i=ni(n[2])-1,o=ni(n[3]),a=ni(n[4]),l=ni(n[5])-1;if(r)return ZE(t,a,l)?YE(t,a,l):new Date(NaN);var c=new Date(0);return!XE(t,i,o)||!JE(t,s)?new Date(NaN):(c.setUTCFullYear(t,i,Math.max(s,o)),c)}function ni(e){return e?parseInt(e):1}function qE(e){var t=e.match(BE);if(!t)return NaN;var n=oc(t[1]),r=oc(t[2]),s=oc(t[3]);return eN(n,r,s)?n*ly+r*ay+s*1e3:NaN}function oc(e){return e&&parseFloat(e.replace(",","."))||0}function GE(e){if(e==="Z")return 0;var t=e.match(WE);if(!t)return 0;var n=t[1]==="+"?-1:1,r=parseInt(t[2]),s=t[3]&&parseInt(t[3])||0;return tN(r,s)?n*(r*ly+s*ay):NaN}function YE(e,t,n){var r=new Date(0);r.setUTCFullYear(e,0,4);var s=r.getUTCDay()||7,i=(t-1)*7+n+1-s;return r.setUTCDate(r.getUTCDate()+i),r}var KE=[31,null,31,30,31,30,31,31,30,31,30,31];function py(e){return e%400===0||e%4===0&&e%100!==0}function XE(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(KE[t]||(py(e)?29:28))}function JE(e,t){return t>=1&&t<=(py(e)?366:365)}function ZE(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function eN(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function tN(e,t){return t>=0&&t<=59}function nN(e,t){ke(2,arguments);var n=sn(t);return oy(e,-n)}function vh(e,t,n){ke(2,arguments);var r=Os(e,n),s=Os(t,n);return r.getTime()===s.getTime()}function ri(e,t){if(e.one!==void 0&&t===1)return e.one;var n=t%10,r=t%100;return n===1&&r!==11?e.singularNominative.replace("{{count}}",String(t)):n>=2&&n<=4&&(r<10||r>20)?e.singularGenitive.replace("{{count}}",String(t)):e.pluralGenitive.replace("{{count}}",String(t))}function St(e){return function(t,n){return n!=null&&n.addSuffix?n.comparison&&n.comparison>0?e.future?ri(e.future,t):"через "+ri(e.regular,t):e.past?ri(e.past,t):ri(e.regular,t)+" назад":ri(e.regular,t)}}var rN={lessThanXSeconds:St({regular:{one:"меньше секунды",singularNominative:"меньше {{count}} секунды",singularGenitive:"меньше {{count}} секунд",pluralGenitive:"меньше {{count}} секунд"},future:{one:"меньше, чем через секунду",singularNominative:"меньше, чем через {{count}} секунду",singularGenitive:"меньше, чем через {{count}} секунды",pluralGenitive:"меньше, чем через {{count}} секунд"}}),xSeconds:St({regular:{singularNominative:"{{count}} секунда",singularGenitive:"{{count}} секунды",pluralGenitive:"{{count}} секунд"},past:{singularNominative:"{{count}} секунду назад",singularGenitive:"{{count}} секунды назад",pluralGenitive:"{{count}} секунд назад"},future:{singularNominative:"через {{count}} секунду",singularGenitive:"через {{count}} секунды",pluralGenitive:"через {{count}} секунд"}}),halfAMinute:function(t,n){return n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"через полминуты":"полминуты назад":"полминуты"},lessThanXMinutes:St({regular:{one:"меньше минуты",singularNominative:"меньше {{count}} минуты",singularGenitive:"меньше {{count}} минут",pluralGenitive:"меньше {{count}} минут"},future:{one:"меньше, чем через минуту",singularNominative:"меньше, чем через {{count}} минуту",singularGenitive:"меньше, чем через {{count}} минуты",pluralGenitive:"меньше, чем через {{count}} минут"}}),xMinutes:St({regular:{singularNominative:"{{count}} минута",singularGenitive:"{{count}} минуты",pluralGenitive:"{{count}} минут"},past:{singularNominative:"{{count}} минуту назад",singularGenitive:"{{count}} минуты назад",pluralGenitive:"{{count}} минут назад"},future:{singularNominative:"через {{count}} минуту",singularGenitive:"через {{count}} минуты",pluralGenitive:"через {{count}} минут"}}),aboutXHours:St({regular:{singularNominative:"около {{count}} часа",singularGenitive:"около {{count}} часов",pluralGenitive:"около {{count}} часов"},future:{singularNominative:"приблизительно через {{count}} час",singularGenitive:"приблизительно через {{count}} часа",pluralGenitive:"приблизительно через {{count}} часов"}}),xHours:St({regular:{singularNominative:"{{count}} час",singularGenitive:"{{count}} часа",pluralGenitive:"{{count}} часов"}}),xDays:St({regular:{singularNominative:"{{count}} день",singularGenitive:"{{count}} дня",pluralGenitive:"{{count}} дней"}}),aboutXWeeks:St({regular:{singularNominative:"около {{count}} недели",singularGenitive:"около {{count}} недель",pluralGenitive:"около {{count}} недель"},future:{singularNominative:"приблизительно через {{count}} неделю",singularGenitive:"приблизительно через {{count}} недели",pluralGenitive:"приблизительно через {{count}} недель"}}),xWeeks:St({regular:{singularNominative:"{{count}} неделя",singularGenitive:"{{count}} недели",pluralGenitive:"{{count}} недель"}}),aboutXMonths:St({regular:{singularNominative:"около {{count}} месяца",singularGenitive:"около {{count}} месяцев",pluralGenitive:"около {{count}} месяцев"},future:{singularNominative:"приблизительно через {{count}} месяц",singularGenitive:"приблизительно через {{count}} месяца",pluralGenitive:"приблизительно через {{count}} месяцев"}}),xMonths:St({regular:{singularNominative:"{{count}} месяц",singularGenitive:"{{count}} месяца",pluralGenitive:"{{count}} месяцев"}}),aboutXYears:St({regular:{singularNominative:"около {{count}} года",singularGenitive:"около {{count}} лет",pluralGenitive:"около {{count}} лет"},future:{singularNominative:"приблизительно через {{count}} год",singularGenitive:"приблизительно через {{count}} года",pluralGenitive:"приблизительно через {{count}} лет"}}),xYears:St({regular:{singularNominative:"{{count}} год",singularGenitive:"{{count}} года",pluralGenitive:"{{count}} лет"}}),overXYears:St({regular:{singularNominative:"больше {{count}} года",singularGenitive:"больше {{count}} лет",pluralGenitive:"больше {{count}} лет"},future:{singularNominative:"больше, чем через {{count}} год",singularGenitive:"больше, чем через {{count}} года",pluralGenitive:"больше, чем через {{count}} лет"}}),almostXYears:St({regular:{singularNominative:"почти {{count}} год",singularGenitive:"почти {{count}} года",pluralGenitive:"почти {{count}} лет"},future:{singularNominative:"почти через {{count}} год",singularGenitive:"почти через {{count}} года",pluralGenitive:"почти через {{count}} лет"}})},sN=function(t,n,r){return rN[t](n,r)},iN={full:"EEEE, d MMMM y 'г.'",long:"d MMMM y 'г.'",medium:"d MMM y 'г.'",short:"dd.MM.y"},oN={full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},aN={any:"{{date}}, {{time}}"},lN={date:Cs({formats:iN,defaultWidth:"full"}),time:Cs({formats:oN,defaultWidth:"full"}),dateTime:Cs({formats:aN,defaultWidth:"any"})},qd=["воскресенье","понедельник","вторник","среду","четверг","пятницу","субботу"];function cN(e){var t=qd[e];switch(e){case 0:return"'в прошлое "+t+" в' p";case 1:case 2:case 4:return"'в прошлый "+t+" в' p";case 3:case 5:case 6:return"'в прошлую "+t+" в' p"}}function yh(e){var t=qd[e];return e===2?"'во "+t+" в' p":"'в "+t+" в' p"}function uN(e){var t=qd[e];switch(e){case 0:return"'в следующее "+t+" в' p";case 1:case 2:case 4:return"'в следующий "+t+" в' p";case 3:case 5:case 6:return"'в следующую "+t+" в' p"}}var dN={lastWeek:function(t,n,r){var s=t.getUTCDay();return vh(t,n,r)?yh(s):cN(s)},yesterday:"'вчера в' p",today:"'сегодня в' p",tomorrow:"'завтра в' p",nextWeek:function(t,n,r){var s=t.getUTCDay();return vh(t,n,r)?yh(s):uN(s)},other:"P"},fN=function(t,n,r,s){var i=dN[t];return typeof i=="function"?i(n,r,s):i},pN={narrow:["до н.э.","н.э."],abbreviated:["до н. э.","н. э."],wide:["до нашей эры","нашей эры"]},hN={narrow:["1","2","3","4"],abbreviated:["1-й кв.","2-й кв.","3-й кв.","4-й кв."],wide:["1-й квартал","2-й квартал","3-й квартал","4-й квартал"]},mN={narrow:["Я","Ф","М","А","М","И","И","А","С","О","Н","Д"],abbreviated:["янв.","фев.","март","апр.","май","июнь","июль","авг.","сент.","окт.","нояб.","дек."],wide:["январь","февраль","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь"]},gN={narrow:["Я","Ф","М","А","М","И","И","А","С","О","Н","Д"],abbreviated:["янв.","фев.","мар.","апр.","мая","июн.","июл.","авг.","сент.","окт.","нояб.","дек."],wide:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"]},vN={narrow:["В","П","В","С","Ч","П","С"],short:["вс","пн","вт","ср","чт","пт","сб"],abbreviated:["вск","пнд","втр","срд","чтв","птн","суб"],wide:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"]},yN={narrow:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утро",afternoon:"день",evening:"веч.",night:"ночь"},abbreviated:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утро",afternoon:"день",evening:"веч.",night:"ночь"},wide:{am:"ДП",pm:"ПП",midnight:"полночь",noon:"полдень",morning:"утро",afternoon:"день",evening:"вечер",night:"ночь"}},wN={narrow:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утра",afternoon:"дня",evening:"веч.",night:"ночи"},abbreviated:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утра",afternoon:"дня",evening:"веч.",night:"ночи"},wide:{am:"ДП",pm:"ПП",midnight:"полночь",noon:"полдень",morning:"утра",afternoon:"дня",evening:"вечера",night:"ночи"}},xN=function(t,n){var r=Number(t),s=n==null?void 0:n.unit,i;return s==="date"?i="-е":s==="week"||s==="minute"||s==="second"?i="-я":i="-й",r+i},SN={ordinalNumber:xN,era:_n({values:pN,defaultWidth:"wide"}),quarter:_n({values:hN,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:_n({values:mN,defaultWidth:"wide",formattingValues:gN,defaultFormattingWidth:"wide"}),day:_n({values:vN,defaultWidth:"wide"}),dayPeriod:_n({values:yN,defaultWidth:"any",formattingValues:wN,defaultFormattingWidth:"wide"})},kN=/^(\d+)(-?(е|я|й|ое|ье|ая|ья|ый|ой|ий|ый))?/i,bN=/\d+/i,CN={narrow:/^((до )?н\.?\s?э\.?)/i,abbreviated:/^((до )?н\.?\s?э\.?)/i,wide:/^(до нашей эры|нашей эры|наша эра)/i},EN={any:[/^д/i,/^н/i]},NN={narrow:/^[1234]/i,abbreviated:/^[1234](-?[ыои]?й?)? кв.?/i,wide:/^[1234](-?[ыои]?й?)? квартал/i},_N={any:[/1/i,/2/i,/3/i,/4/i]},TN={narrow:/^[яфмаисонд]/i,abbreviated:/^(янв|фев|март?|апр|ма[йя]|июн[ья]?|июл[ья]?|авг|сент?|окт|нояб?|дек)\.?/i,wide:/^(январ[ья]|феврал[ья]|марта?|апрел[ья]|ма[йя]|июн[ья]|июл[ья]|августа?|сентябр[ья]|октябр[ья]|октябр[ья]|ноябр[ья]|декабр[ья])/i},jN={narrow:[/^я/i,/^ф/i,/^м/i,/^а/i,/^м/i,/^и/i,/^и/i,/^а/i,/^с/i,/^о/i,/^н/i,/^я/i],any:[/^я/i,/^ф/i,/^мар/i,/^ап/i,/^ма[йя]/i,/^июн/i,/^июл/i,/^ав/i,/^с/i,/^о/i,/^н/i,/^д/i]},PN={narrow:/^[впсч]/i,short:/^(вс|во|пн|по|вт|ср|чт|че|пт|пя|сб|су)\.?/i,abbreviated:/^(вск|вос|пнд|пон|втр|вто|срд|сре|чтв|чет|птн|пят|суб).?/i,wide:/^(воскресень[ея]|понедельника?|вторника?|сред[аы]|четверга?|пятниц[аы]|суббот[аы])/i},IN={narrow:[/^в/i,/^п/i,/^в/i,/^с/i,/^ч/i,/^п/i,/^с/i],any:[/^в[ос]/i,/^п[он]/i,/^в/i,/^ср/i,/^ч/i,/^п[ят]/i,/^с[уб]/i]},RN={narrow:/^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,abbreviated:/^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,wide:/^([дп]п|полночь|полдень|утр[оа]|день|дня|вечера?|ноч[ьи])/i},ON={any:{am:/^дп/i,pm:/^пп/i,midnight:/^полн/i,noon:/^полд/i,morning:/^у/i,afternoon:/^д[ен]/i,evening:/^в/i,night:/^н/i}},DN={ordinalNumber:fy({matchPattern:kN,parsePattern:bN,valueCallback:function(t){return parseInt(t,10)}}),era:Tn({matchPatterns:CN,defaultMatchWidth:"wide",parsePatterns:EN,defaultParseWidth:"any"}),quarter:Tn({matchPatterns:NN,defaultMatchWidth:"wide",parsePatterns:_N,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:Tn({matchPatterns:TN,defaultMatchWidth:"wide",parsePatterns:jN,defaultParseWidth:"any"}),day:Tn({matchPatterns:PN,defaultMatchWidth:"wide",parsePatterns:IN,defaultParseWidth:"any"}),dayPeriod:Tn({matchPatterns:RN,defaultMatchWidth:"wide",parsePatterns:ON,defaultParseWidth:"any"})},hy={code:"ru",formatDistance:sN,formatLong:lN,formatRelative:fN,localize:SN,match:DN,options:{weekStartsOn:1,firstWeekContainsDate:1}};const Nu=e=>zE(e.replace(" ","T")+"Z"),wh=e=>{const t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=e.getFullYear(),s=String(e.getHours()).padStart(2,"0"),i=String(e.getMinutes()).padStart(2,"0");return`${t}.${n}.${r} ${s}:${i}`.substring(0,16)},LN=e=>fi(e,"dd.MM.yyyy",{locale:hy}),xh=e=>{const t=Nu(e);return LN(t)},my=({notes:e=[]})=>{const[t,n]=k.useState(new Date),r=oe(v=>v.notes.selectedDate),s=yt(),i=AC(t),o=LC(t),a=PC(i,{weekStartsOn:1}),l=$C(o,{weekStartsOn:1}),c=MC({start:a,end:l}),d=new Set,f=new Set;e.forEach(v=>{v.created_at&&d.add(xh(v.created_at)),v.updated_at&&v.created_at!==v.updated_at&&f.add(xh(v.updated_at))});const p=v=>{const g=fi(v,"dd.MM.yyyy");s(fu(r===g?null:g))},w=()=>{n(nN(t,1))},h=()=>{n(oy(t,1))},y=fi(t,"MMMM yyyy",{locale:hy}),S=y.charAt(0).toUpperCase()+y.slice(1);return u.jsxs("div",{className:"mini-calendar",children:[u.jsxs("div",{className:"calendar-header",children:[u.jsx("button",{className:"calendar-nav",onClick:w,children:"‹"}),u.jsx("span",{className:"calendar-month-year",children:S}),u.jsx("button",{className:"calendar-nav",onClick:h,children:"›"})]}),u.jsxs("div",{className:"calendar-weekdays",children:[u.jsx("div",{className:"calendar-weekday",children:"Пн"}),u.jsx("div",{className:"calendar-weekday",children:"Вт"}),u.jsx("div",{className:"calendar-weekday",children:"Ср"}),u.jsx("div",{className:"calendar-weekday",children:"Чт"}),u.jsx("div",{className:"calendar-weekday",children:"Пт"}),u.jsx("div",{className:"calendar-weekday",children:"Сб"}),u.jsx("div",{className:"calendar-weekday",children:"Вс"})]}),u.jsx("div",{className:"calendar-days",children:c.map((v,g)=>{const x=fi(v,"dd.MM.yyyy"),C=FE(v,t),T=r===x,b=d.has(x),_=f.has(x),P=RC(v,new Date);return u.jsx("div",{className:`calendar-day ${C?"":"other-month"} ${b?"has-notes":""} ${_?"has-edited-notes":""} ${T?"selected":""} ${P?"today":""}`,"data-date":x,onClick:()=>p(v),children:fi(v,"d")},g)})})]})},gy=()=>{const[e,t]=k.useState(""),n=yt(),r=k.useRef(null);k.useEffect(()=>(r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{n(pu(e))},300),()=>{r.current&&clearTimeout(r.current)}),[e,n]);const s=()=>{t(""),n(pu(""))};return u.jsxs("div",{className:"search-section",children:[u.jsx("div",{className:"search-header",children:u.jsxs("span",{className:"search-title",children:[u.jsx(M,{icon:"mdi:magnify"})," Поиск"]})}),u.jsxs("div",{className:"search-container",children:[u.jsx("input",{type:"text",className:"search-input",placeholder:"Поиск по заметкам...",value:e,onChange:i=>t(i.target.value)}),e&&u.jsx("button",{className:"clear-search-btn",onClick:s,title:"Очистить поиск",children:"✕"})]})]})};function Gd(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Yr=Gd();function vy(e){Yr=e}var Ni={exec:()=>null};function pe(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(Et.caret,"$1"),n=n.replace(s,o),r},getRegex:()=>new RegExp(n,t)};return r}var Et={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},MN=/^(?:[ \t]*(?:\n|$))+/,AN=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,$N=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,fo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,FN=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Yd=/(?:[*+-]|\d{1,9}[.)])/,yy=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,wy=pe(yy).replace(/bull/g,Yd).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),zN=pe(yy).replace(/bull/g,Yd).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Kd=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,UN=/^[^\n]+/,Xd=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,BN=pe(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Xd).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),WN=pe(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Yd).getRegex(),wl="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Jd=/|$))/,HN=pe("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Jd).replace("tag",wl).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),xy=pe(Kd).replace("hr",fo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",wl).getRegex(),QN=pe(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",xy).getRegex(),Zd={blockquote:QN,code:AN,def:BN,fences:$N,heading:FN,hr:fo,html:HN,lheading:wy,list:WN,newline:MN,paragraph:xy,table:Ni,text:UN},Sh=pe("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",fo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",wl).getRegex(),VN={...Zd,lheading:zN,table:Sh,paragraph:pe(Kd).replace("hr",fo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Sh).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",wl).getRegex()},qN={...Zd,html:pe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Jd).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ni,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:pe(Kd).replace("hr",fo).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",wy).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},GN=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,YN=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Sy=/^( {2,}|\\)\n(?!\s*$)/,KN=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\\k(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)")).replace("code",new RegExp("(?`+)[^`]+\\k(?!`)")).replace("html",/<(?! )[^<>]*?>/).getRegex(),Cy=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,t_=pe(Cy,"u").replace(/punct/g,xl).getRegex(),n_=pe(Cy,"u").replace(/punct/g,by).getRegex(),Ey="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",r_=pe(Ey,"gu").replace(/notPunctSpace/g,ky).replace(/punctSpace/g,ef).replace(/punct/g,xl).getRegex(),s_=pe(Ey,"gu").replace(/notPunctSpace/g,ZN).replace(/punctSpace/g,JN).replace(/punct/g,by).getRegex(),i_=pe("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ky).replace(/punctSpace/g,ef).replace(/punct/g,xl).getRegex(),o_=pe(/\\(punct)/,"gu").replace(/punct/g,xl).getRegex(),a_=pe(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),l_=pe(Jd).replace("(?:-->|$)","-->").getRegex(),c_=pe("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",l_).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ua=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,u_=pe(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Ua).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ny=pe(/^!?\[(label)\]\[(ref)\]/).replace("label",Ua).replace("ref",Xd).getRegex(),_y=pe(/^!?\[(ref)\](?:\[\])?/).replace("ref",Xd).getRegex(),d_=pe("reflink|nolink(?!\\()","g").replace("reflink",Ny).replace("nolink",_y).getRegex(),kh=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,tf={_backpedal:Ni,anyPunctuation:o_,autolink:a_,blockSkip:e_,br:Sy,code:YN,del:Ni,emStrongLDelim:t_,emStrongRDelimAst:r_,emStrongRDelimUnd:i_,escape:GN,link:u_,nolink:_y,punctuation:XN,reflink:Ny,reflinkSearch:d_,tag:c_,text:KN,url:Ni},f_={...tf,link:pe(/^!?\[(label)\]\((.*?)\)/).replace("label",Ua).getRegex(),reflink:pe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ua).getRegex()},_u={...tf,emStrongRDelimAst:s_,emStrongLDelim:n_,url:pe(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",kh).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:pe(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},bh=e=>h_[e];function Cn(e,t){if(t){if(Et.escapeTest.test(e))return e.replace(Et.escapeReplace,bh)}else if(Et.escapeTestNoEncode.test(e))return e.replace(Et.escapeReplaceNoEncode,bh);return e}function Ch(e){try{e=encodeURI(e).replace(Et.percentDecode,"%")}catch{return null}return e}function Eh(e,t){var i;let n=e.replace(Et.findPipe,(o,a,l)=>{let c=!1,d=a;for(;--d>=0&&l[d]==="\\";)c=!c;return c?"|":" |"}),r=n.split(Et.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length0?-2:-1}function Nh(e,t,n,r,s){let i=t.href,o=t.title||null,a=e[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}function g_(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let s=r[1];return t.split(` +`).map(i=>{let o=i.match(n.other.beginningSpace);if(o===null)return i;let[a]=o;return a.length>=s.length?i.slice(s.length):i}).join(` +`)}var Ba=class{constructor(e){ce(this,"options");ce(this,"rules");ce(this,"lexer");this.options=e||Yr}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:ii(n,` +`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=g_(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=ii(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:ii(t[0],` +`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=ii(t[0],` +`).split(` +`),r="",s="",i=[];for(;n.length>0;){let o=!1,a=[],l;for(l=0;l1,s={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let i=this.rules.other.listItemRegex(n),o=!1;for(;e;){let l=!1,c="",d="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;c=t[0],e=e.substring(c.length);let f=t[2].split(` +`,1)[0].replace(this.rules.other.listReplaceTabs,v=>" ".repeat(3*v.length)),p=e.split(` +`,1)[0],w=!f.trim(),h=0;if(this.options.pedantic?(h=2,d=f.trimStart()):w?h=t[1].length+1:(h=t[2].search(this.rules.other.nonSpaceChar),h=h>4?1:h,d=f.slice(h),h+=t[1].length),w&&this.rules.other.blankLine.test(p)&&(c+=p+` +`,e=e.substring(p.length+1),l=!0),!l){let v=this.rules.other.nextBulletRegex(h),g=this.rules.other.hrRegex(h),x=this.rules.other.fencesBeginRegex(h),C=this.rules.other.headingBeginRegex(h),T=this.rules.other.htmlBeginRegex(h);for(;e;){let b=e.split(` +`,1)[0],_;if(p=b,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),_=p):_=p.replace(this.rules.other.tabCharGlobal," "),x.test(p)||C.test(p)||T.test(p)||v.test(p)||g.test(p))break;if(_.search(this.rules.other.nonSpaceChar)>=h||!p.trim())d+=` +`+_.slice(h);else{if(w||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||x.test(f)||C.test(f)||g.test(f))break;d+=` +`+p}!w&&!p.trim()&&(w=!0),c+=b+` +`,e=e.substring(b.length+1),f=_.slice(h)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0));let y=null,S;this.options.gfm&&(y=this.rules.other.listIsTask.exec(d),y&&(S=y[0]!=="[ ] ",d=d.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:c,task:!!y,checked:S,loose:!1,text:d,tokens:[]}),s.raw+=c}let a=s.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let l=0;lf.type==="space"),d=c.length>0&&c.some(f=>this.rules.other.anyLine.test(f.raw));s.loose=d}if(s.loose)for(let l=0;l({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[c]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===` +`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=ii(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=m_(t[2],"()");if(i===-2)return;if(i>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let r=t[2],s="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),Nh(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=t[r.toLowerCase()];if(!s){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return Nh(n,s,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,o,a=s,l=0,c=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+s);(r=c.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(o=[...i].length,r[3]||r[4]){a+=o;continue}else if((r[5]||r[6])&&s%3&&!((s+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let d=[...r[0]][0].length,f=e.slice(0,s+r.index+d+o);if(Math.min(s,o)%2){let w=f.slice(1,-1);return{type:"em",raw:f,text:w,tokens:this.lexer.inlineTokens(w)}}let p=f.slice(2,-2);return{type:"strong",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let r,s;if(t[2]==="@")r=t[0],s="mailto:"+r;else{let i;do i=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(i!==t[0]);r=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},fn=class Tu{constructor(t){ce(this,"tokens");ce(this,"options");ce(this,"state");ce(this,"tokenizer");ce(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Yr,this.options.tokenizer=this.options.tokenizer||new Ba,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:Et,block:$o.normal,inline:si.normal};this.options.pedantic?(n.block=$o.pedantic,n.inline=si.pedantic):this.options.gfm&&(n.block=$o.gfm,this.options.breaks?n.inline=si.breaks:n.inline=si.gfm),this.tokenizer.rules=n}static get rules(){return{block:$o,inline:si}}static lex(t,n){return new Tu(n).lex(t)}static lexInline(t,n){return new Tu(n).inlineTokens(t)}lex(t){t=t.replace(Et.carriageReturn,` +`),this.blockTokens(t,this.tokens);for(let n=0;n(a=c.call({lexer:this},t,n))?(t=t.substring(a.raw.length),n.push(a),!0):!1))continue;if(a=this.tokenizer.space(t)){t=t.substring(a.raw.length);let c=n.at(-1);a.raw.length===1&&c!==void 0?c.raw+=` +`:n.push(a);continue}if(a=this.tokenizer.code(t)){t=t.substring(a.raw.length);let c=n.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(` +`)?"":` +`)+a.raw,c.text+=` +`+a.text,this.inlineQueue.at(-1).src=c.text):n.push(a);continue}if(a=this.tokenizer.fences(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.heading(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.hr(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.blockquote(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.list(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.html(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.def(t)){t=t.substring(a.raw.length);let c=n.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(` +`)?"":` +`)+a.raw,c.text+=` +`+a.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},n.push(a));continue}if(a=this.tokenizer.table(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.lheading(t)){t=t.substring(a.raw.length),n.push(a);continue}let l=t;if((o=this.options.extensions)!=null&&o.startBlock){let c=1/0,d=t.slice(1),f;this.options.extensions.startBlock.forEach(p=>{f=p.call({lexer:this},d),typeof f=="number"&&f>=0&&(c=Math.min(c,f))}),c<1/0&&c>=0&&(l=t.substring(0,c+1))}if(this.state.top&&(a=this.tokenizer.paragraph(l))){let c=n.at(-1);r&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=(c.raw.endsWith(` +`)?"":` +`)+a.raw,c.text+=` +`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(a),r=l.length!==t.length,t=t.substring(a.raw.length);continue}if(a=this.tokenizer.text(t)){t=t.substring(a.raw.length);let c=n.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(` +`)?"":` +`)+a.raw,c.text+=` +`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(a);continue}if(t){let c="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var a,l,c,d,f;let r=t,s=null;if(this.tokens.links){let p=Object.keys(this.tokens.links);if(p.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)p.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((l=(a=this.options.hooks)==null?void 0:a.emStrongMask)==null?void 0:l.call({lexer:this},r))??r;let i=!1,o="";for(;t;){i||(o=""),i=!1;let p;if((d=(c=this.options.extensions)==null?void 0:c.inline)!=null&&d.some(h=>(p=h.call({lexer:this},t,n))?(t=t.substring(p.raw.length),n.push(p),!0):!1))continue;if(p=this.tokenizer.escape(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.tag(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.link(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(p.raw.length);let h=n.at(-1);p.type==="text"&&(h==null?void 0:h.type)==="text"?(h.raw+=p.raw,h.text+=p.text):n.push(p);continue}if(p=this.tokenizer.emStrong(t,r,o)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.codespan(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.br(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.del(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.autolink(t)){t=t.substring(p.raw.length),n.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(t))){t=t.substring(p.raw.length),n.push(p);continue}let w=t;if((f=this.options.extensions)!=null&&f.startInline){let h=1/0,y=t.slice(1),S;this.options.extensions.startInline.forEach(v=>{S=v.call({lexer:this},y),typeof S=="number"&&S>=0&&(h=Math.min(h,S))}),h<1/0&&h>=0&&(w=t.substring(0,h+1))}if(p=this.tokenizer.inlineText(w)){t=t.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(o=p.raw.slice(-1)),i=!0;let h=n.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=p.raw,h.text+=p.text):n.push(p);continue}if(t){let h="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return n}},Wa=class{constructor(e){ce(this,"options");ce(this,"parser");this.options=e||Yr}space(e){return""}code({text:e,lang:t,escaped:n}){var i;let r=(i=(t||"").match(Et.notSpaceStart))==null?void 0:i[0],s=e.replace(Et.endingNewline,"")+` +`;return r?'
'+(n?s:Cn(s,!0))+`
+`:"
"+(n?s:Cn(s,!0))+`
+`}blockquote({tokens:e}){return`
+${this.parser.parse(e)}
+`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`${this.parser.parseInline(e)} +`}hr(e){return`
+`}list(e){let t=e.ordered,n=e.start,r="";for(let o=0;o +`+r+" +`}listitem(e){var n;let t="";if(e.task){let r=this.checkbox({checked:!!e.checked});e.loose?((n=e.tokens[0])==null?void 0:n.type)==="paragraph"?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=r+" "+Cn(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):t+=r+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`
  • ${t}
  • +`}checkbox({checked:e}){return"'}paragraph({tokens:e}){return`

    ${this.parser.parseInline(e)}

    +`}table(e){let t="",n="";for(let s=0;s${r}`),` + +`+t+` +`+r+`
    +`}tablerow({text:e}){return` +${e} +`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+` +`}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${Cn(e,!0)}`}br(e){return"
    "}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),s=Ch(e);if(s===null)return r;e=s;let i='
    ",i}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let s=Ch(e);if(s===null)return Cn(n);e=s;let i=`${n}{let l=o[a].flat(1/0);n=n.concat(this.walkTokens(l,t))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let i=t.renderers[s.name];i?t.renderers[s.name]=function(...o){let a=s.renderer.apply(this,o);return a===!1&&(a=i.apply(this,o)),a}:t.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[s.level];i?i.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),r.extensions=t),n.renderer){let s=this.defaults.renderer||new Wa(this.defaults);for(let i in n.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let o=i,a=n.renderer[o],l=s[o];s[o]=(...c)=>{let d=a.apply(s,c);return d===!1&&(d=l.apply(s,c)),d||""}}r.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new Ba(this.defaults);for(let i in n.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let o=i,a=n.tokenizer[o],l=s[o];s[o]=(...c)=>{let d=a.apply(s,c);return d===!1&&(d=l.apply(s,c)),d}}r.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new pi;for(let i in n.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let o=i,a=n.hooks[o],l=s[o];pi.passThroughHooks.has(i)?s[o]=c=>{if(this.defaults.async&&pi.passThroughHooksRespectAsync.has(i))return(async()=>{let f=await a.call(s,c);return l.call(s,f)})();let d=a.call(s,c);return l.call(s,d)}:s[o]=(...c)=>{if(this.defaults.async)return(async()=>{let f=await a.apply(s,c);return f===!1&&(f=await l.apply(s,c)),f})();let d=a.apply(s,c);return d===!1&&(d=l.apply(s,c)),d}}r.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(o){let a=[];return a.push(i.call(this,o)),s&&(a=a.concat(s.call(this,o))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return fn.lex(e,t??this.defaults)}parser(e,t){return pn.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},s={...this.defaults,...r},i=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let o=s.hooks?await s.hooks.preprocess(t):t,a=await(s.hooks?await s.hooks.provideLexer():e?fn.lex:fn.lexInline)(o,s),l=s.hooks?await s.hooks.processAllTokens(a):a;s.walkTokens&&await Promise.all(this.walkTokens(l,s.walkTokens));let c=await(s.hooks?await s.hooks.provideParser():e?pn.parse:pn.parseInline)(l,s);return s.hooks?await s.hooks.postprocess(c):c})().catch(i);try{s.hooks&&(t=s.hooks.preprocess(t));let o=(s.hooks?s.hooks.provideLexer():e?fn.lex:fn.lexInline)(t,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let a=(s.hooks?s.hooks.provideParser():e?pn.parse:pn.parseInline)(o,s);return s.hooks&&(a=s.hooks.postprocess(a)),a}catch(o){return i(o)}}}onError(e,t){return n=>{if(n.message+=` +Please report this to https://github.com/markedjs/marked.`,e){let r="

    An error occurred:

    "+Cn(n.message+"",!0)+"
    ";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},Qr=new v_;function ge(e,t){return Qr.parse(e,t)}ge.options=ge.setOptions=function(e){return Qr.setOptions(e),ge.defaults=Qr.defaults,vy(ge.defaults),ge};ge.getDefaults=Gd;ge.defaults=Yr;ge.use=function(...e){return Qr.use(...e),ge.defaults=Qr.defaults,vy(ge.defaults),ge};ge.walkTokens=function(e,t){return Qr.walkTokens(e,t)};ge.parseInline=Qr.parseInline;ge.Parser=pn;ge.parser=pn.parse;ge.Renderer=Wa;ge.TextRenderer=nf;ge.Lexer=fn;ge.lexer=fn.lex;ge.Tokenizer=Ba;ge.Hooks=pi;ge.parse=ge;ge.options;ge.setOptions;ge.use;ge.walkTokens;ge.parseInline;pn.parse;fn.lex;const y_={name:"spoiler",level:"inline",start(e){var t;return(t=e.match(/\|\|/))==null?void 0:t.index},tokenizer(e){const n=/^\|\|(.*?)\|\|/.exec(e);if(n)return{type:"spoiler",raw:n[0],text:n[1].trim()}},renderer(e){return`${e.text}`}};function gs(e,t){return e.map(n=>{if(t[n.type])return t[n.type](n);if(n.type==="text")return n.text||"";if(n.type==="strong")return`${gs(n.tokens||[],t)}`;if(n.type==="em")return`${gs(n.tokens||[],t)}`;if(n.type==="codespan")return`${n.text||""}`;if(n.type==="del")return`${gs(n.tokens||[],t)}`;if(n.type==="link"){if(t.link)return t.link(n);const r=n.href||"",s=n.title?` title="${n.title}"`:"",i=n.tokens&&n.tokens.length>0?gs(n.tokens,t):n.text||"";return`
    ${i}`}return n.type==="spoiler"?t.spoiler?t.spoiler(n):`${n.text||""}`:n.text||""}).join("")}const w_={link(e){const t=e.href,n=e.title;let r="";e.tokens&&e.tokens.length>0?r=gs(e.tokens,this):e.text&&(r=e.text);try{if(new URL(t,window.location.href).origin!==window.location.origin)return`${r}`}catch{}return`${r}`},listitem(e){const t=e.task,n=e.checked;let r="";return e.tokens&&e.tokens.length>0?r=gs(e.tokens,this):e.text&&(r=e.text),t?`
  • ${``} ${r}
  • +`:`
  • ${r}
  • +`}};ge.use({extensions:[y_],gfm:!0,breaks:!0,renderer:w_});const rf=e=>ge.parse(e),Ty=e=>{const t=/#([а-яё\w]+)/gi,n=[];let r;for(;(r=t.exec(e))!==null;){const s=r.index,i=e.substring(Math.max(0,s-100),s),o=e.substring(s+r[0].length,Math.min(e.length,s+r[0].length+100)),a=i.lastIndexOf("<"),l=i.lastIndexOf(">");if(a>l)continue;const c=Math.max(i.lastIndexOf('"'),i.lastIndexOf("'")),d=i.lastIndexOf("=");if(d>-1&&c>d&&Math.min(o.indexOf('"')!==-1?o.indexOf('"'):1/0,o.indexOf("'")!==-1?o.indexOf("'"):1/0)!==1/0)continue;const f=r[1];n.some(p=>p.toLowerCase()===f.toLowerCase())||n.push(f)}return n},x_=e=>{const t=/#([а-яё\w]+)/gi,n=[];let r;for(;(r=t.exec(e))!==null;)n.push({fullMatch:r[0],tag:r[1],index:r.index});let s=e;for(let i=n.length-1;i>=0;i--){const o=n[i],a=s.substring(0,o.index),l=s.substring(o.index+o.fullMatch.length),c=a.lastIndexOf("<"),d=a.lastIndexOf(">");if(c>d)continue;const f=a.substring(Math.max(0,o.index-100)),p=Math.max(f.lastIndexOf('"'),f.lastIndexOf("'")),w=f.lastIndexOf("=");if(w>-1&&p>w){const y=l.substring(0,Math.min(100,l.length));if(Math.min(y.indexOf('"')!==-1?y.indexOf('"'):1/0,y.indexOf("'")!==-1?y.indexOf("'"):1/0)!==1/0)continue}const h=`${o.fullMatch}`;s=a+h+l}return s},S_=(e,t)=>{if(!t.trim())return e;const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`(${n})`,"gi");return e.replace(r,'$1')},jy=({notes:e=[]})=>{const t=oe(a=>a.notes.selectedTag),n=yt(),s=(()=>{const a={},l={};e.forEach(d=>{Ty(d.content).forEach(p=>{const w=p.toLowerCase();a[w]=(a[w]||0)+1,l[w]||(l[w]=p)})});const c={};return Object.keys(a).forEach(d=>{c[l[d]]=a[d]}),c})(),i=Object.keys(s).sort(),o=(a,l)=>{l.preventDefault();const c=a.toLowerCase();(t==null?void 0:t.toLowerCase())===c?n(Da(null)):n(Da(c)),l.currentTarget.blur()};return i.length===0?u.jsxs("div",{className:"tags-section",children:[u.jsx("div",{className:"tags-header",children:u.jsxs("span",{className:"tags-title",children:[u.jsx(M,{icon:"mdi:tag"})," Теги"]})}),u.jsx("div",{className:"tags-container",children:u.jsx("div",{style:{fontSize:"10px",color:"#999",textAlign:"center"},children:"Нет тегов"})})]}):u.jsxs("div",{className:"tags-section",children:[u.jsx("div",{className:"tags-header",children:u.jsxs("span",{className:"tags-title",children:[u.jsx(M,{icon:"mdi:tag"})," Теги"]})}),u.jsx("div",{className:"tags-container",children:i.map(a=>{const l=s[a],c=(t==null?void 0:t.toLowerCase())===a.toLowerCase();return u.jsxs("span",{className:`tag ${c?"active":""}`,"data-tag":a,onClick:d=>o(a,d),onTouchEnd:d=>{d.currentTarget.blur()},children:["#",a,u.jsx("span",{className:"tag-count",children:l})]},a)})})]})},k_=({notes:e})=>u.jsxs("div",{className:"container-leftside",children:[u.jsx(my,{notes:e}),u.jsx(gy,{}),u.jsx(jy,{notes:e})]}),b_=({isOpen:e,onClose:t})=>{const n=oe(r=>r.notes.allNotes);return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:`mobile-sidebar-overlay ${e?"open":""}`,onClick:t}),u.jsxs("div",{className:`mobile-sidebar ${e?"open":""}`,children:[u.jsx("button",{className:"sidebar-close-btn",onClick:t,children:u.jsx(M,{icon:"mdi:close"})}),u.jsxs("div",{className:"sidebar-content",children:[u.jsx("div",{className:"mobile-calendar-section",children:u.jsx(my,{notes:n})}),u.jsx("div",{className:"mobile-search-section",children:u.jsx(gy,{})}),u.jsx("div",{className:"mobile-tags-section",children:u.jsx(jy,{notes:n})})]})]})]})},Py=({onInsert:e,onImageClick:t,onFileClick:n,onPreviewToggle:r,isPreviewMode:s,onInsertColor:i})=>{const[o,a]=k.useState(!1),l=yt(),c=k.useRef(null),d=k.useRef(null),f=k.useRef(null),p=k.useRef(null),[w,h]=k.useState(!1),[y,S]=k.useState(0),[v,g]=k.useState(0),[x,C]=k.useState(null);k.useEffect(()=>{const I=q=>{c.current&&!c.current.contains(q.target)&&f.current&&!f.current.contains(q.target)&&(a(!1),C(null))},R=()=>{if(d.current&&o){const q=d.current.getBoundingClientRect();C({top:q.bottom+window.scrollY+2,left:q.left+window.scrollX})}};if(o){R();const q=setTimeout(()=>{document.addEventListener("mousedown",I),window.addEventListener("resize",R),window.addEventListener("scroll",R)},100);return()=>{clearTimeout(q),document.removeEventListener("mousedown",I),window.removeEventListener("resize",R),window.removeEventListener("scroll",R)}}else C(null)},[o]);const T=I=>{I.target.closest(".btnMarkdown")||p.current&&(h(!0),S(I.pageX-p.current.offsetLeft),g(p.current.scrollLeft))},b=I=>{if(!w||!p.current)return;I.preventDefault();const q=(I.pageX-p.current.offsetLeft-y)*2;p.current.scrollLeft=v-q},_=()=>{h(!1)};k.useEffect(()=>(w?(document.addEventListener("mousemove",b),document.addEventListener("mouseup",_)):(document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",_)),()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",_)}),[w]);const P=[];return u.jsxs("div",{className:"markdown-buttons",ref:p,onMouseDown:T,style:{cursor:w?"grabbing":p.current&&p.current.scrollWidth>p.current.clientWidth?"grab":"default"},children:[P.map(I=>u.jsx("button",{className:"btnMarkdown",onClick:()=>{I.action?I.action():e(I.before,I.after)},title:I.title,children:u.jsx(M,{icon:I.icon})},I.id)),u.jsxs("div",{className:"header-dropdown",ref:c,children:[u.jsxs("button",{ref:d,className:"btnMarkdown",onMouseDown:I=>{I.stopPropagation()},onClick:I=>{I.stopPropagation(),a(!o)},title:"Заголовок",children:[u.jsx(M,{icon:"mdi:format-header-pound"}),u.jsx(M,{icon:"mdi:menu-down",style:{fontSize:"10px",marginLeft:"-2px"}})]}),o&&x&&u.jsx("div",{ref:f,className:"header-dropdown-menu",style:{position:"fixed",top:`${x.top}px`,left:`${x.left}px`},children:[1,2,3,4,5].map(I=>u.jsxs("button",{onClick:R=>{R.stopPropagation(),e("#".repeat(I)+" ",""),a(!1),C(null)},children:["H",I]},I))})]}),u.jsx("button",{className:"btnMarkdown",onClick:()=>e("- ",""),title:"Список",children:u.jsx(M,{icon:"mdi:format-list-bulleted"})}),u.jsx("button",{className:"btnMarkdown",onClick:()=>e("1. ",""),title:"Нумерованный список",children:u.jsx(M,{icon:"mdi:format-list-numbered"})}),u.jsx("button",{className:"btnMarkdown",onClick:()=>e("**","**"),title:"Жирный",children:u.jsx(M,{icon:"mdi:format-bold"})}),u.jsx("button",{className:"btnMarkdown",onClick:()=>e("*","*"),title:"Курсив",children:u.jsx(M,{icon:"mdi:format-italic"})}),u.jsx("button",{className:"btnMarkdown",onClick:()=>e("~~","~~"),title:"Зачеркнутый",children:u.jsx(M,{icon:"mdi:format-strikethrough"})}),u.jsx("button",{className:"btnMarkdown",onClick:()=>i==null?void 0:i(),title:"Цвет текста",children:u.jsx(M,{icon:"mdi:palette"})}),u.jsx("button",{className:"btnMarkdown",onClick:()=>e("||","||"),title:"Скрытый текст",children:u.jsx(M,{icon:"mdi:eye-off"})}),u.jsx("button",{className:"btnMarkdown",onClick:()=>e("> ",""),title:"Цитата",children:u.jsx(M,{icon:"mdi:format-quote-close"})}),u.jsx("button",{className:"btnMarkdown",onClick:()=>e("`","`"),title:"Код",children:u.jsx(M,{icon:"mdi:code-tags"})}),u.jsx("button",{className:"btnMarkdown",onClick:()=>e("[текст ссылки](",")"),title:"Ссылка",children:u.jsx(M,{icon:"mdi:link"})}),u.jsx("button",{className:"btnMarkdown",onClick:()=>e("- [ ] ",""),title:"To-Do список",children:u.jsx(M,{icon:"mdi:checkbox-marked-outline"})}),u.jsx("button",{className:"btnMarkdown",onClick:()=>t==null?void 0:t(),title:"Загрузить изображения",children:u.jsx(M,{icon:"mdi:image-plus"})}),u.jsx("button",{className:"btnMarkdown",onClick:()=>n==null?void 0:n(),title:"Прикрепить файлы",children:u.jsx(M,{icon:"mdi:file-plus"})}),u.jsx("button",{className:`btnMarkdown ${s?"active":""}`,onClick:r||(()=>l(M1())),title:"Предпросмотр",children:u.jsx(M,{icon:"mdi:monitor-eye"})})]})},Iy=({textareaRef:e,onFormat:t,visible:n,position:r,onHide:s,onInsertColor:i,activeFormats:o={},hasSelection:a=!1})=>{const l=k.useRef(null),[c,d]=k.useState(!1),[f,p]=k.useState(0),[w,h]=k.useState(0);k.useEffect(()=>{n&&l.current&&setTimeout(()=>{if(!l.current)return;const b=l.current,_=b.getBoundingClientRect(),P=window.innerWidth,I=window.innerHeight,R=10,q=8,se=b.querySelector(".floating-toolbar"),J=se?se.scrollWidth:_.width,ne=P-R*2,A=_.height,Q=r.selectionTop??r.top,re=r.selectionBottom??r.top+20,$=Q-R,B=I-re-R;let V;$>=A+q?V=Q-A-q:B>=A+q?V=re+q:$>B?V=Math.max(R,Q-A-q):V=Math.min(I-A-R,re+q);let E=r.left-J/2;J>ne?(b.style.maxWidth=`${ne}px`,E=R):(E+J>P-R&&(E=Math.max(R,P-J-R)),EI-R&&(V=I-A-R),b.style.top=`${V}px`,b.style.left=`${E}px`},0)},[n,r]);const y=b=>{b.target.closest(".floating-toolbar-btn")||l.current&&(d(!0),p(b.pageX-l.current.offsetLeft),h(l.current.scrollLeft))},S=b=>{if(!c||!l.current)return;b.preventDefault();const P=(b.pageX-l.current.offsetLeft-f)*2;l.current.scrollLeft=w-P},v=()=>{d(!1)};k.useEffect(()=>(c?(document.addEventListener("mousemove",S),document.addEventListener("mouseup",v)):(document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",v)),()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",v)}),[c]);const g=(b,_)=>{t(b,_),setTimeout(()=>{if(e.current){e.current.focus();const P=e.current.selectionStart,I=e.current.selectionEnd;P!==I&&e.current.setSelectionRange(P,I)}},0)},x=async()=>{const b=e.current;if(!b)return;const _=b.selectionStart,P=b.selectionEnd;if(_===P)return;const I=b.value.substring(_,P);try{await navigator.clipboard.writeText(I)}catch{const q=document.createElement("textarea");q.value=I,q.style.position="fixed",q.style.left="-999999px",document.body.appendChild(q),q.select(),document.execCommand("copy"),document.body.removeChild(q)}},C=async()=>{var se;const b=e.current;if(!b)return;const _=b.selectionStart,P=b.selectionEnd;if(_===P)return;const I=b.value.substring(_,P);try{await navigator.clipboard.writeText(I)}catch{const ne=document.createElement("textarea");ne.value=I,ne.style.position="fixed",ne.style.left="-999999px",document.body.appendChild(ne),ne.select(),document.execCommand("copy"),document.body.removeChild(ne)}const R=b.value.substring(0,_)+b.value.substring(P),q=(se=Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype,"value"))==null?void 0:se.set;if(q){q.call(b,R);const J=new Event("input",{bubbles:!0});b.dispatchEvent(J)}else{b.value=R;const J=new Event("input",{bubbles:!0});b.dispatchEvent(J)}b.setSelectionRange(_,_),b.focus()},T=async()=>{var I;const b=e.current;if(!b)return;const _=b.selectionStart,P=b.selectionEnd;try{const R=await navigator.clipboard.readText(),q=b.value.substring(0,_)+R+b.value.substring(P),se=(I=Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype,"value"))==null?void 0:I.set;if(se){se.call(b,q);const ne=new Event("input",{bubbles:!0});b.dispatchEvent(ne)}else{b.value=q;const ne=new Event("input",{bubbles:!0});b.dispatchEvent(ne)}const J=_+R.length;b.setSelectionRange(J,J),b.focus()}catch{b.focus(),document.execCommand("paste")}};return!n||!a?null:u.jsx("div",{ref:l,className:"floating-toolbar-wrapper",style:{position:"fixed",top:`${r.top}px`,left:`${r.left}px`,zIndex:1e3,cursor:c?"grabbing":l.current&&l.current.scrollWidth>l.current.clientWidth?"grab":"default"},onMouseDown:b=>{b.preventDefault(),y(b)},onContextMenu:b=>{b.preventDefault()},children:u.jsxs("div",{className:"floating-toolbar",children:[u.jsx("button",{className:"floating-toolbar-btn",onClick:s,title:"Закрыть",children:u.jsx(M,{icon:"mdi:close"})}),a&&u.jsxs(u.Fragment,{children:[u.jsx("button",{className:"floating-toolbar-btn",onClick:x,title:"Копировать",children:u.jsx(M,{icon:"mdi:content-copy"})}),u.jsx("button",{className:"floating-toolbar-btn",onClick:C,title:"Вырезать",children:u.jsx(M,{icon:"mdi:content-cut"})}),u.jsx("button",{className:"floating-toolbar-btn",onClick:T,title:"Вставить",children:u.jsx(M,{icon:"mdi:content-paste"})})]}),a&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"floating-toolbar-separator"}),u.jsx("button",{className:`floating-toolbar-btn ${o.bold?"active":""}`,onClick:()=>g("**","**"),title:"Жирный",children:u.jsx(M,{icon:"mdi:format-bold"})}),u.jsx("button",{className:`floating-toolbar-btn ${o.italic?"active":""}`,onClick:()=>g("*","*"),title:"Курсив",children:u.jsx(M,{icon:"mdi:format-italic"})}),u.jsx("button",{className:`floating-toolbar-btn ${o.strikethrough?"active":""}`,onClick:()=>g("~~","~~"),title:"Зачеркнутый",children:u.jsx(M,{icon:"mdi:format-strikethrough"})}),u.jsx("div",{className:"floating-toolbar-separator"}),u.jsx("button",{className:"floating-toolbar-btn",onClick:()=>i==null?void 0:i(),title:"Цвет текста",children:u.jsx(M,{icon:"mdi:palette"})}),u.jsx("button",{className:"floating-toolbar-btn",onClick:()=>g("||","||"),title:"Скрытый текст",children:u.jsx(M,{icon:"mdi:eye-off"})})]})]})})},rs={getAll:async()=>{const{data:e}=await Y.get("/notes");return e},search:async e=>{const{data:t}=await Y.get("/notes/search",{params:e});return t},create:async e=>{const{data:t}=await Y.post("/notes",e);return t},update:async(e,t,n)=>{const{data:r}=await Y.put(`/notes/${e}`,{content:t,skipTimestamp:n});return r},delete:async e=>{await Y.delete(`/notes/${e}`)},pin:async e=>{const{data:t}=await Y.put(`/notes/${e}/pin`);return t},archive:async e=>{const{data:t}=await Y.put(`/notes/${e}/archive`);return t},unarchive:async e=>{const{data:t}=await Y.put(`/notes/${e}/unarchive`);return t},uploadImages:async(e,t)=>{const n=new FormData;t.forEach(s=>n.append("images",s));const{data:r}=await Y.post(`/notes/${e}/images`,n,{headers:{"Content-Type":"multipart/form-data"}});return r},uploadFiles:async(e,t)=>{const n=new FormData;t.forEach(s=>n.append("files",s));const{data:r}=await Y.post(`/notes/${e}/files`,n,{headers:{"Content-Type":"multipart/form-data"}});return r},deleteImage:async(e,t)=>{await Y.delete(`/notes/${e}/images/${t}`)},deleteFile:async(e,t)=>{await Y.delete(`/notes/${e}/files/${t}`)},getArchived:async()=>{const{data:e}=await Y.get("/notes/archived");return e},deleteArchived:async e=>{await Y.delete(`/notes/archived/${e}`)},deleteAllArchived:async e=>{const{data:t}=await Y.delete("/notes/archived/all",{data:{password:e}});return t},getDataVersion:async()=>{const{data:e}=await Y.get("/notes/version");return e}},C_={getLogs:async e=>{const{data:t}=await Y.get("/logs",{params:e});return t}},Ry=e=>{const t=k.useCallback(()=>{document.querySelectorAll(".spoiler").forEach(i=>{if(!i._clickHandler){const o=function(a){this.classList.contains("revealed")||(a.stopPropagation(),this.classList.add("revealed"))};i._clickHandler=o,i.addEventListener("click",o)}}),document.querySelectorAll(".external-link").forEach(i=>{if(!i._externalClickHandler){const o=function(a){(window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone===!0)&&(a.preventDefault(),window.open(this.href,"_blank","noopener,noreferrer"))};i._externalClickHandler=o,i.addEventListener("click",o)}}),document.querySelectorAll(".note-preview-content input[type='checkbox'], .textNote input[type='checkbox']").forEach(i=>{if(!i._checkboxHandler){const o=async function(){if(this.closest(".note-preview-content"))return;const a=this.closest("[data-note-id]");if(!a)return;const l=parseInt(a.getAttribute("data-note-id")||"0");if(!l)return;const c=a.querySelector(".textNote");if(!c)return;const d=c.getAttribute("data-original-content");if(d)try{const p=Array.from(c.querySelectorAll("input[type='checkbox']")).indexOf(this);if(p===-1)return;const w=d.split(` +`);let h=0,y="";for(let S=0;S{const n=new MutationObserver(()=>{t()});return n.observe(document.body,{childList:!0,subtree:!0}),t(),()=>{n.disconnect()}},[t])},Oy=({content:e})=>{Ry();const t=rf(e);return u.jsxs("div",{className:"note-preview-container",style:{display:"block"},children:[u.jsx("div",{className:"note-preview-header",children:u.jsx("span",{children:"Предпросмотр:"})}),u.jsx("div",{className:"note-preview-content",dangerouslySetInnerHTML:{__html:t}})]})},Dy=({images:e,onChange:t})=>{const n=s=>{t(e.filter((i,o)=>o!==s))},r=()=>{t([])};return e.length===0?null:u.jsxs("div",{className:"image-preview-container",style:{display:"block"},children:[u.jsxs("div",{className:"image-preview-header",children:[u.jsx("span",{children:"Загруженные изображения:"}),u.jsx("button",{type:"button",className:"clear-images-btn",onClick:r,children:"Очистить все"})]}),u.jsx("div",{className:"image-preview-list",children:e.map((s,i)=>u.jsxs("div",{className:"image-preview-item",children:[u.jsx("img",{src:URL.createObjectURL(s),alt:`Preview ${i+1}`,className:"image-preview-thumbnail"}),u.jsx("button",{className:"image-preview-remove",onClick:()=>n(i),title:"Удалить",children:u.jsx(M,{icon:"mdi:close"})})]},i))})]})},Ly=({files:e,onChange:t})=>{const n=o=>{t(e.filter((a,l)=>l!==o))},r=()=>{t([])},s=o=>{var l;const a=((l=o.split(".").pop())==null?void 0:l.toLowerCase())||"";return a==="pdf"?"mdi:file-pdf":["doc","docx"].includes(a)?"mdi:file-word":["xls","xlsx"].includes(a)?"mdi:file-excel":a==="txt"?"mdi:file-document":["zip","rar","7z"].includes(a)?"mdi:folder-zip":"mdi:file"},i=o=>(o/1024/1024).toFixed(2)+" MB";return e.length===0?null:u.jsxs("div",{className:"file-preview-container",style:{display:"block"},children:[u.jsxs("div",{className:"file-preview-header",children:[u.jsx("span",{children:"Прикрепленные файлы:"}),u.jsx("button",{type:"button",className:"clear-files-btn",onClick:r,children:"Очистить все"})]}),u.jsx("div",{className:"file-preview-list",children:e.map((o,a)=>u.jsxs("div",{className:"file-preview-item",children:[u.jsx(M,{icon:s(o.name),className:"file-icon"}),u.jsxs("div",{className:"file-info",children:[u.jsx("div",{className:"file-name",children:o.name}),u.jsx("div",{className:"file-size",children:i(o.size)})]}),u.jsx("button",{className:"file-preview-remove",onClick:()=>n(a),title:"Удалить",children:u.jsx(M,{icon:"mdi:close"})})]},a))})]})};let oi=null;const E_=5e3;async function kt(){const e=Date.now();if(oi&&e-oi.time{const e=await kt(),t=Fo();if(!e)return console.log("[Offline] Loading notes from IndexedDB"),t?await D.getNotesByUserId(t):await D.getAllNotes();try{console.log("[Online] Loading notes from server");const{data:n}=await Y.get("/notes"),r=n.map(s=>({...s,syncStatus:"synced"}));if(t){const s=await D.getNotesByUserId(t),i=new Set(r.map(o=>o.id));for(const o of s)typeof o.id=="string"&&o.id.startsWith("temp-")||i.has(o.id)||(console.log(`[OfflineAPI] Removing deleted note from IndexedDB: ${o.id}`),await D.deleteNote(o.id));await D.saveNotes(r)}return r}catch(n){return console.error("Error fetching notes from server, falling back to cache:",n),t?await D.getNotesByUserId(t):await D.getAllNotes()}},search:async e=>{const t=await kt(),n=Fo();if(!t){console.log("[Offline] Searching notes locally");const r=n?await D.getNotesByUserId(n):await D.getAllNotes();return _h(r,e)}try{console.log("[Online] Searching notes on server");const{data:r}=await Y.get("/notes/search",{params:e}),s=r.map(i=>({...i,syncStatus:"synced"}));return n&&await D.saveNotes(s),s}catch(r){console.error("Error searching notes, falling back to local:",r);const s=n?await D.getNotesByUserId(n):await D.getAllNotes();return _h(s,e)}},create:async e=>{const t=await kt(),n=Fo();if(!t){console.log("[Offline] Creating note locally");const r=ic(),s=new Date().toISOString(),i={...e,id:r,user_id:n||0,created_at:s,updated_at:s,is_pinned:0,is_archived:0,images:[],files:[],syncStatus:"pending"};return await D.saveNote(i),await D.addToSyncQueue({type:"create",noteId:r,data:e,timestamp:Date.now(),retries:0}),ee.dispatch(Dp(i)),await bn(),i}try{console.log("[Online] Creating note on server");const{data:r}=await Y.post("/notes",e),s={...r,syncStatus:"synced"};return n&&await D.saveNote(s),ee.dispatch(Dp(s)),s}catch(r){return console.error("Error creating note, falling back to local:",r),st.create(e)}},update:async(e,t,n)=>{if(!await kt()){console.log("[Offline] Updating note locally");const s=await D.getNote(e);if(!s)throw new Error("Note not found");const i={...s,content:t,updated_at:new Date().toISOString(),syncStatus:"pending"};return await D.saveNote(i),await D.addToSyncQueue({type:"update",noteId:e,data:{content:t,skipTimestamp:n},timestamp:Date.now(),retries:0}),ee.dispatch(Fe(i)),await bn(),i}try{if(console.log("[Online] Updating note on server"),kr(e))throw new Error("Cannot update temp note online");const{data:s}=await Y.put(`/notes/${e}`,{content:t,skipTimestamp:n}),i={...s,syncStatus:"synced"};return await D.saveNote(i),ee.dispatch(Fe(i)),i}catch(s){return console.error("Error updating note, falling back to local:",s),st.update(e,t,n)}},delete:async e=>{if(!await kt()){console.log("[Offline] Queuing note for deletion"),await D.getNote(e)&&await D.addToSyncQueue({type:"delete",noteId:e,data:{},timestamp:Date.now(),retries:0}),await bn();return}try{if(console.log("[Online] Deleting note on server"),kr(e))throw new Error("Cannot delete temp note online");await Y.delete(`/notes/${e}`),await D.deleteNote(e)}catch(n){console.error("Error deleting note, falling back to local:",n),await st.delete(e)}},pin:async e=>{if(!await kt()){const n=await D.getNote(e);if(!n)throw new Error("Note not found");const r={...n,is_pinned:n.is_pinned===0?1:0,pinned_at:n.is_pinned===0?new Date().toISOString():void 0,updated_at:new Date().toISOString(),syncStatus:"pending"};return await D.saveNote(r),await D.addToSyncQueue({type:"update",noteId:e,data:{content:n.content,is_pinned:r.is_pinned},timestamp:Date.now(),retries:0}),ee.dispatch(Fe(r)),await bn(),r}try{if(kr(e))throw new Error("Cannot pin temp note online");const{data:n}=await Y.put(`/notes/${e}/pin`),r=await D.getNote(e);if(!r)throw new Error("Note not found");const s={...r,is_pinned:n.is_pinned,pinned_at:n.is_pinned?new Date().toISOString():void 0,syncStatus:"synced"};return await D.saveNote(s),ee.dispatch(Fe(s)),s}catch(n){throw console.error("Error pinning note:",n),n}},archive:async e=>{if(!await kt()){const n=await D.getNote(e);if(!n)throw new Error("Note not found");const r={...n,is_archived:1,updated_at:new Date().toISOString(),syncStatus:"pending"};return await D.saveNote(r),await D.addToSyncQueue({type:"update",noteId:e,data:{content:n.content,is_archived:1},timestamp:Date.now(),retries:0}),ee.dispatch(Fe(r)),await bn(),r}try{if(kr(e))throw new Error("Cannot archive temp note online");await Y.put(`/notes/${e}/archive`);const n=await D.getNote(e);if(!n)throw new Error("Note not found");const r={...n,is_archived:1,is_pinned:0,pinned_at:void 0,syncStatus:"synced"};return await D.saveNote(r),ee.dispatch(Fe(r)),r}catch(n){throw console.error("Error archiving note:",n),n}},unarchive:async e=>{if(!await kt()){const n=await D.getNote(e);if(!n)throw new Error("Note not found");const r={...n,is_archived:0,updated_at:new Date().toISOString(),syncStatus:"pending"};return await D.saveNote(r),await D.addToSyncQueue({type:"update",noteId:e,data:{content:n.content,is_archived:0},timestamp:Date.now(),retries:0}),ee.dispatch(Fe(r)),await bn(),r}try{if(kr(e))throw new Error("Cannot unarchive temp note online");await Y.put(`/notes/${e}/unarchive`);const n=await D.getNote(e);if(!n)throw new Error("Note not found");const r={...n,is_archived:0,syncStatus:"synced"};return await D.saveNote(r),ee.dispatch(Fe(r)),r}catch(n){throw console.error("Error unarchiving note:",n),n}},uploadImages:async(e,t)=>{if(!await kt()){console.log("[Offline] Converting images to base64");const r=await D.getNote(e);if(!r)throw new Error("Note not found");const s=[];for(const o of t){const a=await ch(o),l={id:ic(),note_id:e,filename:o.name,original_name:o.name,file_path:"",file_size:o.size,mime_type:o.type,created_at:new Date().toISOString(),base64Data:a};s.push(l)}const i={...r,images:[...r.images,...s],syncStatus:"pending"};await D.saveNote(i);for(const o of s)await D.addToSyncQueue({type:"uploadImage",noteId:e,data:{imageId:o.id},timestamp:Date.now(),retries:0});return ee.dispatch(Fe(i)),await bn(),s}try{if(kr(e))throw new Error("Cannot upload images for temp note online");const r=new FormData;t.forEach(a=>r.append("images",a));const{data:s}=await Y.post(`/notes/${e}/images`,r,{headers:{"Content-Type":"multipart/form-data"}}),i=Array.isArray(s)?s:(s==null?void 0:s.images)||[],o=await D.getNote(e);if(o){const a={...o,images:[...o.images||[],...i],syncStatus:"synced"};await D.saveNote(a),ee.dispatch(Fe(a))}return i}catch(r){throw console.error("Error uploading images:",r),r}},uploadFiles:async(e,t)=>{if(!await kt()){console.log("[Offline] Converting files to base64");const r=await D.getNote(e);if(!r)throw new Error("Note not found");const s=[];for(const o of t){const a=await ch(o),l={id:ic(),note_id:e,filename:o.name,original_name:o.name,file_path:"",file_size:o.size,mime_type:o.type,created_at:new Date().toISOString(),base64Data:a};s.push(l)}const i={...r,files:[...r.files,...s],syncStatus:"pending"};await D.saveNote(i);for(const o of s)await D.addToSyncQueue({type:"uploadFile",noteId:e,data:{fileId:o.id},timestamp:Date.now(),retries:0});return ee.dispatch(Fe(i)),await bn(),s}try{if(kr(e))throw new Error("Cannot upload files for temp note online");const r=new FormData;t.forEach(a=>r.append("files",a));const{data:s}=await Y.post(`/notes/${e}/files`,r,{headers:{"Content-Type":"multipart/form-data"}}),i=Array.isArray(s)?s:(s==null?void 0:s.files)||[],o=await D.getNote(e);if(o){const a={...o,files:[...o.files||[],...i],syncStatus:"synced"};await D.saveNote(a),ee.dispatch(Fe(a))}return i}catch(r){throw console.error("Error uploading files:",r),r}},deleteImage:async(e,t)=>{if(!await kt()){const r=await D.getNote(e);if(r){const s={...r,images:r.images.filter(i=>i.id!==t),syncStatus:"pending"};await D.saveNote(s),ee.dispatch(Fe(s)),await bn()}return}try{await Y.delete(`/notes/${e}/images/${t}`);const r=await D.getNote(e);if(r){const s={...r,images:r.images.filter(i=>i.id!==t),syncStatus:"synced"};await D.saveNote(s),ee.dispatch(Fe(s))}}catch(r){throw console.error("Error deleting image:",r),r}},deleteFile:async(e,t)=>{if(!await kt()){const r=await D.getNote(e);if(r){const s={...r,files:r.files.filter(i=>i.id!==t),syncStatus:"pending"};await D.saveNote(s),ee.dispatch(Fe(s)),await bn()}return}try{await Y.delete(`/notes/${e}/files/${t}`);const r=await D.getNote(e);if(r){const s={...r,files:r.files.filter(i=>i.id!==t),syncStatus:"synced"};await D.saveNote(s),ee.dispatch(Fe(s))}}catch(r){throw console.error("Error deleting file:",r),r}},getArchived:async()=>{const e=await kt(),t=Fo();if(!e)return(t?await D.getNotesByUserId(t):await D.getAllNotes()).filter(r=>r.is_archived===1);try{const{data:n}=await Y.get("/notes/archived");return n.map(s=>({...s,syncStatus:"synced"}))}catch(n){return console.error("Error fetching archived notes:",n),(t?await D.getNotesByUserId(t):await D.getAllNotes()).filter(s=>s.is_archived===1)}},deleteArchived:async e=>{if(!await kt()){await st.delete(e);return}try{await Y.delete(`/notes/archived/${e}`),await D.deleteNote(e)}catch(n){throw console.error("Error deleting archived note:",n),n}},deleteAllArchived:async e=>{if(!await kt())throw new Error("Cannot delete all archived in offline mode");try{const{data:n}=await Y.delete("/notes/archived/all",{data:{password:e}});return n}catch(n){throw console.error("Error deleting all archived:",n),n}}};function _h(e,t){let n=e;if(t.q){const r=t.q.toLowerCase();n=n.filter(s=>s.content.toLowerCase().includes(r))}if(t.tag){const r=t.tag.toLowerCase();n=n.filter(s=>N_(s.content).some(o=>o.toLowerCase()===r))}return t.date&&(n=n.filter(r=>r.date===t.date)),n}function N_(e){const t=/#(\w+)/g,n=[];let r;for(;(r=t.exec(e))!==null;)n.push(r[1]);return n}async function bn(){const e=await D.getPendingSyncCount();ee.dispatch(Od(e))}const My={improveText:async e=>{const{data:t}=await Y.post("/ai/improve",{text:e});return t.improvedText}},__=({onSave:e})=>{const[t,n]=k.useState(""),[r,s]=k.useState([]),[i,o]=k.useState([]),[a,l]=k.useState(!1),[c,d]=k.useState(!1),[f,p]=k.useState({top:0,left:0}),[w,h]=k.useState(!1),[y,S]=k.useState({bold:!1,italic:!1,strikethrough:!1}),v=k.useRef(null),g=oe(E=>E.ui.isPreviewMode),{showNotification:x}=Gr(),C=oe(E=>E.profile.aiEnabled),T=oe(E=>E.profile.user),b=(T==null?void 0:T.floating_toolbar_enabled)!==void 0?T.floating_toolbar_enabled===1:!0,_=async()=>{if(!t.trim()){x("Введите текст заметки","warning");return}try{const E=new Date,F=E.toLocaleDateString("ru-RU"),W=E.toLocaleTimeString("ru-RU",{hour:"2-digit",minute:"2-digit"}),z=await st.create({content:t,date:F,time:W});r.length>0&&await st.uploadImages(z.id,r),i.length>0&&await st.uploadFiles(z.id,i),x("Заметка сохранена!","success"),n(""),s([]),o([]),e()}catch(E){console.error("Ошибка сохранения заметки:",E),x("Ошибка сохранения заметки","error")}},P=async()=>{if(!t.trim()){x("Введите текст для улучшения","warning");return}l(!0);try{const E=await My.improveText(t);n(E),x("Текст улучшен!","success")}catch(E){console.error("Ошибка улучшения текста:",E),x("Ошибка улучшения текста","error")}finally{l(!1)}},I=k.useCallback(()=>{const E=v.current;if(!E)return{bold:!1,italic:!1,strikethrough:!1};const F=E.selectionStart,W=E.selectionEnd;if(F===W)return{bold:!1,italic:!1,strikethrough:!1};const z=t.substring(F,W),G={bold:!1,italic:!1,strikethrough:!1},K=10,Z=Math.max(0,F-K),ve=Math.min(t.length,W+K),xe=t.substring(Z,ve),ae=F-Z,ue=xe.substring(0,ae),he=xe.substring(ae+z.length),jt=(Pt,on)=>{let ot=0;for(let et=Pt.length-1;et>=0&&Pt[et]===on;et--)ot++;return ot},Pe=(Pt,on)=>{let ot=0;for(let et=0;et=4;(dt||Ie)&&(G.strikethrough=!0);const Ae=jt(ue,"*"),Ce=Pe(he,"*"),qe=Pe(z,"*"),Te=jt(z,"*"),Je=Ae>=2,Ge=Ce>=2,Ze=qe>=2&&Te>=2;(Je&&Ge||Ze&&z.length>=4)&&(G.bold=!0);const Re=Ae===1||Ae>=3&&Ae%2===1,He=Ce===1||Ce>=3&&Ce%2===1,Ut=qe===1&&Te===1||qe>=3&&Te>=3&&qe%2===1&&Te%2===1;return Re&&He&&!G.bold?G.italic=!0:Ae>=3&&Ce>=3?(G.italic=!0,G.bold=!0):(Ut&&z.length>=2||qe===1&&Te===1&&z.length>=2&&!z.startsWith("**")&&!z.endsWith("**"))&&(G.italic=!0),G.bold&&(Ae>=3||Ce>=3||qe>=3||Te>=3)&&(G.italic=!0),G},[t]),R=k.useCallback((E,F="")=>{const W=v.current;if(!W)return;const z=W.selectionStart,G=W.selectionEnd,K=t.substring(z,G),Z=E.length,ve=Math.max(0,z-Z),xe=Math.min(t.length,G+Z),ae=t.substring(ve,xe),ue=z-ve,he=ae.substring(0,ue),jt=ae.substring(ue+K.length),Pe=he.endsWith(E),Se=jt.startsWith(F),be=K.startsWith(E),dt=K.endsWith(F);let Ie=!1;if(E==="*"&&F==="*"){const Te=z>1?t[z-2]:"",Je=G+1=2&&!K.startsWith("**")&&!K.endsWith("**");Ie=Ge&&Ze||Re}else E==="**"&&F==="**"||E==="~~"&&F==="~~"?Ie=Pe&&Se||be&&dt&&K.length>=4:Ie=Pe&&Se||be&&dt&&K.length>=Z*2;let Ae,Ce,qe;if(Ie)if(Pe&&Se)Ae=t.substring(0,z-Z)+K+t.substring(G+Z),Ce=z-Z,qe=G-Z;else{const Te=K.substring(Z,K.length-Z);Ae=t.substring(0,z)+Te+t.substring(G),Ce=z,qe=z+Te.length}else{const Te=/^[-*+]\s|^\d+\.\s|^- \[ \]\s|^>\s/.test(E),Je=K.includes(` +`);if(Te&&Je){const Ge=K.split(` +`);let Ze=[],Re=1,He=!0;for(let Pt=0;Pt ")?Ze.push(In+"> "+ot):Ze.push(In+E+ot)}const Ut=Ze.join(` +`);Ae=t.substring(0,z)+Ut+t.substring(G),Ce=z+E.length,qe=z+Ut.length}else Ae=t.substring(0,z)+E+K+F+t.substring(G),Ce=z+E.length,qe=G+E.length}n(Ae),setTimeout(()=>{W.focus(),W.setSelectionRange(Ce,qe);const Te=I();S(Te)},0)},[t,I]),q=k.useCallback(()=>{const E=document.createElement("input");E.type="color",E.style.display="none",document.body.appendChild(E),E.addEventListener("change",function(){const F=this.value,W=v.current;if(!W)return;const z=W.selectionStart,G=W.selectionEnd,K=t.substring(z,G),Z=t.substring(0,z),ve=t.substring(G);let xe;K.trim()===""?xe=`Текст`:xe=`${K}`;const ae=Z+xe+ve;n(ae),setTimeout(()=>{W.focus();const ue=z+xe.length;W.setSelectionRange(ue,ue)},0),document.body.removeChild(this)}),E.addEventListener("cancel",function(){document.body.removeChild(this)}),E.click()},[t]),se=E=>{if((E.altKey||E.ctrlKey)&&E.key==="Enter")E.preventDefault(),_();else if(E.key==="Enter"){const F=E.currentTarget,W=F.selectionStart,z=F.value,G=z.split(` +`);let K=0,Z="";for(let ue=0;ue=W){Z=G[ue];break}K+=he+1}const ve=[/^(\s*)- \[ \] /,/^(\s*)- \[x\] /i,/^(\s*)- /,/^(\s*)\* /,/^(\s*)\+ /,/^(\s*)(\d+)\. /,/^(\s*)(\w+)\. /,/^(\s*)1\. /];let xe=null,ae=null;for(const ue of ve){const he=Z.match(ue);if(he){xe=he,ue===ve[0]||ue===ve[1]?ae="checkbox":ue===ve[2]||ue===ve[3]||ue===ve[4]?ae="unordered":ue===ve[7]?ae="numbered":ae="ordered";break}}if(xe){E.preventDefault();const ue=xe[1]||"",he=xe[0].slice(ue.length);if(Z.slice(xe[0].length).trim()===""){const Pe=z.substring(0,W),Se=z.substring(W),be=Pe.replace(/\n\s*- \[ \] \s*$|\n\s*- \[x\] \s*$|\n\s*[-*+]\s*$|\n\s*\d+\.\s*$|\n\s*\w+\.\s*$/i,` +`),dt=be+Se;n(dt),setTimeout(()=>{const Ie=be.length;F.setSelectionRange(Ie,Ie)},0)}else{const Pe=z.substring(0,W),Se=z.substring(W);let be="";if(ae==="checkbox")be=ue+"- [ ] ";else if(ae==="unordered")be=ue+he;else if(ae==="ordered"){const Ae=parseInt(xe[2])+1,Ce=xe[2].replace(/\d+/,Ae.toString());be=ue+Ce+". "}else ae==="numbered"&&(be=ue+"1. ");const dt=Pe+` +`+be+Se;n(dt),setTimeout(()=>{const Ie=W+1+be.length;F.setSelectionRange(Ie,Ie)},0)}}}},J=k.useCallback(()=>{const E=v.current;if(!E)return null;const F=E.selectionStart,W=E.selectionEnd,z=F!==W,G=E.getBoundingClientRect(),K=window.getComputedStyle(E),Z=parseInt(K.lineHeight)||20,ve=parseInt(K.paddingTop)||0,xe=parseInt(K.paddingLeft)||0;parseInt(K.fontSize);const ae=E.scrollTop,he=E.value.substring(0,F).split(` +`),jt=he.length-1,Pe=he[jt],Se=document.createElement("span");Se.style.position="absolute",Se.style.visibility="hidden",Se.style.whiteSpace="pre",Se.style.font=K.font,document.body.appendChild(Se),Se.textContent=Pe;const be=Se.offsetWidth,Ie=E.value.substring(0,W).split(` +`),Ae=Ie.length-1,Ce=Ie[Ae];Se.textContent=Ce;const qe=Se.offsetWidth;document.body.removeChild(Se);const Te=G.top+ve+jt*Z-ae,Je=G.top+ve+Ae*Z-ae,Ge=G.left+xe+be,Ze=G.left+xe+qe;if(z){const Re=Math.min(Ge,Ze),He=Math.max(Ge,Ze),Ut=(Re+He)/2;return{top:(Te+Je)/2,left:Ut,hasSelection:z,selectionTop:Math.min(Te,Je),selectionBottom:Math.max(Te,Je)+Z,selectionLeft:Re,selectionRight:He}}else{const Re=Te,He=Ge;return{top:Re,left:He,hasSelection:z,selectionTop:Re,selectionBottom:Re+Z,selectionLeft:He,selectionRight:He}}},[]),ne=k.useCallback(()=>{if(g||!b){d(!1);return}const E=t.trim().length>0,F=J();if(F&&E)if(p({top:F.top,left:F.left}),h(F.hasSelection),d(!0),F.hasSelection){const W=I();S(W)}else S({bold:!1,italic:!1,strikethrough:!1});else d(!1),h(!1),S({bold:!1,italic:!1,strikethrough:!1})},[g,t,J,I,b]);k.useEffect(()=>{const E=v.current;if(!E||g)return;const F=()=>{setTimeout(ne,0)},W=K=>{K.buttons===1&&setTimeout(ne,0)},z=()=>{setTimeout(ne,0)},G=K=>{const Z=K.target;if(Z===E||E.contains(Z)){const ve=E.value.trim().length>0,xe=E.selectionStart!==E.selectionEnd;ve&&xe&&(K.preventDefault(),K.stopPropagation())}};return E.addEventListener("mouseup",F),E.addEventListener("mousemove",W),E.addEventListener("keyup",z),E.addEventListener("contextmenu",G),document.addEventListener("selectionchange",ne),document.addEventListener("contextmenu",G,!0),()=>{E.removeEventListener("mouseup",F),E.removeEventListener("mousemove",W),E.removeEventListener("keyup",z),E.removeEventListener("contextmenu",G),document.removeEventListener("selectionchange",ne),document.removeEventListener("contextmenu",G,!0)}},[g,ne]),k.useEffect(()=>{const E=F=>{const W=v.current,z=F.target,G=document.querySelector(".floating-toolbar");G&&G.contains(z)||W&&!W.contains(z)&&setTimeout(()=>{W.selectionStart===W.selectionEnd&&d(!1)},0)};return document.addEventListener("mousedown",E),()=>{document.removeEventListener("mousedown",E)}},[]),k.useEffect(()=>{if(!c)return;const E=()=>{const W=J();if(W&&(p({top:W.top,left:W.left}),h(W.hasSelection),W.hasSelection)){const z=I();S(z)}},F=v.current;return F&&(F.addEventListener("scroll",E),window.addEventListener("scroll",E,!0)),()=>{F&&F.removeEventListener("scroll",E),window.removeEventListener("scroll",E,!0)}},[c,J,I]),vn.useEffect(()=>{const E=v.current;if(!E)return;const F=()=>{E.style.height="auto",E.style.height=E.scrollHeight+"px"};return E.addEventListener("input",F),F(),()=>{E.removeEventListener("input",F)}},[t]);const A=k.useRef(null),Q=k.useRef(null),re=()=>{var E;(E=A.current)==null||E.click()},$=()=>{var E;(E=Q.current)==null||E.click()},B=E=>{const W=Array.from(E.target.files||[]).filter(z=>z.type.startsWith("image/")&&z.size<=10*1024*1024);if(W.length+r.length>10){x("Можно загрузить максимум 10 изображений","warning");return}s([...r,...W]),A.current&&(A.current.value="")},V=E=>{const F=Array.from(E.target.files||[]),W=/pdf|doc|docx|xls|xlsx|txt|zip|rar|7z/,z=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","text/plain","application/zip","application/x-zip-compressed","application/x-rar-compressed","application/x-7z-compressed"],G=F.filter(K=>{var Z;return(z.includes(K.type)||W.test(((Z=K.name.split(".").pop())==null?void 0:Z.toLowerCase())||""))&&K.size<=50*1024*1024});o([...i,...G]),Q.current&&(Q.current.value="")};return u.jsxs("div",{className:"main",children:[u.jsx(Py,{onInsert:R,onImageClick:re,onFileClick:$,onInsertColor:q}),u.jsx("input",{ref:A,type:"file",id:"imageInput",accept:"image/*",multiple:!0,style:{display:"none"},onChange:B}),u.jsx("input",{ref:Q,type:"file",id:"fileInput",accept:".pdf,.doc,.docx,.xls,.xlsx,.txt,.zip,.rar,.7z",multiple:!0,style:{display:"none"},onChange:V}),!g&&u.jsxs(u.Fragment,{children:[u.jsx("textarea",{ref:v,className:"textInput",id:"noteInput",placeholder:"Ваша заметка...",value:t,onChange:E=>n(E.target.value),onKeyDown:se,onContextMenu:E=>{const F=v.current;if(F){const W=F.value.trim().length>0,z=F.selectionStart!==F.selectionEnd;W&&z&&E.preventDefault()}}}),b&&u.jsx(Iy,{textareaRef:v,onFormat:R,visible:c,position:f,onHide:()=>d(!1),onInsertColor:q,activeFormats:y,hasSelection:w})]}),g&&u.jsx(Oy,{content:t}),u.jsx(Dy,{images:r,onChange:s}),u.jsx(Ly,{files:i,onChange:o}),u.jsxs("div",{className:"save-button-container",children:[u.jsxs("div",{className:"action-buttons",children:[C&&u.jsxs("button",{className:"btnSave btnAI",onClick:P,disabled:a,title:"Улучшить или создать текст через ИИ",children:[u.jsx(M,{icon:"mdi:robot"}),a?"Обработка...":"Помощь ИИ"]}),u.jsx("button",{className:"btnSave",onClick:_,children:"Сохранить"})]}),u.jsx("span",{className:"save-hint",children:"или нажмите Alt + Enter"})]})]})},Ha=({isOpen:e,onClose:t,onConfirm:n,title:r,message:s,confirmText:i="OK",cancelText:o="Отмена",confirmType:a="primary"})=>(k.useEffect(()=>{const l=c=>{c.key==="Escape"&&t()};return e&&document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e,t]),e?u.jsx("div",{className:"modal",style:{display:"block"},onClick:t,children:u.jsxs("div",{className:"modal-content",onClick:l=>l.stopPropagation(),children:[u.jsxs("div",{className:"modal-header",children:[u.jsx("h3",{children:r}),u.jsx("span",{className:"modal-close",onClick:t,children:"×"})]}),u.jsx("div",{className:"modal-body",children:typeof s=="string"?u.jsx("p",{children:s}):s}),u.jsxs("div",{className:"modal-footer",children:[u.jsx("button",{className:a==="danger"?"btn-danger":"btn-primary",onClick:n,style:{marginRight:"10px"},children:i}),u.jsx("button",{className:"btn-secondary",onClick:t,children:o})]})]})}):null);function ac(e,t,n){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/api")||e.startsWith("/uploads")?e:e.startsWith("/")?`/api${e}`:`/api/notes/${t}/images/${n}`}function T_(e,t,n){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/api")||e.startsWith("/uploads")?e:e.startsWith("/")?`/api${e}`:`/api/notes/${t}/files/${n}`}const j_=({note:e,onDelete:t,onPin:n,onArchive:r,onReload:s})=>{const[i,o]=k.useState(!1),[a,l]=k.useState(e.content),[c,d]=k.useState(!1),[f,p]=k.useState([]),[w,h]=k.useState([]),[y,S]=k.useState([]),[v,g]=k.useState([]),[x,C]=k.useState(!1),[T,b]=k.useState(!1),[_,P]=k.useState({top:0,left:0}),[I,R]=k.useState(!1),[q,se]=k.useState({bold:!1,italic:!1,strikethrough:!1}),[J,ne]=k.useState(!1),[A,Q]=k.useState(!1),[re,$]=k.useState(!1),B=k.useRef(null),V=k.useRef(null),E=k.useRef(null),F=k.useRef(null),W=k.useRef(!1),z=oe(m=>m.notes.searchQuery),G=oe(m=>m.ui.isPreviewMode),K=oe(m=>m.profile.aiEnabled),Z=oe(m=>m.profile.user),{showNotification:ve}=Gr(),xe=yt();Ry({onNoteUpdate:s});const ae=(Z==null?void 0:Z.floating_toolbar_enabled)!==void 0?Z.floating_toolbar_enabled===1:!0,ue=()=>{o(!0),l(e.content),p([]),h([]),S([]),g([]),b(!1),se({bold:!1,italic:!1,strikethrough:!1}),ne(!1),W.current=!0},he=()=>{ne(!J),b(!1)},jt=async()=>{if(!a.trim()){ve("Введите текст заметки","warning");return}try{await st.update(e.id,a);for(const m of y)await st.deleteImage(e.id,m);for(const m of v)await st.deleteFile(e.id,m);f.length>0&&await st.uploadImages(e.id,f),w.length>0&&await st.uploadFiles(e.id,w),ve("Заметка обновлена!","success"),o(!1),p([]),h([]),S([]),g([]),s()}catch(m){console.error("Ошибка обновления заметки:",m),ve("Ошибка обновления заметки","error")}},Pe=()=>{o(!1),l(e.content),p([]),h([]),S([]),g([]),b(!1),se({bold:!1,italic:!1,strikethrough:!1}),ne(!1)},Se=m=>{S([...y,m])},be=m=>{g([...v,m])},dt=m=>{S(y.filter(j=>j!==m))},Ie=m=>{g(v.filter(j=>j!==m))},Ae=async()=>{if(!a.trim()){ve("Введите текст для улучшения","warning");return}C(!0);try{const m=await My.improveText(a);l(m),ve("Текст улучшен!","success")}catch(m){console.error("Ошибка улучшения текста:",m),ve("Ошибка улучшения текста","error")}finally{C(!1)}},Ce=k.useCallback(()=>{const m=B.current;if(!m)return{bold:!1,italic:!1,strikethrough:!1};const j=m.selectionStart,O=m.selectionEnd;if(j===O)return{bold:!1,italic:!1,strikethrough:!1};const U=a.substring(j,O),X={bold:!1,italic:!1,strikethrough:!1},ie=10,me=Math.max(0,j-ie),tt=Math.min(a.length,O+ie),$e=a.substring(me,tt),Ye=j-me,de=$e.substring(0,Ye),wt=$e.substring(Ye+U.length),xr=(Rn,Sr)=>{let Xt=0;for(let xn=Rn.length-1;xn>=0&&Rn[xn]===Sr;xn--)Xt++;return Xt},It=(Rn,Sr)=>{let Xt=0;for(let xn=0;xn=4;(Yt||ft)&&(X.strikethrough=!0);const Rt=xr(de,"*"),Ot=It(wt,"*"),Kt=It(U,"*"),xt=xr(U,"*"),Hs=Rt>=2,Jr=Ot>=2,an=Kt>=2&&xt>=2;(Hs&&Jr||an&&U.length>=4)&&(X.bold=!0);const Vn=Rt===1||Rt>=3&&Rt%2===1,Zr=Ot===1||Ot>=3&&Ot%2===1,ho=Kt===1&&xt===1||Kt>=3&&xt>=3&&Kt%2===1&&xt%2===1;return Vn&&Zr&&!X.bold?X.italic=!0:Rt>=3&&Ot>=3?(X.italic=!0,X.bold=!0):(ho&&U.length>=2||Kt===1&&xt===1&&U.length>=2&&!U.startsWith("**")&&!U.endsWith("**"))&&(X.italic=!0),X.bold&&(Rt>=3||Ot>=3||Kt>=3||xt>=3)&&(X.italic=!0),X},[a]),qe=k.useCallback((m,j="")=>{const O=B.current;if(!O)return;const U=O.selectionStart,X=O.selectionEnd,ie=a.substring(U,X),me=m.length,tt=Math.max(0,U-me),$e=Math.min(a.length,X+me),Ye=a.substring(tt,$e),de=U-tt,wt=Ye.substring(0,de),xr=Ye.substring(de+ie.length),It=wt.endsWith(m),Qe=xr.startsWith(j),nt=ie.startsWith(m),Yt=ie.endsWith(j);let ft=!1;if(m==="*"&&j==="*"){const xt=U>1?a[U-2]:"",Hs=X+1=2&&!ie.startsWith("**")&&!ie.endsWith("**");ft=Jr&&an||Vn}else m==="**"&&j==="**"||m==="~~"&&j==="~~"?ft=It&&Qe||nt&&Yt&&ie.length>=4:ft=It&&Qe||nt&&Yt&&ie.length>=me*2;let Rt,Ot,Kt;if(ft)if(It&&Qe)Rt=a.substring(0,U-me)+ie+a.substring(X+me),Ot=U-me,Kt=X-me;else{const xt=ie.substring(me,ie.length-me);Rt=a.substring(0,U)+xt+a.substring(X),Ot=U,Kt=U+xt.length}else{const xt=/^[-*+]\s|^\d+\.\s|^- \[ \]\s|^>\s/.test(m),Hs=ie.includes(` +`);if(xt&&Hs){const Jr=ie.split(` +`);let an=[],Vn=1,Zr=!0;for(let Rn=0;Rn ")?an.push(Qs+"> "+Xt):an.push(Qs+m+Xt)}const ho=an.join(` +`);Rt=a.substring(0,U)+ho+a.substring(X),Ot=U+m.length,Kt=U+ho.length}else Rt=a.substring(0,U)+m+ie+j+a.substring(X),Ot=U+m.length,Kt=X+m.length}l(Rt),setTimeout(()=>{O.focus(),O.setSelectionRange(Ot,Kt);const xt=Ce();se(xt)},0)},[a,Ce]),Te=k.useCallback(()=>{const m=document.createElement("input");m.type="color",m.style.display="none",document.body.appendChild(m),m.addEventListener("change",function(){const j=this.value,O=B.current;if(!O)return;const U=O.selectionStart,X=O.selectionEnd,ie=a.substring(U,X),me=a.substring(0,U),tt=a.substring(X);let $e;ie.trim()===""?$e=`Текст`:$e=`${ie}`;const Ye=me+$e+tt;l(Ye),setTimeout(()=>{O.focus();const de=U+$e.length;O.setSelectionRange(de,de)},0),document.body.removeChild(this)}),m.addEventListener("cancel",function(){document.body.removeChild(this)}),m.click()},[a]),Je=k.useCallback(()=>{const m=B.current;if(!m)return null;const j=m.selectionStart,O=m.selectionEnd,U=j!==O,X=U?Math.floor((j+O)/2):j,me=m.value.substring(0,X).split(` +`),tt=me.length-1,$e=me[me.length-1],Ye=m.getBoundingClientRect(),de=window.getComputedStyle(m),wt=parseInt(de.lineHeight)||20,xr=parseInt(de.paddingTop)||0,It=parseInt(de.paddingLeft)||0;parseInt(de.fontSize);const Qe=document.createElement("span");Qe.style.position="absolute",Qe.style.visibility="hidden",Qe.style.whiteSpace="pre",Qe.style.font=de.font,Qe.textContent=$e,document.body.appendChild(Qe);const nt=Qe.offsetWidth;document.body.removeChild(Qe);const Yt=Ye.top+xr+tt*wt+wt/2,ft=Ye.left+It+nt;return{top:Yt,left:ft,hasSelection:U}},[]),Ge=k.useCallback(()=>{if(J||!ae){b(!1);return}const m=a.trim().length>0,j=Je();if(j&&m)if(P({top:j.top,left:j.left}),R(j.hasSelection),b(!0),j.hasSelection){const O=Ce();se(O)}else se({bold:!1,italic:!1,strikethrough:!1});else b(!1),R(!1),se({bold:!1,italic:!1,strikethrough:!1})},[J,a,Je,Ce,ae]),Ze=()=>{var m;(m=V.current)==null||m.click()},Re=()=>{var m;(m=E.current)==null||m.click()},He=m=>{const O=Array.from(m.target.files||[]).filter(U=>U.type.startsWith("image/")&&U.size<=10*1024*1024);if(O.length+f.length>10){ve("Можно загрузить максимум 10 изображений","warning");return}p([...f,...O]),V.current&&(V.current.value="")},Ut=m=>{const j=Array.from(m.target.files||[]),O=/pdf|doc|docx|xls|xlsx|txt|zip|rar|7z/,U=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","text/plain","application/zip","application/x-zip-compressed","application/x-rar-compressed","application/x-7z-compressed"],X=j.filter(ie=>{var me;return(U.includes(ie.type)||O.test(((me=ie.name.split(".").pop())==null?void 0:me.toLowerCase())||""))&&ie.size<=50*1024*1024});h([...w,...X]),E.current&&(E.current.value="")},Pt=m=>{if((m.altKey||m.ctrlKey)&&m.key==="Enter")m.preventDefault(),jt();else if(m.key==="Escape")m.preventDefault(),Pe();else if(m.key==="Enter"){const j=m.currentTarget,O=j.selectionStart,U=j.value,X=U.split(` +`);let ie=0,me="";for(let de=0;de=O){me=X[de];break}ie+=wt+1}const tt=[/^(\s*)- \[ \] /,/^(\s*)- \[x\] /i,/^(\s*)- /,/^(\s*)\* /,/^(\s*)\+ /,/^(\s*)(\d+)\. /,/^(\s*)(\w+)\. /,/^(\s*)1\. /];let $e=null,Ye=null;for(const de of tt){const wt=me.match(de);if(wt){$e=wt,de===tt[0]||de===tt[1]?Ye="checkbox":de===tt[2]||de===tt[3]||de===tt[4]?Ye="unordered":de===tt[7]?Ye="numbered":Ye="ordered";break}}if($e){m.preventDefault();const de=$e[1]||"",wt=$e[0].slice(de.length);if(me.slice($e[0].length).trim()===""){const It=U.substring(0,O),Qe=U.substring(O),nt=It.replace(/\n\s*- \[ \] \s*$|\n\s*- \[x\] \s*$|\n\s*[-*+]\s*$|\n\s*\d+\.\s*$|\n\s*\w+\.\s*$/i,` +`),Yt=nt+Qe;l(Yt),setTimeout(()=>{const ft=nt.length;j.setSelectionRange(ft,ft)},0)}else{const It=U.substring(0,O),Qe=U.substring(O);let nt="";if(Ye==="checkbox")nt=de+"- [ ] ";else if(Ye==="unordered")nt=de+wt;else if(Ye==="ordered"){const Rt=parseInt($e[2])+1,Ot=$e[2].replace(/\d+/,Rt.toString());nt=de+Ot+". "}else Ye==="numbered"&&(nt=de+"1. ");const Yt=It+` +`+nt+Qe;l(Yt),setTimeout(()=>{const ft=O+1+nt.length;j.setSelectionRange(ft,ft)},0)}}}},on=()=>{d(!0)};k.useEffect(()=>{if(!i)return;const m=B.current;if(!m)return;const j=()=>{m.style.height="auto",m.style.height=m.scrollHeight+"px"};return m.addEventListener("input",j),j(),()=>{m.removeEventListener("input",j)}},[i,a]),k.useEffect(()=>{i&&B.current&&!J&&setTimeout(()=>{const m=B.current;if(m&&(m.focus(),W.current)){const j=m.value.length;m.setSelectionRange(j,j),W.current=!1}},100)},[i,J]),k.useEffect(()=>{if(!i)return;const m=B.current;if(!m||J)return;const j=()=>{setTimeout(Ge,0)},O=ie=>{ie.buttons===1&&setTimeout(Ge,0)},U=()=>{setTimeout(Ge,0)},X=ie=>{const me=ie.target;if(me===m||m.contains(me)){const tt=m.value.trim().length>0,$e=m.selectionStart!==m.selectionEnd;tt&&$e&&(ie.preventDefault(),ie.stopPropagation())}};return m.addEventListener("mouseup",j),m.addEventListener("mousemove",O),m.addEventListener("keyup",U),m.addEventListener("contextmenu",X),document.addEventListener("selectionchange",Ge),document.addEventListener("contextmenu",X,!0),()=>{m.removeEventListener("mouseup",j),m.removeEventListener("mousemove",O),m.removeEventListener("keyup",U),m.removeEventListener("contextmenu",X),document.removeEventListener("selectionchange",Ge),document.removeEventListener("contextmenu",X,!0)}},[i,G,Ge]),k.useEffect(()=>{if(!i)return;const m=j=>{const O=B.current,U=j.target,X=document.querySelector(".floating-toolbar");X&&X.contains(U)||O&&!O.contains(U)&&setTimeout(()=>{O.selectionStart===O.selectionEnd&&b(!1)},0)};return document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m)}},[i]),k.useEffect(()=>{if(!i||!T)return;const m=()=>{const O=Je();if(O&&(P({top:O.top,left:O.left}),R(O.hasSelection),O.hasSelection)){const U=Ce();se(U)}},j=B.current;return j&&(j.addEventListener("scroll",m),window.addEventListener("scroll",m,!0)),()=>{j&&j.removeEventListener("scroll",m),window.removeEventListener("scroll",m,!0)}},[i,T,Je,Ce]);const ot=()=>{d(!1),r(e.id)},et=m=>m?m.length>5&&m.match(/^\d{2}:\d{2}/)?m.substring(0,5):m:m||"",In=()=>{if(e.created_at){const m=Nu(e.created_at),O=wh(m).replace(/(\d{2}\.\d{2}\.\d{4} \d{2}:\d{2})\d*.*/,"$1");if(e.updated_at&&e.created_at!==e.updated_at){const U=(Z==null?void 0:Z.show_edit_date)!==void 0?Z.show_edit_date===1:!0,X=Nu(e.updated_at),me=wh(X).replace(/(\d{2}\.\d{2}\.\d{4} \d{2}:\d{2})\d*.*/,"$1");return U?u.jsxs(u.Fragment,{children:[O,u.jsx("span",{className:"date-separator",children:" | "}),u.jsx(M,{icon:"mdi:pencil",style:{fontSize:"12px",margin:"0 2px"}}),me]}):u.jsxs(u.Fragment,{children:[O,u.jsx(M,{icon:"mdi:pencil",style:{fontSize:"12px",margin:"0 2px"}})]})}else return O}else{const m=et(e.time);return`${e.date} ${m}`}},Kr=()=>{let m=e.content;z&&(m=S_(m,z));const j=x_(m);return rf(j)},Ws=m=>{var O;const j=((O=m.split(".").pop())==null?void 0:O.toLowerCase())||"";return j==="pdf"?"mdi:file-pdf":["doc","docx"].includes(j)?"mdi:file-word":["xls","xlsx"].includes(j)?"mdi:file-excel":j==="txt"?"mdi:file-document":["zip","rar","7z"].includes(j)?"mdi:folder-zip":"mdi:file"},Qn=m=>(m/1024/1024).toFixed(2)+" MB",Sl=m=>{const j=document.getElementById("imageModal"),O=document.getElementById("modalImage");j&&O&&(O.setAttribute("src",m),j.style.display="block")},Xr=(m,j)=>{m.stopPropagation(),xe(Da(j.toLowerCase()))},po=()=>{Q(!A)};return k.useEffect(()=>{if(i){Q(!1),$(!1);return}if(!F.current)return;const j=setTimeout(()=>{const O=F.current;if(!O)return;const U=O.classList.contains("collapsed");U&&O.classList.remove("collapsed");const X=O.scrollHeight;U&&!A&&O.classList.add("collapsed");const ie=X>300;$(ie)},100);return()=>clearTimeout(j)},[e.content,i,A]),k.useEffect(()=>{Q(!1)},[e.id]),u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:`container ${e.is_pinned?"note-pinned":""}`,"data-note-id":e.id,children:[u.jsxs("div",{className:"date",children:[u.jsxs("span",{className:"date-text",children:[In(),e.is_pinned?u.jsxs("span",{className:"pin-indicator",children:[u.jsx(M,{icon:"mdi:pin"}),"Закреплено"]}):null,e.syncStatus==="pending"&&u.jsx("span",{className:"sync-indicator",title:"Ожидает синхронизации",children:u.jsx(M,{icon:"mdi:cloud-upload"})}),e.syncStatus==="error"&&u.jsx("span",{className:"sync-error-indicator",title:"Ошибка синхронизации",children:u.jsx(M,{icon:"mdi:cloud-alert"})})]}),u.jsxs("div",{className:"note-actions",children:[u.jsx("div",{className:"notesHeaderBtn",onClick:()=>n(e.id),title:e.is_pinned?"Открепить":"Закрепить",children:u.jsx(M,{icon:e.is_pinned?"mdi:pin-off":"mdi:pin"})}),u.jsx("div",{className:"notesHeaderBtn",onClick:ue,title:"Редактировать",children:u.jsx(M,{icon:"mdi:pencil"})}),u.jsx("div",{className:"notesHeaderBtn",onClick:on,title:"В архив",children:u.jsx(M,{icon:"mdi:delete"})})]})]}),i?u.jsxs("div",{className:"note-edit-mode",children:[u.jsx(Py,{onInsert:qe,onImageClick:Ze,onFileClick:Re,onPreviewToggle:he,isPreviewMode:J}),u.jsx("input",{ref:V,type:"file",id:"imageInput",accept:"image/*",multiple:!0,style:{display:"none"},onChange:He}),u.jsx("input",{ref:E,type:"file",id:"fileInput",accept:".pdf,.doc,.docx,.xls,.xlsx,.txt,.zip,.rar,.7z",multiple:!0,style:{display:"none"},onChange:Ut}),!J&&u.jsxs(u.Fragment,{children:[u.jsx("textarea",{ref:B,className:"textInput",value:a,onChange:m=>l(m.target.value),onKeyDown:Pt,style:{minHeight:"100px"},onContextMenu:m=>{const j=B.current;if(j){const O=j.value.trim().length>0,U=j.selectionStart!==j.selectionEnd;O&&U&&m.preventDefault()}}}),ae&&u.jsx(Iy,{textareaRef:B,onFormat:qe,visible:T,position:_,onHide:()=>b(!1),onInsertColor:Te,activeFormats:q,hasSelection:I})]}),J&&u.jsx(Oy,{content:a}),e.images&&e.images.length>0&&u.jsxs("div",{className:"image-preview-container",style:{display:"block"},children:[u.jsx("div",{className:"image-preview-header",children:u.jsx("span",{children:"Прикрепленные изображения:"})}),u.jsx("div",{className:"image-preview-list",children:e.images.filter(m=>!y.includes(m.id)).map(m=>{const j=ac(m.file_path,Number(e.id),Number(m.id));return u.jsxs("div",{className:"image-preview-item",children:[u.jsx("img",{src:j,alt:m.original_name,className:"image-preview-thumbnail"}),u.jsx("button",{className:"image-preview-remove",onClick:()=>Se(m.id),title:"Удалить",children:u.jsx(M,{icon:"mdi:close"})})]},m.id)})})]}),y.length>0&&u.jsxs("div",{className:"image-preview-container",style:{display:"block",opacity:.5},children:[u.jsx("div",{className:"image-preview-header",children:u.jsx("span",{children:"Изображения для удаления:"})}),u.jsx("div",{className:"image-preview-list",children:e.images.filter(m=>y.includes(m.id)).map(m=>{const j=ac(m.file_path,Number(e.id),Number(m.id));return u.jsxs("div",{className:"image-preview-item",children:[u.jsx("img",{src:j,alt:m.original_name,className:"image-preview-thumbnail",style:{opacity:.5}}),u.jsx("button",{className:"image-preview-remove restore-btn",onClick:()=>dt(m.id),title:"Восстановить",children:u.jsx(M,{icon:"mdi:restore"})})]},m.id)})})]}),e.files&&e.files.length>0&&u.jsxs("div",{className:"file-preview-container",style:{display:"block"},children:[u.jsx("div",{className:"file-preview-header",children:u.jsx("span",{children:"Прикрепленные файлы:"})}),u.jsx("div",{className:"file-preview-list",children:e.files.filter(m=>!v.includes(m.id)).map(m=>u.jsxs("div",{className:"file-preview-item",children:[u.jsx(M,{icon:Ws(m.original_name),className:"file-icon"}),u.jsxs("div",{className:"file-info",children:[u.jsx("div",{className:"file-name",children:m.original_name}),u.jsx("div",{className:"file-size",children:Qn(m.file_size)})]}),u.jsx("button",{className:"file-preview-remove",onClick:()=>be(m.id),title:"Удалить",children:u.jsx(M,{icon:"mdi:close"})})]},m.id))})]}),v.length>0&&u.jsxs("div",{className:"file-preview-container",style:{display:"block",opacity:.5},children:[u.jsx("div",{className:"file-preview-header",children:u.jsx("span",{children:"Файлы для удаления:"})}),u.jsx("div",{className:"file-preview-list",children:e.files.filter(m=>v.includes(m.id)).map(m=>u.jsxs("div",{className:"file-preview-item",children:[u.jsx(M,{icon:Ws(m.original_name),className:"file-icon",style:{opacity:.5}}),u.jsxs("div",{className:"file-info",children:[u.jsx("div",{className:"file-name",style:{opacity:.5},children:m.original_name}),u.jsx("div",{className:"file-size",style:{opacity:.5},children:Qn(m.file_size)})]}),u.jsx("button",{className:"file-preview-remove restore-btn",onClick:()=>Ie(m.id),title:"Восстановить",children:u.jsx(M,{icon:"mdi:restore"})})]},m.id))})]}),u.jsx(Dy,{images:f,onChange:p}),u.jsx(Ly,{files:w,onChange:h}),u.jsxs("div",{className:"save-button-container",children:[u.jsxs("div",{className:"action-buttons",children:[K&&u.jsxs("button",{className:"btnSave btnAI",onClick:Ae,disabled:x,title:"Улучшить или создать текст через ИИ",children:[u.jsx(M,{icon:"mdi:robot"}),x?"Обработка...":"Помощь ИИ"]}),u.jsx("button",{className:"btnSave",onClick:jt,children:"Сохранить"}),u.jsx("button",{className:"btn-secondary",onClick:Pe,children:"Отмена"})]}),u.jsx("span",{className:"save-hint",children:"Alt + Enter для сохранения, Esc для отмены"})]})]}):u.jsxs(u.Fragment,{children:[u.jsx("div",{ref:F,className:`textNote ${re&&!A?"collapsed":""}`,"data-original-content":e.content,dangerouslySetInnerHTML:{__html:Kr()},onClick:m=>{const j=m.target;if(j.classList.contains("tag-in-note")){const O=j.getAttribute("data-tag");O&&Xr(m,O)}}}),re&&u.jsxs("button",{className:"show-more-btn",onClick:po,type:"button",children:[u.jsx(M,{icon:A?"mdi:chevron-up":"mdi:chevron-down"}),u.jsx("span",{children:A?"Скрыть":"Раскрыть"})]}),e.images&&e.images.length>0&&u.jsx("div",{className:"note-images-container",children:e.images.map(m=>{const j=ac(m.file_path,Number(e.id),Number(m.id));return u.jsx("div",{className:"note-image-item",children:u.jsx("img",{src:j,alt:m.original_name,className:"note-image lazy","data-src":j,"data-image-id":m.id,loading:"lazy",onClick:()=>Sl(j)})},m.id)})}),e.files&&e.files.length>0&&u.jsx("div",{className:"note-files-container",children:e.files.map(m=>{const j=T_(m.file_path,Number(e.id),Number(m.id));return u.jsx("div",{className:"note-file-item",children:u.jsxs("a",{href:j,download:m.original_name,className:"note-file-link","data-file-id":m.id,children:[u.jsx(M,{icon:Ws(m.original_name),className:"file-icon"}),u.jsxs("div",{className:"file-info",children:[u.jsx("div",{className:"file-name",children:m.original_name}),u.jsx("div",{className:"file-size",children:Qn(m.file_size)})]})]})},m.id)})})]})]}),u.jsx(Ha,{isOpen:c,onClose:()=>d(!1),onConfirm:ot,title:"Подтверждение архивирования",message:"Архивировать эту заметку? Её можно будет восстановить из настроек.",confirmText:"Архивировать",cancelText:"Отмена"})]})},P_=k.forwardRef((e,t)=>{const n=oe(h=>h.notes.notes),r=oe(h=>h.auth.userId),s=oe(h=>h.notes.searchQuery),i=oe(h=>h.notes.selectedDate),o=oe(h=>h.notes.selectedTag),a=yt(),{showNotification:l}=Gr(),c=async()=>{try{const h=await st.getAll();let y=h;r&&(y=h.filter(v=>v.user_id===r)),a(P1(y));let S;if(s||i||o){if(S=await st.search({q:s||void 0,date:i||void 0,tag:o||void 0}),r&&(S=S.filter(v=>v.user_id===r)),o){const v=o.toLowerCase();S=S.filter(g=>Ty(g.content).some(C=>C.toLowerCase()===v))}}else S=y;S=S.filter(v=>v.is_archived===0),a(j1(S))}catch(h){console.error("Ошибка загрузки заметок:",h),l("Ошибка загрузки заметок","error")}};k.useEffect(()=>{r&&c()},[r,s,i,o]),k.useImperativeHandle(t,()=>({reloadNotes:c}));const d=async h=>{try{await st.delete(h),l("Заметка удалена","success"),c()}catch(y){console.error("Ошибка удаления заметки:",y),l("Ошибка удаления заметки","error")}},f=async h=>{try{await st.pin(h),c()}catch(y){console.error("Ошибка закрепления заметки:",y),l("Ошибка закрепления заметки","error")}},p=async h=>{try{await st.archive(h),l("Заметка архивирована","success"),c()}catch(y){console.error("Ошибка архивирования заметки:",y),l("Ошибка архивирования заметки","error")}};if(n.length===0){let h="Заметок пока нет. Создайте первую!";return i&&o?h=`Нет заметок за ${i} с тегом #${o}`:i?h=`Нет заметок за выбранную дату (${i})`:o?h=`Нет заметок с тегом #${o}`:s&&(h="Ничего не найдено по запросу"),u.jsx("div",{className:"notes-container",children:u.jsx("p",{className:"empty-message",children:h})})}const w=[...n].sort((h,y)=>{if(h.is_pinned!==y.is_pinned)return y.is_pinned-h.is_pinned;if(h.is_pinned&&y.is_pinned){const g=h.pinned_at?new Date(h.pinned_at).getTime():0;return(y.pinned_at?new Date(y.pinned_at).getTime():0)-g}const S=new Date(h.created_at).getTime();return new Date(y.created_at).getTime()-S});return u.jsx("div",{className:"notes-container",children:w.map(h=>u.jsx(j_,{note:h,onDelete:d,onPin:f,onArchive:p,onReload:c},h.id))})}),I_=()=>{const[e,t]=k.useState(!1),[n,r]=k.useState("");k.useEffect(()=>{const o=a=>{const l=a.target;if(l.classList.contains("note-image")){const c=l.getAttribute("src")||l.getAttribute("data-src");c&&(r(c),t(!0))}};return document.addEventListener("click",o),()=>{document.removeEventListener("click",o)}},[]),k.useEffect(()=>{const o=a=>{a.key==="Escape"&&e&&t(!1)};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[e]);const s=()=>{t(!1)},i=o=>{o.target===o.currentTarget&&s()};return e?u.jsxs("div",{id:"imageModal",className:"image-modal",style:{display:"block"},onClick:i,children:[u.jsx("span",{className:"image-modal-close",onClick:s,children:"×"}),u.jsx("img",{className:"image-modal-content",id:"modalImage",src:n,alt:"Preview"})]}):null},R_=()=>{const e=oe(y=>y.notes.allNotes),t=k.useRef(null),[n,r]=k.useState(!1),s=yt(),i=oe(y=>y.notes.selectedDate),o=oe(y=>y.notes.selectedTag),a=oe(y=>y.notes.searchQuery),l=!!(i||o||a),c=()=>{s(fu(null)),s(Da(null)),s(pu(""))},f=(()=>{const y=[];return a&&y.push(`Поиск: "${a}"`),i&&y.push(`Дата: ${i}`),o&&y.push(`Тег: #${o}`),y})(),p=()=>{t.current&&t.current.reloadNotes()},w=()=>{r(!n)},h=()=>{r(!1)};return u.jsxs(u.Fragment,{children:[u.jsx(b_,{isOpen:n,onClose:h}),u.jsx(k_,{notes:e}),u.jsxs("div",{className:"center",children:[u.jsxs("div",{className:"container",children:[u.jsx(_C,{onToggleSidebar:w}),l&&u.jsxs("div",{className:"filter-indicator",children:[u.jsxs("span",{className:"filter-indicator-text",children:["Фильтр: ",f.join(", ")]})," ",u.jsx("button",{onClick:c,children:"✕"})]}),u.jsx(__,{onSave:p})]}),u.jsx(P_,{ref:t})]}),u.jsx(I_,{})]})},O_=()=>{const e=wr(),t=yt(),{showNotification:n}=Gr();oe(A=>A.profile.user);const[r,s]=k.useState(""),[i,o]=k.useState(""),[a,l]=k.useState(null),[c,d]=k.useState(!1),[f,p]=k.useState(""),[w,h]=k.useState(""),[y,S]=k.useState(""),[v,g]=k.useState(!1),[x,C]=k.useState(""),[T,b]=k.useState(!1),_=k.useRef(null);k.useEffect(()=>{P()},[]);const P=async()=>{try{const A=await Ct.getProfile();t(Dd(A)),s(A.username||""),o(A.email||"");const Q=A.accent_color||"#007bff";t(La(Q)),Ji(Q),A.avatar?(l(A.avatar),d(!0)):(l(null),d(!1));try{const re=await Ct.getAiSettings();t(Ld(re))}catch(re){console.error("Ошибка загрузки AI настроек:",re)}}catch(A){console.error("Ошибка загрузки профиля:",A),n("Ошибка загрузки данных профиля","error")}},I=async A=>{var $,B,V;const Q=($=A.target.files)==null?void 0:$[0];if(!Q)return;if(Q.size>5*1024*1024){n("Файл слишком большой. Максимальный размер: 5 МБ","error");return}if(!["image/jpeg","image/jpg","image/png","image/gif"].includes(Q.type)){n("Недопустимый формат файла. Используйте JPG, PNG или GIF","error");return}try{const E=await Ct.uploadAvatar(Q);l(E.avatar+"?t="+Date.now()),d(!0),await P(),n("Аватарка успешно загружена","success")}catch(E){console.error("Ошибка загрузки аватарки:",E),n(((V=(B=E.response)==null?void 0:B.data)==null?void 0:V.error)||"Ошибка загрузки аватарки","error")}_.current&&(_.current.value="")},R=async()=>{var A,Q;try{await Ct.deleteAvatar(),l(null),d(!1),await P(),n("Аватарка успешно удалена","success")}catch(re){console.error("Ошибка удаления аватарки:",re),n(((Q=(A=re.response)==null?void 0:A.data)==null?void 0:Q.error)||"Ошибка удаления аватарки","error")}},q=async()=>{var A,Q;if(!r.trim()){n("Логин не может быть пустым","error");return}if(r.length<3){n("Логин должен быть не менее 3 символов","error");return}if(i&&!ne(i)){n("Некорректный email адрес","error");return}try{await Ct.updateProfile({username:r.trim(),email:i.trim()||void 0}),await P(),n("Профиль успешно обновлен","success")}catch(re){console.error("Ошибка обновления профиля:",re),n(((Q=(A=re.response)==null?void 0:A.data)==null?void 0:Q.error)||"Ошибка обновления профиля","error")}},se=async()=>{var A,Q;if(!f){n("Введите текущий пароль","error");return}if(!w){n("Введите новый пароль","error");return}if(w.length<6){n("Новый пароль должен быть не менее 6 символов","error");return}if(w!==y){n("Новый пароль и подтверждение не совпадают","error");return}try{await Ct.updateProfile({currentPassword:f,newPassword:w}),p(""),h(""),S(""),n("Пароль успешно изменен","success")}catch(re){console.error("Ошибка изменения пароля:",re),n(((Q=(A=re.response)==null?void 0:A.data)==null?void 0:Q.error)||"Ошибка изменения пароля","error")}},J=async()=>{var A,Q;if(!x.trim()){n("Введите пароль","warning");return}b(!0);try{await Ct.deleteAccount(x),await D.clearAll(),n("Аккаунт успешно удален","success"),t(Yi()),setTimeout(()=>{e("/")},2e3)}catch(re){console.error("Ошибка удаления аккаунта:",re),n(((Q=(A=re.response)==null?void 0:A.data)==null?void 0:Q.error)||"Ошибка удаления аккаунта","error"),b(!1)}},ne=A=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(A);return u.jsxs("div",{className:"container",children:[u.jsxs("header",{className:"notes-header",children:[u.jsxs("span",{children:[u.jsx(M,{icon:"mdi:account"})," Личный кабинет"]}),u.jsxs("div",{className:"user-info",children:[u.jsx(uo,{}),u.jsx("button",{className:"notes-btn",onClick:()=>e("/notes"),title:"К заметкам",children:u.jsx(M,{icon:"mdi:note-text"})}),u.jsx("button",{className:"settings-btn",onClick:()=>e("/settings"),title:"Настройки",children:u.jsx(M,{icon:"mdi:cog"})}),u.jsx("button",{className:"logout-btn",title:"Выйти",onClick:async()=>{try{await Wr.logout()}catch(A){console.error("Ошибка выхода:",A)}finally{D.clearAll().catch(A=>{console.error("Ошибка очистки IndexedDB при выходе:",A)}),t(Yi()),e("/")}},children:u.jsx(M,{icon:"mdi:logout"})})]})]}),u.jsxs("div",{className:"profile-container",children:[u.jsxs("div",{className:"avatar-section",children:[u.jsx("div",{className:"avatar-wrapper",children:c&&a?u.jsx("img",{src:a,alt:"Аватар",className:"avatar-preview",loading:"lazy"}):u.jsx("div",{className:"avatar-placeholder",children:u.jsx(M,{icon:"mdi:account"})})}),u.jsxs("div",{className:"avatar-buttons",children:[u.jsxs("label",{htmlFor:"avatarInput",className:"btn-upload",children:[u.jsx(M,{icon:"mdi:upload"})," Загрузить аватар"]}),u.jsx("input",{ref:_,type:"file",id:"avatarInput",accept:"image/*",style:{display:"none"},onChange:I}),c&&u.jsxs("button",{className:"btn-delete",onClick:R,children:[u.jsx(M,{icon:"mdi:delete"})," Удалить"]})]}),u.jsx("p",{className:"avatar-hint",children:"Максимальный размер: 5 МБ. Форматы: JPG, PNG, GIF"})]}),u.jsxs("div",{className:"profile-form",children:[u.jsx("h3",{children:"Данные профиля"}),u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"username",children:"Логин"}),u.jsx("input",{type:"text",id:"username",placeholder:"Логин",minLength:3,value:r,onChange:A=>s(A.target.value)})]}),u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"email",children:"Email (необязательно)"}),u.jsx("input",{type:"email",id:"email",placeholder:"example@example.com",value:i,onChange:A=>o(A.target.value)})]}),u.jsx("button",{className:"btnSave",onClick:q,children:"Сохранить изменения"}),u.jsx("hr",{className:"separator"}),u.jsx("h3",{children:"Изменить пароль"}),u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"currentPassword",children:"Текущий пароль"}),u.jsx("input",{type:"password",id:"currentPassword",placeholder:"Текущий пароль",value:f,onChange:A=>p(A.target.value)})]}),u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"newPassword",children:"Новый пароль"}),u.jsx("input",{type:"password",id:"newPassword",placeholder:"Новый пароль (минимум 6 символов)",minLength:6,value:w,onChange:A=>h(A.target.value)})]}),u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"confirmPassword",children:"Подтвердите новый пароль"}),u.jsx("input",{type:"password",id:"confirmPassword",placeholder:"Подтвердите новый пароль",value:y,onChange:A=>S(A.target.value)})]}),u.jsx("button",{className:"btnSave",onClick:se,children:"Изменить пароль"}),u.jsx("hr",{className:"separator"}),u.jsxs("button",{className:"btn-danger",onClick:()=>g(!0),children:[u.jsx(M,{icon:"mdi:account-remove"})," Удалить аккаунт"]}),u.jsx("p",{style:{color:"#666",fontSize:"14px",marginBottom:"15px"},children:"Удаление аккаунта - это необратимое действие. Все ваши заметки, изображения и данные будут удалены навсегда."})]})]}),u.jsx(Ha,{isOpen:v,onClose:()=>{g(!1),C("")},onConfirm:J,title:"Удаление аккаунта",message:u.jsxs(u.Fragment,{children:[u.jsx("p",{style:{color:"#dc3545",fontWeight:"bold",marginBottom:"15px"},children:"⚠️ ВНИМАНИЕ: Это действие нельзя отменить!"}),u.jsx("p",{style:{marginBottom:"20px"},children:"Вы действительно хотите удалить свой аккаунт? Все ваши заметки, изображения, настройки и данные будут удалены навсегда."}),u.jsxs("div",{style:{marginBottom:"15px"},children:[u.jsx("label",{htmlFor:"deleteAccountPassword",style:{display:"block",marginBottom:"5px",fontWeight:"bold"},children:"Введите пароль для подтверждения:"}),u.jsx("input",{type:"password",id:"deleteAccountPassword",placeholder:"Пароль от аккаунта",className:"modal-password-input",value:x,onChange:A=>C(A.target.value),onKeyPress:A=>{A.key==="Enter"&&!T&&J()}})]})]}),confirmText:T?"Удаление...":"Удалить аккаунт",cancelText:"Отмена",confirmType:"danger"})]})},D_=()=>{const e=wr(),t=yt(),{showNotification:n}=Gr();oe(m=>m.profile.user);const r=oe(m=>m.auth.userId);oe(m=>m.ui.accentColor);const[s,i]=k.useState(()=>{const m=localStorage.getItem("settings_active_tab");return m&&["appearance","ai","archive","logs","offline"].includes(m)?m:"appearance"});k.useEffect(()=>{localStorage.setItem("settings_active_tab",s)},[s]);const[o,a]=k.useState("#007bff"),[l,c]=k.useState(!0),[d,f]=k.useState(!0),[p,w]=k.useState(!0),[h,y]=k.useState(""),[S,v]=k.useState(""),[g,x]=k.useState(""),[C,T]=k.useState(!1),[b,_]=k.useState([]),[P,I]=k.useState(!1),[R,q]=k.useState([]),[se,J]=k.useState(0),[ne,A]=k.useState(!0),[Q,re]=k.useState(""),[$,B]=k.useState(!1),[V,E]=k.useState(!1),[F,W]=k.useState(""),[z,G]=k.useState(!1),[K,Z]=k.useState(!1),[ve,xe]=k.useState(!1),[ae,ue]=k.useState(null),[he,jt]=k.useState(null),[Pe,Se]=k.useState(!1),[be,dt]=k.useState(!1),Ie=50,Ae=[{color:"#007bff",title:"Синий"},{color:"#28a745",title:"Зеленый"},{color:"#dc3545",title:"Красный"},{color:"#fd7e14",title:"Оранжевый"},{color:"#6f42c1",title:"Фиолетовый"},{color:"#e83e8c",title:"Розовый"}];k.useEffect(()=>{Ce()},[]),k.useEffect(()=>{s==="archive"?Ut():s==="logs"?et(!0):s==="ai"?qe():s==="offline"&&Qn()},[s]);const Ce=async()=>{try{const m=await Ct.getProfile();t(Dd(m));const j=m.accent_color||"#007bff";a(j),t(La(j)),Ji(j),c(m.show_edit_date!==void 0?m.show_edit_date===1:!0);const O=m.colored_icons!==void 0?m.colored_icons===1:!0;f(O),Je(O);const U=m.floating_toolbar_enabled!==void 0?m.floating_toolbar_enabled===1:!0;w(U);try{const X=await Ct.getAiSettings();t(Ld(X))}catch(X){console.error("Ошибка загрузки AI настроек:",X)}}catch(m){console.error("Ошибка загрузки информации о пользователе:",m)}},qe=async()=>{try{const m=await Ct.getAiSettings();y(m.openai_api_key||""),v(m.openai_base_url||""),x(m.openai_model||""),T(m.ai_enabled===1),localStorage.setItem("ai_enabled",m.ai_enabled?"1":"0")}catch(m){console.error("Ошибка загрузки AI настроек:",m)}},Te=async()=>{var m,j;try{await Ct.updateProfile({accent_color:o,show_edit_date:l,colored_icons:d,floating_toolbar_enabled:p}),t(La(o)),Ji(o),await Ce(),Je(d),n("Настройки внешнего вида успешно обновлены","success")}catch(O){console.error("Ошибка обновления настроек внешнего вида:",O),n(((j=(m=O.response)==null?void 0:m.data)==null?void 0:j.error)||"Ошибка обновления","error")}},Je=m=>{m?document.body.classList.add("colored-icons"):document.body.classList.remove("colored-icons")},Ge=async()=>{var m,j;if(!h.trim()){n("API ключ обязателен","error");return}if(!S.trim()){n("Base URL обязателен","error");return}if(!g.trim()){n("Название модели обязательно","error");return}try{await Ct.updateAiSettings({openai_api_key:h,openai_base_url:S,openai_model:g}),n("AI настройки успешно сохранены","success"),He()}catch(O){console.error("Ошибка сохранения AI настроек:",O),n(((j=(m=O.response)==null?void 0:m.data)==null?void 0:j.error)||"Ошибка сохранения","error")}},Ze=async m=>{var j,O;if(m&&!Re()){n("Сначала заполните все AI настройки","warning");return}try{await Ct.updateAiSettings({ai_enabled:m?1:0}),T(m),localStorage.setItem("ai_enabled",m?"1":"0"),n(m?"Помощь ИИ включена":"Помощь ИИ отключена","success")}catch(U){console.error("Ошибка сохранения настройки AI:",U),n(((O=(j=U.response)==null?void 0:j.data)==null?void 0:O.error)||"Ошибка сохранения","error"),T(!m)}},Re=()=>h.trim()&&S.trim()&&g.trim(),He=()=>{Re()||T(!1)},Ut=async()=>{I(!0);try{const m=await rs.getArchived();_(m)}catch(m){console.error("Ошибка загрузки архивных заметок:",m),n("Ошибка загрузки архивных заметок","error")}finally{I(!1)}},Pt=async m=>{var j,O;try{await rs.unarchive(Number(m)),await Ut(),n("Заметка восстановлена!","success")}catch(U){console.error("Ошибка восстановления заметки:",U),n(((O=(j=U.response)==null?void 0:j.data)==null?void 0:O.error)||"Ошибка восстановления","error")}},on=async m=>{var j,O;try{await rs.deleteArchived(Number(m)),await Ut(),n("Заметка удалена окончательно","success")}catch(U){console.error("Ошибка удаления заметки:",U),n(((O=(j=U.response)==null?void 0:j.data)==null?void 0:O.error)||"Ошибка удаления","error")}},ot=async()=>{var m,j;if(!F.trim()){n("Введите пароль","warning");return}G(!0);try{await rs.deleteAllArchived(F),n("Все архивные заметки удалены","success"),E(!1),W(""),await Ut()}catch(O){console.error("Ошибка:",O),n(((j=(m=O.response)==null?void 0:m.data)==null?void 0:j.error)||"Ошибка удаления","error")}finally{G(!1)}},et=k.useCallback(async(m=!1)=>{B(!0);try{const j=m?0:se,O=await C_.getLogs({action_type:Q||void 0,limit:Ie,offset:j});m?(q(O),J(O.length)):(q(U=>[...U,...O]),J(U=>U+O.length)),A(O.length===Ie)}catch(j){console.error("Ошибка загрузки логов:",j),n("Ошибка загрузки логов","error")}finally{B(!1)}},[Q,Ie,n,se]),In=m=>{re(m),J(0),A(!0)};k.useEffect(()=>{s==="logs"&&et(!0)},[Q,s,et]);const Kr=m=>({login:"Вход",logout:"Выход",register:"Регистрация",note_create:"Создание заметки",note_update:"Редактирование",note_delete:"Удаление",note_pin:"Закрепление",note_archive:"Архивирование",note_unarchive:"Восстановление",note_delete_permanent:"Окончательное удаление",profile_update:"Обновление профиля",ai_improve:"Улучшение через AI"})[m]||m,Ws=async()=>{xe(!0);try{await D.clearAllNotes(),await D.clearSyncQueue(),n("Локальный кэш IndexedDB успешно очищен","success"),Z(!1),await Qn()}catch(m){console.error("Ошибка очистки IndexedDB:",m),n("Ошибка очистки IndexedDB","error")}finally{xe(!1)}},Qn=async()=>{Se(!0);try{try{const m=await rs.getDataVersion();ue(m)}catch(m){console.error("Ошибка загрузки версии с сервера:",m),ue(null)}try{const m=r?await D.getDataVersionByUserId(r):await D.getDataVersion();jt(m)}catch(m){console.error("Ошибка загрузки версии из IndexedDB:",m),jt(null)}}catch(m){console.error("Ошибка загрузки версий данных:",m)}finally{Se(!1)}},Sl=async()=>{if(!navigator.onLine){n("Нет подключения к интернету","error");return}dt(!0);try{n("Начинаем принудительную синхронизацию...","info"),await $a.startSync(),console.log("[ForceSync] Loading all notes from server..."),await st.getAll(),await Qn(),n("Синхронизация завершена успешно","success")}catch(m){console.error("Ошибка принудительной синхронизации:",m),n("Ошибка при синхронизации","error")}finally{dt(!1)}},Xr=m=>{if(!m)return"Нет данных";try{const j=new Date(m.replace(" ","T")+"Z");return new Intl.DateTimeFormat("ru-RU",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(j)}catch{return m}},po=()=>{if(!ae||!he)return{status:"Неизвестно",color:"#999"};if(ae.total_notes!==he.total_notes)return{status:"Не синхронизировано",color:"#dc3545"};const m=ae.last_updated_at?new Date(ae.last_updated_at.replace(" ","T")+"Z").getTime():0,j=he.last_updated_at?new Date(he.last_updated_at.replace(" ","T")+"Z").getTime():0;return m===0&&j===0?{status:"Нет данных",color:"#999"}:Math.abs(m-j)<12e4?{status:"Синхронизировано",color:"#28a745"}:{status:"Не синхронизировано",color:"#dc3545"}};return u.jsxs("div",{className:"container",children:[u.jsxs("header",{className:"notes-header",children:[u.jsxs("span",{children:[u.jsx(M,{icon:"mdi:cog"})," Настройки"]}),u.jsxs("div",{className:"user-info",children:[u.jsx(uo,{}),u.jsx("button",{className:"notes-btn",onClick:()=>e("/notes"),title:"К заметкам",children:u.jsx(M,{icon:"mdi:note-text"})}),u.jsx("button",{className:"profile-btn",onClick:()=>e("/profile"),title:"Профиль",children:u.jsx(M,{icon:"mdi:account"})}),u.jsx("button",{className:"logout-btn",title:"Выйти",onClick:async()=>{try{await Wr.logout()}catch(m){console.error("Ошибка выхода:",m)}finally{D.clearAll().catch(m=>{console.error("Ошибка очистки IndexedDB при выходе:",m)}),t(Yi()),e("/")}},children:u.jsx(M,{icon:"mdi:logout"})})]})]}),u.jsxs("div",{className:"settings-tabs",children:[u.jsxs("button",{className:`settings-tab ${s==="appearance"?"active":""}`,onClick:()=>i("appearance"),children:[u.jsx(M,{icon:"mdi:palette"})," Внешний вид"]}),u.jsxs("button",{className:`settings-tab ${s==="ai"?"active":""}`,onClick:()=>i("ai"),children:[u.jsx(M,{icon:"mdi:robot"})," AI настройки"]}),u.jsxs("button",{className:`settings-tab ${s==="archive"?"active":""}`,onClick:()=>i("archive"),children:[u.jsx(M,{icon:"mdi:archive"})," Архив заметок"]}),u.jsxs("button",{className:`settings-tab ${s==="logs"?"active":""}`,onClick:()=>i("logs"),children:[u.jsx(M,{icon:"mdi:history"})," История действий"]}),u.jsxs("button",{className:`settings-tab ${s==="offline"?"active":""}`,onClick:()=>i("offline"),children:[u.jsx(M,{icon:"mdi:database-off"})," Оффлайн режим"]})]}),u.jsxs("div",{className:"settings-content",children:[s==="appearance"&&u.jsxs("div",{className:"tab-content active",children:[u.jsx("h3",{children:"Внешний вид"}),u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"settings-accentColor",children:"Цветовой акцент"}),u.jsx("div",{className:"accent-color-picker",children:Ae.map(m=>u.jsx("div",{className:`color-option ${o===m.color?"selected":""}`,"data-color":m.color,style:{backgroundColor:m.color},title:m.title,onClick:()=>a(m.color)},m.color))})]}),u.jsx("div",{className:"form-group ai-toggle-group",children:u.jsxs("label",{className:"ai-toggle-label",children:[u.jsxs("div",{className:"toggle-label-content",children:[u.jsx("span",{className:"toggle-text-main",children:"Показывать дату редактирования"}),u.jsx("span",{className:"toggle-text-desc",children:l?"Отображать дату последнего редактирования заметки рядом с датой создания":"Показывать только иконку карандаша без даты редактирования"})]}),u.jsxs("div",{className:"toggle-switch-wrapper",children:[u.jsx("input",{type:"checkbox",id:"show-edit-date-toggle",className:"toggle-checkbox",checked:l,onChange:m=>c(m.target.checked)}),u.jsx("span",{className:"toggle-slider"})]})]})}),u.jsx("div",{className:"form-group ai-toggle-group",children:u.jsxs("label",{className:"ai-toggle-label",children:[u.jsxs("div",{className:"toggle-label-content",children:[u.jsx("span",{className:"toggle-text-main",children:"Цветные иконки"}),u.jsx("span",{className:"toggle-text-desc",children:d?"Иконки отображаются разными цветами для лучшей визуальной дифференциации":"Все иконки отображаются в монохромном стиле"})]}),u.jsxs("div",{className:"toggle-switch-wrapper",children:[u.jsx("input",{type:"checkbox",id:"colored-icons-toggle",className:"toggle-checkbox",checked:d,onChange:m=>{f(m.target.checked),Je(m.target.checked)}}),u.jsx("span",{className:"toggle-slider"})]})]})}),u.jsx("div",{className:"form-group ai-toggle-group",children:u.jsxs("label",{className:"ai-toggle-label",children:[u.jsxs("div",{className:"toggle-label-content",children:[u.jsx("span",{className:"toggle-text-main",children:"Плавающая панель редактирования"}),u.jsx("span",{className:"toggle-text-desc",children:p?"Показывать плавающую панель инструментов при выделении текста в редакторе":"Скрывать плавающую панель инструментов при выделении текста"})]}),u.jsxs("div",{className:"toggle-switch-wrapper",children:[u.jsx("input",{type:"checkbox",id:"floating-toolbar-toggle",className:"toggle-checkbox",checked:p,onChange:m=>w(m.target.checked)}),u.jsx("span",{className:"toggle-slider"})]})]})}),u.jsx("button",{className:"btnSave",onClick:Te,children:"Сохранить изменения"})]}),s==="ai"&&u.jsxs("div",{className:"tab-content active",children:[u.jsx("h3",{children:"Настройки AI"}),u.jsx("div",{className:"form-group ai-toggle-group",children:u.jsxs("label",{className:`ai-toggle-label ${Re()?"":"disabled"}`,children:[u.jsxs("div",{className:"toggle-label-content",children:[u.jsx("span",{className:"toggle-text-main",children:"Включить помощь ИИ"}),u.jsx("span",{className:"toggle-text-desc",children:Re()?'Показывать кнопку "Помощь ИИ" в редакторах заметок':"Сначала заполните API Key, Base URL и Модель ниже"})]}),u.jsxs("div",{className:"toggle-switch-wrapper",children:[u.jsx("input",{type:"checkbox",id:"ai-enabled-toggle",className:"toggle-checkbox",checked:C,disabled:!Re(),onChange:m=>Ze(m.target.checked)}),u.jsx("span",{className:"toggle-slider"})]})]})}),u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"openai-api-key",children:"OpenAI API Key"}),u.jsx("input",{type:"password",id:"openai-api-key",placeholder:"sk-...",className:"form-input",value:h,onChange:m=>{y(m.target.value),He()}}),u.jsx("p",{style:{color:"#666",fontSize:"12px",marginTop:"5px"},children:"Введите ваш OpenAI API ключ"})]}),u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"openai-base-url",children:"OpenAI Base URL"}),u.jsx("input",{type:"text",id:"openai-base-url",placeholder:"https://api.openai.com/v1",className:"form-input",value:S,onChange:m=>{v(m.target.value),He()}}),u.jsx("p",{style:{color:"#666",fontSize:"12px",marginTop:"5px"},children:"URL для API запросов (например, https://api.openai.com/v1)"})]}),u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"openai-model",children:"Модель"}),u.jsx("input",{type:"text",id:"openai-model",placeholder:"gpt-3.5-turbo",className:"form-input",value:g,onChange:m=>{x(m.target.value),He()}}),u.jsxs("p",{style:{color:"#666",fontSize:"12px",marginTop:"5px"},children:["Название модели (например, gpt-4, deepseek/deepseek-chat).",u.jsxs("a",{href:"https://openrouter.ai/models",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent-color)"},children:[" ","Список доступных моделей"]})]})]}),u.jsx("button",{className:"btnSave",onClick:Ge,children:"Сохранить AI настройки"})]}),s==="archive"&&u.jsxs("div",{className:"tab-content active",children:[u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"10px"},children:[u.jsx("h3",{children:"Архивные заметки"}),u.jsxs("button",{className:"btn-danger",style:{fontSize:"14px",padding:"8px 16px"},onClick:()=>E(!0),children:[u.jsx(M,{icon:"mdi:delete-sweep"})," Удалить все"]})]}),u.jsx("p",{style:{color:"#666",fontSize:"14px",marginBottom:"20px"},children:"Архивированные заметки можно восстановить или удалить окончательно"}),u.jsx("div",{className:"archived-notes-list",children:P?u.jsx("p",{style:{textAlign:"center",color:"#999"},children:"Загрузка..."}):b.length===0?u.jsx("p",{style:{textAlign:"center",color:"#999"},children:"Архив пуст"}):b.map(m=>{const j=new Date(m.created_at.replace(" ","T")+"Z"),O=new Intl.DateTimeFormat("ru-RU",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(j),U=rf(m.content),X=U.substring(0,200)+(U.length>200?"...":"");return u.jsxs("div",{className:"archived-note-item",children:[u.jsxs("div",{className:"archived-note-header",children:[u.jsx("span",{className:"archived-note-date",children:O}),u.jsxs("div",{className:"archived-note-actions",children:[u.jsxs("button",{className:"btn-restore",onClick:()=>Pt(Number(m.id)),title:"Восстановить",children:[u.jsx(M,{icon:"mdi:restore"})," Восстановить"]}),u.jsxs("button",{className:"btn-delete-permanent",onClick:()=>on(Number(m.id)),title:"Удалить навсегда",children:[u.jsx(M,{icon:"mdi:delete-forever"})," Удалить"]})]})]}),u.jsx("div",{className:"archived-note-content",dangerouslySetInnerHTML:{__html:X}}),m.images&&m.images.length>0&&u.jsxs("div",{className:"archived-note-images",children:[m.images.length," изображений"]})]},m.id)})})]}),s==="logs"&&u.jsxs("div",{className:"tab-content active",children:[u.jsx("h3",{children:"История действий"}),u.jsxs("div",{className:"logs-filters",children:[u.jsxs("select",{id:"logTypeFilter",className:"log-filter-select",value:Q,onChange:m=>In(m.target.value),children:[u.jsx("option",{value:"",children:"Все действия"}),u.jsx("option",{value:"login",children:"Вход"}),u.jsx("option",{value:"logout",children:"Выход"}),u.jsx("option",{value:"register",children:"Регистрация"}),u.jsx("option",{value:"note_create",children:"Создание заметки"}),u.jsx("option",{value:"note_update",children:"Редактирование заметки"}),u.jsx("option",{value:"note_delete",children:"Удаление заметки"}),u.jsx("option",{value:"note_pin",children:"Закрепление"}),u.jsx("option",{value:"note_archive",children:"Архивирование"}),u.jsx("option",{value:"note_unarchive",children:"Восстановление"}),u.jsx("option",{value:"note_delete_permanent",children:"Окончательное удаление"}),u.jsx("option",{value:"profile_update",children:"Обновление профиля"}),u.jsx("option",{value:"ai_improve",children:"Улучшение через AI"})]}),u.jsxs("button",{className:"btnSave",onClick:()=>et(!0),children:[u.jsx(M,{icon:"mdi:refresh"})," Обновить"]})]}),u.jsx("div",{className:"logs-table-container",children:u.jsxs("table",{className:"logs-table",children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx("th",{children:"Дата и время"}),u.jsx("th",{children:"Действие"}),u.jsx("th",{children:"Детали"})]})}),u.jsx("tbody",{children:$&&R.length===0?u.jsx("tr",{children:u.jsx("td",{colSpan:3,style:{textAlign:"center"},children:"Загрузка..."})}):R.length===0?u.jsx("tr",{children:u.jsx("td",{colSpan:3,style:{textAlign:"center",color:"#999"},children:"Логов пока нет"})}):R.map(m=>{const j=new Date(m.created_at.replace(" ","T")+"Z"),O=new Intl.DateTimeFormat("ru-RU",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(j);return u.jsxs("tr",{children:[u.jsx("td",{children:O}),u.jsx("td",{children:u.jsx("span",{className:`log-action-badge log-action-${m.action_type}`,children:Kr(m.action_type)})}),u.jsx("td",{children:m.details||"-"})]},m.id)})})]})}),ne&&R.length>0&&u.jsx("div",{className:"load-more-container",children:u.jsx("button",{className:"btnSave",onClick:()=>et(!1),children:"Загрузить еще"})})]}),s==="offline"&&u.jsxs("div",{className:"tab-content active",children:[u.jsx("h3",{children:"Оффлайн режим"}),u.jsxs("div",{style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--border-color)",borderRadius:"8px",padding:"20px",marginBottom:"20px"},children:[u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"15px"},children:[u.jsxs("h4",{style:{margin:0,fontSize:"16px",fontWeight:"600"},children:[u.jsx(M,{icon:"mdi:database-sync",style:{marginRight:"8px",verticalAlign:"middle"}}),"Версии данных"]}),u.jsx("button",{onClick:Qn,disabled:Pe,style:{padding:"6px 12px",fontSize:"12px",border:"1px solid var(--border-color)",borderRadius:"4px",backgroundColor:"transparent",cursor:Pe?"not-allowed":"pointer",opacity:Pe?.6:1},title:"Обновить",children:u.jsx(M,{icon:Pe?"mdi:loading":"mdi:refresh"})})]}),Pe?u.jsx("p",{style:{textAlign:"center",color:"#999",margin:"20px 0"},children:"Загрузка..."}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{marginBottom:"15px"},children:[u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"5px"},children:[u.jsxs("span",{style:{fontWeight:"600",color:"var(--text-color)"},children:[u.jsx(M,{icon:"mdi:server",style:{marginRight:"6px",verticalAlign:"middle"}}),"Сервер:"]}),u.jsxs("span",{style:{fontSize:"12px",color:"#666"},children:[(ae==null?void 0:ae.total_notes)||0," заметок"]})]}),u.jsxs("div",{style:{fontSize:"13px",color:"#666",marginLeft:"24px"},children:[u.jsxs("div",{children:["Обновлено:"," ",Xr((ae==null?void 0:ae.last_updated_at)||null)]}),u.jsxs("div",{children:["Создано:"," ",Xr((ae==null?void 0:ae.last_created_at)||null)]})]})]}),u.jsxs("div",{style:{marginBottom:"15px"},children:[u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"5px"},children:[u.jsxs("span",{style:{fontWeight:"600",color:"var(--text-color)"},children:[u.jsx(M,{icon:"mdi:database",style:{marginRight:"6px",verticalAlign:"middle"}}),"IndexedDB (локально):"]}),u.jsxs("span",{style:{fontSize:"12px",color:"#666"},children:[(he==null?void 0:he.total_notes)||0," заметок"]})]}),u.jsxs("div",{style:{fontSize:"13px",color:"#666",marginLeft:"24px"},children:[u.jsxs("div",{children:["Обновлено:"," ",Xr((he==null?void 0:he.last_updated_at)||null)]}),u.jsxs("div",{children:["Создано:"," ",Xr((he==null?void 0:he.last_created_at)||null)]})]})]}),u.jsx("div",{style:{padding:"10px",backgroundColor:"var(--bg-color)",borderRadius:"6px",border:"1px solid var(--border-color)",marginTop:"15px"},children:u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[u.jsx("span",{style:{fontWeight:"600",fontSize:"14px"},children:"Статус синхронизации:"}),u.jsx("span",{style:{color:po().color,fontWeight:"600",fontSize:"13px"},children:po().status})]})}),u.jsxs("div",{style:{marginTop:"15px",paddingTop:"15px",borderTop:"1px solid var(--border-color)"},children:[u.jsxs("button",{onClick:Sl,disabled:be,style:{width:"100%",padding:"10px",fontSize:"14px",fontWeight:"600",border:"1px solid var(--border-color)",borderRadius:"6px",backgroundColor:"var(--accent-color)",color:"#fff",cursor:be?"not-allowed":"pointer",opacity:be?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:[u.jsx(M,{icon:be?"mdi:loading":"mdi:sync",style:{fontSize:"18px"}}),be?"Синхронизация...":"Принудительная синхронизация"]}),u.jsx("p",{style:{color:"#666",fontSize:"12px",marginTop:"8px",textAlign:"center"},children:"Запустить немедленную синхронизацию данных с сервером"})]})]})]}),u.jsx("p",{style:{color:"#666",fontSize:"14px",marginBottom:"20px"},children:"Очистка локального кэша IndexedDB. Это удалит все заметки, сохраненные в браузере для оффлайн-режима. Данные на сервере не будут затронуты."}),u.jsxs("button",{className:"btn-danger",onClick:()=>Z(!0),style:{fontSize:"14px",padding:"10px 20px"},children:[u.jsx(M,{icon:"mdi:database-remove"})," Очистить локальный кэш (IndexedDB)"]})]})]}),u.jsx(Ha,{isOpen:V,onClose:()=>{E(!1),W("")},onConfirm:ot,title:"Подтверждение удаления",message:u.jsxs(u.Fragment,{children:[u.jsx("p",{style:{color:"#dc3545",fontWeight:"bold",marginBottom:"15px"},children:"⚠️ ВНИМАНИЕ: Это действие нельзя отменить!"}),u.jsx("p",{style:{marginBottom:"20px"},children:"Вы действительно хотите удалить ВСЕ архивные заметки? Все заметки и их изображения будут удалены навсегда."}),u.jsxs("div",{style:{marginBottom:"15px"},children:[u.jsx("label",{htmlFor:"deleteAllPassword",style:{display:"block",marginBottom:"5px",fontWeight:"bold"},children:"Введите пароль для подтверждения:"}),u.jsx("input",{type:"password",id:"deleteAllPassword",placeholder:"Пароль от аккаунта",className:"modal-password-input",value:F,onChange:m=>W(m.target.value),onKeyPress:m=>{m.key==="Enter"&&!z&&ot()}})]})]}),confirmText:z?"Удаление...":"Удалить все",cancelText:"Отмена",confirmType:"danger"}),u.jsx(Ha,{isOpen:K,onClose:()=>{Z(!1)},onConfirm:Ws,title:"Подтверждение очистки IndexedDB",message:u.jsxs(u.Fragment,{children:[u.jsx("p",{style:{color:"#dc3545",fontWeight:"bold",marginBottom:"15px"},children:"⚠️ ВНИМАНИЕ: Это действие нельзя отменить!"}),u.jsxs("p",{style:{marginBottom:"20px"},children:["Вы действительно хотите очистить локальный кэш IndexedDB? Все заметки, сохраненные в браузере для оффлайн-режима, будут удалены.",u.jsx("br",{}),u.jsx("br",{}),u.jsx("strong",{children:"Данные на сервере не будут затронуты."})," После очистки данные будут автоматически загружены с сервера при следующем подключении к интернету."]})]}),confirmText:ve?"Очистка...":"Очистить",cancelText:"Отмена",confirmType:"danger"})]})},L_=()=>{const e=oe(n=>n.ui.notifications),t=yt();return u.jsx("div",{className:"notification-stack",children:e.map((n,r)=>u.jsx(M_,{notification:n,index:r,onRemove:()=>t(gv(n.id))},n.id))})},M_=({notification:e,index:t,onRemove:n})=>{const[r,s]=k.useState(!1);k.useEffect(()=>{setTimeout(()=>s(!0),100)},[]),k.useEffect(()=>{const o=setTimeout(()=>{i()},4e3);return()=>clearTimeout(o)},[]);const i=()=>{s(!1),setTimeout(n,300)};return u.jsx("div",{className:`notification notification-${e.type} ${r?"visible":""}`,style:{top:`${20+t*70}px`},onClick:i,children:e.message})},A_=()=>{const[e,t]=k.useState(null),[n,r]=k.useState(!1);k.useEffect(()=>{const o=a=>{if(a.preventDefault(),window.matchMedia("(display-mode: standalone)").matches)return;const l=localStorage.getItem("pwa-install-dismissed");if(l){const c=new Date(l).getTime(),d=new Date().getTime(),f=7*24*60*60*1e3;if(d-cr(!0),2e3)};return window.addEventListener("beforeinstallprompt",o),()=>{window.removeEventListener("beforeinstallprompt",o)}},[]);const s=async()=>{if(!e)return;e.prompt();const{outcome:o}=await e.userChoice;if(o==="accepted"){console.log("Пользователь принял предложение об установке");const a=new Date().toISOString();localStorage.setItem("pwa-install-dismissed",a)}else console.log("Пользователь отклонил предложение об установке");t(null),r(!1)},i=()=>{r(!1);const o=new Date().toISOString();localStorage.setItem("pwa-install-dismissed",o)};return!n||!e?null:u.jsxs("div",{style:{position:"fixed",bottom:"20px",left:"50%",transform:"translateX(-50%)",backgroundColor:"var(--bg-primary)",border:"1px solid var(--border-primary)",borderRadius:"12px",padding:"16px 20px",boxShadow:"0 4px 20px var(--shadow-light)",zIndex:1e3,maxWidth:"90%",width:"400px",display:"flex",alignItems:"center",gap:"12px"},children:[u.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"4px"},children:[u.jsx("div",{style:{fontWeight:600,fontSize:"14px",color:"var(--text-primary)"},children:"Установить NoteJS?"}),u.jsx("div",{style:{fontSize:"12px",color:"var(--text-primary)",opacity:.7},children:"Установите приложение для быстрого доступа"})]}),u.jsxs("div",{style:{display:"flex",gap:"8px"},children:[u.jsxs("button",{onClick:s,style:{padding:"8px 16px",backgroundColor:"var(--accent-color)",color:"white",border:"none",borderRadius:"8px",cursor:"pointer",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px"},children:[u.jsx(M,{icon:"mdi:download",width:"18",height:"18"}),"Установить"]}),u.jsx("button",{onClick:i,style:{padding:"8px",backgroundColor:"transparent",color:"var(--text-primary)",border:"none",borderRadius:"8px",cursor:"pointer",display:"flex",alignItems:"center",opacity:.6},"aria-label":"Закрыть",children:u.jsx(M,{icon:"mdi:close",width:"20",height:"20"})})]})]})},$_=()=>u.jsx("div",{className:"loading-overlay",children:u.jsx("div",{className:"loading-content",children:u.jsx("div",{className:"loading-spinner"})})}),lc=({children:e})=>{const t=oe(o=>o.auth.isAuthenticated),n=oe(o=>o.auth.userId),r=yt(),[s,i]=k.useState(!0);return k.useEffect(()=>{(async()=>{try{const a=await Wr.checkStatus();if(a.authenticated){const l=a.userId;n&&n!==l&&(console.log(`[ProtectedRoute] User changed from ${n} to ${l}, clearing IndexedDB`),await D.clearAll()),r(Rd({userId:l,username:a.username}))}else r(Yi())}catch{r(Yi())}finally{i(!1)}})()},[r,n]),s?u.jsx($_,{}):t?u.jsx(u.Fragment,{children:e}):u.jsx(Kg,{to:"/",replace:!0})},F_=()=>(iy(),u.jsxs(u.Fragment,{children:[u.jsx(L_,{}),u.jsx(A_,{}),u.jsx(fS,{children:u.jsxs(sS,{children:[u.jsx(Er,{path:"/",element:u.jsx(SC,{})}),u.jsx(Er,{path:"/register",element:u.jsx(kC,{})}),u.jsx(Er,{path:"/notes",element:u.jsx(lc,{children:u.jsx(R_,{})})}),u.jsx(Er,{path:"/profile",element:u.jsx(lc,{children:u.jsx(O_,{})})}),u.jsx(Er,{path:"/settings",element:u.jsx(lc,{children:u.jsx(D_,{})})}),u.jsx(Er,{path:"*",element:u.jsx(Kg,{to:"/",replace:!0})})]})})]})),z_=()=>u.jsx(MS,{store:ee,children:u.jsx(F_,{})});async function U_(){try{console.log("[Init] Initializing offline mode..."),await D.init(),console.log("[Init] IndexedDB initialized");const e=await Eu();ee.dispatch(bi(!e)),console.log(`[Init] Network status: ${e?"online":"offline"}`),dh.onOnline(async()=>{console.log("[Network] Online event detected");const n=await Eu();ee.dispatch(bi(!n)),n&&(ee.dispatch(bs({message:"Подключение восстановлено, начинаем синхронизацию...",type:"info"})),await $a.startSync())}),dh.onOffline(()=>{console.log("[Network] Offline event detected"),ee.dispatch(bi(!0)),ee.dispatch(bs({message:"Работаем в offline режиме",type:"warning"}))});const t=await D.getPendingSyncCount();ee.dispatch(Od(t)),t>0&&console.log(`[Init] Found ${t} pending sync items`),e&&t>0&&(console.log("[Init] Starting initial sync..."),setTimeout(()=>{$a.startSync()},2e3)),console.log("[Init] Offline mode initialized successfully")}catch(e){console.error("[Init] Error initializing offline mode:",e)}}U_();cc.createRoot(document.getElementById("root")).render(u.jsx(vn.StrictMode,{children:u.jsx(z_,{})})); diff --git a/backend/public/assets/index-CRKRzJj1.js b/backend/public/assets/index-CRKRzJj1.js deleted file mode 100644 index badf865..0000000 --- a/backend/public/assets/index-CRKRzJj1.js +++ /dev/null @@ -1,272 +0,0 @@ -var uy=Object.defineProperty;var cy=(e,t,n)=>t in e?uy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ve=(e,t,n)=>cy(e,typeof t!="symbol"?t+"":t,n);function dy(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function fy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Kp={exports:{}},fl={},Xp={exports:{}},ie={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var bs=Symbol.for("react.element"),py=Symbol.for("react.portal"),hy=Symbol.for("react.fragment"),my=Symbol.for("react.strict_mode"),gy=Symbol.for("react.profiler"),vy=Symbol.for("react.provider"),yy=Symbol.for("react.context"),wy=Symbol.for("react.forward_ref"),xy=Symbol.for("react.suspense"),ky=Symbol.for("react.memo"),Sy=Symbol.for("react.lazy"),Rd=Symbol.iterator;function Ey(e){return e===null||typeof e!="object"?null:(e=Rd&&e[Rd]||e["@@iterator"],typeof e=="function"?e:null)}var Jp={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Zp=Object.assign,eh={};function si(e,t,n){this.props=e,this.context=t,this.refs=eh,this.updater=n||Jp}si.prototype.isReactComponent={};si.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};si.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function th(){}th.prototype=si.prototype;function rc(e,t,n){this.props=e,this.context=t,this.refs=eh,this.updater=n||Jp}var ic=rc.prototype=new th;ic.constructor=rc;Zp(ic,si.prototype);ic.isPureReactComponent=!0;var Od=Array.isArray,nh=Object.prototype.hasOwnProperty,sc={current:null},rh={key:!0,ref:!0,__self:!0,__source:!0};function ih(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)nh.call(t,r)&&!rh.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1>>1,$=O[L];if(0>>1;Li(J,P))oe<$&&0>i(le,J)?(O[L]=le,O[oe]=P,L=oe):(O[L]=J,O[G]=P,L=G);else if(oe<$&&0>i(le,P))O[L]=le,O[oe]=P,L=oe;else break e}}return b}function i(O,b){var P=O.sortIndex-b.sortIndex;return P!==0?P:O.id-b.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var a=[],u=[],d=1,f=null,p=3,w=!1,h=!1,v=!1,k=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,m=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(O){for(var b=n(u);b!==null;){if(b.callback===null)r(u);else if(b.startTime<=O)r(u),b.sortIndex=b.expirationTime,t(a,b);else break;b=n(u)}}function C(O){if(v=!1,y(O),!h)if(n(a)!==null)h=!0,Q(j);else{var b=n(u);b!==null&&se(C,b.startTime-O)}}function j(O,b){h=!1,v&&(v=!1,g(_),_=-1),w=!0;var P=p;try{for(y(b),f=n(a);f!==null&&(!(f.expirationTime>b)||O&&!q());){var L=f.callback;if(typeof L=="function"){f.callback=null,p=f.priorityLevel;var $=L(f.expirationTime<=b);b=e.unstable_now(),typeof $=="function"?f.callback=$:f===n(a)&&r(a),y(b)}else r(a);f=n(a)}if(f!==null)var H=!0;else{var G=n(u);G!==null&&se(C,G.startTime-b),H=!1}return H}finally{f=null,p=P,w=!1}}var S=!1,N=null,_=-1,D=5,M=-1;function q(){return!(e.unstable_now()-MO||125L?(O.sortIndex=P,t(u,O),n(a)===null&&O===n(u)&&(v?(g(_),_=-1):v=!0,se(C,P-L))):(O.sortIndex=$,t(a,O),h||w||(h=!0,Q(j))),O},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(O){var b=p;return function(){var P=p;p=b;try{return O.apply(this,arguments)}finally{p=P}}}})(uh);ah.exports=uh;var My=ah.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Dy=x,_t=My;function I(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$a=Object.prototype.hasOwnProperty,Ay=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Id={},Md={};function $y(e){return $a.call(Md,e)?!0:$a.call(Id,e)?!1:Ay.test(e)?Md[e]=!0:(Id[e]=!0,!1)}function zy(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Fy(e,t,n,r){if(t===null||typeof t>"u"||zy(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function ht(e,t,n,r,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var Ze={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ze[e]=new ht(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ze[t]=new ht(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ze[e]=new ht(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ze[e]=new ht(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Ze[e]=new ht(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ze[e]=new ht(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ze[e]=new ht(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ze[e]=new ht(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ze[e]=new ht(e,5,!1,e.toLowerCase(),null,!1,!1)});var lc=/[\-:]([a-z])/g;function ac(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(lc,ac);Ze[t]=new ht(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(lc,ac);Ze[t]=new ht(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(lc,ac);Ze[t]=new ht(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ze[e]=new ht(e,1,!1,e.toLowerCase(),null,!1,!1)});Ze.xlinkHref=new ht("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ze[e]=new ht(e,1,!1,e.toLowerCase(),null,!0,!0)});function uc(e,t,n,r){var i=Ze.hasOwnProperty(t)?Ze[t]:null;(i!==null?i.type!==0:r||!(2l||i[o]!==s[l]){var a=` -`+i[o].replace(" at new "," at ");return e.displayName&&a.includes("")&&(a=a.replace("",e.displayName)),a}while(1<=o&&0<=l);break}}}finally{Zl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Mi(e):""}function Uy(e){switch(e.tag){case 5:return Mi(e.type);case 16:return Mi("Lazy");case 13:return Mi("Suspense");case 19:return Mi("SuspenseList");case 0:case 2:case 15:return e=ea(e.type,!1),e;case 11:return e=ea(e.type.render,!1),e;case 1:return e=ea(e.type,!0),e;default:return""}}function Ba(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Or:return"Fragment";case Rr:return"Portal";case za:return"Profiler";case cc:return"StrictMode";case Fa:return"Suspense";case Ua:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case fh:return(e.displayName||"Context")+".Consumer";case dh:return(e._context.displayName||"Context")+".Provider";case dc:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case fc:return t=e.displayName||null,t!==null?t:Ba(e.type)||"Memo";case Nn:t=e._payload,e=e._init;try{return Ba(e(t))}catch{}}return null}function By(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ba(t);case 8:return t===cc?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Bn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function hh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Wy(e){var t=hh(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Fs(e){e._valueTracker||(e._valueTracker=Wy(e))}function mh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=hh(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function To(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Wa(e,t){var n=t.checked;return je({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ad(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Bn(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function gh(e,t){t=t.checked,t!=null&&uc(e,"checked",t,!1)}function Ha(e,t){gh(e,t);var n=Bn(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Va(e,t.type,n):t.hasOwnProperty("defaultValue")&&Va(e,t.type,Bn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $d(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Va(e,t,n){(t!=="number"||To(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Di=Array.isArray;function Wr(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Us.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ts(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Bi={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Hy=["Webkit","ms","Moz","O"];Object.keys(Bi).forEach(function(e){Hy.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Bi[t]=Bi[e]})});function xh(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Bi.hasOwnProperty(e)&&Bi[e]?(""+t).trim():t+"px"}function kh(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=xh(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var Vy=je({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ga(e,t){if(t){if(Vy[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(I(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(I(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(I(61))}if(t.style!=null&&typeof t.style!="object")throw Error(I(62))}}function Ya(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ka=null;function pc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Xa=null,Hr=null,Vr=null;function Ud(e){if(e=js(e)){if(typeof Xa!="function")throw Error(I(280));var t=e.stateNode;t&&(t=vl(t),Xa(e.stateNode,e.type,t))}}function Sh(e){Hr?Vr?Vr.push(e):Vr=[e]:Hr=e}function Eh(){if(Hr){var e=Hr,t=Vr;if(Vr=Hr=null,Ud(e),t)for(e=0;e>>=0,e===0?32:31-(nw(e)/rw|0)|0}var Bs=64,Ws=4194304;function Ai(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ro(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=Ai(l):(s&=o,s!==0&&(r=Ai(s)))}else o=n&~i,o!==0?r=Ai(o):s!==0&&(r=Ai(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Ns(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Kt(t),e[t]=n}function lw(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Hi),Kd=" ",Xd=!1;function Wh(e,t){switch(e){case"keyup":return Mw.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Lr=!1;function Aw(e,t){switch(e){case"compositionend":return Hh(t);case"keypress":return t.which!==32?null:(Xd=!0,Kd);case"textInput":return e=t.data,e===Kd&&Xd?null:e;default:return null}}function $w(e,t){if(Lr)return e==="compositionend"||!kc&&Wh(e,t)?(e=Uh(),po=yc=Pn=null,Lr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=tf(n)}}function Gh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Gh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Yh(){for(var e=window,t=To();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=To(e.document)}return t}function Sc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function qw(e){var t=Yh(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Gh(n.ownerDocument.documentElement,n)){if(r!==null&&Sc(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=nf(n,s);var o=nf(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Ir=null,ru=null,Qi=null,iu=!1;function rf(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;iu||Ir==null||Ir!==To(r)||(r=Ir,"selectionStart"in r&&Sc(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Qi&&ls(Qi,r)||(Qi=r,r=Io(ru,"onSelect"),0Ar||(e.current=cu[Ar],cu[Ar]=null,Ar--)}function ke(e,t){Ar++,cu[Ar]=e.current,e.current=t}var Wn={},st=Qn(Wn),yt=Qn(!1),hr=Wn;function Xr(e,t){var n=e.type.contextTypes;if(!n)return Wn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function wt(e){return e=e.childContextTypes,e!=null}function Do(){Ee(yt),Ee(st)}function df(e,t,n){if(st.current!==Wn)throw Error(I(168));ke(st,t),ke(yt,n)}function im(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(I(108,By(e)||"Unknown",i));return je({},n,r)}function Ao(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Wn,hr=st.current,ke(st,e),ke(yt,yt.current),!0}function ff(e,t,n){var r=e.stateNode;if(!r)throw Error(I(169));n?(e=im(e,t,hr),r.__reactInternalMemoizedMergedChildContext=e,Ee(yt),Ee(st),ke(st,e)):Ee(yt),ke(yt,n)}var pn=null,yl=!1,ha=!1;function sm(e){pn===null?pn=[e]:pn.push(e)}function s0(e){yl=!0,sm(e)}function qn(){if(!ha&&pn!==null){ha=!0;var e=0,t=me;try{var n=pn;for(me=1;e>=o,i-=o,hn=1<<32-Kt(t)+i|n<_?(D=N,N=null):D=N.sibling;var M=p(g,N,y[_],C);if(M===null){N===null&&(N=D);break}e&&N&&M.alternate===null&&t(g,N),m=s(M,m,_),S===null?j=M:S.sibling=M,S=M,N=D}if(_===y.length)return n(g,N),be&&tr(g,_),j;if(N===null){for(;__?(D=N,N=null):D=N.sibling;var q=p(g,N,M.value,C);if(q===null){N===null&&(N=D);break}e&&N&&q.alternate===null&&t(g,N),m=s(q,m,_),S===null?j=q:S.sibling=q,S=q,N=D}if(M.done)return n(g,N),be&&tr(g,_),j;if(N===null){for(;!M.done;_++,M=y.next())M=f(g,M.value,C),M!==null&&(m=s(M,m,_),S===null?j=M:S.sibling=M,S=M);return be&&tr(g,_),j}for(N=r(g,N);!M.done;_++,M=y.next())M=w(N,g,_,M.value,C),M!==null&&(e&&M.alternate!==null&&N.delete(M.key===null?_:M.key),m=s(M,m,_),S===null?j=M:S.sibling=M,S=M);return e&&N.forEach(function(X){return t(g,X)}),be&&tr(g,_),j}function k(g,m,y,C){if(typeof y=="object"&&y!==null&&y.type===Or&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case zs:e:{for(var j=y.key,S=m;S!==null;){if(S.key===j){if(j=y.type,j===Or){if(S.tag===7){n(g,S.sibling),m=i(S,y.props.children),m.return=g,g=m;break e}}else if(S.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Nn&&mf(j)===S.type){n(g,S.sibling),m=i(S,y.props),m.ref=Ni(g,S,y),m.return=g,g=m;break e}n(g,S);break}else t(g,S);S=S.sibling}y.type===Or?(m=dr(y.props.children,g.mode,C,y.key),m.return=g,g=m):(C=ko(y.type,y.key,y.props,null,g.mode,C),C.ref=Ni(g,m,y),C.return=g,g=C)}return o(g);case Rr:e:{for(S=y.key;m!==null;){if(m.key===S)if(m.tag===4&&m.stateNode.containerInfo===y.containerInfo&&m.stateNode.implementation===y.implementation){n(g,m.sibling),m=i(m,y.children||[]),m.return=g,g=m;break e}else{n(g,m);break}else t(g,m);m=m.sibling}m=Sa(y,g.mode,C),m.return=g,g=m}return o(g);case Nn:return S=y._init,k(g,m,S(y._payload),C)}if(Di(y))return h(g,m,y,C);if(ki(y))return v(g,m,y,C);Ks(g,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,m!==null&&m.tag===6?(n(g,m.sibling),m=i(m,y),m.return=g,g=m):(n(g,m),m=ka(y,g.mode,C),m.return=g,g=m),o(g)):n(g,m)}return k}var Zr=um(!0),cm=um(!1),Fo=Qn(null),Uo=null,Fr=null,Nc=null;function Tc(){Nc=Fr=Uo=null}function jc(e){var t=Fo.current;Ee(Fo),e._currentValue=t}function pu(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function qr(e,t){Uo=e,Nc=Fr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(vt=!0),e.firstContext=null)}function zt(e){var t=e._currentValue;if(Nc!==e)if(e={context:e,memoizedValue:t,next:null},Fr===null){if(Uo===null)throw Error(I(308));Fr=e,Uo.dependencies={lanes:0,firstContext:e}}else Fr=Fr.next=e;return t}var lr=null;function _c(e){lr===null?lr=[e]:lr.push(e)}function dm(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,_c(t)):(n.next=i.next,i.next=n),t.interleaved=n,xn(e,r)}function xn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Tn=!1;function Pc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function fm(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function gn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function An(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ae&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,xn(e,n)}return i=r.interleaved,i===null?(t.next=t,_c(r)):(t.next=i.next,i.next=t),r.interleaved=t,xn(e,n)}function mo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,mc(e,n)}}function gf(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Bo(e,t,n,r){var i=e.updateQueue;Tn=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var a=l,u=a.next;a.next=null,o===null?s=u:o.next=u,o=a;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=a))}if(s!==null){var f=i.baseState;o=0,d=u=a=null,l=s;do{var p=l.lane,w=l.eventTime;if((r&p)===p){d!==null&&(d=d.next={eventTime:w,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var h=e,v=l;switch(p=t,w=n,v.tag){case 1:if(h=v.payload,typeof h=="function"){f=h.call(w,f,p);break e}f=h;break e;case 3:h.flags=h.flags&-65537|128;case 0:if(h=v.payload,p=typeof h=="function"?h.call(w,f,p):h,p==null)break e;f=je({},f,p);break e;case 2:Tn=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=i.effects,p===null?i.effects=[l]:p.push(l))}else w={eventTime:w,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=w,a=f):d=d.next=w,o|=p;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;p=l,l=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(d===null&&(a=f),i.baseState=a,i.firstBaseUpdate=u,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);vr|=o,e.lanes=o,e.memoizedState=f}}function vf(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=ga.transition;ga.transition={};try{e(!1),t()}finally{me=n,ga.transition=r}}function _m(){return Ft().memoizedState}function u0(e,t,n){var r=zn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Pm(e))Rm(t,n);else if(n=dm(e,t,n,r),n!==null){var i=ft();Xt(n,e,r,i),Om(n,t,r)}}function c0(e,t,n){var r=zn(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Pm(e))Rm(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,l=s(o,n);if(i.hasEagerState=!0,i.eagerState=l,Zt(l,o)){var a=t.interleaved;a===null?(i.next=i,_c(t)):(i.next=a.next,a.next=i),t.interleaved=i;return}}catch{}finally{}n=dm(e,t,i,r),n!==null&&(i=ft(),Xt(n,e,r,i),Om(n,t,r))}}function Pm(e){var t=e.alternate;return e===Te||t!==null&&t===Te}function Rm(e,t){qi=Ho=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Om(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,mc(e,n)}}var Vo={readContext:zt,useCallback:tt,useContext:tt,useEffect:tt,useImperativeHandle:tt,useInsertionEffect:tt,useLayoutEffect:tt,useMemo:tt,useReducer:tt,useRef:tt,useState:tt,useDebugValue:tt,useDeferredValue:tt,useTransition:tt,useMutableSource:tt,useSyncExternalStore:tt,useId:tt,unstable_isNewReconciler:!1},d0={readContext:zt,useCallback:function(e,t){return sn().memoizedState=[e,t===void 0?null:t],e},useContext:zt,useEffect:wf,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,vo(4194308,4,Cm.bind(null,t,e),n)},useLayoutEffect:function(e,t){return vo(4194308,4,e,t)},useInsertionEffect:function(e,t){return vo(4,2,e,t)},useMemo:function(e,t){var n=sn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=sn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=u0.bind(null,Te,e),[r.memoizedState,e]},useRef:function(e){var t=sn();return e={current:e},t.memoizedState=e},useState:yf,useDebugValue:$c,useDeferredValue:function(e){return sn().memoizedState=e},useTransition:function(){var e=yf(!1),t=e[0];return e=a0.bind(null,e[1]),sn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Te,i=sn();if(be){if(n===void 0)throw Error(I(407));n=n()}else{if(n=t(),Ye===null)throw Error(I(349));gr&30||gm(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,wf(ym.bind(null,r,s,e),[e]),r.flags|=2048,ms(9,vm.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=sn(),t=Ye.identifierPrefix;if(be){var n=mn,r=hn;n=(r&~(1<<32-Kt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ps++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[on]=t,e[cs]=r,Bm(e,t,!1,!1),t.stateNode=e;e:{switch(o=Ya(n,r),n){case"dialog":Se("cancel",e),Se("close",e),i=r;break;case"iframe":case"object":case"embed":Se("load",e),i=r;break;case"video":case"audio":for(i=0;i<$i.length;i++)Se($i[i],e);i=r;break;case"source":Se("error",e),i=r;break;case"img":case"image":case"link":Se("error",e),Se("load",e),i=r;break;case"details":Se("toggle",e),i=r;break;case"input":Ad(e,r),i=Wa(e,r),Se("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=je({},r,{value:void 0}),Se("invalid",e);break;case"textarea":zd(e,r),i=Qa(e,r),Se("invalid",e);break;default:i=r}Ga(n,i),l=i;for(s in l)if(l.hasOwnProperty(s)){var a=l[s];s==="style"?kh(e,a):s==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&wh(e,a)):s==="children"?typeof a=="string"?(n!=="textarea"||a!=="")&&ts(e,a):typeof a=="number"&&ts(e,""+a):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(es.hasOwnProperty(s)?a!=null&&s==="onScroll"&&Se("scroll",e):a!=null&&uc(e,s,a,o))}switch(n){case"input":Fs(e),$d(e,r,!1);break;case"textarea":Fs(e),Fd(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Bn(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?Wr(e,!!r.multiple,s,!1):r.defaultValue!=null&&Wr(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=Mo)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return nt(t),null;case 6:if(e&&t.stateNode!=null)Hm(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(I(166));if(n=ar(fs.current),ar(cn.current),Ys(t)){if(r=t.stateNode,n=t.memoizedProps,r[on]=t,(s=r.nodeValue!==n)&&(e=jt,e!==null))switch(e.tag){case 3:Gs(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Gs(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[on]=t,t.stateNode=r}return nt(t),null;case 13:if(Ee(Ne),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(be&&Tt!==null&&t.mode&1&&!(t.flags&128))am(),Jr(),t.flags|=98560,s=!1;else if(s=Ys(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(I(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(I(317));s[on]=t}else Jr(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;nt(t),s=!1}else Qt!==null&&(_u(Qt),Qt=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Ne.current&1?We===0&&(We=3):Vc())),t.updateQueue!==null&&(t.flags|=4),nt(t),null);case 4:return ei(),ku(e,t),e===null&&as(t.stateNode.containerInfo),nt(t),null;case 10:return jc(t.type._context),nt(t),null;case 17:return wt(t.type)&&Do(),nt(t),null;case 19:if(Ee(Ne),s=t.memoizedState,s===null)return nt(t),null;if(r=(t.flags&128)!==0,o=s.rendering,o===null)if(r)Ti(s,!1);else{if(We!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Wo(e),o!==null){for(t.flags|=128,Ti(s,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,e=o.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return ke(Ne,Ne.current&1|2),t.child}e=e.sibling}s.tail!==null&&Le()>ni&&(t.flags|=128,r=!0,Ti(s,!1),t.lanes=4194304)}else{if(!r)if(e=Wo(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ti(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!be)return nt(t),null}else 2*Le()-s.renderingStartTime>ni&&n!==1073741824&&(t.flags|=128,r=!0,Ti(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Le(),t.sibling=null,n=Ne.current,ke(Ne,r?n&1|2:n&1),t):(nt(t),null);case 22:case 23:return Hc(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Nt&1073741824&&(nt(t),t.subtreeFlags&6&&(t.flags|=8192)):nt(t),null;case 24:return null;case 25:return null}throw Error(I(156,t.tag))}function w0(e,t){switch(Cc(t),t.tag){case 1:return wt(t.type)&&Do(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ei(),Ee(yt),Ee(st),Lc(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Oc(t),null;case 13:if(Ee(Ne),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(I(340));Jr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ee(Ne),null;case 4:return ei(),null;case 10:return jc(t.type._context),null;case 22:case 23:return Hc(),null;case 24:return null;default:return null}}var Js=!1,rt=!1,x0=typeof WeakSet=="function"?WeakSet:Set,B=null;function Ur(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Re(e,t,r)}else n.current=null}function Su(e,t,n){try{n()}catch(r){Re(e,t,r)}}var Pf=!1;function k0(e,t){if(su=Oo,e=Yh(),Sc(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,l=-1,a=-1,u=0,d=0,f=e,p=null;t:for(;;){for(var w;f!==n||i!==0&&f.nodeType!==3||(l=o+i),f!==s||r!==0&&f.nodeType!==3||(a=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(w=f.firstChild)!==null;)p=f,f=w;for(;;){if(f===e)break t;if(p===n&&++u===i&&(l=o),p===s&&++d===r&&(a=o),(w=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=w}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(ou={focusedElem:e,selectionRange:n},Oo=!1,B=t;B!==null;)if(t=B,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,B=e;else for(;B!==null;){t=B;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var v=h.memoizedProps,k=h.memoizedState,g=t.stateNode,m=g.getSnapshotBeforeUpdate(t.elementType===t.type?v:Ht(t.type,v),k);g.__reactInternalSnapshotBeforeUpdate=m}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(I(163))}}catch(C){Re(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,B=e;break}B=t.return}return h=Pf,Pf=!1,h}function Gi(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&Su(t,n,s)}i=i.next}while(i!==r)}}function kl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Eu(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Vm(e){var t=e.alternate;t!==null&&(e.alternate=null,Vm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[on],delete t[cs],delete t[uu],delete t[r0],delete t[i0])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Qm(e){return e.tag===5||e.tag===3||e.tag===4}function Rf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Qm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Cu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Mo));else if(r!==4&&(e=e.child,e!==null))for(Cu(e,t,n),e=e.sibling;e!==null;)Cu(e,t,n),e=e.sibling}function bu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(bu(e,t,n),e=e.sibling;e!==null;)bu(e,t,n),e=e.sibling}var Xe=null,Vt=!1;function Cn(e,t,n){for(n=n.child;n!==null;)qm(e,t,n),n=n.sibling}function qm(e,t,n){if(un&&typeof un.onCommitFiberUnmount=="function")try{un.onCommitFiberUnmount(pl,n)}catch{}switch(n.tag){case 5:rt||Ur(n,t);case 6:var r=Xe,i=Vt;Xe=null,Cn(e,t,n),Xe=r,Vt=i,Xe!==null&&(Vt?(e=Xe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Xe.removeChild(n.stateNode));break;case 18:Xe!==null&&(Vt?(e=Xe,n=n.stateNode,e.nodeType===8?pa(e.parentNode,n):e.nodeType===1&&pa(e,n),ss(e)):pa(Xe,n.stateNode));break;case 4:r=Xe,i=Vt,Xe=n.stateNode.containerInfo,Vt=!0,Cn(e,t,n),Xe=r,Vt=i;break;case 0:case 11:case 14:case 15:if(!rt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Su(n,t,o),i=i.next}while(i!==r)}Cn(e,t,n);break;case 1:if(!rt&&(Ur(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Re(n,t,l)}Cn(e,t,n);break;case 21:Cn(e,t,n);break;case 22:n.mode&1?(rt=(r=rt)||n.memoizedState!==null,Cn(e,t,n),rt=r):Cn(e,t,n);break;default:Cn(e,t,n)}}function Of(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new x0),t.forEach(function(r){var i=P0.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Wt(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=Le()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*E0(r/1960))-r,10e?16:e,Rn===null)var r=!1;else{if(e=Rn,Rn=null,Go=0,ae&6)throw Error(I(331));var i=ae;for(ae|=4,B=e.current;B!==null;){var s=B,o=s.child;if(B.flags&16){var l=s.deletions;if(l!==null){for(var a=0;aLe()-Bc?cr(e,0):Uc|=n),xt(e,t)}function tg(e,t){t===0&&(e.mode&1?(t=Ws,Ws<<=1,!(Ws&130023424)&&(Ws=4194304)):t=1);var n=ft();e=xn(e,t),e!==null&&(Ns(e,t,n),xt(e,n))}function _0(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),tg(e,n)}function P0(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(I(314))}r!==null&&r.delete(t),tg(e,n)}var ng;ng=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||yt.current)vt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return vt=!1,v0(e,t,n);vt=!!(e.flags&131072)}else vt=!1,be&&t.flags&1048576&&om(t,zo,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;yo(e,t),e=t.pendingProps;var i=Xr(t,st.current);qr(t,n),i=Mc(null,t,r,e,i,n);var s=Dc();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,wt(r)?(s=!0,Ao(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Pc(t),i.updater=xl,t.stateNode=i,i._reactInternals=t,mu(t,r,e,n),t=yu(null,t,r,!0,s,n)):(t.tag=0,be&&s&&Ec(t),ut(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(yo(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=O0(r),e=Ht(r,e),i){case 0:t=vu(null,t,r,e,n);break e;case 1:t=Tf(null,t,r,e,n);break e;case 11:t=bf(null,t,r,e,n);break e;case 14:t=Nf(null,t,r,Ht(r.type,e),n);break e}throw Error(I(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ht(r,i),vu(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ht(r,i),Tf(e,t,r,i,n);case 3:e:{if(zm(t),e===null)throw Error(I(387));r=t.pendingProps,s=t.memoizedState,i=s.element,fm(e,t),Bo(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=ti(Error(I(423)),t),t=jf(e,t,r,n,i);break e}else if(r!==i){i=ti(Error(I(424)),t),t=jf(e,t,r,n,i);break e}else for(Tt=Dn(t.stateNode.containerInfo.firstChild),jt=t,be=!0,Qt=null,n=cm(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Jr(),r===i){t=kn(e,t,n);break e}ut(e,t,r,n)}t=t.child}return t;case 5:return pm(t),e===null&&fu(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,lu(r,i)?o=null:s!==null&&lu(r,s)&&(t.flags|=32),$m(e,t),ut(e,t,o,n),t.child;case 6:return e===null&&fu(t),null;case 13:return Fm(e,t,n);case 4:return Rc(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Zr(t,null,r,n):ut(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ht(r,i),bf(e,t,r,i,n);case 7:return ut(e,t,t.pendingProps,n),t.child;case 8:return ut(e,t,t.pendingProps.children,n),t.child;case 12:return ut(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,ke(Fo,r._currentValue),r._currentValue=o,s!==null)if(Zt(s.value,o)){if(s.children===i.children&&!yt.current){t=kn(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var a=l.firstContext;a!==null;){if(a.context===r){if(s.tag===1){a=gn(-1,n&-n),a.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?a.next=a:(a.next=d.next,d.next=a),u.pending=a}}s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),pu(s.return,n,t),l.lanes|=n;break}a=a.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(I(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),pu(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}ut(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,qr(t,n),i=zt(i),r=r(i),t.flags|=1,ut(e,t,r,n),t.child;case 14:return r=t.type,i=Ht(r,t.pendingProps),i=Ht(r.type,i),Nf(e,t,r,i,n);case 15:return Dm(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ht(r,i),yo(e,t),t.tag=1,wt(r)?(e=!0,Ao(t)):e=!1,qr(t,n),Lm(t,r,i),mu(t,r,i,n),yu(null,t,r,!0,e,n);case 19:return Um(e,t,n);case 22:return Am(e,t,n)}throw Error(I(156,t.tag))};function rg(e,t){return Ph(e,t)}function R0(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function At(e,t,n,r){return new R0(e,t,n,r)}function Qc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function O0(e){if(typeof e=="function")return Qc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===dc)return 11;if(e===fc)return 14}return 2}function Fn(e,t){var n=e.alternate;return n===null?(n=At(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ko(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")Qc(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Or:return dr(n.children,i,s,t);case cc:o=8,i|=8;break;case za:return e=At(12,n,t,i|2),e.elementType=za,e.lanes=s,e;case Fa:return e=At(13,n,t,i),e.elementType=Fa,e.lanes=s,e;case Ua:return e=At(19,n,t,i),e.elementType=Ua,e.lanes=s,e;case ph:return El(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case dh:o=10;break e;case fh:o=9;break e;case dc:o=11;break e;case fc:o=14;break e;case Nn:o=16,r=null;break e}throw Error(I(130,e==null?e:typeof e,""))}return t=At(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function dr(e,t,n,r){return e=At(7,e,r,t),e.lanes=n,e}function El(e,t,n,r){return e=At(22,e,r,t),e.elementType=ph,e.lanes=n,e.stateNode={isHidden:!1},e}function ka(e,t,n){return e=At(6,e,null,t),e.lanes=n,e}function Sa(e,t,n){return t=At(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function L0(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=na(0),this.expirationTimes=na(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=na(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function qc(e,t,n,r,i,s,o,l,a){return e=new L0(e,t,n,l,a),t===1?(t=1,s===!0&&(t|=8)):t=0,s=At(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Pc(s),e}function I0(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(lg)}catch(e){console.error(e)}}lg(),lh.exports=Rt;var z0=lh.exports,Ff=z0;Aa.createRoot=Ff.createRoot,Aa.hydrateRoot=Ff.hydrateRoot;/** - * @remix-run/router v1.23.0 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function vs(){return vs=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function ag(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function U0(){return Math.random().toString(36).substr(2,8)}function Bf(e,t){return{usr:e.state,key:e.key,idx:t}}function Pu(e,t,n,r){return n===void 0&&(n=null),vs({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?ai(t):t,{state:n,key:t&&t.key||r||U0()})}function Xo(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function ai(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function B0(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,l=On.Pop,a=null,u=d();u==null&&(u=0,o.replaceState(vs({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=On.Pop;let k=d(),g=k==null?null:k-u;u=k,a&&a({action:l,location:v.location,delta:g})}function p(k,g){l=On.Push;let m=Pu(v.location,k,g);u=d()+1;let y=Bf(m,u),C=v.createHref(m);try{o.pushState(y,"",C)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;i.location.assign(C)}s&&a&&a({action:l,location:v.location,delta:1})}function w(k,g){l=On.Replace;let m=Pu(v.location,k,g);u=d();let y=Bf(m,u),C=v.createHref(m);o.replaceState(y,"",C),s&&a&&a({action:l,location:v.location,delta:0})}function h(k){let g=i.location.origin!=="null"?i.location.origin:i.location.href,m=typeof k=="string"?k:Xo(k);return m=m.replace(/ $/,"%20"),Ie(g,"No window.location.(origin|href) available to create URL for href: "+m),new URL(m,g)}let v={get action(){return l},get location(){return e(i,o)},listen(k){if(a)throw new Error("A history only accepts one active listener");return i.addEventListener(Uf,f),a=k,()=>{i.removeEventListener(Uf,f),a=null}},createHref(k){return t(i,k)},createURL:h,encodeLocation(k){let g=h(k);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:p,replace:w,go(k){return o.go(k)}};return v}var Wf;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Wf||(Wf={}));function W0(e,t,n){return n===void 0&&(n="/"),H0(e,t,n)}function H0(e,t,n,r){let i=typeof t=="string"?ai(t):t,s=Xc(i.pathname||"/",n);if(s==null)return null;let o=ug(e);V0(o);let l=null;for(let a=0;l==null&&a{let a={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};a.relativePath.startsWith("/")&&(Ie(a.relativePath.startsWith(r),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(r.length));let u=Un([r,a.relativePath]),d=n.concat(a);s.children&&s.children.length>0&&(Ie(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),ug(s.children,t,d,u)),!(s.path==null&&!s.index)&&t.push({path:u,score:J0(u,s.index),routesMeta:d})};return e.forEach((s,o)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))i(s,o);else for(let a of cg(s.path))i(s,o,a)}),t}function cg(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=cg(r.join("/")),l=[];return l.push(...o.map(a=>a===""?s:[s,a].join("/"))),i&&l.push(...o),l.map(a=>e.startsWith("/")&&a===""?"/":a)}function V0(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Z0(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const Q0=/^:[\w-]+$/,q0=3,G0=2,Y0=1,K0=10,X0=-2,Hf=e=>e==="*";function J0(e,t){let n=e.split("/"),r=n.length;return n.some(Hf)&&(r+=X0),t&&(r+=G0),n.filter(i=>!Hf(i)).reduce((i,s)=>i+(Q0.test(s)?q0:s===""?Y0:K0),r)}function Z0(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function ex(e,t,n){let{routesMeta:r}=e,i={},s="/",o=[];for(let l=0;l{let{paramName:p,isOptional:w}=d;if(p==="*"){let v=l[f]||"";o=s.slice(0,s.length-v.length).replace(/(.)\/+$/,"$1")}const h=l[f];return w&&!h?u[p]=void 0:u[p]=(h||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:o,pattern:e}}function nx(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),ag(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,a)=>(r.push({paramName:l,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function rx(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ag(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Xc(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function ix(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?ai(e):e;return{pathname:n?n.startsWith("/")?n:sx(n,t):t,search:ax(r),hash:ux(i)}}function sx(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Ea(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function ox(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Jc(e,t){let n=ox(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Zc(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=ai(e):(i=vs({},e),Ie(!i.pathname||!i.pathname.includes("?"),Ea("?","pathname","search",i)),Ie(!i.pathname||!i.pathname.includes("#"),Ea("#","pathname","hash",i)),Ie(!i.search||!i.search.includes("#"),Ea("#","search","hash",i)));let s=e===""||i.pathname==="",o=s?"/":i.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),f-=1;i.pathname=p.join("/")}l=f>=0?t[f]:"/"}let a=ix(i,l),u=o&&o!=="/"&&o.endsWith("/"),d=(s||o===".")&&n.endsWith("/");return!a.pathname.endsWith("/")&&(u||d)&&(a.pathname+="/"),a}const Un=e=>e.join("/").replace(/\/\/+/g,"/"),lx=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),ax=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ux=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function cx(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const dg=["post","put","patch","delete"];new Set(dg);const dx=["get",...dg];new Set(dx);/** - * React Router v6.30.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function ys(){return ys=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),x.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=Zc(u,JSON.parse(o),s,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Un([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,o,s,e])}function hg(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=x.useContext(Gn),{matches:i}=x.useContext(Yn),{pathname:s}=ci(),o=JSON.stringify(Jc(i,r.v7_relativeSplatPath));return x.useMemo(()=>Zc(e,JSON.parse(o),s,n==="path"),[e,o,s,n])}function mx(e,t){return gx(e,t)}function gx(e,t,n,r){ui()||Ie(!1);let{navigator:i}=x.useContext(Gn),{matches:s}=x.useContext(Yn),o=s[s.length-1],l=o?o.params:{};o&&o.pathname;let a=o?o.pathnameBase:"/";o&&o.route;let u=ci(),d;if(t){var f;let k=typeof t=="string"?ai(t):t;a==="/"||(f=k.pathname)!=null&&f.startsWith(a)||Ie(!1),d=k}else d=u;let p=d.pathname||"/",w=p;if(a!=="/"){let k=a.replace(/^\//,"").split("/");w="/"+p.replace(/^\//,"").split("/").slice(k.length).join("/")}let h=W0(e,{pathname:w}),v=kx(h&&h.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:Un([a,i.encodeLocation?i.encodeLocation(k.pathname).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?a:Un([a,i.encodeLocation?i.encodeLocation(k.pathnameBase).pathname:k.pathnameBase])})),s,n,r);return t&&v?x.createElement(jl.Provider,{value:{location:ys({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:On.Pop}},v):v}function vx(){let e=bx(),t=cx(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),n?x.createElement("pre",{style:i},n):null,null)}const yx=x.createElement(vx,null);class wx extends x.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?x.createElement(Yn.Provider,{value:this.props.routeContext},x.createElement(fg.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function xx(e){let{routeContext:t,match:n,children:r}=e,i=x.useContext(ed);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),x.createElement(Yn.Provider,{value:t},r)}function kx(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(i=n)==null?void 0:i.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||Ie(!1),o=o.slice(0,Math.min(o.length,d+1))}let a=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,p)=>{let w,h=!1,v=null,k=null;n&&(w=l&&f.route.id?l[f.route.id]:void 0,v=f.route.errorElement||yx,a&&(u<0&&p===0?(Tx("route-fallback"),h=!0,k=null):u===p&&(h=!0,k=f.route.hydrateFallbackElement||null)));let g=t.concat(o.slice(0,p+1)),m=()=>{let y;return w?y=v:h?y=k:f.route.Component?y=x.createElement(f.route.Component,null):f.route.element?y=f.route.element:y=d,x.createElement(xx,{match:f,routeContext:{outlet:d,matches:g,isDataRoute:n!=null},children:y})};return n&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?x.createElement(wx,{location:n.location,revalidation:n.revalidation,component:v,error:w,children:m(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):m()},null)}var mg=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(mg||{}),gg=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(gg||{});function Sx(e){let t=x.useContext(ed);return t||Ie(!1),t}function Ex(e){let t=x.useContext(fx);return t||Ie(!1),t}function Cx(e){let t=x.useContext(Yn);return t||Ie(!1),t}function vg(e){let t=Cx(),n=t.matches[t.matches.length-1];return n.route.id||Ie(!1),n.route.id}function bx(){var e;let t=x.useContext(fg),n=Ex(),r=vg();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function Nx(){let{router:e}=Sx(mg.UseNavigateStable),t=vg(gg.UseNavigateStable),n=x.useRef(!1);return pg(()=>{n.current=!0}),x.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,ys({fromRouteId:t},s)))},[e,t])}const Vf={};function Tx(e,t,n){Vf[e]||(Vf[e]=!0)}function jx(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function yg(e){let{to:t,replace:n,state:r,relative:i}=e;ui()||Ie(!1);let{future:s,static:o}=x.useContext(Gn),{matches:l}=x.useContext(Yn),{pathname:a}=ci(),u=Kn(),d=Zc(t,Jc(l,s.v7_relativeSplatPath),a,i==="path"),f=JSON.stringify(d);return x.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:i}),[u,f,i,n,r]),null}function rr(e){Ie(!1)}function _x(e){let{basename:t="/",children:n=null,location:r,navigationType:i=On.Pop,navigator:s,static:o=!1,future:l}=e;ui()&&Ie(!1);let a=t.replace(/^\/*/,"/"),u=x.useMemo(()=>({basename:a,navigator:s,static:o,future:ys({v7_relativeSplatPath:!1},l)}),[a,l,s,o]);typeof r=="string"&&(r=ai(r));let{pathname:d="/",search:f="",hash:p="",state:w=null,key:h="default"}=r,v=x.useMemo(()=>{let k=Xc(d,a);return k==null?null:{location:{pathname:k,search:f,hash:p,state:w,key:h},navigationType:i}},[a,d,f,p,w,h,i]);return v==null?null:x.createElement(Gn.Provider,{value:u},x.createElement(jl.Provider,{children:n,value:v}))}function Px(e){let{children:t,location:n}=e;return mx(Ru(t),n)}new Promise(()=>{});function Ru(e,t){t===void 0&&(t=[]);let n=[];return x.Children.forEach(e,(r,i)=>{if(!x.isValidElement(r))return;let s=[...t,i];if(r.type===x.Fragment){n.push.apply(n,Ru(r.props.children,s));return}r.type!==rr&&Ie(!1),!r.props.index||!r.props.children||Ie(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Ru(r.props.children,s)),n.push(o)}),n}/** - * React Router DOM v6.30.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Ou(){return Ou=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function Ox(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Lx(e,t){return e.button===0&&(!t||t==="_self")&&!Ox(e)}function Lu(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function Ix(e,t){let n=Lu(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(s=>{n.append(i,s)})}),n}const Mx=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Dx="6";try{window.__reactRouterVersion=Dx}catch{}const Ax="startTransition",Qf=jy[Ax];function $x(e){let{basename:t,children:n,future:r,window:i}=e,s=x.useRef();s.current==null&&(s.current=F0({window:i,v5Compat:!0}));let o=s.current,[l,a]=x.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=x.useCallback(f=>{u&&Qf?Qf(()=>a(f)):a(f)},[a,u]);return x.useLayoutEffect(()=>o.listen(d),[o,d]),x.useEffect(()=>jx(r),[r]),x.createElement(_x,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const zx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Fx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,wg=x.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:s,replace:o,state:l,target:a,to:u,preventScrollReset:d,viewTransition:f}=t,p=Rx(t,Mx),{basename:w}=x.useContext(Gn),h,v=!1;if(typeof u=="string"&&Fx.test(u)&&(h=u,zx))try{let y=new URL(window.location.href),C=u.startsWith("//")?new URL(y.protocol+u):new URL(u),j=Xc(C.pathname,w);C.origin===y.origin&&j!=null?u=j+C.search+C.hash:v=!0}catch{}let k=px(u,{relative:i}),g=Ux(u,{replace:o,state:l,target:a,preventScrollReset:d,relative:i,viewTransition:f});function m(y){r&&r(y),y.defaultPrevented||g(y)}return x.createElement("a",Ou({},p,{href:h||k,onClick:v||s?r:m,ref:n,target:a}))});var qf;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(qf||(qf={}));var Gf;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Gf||(Gf={}));function Ux(e,t){let{target:n,replace:r,state:i,preventScrollReset:s,relative:o,viewTransition:l}=t===void 0?{}:t,a=Kn(),u=ci(),d=hg(e,{relative:o});return x.useCallback(f=>{if(Lx(f,n)){f.preventDefault();let p=r!==void 0?r:Xo(u)===Xo(d);a(e,{replace:p,state:i,preventScrollReset:s,relative:o,viewTransition:l})}},[u,a,d,r,i,n,e,s,o,l])}function Bx(e){let t=x.useRef(Lu(e)),n=x.useRef(!1),r=ci(),i=x.useMemo(()=>Ix(r.search,n.current?null:t.current),[r.search]),s=Kn(),o=x.useCallback((l,a)=>{const u=Lu(typeof l=="function"?l(i):l);n.current=!0,s("?"+u,a)},[s,i]);return[i,o]}var xg={exports:{}},kg={};/** - * @license React - * use-sync-external-store-with-selector.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Ps=x;function Wx(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Hx=typeof Object.is=="function"?Object.is:Wx,Vx=Ps.useSyncExternalStore,Qx=Ps.useRef,qx=Ps.useEffect,Gx=Ps.useMemo,Yx=Ps.useDebugValue;kg.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=Qx(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=Gx(function(){function a(w){if(!u){if(u=!0,d=w,w=r(w),i!==void 0&&o.hasValue){var h=o.value;if(i(h,w))return f=h}return f=w}if(h=f,Hx(d,w))return h;var v=r(w);return i!==void 0&&i(h,v)?(d=w,h):(d=w,f=v)}var u=!1,d,f,p=n===void 0?null:n;return[function(){return a(t())},p===null?void 0:function(){return a(p())}]},[t,n,r,i]);var l=Vx(e,s[0],s[1]);return qx(function(){o.hasValue=!0,o.value=l},[l]),Yx(l),l};xg.exports=kg;var Kx=xg.exports;function Xx(e){e()}function Jx(){let e=null,t=null;return{clear(){e=null,t=null},notify(){Xx(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var Yf={notify(){},get:()=>[]};function Zx(e,t){let n,r=Yf,i=0,s=!1;function o(v){d();const k=r.subscribe(v);let g=!1;return()=>{g||(g=!0,k(),f())}}function l(){r.notify()}function a(){h.onStateChange&&h.onStateChange()}function u(){return s}function d(){i++,n||(n=e.subscribe(a),r=Jx())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Yf)}function p(){s||(s=!0,d())}function w(){s&&(s=!1,f())}const h={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:a,isSubscribed:u,trySubscribe:p,tryUnsubscribe:w,getListeners:()=>r};return h}var ek=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",tk=ek(),nk=()=>typeof navigator<"u"&&navigator.product==="ReactNative",rk=nk(),ik=()=>tk||rk?x.useLayoutEffect:x.useEffect,sk=ik(),Ca=Symbol.for("react-redux-context"),ba=typeof globalThis<"u"?globalThis:{};function ok(){if(!x.createContext)return{};const e=ba[Ca]??(ba[Ca]=new Map);let t=e.get(x.createContext);return t||(t=x.createContext(null),e.set(x.createContext,t)),t}var Hn=ok();function lk(e){const{children:t,context:n,serverState:r,store:i}=e,s=x.useMemo(()=>{const a=Zx(i);return{store:i,subscription:a,getServerState:r?()=>r:void 0}},[i,r]),o=x.useMemo(()=>i.getState(),[i]);sk(()=>{const{subscription:a}=s;return a.onStateChange=a.notifyNestedSubs,a.trySubscribe(),o!==i.getState()&&a.notifyNestedSubs(),()=>{a.tryUnsubscribe(),a.onStateChange=void 0}},[s,o]);const l=n||Hn;return x.createElement(l.Provider,{value:s},t)}var ak=lk;function td(e=Hn){return function(){return x.useContext(e)}}var Sg=td();function Eg(e=Hn){const t=e===Hn?Sg:td(e),n=()=>{const{store:r}=t();return r};return Object.assign(n,{withTypes:()=>n}),n}var uk=Eg();function ck(e=Hn){const t=e===Hn?uk:Eg(e),n=()=>t().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var dk=ck(),fk=(e,t)=>e===t;function pk(e=Hn){const t=e===Hn?Sg:td(e),n=(r,i={})=>{const{equalityFn:s=fk}=typeof i=="function"?{equalityFn:i}:i,o=t(),{store:l,subscription:a,getServerState:u}=o;x.useRef(!0);const d=x.useCallback({[r.name](p){return r(p)}}[r.name],[r]),f=Kx.useSyncExternalStoreWithSelector(a.addNestedSub,l.getState,u||l.getState,d,s);return x.useDebugValue(f),f};return Object.assign(n,{withTypes:()=>n}),n}var hk=pk();function Ke(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 mk=typeof Symbol=="function"&&Symbol.observable||"@@observable",Kf=mk,Na=()=>Math.random().toString(36).substring(7).split("").join("."),gk={INIT:`@@redux/INIT${Na()}`,REPLACE:`@@redux/REPLACE${Na()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Na()}`},Jo=gk;function nd(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 Cg(e,t,n){if(typeof e!="function")throw new Error(Ke(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Ke(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Ke(1));return n(Cg)(e,t)}let r=e,i=t,s=new Map,o=s,l=0,a=!1;function u(){o===s&&(o=new Map,s.forEach((k,g)=>{o.set(g,k)}))}function d(){if(a)throw new Error(Ke(3));return i}function f(k){if(typeof k!="function")throw new Error(Ke(4));if(a)throw new Error(Ke(5));let g=!0;u();const m=l++;return o.set(m,k),function(){if(g){if(a)throw new Error(Ke(6));g=!1,u(),o.delete(m),s=null}}}function p(k){if(!nd(k))throw new Error(Ke(7));if(typeof k.type>"u")throw new Error(Ke(8));if(typeof k.type!="string")throw new Error(Ke(17));if(a)throw new Error(Ke(9));try{a=!0,i=r(i,k)}finally{a=!1}return(s=o).forEach(m=>{m()}),k}function w(k){if(typeof k!="function")throw new Error(Ke(10));r=k,p({type:Jo.REPLACE})}function h(){const k=f;return{subscribe(g){if(typeof g!="object"||g===null)throw new Error(Ke(11));function m(){const C=g;C.next&&C.next(d())}return m(),{unsubscribe:k(m)}},[Kf](){return this}}}return p({type:Jo.INIT}),{dispatch:p,subscribe:f,getState:d,replaceReducer:w,[Kf]:h}}function vk(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:Jo.INIT})>"u")throw new Error(Ke(12));if(typeof n(void 0,{type:Jo.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ke(13))})}function yk(e){const t=Object.keys(e),n={};for(let s=0;s"u")throw l&&l.type,new Error(Ke(14));u[f]=h,a=a||h!==w}return a=a||r.length!==Object.keys(o).length,a?u:o}}function Zo(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function wk(...e){return t=>(n,r)=>{const i=t(n,r);let s=()=>{throw new Error(Ke(15))};const o={getState:i.getState,dispatch:(a,...u)=>s(a,...u)},l=e.map(a=>a(o));return s=Zo(...l)(i.dispatch),{...i,dispatch:s}}}function xk(e){return nd(e)&&"type"in e&&typeof e.type=="string"}var bg=Symbol.for("immer-nothing"),Xf=Symbol.for("immer-draftable"),Pt=Symbol.for("immer-state");function Yt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ws=Object.getPrototypeOf;function wr(e){return!!e&&!!e[Pt]}function Sn(e){var t;return e?Ng(e)||Array.isArray(e)||!!e[Xf]||!!((t=e.constructor)!=null&&t[Xf])||Rs(e)||Pl(e):!1}var kk=Object.prototype.constructor.toString(),Jf=new WeakMap;function Ng(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=Jf.get(n);return r===void 0&&(r=Function.toString.call(n),Jf.set(n,r)),r===kk}function el(e,t,n=!0){_l(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function _l(e){const t=e[Pt];return t?t.type_:Array.isArray(e)?1:Rs(e)?2:Pl(e)?3:0}function Iu(e,t){return _l(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Tg(e,t,n){const r=_l(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Sk(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Rs(e){return e instanceof Map}function Pl(e){return e instanceof Set}function ir(e){return e.copy_||e.base_}function Mu(e,t){if(Rs(e))return new Map(e);if(Pl(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Ng(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Pt];let i=Reflect.ownKeys(r);for(let s=0;s1&&Object.defineProperties(e,{set:to,add:to,clear:to,delete:to}),Object.freeze(e),t&&Object.values(e).forEach(n=>rd(n,!0))),e}function Ek(){Yt(2)}var to={value:Ek};function Rl(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var Ck={};function xr(e){const t=Ck[e];return t||Yt(0,e),t}var xs;function jg(){return xs}function bk(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Zf(e,t){t&&(xr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Du(e){Au(e),e.drafts_.forEach(Nk),e.drafts_=null}function Au(e){e===xs&&(xs=e.parent_)}function ep(e){return xs=bk(xs,e)}function Nk(e){const t=e[Pt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function tp(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Pt].modified_&&(Du(t),Yt(4)),Sn(e)&&(e=tl(t,e),t.parent_||nl(t,e)),t.patches_&&xr("Patches").generateReplacementPatches_(n[Pt].base_,e,t.patches_,t.inversePatches_)):e=tl(t,n,[]),Du(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==bg?e:void 0}function tl(e,t,n){if(Rl(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[Pt];if(!i)return el(t,(s,o)=>np(e,i,t,s,o,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return nl(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let o=s,l=!1;i.type_===3&&(o=new Set(s),s.clear(),l=!0),el(o,(a,u)=>np(e,i,s,a,u,n,l),r),nl(e,s,!1),n&&e.patches_&&xr("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function np(e,t,n,r,i,s,o){if(i==null||typeof i!="object"&&!o)return;const l=Rl(i);if(!(l&&!o)){if(wr(i)){const a=s&&t&&t.type_!==3&&!Iu(t.assigned_,r)?s.concat(r):void 0,u=tl(e,i,a);if(Tg(n,r,u),wr(u))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(Sn(i)&&!l){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&l)return;tl(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(Rs(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&nl(e,i)}}}function nl(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&rd(t,n)}function Tk(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:jg(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,s=id;n&&(i=[r],s=ks);const{revoke:o,proxy:l}=Proxy.revocable(i,s);return r.draft_=l,r.revoke_=o,l}var id={get(e,t){if(t===Pt)return e;const n=ir(e);if(!Iu(n,t))return jk(e,n,t);const r=n[t];return e.finalized_||!Sn(r)?r:r===Ta(e.base_,t)?(ja(e),e.copy_[t]=zu(r,e)):r},has(e,t){return t in ir(e)},ownKeys(e){return Reflect.ownKeys(ir(e))},set(e,t,n){const r=_g(ir(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=Ta(ir(e),t),s=i==null?void 0:i[Pt];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Sk(n,i)&&(n!==void 0||Iu(e.base_,t)))return!0;ja(e),$u(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 Ta(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,ja(e),$u(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=ir(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Yt(11)},getPrototypeOf(e){return ws(e.base_)},setPrototypeOf(){Yt(12)}},ks={};el(id,(e,t)=>{ks[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});ks.deleteProperty=function(e,t){return ks.set.call(this,e,t,void 0)};ks.set=function(e,t,n){return id.set.call(this,e[0],t,n,e[0])};function Ta(e,t){const n=e[Pt];return(n?ir(n):e)[t]}function jk(e,t,n){var i;const r=_g(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function _g(e,t){if(!(t in e))return;let n=ws(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=ws(n)}}function $u(e){e.modified_||(e.modified_=!0,e.parent_&&$u(e.parent_))}function ja(e){e.copy_||(e.copy_=Mu(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var _k=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const s=n;n=t;const o=this;return function(a=s,...u){return o.produce(a,d=>n.call(this,d,...u))}}typeof n!="function"&&Yt(6),r!==void 0&&typeof r!="function"&&Yt(7);let i;if(Sn(t)){const s=ep(this),o=zu(t,void 0);let l=!0;try{i=n(o),l=!1}finally{l?Du(s):Au(s)}return Zf(s,r),tp(i,s)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===bg&&(i=void 0),this.autoFreeze_&&rd(i,!0),r){const s=[],o=[];xr("Patches").generateReplacementPatches_(t,i,s,o),r(s,o)}return i}else Yt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(o,...l)=>this.produceWithPatches(o,a=>t(a,...l));let r,i;return[this.produce(t,n,(o,l)=>{r=o,i=l}),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),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Sn(e)||Yt(8),wr(e)&&(e=Pk(e));const t=ep(this),n=zu(e,void 0);return n[Pt].isManual_=!0,Au(t),n}finishDraft(e,t){const n=e&&e[Pt];(!n||!n.isManual_)&&Yt(9);const{scope_:r}=n;return Zf(r,t),tp(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}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=xr("Patches").applyPatches_;return wr(e)?r(e,t):this.produce(e,i=>r(i,t))}};function zu(e,t){const n=Rs(e)?xr("MapSet").proxyMap_(e,t):Pl(e)?xr("MapSet").proxySet_(e,t):Tk(e,t);return(t?t.scope_:jg()).drafts_.push(n),n}function Pk(e){return wr(e)||Yt(10,e),Pg(e)}function Pg(e){if(!Sn(e)||Rl(e))return e;const t=e[Pt];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Mu(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Mu(e,!0);return el(n,(i,s)=>{Tg(n,i,Pg(s))},r),t&&(t.finalized_=!1),n}var Rk=new _k,Rg=Rk.produce;function Og(e){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,e):i(s)}var Ok=Og(),Lk=Og,Ik=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Zo:Zo.apply(null,arguments)};function rp(e,t){function n(...r){if(t){let i=t(...r);if(!i)throw new Error(vn(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=>xk(r)&&r.type===e,n}var Lg=class zi extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,zi.prototype)}static get[Symbol.species](){return zi}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new zi(...t[0].concat(this)):new zi(...t.concat(this))}};function ip(e){return Sn(e)?Rg(e,()=>{}):e}function no(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function Mk(e){return typeof e=="boolean"}var Dk=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=t??{};let o=new Lg;return n&&(Mk(n)?o.push(Ok):o.push(Lk(n.extraArgument))),o},Ak="RTK_autoBatch",sp=e=>t=>{setTimeout(t,e)},$k=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,s=!1,o=!1;const l=new Set,a=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:sp(10):e.type==="callback"?e.queueNotification:sp(e.timeout),u=()=>{o=!1,s&&(s=!1,l.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),p=r.subscribe(f);return l.add(d),()=>{p(),l.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[Ak]),s=!i,s&&(o||(o=!0,a(u))),r.dispatch(d)}finally{i=!0}}})},zk=e=>function(n){const{autoBatch:r=!0}=n??{};let i=new Lg(e);return r&&i.push($k(typeof r=="object"?r:void 0)),i};function Fk(e){const t=Dk(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:s=void 0,enhancers:o=void 0}=e||{};let l;if(typeof n=="function")l=n;else if(nd(n))l=yk(n);else throw new Error(vn(1));let a;typeof r=="function"?a=r(t):a=t();let u=Zo;i&&(u=Ik({trace:!1,...typeof i=="object"&&i}));const d=wk(...a),f=zk(d);let p=typeof o=="function"?o(f):f();const w=u(...p);return Cg(l,s,w)}function Ig(e){const t={},n=[];let r;const i={addCase(s,o){const l=typeof s=="string"?s:s.type;if(!l)throw new Error(vn(28));if(l in t)throw new Error(vn(29));return t[l]=o,i},addAsyncThunk(s,o){return o.pending&&(t[s.pending.type]=o.pending),o.rejected&&(t[s.rejected.type]=o.rejected),o.fulfilled&&(t[s.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:s.settled,reducer:o.settled}),i},addMatcher(s,o){return n.push({matcher:s,reducer:o}),i},addDefaultCase(s){return r=s,i}};return e(i),[t,n,r]}function Uk(e){return typeof e=="function"}function Bk(e,t){let[n,r,i]=Ig(t),s;if(Uk(e))s=()=>ip(e());else{const l=ip(e);s=()=>l}function o(l=s(),a){let u=[n[a.type],...r.filter(({matcher:d})=>d(a)).map(({reducer:d})=>d)];return u.filter(d=>!!d).length===0&&(u=[i]),u.reduce((d,f)=>{if(f)if(wr(d)){const w=f(d,a);return w===void 0?d:w}else{if(Sn(d))return Rg(d,p=>f(p,a));{const p=f(d,a);if(p===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return d},l)}return o.getInitialState=s,o}var Wk=Symbol.for("rtk-slice-createasyncthunk");function Hk(e,t){return`${e}/${t}`}function Vk({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[Wk];return function(i){const{name:s,reducerPath:o=s}=i;if(!s)throw new Error(vn(11));const l=(typeof i.reducers=="function"?i.reducers(qk()):i.reducers)||{},a=Object.keys(l),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(C,j){const S=typeof C=="string"?C:C.type;if(!S)throw new Error(vn(12));if(S in u.sliceCaseReducersByType)throw new Error(vn(13));return u.sliceCaseReducersByType[S]=j,d},addMatcher(C,j){return u.sliceMatchers.push({matcher:C,reducer:j}),d},exposeAction(C,j){return u.actionCreators[C]=j,d},exposeCaseReducer(C,j){return u.sliceCaseReducersByName[C]=j,d}};a.forEach(C=>{const j=l[C],S={reducerName:C,type:Hk(s,C),createNotation:typeof i.reducers=="function"};Yk(j)?Xk(S,j,d,t):Gk(S,j,d)});function f(){const[C={},j=[],S=void 0]=typeof i.extraReducers=="function"?Ig(i.extraReducers):[i.extraReducers],N={...C,...u.sliceCaseReducersByType};return Bk(i.initialState,_=>{for(let D in N)_.addCase(D,N[D]);for(let D of u.sliceMatchers)_.addMatcher(D.matcher,D.reducer);for(let D of j)_.addMatcher(D.matcher,D.reducer);S&&_.addDefaultCase(S)})}const p=C=>C,w=new Map,h=new WeakMap;let v;function k(C,j){return v||(v=f()),v(C,j)}function g(){return v||(v=f()),v.getInitialState()}function m(C,j=!1){function S(_){let D=_[C];return typeof D>"u"&&j&&(D=no(h,S,g)),D}function N(_=p){const D=no(w,j,()=>new WeakMap);return no(D,_,()=>{const M={};for(const[q,X]of Object.entries(i.selectors??{}))M[q]=Qk(X,_,()=>no(h,_,g),j);return M})}return{reducerPath:C,getSelectors:N,get selectors(){return N(S)},selectSlice:S}}const y={name:s,reducer:k,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:g,...m(o),injectInto(C,{reducerPath:j,...S}={}){const N=j??o;return C.inject({reducerPath:N,reducer:k},S),{...y,...m(N,!0)}}};return y}}function Qk(e,t,n,r){function i(s,...o){let l=t(s);return typeof l>"u"&&r&&(l=n()),e(l,...o)}return i.unwrapped=e,i}var Ol=Vk();function qk(){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 Gk({type:e,reducerName:t,createNotation:n},r,i){let s,o;if("reducer"in r){if(n&&!Kk(r))throw new Error(vn(17));s=r.reducer,o=r.prepare}else s=r;i.addCase(e,s).exposeCaseReducer(t,s).exposeAction(t,o?rp(e,o):rp(e))}function Yk(e){return e._reducerDefinitionType==="asyncThunk"}function Kk(e){return e._reducerDefinitionType==="reducerWithPrepare"}function Xk({type:e,reducerName:t},n,r,i){if(!i)throw new Error(vn(18));const{payloadCreator:s,fulfilled:o,pending:l,rejected:a,settled:u,options:d}=n,f=i(e,s,d);r.exposeAction(t,f),o&&r.addCase(f.fulfilled,o),l&&r.addCase(f.pending,l),a&&r.addCase(f.rejected,a),u&&r.addMatcher(f.settled,u),r.exposeCaseReducer(t,{fulfilled:o||ro,pending:l||ro,rejected:a||ro,settled:u||ro})}function ro(){}function vn(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 Jk={isAuthenticated:localStorage.getItem("isAuthenticated")==="true",userId:null,username:localStorage.getItem("username")||null,loading:!1},Mg=Ol({name:"auth",initialState:Jk,reducers:{setAuth:(e,t)=>{e.isAuthenticated=!0,e.userId=t.payload.userId,e.username=t.payload.username,localStorage.setItem("isAuthenticated","true"),localStorage.setItem("username",t.payload.username)},clearAuth:e=>{e.isAuthenticated=!1,e.userId=null,e.username=null,localStorage.removeItem("isAuthenticated"),localStorage.removeItem("username")}}}),{setAuth:sd,clearAuth:fr}=Mg.actions,Zk=Mg.reducer,e1={notes:[],allNotes:[],archivedNotes:[],selectedDate:null,selectedTag:null,searchQuery:"",loading:!1,editingNoteId:null},Dg=Ol({name:"notes",initialState:e1,reducers:{setNotes:(e,t)=>{e.notes=t.payload},setAllNotes:(e,t)=>{e.allNotes=t.payload},addNote:(e,t)=>{e.notes.unshift(t.payload),e.allNotes.unshift(t.payload)},updateNote:(e,t)=>{const n=e.notes.findIndex(i=>i.id===t.payload.id);n!==-1&&(e.notes[n]=t.payload);const r=e.allNotes.findIndex(i=>i.id===t.payload.id);r!==-1&&(e.allNotes[r]=t.payload)},deleteNote:(e,t)=>{e.notes=e.notes.filter(n=>n.id!==t.payload),e.allNotes=e.allNotes.filter(n=>n.id!==t.payload)},setSelectedDate:(e,t)=>{e.selectedDate=t.payload},setSelectedTag:(e,t)=>{e.selectedTag=t.payload},setSearchQuery:(e,t)=>{e.searchQuery=t.payload},setEditingNote:(e,t)=>{e.editingNoteId=t.payload}}}),{setNotes:t1,setAllNotes:n1,addNote:fT,updateNote:pT,deleteNote:hT,setSelectedDate:Fu,setSelectedTag:rl,setSearchQuery:Uu,setEditingNote:mT}=Dg.actions,r1=Dg.reducer,i1=()=>{const e=localStorage.getItem("theme");return e==="dark"||e==="light"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"},s1={theme:i1(),accentColor:localStorage.getItem("accentColor")||"#007bff",notifications:[],isMobileSidebarOpen:!1,isPreviewMode:!1},Ag=Ol({name:"ui",initialState:s1,reducers:{toggleTheme:e=>{e.theme=e.theme==="light"?"dark":"light",localStorage.setItem("theme",e.theme)},setTheme:(e,t)=>{e.theme=t.payload,localStorage.setItem("theme",e.theme)},setAccentColor:(e,t)=>{e.accentColor=t.payload,localStorage.setItem("accentColor",t.payload)},addNotification:(e,t)=>{const n=`notification-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;e.notifications.push({...t.payload,id:n})},removeNotification:(e,t)=>{e.notifications=e.notifications.filter(n=>n.id!==t.payload)},toggleMobileSidebar:e=>{e.isMobileSidebarOpen=!e.isMobileSidebarOpen},closeMobileSidebar:e=>{e.isMobileSidebarOpen=!1},togglePreviewMode:e=>{e.isPreviewMode=!e.isPreviewMode}}}),{toggleTheme:o1,setTheme:l1,setAccentColor:il,addNotification:a1,removeNotification:$g,toggleMobileSidebar:gT,closeMobileSidebar:vT,togglePreviewMode:u1}=Ag.actions,c1=Ag.reducer,d1={user:null,aiSettings:null,aiEnabled:!1,loading:!1},zg=Ol({name:"profile",initialState:d1,reducers:{setUser:(e,t)=>{e.user=t.payload},setAiSettings:(e,t)=>{e.aiSettings=t.payload,e.aiEnabled=t.payload.ai_enabled===1},setLoading:(e,t)=>{e.loading=t.payload}}}),{setUser:od,setAiSettings:ld,setLoading:yT}=zg.actions,f1=zg.reducer,p1=Fk({reducer:{auth:Zk,notes:r1,ui:c1,profile:f1}}),ot=()=>dk(),ye=hk;function Fg(e,t){return function(){return e.apply(t,arguments)}}const{toString:h1}=Object.prototype,{getPrototypeOf:ad}=Object,{iterator:Ll,toStringTag:Ug}=Symbol,Il=(e=>t=>{const n=h1.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),en=e=>(e=e.toLowerCase(),t=>Il(t)===e),Ml=e=>t=>typeof t===e,{isArray:di}=Array,ri=Ml("undefined");function Os(e){return e!==null&&!ri(e)&&e.constructor!==null&&!ri(e.constructor)&&kt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Bg=en("ArrayBuffer");function m1(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Bg(e.buffer),t}const g1=Ml("string"),kt=Ml("function"),Wg=Ml("number"),Ls=e=>e!==null&&typeof e=="object",v1=e=>e===!0||e===!1,So=e=>{if(Il(e)!=="object")return!1;const t=ad(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Ug in e)&&!(Ll in e)},y1=e=>{if(!Ls(e)||Os(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},w1=en("Date"),x1=en("File"),k1=en("Blob"),S1=en("FileList"),E1=e=>Ls(e)&&kt(e.pipe),C1=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||kt(e.append)&&((t=Il(e))==="formdata"||t==="object"&&kt(e.toString)&&e.toString()==="[object FormData]"))},b1=en("URLSearchParams"),[N1,T1,j1,_1]=["ReadableStream","Request","Response","Headers"].map(en),P1=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Is(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,i;if(typeof e!="object"&&(e=[e]),di(e))for(r=0,i=e.length;r0;)if(i=n[r],t===i.toLowerCase())return i;return null}const ur=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Vg=e=>!ri(e)&&e!==ur;function Bu(){const{caseless:e,skipUndefined:t}=Vg(this)&&this||{},n={},r=(i,s)=>{const o=e&&Hg(n,s)||s;So(n[o])&&So(i)?n[o]=Bu(n[o],i):So(i)?n[o]=Bu({},i):di(i)?n[o]=i.slice():(!t||!ri(i))&&(n[o]=i)};for(let i=0,s=arguments.length;i(Is(t,(i,s)=>{n&&kt(i)?e[s]=Fg(i,n):e[s]=i},{allOwnKeys:r}),e),O1=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),L1=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},I1=(e,t,n,r)=>{let i,s,o;const l={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),s=i.length;s-- >0;)o=i[s],(!r||r(o,e,t))&&!l[o]&&(t[o]=e[o],l[o]=!0);e=n!==!1&&ad(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},M1=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},D1=e=>{if(!e)return null;if(di(e))return e;let t=e.length;if(!Wg(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},A1=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&ad(Uint8Array)),$1=(e,t)=>{const r=(e&&e[Ll]).call(e);let i;for(;(i=r.next())&&!i.done;){const s=i.value;t.call(e,s[0],s[1])}},z1=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},F1=en("HTMLFormElement"),U1=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),op=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),B1=en("RegExp"),Qg=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Is(n,(i,s)=>{let o;(o=t(i,s,e))!==!1&&(r[s]=o||i)}),Object.defineProperties(e,r)},W1=e=>{Qg(e,(t,n)=>{if(kt(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(kt(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},H1=(e,t)=>{const n={},r=i=>{i.forEach(s=>{n[s]=!0})};return di(e)?r(e):r(String(e).split(t)),n},V1=()=>{},Q1=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function q1(e){return!!(e&&kt(e.append)&&e[Ug]==="FormData"&&e[Ll])}const G1=e=>{const t=new Array(10),n=(r,i)=>{if(Ls(r)){if(t.indexOf(r)>=0)return;if(Os(r))return r;if(!("toJSON"in r)){t[i]=r;const s=di(r)?[]:{};return Is(r,(o,l)=>{const a=n(o,i+1);!ri(a)&&(s[l]=a)}),t[i]=void 0,s}}return r};return n(e,0)},Y1=en("AsyncFunction"),K1=e=>e&&(Ls(e)||kt(e))&&kt(e.then)&&kt(e.catch),qg=((e,t)=>e?setImmediate:t?((n,r)=>(ur.addEventListener("message",({source:i,data:s})=>{i===ur&&s===n&&r.length&&r.shift()()},!1),i=>{r.push(i),ur.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",kt(ur.postMessage)),X1=typeof queueMicrotask<"u"?queueMicrotask.bind(ur):typeof process<"u"&&process.nextTick||qg,J1=e=>e!=null&&kt(e[Ll]),T={isArray:di,isArrayBuffer:Bg,isBuffer:Os,isFormData:C1,isArrayBufferView:m1,isString:g1,isNumber:Wg,isBoolean:v1,isObject:Ls,isPlainObject:So,isEmptyObject:y1,isReadableStream:N1,isRequest:T1,isResponse:j1,isHeaders:_1,isUndefined:ri,isDate:w1,isFile:x1,isBlob:k1,isRegExp:B1,isFunction:kt,isStream:E1,isURLSearchParams:b1,isTypedArray:A1,isFileList:S1,forEach:Is,merge:Bu,extend:R1,trim:P1,stripBOM:O1,inherits:L1,toFlatObject:I1,kindOf:Il,kindOfTest:en,endsWith:M1,toArray:D1,forEachEntry:$1,matchAll:z1,isHTMLForm:F1,hasOwnProperty:op,hasOwnProp:op,reduceDescriptors:Qg,freezeMethods:W1,toObjectSet:H1,toCamelCase:U1,noop:V1,toFiniteNumber:Q1,findKey:Hg,global:ur,isContextDefined:Vg,isSpecCompliantForm:q1,toJSONObject:G1,isAsyncFn:Y1,isThenable:K1,setImmediate:qg,asap:X1,isIterable:J1};function ee(e,t,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}T.inherits(ee,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:T.toJSONObject(this.config),code:this.code,status:this.status}}});const Gg=ee.prototype,Yg={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Yg[e]={value:e}});Object.defineProperties(ee,Yg);Object.defineProperty(Gg,"isAxiosError",{value:!0});ee.from=(e,t,n,r,i,s)=>{const o=Object.create(Gg);T.toFlatObject(e,o,function(d){return d!==Error.prototype},u=>u!=="isAxiosError");const l=e&&e.message?e.message:"Error",a=t==null&&e?e.code:t;return ee.call(o,l,a,n,r,i),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",s&&Object.assign(o,s),o};const Z1=null;function Wu(e){return T.isPlainObject(e)||T.isArray(e)}function Kg(e){return T.endsWith(e,"[]")?e.slice(0,-2):e}function lp(e,t,n){return e?e.concat(t).map(function(i,s){return i=Kg(i),!n&&s?"["+i+"]":i}).join(n?".":""):t}function eS(e){return T.isArray(e)&&!e.some(Wu)}const tS=T.toFlatObject(T,{},null,function(t){return/^is[A-Z]/.test(t)});function Dl(e,t,n){if(!T.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=T.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,k){return!T.isUndefined(k[v])});const r=n.metaTokens,i=n.visitor||d,s=n.dots,o=n.indexes,a=(n.Blob||typeof Blob<"u"&&Blob)&&T.isSpecCompliantForm(t);if(!T.isFunction(i))throw new TypeError("visitor must be a function");function u(h){if(h===null)return"";if(T.isDate(h))return h.toISOString();if(T.isBoolean(h))return h.toString();if(!a&&T.isBlob(h))throw new ee("Blob is not supported. Use a Buffer instead.");return T.isArrayBuffer(h)||T.isTypedArray(h)?a&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function d(h,v,k){let g=h;if(h&&!k&&typeof h=="object"){if(T.endsWith(v,"{}"))v=r?v:v.slice(0,-2),h=JSON.stringify(h);else if(T.isArray(h)&&eS(h)||(T.isFileList(h)||T.endsWith(v,"[]"))&&(g=T.toArray(h)))return v=Kg(v),g.forEach(function(y,C){!(T.isUndefined(y)||y===null)&&t.append(o===!0?lp([v],C,s):o===null?v:v+"[]",u(y))}),!1}return Wu(h)?!0:(t.append(lp(k,v,s),u(h)),!1)}const f=[],p=Object.assign(tS,{defaultVisitor:d,convertValue:u,isVisitable:Wu});function w(h,v){if(!T.isUndefined(h)){if(f.indexOf(h)!==-1)throw Error("Circular reference detected in "+v.join("."));f.push(h),T.forEach(h,function(g,m){(!(T.isUndefined(g)||g===null)&&i.call(t,g,T.isString(m)?m.trim():m,v,p))===!0&&w(g,v?v.concat(m):[m])}),f.pop()}}if(!T.isObject(e))throw new TypeError("data must be an object");return w(e),t}function ap(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function ud(e,t){this._pairs=[],e&&Dl(e,this,t)}const Xg=ud.prototype;Xg.append=function(t,n){this._pairs.push([t,n])};Xg.toString=function(t){const n=t?function(r){return t.call(this,r,ap)}:ap;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function nS(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Jg(e,t,n){if(!t)return e;const r=n&&n.encode||nS;T.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let s;if(i?s=i(t,n):s=T.isURLSearchParams(t)?t.toString():new ud(t,n).toString(r),s){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class up{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){T.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Zg={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},rS=typeof URLSearchParams<"u"?URLSearchParams:ud,iS=typeof FormData<"u"?FormData:null,sS=typeof Blob<"u"?Blob:null,oS={isBrowser:!0,classes:{URLSearchParams:rS,FormData:iS,Blob:sS},protocols:["http","https","file","blob","url","data"]},cd=typeof window<"u"&&typeof document<"u",Hu=typeof navigator=="object"&&navigator||void 0,lS=cd&&(!Hu||["ReactNative","NativeScript","NS"].indexOf(Hu.product)<0),aS=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",uS=cd&&window.location.href||"http://localhost",cS=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:cd,hasStandardBrowserEnv:lS,hasStandardBrowserWebWorkerEnv:aS,navigator:Hu,origin:uS},Symbol.toStringTag,{value:"Module"})),it={...cS,...oS};function dS(e,t){return Dl(e,new it.classes.URLSearchParams,{visitor:function(n,r,i,s){return it.isNode&&T.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...t})}function fS(e){return T.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function pS(e){const t={},n=Object.keys(e);let r;const i=n.length;let s;for(r=0;r=n.length;return o=!o&&T.isArray(i)?i.length:o,a?(T.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!l):((!i[o]||!T.isObject(i[o]))&&(i[o]=[]),t(n,r,i[o],s)&&T.isArray(i[o])&&(i[o]=pS(i[o])),!l)}if(T.isFormData(e)&&T.isFunction(e.entries)){const n={};return T.forEachEntry(e,(r,i)=>{t(fS(r),i,n,0)}),n}return null}function hS(e,t,n){if(T.isString(e))try{return(t||JSON.parse)(e),T.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Ms={transitional:Zg,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,s=T.isObject(t);if(s&&T.isHTMLForm(t)&&(t=new FormData(t)),T.isFormData(t))return i?JSON.stringify(ev(t)):t;if(T.isArrayBuffer(t)||T.isBuffer(t)||T.isStream(t)||T.isFile(t)||T.isBlob(t)||T.isReadableStream(t))return t;if(T.isArrayBufferView(t))return t.buffer;if(T.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return dS(t,this.formSerializer).toString();if((l=T.isFileList(t))||r.indexOf("multipart/form-data")>-1){const a=this.env&&this.env.FormData;return Dl(l?{"files[]":t}:t,a&&new a,this.formSerializer)}}return s||i?(n.setContentType("application/json",!1),hS(t)):t}],transformResponse:[function(t){const n=this.transitional||Ms.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(T.isResponse(t)||T.isReadableStream(t))return t;if(t&&T.isString(t)&&(r&&!this.responseType||i)){const o=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(l){if(o)throw l.name==="SyntaxError"?ee.from(l,ee.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:it.classes.FormData,Blob:it.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};T.forEach(["delete","get","head","post","put","patch"],e=>{Ms.headers[e]={}});const mS=T.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),gS=e=>{const t={};let n,r,i;return e&&e.split(` -`).forEach(function(o){i=o.indexOf(":"),n=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!n||t[n]&&mS[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},cp=Symbol("internals");function _i(e){return e&&String(e).trim().toLowerCase()}function Eo(e){return e===!1||e==null?e:T.isArray(e)?e.map(Eo):String(e)}function vS(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const yS=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function _a(e,t,n,r,i){if(T.isFunction(r))return r.call(this,t,n);if(i&&(t=n),!!T.isString(t)){if(T.isString(r))return t.indexOf(r)!==-1;if(T.isRegExp(r))return r.test(t)}}function wS(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function xS(e,t){const n=T.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(i,s,o){return this[r].call(this,t,i,s,o)},configurable:!0})})}let St=class{constructor(t){t&&this.set(t)}set(t,n,r){const i=this;function s(l,a,u){const d=_i(a);if(!d)throw new Error("header name must be a non-empty string");const f=T.findKey(i,d);(!f||i[f]===void 0||u===!0||u===void 0&&i[f]!==!1)&&(i[f||a]=Eo(l))}const o=(l,a)=>T.forEach(l,(u,d)=>s(u,d,a));if(T.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(T.isString(t)&&(t=t.trim())&&!yS(t))o(gS(t),n);else if(T.isObject(t)&&T.isIterable(t)){let l={},a,u;for(const d of t){if(!T.isArray(d))throw TypeError("Object iterator must return a key-value pair");l[u=d[0]]=(a=l[u])?T.isArray(a)?[...a,d[1]]:[a,d[1]]:d[1]}o(l,n)}else t!=null&&s(n,t,r);return this}get(t,n){if(t=_i(t),t){const r=T.findKey(this,t);if(r){const i=this[r];if(!n)return i;if(n===!0)return vS(i);if(T.isFunction(n))return n.call(this,i,r);if(T.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=_i(t),t){const r=T.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||_a(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let i=!1;function s(o){if(o=_i(o),o){const l=T.findKey(r,o);l&&(!n||_a(r,r[l],l,n))&&(delete r[l],i=!0)}}return T.isArray(t)?t.forEach(s):s(t),i}clear(t){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const s=n[r];(!t||_a(this,this[s],s,t,!0))&&(delete this[s],i=!0)}return i}normalize(t){const n=this,r={};return T.forEach(this,(i,s)=>{const o=T.findKey(r,s);if(o){n[o]=Eo(i),delete n[s];return}const l=t?wS(s):String(s).trim();l!==s&&delete n[s],n[l]=Eo(i),r[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return T.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=t&&T.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` -`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[cp]=this[cp]={accessors:{}}).accessors,i=this.prototype;function s(o){const l=_i(o);r[l]||(xS(i,o),r[l]=!0)}return T.isArray(t)?t.forEach(s):s(t),this}};St.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);T.reduceDescriptors(St.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});T.freezeMethods(St);function Pa(e,t){const n=this||Ms,r=t||n,i=St.from(r.headers);let s=r.data;return T.forEach(e,function(l){s=l.call(n,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function tv(e){return!!(e&&e.__CANCEL__)}function fi(e,t,n){ee.call(this,e??"canceled",ee.ERR_CANCELED,t,n),this.name="CanceledError"}T.inherits(fi,ee,{__CANCEL__:!0});function nv(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new ee("Request failed with status code "+n.status,[ee.ERR_BAD_REQUEST,ee.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function kS(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function SS(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,s=0,o;return t=t!==void 0?t:1e3,function(a){const u=Date.now(),d=r[s];o||(o=u),n[i]=a,r[i]=u;let f=s,p=0;for(;f!==i;)p+=n[f++],f=f%e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),u-o{n=d,i=null,s&&(clearTimeout(s),s=null),e(...u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=r?o(u,d):(i=u,s||(s=setTimeout(()=>{s=null,o(i)},r-f)))},()=>i&&o(i)]}const sl=(e,t,n=3)=>{let r=0;const i=SS(50,250);return ES(s=>{const o=s.loaded,l=s.lengthComputable?s.total:void 0,a=o-r,u=i(a),d=o<=l;r=o;const f={loaded:o,total:l,progress:l?o/l:void 0,bytes:a,rate:u||void 0,estimated:u&&l&&d?(l-o)/u:void 0,event:s,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(f)},n)},dp=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},fp=e=>(...t)=>T.asap(()=>e(...t)),CS=it.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,it.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(it.origin),it.navigator&&/(msie|trident)/i.test(it.navigator.userAgent)):()=>!0,bS=it.hasStandardBrowserEnv?{write(e,t,n,r,i,s,o){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];T.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),T.isString(r)&&l.push(`path=${r}`),T.isString(i)&&l.push(`domain=${i}`),s===!0&&l.push("secure"),T.isString(o)&&l.push(`SameSite=${o}`),document.cookie=l.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function NS(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function TS(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function rv(e,t,n){let r=!NS(t);return e&&(r||n==!1)?TS(e,t):t}const pp=e=>e instanceof St?{...e}:e;function kr(e,t){t=t||{};const n={};function r(u,d,f,p){return T.isPlainObject(u)&&T.isPlainObject(d)?T.merge.call({caseless:p},u,d):T.isPlainObject(d)?T.merge({},d):T.isArray(d)?d.slice():d}function i(u,d,f,p){if(T.isUndefined(d)){if(!T.isUndefined(u))return r(void 0,u,f,p)}else return r(u,d,f,p)}function s(u,d){if(!T.isUndefined(d))return r(void 0,d)}function o(u,d){if(T.isUndefined(d)){if(!T.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function l(u,d,f){if(f in t)return r(u,d);if(f in e)return r(void 0,u)}const a={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(u,d,f)=>i(pp(u),pp(d),f,!0)};return T.forEach(Object.keys({...e,...t}),function(d){const f=a[d]||i,p=f(e[d],t[d],d);T.isUndefined(p)&&f!==l||(n[d]=p)}),n}const iv=e=>{const t=kr({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:l}=t;if(t.headers=o=St.from(o),t.url=Jg(rv(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),T.isFormData(n)){if(it.hasStandardBrowserEnv||it.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(T.isFunction(n.getHeaders)){const a=n.getHeaders(),u=["content-type","content-length"];Object.entries(a).forEach(([d,f])=>{u.includes(d.toLowerCase())&&o.set(d,f)})}}if(it.hasStandardBrowserEnv&&(r&&T.isFunction(r)&&(r=r(t)),r||r!==!1&&CS(t.url))){const a=i&&s&&bS.read(s);a&&o.set(i,a)}return t},jS=typeof XMLHttpRequest<"u",_S=jS&&function(e){return new Promise(function(n,r){const i=iv(e);let s=i.data;const o=St.from(i.headers).normalize();let{responseType:l,onUploadProgress:a,onDownloadProgress:u}=i,d,f,p,w,h;function v(){w&&w(),h&&h(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let k=new XMLHttpRequest;k.open(i.method.toUpperCase(),i.url,!0),k.timeout=i.timeout;function g(){if(!k)return;const y=St.from("getAllResponseHeaders"in k&&k.getAllResponseHeaders()),j={data:!l||l==="text"||l==="json"?k.responseText:k.response,status:k.status,statusText:k.statusText,headers:y,config:e,request:k};nv(function(N){n(N),v()},function(N){r(N),v()},j),k=null}"onloadend"in k?k.onloadend=g:k.onreadystatechange=function(){!k||k.readyState!==4||k.status===0&&!(k.responseURL&&k.responseURL.indexOf("file:")===0)||setTimeout(g)},k.onabort=function(){k&&(r(new ee("Request aborted",ee.ECONNABORTED,e,k)),k=null)},k.onerror=function(C){const j=C&&C.message?C.message:"Network Error",S=new ee(j,ee.ERR_NETWORK,e,k);S.event=C||null,r(S),k=null},k.ontimeout=function(){let C=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const j=i.transitional||Zg;i.timeoutErrorMessage&&(C=i.timeoutErrorMessage),r(new ee(C,j.clarifyTimeoutError?ee.ETIMEDOUT:ee.ECONNABORTED,e,k)),k=null},s===void 0&&o.setContentType(null),"setRequestHeader"in k&&T.forEach(o.toJSON(),function(C,j){k.setRequestHeader(j,C)}),T.isUndefined(i.withCredentials)||(k.withCredentials=!!i.withCredentials),l&&l!=="json"&&(k.responseType=i.responseType),u&&([p,h]=sl(u,!0),k.addEventListener("progress",p)),a&&k.upload&&([f,w]=sl(a),k.upload.addEventListener("progress",f),k.upload.addEventListener("loadend",w)),(i.cancelToken||i.signal)&&(d=y=>{k&&(r(!y||y.type?new fi(null,e,k):y),k.abort(),k=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const m=kS(i.url);if(m&&it.protocols.indexOf(m)===-1){r(new ee("Unsupported protocol "+m+":",ee.ERR_BAD_REQUEST,e));return}k.send(s||null)})},PS=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,i;const s=function(u){if(!i){i=!0,l();const d=u instanceof Error?u:this.reason;r.abort(d instanceof ee?d:new fi(d instanceof Error?d.message:d))}};let o=t&&setTimeout(()=>{o=null,s(new ee(`timeout ${t} of ms exceeded`,ee.ETIMEDOUT))},t);const l=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),e=null)};e.forEach(u=>u.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>T.asap(l),a}},RS=function*(e,t){let n=e.byteLength;if(n{const i=OS(e,t);let s=0,o,l=a=>{o||(o=!0,r&&r(a))};return new ReadableStream({async pull(a){try{const{done:u,value:d}=await i.next();if(u){l(),a.close();return}let f=d.byteLength;if(n){let p=s+=f;n(p)}a.enqueue(new Uint8Array(d))}catch(u){throw l(u),u}},cancel(a){return l(a),i.return()}},{highWaterMark:2})},mp=64*1024,{isFunction:io}=T,IS=(({Request:e,Response:t})=>({Request:e,Response:t}))(T.global),{ReadableStream:gp,TextEncoder:vp}=T.global,yp=(e,...t)=>{try{return!!e(...t)}catch{return!1}},MS=e=>{e=T.merge.call({skipUndefined:!0},IS,e);const{fetch:t,Request:n,Response:r}=e,i=t?io(t):typeof fetch=="function",s=io(n),o=io(r);if(!i)return!1;const l=i&&io(gp),a=i&&(typeof vp=="function"?(h=>v=>h.encode(v))(new vp):async h=>new Uint8Array(await new n(h).arrayBuffer())),u=s&&l&&yp(()=>{let h=!1;const v=new n(it.origin,{body:new gp,method:"POST",get duplex(){return h=!0,"half"}}).headers.has("Content-Type");return h&&!v}),d=o&&l&&yp(()=>T.isReadableStream(new r("").body)),f={stream:d&&(h=>h.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(h=>{!f[h]&&(f[h]=(v,k)=>{let g=v&&v[h];if(g)return g.call(v);throw new ee(`Response type '${h}' is not supported`,ee.ERR_NOT_SUPPORT,k)})});const p=async h=>{if(h==null)return 0;if(T.isBlob(h))return h.size;if(T.isSpecCompliantForm(h))return(await new n(it.origin,{method:"POST",body:h}).arrayBuffer()).byteLength;if(T.isArrayBufferView(h)||T.isArrayBuffer(h))return h.byteLength;if(T.isURLSearchParams(h)&&(h=h+""),T.isString(h))return(await a(h)).byteLength},w=async(h,v)=>{const k=T.toFiniteNumber(h.getContentLength());return k??p(v)};return async h=>{let{url:v,method:k,data:g,signal:m,cancelToken:y,timeout:C,onDownloadProgress:j,onUploadProgress:S,responseType:N,headers:_,withCredentials:D="same-origin",fetchOptions:M}=iv(h),q=t||fetch;N=N?(N+"").toLowerCase():"text";let X=PS([m,y&&y.toAbortSignal()],C),te=null;const K=X&&X.unsubscribe&&(()=>{X.unsubscribe()});let z;try{if(S&&u&&k!=="get"&&k!=="head"&&(z=await w(_,g))!==0){let L=new n(v,{method:"POST",body:g,duplex:"half"}),$;if(T.isFormData(g)&&($=L.headers.get("content-type"))&&_.setContentType($),L.body){const[H,G]=dp(z,sl(fp(S)));g=hp(L.body,mp,H,G)}}T.isString(D)||(D=D?"include":"omit");const Q=s&&"credentials"in n.prototype,se={...M,signal:X,method:k.toUpperCase(),headers:_.normalize().toJSON(),body:g,duplex:"half",credentials:Q?D:void 0};te=s&&new n(v,se);let O=await(s?q(te,M):q(v,se));const b=d&&(N==="stream"||N==="response");if(d&&(j||b&&K)){const L={};["status","statusText","headers"].forEach(J=>{L[J]=O[J]});const $=T.toFiniteNumber(O.headers.get("content-length")),[H,G]=j&&dp($,sl(fp(j),!0))||[];O=new r(hp(O.body,mp,H,()=>{G&&G(),K&&K()}),L)}N=N||"text";let P=await f[T.findKey(f,N)||"text"](O,h);return!b&&K&&K(),await new Promise((L,$)=>{nv(L,$,{data:P,headers:St.from(O.headers),status:O.status,statusText:O.statusText,config:h,request:te})})}catch(Q){throw K&&K(),Q&&Q.name==="TypeError"&&/Load failed|fetch/i.test(Q.message)?Object.assign(new ee("Network Error",ee.ERR_NETWORK,h,te),{cause:Q.cause||Q}):ee.from(Q,Q&&Q.code,h,te)}}},DS=new Map,sv=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:i}=t,s=[r,i,n];let o=s.length,l=o,a,u,d=DS;for(;l--;)a=s[l],u=d.get(a),u===void 0&&d.set(a,u=l?new Map:MS(t)),d=u;return u};sv();const dd={http:Z1,xhr:_S,fetch:{get:sv}};T.forEach(dd,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const wp=e=>`- ${e}`,AS=e=>T.isFunction(e)||e===null||e===!1;function $S(e,t){e=T.isArray(e)?e:[e];const{length:n}=e;let r,i;const s={};for(let o=0;o`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let l=n?o.length>1?`since : -`+o.map(wp).join(` -`):" "+wp(o[0]):"as no adapter specified";throw new ee("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return i}const ov={getAdapter:$S,adapters:dd};function Ra(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new fi(null,e)}function xp(e){return Ra(e),e.headers=St.from(e.headers),e.data=Pa.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ov.getAdapter(e.adapter||Ms.adapter,e)(e).then(function(r){return Ra(e),r.data=Pa.call(e,e.transformResponse,r),r.headers=St.from(r.headers),r},function(r){return tv(r)||(Ra(e),r&&r.response&&(r.response.data=Pa.call(e,e.transformResponse,r.response),r.response.headers=St.from(r.response.headers))),Promise.reject(r)})}const lv="1.13.1",Al={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Al[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const kp={};Al.transitional=function(t,n,r){function i(s,o){return"[Axios v"+lv+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,l)=>{if(t===!1)throw new ee(i(o," has been removed"+(n?" in "+n:"")),ee.ERR_DEPRECATED);return n&&!kp[o]&&(kp[o]=!0,console.warn(i(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,o,l):!0}};Al.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function zS(e,t,n){if(typeof e!="object")throw new ee("options must be an object",ee.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const s=r[i],o=t[s];if(o){const l=e[s],a=l===void 0||o(l,s,e);if(a!==!0)throw new ee("option "+s+" must be "+a,ee.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ee("Unknown option "+s,ee.ERR_BAD_OPTION)}}const Co={assertOptions:zS,validators:Al},nn=Co.validators;let pr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new up,response:new up}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+s):r.stack=s}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=kr(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&Co.assertOptions(r,{silentJSONParsing:nn.transitional(nn.boolean),forcedJSONParsing:nn.transitional(nn.boolean),clarifyTimeoutError:nn.transitional(nn.boolean)},!1),i!=null&&(T.isFunction(i)?n.paramsSerializer={serialize:i}:Co.assertOptions(i,{encode:nn.function,serialize:nn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Co.assertOptions(n,{baseUrl:nn.spelling("baseURL"),withXsrfToken:nn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=s&&T.merge(s.common,s[n.method]);s&&T.forEach(["delete","get","head","post","put","patch","common"],h=>{delete s[h]}),n.headers=St.concat(o,s);const l=[];let a=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(n)===!1||(a=a&&v.synchronous,l.unshift(v.fulfilled,v.rejected))});const u=[];this.interceptors.response.forEach(function(v){u.push(v.fulfilled,v.rejected)});let d,f=0,p;if(!a){const h=[xp.bind(this),void 0];for(h.unshift(...l),h.push(...u),p=h.length,d=Promise.resolve(n);f{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(l=>{r.subscribe(l),s=l}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},t(function(s,o,l){r.reason||(r.reason=new fi(s,o,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new av(function(i){t=i}),cancel:t}}};function US(e){return function(n){return e.apply(null,n)}}function BS(e){return T.isObject(e)&&e.isAxiosError===!0}const Vu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Vu).forEach(([e,t])=>{Vu[t]=e});function uv(e){const t=new pr(e),n=Fg(pr.prototype.request,t);return T.extend(n,pr.prototype,t,{allOwnKeys:!0}),T.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return uv(kr(e,i))},n}const De=uv(Ms);De.Axios=pr;De.CanceledError=fi;De.CancelToken=FS;De.isCancel=tv;De.VERSION=lv;De.toFormData=Dl;De.AxiosError=ee;De.Cancel=De.CanceledError;De.all=function(t){return Promise.all(t)};De.spread=US;De.isAxiosError=BS;De.mergeConfig=kr;De.AxiosHeaders=St;De.formToJSON=e=>ev(T.isHTMLForm(e)?new FormData(e):e);De.getAdapter=ov.getAdapter;De.HttpStatusCode=Vu;De.default=De;const{Axios:kT,AxiosError:ST,CanceledError:ET,isCancel:CT,CancelToken:bT,VERSION:NT,all:TT,Cancel:jT,isAxiosError:_T,spread:PT,toFormData:RT,AxiosHeaders:OT,HttpStatusCode:LT,formToJSON:IT,getAdapter:MT,mergeConfig:DT}=De,fe=De.create({baseURL:"/api",withCredentials:!0,headers:{"Content-Type":"application/json"}});fe.interceptors.request.use(e=>{var t;return console.log("API Request:",(t=e.method)==null?void 0:t.toUpperCase(),e.url),e},e=>Promise.reject(e));fe.interceptors.response.use(e=>(console.log("API Response:",e.status,e.config.url),e),e=>{var t,n,r,i;return console.error("API Error:",{url:(t=e.config)==null?void 0:t.url,status:(n=e.response)==null?void 0:n.status,message:e.message,data:(r=e.response)==null?void 0:r.data}),((i=e.response)==null?void 0:i.status)===401&&(["/login","/register","/notes/archived/all","/user/delete-account"].some(l=>{var a,u;return(u=(a=e.config)==null?void 0:a.url)==null?void 0:u.includes(l)})||(localStorage.removeItem("isAuthenticated"),window.location.href="/")),e.response||console.error("Network error - server might be down or proxy not working"),Promise.reject(e)});const Sr={login:async(e,t)=>{const{data:n}=await fe.post("/login",{username:e,password:t});return n},register:async(e,t,n)=>{const{data:r}=await fe.post("/register",{username:e,password:t,confirmPassword:n});return r},checkStatus:async()=>{const{data:e}=await fe.get("/auth/status");return e},logout:async()=>{await fe.post("/logout")}},Tr=()=>{const e=ot();return{showNotification:x.useCallback((n,r="info")=>{const s=e(a1({message:n,type:r})).payload.id;setTimeout(()=>{e($g(s))},4e3)},[e])}},Xi=/^[a-z0-9]+(-[a-z0-9]+)*$/,$l=(e,t,n,r="")=>{const i=e.split(":");if(e.slice(0,1)==="@"){if(i.length<2||i.length>3)return null;r=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){const l=i.pop(),a=i.pop(),u={provider:i.length>0?i[0]:r,prefix:a,name:l};return t&&!bo(u)?null:u}const s=i[0],o=s.split("-");if(o.length>1){const l={provider:r,prefix:o.shift(),name:o.join("-")};return t&&!bo(l)?null:l}if(n&&r===""){const l={provider:r,prefix:"",name:s};return t&&!bo(l,n)?null:l}return null},bo=(e,t)=>e?!!((e.provider===""||e.provider.match(Xi))&&(t&&e.prefix===""||e.prefix.match(Xi))&&e.name.match(Xi)):!1,cv=Object.freeze({left:0,top:0,width:16,height:16}),ol=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),fd=Object.freeze({...cv,...ol}),Qu=Object.freeze({...fd,body:"",hidden:!1});function WS(e,t){const n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);const r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function Sp(e,t){const n=WS(e,t);for(const r in Qu)r in ol?r in e&&!(r in n)&&(n[r]=ol[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function HS(e,t){const n=e.icons,r=e.aliases||Object.create(null),i=Object.create(null);function s(o){if(n[o])return i[o]=[];if(!(o in i)){i[o]=null;const l=r[o]&&r[o].parent,a=l&&s(l);a&&(i[o]=[l].concat(a))}return i[o]}return Object.keys(n).concat(Object.keys(r)).forEach(s),i}function VS(e,t,n){const r=e.icons,i=e.aliases||Object.create(null);let s={};function o(l){s=Sp(r[l]||i[l],s)}return o(t),n.forEach(o),Sp(e,s)}function dv(e,t){const n=[];if(typeof e!="object"||typeof e.icons!="object")return n;e.not_found instanceof Array&&e.not_found.forEach(i=>{t(i,null),n.push(i)});const r=HS(e);for(const i in r){const s=r[i];s&&(t(i,VS(e,i,s)),n.push(i))}return n}const QS={provider:"",aliases:{},not_found:{},...cv};function Oa(e,t){for(const n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function fv(e){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.prefix!="string"||!e.icons||typeof e.icons!="object"||!Oa(e,QS))return null;const n=t.icons;for(const i in n){const s=n[i];if(!i.match(Xi)||typeof s.body!="string"||!Oa(s,Qu))return null}const r=t.aliases||Object.create(null);for(const i in r){const s=r[i],o=s.parent;if(!i.match(Xi)||typeof o!="string"||!n[o]&&!r[o]||!Oa(s,Qu))return null}return t}const Ep=Object.create(null);function qS(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function Er(e,t){const n=Ep[e]||(Ep[e]=Object.create(null));return n[t]||(n[t]=qS(e,t))}function pd(e,t){return fv(t)?dv(t,(n,r)=>{r?e.icons[n]=r:e.missing.add(n)}):[]}function GS(e,t,n){try{if(typeof n.body=="string")return e.icons[t]={...n},!0}catch{}return!1}let Ss=!1;function pv(e){return typeof e=="boolean"&&(Ss=e),Ss}function YS(e){const t=typeof e=="string"?$l(e,!0,Ss):e;if(t){const n=Er(t.provider,t.prefix),r=t.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function KS(e,t){const n=$l(e,!0,Ss);if(!n)return!1;const r=Er(n.provider,n.prefix);return GS(r,n.name,t)}function XS(e,t){if(typeof e!="object")return!1;if(typeof t!="string"&&(t=e.provider||""),Ss&&!t&&!e.prefix){let i=!1;return fv(e)&&(e.prefix="",dv(e,(s,o)=>{o&&KS(s,o)&&(i=!0)})),i}const n=e.prefix;if(!bo({provider:t,prefix:n,name:"a"}))return!1;const r=Er(t,n);return!!pd(r,e)}const hv=Object.freeze({width:null,height:null}),mv=Object.freeze({...hv,...ol}),JS=/(-?[0-9.]*[0-9]+[0-9.]*)/g,ZS=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Cp(e,t,n){if(t===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*t*n)/n;if(typeof e!="string")return e;const r=e.split(JS);if(r===null||!r.length)return e;const i=[];let s=r.shift(),o=ZS.test(s);for(;;){if(o){const l=parseFloat(s);isNaN(l)?i.push(s):i.push(Math.ceil(l*t*n)/n)}else i.push(s);if(s=r.shift(),s===void 0)return i.join("");o=!o}}const eE=e=>e==="unset"||e==="undefined"||e==="none";function tE(e,t){const n={...fd,...e},r={...mv,...t},i={left:n.left,top:n.top,width:n.width,height:n.height};let s=n.body;[n,r].forEach(h=>{const v=[],k=h.hFlip,g=h.vFlip;let m=h.rotate;k?g?m+=2:(v.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),v.push("scale(-1 1)"),i.top=i.left=0):g&&(v.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),v.push("scale(1 -1)"),i.top=i.left=0);let y;switch(m<0&&(m-=Math.floor(m/4)*4),m=m%4,m){case 1:y=i.height/2+i.top,v.unshift("rotate(90 "+y.toString()+" "+y.toString()+")");break;case 2:v.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:y=i.width/2+i.left,v.unshift("rotate(-90 "+y.toString()+" "+y.toString()+")");break}m%2===1&&(i.left!==i.top&&(y=i.left,i.left=i.top,i.top=y),i.width!==i.height&&(y=i.width,i.width=i.height,i.height=y)),v.length&&(s=''+s+"")});const o=r.width,l=r.height,a=i.width,u=i.height;let d,f;o===null?(f=l===null?"1em":l==="auto"?u:l,d=Cp(f,a/u)):(d=o==="auto"?a:o,f=l===null?Cp(d,u/a):l==="auto"?u:l);const p={},w=(h,v)=>{eE(v)||(p[h]=v.toString())};return w("width",d),w("height",f),p.viewBox=i.left.toString()+" "+i.top.toString()+" "+a.toString()+" "+u.toString(),{attributes:p,body:s}}const nE=/\sid="(\S+)"/g,rE="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let iE=0;function sE(e,t=rE){const n=[];let r;for(;r=nE.exec(e);)n.push(r[1]);if(!n.length)return e;const i="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(s=>{const o=typeof t=="function"?t(s):t+(iE++).toString(),l=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+o+i+"$3")}),e=e.replace(new RegExp(i,"g"),""),e}const qu=Object.create(null);function oE(e,t){qu[e]=t}function Gu(e){return qu[e]||qu[""]}function hd(e){let t;if(typeof e.resources=="string")t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const md=Object.create(null),Pi=["https://api.simplesvg.com","https://api.unisvg.com"],No=[];for(;Pi.length>0;)Pi.length===1||Math.random()>.5?No.push(Pi.shift()):No.push(Pi.pop());md[""]=hd({resources:["https://api.iconify.design"].concat(No)});function lE(e,t){const n=hd(t);return n===null?!1:(md[e]=n,!0)}function gd(e){return md[e]}const aE=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let bp=aE();function uE(e,t){const n=gd(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let i=0;n.resources.forEach(o=>{i=Math.max(i,o.length)});const s=t+".json?icons=";r=n.maxURL-i-n.path.length-s.length}return r}function cE(e){return e===404}const dE=(e,t,n)=>{const r=[],i=uE(e,t),s="icons";let o={type:s,provider:e,prefix:t,icons:[]},l=0;return n.forEach((a,u)=>{l+=a.length+1,l>=i&&u>0&&(r.push(o),o={type:s,provider:e,prefix:t,icons:[]},l=a.length),o.icons.push(a)}),r.push(o),r};function fE(e){if(typeof e=="string"){const t=gd(e);if(t)return t.path}return"/"}const pE=(e,t,n)=>{if(!bp){n("abort",424);return}let r=fE(t.provider);switch(t.type){case"icons":{const s=t.prefix,l=t.icons.join(","),a=new URLSearchParams({icons:l});r+=s+".json?"+a.toString();break}case"custom":{const s=t.uri;r+=s.slice(0,1)==="/"?s.slice(1):s;break}default:n("abort",400);return}let i=503;bp(e+r).then(s=>{const o=s.status;if(o!==200){setTimeout(()=>{n(cE(o)?"abort":"next",o)});return}return i=501,s.json()}).then(s=>{if(typeof s!="object"||s===null){setTimeout(()=>{s===404?n("abort",s):n("next",i)});return}setTimeout(()=>{n("success",s)})}).catch(()=>{n("next",i)})},hE={prepare:dE,send:pE};function mE(e){const t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((i,s)=>i.provider!==s.provider?i.provider.localeCompare(s.provider):i.prefix!==s.prefix?i.prefix.localeCompare(s.prefix):i.name.localeCompare(s.name));let r={provider:"",prefix:"",name:""};return e.forEach(i=>{if(r.name===i.name&&r.prefix===i.prefix&&r.provider===i.provider)return;r=i;const s=i.provider,o=i.prefix,l=i.name,a=n[s]||(n[s]=Object.create(null)),u=a[o]||(a[o]=Er(s,o));let d;l in u.icons?d=t.loaded:o===""||u.missing.has(l)?d=t.missing:d=t.pending;const f={provider:s,prefix:o,name:l};d.push(f)}),t}function gv(e,t){e.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(i=>i.id!==t))})}function gE(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1;const r=e.provider,i=e.prefix;t.forEach(s=>{const o=s.icons,l=o.pending.length;o.pending=o.pending.filter(a=>{if(a.prefix!==i)return!0;const u=a.name;if(e.icons[u])o.loaded.push({provider:r,prefix:i,name:u});else if(e.missing.has(u))o.missing.push({provider:r,prefix:i,name:u});else return n=!0,!0;return!1}),o.pending.length!==l&&(n||gv([e],s.id),s.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),s.abort))})}))}let vE=0;function yE(e,t,n){const r=vE++,i=gv.bind(null,n,r);if(!t.pending.length)return i;const s={id:r,icons:t,callback:e,abort:i};return n.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(s)}),i}function wE(e,t=!0,n=!1){const r=[];return e.forEach(i=>{const s=typeof i=="string"?$l(i,t,n):i;s&&r.push(s)}),r}var xE={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function kE(e,t,n,r){const i=e.resources.length,s=e.random?Math.floor(Math.random()*i):e.index;let o;if(e.random){let S=e.resources.slice(0);for(o=[];S.length>1;){const N=Math.floor(Math.random()*S.length);o.push(S[N]),S=S.slice(0,N).concat(S.slice(N+1))}o=o.concat(S)}else o=e.resources.slice(s).concat(e.resources.slice(0,s));const l=Date.now();let a="pending",u=0,d,f=null,p=[],w=[];typeof r=="function"&&w.push(r);function h(){f&&(clearTimeout(f),f=null)}function v(){a==="pending"&&(a="aborted"),h(),p.forEach(S=>{S.status==="pending"&&(S.status="aborted")}),p=[]}function k(S,N){N&&(w=[]),typeof S=="function"&&w.push(S)}function g(){return{startTime:l,payload:t,status:a,queriesSent:u,queriesPending:p.length,subscribe:k,abort:v}}function m(){a="failed",w.forEach(S=>{S(void 0,d)})}function y(){p.forEach(S=>{S.status==="pending"&&(S.status="aborted")}),p=[]}function C(S,N,_){const D=N!=="success";switch(p=p.filter(M=>M!==S),a){case"pending":break;case"failed":if(D||!e.dataAfterTimeout)return;break;default:return}if(N==="abort"){d=_,m();return}if(D){d=_,p.length||(o.length?j():m());return}if(h(),y(),!e.random){const M=e.resources.indexOf(S.resource);M!==-1&&M!==e.index&&(e.index=M)}a="completed",w.forEach(M=>{M(_)})}function j(){if(a!=="pending")return;h();const S=o.shift();if(S===void 0){if(p.length){f=setTimeout(()=>{h(),a==="pending"&&(y(),m())},e.timeout);return}m();return}const N={status:"pending",resource:S,callback:(_,D)=>{C(N,_,D)}};p.push(N),u++,f=setTimeout(j,e.rotate),n(S,t,N.callback)}return setTimeout(j),g}function vv(e){const t={...xE,...e};let n=[];function r(){n=n.filter(l=>l().status==="pending")}function i(l,a,u){const d=kE(t,l,a,(f,p)=>{r(),u&&u(f,p)});return n.push(d),d}function s(l){return n.find(a=>l(a))||null}return{query:i,find:s,setIndex:l=>{t.index=l},getIndex:()=>t.index,cleanup:r}}function Np(){}const La=Object.create(null);function SE(e){if(!La[e]){const t=gd(e);if(!t)return;const n=vv(t),r={config:t,redundancy:n};La[e]=r}return La[e]}function EE(e,t,n){let r,i;if(typeof e=="string"){const s=Gu(e);if(!s)return n(void 0,424),Np;i=s.send;const o=SE(e);o&&(r=o.redundancy)}else{const s=hd(e);if(s){r=vv(s);const o=e.resources?e.resources[0]:"",l=Gu(o);l&&(i=l.send)}}return!r||!i?(n(void 0,424),Np):r.query(t,i,n)().abort}const Tp="iconify2",Es="iconify",yv=Es+"-count",jp=Es+"-version",wv=36e5,CE=168;function Yu(e,t){try{return e.getItem(t)}catch{}}function vd(e,t,n){try{return e.setItem(t,n),!0}catch{}}function _p(e,t){try{e.removeItem(t)}catch{}}function Ku(e,t){return vd(e,yv,t.toString())}function Xu(e){return parseInt(Yu(e,yv))||0}const zl={local:!0,session:!0},xv={local:new Set,session:new Set};let yd=!1;function bE(e){yd=e}let so=typeof window>"u"?{}:window;function kv(e){const t=e+"Storage";try{if(so&&so[t]&&typeof so[t].length=="number")return so[t]}catch{}zl[e]=!1}function Sv(e,t){const n=kv(e);if(!n)return;const r=Yu(n,jp);if(r!==Tp){if(r){const l=Xu(n);for(let a=0;a{const a=Es+l.toString(),u=Yu(n,a);if(typeof u=="string"){try{const d=JSON.parse(u);if(typeof d=="object"&&typeof d.cached=="number"&&d.cached>i&&typeof d.provider=="string"&&typeof d.data=="object"&&typeof d.data.prefix=="string"&&t(d,l))return!0}catch{}_p(n,a)}};let o=Xu(n);for(let l=o-1;l>=0;l--)s(l)||(l===o-1?(o--,Ku(n,o)):xv[e].add(l))}function Ev(){if(!yd){bE(!0);for(const e in zl)Sv(e,t=>{const n=t.data,r=t.provider,i=n.prefix,s=Er(r,i);if(!pd(s,n).length)return!1;const o=n.lastModified||-1;return s.lastModifiedCached=s.lastModifiedCached?Math.min(s.lastModifiedCached,o):o,!0})}}function NE(e,t){const n=e.lastModifiedCached;if(n&&n>=t)return n===t;if(e.lastModifiedCached=t,n)for(const r in zl)Sv(r,i=>{const s=i.data;return i.provider!==e.provider||s.prefix!==e.prefix||s.lastModified===t});return!0}function TE(e,t){yd||Ev();function n(r){let i;if(!zl[r]||!(i=kv(r)))return;const s=xv[r];let o;if(s.size)s.delete(o=Array.from(s).shift());else if(o=Xu(i),!Ku(i,o+1))return;const l={cached:Math.floor(Date.now()/wv),provider:e.provider,data:t};return vd(i,Es+o.toString(),JSON.stringify(l))}t.lastModified&&!NE(e,t.lastModified)||Object.keys(t.icons).length&&(t.not_found&&(t=Object.assign({},t),delete t.not_found),n("local")||n("session"))}function Pp(){}function jE(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,gE(e)}))}function _E(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:n,prefix:r}=e,i=e.iconsToLoad;delete e.iconsToLoad;let s;if(!i||!(s=Gu(n)))return;s.prepare(n,r,i).forEach(l=>{EE(n,l,a=>{if(typeof a!="object")l.icons.forEach(u=>{e.missing.add(u)});else try{const u=pd(e,a);if(!u.length)return;const d=e.pendingIcons;d&&u.forEach(f=>{d.delete(f)}),TE(e,a)}catch(u){console.error(u)}jE(e)})})}))}const PE=(e,t)=>{const n=wE(e,!0,pv()),r=mE(n);if(!r.pending.length){let a=!0;return t&&setTimeout(()=>{a&&t(r.loaded,r.missing,r.pending,Pp)}),()=>{a=!1}}const i=Object.create(null),s=[];let o,l;return r.pending.forEach(a=>{const{provider:u,prefix:d}=a;if(d===l&&u===o)return;o=u,l=d,s.push(Er(u,d));const f=i[u]||(i[u]=Object.create(null));f[d]||(f[d]=[])}),r.pending.forEach(a=>{const{provider:u,prefix:d,name:f}=a,p=Er(u,d),w=p.pendingIcons||(p.pendingIcons=new Set);w.has(f)||(w.add(f),i[u][d].push(f))}),s.forEach(a=>{const{provider:u,prefix:d}=a;i[u][d].length&&_E(a,i[u][d])}),t?yE(t,r,s):Pp};function RE(e,t){const n={...e};for(const r in t){const i=t[r],s=typeof i;r in hv?(i===null||i&&(s==="string"||s==="number"))&&(n[r]=i):s===typeof n[r]&&(n[r]=r==="rotate"?i%4:i)}return n}const OE=/[\s,]+/;function LE(e,t){t.split(OE).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function IE(e,t=0){const n=e.replace(/^-?[0-9.]*/,"");function r(i){for(;i<0;)i+=4;return i%4}if(n===""){const i=parseInt(e);return isNaN(i)?0:r(i)}else if(n!==e){let i=0;switch(n){case"%":i=25;break;case"deg":i=90}if(i){let s=parseFloat(e.slice(0,e.length-n.length));return isNaN(s)?0:(s=s/i,s%1===0?r(s):0)}}return t}function ME(e,t){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in t)n+=" "+r+'="'+t[r]+'"';return'"+e+""}function DE(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function AE(e){return"data:image/svg+xml,"+DE(e)}function $E(e){return'url("'+AE(e)+'")'}let Ji;function zE(){try{Ji=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Ji=null}}function FE(e){return Ji===void 0&&zE(),Ji?Ji.createHTML(e):e}const Cv={...mv,inline:!1},UE={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},BE={display:"inline-block"},Ju={backgroundColor:"currentColor"},bv={backgroundColor:"transparent"},Rp={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Op={WebkitMask:Ju,mask:Ju,background:bv};for(const e in Op){const t=Op[e];for(const n in Rp)t[e+n]=Rp[n]}const WE={...Cv,inline:!0};function Lp(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const HE=(e,t,n,r)=>{const i=n?WE:Cv,s=RE(i,t),o=t.mode||"svg",l={},a=t.style||{},u={...o==="svg"?UE:{},ref:r};for(let g in t){const m=t[g];if(m!==void 0)switch(g){case"icon":case"style":case"children":case"onLoad":case"mode":case"_ref":case"_inline":break;case"inline":case"hFlip":case"vFlip":s[g]=m===!0||m==="true"||m===1;break;case"flip":typeof m=="string"&&LE(s,m);break;case"color":l.color=m;break;case"rotate":typeof m=="string"?s[g]=IE(m):typeof m=="number"&&(s[g]=m);break;case"ariaHidden":case"aria-hidden":m!==!0&&m!=="true"&&delete u["aria-hidden"];break;default:i[g]===void 0&&(u[g]=m)}}const d=tE(e,s),f=d.attributes;if(s.inline&&(l.verticalAlign="-0.125em"),o==="svg"){u.style={...l,...a},Object.assign(u,f);let g=0,m=t.id;return typeof m=="string"&&(m=m.replace(/-/g,"_")),u.dangerouslySetInnerHTML={__html:FE(sE(d.body,m?()=>m+"ID"+g++:"iconifyReact"))},Jt.createElement("svg",u)}const{body:p,width:w,height:h}=e,v=o==="mask"||(o==="bg"?!1:p.indexOf("currentColor")!==-1),k=ME(p,{...f,width:w+"",height:h+""});return u.style={...l,"--svg":$E(k),width:Lp(f.width),height:Lp(f.height),...BE,...v?Ju:bv,...a},Jt.createElement("span",u)};pv(!0);oE("",hE);if(typeof document<"u"&&typeof window<"u"){Ev();const e=window;if(e.IconifyPreload!==void 0){const t=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof t=="object"&&t!==null&&(t instanceof Array?t:[t]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!XS(r))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){const t=e.IconifyProviders;if(typeof t=="object"&&t!==null)for(let n in t){const r="IconifyProviders["+n+"] is invalid.";try{const i=t[n];if(typeof i!="object"||!i||i.resources===void 0)continue;lE(n,i)||console.error(r)}catch{console.error(r)}}}}class Nv extends Jt.Component{constructor(t){super(t),this.state={icon:null}}_abortLoading(){this._loading&&(this._loading.abort(),this._loading=null)}_setData(t){this.state.icon!==t&&this.setState({icon:t})}_checkIcon(t){const n=this.state,r=this.props.icon;if(typeof r=="object"&&r!==null&&typeof r.body=="string"){this._icon="",this._abortLoading(),(t||n.icon===null)&&this._setData({data:r});return}let i;if(typeof r!="string"||(i=$l(r,!1,!0))===null){this._abortLoading(),this._setData(null);return}const s=YS(i);if(!s){(!this._loading||this._loading.name!==r)&&(this._abortLoading(),this._icon="",this._setData(null),s!==null&&(this._loading={name:r,abort:PE([i],this._checkIcon.bind(this,!1))}));return}if(this._icon!==r||n.icon===null){this._abortLoading(),this._icon=r;const o=["iconify"];i.prefix!==""&&o.push("iconify--"+i.prefix),i.provider!==""&&o.push("iconify--"+i.provider),this._setData({data:s,classes:o}),this.props.onLoad&&this.props.onLoad(r)}}componentDidMount(){this._checkIcon(!1)}componentDidUpdate(t){t.icon!==this.props.icon&&this._checkIcon(!0)}componentWillUnmount(){this._abortLoading()}render(){const t=this.props,n=this.state.icon;if(n===null)return t.children?t.children:Jt.createElement("span",{});let r=t;return n.classes&&(r={...t,className:(typeof t.className=="string"?t.className+" ":"")+n.classes.join(" ")}),HE({...fd,...n.data},r,t._inline,t._ref)}}const F=Jt.forwardRef(function(t,n){const r={...t,_ref:n,_inline:!1};return Jt.createElement(Nv,r)});Jt.forwardRef(function(t,n){const r={...t,_ref:n,_inline:!0};return Jt.createElement(Nv,r)});const VE=e=>{const t=e.replace("#",""),n=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),i=parseInt(t.substring(4,6),16);return`${n}, ${r}, ${i}`},Cs=e=>{document.documentElement.style.setProperty("--accent-color",e);const t=VE(e);document.documentElement.style.setProperty("--accent-color-rgb",t)},Tv=()=>{const e=ye(r=>r.ui.theme),t=ye(r=>r.ui.accentColor),n=ot();return x.useEffect(()=>{document.documentElement.setAttribute("data-theme",e),Cs(t);const r=document.querySelector('meta[name="theme-color"]');r&&r.setAttribute("content",e==="dark"?"#1a1a1a":t)},[e,t]),x.useEffect(()=>{const r=window.matchMedia("(prefers-color-scheme: dark)"),i=s=>{localStorage.getItem("theme")||n(l1(s.matches?"dark":"light"))};return r.addEventListener("change",i),()=>r.removeEventListener("change",i)},[n]),{theme:e,accentColor:t,toggleTheme:()=>n(o1())}},Ds=()=>{const{theme:e,toggleTheme:t}=Tv();return c.jsx("button",{id:"theme-toggle-btn",className:"theme-toggle-btn",onClick:t,title:"Переключить тему",children:c.jsx(F,{icon:e==="dark"?"mdi:weather-sunny":"mdi:weather-night"})})},QE=()=>{const[e,t]=x.useState(""),[n,r]=x.useState(""),[i,s]=x.useState(!1),o=Kn(),l=ot(),{showNotification:a}=Tr(),u=ye(p=>p.auth.isAuthenticated),[d]=Bx();x.useEffect(()=>{u&&o("/notes")},[u,o]),x.useEffect(()=>{d.get("error")==="invalid_password"&&a("Неверный пароль!","error")},[d,a]);const f=async p=>{var w;if(p.preventDefault(),!e.trim()||!n){a("Логин и пароль обязательны","error");return}s(!0);try{console.log("Attempting login...");const h=await Sr.login(e,n);if(console.log("Login response:",h),h.success){const v=await Sr.checkStatus();l(sd({userId:v.userId,username:v.username})),a("Успешный вход!","success"),o("/notes")}else a(h.error||"Ошибка входа","error")}catch(h){console.error("Login error details:",h),console.error("Error response:",h.response),console.error("Error message:",h.message);let v="Ошибка соединения с сервером";h.response?v=((w=h.response.data)==null?void 0:w.error)||`Ошибка ${h.response.status}`:h.request?v="Сервер не отвечает. Проверьте, запущен ли backend на порту 3000":v=h.message||"Ошибка соединения с сервером",a(v,"error")}finally{s(!1)}};return c.jsxs("div",{className:"container",children:[c.jsx("header",{children:c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[c.jsxs("span",{children:[c.jsx(F,{icon:"mdi:login"})," Вход в систему"]}),c.jsx(Ds,{})]})}),c.jsxs("div",{className:"login-form",children:[c.jsxs("form",{id:"loginForm",onSubmit:f,children:[c.jsxs("div",{className:"form-group",children:[c.jsx("label",{htmlFor:"username",children:"Логин:"}),c.jsx("input",{type:"text",id:"username",name:"username",value:e,onChange:p=>t(p.target.value),required:!0,placeholder:"Введите ваш логин"})]}),c.jsxs("div",{className:"form-group",children:[c.jsx("label",{htmlFor:"password",children:"Пароль:"}),c.jsx("input",{type:"password",id:"password",name:"password",value:n,onChange:p=>r(p.target.value),required:!0,placeholder:"Введите пароль"})]}),c.jsx("button",{type:"submit",className:"btnSave",disabled:i,children:i?"Вход...":"Войти"})]}),c.jsxs("p",{className:"auth-link",children:["Нет аккаунта? ",c.jsx(wg,{to:"/register",children:"Зарегистрируйтесь"})]})]}),c.jsx("div",{className:"footer",children:c.jsxs("p",{children:["Создатель: ",c.jsx("span",{children:"Fovway"})]})})]})},qE=()=>{const[e,t]=x.useState(""),[n,r]=x.useState(""),[i,s]=x.useState(""),[o,l]=x.useState(!1),a=Kn(),u=ot(),{showNotification:d}=Tr(),f=ye(w=>w.auth.isAuthenticated);x.useEffect(()=>{f&&a("/notes")},[f,a]);const p=async w=>{var h;if(w.preventDefault(),!e.trim()||!n||!i){d("Все поля обязательны","error");return}if(e.length<3){d("Логин должен быть не менее 3 символов","error");return}if(n.length<6){d("Пароль должен быть не менее 6 символов","error");return}if(n!==i){d("Пароли не совпадают","error");return}l(!0);try{console.log("Attempting registration...");const v=await Sr.register(e,n,i);if(console.log("Register response:",v),v.success){const k=await Sr.checkStatus();u(sd({userId:k.userId,username:k.username})),d("Регистрация успешна!","success"),a("/notes")}else d(v.error||"Ошибка регистрации","error")}catch(v){console.error("Register error details:",v),console.error("Error response:",v.response),console.error("Error message:",v.message);let k="Ошибка соединения с сервером";v.response?k=((h=v.response.data)==null?void 0:h.error)||`Ошибка ${v.response.status}`:v.request?k="Сервер не отвечает. Проверьте, запущен ли backend на порту 3000":k=v.message||"Ошибка соединения с сервером",d(k,"error")}finally{l(!1)}};return c.jsxs("div",{className:"container",children:[c.jsx("header",{children:c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[c.jsxs("span",{children:[c.jsx(F,{icon:"mdi:account-plus"})," Регистрация"]}),c.jsx(Ds,{})]})}),c.jsxs("div",{className:"login-form",children:[c.jsxs("form",{id:"registerForm",onSubmit:p,children:[c.jsxs("div",{className:"form-group",children:[c.jsx("label",{htmlFor:"username",children:"Логин:"}),c.jsx("input",{type:"text",id:"username",name:"username",value:e,onChange:w=>t(w.target.value),required:!0,placeholder:"Введите ваш логин (мин. 3 символа)"})]}),c.jsxs("div",{className:"form-group",children:[c.jsx("label",{htmlFor:"password",children:"Пароль:"}),c.jsx("input",{type:"password",id:"password",name:"password",value:n,onChange:w=>r(w.target.value),required:!0,placeholder:"Введите пароль (мин. 6 символов)"})]}),c.jsxs("div",{className:"form-group",children:[c.jsx("label",{htmlFor:"confirmPassword",children:"Подтвердите пароль:"}),c.jsx("input",{type:"password",id:"confirmPassword",name:"confirmPassword",value:i,onChange:w=>s(w.target.value),required:!0,placeholder:"Подтвердите пароль"})]}),c.jsx("button",{type:"submit",className:"btnSave",disabled:o,children:o?"Регистрация...":"Зарегистрироваться"})]}),c.jsxs("p",{className:"auth-link",children:["Уже есть аккаунт? ",c.jsx(wg,{to:"/",children:"Войдите"})]})]}),c.jsx("div",{className:"footer",children:c.jsxs("p",{children:["Создатель: ",c.jsx("span",{children:"Fovway"})]})})]})},ct={getProfile:async()=>{const{data:e}=await fe.get("/user");return e},updateProfile:async e=>{const{data:t}=await fe.put("/user/profile",e);return t},uploadAvatar:async e=>{const t=new FormData;t.append("avatar",e);const{data:n}=await fe.post("/user/avatar",t,{headers:{"Content-Type":"multipart/form-data"}});return n},deleteAvatar:async()=>{await fe.delete("/user/avatar")},deleteAccount:async e=>{const{data:t}=await fe.delete("/user/delete-account",{data:{password:e}});return t},getAiSettings:async()=>{const{data:e}=await fe.get("/user/ai-settings");return e},updateAiSettings:async e=>{const{data:t}=await fe.put("/user/ai-settings",e);return t}},GE=({onFilterChange:e,onToggleSidebar:t})=>{const n=Kn(),r=ot(),i=ye(u=>u.profile.user),s=ye(u=>u.notes.selectedDate),o=ye(u=>u.notes.selectedTag),l=ye(u=>u.notes.searchQuery);x.useEffect(()=>{a()},[]),x.useEffect(()=>{const u=!!(s||o||l);e==null||e(u)},[s,o,l,e]);const a=async()=>{try{const u=await ct.getProfile();r(od(u));const d=u.accent_color||"#007bff";r(il(d)),Cs(d);try{const f=await ct.getAiSettings();r(ld(f))}catch(f){console.error("Ошибка загрузки AI настроек:",f)}}catch(u){console.error("Ошибка загрузки информации о пользователе:",u)}};return c.jsxs(c.Fragment,{children:[t&&c.jsx("button",{className:"mobile-menu-btn",onClick:t,children:c.jsx(F,{icon:"mdi:menu"})}),c.jsxs("header",{className:"notes-header",children:[c.jsx("div",{className:"notes-header-left",children:c.jsxs("span",{children:[c.jsx(F,{icon:"mdi:note-text"})," Мои заметки"]})}),c.jsxs("div",{className:"user-info",children:[i!=null&&i.avatar?c.jsx("div",{className:"user-avatar-mini",style:{display:"block"},title:"Перейти в профиль",onClick:()=>n("/profile"),children:c.jsx("img",{src:i.avatar,alt:"Аватар",loading:"lazy"})}):c.jsx("div",{className:"user-avatar-mini user-avatar-placeholder-mini",style:{display:"flex"},title:"Перейти в профиль",onClick:()=>n("/profile"),children:c.jsx(F,{icon:"mdi:account"})}),c.jsx(Ds,{}),c.jsx("button",{className:"settings-icon-btn",title:"Настройки",onClick:()=>n("/settings"),children:c.jsx(F,{icon:"mdi:cog"})})]})]})]})};function ll(e){"@babel/helpers - typeof";return ll=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ll(e)}function Ut(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function we(e,t){if(t.length1?"s":"")+" required, but only "+t.length+" present")}function Me(e){we(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||ll(e)==="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):((typeof e=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function jv(e,t){we(2,arguments);var n=Me(e),r=Ut(t);if(isNaN(r))return new Date(NaN);if(!r)return n;var i=n.getDate(),s=new Date(n.getTime());s.setMonth(n.getMonth()+r+1,0);var o=s.getDate();return i>=o?s:(n.setFullYear(s.getFullYear(),s.getMonth(),i),n)}function YE(e,t){we(2,arguments);var n=Me(e).getTime(),r=Ut(t);return new Date(n+r)}var KE={};function pi(){return KE}function XE(e,t){var n,r,i,s,o,l,a,u;we(1,arguments);var d=pi(),f=Ut((n=(r=(i=(s=t==null?void 0:t.weekStartsOn)!==null&&s!==void 0?s:t==null||(o=t.locale)===null||o===void 0||(l=o.options)===null||l===void 0?void 0:l.weekStartsOn)!==null&&i!==void 0?i:d.weekStartsOn)!==null&&r!==void 0?r:(a=d.locale)===null||a===void 0||(u=a.options)===null||u===void 0?void 0:u.weekStartsOn)!==null&&n!==void 0?n:0);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=Me(e),w=p.getDay(),h=(w=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=Me(e),w=p.getDay(),h=(w=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function uC(e){we(1,arguments);var t=Rv(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var r=al(n);return r}var cC=6048e5;function dC(e){we(1,arguments);var t=Me(e),n=al(t).getTime()-uC(t).getTime();return Math.round(n/cC)+1}function ii(e,t){var n,r,i,s,o,l,a,u;we(1,arguments);var d=pi(),f=Ut((n=(r=(i=(s=t==null?void 0:t.weekStartsOn)!==null&&s!==void 0?s:t==null||(o=t.locale)===null||o===void 0||(l=o.options)===null||l===void 0?void 0:l.weekStartsOn)!==null&&i!==void 0?i:d.weekStartsOn)!==null&&r!==void 0?r:(a=d.locale)===null||a===void 0||(u=a.options)===null||u===void 0?void 0:u.weekStartsOn)!==null&&n!==void 0?n:0);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=Me(e),w=p.getUTCDay(),h=(w=1&&w<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=new Date(0);h.setUTCFullYear(f+1,0,w),h.setUTCHours(0,0,0,0);var v=ii(h,t),k=new Date(0);k.setUTCFullYear(f,0,w),k.setUTCHours(0,0,0,0);var g=ii(k,t);return d.getTime()>=v.getTime()?f+1:d.getTime()>=g.getTime()?f:f-1}function fC(e,t){var n,r,i,s,o,l,a,u;we(1,arguments);var d=pi(),f=Ut((n=(r=(i=(s=t==null?void 0:t.firstWeekContainsDate)!==null&&s!==void 0?s:t==null||(o=t.locale)===null||o===void 0||(l=o.options)===null||l===void 0?void 0:l.firstWeekContainsDate)!==null&&i!==void 0?i:d.firstWeekContainsDate)!==null&&r!==void 0?r:(a=d.locale)===null||a===void 0||(u=a.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&n!==void 0?n:1),p=Ov(e,t),w=new Date(0);w.setUTCFullYear(p,0,f),w.setUTCHours(0,0,0,0);var h=ii(w,t);return h}var pC=6048e5;function hC(e,t){we(1,arguments);var n=Me(e),r=ii(n,t).getTime()-fC(n,t).getTime();return Math.round(r/pC)+1}function he(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length0?r:1-r;return he(n==="yy"?i%100:i,n.length)},M:function(t,n){var r=t.getUTCMonth();return n==="M"?String(r+1):he(r+1,2)},d:function(t,n){return he(t.getUTCDate(),n.length)},a:function(t,n){var r=t.getUTCHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h:function(t,n){return he(t.getUTCHours()%12||12,n.length)},H:function(t,n){return he(t.getUTCHours(),n.length)},m:function(t,n){return he(t.getUTCMinutes(),n.length)},s:function(t,n){return he(t.getUTCSeconds(),n.length)},S:function(t,n){var r=n.length,i=t.getUTCMilliseconds(),s=Math.floor(i*Math.pow(10,r-3));return he(s,n.length)}},Pr={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},mC={G:function(t,n,r){var i=t.getUTCFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return r.era(i,{width:"abbreviated"});case"GGGGG":return r.era(i,{width:"narrow"});case"GGGG":default:return r.era(i,{width:"wide"})}},y:function(t,n,r){if(n==="yo"){var i=t.getUTCFullYear(),s=i>0?i:1-i;return r.ordinalNumber(s,{unit:"year"})}return bn.y(t,n)},Y:function(t,n,r,i){var s=Ov(t,i),o=s>0?s:1-s;if(n==="YY"){var l=o%100;return he(l,2)}return n==="Yo"?r.ordinalNumber(o,{unit:"year"}):he(o,n.length)},R:function(t,n){var r=Rv(t);return he(r,n.length)},u:function(t,n){var r=t.getUTCFullYear();return he(r,n.length)},Q:function(t,n,r){var i=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"Q":return String(i);case"QQ":return he(i,2);case"Qo":return r.ordinalNumber(i,{unit:"quarter"});case"QQQ":return r.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(i,{width:"wide",context:"formatting"})}},q:function(t,n,r){var i=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"q":return String(i);case"qq":return he(i,2);case"qo":return r.ordinalNumber(i,{unit:"quarter"});case"qqq":return r.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(i,{width:"wide",context:"standalone"})}},M:function(t,n,r){var i=t.getUTCMonth();switch(n){case"M":case"MM":return bn.M(t,n);case"Mo":return r.ordinalNumber(i+1,{unit:"month"});case"MMM":return r.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(i,{width:"wide",context:"formatting"})}},L:function(t,n,r){var i=t.getUTCMonth();switch(n){case"L":return String(i+1);case"LL":return he(i+1,2);case"Lo":return r.ordinalNumber(i+1,{unit:"month"});case"LLL":return r.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(i,{width:"wide",context:"standalone"})}},w:function(t,n,r,i){var s=hC(t,i);return n==="wo"?r.ordinalNumber(s,{unit:"week"}):he(s,n.length)},I:function(t,n,r){var i=dC(t);return n==="Io"?r.ordinalNumber(i,{unit:"week"}):he(i,n.length)},d:function(t,n,r){return n==="do"?r.ordinalNumber(t.getUTCDate(),{unit:"date"}):bn.d(t,n)},D:function(t,n,r){var i=aC(t);return n==="Do"?r.ordinalNumber(i,{unit:"dayOfYear"}):he(i,n.length)},E:function(t,n,r){var i=t.getUTCDay();switch(n){case"E":case"EE":case"EEE":return r.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(i,{width:"short",context:"formatting"});case"EEEE":default:return r.day(i,{width:"wide",context:"formatting"})}},e:function(t,n,r,i){var s=t.getUTCDay(),o=(s-i.weekStartsOn+8)%7||7;switch(n){case"e":return String(o);case"ee":return he(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(s,{width:"short",context:"formatting"});case"eeee":default:return r.day(s,{width:"wide",context:"formatting"})}},c:function(t,n,r,i){var s=t.getUTCDay(),o=(s-i.weekStartsOn+8)%7||7;switch(n){case"c":return String(o);case"cc":return he(o,n.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(s,{width:"narrow",context:"standalone"});case"cccccc":return r.day(s,{width:"short",context:"standalone"});case"cccc":default:return r.day(s,{width:"wide",context:"standalone"})}},i:function(t,n,r){var i=t.getUTCDay(),s=i===0?7:i;switch(n){case"i":return String(s);case"ii":return he(s,n.length);case"io":return r.ordinalNumber(s,{unit:"day"});case"iii":return r.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(i,{width:"short",context:"formatting"});case"iiii":default:return r.day(i,{width:"wide",context:"formatting"})}},a:function(t,n,r){var i=t.getUTCHours(),s=i/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,n,r){var i=t.getUTCHours(),s;switch(i===12?s=Pr.noon:i===0?s=Pr.midnight:s=i/12>=1?"pm":"am",n){case"b":case"bb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,n,r){var i=t.getUTCHours(),s;switch(i>=17?s=Pr.evening:i>=12?s=Pr.afternoon:i>=4?s=Pr.morning:s=Pr.night,n){case"B":case"BB":case"BBB":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,n,r){if(n==="ho"){var i=t.getUTCHours()%12;return i===0&&(i=12),r.ordinalNumber(i,{unit:"hour"})}return bn.h(t,n)},H:function(t,n,r){return n==="Ho"?r.ordinalNumber(t.getUTCHours(),{unit:"hour"}):bn.H(t,n)},K:function(t,n,r){var i=t.getUTCHours()%12;return n==="Ko"?r.ordinalNumber(i,{unit:"hour"}):he(i,n.length)},k:function(t,n,r){var i=t.getUTCHours();return i===0&&(i=24),n==="ko"?r.ordinalNumber(i,{unit:"hour"}):he(i,n.length)},m:function(t,n,r){return n==="mo"?r.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):bn.m(t,n)},s:function(t,n,r){return n==="so"?r.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):bn.s(t,n)},S:function(t,n){return bn.S(t,n)},X:function(t,n,r,i){var s=i._originalDate||t,o=s.getTimezoneOffset();if(o===0)return"Z";switch(n){case"X":return Dp(o);case"XXXX":case"XX":return sr(o);case"XXXXX":case"XXX":default:return sr(o,":")}},x:function(t,n,r,i){var s=i._originalDate||t,o=s.getTimezoneOffset();switch(n){case"x":return Dp(o);case"xxxx":case"xx":return sr(o);case"xxxxx":case"xxx":default:return sr(o,":")}},O:function(t,n,r,i){var s=i._originalDate||t,o=s.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+Mp(o,":");case"OOOO":default:return"GMT"+sr(o,":")}},z:function(t,n,r,i){var s=i._originalDate||t,o=s.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+Mp(o,":");case"zzzz":default:return"GMT"+sr(o,":")}},t:function(t,n,r,i){var s=i._originalDate||t,o=Math.floor(s.getTime()/1e3);return he(o,n.length)},T:function(t,n,r,i){var s=i._originalDate||t,o=s.getTime();return he(o,n.length)}};function Mp(e,t){var n=e>0?"-":"+",r=Math.abs(e),i=Math.floor(r/60),s=r%60;if(s===0)return n+String(i);var o=t;return n+String(i)+o+he(s,2)}function Dp(e,t){if(e%60===0){var n=e>0?"-":"+";return n+he(Math.abs(e)/60,2)}return sr(e,t)}function sr(e,t){var n=t||"",r=e>0?"-":"+",i=Math.abs(e),s=he(Math.floor(i/60),2),o=he(i%60,2);return r+s+n+o}var Ap=function(t,n){switch(t){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},Lv=function(t,n){switch(t){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},gC=function(t,n){var r=t.match(/(P+)(p+)?/)||[],i=r[1],s=r[2];if(!s)return Ap(t,n);var o;switch(i){case"P":o=n.dateTime({width:"short"});break;case"PP":o=n.dateTime({width:"medium"});break;case"PPP":o=n.dateTime({width:"long"});break;case"PPPP":default:o=n.dateTime({width:"full"});break}return o.replace("{{date}}",Ap(i,n)).replace("{{time}}",Lv(s,n))},vC={p:Lv,P:gC},yC=["D","DD"],wC=["YY","YYYY"];function xC(e){return yC.indexOf(e)!==-1}function kC(e){return wC.indexOf(e)!==-1}function $p(e,t,n){if(e==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var SC={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},EC=function(t,n,r){var i,s=SC[t];return typeof s=="string"?i=s:n===1?i=s.one:i=s.other.replace("{{count}}",n.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+i:i+" ago":i};function Yr(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,r=e.formats[n]||e.formats[e.defaultWidth];return r}}var CC={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},bC={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},NC={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},TC={date:Yr({formats:CC,defaultWidth:"full"}),time:Yr({formats:bC,defaultWidth:"full"}),dateTime:Yr({formats:NC,defaultWidth:"full"})},jC={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},_C=function(t,n,r,i){return jC[t]};function ln(e){return function(t,n){var r=n!=null&&n.context?String(n.context):"standalone",i;if(r==="formatting"&&e.formattingValues){var s=e.defaultFormattingWidth||e.defaultWidth,o=n!=null&&n.width?String(n.width):s;i=e.formattingValues[o]||e.formattingValues[s]}else{var l=e.defaultWidth,a=n!=null&&n.width?String(n.width):e.defaultWidth;i=e.values[a]||e.values[l]}var u=e.argumentCallback?e.argumentCallback(t):t;return i[u]}}var PC={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},RC={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},OC={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},LC={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},IC={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},MC={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},DC=function(t,n){var r=Number(t),i=r%100;if(i>20||i<10)switch(i%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},AC={ordinalNumber:DC,era:ln({values:PC,defaultWidth:"wide"}),quarter:ln({values:RC,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:ln({values:OC,defaultWidth:"wide"}),day:ln({values:LC,defaultWidth:"wide"}),dayPeriod:ln({values:IC,defaultWidth:"wide",formattingValues:MC,defaultFormattingWidth:"wide"})};function an(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],s=t.match(i);if(!s)return null;var o=s[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],a=Array.isArray(l)?zC(l,function(f){return f.test(o)}):$C(l,function(f){return f.test(o)}),u;u=e.valueCallback?e.valueCallback(a):a,u=n.valueCallback?n.valueCallback(u):u;var d=t.slice(o.length);return{value:u,rest:d}}}function $C(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function zC(e,t){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=t.match(e.matchPattern);if(!r)return null;var i=r[0],s=t.match(e.parsePattern);if(!s)return null;var o=e.valueCallback?e.valueCallback(s[0]):s[0];o=n.valueCallback?n.valueCallback(o):o;var l=t.slice(i.length);return{value:o,rest:l}}}var FC=/^(\d+)(th|st|nd|rd)?/i,UC=/\d+/i,BC={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},WC={any:[/^b/i,/^(a|c)/i]},HC={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},VC={any:[/1/i,/2/i,/3/i,/4/i]},QC={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},qC={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},GC={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},YC={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},KC={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},XC={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},JC={ordinalNumber:Iv({matchPattern:FC,parsePattern:UC,valueCallback:function(t){return parseInt(t,10)}}),era:an({matchPatterns:BC,defaultMatchWidth:"wide",parsePatterns:WC,defaultParseWidth:"any"}),quarter:an({matchPatterns:HC,defaultMatchWidth:"wide",parsePatterns:VC,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:an({matchPatterns:QC,defaultMatchWidth:"wide",parsePatterns:qC,defaultParseWidth:"any"}),day:an({matchPatterns:GC,defaultMatchWidth:"wide",parsePatterns:YC,defaultParseWidth:"any"}),dayPeriod:an({matchPatterns:KC,defaultMatchWidth:"any",parsePatterns:XC,defaultParseWidth:"any"})},ZC={code:"en-US",formatDistance:EC,formatLong:TC,formatRelative:_C,localize:AC,match:JC,options:{weekStartsOn:0,firstWeekContainsDate:1}},eb=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,tb=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,nb=/^'([^]*?)'?$/,rb=/''/g,ib=/[a-zA-Z]/;function Fi(e,t,n){var r,i,s,o,l,a,u,d,f,p,w,h,v,k,g,m,y,C;we(2,arguments);var j=String(t),S=pi(),N=(r=(i=n==null?void 0:n.locale)!==null&&i!==void 0?i:S.locale)!==null&&r!==void 0?r:ZC,_=Ut((s=(o=(l=(a=n==null?void 0:n.firstWeekContainsDate)!==null&&a!==void 0?a:n==null||(u=n.locale)===null||u===void 0||(d=u.options)===null||d===void 0?void 0:d.firstWeekContainsDate)!==null&&l!==void 0?l:S.firstWeekContainsDate)!==null&&o!==void 0?o:(f=S.locale)===null||f===void 0||(p=f.options)===null||p===void 0?void 0:p.firstWeekContainsDate)!==null&&s!==void 0?s:1);if(!(_>=1&&_<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var D=Ut((w=(h=(v=(k=n==null?void 0:n.weekStartsOn)!==null&&k!==void 0?k:n==null||(g=n.locale)===null||g===void 0||(m=g.options)===null||m===void 0?void 0:m.weekStartsOn)!==null&&v!==void 0?v:S.weekStartsOn)!==null&&h!==void 0?h:(y=S.locale)===null||y===void 0||(C=y.options)===null||C===void 0?void 0:C.weekStartsOn)!==null&&w!==void 0?w:0);if(!(D>=0&&D<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!N.localize)throw new RangeError("locale must contain localize property");if(!N.formatLong)throw new RangeError("locale must contain formatLong property");var M=Me(e);if(!tC(M))throw new RangeError("Invalid time value");var q=JE(M),X=oC(M,q),te={firstWeekContainsDate:_,weekStartsOn:D,locale:N,_originalDate:M},K=j.match(tb).map(function(z){var Q=z[0];if(Q==="p"||Q==="P"){var se=vC[Q];return se(z,N.formatLong)}return z}).join("").match(eb).map(function(z){if(z==="''")return"'";var Q=z[0];if(Q==="'")return sb(z);var se=mC[Q];if(se)return!(n!=null&&n.useAdditionalWeekYearTokens)&&kC(z)&&$p(z,t,String(e)),!(n!=null&&n.useAdditionalDayOfYearTokens)&&xC(z)&&$p(z,t,String(e)),se(X,z,N.localize,te);if(Q.match(ib))throw new RangeError("Format string contains an unescaped latin alphabet character `"+Q+"`");return z}).join("");return K}function sb(e){var t=e.match(nb);return t?t[1].replace(rb,"'"):e}function ob(e,t){we(2,arguments);var n=Me(e),r=Me(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function lb(e,t){var n;we(1,arguments);var r=Ut((n=void 0)!==null&&n!==void 0?n:2);if(r!==2&&r!==1&&r!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(!(typeof e=="string"||Object.prototype.toString.call(e)==="[object String]"))return new Date(NaN);var i=db(e),s;if(i.date){var o=fb(i.date,r);s=pb(o.restDateString,o.year)}if(!s||isNaN(s.getTime()))return new Date(NaN);var l=s.getTime(),a=0,u;if(i.time&&(a=hb(i.time),isNaN(a)))return new Date(NaN);if(i.timezone){if(u=mb(i.timezone),isNaN(u))return new Date(NaN)}else{var d=new Date(l+a),f=new Date(0);return f.setFullYear(d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate()),f.setHours(d.getUTCHours(),d.getUTCMinutes(),d.getUTCSeconds(),d.getUTCMilliseconds()),f}return new Date(l+a+u)}var oo={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},ab=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,ub=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,cb=/^([+-])(\d{2})(?::?(\d{2}))?$/;function db(e){var t={},n=e.split(oo.dateTimeDelimiter),r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],oo.timeZoneDelimiter.test(t.date)&&(t.date=e.split(oo.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){var i=oo.timezone.exec(r);i?(t.time=r.replace(i[1],""),t.timezone=i[1]):t.time=r}return t}function fb(e,t){var n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),r=e.match(n);if(!r)return{year:NaN,restDateString:""};var i=r[1]?parseInt(r[1]):null,s=r[2]?parseInt(r[2]):null;return{year:s===null?i:s*100,restDateString:e.slice((r[1]||r[2]).length)}}function pb(e,t){if(t===null)return new Date(NaN);var n=e.match(ab);if(!n)return new Date(NaN);var r=!!n[4],i=Ri(n[1]),s=Ri(n[2])-1,o=Ri(n[3]),l=Ri(n[4]),a=Ri(n[5])-1;if(r)return xb(t,l,a)?gb(t,l,a):new Date(NaN);var u=new Date(0);return!yb(t,s,o)||!wb(t,i)?new Date(NaN):(u.setUTCFullYear(t,s,Math.max(i,o)),u)}function Ri(e){return e?parseInt(e):1}function hb(e){var t=e.match(ub);if(!t)return NaN;var n=Ia(t[1]),r=Ia(t[2]),i=Ia(t[3]);return kb(n,r,i)?n*Pv+r*_v+i*1e3:NaN}function Ia(e){return e&&parseFloat(e.replace(",","."))||0}function mb(e){if(e==="Z")return 0;var t=e.match(cb);if(!t)return 0;var n=t[1]==="+"?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return Sb(r,i)?n*(r*Pv+i*_v):NaN}function gb(e,t,n){var r=new Date(0);r.setUTCFullYear(e,0,4);var i=r.getUTCDay()||7,s=(t-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+s),r}var vb=[31,null,31,30,31,30,31,31,30,31,30,31];function Mv(e){return e%400===0||e%4===0&&e%100!==0}function yb(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(vb[t]||(Mv(e)?29:28))}function wb(e,t){return t>=1&&t<=(Mv(e)?366:365)}function xb(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function kb(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function Sb(e,t){return t>=0&&t<=59}function Eb(e,t){we(2,arguments);var n=Ut(t);return jv(e,-n)}function zp(e,t,n){we(2,arguments);var r=ii(e,n),i=ii(t,n);return r.getTime()===i.getTime()}function Oi(e,t){if(e.one!==void 0&&t===1)return e.one;var n=t%10,r=t%100;return n===1&&r!==11?e.singularNominative.replace("{{count}}",String(t)):n>=2&&n<=4&&(r<10||r>20)?e.singularGenitive.replace("{{count}}",String(t)):e.pluralGenitive.replace("{{count}}",String(t))}function at(e){return function(t,n){return n!=null&&n.addSuffix?n.comparison&&n.comparison>0?e.future?Oi(e.future,t):"через "+Oi(e.regular,t):e.past?Oi(e.past,t):Oi(e.regular,t)+" назад":Oi(e.regular,t)}}var Cb={lessThanXSeconds:at({regular:{one:"меньше секунды",singularNominative:"меньше {{count}} секунды",singularGenitive:"меньше {{count}} секунд",pluralGenitive:"меньше {{count}} секунд"},future:{one:"меньше, чем через секунду",singularNominative:"меньше, чем через {{count}} секунду",singularGenitive:"меньше, чем через {{count}} секунды",pluralGenitive:"меньше, чем через {{count}} секунд"}}),xSeconds:at({regular:{singularNominative:"{{count}} секунда",singularGenitive:"{{count}} секунды",pluralGenitive:"{{count}} секунд"},past:{singularNominative:"{{count}} секунду назад",singularGenitive:"{{count}} секунды назад",pluralGenitive:"{{count}} секунд назад"},future:{singularNominative:"через {{count}} секунду",singularGenitive:"через {{count}} секунды",pluralGenitive:"через {{count}} секунд"}}),halfAMinute:function(t,n){return n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"через полминуты":"полминуты назад":"полминуты"},lessThanXMinutes:at({regular:{one:"меньше минуты",singularNominative:"меньше {{count}} минуты",singularGenitive:"меньше {{count}} минут",pluralGenitive:"меньше {{count}} минут"},future:{one:"меньше, чем через минуту",singularNominative:"меньше, чем через {{count}} минуту",singularGenitive:"меньше, чем через {{count}} минуты",pluralGenitive:"меньше, чем через {{count}} минут"}}),xMinutes:at({regular:{singularNominative:"{{count}} минута",singularGenitive:"{{count}} минуты",pluralGenitive:"{{count}} минут"},past:{singularNominative:"{{count}} минуту назад",singularGenitive:"{{count}} минуты назад",pluralGenitive:"{{count}} минут назад"},future:{singularNominative:"через {{count}} минуту",singularGenitive:"через {{count}} минуты",pluralGenitive:"через {{count}} минут"}}),aboutXHours:at({regular:{singularNominative:"около {{count}} часа",singularGenitive:"около {{count}} часов",pluralGenitive:"около {{count}} часов"},future:{singularNominative:"приблизительно через {{count}} час",singularGenitive:"приблизительно через {{count}} часа",pluralGenitive:"приблизительно через {{count}} часов"}}),xHours:at({regular:{singularNominative:"{{count}} час",singularGenitive:"{{count}} часа",pluralGenitive:"{{count}} часов"}}),xDays:at({regular:{singularNominative:"{{count}} день",singularGenitive:"{{count}} дня",pluralGenitive:"{{count}} дней"}}),aboutXWeeks:at({regular:{singularNominative:"около {{count}} недели",singularGenitive:"около {{count}} недель",pluralGenitive:"около {{count}} недель"},future:{singularNominative:"приблизительно через {{count}} неделю",singularGenitive:"приблизительно через {{count}} недели",pluralGenitive:"приблизительно через {{count}} недель"}}),xWeeks:at({regular:{singularNominative:"{{count}} неделя",singularGenitive:"{{count}} недели",pluralGenitive:"{{count}} недель"}}),aboutXMonths:at({regular:{singularNominative:"около {{count}} месяца",singularGenitive:"около {{count}} месяцев",pluralGenitive:"около {{count}} месяцев"},future:{singularNominative:"приблизительно через {{count}} месяц",singularGenitive:"приблизительно через {{count}} месяца",pluralGenitive:"приблизительно через {{count}} месяцев"}}),xMonths:at({regular:{singularNominative:"{{count}} месяц",singularGenitive:"{{count}} месяца",pluralGenitive:"{{count}} месяцев"}}),aboutXYears:at({regular:{singularNominative:"около {{count}} года",singularGenitive:"около {{count}} лет",pluralGenitive:"около {{count}} лет"},future:{singularNominative:"приблизительно через {{count}} год",singularGenitive:"приблизительно через {{count}} года",pluralGenitive:"приблизительно через {{count}} лет"}}),xYears:at({regular:{singularNominative:"{{count}} год",singularGenitive:"{{count}} года",pluralGenitive:"{{count}} лет"}}),overXYears:at({regular:{singularNominative:"больше {{count}} года",singularGenitive:"больше {{count}} лет",pluralGenitive:"больше {{count}} лет"},future:{singularNominative:"больше, чем через {{count}} год",singularGenitive:"больше, чем через {{count}} года",pluralGenitive:"больше, чем через {{count}} лет"}}),almostXYears:at({regular:{singularNominative:"почти {{count}} год",singularGenitive:"почти {{count}} года",pluralGenitive:"почти {{count}} лет"},future:{singularNominative:"почти через {{count}} год",singularGenitive:"почти через {{count}} года",pluralGenitive:"почти через {{count}} лет"}})},bb=function(t,n,r){return Cb[t](n,r)},Nb={full:"EEEE, d MMMM y 'г.'",long:"d MMMM y 'г.'",medium:"d MMM y 'г.'",short:"dd.MM.y"},Tb={full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},jb={any:"{{date}}, {{time}}"},_b={date:Yr({formats:Nb,defaultWidth:"full"}),time:Yr({formats:Tb,defaultWidth:"full"}),dateTime:Yr({formats:jb,defaultWidth:"any"})},wd=["воскресенье","понедельник","вторник","среду","четверг","пятницу","субботу"];function Pb(e){var t=wd[e];switch(e){case 0:return"'в прошлое "+t+" в' p";case 1:case 2:case 4:return"'в прошлый "+t+" в' p";case 3:case 5:case 6:return"'в прошлую "+t+" в' p"}}function Fp(e){var t=wd[e];return e===2?"'во "+t+" в' p":"'в "+t+" в' p"}function Rb(e){var t=wd[e];switch(e){case 0:return"'в следующее "+t+" в' p";case 1:case 2:case 4:return"'в следующий "+t+" в' p";case 3:case 5:case 6:return"'в следующую "+t+" в' p"}}var Ob={lastWeek:function(t,n,r){var i=t.getUTCDay();return zp(t,n,r)?Fp(i):Pb(i)},yesterday:"'вчера в' p",today:"'сегодня в' p",tomorrow:"'завтра в' p",nextWeek:function(t,n,r){var i=t.getUTCDay();return zp(t,n,r)?Fp(i):Rb(i)},other:"P"},Lb=function(t,n,r,i){var s=Ob[t];return typeof s=="function"?s(n,r,i):s},Ib={narrow:["до н.э.","н.э."],abbreviated:["до н. э.","н. э."],wide:["до нашей эры","нашей эры"]},Mb={narrow:["1","2","3","4"],abbreviated:["1-й кв.","2-й кв.","3-й кв.","4-й кв."],wide:["1-й квартал","2-й квартал","3-й квартал","4-й квартал"]},Db={narrow:["Я","Ф","М","А","М","И","И","А","С","О","Н","Д"],abbreviated:["янв.","фев.","март","апр.","май","июнь","июль","авг.","сент.","окт.","нояб.","дек."],wide:["январь","февраль","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь"]},Ab={narrow:["Я","Ф","М","А","М","И","И","А","С","О","Н","Д"],abbreviated:["янв.","фев.","мар.","апр.","мая","июн.","июл.","авг.","сент.","окт.","нояб.","дек."],wide:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"]},$b={narrow:["В","П","В","С","Ч","П","С"],short:["вс","пн","вт","ср","чт","пт","сб"],abbreviated:["вск","пнд","втр","срд","чтв","птн","суб"],wide:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"]},zb={narrow:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утро",afternoon:"день",evening:"веч.",night:"ночь"},abbreviated:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утро",afternoon:"день",evening:"веч.",night:"ночь"},wide:{am:"ДП",pm:"ПП",midnight:"полночь",noon:"полдень",morning:"утро",afternoon:"день",evening:"вечер",night:"ночь"}},Fb={narrow:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утра",afternoon:"дня",evening:"веч.",night:"ночи"},abbreviated:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утра",afternoon:"дня",evening:"веч.",night:"ночи"},wide:{am:"ДП",pm:"ПП",midnight:"полночь",noon:"полдень",morning:"утра",afternoon:"дня",evening:"вечера",night:"ночи"}},Ub=function(t,n){var r=Number(t),i=n==null?void 0:n.unit,s;return i==="date"?s="-е":i==="week"||i==="minute"||i==="second"?s="-я":s="-й",r+s},Bb={ordinalNumber:Ub,era:ln({values:Ib,defaultWidth:"wide"}),quarter:ln({values:Mb,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:ln({values:Db,defaultWidth:"wide",formattingValues:Ab,defaultFormattingWidth:"wide"}),day:ln({values:$b,defaultWidth:"wide"}),dayPeriod:ln({values:zb,defaultWidth:"any",formattingValues:Fb,defaultFormattingWidth:"wide"})},Wb=/^(\d+)(-?(е|я|й|ое|ье|ая|ья|ый|ой|ий|ый))?/i,Hb=/\d+/i,Vb={narrow:/^((до )?н\.?\s?э\.?)/i,abbreviated:/^((до )?н\.?\s?э\.?)/i,wide:/^(до нашей эры|нашей эры|наша эра)/i},Qb={any:[/^д/i,/^н/i]},qb={narrow:/^[1234]/i,abbreviated:/^[1234](-?[ыои]?й?)? кв.?/i,wide:/^[1234](-?[ыои]?й?)? квартал/i},Gb={any:[/1/i,/2/i,/3/i,/4/i]},Yb={narrow:/^[яфмаисонд]/i,abbreviated:/^(янв|фев|март?|апр|ма[йя]|июн[ья]?|июл[ья]?|авг|сент?|окт|нояб?|дек)\.?/i,wide:/^(январ[ья]|феврал[ья]|марта?|апрел[ья]|ма[йя]|июн[ья]|июл[ья]|августа?|сентябр[ья]|октябр[ья]|октябр[ья]|ноябр[ья]|декабр[ья])/i},Kb={narrow:[/^я/i,/^ф/i,/^м/i,/^а/i,/^м/i,/^и/i,/^и/i,/^а/i,/^с/i,/^о/i,/^н/i,/^я/i],any:[/^я/i,/^ф/i,/^мар/i,/^ап/i,/^ма[йя]/i,/^июн/i,/^июл/i,/^ав/i,/^с/i,/^о/i,/^н/i,/^д/i]},Xb={narrow:/^[впсч]/i,short:/^(вс|во|пн|по|вт|ср|чт|че|пт|пя|сб|су)\.?/i,abbreviated:/^(вск|вос|пнд|пон|втр|вто|срд|сре|чтв|чет|птн|пят|суб).?/i,wide:/^(воскресень[ея]|понедельника?|вторника?|сред[аы]|четверга?|пятниц[аы]|суббот[аы])/i},Jb={narrow:[/^в/i,/^п/i,/^в/i,/^с/i,/^ч/i,/^п/i,/^с/i],any:[/^в[ос]/i,/^п[он]/i,/^в/i,/^ср/i,/^ч/i,/^п[ят]/i,/^с[уб]/i]},Zb={narrow:/^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,abbreviated:/^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,wide:/^([дп]п|полночь|полдень|утр[оа]|день|дня|вечера?|ноч[ьи])/i},eN={any:{am:/^дп/i,pm:/^пп/i,midnight:/^полн/i,noon:/^полд/i,morning:/^у/i,afternoon:/^д[ен]/i,evening:/^в/i,night:/^н/i}},tN={ordinalNumber:Iv({matchPattern:Wb,parsePattern:Hb,valueCallback:function(t){return parseInt(t,10)}}),era:an({matchPatterns:Vb,defaultMatchWidth:"wide",parsePatterns:Qb,defaultParseWidth:"any"}),quarter:an({matchPatterns:qb,defaultMatchWidth:"wide",parsePatterns:Gb,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:an({matchPatterns:Yb,defaultMatchWidth:"wide",parsePatterns:Kb,defaultParseWidth:"any"}),day:an({matchPatterns:Xb,defaultMatchWidth:"wide",parsePatterns:Jb,defaultParseWidth:"any"}),dayPeriod:an({matchPatterns:Zb,defaultMatchWidth:"wide",parsePatterns:eN,defaultParseWidth:"any"})},Dv={code:"ru",formatDistance:bb,formatLong:_b,formatRelative:Lb,localize:Bb,match:tN,options:{weekStartsOn:1,firstWeekContainsDate:1}};const Zu=e=>lb(e.replace(" ","T")+"Z"),Up=e=>{const t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=e.getFullYear(),i=String(e.getHours()).padStart(2,"0"),s=String(e.getMinutes()).padStart(2,"0");return`${t}.${n}.${r} ${i}:${s}`.substring(0,16)},nN=e=>Fi(e,"dd.MM.yyyy",{locale:Dv}),Bp=e=>{const t=Zu(e);return nN(t)},Av=({notes:e=[]})=>{const[t,n]=x.useState(new Date),r=ye(g=>g.notes.selectedDate),i=ot(),s=iC(t),o=nC(t),l=XE(s,{weekStartsOn:1}),a=sC(o,{weekStartsOn:1}),u=rC({start:l,end:a}),d=new Set,f=new Set;e.forEach(g=>{g.created_at&&d.add(Bp(g.created_at)),g.updated_at&&g.created_at!==g.updated_at&&f.add(Bp(g.updated_at))});const p=g=>{const m=Fi(g,"dd.MM.yyyy");i(Fu(r===m?null:m))},w=()=>{n(Eb(t,1))},h=()=>{n(jv(t,1))},v=Fi(t,"MMMM yyyy",{locale:Dv}),k=v.charAt(0).toUpperCase()+v.slice(1);return c.jsxs("div",{className:"mini-calendar",children:[c.jsxs("div",{className:"calendar-header",children:[c.jsx("button",{className:"calendar-nav",onClick:w,children:"‹"}),c.jsx("span",{className:"calendar-month-year",children:k}),c.jsx("button",{className:"calendar-nav",onClick:h,children:"›"})]}),c.jsxs("div",{className:"calendar-weekdays",children:[c.jsx("div",{className:"calendar-weekday",children:"Пн"}),c.jsx("div",{className:"calendar-weekday",children:"Вт"}),c.jsx("div",{className:"calendar-weekday",children:"Ср"}),c.jsx("div",{className:"calendar-weekday",children:"Чт"}),c.jsx("div",{className:"calendar-weekday",children:"Пт"}),c.jsx("div",{className:"calendar-weekday",children:"Сб"}),c.jsx("div",{className:"calendar-weekday",children:"Вс"})]}),c.jsx("div",{className:"calendar-days",children:u.map((g,m)=>{const y=Fi(g,"dd.MM.yyyy"),C=ob(g,t),j=r===y,S=d.has(y),N=f.has(y),_=ZE(g,new Date);return c.jsx("div",{className:`calendar-day ${C?"":"other-month"} ${S?"has-notes":""} ${N?"has-edited-notes":""} ${j?"selected":""} ${_?"today":""}`,"data-date":y,onClick:()=>p(g),children:Fi(g,"d")},m)})})]})},$v=()=>{const[e,t]=x.useState(""),n=ot(),r=x.useRef(null);x.useEffect(()=>(r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{n(Uu(e))},300),()=>{r.current&&clearTimeout(r.current)}),[e,n]);const i=()=>{t(""),n(Uu(""))};return c.jsxs("div",{className:"search-section",children:[c.jsx("div",{className:"search-header",children:c.jsxs("span",{className:"search-title",children:[c.jsx(F,{icon:"mdi:magnify"})," Поиск"]})}),c.jsxs("div",{className:"search-container",children:[c.jsx("input",{type:"text",className:"search-input",placeholder:"Поиск по заметкам...",value:e,onChange:s=>t(s.target.value)}),e&&c.jsx("button",{className:"clear-search-btn",onClick:i,title:"Очистить поиск",children:"✕"})]})]})};function xd(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var jr=xd();function zv(e){jr=e}var Zi={exec:()=>null};function ce(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(dt.caret,"$1"),n=n.replace(i,o),r},getRegex:()=>new RegExp(n,t)};return r}var dt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},rN=/^(?:[ \t]*(?:\n|$))+/,iN=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,sN=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,As=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,oN=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,kd=/(?:[*+-]|\d{1,9}[.)])/,Fv=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Uv=ce(Fv).replace(/bull/g,kd).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),lN=ce(Fv).replace(/bull/g,kd).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Sd=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,aN=/^[^\n]+/,Ed=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,uN=ce(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ed).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),cN=ce(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,kd).getRegex(),Fl="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Cd=/|$))/,dN=ce("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Cd).replace("tag",Fl).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Bv=ce(Sd).replace("hr",As).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Fl).getRegex(),fN=ce(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Bv).getRegex(),bd={blockquote:fN,code:iN,def:uN,fences:sN,heading:oN,hr:As,html:dN,lheading:Uv,list:cN,newline:rN,paragraph:Bv,table:Zi,text:aN},Wp=ce("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",As).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Fl).getRegex(),pN={...bd,lheading:lN,table:Wp,paragraph:ce(Sd).replace("hr",As).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Wp).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Fl).getRegex()},hN={...bd,html:ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Cd).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Zi,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ce(Sd).replace("hr",As).replace("heading",` *#{1,6} *[^ -]`).replace("lheading",Uv).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},mN=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,gN=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Wv=/^( {2,}|\\)\n(?!\s*$)/,vN=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\\k(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)")).replace("code",new RegExp("(?`+)[^`]+\\k(?!`)")).replace("html",/<(?! )[^<>]*?>/).getRegex(),Qv=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,SN=ce(Qv,"u").replace(/punct/g,Ul).getRegex(),EN=ce(Qv,"u").replace(/punct/g,Vv).getRegex(),qv="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",CN=ce(qv,"gu").replace(/notPunctSpace/g,Hv).replace(/punctSpace/g,Nd).replace(/punct/g,Ul).getRegex(),bN=ce(qv,"gu").replace(/notPunctSpace/g,xN).replace(/punctSpace/g,wN).replace(/punct/g,Vv).getRegex(),NN=ce("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Hv).replace(/punctSpace/g,Nd).replace(/punct/g,Ul).getRegex(),TN=ce(/\\(punct)/,"gu").replace(/punct/g,Ul).getRegex(),jN=ce(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),_N=ce(Cd).replace("(?:-->|$)","-->").getRegex(),PN=ce("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",_N).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ul=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,RN=ce(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",ul).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Gv=ce(/^!?\[(label)\]\[(ref)\]/).replace("label",ul).replace("ref",Ed).getRegex(),Yv=ce(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ed).getRegex(),ON=ce("reflink|nolink(?!\\()","g").replace("reflink",Gv).replace("nolink",Yv).getRegex(),Hp=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Td={_backpedal:Zi,anyPunctuation:TN,autolink:jN,blockSkip:kN,br:Wv,code:gN,del:Zi,emStrongLDelim:SN,emStrongRDelimAst:CN,emStrongRDelimUnd:NN,escape:mN,link:RN,nolink:Yv,punctuation:yN,reflink:Gv,reflinkSearch:ON,tag:PN,text:vN,url:Zi},LN={...Td,link:ce(/^!?\[(label)\]\((.*?)\)/).replace("label",ul).getRegex(),reflink:ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ul).getRegex()},ec={...Td,emStrongRDelimAst:bN,emStrongLDelim:EN,url:ce(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Hp).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:ce(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},Vp=e=>MN[e];function rn(e,t){if(t){if(dt.escapeTest.test(e))return e.replace(dt.escapeReplace,Vp)}else if(dt.escapeTestNoEncode.test(e))return e.replace(dt.escapeReplaceNoEncode,Vp);return e}function Qp(e){try{e=encodeURI(e).replace(dt.percentDecode,"%")}catch{return null}return e}function qp(e,t){var s;let n=e.replace(dt.findPipe,(o,l,a)=>{let u=!1,d=l;for(;--d>=0&&a[d]==="\\";)u=!u;return u?"|":" |"}),r=n.split(dt.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!((s=r.at(-1))!=null&&s.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length0?-2:-1}function Gp(e,t,n,r,i){let s=t.href,o=t.title||null,l=e[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let a={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:o,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,a}function AN(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(` -`).map(s=>{let o=s.match(n.other.beginningSpace);if(o===null)return s;let[l]=o;return l.length>=i.length?s.slice(i.length):s}).join(` -`)}var cl=class{constructor(e){ve(this,"options");ve(this,"rules");ve(this,"lexer");this.options=e||jr}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Ii(n,` -`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=AN(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=Ii(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Ii(t[0],` -`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Ii(t[0],` -`).split(` -`),r="",i="",s=[];for(;n.length>0;){let o=!1,l=[],a;for(a=0;a1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let s=this.rules.other.listItemRegex(n),o=!1;for(;e;){let a=!1,u="",d="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;u=t[0],e=e.substring(u.length);let f=t[2].split(` -`,1)[0].replace(this.rules.other.listReplaceTabs,g=>" ".repeat(3*g.length)),p=e.split(` -`,1)[0],w=!f.trim(),h=0;if(this.options.pedantic?(h=2,d=f.trimStart()):w?h=t[1].length+1:(h=t[2].search(this.rules.other.nonSpaceChar),h=h>4?1:h,d=f.slice(h),h+=t[1].length),w&&this.rules.other.blankLine.test(p)&&(u+=p+` -`,e=e.substring(p.length+1),a=!0),!a){let g=this.rules.other.nextBulletRegex(h),m=this.rules.other.hrRegex(h),y=this.rules.other.fencesBeginRegex(h),C=this.rules.other.headingBeginRegex(h),j=this.rules.other.htmlBeginRegex(h);for(;e;){let S=e.split(` -`,1)[0],N;if(p=S,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),N=p):N=p.replace(this.rules.other.tabCharGlobal," "),y.test(p)||C.test(p)||j.test(p)||g.test(p)||m.test(p))break;if(N.search(this.rules.other.nonSpaceChar)>=h||!p.trim())d+=` -`+N.slice(h);else{if(w||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||y.test(f)||C.test(f)||m.test(f))break;d+=` -`+p}!w&&!p.trim()&&(w=!0),u+=S+` -`,e=e.substring(S.length+1),f=N.slice(h)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(o=!0));let v=null,k;this.options.gfm&&(v=this.rules.other.listIsTask.exec(d),v&&(k=v[0]!=="[ ] ",d=d.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:u,task:!!v,checked:k,loose:!1,text:d,tokens:[]}),i.raw+=u}let l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let a=0;af.type==="space"),d=u.length>0&&u.some(f=>this.rules.other.anyLine.test(f.raw));i.loose=d}if(i.loose)for(let a=0;a({text:a,tokens:this.lexer.inline(a),header:!1,align:s.align[u]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===` -`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let s=Ii(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=DN(t[2],"()");if(s===-2)return;if(s>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let r=t[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),Gp(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[r.toLowerCase()];if(!i){let s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return Gp(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,s,o,l=i,a=0,u=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+i);(r=u.exec(t))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(o=[...s].length,r[3]||r[4]){l+=o;continue}else if((r[5]||r[6])&&i%3&&!((i+o)%3)){a+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+a);let d=[...r[0]][0].length,f=e.slice(0,i+r.index+d+o);if(Math.min(i,o)%2){let w=f.slice(1,-1);return{type:"em",raw:f,text:w,tokens:this.lexer.inlineTokens(w)}}let p=f.slice(2,-2);return{type:"strong",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let r,i;if(t[2]==="@")r=t[0],i="mailto:"+r;else{let s;do s=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(s!==t[0]);r=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},qt=class tc{constructor(t){ve(this,"tokens");ve(this,"options");ve(this,"state");ve(this,"tokenizer");ve(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||jr,this.options.tokenizer=this.options.tokenizer||new cl,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:dt,block:lo.normal,inline:Li.normal};this.options.pedantic?(n.block=lo.pedantic,n.inline=Li.pedantic):this.options.gfm&&(n.block=lo.gfm,this.options.breaks?n.inline=Li.breaks:n.inline=Li.gfm),this.tokenizer.rules=n}static get rules(){return{block:lo,inline:Li}}static lex(t,n){return new tc(n).lex(t)}static lexInline(t,n){return new tc(n).inlineTokens(t)}lex(t){t=t.replace(dt.carriageReturn,` -`),this.blockTokens(t,this.tokens);for(let n=0;n(l=u.call({lexer:this},t,n))?(t=t.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.space(t)){t=t.substring(l.raw.length);let u=n.at(-1);l.raw.length===1&&u!==void 0?u.raw+=` -`:n.push(l);continue}if(l=this.tokenizer.code(t)){t=t.substring(l.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(` -`)?"":` -`)+l.raw,u.text+=` -`+l.text,this.inlineQueue.at(-1).src=u.text):n.push(l);continue}if(l=this.tokenizer.fences(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.heading(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.hr(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.blockquote(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.list(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.html(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.def(t)){t=t.substring(l.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(` -`)?"":` -`)+l.raw,u.text+=` -`+l.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},n.push(l));continue}if(l=this.tokenizer.table(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.lheading(t)){t=t.substring(l.raw.length),n.push(l);continue}let a=t;if((o=this.options.extensions)!=null&&o.startBlock){let u=1/0,d=t.slice(1),f;this.options.extensions.startBlock.forEach(p=>{f=p.call({lexer:this},d),typeof f=="number"&&f>=0&&(u=Math.min(u,f))}),u<1/0&&u>=0&&(a=t.substring(0,u+1))}if(this.state.top&&(l=this.tokenizer.paragraph(a))){let u=n.at(-1);r&&(u==null?void 0:u.type)==="paragraph"?(u.raw+=(u.raw.endsWith(` -`)?"":` -`)+l.raw,u.text+=` -`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(l),r=a.length!==t.length,t=t.substring(l.raw.length);continue}if(l=this.tokenizer.text(t)){t=t.substring(l.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(` -`)?"":` -`)+l.raw,u.text+=` -`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(l);continue}if(t){let u="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var l,a,u,d,f;let r=t,i=null;if(this.tokens.links){let p=Object.keys(this.tokens.links);if(p.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)p.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((a=(l=this.options.hooks)==null?void 0:l.emStrongMask)==null?void 0:a.call({lexer:this},r))??r;let s=!1,o="";for(;t;){s||(o=""),s=!1;let p;if((d=(u=this.options.extensions)==null?void 0:u.inline)!=null&&d.some(h=>(p=h.call({lexer:this},t,n))?(t=t.substring(p.raw.length),n.push(p),!0):!1))continue;if(p=this.tokenizer.escape(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.tag(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.link(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(p.raw.length);let h=n.at(-1);p.type==="text"&&(h==null?void 0:h.type)==="text"?(h.raw+=p.raw,h.text+=p.text):n.push(p);continue}if(p=this.tokenizer.emStrong(t,r,o)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.codespan(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.br(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.del(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.autolink(t)){t=t.substring(p.raw.length),n.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(t))){t=t.substring(p.raw.length),n.push(p);continue}let w=t;if((f=this.options.extensions)!=null&&f.startInline){let h=1/0,v=t.slice(1),k;this.options.extensions.startInline.forEach(g=>{k=g.call({lexer:this},v),typeof k=="number"&&k>=0&&(h=Math.min(h,k))}),h<1/0&&h>=0&&(w=t.substring(0,h+1))}if(p=this.tokenizer.inlineText(w)){t=t.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(o=p.raw.slice(-1)),s=!0;let h=n.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=p.raw,h.text+=p.text):n.push(p);continue}if(t){let h="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return n}},dl=class{constructor(e){ve(this,"options");ve(this,"parser");this.options=e||jr}space(e){return""}code({text:e,lang:t,escaped:n}){var s;let r=(s=(t||"").match(dt.notSpaceStart))==null?void 0:s[0],i=e.replace(dt.endingNewline,"")+` -`;return r?'
    '+(n?i:rn(i,!0))+`
    -`:"
    "+(n?i:rn(i,!0))+`
    -`}blockquote({tokens:e}){return`
    -${this.parser.parse(e)}
    -`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`${this.parser.parseInline(e)} -`}hr(e){return`
    -`}list(e){let t=e.ordered,n=e.start,r="";for(let o=0;o -`+r+" -`}listitem(e){var n;let t="";if(e.task){let r=this.checkbox({checked:!!e.checked});e.loose?((n=e.tokens[0])==null?void 0:n.type)==="paragraph"?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=r+" "+rn(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):t+=r+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`
  • ${t}
  • -`}checkbox({checked:e}){return"'}paragraph({tokens:e}){return`

    ${this.parser.parseInline(e)}

    -`}table(e){let t="",n="";for(let i=0;i${r}`),` - -`+t+` -`+r+`
    -`}tablerow({text:e}){return` -${e} -`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+` -`}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${rn(e,!0)}`}br(e){return"
    "}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Qp(e);if(i===null)return r;e=i;let s='
    ",s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Qp(e);if(i===null)return rn(n);e=i;let s=`${n}{let a=o[l].flat(1/0);n=n.concat(this.walkTokens(a,t))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=t.renderers[i.name];s?t.renderers[i.name]=function(...o){let l=i.renderer.apply(this,o);return l===!1&&(l=s.apply(this,o)),l}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[i.level];s?s.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),r.extensions=t),n.renderer){let i=this.defaults.renderer||new dl(this.defaults);for(let s in n.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,l=n.renderer[o],a=i[o];i[o]=(...u)=>{let d=l.apply(i,u);return d===!1&&(d=a.apply(i,u)),d||""}}r.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new cl(this.defaults);for(let s in n.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,l=n.tokenizer[o],a=i[o];i[o]=(...u)=>{let d=l.apply(i,u);return d===!1&&(d=a.apply(i,u)),d}}r.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new Ui;for(let s in n.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,l=n.hooks[o],a=i[o];Ui.passThroughHooks.has(s)?i[o]=u=>{if(this.defaults.async&&Ui.passThroughHooksRespectAsync.has(s))return(async()=>{let f=await l.call(i,u);return a.call(i,f)})();let d=l.call(i,u);return a.call(i,d)}:i[o]=(...u)=>{if(this.defaults.async)return(async()=>{let f=await l.apply(i,u);return f===!1&&(f=await a.apply(i,u)),f})();let d=l.apply(i,u);return d===!1&&(d=a.apply(i,u)),d}}r.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(o){let l=[];return l.push(s.call(this,o)),i&&(l=l.concat(i.call(this,o))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return qt.lex(e,t??this.defaults)}parser(e,t){return Gt.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(t):t,l=await(i.hooks?await i.hooks.provideLexer():e?qt.lex:qt.lexInline)(o,i),a=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():e?Gt.parse:Gt.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(s);try{i.hooks&&(t=i.hooks.preprocess(t));let o=(i.hooks?i.hooks.provideLexer():e?qt.lex:qt.lexInline)(t,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let l=(i.hooks?i.hooks.provideParser():e?Gt.parse:Gt.parseInline)(o,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(o){return s(o)}}}onError(e,t){return n=>{if(n.message+=` -Please report this to https://github.com/markedjs/marked.`,e){let r="

    An error occurred:

    "+rn(n.message+"",!0)+"
    ";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},Cr=new $N;function pe(e,t){return Cr.parse(e,t)}pe.options=pe.setOptions=function(e){return Cr.setOptions(e),pe.defaults=Cr.defaults,zv(pe.defaults),pe};pe.getDefaults=xd;pe.defaults=jr;pe.use=function(...e){return Cr.use(...e),pe.defaults=Cr.defaults,zv(pe.defaults),pe};pe.walkTokens=function(e,t){return Cr.walkTokens(e,t)};pe.parseInline=Cr.parseInline;pe.Parser=Gt;pe.parser=Gt.parse;pe.Renderer=dl;pe.TextRenderer=jd;pe.Lexer=qt;pe.lexer=qt.lex;pe.Tokenizer=cl;pe.Hooks=Ui;pe.parse=pe;pe.options;pe.setOptions;pe.use;pe.walkTokens;pe.parseInline;Gt.parse;qt.lex;const zN={name:"spoiler",level:"inline",start(e){var t;return(t=e.match(/\|\|/))==null?void 0:t.index},tokenizer(e){const n=/^\|\|(.*?)\|\|/.exec(e);if(n)return{type:"spoiler",raw:n[0],text:n[1].trim()}},renderer(e){return`${e.text}`}},FN={link(e){const t=e.href,n=e.title,r=e.text;try{if(new URL(t,window.location.href).origin!==window.location.origin)return`
    ${r}`}catch{}return`${r}`},listitem(e){const t=e.text,n=e.task,r=e.checked;return n?`
  • ${``} ${t}
  • -`:`
  • ${t}
  • -`}};pe.use({extensions:[zN],gfm:!0,breaks:!0,renderer:FN});const _d=e=>pe.parse(e),UN=e=>{const t=/#([а-яё\w]+)/gi,n=[];let r;for(;(r=t.exec(e))!==null;){const i=r.index,s=e.substring(Math.max(0,i-100),i),o=e.substring(i+r[0].length,Math.min(e.length,i+r[0].length+100)),l=s.lastIndexOf("<"),a=s.lastIndexOf(">");if(l>a)continue;const u=Math.max(s.lastIndexOf('"'),s.lastIndexOf("'")),d=s.lastIndexOf("=");if(d>-1&&u>d&&Math.min(o.indexOf('"')!==-1?o.indexOf('"'):1/0,o.indexOf("'")!==-1?o.indexOf("'"):1/0)!==1/0)continue;const f=r[1].toLowerCase();n.includes(f)||n.push(f)}return n},BN=e=>{const t=/#([а-яё\w]+)/gi,n=[];let r;for(;(r=t.exec(e))!==null;)n.push({fullMatch:r[0],tag:r[1],index:r.index});let i=e;for(let s=n.length-1;s>=0;s--){const o=n[s],l=i.substring(0,o.index),a=i.substring(o.index+o.fullMatch.length),u=l.lastIndexOf("<"),d=l.lastIndexOf(">");if(u>d)continue;const f=l.substring(Math.max(0,o.index-100)),p=Math.max(f.lastIndexOf('"'),f.lastIndexOf("'")),w=f.lastIndexOf("=");if(w>-1&&p>w){const v=a.substring(0,Math.min(100,a.length));if(Math.min(v.indexOf('"')!==-1?v.indexOf('"'):1/0,v.indexOf("'")!==-1?v.indexOf("'"):1/0)!==1/0)continue}const h=`${o.fullMatch}`;i=l+h+a}return i},WN=(e,t)=>{if(!t.trim())return e;const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`(${n})`,"gi");return e.replace(r,'$1')},Kv=({notes:e=[]})=>{const t=ye(l=>l.notes.selectedTag),n=ot(),i=(()=>{const l={};return e.forEach(a=>{UN(a.content).forEach(d=>{l[d]=(l[d]||0)+1})}),l})(),s=Object.keys(i).sort(),o=l=>{n(rl(t===l?null:l))};return s.length===0?c.jsxs("div",{className:"tags-section",children:[c.jsx("div",{className:"tags-header",children:c.jsxs("span",{className:"tags-title",children:[c.jsx(F,{icon:"mdi:tag"})," Теги"]})}),c.jsx("div",{className:"tags-container",children:c.jsx("div",{style:{fontSize:"10px",color:"#999",textAlign:"center"},children:"Нет тегов"})})]}):c.jsxs("div",{className:"tags-section",children:[c.jsx("div",{className:"tags-header",children:c.jsxs("span",{className:"tags-title",children:[c.jsx(F,{icon:"mdi:tag"})," Теги"]})}),c.jsx("div",{className:"tags-container",children:s.map(l=>{const a=i[l],u=t===l;return c.jsxs("span",{className:`tag ${u?"active":""}`,"data-tag":l,onClick:()=>o(l),children:["#",l,c.jsx("span",{className:"tag-count",children:a})]},l)})})]})},HN=({notes:e})=>c.jsxs("div",{className:"container-leftside",children:[c.jsx(Av,{notes:e}),c.jsx($v,{}),c.jsx(Kv,{notes:e})]}),VN=({isOpen:e,onClose:t})=>{const n=ye(r=>r.notes.allNotes);return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:`mobile-sidebar-overlay ${e?"open":""}`,onClick:t}),c.jsxs("div",{className:`mobile-sidebar ${e?"open":""}`,children:[c.jsx("button",{className:"sidebar-close-btn",onClick:t,children:c.jsx(F,{icon:"mdi:close"})}),c.jsxs("div",{className:"sidebar-content",children:[c.jsx("div",{className:"mobile-calendar-section",children:c.jsx(Av,{notes:n})}),c.jsx("div",{className:"mobile-search-section",children:c.jsx($v,{})}),c.jsx("div",{className:"mobile-tags-section",children:c.jsx(Kv,{notes:n})})]})]})]})},Xv=({onInsert:e,onImageClick:t,onFileClick:n,onPreviewToggle:r,isPreviewMode:i})=>{const[s,o]=x.useState(!1),l=ot(),a=x.useRef(null),u=x.useRef(null),d=x.useRef(null),f=x.useRef(null),[p,w]=x.useState(!1),[h,v]=x.useState(0),[k,g]=x.useState(0),[m,y]=x.useState(null);x.useEffect(()=>{const _=M=>{a.current&&!a.current.contains(M.target)&&d.current&&!d.current.contains(M.target)&&(o(!1),y(null))},D=()=>{if(u.current&&s){const M=u.current.getBoundingClientRect();y({top:M.bottom+window.scrollY+2,left:M.left+window.scrollX})}};if(s){D();const M=setTimeout(()=>{document.addEventListener("mousedown",_),window.addEventListener("resize",D),window.addEventListener("scroll",D)},100);return()=>{clearTimeout(M),document.removeEventListener("mousedown",_),window.removeEventListener("resize",D),window.removeEventListener("scroll",D)}}else y(null)},[s]);const C=_=>{_.target.closest(".btnMarkdown")||f.current&&(w(!0),v(_.pageX-f.current.offsetLeft),g(f.current.scrollLeft))},j=_=>{if(!p||!f.current)return;_.preventDefault();const M=(_.pageX-f.current.offsetLeft-h)*2;f.current.scrollLeft=k-M},S=()=>{w(!1)};x.useEffect(()=>(p?(document.addEventListener("mousemove",j),document.addEventListener("mouseup",S)):(document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",S)),()=>{document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",S)}),[p]);const N=[];return c.jsxs("div",{className:"markdown-buttons",ref:f,onMouseDown:C,style:{cursor:p?"grabbing":f.current&&f.current.scrollWidth>f.current.clientWidth?"grab":"default"},children:[N.map(_=>c.jsx("button",{className:"btnMarkdown",onClick:()=>{_.action?_.action():e(_.before,_.after)},title:_.title,children:c.jsx(F,{icon:_.icon})},_.id)),c.jsxs("div",{className:"header-dropdown",ref:a,children:[c.jsxs("button",{ref:u,className:"btnMarkdown",onMouseDown:_=>{_.stopPropagation()},onClick:_=>{_.stopPropagation(),o(!s)},title:"Заголовок",children:[c.jsx(F,{icon:"mdi:format-header-pound"}),c.jsx(F,{icon:"mdi:menu-down",style:{fontSize:"10px",marginLeft:"-2px"}})]}),s&&m&&c.jsx("div",{ref:d,className:"header-dropdown-menu",style:{position:"fixed",top:`${m.top}px`,left:`${m.left}px`},children:[1,2,3,4,5].map(_=>c.jsxs("button",{onClick:D=>{D.stopPropagation(),e("#".repeat(_)+" ",""),o(!1),y(null)},children:["H",_]},_))})]}),c.jsx("button",{className:"btnMarkdown",onClick:()=>e("- ",""),title:"Список",children:c.jsx(F,{icon:"mdi:format-list-bulleted"})}),c.jsx("button",{className:"btnMarkdown",onClick:()=>e("1. ",""),title:"Нумерованный список",children:c.jsx(F,{icon:"mdi:format-list-numbered"})}),c.jsx("button",{className:"btnMarkdown",onClick:()=>e("> ",""),title:"Цитата",children:c.jsx(F,{icon:"mdi:format-quote-close"})}),c.jsx("button",{className:"btnMarkdown",onClick:()=>e("`","`"),title:"Код",children:c.jsx(F,{icon:"mdi:code-tags"})}),c.jsx("button",{className:"btnMarkdown",onClick:()=>e("[текст ссылки](",")"),title:"Ссылка",children:c.jsx(F,{icon:"mdi:link"})}),c.jsx("button",{className:"btnMarkdown",onClick:()=>e("- [ ] ",""),title:"To-Do список",children:c.jsx(F,{icon:"mdi:checkbox-marked-outline"})}),c.jsx("button",{className:"btnMarkdown",onClick:()=>t==null?void 0:t(),title:"Загрузить изображения",children:c.jsx(F,{icon:"mdi:image-plus"})}),c.jsx("button",{className:"btnMarkdown",onClick:()=>n==null?void 0:n(),title:"Прикрепить файлы",children:c.jsx(F,{icon:"mdi:file-plus"})}),c.jsx("button",{className:`btnMarkdown ${i?"active":""}`,onClick:r||(()=>l(u1())),title:"Предпросмотр",children:c.jsx(F,{icon:"mdi:monitor-eye"})})]})},Jv=({textareaRef:e,onFormat:t,visible:n,position:r,onHide:i,onInsertColor:s,activeFormats:o={},hasSelection:l=!1})=>{const a=x.useRef(null),[u,d]=x.useState(!1),[f,p]=x.useState(0),[w,h]=x.useState(0);x.useEffect(()=>{n&&a.current&&setTimeout(()=>{if(!a.current)return;const S=a.current,N=S.getBoundingClientRect(),_=window.innerWidth,D=window.innerHeight,M=10,q=S.querySelector(".floating-toolbar"),X=q?q.scrollWidth:N.width,te=_-M*2;let K=r.top-N.height-M,z=r.left;X>te&&(S.style.maxWidth=`${te}px`),z+N.width>_-M&&(X>te?z=M:z=Math.max(M,_-N.width-M)),zD-M&&(K=D-N.height-M),S.style.top=`${K}px`,S.style.left=`${z}px`},0)},[n,r]);const v=S=>{S.target.closest(".floating-toolbar-btn")||a.current&&(d(!0),p(S.pageX-a.current.offsetLeft),h(a.current.scrollLeft))},k=S=>{if(!u||!a.current)return;S.preventDefault();const _=(S.pageX-a.current.offsetLeft-f)*2;a.current.scrollLeft=w-_},g=()=>{d(!1)};x.useEffect(()=>(u?(document.addEventListener("mousemove",k),document.addEventListener("mouseup",g)):(document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",g)),()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",g)}),[u]);const m=(S,N)=>{t(S,N),setTimeout(()=>{if(e.current){e.current.focus();const _=e.current.selectionStart,D=e.current.selectionEnd;_!==D&&e.current.setSelectionRange(_,D)}},0)},y=async()=>{const S=e.current;if(!S)return;const N=S.selectionStart,_=S.selectionEnd;if(N===_)return;const D=S.value.substring(N,_);try{await navigator.clipboard.writeText(D)}catch{const q=document.createElement("textarea");q.value=D,q.style.position="fixed",q.style.left="-999999px",document.body.appendChild(q),q.select(),document.execCommand("copy"),document.body.removeChild(q)}},C=async()=>{var X;const S=e.current;if(!S)return;const N=S.selectionStart,_=S.selectionEnd;if(N===_)return;const D=S.value.substring(N,_);try{await navigator.clipboard.writeText(D)}catch{const K=document.createElement("textarea");K.value=D,K.style.position="fixed",K.style.left="-999999px",document.body.appendChild(K),K.select(),document.execCommand("copy"),document.body.removeChild(K)}const M=S.value.substring(0,N)+S.value.substring(_),q=(X=Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype,"value"))==null?void 0:X.set;if(q){q.call(S,M);const te=new Event("input",{bubbles:!0});S.dispatchEvent(te)}else{S.value=M;const te=new Event("input",{bubbles:!0});S.dispatchEvent(te)}S.setSelectionRange(N,N),S.focus()},j=async()=>{var D;const S=e.current;if(!S)return;const N=S.selectionStart,_=S.selectionEnd;try{const M=await navigator.clipboard.readText(),q=S.value.substring(0,N)+M+S.value.substring(_),X=(D=Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype,"value"))==null?void 0:D.set;if(X){X.call(S,q);const K=new Event("input",{bubbles:!0});S.dispatchEvent(K)}else{S.value=q;const K=new Event("input",{bubbles:!0});S.dispatchEvent(K)}const te=N+M.length;S.setSelectionRange(te,te),S.focus()}catch{S.focus(),document.execCommand("paste")}};return!n||!l?null:c.jsx("div",{ref:a,className:"floating-toolbar-wrapper",style:{position:"fixed",top:`${r.top}px`,left:`${r.left}px`,zIndex:1e3,cursor:u?"grabbing":a.current&&a.current.scrollWidth>a.current.clientWidth?"grab":"default"},onMouseDown:S=>{S.preventDefault(),v(S)},onContextMenu:S=>{S.preventDefault()},children:c.jsxs("div",{className:"floating-toolbar",children:[c.jsx("button",{className:"floating-toolbar-btn",onClick:i,title:"Закрыть",children:c.jsx(F,{icon:"mdi:close"})}),l&&c.jsxs(c.Fragment,{children:[c.jsx("button",{className:"floating-toolbar-btn",onClick:y,title:"Копировать",children:c.jsx(F,{icon:"mdi:content-copy"})}),c.jsx("button",{className:"floating-toolbar-btn",onClick:C,title:"Вырезать",children:c.jsx(F,{icon:"mdi:content-cut"})}),c.jsx("button",{className:"floating-toolbar-btn",onClick:j,title:"Вставить",children:c.jsx(F,{icon:"mdi:content-paste"})})]}),l&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"floating-toolbar-separator"}),c.jsx("button",{className:`floating-toolbar-btn ${o.bold?"active":""}`,onClick:()=>m("**","**"),title:"Жирный",children:c.jsx(F,{icon:"mdi:format-bold"})}),c.jsx("button",{className:`floating-toolbar-btn ${o.italic?"active":""}`,onClick:()=>m("*","*"),title:"Курсив",children:c.jsx(F,{icon:"mdi:format-italic"})}),c.jsx("button",{className:`floating-toolbar-btn ${o.strikethrough?"active":""}`,onClick:()=>m("~~","~~"),title:"Зачеркнутый",children:c.jsx(F,{icon:"mdi:format-strikethrough"})}),c.jsx("div",{className:"floating-toolbar-separator"}),c.jsx("button",{className:"floating-toolbar-btn",onClick:()=>s==null?void 0:s(),title:"Цвет текста",children:c.jsx(F,{icon:"mdi:palette"})}),c.jsx("button",{className:"floating-toolbar-btn",onClick:()=>m("||","||"),title:"Скрытый текст",children:c.jsx(F,{icon:"mdi:eye-off"})}),c.jsx("button",{className:"floating-toolbar-btn",onClick:()=>m("`","`"),title:"Код",children:c.jsx(F,{icon:"mdi:code-tags"})}),c.jsx("button",{className:"floating-toolbar-btn",onClick:()=>m("> ",""),title:"Цитата",children:c.jsx(F,{icon:"mdi:format-quote-close"})})]})]})})},Ge={getAll:async()=>{const{data:e}=await fe.get("/notes");return e},search:async e=>{const{data:t}=await fe.get("/notes/search",{params:e});return t},create:async e=>{const{data:t}=await fe.post("/notes",e);return t},update:async(e,t,n)=>{const{data:r}=await fe.put(`/notes/${e}`,{content:t,skipTimestamp:n});return r},delete:async e=>{await fe.delete(`/notes/${e}`)},pin:async e=>{const{data:t}=await fe.put(`/notes/${e}/pin`);return t},archive:async e=>{const{data:t}=await fe.put(`/notes/${e}/archive`);return t},unarchive:async e=>{const{data:t}=await fe.put(`/notes/${e}/unarchive`);return t},uploadImages:async(e,t)=>{const n=new FormData;t.forEach(i=>n.append("images",i));const{data:r}=await fe.post(`/notes/${e}/images`,n,{headers:{"Content-Type":"multipart/form-data"}});return r},uploadFiles:async(e,t)=>{const n=new FormData;t.forEach(i=>n.append("files",i));const{data:r}=await fe.post(`/notes/${e}/files`,n,{headers:{"Content-Type":"multipart/form-data"}});return r},deleteImage:async(e,t)=>{await fe.delete(`/notes/${e}/images/${t}`)},deleteFile:async(e,t)=>{await fe.delete(`/notes/${e}/files/${t}`)},getArchived:async()=>{const{data:e}=await fe.get("/notes/archived");return e},deleteArchived:async e=>{await fe.delete(`/notes/archived/${e}`)},deleteAllArchived:async e=>{const{data:t}=await fe.delete("/notes/archived/all",{data:{password:e}});return t}},QN={getLogs:async e=>{const{data:t}=await fe.get("/logs",{params:e});return t}},Zv=e=>{const t=x.useCallback(()=>{document.querySelectorAll(".spoiler").forEach(s=>{if(!s._clickHandler){const o=function(l){this.classList.contains("revealed")||(l.stopPropagation(),this.classList.add("revealed"))};s._clickHandler=o,s.addEventListener("click",o)}}),document.querySelectorAll(".external-link").forEach(s=>{if(!s._externalClickHandler){const o=function(l){(window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone===!0)&&(l.preventDefault(),window.open(this.href,"_blank","noopener,noreferrer"))};s._externalClickHandler=o,s.addEventListener("click",o)}}),document.querySelectorAll(".note-preview-content input[type='checkbox'], .textNote input[type='checkbox']").forEach(s=>{if(!s._checkboxHandler){const o=async function(){if(this.closest(".note-preview-content"))return;const l=this.closest("[data-note-id]");if(!l)return;const a=parseInt(l.getAttribute("data-note-id")||"0");if(!a)return;const u=l.querySelector(".textNote");if(!u)return;const d=u.getAttribute("data-original-content");if(d)try{const p=Array.from(u.querySelectorAll("input[type='checkbox']")).indexOf(this);if(p===-1)return;const w=d.split(` -`);let h=0,v="";for(let k=0;k{const n=new MutationObserver(()=>{t()});return n.observe(document.body,{childList:!0,subtree:!0}),t(),()=>{n.disconnect()}},[t])},ey=({content:e})=>{Zv();const t=_d(e);return c.jsxs("div",{className:"note-preview-container",style:{display:"block"},children:[c.jsx("div",{className:"note-preview-header",children:c.jsx("span",{children:"Предпросмотр:"})}),c.jsx("div",{className:"note-preview-content",dangerouslySetInnerHTML:{__html:t}})]})},ty=({images:e,onChange:t})=>{const n=i=>{t(e.filter((s,o)=>o!==i))},r=()=>{t([])};return e.length===0?null:c.jsxs("div",{className:"image-preview-container",style:{display:"block"},children:[c.jsxs("div",{className:"image-preview-header",children:[c.jsx("span",{children:"Загруженные изображения:"}),c.jsx("button",{type:"button",className:"clear-images-btn",onClick:r,children:"Очистить все"})]}),c.jsx("div",{className:"image-preview-list",children:e.map((i,s)=>c.jsxs("div",{className:"image-preview-item",children:[c.jsx("img",{src:URL.createObjectURL(i),alt:`Preview ${s+1}`,className:"image-preview-thumbnail"}),c.jsx("button",{className:"image-preview-remove",onClick:()=>n(s),title:"Удалить",children:c.jsx(F,{icon:"mdi:close"})})]},s))})]})},ny=({files:e,onChange:t})=>{const n=o=>{t(e.filter((l,a)=>a!==o))},r=()=>{t([])},i=o=>{var a;const l=((a=o.split(".").pop())==null?void 0:a.toLowerCase())||"";return l==="pdf"?"mdi:file-pdf":["doc","docx"].includes(l)?"mdi:file-word":["xls","xlsx"].includes(l)?"mdi:file-excel":l==="txt"?"mdi:file-document":["zip","rar","7z"].includes(l)?"mdi:folder-zip":"mdi:file"},s=o=>(o/1024/1024).toFixed(2)+" MB";return e.length===0?null:c.jsxs("div",{className:"file-preview-container",style:{display:"block"},children:[c.jsxs("div",{className:"file-preview-header",children:[c.jsx("span",{children:"Прикрепленные файлы:"}),c.jsx("button",{type:"button",className:"clear-files-btn",onClick:r,children:"Очистить все"})]}),c.jsx("div",{className:"file-preview-list",children:e.map((o,l)=>c.jsxs("div",{className:"file-preview-item",children:[c.jsx(F,{icon:i(o.name),className:"file-icon"}),c.jsxs("div",{className:"file-info",children:[c.jsx("div",{className:"file-name",children:o.name}),c.jsx("div",{className:"file-size",children:s(o.size)})]}),c.jsx("button",{className:"file-preview-remove",onClick:()=>n(l),title:"Удалить",children:c.jsx(F,{icon:"mdi:close"})})]},l))})]})},ry={improveText:async e=>{const{data:t}=await fe.post("/ai/improve",{text:e});return t.improvedText}},qN=({onSave:e})=>{const[t,n]=x.useState(""),[r,i]=x.useState([]),[s,o]=x.useState([]),[l,a]=x.useState(!1),[u,d]=x.useState(!1),[f,p]=x.useState({top:0,left:0}),[w,h]=x.useState(!1),[v,k]=x.useState({bold:!1,italic:!1,strikethrough:!1}),g=x.useRef(null),m=ye(b=>b.ui.isPreviewMode),{showNotification:y}=Tr(),C=ye(b=>b.profile.aiEnabled),j=async()=>{if(!t.trim()){y("Введите текст заметки","warning");return}try{const b=new Date,P=b.toLocaleDateString("ru-RU"),L=b.toLocaleTimeString("ru-RU",{hour:"2-digit",minute:"2-digit"}),$=await Ge.create({content:t,date:P,time:L});r.length>0&&await Ge.uploadImages($.id,r),s.length>0&&await Ge.uploadFiles($.id,s),y("Заметка сохранена!","success"),n(""),i([]),o([]),e()}catch(b){console.error("Ошибка сохранения заметки:",b),y("Ошибка сохранения заметки","error")}},S=async()=>{if(!t.trim()){y("Введите текст для улучшения","warning");return}a(!0);try{const b=await ry.improveText(t);n(b),y("Текст улучшен!","success")}catch(b){console.error("Ошибка улучшения текста:",b),y("Ошибка улучшения текста","error")}finally{a(!1)}},N=x.useCallback(()=>{const b=g.current;if(!b)return{bold:!1,italic:!1,strikethrough:!1};const P=b.selectionStart,L=b.selectionEnd;if(P===L)return{bold:!1,italic:!1,strikethrough:!1};const $=t.substring(P,L),H={bold:!1,italic:!1,strikethrough:!1},G=10,J=Math.max(0,P-G),oe=Math.min(t.length,L+G),le=t.substring(J,oe),xe=P-J,ne=le.substring(0,xe),Ae=le.substring(xe+$.length),Lt=(Xn,yi)=>{let Jn=0;for(let dn=Xn.length-1;dn>=0&&Xn[dn]===yi;dn--)Jn++;return Jn},_e=(Xn,yi)=>{let Jn=0;for(let dn=0;dn=4;(R||V)&&(H.strikethrough=!0);const Y=Lt(ne,"*"),de=_e(Ae,"*"),He=_e($,"*"),$e=Lt($,"*"),hi=Y>=2,mi=de>=2,gi=He>=2&&$e>=2;(hi&&mi||gi&&$.length>=4)&&(H.bold=!0);const vi=Y===1||Y>=3&&Y%2===1,Bl=de===1||de>=3&&de%2===1,Wl=He===1&&$e===1||He>=3&&$e>=3&&He%2===1&&$e%2===1;return vi&&Bl&&!H.bold?H.italic=!0:Y>=3&&de>=3?(H.italic=!0,H.bold=!0):(Wl&&$.length>=2||He===1&&$e===1&&$.length>=2&&!$.startsWith("**")&&!$.endsWith("**"))&&(H.italic=!0),H.bold&&(Y>=3||de>=3||He>=3||$e>=3)&&(H.italic=!0),H},[t]),_=x.useCallback((b,P="")=>{const L=g.current;if(!L)return;const $=L.selectionStart,H=L.selectionEnd,G=t.substring($,H),J=b.length,oe=Math.max(0,$-J),le=Math.min(t.length,H+J),xe=t.substring(oe,le),ne=$-oe,Ae=xe.substring(0,ne),Lt=xe.substring(ne+G.length),_e=Ae.endsWith(b),Ce=Lt.startsWith(P),Pe=G.startsWith(b),R=G.endsWith(P);let V=!1;if(b==="*"&&P==="*"){const $e=$>1?t[$-2]:"",hi=H+1=2&&!G.startsWith("**")&&!G.endsWith("**");V=mi&&gi||vi}else b==="**"&&P==="**"||b==="~~"&&P==="~~"?V=_e&&Ce||Pe&&R&&G.length>=4:V=_e&&Ce||Pe&&R&&G.length>=J*2;let Y,de,He;if(V)if(_e&&Ce)Y=t.substring(0,$-J)+G+t.substring(H+J),de=$-J,He=H-J;else{const $e=G.substring(J,G.length-J);Y=t.substring(0,$)+$e+t.substring(H),de=$,He=$+$e.length}else Y=t.substring(0,$)+b+G+P+t.substring(H),de=$+b.length,He=H+b.length;n(Y),setTimeout(()=>{L.focus(),L.setSelectionRange(de,He);const $e=N();k($e)},0)},[t,N]),D=x.useCallback(()=>{const b=document.createElement("input");b.type="color",b.style.display="none",document.body.appendChild(b),b.addEventListener("change",function(){const P=this.value,L=g.current;if(!L)return;const $=L.selectionStart,H=L.selectionEnd,G=t.substring($,H),J=t.substring(0,$),oe=t.substring(H);let le;G.trim()===""?le=`Текст`:le=`${G}`;const xe=J+le+oe;n(xe),setTimeout(()=>{L.focus();const ne=$+le.length;L.setSelectionRange(ne,ne)},0),document.body.removeChild(this)}),b.addEventListener("cancel",function(){document.body.removeChild(this)}),b.click()},[t]),M=b=>{if((b.altKey||b.ctrlKey)&&b.key==="Enter")b.preventDefault(),j();else if(b.key==="Enter"){const P=b.currentTarget,L=P.selectionStart,$=P.value,H=$.split(` -`);let G=0,J="";for(let ne=0;ne=L){J=H[ne];break}G+=Ae+1}const oe=[/^(\s*)- \[ \] /,/^(\s*)- \[x\] /i,/^(\s*)- /,/^(\s*)\* /,/^(\s*)\+ /,/^(\s*)(\d+)\. /,/^(\s*)(\w+)\. /,/^(\s*)1\. /];let le=null,xe=null;for(const ne of oe){const Ae=J.match(ne);if(Ae){le=Ae,ne===oe[0]||ne===oe[1]?xe="checkbox":ne===oe[2]||ne===oe[3]||ne===oe[4]?xe="unordered":ne===oe[7]?xe="numbered":xe="ordered";break}}if(le){b.preventDefault();const ne=le[1]||"",Ae=le[0].slice(ne.length);if(J.slice(le[0].length).trim()===""){const _e=$.substring(0,L),Ce=$.substring(L),Pe=_e.replace(/\n\s*- \[ \] \s*$|\n\s*- \[x\] \s*$|\n\s*[-*+]\s*$|\n\s*\d+\.\s*$|\n\s*\w+\.\s*$/i,` -`),R=Pe+Ce;n(R),setTimeout(()=>{const V=Pe.length;P.setSelectionRange(V,V)},0)}else{const _e=$.substring(0,L),Ce=$.substring(L);let Pe="";if(xe==="checkbox")Pe=ne+"- [ ] ";else if(xe==="unordered")Pe=ne+Ae;else if(xe==="ordered"){const Y=parseInt(le[2])+1,de=le[2].replace(/\d+/,Y.toString());Pe=ne+de+". "}else xe==="numbered"&&(Pe=ne+"1. ");const R=_e+` -`+Pe+Ce;n(R),setTimeout(()=>{const V=L+1+Pe.length;P.setSelectionRange(V,V)},0)}}}},q=x.useCallback(()=>{const b=g.current;if(!b)return null;const P=b.selectionStart,L=b.selectionEnd,$=P!==L,H=$?Math.floor((P+L)/2):P,J=b.value.substring(0,H).split(` -`),oe=J.length-1,le=J[J.length-1],xe=b.getBoundingClientRect(),ne=window.getComputedStyle(b),Ae=parseInt(ne.lineHeight)||20,Lt=parseInt(ne.paddingTop)||0,_e=parseInt(ne.paddingLeft)||0,Ce=document.createElement("span");Ce.style.position="absolute",Ce.style.visibility="hidden",Ce.style.whiteSpace="pre",Ce.style.font=ne.font,Ce.textContent=le,document.body.appendChild(Ce);const Pe=Ce.offsetWidth;document.body.removeChild(Ce);const R=xe.top+Lt+oe*Ae+Ae/2,V=xe.left+_e+Pe;return{top:R,left:V,hasSelection:$}},[]),X=x.useCallback(()=>{if(m){d(!1);return}const b=t.trim().length>0,P=q();if(P&&b)if(p({top:P.top,left:P.left}),h(P.hasSelection),d(!0),P.hasSelection){const L=N();k(L)}else k({bold:!1,italic:!1,strikethrough:!1});else d(!1),h(!1),k({bold:!1,italic:!1,strikethrough:!1})},[m,t,q,N]);x.useEffect(()=>{const b=g.current;if(!b||m)return;const P=()=>{setTimeout(X,0)},L=G=>{G.buttons===1&&setTimeout(X,0)},$=()=>{setTimeout(X,0)},H=G=>{const J=G.target;if(J===b||b.contains(J)){const oe=b.value.trim().length>0,le=b.selectionStart!==b.selectionEnd;oe&&le&&(G.preventDefault(),G.stopPropagation())}};return b.addEventListener("mouseup",P),b.addEventListener("mousemove",L),b.addEventListener("keyup",$),b.addEventListener("contextmenu",H),document.addEventListener("selectionchange",X),document.addEventListener("contextmenu",H,!0),()=>{b.removeEventListener("mouseup",P),b.removeEventListener("mousemove",L),b.removeEventListener("keyup",$),b.removeEventListener("contextmenu",H),document.removeEventListener("selectionchange",X),document.removeEventListener("contextmenu",H,!0)}},[m,X]),x.useEffect(()=>{const b=P=>{const L=g.current,$=P.target,H=document.querySelector(".floating-toolbar");H&&H.contains($)||L&&!L.contains($)&&setTimeout(()=>{L.selectionStart===L.selectionEnd&&d(!1)},0)};return document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b)}},[]),x.useEffect(()=>{if(!u)return;const b=()=>{const L=q();if(L&&(p({top:L.top,left:L.left}),h(L.hasSelection),L.hasSelection)){const $=N();k($)}},P=g.current;return P&&(P.addEventListener("scroll",b),window.addEventListener("scroll",b,!0)),()=>{P&&P.removeEventListener("scroll",b),window.removeEventListener("scroll",b,!0)}},[u,q,N]),Jt.useEffect(()=>{const b=g.current;if(!b)return;const P=()=>{b.style.height="auto",b.style.height=b.scrollHeight+"px"};return b.addEventListener("input",P),P(),()=>{b.removeEventListener("input",P)}},[t]);const te=x.useRef(null),K=x.useRef(null),z=()=>{var b;(b=te.current)==null||b.click()},Q=()=>{var b;(b=K.current)==null||b.click()},se=b=>{const L=Array.from(b.target.files||[]).filter($=>$.type.startsWith("image/")&&$.size<=10*1024*1024);if(L.length+r.length>10){y("Можно загрузить максимум 10 изображений","warning");return}i([...r,...L]),te.current&&(te.current.value="")},O=b=>{const P=Array.from(b.target.files||[]),L=/pdf|doc|docx|xls|xlsx|txt|zip|rar|7z/,$=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","text/plain","application/zip","application/x-zip-compressed","application/x-rar-compressed","application/x-7z-compressed"],H=P.filter(G=>{var J;return($.includes(G.type)||L.test(((J=G.name.split(".").pop())==null?void 0:J.toLowerCase())||""))&&G.size<=50*1024*1024});o([...s,...H]),K.current&&(K.current.value="")};return c.jsxs("div",{className:"main",children:[c.jsx(Xv,{onInsert:_,onImageClick:z,onFileClick:Q}),c.jsx("input",{ref:te,type:"file",id:"imageInput",accept:"image/*",multiple:!0,style:{display:"none"},onChange:se}),c.jsx("input",{ref:K,type:"file",id:"fileInput",accept:".pdf,.doc,.docx,.xls,.xlsx,.txt,.zip,.rar,.7z",multiple:!0,style:{display:"none"},onChange:O}),!m&&c.jsxs(c.Fragment,{children:[c.jsx("textarea",{ref:g,className:"textInput",id:"noteInput",placeholder:"Ваша заметка...",value:t,onChange:b=>n(b.target.value),onKeyDown:M,onContextMenu:b=>{const P=g.current;if(P){const L=P.value.trim().length>0,$=P.selectionStart!==P.selectionEnd;L&&$&&b.preventDefault()}}}),c.jsx(Jv,{textareaRef:g,onFormat:_,visible:u,position:f,onHide:()=>d(!1),onInsertColor:D,activeFormats:v,hasSelection:w})]}),m&&c.jsx(ey,{content:t}),c.jsx(ty,{images:r,onChange:i}),c.jsx(ny,{files:s,onChange:o}),c.jsxs("div",{className:"save-button-container",children:[c.jsxs("div",{className:"action-buttons",children:[C&&c.jsxs("button",{className:"btnSave btnAI",onClick:S,disabled:l,title:"Улучшить или создать текст через ИИ",children:[c.jsx(F,{icon:"mdi:robot"}),l?"Обработка...":"Помощь ИИ"]}),c.jsx("button",{className:"btnSave",onClick:j,children:"Сохранить"})]}),c.jsx("span",{className:"save-hint",children:"или нажмите Alt + Enter"})]})]})},Pd=({isOpen:e,onClose:t,onConfirm:n,title:r,message:i,confirmText:s="OK",cancelText:o="Отмена",confirmType:l="primary"})=>(x.useEffect(()=>{const a=u=>{u.key==="Escape"&&t()};return e&&document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,t]),e?c.jsx("div",{className:"modal",style:{display:"block"},onClick:t,children:c.jsxs("div",{className:"modal-content",onClick:a=>a.stopPropagation(),children:[c.jsxs("div",{className:"modal-header",children:[c.jsx("h3",{children:r}),c.jsx("span",{className:"modal-close",onClick:t,children:"×"})]}),c.jsx("div",{className:"modal-body",children:typeof i=="string"?c.jsx("p",{children:i}):i}),c.jsxs("div",{className:"modal-footer",children:[c.jsx("button",{className:l==="danger"?"btn-danger":"btn-primary",onClick:n,style:{marginRight:"10px"},children:s}),c.jsx("button",{className:"btn-secondary",onClick:t,children:o})]})]})}):null);function Ma(e,t,n){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/api")||e.startsWith("/uploads")?e:e.startsWith("/")?`/api${e}`:`/api/notes/${t}/images/${n}`}function GN(e,t,n){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/api")||e.startsWith("/uploads")?e:e.startsWith("/")?`/api${e}`:`/api/notes/${t}/files/${n}`}const YN=({note:e,onPin:t,onArchive:n,onReload:r})=>{const[i,s]=x.useState(!1),[o,l]=x.useState(e.content),[a,u]=x.useState(!1),[d,f]=x.useState([]),[p,w]=x.useState([]),[h,v]=x.useState([]),[k,g]=x.useState([]),[m,y]=x.useState(!1),[C,j]=x.useState(!1),[S,N]=x.useState({top:0,left:0}),[_,D]=x.useState(!1),[M,q]=x.useState({bold:!1,italic:!1,strikethrough:!1}),[X,te]=x.useState(!1),[K,z]=x.useState(!1),[Q,se]=x.useState(!1),O=x.useRef(null),b=x.useRef(null),P=x.useRef(null),L=x.useRef(null),$=ye(E=>E.notes.searchQuery),H=ye(E=>E.ui.isPreviewMode),G=ye(E=>E.profile.aiEnabled),{showNotification:J}=Tr(),oe=ot();Zv({onNoteUpdate:r});const le=()=>{s(!0),l(e.content),f([]),w([]),v([]),g([]),j(!1),q({bold:!1,italic:!1,strikethrough:!1}),te(!1)},xe=()=>{te(!X),j(!1)},ne=async()=>{if(!o.trim()){J("Введите текст заметки","warning");return}try{await Ge.update(e.id,o);for(const E of h)await Ge.deleteImage(e.id,E);for(const E of k)await Ge.deleteFile(e.id,E);d.length>0&&await Ge.uploadImages(e.id,d),p.length>0&&await Ge.uploadFiles(e.id,p),J("Заметка обновлена!","success"),s(!1),f([]),w([]),v([]),g([]),r()}catch(E){console.error("Ошибка обновления заметки:",E),J("Ошибка обновления заметки","error")}},Ae=()=>{s(!1),l(e.content),f([]),w([]),v([]),g([]),j(!1),q({bold:!1,italic:!1,strikethrough:!1}),te(!1)},Lt=E=>{v([...h,E])},_e=E=>{g([...k,E])},Ce=E=>{v(h.filter(A=>A!==E))},Pe=E=>{g(k.filter(A=>A!==E))},R=async()=>{if(!o.trim()){J("Введите текст для улучшения","warning");return}y(!0);try{const E=await ry.improveText(o);l(E),J("Текст улучшен!","success")}catch(E){console.error("Ошибка улучшения текста:",E),J("Ошибка улучшения текста","error")}finally{y(!1)}},V=x.useCallback(()=>{const E=O.current;if(!E)return{bold:!1,italic:!1,strikethrough:!1};const A=E.selectionStart,U=E.selectionEnd;if(A===U)return{bold:!1,italic:!1,strikethrough:!1};const W=o.substring(A,U),Z={bold:!1,italic:!1,strikethrough:!1},re=10,ge=Math.max(0,A-re),Ve=Math.min(o.length,U+re),Oe=o.substring(ge,Ve),Ue=A-ge,ue=Oe.substring(0,Ue),lt=Oe.substring(Ue+W.length),Zn=(wi,Kl)=>{let xi=0;for(let er=wi.length-1;er>=0&&wi[er]===Kl;er--)xi++;return xi},mt=(wi,Kl)=>{let xi=0;for(let er=0;er=4;(It||et)&&(Z.strikethrough=!0);const Et=Zn(ue,"*"),Ct=mt(lt,"*"),Bt=mt(W,"*"),bt=Zn(W,"*"),Ql=Et>=2,ql=Ct>=2,Gl=Bt>=2&&bt>=2;(Ql&&ql||Gl&&W.length>=4)&&(Z.bold=!0);const Yl=Et===1||Et>=3&&Et%2===1,ly=Ct===1||Ct>=3&&Ct%2===1,ay=Bt===1&&bt===1||Bt>=3&&bt>=3&&Bt%2===1&&bt%2===1;return Yl&&ly&&!Z.bold?Z.italic=!0:Et>=3&&Ct>=3?(Z.italic=!0,Z.bold=!0):(ay&&W.length>=2||Bt===1&&bt===1&&W.length>=2&&!W.startsWith("**")&&!W.endsWith("**"))&&(Z.italic=!0),Z.bold&&(Et>=3||Ct>=3||Bt>=3||bt>=3)&&(Z.italic=!0),Z},[o]),Y=x.useCallback((E,A="")=>{const U=O.current;if(!U)return;const W=U.selectionStart,Z=U.selectionEnd,re=o.substring(W,Z),ge=E.length,Ve=Math.max(0,W-ge),Oe=Math.min(o.length,Z+ge),Ue=o.substring(Ve,Oe),ue=W-Ve,lt=Ue.substring(0,ue),Zn=Ue.substring(ue+re.length),mt=lt.endsWith(E),ze=Zn.startsWith(A),Qe=re.startsWith(E),It=re.endsWith(A);let et=!1;if(E==="*"&&A==="*"){const bt=W>1?o[W-2]:"",Ql=Z+1=2&&!re.startsWith("**")&&!re.endsWith("**");et=ql&&Gl||Yl}else E==="**"&&A==="**"||E==="~~"&&A==="~~"?et=mt&&ze||Qe&&It&&re.length>=4:et=mt&&ze||Qe&&It&&re.length>=ge*2;let Et,Ct,Bt;if(et)if(mt&&ze)Et=o.substring(0,W-ge)+re+o.substring(Z+ge),Ct=W-ge,Bt=Z-ge;else{const bt=re.substring(ge,re.length-ge);Et=o.substring(0,W)+bt+o.substring(Z),Ct=W,Bt=W+bt.length}else Et=o.substring(0,W)+E+re+A+o.substring(Z),Ct=W+E.length,Bt=Z+E.length;l(Et),setTimeout(()=>{U.focus(),U.setSelectionRange(Ct,Bt);const bt=V();q(bt)},0)},[o,V]),de=x.useCallback(()=>{const E=document.createElement("input");E.type="color",E.style.display="none",document.body.appendChild(E),E.addEventListener("change",function(){const A=this.value,U=O.current;if(!U)return;const W=U.selectionStart,Z=U.selectionEnd,re=o.substring(W,Z),ge=o.substring(0,W),Ve=o.substring(Z);let Oe;re.trim()===""?Oe=`Текст`:Oe=`${re}`;const Ue=ge+Oe+Ve;l(Ue),setTimeout(()=>{U.focus();const ue=W+Oe.length;U.setSelectionRange(ue,ue)},0),document.body.removeChild(this)}),E.addEventListener("cancel",function(){document.body.removeChild(this)}),E.click()},[o]),He=x.useCallback(()=>{const E=O.current;if(!E)return null;const A=E.selectionStart,U=E.selectionEnd,W=A!==U,Z=W?Math.floor((A+U)/2):A,ge=E.value.substring(0,Z).split(` -`),Ve=ge.length-1,Oe=ge[ge.length-1],Ue=E.getBoundingClientRect(),ue=window.getComputedStyle(E),lt=parseInt(ue.lineHeight)||20,Zn=parseInt(ue.paddingTop)||0,mt=parseInt(ue.paddingLeft)||0,ze=document.createElement("span");ze.style.position="absolute",ze.style.visibility="hidden",ze.style.whiteSpace="pre",ze.style.font=ue.font,ze.textContent=Oe,document.body.appendChild(ze);const Qe=ze.offsetWidth;document.body.removeChild(ze);const It=Ue.top+Zn+Ve*lt+lt/2,et=Ue.left+mt+Qe;return{top:It,left:et,hasSelection:W}},[]),$e=x.useCallback(()=>{if(X){j(!1);return}const E=o.trim().length>0,A=He();if(A&&E)if(N({top:A.top,left:A.left}),D(A.hasSelection),j(!0),A.hasSelection){const U=V();q(U)}else q({bold:!1,italic:!1,strikethrough:!1});else j(!1),D(!1),q({bold:!1,italic:!1,strikethrough:!1})},[X,o,He,V]),hi=()=>{var E;(E=b.current)==null||E.click()},mi=()=>{var E;(E=P.current)==null||E.click()},gi=E=>{const U=Array.from(E.target.files||[]).filter(W=>W.type.startsWith("image/")&&W.size<=10*1024*1024);if(U.length+d.length>10){J("Можно загрузить максимум 10 изображений","warning");return}f([...d,...U]),b.current&&(b.current.value="")},vi=E=>{const A=Array.from(E.target.files||[]),U=/pdf|doc|docx|xls|xlsx|txt|zip|rar|7z/,W=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","text/plain","application/zip","application/x-zip-compressed","application/x-rar-compressed","application/x-7z-compressed"],Z=A.filter(re=>{var ge;return(W.includes(re.type)||U.test(((ge=re.name.split(".").pop())==null?void 0:ge.toLowerCase())||""))&&re.size<=50*1024*1024});w([...p,...Z]),P.current&&(P.current.value="")},Bl=E=>{if((E.altKey||E.ctrlKey)&&E.key==="Enter")E.preventDefault(),ne();else if(E.key==="Escape")E.preventDefault(),Ae();else if(E.key==="Enter"){const A=E.currentTarget,U=A.selectionStart,W=A.value,Z=W.split(` -`);let re=0,ge="";for(let ue=0;ue=U){ge=Z[ue];break}re+=lt+1}const Ve=[/^(\s*)- \[ \] /,/^(\s*)- \[x\] /i,/^(\s*)- /,/^(\s*)\* /,/^(\s*)\+ /,/^(\s*)(\d+)\. /,/^(\s*)(\w+)\. /,/^(\s*)1\. /];let Oe=null,Ue=null;for(const ue of Ve){const lt=ge.match(ue);if(lt){Oe=lt,ue===Ve[0]||ue===Ve[1]?Ue="checkbox":ue===Ve[2]||ue===Ve[3]||ue===Ve[4]?Ue="unordered":ue===Ve[7]?Ue="numbered":Ue="ordered";break}}if(Oe){E.preventDefault();const ue=Oe[1]||"",lt=Oe[0].slice(ue.length);if(ge.slice(Oe[0].length).trim()===""){const mt=W.substring(0,U),ze=W.substring(U),Qe=mt.replace(/\n\s*- \[ \] \s*$|\n\s*- \[x\] \s*$|\n\s*[-*+]\s*$|\n\s*\d+\.\s*$|\n\s*\w+\.\s*$/i,` -`),It=Qe+ze;l(It),setTimeout(()=>{const et=Qe.length;A.setSelectionRange(et,et)},0)}else{const mt=W.substring(0,U),ze=W.substring(U);let Qe="";if(Ue==="checkbox")Qe=ue+"- [ ] ";else if(Ue==="unordered")Qe=ue+lt;else if(Ue==="ordered"){const Et=parseInt(Oe[2])+1,Ct=Oe[2].replace(/\d+/,Et.toString());Qe=ue+Ct+". "}else Ue==="numbered"&&(Qe=ue+"1. ");const It=mt+` -`+Qe+ze;l(It),setTimeout(()=>{const et=U+1+Qe.length;A.setSelectionRange(et,et)},0)}}}},Wl=()=>{u(!0)};x.useEffect(()=>{if(!i)return;const E=O.current;if(!E)return;const A=()=>{E.style.height="auto",E.style.height=E.scrollHeight+"px"};return E.addEventListener("input",A),A(),()=>{E.removeEventListener("input",A)}},[i,o]),x.useEffect(()=>{i&&O.current&&!X&&setTimeout(()=>{var A;(A=O.current)==null||A.focus();const E=O.current;E&&E.setSelectionRange(o.length,o.length)},100)},[i,X,o]),x.useEffect(()=>{if(!i)return;const E=O.current;if(!E||X)return;const A=()=>{setTimeout($e,0)},U=re=>{re.buttons===1&&setTimeout($e,0)},W=()=>{setTimeout($e,0)},Z=re=>{const ge=re.target;if(ge===E||E.contains(ge)){const Ve=E.value.trim().length>0,Oe=E.selectionStart!==E.selectionEnd;Ve&&Oe&&(re.preventDefault(),re.stopPropagation())}};return E.addEventListener("mouseup",A),E.addEventListener("mousemove",U),E.addEventListener("keyup",W),E.addEventListener("contextmenu",Z),document.addEventListener("selectionchange",$e),document.addEventListener("contextmenu",Z,!0),()=>{E.removeEventListener("mouseup",A),E.removeEventListener("mousemove",U),E.removeEventListener("keyup",W),E.removeEventListener("contextmenu",Z),document.removeEventListener("selectionchange",$e),document.removeEventListener("contextmenu",Z,!0)}},[i,H,$e]),x.useEffect(()=>{if(!i)return;const E=A=>{const U=O.current,W=A.target,Z=document.querySelector(".floating-toolbar");Z&&Z.contains(W)||U&&!U.contains(W)&&setTimeout(()=>{U.selectionStart===U.selectionEnd&&j(!1)},0)};return document.addEventListener("mousedown",E),()=>{document.removeEventListener("mousedown",E)}},[i]),x.useEffect(()=>{if(!i||!C)return;const E=()=>{const U=He();if(U&&(N({top:U.top,left:U.left}),D(U.hasSelection),U.hasSelection)){const W=V();q(W)}},A=O.current;return A&&(A.addEventListener("scroll",E),window.addEventListener("scroll",E,!0)),()=>{A&&A.removeEventListener("scroll",E),window.removeEventListener("scroll",E,!0)}},[i,C,He,V]);const Xn=()=>{u(!1),n(e.id)},yi=E=>E?E.length>5&&E.match(/^\d{2}:\d{2}/)?E.substring(0,5):E:E||"",Jn=()=>{if(e.created_at){const E=Zu(e.created_at),U=Up(E).replace(/(\d{2}\.\d{2}\.\d{4} \d{2}:\d{2})\d*.*/,"$1");if(e.updated_at&&e.created_at!==e.updated_at){const W=Zu(e.updated_at),re=Up(W).replace(/(\d{2}\.\d{2}\.\d{4} \d{2}:\d{2})\d*.*/,"$1");return c.jsxs(c.Fragment,{children:[U,c.jsx("span",{className:"date-separator",children:" | "}),c.jsx(F,{icon:"mdi:pencil",style:{fontSize:"12px",margin:"0 2px"}}),re]})}else return U}else{const E=yi(e.time);return`${e.date} ${E}`}},dn=()=>{let E=e.content;$&&(E=WN(E,$));const A=BN(E);return _d(A)},Hl=E=>{var U;const A=((U=E.split(".").pop())==null?void 0:U.toLowerCase())||"";return A==="pdf"?"mdi:file-pdf":["doc","docx"].includes(A)?"mdi:file-word":["xls","xlsx"].includes(A)?"mdi:file-excel":A==="txt"?"mdi:file-document":["zip","rar","7z"].includes(A)?"mdi:folder-zip":"mdi:file"},Vl=E=>(E/1024/1024).toFixed(2)+" MB",iy=E=>{const A=document.getElementById("imageModal"),U=document.getElementById("modalImage");A&&U&&(U.setAttribute("src",E),A.style.display="block")},sy=(E,A)=>{E.stopPropagation(),oe(rl(A))},oy=()=>{z(!K)};return x.useEffect(()=>{if(i){z(!1),se(!1);return}if(!L.current)return;const A=setTimeout(()=>{const U=L.current;if(!U)return;const W=U.classList.contains("collapsed");W&&U.classList.remove("collapsed");const Z=U.scrollHeight;W&&!K&&U.classList.add("collapsed");const re=Z>300;se(re)},100);return()=>clearTimeout(A)},[e.content,i,K]),x.useEffect(()=>{z(!1)},[e.id]),c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:`container ${e.is_pinned?"note-pinned":""}`,"data-note-id":e.id,children:[c.jsxs("div",{className:"date",children:[c.jsxs("span",{className:"date-text",children:[Jn(),e.is_pinned?c.jsxs("span",{className:"pin-indicator",children:[c.jsx(F,{icon:"mdi:pin"}),"Закреплено"]}):null]}),c.jsxs("div",{className:"note-actions",children:[c.jsx("div",{className:"notesHeaderBtn",onClick:()=>t(e.id),title:e.is_pinned?"Открепить":"Закрепить",children:c.jsx(F,{icon:e.is_pinned?"mdi:pin-off":"mdi:pin"})}),c.jsx("div",{className:"notesHeaderBtn",onClick:le,title:"Редактировать",children:c.jsx(F,{icon:"mdi:pencil"})}),c.jsx("div",{className:"notesHeaderBtn",onClick:Wl,title:"В архив",children:c.jsx(F,{icon:"mdi:delete"})})]})]}),i?c.jsxs("div",{className:"note-edit-mode",children:[c.jsx(Xv,{onInsert:Y,onImageClick:hi,onFileClick:mi,onPreviewToggle:xe,isPreviewMode:X}),c.jsx("input",{ref:b,type:"file",id:"imageInput",accept:"image/*",multiple:!0,style:{display:"none"},onChange:gi}),c.jsx("input",{ref:P,type:"file",id:"fileInput",accept:".pdf,.doc,.docx,.xls,.xlsx,.txt,.zip,.rar,.7z",multiple:!0,style:{display:"none"},onChange:vi}),!X&&c.jsxs(c.Fragment,{children:[c.jsx("textarea",{ref:O,className:"textInput",value:o,onChange:E=>l(E.target.value),onKeyDown:Bl,style:{minHeight:"100px"},onContextMenu:E=>{const A=O.current;if(A){const U=A.value.trim().length>0,W=A.selectionStart!==A.selectionEnd;U&&W&&E.preventDefault()}}}),c.jsx(Jv,{textareaRef:O,onFormat:Y,visible:C,position:S,onHide:()=>j(!1),onInsertColor:de,activeFormats:M,hasSelection:_})]}),X&&c.jsx(ey,{content:o}),e.images&&e.images.length>0&&c.jsxs("div",{className:"image-preview-container",style:{display:"block"},children:[c.jsx("div",{className:"image-preview-header",children:c.jsx("span",{children:"Прикрепленные изображения:"})}),c.jsx("div",{className:"image-preview-list",children:e.images.filter(E=>!h.includes(E.id)).map(E=>{const A=Ma(E.file_path,e.id,E.id);return c.jsxs("div",{className:"image-preview-item",children:[c.jsx("img",{src:A,alt:E.original_name,className:"image-preview-thumbnail"}),c.jsx("button",{className:"image-preview-remove",onClick:()=>Lt(E.id),title:"Удалить",children:c.jsx(F,{icon:"mdi:close"})})]},E.id)})})]}),h.length>0&&c.jsxs("div",{className:"image-preview-container",style:{display:"block",opacity:.5},children:[c.jsx("div",{className:"image-preview-header",children:c.jsx("span",{children:"Изображения для удаления:"})}),c.jsx("div",{className:"image-preview-list",children:e.images.filter(E=>h.includes(E.id)).map(E=>{const A=Ma(E.file_path,e.id,E.id);return c.jsxs("div",{className:"image-preview-item",children:[c.jsx("img",{src:A,alt:E.original_name,className:"image-preview-thumbnail",style:{opacity:.5}}),c.jsx("button",{className:"image-preview-remove restore-btn",onClick:()=>Ce(E.id),title:"Восстановить",children:c.jsx(F,{icon:"mdi:restore"})})]},E.id)})})]}),e.files&&e.files.length>0&&c.jsxs("div",{className:"file-preview-container",style:{display:"block"},children:[c.jsx("div",{className:"file-preview-header",children:c.jsx("span",{children:"Прикрепленные файлы:"})}),c.jsx("div",{className:"file-preview-list",children:e.files.filter(E=>!k.includes(E.id)).map(E=>c.jsxs("div",{className:"file-preview-item",children:[c.jsx(F,{icon:Hl(E.original_name),className:"file-icon"}),c.jsxs("div",{className:"file-info",children:[c.jsx("div",{className:"file-name",children:E.original_name}),c.jsx("div",{className:"file-size",children:Vl(E.file_size)})]}),c.jsx("button",{className:"file-preview-remove",onClick:()=>_e(E.id),title:"Удалить",children:c.jsx(F,{icon:"mdi:close"})})]},E.id))})]}),k.length>0&&c.jsxs("div",{className:"file-preview-container",style:{display:"block",opacity:.5},children:[c.jsx("div",{className:"file-preview-header",children:c.jsx("span",{children:"Файлы для удаления:"})}),c.jsx("div",{className:"file-preview-list",children:e.files.filter(E=>k.includes(E.id)).map(E=>c.jsxs("div",{className:"file-preview-item",children:[c.jsx(F,{icon:Hl(E.original_name),className:"file-icon",style:{opacity:.5}}),c.jsxs("div",{className:"file-info",children:[c.jsx("div",{className:"file-name",style:{opacity:.5},children:E.original_name}),c.jsx("div",{className:"file-size",style:{opacity:.5},children:Vl(E.file_size)})]}),c.jsx("button",{className:"file-preview-remove restore-btn",onClick:()=>Pe(E.id),title:"Восстановить",children:c.jsx(F,{icon:"mdi:restore"})})]},E.id))})]}),c.jsx(ty,{images:d,onChange:f}),c.jsx(ny,{files:p,onChange:w}),c.jsxs("div",{className:"save-button-container",children:[c.jsxs("div",{className:"action-buttons",children:[G&&c.jsxs("button",{className:"btnSave btnAI",onClick:R,disabled:m,title:"Улучшить или создать текст через ИИ",children:[c.jsx(F,{icon:"mdi:robot"}),m?"Обработка...":"Помощь ИИ"]}),c.jsx("button",{className:"btnSave",onClick:ne,children:"Сохранить"}),c.jsx("button",{className:"btn-secondary",onClick:Ae,children:"Отмена"})]}),c.jsx("span",{className:"save-hint",children:"Alt + Enter для сохранения, Esc для отмены"})]})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:L,className:`textNote ${Q&&!K?"collapsed":""}`,"data-original-content":e.content,dangerouslySetInnerHTML:{__html:dn()},onClick:E=>{const A=E.target;if(A.classList.contains("tag-in-note")){const U=A.getAttribute("data-tag");U&&sy(E,U)}}}),Q&&c.jsxs("button",{className:"show-more-btn",onClick:oy,type:"button",children:[c.jsx(F,{icon:K?"mdi:chevron-up":"mdi:chevron-down"}),c.jsx("span",{children:K?"Скрыть":"Раскрыть"})]}),e.images&&e.images.length>0&&c.jsx("div",{className:"note-images-container",children:e.images.map(E=>{const A=Ma(E.file_path,e.id,E.id);return c.jsx("div",{className:"note-image-item",children:c.jsx("img",{src:A,alt:E.original_name,className:"note-image lazy","data-src":A,"data-image-id":E.id,loading:"lazy",onClick:()=>iy(A)})},E.id)})}),e.files&&e.files.length>0&&c.jsx("div",{className:"note-files-container",children:e.files.map(E=>{const A=GN(E.file_path,e.id,E.id);return c.jsx("div",{className:"note-file-item",children:c.jsxs("a",{href:A,download:E.original_name,className:"note-file-link","data-file-id":E.id,children:[c.jsx(F,{icon:Hl(E.original_name),className:"file-icon"}),c.jsxs("div",{className:"file-info",children:[c.jsx("div",{className:"file-name",children:E.original_name}),c.jsx("div",{className:"file-size",children:Vl(E.file_size)})]})]})},E.id)})})]})]}),c.jsx(Pd,{isOpen:a,onClose:()=>u(!1),onConfirm:Xn,title:"Подтверждение архивирования",message:"Архивировать эту заметку? Её можно будет восстановить из настроек.",confirmText:"Архивировать",cancelText:"Отмена"})]})},KN=x.forwardRef((e,t)=>{const n=ye(h=>h.notes.notes),r=ye(h=>h.auth.userId),i=ye(h=>h.notes.searchQuery),s=ye(h=>h.notes.selectedDate),o=ye(h=>h.notes.selectedTag),l=ot(),{showNotification:a}=Tr(),u=async()=>{try{const h=await Ge.getAll();let v=h;r&&(v=h.filter(g=>g.user_id===r)),l(n1(v));let k;i||s||o?(k=await Ge.search({q:i||void 0,date:s||void 0,tag:o||void 0}),r&&(k=k.filter(g=>g.user_id===r))):k=v,l(t1(k))}catch(h){console.error("Ошибка загрузки заметок:",h),a("Ошибка загрузки заметок","error")}};x.useEffect(()=>{r&&u()},[r,i,s,o]),x.useImperativeHandle(t,()=>({reloadNotes:u}));const d=async h=>{try{await Ge.delete(h),a("Заметка удалена","success"),u()}catch(v){console.error("Ошибка удаления заметки:",v),a("Ошибка удаления заметки","error")}},f=async h=>{try{await Ge.pin(h),u()}catch(v){console.error("Ошибка закрепления заметки:",v),a("Ошибка закрепления заметки","error")}},p=async h=>{try{await Ge.archive(h),a("Заметка архивирована","success"),u()}catch(v){console.error("Ошибка архивирования заметки:",v),a("Ошибка архивирования заметки","error")}};if(n.length===0){let h="Заметок пока нет. Создайте первую!";return s&&o?h=`Нет заметок за ${s} с тегом #${o}`:s?h=`Нет заметок за выбранную дату (${s})`:o?h=`Нет заметок с тегом #${o}`:i&&(h="Ничего не найдено по запросу"),c.jsx("div",{className:"notes-container",children:c.jsx("p",{className:"empty-message",children:h})})}const w=[...n].sort((h,v)=>{if(h.is_pinned!==v.is_pinned)return v.is_pinned-h.is_pinned;if(h.is_pinned&&v.is_pinned){const m=h.pinned_at?new Date(h.pinned_at).getTime():0;return(v.pinned_at?new Date(v.pinned_at).getTime():0)-m}const k=new Date(h.created_at).getTime();return new Date(v.created_at).getTime()-k});return c.jsx("div",{className:"notes-container",children:w.map(h=>c.jsx(YN,{note:h,onDelete:d,onPin:f,onArchive:p,onReload:u},h.id))})}),XN=()=>{const[e,t]=x.useState(!1),[n,r]=x.useState("");x.useEffect(()=>{const o=l=>{const a=l.target;if(a.classList.contains("note-image")){const u=a.getAttribute("src")||a.getAttribute("data-src");u&&(r(u),t(!0))}};return document.addEventListener("click",o),()=>{document.removeEventListener("click",o)}},[]),x.useEffect(()=>{const o=l=>{l.key==="Escape"&&e&&t(!1)};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[e]);const i=()=>{t(!1)},s=o=>{o.target===o.currentTarget&&i()};return e?c.jsxs("div",{id:"imageModal",className:"image-modal",style:{display:"block"},onClick:s,children:[c.jsx("span",{className:"image-modal-close",onClick:i,children:"×"}),c.jsx("img",{className:"image-modal-content",id:"modalImage",src:n,alt:"Preview"})]}):null},JN=()=>{const e=ye(v=>v.notes.allNotes),t=x.useRef(null),[n,r]=x.useState(!1),i=ot(),s=ye(v=>v.notes.selectedDate),o=ye(v=>v.notes.selectedTag),l=ye(v=>v.notes.searchQuery),a=!!(s||o||l),u=()=>{i(Fu(null)),i(rl(null)),i(Uu(""))},f=(()=>{const v=[];return l&&v.push(`Поиск: "${l}"`),s&&v.push(`Дата: ${s}`),o&&v.push(`Тег: #${o}`),v})(),p=()=>{t.current&&t.current.reloadNotes()},w=()=>{r(!n)},h=()=>{r(!1)};return c.jsxs(c.Fragment,{children:[c.jsx(VN,{isOpen:n,onClose:h}),c.jsx(HN,{notes:e}),c.jsxs("div",{className:"center",children:[c.jsxs("div",{className:"container",children:[c.jsx(GE,{onToggleSidebar:w}),a&&c.jsxs("div",{className:"filter-indicator",children:[c.jsxs("span",{className:"filter-indicator-text",children:["Фильтр: ",f.join(", ")]})," ",c.jsx("button",{onClick:u,children:"✕"})]}),c.jsx(qN,{onSave:p})]}),c.jsx(KN,{ref:t}),c.jsx("div",{className:"footer",children:c.jsxs("p",{children:["Создатель: ",c.jsx("span",{children:"Fovway"})]})})]}),c.jsx(XN,{})]})},ZN=()=>{const e=Kn(),t=ot(),{showNotification:n}=Tr(),[r,i]=x.useState(""),[s,o]=x.useState(""),[l,a]=x.useState(null),[u,d]=x.useState(!1),[f,p]=x.useState(""),[w,h]=x.useState(""),[v,k]=x.useState(""),[g,m]=x.useState(!1),[y,C]=x.useState(""),[j,S]=x.useState(!1),N=x.useRef(null);x.useEffect(()=>{_()},[]);const _=async()=>{try{const z=await ct.getProfile();t(od(z)),i(z.username||""),o(z.email||"");const Q=z.accent_color||"#007bff";t(il(Q)),Cs(Q),z.avatar?(a(z.avatar),d(!0)):(a(null),d(!1));try{const se=await ct.getAiSettings();t(ld(se))}catch(se){console.error("Ошибка загрузки AI настроек:",se)}}catch(z){console.error("Ошибка загрузки профиля:",z),n("Ошибка загрузки данных профиля","error")}},D=async z=>{var O,b,P;const Q=(O=z.target.files)==null?void 0:O[0];if(!Q)return;if(Q.size>5*1024*1024){n("Файл слишком большой. Максимальный размер: 5 МБ","error");return}if(!["image/jpeg","image/jpg","image/png","image/gif"].includes(Q.type)){n("Недопустимый формат файла. Используйте JPG, PNG или GIF","error");return}try{const L=await ct.uploadAvatar(Q);a(L.avatar+"?t="+Date.now()),d(!0),await _(),n("Аватарка успешно загружена","success")}catch(L){console.error("Ошибка загрузки аватарки:",L),n(((P=(b=L.response)==null?void 0:b.data)==null?void 0:P.error)||"Ошибка загрузки аватарки","error")}N.current&&(N.current.value="")},M=async()=>{var z,Q;try{await ct.deleteAvatar(),a(null),d(!1),await _(),n("Аватарка успешно удалена","success")}catch(se){console.error("Ошибка удаления аватарки:",se),n(((Q=(z=se.response)==null?void 0:z.data)==null?void 0:Q.error)||"Ошибка удаления аватарки","error")}},q=async()=>{var z,Q;if(!r.trim()){n("Логин не может быть пустым","error");return}if(r.length<3){n("Логин должен быть не менее 3 символов","error");return}if(s&&!K(s)){n("Некорректный email адрес","error");return}try{await ct.updateProfile({username:r.trim(),email:s.trim()||void 0}),await _(),n("Профиль успешно обновлен","success")}catch(se){console.error("Ошибка обновления профиля:",se),n(((Q=(z=se.response)==null?void 0:z.data)==null?void 0:Q.error)||"Ошибка обновления профиля","error")}},X=async()=>{var z,Q;if(!f){n("Введите текущий пароль","error");return}if(!w){n("Введите новый пароль","error");return}if(w.length<6){n("Новый пароль должен быть не менее 6 символов","error");return}if(w!==v){n("Новый пароль и подтверждение не совпадают","error");return}try{await ct.updateProfile({currentPassword:f,newPassword:w}),p(""),h(""),k(""),n("Пароль успешно изменен","success")}catch(se){console.error("Ошибка изменения пароля:",se),n(((Q=(z=se.response)==null?void 0:z.data)==null?void 0:Q.error)||"Ошибка изменения пароля","error")}},te=async()=>{var z,Q;if(!y.trim()){n("Введите пароль","warning");return}S(!0);try{await ct.deleteAccount(y),n("Аккаунт успешно удален","success"),t(fr()),setTimeout(()=>{e("/")},2e3)}catch(se){console.error("Ошибка удаления аккаунта:",se),n(((Q=(z=se.response)==null?void 0:z.data)==null?void 0:Q.error)||"Ошибка удаления аккаунта","error"),S(!1)}},K=z=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(z);return c.jsxs("div",{className:"container",children:[c.jsxs("header",{className:"notes-header",children:[c.jsxs("span",{children:[c.jsx(F,{icon:"mdi:account"})," Личный кабинет"]}),c.jsxs("div",{className:"user-info",children:[c.jsx(Ds,{}),c.jsx("button",{className:"notes-btn",onClick:()=>e("/notes"),title:"К заметкам",children:c.jsx(F,{icon:"mdi:note-text"})}),c.jsx("button",{className:"settings-btn",onClick:()=>e("/settings"),title:"Настройки",children:c.jsx(F,{icon:"mdi:cog"})}),c.jsx("button",{className:"logout-btn",title:"Выйти",onClick:async()=>{try{await Sr.logout(),t(fr()),e("/")}catch(z){console.error("Ошибка выхода:",z),t(fr()),e("/")}},children:c.jsx(F,{icon:"mdi:logout"})})]})]}),c.jsxs("div",{className:"profile-container",children:[c.jsxs("div",{className:"avatar-section",children:[c.jsx("div",{className:"avatar-wrapper",children:u&&l?c.jsx("img",{src:l,alt:"Аватар",className:"avatar-preview",loading:"lazy"}):c.jsx("div",{className:"avatar-placeholder",children:c.jsx(F,{icon:"mdi:account"})})}),c.jsxs("div",{className:"avatar-buttons",children:[c.jsxs("label",{htmlFor:"avatarInput",className:"btn-upload",children:[c.jsx(F,{icon:"mdi:upload"})," Загрузить аватар"]}),c.jsx("input",{ref:N,type:"file",id:"avatarInput",accept:"image/*",style:{display:"none"},onChange:D}),u&&c.jsxs("button",{className:"btn-delete",onClick:M,children:[c.jsx(F,{icon:"mdi:delete"})," Удалить"]})]}),c.jsx("p",{className:"avatar-hint",children:"Максимальный размер: 5 МБ. Форматы: JPG, PNG, GIF"})]}),c.jsxs("div",{className:"profile-form",children:[c.jsx("h3",{children:"Данные профиля"}),c.jsxs("div",{className:"form-group",children:[c.jsx("label",{htmlFor:"username",children:"Логин"}),c.jsx("input",{type:"text",id:"username",placeholder:"Логин",minLength:3,value:r,onChange:z=>i(z.target.value)})]}),c.jsxs("div",{className:"form-group",children:[c.jsx("label",{htmlFor:"email",children:"Email (необязательно)"}),c.jsx("input",{type:"email",id:"email",placeholder:"example@example.com",value:s,onChange:z=>o(z.target.value)})]}),c.jsx("button",{className:"btnSave",onClick:q,children:"Сохранить изменения"}),c.jsx("hr",{className:"separator"}),c.jsx("h3",{children:"Изменить пароль"}),c.jsxs("div",{className:"form-group",children:[c.jsx("label",{htmlFor:"currentPassword",children:"Текущий пароль"}),c.jsx("input",{type:"password",id:"currentPassword",placeholder:"Текущий пароль",value:f,onChange:z=>p(z.target.value)})]}),c.jsxs("div",{className:"form-group",children:[c.jsx("label",{htmlFor:"newPassword",children:"Новый пароль"}),c.jsx("input",{type:"password",id:"newPassword",placeholder:"Новый пароль (минимум 6 символов)",minLength:6,value:w,onChange:z=>h(z.target.value)})]}),c.jsxs("div",{className:"form-group",children:[c.jsx("label",{htmlFor:"confirmPassword",children:"Подтвердите новый пароль"}),c.jsx("input",{type:"password",id:"confirmPassword",placeholder:"Подтвердите новый пароль",value:v,onChange:z=>k(z.target.value)})]}),c.jsx("button",{className:"btnSave",onClick:X,children:"Изменить пароль"}),c.jsx("hr",{className:"separator"}),c.jsxs("button",{className:"btn-danger",onClick:()=>m(!0),children:[c.jsx(F,{icon:"mdi:account-remove"})," Удалить аккаунт"]}),c.jsx("p",{style:{color:"#666",fontSize:"14px",marginBottom:"15px"},children:"Удаление аккаунта - это необратимое действие. Все ваши заметки, изображения и данные будут удалены навсегда."})]})]}),c.jsx(Pd,{isOpen:g,onClose:()=>{m(!1),C("")},onConfirm:te,title:"Удаление аккаунта",message:c.jsxs(c.Fragment,{children:[c.jsx("p",{style:{color:"#dc3545",fontWeight:"bold",marginBottom:"15px"},children:"⚠️ ВНИМАНИЕ: Это действие нельзя отменить!"}),c.jsx("p",{style:{marginBottom:"20px"},children:"Вы действительно хотите удалить свой аккаунт? Все ваши заметки, изображения, настройки и данные будут удалены навсегда."}),c.jsxs("div",{style:{marginBottom:"15px"},children:[c.jsx("label",{htmlFor:"deleteAccountPassword",style:{display:"block",marginBottom:"5px",fontWeight:"bold"},children:"Введите пароль для подтверждения:"}),c.jsx("input",{type:"password",id:"deleteAccountPassword",placeholder:"Пароль от аккаунта",className:"modal-password-input",value:y,onChange:z=>C(z.target.value),onKeyPress:z=>{z.key==="Enter"&&!j&&te()}})]})]}),confirmText:j?"Удаление...":"Удалить аккаунт",cancelText:"Отмена",confirmType:"danger"})]})},eT=()=>{const e=Kn(),t=ot(),{showNotification:n}=Tr(),[r,i]=x.useState("appearance"),[s,o]=x.useState("#007bff"),[l,a]=x.useState(""),[u,d]=x.useState(""),[f,p]=x.useState(""),[w,h]=x.useState(!1),[v,k]=x.useState([]),[g,m]=x.useState(!1),[y,C]=x.useState([]),[j,S]=x.useState(0),[N,_]=x.useState(!0),[D,M]=x.useState(""),[q,X]=x.useState(!1),[te,K]=x.useState(!1),[z,Q]=x.useState(""),[se,O]=x.useState(!1),b=50,P=[{color:"#007bff",title:"Синий"},{color:"#28a745",title:"Зеленый"},{color:"#dc3545",title:"Красный"},{color:"#fd7e14",title:"Оранжевый"},{color:"#6f42c1",title:"Фиолетовый"},{color:"#e83e8c",title:"Розовый"}];x.useEffect(()=>{L()},[]),x.useEffect(()=>{r==="archive"?xe():r==="logs"?_e(!0):r==="ai"&&$()},[r]);const L=async()=>{try{const R=await ct.getProfile();t(od(R));const V=R.accent_color||"#007bff";o(V),t(il(V)),Cs(V);try{const Y=await ct.getAiSettings();t(ld(Y))}catch(Y){console.error("Ошибка загрузки AI настроек:",Y)}}catch(R){console.error("Ошибка загрузки информации о пользователе:",R)}},$=async()=>{try{const R=await ct.getAiSettings();a(R.openai_api_key||""),d(R.openai_base_url||""),p(R.openai_model||""),h(R.ai_enabled===1),localStorage.setItem("ai_enabled",R.ai_enabled?"1":"0")}catch(R){console.error("Ошибка загрузки AI настроек:",R)}},H=async()=>{var R,V;try{await ct.updateProfile({accent_color:s}),t(il(s)),Cs(s),await L(),n("Цветовой акцент успешно обновлен","success")}catch(Y){console.error("Ошибка обновления цветового акцента:",Y),n(((V=(R=Y.response)==null?void 0:R.data)==null?void 0:V.error)||"Ошибка обновления","error")}},G=async()=>{var R,V;if(!l.trim()){n("API ключ обязателен","error");return}if(!u.trim()){n("Base URL обязателен","error");return}if(!f.trim()){n("Название модели обязательно","error");return}try{await ct.updateAiSettings({openai_api_key:l,openai_base_url:u,openai_model:f}),n("AI настройки успешно сохранены","success"),le()}catch(Y){console.error("Ошибка сохранения AI настроек:",Y),n(((V=(R=Y.response)==null?void 0:R.data)==null?void 0:V.error)||"Ошибка сохранения","error")}},J=async R=>{var V,Y;if(R&&!oe()){n("Сначала заполните все AI настройки","warning");return}try{await ct.updateAiSettings({ai_enabled:R?1:0}),h(R),localStorage.setItem("ai_enabled",R?"1":"0"),n(R?"Помощь ИИ включена":"Помощь ИИ отключена","success")}catch(de){console.error("Ошибка сохранения настройки AI:",de),n(((Y=(V=de.response)==null?void 0:V.data)==null?void 0:Y.error)||"Ошибка сохранения","error"),h(!R)}},oe=()=>l.trim()&&u.trim()&&f.trim(),le=()=>{oe()||h(!1)},xe=async()=>{m(!0);try{const R=await Ge.getArchived();k(R)}catch(R){console.error("Ошибка загрузки архивных заметок:",R),n("Ошибка загрузки архивных заметок","error")}finally{m(!1)}},ne=async R=>{var V,Y;try{await Ge.unarchive(R),await xe(),n("Заметка восстановлена!","success")}catch(de){console.error("Ошибка восстановления заметки:",de),n(((Y=(V=de.response)==null?void 0:V.data)==null?void 0:Y.error)||"Ошибка восстановления","error")}},Ae=async R=>{var V,Y;try{await Ge.deleteArchived(R),await xe(),n("Заметка удалена окончательно","success")}catch(de){console.error("Ошибка удаления заметки:",de),n(((Y=(V=de.response)==null?void 0:V.data)==null?void 0:Y.error)||"Ошибка удаления","error")}},Lt=async()=>{var R,V;if(!z.trim()){n("Введите пароль","warning");return}O(!0);try{await Ge.deleteAllArchived(z),n("Все архивные заметки удалены","success"),K(!1),Q(""),await xe()}catch(Y){console.error("Ошибка:",Y),n(((V=(R=Y.response)==null?void 0:R.data)==null?void 0:V.error)||"Ошибка удаления","error")}finally{O(!1)}},_e=x.useCallback(async(R=!1)=>{X(!0);try{const V=R?0:j,Y=await QN.getLogs({action_type:D||void 0,limit:b,offset:V});R?(C(Y),S(Y.length)):(C(de=>[...de,...Y]),S(de=>de+Y.length)),_(Y.length===b)}catch(V){console.error("Ошибка загрузки логов:",V),n("Ошибка загрузки логов","error")}finally{X(!1)}},[D,b,n,j]),Ce=R=>{M(R),S(0),_(!0)};x.useEffect(()=>{r==="logs"&&_e(!0)},[D,r,_e]);const Pe=R=>({login:"Вход",logout:"Выход",register:"Регистрация",note_create:"Создание заметки",note_update:"Редактирование",note_delete:"Удаление",note_pin:"Закрепление",note_archive:"Архивирование",note_unarchive:"Восстановление",note_delete_permanent:"Окончательное удаление",profile_update:"Обновление профиля",ai_improve:"Улучшение через AI"})[R]||R;return c.jsxs("div",{className:"container",children:[c.jsxs("header",{className:"notes-header",children:[c.jsxs("span",{children:[c.jsx(F,{icon:"mdi:cog"})," Настройки"]}),c.jsxs("div",{className:"user-info",children:[c.jsx(Ds,{}),c.jsx("button",{className:"notes-btn",onClick:()=>e("/notes"),title:"К заметкам",children:c.jsx(F,{icon:"mdi:note-text"})}),c.jsx("button",{className:"profile-btn",onClick:()=>e("/profile"),title:"Профиль",children:c.jsx(F,{icon:"mdi:account"})}),c.jsx("button",{className:"logout-btn",title:"Выйти",onClick:async()=>{try{await Sr.logout(),t(fr()),e("/")}catch(R){console.error("Ошибка выхода:",R),t(fr()),e("/")}},children:c.jsx(F,{icon:"mdi:logout"})})]})]}),c.jsxs("div",{className:"settings-tabs",children:[c.jsxs("button",{className:`settings-tab ${r==="appearance"?"active":""}`,onClick:()=>i("appearance"),children:[c.jsx(F,{icon:"mdi:palette"})," Внешний вид"]}),c.jsxs("button",{className:`settings-tab ${r==="ai"?"active":""}`,onClick:()=>i("ai"),children:[c.jsx(F,{icon:"mdi:robot"})," AI настройки"]}),c.jsxs("button",{className:`settings-tab ${r==="archive"?"active":""}`,onClick:()=>i("archive"),children:[c.jsx(F,{icon:"mdi:archive"})," Архив заметок"]}),c.jsxs("button",{className:`settings-tab ${r==="logs"?"active":""}`,onClick:()=>i("logs"),children:[c.jsx(F,{icon:"mdi:history"})," История действий"]})]}),c.jsxs("div",{className:"settings-content",children:[r==="appearance"&&c.jsxs("div",{className:"tab-content active",children:[c.jsx("h3",{children:"Внешний вид"}),c.jsxs("div",{className:"form-group",children:[c.jsx("label",{htmlFor:"settings-accentColor",children:"Цветовой акцент"}),c.jsx("div",{className:"accent-color-picker",children:P.map(R=>c.jsx("div",{className:`color-option ${s===R.color?"selected":""}`,"data-color":R.color,style:{backgroundColor:R.color},title:R.title,onClick:()=>o(R.color)},R.color))})]}),c.jsx("button",{className:"btnSave",onClick:H,children:"Сохранить изменения"})]}),r==="ai"&&c.jsxs("div",{className:"tab-content active",children:[c.jsx("h3",{children:"Настройки AI"}),c.jsx("div",{className:"form-group ai-toggle-group",children:c.jsxs("label",{className:`ai-toggle-label ${oe()?"":"disabled"}`,children:[c.jsxs("div",{className:"toggle-label-content",children:[c.jsx("span",{className:"toggle-text-main",children:"Включить помощь ИИ"}),c.jsx("span",{className:"toggle-text-desc",children:oe()?'Показывать кнопку "Помощь ИИ" в редакторах заметок':"Сначала заполните API Key, Base URL и Модель ниже"})]}),c.jsxs("div",{className:"toggle-switch-wrapper",children:[c.jsx("input",{type:"checkbox",id:"ai-enabled-toggle",className:"toggle-checkbox",checked:w,disabled:!oe(),onChange:R=>J(R.target.checked)}),c.jsx("span",{className:"toggle-slider"})]})]})}),c.jsxs("div",{className:"form-group",children:[c.jsx("label",{htmlFor:"openai-api-key",children:"OpenAI API Key"}),c.jsx("input",{type:"password",id:"openai-api-key",placeholder:"sk-...",className:"form-input",value:l,onChange:R=>{a(R.target.value),le()}}),c.jsx("p",{style:{color:"#666",fontSize:"12px",marginTop:"5px"},children:"Введите ваш OpenAI API ключ"})]}),c.jsxs("div",{className:"form-group",children:[c.jsx("label",{htmlFor:"openai-base-url",children:"OpenAI Base URL"}),c.jsx("input",{type:"text",id:"openai-base-url",placeholder:"https://api.openai.com/v1",className:"form-input",value:u,onChange:R=>{d(R.target.value),le()}}),c.jsx("p",{style:{color:"#666",fontSize:"12px",marginTop:"5px"},children:"URL для API запросов (например, https://api.openai.com/v1)"})]}),c.jsxs("div",{className:"form-group",children:[c.jsx("label",{htmlFor:"openai-model",children:"Модель"}),c.jsx("input",{type:"text",id:"openai-model",placeholder:"gpt-3.5-turbo",className:"form-input",value:f,onChange:R=>{p(R.target.value),le()}}),c.jsxs("p",{style:{color:"#666",fontSize:"12px",marginTop:"5px"},children:["Название модели (например, gpt-4, deepseek/deepseek-chat).",c.jsxs("a",{href:"https://openrouter.ai/models",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent-color)"},children:[" ","Список доступных моделей"]})]})]}),c.jsx("button",{className:"btnSave",onClick:G,children:"Сохранить AI настройки"})]}),r==="archive"&&c.jsxs("div",{className:"tab-content active",children:[c.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"10px"},children:[c.jsx("h3",{children:"Архивные заметки"}),c.jsxs("button",{className:"btn-danger",style:{fontSize:"14px",padding:"8px 16px"},onClick:()=>K(!0),children:[c.jsx(F,{icon:"mdi:delete-sweep"})," Удалить все"]})]}),c.jsx("p",{style:{color:"#666",fontSize:"14px",marginBottom:"20px"},children:"Архивированные заметки можно восстановить или удалить окончательно"}),c.jsx("div",{className:"archived-notes-list",children:g?c.jsx("p",{style:{textAlign:"center",color:"#999"},children:"Загрузка..."}):v.length===0?c.jsx("p",{style:{textAlign:"center",color:"#999"},children:"Архив пуст"}):v.map(R=>{const V=new Date(R.created_at.replace(" ","T")+"Z"),Y=new Intl.DateTimeFormat("ru-RU",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(V),de=_d(R.content),He=de.substring(0,200)+(de.length>200?"...":"");return c.jsxs("div",{className:"archived-note-item",children:[c.jsxs("div",{className:"archived-note-header",children:[c.jsx("span",{className:"archived-note-date",children:Y}),c.jsxs("div",{className:"archived-note-actions",children:[c.jsxs("button",{className:"btn-restore",onClick:()=>ne(R.id),title:"Восстановить",children:[c.jsx(F,{icon:"mdi:restore"})," Восстановить"]}),c.jsxs("button",{className:"btn-delete-permanent",onClick:()=>Ae(R.id),title:"Удалить навсегда",children:[c.jsx(F,{icon:"mdi:delete-forever"})," Удалить"]})]})]}),c.jsx("div",{className:"archived-note-content",dangerouslySetInnerHTML:{__html:He}}),R.images&&R.images.length>0&&c.jsxs("div",{className:"archived-note-images",children:[R.images.length," изображений"]})]},R.id)})})]}),r==="logs"&&c.jsxs("div",{className:"tab-content active",children:[c.jsx("h3",{children:"История действий"}),c.jsxs("div",{className:"logs-filters",children:[c.jsxs("select",{id:"logTypeFilter",className:"log-filter-select",value:D,onChange:R=>Ce(R.target.value),children:[c.jsx("option",{value:"",children:"Все действия"}),c.jsx("option",{value:"login",children:"Вход"}),c.jsx("option",{value:"logout",children:"Выход"}),c.jsx("option",{value:"register",children:"Регистрация"}),c.jsx("option",{value:"note_create",children:"Создание заметки"}),c.jsx("option",{value:"note_update",children:"Редактирование заметки"}),c.jsx("option",{value:"note_delete",children:"Удаление заметки"}),c.jsx("option",{value:"note_pin",children:"Закрепление"}),c.jsx("option",{value:"note_archive",children:"Архивирование"}),c.jsx("option",{value:"note_unarchive",children:"Восстановление"}),c.jsx("option",{value:"note_delete_permanent",children:"Окончательное удаление"}),c.jsx("option",{value:"profile_update",children:"Обновление профиля"}),c.jsx("option",{value:"ai_improve",children:"Улучшение через AI"})]}),c.jsxs("button",{className:"btnSave",onClick:()=>_e(!0),children:[c.jsx(F,{icon:"mdi:refresh"})," Обновить"]})]}),c.jsx("div",{className:"logs-table-container",children:c.jsxs("table",{className:"logs-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:"Дата и время"}),c.jsx("th",{children:"Действие"}),c.jsx("th",{children:"Детали"})]})}),c.jsx("tbody",{children:q&&y.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:3,style:{textAlign:"center"},children:"Загрузка..."})}):y.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:3,style:{textAlign:"center",color:"#999"},children:"Логов пока нет"})}):y.map(R=>{const V=new Date(R.created_at.replace(" ","T")+"Z"),Y=new Intl.DateTimeFormat("ru-RU",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(V);return c.jsxs("tr",{children:[c.jsx("td",{children:Y}),c.jsx("td",{children:c.jsx("span",{className:`log-action-badge log-action-${R.action_type}`,children:Pe(R.action_type)})}),c.jsx("td",{children:R.details||"-"})]},R.id)})})]})}),N&&y.length>0&&c.jsx("div",{className:"load-more-container",children:c.jsx("button",{className:"btnSave",onClick:()=>_e(!1),children:"Загрузить еще"})})]})]}),c.jsx(Pd,{isOpen:te,onClose:()=>{K(!1),Q("")},onConfirm:Lt,title:"Подтверждение удаления",message:c.jsxs(c.Fragment,{children:[c.jsx("p",{style:{color:"#dc3545",fontWeight:"bold",marginBottom:"15px"},children:"⚠️ ВНИМАНИЕ: Это действие нельзя отменить!"}),c.jsx("p",{style:{marginBottom:"20px"},children:"Вы действительно хотите удалить ВСЕ архивные заметки? Все заметки и их изображения будут удалены навсегда."}),c.jsxs("div",{style:{marginBottom:"15px"},children:[c.jsx("label",{htmlFor:"deleteAllPassword",style:{display:"block",marginBottom:"5px",fontWeight:"bold"},children:"Введите пароль для подтверждения:"}),c.jsx("input",{type:"password",id:"deleteAllPassword",placeholder:"Пароль от аккаунта",className:"modal-password-input",value:z,onChange:R=>Q(R.target.value),onKeyPress:R=>{R.key==="Enter"&&!se&&Lt()}})]})]}),confirmText:se?"Удаление...":"Удалить все",cancelText:"Отмена",confirmType:"danger"})]})},tT=()=>{const e=ye(n=>n.ui.notifications),t=ot();return c.jsx("div",{className:"notification-stack",children:e.map((n,r)=>c.jsx(nT,{notification:n,index:r,onRemove:()=>t($g(n.id))},n.id))})},nT=({notification:e,index:t,onRemove:n})=>{const[r,i]=x.useState(!1);x.useEffect(()=>{setTimeout(()=>i(!0),100)},[]),x.useEffect(()=>{const o=setTimeout(()=>{s()},4e3);return()=>clearTimeout(o)},[]);const s=()=>{i(!1),setTimeout(n,300)};return c.jsx("div",{className:`notification notification-${e.type} ${r?"visible":""}`,style:{top:`${20+t*70}px`},onClick:s,children:e.message})},rT=()=>c.jsx("div",{className:"loading-overlay",children:c.jsx("div",{className:"loading-content",children:c.jsx("div",{className:"loading-text",children:"Загрузка..."})})}),Da=({children:e})=>{const t=ye(s=>s.auth.isAuthenticated),n=ot(),[r,i]=x.useState(!0);return x.useEffect(()=>{t?(async()=>{try{const o=await Sr.checkStatus();o.authenticated?n(sd({userId:o.userId,username:o.username})):n(fr())}catch{n(fr())}finally{i(!1)}})():i(!1)},[n,t]),r?c.jsx(rT,{}):t?c.jsx(c.Fragment,{children:e}):c.jsx(yg,{to:"/",replace:!0})},iT=()=>{const[e,t]=x.useState(null),[n,r]=x.useState(!1),[i,s]=x.useState(!1);x.useEffect(()=>{if(window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone===!0){s(!0);return}const a=localStorage.getItem("pwa-install-dismissed");if(a){const f=parseInt(a,10);if((Date.now()-f)/(1e3*60*60*24)<7)return}const u=f=>{f.preventDefault(),t(f),setTimeout(()=>r(!0),3e3)},d=()=>{s(!0),r(!1),t(null)};return window.addEventListener("beforeinstallprompt",u),window.addEventListener("appinstalled",d),()=>{window.removeEventListener("beforeinstallprompt",u),window.removeEventListener("appinstalled",d)}},[]);const o=async()=>{if(!e)return;e.prompt();const{outcome:a}=await e.userChoice;a==="accepted"&&(r(!1),s(!0)),t(null)},l=()=>{r(!1),localStorage.setItem("pwa-install-dismissed",Date.now().toString())};return i||!n||!e?null:c.jsxs("div",{className:"pwa-install-prompt",children:[c.jsxs("div",{className:"pwa-install-prompt-content",children:[c.jsx("div",{className:"pwa-install-prompt-icon",children:c.jsx(F,{icon:"mdi:download",width:32,height:32})}),c.jsxs("div",{className:"pwa-install-prompt-text",children:[c.jsx("h3",{children:"Установить NoteJS"}),c.jsx("p",{children:"Установите приложение для быстрого доступа и работы офлайн"})]}),c.jsxs("div",{className:"pwa-install-prompt-actions",children:[c.jsx("button",{className:"pwa-install-btn-primary",onClick:o,children:"Установить"}),c.jsx("button",{className:"pwa-install-btn-secondary",onClick:l,"aria-label":"Закрыть",children:c.jsx(F,{icon:"mdi:close",width:20,height:20})})]})]}),c.jsx("style",{children:` - .pwa-install-prompt { - position: fixed; - bottom: 20px; - left: 50%; - transform: translateX(-50%); - z-index: 10000; - max-width: 400px; - width: calc(100% - 40px); - animation: slideUp 0.3s ease-out; - } - - @keyframes slideUp { - from { - transform: translateX(-50%) translateY(100%); - opacity: 0; - } - to { - transform: translateX(-50%) translateY(0); - opacity: 1; - } - } - - .pwa-install-prompt-content { - background: var(--bg-primary); - border: 1px solid var(--border-primary); - border-radius: 12px; - padding: 16px; - box-shadow: 0 4px 20px var(--shadow-light); - display: flex; - align-items: center; - gap: 12px; - } - - .pwa-install-prompt-icon { - color: var(--accent-color); - flex-shrink: 0; - } - - .pwa-install-prompt-text { - flex: 1; - min-width: 0; - } - - .pwa-install-prompt-text h3 { - margin: 0 0 4px 0; - font-size: 16px; - font-weight: 600; - color: var(--text-primary); - } - - .pwa-install-prompt-text p { - margin: 0; - font-size: 13px; - color: var(--text-primary); - opacity: 0.8; - } - - .pwa-install-prompt-actions { - display: flex; - align-items: center; - gap: 8px; - flex-shrink: 0; - } - - .pwa-install-btn-primary { - background: var(--accent-color); - color: white; - border: none; - border-radius: 8px; - padding: 8px 16px; - font-size: 14px; - font-weight: 500; - cursor: pointer; - transition: opacity 0.2s; - } - - .pwa-install-btn-primary:hover { - opacity: 0.9; - } - - .pwa-install-btn-primary:active { - opacity: 0.8; - } - - .pwa-install-btn-secondary { - background: transparent; - color: var(--text-primary); - border: none; - padding: 4px; - cursor: pointer; - border-radius: 4px; - display: flex; - align-items: center; - justify-content: center; - transition: background 0.2s; - } - - .pwa-install-btn-secondary:hover { - background: var(--border-primary); - } - - @media (max-width: 480px) { - .pwa-install-prompt-content { - flex-direction: column; - text-align: center; - } - - .pwa-install-prompt-actions { - width: 100%; - justify-content: center; - } - - .pwa-install-btn-primary { - flex: 1; - } - } - `})]})},sT=()=>(Tv(),c.jsxs(c.Fragment,{children:[c.jsx(tT,{}),c.jsx(iT,{}),c.jsx($x,{children:c.jsxs(Px,{children:[c.jsx(rr,{path:"/",element:c.jsx(QE,{})}),c.jsx(rr,{path:"/register",element:c.jsx(qE,{})}),c.jsx(rr,{path:"/notes",element:c.jsx(Da,{children:c.jsx(JN,{})})}),c.jsx(rr,{path:"/profile",element:c.jsx(Da,{children:c.jsx(ZN,{})})}),c.jsx(rr,{path:"/settings",element:c.jsx(Da,{children:c.jsx(eT,{})})}),c.jsx(rr,{path:"*",element:c.jsx(yg,{to:"/",replace:!0})})]})})]})),oT=()=>c.jsx(ak,{store:p1,children:c.jsx(sT,{})}),lT="modulepreload",aT=function(e){return"/"+e},Yp={},uT=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(n.map(a=>{if(a=aT(a),a in Yp)return;Yp[a]=!0;const u=a.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${a}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":lT,u||(f.as="script"),f.crossOrigin="",f.href=a,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((p,w)=>{f.addEventListener("load",p),f.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${a}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})};function cT(e={}){const{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:s,onRegisterError:o}=e;let l,a,u;const d=async(p=!0)=>{await a,await(u==null?void 0:u())};async function f(){if("serviceWorker"in navigator){if(l=await uT(async()=>{const{Workbox:p}=await import("./workbox-window.prod.es5-B9K5rw8f.js");return{Workbox:p}},[]).then(({Workbox:p})=>new p("/sw.js",{scope:"/",type:"classic"})).catch(p=>{o==null||o(p)}),!l)return;u=async()=>{await(l==null?void 0:l.messageSkipWaiting())};{let p=!1;const w=()=>{p=!0,l==null||l.addEventListener("controlling",h=>{h.isUpdate&&window.location.reload()}),n==null||n()};l.addEventListener("installed",h=>{typeof h.isUpdate>"u"?typeof h.isExternal<"u"?h.isExternal?w():!p&&(r==null||r()):h.isExternal?window.location.reload():!p&&(r==null||r()):h.isUpdate||r==null||r()}),l.addEventListener("waiting",w),l.addEventListener("externalwaiting",w)}l.register({immediate:t}).then(p=>{s?s("/sw.js",p):i==null||i(p)}).catch(p=>{o==null||o(p)})}}return a=f(),d}"serviceWorker"in navigator&&cT({onNeedRefresh(){console.log("Доступно новое обновление приложения")},onOfflineReady(){console.log("Приложение готово к работе офлайн")}})();Aa.createRoot(document.getElementById("root")).render(c.jsx(Jt.StrictMode,{children:c.jsx(oT,{})})); diff --git a/backend/public/assets/index-DK8OUj6L.css b/backend/public/assets/index-DK8OUj6L.css new file mode 100644 index 0000000..bc7f53c --- /dev/null +++ b/backend/public/assets/index-DK8OUj6L.css @@ -0,0 +1 @@ +body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}:root{--accent-color: #007bff}[data-theme=light]{--bg-color: #ffffff;--text-color: #333333;--border-color: #e0e0e0;--shadow: rgba(0, 0, 0, .1)}[data-theme=dark]{--bg-color: #1a1a1a;--text-color: #e0e0e0;--border-color: #333333;--shadow: rgba(0, 0, 0, .5)}body{background-color:var(--bg-color);color:var(--text-color)}:root{--accent-color: #007bff;--accent-color-rgb: 0, 123, 255;--bg-primary: #f5f5f5;--bg-secondary: #ffffff;--bg-tertiary: #f8f9fa;--bg-quaternary: #e9ecef;--bg-hover: #e7f3ff;--text-primary: #333333;--text-secondary: #666666;--text-muted: #999999;--text-light: #757575;--border-primary: #e0e0e0;--border-secondary: #dddddd;--border-focus: var(--accent-color);--shadow-light: rgba(0, 0, 0, .1);--shadow-medium: rgba(0, 0, 0, .15);--icon-search: #2196f3;--icon-tags: #4caf50;--icon-notes: #ff9800;--icon-user: #9c27b0;--icon-danger: #dc3545}[data-theme=dark]{--bg-primary: #1a1a1a;--bg-secondary: #2d2d2d;--bg-tertiary: #3a3a3a;--bg-quaternary: #4a4a4a;--bg-hover: #2a4a6b;--text-primary: #ffffff;--text-secondary: #cccccc;--text-muted: #999999;--text-light: #aaaaaa;--border-primary: #404040;--border-secondary: #555555;--border-focus: var(--accent-color);--shadow-light: rgba(0, 0, 0, .3);--shadow-medium: rgba(0, 0, 0, .4);--icon-search: #64b5f6;--icon-tags: #81c784;--icon-notes: #ffb74d;--icon-user: #ba68c8;--icon-danger: #f44336}*{margin:0;padding:0;box-sizing:border-box}body{font-family:Open Sans,sans-serif;margin:0;background:var(--bg-primary);color:var(--text-primary);display:flex;flex-direction:row;justify-content:center;align-items:flex-start;gap:30px;padding:0 15px;transition:background-color .3s ease,color .3s ease}#root{display:contents}.notification-stack{position:fixed;top:0;left:0;right:0;z-index:10000;pointer-events:none}.notification-stack .notification{pointer-events:all}.iconify{font-size:16px;vertical-align:middle;display:inline-block;width:1em;height:1em}button{-webkit-tap-highlight-color:transparent;-moz-tap-highlight-color:transparent;tap-highlight-color:transparent;outline:none;box-shadow:none}button:focus,button:active{outline:none;box-shadow:none}input[type=button],input[type=submit],input[type=reset],a,div[role=button]{-webkit-tap-highlight-color:transparent;-moz-tap-highlight-color:transparent;tap-highlight-color:transparent;outline:none;box-shadow:none}input[type=button]:focus,input[type=submit]:focus,input[type=reset]:focus,a:focus,div[role=button]:focus,input[type=button]:active,input[type=submit]:active,input[type=reset]:active,a:active,div[role=button]:active{outline:none;box-shadow:none}iconify-icon{font-size:16px;vertical-align:middle;display:inline-block;width:1em;height:1em}header .iconify{font-size:20px;margin-right:8px}.search-title .iconify,.tags-title .iconify{font-size:14px;margin-right:6px}.colored-icons .iconify svg,.colored-icons iconify-icon svg{fill:currentColor!important}.colored-icons header svg,.colored-icons header img[role=img] svg{fill:currentColor!important}.colored-icons .notes-header-left .iconify,.colored-icons .notes-header-left iconify-icon,.colored-icons header .notes-header-left .iconify,.colored-icons header .notes-header-left iconify-icon,.colored-icons header .notes-header-left svg,.colored-icons header .notes-header span .iconify,.colored-icons header .notes-header span iconify-icon,.colored-icons header .notes-header span svg,.colored-icons .notes-header-left img[src*="data:image/svg"],.colored-icons header .notes-header-left img[src*="data:image/svg"],.colored-icons header .notes-header span img[src*="data:image/svg"]{color:#ff9800!important;fill:#ff9800!important}.colored-icons .notes-header-left svg,.colored-icons header .notes-header-left svg,.colored-icons header .notes-header span svg,.colored-icons .notes-header-left img svg,.colored-icons header .notes-header-left img svg{fill:#ff9800!important}.colored-icons .notes-header-left svg path,.colored-icons header .notes-header-left svg path{fill:#ff9800!important}.colored-icons .settings-icon-btn .iconify,.colored-icons .settings-icon-btn iconify-icon,.colored-icons header button.settings-icon-btn .iconify,.colored-icons header button.settings-icon-btn iconify-icon,.colored-icons .settings-icon-btn svg,.colored-icons header button.settings-icon-btn svg,.colored-icons .settings-icon-btn svg path,.colored-icons header button.settings-icon-btn svg path{color:#607d8b!important;fill:#607d8b!important}.colored-icons .user-avatar-placeholder-mini .iconify,.colored-icons .user-avatar-placeholder-mini iconify-icon,.colored-icons header .user-avatar-placeholder-mini .iconify,.colored-icons header .user-avatar-placeholder-mini iconify-icon,.colored-icons .user-avatar-placeholder-mini svg,.colored-icons header .user-avatar-placeholder-mini svg,.colored-icons .user-avatar-placeholder-mini svg path,.colored-icons header .user-avatar-placeholder-mini svg path{color:#9c27b0!important;fill:#9c27b0!important}.colored-icons .logout-btn .iconify,.colored-icons .logout-btn iconify-icon,.colored-icons header button.logout-btn .iconify,.colored-icons header button.logout-btn iconify-icon,.colored-icons .logout-btn svg,.colored-icons header button.logout-btn svg,.colored-icons .logout-btn svg path,.colored-icons header button.logout-btn svg path{color:#f44336!important;fill:#f44336!important}.colored-icons header .iconify[data-icon="mdi:login"],.colored-icons header iconify-icon[icon="mdi:login"]{color:#2196f3!important;fill:#2196f3!important}.colored-icons header .iconify[data-icon="mdi:account-plus"],.colored-icons header iconify-icon[icon="mdi:account-plus"]{color:#4caf50!important;fill:#4caf50!important}.colored-icons header.notes-header span:first-child .iconify,.colored-icons header.notes-header span:first-child iconify-icon,.colored-icons header.notes-header span:first-child svg,.colored-icons header.notes-header span:first-child svg path{color:#607d8b!important;fill:#607d8b!important}.colored-icons header .notes-btn .iconify,.colored-icons header .notes-btn iconify-icon,.colored-icons header button.notes-btn .iconify,.colored-icons header button.notes-btn iconify-icon,.colored-icons header .notes-btn svg,.colored-icons header button.notes-btn svg,.colored-icons header .notes-btn svg path,.colored-icons header button.notes-btn svg path{color:#ff9800!important;fill:#ff9800!important}.colored-icons header .profile-btn .iconify,.colored-icons header .profile-btn iconify-icon,.colored-icons header button.profile-btn .iconify,.colored-icons header button.profile-btn iconify-icon,.colored-icons header .profile-btn svg,.colored-icons header button.profile-btn svg,.colored-icons header .profile-btn svg path,.colored-icons header button.profile-btn svg path{color:#9c27b0!important;fill:#9c27b0!important}.colored-icons .settings-tab .iconify[data-icon="mdi:palette"],.colored-icons .settings-tab iconify-icon[icon="mdi:palette"]{color:#e91e63!important;fill:#e91e63!important}.colored-icons .settings-tab .iconify[data-icon="mdi:robot"],.colored-icons .settings-tab iconify-icon[icon="mdi:robot"]{color:#ff6f00!important;fill:#ff6f00!important}.colored-icons .settings-tab .iconify[data-icon="mdi:archive"],.colored-icons .settings-tab iconify-icon[icon="mdi:archive"]{color:#ff9800!important;fill:#ff9800!important}.colored-icons .settings-tab .iconify[data-icon="mdi:history"],.colored-icons .settings-tab iconify-icon[icon="mdi:history"]{color:#9c27b0!important;fill:#9c27b0!important}.colored-icons .note-actions .notesHeaderBtn:nth-child(1) .iconify,.colored-icons .note-actions .notesHeaderBtn:nth-child(1) iconify-icon{color:#ff9800!important;fill:#ff9800!important}.colored-icons .note-actions .notesHeaderBtn:nth-child(2) .iconify,.colored-icons .note-actions .notesHeaderBtn:nth-child(2) iconify-icon{color:#2196f3!important;fill:#2196f3!important}.colored-icons .note-actions .notesHeaderBtn:nth-child(3) .iconify,.colored-icons .note-actions .notesHeaderBtn:nth-child(3) iconify-icon{color:#dc3545!important;fill:#dc3545!important}.theme-toggle-btn{width:40px;height:40px;border-radius:50%;border:none;background:var(--bg-secondary);color:var(--text-secondary);cursor:pointer;font-size:18px;transition:all .3s ease;display:flex;align-items:center;justify-content:center;flex-shrink:0}.theme-toggle-btn:hover{background-color:var(--accent-color, #007bff);color:#fff;transform:scale(1.1)}.theme-toggle-btn .iconify{font-size:18px;color:var(--text-secondary);transition:color .3s ease;margin:0}.theme-toggle-btn:hover .iconify{color:#fff}header{font-size:20px;font-weight:700}.notes-header{display:flex;justify-content:space-between;align-items:flex-start;width:100%;box-sizing:border-box}.notes-header-left{display:flex;flex-direction:column;align-items:flex-start;flex:1;min-width:0}.search-section{margin-top:15px;padding-top:15px;border-top:1px solid var(--border-primary)}.search-header{margin-bottom:10px}.search-title{font-size:12px;font-weight:700;color:var(--text-primary)}.search-container{position:relative;width:100%}.search-input{width:100%;padding:6px 30px 6px 10px;border:1px solid var(--border-secondary);border-radius:15px;font-size:12px;background-color:var(--bg-tertiary);color:var(--text-primary);transition:all .3s ease;box-sizing:border-box}.search-input:focus{outline:none;border-color:var(--border-focus);background-color:var(--bg-secondary);box-shadow:0 0 0 2px rgba(var(--accent-color-rgb),.25)}.clear-search-btn{position:absolute;right:6px;top:50%;transform:translateY(-50%);background:none;border:none;color:#999;cursor:pointer;font-size:14px;padding:2px 4px;border-radius:50%;transition:all .2s ease}.clear-search-btn:hover{background-color:var(--bg-quaternary);color:var(--text-secondary)}.filter-indicator{display:inline-flex;align-items:center;margin-top:15px;padding:4px 10px;background-color:rgba(var(--accent-color-rgb),.1);border:1px solid rgba(var(--accent-color-rgb),.3);border-radius:15px;font-size:12px;color:var(--accent-color);font-weight:500;max-width:min(300px,100%);box-sizing:border-box}.filter-indicator-text{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.filter-indicator button{background:none;border:none;color:var(--icon-danger);cursor:pointer;margin-left:8px;font-weight:700;padding:2px 4px;font-size:14px;border-radius:3px;min-width:20px;min-height:20px;display:flex;align-items:center;justify-content:center;transition:all .2s ease}.filter-indicator button:hover{color:#ff6b6b;background-color:#ff6b6b1a}.user-info{display:flex;align-items:center;gap:15px;flex-shrink:0}.user-info span{font-size:14px;color:#666;font-weight:500}.user-avatar-mini{width:40px;height:40px;border-radius:50%;overflow:hidden;cursor:pointer;transition:all .3s ease;border:2px solid var(--accent-color, #007bff);flex-shrink:0}.user-avatar-mini:hover{transform:scale(1.05);box-shadow:0 0 0 3px rgba(var(--accent-color-rgb),.2)}.user-avatar-mini img{width:100%;height:100%;object-fit:cover}.user-avatar-placeholder-mini{display:flex;align-items:center;justify-content:center;background:#e0e0e0;color:#999;font-size:24px}.user-avatar-placeholder-mini .iconify{margin:0;padding:0;line-height:1;vertical-align:baseline}.settings-icon-btn{width:40px;height:40px;border-radius:50%;border:none;background:var(--bg-secondary);color:var(--text-secondary);cursor:pointer;font-size:18px;transition:all .3s ease;display:flex;align-items:center;justify-content:center;flex-shrink:0}.settings-icon-btn:hover{background-color:var(--accent-color, #007bff);color:#fff;transform:scale(1.1)}.settings-icon-btn .iconify{font-size:18px;color:var(--text-secondary);transition:color .3s ease;margin:0}.settings-icon-btn:hover .iconify{color:#fff}.sync-indicator{width:40px;height:40px;border-radius:50%;border:none;background:transparent;color:var(--text-secondary);cursor:pointer;font-size:18px;transition:all .3s ease;display:flex;align-items:center;justify-content:center;flex-shrink:0;position:relative;padding:0}.sync-indicator:hover{transform:scale(1.1)}.sync-indicator:disabled{cursor:default}.sync-indicator .iconify{font-size:24px;margin:0;padding:0}.sync-badge{position:absolute;top:-4px;right:-4px;background:var(--accent-color, #007bff);color:#fff;border-radius:50%;width:18px;height:18px;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;line-height:1}.offline-indicator{width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0;animation:pulse 2s ease-in-out infinite}.offline-indicator .iconify{font-size:24px;margin:0;padding:0}@keyframes pulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.6;transform:scale(1.1)}}.spinning{animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.logout-btn{width:40px;height:40px;border-radius:50%;border:none;background:var(--bg-secondary);color:var(--text-secondary);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .3s ease;flex-shrink:0}.logout-btn:hover{background-color:#dc3545}.logout-btn .iconify{font-size:20px;color:#dc3545;transition:color .3s ease;margin:0;padding:0;line-height:1;vertical-align:baseline}.logout-btn:hover .iconify{color:#fff}.notes-btn{width:40px;height:40px;border-radius:50%;border:none;background:var(--bg-secondary);color:var(--text-secondary);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .3s ease;flex-shrink:0}.notes-btn:hover{background-color:var(--accent-color, #007bff)}.notes-btn .iconify{font-size:20px;color:#666;transition:color .3s ease;margin:0;padding:0;line-height:1;vertical-align:baseline}.notes-btn:hover .iconify{color:#fff}.settings-btn{width:40px;height:40px;border-radius:50%;border:none;background:var(--bg-secondary);color:var(--text-secondary);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .3s ease;flex-shrink:0}.settings-btn:hover{background-color:var(--accent-color, #007bff)}.settings-btn .iconify{font-size:20px;color:#666;transition:color .3s ease;margin:0;padding:0;line-height:1;vertical-align:baseline}.settings-btn:hover .iconify{color:#fff}.profile-btn{width:40px;height:40px;border-radius:50%;border:none;background:var(--bg-secondary);color:var(--text-secondary);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .3s ease;flex-shrink:0}.profile-btn:hover{background-color:var(--accent-color, #007bff)}.profile-btn .iconify{font-size:20px;color:#666;transition:color .3s ease;margin:0;padding:0;line-height:1;vertical-align:baseline}.profile-btn:hover .iconify{color:#fff}.auth-link{text-align:center;margin-top:15px;font-size:14px}.auth-link a{color:var(--accent-color, #007bff);text-decoration:none;font-weight:500}.auth-link a:hover{text-decoration:underline}.container{width:90%;max-width:600px;box-shadow:0 0 10px var(--shadow-light);border-radius:8px;padding:15px;margin-top:20px;background:var(--bg-secondary);color:var(--text-primary);box-sizing:border-box;word-wrap:break-word;overflow-wrap:break-word;overflow:visible;transition:background-color .3s ease,color .3s ease,box-shadow .3s ease}.notes-container .container{margin-top:0}.notes-container{margin-top:8px}.empty-message{text-align:center;color:#999;margin-top:50px;word-break:break-word;overflow-wrap:break-word;max-width:100%;padding:0 20px;box-sizing:border-box}.login-form{margin-top:20px}.form-group{margin-bottom:15px}.form-group label{display:block;margin-bottom:5px;font-weight:700;color:var(--text-primary)}.form-group input{width:100%;padding:10px;border:1px solid var(--border-secondary);border-radius:5px;font-size:16px;background-color:var(--bg-tertiary);color:var(--text-primary);box-sizing:border-box;transition:all .3s ease}.form-group input:focus{outline:none;border-color:var(--border-focus);background-color:var(--bg-secondary);box-shadow:0 0 0 2px rgba(var(--accent-color-rgb),.25)}.ai-toggle-group{margin-bottom:20px}.ai-toggle-label{display:flex;align-items:center;justify-content:space-between;cursor:pointer;-webkit-user-select:none;user-select:none;font-weight:400!important;margin-bottom:0!important;padding:16px 20px;background-color:var(--bg-tertiary);border:1px solid var(--border-secondary);border-radius:8px;transition:all .3s ease}.ai-toggle-label:hover{background-color:var(--bg-secondary);border-color:var(--accent-color)}.ai-toggle-label.disabled{opacity:.6;cursor:not-allowed;background-color:var(--bg-secondary)}.ai-toggle-label.disabled:hover{background-color:var(--bg-secondary);border-color:var(--border-secondary)}.ai-toggle-label.disabled .toggle-text-main{color:var(--text-secondary)}.ai-toggle-label.disabled .toggle-text-desc{color:#e67e22;font-weight:500}.ai-toggle-label.disabled .toggle-slider{background-color:#999;cursor:not-allowed}.ai-toggle-label.disabled .toggle-slider:before{background-color:#ddd}.toggle-label-content{display:flex;flex-direction:column;gap:4px;flex:1;min-width:0}.toggle-text-main{color:var(--text-primary);font-size:15px;font-weight:500}.toggle-text-desc{color:var(--text-secondary);font-size:12px;line-height:1.4}.toggle-switch-wrapper{flex-shrink:0;margin-left:20px;position:relative}.toggle-checkbox{display:none}.toggle-slider{position:relative;display:block;width:50px;height:26px;background-color:#ccc;border-radius:26px;transition:background-color .3s ease;box-shadow:inset 0 1px 3px #0003}.toggle-slider:before{content:"";position:absolute;width:22px;height:22px;border-radius:50%;background-color:#fff;top:2px;left:2px;transition:transform .3s ease;box-shadow:0 2px 4px #0003}.toggle-checkbox:checked+.toggle-slider{background-color:var(--accent-color, #007bff);box-shadow:inset 0 1px 3px #0000004d}.toggle-checkbox:checked+.toggle-slider:before{transform:translate(24px)}.error-message{color:var(--icon-danger);margin-top:10px;padding:10px;background-color:#dc35451a;border:1px solid rgba(220,53,69,.3);border-radius:5px}textarea{width:100%;min-height:50px;resize:none;border:none;background:var(--bg-secondary);color:var(--text-primary);margin-bottom:5px;overflow-y:hidden;transition:background-color .3s ease,color .3s ease;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}textarea:focus{outline:none}.save-button-container{display:flex;flex-direction:column;gap:10px}.action-buttons{display:flex;align-items:center;gap:10px}.btnAI{background:linear-gradient(135deg,#667eea,#764ba2);color:#fff;display:flex;align-items:center;gap:6px}.btnAI:hover{background:linear-gradient(135deg,#5568d3,#5a3f7d);transform:translateY(-2px)}.btnAI:active{transform:translateY(0)}.btnAI .iconify{font-size:18px}.save-hint{font-size:12px;color:#999;font-style:italic}.btnSave{padding:10px 20px;cursor:pointer;border-width:1px;background:var(--bg-secondary);color:var(--text-primary);border:1px solid var(--border-secondary);border-radius:5px;font-family:Open Sans,sans-serif;transition:all .3s ease;font-size:16px}.btnSave:hover{background-color:var(--accent-color, #007bff);color:#fff;border-color:var(--accent-color, #007bff)}.date{font-size:11px;color:gray;display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}.date .date-text{flex:1;overflow:hidden;text-overflow:ellipsis;display:flex;align-items:center;gap:4px;flex-wrap:wrap}.date-separator{color:#999;font-weight:400;margin:0 2px}.note-actions{display:flex;align-items:center;gap:4px;flex-wrap:wrap}.notesHeaderBtn{display:inline-flex;align-items:center;justify-content:center;gap:4px;cursor:pointer;color:var(--text-primary);font-weight:700;white-space:nowrap;padding:2px 4px;border-radius:4px;transition:all .2s ease;font-size:10px}.notesHeaderBtn:hover{background:var(--bg-quaternary)}#pinBtn:hover{background:#ffc10733;color:#ffc107}#archiveBtn:hover{background:var(--bg-quaternary);color:var(--text-primary)}#editBtn:hover{background:#0dcaf033;color:#0dcaf0}#deleteBtn:hover{background:#dc354533;color:var(--icon-danger)}.textNote{margin-top:10px;white-space:pre-wrap;position:relative;transition:max-height .3s ease;word-wrap:break-word;overflow-wrap:break-word;word-break:break-word}.textNote.collapsed{max-height:300px;overflow:hidden}.textNote.collapsed:after{content:"";position:absolute;bottom:0;left:0;right:0;height:80px;background:linear-gradient(to bottom,transparent,var(--bg-secondary));pointer-events:none}.show-more-btn{display:flex;align-items:center;justify-content:center;width:100%;margin-top:10px;padding:8px;background-color:var(--bg-tertiary);border:1px solid var(--border-secondary);border-radius:5px;color:var(--accent-color, #007bff);font-size:14px;cursor:pointer;transition:all .3s ease;text-align:center;gap:5px}.show-more-btn:hover{background-color:var(--accent-color, #007bff);color:#fff;border-color:var(--accent-color, #007bff)}.textNote p{margin:0;padding:0;word-wrap:break-word;overflow-wrap:break-word}.textNote h1,.textNote h2,.textNote h3,.textNote h4,.textNote h5,.textNote h6{margin:0;padding:0;word-wrap:break-word;overflow-wrap:break-word;word-break:break-word}.textNote ul,.textNote ol{margin:0;padding-left:20px;word-wrap:break-word;overflow-wrap:break-word;line-height:.5}.textNote li{margin:0;padding:0;line-height:1;word-wrap:break-word;overflow-wrap:break-word}.textNote a{color:var(--accent-color, #007bff);text-decoration:none;word-wrap:break-word;overflow-wrap:break-word}.textNote a.external-link{position:relative;padding-right:16px}.textNote a.external-link:after{content:"↗";position:absolute;right:0;top:0;font-size:.8em;opacity:.7;transition:opacity .3s ease}.textNote a.external-link:hover:after{opacity:1}.textNote a:hover{text-decoration:underline}.textNote blockquote{border-left:4px solid var(--accent-color, #007bff);margin:10px 0;color:var(--text-secondary);font-style:italic;background-color:var(--bg-tertiary);padding:10px 16px;border-radius:0 4px 4px 0;word-wrap:break-word;overflow-wrap:break-word}.textNote blockquote p{margin:0}.textNote pre{background-color:var(--bg-tertiary);color:var(--text-primary);padding:10px;border-radius:5px;font-size:14px;overflow-x:auto;word-wrap:break-word;overflow-wrap:break-word;white-space:pre-wrap}.textNote code{background-color:var(--bg-tertiary);color:var(--text-primary);padding:2px 4px;border-radius:5px;font-size:14px;word-wrap:break-word;overflow-wrap:break-word;word-break:break-word}.textNote input[type=checkbox]{cursor:pointer;margin-right:8px;width:18px;height:18px;accent-color:var(--accent-color, #007bff);vertical-align:middle;position:relative;top:-1px}.textNote .task-list-item{list-style-type:none;margin-left:-20px;padding:0;line-height:1.5;transition:all .3s ease}.textNote .task-list-item:has(input[type=checkbox]:checked){opacity:.65;text-decoration:line-through;color:#999}.textNote .task-list-item input[type=checkbox]:checked~*{text-decoration:line-through;color:#999}.textNote .task-list-item:has(input[type=checkbox]:checked) *{text-decoration:line-through;color:#999}.textNote input[type=checkbox]:checked{text-decoration:none}.textNote input[type=checkbox]:checked+*{text-decoration:line-through;color:#999}.textNote .task-list-item:hover{background-color:rgba(var(--accent-color-rgb),.05);border-radius:4px;padding-left:4px;margin-left:-24px}.textNote li:has(input[type=checkbox]){list-style-type:none;margin-left:-20px;padding:0;line-height:1.5;transition:all .3s ease}.textNote li:has(input[type=checkbox]:checked){opacity:.65;text-decoration:line-through;color:#999}.textNote li:has(input[type=checkbox]) input[type=checkbox]:checked{text-decoration:none}.textNote li:has(input[type=checkbox]:checked) label,.textNote li:has(input[type=checkbox]:checked) span,.textNote li:has(input[type=checkbox]:checked) p{text-decoration:line-through;color:#999}.textNote li:has(input[type=checkbox]:checked) *{text-decoration:line-through;color:#999}.textNote li:has(input[type=checkbox]):hover{background-color:rgba(var(--accent-color-rgb),.05);border-radius:4px;padding-left:4px;margin-left:-24px}.notes-container{width:100%;display:flex;flex-direction:column;align-items:center;padding-bottom:60px;margin-top:16px;gap:16px;word-wrap:break-word;overflow-wrap:break-word}#notesList{width:100%;display:flex;flex-direction:column;align-items:center}.markdown-buttons{margin-top:10px;margin-bottom:10px;overflow-x:auto;overflow-y:hidden;position:relative;display:flex;flex-wrap:nowrap;gap:8px;align-items:center;scrollbar-width:none}.markdown-buttons::-webkit-scrollbar{display:none}.markdown-buttons.markdown-buttons--edit{display:flex;flex-wrap:nowrap;gap:8px;overflow-x:auto;overflow-y:hidden;scrollbar-width:none}.markdown-buttons.markdown-buttons--edit::-webkit-scrollbar{display:none}.markdown-buttons.markdown-buttons--edit .btnMarkdown{padding:5px 10px;margin-right:0;border:none;background-color:transparent;color:var(--text-primary);border-radius:4px;font-size:14px;touch-action:manipulation;-webkit-tap-highlight-color:transparent;user-select:none;-webkit-user-select:none;min-height:44px;display:inline-flex;align-items:center;justify-content:center;transition:all .3s ease}.markdown-buttons.markdown-buttons--edit .btnMarkdown:hover{background-color:var(--bg-quaternary)}@media (max-width: 768px){.markdown-buttons.markdown-buttons--edit .btnMarkdown{min-height:48px;padding:8px 12px;margin:0}}.markdown-buttons .btnMarkdown{padding:5px 10px;margin-right:0;cursor:pointer;border:none;background-color:transparent;color:var(--text-primary);border-radius:4px;font-size:14px;touch-action:manipulation;-webkit-tap-highlight-color:transparent;user-select:none;-webkit-user-select:none;min-height:44px;display:inline-flex;align-items:center;justify-content:center;transition:all .3s ease}.markdown-buttons .btnMarkdown:hover{background-color:var(--bg-quaternary)}.btnMarkdown.active{background-color:var(--accent-color);color:#fff}.btnMarkdown.active .iconify{color:#fff!important}.header-dropdown{position:relative;display:inline-block;overflow:visible;z-index:1}.header-dropdown-menu{display:block;position:fixed;background:var(--bg-secondary);border:1px solid var(--border-secondary);border-radius:5px;box-shadow:0 2px 8px var(--shadow-medium);z-index:1001;min-width:60px;max-width:120px}.header-dropdown-menu button{display:block;width:100%;padding:8px 16px;border:none;background:none;text-align:left;cursor:pointer;font-size:14px;font-weight:500;color:var(--text-primary);transition:background .2s ease}.header-dropdown-menu button:hover{background:var(--bg-quaternary)}.header-dropdown-menu button:first-child{border-radius:5px 5px 0 0}.header-dropdown-menu button:last-child{border-radius:0 0 5px 5px}.floating-toolbar-wrapper{overflow-x:auto;overflow-y:hidden;scrollbar-width:none;scroll-behavior:smooth;max-width:calc(100vw - 20px)}.floating-toolbar-wrapper::-webkit-scrollbar{display:none}.floating-toolbar{display:flex;gap:4px;background-color:var(--bg-secondary);border:1px solid var(--border-secondary);border-radius:8px;padding:6px;box-shadow:0 4px 12px #00000026;animation:fadeIn .2s ease-out;align-items:center;flex-shrink:0;min-width:fit-content;width:max-content}@keyframes fadeIn{0%{opacity:0;transform:translateY(-5px)}to{opacity:1;transform:translateY(0)}}.floating-toolbar-btn{padding:6px 10px;border:none;background-color:transparent;color:var(--text-primary);border-radius:4px;cursor:pointer;font-size:16px;display:flex;align-items:center;justify-content:center;transition:all .2s ease;min-width:32px;min-height:32px}.floating-toolbar-btn:hover{background-color:var(--bg-quaternary)}.floating-toolbar-btn:active{transform:scale(.95)}.floating-toolbar-btn:disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.floating-toolbar-btn .iconify{font-size:18px}.colored-icons .floating-toolbar-btn .iconify[data-icon="mdi:format-bold"],.colored-icons .floating-toolbar-btn iconify-icon[icon="mdi:format-bold"]{color:#1976d2}.colored-icons .floating-toolbar-btn .iconify[data-icon="mdi:format-italic"],.colored-icons .floating-toolbar-btn iconify-icon[icon="mdi:format-italic"]{color:#7b1fa2}.colored-icons .floating-toolbar-btn .iconify[data-icon="mdi:format-strikethrough"],.colored-icons .floating-toolbar-btn iconify-icon[icon="mdi:format-strikethrough"]{color:#ff6f00}.colored-icons .iconify svg,.colored-icons iconify-icon svg{fill:currentColor}.floating-toolbar-btn.active{background-color:var(--bg-quaternary);box-shadow:0 0 0 2px var(--border-focus)}.floating-toolbar-btn.active .iconify{opacity:1;filter:brightness(1.2)}.floating-toolbar-separator{width:1px;height:20px;background-color:var(--border-secondary);margin:0 4px}@media (max-width: 768px){.header-dropdown-menu{min-width:50px;right:-10px}}.footer{text-align:center;font-size:12px;color:#999;position:fixed;bottom:0;width:100%;padding:10px 0}.footer span{font-weight:700}.profile-container{margin-top:20px}.avatar-section{text-align:center;padding:20px;border-bottom:1px solid #e0e0e0;margin-bottom:20px}.avatar-wrapper{margin-bottom:15px;display:flex;justify-content:center;align-items:center}.avatar-preview{width:150px;height:150px;border-radius:50%;object-fit:cover;border:3px solid var(--accent-color, #007bff)}.avatar-placeholder{width:150px;height:150px;border-radius:50%;background-color:#e0e0e0;display:inline-flex;align-items:center;justify-content:center;font-size:64px;color:#999}.avatar-buttons{display:flex;justify-content:center;gap:10px;margin-top:15px}.btn-upload,.btn-delete{padding:8px 16px;cursor:pointer;border:1px solid var(--border-secondary);background-color:var(--bg-tertiary);color:var(--text-primary);border-radius:5px;font-size:14px;transition:all .3s ease;display:inline-block}.btn-upload:hover{background-color:var(--accent-color, #007bff);color:#fff;border-color:var(--accent-color, #007bff)}.btn-delete{color:#dc3545}.btn-delete:hover{background-color:#dc3545;color:#fff;border-color:#dc3545}.avatar-hint{font-size:12px;color:#999;margin-top:10px}.profile-form{padding:0 10px;margin-bottom:80px}.profile-form h3{margin-bottom:15px;color:var(--text-primary)}.separator{margin:30px 0;border:none;border-top:1px solid var(--border-primary)}.notification{position:fixed;top:20px;left:50%;transform:translate(-50%) translateY(-100%);padding:12px 20px;border-radius:8px;color:#fff;font-weight:500;z-index:10000;max-width:350px;box-shadow:0 4px 12px #0000004d;transition:transform .3s ease,top .3s ease;font-size:14px;line-height:1.4;word-wrap:break-word}.notification-success{background-color:#28a745}.notification-error{background-color:#dc3545}.notification-warning{background-color:#ffc107;color:#000}.notification-info{background-color:var(--accent-color, #007bff)}.notification.visible{transform:translate(-50%) translateY(0)}@media (max-width: 768px){.notification{left:10px;right:10px;max-width:none;transform:translateY(-100%)}.notification.visible{transform:translateY(0)}}.back-btn{padding:8px 16px;border:1px solid var(--border-secondary);background-color:var(--bg-tertiary);border-radius:5px;font-size:14px;color:var(--border-focus);text-decoration:none;transition:all .3s ease;display:inline-block}.back-btn:hover{background-color:var(--accent-color, #007bff);color:#fff;border-color:var(--accent-color, #007bff)}.username-clickable{cursor:pointer;transition:color .3s ease}.username-clickable:hover{color:var(--accent-color, #007bff);text-decoration:underline}.center{display:flex;justify-content:center;align-items:center;flex-direction:column;width:600px;height:100%}.container-leftside{width:220px;height:auto;max-width:220px;box-shadow:0 0 10px var(--shadow-light);border-radius:8px;padding:12px;margin-top:20px;background:var(--bg-secondary);color:var(--text-primary);transition:background-color .3s ease,color .3s ease,box-shadow .3s ease}.mini-calendar{width:100%}.calendar-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}.calendar-month-year{font-size:13px;font-weight:700;color:var(--text-primary);text-align:center;flex:1}.calendar-nav{background:none;border:none;font-size:18px;cursor:pointer;color:var(--text-secondary);padding:0 3px;transition:color .3s ease}.calendar-nav:hover{color:var(--accent-color)}.calendar-weekdays{display:grid;grid-template-columns:repeat(7,1fr);gap:1px;margin-bottom:3px}.calendar-weekday{text-align:center;font-size:9px;font-weight:700;color:var(--text-secondary);padding:3px 0}.calendar-day{aspect-ratio:1;display:flex;align-items:center;justify-content:center;font-size:11px;cursor:pointer;border-radius:3px;transition:all .2s ease;color:var(--text-primary);padding:2px;font-weight:500;position:relative;background-color:transparent;border:1px solid transparent}.calendar-day:hover{background-color:transparent;border-color:var(--accent-color, #007bff)}.calendar-day.today{background-color:transparent;color:var(--text-primary);font-weight:700;border:1px solid var(--accent-color, #007bff)}.calendar-day.today:hover{background-color:transparent;border-color:var(--accent-color, #007bff)}.calendar-day.other-month{color:var(--text-muted);background-color:transparent;border:1px solid transparent}.calendar-day.selected{background-color:var(--accent-color, #007bff);color:#fff;font-weight:700;opacity:1;border:1px solid var(--accent-color, #007bff)}.calendar-day.selected:hover{background-color:var(--accent-color, #007bff);border-color:var(--accent-color, #007bff)}@media (min-width: 769px){.mini-calendar,.container-leftside .mini-calendar{background-color:transparent}.calendar-month-year{font-size:14px;font-weight:600;color:var(--text-primary)}.calendar-nav{font-size:20px;color:var(--text-secondary);font-weight:400}.calendar-nav:hover{color:var(--accent-color)}.calendar-weekdays{margin-bottom:5px}.calendar-weekday{font-size:10px;font-weight:400;color:#999;text-transform:none}.calendar-day{font-size:12px;border-radius:4px;color:#fff;font-weight:400;background-color:transparent;border:1px solid transparent}.calendar-day:hover{background-color:transparent;border-color:var(--accent-color, #007bff)}.calendar-day.other-month{color:#999;background-color:transparent;border:1px solid transparent}.calendar-day.other-month:hover{border-color:var(--accent-color, #007bff)}.calendar-day.selected{background-color:var(--accent-color, #007bff);color:#fff;font-weight:500;opacity:1;border-radius:4px;border:1px solid var(--accent-color, #007bff)}.calendar-day.selected:hover{background-color:var(--accent-color, #007bff);border-color:var(--accent-color, #007bff)}.calendar-day.today{background-color:transparent;color:#fff;font-weight:500;border:1px solid var(--accent-color, #007bff)}.calendar-day.today:hover{background-color:transparent;border-color:var(--accent-color, #007bff)}}.calendar-day.has-notes:after{content:"";position:absolute;bottom:2px;left:50%;transform:translate(-50%);width:4px;height:4px;background-color:#28a745;border-radius:50%}.calendar-day.has-edited-notes:before{content:"";position:absolute;bottom:2px;left:50%;transform:translate(-50%);width:4px;height:4px;background-color:#ffc107;border-radius:50%}.calendar-day.has-notes.has-edited-notes:before{transform:translate(-150%)}.calendar-day.has-notes.has-edited-notes:after{transform:translate(50%)}.calendar-day.selected.has-notes:after{background-color:#28a745;border:1px solid #fff;box-shadow:0 0 3px #00000080}.calendar-day.selected.has-edited-notes:before{background-color:#ffc107;border:1px solid #fff;box-shadow:0 0 3px #00000080}.calendar-day.today.has-notes:after{background-color:#28a745;border:1px solid #fff;box-shadow:0 0 3px #00000080}.calendar-day.today.has-edited-notes:before{background-color:#ffc107;border:1px solid #fff;box-shadow:0 0 3px #00000080}.calendar-day.selected.has-notes.has-edited-notes:before,.calendar-day.selected.has-notes.has-edited-notes:after{border:1px solid #fff;box-shadow:0 0 3px #00000080}.calendar-day.today.has-notes.has-edited-notes:before,.calendar-day.today.has-notes.has-edited-notes:after{border:1px solid #fff;box-shadow:0 0 3px #00000080}@media (min-width: 769px){[data-theme=dark] .mini-calendar,[data-theme=dark] .container-leftside .mini-calendar{background-color:transparent}[data-theme=dark] .calendar-day{background-color:transparent;color:#fff;border:1px solid transparent}[data-theme=dark] .calendar-day:hover{background-color:transparent;border-color:var(--accent-color, #007bff)}[data-theme=dark] .calendar-day.other-month{background-color:transparent;color:#999;border:1px solid transparent}[data-theme=dark] .calendar-day.other-month:hover{border-color:var(--accent-color, #007bff)}[data-theme=dark] .calendar-day.today{background-color:transparent;color:#fff;border:1px solid var(--accent-color, #007bff)}[data-theme=dark] .calendar-day.today:hover{background-color:transparent;border-color:var(--accent-color, #007bff)}[data-theme=dark] .calendar-day.selected{background-color:var(--accent-color, #007bff);color:#fff;opacity:1;border:1px solid var(--accent-color, #007bff)}[data-theme=dark] .calendar-day.selected:hover{background-color:var(--accent-color, #007bff);border-color:var(--accent-color, #007bff)}[data-theme=dark] .calendar-nav{color:#fff}[data-theme=dark] .calendar-nav:hover{opacity:.8}[data-theme=dark] .calendar-weekday{color:#999}[data-theme=dark] .calendar-month-year{color:#fff}[data-theme=dark] .calendar-day.has-notes:after{background-color:#28a745}[data-theme=dark] .calendar-day.has-edited-notes:before{background-color:#ffc107}}[data-theme=dark] .calendar-day.has-notes:after{background-color:#28a745;box-shadow:0 0 2px #28a74599}[data-theme=dark] .calendar-day.has-edited-notes:before{background-color:#ffc107;box-shadow:0 0 2px #ffc10799}.tags-section{margin-top:15px;padding-top:15px;border-top:1px solid var(--border-primary)}.tags-header{margin-bottom:10px}.tags-title{font-size:12px;font-weight:700;color:var(--text-primary)}.tags-container{display:flex;flex-wrap:wrap;gap:5px}.tag{display:inline-block;padding:4px 8px;background-color:rgba(var(--accent-color-rgb),.1);color:var(--accent-color);border:1px solid rgba(var(--accent-color-rgb),.3);border-radius:12px;font-size:10px;font-weight:500;cursor:pointer;transition:all .2s ease;-webkit-user-select:none;user-select:none;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:break-word}.tag:hover{background-color:var(--accent-color, #007bff);color:#fff}.tag.active{background-color:var(--accent-color, #007bff);color:#fff;font-weight:700}.tag-count{margin-left:4px;font-size:9px;opacity:.8}.textNote .tag-in-note{display:inline-block;padding:2px 6px;background-color:rgba(var(--accent-color-rgb),.1);color:var(--accent-color);border:1px solid rgba(var(--accent-color-rgb),.3);border-radius:8px;font-size:12px;font-weight:500;cursor:pointer;transition:all .2s ease;text-decoration:none;margin:0 2px;word-wrap:break-word;overflow-wrap:break-word}.textNote .tag-in-note:hover{background-color:var(--accent-color, #007bff);color:#fff;transform:translateY(-1px);box-shadow:0 2px 4px rgba(var(--accent-color-rgb),.3)}.search-highlight{background-color:#fff3cd;padding:1px 2px;border-radius:2px;font-weight:500}.search-highlight.current{background-color:#ffc107;color:#000}.mobile-sidebar{display:flex;position:fixed;top:0;left:-85vw;width:85vw;max-width:320px;height:100vh;background:var(--bg-secondary);color:var(--text-primary);box-shadow:2px 0 10px var(--shadow-light);z-index:1000;overflow-y:auto;transition:left .3s ease;flex-direction:column;padding:0}.sidebar-close-btn{display:flex;align-items:center;justify-content:center;width:40px;height:40px;padding:0;margin:10px 10px 10px auto;background:var(--bg-tertiary);border:1px solid var(--border-secondary);border-radius:8px;cursor:pointer;transition:all .2s ease;flex-shrink:0}.mobile-sidebar .mini-calendar{width:100%;margin-bottom:15px}.mobile-sidebar .calendar-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;gap:4px}.mobile-sidebar .calendar-month-year{font-size:12px;font-weight:700;color:var(--text-primary);text-align:center;flex:1}.mobile-sidebar .calendar-nav{background:none;border:none;font-size:16px;cursor:pointer;color:var(--text-secondary);padding:0 3px;transition:color .3s ease}.mobile-sidebar .calendar-nav:hover{color:var(--accent-color)}.mobile-sidebar .calendar-days{display:grid;grid-template-columns:repeat(7,1fr);gap:1px;margin-bottom:15px}.mobile-sidebar .calendar-day{aspect-ratio:1;display:flex;align-items:center;justify-content:center;font-size:9px;cursor:pointer;border-radius:3px;transition:all .2s ease;color:var(--text-primary);padding:1px;font-weight:500;position:relative;background-color:transparent;border:1px solid transparent}.mobile-sidebar .calendar-day:hover{background-color:transparent;border-color:var(--accent-color, #007bff)}.mobile-sidebar .calendar-day.today{background-color:transparent;color:var(--text-primary);font-weight:700;border:1px solid var(--accent-color, #007bff)}.mobile-sidebar .calendar-day.today:hover{background-color:transparent;border-color:var(--accent-color, #007bff)}.mobile-sidebar .calendar-day.selected{background-color:var(--accent-color, #007bff);color:#fff;font-weight:700;opacity:1;border:1px solid var(--accent-color, #007bff)}.mobile-sidebar .calendar-day.selected:hover{background-color:var(--accent-color, #007bff);border-color:var(--accent-color, #007bff)}.mobile-sidebar .calendar-day.other-month{color:var(--text-muted);background-color:transparent;border:1px solid transparent}.mobile-sidebar .calendar-day.other-month:hover{border-color:var(--accent-color, #007bff)}[data-theme=dark] .mobile-sidebar .calendar-day{background-color:transparent;color:var(--text-primary);border:1px solid transparent}[data-theme=dark] .mobile-sidebar .calendar-day:hover{background-color:transparent;border-color:var(--accent-color, #007bff)}[data-theme=dark] .mobile-sidebar .calendar-day.other-month{background-color:transparent;color:var(--text-muted);border:1px solid transparent}[data-theme=dark] .mobile-sidebar .calendar-day.other-month:hover{border-color:var(--accent-color, #007bff)}[data-theme=dark] .mobile-sidebar .calendar-day.today{background-color:transparent;color:var(--text-primary);border:1px solid var(--accent-color, #007bff)}[data-theme=dark] .mobile-sidebar .calendar-day.today:hover{background-color:transparent;border-color:var(--accent-color, #007bff)}[data-theme=dark] .mobile-sidebar .calendar-day.selected{background-color:var(--accent-color, #007bff);color:#fff;opacity:1;border:1px solid var(--accent-color, #007bff)}[data-theme=dark] .mobile-sidebar .calendar-day.selected:hover{background-color:var(--accent-color, #007bff);border-color:var(--accent-color, #007bff)}[data-theme=dark] .mobile-sidebar .calendar-nav:hover{color:var(--border-focus)}[data-theme=dark] .mobile-sidebar .calendar-weekday{color:var(--text-secondary)}[data-theme=dark] .mobile-sidebar .calendar-day.has-notes:after{background-color:#28a745;box-shadow:0 0 2px #28a74599}[data-theme=dark] .mobile-sidebar .calendar-day.has-edited-notes:before{background-color:#ffc107;box-shadow:0 0 2px #ffc10799}.mobile-sidebar .search-section{margin-bottom:15px;padding-bottom:15px;border-bottom:1px solid var(--border-primary)}.mobile-sidebar .search-title{font-size:11px;font-weight:700;color:var(--text-primary);display:block;margin-bottom:8px}.mobile-sidebar .search-input{width:100%;padding:6px 10px;border:1px solid var(--border-secondary);border-radius:15px;font-size:11px;background-color:var(--bg-tertiary);color:var(--text-primary);transition:all .3s ease;box-sizing:border-box}.mobile-sidebar .search-input:focus{outline:none;border-color:var(--accent-color, #007bff);background-color:var(--bg-secondary);box-shadow:0 0 0 2px rgba(var(--accent-color-rgb),.25)}.mobile-sidebar .tags-section{margin-top:0;padding-top:0;border-top:none}.mobile-sidebar .tags-title{font-size:11px;font-weight:700;color:var(--text-primary);display:block;margin-bottom:8px}.mobile-sidebar .tags-container{display:flex;flex-wrap:wrap;gap:5px}.mobile-sidebar .tag{display:inline-block;padding:4px 8px;background-color:rgba(var(--accent-color-rgb),.1);color:var(--accent-color);border:1px solid rgba(var(--accent-color-rgb),.3);border-radius:12px;font-size:9px;font-weight:500;cursor:pointer;transition:all .2s ease;-webkit-user-select:none;user-select:none;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:break-word;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.mobile-sidebar .tag:not(.active){background-color:rgba(var(--accent-color-rgb),.1)!important;color:var(--accent-color)!important}.mobile-sidebar .tag:not(.active):hover{background-color:var(--accent-color, #007bff);color:#fff}@media (hover: none) and (pointer: coarse){.mobile-sidebar .tag:not(.active):hover{background-color:rgba(var(--accent-color-rgb),.1)!important;color:var(--accent-color)!important}}.mobile-sidebar .tag:not(.active):active,.mobile-sidebar .tag:not(.active):focus,.mobile-sidebar .tag:not(.active):focus:active{background-color:rgba(var(--accent-color-rgb),.1)!important;color:var(--accent-color)!important;outline:none}.mobile-sidebar .tag.active{background-color:var(--accent-color, #007bff);color:#fff;font-weight:700}.mobile-sidebar .tag.active:active,.mobile-sidebar .tag.active:focus{background-color:var(--accent-color, #007bff);color:#fff;outline:none}.mobile-sidebar .tag-count{margin-left:3px;font-size:8px;opacity:.8}@media (max-width: 768px){.ai-toggle-label{padding:12px 16px}.toggle-text-main{font-size:14px}.toggle-text-desc{font-size:11px}.toggle-switch-wrapper{margin-left:12px}.toggle-slider{width:44px;height:24px}.toggle-slider:before{width:20px;height:20px}.toggle-checkbox:checked+.toggle-slider:before{transform:translate(20px)}.mobile-menu-btn{display:flex;align-items:center;justify-content:center}.container-leftside{display:none!important}body{flex-direction:column;gap:0;padding:0 10px;justify-content:flex-start;align-items:center}.center{width:100%;max-width:600px;margin:60px auto 0}.container{width:100%;max-width:none;margin-top:5px;padding:10px;box-sizing:border-box}.center>.container:first-child{margin-top:3px}.notes-container .container{margin-top:0}.notes-container{margin-top:5px}.notes-header{flex-direction:row;align-items:center;gap:10px;width:100%}.notes-header-left{flex:1;min-width:0}.user-info{flex-shrink:0;flex-wrap:wrap;gap:8px}.user-info .back-btn{font-size:12px;padding:6px 8px;white-space:nowrap}.user-info .theme-toggle-btn{flex-shrink:0}@media (max-width: 480px){.user-info{flex-shrink:0;gap:4px}.user-info .back-btn{font-size:11px;padding:4px 6px}.user-info .theme-toggle-btn{width:32px;height:32px;padding:6px}.user-info .theme-toggle-btn .iconify{font-size:16px}.settings-icon-btn{width:32px;height:32px;padding:6px}.settings-icon-btn .iconify{font-size:16px}}.markdown-buttons{display:flex;flex-wrap:nowrap;gap:8px;width:100%;justify-content:flex-start;overflow-x:auto;overflow-y:hidden;scrollbar-width:none}.markdown-buttons::-webkit-scrollbar{display:none}.markdown-buttons .btnMarkdown{flex:0 1 auto;min-width:auto;margin-right:0;padding:8px 12px;font-size:14px;border:none;background-color:transparent}textarea{min-height:100px}.save-button-container,.action-buttons{width:100%;flex-direction:column}.btnSave,.btnAI,.btn-secondary{width:100%;text-align:center;justify-content:center}.footer{position:relative;margin-top:20px}}.image-preview-container{margin:15px 0;padding:15px;background:#f8f9fa;border:2px dashed #dee2e6;border-radius:8px;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.image-preview-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;font-weight:600;color:#495057}.note-preview-container{margin:15px 0;padding:15px;background:var(--bg-tertiary);border:2px solid var(--accent-color, #007bff);border-radius:8px;min-height:200px;max-height:600px;overflow-y:auto;transition:background-color .3s ease,border-color .3s ease}.note-preview-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:15px;padding-bottom:10px;border-bottom:2px solid var(--border-primary);font-weight:600;color:var(--accent-color, #007bff);font-size:16px;transition:color .3s ease,border-color .3s ease}.note-preview-content{background:var(--bg-secondary);color:var(--text-primary);padding:15px;border-radius:6px;min-height:150px;transition:background-color .3s ease,color .3s ease}.textNote .markdown-buttons--edit,.textNote .note-preview-container,.textNote .image-preview-container,.textNote .file-preview-container,.textNote .textInput,.textNote textarea.textInput{width:100%;box-sizing:border-box}.textNote .file-preview-container .file-preview-item{padding:6px 10px;min-height:40px}.textNote .file-preview-container .file-preview-item .file-icon{font-size:24px}.textNote .file-preview-container .file-preview-item .file-name{font-size:14px;line-height:1.2}.textNote .file-preview-container .file-preview-item .file-size{font-size:11px;margin-top:1px;line-height:1.2}.textNote .file-preview-container .file-preview-item .remove-file-btn{width:24px;height:24px;font-size:14px}.note-preview-content h1,.note-preview-content h2,.note-preview-content h3,.note-preview-content h4,.note-preview-content h5,.note-preview-content h6{margin-top:.5em;margin-bottom:.5em;color:var(--text-primary);transition:color .3s ease}.note-preview-content p{margin:.5em 0;color:var(--text-primary);transition:color .3s ease}.note-preview-content ul,.note-preview-content ol{margin:.5em 0;padding-left:2em;color:var(--text-primary);transition:color .3s ease}.note-preview-content li{color:var(--text-primary);transition:color .3s ease}.note-preview-content a{color:var(--accent-color, #007bff);text-decoration:none;transition:color .3s ease}.note-preview-content a:hover{text-decoration:underline}.note-preview-content code{background:var(--bg-quaternary);color:var(--text-primary);padding:2px 6px;border-radius:4px;font-family:Courier New,monospace;transition:background-color .3s ease,color .3s ease}.note-preview-content pre{background:var(--bg-quaternary);color:var(--text-primary);padding:10px;border-radius:6px;overflow-x:auto;border:1px solid var(--border-primary);transition:background-color .3s ease,color .3s ease,border-color .3s ease}.note-preview-content pre code{background:transparent;padding:0;border-radius:0}.note-preview-content blockquote{border-left:4px solid var(--accent-color, #007bff);margin:10px 0;color:var(--text-secondary);background-color:var(--bg-tertiary);padding:8px 15px;border-radius:0 4px 4px 0;transition:color .3s ease,background-color .3s ease,border-color .3s ease}.note-preview-content blockquote p{color:var(--text-secondary);margin:0}.note-preview-content img{max-width:100%;height:auto;border-radius:6px;margin:10px 0;box-shadow:0 2px 4px var(--shadow-light);transition:box-shadow .3s ease}.note-preview-content table{width:100%;border-collapse:collapse;margin:10px 0;background:var(--bg-secondary);border-radius:6px;overflow:hidden;box-shadow:0 1px 3px var(--shadow-light);transition:background-color .3s ease,box-shadow .3s ease}.note-preview-content th,.note-preview-content td{padding:8px 12px;text-align:left;border-bottom:1px solid var(--border-primary);color:var(--text-primary);transition:color .3s ease,border-color .3s ease}.note-preview-content th{background:var(--bg-tertiary);font-weight:700;color:var(--text-primary);transition:background-color .3s ease,color .3s ease}.note-preview-content tr:hover{background:var(--bg-quaternary);transition:background-color .3s ease}.note-preview-content hr{border:none;height:1px;background:var(--border-primary);margin:20px 0;transition:background-color .3s ease}[data-theme=dark] .note-preview-container{background:var(--bg-tertiary);border-color:var(--accent-color)}[data-theme=dark] .note-preview-header{color:var(--accent-color);border-bottom-color:var(--border-primary)}[data-theme=dark] .note-preview-content{background:var(--bg-secondary);color:var(--text-primary)}[data-theme=dark] .note-preview-content code,[data-theme=dark] .note-preview-content pre{background:var(--bg-quaternary);color:#e6e6e6;border:1px solid var(--border-primary)}[data-theme=dark] .note-preview-content pre code{background:transparent;border:none;color:#e6e6e6}[data-theme=dark] .note-preview-content blockquote{background-color:var(--bg-tertiary);border-left-color:var(--accent-color);color:var(--text-secondary)}[data-theme=dark] .note-preview-content table{background:var(--bg-secondary);box-shadow:0 1px 3px var(--shadow-light)}[data-theme=dark] .note-preview-content th{background:var(--bg-tertiary);color:var(--text-primary)}[data-theme=dark] .note-preview-content th,[data-theme=dark] .note-preview-content td{border-bottom-color:var(--border-primary);color:var(--text-primary)}[data-theme=dark] .note-preview-content tr:hover{background:var(--bg-quaternary)}[data-theme=dark] .note-preview-content img{box-shadow:0 2px 4px var(--shadow-light)}.note-preview-content input[type=checkbox]{cursor:pointer;margin-right:8px;width:18px;height:18px;accent-color:var(--accent-color, #007bff);vertical-align:middle;position:relative;top:-1px}.note-preview-content .task-list-item{list-style-type:none;margin-left:-20px;padding:0;line-height:1.5;transition:all .3s ease}.note-preview-content .task-list-item:has(input[type=checkbox]:checked){opacity:.65;text-decoration:line-through;color:var(--text-muted)}.note-preview-content .task-list-item input[type=checkbox]:checked~*{text-decoration:line-through;color:var(--text-muted)}.note-preview-content .task-list-item:has(input[type=checkbox]:checked) *{text-decoration:line-through;color:var(--text-muted)}.note-preview-content .task-list-item:hover{background-color:rgba(var(--accent-color-rgb),.05);border-radius:4px;padding-left:4px;margin-left:-24px}.note-preview-content input[type=checkbox]:checked{text-decoration:none}.note-preview-content input[type=checkbox]:checked+*{text-decoration:line-through;color:var(--text-muted)}.note-preview-content li:has(input[type=checkbox]){list-style-type:none;margin-left:-20px;padding:0;line-height:1.5;transition:all .3s ease}.note-preview-content li:has(input[type=checkbox]:checked){opacity:.65;text-decoration:line-through;color:var(--text-muted)}.note-preview-content li:has(input[type=checkbox]) input[type=checkbox]:checked{text-decoration:none}.note-preview-content li:has(input[type=checkbox]:checked) label,.note-preview-content li:has(input[type=checkbox]:checked) span,.note-preview-content li:has(input[type=checkbox]:checked) p{text-decoration:line-through;color:var(--text-muted)}.note-preview-content li:has(input[type=checkbox]:checked) *{text-decoration:line-through;color:var(--text-muted)}.note-preview-content li:has(input[type=checkbox]):hover{background-color:rgba(var(--accent-color-rgb),.05);border-radius:4px;padding-left:4px;margin-left:-24px}.clear-images-btn{background:#dc3545;color:#fff;border:none;padding:4px 8px;border-radius:4px;cursor:pointer;font-size:12px;transition:background-color .3s ease}.clear-images-btn:hover{background:#c82333}.image-preview-list{display:flex;flex-wrap:wrap;gap:10px}.image-preview-item{position:relative;border:1px solid #dee2e6;border-radius:6px;overflow:hidden;background:#fff}.image-preview-item img{width:100px;height:100px;object-fit:cover;display:block}.image-preview-item .remove-image-btn{position:absolute;top:2px;right:2px;background:#dc3545cc;color:#fff;border:none;border-radius:50%;width:24px;height:24px;cursor:pointer;font-size:14px;display:flex;align-items:center;justify-content:center;transition:background-color .3s ease;touch-action:manipulation;-webkit-tap-highlight-color:transparent;user-select:none;-webkit-user-select:none}.image-preview-item .remove-image-btn:hover{background:#dc3545}.image-preview-item .image-preview-remove{position:absolute;top:2px;right:2px;background:#dc3545e6;color:#fff;border:none;border-radius:50%;width:28px;height:28px;cursor:pointer;font-size:16px;display:flex;align-items:center;justify-content:center;transition:all .3s ease;touch-action:manipulation;-webkit-tap-highlight-color:transparent;user-select:none;-webkit-user-select:none;box-shadow:0 2px 4px #0003;z-index:10}.image-preview-item .image-preview-remove:hover{background:#dc3545;transform:scale(1.1);box-shadow:0 3px 6px #0000004d}.image-preview-item .image-preview-remove:active{transform:scale(.95)}.file-preview-item .file-preview-remove{background:#dc3545e6;color:#fff;border:none;border-radius:50%;width:28px;height:28px;cursor:pointer;font-size:16px;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:all .3s ease;touch-action:manipulation;-webkit-tap-highlight-color:transparent;user-select:none;-webkit-user-select:none;box-shadow:0 2px 4px #0003;margin-left:auto}.file-preview-item .file-preview-remove:hover{background:#dc3545;transform:scale(1.1);box-shadow:0 3px 6px #0000004d}.file-preview-item .file-preview-remove:active{transform:scale(.95)}.image-preview-item .image-preview-remove.restore-btn,.file-preview-item .file-preview-remove.restore-btn{background:#28a745e6!important}.image-preview-item .image-preview-remove.restore-btn:hover,.file-preview-item .file-preview-remove.restore-btn:hover{background:#28a745!important}.image-preview-item .image-preview-remove[style*=green],.file-preview-item .file-preview-remove[style*=green]{background:#28a745e6!important}.image-preview-item .image-preview-remove[style*=green]:hover,.file-preview-item .file-preview-remove[style*=green]:hover{background:#28a745!important}.image-preview-item .image-info{padding:4px 6px;font-size:10px;color:#6c757d;background:#f8f9fa;word-break:break-all}.note-image{width:150px;height:150px;object-fit:cover;border-radius:6px;margin:10px 0;box-shadow:0 2px 4px #0000001a;cursor:pointer;transition:transform .2s ease}.note-image:hover{transform:scale(1.02);box-shadow:0 4px 8px #0003}.note-image:after{content:"🔍";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);background:#000000b3;color:#fff;padding:8px;border-radius:50%;font-size:16px;opacity:0;transition:opacity .2s ease;pointer-events:none}.note-image:hover:after{opacity:1}.note-images-container{margin:10px 0;display:flex;flex-wrap:wrap;gap:10px}.note-image-item{position:relative;display:inline-block}.note-image-item .note-image{position:relative}.note-files-container{margin:10px 0;display:flex;flex-direction:column;gap:8px}.note-file-item{display:flex;align-items:center}.note-file-link{display:flex;align-items:center;padding:10px;background:#f8f9fa;border:1px solid #dee2e6;border-radius:6px;text-decoration:none;color:inherit;gap:12px;width:100%;transition:all .2s}.note-file-link:hover{background:#e9ecef;border-color:var(--accent-color, #007bff);transform:translateY(-1px);box-shadow:0 2px 4px #0000001a}.note-file-link .file-icon{font-size:32px;color:var(--accent-color, #007bff);flex-shrink:0}.note-file-link .file-info{flex:1;min-width:0}.note-file-link .file-name{font-weight:500;color:#333;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.note-file-link .file-size{font-size:12px;color:#666;margin-top:2px}.note-image-item .remove-note-image-btn{position:absolute;top:5px;right:5px;background:#dc3545cc;color:#fff;border:none;border-radius:50%;width:24px;height:24px;cursor:pointer;font-size:14px;display:flex;align-items:center;justify-content:center;transition:background-color .3s ease;opacity:0}.note-image-item:hover .remove-note-image-btn{opacity:1}.note-image-item .remove-note-image-btn:hover{background:#dc3545}.image-modal{display:none;position:fixed;z-index:1000;left:0;top:0;width:100%;height:100%;background-color:#000000e6;cursor:pointer}.image-modal-content{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);max-width:90%;max-height:90%;object-fit:contain}.image-modal-close{position:absolute;top:15px;right:35px;color:#f1f1f1;font-size:40px;font-weight:700;cursor:pointer}.image-modal-close:hover{color:#bbb}.modal{display:none;position:fixed;z-index:1000;left:0;top:0;width:100%;height:100%;background-color:#00000080;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.modal-content{background-color:#fff;margin:10% auto;padding:0;border-radius:8px;width:90%;max-width:500px;box-shadow:0 4px 20px #0000004d;animation:modalFadeIn .3s ease-out}@keyframes modalFadeIn{0%{opacity:0;transform:translateY(-20px)}to{opacity:1;transform:translateY(0)}}.modal-header{padding:20px 25px;border-bottom:1px solid #eee;display:flex;justify-content:space-between;align-items:center}.modal-header h3{margin:0;color:#333;font-size:20px}.modal-close{color:#aaa;font-size:28px;font-weight:700;cursor:pointer;line-height:1}.modal-close:hover{color:#666}.modal-body{padding:25px;color:#555;line-height:1.5}.modal-footer{padding:20px 25px;border-top:1px solid #eee;display:flex;justify-content:flex-end;gap:10px}[data-theme=dark] .modal-content{background-color:var(--bg-secondary);color:var(--text-primary)}[data-theme=dark] .modal-header{border-bottom-color:var(--border-primary)}[data-theme=dark] .modal-header h3{color:var(--text-primary)}[data-theme=dark] .modal-close{color:var(--text-secondary)}[data-theme=dark] .modal-close:hover{color:var(--text-primary)}[data-theme=dark] .modal-body{color:var(--text-secondary)}[data-theme=dark] .modal-footer{border-top-color:var(--border-primary)}.modal-password-input{width:100%;padding:10px;border:1px solid var(--border-secondary);border-radius:4px;font-size:16px;background-color:var(--bg-tertiary);color:var(--text-primary);box-sizing:border-box;transition:all .3s ease}.modal-password-input:focus{outline:none;border-color:var(--border-focus);background-color:var(--bg-secondary);box-shadow:0 0 0 2px #4a9eff40}.modal-password-input::placeholder{color:var(--text-muted)}@media (max-width: 768px){.image-preview-list,.note-images-container{justify-content:center}.image-preview-item img{width:80px;height:80px}.markdown-buttons .btnMarkdown{min-height:48px;padding:8px 12px;margin:2px}.image-preview-item .remove-image-btn{width:28px;height:28px;font-size:16px}.image-preview-item .image-preview-remove,.file-preview-item .file-preview-remove{width:32px;height:32px;font-size:18px}.clear-images-btn{min-height:44px;padding:8px 16px;font-size:14px}.note-image{width:120px;height:120px}}.accent-color-picker{display:flex;gap:10px;margin-bottom:10px;flex-wrap:wrap}.color-option{width:40px;height:40px;border-radius:50%;cursor:pointer;border:3px solid transparent;transition:all .3s ease;position:relative}.color-option:hover{transform:scale(1.1);box-shadow:0 2px 8px #0003}.color-option.selected{border-color:#333;transform:scale(1.1);box-shadow:0 0 0 2px #fff,0 0 0 4px #333}.color-option:after{content:"✓";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:#fff;font-weight:700;font-size:18px;opacity:0;transition:opacity .2s ease}.color-option.selected:after{opacity:1}#accentColor{width:60px;height:40px;border:none;border-radius:5px;cursor:pointer}.settings-tabs{display:flex;gap:10px;margin:20px 0;border-bottom:2px solid #e0e0e0;flex-wrap:wrap}.settings-tab{padding:10px 20px;background:none;border:none;border-bottom:3px solid transparent;cursor:pointer;font-size:16px;color:#666;transition:all .3s ease;display:flex;align-items:center;gap:8px}.settings-tab:hover{color:var(--accent-color, #007bff);background:rgba(var(--accent-color-rgb),.05)}.settings-tab.active{color:var(--accent-color, #007bff);border-bottom-color:var(--accent-color, #007bff);font-weight:700}.settings-content{margin-top:20px}.tab-content{display:none}.tab-content.active{display:block}.archived-notes-list{display:flex;flex-direction:column;gap:15px}.archived-note-item{background:var(--bg-secondary);border:1px solid var(--border-primary);border-radius:8px;padding:15px;transition:all .3s ease;color:var(--text-primary)}.archived-note-item:hover{box-shadow:0 2px 8px var(--shadow-light)}.archived-note-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;flex-wrap:wrap;gap:10px}.archived-note-date{font-size:12px;color:var(--text-muted)}.archived-note-actions{display:flex;gap:8px}.btn-restore,.btn-delete-permanent{padding:6px 12px;border:1px solid var(--border-secondary);border-radius:5px;background:var(--bg-tertiary);color:var(--text-primary);cursor:pointer;font-size:13px;transition:all .3s ease;display:flex;align-items:center;gap:4px}.btn-restore{color:var(--accent-color, #007bff);border-color:var(--accent-color, #007bff)}.btn-restore:hover{background:var(--accent-color, #007bff);color:#fff}.btn-delete-permanent{color:#dc3545;border-color:#dc3545}.btn-delete-permanent:hover{background:#dc3545;color:#fff}.btn-primary{background-color:var(--accent-color, #007bff);color:#fff;border:1px solid var(--accent-color, #007bff);padding:10px 20px;border-radius:5px;cursor:pointer;font-size:14px;transition:all .3s ease;display:inline-flex;align-items:center;gap:6px}.btn-primary:hover{background-color:var(--accent-color, #007bff);border-color:var(--accent-color, #007bff);opacity:.9;filter:brightness(.9)}.btn-primary:disabled{background-color:#6c757d;border-color:#6c757d;cursor:not-allowed;opacity:.6}.btn-danger{background-color:#dc3545;color:#fff;border:1px solid #dc3545;padding:10px 20px;border-radius:5px;cursor:pointer;font-size:14px;transition:all .3s ease;display:inline-flex;align-items:center;gap:6px}.btn-danger:hover{background-color:#c82333;border-color:#bd2130}.btn-danger:disabled{background-color:#6c757d;border-color:#6c757d;cursor:not-allowed;opacity:.6}.danger-zone{background-color:var(--bg-secondary);border:2px solid #dc3545;border-radius:8px;padding:20px;margin-top:20px;position:relative}.danger-zone:before{content:"⚠️";position:absolute;top:-10px;left:20px;background-color:var(--bg-primary);padding:0 10px;font-size:16px}.danger-zone h3{color:#dc3545;margin-top:0;margin-bottom:15px;font-size:18px;font-weight:700}.danger-zone p{color:var(--text-secondary);font-size:14px;line-height:1.5;margin-bottom:15px}.danger-zone .btn-danger{background-color:#dc3545;border-color:#dc3545;font-weight:600;padding:12px 24px;font-size:15px}.danger-zone .btn-danger:hover{background-color:#c82333;border-color:#bd2130;transform:translateY(-1px);box-shadow:0 4px 8px #dc35454d}.btn-secondary{background-color:var(--bg-tertiary);color:var(--text-primary);border:1px solid var(--border-secondary);padding:10px 20px;border-radius:5px;cursor:pointer;font-size:14px;transition:all .3s ease}.btn-secondary:hover{background-color:var(--bg-quaternary)}.btn-secondary.active{background-color:var(--accent-color);color:#fff;border-color:var(--accent-color)}.archived-note-content{font-size:14px;color:var(--text-primary);line-height:1.5;max-height:100px;overflow:hidden;text-overflow:ellipsis;word-wrap:break-word;overflow-wrap:break-word}.archived-note-images{margin-top:10px;font-size:12px;color:var(--text-secondary);font-style:italic}.logs-filters{display:flex;gap:10px;margin-bottom:20px;flex-wrap:wrap}.log-filter-select{flex:1;min-width:200px;padding:8px 12px;border:1px solid var(--border-secondary);border-radius:5px;font-size:14px;background-color:var(--bg-tertiary);color:var(--text-primary)}.log-filter-select:focus{outline:none;border-color:var(--accent-color, #007bff)}.logs-table-container{overflow-x:auto;margin-bottom:20px}.logs-table{width:100%;border-collapse:collapse;background:var(--bg-secondary);color:var(--text-primary);border-radius:8px;overflow:hidden;box-shadow:0 1px 3px var(--shadow-light)}.logs-table thead{background:var(--bg-tertiary)}.logs-table th{padding:12px;text-align:left;font-weight:700;color:var(--text-primary);border-bottom:2px solid var(--border-primary);font-size:14px}.logs-table td{padding:12px;border-bottom:1px solid var(--border-primary);font-size:13px;color:var(--text-secondary)}.logs-table tbody tr:hover{background:var(--bg-quaternary)}.log-action-badge{display:inline-block;padding:4px 8px;border-radius:4px;font-size:12px;font-weight:500;white-space:nowrap}.log-action-login,.log-action-register{background:#d4edda;color:#155724}.log-action-logout{background:#f8d7da;color:#721c24}.log-action-note_create{background:#d1ecf1;color:#0c5460}.log-action-note_update{background:#fff3cd;color:#856404}.log-action-note_delete,.log-action-note_delete_permanent{background:#f8d7da;color:#721c24}.log-action-note_pin{background:#e7e7ff;color:#4a4aff}.log-action-note_archive{background:#e2e3e5;color:#383d41}.log-action-note_unarchive{background:#d4edda;color:#155724}.log-action-profile_update{background:#fce4ec;color:#c2185b}.load-more-container{text-align:center;margin:20px 0}.note-pinned{border-left:4px solid #ffc107;background:var(--bg-secondary)}.pin-indicator{display:inline-flex;align-items:center;gap:4px;color:#ffc107;font-size:12px;font-weight:700;margin-left:10px}@media (max-width: 768px){.settings-tabs{flex-direction:column}.settings-tab{width:100%;justify-content:center}.archived-note-header{flex-direction:column;align-items:flex-start}.archived-note-actions{width:100%;justify-content:flex-start}.logs-table{font-size:12px}.logs-table th,.logs-table td{padding:8px}.logs-filters{flex-direction:column}.log-filter-select{width:100%}}.log-action-ai_improve{background:#d1ecf1;color:#0c5460}.spoiler{background:linear-gradient(45deg,rgba(var(--accent-color-rgb),.15),rgba(var(--accent-color-rgb),.25));color:transparent;cursor:pointer;border-radius:4px;padding:3px 6px;-webkit-user-select:none;user-select:none;transition:all .3s ease;position:relative;display:inline-block;vertical-align:baseline;border:1px solid rgba(var(--accent-color-rgb),.3);font-weight:500;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);text-shadow:0 0 8px rgba(var(--accent-color-rgb),.3);isolation:isolate;z-index:0}.spoiler:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(var(--accent-color-rgb),.1);border-radius:4px;filter:blur(1px);z-index:-1;box-sizing:border-box;pointer-events:none}.spoiler:hover{background:linear-gradient(45deg,rgba(var(--accent-color-rgb),.25),rgba(var(--accent-color-rgb),.35));transform:scale(1.02);box-shadow:0 2px 8px rgba(var(--accent-color-rgb),.25);border-color:rgba(var(--accent-color-rgb),.4)}.spoiler:hover:before{background:rgba(var(--accent-color-rgb),.15)}.spoiler.revealed{background:linear-gradient(45deg,rgba(var(--accent-color-rgb),.15),rgba(var(--accent-color-rgb),.2));color:var(--accent-color);border-color:rgba(var(--accent-color-rgb),.4);box-shadow:0 0 0 2px rgba(var(--accent-color-rgb),.25);text-shadow:none;user-select:text;-webkit-user-select:text;cursor:text}.spoiler.revealed:before{display:none}.spoiler.revealed:hover{background:linear-gradient(45deg,rgba(var(--accent-color-rgb),.2),rgba(var(--accent-color-rgb),.25));box-shadow:0 0 0 2px rgba(var(--accent-color-rgb),.35)}.file-preview-container{margin:15px 0;padding:15px;background:#f0f8ff;border:2px dashed #b0d4f1;border-radius:8px;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.file-preview-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;font-weight:600;color:#495057}.file-preview-list{display:flex;flex-direction:column;gap:10px}.file-preview-item{display:flex;align-items:center;padding:6px 10px;background:#fff;border-radius:6px;border:1px solid #dee2e6;gap:12px;min-height:40px}.file-preview-item .file-icon{font-size:24px;color:var(--accent-color, #007bff);flex-shrink:0}.file-preview-item .file-info,.file-preview-item .file-info-edit{flex:1;min-width:0}.file-preview-item .file-name{font-weight:500;color:#333;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;line-height:1.2}.file-preview-item .file-size{font-size:11px;color:#666;margin-top:1px;line-height:1.2}.file-info-edit .file-name{font-weight:500;color:#333;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;line-height:1.2}.file-info-edit .file-size{font-size:11px;color:#666;margin-top:1px;line-height:1.2}.file-preview-item .remove-file-btn{background:#dc3545;color:#fff;border:none;border-radius:50%;width:24px;height:24px;cursor:pointer;font-size:14px;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:background-color .2s}.file-preview-item .remove-file-btn:hover{background:#c82333}.clear-files-btn{background:#dc3545;color:#fff;border:none;padding:4px 8px;border-radius:4px;cursor:pointer;font-size:12px;transition:background-color .3s ease}.clear-files-btn:hover{background:#c82333}[data-theme=dark] .file-preview-container{background:#2a3a4a;border-color:#4a5a6a}[data-theme=dark] .file-preview-header{color:var(--text-primary)}[data-theme=dark] .file-preview-item{background:var(--bg-secondary);border-color:var(--border-primary)}[data-theme=dark] .file-preview-item .file-name{color:var(--text-primary);font-size:14px;line-height:1.2}[data-theme=dark] .file-preview-item .file-size{color:var(--text-secondary);font-size:11px;margin-top:1px;line-height:1.2}[data-theme=dark] .file-info-edit .file-name{color:var(--text-primary);font-size:14px;line-height:1.2}[data-theme=dark] .file-info-edit .file-size{color:var(--text-secondary);font-size:11px;margin-top:1px;line-height:1.2}[data-theme=dark] .textNote .file-preview-container .file-preview-item .file-name{color:var(--text-primary);font-size:14px;line-height:1.2}[data-theme=dark] .textNote .file-preview-container .file-preview-item .file-size{color:var(--text-secondary);font-size:11px;margin-top:1px;line-height:1.2}[data-theme=dark] .note-file-link{background:var(--bg-tertiary);border-color:var(--border-primary);color:var(--text-primary)}[data-theme=dark] .note-file-link:hover{background:var(--bg-hover);border-color:var(--accent-color)}[data-theme=dark] .note-file-link .file-name{color:var(--text-primary)}[data-theme=dark] .note-file-link .file-size{color:var(--text-secondary)}[data-theme=dark] .image-preview-container{background:#2a3a4a;border-color:#4a5a6a}[data-theme=dark] .image-preview-header{color:var(--text-primary)}[data-theme=dark] .image-preview-item{background:var(--bg-secondary);border-color:var(--border-primary)}[data-theme=dark] .image-preview-item .image-info{background:var(--bg-tertiary);color:var(--text-secondary)}[data-theme=dark] .image-preview-item .image-preview-remove{background:#dc3545d9;box-shadow:0 2px 4px #0006}[data-theme=dark] .image-preview-item .image-preview-remove:hover{background:#dc3545;box-shadow:0 3px 6px #00000080}[data-theme=dark] .file-preview-item .file-preview-remove{background:#dc3545d9;box-shadow:0 2px 4px #0006}[data-theme=dark] .file-preview-item .file-preview-remove:hover{background:#dc3545;box-shadow:0 3px 6px #00000080}[data-theme=dark] .image-preview-item .image-preview-remove.restore-btn,[data-theme=dark] .file-preview-item .file-preview-remove.restore-btn{background:#28a745d9!important}[data-theme=dark] .image-preview-item .image-preview-remove.restore-btn:hover,[data-theme=dark] .file-preview-item .file-preview-remove.restore-btn:hover{background:#28a745!important}[data-theme=dark] .image-preview-item .image-preview-remove[style*=green],[data-theme=dark] .file-preview-item .file-preview-remove[style*=green]{background:#28a745d9!important}[data-theme=dark] .image-preview-item .image-preview-remove[style*=green]:hover,[data-theme=dark] .file-preview-item .file-preview-remove[style*=green]:hover{background:#28a745!important}[data-theme=dark] .note-images-container{background:transparent}[data-theme=dark] .note-image-item,[data-theme=dark] .note-image{border-color:var(--border-primary)}[data-theme=dark] .note-image:hover:after{background:#000000b3}.btnMarkdown .iconify[data-icon="mdi:menu-down"]{color:#1976d2}.mobile-menu-btn{display:none;position:fixed;top:15px;left:15px;z-index:999;background:var(--bg-secondary);border:1px solid var(--border-secondary);border-radius:8px;padding:10px 12px;cursor:pointer;box-shadow:0 2px 8px var(--shadow-light);transition:all .3s ease}.mobile-menu-btn:hover{background:var(--bg-quaternary);box-shadow:0 4px 12px var(--shadow-medium)}.mobile-menu-btn .iconify{font-size:24px;color:var(--text-primary)}.mobile-sidebar{display:flex;flex-direction:column;position:fixed;top:0;left:-85vw;width:85vw;max-width:320px;height:100vh;background:var(--bg-secondary);color:var(--text-primary);box-shadow:2px 0 10px var(--shadow-light);transition:left .3s ease;z-index:1000;overflow-y:auto}.mobile-sidebar.open{left:0}.sidebar-close-btn{display:flex;align-items:center;justify-content:center;width:40px;height:40px;padding:0;margin:10px 10px 10px auto;background:var(--bg-tertiary);border:1px solid var(--border-secondary);border-radius:8px;cursor:pointer;transition:background .3s ease}.sidebar-close-btn:hover{background:var(--bg-quaternary)}.sidebar-close-btn .iconify{font-size:20px;color:var(--text-primary)}.sidebar-content{padding:10px 12px;overflow-y:auto;flex:1}.mobile-calendar-section,.mobile-search-section,.mobile-tags-section{margin-bottom:20px;padding-bottom:15px;border-bottom:1px solid var(--border-primary)}.mobile-tags-section{border-bottom:none}.search-header,.tags-header{margin-bottom:10px}.search-title,.tags-title{font-size:13px;font-weight:700;color:var(--text-primary);display:flex;align-items:center;gap:5px}.search-title .iconify,.tags-title .iconify{font-size:16px;color:var(--accent-color)}.mobile-sidebar-overlay{display:none;position:fixed;top:0;left:0;right:0;bottom:0;background:#00000080;z-index:999;opacity:0;transition:opacity .3s ease}.mobile-sidebar-overlay.open{display:block;opacity:1}@media (max-width: 768px){.mobile-menu-btn{display:flex;align-items:center;justify-content:center}.container-leftside,.sidebar{display:none!important}body{flex-direction:column;gap:0;padding:20px 10px 0}.center{width:100%!important;max-width:100%!important}.container{width:100%;max-width:100%;margin-top:60px}.center>.container:first-child{margin-top:3px}.notes-container .container{margin-top:0}.notes-container{padding-bottom:80px;margin-top:16px;gap:16px}.empty-message{padding:0 15px;font-size:14px}.notes-header{gap:10px;align-items:flex-start}.notes-header-left{width:auto;min-width:0;align-items:flex-start;gap:8px}.filter-indicator{font-size:12px;display:inline-flex!important;max-width:min(300px,100%)!important;width:fit-content!important;box-sizing:border-box!important}.filter-indicator-text{overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important}.markdown-buttons .btnMarkdown{min-height:44px;padding:8px 10px;margin:2px;font-size:13px}.textInput{font-size:14px;min-height:100px}.image-preview-list,.note-images-container{justify-content:center}.image-preview-item img,.note-image{width:80px;height:80px}.notification{left:10px;right:10px;max-width:none}.footer{font-size:11px;padding:8px 0}}@media (max-width: 480px){.mobile-menu-btn .iconify{font-size:20px}.container{margin-top:50px;padding:12px}.markdown-buttons .btnMarkdown{padding:6px 8px;font-size:12px}.user-info>*{font-size:12px}}.loading-overlay{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#00000080;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);display:flex;justify-content:center;align-items:center;z-index:1000}.loading-content{background-color:var(--bg-color);padding:20px 30px;border-radius:8px;box-shadow:0 4px 20px #0000004d;display:flex;align-items:center;justify-content:center;min-width:80px;min-height:80px}.loading-spinner{width:50px;height:50px;border:4px solid transparent;border-top:4px solid var(--accent-color, #007bff);border-right:4px solid var(--accent-color, #007bff);border-bottom:4px solid transparent;border-left:4px solid transparent;border-radius:50%;animation:loading-spin .8s linear infinite;opacity:.8}@keyframes loading-spin{to{transform:rotate(360deg)}}[data-theme=dark] .loading-content{box-shadow:0 4px 20px #0009}@media (max-width: 768px){.floating-toolbar{padding:8px;gap:6px;border-radius:12px}.floating-toolbar-btn{min-width:44px;min-height:44px;padding:8px 12px;font-size:18px}.floating-toolbar-btn .iconify{font-size:20px}.floating-toolbar-wrapper{-webkit-overflow-scrolling:touch;touch-action:pan-x}}@media (max-width: 768px){@keyframes fadeIn{0%{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}}.main-wrapper{display:flex;gap:15px;align-items:flex-start;width:100%}.calendar-box{flex-shrink:0;width:190px;background:#fff;box-shadow:0 0 10px #0000001a;border-radius:8px;padding:10px}.calendar-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;gap:4px}.calendar-header h3{margin:0;font-size:11px;font-weight:600;color:#333;min-width:75px;text-align:center;flex:1}.calendar-nav-btn{background:#f0f0f0;border:1px solid #ddd;border-radius:3px;padding:2px 5px;cursor:pointer;font-size:11px;color:#333;transition:all .2s ease}.calendar-nav-btn:hover{background:var(--accent-color, #007bff);color:#fff;border-color:var(--accent-color, #007bff)}.calendar-weekdays{display:grid;grid-template-columns:repeat(7,1fr);gap:1px;margin-bottom:5px}.weekday{text-align:center;font-size:8px;font-weight:600;color:#666;padding:1px 0;text-transform:uppercase}.calendar-days{display:grid;grid-template-columns:repeat(7,1fr);gap:1px}.calendar-day{aspect-ratio:1;display:flex;align-items:center;justify-content:center;font-size:10px;border-radius:3px;cursor:pointer;background:transparent;color:#666;border:1px solid transparent;transition:all .2s ease;position:relative}.calendar-day:hover{background:transparent;border-color:var(--accent-color, #007bff)}.calendar-day.other-month{color:#ccc;background:transparent}.calendar-day.other-month:hover{border-color:var(--accent-color, #007bff)}.calendar-day.today{background:transparent;color:#666;font-weight:600;border-color:var(--accent-color, #007bff)}.calendar-day.today:hover{background:transparent;border-color:var(--accent-color, #007bff)}.calendar-day.selected{background:var(--accent-color, #007bff);color:#fff;font-weight:600;border-color:var(--accent-color, #007bff)}.calendar-day.selected:hover{background:var(--accent-color, #007bff);border-color:var(--accent-color, #007bff)}.main{flex:1;min-width:300px}@media (max-width: 768px){.main-wrapper{flex-direction:column}.calendar-box{width:100%}.main{min-width:auto}.container{max-width:100%}} diff --git a/backend/public/assets/index-QEK5TGz3.css b/backend/public/assets/index-QEK5TGz3.css deleted file mode 100644 index d3cf2c1..0000000 --- a/backend/public/assets/index-QEK5TGz3.css +++ /dev/null @@ -1 +0,0 @@ -body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}:root{--accent-color: #007bff}[data-theme=light]{--bg-color: #ffffff;--text-color: #333333;--border-color: #e0e0e0;--shadow: rgba(0, 0, 0, .1)}[data-theme=dark]{--bg-color: #1a1a1a;--text-color: #e0e0e0;--border-color: #333333;--shadow: rgba(0, 0, 0, .5)}body{background-color:var(--bg-color);color:var(--text-color)}:root{--accent-color: #007bff;--accent-color-rgb: 0, 123, 255;--bg-primary: #f5f5f5;--bg-secondary: #ffffff;--bg-tertiary: #f8f9fa;--bg-quaternary: #e9ecef;--bg-hover: #e7f3ff;--text-primary: #333333;--text-secondary: #666666;--text-muted: #999999;--text-light: #757575;--border-primary: #e0e0e0;--border-secondary: #dddddd;--border-focus: var(--accent-color);--shadow-light: rgba(0, 0, 0, .1);--shadow-medium: rgba(0, 0, 0, .15);--icon-search: #2196f3;--icon-tags: #4caf50;--icon-notes: #ff9800;--icon-user: #9c27b0;--icon-danger: #dc3545}[data-theme=dark]{--bg-primary: #1a1a1a;--bg-secondary: #2d2d2d;--bg-tertiary: #3a3a3a;--bg-quaternary: #4a4a4a;--bg-hover: #2a4a6b;--text-primary: #ffffff;--text-secondary: #cccccc;--text-muted: #999999;--text-light: #aaaaaa;--border-primary: #404040;--border-secondary: #555555;--border-focus: var(--accent-color);--shadow-light: rgba(0, 0, 0, .3);--shadow-medium: rgba(0, 0, 0, .4);--icon-search: #64b5f6;--icon-tags: #81c784;--icon-notes: #ffb74d;--icon-user: #ba68c8;--icon-danger: #f44336}*{margin:0;padding:0;box-sizing:border-box}body{font-family:Open Sans,sans-serif;margin:0;background:var(--bg-primary);color:var(--text-primary);display:flex;flex-direction:row;justify-content:center;align-items:flex-start;gap:30px;padding:0 15px;transition:background-color .3s ease,color .3s ease}#root{display:contents}.notification-stack{position:fixed;top:0;left:0;right:0;z-index:10000;pointer-events:none}.notification-stack .notification{pointer-events:all}.iconify{font-size:16px;vertical-align:middle;display:inline-block;width:1em;height:1em}button{-webkit-tap-highlight-color:transparent;-moz-tap-highlight-color:transparent;tap-highlight-color:transparent;outline:none;box-shadow:none}button:focus,button:active{outline:none;box-shadow:none}input[type=button],input[type=submit],input[type=reset],a,div[role=button]{-webkit-tap-highlight-color:transparent;-moz-tap-highlight-color:transparent;tap-highlight-color:transparent;outline:none;box-shadow:none}input[type=button]:focus,input[type=submit]:focus,input[type=reset]:focus,a:focus,div[role=button]:focus,input[type=button]:active,input[type=submit]:active,input[type=reset]:active,a:active,div[role=button]:active{outline:none;box-shadow:none}iconify-icon{font-size:16px;vertical-align:middle;display:inline-block;width:1em;height:1em}header .iconify{font-size:20px;margin-right:8px}.search-title .iconify,.tags-title .iconify{font-size:14px;margin-right:6px}.search-title .iconify[data-icon="mdi:magnify"]{color:var(--icon-search)}.tags-title .iconify[data-icon="mdi:tag"]{color:var(--icon-tags)}header .iconify[data-icon="mdi:note-text"]{color:var(--icon-notes)}header .iconify[data-icon="mdi:account"],.username-clickable .iconify[data-icon="mdi:account"]{color:var(--icon-user)}.theme-toggle-btn{width:40px;height:40px;border-radius:50%;border:none;background:var(--bg-secondary);color:var(--text-secondary);cursor:pointer;font-size:18px;transition:all .3s ease;display:flex;align-items:center;justify-content:center;flex-shrink:0}.theme-toggle-btn:hover{background-color:var(--accent-color, #007bff);color:#fff;transform:scale(1.1)}.theme-toggle-btn .iconify{font-size:18px;color:var(--text-secondary);transition:color .3s ease;margin:0}.theme-toggle-btn:hover .iconify{color:#fff}header .iconify[data-icon="mdi:login"]{color:#2196f3}header .iconify[data-icon="mdi:account-plus"]{color:#4caf50}.btnMarkdown .iconify[data-icon="mdi:format-bold"]{color:#d32f2f}.btnMarkdown .iconify[data-icon="mdi:format-italic"]{color:#f57c00}.btnMarkdown .iconify[data-icon="mdi:palette"]{color:#e91e63}.btnMarkdown .iconify[data-icon="mdi:format-header-1"],.btnMarkdown .iconify[data-icon="mdi:format-header-pound"]{color:#1976d2}.btnMarkdown .iconify[data-icon="mdi:format-list-bulleted"]{color:#388e3c}.btnMarkdown .iconify[data-icon="mdi:format-quote-close"]{color:#f57c00}.btnMarkdown .iconify[data-icon="mdi:code-tags"]{color:#7b1fa2}.btnMarkdown .iconify[data-icon="mdi:link"]{color:#0288d1}.btnMarkdown .iconify[data-icon="mdi:format-strikethrough"]{color:#ff6f00}.btnMarkdown .iconify[data-icon="mdi:format-list-numbered"]{color:#4caf50}.btnMarkdown .iconify[data-icon="mdi:checkbox-marked-outline"]{color:#ff9800}.btnMarkdown .iconify[data-icon="mdi:image-plus"]{color:#2196f3}.btnMarkdown .iconify[data-icon="mdi:eye"]{color:#607d8b}.btnMarkdown .iconify[data-icon="mdi:file-plus"]{color:#9c27b0}.btnMarkdown .iconify[data-icon="mdi:eye-off"]{color:#e91e63}.btnMarkdown .iconify[data-icon="mdi:robot"]{color:#ff6f00}.notesHeaderBtn .iconify[data-icon="mdi:pencil"]{color:#2196f3}.notesHeaderBtn .iconify[data-icon="mdi:delete"]{color:#dc3545}header{font-size:20px;font-weight:700}.notes-header{display:flex;justify-content:space-between;align-items:flex-start;width:100%;box-sizing:border-box}.notes-header-left{display:flex;flex-direction:column;align-items:flex-start;flex:1;min-width:0}.search-section{margin-top:15px;padding-top:15px;border-top:1px solid var(--border-primary)}.search-header{margin-bottom:10px}.search-title{font-size:12px;font-weight:700;color:var(--text-primary)}.search-container{position:relative;width:100%}.search-input{width:100%;padding:6px 30px 6px 10px;border:1px solid var(--border-secondary);border-radius:15px;font-size:12px;background-color:var(--bg-tertiary);color:var(--text-primary);transition:all .3s ease;box-sizing:border-box}.search-input:focus{outline:none;border-color:var(--border-focus);background-color:var(--bg-secondary);box-shadow:0 0 0 2px rgba(var(--accent-color-rgb),.25)}.clear-search-btn{position:absolute;right:6px;top:50%;transform:translateY(-50%);background:none;border:none;color:#999;cursor:pointer;font-size:14px;padding:2px 4px;border-radius:50%;transition:all .2s ease}.clear-search-btn:hover{background-color:var(--bg-quaternary);color:var(--text-secondary)}.filter-indicator{display:inline-flex;align-items:center;margin-top:15px;padding:4px 10px;background-color:rgba(var(--accent-color-rgb),.1);border:1px solid rgba(var(--accent-color-rgb),.3);border-radius:15px;font-size:12px;color:var(--accent-color);font-weight:500;max-width:min(300px,100%);box-sizing:border-box}.filter-indicator-text{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.filter-indicator button{background:none;border:none;color:var(--icon-danger);cursor:pointer;margin-left:8px;font-weight:700;padding:2px 4px;font-size:14px;border-radius:3px;min-width:20px;min-height:20px;display:flex;align-items:center;justify-content:center;transition:all .2s ease}.filter-indicator button:hover{color:#ff6b6b;background-color:#ff6b6b1a}.user-info{display:flex;align-items:center;gap:15px;flex-shrink:0}.user-info span{font-size:14px;color:#666;font-weight:500}.user-avatar-mini{width:40px;height:40px;border-radius:50%;overflow:hidden;cursor:pointer;transition:all .3s ease;border:2px solid var(--accent-color, #007bff);flex-shrink:0}.user-avatar-mini:hover{transform:scale(1.05);box-shadow:0 0 0 3px rgba(var(--accent-color-rgb),.2)}.user-avatar-mini img{width:100%;height:100%;object-fit:cover}.user-avatar-placeholder-mini{display:flex;align-items:center;justify-content:center;background:#e0e0e0;color:#999;font-size:24px}.user-avatar-placeholder-mini .iconify{margin:0;padding:0;line-height:1;vertical-align:baseline}.settings-icon-btn{width:40px;height:40px;border-radius:50%;border:none;background:var(--bg-secondary);color:var(--text-secondary);cursor:pointer;font-size:18px;transition:all .3s ease;display:flex;align-items:center;justify-content:center;flex-shrink:0}.settings-icon-btn:hover{background-color:var(--accent-color, #007bff);color:#fff;transform:scale(1.1)}.settings-icon-btn .iconify{font-size:18px;color:var(--text-secondary);transition:color .3s ease;margin:0}.settings-icon-btn:hover .iconify{color:#fff}.logout-btn{width:40px;height:40px;border-radius:50%;border:none;background:var(--bg-secondary);color:var(--text-secondary);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .3s ease;flex-shrink:0}.logout-btn:hover{background-color:#dc3545}.logout-btn .iconify{font-size:20px;color:#dc3545;transition:color .3s ease;margin:0;padding:0;line-height:1;vertical-align:baseline}.logout-btn:hover .iconify{color:#fff}.notes-btn{width:40px;height:40px;border-radius:50%;border:none;background:var(--bg-secondary);color:var(--text-secondary);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .3s ease;flex-shrink:0}.notes-btn:hover{background-color:var(--accent-color, #007bff)}.notes-btn .iconify{font-size:20px;color:#666;transition:color .3s ease;margin:0;padding:0;line-height:1;vertical-align:baseline}.notes-btn:hover .iconify{color:#fff}.settings-btn{width:40px;height:40px;border-radius:50%;border:none;background:var(--bg-secondary);color:var(--text-secondary);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .3s ease;flex-shrink:0}.settings-btn:hover{background-color:var(--accent-color, #007bff)}.settings-btn .iconify{font-size:20px;color:#666;transition:color .3s ease;margin:0;padding:0;line-height:1;vertical-align:baseline}.settings-btn:hover .iconify{color:#fff}.profile-btn{width:40px;height:40px;border-radius:50%;border:none;background:var(--bg-secondary);color:var(--text-secondary);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .3s ease;flex-shrink:0}.profile-btn:hover{background-color:var(--accent-color, #007bff)}.profile-btn .iconify{font-size:20px;color:#666;transition:color .3s ease;margin:0;padding:0;line-height:1;vertical-align:baseline}.profile-btn:hover .iconify{color:#fff}.auth-link{text-align:center;margin-top:15px;font-size:14px}.auth-link a{color:var(--accent-color, #007bff);text-decoration:none;font-weight:500}.auth-link a:hover{text-decoration:underline}.container{width:90%;max-width:600px;box-shadow:0 0 10px var(--shadow-light);border-radius:8px;padding:15px;margin-top:20px;background:var(--bg-secondary);color:var(--text-primary);box-sizing:border-box;word-wrap:break-word;overflow-wrap:break-word;overflow:visible;transition:background-color .3s ease,color .3s ease,box-shadow .3s ease}.notes-container .container{margin-top:0}.notes-container{margin-top:8px}.empty-message{text-align:center;color:#999;margin-top:50px;word-break:break-word;overflow-wrap:break-word;max-width:100%;padding:0 20px;box-sizing:border-box}.login-form{margin-top:20px}.form-group{margin-bottom:15px}.form-group label{display:block;margin-bottom:5px;font-weight:700;color:var(--text-primary)}.form-group input{width:100%;padding:10px;border:1px solid var(--border-secondary);border-radius:5px;font-size:16px;background-color:var(--bg-tertiary);color:var(--text-primary);box-sizing:border-box;transition:all .3s ease}.form-group input:focus{outline:none;border-color:var(--border-focus);background-color:var(--bg-secondary);box-shadow:0 0 0 2px rgba(var(--accent-color-rgb),.25)}.ai-toggle-group{margin-bottom:20px}.ai-toggle-label{display:flex;align-items:center;justify-content:space-between;cursor:pointer;-webkit-user-select:none;user-select:none;font-weight:400!important;margin-bottom:0!important;padding:16px 20px;background-color:var(--bg-tertiary);border:1px solid var(--border-secondary);border-radius:8px;transition:all .3s ease}.ai-toggle-label:hover{background-color:var(--bg-secondary);border-color:var(--accent-color)}.ai-toggle-label.disabled{opacity:.6;cursor:not-allowed;background-color:var(--bg-secondary)}.ai-toggle-label.disabled:hover{background-color:var(--bg-secondary);border-color:var(--border-secondary)}.ai-toggle-label.disabled .toggle-text-main{color:var(--text-secondary)}.ai-toggle-label.disabled .toggle-text-desc{color:#e67e22;font-weight:500}.ai-toggle-label.disabled .toggle-slider{background-color:#999;cursor:not-allowed}.ai-toggle-label.disabled .toggle-slider:before{background-color:#ddd}.toggle-label-content{display:flex;flex-direction:column;gap:4px;flex:1;min-width:0}.toggle-text-main{color:var(--text-primary);font-size:15px;font-weight:500}.toggle-text-desc{color:var(--text-secondary);font-size:12px;line-height:1.4}.toggle-switch-wrapper{flex-shrink:0;margin-left:20px;position:relative}.toggle-checkbox{display:none}.toggle-slider{position:relative;display:block;width:50px;height:26px;background-color:#ccc;border-radius:26px;transition:background-color .3s ease;box-shadow:inset 0 1px 3px #0003}.toggle-slider:before{content:"";position:absolute;width:22px;height:22px;border-radius:50%;background-color:#fff;top:2px;left:2px;transition:transform .3s ease;box-shadow:0 2px 4px #0003}.toggle-checkbox:checked+.toggle-slider{background-color:var(--accent-color, #007bff);box-shadow:inset 0 1px 3px #0000004d}.toggle-checkbox:checked+.toggle-slider:before{transform:translate(24px)}.error-message{color:var(--icon-danger);margin-top:10px;padding:10px;background-color:#dc35451a;border:1px solid rgba(220,53,69,.3);border-radius:5px}textarea{width:100%;min-height:50px;resize:none;border:none;background:var(--bg-secondary);color:var(--text-primary);margin-bottom:5px;overflow-y:hidden;transition:background-color .3s ease,color .3s ease;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}textarea:focus{outline:none}.save-button-container{display:flex;flex-direction:column;gap:10px}.action-buttons{display:flex;align-items:center;gap:10px}.btnAI{background:linear-gradient(135deg,#667eea,#764ba2);color:#fff;display:flex;align-items:center;gap:6px}.btnAI:hover{background:linear-gradient(135deg,#5568d3,#5a3f7d);transform:translateY(-2px)}.btnAI:active{transform:translateY(0)}.btnAI .iconify{font-size:18px}.save-hint{font-size:12px;color:#999;font-style:italic}.btnSave{padding:10px 20px;cursor:pointer;border-width:1px;background:var(--bg-secondary);color:var(--text-primary);border:1px solid var(--border-secondary);border-radius:5px;font-family:Open Sans,sans-serif;transition:all .3s ease;font-size:16px}.btnSave:hover{background-color:var(--accent-color, #007bff);color:#fff;border-color:var(--accent-color, #007bff)}.date{font-size:11px;color:gray;display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}.date .date-text{flex:1;overflow:hidden;text-overflow:ellipsis;display:flex;align-items:center;gap:4px;flex-wrap:wrap}.date-separator{color:#999;font-weight:400;margin:0 2px}.note-actions{display:flex;align-items:center;gap:4px;flex-wrap:wrap}.notesHeaderBtn{display:inline-flex;align-items:center;justify-content:center;gap:4px;cursor:pointer;color:var(--text-primary);font-weight:700;white-space:nowrap;padding:2px 4px;border-radius:4px;transition:all .2s ease;font-size:10px}.notesHeaderBtn:hover{background:var(--bg-quaternary)}#pinBtn:hover{background:#ffc10733;color:#ffc107}#archiveBtn:hover{background:var(--bg-quaternary);color:var(--text-primary)}#editBtn:hover{background:#0dcaf033;color:#0dcaf0}#deleteBtn:hover{background:#dc354533;color:var(--icon-danger)}.textNote{margin-top:10px;white-space:pre-wrap;position:relative;transition:max-height .3s ease;word-wrap:break-word;overflow-wrap:break-word;word-break:break-word}.textNote.collapsed{max-height:300px;overflow:hidden}.textNote.collapsed:after{content:"";position:absolute;bottom:0;left:0;right:0;height:80px;background:linear-gradient(to bottom,transparent,var(--bg-secondary));pointer-events:none}.show-more-btn{display:flex;align-items:center;justify-content:center;width:100%;margin-top:10px;padding:8px;background-color:var(--bg-tertiary);border:1px solid var(--border-secondary);border-radius:5px;color:var(--accent-color, #007bff);font-size:14px;cursor:pointer;transition:all .3s ease;text-align:center;gap:5px}.show-more-btn:hover{background-color:var(--accent-color, #007bff);color:#fff;border-color:var(--accent-color, #007bff)}.textNote p{margin:0;padding:0;word-wrap:break-word;overflow-wrap:break-word}.textNote h1,.textNote h2,.textNote h3,.textNote h4,.textNote h5,.textNote h6{margin:0;padding:0;word-wrap:break-word;overflow-wrap:break-word;word-break:break-word}.textNote ul,.textNote ol{margin:0;padding-left:20px;word-wrap:break-word;overflow-wrap:break-word;line-height:.5}.textNote li{margin:0;padding:0;line-height:1;word-wrap:break-word;overflow-wrap:break-word}.textNote a{color:var(--accent-color, #007bff);text-decoration:none;word-wrap:break-word;overflow-wrap:break-word}.textNote a.external-link{position:relative;padding-right:16px}.textNote a.external-link:after{content:"↗";position:absolute;right:0;top:0;font-size:.8em;opacity:.7;transition:opacity .3s ease}.textNote a.external-link:hover:after{opacity:1}.textNote a:hover{text-decoration:underline}.textNote blockquote{border-left:4px solid var(--accent-color, #007bff);margin:10px 0;color:var(--text-secondary);font-style:italic;background-color:var(--bg-tertiary);padding:10px 16px;border-radius:0 4px 4px 0;word-wrap:break-word;overflow-wrap:break-word}.textNote blockquote p{margin:0}.textNote pre{background-color:var(--bg-tertiary);color:var(--text-primary);padding:10px;border-radius:5px;font-size:14px;overflow-x:auto;word-wrap:break-word;overflow-wrap:break-word;white-space:pre-wrap}.textNote code{background-color:var(--bg-tertiary);color:var(--text-primary);padding:2px 4px;border-radius:5px;font-size:14px;word-wrap:break-word;overflow-wrap:break-word;word-break:break-word}.textNote input[type=checkbox]{cursor:pointer;margin-right:8px;width:18px;height:18px;accent-color:var(--accent-color, #007bff);vertical-align:middle;position:relative;top:-1px}.textNote .task-list-item{list-style-type:none;margin-left:-20px;padding:0;line-height:1.5;transition:all .3s ease}.textNote .task-list-item:has(input[type=checkbox]:checked){opacity:.65;text-decoration:line-through;color:#999}.textNote .task-list-item input[type=checkbox]:checked~*{text-decoration:line-through;color:#999}.textNote .task-list-item:has(input[type=checkbox]:checked) *{text-decoration:line-through;color:#999}.textNote input[type=checkbox]:checked{text-decoration:none}.textNote input[type=checkbox]:checked+*{text-decoration:line-through;color:#999}.textNote .task-list-item:hover{background-color:rgba(var(--accent-color-rgb),.05);border-radius:4px;padding-left:4px;margin-left:-24px}.textNote li:has(input[type=checkbox]){list-style-type:none;margin-left:-20px;padding:0;line-height:1.5;transition:all .3s ease}.textNote li:has(input[type=checkbox]:checked){opacity:.65;text-decoration:line-through;color:#999}.textNote li:has(input[type=checkbox]) input[type=checkbox]:checked{text-decoration:none}.textNote li:has(input[type=checkbox]:checked) label,.textNote li:has(input[type=checkbox]:checked) span,.textNote li:has(input[type=checkbox]:checked) p{text-decoration:line-through;color:#999}.textNote li:has(input[type=checkbox]:checked) *{text-decoration:line-through;color:#999}.textNote li:has(input[type=checkbox]):hover{background-color:rgba(var(--accent-color-rgb),.05);border-radius:4px;padding-left:4px;margin-left:-24px}.notes-container{width:100%;display:flex;flex-direction:column;align-items:center;padding-bottom:60px;margin-top:16px;gap:16px;word-wrap:break-word;overflow-wrap:break-word}#notesList{width:100%;display:flex;flex-direction:column;align-items:center}.markdown-buttons{margin-top:10px;margin-bottom:10px;overflow-x:auto;overflow-y:hidden;position:relative;display:flex;flex-wrap:nowrap;gap:8px;align-items:center;scrollbar-width:none}.markdown-buttons::-webkit-scrollbar{display:none}.markdown-buttons.markdown-buttons--edit{display:flex;flex-wrap:nowrap;gap:8px;overflow-x:auto;overflow-y:hidden;scrollbar-width:none}.markdown-buttons.markdown-buttons--edit::-webkit-scrollbar{display:none}.markdown-buttons.markdown-buttons--edit .btnMarkdown{padding:5px 10px;margin-right:0;border:none;background-color:transparent;color:var(--text-primary);border-radius:4px;font-size:14px;touch-action:manipulation;-webkit-tap-highlight-color:transparent;user-select:none;-webkit-user-select:none;min-height:44px;display:inline-flex;align-items:center;justify-content:center;transition:all .3s ease}.markdown-buttons.markdown-buttons--edit .btnMarkdown:hover{background-color:var(--bg-quaternary)}@media (max-width: 768px){.markdown-buttons.markdown-buttons--edit .btnMarkdown{min-height:48px;padding:8px 12px;margin:0}}.markdown-buttons .btnMarkdown{padding:5px 10px;margin-right:0;cursor:pointer;border:none;background-color:transparent;color:var(--text-primary);border-radius:4px;font-size:14px;touch-action:manipulation;-webkit-tap-highlight-color:transparent;user-select:none;-webkit-user-select:none;min-height:44px;display:inline-flex;align-items:center;justify-content:center;transition:all .3s ease}.markdown-buttons .btnMarkdown:hover{background-color:var(--bg-quaternary)}.btnMarkdown.active{background-color:var(--accent-color);color:#fff}.btnMarkdown.active .iconify{color:#fff!important}.header-dropdown{position:relative;display:inline-block;overflow:visible;z-index:1}.header-dropdown-menu{display:block;position:fixed;background:var(--bg-secondary);border:1px solid var(--border-secondary);border-radius:5px;box-shadow:0 2px 8px var(--shadow-medium);z-index:1001;min-width:60px;max-width:120px}.header-dropdown-menu button{display:block;width:100%;padding:8px 16px;border:none;background:none;text-align:left;cursor:pointer;font-size:14px;font-weight:500;color:var(--text-primary);transition:background .2s ease}.header-dropdown-menu button:hover{background:var(--bg-quaternary)}.header-dropdown-menu button:first-child{border-radius:5px 5px 0 0}.header-dropdown-menu button:last-child{border-radius:0 0 5px 5px}.floating-toolbar-wrapper{overflow-x:auto;overflow-y:hidden;scrollbar-width:none;scroll-behavior:smooth;max-width:calc(100vw - 20px)}.floating-toolbar-wrapper::-webkit-scrollbar{display:none}.floating-toolbar{display:flex;gap:4px;background-color:var(--bg-secondary);border:1px solid var(--border-secondary);border-radius:8px;padding:6px;box-shadow:0 4px 12px #00000026;animation:fadeIn .2s ease-out;align-items:center;flex-shrink:0;min-width:fit-content;width:max-content}@keyframes fadeIn{0%{opacity:0;transform:translateY(-5px)}to{opacity:1;transform:translateY(0)}}.floating-toolbar-btn{padding:6px 10px;border:none;background-color:transparent;color:var(--text-primary);border-radius:4px;cursor:pointer;font-size:16px;display:flex;align-items:center;justify-content:center;transition:all .2s ease;min-width:32px;min-height:32px}.floating-toolbar-btn:hover{background-color:var(--bg-quaternary)}.floating-toolbar-btn:active{transform:scale(.95)}.floating-toolbar-btn:disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.floating-toolbar-btn .iconify{font-size:18px}.floating-toolbar-btn .iconify[data-icon="mdi:format-bold"]{color:#1976d2}.floating-toolbar-btn .iconify[data-icon="mdi:format-italic"]{color:#7b1fa2}.floating-toolbar-btn .iconify[data-icon="mdi:format-strikethrough"]{color:#ff6f00}.floating-toolbar-btn.active{background-color:var(--bg-quaternary);box-shadow:0 0 0 2px var(--border-focus)}.floating-toolbar-btn.active .iconify{opacity:1;filter:brightness(1.2)}.floating-toolbar-separator{width:1px;height:20px;background-color:var(--border-secondary);margin:0 4px}@media (max-width: 768px){.header-dropdown-menu{min-width:50px;right:-10px}}.footer{text-align:center;font-size:12px;color:#999;position:fixed;bottom:0;width:100%;padding:10px 0}.footer span{font-weight:700}.profile-container{margin-top:20px}.avatar-section{text-align:center;padding:20px;border-bottom:1px solid #e0e0e0;margin-bottom:20px}.avatar-wrapper{margin-bottom:15px;display:flex;justify-content:center;align-items:center}.avatar-preview{width:150px;height:150px;border-radius:50%;object-fit:cover;border:3px solid var(--accent-color, #007bff)}.avatar-placeholder{width:150px;height:150px;border-radius:50%;background-color:#e0e0e0;display:inline-flex;align-items:center;justify-content:center;font-size:64px;color:#999}.avatar-buttons{display:flex;justify-content:center;gap:10px;margin-top:15px}.btn-upload,.btn-delete{padding:8px 16px;cursor:pointer;border:1px solid var(--border-secondary);background-color:var(--bg-tertiary);color:var(--text-primary);border-radius:5px;font-size:14px;transition:all .3s ease;display:inline-block}.btn-upload:hover{background-color:var(--accent-color, #007bff);color:#fff;border-color:var(--accent-color, #007bff)}.btn-delete{color:#dc3545}.btn-delete:hover{background-color:#dc3545;color:#fff;border-color:#dc3545}.avatar-hint{font-size:12px;color:#999;margin-top:10px}.profile-form{padding:0 10px;margin-bottom:80px}.profile-form h3{margin-bottom:15px;color:var(--text-primary)}.separator{margin:30px 0;border:none;border-top:1px solid var(--border-primary)}.notification{position:fixed;top:20px;left:50%;transform:translate(-50%) translateY(-100%);padding:12px 20px;border-radius:8px;color:#fff;font-weight:500;z-index:10000;max-width:350px;box-shadow:0 4px 12px #0000004d;transition:transform .3s ease,top .3s ease;font-size:14px;line-height:1.4;word-wrap:break-word}.notification-success{background-color:#28a745}.notification-error{background-color:#dc3545}.notification-warning{background-color:#ffc107;color:#000}.notification-info{background-color:var(--accent-color, #007bff)}.notification.visible{transform:translate(-50%) translateY(0)}@media (max-width: 768px){.notification{left:10px;right:10px;max-width:none;transform:translateY(-100%)}.notification.visible{transform:translateY(0)}}.back-btn{padding:8px 16px;border:1px solid var(--border-secondary);background-color:var(--bg-tertiary);border-radius:5px;font-size:14px;color:var(--border-focus);text-decoration:none;transition:all .3s ease;display:inline-block}.back-btn:hover{background-color:var(--accent-color, #007bff);color:#fff;border-color:var(--accent-color, #007bff)}.username-clickable{cursor:pointer;transition:color .3s ease}.username-clickable:hover{color:var(--accent-color, #007bff);text-decoration:underline}.center{display:flex;justify-content:center;align-items:center;flex-direction:column;width:600px;height:100%}.container-leftside{width:220px;height:auto;max-width:220px;box-shadow:0 0 10px var(--shadow-light);border-radius:8px;padding:12px;margin-top:20px;background:var(--bg-secondary);color:var(--text-primary);transition:background-color .3s ease,color .3s ease,box-shadow .3s ease}.mini-calendar{width:100%}.calendar-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}.calendar-month-year{font-size:13px;font-weight:700;color:var(--text-primary);text-align:center;flex:1}.calendar-nav{background:none;border:none;font-size:18px;cursor:pointer;color:var(--text-secondary);padding:0 3px;transition:color .3s ease}.calendar-nav:hover{color:var(--accent-color)}.calendar-weekdays{display:grid;grid-template-columns:repeat(7,1fr);gap:1px;margin-bottom:3px}.calendar-weekday{text-align:center;font-size:9px;font-weight:700;color:var(--text-secondary);padding:3px 0}.calendar-day{aspect-ratio:1;display:flex;align-items:center;justify-content:center;font-size:11px;cursor:pointer;border-radius:3px;transition:all .2s ease;color:var(--text-primary);padding:2px;font-weight:500;position:relative;background-color:transparent;border:1px solid transparent}.calendar-day:hover{background-color:transparent;border-color:var(--accent-color, #007bff)}.calendar-day.today{background-color:transparent;color:var(--text-primary);font-weight:700;border:1px solid var(--accent-color, #007bff)}.calendar-day.today:hover{background-color:transparent;border-color:var(--accent-color, #007bff)}.calendar-day.other-month{color:var(--text-muted);background-color:transparent;border:1px solid transparent}.calendar-day.selected{background-color:var(--accent-color, #007bff);color:#fff;font-weight:700;opacity:1;border:1px solid var(--accent-color, #007bff)}.calendar-day.selected:hover{background-color:var(--accent-color, #007bff);border-color:var(--accent-color, #007bff)}@media (min-width: 769px){.mini-calendar,.container-leftside .mini-calendar{background-color:transparent}.calendar-month-year{font-size:14px;font-weight:600;color:var(--text-primary)}.calendar-nav{font-size:20px;color:var(--text-secondary);font-weight:400}.calendar-nav:hover{color:var(--accent-color)}.calendar-weekdays{margin-bottom:5px}.calendar-weekday{font-size:10px;font-weight:400;color:#999;text-transform:none}.calendar-day{font-size:12px;border-radius:4px;color:#fff;font-weight:400;background-color:transparent;border:1px solid transparent}.calendar-day:hover{background-color:transparent;border-color:var(--accent-color, #007bff)}.calendar-day.other-month{color:#999;background-color:transparent;border:1px solid transparent}.calendar-day.other-month:hover{border-color:var(--accent-color, #007bff)}.calendar-day.selected{background-color:var(--accent-color, #007bff);color:#fff;font-weight:500;opacity:1;border-radius:4px;border:1px solid var(--accent-color, #007bff)}.calendar-day.selected:hover{background-color:var(--accent-color, #007bff);border-color:var(--accent-color, #007bff)}.calendar-day.today{background-color:transparent;color:#fff;font-weight:500;border:1px solid var(--accent-color, #007bff)}.calendar-day.today:hover{background-color:transparent;border-color:var(--accent-color, #007bff)}}.calendar-day.has-notes:after{content:"";position:absolute;bottom:2px;left:50%;transform:translate(-50%);width:4px;height:4px;background-color:#28a745;border-radius:50%}.calendar-day.has-edited-notes:before{content:"";position:absolute;bottom:2px;left:50%;transform:translate(-50%);width:4px;height:4px;background-color:#ffc107;border-radius:50%}.calendar-day.has-notes.has-edited-notes:before{transform:translate(-150%)}.calendar-day.has-notes.has-edited-notes:after{transform:translate(50%)}.calendar-day.selected.has-notes:after{background-color:#28a745;border:1px solid #fff;box-shadow:0 0 3px #00000080}.calendar-day.selected.has-edited-notes:before{background-color:#ffc107;border:1px solid #fff;box-shadow:0 0 3px #00000080}.calendar-day.today.has-notes:after{background-color:#28a745;border:1px solid #fff;box-shadow:0 0 3px #00000080}.calendar-day.today.has-edited-notes:before{background-color:#ffc107;border:1px solid #fff;box-shadow:0 0 3px #00000080}.calendar-day.selected.has-notes.has-edited-notes:before,.calendar-day.selected.has-notes.has-edited-notes:after{border:1px solid #fff;box-shadow:0 0 3px #00000080}.calendar-day.today.has-notes.has-edited-notes:before,.calendar-day.today.has-notes.has-edited-notes:after{border:1px solid #fff;box-shadow:0 0 3px #00000080}@media (min-width: 769px){[data-theme=dark] .mini-calendar,[data-theme=dark] .container-leftside .mini-calendar{background-color:transparent}[data-theme=dark] .calendar-day{background-color:transparent;color:#fff;border:1px solid transparent}[data-theme=dark] .calendar-day:hover{background-color:transparent;border-color:var(--accent-color, #007bff)}[data-theme=dark] .calendar-day.other-month{background-color:transparent;color:#999;border:1px solid transparent}[data-theme=dark] .calendar-day.other-month:hover{border-color:var(--accent-color, #007bff)}[data-theme=dark] .calendar-day.today{background-color:transparent;color:#fff;border:1px solid var(--accent-color, #007bff)}[data-theme=dark] .calendar-day.today:hover{background-color:transparent;border-color:var(--accent-color, #007bff)}[data-theme=dark] .calendar-day.selected{background-color:var(--accent-color, #007bff);color:#fff;opacity:1;border:1px solid var(--accent-color, #007bff)}[data-theme=dark] .calendar-day.selected:hover{background-color:var(--accent-color, #007bff);border-color:var(--accent-color, #007bff)}[data-theme=dark] .calendar-nav{color:#fff}[data-theme=dark] .calendar-nav:hover{opacity:.8}[data-theme=dark] .calendar-weekday{color:#999}[data-theme=dark] .calendar-month-year{color:#fff}[data-theme=dark] .calendar-day.has-notes:after{background-color:#28a745}[data-theme=dark] .calendar-day.has-edited-notes:before{background-color:#ffc107}}[data-theme=dark] .calendar-day.has-notes:after{background-color:#28a745;box-shadow:0 0 2px #28a74599}[data-theme=dark] .calendar-day.has-edited-notes:before{background-color:#ffc107;box-shadow:0 0 2px #ffc10799}.tags-section{margin-top:15px;padding-top:15px;border-top:1px solid var(--border-primary)}.tags-header{margin-bottom:10px}.tags-title{font-size:12px;font-weight:700;color:var(--text-primary)}.tags-container{display:flex;flex-wrap:wrap;gap:5px}.tag{display:inline-block;padding:4px 8px;background-color:rgba(var(--accent-color-rgb),.1);color:var(--accent-color);border:1px solid rgba(var(--accent-color-rgb),.3);border-radius:12px;font-size:10px;font-weight:500;cursor:pointer;transition:all .2s ease;-webkit-user-select:none;user-select:none;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:break-word}.tag:hover{background-color:var(--accent-color, #007bff);color:#fff}.tag.active{background-color:var(--accent-color, #007bff);color:#fff;font-weight:700}.tag-count{margin-left:4px;font-size:9px;opacity:.8}.textNote .tag-in-note{display:inline-block;padding:2px 6px;background-color:rgba(var(--accent-color-rgb),.1);color:var(--accent-color);border:1px solid rgba(var(--accent-color-rgb),.3);border-radius:8px;font-size:12px;font-weight:500;cursor:pointer;transition:all .2s ease;text-decoration:none;margin:0 2px;word-wrap:break-word;overflow-wrap:break-word}.textNote .tag-in-note:hover{background-color:var(--accent-color, #007bff);color:#fff;transform:translateY(-1px);box-shadow:0 2px 4px rgba(var(--accent-color-rgb),.3)}.search-highlight{background-color:#fff3cd;padding:1px 2px;border-radius:2px;font-weight:500}.search-highlight.current{background-color:#ffc107;color:#000}.mobile-sidebar{display:flex;position:fixed;top:0;left:-85vw;width:85vw;max-width:320px;height:100vh;background:var(--bg-secondary);color:var(--text-primary);box-shadow:2px 0 10px var(--shadow-light);z-index:1000;overflow-y:auto;transition:left .3s ease;flex-direction:column;padding:0}.sidebar-close-btn{display:flex;align-items:center;justify-content:center;width:40px;height:40px;padding:0;margin:10px 10px 10px auto;background:var(--bg-tertiary);border:1px solid var(--border-secondary);border-radius:8px;cursor:pointer;transition:all .2s ease;flex-shrink:0}.mobile-sidebar .mini-calendar{width:100%;margin-bottom:15px}.mobile-sidebar .calendar-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;gap:4px}.mobile-sidebar .calendar-month-year{font-size:12px;font-weight:700;color:var(--text-primary);text-align:center;flex:1}.mobile-sidebar .calendar-nav{background:none;border:none;font-size:16px;cursor:pointer;color:var(--text-secondary);padding:0 3px;transition:color .3s ease}.mobile-sidebar .calendar-nav:hover{color:var(--accent-color)}.mobile-sidebar .calendar-days{display:grid;grid-template-columns:repeat(7,1fr);gap:1px;margin-bottom:15px}.mobile-sidebar .calendar-day{aspect-ratio:1;display:flex;align-items:center;justify-content:center;font-size:9px;cursor:pointer;border-radius:3px;transition:all .2s ease;color:var(--text-primary);padding:1px;font-weight:500;position:relative;background-color:transparent;border:1px solid transparent}.mobile-sidebar .calendar-day:hover{background-color:transparent;border-color:var(--accent-color, #007bff)}.mobile-sidebar .calendar-day.today{background-color:transparent;color:var(--text-primary);font-weight:700;border:1px solid var(--accent-color, #007bff)}.mobile-sidebar .calendar-day.today:hover{background-color:transparent;border-color:var(--accent-color, #007bff)}.mobile-sidebar .calendar-day.selected{background-color:var(--accent-color, #007bff);color:#fff;font-weight:700;opacity:1;border:1px solid var(--accent-color, #007bff)}.mobile-sidebar .calendar-day.selected:hover{background-color:var(--accent-color, #007bff);border-color:var(--accent-color, #007bff)}.mobile-sidebar .calendar-day.other-month{color:var(--text-muted);background-color:transparent;border:1px solid transparent}.mobile-sidebar .calendar-day.other-month:hover{border-color:var(--accent-color, #007bff)}[data-theme=dark] .mobile-sidebar .calendar-day{background-color:transparent;color:var(--text-primary);border:1px solid transparent}[data-theme=dark] .mobile-sidebar .calendar-day:hover{background-color:transparent;border-color:var(--accent-color, #007bff)}[data-theme=dark] .mobile-sidebar .calendar-day.other-month{background-color:transparent;color:var(--text-muted);border:1px solid transparent}[data-theme=dark] .mobile-sidebar .calendar-day.other-month:hover{border-color:var(--accent-color, #007bff)}[data-theme=dark] .mobile-sidebar .calendar-day.today{background-color:transparent;color:var(--text-primary);border:1px solid var(--accent-color, #007bff)}[data-theme=dark] .mobile-sidebar .calendar-day.today:hover{background-color:transparent;border-color:var(--accent-color, #007bff)}[data-theme=dark] .mobile-sidebar .calendar-day.selected{background-color:var(--accent-color, #007bff);color:#fff;opacity:1;border:1px solid var(--accent-color, #007bff)}[data-theme=dark] .mobile-sidebar .calendar-day.selected:hover{background-color:var(--accent-color, #007bff);border-color:var(--accent-color, #007bff)}[data-theme=dark] .mobile-sidebar .calendar-nav:hover{color:var(--border-focus)}[data-theme=dark] .mobile-sidebar .calendar-weekday{color:var(--text-secondary)}[data-theme=dark] .mobile-sidebar .calendar-day.has-notes:after{background-color:#28a745;box-shadow:0 0 2px #28a74599}[data-theme=dark] .mobile-sidebar .calendar-day.has-edited-notes:before{background-color:#ffc107;box-shadow:0 0 2px #ffc10799}.mobile-sidebar .search-section{margin-bottom:15px;padding-bottom:15px;border-bottom:1px solid var(--border-primary)}.mobile-sidebar .search-title{font-size:11px;font-weight:700;color:var(--text-primary);display:block;margin-bottom:8px}.mobile-sidebar .search-input{width:100%;padding:6px 10px;border:1px solid var(--border-secondary);border-radius:15px;font-size:11px;background-color:var(--bg-tertiary);color:var(--text-primary);transition:all .3s ease;box-sizing:border-box}.mobile-sidebar .search-input:focus{outline:none;border-color:var(--accent-color, #007bff);background-color:var(--bg-secondary);box-shadow:0 0 0 2px rgba(var(--accent-color-rgb),.25)}.mobile-sidebar .tags-section{margin-top:0;padding-top:0;border-top:none}.mobile-sidebar .tags-title{font-size:11px;font-weight:700;color:var(--text-primary);display:block;margin-bottom:8px}.mobile-sidebar .tags-container{display:flex;flex-wrap:wrap;gap:5px}.mobile-sidebar .tag{display:inline-block;padding:4px 8px;background-color:rgba(var(--accent-color-rgb),.1);color:var(--accent-color);border:1px solid rgba(var(--accent-color-rgb),.3);border-radius:12px;font-size:9px;font-weight:500;cursor:pointer;transition:all .2s ease;-webkit-user-select:none;user-select:none;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:break-word}.mobile-sidebar .tag:hover{background-color:var(--accent-color, #007bff);color:#fff}.mobile-sidebar .tag.active{background-color:var(--accent-color, #007bff);color:#fff;font-weight:700}.mobile-sidebar .tag-count{margin-left:3px;font-size:8px;opacity:.8}@media (max-width: 768px){.ai-toggle-label{padding:12px 16px}.toggle-text-main{font-size:14px}.toggle-text-desc{font-size:11px}.toggle-switch-wrapper{margin-left:12px}.toggle-slider{width:44px;height:24px}.toggle-slider:before{width:20px;height:20px}.toggle-checkbox:checked+.toggle-slider:before{transform:translate(20px)}.mobile-menu-btn{display:flex;align-items:center;justify-content:center}.container-leftside{display:none!important}body{flex-direction:column;gap:0;padding:0 10px;justify-content:flex-start;align-items:center}.center{width:100%;max-width:600px;margin:60px auto 0}.container{width:100%;max-width:none;margin-top:5px;padding:10px;box-sizing:border-box}.center>.container:first-child{margin-top:3px}.notes-container .container{margin-top:0}.notes-container{margin-top:5px}.notes-header{flex-direction:row;align-items:center;gap:10px;width:100%}.notes-header-left{flex:1;min-width:0}.user-info{flex-shrink:0;flex-wrap:wrap;gap:8px}.user-info .back-btn{font-size:12px;padding:6px 8px;white-space:nowrap}.user-info .theme-toggle-btn{flex-shrink:0}@media (max-width: 480px){.user-info{flex-shrink:0;gap:4px}.user-info .back-btn{font-size:11px;padding:4px 6px}.user-info .theme-toggle-btn{width:32px;height:32px;padding:6px}.user-info .theme-toggle-btn .iconify{font-size:16px}.settings-icon-btn{width:32px;height:32px;padding:6px}.settings-icon-btn .iconify{font-size:16px}}.markdown-buttons{display:flex;flex-wrap:nowrap;gap:8px;width:100%;justify-content:flex-start;overflow-x:auto;overflow-y:hidden;scrollbar-width:none}.markdown-buttons::-webkit-scrollbar{display:none}.markdown-buttons .btnMarkdown{flex:0 1 auto;min-width:auto;margin-right:0;padding:8px 12px;font-size:14px;border:none;background-color:transparent}textarea{min-height:100px}.save-button-container,.action-buttons{width:100%;flex-direction:column}.btnSave,.btnAI,.btn-secondary{width:100%;text-align:center;justify-content:center}.footer{position:relative;margin-top:20px}}.image-preview-container{margin:15px 0;padding:15px;background:#f8f9fa;border:2px dashed #dee2e6;border-radius:8px;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.image-preview-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;font-weight:600;color:#495057}.note-preview-container{margin:15px 0;padding:15px;background:var(--bg-tertiary);border:2px solid var(--accent-color, #007bff);border-radius:8px;min-height:200px;max-height:600px;overflow-y:auto;transition:background-color .3s ease,border-color .3s ease}.note-preview-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:15px;padding-bottom:10px;border-bottom:2px solid var(--border-primary);font-weight:600;color:var(--accent-color, #007bff);font-size:16px;transition:color .3s ease,border-color .3s ease}.note-preview-content{background:var(--bg-secondary);color:var(--text-primary);padding:15px;border-radius:6px;min-height:150px;transition:background-color .3s ease,color .3s ease}.textNote .markdown-buttons--edit,.textNote .note-preview-container,.textNote .image-preview-container,.textNote .file-preview-container,.textNote .textInput,.textNote textarea.textInput{width:100%;box-sizing:border-box}.textNote .file-preview-container .file-preview-item{padding:6px 10px;min-height:40px}.textNote .file-preview-container .file-preview-item .file-icon{font-size:24px}.textNote .file-preview-container .file-preview-item .file-name{font-size:14px;line-height:1.2}.textNote .file-preview-container .file-preview-item .file-size{font-size:11px;margin-top:1px;line-height:1.2}.textNote .file-preview-container .file-preview-item .remove-file-btn{width:24px;height:24px;font-size:14px}.note-preview-content h1,.note-preview-content h2,.note-preview-content h3,.note-preview-content h4,.note-preview-content h5,.note-preview-content h6{margin-top:.5em;margin-bottom:.5em;color:var(--text-primary);transition:color .3s ease}.note-preview-content p{margin:.5em 0;color:var(--text-primary);transition:color .3s ease}.note-preview-content ul,.note-preview-content ol{margin:.5em 0;padding-left:2em;color:var(--text-primary);transition:color .3s ease}.note-preview-content li{color:var(--text-primary);transition:color .3s ease}.note-preview-content a{color:var(--accent-color, #007bff);text-decoration:none;transition:color .3s ease}.note-preview-content a:hover{text-decoration:underline}.note-preview-content code{background:var(--bg-quaternary);color:var(--text-primary);padding:2px 6px;border-radius:4px;font-family:Courier New,monospace;transition:background-color .3s ease,color .3s ease}.note-preview-content pre{background:var(--bg-quaternary);color:var(--text-primary);padding:10px;border-radius:6px;overflow-x:auto;border:1px solid var(--border-primary);transition:background-color .3s ease,color .3s ease,border-color .3s ease}.note-preview-content pre code{background:transparent;padding:0;border-radius:0}.note-preview-content blockquote{border-left:4px solid var(--accent-color, #007bff);margin:10px 0;color:var(--text-secondary);background-color:var(--bg-tertiary);padding:8px 15px;border-radius:0 4px 4px 0;transition:color .3s ease,background-color .3s ease,border-color .3s ease}.note-preview-content blockquote p{color:var(--text-secondary);margin:0}.note-preview-content img{max-width:100%;height:auto;border-radius:6px;margin:10px 0;box-shadow:0 2px 4px var(--shadow-light);transition:box-shadow .3s ease}.note-preview-content table{width:100%;border-collapse:collapse;margin:10px 0;background:var(--bg-secondary);border-radius:6px;overflow:hidden;box-shadow:0 1px 3px var(--shadow-light);transition:background-color .3s ease,box-shadow .3s ease}.note-preview-content th,.note-preview-content td{padding:8px 12px;text-align:left;border-bottom:1px solid var(--border-primary);color:var(--text-primary);transition:color .3s ease,border-color .3s ease}.note-preview-content th{background:var(--bg-tertiary);font-weight:700;color:var(--text-primary);transition:background-color .3s ease,color .3s ease}.note-preview-content tr:hover{background:var(--bg-quaternary);transition:background-color .3s ease}.note-preview-content hr{border:none;height:1px;background:var(--border-primary);margin:20px 0;transition:background-color .3s ease}[data-theme=dark] .note-preview-container{background:var(--bg-tertiary);border-color:var(--accent-color)}[data-theme=dark] .note-preview-header{color:var(--accent-color);border-bottom-color:var(--border-primary)}[data-theme=dark] .note-preview-content{background:var(--bg-secondary);color:var(--text-primary)}[data-theme=dark] .note-preview-content code,[data-theme=dark] .note-preview-content pre{background:var(--bg-quaternary);color:#e6e6e6;border:1px solid var(--border-primary)}[data-theme=dark] .note-preview-content pre code{background:transparent;border:none;color:#e6e6e6}[data-theme=dark] .note-preview-content blockquote{background-color:var(--bg-tertiary);border-left-color:var(--accent-color);color:var(--text-secondary)}[data-theme=dark] .note-preview-content table{background:var(--bg-secondary);box-shadow:0 1px 3px var(--shadow-light)}[data-theme=dark] .note-preview-content th{background:var(--bg-tertiary);color:var(--text-primary)}[data-theme=dark] .note-preview-content th,[data-theme=dark] .note-preview-content td{border-bottom-color:var(--border-primary);color:var(--text-primary)}[data-theme=dark] .note-preview-content tr:hover{background:var(--bg-quaternary)}[data-theme=dark] .note-preview-content img{box-shadow:0 2px 4px var(--shadow-light)}.note-preview-content input[type=checkbox]{cursor:pointer;margin-right:8px;width:18px;height:18px;accent-color:var(--accent-color, #007bff);vertical-align:middle;position:relative;top:-1px}.note-preview-content .task-list-item{list-style-type:none;margin-left:-20px;padding:0;line-height:1.5;transition:all .3s ease}.note-preview-content .task-list-item:has(input[type=checkbox]:checked){opacity:.65;text-decoration:line-through;color:var(--text-muted)}.note-preview-content .task-list-item input[type=checkbox]:checked~*{text-decoration:line-through;color:var(--text-muted)}.note-preview-content .task-list-item:has(input[type=checkbox]:checked) *{text-decoration:line-through;color:var(--text-muted)}.note-preview-content .task-list-item:hover{background-color:rgba(var(--accent-color-rgb),.05);border-radius:4px;padding-left:4px;margin-left:-24px}.note-preview-content input[type=checkbox]:checked{text-decoration:none}.note-preview-content input[type=checkbox]:checked+*{text-decoration:line-through;color:var(--text-muted)}.note-preview-content li:has(input[type=checkbox]){list-style-type:none;margin-left:-20px;padding:0;line-height:1.5;transition:all .3s ease}.note-preview-content li:has(input[type=checkbox]:checked){opacity:.65;text-decoration:line-through;color:var(--text-muted)}.note-preview-content li:has(input[type=checkbox]) input[type=checkbox]:checked{text-decoration:none}.note-preview-content li:has(input[type=checkbox]:checked) label,.note-preview-content li:has(input[type=checkbox]:checked) span,.note-preview-content li:has(input[type=checkbox]:checked) p{text-decoration:line-through;color:var(--text-muted)}.note-preview-content li:has(input[type=checkbox]:checked) *{text-decoration:line-through;color:var(--text-muted)}.note-preview-content li:has(input[type=checkbox]):hover{background-color:rgba(var(--accent-color-rgb),.05);border-radius:4px;padding-left:4px;margin-left:-24px}.clear-images-btn{background:#dc3545;color:#fff;border:none;padding:4px 8px;border-radius:4px;cursor:pointer;font-size:12px;transition:background-color .3s ease}.clear-images-btn:hover{background:#c82333}.image-preview-list{display:flex;flex-wrap:wrap;gap:10px}.image-preview-item{position:relative;border:1px solid #dee2e6;border-radius:6px;overflow:hidden;background:#fff}.image-preview-item img{width:100px;height:100px;object-fit:cover;display:block}.image-preview-item .remove-image-btn{position:absolute;top:2px;right:2px;background:#dc3545cc;color:#fff;border:none;border-radius:50%;width:24px;height:24px;cursor:pointer;font-size:14px;display:flex;align-items:center;justify-content:center;transition:background-color .3s ease;touch-action:manipulation;-webkit-tap-highlight-color:transparent;user-select:none;-webkit-user-select:none}.image-preview-item .remove-image-btn:hover{background:#dc3545}.image-preview-item .image-preview-remove{position:absolute;top:2px;right:2px;background:#dc3545e6;color:#fff;border:none;border-radius:50%;width:28px;height:28px;cursor:pointer;font-size:16px;display:flex;align-items:center;justify-content:center;transition:all .3s ease;touch-action:manipulation;-webkit-tap-highlight-color:transparent;user-select:none;-webkit-user-select:none;box-shadow:0 2px 4px #0003;z-index:10}.image-preview-item .image-preview-remove:hover{background:#dc3545;transform:scale(1.1);box-shadow:0 3px 6px #0000004d}.image-preview-item .image-preview-remove:active{transform:scale(.95)}.file-preview-item .file-preview-remove{background:#dc3545e6;color:#fff;border:none;border-radius:50%;width:28px;height:28px;cursor:pointer;font-size:16px;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:all .3s ease;touch-action:manipulation;-webkit-tap-highlight-color:transparent;user-select:none;-webkit-user-select:none;box-shadow:0 2px 4px #0003;margin-left:auto}.file-preview-item .file-preview-remove:hover{background:#dc3545;transform:scale(1.1);box-shadow:0 3px 6px #0000004d}.file-preview-item .file-preview-remove:active{transform:scale(.95)}.image-preview-item .image-preview-remove.restore-btn,.file-preview-item .file-preview-remove.restore-btn{background:#28a745e6!important}.image-preview-item .image-preview-remove.restore-btn:hover,.file-preview-item .file-preview-remove.restore-btn:hover{background:#28a745!important}.image-preview-item .image-preview-remove[style*=green],.file-preview-item .file-preview-remove[style*=green]{background:#28a745e6!important}.image-preview-item .image-preview-remove[style*=green]:hover,.file-preview-item .file-preview-remove[style*=green]:hover{background:#28a745!important}.image-preview-item .image-info{padding:4px 6px;font-size:10px;color:#6c757d;background:#f8f9fa;word-break:break-all}.note-image{width:150px;height:150px;object-fit:cover;border-radius:6px;margin:10px 0;box-shadow:0 2px 4px #0000001a;cursor:pointer;transition:transform .2s ease}.note-image:hover{transform:scale(1.02);box-shadow:0 4px 8px #0003}.note-image:after{content:"🔍";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);background:#000000b3;color:#fff;padding:8px;border-radius:50%;font-size:16px;opacity:0;transition:opacity .2s ease;pointer-events:none}.note-image:hover:after{opacity:1}.note-images-container{margin:10px 0;display:flex;flex-wrap:wrap;gap:10px}.note-image-item{position:relative;display:inline-block}.note-image-item .note-image{position:relative}.note-files-container{margin:10px 0;display:flex;flex-direction:column;gap:8px}.note-file-item{display:flex;align-items:center}.note-file-link{display:flex;align-items:center;padding:10px;background:#f8f9fa;border:1px solid #dee2e6;border-radius:6px;text-decoration:none;color:inherit;gap:12px;width:100%;transition:all .2s}.note-file-link:hover{background:#e9ecef;border-color:var(--accent-color, #007bff);transform:translateY(-1px);box-shadow:0 2px 4px #0000001a}.note-file-link .file-icon{font-size:32px;color:var(--accent-color, #007bff);flex-shrink:0}.note-file-link .file-info{flex:1;min-width:0}.note-file-link .file-name{font-weight:500;color:#333;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.note-file-link .file-size{font-size:12px;color:#666;margin-top:2px}.note-image-item .remove-note-image-btn{position:absolute;top:5px;right:5px;background:#dc3545cc;color:#fff;border:none;border-radius:50%;width:24px;height:24px;cursor:pointer;font-size:14px;display:flex;align-items:center;justify-content:center;transition:background-color .3s ease;opacity:0}.note-image-item:hover .remove-note-image-btn{opacity:1}.note-image-item .remove-note-image-btn:hover{background:#dc3545}.image-modal{display:none;position:fixed;z-index:1000;left:0;top:0;width:100%;height:100%;background-color:#000000e6;cursor:pointer}.image-modal-content{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);max-width:90%;max-height:90%;object-fit:contain}.image-modal-close{position:absolute;top:15px;right:35px;color:#f1f1f1;font-size:40px;font-weight:700;cursor:pointer}.image-modal-close:hover{color:#bbb}.modal{display:none;position:fixed;z-index:1000;left:0;top:0;width:100%;height:100%;background-color:#00000080;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.modal-content{background-color:#fff;margin:10% auto;padding:0;border-radius:8px;width:90%;max-width:500px;box-shadow:0 4px 20px #0000004d;animation:modalFadeIn .3s ease-out}@keyframes modalFadeIn{0%{opacity:0;transform:translateY(-20px)}to{opacity:1;transform:translateY(0)}}.modal-header{padding:20px 25px;border-bottom:1px solid #eee;display:flex;justify-content:space-between;align-items:center}.modal-header h3{margin:0;color:#333;font-size:20px}.modal-close{color:#aaa;font-size:28px;font-weight:700;cursor:pointer;line-height:1}.modal-close:hover{color:#666}.modal-body{padding:25px;color:#555;line-height:1.5}.modal-footer{padding:20px 25px;border-top:1px solid #eee;display:flex;justify-content:flex-end;gap:10px}[data-theme=dark] .modal-content{background-color:var(--bg-secondary);color:var(--text-primary)}[data-theme=dark] .modal-header{border-bottom-color:var(--border-primary)}[data-theme=dark] .modal-header h3{color:var(--text-primary)}[data-theme=dark] .modal-close{color:var(--text-secondary)}[data-theme=dark] .modal-close:hover{color:var(--text-primary)}[data-theme=dark] .modal-body{color:var(--text-secondary)}[data-theme=dark] .modal-footer{border-top-color:var(--border-primary)}.modal-password-input{width:100%;padding:10px;border:1px solid var(--border-secondary);border-radius:4px;font-size:16px;background-color:var(--bg-tertiary);color:var(--text-primary);box-sizing:border-box;transition:all .3s ease}.modal-password-input:focus{outline:none;border-color:var(--border-focus);background-color:var(--bg-secondary);box-shadow:0 0 0 2px #4a9eff40}.modal-password-input::placeholder{color:var(--text-muted)}@media (max-width: 768px){.image-preview-list,.note-images-container{justify-content:center}.image-preview-item img{width:80px;height:80px}.markdown-buttons .btnMarkdown{min-height:48px;padding:8px 12px;margin:2px}.image-preview-item .remove-image-btn{width:28px;height:28px;font-size:16px}.image-preview-item .image-preview-remove,.file-preview-item .file-preview-remove{width:32px;height:32px;font-size:18px}.clear-images-btn{min-height:44px;padding:8px 16px;font-size:14px}.note-image{width:120px;height:120px}}.accent-color-picker{display:flex;gap:10px;margin-bottom:10px;flex-wrap:wrap}.color-option{width:40px;height:40px;border-radius:50%;cursor:pointer;border:3px solid transparent;transition:all .3s ease;position:relative}.color-option:hover{transform:scale(1.1);box-shadow:0 2px 8px #0003}.color-option.selected{border-color:#333;transform:scale(1.1);box-shadow:0 0 0 2px #fff,0 0 0 4px #333}.color-option:after{content:"✓";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:#fff;font-weight:700;font-size:18px;opacity:0;transition:opacity .2s ease}.color-option.selected:after{opacity:1}#accentColor{width:60px;height:40px;border:none;border-radius:5px;cursor:pointer}.settings-tabs{display:flex;gap:10px;margin:20px 0;border-bottom:2px solid #e0e0e0;flex-wrap:wrap}.settings-tab{padding:10px 20px;background:none;border:none;border-bottom:3px solid transparent;cursor:pointer;font-size:16px;color:#666;transition:all .3s ease;display:flex;align-items:center;gap:8px}.settings-tab:hover{color:var(--accent-color, #007bff);background:rgba(var(--accent-color-rgb),.05)}.settings-tab.active{color:var(--accent-color, #007bff);border-bottom-color:var(--accent-color, #007bff);font-weight:700}.settings-content{margin-top:20px}.tab-content{display:none}.tab-content.active{display:block}.archived-notes-list{display:flex;flex-direction:column;gap:15px}.archived-note-item{background:var(--bg-secondary);border:1px solid var(--border-primary);border-radius:8px;padding:15px;transition:all .3s ease;color:var(--text-primary)}.archived-note-item:hover{box-shadow:0 2px 8px var(--shadow-light)}.archived-note-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;flex-wrap:wrap;gap:10px}.archived-note-date{font-size:12px;color:var(--text-muted)}.archived-note-actions{display:flex;gap:8px}.btn-restore,.btn-delete-permanent{padding:6px 12px;border:1px solid var(--border-secondary);border-radius:5px;background:var(--bg-tertiary);color:var(--text-primary);cursor:pointer;font-size:13px;transition:all .3s ease;display:flex;align-items:center;gap:4px}.btn-restore{color:var(--accent-color, #007bff);border-color:var(--accent-color, #007bff)}.btn-restore:hover{background:var(--accent-color, #007bff);color:#fff}.btn-delete-permanent{color:#dc3545;border-color:#dc3545}.btn-delete-permanent:hover{background:#dc3545;color:#fff}.btn-primary{background-color:var(--accent-color, #007bff);color:#fff;border:1px solid var(--accent-color, #007bff);padding:10px 20px;border-radius:5px;cursor:pointer;font-size:14px;transition:all .3s ease;display:inline-flex;align-items:center;gap:6px}.btn-primary:hover{background-color:var(--accent-color, #007bff);border-color:var(--accent-color, #007bff);opacity:.9;filter:brightness(.9)}.btn-primary:disabled{background-color:#6c757d;border-color:#6c757d;cursor:not-allowed;opacity:.6}.btn-danger{background-color:#dc3545;color:#fff;border:1px solid #dc3545;padding:10px 20px;border-radius:5px;cursor:pointer;font-size:14px;transition:all .3s ease;display:inline-flex;align-items:center;gap:6px}.btn-danger:hover{background-color:#c82333;border-color:#bd2130}.btn-danger:disabled{background-color:#6c757d;border-color:#6c757d;cursor:not-allowed;opacity:.6}.danger-zone{background-color:var(--bg-secondary);border:2px solid #dc3545;border-radius:8px;padding:20px;margin-top:20px;position:relative}.danger-zone:before{content:"⚠️";position:absolute;top:-10px;left:20px;background-color:var(--bg-primary);padding:0 10px;font-size:16px}.danger-zone h3{color:#dc3545;margin-top:0;margin-bottom:15px;font-size:18px;font-weight:700}.danger-zone p{color:var(--text-secondary);font-size:14px;line-height:1.5;margin-bottom:15px}.danger-zone .btn-danger{background-color:#dc3545;border-color:#dc3545;font-weight:600;padding:12px 24px;font-size:15px}.danger-zone .btn-danger:hover{background-color:#c82333;border-color:#bd2130;transform:translateY(-1px);box-shadow:0 4px 8px #dc35454d}.btn-secondary{background-color:var(--bg-tertiary);color:var(--text-primary);border:1px solid var(--border-secondary);padding:10px 20px;border-radius:5px;cursor:pointer;font-size:14px;transition:all .3s ease}.btn-secondary:hover{background-color:var(--bg-quaternary)}.btn-secondary.active{background-color:var(--accent-color);color:#fff;border-color:var(--accent-color)}.archived-note-content{font-size:14px;color:var(--text-primary);line-height:1.5;max-height:100px;overflow:hidden;text-overflow:ellipsis;word-wrap:break-word;overflow-wrap:break-word}.archived-note-images{margin-top:10px;font-size:12px;color:var(--text-secondary);font-style:italic}.logs-filters{display:flex;gap:10px;margin-bottom:20px;flex-wrap:wrap}.log-filter-select{flex:1;min-width:200px;padding:8px 12px;border:1px solid var(--border-secondary);border-radius:5px;font-size:14px;background-color:var(--bg-tertiary);color:var(--text-primary)}.log-filter-select:focus{outline:none;border-color:var(--accent-color, #007bff)}.logs-table-container{overflow-x:auto;margin-bottom:20px}.logs-table{width:100%;border-collapse:collapse;background:var(--bg-secondary);color:var(--text-primary);border-radius:8px;overflow:hidden;box-shadow:0 1px 3px var(--shadow-light)}.logs-table thead{background:var(--bg-tertiary)}.logs-table th{padding:12px;text-align:left;font-weight:700;color:var(--text-primary);border-bottom:2px solid var(--border-primary);font-size:14px}.logs-table td{padding:12px;border-bottom:1px solid var(--border-primary);font-size:13px;color:var(--text-secondary)}.logs-table tbody tr:hover{background:var(--bg-quaternary)}.log-action-badge{display:inline-block;padding:4px 8px;border-radius:4px;font-size:12px;font-weight:500;white-space:nowrap}.log-action-login,.log-action-register{background:#d4edda;color:#155724}.log-action-logout{background:#f8d7da;color:#721c24}.log-action-note_create{background:#d1ecf1;color:#0c5460}.log-action-note_update{background:#fff3cd;color:#856404}.log-action-note_delete,.log-action-note_delete_permanent{background:#f8d7da;color:#721c24}.log-action-note_pin{background:#e7e7ff;color:#4a4aff}.log-action-note_archive{background:#e2e3e5;color:#383d41}.log-action-note_unarchive{background:#d4edda;color:#155724}.log-action-profile_update{background:#fce4ec;color:#c2185b}.load-more-container{text-align:center;margin:20px 0}.note-pinned{border-left:4px solid #ffc107;background:var(--bg-secondary)}.pin-indicator{display:inline-flex;align-items:center;gap:4px;color:#ffc107;font-size:12px;font-weight:700;margin-left:10px}@media (max-width: 768px){.settings-tabs{flex-direction:column}.settings-tab{width:100%;justify-content:center}.archived-note-header{flex-direction:column;align-items:flex-start}.archived-note-actions{width:100%;justify-content:flex-start}.logs-table{font-size:12px}.logs-table th,.logs-table td{padding:8px}.logs-filters{flex-direction:column}.log-filter-select{width:100%}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.log-action-ai_improve{background:#d1ecf1;color:#0c5460}.spoiler{background:linear-gradient(45deg,#f0f0f0,#e8e8e8);color:transparent;cursor:pointer;border-radius:4px;padding:3px 6px;-webkit-user-select:none;user-select:none;transition:all .3s ease;position:relative;border:1px solid #ddd;font-weight:500;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);text-shadow:0 0 8px rgba(0,0,0,.3)}.spoiler:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:#fffc;border-radius:4px;filter:blur(1px);z-index:-1}.spoiler:hover{background:linear-gradient(45deg,#e8e8e8,#d8d8d8);transform:scale(1.02);box-shadow:0 2px 8px #00000026}.spoiler:hover:before{background:#ffffffe6}.spoiler.revealed{background:linear-gradient(45deg,#e8f5e8,#d4edda);color:#155724;border-color:#c3e6cb;box-shadow:0 0 0 2px #28a74540;text-shadow:none;user-select:text;-webkit-user-select:text;cursor:text}.spoiler.revealed:before{display:none}.spoiler.revealed:hover{background:linear-gradient(45deg,#d4edda,#c3e6cb);box-shadow:0 0 0 2px #28a74559}.file-preview-container{margin:15px 0;padding:15px;background:#f0f8ff;border:2px dashed #b0d4f1;border-radius:8px;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.file-preview-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;font-weight:600;color:#495057}.file-preview-list{display:flex;flex-direction:column;gap:10px}.file-preview-item{display:flex;align-items:center;padding:6px 10px;background:#fff;border-radius:6px;border:1px solid #dee2e6;gap:12px;min-height:40px}.file-preview-item .file-icon{font-size:24px;color:var(--accent-color, #007bff);flex-shrink:0}.file-preview-item .file-info,.file-preview-item .file-info-edit{flex:1;min-width:0}.file-preview-item .file-name{font-weight:500;color:#333;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;line-height:1.2}.file-preview-item .file-size{font-size:11px;color:#666;margin-top:1px;line-height:1.2}.file-info-edit .file-name{font-weight:500;color:#333;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;line-height:1.2}.file-info-edit .file-size{font-size:11px;color:#666;margin-top:1px;line-height:1.2}.file-preview-item .remove-file-btn{background:#dc3545;color:#fff;border:none;border-radius:50%;width:24px;height:24px;cursor:pointer;font-size:14px;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:background-color .2s}.file-preview-item .remove-file-btn:hover{background:#c82333}.clear-files-btn{background:#dc3545;color:#fff;border:none;padding:4px 8px;border-radius:4px;cursor:pointer;font-size:12px;transition:background-color .3s ease}.clear-files-btn:hover{background:#c82333}[data-theme=dark] .file-preview-container{background:#2a3a4a;border-color:#4a5a6a}[data-theme=dark] .file-preview-header{color:var(--text-primary)}[data-theme=dark] .file-preview-item{background:var(--bg-secondary);border-color:var(--border-primary)}[data-theme=dark] .file-preview-item .file-name{color:var(--text-primary);font-size:14px;line-height:1.2}[data-theme=dark] .file-preview-item .file-size{color:var(--text-secondary);font-size:11px;margin-top:1px;line-height:1.2}[data-theme=dark] .file-info-edit .file-name{color:var(--text-primary);font-size:14px;line-height:1.2}[data-theme=dark] .file-info-edit .file-size{color:var(--text-secondary);font-size:11px;margin-top:1px;line-height:1.2}[data-theme=dark] .textNote .file-preview-container .file-preview-item .file-name{color:var(--text-primary);font-size:14px;line-height:1.2}[data-theme=dark] .textNote .file-preview-container .file-preview-item .file-size{color:var(--text-secondary);font-size:11px;margin-top:1px;line-height:1.2}[data-theme=dark] .note-file-link{background:var(--bg-tertiary);border-color:var(--border-primary);color:var(--text-primary)}[data-theme=dark] .note-file-link:hover{background:var(--bg-hover);border-color:var(--accent-color)}[data-theme=dark] .note-file-link .file-name{color:var(--text-primary)}[data-theme=dark] .note-file-link .file-size{color:var(--text-secondary)}[data-theme=dark] .image-preview-container{background:#2a3a4a;border-color:#4a5a6a}[data-theme=dark] .image-preview-header{color:var(--text-primary)}[data-theme=dark] .image-preview-item{background:var(--bg-secondary);border-color:var(--border-primary)}[data-theme=dark] .image-preview-item .image-info{background:var(--bg-tertiary);color:var(--text-secondary)}[data-theme=dark] .image-preview-item .image-preview-remove{background:#dc3545d9;box-shadow:0 2px 4px #0006}[data-theme=dark] .image-preview-item .image-preview-remove:hover{background:#dc3545;box-shadow:0 3px 6px #00000080}[data-theme=dark] .file-preview-item .file-preview-remove{background:#dc3545d9;box-shadow:0 2px 4px #0006}[data-theme=dark] .file-preview-item .file-preview-remove:hover{background:#dc3545;box-shadow:0 3px 6px #00000080}[data-theme=dark] .image-preview-item .image-preview-remove.restore-btn,[data-theme=dark] .file-preview-item .file-preview-remove.restore-btn{background:#28a745d9!important}[data-theme=dark] .image-preview-item .image-preview-remove.restore-btn:hover,[data-theme=dark] .file-preview-item .file-preview-remove.restore-btn:hover{background:#28a745!important}[data-theme=dark] .image-preview-item .image-preview-remove[style*=green],[data-theme=dark] .file-preview-item .file-preview-remove[style*=green]{background:#28a745d9!important}[data-theme=dark] .image-preview-item .image-preview-remove[style*=green]:hover,[data-theme=dark] .file-preview-item .file-preview-remove[style*=green]:hover{background:#28a745!important}[data-theme=dark] .note-images-container{background:transparent}[data-theme=dark] .note-image-item,[data-theme=dark] .note-image{border-color:var(--border-primary)}[data-theme=dark] .note-image:hover:after{background:#000000b3}.btnMarkdown .iconify[data-icon="mdi:menu-down"]{color:#1976d2}.mobile-menu-btn{display:none;position:fixed;top:15px;left:15px;z-index:999;background:var(--bg-secondary);border:1px solid var(--border-secondary);border-radius:8px;padding:10px 12px;cursor:pointer;box-shadow:0 2px 8px var(--shadow-light);transition:all .3s ease}.mobile-menu-btn:hover{background:var(--bg-quaternary);box-shadow:0 4px 12px var(--shadow-medium)}.mobile-menu-btn .iconify{font-size:24px;color:var(--text-primary)}.mobile-sidebar{display:flex;flex-direction:column;position:fixed;top:0;left:-85vw;width:85vw;max-width:320px;height:100vh;background:var(--bg-secondary);color:var(--text-primary);box-shadow:2px 0 10px var(--shadow-light);transition:left .3s ease;z-index:1000;overflow-y:auto}.mobile-sidebar.open{left:0}.sidebar-close-btn{display:flex;align-items:center;justify-content:center;width:40px;height:40px;padding:0;margin:10px 10px 10px auto;background:var(--bg-tertiary);border:1px solid var(--border-secondary);border-radius:8px;cursor:pointer;transition:background .3s ease}.sidebar-close-btn:hover{background:var(--bg-quaternary)}.sidebar-close-btn .iconify{font-size:20px;color:var(--text-primary)}.sidebar-content{padding:10px 12px;overflow-y:auto;flex:1}.mobile-calendar-section,.mobile-search-section,.mobile-tags-section{margin-bottom:20px;padding-bottom:15px;border-bottom:1px solid var(--border-primary)}.mobile-tags-section{border-bottom:none}.search-header,.tags-header{margin-bottom:10px}.search-title,.tags-title{font-size:13px;font-weight:700;color:var(--text-primary);display:flex;align-items:center;gap:5px}.search-title .iconify,.tags-title .iconify{font-size:16px;color:var(--accent-color)}.mobile-sidebar-overlay{display:none;position:fixed;top:0;left:0;right:0;bottom:0;background:#00000080;z-index:999;opacity:0;transition:opacity .3s ease}.mobile-sidebar-overlay.open{display:block;opacity:1}@media (max-width: 768px){.mobile-menu-btn{display:flex;align-items:center;justify-content:center}.container-leftside,.sidebar{display:none!important}body{flex-direction:column;gap:0;padding:20px 10px 0}.center{width:100%!important;max-width:100%!important}.container{width:100%;max-width:100%;margin-top:60px}.center>.container:first-child{margin-top:3px}.notes-container .container{margin-top:0}.notes-container{padding-bottom:80px;margin-top:16px;gap:16px}.empty-message{padding:0 15px;font-size:14px}.notes-header{gap:10px;align-items:flex-start}.notes-header-left{width:auto;min-width:0;align-items:flex-start;gap:8px}.filter-indicator{font-size:12px;display:inline-flex!important;max-width:min(300px,100%)!important;width:fit-content!important;box-sizing:border-box!important}.filter-indicator-text{overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important}.markdown-buttons .btnMarkdown{min-height:44px;padding:8px 10px;margin:2px;font-size:13px}.textInput{font-size:14px;min-height:100px}.image-preview-list,.note-images-container{justify-content:center}.image-preview-item img,.note-image{width:80px;height:80px}.notification{left:10px;right:10px;max-width:none}.footer{font-size:11px;padding:8px 0}}@media (max-width: 480px){.mobile-menu-btn{top:10px;left:10px;padding:8px 10px}.mobile-menu-btn .iconify{font-size:20px}.container{margin-top:50px;padding:12px}.markdown-buttons .btnMarkdown{padding:6px 8px;font-size:12px}.user-info>*{font-size:12px}}.loading-overlay{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#00000080;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);display:flex;justify-content:center;align-items:center;z-index:1000}.loading-content{background-color:var(--bg-color);padding:20px 30px;border-radius:8px;box-shadow:0 4px 20px #0000004d;display:flex;align-items:center;justify-content:center;min-width:150px}.loading-text{color:var(--text-color);font-size:16px;font-weight:500;text-align:center}[data-theme=dark] .loading-content{box-shadow:0 4px 20px #0009}.main-wrapper{display:flex;gap:15px;align-items:flex-start;width:100%}.calendar-box{flex-shrink:0;width:190px;background:#fff;box-shadow:0 0 10px #0000001a;border-radius:8px;padding:10px}.calendar-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;gap:4px}.calendar-header h3{margin:0;font-size:11px;font-weight:600;color:#333;min-width:75px;text-align:center;flex:1}.calendar-nav-btn{background:#f0f0f0;border:1px solid #ddd;border-radius:3px;padding:2px 5px;cursor:pointer;font-size:11px;color:#333;transition:all .2s ease}.calendar-nav-btn:hover{background:var(--accent-color, #007bff);color:#fff;border-color:var(--accent-color, #007bff)}.calendar-weekdays{display:grid;grid-template-columns:repeat(7,1fr);gap:1px;margin-bottom:5px}.weekday{text-align:center;font-size:8px;font-weight:600;color:#666;padding:1px 0;text-transform:uppercase}.calendar-days{display:grid;grid-template-columns:repeat(7,1fr);gap:1px}.calendar-day{aspect-ratio:1;display:flex;align-items:center;justify-content:center;font-size:10px;border-radius:3px;cursor:pointer;background:transparent;color:#666;border:1px solid transparent;transition:all .2s ease;position:relative}.calendar-day:hover{background:transparent;border-color:var(--accent-color, #007bff)}.calendar-day.other-month{color:#ccc;background:transparent}.calendar-day.other-month:hover{border-color:var(--accent-color, #007bff)}.calendar-day.today{background:transparent;color:#666;font-weight:600;border-color:var(--accent-color, #007bff)}.calendar-day.today:hover{background:transparent;border-color:var(--accent-color, #007bff)}.calendar-day.selected{background:var(--accent-color, #007bff);color:#fff;font-weight:600;border-color:var(--accent-color, #007bff)}.calendar-day.selected:hover{background:var(--accent-color, #007bff);border-color:var(--accent-color, #007bff)}.main{flex:1;min-width:300px}@media (max-width: 768px){.main-wrapper{flex-direction:column}.calendar-box{width:100%}.main{min-width:auto}.container{max-width:100%}} diff --git a/backend/public/assets/workbox-window.prod.es5-B9K5rw8f.js b/backend/public/assets/workbox-window.prod.es5-B9K5rw8f.js deleted file mode 100644 index 8f3684a..0000000 --- a/backend/public/assets/workbox-window.prod.es5-B9K5rw8f.js +++ /dev/null @@ -1,2 +0,0 @@ -try{self["workbox:window:7.2.0"]&&_()}catch{}function E(n,r){return new Promise(function(t){var i=new MessageChannel;i.port1.onmessage=function(c){t(c.data)},n.postMessage(r,[i.port2])})}function W(n){var r=function(t,i){if(typeof t!="object"||!t)return t;var c=t[Symbol.toPrimitive];if(c!==void 0){var h=c.call(t,i);if(typeof h!="object")return h;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(n,"string");return typeof r=="symbol"?r:r+""}function k(n,r){for(var t=0;tn.length)&&(r=n.length);for(var t=0,i=new Array(r);t=n.length?{done:!0}:{done:!1,value:n[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}try{self["workbox:core:7.2.0"]&&_()}catch{}var w=function(){var n=this;this.promise=new Promise(function(r,t){n.resolve=r,n.reject=t})};function b(n,r){var t=location.href;return new URL(n,t).href===new URL(r,t).href}var g=function(n,r){this.type=n,Object.assign(this,r)};function d(n,r,t){return t?r?r(n):n:(n&&n.then||(n=Promise.resolve(n)),r?n.then(r):n)}function O(){}var x={type:"SKIP_WAITING"};function S(n,r){return n&&n.then?n.then(O):Promise.resolve()}var U=function(n){function r(v,u){var e,o;return u===void 0&&(u={}),(e=n.call(this)||this).nn={},e.tn=0,e.rn=new w,e.en=new w,e.on=new w,e.un=0,e.an=new Set,e.cn=function(){var s=e.fn,a=s.installing;e.tn>0||!b(a.scriptURL,e.sn.toString())||performance.now()>e.un+6e4?(e.vn=a,s.removeEventListener("updatefound",e.cn)):(e.hn=a,e.an.add(a),e.rn.resolve(a)),++e.tn,a.addEventListener("statechange",e.ln)},e.ln=function(s){var a=e.fn,f=s.target,p=f.state,m=f===e.vn,y={sw:f,isExternal:m,originalEvent:s};!m&&e.mn&&(y.isUpdate=!0),e.dispatchEvent(new g(p,y)),p==="installed"?e.wn=self.setTimeout(function(){p==="installed"&&a.waiting===f&&e.dispatchEvent(new g("waiting",y))},200):p==="activating"&&(clearTimeout(e.wn),m||e.en.resolve(f))},e.yn=function(s){var a=e.hn,f=a!==navigator.serviceWorker.controller;e.dispatchEvent(new g("controlling",{isExternal:f,originalEvent:s,sw:a,isUpdate:e.mn})),f||e.on.resolve(a)},e.gn=(o=function(s){var a=s.data,f=s.ports,p=s.source;return d(e.getSW(),function(){e.an.has(p)&&e.dispatchEvent(new g("message",{data:a,originalEvent:s,ports:f,sw:p}))})},function(){for(var s=[],a=0;a - - - + + + -
    +
    + +
    + +
    +
    +
    + diff --git a/backend/public/manifest.json b/backend/public/manifest.json index ac17bce..ad0f651 100644 --- a/backend/public/manifest.json +++ b/backend/public/manifest.json @@ -9,27 +9,10 @@ "orientation": "portrait-primary", "scope": "/", "lang": "ru", - "id": "/", "categories": ["productivity", "utilities"], "prefer_related_applications": false, "display_override": ["window-controls-overlay", "standalone"], "dir": "ltr", - "shortcuts": [ - { - "name": "Новая заметка", - "short_name": "Новая", - "description": "Создать новую заметку", - "url": "/notes?new=true", - "icons": [{ "src": "/icons/icon-192x192.png", "sizes": "192x192" }] - }, - { - "name": "Мой профиль", - "short_name": "Профиль", - "description": "Открыть профиль", - "url": "/profile", - "icons": [{ "src": "/icons/icon-192x192.png", "sizes": "192x192" }] - } - ], "screenshots": [ { "src": "/icons/icon-512x512.png", diff --git a/backend/server.js b/backend/server.js index 1c3d4b8..83e9517 100644 --- a/backend/server.js +++ b/backend/server.js @@ -1,3 +1,6 @@ +// Загружаем .env файл ПЕРВЫМ, до всех остальных импортов +require("dotenv").config(); + const express = require("express"); const sqlite3 = require("sqlite3").verbose(); const bcrypt = require("bcryptjs"); @@ -11,7 +14,7 @@ const multer = require("multer"); const fs = require("fs"); const https = require("https"); const http = require("http"); -require("dotenv").config(); +const { encrypt, decrypt } = require("./utils/encryption"); const app = express(); const PORT = process.env.PORT || 3001; @@ -659,7 +662,7 @@ app.get("/register", (req, res) => { if (req.session.authenticated) { return res.redirect("/notes"); } - res.sendFile(path.join(__dirname, "public", "register.html")); + res.sendFile(path.join(__dirname, "public", "index.html")); }); // API регистрации @@ -815,19 +818,19 @@ app.get("/notes", requireAuth, (req, res) => { db.get(sql, [req.session.userId], (err, user) => { if (err) { console.error("Ошибка получения цвета пользователя:", err.message); - return res.sendFile(path.join(__dirname, "public", "notes.html")); + return res.sendFile(path.join(__dirname, "public", "index.html")); } const accentColor = user?.accent_color || "#007bff"; // Читаем HTML файл fs.readFile( - path.join(__dirname, "public", "notes.html"), + path.join(__dirname, "public", "index.html"), "utf8", (err, html) => { if (err) { - console.error("Ошибка чтения файла notes.html:", err.message); - return res.sendFile(path.join(__dirname, "public", "notes.html")); + console.error("Ошибка чтения файла index.html:", err.message); + return res.sendFile(path.join(__dirname, "public", "index.html")); } // Вставляем inline CSS с правильным цветом в самое начало head для предотвращения FOUC @@ -857,11 +860,12 @@ app.get("/api/notes/search", requireApiAuth, (req, res) => { let whereClause = "WHERE n.user_id = ? AND n.is_archived = 0"; let params = [req.session.userId]; - // Поиск по тексту (регистронезависимый) - if (q && q.trim()) { - whereClause += " AND LOWER(n.content) LIKE ?"; - params.push(`%${q.trim().toLowerCase()}%`); - } + // Поиск по тексту - убран из SQL, так как зашифрованный текст нельзя искать + // Поиск будет выполняться на клиенте после дешифрования + // if (q && q.trim()) { + // whereClause += " AND LOWER(n.content) LIKE ?"; + // params.push(`%${q.trim().toLowerCase()}%`); + // } // Поиск по тегу (регистронезависимый) // SQLite LOWER() плохо работает с кириллицей, поэтому фильтрация по тегу выполняется на клиенте @@ -932,6 +936,7 @@ app.get("/api/notes/search", requireApiAuth, (req, res) => { // Парсим JSON строки изображений и файлов const notesWithImagesAndFiles = rows.map((row) => ({ ...row, + content: decrypt(row.content), // Дешифруем содержимое заметки images: row.images === "[]" ? [] : JSON.parse(row.images), files: row.files === "[]" ? [] : JSON.parse(row.files), })); @@ -995,6 +1000,7 @@ app.get("/api/notes", requireApiAuth, (req, res) => { // Парсим JSON строки изображений и файлов const notesWithImagesAndFiles = rows.map((row) => ({ ...row, + content: decrypt(row.content), // Дешифруем содержимое заметки images: row.images === "[]" ? [] : JSON.parse(row.images), files: row.files === "[]" ? [] : JSON.parse(row.files), })); @@ -1011,9 +1017,12 @@ app.post("/api/notes", requireApiAuth, (req, res) => { return res.status(400).json({ error: "Не все поля заполнены" }); } + // Шифруем содержимое заметки перед сохранением + const encryptedContent = encrypt(content); + const sql = "INSERT INTO notes (user_id, content, date, time, created_at, updated_at) VALUES (?, ?, ?, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)"; - const params = [req.session.userId, content, date, time]; + const params = [req.session.userId, encryptedContent, date, time]; db.run(sql, params, function (err) { if (err) { @@ -1038,6 +1047,9 @@ app.put("/api/notes/:id", requireApiAuth, (req, res) => { return res.status(400).json({ error: "Содержание заметки обязательно" }); } + // Шифруем содержимое заметки перед сохранением + const encryptedContent = encrypt(content); + // Проверяем, что заметка принадлежит текущему пользователю const checkSql = "SELECT user_id, date, time FROM notes WHERE id = ?"; db.get(checkSql, [id], (err, row) => { @@ -1058,7 +1070,7 @@ app.put("/api/notes/:id", requireApiAuth, (req, res) => { const updateSql = skipTimestamp ? "UPDATE notes SET content = ? WHERE id = ?" : "UPDATE notes SET content = ?, updated_at = CURRENT_TIMESTAMP WHERE id = ?"; - const params = [content, id]; + const params = [encryptedContent, id]; db.run(updateSql, params, function (err) { if (err) { @@ -1581,19 +1593,19 @@ app.get("/profile", requireAuth, (req, res) => { db.get(sql, [req.session.userId], (err, user) => { if (err) { console.error("Ошибка получения цвета пользователя:", err.message); - return res.sendFile(path.join(__dirname, "public", "profile.html")); + return res.sendFile(path.join(__dirname, "public", "index.html")); } const accentColor = user?.accent_color || "#007bff"; // Читаем HTML файл fs.readFile( - path.join(__dirname, "public", "profile.html"), + path.join(__dirname, "public", "index.html"), "utf8", (err, html) => { if (err) { - console.error("Ошибка чтения файла profile.html:", err.message); - return res.sendFile(path.join(__dirname, "public", "profile.html")); + console.error("Ошибка чтения файла index.html:", err.message); + return res.sendFile(path.join(__dirname, "public", "index.html")); } // Вставляем inline CSS с правильным цветом в самое начало head для предотвращения FOUC @@ -2001,6 +2013,7 @@ app.get("/api/notes/archived", requireApiAuth, (req, res) => { // Парсим JSON строки изображений и файлов const notesWithImagesAndFiles = rows.map((row) => ({ ...row, + content: decrypt(row.content), // Дешифруем содержимое заметки images: row.images === "[]" ? [] : JSON.parse(row.images), files: row.files === "[]" ? [] : JSON.parse(row.files), })); @@ -2271,19 +2284,19 @@ app.get("/settings", requireAuth, (req, res) => { db.get(sql, [req.session.userId], (err, user) => { if (err) { console.error("Ошибка получения цвета пользователя:", err.message); - return res.sendFile(path.join(__dirname, "public", "settings.html")); + return res.sendFile(path.join(__dirname, "public", "index.html")); } const accentColor = user?.accent_color || "#007bff"; // Читаем HTML файл fs.readFile( - path.join(__dirname, "public", "settings.html"), + path.join(__dirname, "public", "index.html"), "utf8", (err, html) => { if (err) { - console.error("Ошибка чтения файла settings.html:", err.message); - return res.sendFile(path.join(__dirname, "public", "settings.html")); + console.error("Ошибка чтения файла index.html:", err.message); + return res.sendFile(path.join(__dirname, "public", "index.html")); } // Вставляем inline CSS с правильным цветом diff --git a/backend/utils/encryption.js b/backend/utils/encryption.js new file mode 100644 index 0000000..bea19fa --- /dev/null +++ b/backend/utils/encryption.js @@ -0,0 +1,140 @@ +const crypto = require("crypto"); + +// Ключ шифрования из переменных окружения или дефолтный (для разработки) +// В продакшене ОБЯЗАТЕЛЬНО установите ENCRYPTION_KEY в .env файле! +// Ключ должен быть строкой минимум 32 символа для AES-256 +const ENCRYPTION_KEY_STRING = + process.env.ENCRYPTION_KEY || "default-key-change-in-production-min-32-chars"; + +// Проверка ключа при запуске +const isProduction = process.env.NODE_ENV === "production"; +const isUsingDefaultKey = !process.env.ENCRYPTION_KEY; + +// В продакшене требуем установленный ключ +if (isProduction && isUsingDefaultKey) { + console.error( + "❌ ОШИБКА: ENCRYPTION_KEY не установлен в переменных окружения!" + ); + console.error( + "Установите ENCRYPTION_KEY в .env файле перед запуском в продакшене." + ); + console.error("Пример: ENCRYPTION_KEY=ваш-случайный-ключ-минимум-32-символа"); + process.exit(1); +} + +// Предупреждение в разработке +if (!isProduction && isUsingDefaultKey) { + console.warn("⚠️ ПРЕДУПРЕЖДЕНИЕ: Используется дефолтный ключ шифрования!"); + console.warn("Для безопасности установите ENCRYPTION_KEY в .env файле."); + console.warn("Пример: ENCRYPTION_KEY=ваш-случайный-ключ-минимум-32-символа"); +} + +// Преобразуем строку ключа в 32-байтовый ключ для AES-256 +const ENCRYPTION_KEY = crypto + .createHash("sha256") + .update(ENCRYPTION_KEY_STRING) + .digest(); + +// Длина IV (Initialization Vector) для AES-256-GCM +const IV_LENGTH = 16; + +// Метка аутентификации для проверки целостности данных +const AUTH_TAG_LENGTH = 16; + +/** + * Шифрует текст заметки + * @param {string} text - Текст для шифрования + * @returns {string} - Зашифрованный текст в формате base64:iv:authTag + */ +function encrypt(text) { + if (!text || text.trim() === "") { + return text; + } + + try { + // Генерируем случайный IV для каждой операции шифрования + const iv = crypto.randomBytes(IV_LENGTH); + + // Создаем шифр с алгоритмом AES-256-GCM + const cipher = crypto.createCipheriv("aes-256-gcm", ENCRYPTION_KEY, iv); + + // Шифруем текст + let encrypted = cipher.update(text, "utf8", "base64"); + encrypted += cipher.final("base64"); + + // Получаем метку аутентификации для проверки целостности + const authTag = cipher.getAuthTag(); + + // Возвращаем зашифрованные данные в формате: base64:iv:authTag + return `${encrypted}:${iv.toString("base64")}:${authTag.toString( + "base64" + )}`; + } catch (error) { + console.error("Ошибка шифрования:", error); + throw new Error("Ошибка шифрования данных"); + } +} + +/** + * Дешифрует текст заметки + * @param {string} encryptedText - Зашифрованный текст в формате base64:iv:authTag + * @returns {string} - Расшифрованный текст + */ +function decrypt(encryptedText) { + if (!encryptedText || encryptedText.trim() === "") { + return encryptedText; + } + + // Проверяем формат зашифрованных данных + // Если формат не соответствует ожидаемому, возможно это старая незашифрованная заметка + const parts = encryptedText.split(":"); + if (parts.length !== 3) { + // Если это не зашифрованный текст, возвращаем как есть (для обратной совместимости) + console.warn("Обнаружен незашифрованный текст заметки"); + return encryptedText; + } + + try { + const [encrypted, ivBase64, authTagBase64] = parts; + + // Преобразуем IV и метку аутентификации из base64 + const iv = Buffer.from(ivBase64, "base64"); + const authTag = Buffer.from(authTagBase64, "base64"); + + // Создаем дешифратор с алгоритмом AES-256-GCM + const decipher = crypto.createDecipheriv("aes-256-gcm", ENCRYPTION_KEY, iv); + + // Устанавливаем метку аутентификации для проверки целостности + decipher.setAuthTag(authTag); + + // Дешифруем текст + let decrypted = decipher.update(encrypted, "base64", "utf8"); + decrypted += decipher.final("utf8"); + + return decrypted; + } catch (error) { + console.error("Ошибка дешифрования:", error); + // Если не удалось дешифровать, возможно это старая заметка + // Возвращаем оригинальный текст + return encryptedText; + } +} + +/** + * Проверяет, является ли текст зашифрованным + * @param {string} text - Текст для проверки + * @returns {boolean} - true если текст зашифрован + */ +function isEncrypted(text) { + if (!text || text.trim() === "") { + return false; + } + const parts = text.split(":"); + return parts.length === 3; +} + +module.exports = { + encrypt, + decrypt, + isEncrypted, +}; diff --git a/dev-dist/sw.js b/dev-dist/sw.js index d256230..28279d5 100644 --- a/dev-dist/sw.js +++ b/dev-dist/sw.js @@ -82,7 +82,7 @@ define(['./workbox-9dc17825'], (function (workbox) { 'use strict'; "revision": "3ca0b8505b4bec776b69afdba2768812" }, { "url": "index.html", - "revision": "0.hpmojmu6e28" + "revision": "0.spl6nc4dqkg" }], {}); workbox.cleanupOutdatedCaches(); workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), { diff --git a/src/api/userApi.ts b/src/api/userApi.ts index d940cc1..1b10fa9 100644 --- a/src/api/userApi.ts +++ b/src/api/userApi.ts @@ -8,7 +8,7 @@ export const userApi = { }, updateProfile: async ( - profile: Partial & { + profile: Omit, 'show_edit_date' | 'colored_icons' | 'floating_toolbar_enabled'> & { currentPassword?: string; newPassword?: string; accent_color?: string; diff --git a/src/components/calendar/MiniCalendar.tsx b/src/components/calendar/MiniCalendar.tsx index df75a5c..dade509 100644 --- a/src/components/calendar/MiniCalendar.tsx +++ b/src/components/calendar/MiniCalendar.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from "react"; +import React, { useState } from "react"; import { format, startOfMonth, diff --git a/src/components/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsx index ab78c39..db6b787 100644 --- a/src/components/layout/Sidebar.tsx +++ b/src/components/layout/Sidebar.tsx @@ -2,7 +2,6 @@ import React from "react"; import { MiniCalendar } from "../calendar/MiniCalendar"; import { SearchBar } from "../search/SearchBar"; import { TagsFilter } from "../search/TagsFilter"; -import { useAppSelector } from "../../store/hooks"; import { Note } from "../../types/note"; interface SidebarProps { diff --git a/src/components/notes/MarkdownToolbar.tsx b/src/components/notes/MarkdownToolbar.tsx index db83a45..9375d57 100644 --- a/src/components/notes/MarkdownToolbar.tsx +++ b/src/components/notes/MarkdownToolbar.tsx @@ -115,7 +115,14 @@ export const MarkdownToolbar: React.FC = ({ }; }, [isDragging]); - const buttons = []; + const buttons: Array<{ + id: string; + icon: string; + title: string; + before?: string; + after?: string; + action?: () => void; + }> = []; return (
    = ({ onSave }) => { const lines = text.split("\n"); // Определяем текущую строку - let currentLineIndex = 0; + // @ts-expect-error - переменная используется для определения текущей строки + let _currentLineIndex = 0; let currentLineStart = 0; let currentLine = ""; for (let i = 0; i < lines.length; i++) { const lineLength = lines[i].length; if (currentLineStart + lineLength >= start) { - currentLineIndex = i; + _currentLineIndex = i; currentLine = lines[i]; break; } @@ -611,7 +612,8 @@ export const NoteEditor: React.FC = ({ onSave }) => { const lineHeight = parseInt(styles.lineHeight) || 20; const paddingTop = parseInt(styles.paddingTop) || 0; const paddingLeft = parseInt(styles.paddingLeft) || 0; - const fontSize = parseInt(styles.fontSize) || 14; + // @ts-expect-error - переменная может использоваться в будущем + const _fontSize = parseInt(styles.fontSize) || 14; const scrollTop = textarea.scrollTop; // Вычисляем координаты начала выделения diff --git a/src/components/notes/NoteItem.tsx b/src/components/notes/NoteItem.tsx index bae83ff..f76ab5d 100644 --- a/src/components/notes/NoteItem.tsx +++ b/src/components/notes/NoteItem.tsx @@ -31,7 +31,7 @@ interface NoteItemProps { export const NoteItem: React.FC = ({ note, - onDelete, + onDelete: _onDelete, onPin, onArchive, onReload, @@ -41,8 +41,8 @@ export const NoteItem: React.FC = ({ const [showArchiveModal, setShowArchiveModal] = useState(false); const [editImages, setEditImages] = useState([]); const [editFiles, setEditFiles] = useState([]); - const [deletedImageIds, setDeletedImageIds] = useState([]); - const [deletedFileIds, setDeletedFileIds] = useState([]); + const [deletedImageIds, setDeletedImageIds] = useState<(number | string)[]>([]); + const [deletedFileIds, setDeletedFileIds] = useState<(number | string)[]>([]); const [isAiLoading, setIsAiLoading] = useState(false); const [showFloatingToolbar, setShowFloatingToolbar] = useState(false); const [toolbarPosition, setToolbarPosition] = useState({ top: 0, left: 0 }); @@ -146,19 +146,19 @@ export const NoteItem: React.FC = ({ setLocalPreviewMode(false); }; - const handleDeleteExistingImage = (imageId: number) => { + const handleDeleteExistingImage = (imageId: number | string) => { setDeletedImageIds([...deletedImageIds, imageId]); }; - const handleDeleteExistingFile = (fileId: number) => { + const handleDeleteExistingFile = (fileId: number | string) => { setDeletedFileIds([...deletedFileIds, fileId]); }; - const handleRestoreImage = (imageId: number) => { + const handleRestoreImage = (imageId: number | string) => { setDeletedImageIds(deletedImageIds.filter((id) => id !== imageId)); }; - const handleRestoreFile = (fileId: number) => { + const handleRestoreFile = (fileId: number | string) => { setDeletedFileIds(deletedFileIds.filter((id) => id !== fileId)); }; @@ -576,7 +576,8 @@ export const NoteItem: React.FC = ({ const lineHeight = parseInt(styles.lineHeight) || 20; const paddingTop = parseInt(styles.paddingTop) || 0; const paddingLeft = parseInt(styles.paddingLeft) || 0; - const fontSize = parseInt(styles.fontSize) || 14; + // @ts-expect-error - переменная может использоваться в будущем + const _fontSize = parseInt(styles.fontSize) || 14; // Более точный расчет ширины символа // Создаем временный элемент для измерения @@ -699,14 +700,15 @@ export const NoteItem: React.FC = ({ const lines = text.split("\n"); // Определяем текущую строку - let currentLineIndex = 0; + // @ts-expect-error - переменная используется для определения текущей строки + let _currentLineIndex = 0; let currentLineStart = 0; let currentLine = ""; for (let i = 0; i < lines.length; i++) { const lineLength = lines[i].length; if (currentLineStart + lineLength >= start) { - currentLineIndex = i; + _currentLineIndex = i; currentLine = lines[i]; break; } @@ -1259,8 +1261,8 @@ export const NoteItem: React.FC = ({ .map((image) => { const imageUrl = getImageUrl( image.file_path, - note.id, - image.id + Number(note.id), + Number(image.id) ); return (
    @@ -1298,8 +1300,8 @@ export const NoteItem: React.FC = ({ .map((image) => { const imageUrl = getImageUrl( image.file_path, - note.id, - image.id + Number(note.id), + Number(image.id) ); return (
    @@ -1336,11 +1338,7 @@ export const NoteItem: React.FC = ({ {note.files .filter((file) => !deletedFileIds.includes(file.id)) .map((file) => { - const fileUrl = getFileUrl( - file.file_path, - note.id, - file.id - ); + // fileUrl не используется в этом контексте return (
    = ({ {note.images.map((image) => { const imageUrl = getImageUrl( image.file_path, - note.id, - image.id + Number(note.id), + Number(image.id) ); return (
    @@ -1499,7 +1497,7 @@ export const NoteItem: React.FC = ({ {note.files && note.files.length > 0 && (
    {note.files.map((file) => { - const fileUrl = getFileUrl(file.file_path, note.id, file.id); + const fileUrl = getFileUrl(file.file_path, Number(note.id), Number(file.id)); return (
    void; } -export const NotesList = forwardRef((props, ref) => { +export const NotesList = forwardRef((_props, ref) => { const notes = useAppSelector((state) => state.notes.notes); const userId = useAppSelector((state) => state.auth.userId); const searchQuery = useAppSelector((state) => state.notes.searchQuery); diff --git a/src/components/search/SearchBar.tsx b/src/components/search/SearchBar.tsx index 25d067e..f5d6960 100644 --- a/src/components/search/SearchBar.tsx +++ b/src/components/search/SearchBar.tsx @@ -6,7 +6,7 @@ import { setSearchQuery } from "../../store/slices/notesSlice"; export const SearchBar: React.FC = () => { const [query, setQuery] = useState(""); const dispatch = useAppDispatch(); - const timeoutRef = useRef(null); + const timeoutRef = useRef | null>(null); useEffect(() => { // Debounce для поиска diff --git a/src/hooks/useNotification.ts b/src/hooks/useNotification.ts index f7e8422..3932cb5 100644 --- a/src/hooks/useNotification.ts +++ b/src/hooks/useNotification.ts @@ -10,7 +10,10 @@ export const useNotification = () => { message: string, type: "info" | "success" | "error" | "warning" = "info" ) => { - const id = dispatch(addNotification({ message, type })).payload.id; + const id = `notification-${Date.now()}-${Math.random() + .toString(36) + .substr(2, 9)}`; + dispatch(addNotification({ message, type, id })); setTimeout(() => { dispatch(removeNotification(id)); }, 4000); diff --git a/src/pages/ProfilePage.tsx b/src/pages/ProfilePage.tsx index 53b2563..f327ed6 100644 --- a/src/pages/ProfilePage.tsx +++ b/src/pages/ProfilePage.tsx @@ -17,7 +17,8 @@ const ProfilePage: React.FC = () => { const navigate = useNavigate(); const dispatch = useAppDispatch(); const { showNotification } = useNotification(); - const user = useAppSelector((state) => state.profile.user); + // @ts-expect-error - переменная может использоваться в будущем + const _user = useAppSelector((state) => state.profile.user); const [username, setUsername] = useState(""); const [email, setEmail] = useState(""); diff --git a/src/pages/SettingsPage.tsx b/src/pages/SettingsPage.tsx index e839034..36d9e2c 100644 --- a/src/pages/SettingsPage.tsx +++ b/src/pages/SettingsPage.tsx @@ -13,7 +13,6 @@ import { setAccentColor } from "../utils/colorUtils"; import { useNotification } from "../hooks/useNotification"; import { Modal } from "../components/common/Modal"; import { ThemeToggle } from "../components/common/ThemeToggle"; -import { formatDateFromTimestamp } from "../utils/dateFormat"; import { parseMarkdown } from "../utils/markdown"; import { dbManager } from "../utils/indexedDB"; import { syncService } from "../services/syncService"; @@ -25,8 +24,11 @@ const SettingsPage: React.FC = () => { const navigate = useNavigate(); const dispatch = useAppDispatch(); const { showNotification } = useNotification(); - const user = useAppSelector((state) => state.profile.user); - const accentColor = useAppSelector((state) => state.ui.accentColor); + // @ts-expect-error - переменная может использоваться в будущем + const _user = useAppSelector((state) => state.profile.user); + const userId = useAppSelector((state) => state.auth.userId); + // @ts-expect-error - переменная может использоваться в будущем + const _accentColor = useAppSelector((state) => state.ui.accentColor); const [activeTab, setActiveTab] = useState(() => { // Восстанавливаем активную вкладку из localStorage при инициализации @@ -280,9 +282,9 @@ const SettingsPage: React.FC = () => { } }; - const handleRestoreNote = async (id: number) => { + const handleRestoreNote = async (id: number | string) => { try { - await notesApi.unarchive(id); + await notesApi.unarchive(Number(id)); await loadArchivedNotes(); showNotification("Заметка восстановлена!", "success"); } catch (error: any) { @@ -294,9 +296,9 @@ const SettingsPage: React.FC = () => { } }; - const handleDeletePermanent = async (id: number) => { + const handleDeletePermanent = async (id: number | string) => { try { - await notesApi.deleteArchived(id); + await notesApi.deleteArchived(Number(id)); await loadArchivedNotes(); showNotification("Заметка удалена окончательно", "success"); } catch (error: any) { @@ -427,7 +429,6 @@ const SettingsPage: React.FC = () => { // Загружаем версию из IndexedDB try { - const userId = user?.id; const localVer = userId ? await dbManager.getDataVersionByUserId(userId) : await dbManager.getDataVersion(); @@ -872,14 +873,14 @@ const SettingsPage: React.FC = () => {