@vgbire/react-keep-alive
Version:
React keepAlive
6 lines • 85.8 kB
JavaScript
import*as e from"react";import t,{createContext as n,useState as i,useEffect as r,useContext as s,useLayoutEffect as o,useRef as a,useId as l,useCallback as c}from"react";import{createPortal as u}from"react-dom";import{useNavigate as h,useLocation as d,useMatches as p}from"react-router";import{Modal as g,Flex as f,Divider as m}from"antd";const v=n({activateds:{},deactivateds:{}});v.displayName="KeepAliveScope";const y=({children:e})=>{const[n,s]=i(""),[o,a]=i({}),[l,c]=i({});return r((()=>{var e;(null===(e=o[n])||void 0===e?void 0:e.length)&&o[n].forEach((e=>{const t=e();t&&(l[n]||(l[n]=[]),l[n].push(t),c(Object.assign({},l)))}))}),[n]),t.createElement(v.Provider,{value:{active:n,setActive:s,activateds:o,setActivateds:a,deactivateds:l,setDeactivateds:c}},e)},b=()=>{const e=s(v);if(!e)throw new Error("useKeepAliveScopeContext 必须在 KeepAliveScope 中使用");return e};function x(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function O(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,s=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}"function"==typeof SuppressedError&&SuppressedError;const w=({name:e,show:t,children:n,to:s,style:a})=>{const[l]=i((()=>document.createElement("div")));return r((()=>{l.style.cssText="",Object.keys(a||{}).forEach((e=>{l.style[e]=a[e]}))}),[a]),o((()=>{var e;t&&(null===(e=s.current)||void 0===e||e.replaceChildren(l))}),[t]),u(n,l,e)},k=e=>{var{activeKey:n,max:s=Number.MAX_SAFE_INTEGER,items:o,exclude:l,include:c,style:u,className:h,styles:d}=e,p=x(e,["activeKey","max","items","exclude","include","style","className","styles"]);const g=a(null),[f,m]=i([]),[v,y]=i();r((()=>{let e=f;const t=e.find((e=>e.key===n)),i=o.find((e=>e.key===n));t||(e.push(i),e.length>s&&e.shift()),(l||c)&&(e=e.filter((({key:e})=>(!(null==l?void 0:l.length)||!l.includes(e))&&(!(null==c?void 0:c.length)||c.includes(e))))),!e.find((e=>e.key===n))&&i?(g.current.replaceChildren(),y(i.children)):y(null),m([...e])}),[n,s,o,l,c]);const{setActive:O,deactivateds:k,setDeactivateds:S}=b();return r((()=>{null==O||O((e=>{var t;return(null===(t=k[e])||void 0===t?void 0:t.length)&&(k[e].forEach((e=>{e()})),delete k[e],null==S||S(Object.assign({},k))),n}))}),[n]),t.createElement(t.Fragment,null,t.createElement("div",Object.assign({ref:g,style:Object.assign(Object.assign({},u),null==d?void 0:d.wrapper),className:h},p)),f.map((({key:e,children:i})=>t.createElement(w,{key:e,name:e,show:e===n,to:g,style:null==d?void 0:d.content},i))),v)},S=(e,t=[])=>{const{active:n,activateds:i,setActivateds:s}=b(),o=l();r((()=>{e.id=o,i[n]||(i[n]=[]);const t=i[n].findIndex((e=>e.id===o));return-1!==t&&i[n].splice(t,1),i[n].push(e),null==s||s(Object.assign({},i)),()=>{delete i[n],null==s||s(Object.assign({},i))}}),[...t])};var C=n({});function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},E.apply(null,arguments)}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function L(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(e)).next,0===t);else for(;!(l=(i=s.call(n)).done)&&(a.push(i.value),a.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},j(e)}function N(e){var t=function(e,t){if("object"!=j(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!=j(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==j(t)?t:t+""}function R(e,t,n){return(t=N(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;n[i]=e[i]}return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function A(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var P,M={exports:{}};
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/P=M,function(){var e={}.hasOwnProperty;function t(){for(var e="",t=0;t<arguments.length;t++){var r=arguments[t];r&&(e=i(e,n(r)))}return e}function n(n){if("string"==typeof n||"number"==typeof n)return n;if("object"!=typeof n)return"";if(Array.isArray(n))return t.apply(null,n);if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]"))return n.toString();var r="";for(var s in n)e.call(n,s)&&n[s]&&(r=i(r,s));return r}function i(e,t){return t?e?e+" "+t:e+t:e}P.exports?(t.default=t,P.exports=t):window.classNames=t}();var T=A(M.exports);const D=Math.round;function V(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],i=n.map((e=>parseFloat(e)));for(let e=0;e<3;e+=1)i[e]=t(i[e]||0,n[e]||"",e);return n[3]?i[3]=n[3].includes("%")?i[3]/100:i[3]:i[3]=1,i}const F=(e,t,n)=>0===n?e:e/100;function I(e,t){const n=t||255;return e>n?n:e<0?0:e}class H{constructor(e){function t(t){return t[0]in e&&t[1]in e&&t[2]in e}if(R(this,"isValid",!0),R(this,"r",0),R(this,"g",0),R(this,"b",0),R(this,"a",1),R(this,"_h",void 0),R(this,"_s",void 0),R(this,"_l",void 0),R(this,"_v",void 0),R(this,"_max",void 0),R(this,"_min",void 0),R(this,"_brightness",void 0),e)if("string"==typeof e){const n=e.trim();function i(e){return n.startsWith(e)}/^#?[A-F\d]{3,8}$/i.test(n)?this.fromHexString(n):i("rgb")?this.fromRgbString(n):i("hsl")?this.fromHslString(n):(i("hsv")||i("hsb"))&&this.fromHsvString(n)}else if(e instanceof H)this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this._h=e._h,this._s=e._s,this._l=e._l,this._v=e._v;else if(t("rgb"))this.r=I(e.r),this.g=I(e.g),this.b=I(e.b),this.a="number"==typeof e.a?I(e.a,1):1;else if(t("hsl"))this.fromHsl(e);else{if(!t("hsv"))throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(e));this.fromHsv(e)}else;}setR(e){return this._sc("r",e)}setG(e){return this._sc("g",e)}setB(e){return this._sc("b",e)}setA(e){return this._sc("a",e,1)}setHue(e){const t=this.toHsv();return t.h=e,this._c(t)}getLuminance(){function e(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}return.2126*e(this.r)+.7152*e(this.g)+.0722*e(this.b)}getHue(){if(void 0===this._h){const e=this.getMax()-this.getMin();this._h=0===e?0:D(60*(this.r===this.getMax()?(this.g-this.b)/e+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/e+2:(this.r-this.g)/e+4))}return this._h}getSaturation(){if(void 0===this._s){const e=this.getMax()-this.getMin();this._s=0===e?0:e/this.getMax()}return this._s}getLightness(){return void 0===this._l&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return void 0===this._v&&(this._v=this.getMax()/255),this._v}getBrightness(){return void 0===this._brightness&&(this._brightness=(299*this.r+587*this.g+114*this.b)/1e3),this._brightness}darken(e=10){const t=this.getHue(),n=this.getSaturation();let i=this.getLightness()-e/100;return i<0&&(i=0),this._c({h:t,s:n,l:i,a:this.a})}lighten(e=10){const t=this.getHue(),n=this.getSaturation();let i=this.getLightness()+e/100;return i>1&&(i=1),this._c({h:t,s:n,l:i,a:this.a})}mix(e,t=50){const n=this._c(e),i=t/100,r=e=>(n[e]-this[e])*i+this[e],s={r:D(r("r")),g:D(r("g")),b:D(r("b")),a:D(100*r("a"))/100};return this._c(s)}tint(e=10){return this.mix({r:255,g:255,b:255,a:1},e)}shade(e=10){return this.mix({r:0,g:0,b:0,a:1},e)}onBackground(e){const t=this._c(e),n=this.a+t.a*(1-this.a),i=e=>D((this[e]*this.a+t[e]*t.a*(1-this.a))/n);return this._c({r:i("r"),g:i("g"),b:i("b"),a:n})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}clone(){return this._c(this)}toHexString(){let e="#";const t=(this.r||0).toString(16);e+=2===t.length?t:"0"+t;const n=(this.g||0).toString(16);e+=2===n.length?n:"0"+n;const i=(this.b||0).toString(16);if(e+=2===i.length?i:"0"+i,"number"==typeof this.a&&this.a>=0&&this.a<1){const t=D(255*this.a).toString(16);e+=2===t.length?t:"0"+t}return e}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const e=this.getHue(),t=D(100*this.getSaturation()),n=D(100*this.getLightness());return 1!==this.a?`hsla(${e},${t}%,${n}%,${this.a})`:`hsl(${e},${t}%,${n}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return 1!==this.a?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(e,t,n){const i=this.clone();return i[e]=I(t,n),i}_c(e){return new this.constructor(e)}getMax(){return void 0===this._max&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return void 0===this._min&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(e){const t=e.replace("#","");function n(e,n){return parseInt(t[e]+t[n||e],16)}t.length<6?(this.r=n(0),this.g=n(1),this.b=n(2),this.a=t[3]?n(3)/255:1):(this.r=n(0,1),this.g=n(2,3),this.b=n(4,5),this.a=t[6]?n(6,7)/255:1)}fromHsl({h:e,s:t,l:n,a:i}){if(this._h=e%360,this._s=t,this._l=n,this.a="number"==typeof i?i:1,t<=0){const e=D(255*n);this.r=e,this.g=e,this.b=e}let r=0,s=0,o=0;const a=e/60,l=(1-Math.abs(2*n-1))*t,c=l*(1-Math.abs(a%2-1));a>=0&&a<1?(r=l,s=c):a>=1&&a<2?(r=c,s=l):a>=2&&a<3?(s=l,o=c):a>=3&&a<4?(s=c,o=l):a>=4&&a<5?(r=c,o=l):a>=5&&a<6&&(r=l,o=c);const u=n-l/2;this.r=D(255*(r+u)),this.g=D(255*(s+u)),this.b=D(255*(o+u))}fromHsv({h:e,s:t,v:n,a:i}){this._h=e%360,this._s=t,this._v=n,this.a="number"==typeof i?i:1;const r=D(255*n);if(this.r=r,this.g=r,this.b=r,t<=0)return;const s=e/60,o=Math.floor(s),a=s-o,l=D(n*(1-t)*255),c=D(n*(1-t*a)*255),u=D(n*(1-t*(1-a))*255);switch(o){case 0:this.g=u,this.b=l;break;case 1:this.r=c,this.b=l;break;case 2:this.r=l,this.b=u;break;case 3:this.r=l,this.g=c;break;case 4:this.r=u,this.g=l;break;default:this.g=l,this.b=c}}fromHsvString(e){const t=V(e,F);this.fromHsv({h:t[0],s:t[1],v:t[2],a:t[3]})}fromHslString(e){const t=V(e,F);this.fromHsl({h:t[0],s:t[1],l:t[2],a:t[3]})}fromRgbString(e){const t=V(e,((e,t)=>t.includes("%")?D(e/100*255):e));this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}}var z=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function B(e,t,n){var i;return(i=Math.round(e.h)>=60&&Math.round(e.h)<=240?n?Math.round(e.h)-2*t:Math.round(e.h)+2*t:n?Math.round(e.h)+2*t:Math.round(e.h)-2*t)<0?i+=360:i>=360&&(i-=360),i}function K(e,t,n){return 0===e.h&&0===e.s?e.s:((i=n?e.s-.16*t:4===t?e.s+.16:e.s+.05*t)>1&&(i=1),n&&5===t&&i>.1&&(i=.1),i<.06&&(i=.06),Math.round(100*i)/100);var i}function U(e,t,n){var i;return i=n?e.v+.05*t:e.v-.15*t,i=Math.max(0,Math.min(1,i)),Math.round(100*i)/100}var W=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];function q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?q(Object(n),!0).forEach((function(t){R(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}W.primary=W[5];var G="data-rc-order",Q="data-rc-priority",Y=new Map;function X(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).mark;return e?e.startsWith("data-")?e:"data-".concat(e):"rc-util-key"}function Z(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function ee(e){return Array.from((Y.get(e)||e).children).filter((function(e){return"STYLE"===e.tagName}))}function te(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("undefined"==typeof window||!window.document||!window.document.createElement)return null;var n=t.csp,i=t.prepend,r=t.priority,s=void 0===r?0:r,o=function(e){return"queue"===e?"prependQueue":e?"prepend":"append"}(i),a="prependQueue"===o,l=document.createElement("style");l.setAttribute(G,o),a&&s&&l.setAttribute(Q,"".concat(s)),null!=n&&n.nonce&&(l.nonce=null==n?void 0:n.nonce),l.innerHTML=e;var c=Z(t),u=c.firstChild;if(i){if(a){var h=(t.styles||ee(c)).filter((function(e){if(!["prepend","prependQueue"].includes(e.getAttribute(G)))return!1;var t=Number(e.getAttribute(Q)||0);return s>=t}));if(h.length)return c.insertBefore(l,h[h.length-1].nextSibling),l}c.insertBefore(l,u)}else c.appendChild(l);return l}function ne(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=Z(n),r=ee(i),s=J(J({},n),{},{styles:r});!function(e,t){var n=Y.get(e);if(!n||!function(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}(document,n)){var i=te("",t),r=i.parentNode;Y.set(e,r),e.removeChild(i)}}(i,s);var o=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Z(t);return(t.styles||ee(n)).find((function(n){return n.getAttribute(X(t))===e}))}(t,s);if(o){var a,l,c;if(null!==(a=s.csp)&&void 0!==a&&a.nonce&&o.nonce!==(null===(l=s.csp)||void 0===l?void 0:l.nonce))o.nonce=null===(c=s.csp)||void 0===c?void 0:c.nonce;return o.innerHTML!==e&&(o.innerHTML=e),o}var u=te(e,s);return u.setAttribute(X(s),t),u}function ie(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}function re(e){return function(e){return ie(e)instanceof ShadowRoot}(e)?ie(e):null}var se={},oe=[];function ae(e,t){if("production"!==process.env.NODE_ENV&&!e&&void 0!==console){var n=oe.reduce((function(e,t){return t(null!=e?e:"","warning")}),t);n&&console.error("Warning: ".concat(n))}}function le(e,t){if("production"!==process.env.NODE_ENV&&!e&&void 0!==console){var n=oe.reduce((function(e,t){return t(null!=e?e:"","note")}),t);n&&console.warn("Note: ".concat(n))}}function ce(e,t,n){t||se[n]||(e(!1,n),se[n]=!0)}function ue(e,t){ce(ae,e,t)}function he(e){return"object"===j(e)&&"string"==typeof e.name&&"string"==typeof e.theme&&("object"===j(e.icon)||"function"==typeof e.icon)}function de(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(e).reduce((function(t,n){var i,r=e[n];if("class"===n)t.className=r,delete t.class;else delete t[n],t[(i=n,i.replace(/-(.)/g,(function(e,t){return t.toUpperCase()})))]=r;return t}),{})}function pe(e,n,i){return i?t.createElement(e.tag,J(J({key:n},de(e.attrs)),i),(e.children||[]).map((function(t,i){return pe(t,"".concat(n,"-").concat(e.tag,"-").concat(i))}))):t.createElement(e.tag,J({key:n},de(e.attrs)),(e.children||[]).map((function(t,i){return pe(t,"".concat(n,"-").concat(e.tag,"-").concat(i))})))}function ge(e){return function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],i=new H(e),r=i.toHsv(),s=5;s>0;s-=1){var o=new H({h:B(r,s,!0),s:K(r,s,!0),v:U(r,s,!0)});n.push(o)}n.push(i);for(var a=1;a<=4;a+=1){var l=new H({h:B(r,a),s:K(r,a),v:U(r,a)});n.push(l)}return"dark"===t.theme?z.map((function(e){var i=e.index,r=e.amount;return new H(t.backgroundColor||"#141414").mix(n[i],r).toHexString()})):n.map((function(e){return e.toHexString()}))}(e)[0]}function fe(e){return e?Array.isArray(e)?e:[e]:[]}ue.preMessage=function(e){oe.push(e)},ue.resetWarned=function(){se={}},ue.noteOnce=function(e,t){ce(le,e,t)};var me=["icon","className","onClick","style","primaryColor","secondaryColor"],ve={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};var ye=function(t){var n,i,o,a,l,c,u,h,d=t.icon,p=t.className,g=t.onClick,f=t.style,m=t.primaryColor,v=t.secondaryColor,y=$(t,me),b=e.useRef(),x=ve;if(m&&(x={primaryColor:m,secondaryColor:v||ge(m)}),n=b,i=s(C),o=i.csp,a=i.prefixCls,l=i.layer,c="\n.anticon {\n display: inline-flex;\n align-items: center;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n",a&&(c=c.replace(/anticon/g,a)),l&&(c="@layer ".concat(l," {\n").concat(c,"\n}")),r((function(){var e=re(n.current);ne(c,"@ant-design-icons",{prepend:!l,csp:o,attachTo:e})}),[]),u=he(d),h="icon should be icon definiton, but got ".concat(d),ue(u,"[@ant-design/icons] ".concat(h)),!he(d))return null;var O=d;return O&&"function"==typeof O.icon&&(O=J(J({},O),{},{icon:O.icon(x.primaryColor,x.secondaryColor)})),pe(O.icon,"svg-".concat(O.name),J(J({className:p,onClick:g,style:f,"data-icon":O.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},y),{},{ref:b}))};function be(e){var t=L(fe(e),2),n=t[0],i=t[1];return ye.setTwoToneColors({primaryColor:n,secondaryColor:i})}ye.displayName="IconReact",ye.getTwoToneColors=function(){return J({},ve)},ye.setTwoToneColors=function(e){var t=e.primaryColor,n=e.secondaryColor;ve.primaryColor=t,ve.secondaryColor=n||ge(t),ve.calculated=!!n};var xe=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];be(W.primary);var Oe=e.forwardRef((function(t,n){var i=t.className,r=t.icon,s=t.spin,o=t.rotate,a=t.tabIndex,l=t.onClick,c=t.twoToneColor,u=$(t,xe),h=e.useContext(C),d=h.prefixCls,p=void 0===d?"anticon":d,g=h.rootClassName,f=T(g,p,R(R({},"".concat(p,"-").concat(r.name),!!r.name),"".concat(p,"-spin"),!!s||"loading"===r.name),i),m=a;void 0===m&&l&&(m=-1);var v=o?{msTransform:"rotate(".concat(o,"deg)"),transform:"rotate(".concat(o,"deg)")}:void 0,y=L(fe(c),2),b=y[0],x=y[1];return e.createElement("span",E({role:"img","aria-label":r.name},u,{ref:n,tabIndex:m,onClick:l,className:f}),e.createElement(ye,{icon:r,primaryColor:b,secondaryColor:x,style:v}))}));Oe.displayName="AntdIcon",Oe.getTwoToneColor=function(){var e=ye.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor},Oe.setTwoToneColor=be;var we={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z"}}]},name:"close-circle",theme:"outlined"},ke=function(t,n){return e.createElement(Oe,E({},t,{ref:n,icon:we}))},Se=e.forwardRef(ke);"production"!==process.env.NODE_ENV&&(Se.displayName="CloseCircleOutlined");var Ce={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z"}}]},name:"close",theme:"outlined"},Ee=function(t,n){return e.createElement(Oe,E({},t,{ref:n,icon:Ce}))},_e=e.forwardRef(Ee);"production"!==process.env.NODE_ENV&&(_e.displayName="CloseOutlined");var Le={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},je=function(t,n){return e.createElement(Oe,E({},t,{ref:n,icon:Le}))},Ne=e.forwardRef(je);"production"!==process.env.NODE_ENV&&(Ne.displayName="LeftOutlined");var Re={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},$e=function(t,n){return e.createElement(Oe,E({},t,{ref:n,icon:Re}))},Ae=e.forwardRef($e);"production"!==process.env.NODE_ENV&&(Ae.displayName="RightOutlined");var Pe=function(e){return"function"==typeof e},Me="development"===process.env.NODE_ENV||"test"===process.env.NODE_ENV;function Te(e,t){if(e===t)return!0;for(var n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0}var De=function(e){Me&&(Pe(e)||console.error("useUnmount expected parameter is a function, got ".concat(typeof e)));var t,n,i=((n=a(t=e)).current=t,n);r((function(){return function(){i.current()}}),[])},Ve=!("undefined"==typeof window||!window.document||!window.document.createElement);function Fe(e,t){if(Ve)return e?Pe(e)?e():"current"in e?e.current:e:t}var Ie=function(e){return function(t,n,i){var r=a(!1),s=a([]),o=a([]),l=a();e((function(){var e,a=(Array.isArray(i)?i:[i]).map((function(e){return Fe(e)}));if(!r.current)return r.current=!0,s.current=a,o.current=n,void(l.current=t());a.length===s.current.length&&Te(s.current,a)&&Te(o.current,n)||(null===(e=l.current)||void 0===e||e.call(l),s.current=a,o.current=n,l.current=t())})),De((function(){var e;null===(e=l.current)||void 0===e||e.call(l),r.current=!1}))}},He=Ie(r);var ze=function(){if("undefined"!=typeof Map)return Map;function e(e,t){var n=-1;return e.some((function(e,i){return e[0]===t&&(n=i,!0)})),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var n=e(this.__entries__,t),i=this.__entries__[n];return i&&i[1]},t.prototype.set=function(t,n){var i=e(this.__entries__,t);~i?this.__entries__[i][1]=n:this.__entries__.push([t,n])},t.prototype.delete=function(t){var n=this.__entries__,i=e(n,t);~i&&n.splice(i,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var n=0,i=this.__entries__;n<i.length;n++){var r=i[n];e.call(t,r[1],r[0])}},t}()}(),Be="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,Ke="undefined"!=typeof global&&global.Math===Math?global:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),Ue="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(Ke):function(e){return setTimeout((function(){return e(Date.now())}),1e3/60)};var We=["top","right","bottom","left","width","height","size","weight"],qe="undefined"!=typeof MutationObserver,Je=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(e,t){var n=!1,i=!1,r=0;function s(){n&&(n=!1,e()),i&&a()}function o(){Ue(s)}function a(){var e=Date.now();if(n){if(e-r<2)return;i=!0}else n=!0,i=!1,setTimeout(o,t);r=e}return a}(this.refresh.bind(this),20)}return e.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},e.prototype.removeObserver=function(e){var t=this.observers_,n=t.indexOf(e);~n&&t.splice(n,1),!t.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},e.prototype.updateObservers_=function(){var e=this.observers_.filter((function(e){return e.gatherActive(),e.hasActive()}));return e.forEach((function(e){return e.broadcastActive()})),e.length>0},e.prototype.connect_=function(){Be&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),qe?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){Be&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,n=void 0===t?"":t;We.some((function(e){return!!~n.indexOf(e)}))&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),Ge=function(e,t){for(var n=0,i=Object.keys(t);n<i.length;n++){var r=i[n];Object.defineProperty(e,r,{value:t[r],enumerable:!1,writable:!1,configurable:!0})}return e},Qe=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||Ke},Ye=it(0,0,0,0);function Xe(e){return parseFloat(e)||0}function Ze(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce((function(t,n){return t+Xe(e["border-"+n+"-width"])}),0)}function et(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return Ye;var i=Qe(e).getComputedStyle(e),r=function(e){for(var t={},n=0,i=["top","right","bottom","left"];n<i.length;n++){var r=i[n],s=e["padding-"+r];t[r]=Xe(s)}return t}(i),s=r.left+r.right,o=r.top+r.bottom,a=Xe(i.width),l=Xe(i.height);if("border-box"===i.boxSizing&&(Math.round(a+s)!==t&&(a-=Ze(i,"left","right")+s),Math.round(l+o)!==n&&(l-=Ze(i,"top","bottom")+o)),!function(e){return e===Qe(e).document.documentElement}(e)){var c=Math.round(a+s)-t,u=Math.round(l+o)-n;1!==Math.abs(c)&&(a-=c),1!==Math.abs(u)&&(l-=u)}return it(r.left,r.top,a,l)}var tt="undefined"!=typeof SVGGraphicsElement?function(e){return e instanceof Qe(e).SVGGraphicsElement}:function(e){return e instanceof Qe(e).SVGElement&&"function"==typeof e.getBBox};function nt(e){return Be?tt(e)?function(e){var t=e.getBBox();return it(0,0,t.width,t.height)}(e):et(e):Ye}function it(e,t,n,i){return{x:e,y:t,width:n,height:i}}var rt=function(){function e(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=it(0,0,0,0),this.target=e}return e.prototype.isActive=function(){var e=nt(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},e}(),st=function(e,t){var n,i,r,s,o,a,l,c=(i=(n=t).x,r=n.y,s=n.width,o=n.height,a="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,l=Object.create(a.prototype),Ge(l,{x:i,y:r,width:s,height:o,top:r,right:i+s,bottom:o+r,left:i}),l);Ge(this,{target:e,contentRect:c})},ot=function(){function e(e,t,n){if(this.activeObservations_=[],this.observations_=new ze,"function"!=typeof e)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=t,this.callbackCtx_=n}return e.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof Qe(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new rt(e)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof Qe(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach((function(t){t.isActive()&&e.activeObservations_.push(t)}))},e.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map((function(e){return new st(e.target,e.broadcastRect())}));this.callback_.call(e,t,e),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),at="undefined"!=typeof WeakMap?new WeakMap:new ze,lt=function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=Je.getInstance(),i=new ot(t,n,this);at.set(this,i)};["observe","unobserve","disconnect"].forEach((function(e){lt.prototype[e]=function(){var t;return(t=at.get(this))[e].apply(t,arguments)}}));var ct=void 0!==Ke.ResizeObserver?Ke.ResizeObserver:lt,ut=Ie(o),ht=Ve?ut:He;function dt(e){var t=O(function(e){var t=a(0),n=O(i(e),2),r=n[0],s=n[1],o=c((function(e){cancelAnimationFrame(t.current),t.current=requestAnimationFrame((function(){s(e)}))}),[]);return De((function(){cancelAnimationFrame(t.current)})),[r,o]}((function(){var t=Fe(e);return t?{width:t.clientWidth,height:t.clientHeight}:void 0})),2),n=t[0],r=t[1];return ht((function(){var t=Fe(e);if(t){var n=new ct((function(e){e.forEach((function(e){var t=e.target,n=t.clientWidth,i=t.clientHeight;r({width:n,height:i})}))}));return n.observe(t),function(){n.disconnect()}}}),[],e),n}!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}(".router-tab-box {\n cursor: pointer;\n}\n.router-tab-box .router-tab-icon {\n flex-basis: 20px;\n padding-left: 8px;\n font-size: 12px;\n z-index: 2;\n box-sizing: content-box;\n}\n\n.tab-item-divider {\n margin: 0;\n height: 20px;\n background: #ddd;\n}\n\n.tab-item {\n display: inline-block;\n user-select: none;\n}\n.tab-item .tab-item-icon {\n margin-left: 8px;\n padding: 2px;\n transition: color 0.3s;\n font-size: 12px;\n}\n\n.tab-list .fade-exit {\n opacity: 1;\n transform: scale(1);\n left: -100%;\n}\n\n.tab-list .fade-exit-active {\n opacity: 0;\n transform: scale(0.9);\n left: 0;\n transition: opacity 300ms, left 300ms, transform 300ms;\n}");const pt=e=>"string"==typeof e,gt=()=>{let e,t;const n=new Promise(((n,i)=>{e=n,t=i}));return n.resolve=e,n.reject=t,n},ft=e=>null==e?"":""+e,mt=/###/g,vt=e=>e&&e.indexOf("###")>-1?e.replace(mt,"."):e,yt=e=>!e||pt(e),bt=(e,t,n)=>{const i=pt(t)?t.split("."):t;let r=0;for(;r<i.length-1;){if(yt(e))return{};const t=vt(i[r]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++r}return yt(e)?{}:{obj:e,k:vt(i[r])}},xt=(e,t,n)=>{const{obj:i,k:r}=bt(e,t,Object);if(void 0!==i||1===t.length)return void(i[r]=n);let s=t[t.length-1],o=t.slice(0,t.length-1),a=bt(e,o,Object);for(;void 0===a.obj&&o.length;)s=`${o[o.length-1]}.${s}`,o=o.slice(0,o.length-1),a=bt(e,o,Object),a?.obj&&void 0!==a.obj[`${a.k}.${s}`]&&(a.obj=void 0);a.obj[`${a.k}.${s}`]=n},Ot=(e,t)=>{const{obj:n,k:i}=bt(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,i))return n[i]},wt=(e,t,n)=>{for(const i in t)"__proto__"!==i&&"constructor"!==i&&(i in e?pt(e[i])||e[i]instanceof String||pt(t[i])||t[i]instanceof String?n&&(e[i]=t[i]):wt(e[i],t[i],n):e[i]=t[i]);return e},kt=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var St={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const Ct=e=>pt(e)?e.replace(/[&<>"'\/]/g,(e=>St[e])):e;const Et=[" ",",","?","!",";"],_t=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}(20),Lt=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}const i=t.split(n);let r=e;for(let e=0;e<i.length;){if(!r||"object"!=typeof r)return;let t,s="";for(let o=e;o<i.length;++o)if(o!==e&&(s+=n),s+=i[o],t=r[s],void 0!==t){if(["string","number","boolean"].indexOf(typeof t)>-1&&o<i.length-1)continue;e+=o-e+1;break}r=t}return r},jt=e=>e?.replace("_","-"),Nt={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class Rt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||Nt,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}warn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}error(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}deprecate(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,n,i){return i&&!this.debug?null:(pt(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new Rt(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new Rt(this.logger,e)}}var $t=new Rt;class At{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach((e=>{this.observers[e]||(this.observers[e]=new Map);const n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)})),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];if(this.observers[e]){Array.from(this.observers[e].entries()).forEach((e=>{let[t,i]=e;for(let e=0;e<i;e++)t(...n)}))}if(this.observers["*"]){Array.from(this.observers["*"].entries()).forEach((t=>{let[i,r]=t;for(let t=0;t<r;t++)i.apply(i,[e,...n])}))}}}class Pt extends At{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,s=void 0!==i.ignoreJSONStructure?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let o;e.indexOf(".")>-1?o=e.split("."):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):pt(n)&&r?o.push(...n.split(r)):o.push(n)));const a=Ot(this.data,o);return!a&&!t&&!n&&e.indexOf(".")>-1&&(e=o[0],t=o[1],n=o.slice(2).join(".")),!a&&s&&pt(n)?Lt(this.data?.[e]?.[t],n,r):a}addResource(e,t,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1};const s=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator;let o=[e,t];n&&(o=o.concat(s?n.split(s):n)),e.indexOf(".")>-1&&(o=e.split("."),i=t,t=o[1]),this.addNamespaces(t),xt(this.data,o,i),r.silent||this.emit("added",e,t,n,i)}addResources(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(const i in n)(pt(n[i])||Array.isArray(n[i]))&&this.addResource(e,t,i,n[i],{silent:!0});i.silent||this.emit("added",e,t,n)}addResourceBundle(e,t,n,i,r){let s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1,skipCopy:!1},o=[e,t];e.indexOf(".")>-1&&(o=e.split("."),i=n,n=t,t=o[1]),this.addNamespaces(t);let a=Ot(this.data,o)||{};s.skipCopy||(n=JSON.parse(JSON.stringify(n))),i?wt(a,n,r):a={...a,...n},xt(this.data,o,a),s.silent||this.emit("added",e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((e=>t[e]&&Object.keys(t[e]).length>0))}toJSON(){return this.data}}var Mt={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,i,r){return e.forEach((e=>{t=this.processors[e]?.process(t,n,i,r)??t})),t}};const Tt={},Dt=e=>!pt(e)&&"boolean"!=typeof e&&"number"!=typeof e;class Vt extends At{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n,i;super(),n=e,i=this,["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"].forEach((e=>{n[e]&&(i[e]=n[e])})),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=$t.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;const n=this.resolve(e,t);return void 0!==n?.res}extractFromKey(e,t){let n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");const i=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let r=t.ns||this.options.defaultNS||[];const s=n&&e.indexOf(n)>-1,o=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,n)=>{t=t||"",n=n||"";const i=Et.filter((e=>t.indexOf(e)<0&&n.indexOf(e)<0));if(0===i.length)return!0;const r=_t.getRegExp(`(${i.map((e=>"?"===e?"\\?":e)).join("|")})`);let s=!r.test(e);if(!s){const t=e.indexOf(n);t>0&&!r.test(e.substring(0,t))&&(s=!0)}return s})(e,n,i));if(s&&!o){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:pt(r)?[r]:r};const s=e.split(n);(n!==i||n===i&&this.options.ns.indexOf(s[0])>-1)&&(r=s.shift()),e=s.join(i)}return{key:e,namespaces:pt(r)?[r]:r}}translate(e,t,n){if("object"!=typeof t&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof t&&(t={...t}),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);const i=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,{key:s,namespaces:o}=this.extractFromKey(e[e.length-1],t),a=o[o.length-1],l=t.lng||this.language,c=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if("cimode"===l?.toLowerCase()){if(c){const e=t.nsSeparator||this.options.nsSeparator;return i?{res:`${a}${e}${s}`,usedKey:s,exactUsedKey:s,usedLng:l,usedNS:a,usedParams:this.getUsedParamsDetails(t)}:`${a}${e}${s}`}return i?{res:s,usedKey:s,exactUsedKey:s,usedLng:l,usedNS:a,usedParams:this.getUsedParamsDetails(t)}:s}const u=this.resolve(e,t);let h=u?.res;const d=u?.usedKey||s,p=u?.exactUsedKey||s,g=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,f=!this.i18nFormat||this.i18nFormat.handleAsObject,m=void 0!==t.count&&!pt(t.count),v=Vt.hasDefaultValue(t),y=m?this.pluralResolver.getSuffix(l,t.count,t):"",b=t.ordinal&&m?this.pluralResolver.getSuffix(l,t.count,{ordinal:!1}):"",x=m&&!t.ordinal&&0===t.count,O=x&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${y}`]||t[`defaultValue${b}`]||t.defaultValue;let w=h;f&&!h&&v&&(w=O);const k=Dt(w),S=Object.prototype.toString.apply(w);if(!(f&&w&&k&&["[object Number]","[object Function]","[object RegExp]"].indexOf(S)<0)||pt(g)&&Array.isArray(w))if(f&&pt(g)&&Array.isArray(h))h=h.join(g),h&&(h=this.extendTranslation(h,e,t,n));else{let i=!1,o=!1;!this.isValidLookup(h)&&v&&(i=!0,h=O),this.isValidLookup(h)||(o=!0,h=s);const c=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&o?void 0:h,d=v&&O!==h&&this.options.updateMissing;if(o||i||d){if(this.logger.log(d?"updateKey":"missingKey",l,a,s,d?O:h),r){const e=this.resolve(s,{...t,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const n=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&n&&n[0])for(let t=0;t<n.length;t++)e.push(n[t]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(t.lng||this.language):e.push(t.lng||this.language);const i=(e,n,i)=>{const r=v&&i!==h?i:c;this.options.missingKeyHandler?this.options.missingKeyHandler(e,a,n,r,d,t):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,a,n,r,d,t),this.emit("missingKey",e,a,n,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&m?e.forEach((e=>{const n=this.pluralResolver.getSuffixes(e,t);x&&t[`defaultValue${this.options.pluralSeparator}zero`]&&n.indexOf(`${this.options.pluralSeparator}zero`)<0&&n.push(`${this.options.pluralSeparator}zero`),n.forEach((n=>{i([e],s+n,t[`defaultValue${n}`]||O)}))})):i(e,s,O))}h=this.extendTranslation(h,e,t,u,n),o&&h===s&&this.options.appendNamespaceToMissingKey&&(h=`${a}:${s}`),(o||i)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${a}:${s}`:s,i?h:void 0))}else{if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(d,w,{...t,ns:o}):`key '${s} (${this.language})' returned an object instead of string.`;return i?(u.res=e,u.usedParams=this.getUsedParamsDetails(t),u):e}if(r){const e=Array.isArray(w),n=e?[]:{},i=e?p:d;for(const e in w)if(Object.prototype.hasOwnProperty.call(w,e)){const s=`${i}${r}${e}`;n[e]=v&&!h?this.translate(s,{...t,defaultValue:Dt(O)?O[e]:void 0,joinArrays:!1,ns:o}):this.translate(s,{...t,joinArrays:!1,ns:o}),n[e]===s&&(n[e]=w[e])}h=n}}return i?(u.res=h,u.usedParams=this.getUsedParamsDetails(t),u):h}extendTranslation(e,t,n,i,r){var s=this;if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const o=pt(e)&&(void 0!==n?.interpolation?.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let a;if(o){const t=e.match(this.interpolator.nestingRegexp);a=t&&t.length}let l=n.replace&&!pt(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),e=this.interpolator.interpolate(e,l,n.lng||this.language||i.usedLng,n),o){const t=e.match(this.interpolator.nestingRegexp);a<(t&&t.length)&&(n.nest=!1)}!n.lng&&i&&i.res&&(n.lng=this.language||i.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,i=new Array(e),o=0;o<e;o++)i[o]=arguments[o];return r?.[0]!==i[0]||n.context?s.translate(...i,t):(s.logger.warn(`It seems you are nesting recursively key: ${i[0]} in key: ${t[0]}`),null)}),n)),n.interpolation&&this.interpolator.reset()}const o=n.postProcess||this.options.postProcess,a=pt(o)?[o]:o;return null!=e&&a?.length&&!1!==n.applyPostProcessor&&(e=Mt.handle(a,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e){let t,n,i,r,s,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return pt(e)&&(e=[e]),e.forEach((e=>{if(this.isValidLookup(t))return;const a=this.extractFromKey(e,o),l=a.key;n=l;let c=a.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));const u=void 0!==o.count&&!pt(o.count),h=u&&!o.ordinal&&0===o.count,d=void 0!==o.context&&(pt(o.context)||"number"==typeof o.context)&&""!==o.context,p=o.lngs?o.lngs:this.languageUtils.toResolveHierarchy(o.lng||this.language,o.fallbackLng);c.forEach((e=>{this.isValidLookup(t)||(s=e,Tt[`${p[0]}-${e}`]||!this.utils?.hasLoadedNamespace||this.utils?.hasLoadedNamespace(s)||(Tt[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${n}" for languages "${p.join(", ")}" won't get resolved as namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach((n=>{if(this.isValidLookup(t))return;r=n;const s=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(s,l,n,e,o);else{let e;u&&(e=this.pluralResolver.getSuffix(n,o.count,o));const t=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(s.push(l+e),o.ordinal&&0===e.indexOf(i)&&s.push(l+e.replace(i,this.options.pluralSeparator)),h&&s.push(l+t)),d){const n=`${l}${this.options.contextSeparator}${o.context}`;s.push(n),u&&(s.push(n+e),o.ordinal&&0===e.indexOf(i)&&s.push(n+e.replace(i,this.options.pluralSeparator)),h&&s.push(n+t))}}let a;for(;a=s.pop();)this.isValidLookup(t)||(i=a,t=this.getResource(n,e,a,o))})))}))})),{res:t,usedKey:n,exactUsedKey:i,usedLng:r,usedNS:s}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,i):this.resourceStore.getResource(e,t,n,i)}getUsedParamsDetails(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!pt(e.replace);let i=n?e.replace:e;if(n&&void 0!==e.count&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!n){i={...i};for(const e of t)delete i[e]}return i}static hasDefaultValue(e){const t="defaultValue";for(const n in e)if(O