diff --git a/assets/index-5c5196b1.js b/assets/index-b4e39f66.js similarity index 99% rename from assets/index-5c5196b1.js rename to assets/index-b4e39f66.js index 7fbf034..7a67686 100644 --- a/assets/index-5c5196b1.js +++ b/assets/index-b4e39f66.js @@ -81,7 +81,7 @@ Error generating stack: `+et.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var h$6=reactExports,n=shimExports;function p(i,o){return i===o&&(i!==0||1/i===1/o)||i!==i&&o!==o}var q=typeof Object.is=="function"?Object.is:p,r=n.useSyncExternalStore,t=h$6.useRef,u=h$6.useEffect,v$6=h$6.useMemo,w$6=h$6.useDebugValue;withSelector_production_min.useSyncExternalStoreWithSelector=function(i,o,j,$,_e){var et=t(null);if(et.current===null){var tt={hasValue:!1,value:null};et.current=tt}else tt=et.current;et=v$6(function(){function rt(pt){if(!it){if(it=!0,at=pt,pt=$(pt),_e!==void 0&&tt.hasValue){var ht=tt.value;if(_e(ht,pt))return ct=ht}return ct=pt}if(ht=ct,q(at,pt))return ht;var dt=$(pt);return _e!==void 0&&_e(ht,dt)?ht:(at=pt,ct=dt)}var it=!1,at,ct,st=j===void 0?null:j;return[function(){return rt(o())},st===null?void 0:function(){return rt(st())}]},[o,j,$,_e]);var nt=r(i,et[0],et[1]);return u(function(){tt.hasValue=!0,tt.value=nt},[nt]),w$6(nt),nt};withSelector.exports=withSelector_production_min;var withSelectorExports=withSelector.exports;const useSyncExternalStoreExports=getDefaultExportFromCjs(withSelectorExports),{useSyncExternalStoreWithSelector}=useSyncExternalStoreExports;function useStore$1(i,o=i.getState,j){const $=useSyncExternalStoreWithSelector(i.subscribe,i.getState,i.getServerState||i.getState,o,j);return reactExports.useDebugValue($),$}const createImpl=i=>{const o=typeof i=="function"?createStore(i):i,j=($,_e)=>useStore$1(o,$,_e);return Object.assign(j,o),j},create$1=i=>i?createImpl(i):createImpl,useStore=create$1((i,o)=>({overlays:[],setOverlays:j=>i({overlays:j}),txId:void 0,setTxId:j=>i({txId:j}),users:[],setUsers:j=>i({users:j}),selectPersonId:null,setSelectPersonId:j=>i({selectPersonId:j}),isSelectPayers:null,setIsSelectPayers:j=>i({isSelectPayers:j}),currencies:[],setCurrencies:j=>i({currencies:j}),setCurrency:j=>{o().transaction!==void 0&&i({transaction:{...o().transaction,currency_id:j}})},chat:void 0,setChat:j=>i({chat:j}),transaction:void 0,setTransaction:j=>i({transaction:j}),isAuthorSharesInited:!1,setIsAuthorSharesInited:j=>i({isAuthorSharesInited:j}),txComment:"",setTxComment:j=>i({txComment:j}),isSuccess:null,setSuccess:j=>i({isSuccess:j}),txPatchError:null,setTxPatchError:j=>i({txPatchError:j}),summaryId:void 0,setSummaryId:j=>i({summaryId:j}),summary:void 0,setSummary:j=>i({summary:j})})),useCurrencies=()=>{const{currencies:i}=useStore();return{getCurrencyById:j=>i.find($=>$._id===j)}},consoleLogger={type:"logger",log(i){this.output("log",i)},warn(i){this.output("warn",i)},error(i){this.output("error",i)},output(i,o){console&&console[i]&&console[i].apply(console,o)}};class Logger{constructor(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(o,j)}init(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=j.prefix||"i18next:",this.logger=o||consoleLogger,this.options=j,this.debug=j.debug}log(){for(var o=arguments.length,j=new Array(o),$=0;${this.observers[$]=this.observers[$]||[],this.observers[$].push(j)}),this}off(o,j){if(this.observers[o]){if(!j){delete this.observers[o];return}this.observers[o]=this.observers[o].filter($=>$!==j)}}emit(o){for(var j=arguments.length,$=new Array(j>1?j-1:0),_e=1;_e{tt(...$)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(tt=>{tt.apply(tt,[o,...$])})}}function defer(){let i,o;const j=new Promise(($,_e)=>{i=$,o=_e});return j.resolve=i,j.reject=o,j}function makeString(i){return i==null?"":""+i}function copy(i,o,j){i.forEach($=>{o[$]&&(j[$]=o[$])})}function getLastOfPath(i,o,j){function $(tt){return tt&&tt.indexOf("###")>-1?tt.replace(/###/g,"."):tt}function _e(){return!i||typeof i=="string"}const et=typeof o!="string"?[].concat(o):o.split(".");for(;et.length>1;){if(_e())return{};const tt=$(et.shift());!i[tt]&&j&&(i[tt]=new j),Object.prototype.hasOwnProperty.call(i,tt)?i=i[tt]:i={}}return _e()?{}:{obj:i,k:$(et.shift())}}function setPath(i,o,j){const{obj:$,k:_e}=getLastOfPath(i,o,Object);$[_e]=j}function pushPath(i,o,j,$){const{obj:_e,k:et}=getLastOfPath(i,o,Object);_e[et]=_e[et]||[],$&&(_e[et]=_e[et].concat(j)),$||_e[et].push(j)}function getPath(i,o){const{obj:j,k:$}=getLastOfPath(i,o);if(j)return j[$]}function getPathWithDefaults(i,o,j){const $=getPath(i,j);return $!==void 0?$:getPath(o,j)}function deepExtend(i,o,j){for(const $ in o)$!=="__proto__"&&$!=="constructor"&&($ in i?typeof i[$]=="string"||i[$]instanceof String||typeof o[$]=="string"||o[$]instanceof String?j&&(i[$]=o[$]):deepExtend(i[$],o[$],j):i[$]=o[$]);return i}function regexEscape(i){return i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var _entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function escape(i){return typeof i=="string"?i.replace(/[&<>"'\/]/g,o=>_entityMap[o]):i}const chars=[" ",",","?","!",";"];function looksLikeObjectPath(i,o,j){o=o||"",j=j||"";const $=chars.filter(tt=>o.indexOf(tt)<0&&j.indexOf(tt)<0);if($.length===0)return!0;const _e=new RegExp(`(${$.map(tt=>tt==="?"?"\\?":tt).join("|")})`);let et=!_e.test(i);if(!et){const tt=i.indexOf(j);tt>0&&!_e.test(i.substring(0,tt))&&(et=!0)}return et}function deepFind(i,o){let j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!i)return;if(i[o])return i[o];const $=o.split(j);let _e=i;for(let et=0;et<$.length;++et){if(!_e||typeof _e[$[et]]=="string"&&et+1<$.length)return;if(_e[$[et]]===void 0){let tt=2,nt=$.slice(et,et+tt).join(j),rt=_e[nt];for(;rt===void 0&&$.length>et+tt;)tt++,nt=$.slice(et,et+tt).join(j),rt=_e[nt];if(rt===void 0)return;if(rt===null)return null;if(o.endsWith(nt)){if(typeof rt=="string")return rt;if(nt&&typeof rt[nt]=="string")return rt[nt]}const it=$.slice(et+tt).join(j);return it?deepFind(rt,it,j):void 0}_e=_e[$[et]]}return _e}function getCleanedCode(i){return i&&i.indexOf("_")>0?i.replace("_","-"):i}class ResourceStore extends EventEmitter{constructor(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=o||{},this.options=j,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(o){this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}removeNamespaces(o){const j=this.options.ns.indexOf(o);j>-1&&this.options.ns.splice(j,1)}getResource(o,j,$){let _e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const et=_e.keySeparator!==void 0?_e.keySeparator:this.options.keySeparator,tt=_e.ignoreJSONStructure!==void 0?_e.ignoreJSONStructure:this.options.ignoreJSONStructure;let nt=[o,j];$&&typeof $!="string"&&(nt=nt.concat($)),$&&typeof $=="string"&&(nt=nt.concat(et?$.split(et):$)),o.indexOf(".")>-1&&(nt=o.split("."));const rt=getPath(this.data,nt);return rt||!tt||typeof $!="string"?rt:deepFind(this.data&&this.data[o]&&this.data[o][j],$,et)}addResource(o,j,$,_e){let et=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const tt=et.keySeparator!==void 0?et.keySeparator:this.options.keySeparator;let nt=[o,j];$&&(nt=nt.concat(tt?$.split(tt):$)),o.indexOf(".")>-1&&(nt=o.split("."),_e=j,j=nt[1]),this.addNamespaces(j),setPath(this.data,nt,_e),et.silent||this.emit("added",o,j,$,_e)}addResources(o,j,$){let _e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const et in $)(typeof $[et]=="string"||Object.prototype.toString.apply($[et])==="[object Array]")&&this.addResource(o,j,et,$[et],{silent:!0});_e.silent||this.emit("added",o,j,$)}addResourceBundle(o,j,$,_e,et){let tt=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},nt=[o,j];o.indexOf(".")>-1&&(nt=o.split("."),_e=$,$=j,j=nt[1]),this.addNamespaces(j);let rt=getPath(this.data,nt)||{};_e?deepExtend(rt,$,et):rt={...rt,...$},setPath(this.data,nt,rt),tt.silent||this.emit("added",o,j,$)}removeResourceBundle(o,j){this.hasResourceBundle(o,j)&&delete this.data[o][j],this.removeNamespaces(j),this.emit("removed",o,j)}hasResourceBundle(o,j){return this.getResource(o,j)!==void 0}getResourceBundle(o,j){return j||(j=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(o,j)}:this.getResource(o,j)}getDataByLanguage(o){return this.data[o]}hasLanguageSomeTranslations(o){const j=this.getDataByLanguage(o);return!!(j&&Object.keys(j)||[]).find(_e=>j[_e]&&Object.keys(j[_e]).length>0)}toJSON(){return this.data}}var postProcessor={processors:{},addPostProcessor(i){this.processors[i.name]=i},handle(i,o,j,$,_e){return i.forEach(et=>{this.processors[et]&&(o=this.processors[et].process(o,j,$,_e))}),o}};const checkedLoadedFor={};class Translator extends EventEmitter{constructor(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),copy(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],o,this),this.options=j,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=baseLogger.create("translator")}changeLanguage(o){o&&(this.language=o)}exists(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(o==null)return!1;const $=this.resolve(o,j);return $&&$.res!==void 0}extractFromKey(o,j){let $=j.nsSeparator!==void 0?j.nsSeparator:this.options.nsSeparator;$===void 0&&($=":");const _e=j.keySeparator!==void 0?j.keySeparator:this.options.keySeparator;let et=j.ns||this.options.defaultNS||[];const tt=$&&o.indexOf($)>-1,nt=!this.options.userDefinedKeySeparator&&!j.keySeparator&&!this.options.userDefinedNsSeparator&&!j.nsSeparator&&!looksLikeObjectPath(o,$,_e);if(tt&&!nt){const rt=o.match(this.interpolator.nestingRegexp);if(rt&&rt.length>0)return{key:o,namespaces:et};const it=o.split($);($!==_e||$===_e&&this.options.ns.indexOf(it[0])>-1)&&(et=it.shift()),o=it.join(_e)}return typeof et=="string"&&(et=[et]),{key:o,namespaces:et}}translate(o,j,$){if(typeof j!="object"&&this.options.overloadTranslationOptionHandler&&(j=this.options.overloadTranslationOptionHandler(arguments)),typeof j=="object"&&(j={...j}),j||(j={}),o==null)return"";Array.isArray(o)||(o=[String(o)]);const _e=j.returnDetails!==void 0?j.returnDetails:this.options.returnDetails,et=j.keySeparator!==void 0?j.keySeparator:this.options.keySeparator,{key:tt,namespaces:nt}=this.extractFromKey(o[o.length-1],j),rt=nt[nt.length-1],it=j.lng||this.language,at=j.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(it&&it.toLowerCase()==="cimode"){if(at){const ft=j.nsSeparator||this.options.nsSeparator;return _e?{res:`${rt}${ft}${tt}`,usedKey:tt,exactUsedKey:tt,usedLng:it,usedNS:rt,usedParams:this.getUsedParamsDetails(j)}:`${rt}${ft}${tt}`}return _e?{res:tt,usedKey:tt,exactUsedKey:tt,usedLng:it,usedNS:rt,usedParams:this.getUsedParamsDetails(j)}:tt}const ct=this.resolve(o,j);let st=ct&&ct.res;const pt=ct&&ct.usedKey||tt,ht=ct&&ct.exactUsedKey||tt,dt=Object.prototype.toString.apply(st),yt=["[object Number]","[object Function]","[object RegExp]"],ot=j.joinArrays!==void 0?j.joinArrays:this.options.joinArrays,ut=!this.i18nFormat||this.i18nFormat.handleAsObject;if(ut&&st&&(typeof st!="string"&&typeof st!="boolean"&&typeof st!="number")&&yt.indexOf(dt)<0&&!(typeof ot=="string"&&dt==="[object Array]")){if(!j.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const ft=this.options.returnedObjectHandler?this.options.returnedObjectHandler(pt,st,{...j,ns:nt}):`key '${tt} (${this.language})' returned an object instead of string.`;return _e?(ct.res=ft,ct.usedParams=this.getUsedParamsDetails(j),ct):ft}if(et){const ft=dt==="[object Array]",gt=ft?[]:{},kt=ft?ht:pt;for(const xt in st)if(Object.prototype.hasOwnProperty.call(st,xt)){const _t=`${kt}${et}${xt}`;gt[xt]=this.translate(_t,{...j,joinArrays:!1,ns:nt}),gt[xt]===_t&&(gt[xt]=st[xt])}st=gt}}else if(ut&&typeof ot=="string"&&dt==="[object Array]")st=st.join(ot),st&&(st=this.extendTranslation(st,o,j,$));else{let ft=!1,gt=!1;const kt=j.count!==void 0&&typeof j.count!="string",xt=Translator.hasDefaultValue(j),_t=kt?this.pluralResolver.getSuffix(it,j.count,j):"",Ct=j.ordinal&&kt?this.pluralResolver.getSuffix(it,j.count,{ordinal:!1}):"",Rt=j[`defaultValue${_t}`]||j[`defaultValue${Ct}`]||j.defaultValue;!this.isValidLookup(st)&&xt&&(ft=!0,st=Rt),this.isValidLookup(st)||(gt=!0,st=tt);const Tt=(j.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&>?void 0:st,jt=xt&&Rt!==st&&this.options.updateMissing;if(gt||ft||jt){if(this.logger.log(jt?"updateKey":"missingKey",it,rt,tt,jt?Rt:st),et){const bt=this.resolve(tt,{...j,keySeparator:!1});bt&&bt.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 Bt=[];const Ft=this.languageUtils.getFallbackCodes(this.options.fallbackLng,j.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Ft&&Ft[0])for(let bt=0;bt{const Pt=xt&&vt!==st?vt:Tt;this.options.missingKeyHandler?this.options.missingKeyHandler(bt,rt,mt,Pt,jt,j):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(bt,rt,mt,Pt,jt,j),this.emit("missingKey",bt,rt,mt,st)};this.options.saveMissing&&(this.options.saveMissingPlurals&&kt?Bt.forEach(bt=>{this.pluralResolver.getSuffixes(bt,j).forEach(mt=>{Et([bt],tt+mt,j[`defaultValue${mt}`]||Rt)})}):Et(Bt,tt,Rt))}st=this.extendTranslation(st,o,j,ct,$),gt&&st===tt&&this.options.appendNamespaceToMissingKey&&(st=`${rt}:${tt}`),(gt||ft)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?st=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${rt}:${tt}`:tt,ft?st:void 0):st=this.options.parseMissingKeyHandler(st))}return _e?(ct.res=st,ct.usedParams=this.getUsedParamsDetails(j),ct):st}extendTranslation(o,j,$,_e,et){var tt=this;if(this.i18nFormat&&this.i18nFormat.parse)o=this.i18nFormat.parse(o,{...this.options.interpolation.defaultVariables,...$},$.lng||this.language||_e.usedLng,_e.usedNS,_e.usedKey,{resolved:_e});else if(!$.skipInterpolation){$.interpolation&&this.interpolator.init({...$,interpolation:{...this.options.interpolation,...$.interpolation}});const it=typeof o=="string"&&($&&$.interpolation&&$.interpolation.skipOnVariables!==void 0?$.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let at;if(it){const st=o.match(this.interpolator.nestingRegexp);at=st&&st.length}let ct=$.replace&&typeof $.replace!="string"?$.replace:$;if(this.options.interpolation.defaultVariables&&(ct={...this.options.interpolation.defaultVariables,...ct}),o=this.interpolator.interpolate(o,ct,$.lng||this.language,$),it){const st=o.match(this.interpolator.nestingRegexp),pt=st&&st.length;at1&&arguments[1]!==void 0?arguments[1]:{},$,_e,et,tt,nt;return typeof o=="string"&&(o=[o]),o.forEach(rt=>{if(this.isValidLookup($))return;const it=this.extractFromKey(rt,j),at=it.key;_e=at;let ct=it.namespaces;this.options.fallbackNS&&(ct=ct.concat(this.options.fallbackNS));const st=j.count!==void 0&&typeof j.count!="string",pt=st&&!j.ordinal&&j.count===0&&this.pluralResolver.shouldUseIntlApi(),ht=j.context!==void 0&&(typeof j.context=="string"||typeof j.context=="number")&&j.context!=="",dt=j.lngs?j.lngs:this.languageUtils.toResolveHierarchy(j.lng||this.language,j.fallbackLng);ct.forEach(yt=>{this.isValidLookup($)||(nt=yt,!checkedLoadedFor[`${dt[0]}-${yt}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(nt)&&(checkedLoadedFor[`${dt[0]}-${yt}`]=!0,this.logger.warn(`key "${_e}" for languages "${dt.join(", ")}" won't get resolved as namespace "${nt}" 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!!!")),dt.forEach(ot=>{if(this.isValidLookup($))return;tt=ot;const ut=[at];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(ut,at,ot,yt,j);else{let ft;st&&(ft=this.pluralResolver.getSuffix(ot,j.count,j));const gt=`${this.options.pluralSeparator}zero`,kt=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(st&&(ut.push(at+ft),j.ordinal&&ft.indexOf(kt)===0&&ut.push(at+ft.replace(kt,this.options.pluralSeparator)),pt&&ut.push(at+gt)),ht){const xt=`${at}${this.options.contextSeparator}${j.context}`;ut.push(xt),st&&(ut.push(xt+ft),j.ordinal&&ft.indexOf(kt)===0&&ut.push(xt+ft.replace(kt,this.options.pluralSeparator)),pt&&ut.push(xt+gt))}}let lt;for(;lt=ut.pop();)this.isValidLookup($)||(et=lt,$=this.getResource(ot,yt,lt,j))}))})}),{res:$,usedKey:_e,exactUsedKey:et,usedLng:tt,usedNS:nt}}isValidLookup(o){return o!==void 0&&!(!this.options.returnNull&&o===null)&&!(!this.options.returnEmptyString&&o==="")}getResource(o,j,$){let _e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(o,j,$,_e):this.resourceStore.getResource(o,j,$,_e)}getUsedParamsDetails(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const j=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],$=o.replace&&typeof o.replace!="string";let _e=$?o.replace:o;if($&&typeof o.count<"u"&&(_e.count=o.count),this.options.interpolation.defaultVariables&&(_e={...this.options.interpolation.defaultVariables,..._e}),!$){_e={..._e};for(const et of j)delete _e[et]}return _e}static hasDefaultValue(o){const j="defaultValue";for(const $ in o)if(Object.prototype.hasOwnProperty.call(o,$)&&j===$.substring(0,j.length)&&o[$]!==void 0)return!0;return!1}}function capitalize(i){return i.charAt(0).toUpperCase()+i.slice(1)}class LanguageUtil{constructor(o){this.options=o,this.supportedLngs=this.options.supportedLngs||!1,this.logger=baseLogger.create("languageUtils")}getScriptPartFromCode(o){if(o=getCleanedCode(o),!o||o.indexOf("-")<0)return null;const j=o.split("-");return j.length===2||(j.pop(),j[j.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(j.join("-"))}getLanguagePartFromCode(o){if(o=getCleanedCode(o),!o||o.indexOf("-")<0)return o;const j=o.split("-");return this.formatLanguageCode(j[0])}formatLanguageCode(o){if(typeof o=="string"&&o.indexOf("-")>-1){const j=["hans","hant","latn","cyrl","cans","mong","arab"];let $=o.split("-");return this.options.lowerCaseLng?$=$.map(_e=>_e.toLowerCase()):$.length===2?($[0]=$[0].toLowerCase(),$[1]=$[1].toUpperCase(),j.indexOf($[1].toLowerCase())>-1&&($[1]=capitalize($[1].toLowerCase()))):$.length===3&&($[0]=$[0].toLowerCase(),$[1].length===2&&($[1]=$[1].toUpperCase()),$[0]!=="sgn"&&$[2].length===2&&($[2]=$[2].toUpperCase()),j.indexOf($[1].toLowerCase())>-1&&($[1]=capitalize($[1].toLowerCase())),j.indexOf($[2].toLowerCase())>-1&&($[2]=capitalize($[2].toLowerCase()))),$.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?o.toLowerCase():o}isSupportedCode(o){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(o=this.getLanguagePartFromCode(o)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(o)>-1}getBestMatchFromCodes(o){if(!o)return null;let j;return o.forEach($=>{if(j)return;const _e=this.formatLanguageCode($);(!this.options.supportedLngs||this.isSupportedCode(_e))&&(j=_e)}),!j&&this.options.supportedLngs&&o.forEach($=>{if(j)return;const _e=this.getLanguagePartFromCode($);if(this.isSupportedCode(_e))return j=_e;j=this.options.supportedLngs.find(et=>{if(et===_e)return et;if(!(et.indexOf("-")<0&&_e.indexOf("-")<0)&&et.indexOf(_e)===0)return et})}),j||(j=this.getFallbackCodes(this.options.fallbackLng)[0]),j}getFallbackCodes(o,j){if(!o)return[];if(typeof o=="function"&&(o=o(j)),typeof o=="string"&&(o=[o]),Object.prototype.toString.apply(o)==="[object Array]")return o;if(!j)return o.default||[];let $=o[j];return $||($=o[this.getScriptPartFromCode(j)]),$||($=o[this.formatLanguageCode(j)]),$||($=o[this.getLanguagePartFromCode(j)]),$||($=o.default),$||[]}toResolveHierarchy(o,j){const $=this.getFallbackCodes(j||this.options.fallbackLng||[],o),_e=[],et=tt=>{tt&&(this.isSupportedCode(tt)?_e.push(tt):this.logger.warn(`rejecting language code not found in supportedLngs: ${tt}`))};return typeof o=="string"&&(o.indexOf("-")>-1||o.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&et(this.formatLanguageCode(o)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&et(this.getScriptPartFromCode(o)),this.options.load!=="currentOnly"&&et(this.getLanguagePartFromCode(o))):typeof o=="string"&&et(this.formatLanguageCode(o)),$.forEach(tt=>{_e.indexOf(tt)<0&&et(this.formatLanguageCode(tt))}),_e}}let sets=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],_rulesPluralsTypes={1:function(i){return+(i>1)},2:function(i){return+(i!=1)},3:function(i){return 0},4:function(i){return i%10==1&&i%100!=11?0:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?1:2},5:function(i){return i==0?0:i==1?1:i==2?2:i%100>=3&&i%100<=10?3:i%100>=11?4:5},6:function(i){return i==1?0:i>=2&&i<=4?1:2},7:function(i){return i==1?0:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?1:2},8:function(i){return i==1?0:i==2?1:i!=8&&i!=11?2:3},9:function(i){return+(i>=2)},10:function(i){return i==1?0:i==2?1:i<7?2:i<11?3:4},11:function(i){return i==1||i==11?0:i==2||i==12?1:i>2&&i<20?2:3},12:function(i){return+(i%10!=1||i%100==11)},13:function(i){return+(i!==0)},14:function(i){return i==1?0:i==2?1:i==3?2:3},15:function(i){return i%10==1&&i%100!=11?0:i%10>=2&&(i%100<10||i%100>=20)?1:2},16:function(i){return i%10==1&&i%100!=11?0:i!==0?1:2},17:function(i){return i==1||i%10==1&&i%100!=11?0:1},18:function(i){return i==0?0:i==1?1:2},19:function(i){return i==1?0:i==0||i%100>1&&i%100<11?1:i%100>10&&i%100<20?2:3},20:function(i){return i==1?0:i==0||i%100>0&&i%100<20?1:2},21:function(i){return i%100==1?1:i%100==2?2:i%100==3||i%100==4?3:0},22:function(i){return i==1?0:i==2?1:(i<0||i>10)&&i%10==0?2:3}};const nonIntlVersions=["v1","v2","v3"],intlVersions=["v4"],suffixesOrder={zero:0,one:1,two:2,few:3,many:4,other:5};function createRules(){const i={};return sets.forEach(o=>{o.lngs.forEach(j=>{i[j]={numbers:o.nr,plurals:_rulesPluralsTypes[o.fc]}})}),i}class PluralResolver{constructor(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=o,this.options=j,this.logger=baseLogger.create("pluralResolver"),(!this.options.compatibilityJSON||intlVersions.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=createRules()}addRule(o,j){this.rules[o]=j}getRule(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(getCleanedCode(o),{type:j.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[o]||this.rules[this.languageUtils.getLanguagePartFromCode(o)]}needsPlural(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const $=this.getRule(o,j);return this.shouldUseIntlApi()?$&&$.resolvedOptions().pluralCategories.length>1:$&&$.numbers.length>1}getPluralFormsOfKey(o,j){let $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(o,$).map(_e=>`${j}${_e}`)}getSuffixes(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const $=this.getRule(o,j);return $?this.shouldUseIntlApi()?$.resolvedOptions().pluralCategories.sort((_e,et)=>suffixesOrder[_e]-suffixesOrder[et]).map(_e=>`${this.options.prepend}${j.ordinal?`ordinal${this.options.prepend}`:""}${_e}`):$.numbers.map(_e=>this.getSuffix(o,_e,j)):[]}getSuffix(o,j){let $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const _e=this.getRule(o,$);return _e?this.shouldUseIntlApi()?`${this.options.prepend}${$.ordinal?`ordinal${this.options.prepend}`:""}${_e.select(j)}`:this.getSuffixRetroCompatible(_e,j):(this.logger.warn(`no plural rule found for: ${o}`),"")}getSuffixRetroCompatible(o,j){const $=o.noAbs?o.plurals(j):o.plurals(Math.abs(j));let _e=o.numbers[$];this.options.simplifyPluralSuffix&&o.numbers.length===2&&o.numbers[0]===1&&(_e===2?_e="plural":_e===1&&(_e=""));const et=()=>this.options.prepend&&_e.toString()?this.options.prepend+_e.toString():_e.toString();return this.options.compatibilityJSON==="v1"?_e===1?"":typeof _e=="number"?`_plural_${_e.toString()}`:et():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&o.numbers.length===2&&o.numbers[0]===1?et():this.options.prepend&&$.toString()?this.options.prepend+$.toString():$.toString()}shouldUseIntlApi(){return!nonIntlVersions.includes(this.options.compatibilityJSON)}}function deepFindWithDefaults(i,o,j){let $=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",_e=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,et=getPathWithDefaults(i,o,j);return!et&&_e&&typeof j=="string"&&(et=deepFind(i,j,$),et===void 0&&(et=deepFind(o,j,$))),et}class Interpolator{constructor(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=baseLogger.create("interpolator"),this.options=o,this.format=o.interpolation&&o.interpolation.format||(j=>j),this.init(o)}init(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};o.interpolation||(o.interpolation={escapeValue:!0});const j=o.interpolation;this.escape=j.escape!==void 0?j.escape:escape,this.escapeValue=j.escapeValue!==void 0?j.escapeValue:!0,this.useRawValueToEscape=j.useRawValueToEscape!==void 0?j.useRawValueToEscape:!1,this.prefix=j.prefix?regexEscape(j.prefix):j.prefixEscaped||"{{",this.suffix=j.suffix?regexEscape(j.suffix):j.suffixEscaped||"}}",this.formatSeparator=j.formatSeparator?j.formatSeparator:j.formatSeparator||",",this.unescapePrefix=j.unescapeSuffix?"":j.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":j.unescapeSuffix||"",this.nestingPrefix=j.nestingPrefix?regexEscape(j.nestingPrefix):j.nestingPrefixEscaped||regexEscape("$t("),this.nestingSuffix=j.nestingSuffix?regexEscape(j.nestingSuffix):j.nestingSuffixEscaped||regexEscape(")"),this.nestingOptionsSeparator=j.nestingOptionsSeparator?j.nestingOptionsSeparator:j.nestingOptionsSeparator||",",this.maxReplaces=j.maxReplaces?j.maxReplaces:1e3,this.alwaysFormat=j.alwaysFormat!==void 0?j.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const o=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(o,"g");const j=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(j,"g");const $=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp($,"g")}interpolate(o,j,$,_e){let et,tt,nt;const rt=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function it(ht){return ht.replace(/\$/g,"$$$$")}const at=ht=>{if(ht.indexOf(this.formatSeparator)<0){const ut=deepFindWithDefaults(j,rt,ht,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(ut,void 0,$,{..._e,...j,interpolationkey:ht}):ut}const dt=ht.split(this.formatSeparator),yt=dt.shift().trim(),ot=dt.join(this.formatSeparator).trim();return this.format(deepFindWithDefaults(j,rt,yt,this.options.keySeparator,this.options.ignoreJSONStructure),ot,$,{..._e,...j,interpolationkey:yt})};this.resetRegExp();const ct=_e&&_e.missingInterpolationHandler||this.options.missingInterpolationHandler,st=_e&&_e.interpolation&&_e.interpolation.skipOnVariables!==void 0?_e.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:ht=>it(ht)},{regex:this.regexp,safeValue:ht=>this.escapeValue?it(this.escape(ht)):it(ht)}].forEach(ht=>{for(nt=0;et=ht.regex.exec(o);){const dt=et[1].trim();if(tt=at(dt),tt===void 0)if(typeof ct=="function"){const ot=ct(o,et,_e);tt=typeof ot=="string"?ot:""}else if(_e&&Object.prototype.hasOwnProperty.call(_e,dt))tt="";else if(st){tt=et[0];continue}else this.logger.warn(`missed to pass in variable ${dt} for interpolating ${o}`),tt="";else typeof tt!="string"&&!this.useRawValueToEscape&&(tt=makeString(tt));const yt=ht.safeValue(tt);if(o=o.replace(et[0],yt),st?(ht.regex.lastIndex+=tt.length,ht.regex.lastIndex-=et[0].length):ht.regex.lastIndex=0,nt++,nt>=this.maxReplaces)break}}),o}nest(o,j){let $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},_e,et,tt;function nt(rt,it){const at=this.nestingOptionsSeparator;if(rt.indexOf(at)<0)return rt;const ct=rt.split(new RegExp(`${at}[ ]*{`));let st=`{${ct[1]}`;rt=ct[0],st=this.interpolate(st,tt);const pt=st.match(/'/g),ht=st.match(/"/g);(pt&&pt.length%2===0&&!ht||ht.length%2!==0)&&(st=st.replace(/'/g,'"'));try{tt=JSON.parse(st),it&&(tt={...it,...tt})}catch(dt){return this.logger.warn(`failed parsing options string in nesting for key ${rt}`,dt),`${rt}${at}${st}`}return delete tt.defaultValue,rt}for(;_e=this.nestingRegexp.exec(o);){let rt=[];tt={...$},tt=tt.replace&&typeof tt.replace!="string"?tt.replace:tt,tt.applyPostProcessor=!1,delete tt.defaultValue;let it=!1;if(_e[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(_e[1])){const at=_e[1].split(this.formatSeparator).map(ct=>ct.trim());_e[1]=at.shift(),rt=at,it=!0}if(et=j(nt.call(this,_e[1].trim(),tt),tt),et&&_e[0]===o&&typeof et!="string")return et;typeof et!="string"&&(et=makeString(et)),et||(this.logger.warn(`missed to resolve ${_e[1]} for nesting ${o}`),et=""),it&&(et=rt.reduce((at,ct)=>this.format(at,ct,$.lng,{...$,interpolationkey:_e[1].trim()}),et.trim())),o=o.replace(_e[0],et),this.regexp.lastIndex=0}return o}}function parseFormatStr(i){let o=i.toLowerCase().trim();const j={};if(i.indexOf("(")>-1){const $=i.split("(");o=$[0].toLowerCase().trim();const _e=$[1].substring(0,$[1].length-1);o==="currency"&&_e.indexOf(":")<0?j.currency||(j.currency=_e.trim()):o==="relativetime"&&_e.indexOf(":")<0?j.range||(j.range=_e.trim()):_e.split(";").forEach(tt=>{if(!tt)return;const[nt,...rt]=tt.split(":"),it=rt.join(":").trim().replace(/^'+|'+$/g,"");j[nt.trim()]||(j[nt.trim()]=it),it==="false"&&(j[nt.trim()]=!1),it==="true"&&(j[nt.trim()]=!0),isNaN(it)||(j[nt.trim()]=parseInt(it,10))})}return{formatName:o,formatOptions:j}}function createCachedFormatter(i){const o={};return function($,_e,et){const tt=_e+JSON.stringify(et);let nt=o[tt];return nt||(nt=i(getCleanedCode(_e),et),o[tt]=nt),nt($)}}class Formatter{constructor(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=baseLogger.create("formatter"),this.options=o,this.formats={number:createCachedFormatter((j,$)=>{const _e=new Intl.NumberFormat(j,{...$});return et=>_e.format(et)}),currency:createCachedFormatter((j,$)=>{const _e=new Intl.NumberFormat(j,{...$,style:"currency"});return et=>_e.format(et)}),datetime:createCachedFormatter((j,$)=>{const _e=new Intl.DateTimeFormat(j,{...$});return et=>_e.format(et)}),relativetime:createCachedFormatter((j,$)=>{const _e=new Intl.RelativeTimeFormat(j,{...$});return et=>_e.format(et,$.range||"day")}),list:createCachedFormatter((j,$)=>{const _e=new Intl.ListFormat(j,{...$});return et=>_e.format(et)})},this.init(o)}init(o){const $=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=$.formatSeparator?$.formatSeparator:$.formatSeparator||","}add(o,j){this.formats[o.toLowerCase().trim()]=j}addCached(o,j){this.formats[o.toLowerCase().trim()]=createCachedFormatter(j)}format(o,j,$){let _e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return j.split(this.formatSeparator).reduce((nt,rt)=>{const{formatName:it,formatOptions:at}=parseFormatStr(rt);if(this.formats[it]){let ct=nt;try{const st=_e&&_e.formatParams&&_e.formatParams[_e.interpolationkey]||{},pt=st.locale||st.lng||_e.locale||_e.lng||$;ct=this.formats[it](nt,pt,{...at,..._e,...st})}catch(st){this.logger.warn(st)}return ct}else this.logger.warn(`there was no format function for ${it}`);return nt},o)}}function removePending(i,o){i.pending[o]!==void 0&&(delete i.pending[o],i.pendingCount--)}class Connector extends EventEmitter{constructor(o,j,$){let _e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=o,this.store=j,this.services=$,this.languageUtils=$.languageUtils,this.options=_e,this.logger=baseLogger.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=_e.maxParallelReads||10,this.readingCalls=0,this.maxRetries=_e.maxRetries>=0?_e.maxRetries:5,this.retryTimeout=_e.retryTimeout>=1?_e.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init($,_e.backend,_e)}queueLoad(o,j,$,_e){const et={},tt={},nt={},rt={};return o.forEach(it=>{let at=!0;j.forEach(ct=>{const st=`${it}|${ct}`;!$.reload&&this.store.hasResourceBundle(it,ct)?this.state[st]=2:this.state[st]<0||(this.state[st]===1?tt[st]===void 0&&(tt[st]=!0):(this.state[st]=1,at=!1,tt[st]===void 0&&(tt[st]=!0),et[st]===void 0&&(et[st]=!0),rt[ct]===void 0&&(rt[ct]=!0)))}),at||(nt[it]=!0)}),(Object.keys(et).length||Object.keys(tt).length)&&this.queue.push({pending:tt,pendingCount:Object.keys(tt).length,loaded:{},errors:[],callback:_e}),{toLoad:Object.keys(et),pending:Object.keys(tt),toLoadLanguages:Object.keys(nt),toLoadNamespaces:Object.keys(rt)}}loaded(o,j,$){const _e=o.split("|"),et=_e[0],tt=_e[1];j&&this.emit("failedLoading",et,tt,j),$&&this.store.addResourceBundle(et,tt,$),this.state[o]=j?-1:2;const nt={};this.queue.forEach(rt=>{pushPath(rt.loaded,[et],tt),removePending(rt,o),j&&rt.errors.push(j),rt.pendingCount===0&&!rt.done&&(Object.keys(rt.loaded).forEach(it=>{nt[it]||(nt[it]={});const at=rt.loaded[it];at.length&&at.forEach(ct=>{nt[it][ct]===void 0&&(nt[it][ct]=!0)})}),rt.done=!0,rt.errors.length?rt.callback(rt.errors):rt.callback())}),this.emit("loaded",nt),this.queue=this.queue.filter(rt=>!rt.done)}read(o,j,$){let _e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,et=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,tt=arguments.length>5?arguments[5]:void 0;if(!o.length)return tt(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:o,ns:j,fcName:$,tried:_e,wait:et,callback:tt});return}this.readingCalls++;const nt=(it,at)=>{if(this.readingCalls--,this.waitingReads.length>0){const ct=this.waitingReads.shift();this.read(ct.lng,ct.ns,ct.fcName,ct.tried,ct.wait,ct.callback)}if(it&&at&&_e{this.read.call(this,o,j,$,_e+1,et*2,tt)},et);return}tt(it,at)},rt=this.backend[$].bind(this.backend);if(rt.length===2){try{const it=rt(o,j);it&&typeof it.then=="function"?it.then(at=>nt(null,at)).catch(nt):nt(null,it)}catch(it){nt(it)}return}return rt(o,j,nt)}prepareLoading(o,j){let $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},_e=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),_e&&_e();typeof o=="string"&&(o=this.languageUtils.toResolveHierarchy(o)),typeof j=="string"&&(j=[j]);const et=this.queueLoad(o,j,$,_e);if(!et.toLoad.length)return et.pending.length||_e(),null;et.toLoad.forEach(tt=>{this.loadOne(tt)})}load(o,j,$){this.prepareLoading(o,j,{},$)}reload(o,j,$){this.prepareLoading(o,j,{reload:!0},$)}loadOne(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const $=o.split("|"),_e=$[0],et=$[1];this.read(_e,et,"read",void 0,void 0,(tt,nt)=>{tt&&this.logger.warn(`${j}loading namespace ${et} for language ${_e} failed`,tt),!tt&&nt&&this.logger.log(`${j}loaded namespace ${et} for language ${_e}`,nt),this.loaded(o,tt,nt)})}saveMissing(o,j,$,_e,et){let tt=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},nt=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(j)){this.logger.warn(`did not save key "${$}" as the namespace "${j}" 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!!!");return}if(!($==null||$==="")){if(this.backend&&this.backend.create){const rt={...tt,isUpdate:et},it=this.backend.create.bind(this.backend);if(it.length<6)try{let at;it.length===5?at=it(o,j,$,_e,rt):at=it(o,j,$,_e),at&&typeof at.then=="function"?at.then(ct=>nt(null,ct)).catch(nt):nt(null,at)}catch(at){nt(at)}else it(o,j,$,_e,nt,rt)}!o||!o[0]||this.store.addResource(o[0],j,$,_e)}}}function get(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(o){let j={};if(typeof o[1]=="object"&&(j=o[1]),typeof o[1]=="string"&&(j.defaultValue=o[1]),typeof o[2]=="string"&&(j.tDescription=o[2]),typeof o[2]=="object"||typeof o[3]=="object"){const $=o[3]||o[2];Object.keys($).forEach(_e=>{j[_e]=$[_e]})}return j},interpolation:{escapeValue:!0,format:i=>i,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function transformOptions(i){return typeof i.ns=="string"&&(i.ns=[i.ns]),typeof i.fallbackLng=="string"&&(i.fallbackLng=[i.fallbackLng]),typeof i.fallbackNS=="string"&&(i.fallbackNS=[i.fallbackNS]),i.supportedLngs&&i.supportedLngs.indexOf("cimode")<0&&(i.supportedLngs=i.supportedLngs.concat(["cimode"])),i}function noop(){}function bindMemberFunctions(i){Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(j=>{typeof i[j]=="function"&&(i[j]=i[j].bind(i))})}class I18n extends EventEmitter{constructor(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},j=arguments.length>1?arguments[1]:void 0;if(super(),this.options=transformOptions(o),this.services={},this.logger=baseLogger,this.modules={external:[]},bindMemberFunctions(this),j&&!this.isInitialized&&!o.isClone){if(!this.options.initImmediate)return this.init(o,j),this;setTimeout(()=>{this.init(o,j)},0)}}init(){var o=this;let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},$=arguments.length>1?arguments[1]:void 0;typeof j=="function"&&($=j,j={}),!j.defaultNS&&j.defaultNS!==!1&&j.ns&&(typeof j.ns=="string"?j.defaultNS=j.ns:j.ns.indexOf("translation")<0&&(j.defaultNS=j.ns[0]));const _e=get();this.options={..._e,...this.options,...transformOptions(j)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={..._e.interpolation,...this.options.interpolation}),j.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=j.keySeparator),j.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=j.nsSeparator);function et(at){return at?typeof at=="function"?new at:at:null}if(!this.options.isClone){this.modules.logger?baseLogger.init(et(this.modules.logger),this.options):baseLogger.init(null,this.options);let at;this.modules.formatter?at=this.modules.formatter:typeof Intl<"u"&&(at=Formatter);const ct=new LanguageUtil(this.options);this.store=new ResourceStore(this.options.resources,this.options);const st=this.services;st.logger=baseLogger,st.resourceStore=this.store,st.languageUtils=ct,st.pluralResolver=new PluralResolver(ct,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),at&&(!this.options.interpolation.format||this.options.interpolation.format===_e.interpolation.format)&&(st.formatter=et(at),st.formatter.init(st,this.options),this.options.interpolation.format=st.formatter.format.bind(st.formatter)),st.interpolator=new Interpolator(this.options),st.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},st.backendConnector=new Connector(et(this.modules.backend),st.resourceStore,st,this.options),st.backendConnector.on("*",function(pt){for(var ht=arguments.length,dt=new Array(ht>1?ht-1:0),yt=1;yt1?ht-1:0),yt=1;yt{pt.init&&pt.init(this)})}if(this.format=this.options.interpolation.format,$||($=noop),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const at=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);at.length>0&&at[0]!=="dev"&&(this.options.lng=at[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(at=>{this[at]=function(){return o.store[at](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(at=>{this[at]=function(){return o.store[at](...arguments),o}});const rt=defer(),it=()=>{const at=(ct,st)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),rt.resolve(st),$(ct,st)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return at(null,this.t.bind(this));this.changeLanguage(this.options.lng,at)};return this.options.resources||!this.options.initImmediate?it():setTimeout(it,0),rt}loadResources(o){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:noop;const _e=typeof o=="string"?o:this.language;if(typeof o=="function"&&($=o),!this.options.resources||this.options.partialBundledLanguages){if(_e&&_e.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return $();const et=[],tt=nt=>{if(!nt||nt==="cimode")return;this.services.languageUtils.toResolveHierarchy(nt).forEach(it=>{it!=="cimode"&&et.indexOf(it)<0&&et.push(it)})};_e?tt(_e):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(rt=>tt(rt)),this.options.preload&&this.options.preload.forEach(nt=>tt(nt)),this.services.backendConnector.load(et,this.options.ns,nt=>{!nt&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),$(nt)})}else $(null)}reloadResources(o,j,$){const _e=defer();return o||(o=this.languages),j||(j=this.options.ns),$||($=noop),this.services.backendConnector.reload(o,j,et=>{_e.resolve(),$(et)}),_e}use(o){if(!o)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!o.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return o.type==="backend"&&(this.modules.backend=o),(o.type==="logger"||o.log&&o.warn&&o.error)&&(this.modules.logger=o),o.type==="languageDetector"&&(this.modules.languageDetector=o),o.type==="i18nFormat"&&(this.modules.i18nFormat=o),o.type==="postProcessor"&&postProcessor.addPostProcessor(o),o.type==="formatter"&&(this.modules.formatter=o),o.type==="3rdParty"&&this.modules.external.push(o),this}setResolvedLanguage(o){if(!(!o||!this.languages)&&!(["cimode","dev"].indexOf(o)>-1))for(let j=0;j-1)&&this.store.hasLanguageSomeTranslations($)){this.resolvedLanguage=$;break}}}changeLanguage(o,j){var $=this;this.isLanguageChangingTo=o;const _e=defer();this.emit("languageChanging",o);const et=rt=>{this.language=rt,this.languages=this.services.languageUtils.toResolveHierarchy(rt),this.resolvedLanguage=void 0,this.setResolvedLanguage(rt)},tt=(rt,it)=>{it?(et(it),this.translator.changeLanguage(it),this.isLanguageChangingTo=void 0,this.emit("languageChanged",it),this.logger.log("languageChanged",it)):this.isLanguageChangingTo=void 0,_e.resolve(function(){return $.t(...arguments)}),j&&j(rt,function(){return $.t(...arguments)})},nt=rt=>{!o&&!rt&&this.services.languageDetector&&(rt=[]);const it=typeof rt=="string"?rt:this.services.languageUtils.getBestMatchFromCodes(rt);it&&(this.language||et(it),this.translator.language||this.translator.changeLanguage(it),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(it)),this.loadResources(it,at=>{tt(at,it)})};return!o&&this.services.languageDetector&&!this.services.languageDetector.async?nt(this.services.languageDetector.detect()):!o&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(nt):this.services.languageDetector.detect(nt):nt(o),_e}getFixedT(o,j,$){var _e=this;const et=function(tt,nt){let rt;if(typeof nt!="object"){for(var it=arguments.length,at=new Array(it>2?it-2:0),ct=2;ct`${rt.keyPrefix}${st}${ht}`):pt=rt.keyPrefix?`${rt.keyPrefix}${st}${tt}`:tt,_e.t(pt,rt)};return typeof o=="string"?et.lng=o:et.lngs=o,et.ns=j,et.keyPrefix=$,et}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(o){this.options.defaultNS=o}hasLoadedNamespace(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const $=j.lng||this.resolvedLanguage||this.languages[0],_e=this.options?this.options.fallbackLng:!1,et=this.languages[this.languages.length-1];if($.toLowerCase()==="cimode")return!0;const tt=(nt,rt)=>{const it=this.services.backendConnector.state[`${nt}|${rt}`];return it===-1||it===2};if(j.precheck){const nt=j.precheck(this,tt);if(nt!==void 0)return nt}return!!(this.hasResourceBundle($,o)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||tt($,o)&&(!_e||tt(et,o)))}loadNamespaces(o,j){const $=defer();return this.options.ns?(typeof o=="string"&&(o=[o]),o.forEach(_e=>{this.options.ns.indexOf(_e)<0&&this.options.ns.push(_e)}),this.loadResources(_e=>{$.resolve(),j&&j(_e)}),$):(j&&j(),Promise.resolve())}loadLanguages(o,j){const $=defer();typeof o=="string"&&(o=[o]);const _e=this.options.preload||[],et=o.filter(tt=>_e.indexOf(tt)<0);return et.length?(this.options.preload=_e.concat(et),this.loadResources(tt=>{$.resolve(),j&&j(tt)}),$):(j&&j(),Promise.resolve())}dir(o){if(o||(o=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!o)return"rtl";const j=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],$=this.services&&this.services.languageUtils||new LanguageUtil(get());return j.indexOf($.getLanguagePartFromCode(o))>-1||o.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},j=arguments.length>1?arguments[1]:void 0;return new I18n(o,j)}cloneInstance(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:noop;const $=o.forkResourceStore;$&&delete o.forkResourceStore;const _e={...this.options,...o,isClone:!0},et=new I18n(_e);return(o.debug!==void 0||o.prefix!==void 0)&&(et.logger=et.logger.clone(o)),["store","services","language"].forEach(nt=>{et[nt]=this[nt]}),et.services={...this.services},et.services.utils={hasLoadedNamespace:et.hasLoadedNamespace.bind(et)},$&&(et.store=new ResourceStore(this.store.data,_e),et.services.resourceStore=et.store),et.translator=new Translator(et.services,_e),et.translator.on("*",function(nt){for(var rt=arguments.length,it=new Array(rt>1?rt-1:0),at=1;at()=>{if(i.isInitialized)o();else{const j=()=>{setTimeout(()=>{i.off("initialized",j)},0),o()};i.on("initialized",j)}};function loadNamespaces(i,o,j){i.loadNamespaces(o,loadedClb(i,j))}function loadLanguages(i,o,j,$){typeof j=="string"&&(j=[j]),j.forEach(_e=>{i.options.ns.indexOf(_e)<0&&i.options.ns.push(_e)}),i.loadLanguages(o,loadedClb(i,$))}function oldI18nextHasLoadedNamespace(i,o){let j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const $=o.languages[0],_e=o.options?o.options.fallbackLng:!1,et=o.languages[o.languages.length-1];if($.toLowerCase()==="cimode")return!0;const tt=(nt,rt)=>{const it=o.services.backendConnector.state[`${nt}|${rt}`];return it===-1||it===2};return j.bindI18n&&j.bindI18n.indexOf("languageChanging")>-1&&o.services.backendConnector.backend&&o.isLanguageChangingTo&&!tt(o.isLanguageChangingTo,i)?!1:!!(o.hasResourceBundle($,i)||!o.services.backendConnector.backend||o.options.resources&&!o.options.partialBundledLanguages||tt($,i)&&(!_e||tt(et,i)))}function hasLoadedNamespace(i,o){let j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!o.languages||!o.languages.length?(warnOnce("i18n.languages were undefined or empty",o.languages),!0):o.options.ignoreJSONStructure!==void 0?o.hasLoadedNamespace(i,{lng:j.lng,precheck:(_e,et)=>{if(j.bindI18n&&j.bindI18n.indexOf("languageChanging")>-1&&_e.services.backendConnector.backend&&_e.isLanguageChangingTo&&!et(_e.isLanguageChangingTo,i))return!1}}):oldI18nextHasLoadedNamespace(i,o,j)}const matchHtmlEntity=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,htmlEntities={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},unescapeHtmlEntity=i=>htmlEntities[i],unescape=i=>i.replace(matchHtmlEntity,unescapeHtmlEntity);let defaultOptions={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape};function setDefaults(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};defaultOptions={...defaultOptions,...i}}function getDefaults(){return defaultOptions}let i18nInstance;function setI18n(i){i18nInstance=i}function getI18n(){return i18nInstance}const initReactI18next={type:"3rdParty",init(i){setDefaults(i.options.react),setI18n(i)}},I18nContext=reactExports.createContext();class ReportNamespaces{constructor(){this.usedNamespaces={}}addUsedNamespaces(o){o.forEach(j=>{this.usedNamespaces[j]||(this.usedNamespaces[j]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const usePrevious=(i,o)=>{const j=reactExports.useRef();return reactExports.useEffect(()=>{j.current=o?j.current:i},[i,o]),j.current};function useTranslation(i){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:j}=o,{i18n:$,defaultNS:_e}=reactExports.useContext(I18nContext)||{},et=j||$||getI18n();if(et&&!et.reportNamespaces&&(et.reportNamespaces=new ReportNamespaces),!et){warnOnce("You will need to pass in an i18next instance by using initReactI18next");const lt=(gt,kt)=>typeof kt=="string"?kt:kt&&typeof kt=="object"&&typeof kt.defaultValue=="string"?kt.defaultValue:Array.isArray(gt)?gt[gt.length-1]:gt,ft=[lt,{},!1];return ft.t=lt,ft.i18n={},ft.ready=!1,ft}et.options.react&&et.options.react.wait!==void 0&&warnOnce("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const tt={...getDefaults(),...et.options.react,...o},{useSuspense:nt,keyPrefix:rt}=tt;let it=i||_e||et.options&&et.options.defaultNS;it=typeof it=="string"?[it]:it||["translation"],et.reportNamespaces.addUsedNamespaces&&et.reportNamespaces.addUsedNamespaces(it);const at=(et.isInitialized||et.initializedStoreOnce)&&it.every(lt=>hasLoadedNamespace(lt,et,tt));function ct(){return et.getFixedT(o.lng||null,tt.nsMode==="fallback"?it:it[0],rt)}const[st,pt]=reactExports.useState(ct);let ht=it.join();o.lng&&(ht=`${o.lng}${ht}`);const dt=usePrevious(ht),yt=reactExports.useRef(!0);reactExports.useEffect(()=>{const{bindI18n:lt,bindI18nStore:ft}=tt;yt.current=!0,!at&&!nt&&(o.lng?loadLanguages(et,o.lng,it,()=>{yt.current&&pt(ct)}):loadNamespaces(et,it,()=>{yt.current&&pt(ct)})),at&&dt&&dt!==ht&&yt.current&&pt(ct);function gt(){yt.current&&pt(ct)}return lt&&et&&et.on(lt,gt),ft&&et&&et.store.on(ft,gt),()=>{yt.current=!1,lt&&et&<.split(" ").forEach(kt=>et.off(kt,gt)),ft&&et&&ft.split(" ").forEach(kt=>et.store.off(kt,gt))}},[et,ht]);const ot=reactExports.useRef(!0);reactExports.useEffect(()=>{yt.current&&!ot.current&&pt(ct),ot.current=!1},[et,rt]);const ut=[st,et,at];if(ut.t=st,ut.i18n=et,ut.ready=at,at||!at&&!nt)return ut;throw new Promise(lt=>{o.lng?loadLanguages(et,o.lng,it,()=>lt()):loadNamespaces(et,it,()=>lt())})}const demoMode$2="Demo mode",bot$2="bot",cancel$2="Cancel",back$2="Back",close$2="Close",addMore$2="Add more",addEveryone$2="Add everyone",next$2="Next",apply$3="Apply",save$2="Save",addComment$2="Add comment",yourComment$2="Your comment...",message$2="Message",addUsers$2="Add users",matchUsers$2="Match names",willBeSaved$2="I'll remember the names later",paid$2="paid",owes$2="owes",select$2="please select...",author$2="author",added$2="added",addUser$2="Add user",pleaseMatchUsers$2="Match users",pleaseAddUsers$2="Add users",selectWhoIs$2="Select who is",selectUser$2="Select user",checkout$2="Checkout",selectCurrency$2="Select currency",lack$2="Lack",allRight$2="All right",overdo$2="Overdo",unbalanced$2="The sum above is not equal to the sum below. So I can't record the transaction.",paidSum$2="Paid",oweSum$2="owe",whoPaid$2="Who paid",forWhom$2="For whoom",selectAll$2="Select all",unselectAll$2="Unselect all",splitEqually$2="Split equally",noShares$2="Nobody here",checkAmounts$2="Check amounts",groupBalances$1="Group balances",settleUpBy$1="Settle up by",detailedSummary$1="Detailed summary",summaryBy$1="Summary by",settleUp$1="Settle up",settleUpSaved$1="Transaction successfully saved!",allSettledUp$1="You are all settled up in this group",convertAllTo$2="Convert all to",featureSoon$2="This feature will be available soon",okay$2="Okay",translationEn={demoMode:demoMode$2,bot:bot$2,cancel:cancel$2,back:back$2,close:close$2,delete:"Delete",addMore:addMore$2,addEveryone:addEveryone$2,next:next$2,apply:apply$3,save:save$2,addComment:addComment$2,yourComment:yourComment$2,message:message$2,addUsers:addUsers$2,matchUsers:matchUsers$2,willBeSaved:willBeSaved$2,paid:paid$2,owes:owes$2,select:select$2,author:author$2,added:added$2,addUser:addUser$2,pleaseMatchUsers:pleaseMatchUsers$2,pleaseAddUsers:pleaseAddUsers$2,selectWhoIs:selectWhoIs$2,selectUser:selectUser$2,checkout:checkout$2,selectCurrency:selectCurrency$2,lack:lack$2,allRight:allRight$2,overdo:overdo$2,unbalanced:unbalanced$2,paidSum:paidSum$2,oweSum:oweSum$2,whoPaid:whoPaid$2,forWhom:forWhom$2,selectAll:selectAll$2,unselectAll:unselectAll$2,splitEqually:splitEqually$2,noShares:noShares$2,checkAmounts:checkAmounts$2,groupBalances:groupBalances$1,settleUpBy:settleUpBy$1,detailedSummary:detailedSummary$1,summaryBy:summaryBy$1,settleUp:settleUp$1,settleUpSaved:settleUpSaved$1,allSettledUp:allSettledUp$1,convertAllTo:convertAllTo$2,featureSoon:featureSoon$2,okay:okay$2},demoMode$1="Демо-режим",bot$1="бот",cancel$1="Отмена",back$1="Назад",close$1="Закрыть",addMore$1="Добавить ещё",addEveryone$1="Добавить всех",next$1="Далее",apply$2="Применить",save$1="Сохранить",addComment$1="Добавьте комментарий",yourComment$1="Ваш комментарий...",message$1="Сообщение",addUsers$1="Добавьте людей",matchUsers$1="Соотнесите людей",willBeSaved$1="Со временем я запомню соотношения",paid$1="заплатил",owes$1="должен",select$1="выберите...",author$1="автор",added$1="доп.",addUser$1="Добавить человека",pleaseMatchUsers$1="Выберите людей",pleaseAddUsers$1="Добавьте людей",selectWhoIs$1="Выберите, кто",selectUser$1="Выберите",checkout$1="Проверить траты",selectCurrency$1="Выберите валюту",lack$1="Не хватает",allRight$1="Всё верно",overdo$1="Перебор",unbalanced$1="Cумма сверху не равна сумме снизу. Поэтому я не могу записать трату.",paidSum$1="Заплатили",oweSum$1="должны",whoPaid$1="Кто платил",forWhom$1="За кого платили",selectAll$1="Выбрать всех",unselectAll$1="Очистить выбор",splitEqually$1="Разделить поровну",noShares$1="Пусто",checkAmounts$1="Проверьте траты",groupBalances="Баланс группы",settleUpBy="Рассчитаться по",detailedSummary="Детализация",summaryBy="Итог по",settleUp="Рассчитаться",settleUpSaved="Транзакция успешно сохранена!",allSettledUp="Все рассчитались в этой группе",convertAllTo$1="Перевести всё в",featureSoon$1="Эта функция скоро станет доступна",okay$1="Хорошо",translationRu={demoMode:demoMode$1,bot:bot$1,cancel:cancel$1,back:back$1,close:close$1,delete:"Удалить",addMore:addMore$1,addEveryone:addEveryone$1,next:next$1,apply:apply$2,save:save$1,addComment:addComment$1,yourComment:yourComment$1,message:message$1,addUsers:addUsers$1,matchUsers:matchUsers$1,willBeSaved:willBeSaved$1,paid:paid$1,owes:owes$1,select:select$1,author:author$1,added:added$1,addUser:addUser$1,pleaseMatchUsers:pleaseMatchUsers$1,pleaseAddUsers:pleaseAddUsers$1,selectWhoIs:selectWhoIs$1,selectUser:selectUser$1,checkout:checkout$1,selectCurrency:selectCurrency$1,lack:lack$1,allRight:allRight$1,overdo:overdo$1,unbalanced:unbalanced$1,paidSum:paidSum$1,oweSum:oweSum$1,whoPaid:whoPaid$1,forWhom:forWhom$1,selectAll:selectAll$1,unselectAll:unselectAll$1,splitEqually:splitEqually$1,noShares:noShares$1,checkAmounts:checkAmounts$1,groupBalances,settleUpBy,detailedSummary,summaryBy,settleUp,settleUpSaved,allSettledUp,convertAllTo:convertAllTo$1,featureSoon:featureSoon$1,okay:okay$1},demoMode="Демо-режим",bot="бот",cancel="Відміна",back="Назад",close="Закрити",addMore="Додати ще",addEveryone="Додати всіх",next="Далі",apply$1="Застосувати",save="Зберегти",addComment="Додати коментар",yourComment="Ваш коментар...",message="Повідомлення",addUsers="Додайте людей",matchUsers="Співвіднесіть людей",willBeSaved="З часом я запам'ятаю співвідношення",paid="оплатив",owes="повинен",select="оберіть…",author="автор",added="дод.",addUser="Додати людину",pleaseMatchUsers="Виберіть людей",pleaseAddUsers="Додати людей",selectWhoIs="Оберіть хто",selectUser="Оберіть",checkout="Перевірити витрати",selectCurrency="Оберіть валюту",lack="Не вистачає",allRight="Все вірно",overdo="Перебір",unbalanced="Сума зверху не дорівнює сумі знизу. Тому я не можу записати витрати.",paidSum="Оплатили",oweSum="винні",whoPaid="Хто платив",forWhom="За кого платили",selectAll="Вибрати всіх",unselectAll="Очистити вибір",splitEqually="Розділити порівну",noShares="Пусто",checkAmounts="Перевірте витрати",convertAllTo="Перевести всё в",featureSoon="Ця функція незабаром стане доступною",okay="Добре",translationUk={demoMode,bot,cancel,back,close,delete:"Видалити",addMore,addEveryone,next,apply:apply$1,save,addComment,yourComment,message,addUsers,matchUsers,willBeSaved,paid,owes,select,author,added,addUser,pleaseMatchUsers,pleaseAddUsers,selectWhoIs,selectUser,checkout,selectCurrency,lack,allRight,overdo,unbalanced,paidSum,oweSum,whoPaid,forWhom,selectAll,unselectAll,splitEqually,noShares,checkAmounts,convertAllTo,featureSoon,okay};instance.use(initReactI18next).init({lng:"en",fallbackLng:["en","ru","uk"],supportedLngs:["en","ru","uk"],debug:!0,resources:{en:{translation:translationEn},ru:{translation:translationRu},uk:{translation:translationUk}}});const useInit=()=>{const{txId:i,setTxId:o,summaryId:j,setSummaryId:$,chat:_e,transaction:et,setTransaction:tt,isAuthorSharesInited:nt,setIsAuthorSharesInited:rt}=useStore(),it=useLocation(),[at]=M(),{users:ct,getUserById:st,addUsers:pt}=useUsers(),ht=new URLSearchParams(it.search),dt=ht.get("txid"),yt=ht.get("summaryid"),ot=at.start_param;let ut,lt;it.pathname==="/summary"?lt=ot:ut=ot,i===void 0&&o(dt||ut||null),j===void 0&&$(yt||lt||null),reactExports.useEffect(()=>{if(!nt&&at.user&&et&&et.creator_user_id===null&&et.shares.length===0&&ct.length){const ft=at.user.id;console.log("author: 0 shares, userId =",ft,"users",ct.length,ct);const gt=st(ft);console.log("author user =",gt),gt&&(console.log("author: user found"),console.log("setIsAuthorSharesInited",!0),rt(!0),console.log("author: tx...",JSON.stringify(et)),setInterval(()=>{console.log("author interval: addUsers..."),pt([gt],{isAuthor:!0})},1e3),setInterval(()=>{console.log("author interval: upd creator_user_id..."),tt({...et,creator_user_id:ft})},1e4))}},[et,ct,at,nt,rt,st,pt,tt]),reactExports.useEffect(()=>{console.log("author: tx changed",JSON.stringify(et))},[et]),_e!=null&&_e.language_code&&_e.language_code!==instance.language&&instance.languages.includes(_e.language_code)&&instance.changeLanguage(_e.language_code)},mockCurrencies$1=[{_id:"RUB",symbol:"₽",title:"Рубль",in:"В рублях"},{_id:"GEL",symbol:"₾",title:"Лари",in:"В лари"},{_id:"TRY",symbol:"₺",title:"Лира",in:"В лирах"},{_id:"EUR",symbol:"€",title:"Евро",in:"В евро"},{_id:"USD",symbol:"$",title:"Доллар",in:"В долларах"},{_id:"GBP",symbol:"£",title:"Фунт",in:"В фунтах"},{_id:"UAH",symbol:"₴",title:"Гривна",in:"В гривнах"},{_id:"BYN",symbol:"Br",title:"Бел. рубль",in:"В бел. рублях"},{_id:"KZT",symbol:"₸",title:"Тенге",in:"В тенге"},{_id:"CNY",symbol:"¥",title:"Юань",in:"В юанях"},{_id:"JPY",symbol:"¥",title:"Иена",in:"В иенах"},{_id:"CHF",symbol:"₣",title:"Франк",in:"В франках"},{_id:"CAD",symbol:"$",title:"Кан. доллар",in:"В кан. долларах"},{_id:"AUD",symbol:"$",title:"Австр. доллар",in:"В австр. долларах"},{_id:"NZD",symbol:"$",title:"Нов. доллар",in:"В нов. долларах"},{_id:"AZN",symbol:"₼",title:"Азерб. манат",in:"В азерб. манатах"},{_id:"AMD",symbol:"֏",title:"Арм. драм",in:"В арм. драмах"},{_id:"KGS",symbol:"с",title:"Сом",in:"В сомах"},{_id:"RSD",symbol:"дин",title:"Динар",in:"В динарах"},{_id:"BGN",symbol:"лв",title:"Лев",in:"В левах"}],decimals=2,visible_decimals=2,avatar0="/CalcKoala-webapp/assets/avatar-0-6b7a4992.jpg",avatar1="/CalcKoala-webapp/assets/avatar-1-07738e43.jpg",avatar2="/CalcKoala-webapp/assets/avatar-2-e805addc.jpg",avatar3="/CalcKoala-webapp/assets/avatar-3-43e75752.jpg",avatar4="/CalcKoala-webapp/assets/avatar-4-12297858.jpg",transliterate=i=>{const o={Ё:"YO",Й:"I",Ц:"TS",У:"U",К:"K",Е:"E",Н:"N",Г:"G",Ш:"SH",Щ:"SCH",З:"Z",Х:"H",Ъ:"",ё:"yo",й:"i",ц:"ts",у:"u",к:"k",е:"e",н:"n",г:"g",ш:"sh",щ:"sch",з:"z",х:"h",ъ:"",Ф:"F",Ы:"I",В:"V",А:"A",П:"P",Р:"R",О:"O",Л:"L",Д:"D",Ж:"ZH",Э:"E",ф:"f",ы:"i",в:"v",а:"a",п:"p",р:"r",о:"o",л:"l",д:"d",ж:"zh",э:"e",Я:"Ya",Ч:"CH",С:"S",М:"M",И:"I",Т:"T",Ь:"",Б:"B",Ю:"YU",я:"ya",ч:"ch",с:"s",м:"m",и:"i",т:"t",ь:"",б:"b",ю:"yu"};return i.split("").map(j=>o[j]||j).join("")},generateUser=i=>({_id:Math.round(Math.random()*1e10),first_name:i,last_name:i,username:Math.random()>.2?transliterate(i).toLowerCase():void 0,profile_photo:Math.random()<.5?null:`https://i.pravatar.cc/48/${Math.round(Math.random()*1e10)}`,_name:i}),generateName=()=>{const i=instance.language==="ru"?["Александр","Дмитрий","Максим","Сергей","Андрей","Алексей","Артём","Илья","Кирилл","Михаил","Никита","Матвей","Роман","Егор","Арсений","Иван","Денис","Евгений","Тимофей","Владислав","Игорь","Владимир","Павел","Руслан","Марк","Константин","Тимур","Олег","Ярослав","Антон","Николай","Данил","Анастасия","Мария","Анна","Виктория","Екатерина","Наталья","Марина","Полина","София","Дарья","Алиса","Ксения","Александра","Елена"]:["Isabelle","Louis","Tariq","Joyce","Zaid","Mary","Rufus","Ishaq","Lucy","Vinnie","Amelie","Jaydon","Beth","Zackary","Scott","Rhonda","Gilbert","Ayla","Dale","Moshe","Jon","Sylvie","Grover","Neil","Lukas","Amber","Shreya","Evan","Lucinda","Kareem","Reid","Owain","Liberty","Cordelia","Tony","Ophelia","Maeve","Yasir","Gary","Daniella","Keira","Umar","Sally","Oskar","Lucia","Dewi","Bethany","Marco","Amna","Micheal"];return i[Math.floor(Math.random()*i.length)]},generateNames=i=>{const o=[];do{const j=generateName();o.includes(j)||o.push(j)}while(o.length!==i);return o},_names=generateNames(6),_mockUsers=_names.map(i=>generateUser(i)),shares=_mockUsers.slice(0,4).map((i,o)=>({person_id:`Person${o}`,raw_name:i._name||"",normalized_name:i._name||"",related_user_id:Math.random()>.3?i._id:null,is_payer:o==0,amount:parseFloat((Math.round(Math.random()*1e4)/10**decimals).toFixed(decimals)),user_candidates:null}));shares.splice(1,0,{...shares[0],amount:parseFloat((shares[0].amount/3).toFixed(decimals)),is_payer:!1});shares.map(i=>`${i.normalized_name} ${i.is_payer?instance.t("paid"):instance.t("owes")} ${i.amount}`).join(", "),shares.map(i=>`${i.normalized_name} ${i.is_payer?instance.t("paid"):instance.t("owes")} ${i.amount}`).join(", "),mockCurrencies$1[0]._id;mockCurrencies$1[0]._id;const mockSummary={debts:[],url:"https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit",chat_id:0};Math.random()>.25&&_mockUsers.forEach((i,o,j)=>{oАнтон заплатил 4500 рублей за Пашу, Егора, Дашу и Карима в ресторане. Егор оставил 700 рублей чаевыми. Делим счёт поровну.":"Anton paid 45 dollars for Pavel, George, Dasha and Karim in restaurant. George left 10 dollars tips. Split bill equally.",is_confirmed:!1,currency_id:isRus?"RUB":"USD",shares:[{person_id:"Person-1",raw_name:demoUsers[1].first_name,normalized_name:demoUsers[1].first_name,related_user_id:demoUsers[1]._id,is_payer:!0,amount:isRus?4500:45,user_candidates:null},{person_id:"Person-2",raw_name:demoUsers[2].first_name,normalized_name:demoUsers[2].first_name,related_user_id:demoUsers[2]._id,is_payer:!0,amount:isRus?700:10,user_candidates:null},{person_id:"Person-0",raw_name:demoUsers[0].first_name,normalized_name:demoUsers[0].first_name,related_user_id:demoUsers[0]._id,is_payer:!1,amount:isRus?1040:11,user_candidates:null},{person_id:"Person-2",raw_name:demoUsers[2].first_name,normalized_name:demoUsers[2].first_name,related_user_id:demoUsers[2]._id,is_payer:!1,amount:isRus?1040:11,user_candidates:null},{person_id:"Person-3",raw_name:demoUsers[3].first_name,normalized_name:demoUsers[3].first_name,related_user_id:demoUsers[3]._id,is_payer:!1,amount:isRus?1040:11,user_candidates:null},{person_id:"Person-4",raw_name:demoUsers[4].first_name,normalized_name:demoUsers[4].first_name,related_user_id:demoUsers[4]._id,is_payer:!1,amount:isRus?1040:11,user_candidates:null},{person_id:"Person-1",raw_name:demoUsers[1].first_name,normalized_name:demoUsers[1].first_name,related_user_id:demoUsers[1]._id,is_payer:!1,amount:isRus?1040:11,user_candidates:null}]},demoChat={_id:0,name:"demo chat name",summary_id:"demo summary id",default_currency:isRus?"RUB":"USD",status:"administrator",welcome_message_id:-1,menu_message_id:-1,pin_message_id:-1,language_code:tgLanguageCode},mockUsers=demoUsers,mockTransaction=demoTransaction,mockChat=demoChat,apiUrl$1="https://104.248.87.96.sslip.io",staleTime=5*60*1e3,handleJsonResponse=i=>{if(!i.ok)throw new Error(`[${i.status}] ${i.statusText}`);return i.json()},useGetTx=()=>{const[,i]=M(),{setTransaction:o,txId:j}=useStore();return console.log("useGetTx txId",j),useQuery({queryKey:["tx",`tx-${j}`],queryFn:j?()=>fetch(`${apiUrl$1}/transactions/${j}`,{method:"GET",headers:{Authorization:i}}).then(handleJsonResponse):()=>mockTransaction,onSuccess:$=>{console.log("useApi: set tx",$),o($)},staleTime})},useGetUsers=i=>{const[,o]=M(),{setUsers:j}=useStore();return useQuery({queryKey:["users",`chat-${i}`],queryFn:i?()=>fetch(`${apiUrl$1}/chats/${i}/users`,{method:"GET",headers:{Authorization:o}}).then(handleJsonResponse):()=>mockUsers,onSuccess:$=>{console.log("useApi: set users",$),j($)},enabled:i!==void 0,staleTime})},useGetChat=i=>{const[,o]=M(),{setChat:j}=useStore();return useQuery({queryKey:["chat",`chat-${i}`],queryFn:i?()=>fetch(`${apiUrl$1}/chats/${i}`,{method:"GET",headers:{Authorization:o}}).then(handleJsonResponse):()=>mockChat,onSuccess:$=>{console.log("useApi: set chat",$),j($)},enabled:i!==void 0,staleTime})},useGetCurrencies=i=>{const[,o]=M(),{setCurrencies:j}=useStore();return useQuery({queryKey:["currencies"],queryFn:()=>fetch(`${apiUrl$1}/currencies/`,{method:"GET",headers:{Authorization:o}}).then(handleJsonResponse),onSuccess:$=>{console.log("useApi: set currencies",$),j($)},enabled:i!==void 0,staleTime})},usePutTransaction=()=>{const[,i]=M(),{txId:o}=useStore(),j=o?`${apiUrl$1}/transactions/${o}`:"https://jsonplaceholder.typicode.com/posts/1";return $=>fetch(j,{method:"PUT",body:JSON.stringify($),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},usePostTransaction=()=>{const[,i]=M(),{summaryId:o}=useStore(),j=o?`${apiUrl$1}/transactions/`:"https://jsonplaceholder.typicode.com/posts";return $=>fetch(j,{method:"POST",body:JSON.stringify($),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},useGetSummary=()=>{const[,i]=M(),{setSummary:o,summaryId:j}=useStore();return console.log("useGetSummary summaryId",j),useQuery({queryKey:["summary",`summary-${j}`],queryFn:j?()=>fetch(`${apiUrl$1}/summary/${j}`,{method:"GET",headers:{Authorization:i}}).then(handleJsonResponse):()=>mockSummary,onSuccess:$=>{console.log("useGetSummary: setSummary",$),o($)},staleTime})},useSplash=()=>{const{isLoading:i,error:o,data:j}=useGetTx(),{isLoading:$,error:_e,data:et}=useGetSummary(),tt=(j?j.chat_id:void 0)||(et?et.chat_id:void 0),{isLoading:nt,error:rt}=useGetUsers(tt),{isLoading:it,error:at}=useGetChat(tt),{isLoading:ct,error:st}=useGetCurrencies(tt),pt=i||nt||it||ct||$,{currencies:ht,txPatchError:dt}=useStore(),yt=j!=null&&j.currency_id&&ht.length&&!ht.find(ut=>ut._id===j.currency_id)?new Error(`Unknown tx currency ${j.currency_id}`):null;return{isLoading:pt,error:o||rt||at||dt||st||yt||_e}},useTheme=()=>{const[i]=C(),o=()=>{var rt;const et=((rt=window.Telegram)==null?void 0:rt.WebApp.colorScheme)==="dark"||i==="dark"||window.matchMedia("(prefers-color-scheme: dark)").matches,tt=["theme-dark","dark"],nt=["theme-light","light"];return document.body.classList.add(...et?tt:nt),document.body.classList.remove(...et?nt:tt),et},[j,$]=reactExports.useState(o()),_e=()=>{$(o())};return window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",_e),{isDark:j}},useUsers=()=>{const{users:i,transaction:o,setTransaction:j,selectPersonId:$}=useStore(),[_e,,et]=b(),tt=(o==null?void 0:o.shares)||[],nt=tt.map(ot=>ot.related_user_id),rt=i.filter(ot=>!nt.includes(ot._id)),it=[...new Set(tt.filter(ot=>!(ot.related_user_id&&i.find(ut=>ut._id===ot.related_user_id))).map(ot=>ot.person_id))].length,at=it===0,ct=tt.length>1;return{users:i,unrelatedUsers:rt,countUnrelatedPersons:it,isRelationsComplete:at,isRelationsEnough:ct,getUserById:ot=>i.find(ut=>ut._id===ot),selectUser:ot=>()=>{if($!==null){const ut=[...tt],lt=[];for(let ft=0;ft()=>{if($===null){const lt=tt.some(kt=>kt.is_payer),ft=({isPayer:kt})=>xt=>({person_id:ut?"MESSAGE_AUTHOR":`added-person-user-${xt._id}`,raw_name:null,normalized_name:ut?"MESSAGE_AUTHOR":null,is_payer:kt,amount:0,user_candidates:null,related_user_id:xt._id}),gt=[...tt,...lt?[]:[ft({isPayer:!0})(ot[0])],...ot.map(ft({isPayer:!1}))];o&&j({...o,shares:gt})}console.log("addUsers vibro"),et(),_e("light"),history.back()},updUsers:(ot,ut)=>()=>{if(console.log("updUsers",i),ut!==null){const lt=[...tt].filter(kt=>!(kt.is_payer===ut&&kt.related_user_id!==null&&!ot.includes(kt.related_user_id))),ft=ot.filter(kt=>!tt.find(xt=>xt.is_payer===ut&&xt.related_user_id!==null&&kt===xt.related_user_id)),gt=[...lt,...ft.map(kt=>({person_id:`added-person-user-${kt}`,raw_name:null,normalized_name:null,is_payer:ut,amount:0,user_candidates:null,related_user_id:kt}))];o&&j({...o,shares:gt})}console.log("updUsers vibro"),et(),_e("light"),history.back()},deleteUser:ot=>()=>{const ut=[...tt].filter(lt=>lt.person_id!==ot);o&&j({...o,shares:ut}),history.back()}}},SvgPlus=i=>reactExports.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},reactExports.createElement("path",{d:"M8 1C8 0.447715 7.55228 0 7 0C6.44772 0 6 0.447715 6 1V6H1C0.447715 6 0 6.44771 0 7C0 7.55228 0.447715 8 1 8H6V13C6 13.5523 6.44772 14 7 14C7.55228 14 8 13.5523 8 13V8H13C13.5523 8 14 7.55228 14 7C14 6.44772 13.5523 6 13 6H8V1Z",fill:"currentColor"}));var classnames={exports:{}};/*! + */var h$6=reactExports,n=shimExports;function p(i,o){return i===o&&(i!==0||1/i===1/o)||i!==i&&o!==o}var q=typeof Object.is=="function"?Object.is:p,r=n.useSyncExternalStore,t=h$6.useRef,u=h$6.useEffect,v$6=h$6.useMemo,w$6=h$6.useDebugValue;withSelector_production_min.useSyncExternalStoreWithSelector=function(i,o,j,$,_e){var et=t(null);if(et.current===null){var tt={hasValue:!1,value:null};et.current=tt}else tt=et.current;et=v$6(function(){function rt(pt){if(!it){if(it=!0,at=pt,pt=$(pt),_e!==void 0&&tt.hasValue){var ht=tt.value;if(_e(ht,pt))return ct=ht}return ct=pt}if(ht=ct,q(at,pt))return ht;var dt=$(pt);return _e!==void 0&&_e(ht,dt)?ht:(at=pt,ct=dt)}var it=!1,at,ct,st=j===void 0?null:j;return[function(){return rt(o())},st===null?void 0:function(){return rt(st())}]},[o,j,$,_e]);var nt=r(i,et[0],et[1]);return u(function(){tt.hasValue=!0,tt.value=nt},[nt]),w$6(nt),nt};withSelector.exports=withSelector_production_min;var withSelectorExports=withSelector.exports;const useSyncExternalStoreExports=getDefaultExportFromCjs(withSelectorExports),{useSyncExternalStoreWithSelector}=useSyncExternalStoreExports;function useStore$1(i,o=i.getState,j){const $=useSyncExternalStoreWithSelector(i.subscribe,i.getState,i.getServerState||i.getState,o,j);return reactExports.useDebugValue($),$}const createImpl=i=>{const o=typeof i=="function"?createStore(i):i,j=($,_e)=>useStore$1(o,$,_e);return Object.assign(j,o),j},create$1=i=>i?createImpl(i):createImpl,useStore=create$1((i,o)=>({overlays:[],setOverlays:j=>i({overlays:j}),txId:void 0,setTxId:j=>i({txId:j}),users:[],setUsers:j=>i({users:j}),selectPersonId:null,setSelectPersonId:j=>i({selectPersonId:j}),isSelectPayers:null,setIsSelectPayers:j=>i({isSelectPayers:j}),currencies:[],setCurrencies:j=>i({currencies:j}),setCurrency:j=>{o().transaction!==void 0&&i({transaction:{...o().transaction,currency_id:j}})},chat:void 0,setChat:j=>i({chat:j}),transaction:void 0,setTransaction:j=>i({transaction:j}),isAuthorSharesInited:!1,setIsAuthorSharesInited:j=>i({isAuthorSharesInited:j}),txComment:"",setTxComment:j=>i({txComment:j}),isSuccess:null,setSuccess:j=>i({isSuccess:j}),txPatchError:null,setTxPatchError:j=>i({txPatchError:j}),summaryId:void 0,setSummaryId:j=>i({summaryId:j}),summary:void 0,setSummary:j=>i({summary:j})})),useCurrencies=()=>{const{currencies:i}=useStore();return{getCurrencyById:j=>i.find($=>$._id===j)}},consoleLogger={type:"logger",log(i){this.output("log",i)},warn(i){this.output("warn",i)},error(i){this.output("error",i)},output(i,o){console&&console[i]&&console[i].apply(console,o)}};class Logger{constructor(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(o,j)}init(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=j.prefix||"i18next:",this.logger=o||consoleLogger,this.options=j,this.debug=j.debug}log(){for(var o=arguments.length,j=new Array(o),$=0;${this.observers[$]=this.observers[$]||[],this.observers[$].push(j)}),this}off(o,j){if(this.observers[o]){if(!j){delete this.observers[o];return}this.observers[o]=this.observers[o].filter($=>$!==j)}}emit(o){for(var j=arguments.length,$=new Array(j>1?j-1:0),_e=1;_e{tt(...$)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(tt=>{tt.apply(tt,[o,...$])})}}function defer(){let i,o;const j=new Promise(($,_e)=>{i=$,o=_e});return j.resolve=i,j.reject=o,j}function makeString(i){return i==null?"":""+i}function copy(i,o,j){i.forEach($=>{o[$]&&(j[$]=o[$])})}function getLastOfPath(i,o,j){function $(tt){return tt&&tt.indexOf("###")>-1?tt.replace(/###/g,"."):tt}function _e(){return!i||typeof i=="string"}const et=typeof o!="string"?[].concat(o):o.split(".");for(;et.length>1;){if(_e())return{};const tt=$(et.shift());!i[tt]&&j&&(i[tt]=new j),Object.prototype.hasOwnProperty.call(i,tt)?i=i[tt]:i={}}return _e()?{}:{obj:i,k:$(et.shift())}}function setPath(i,o,j){const{obj:$,k:_e}=getLastOfPath(i,o,Object);$[_e]=j}function pushPath(i,o,j,$){const{obj:_e,k:et}=getLastOfPath(i,o,Object);_e[et]=_e[et]||[],$&&(_e[et]=_e[et].concat(j)),$||_e[et].push(j)}function getPath(i,o){const{obj:j,k:$}=getLastOfPath(i,o);if(j)return j[$]}function getPathWithDefaults(i,o,j){const $=getPath(i,j);return $!==void 0?$:getPath(o,j)}function deepExtend(i,o,j){for(const $ in o)$!=="__proto__"&&$!=="constructor"&&($ in i?typeof i[$]=="string"||i[$]instanceof String||typeof o[$]=="string"||o[$]instanceof String?j&&(i[$]=o[$]):deepExtend(i[$],o[$],j):i[$]=o[$]);return i}function regexEscape(i){return i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var _entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function escape(i){return typeof i=="string"?i.replace(/[&<>"'\/]/g,o=>_entityMap[o]):i}const chars=[" ",",","?","!",";"];function looksLikeObjectPath(i,o,j){o=o||"",j=j||"";const $=chars.filter(tt=>o.indexOf(tt)<0&&j.indexOf(tt)<0);if($.length===0)return!0;const _e=new RegExp(`(${$.map(tt=>tt==="?"?"\\?":tt).join("|")})`);let et=!_e.test(i);if(!et){const tt=i.indexOf(j);tt>0&&!_e.test(i.substring(0,tt))&&(et=!0)}return et}function deepFind(i,o){let j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!i)return;if(i[o])return i[o];const $=o.split(j);let _e=i;for(let et=0;et<$.length;++et){if(!_e||typeof _e[$[et]]=="string"&&et+1<$.length)return;if(_e[$[et]]===void 0){let tt=2,nt=$.slice(et,et+tt).join(j),rt=_e[nt];for(;rt===void 0&&$.length>et+tt;)tt++,nt=$.slice(et,et+tt).join(j),rt=_e[nt];if(rt===void 0)return;if(rt===null)return null;if(o.endsWith(nt)){if(typeof rt=="string")return rt;if(nt&&typeof rt[nt]=="string")return rt[nt]}const it=$.slice(et+tt).join(j);return it?deepFind(rt,it,j):void 0}_e=_e[$[et]]}return _e}function getCleanedCode(i){return i&&i.indexOf("_")>0?i.replace("_","-"):i}class ResourceStore extends EventEmitter{constructor(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=o||{},this.options=j,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(o){this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}removeNamespaces(o){const j=this.options.ns.indexOf(o);j>-1&&this.options.ns.splice(j,1)}getResource(o,j,$){let _e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const et=_e.keySeparator!==void 0?_e.keySeparator:this.options.keySeparator,tt=_e.ignoreJSONStructure!==void 0?_e.ignoreJSONStructure:this.options.ignoreJSONStructure;let nt=[o,j];$&&typeof $!="string"&&(nt=nt.concat($)),$&&typeof $=="string"&&(nt=nt.concat(et?$.split(et):$)),o.indexOf(".")>-1&&(nt=o.split("."));const rt=getPath(this.data,nt);return rt||!tt||typeof $!="string"?rt:deepFind(this.data&&this.data[o]&&this.data[o][j],$,et)}addResource(o,j,$,_e){let et=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const tt=et.keySeparator!==void 0?et.keySeparator:this.options.keySeparator;let nt=[o,j];$&&(nt=nt.concat(tt?$.split(tt):$)),o.indexOf(".")>-1&&(nt=o.split("."),_e=j,j=nt[1]),this.addNamespaces(j),setPath(this.data,nt,_e),et.silent||this.emit("added",o,j,$,_e)}addResources(o,j,$){let _e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const et in $)(typeof $[et]=="string"||Object.prototype.toString.apply($[et])==="[object Array]")&&this.addResource(o,j,et,$[et],{silent:!0});_e.silent||this.emit("added",o,j,$)}addResourceBundle(o,j,$,_e,et){let tt=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},nt=[o,j];o.indexOf(".")>-1&&(nt=o.split("."),_e=$,$=j,j=nt[1]),this.addNamespaces(j);let rt=getPath(this.data,nt)||{};_e?deepExtend(rt,$,et):rt={...rt,...$},setPath(this.data,nt,rt),tt.silent||this.emit("added",o,j,$)}removeResourceBundle(o,j){this.hasResourceBundle(o,j)&&delete this.data[o][j],this.removeNamespaces(j),this.emit("removed",o,j)}hasResourceBundle(o,j){return this.getResource(o,j)!==void 0}getResourceBundle(o,j){return j||(j=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(o,j)}:this.getResource(o,j)}getDataByLanguage(o){return this.data[o]}hasLanguageSomeTranslations(o){const j=this.getDataByLanguage(o);return!!(j&&Object.keys(j)||[]).find(_e=>j[_e]&&Object.keys(j[_e]).length>0)}toJSON(){return this.data}}var postProcessor={processors:{},addPostProcessor(i){this.processors[i.name]=i},handle(i,o,j,$,_e){return i.forEach(et=>{this.processors[et]&&(o=this.processors[et].process(o,j,$,_e))}),o}};const checkedLoadedFor={};class Translator extends EventEmitter{constructor(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),copy(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],o,this),this.options=j,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=baseLogger.create("translator")}changeLanguage(o){o&&(this.language=o)}exists(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(o==null)return!1;const $=this.resolve(o,j);return $&&$.res!==void 0}extractFromKey(o,j){let $=j.nsSeparator!==void 0?j.nsSeparator:this.options.nsSeparator;$===void 0&&($=":");const _e=j.keySeparator!==void 0?j.keySeparator:this.options.keySeparator;let et=j.ns||this.options.defaultNS||[];const tt=$&&o.indexOf($)>-1,nt=!this.options.userDefinedKeySeparator&&!j.keySeparator&&!this.options.userDefinedNsSeparator&&!j.nsSeparator&&!looksLikeObjectPath(o,$,_e);if(tt&&!nt){const rt=o.match(this.interpolator.nestingRegexp);if(rt&&rt.length>0)return{key:o,namespaces:et};const it=o.split($);($!==_e||$===_e&&this.options.ns.indexOf(it[0])>-1)&&(et=it.shift()),o=it.join(_e)}return typeof et=="string"&&(et=[et]),{key:o,namespaces:et}}translate(o,j,$){if(typeof j!="object"&&this.options.overloadTranslationOptionHandler&&(j=this.options.overloadTranslationOptionHandler(arguments)),typeof j=="object"&&(j={...j}),j||(j={}),o==null)return"";Array.isArray(o)||(o=[String(o)]);const _e=j.returnDetails!==void 0?j.returnDetails:this.options.returnDetails,et=j.keySeparator!==void 0?j.keySeparator:this.options.keySeparator,{key:tt,namespaces:nt}=this.extractFromKey(o[o.length-1],j),rt=nt[nt.length-1],it=j.lng||this.language,at=j.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(it&&it.toLowerCase()==="cimode"){if(at){const ft=j.nsSeparator||this.options.nsSeparator;return _e?{res:`${rt}${ft}${tt}`,usedKey:tt,exactUsedKey:tt,usedLng:it,usedNS:rt,usedParams:this.getUsedParamsDetails(j)}:`${rt}${ft}${tt}`}return _e?{res:tt,usedKey:tt,exactUsedKey:tt,usedLng:it,usedNS:rt,usedParams:this.getUsedParamsDetails(j)}:tt}const ct=this.resolve(o,j);let st=ct&&ct.res;const pt=ct&&ct.usedKey||tt,ht=ct&&ct.exactUsedKey||tt,dt=Object.prototype.toString.apply(st),yt=["[object Number]","[object Function]","[object RegExp]"],ot=j.joinArrays!==void 0?j.joinArrays:this.options.joinArrays,ut=!this.i18nFormat||this.i18nFormat.handleAsObject;if(ut&&st&&(typeof st!="string"&&typeof st!="boolean"&&typeof st!="number")&&yt.indexOf(dt)<0&&!(typeof ot=="string"&&dt==="[object Array]")){if(!j.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const ft=this.options.returnedObjectHandler?this.options.returnedObjectHandler(pt,st,{...j,ns:nt}):`key '${tt} (${this.language})' returned an object instead of string.`;return _e?(ct.res=ft,ct.usedParams=this.getUsedParamsDetails(j),ct):ft}if(et){const ft=dt==="[object Array]",gt=ft?[]:{},kt=ft?ht:pt;for(const xt in st)if(Object.prototype.hasOwnProperty.call(st,xt)){const _t=`${kt}${et}${xt}`;gt[xt]=this.translate(_t,{...j,joinArrays:!1,ns:nt}),gt[xt]===_t&&(gt[xt]=st[xt])}st=gt}}else if(ut&&typeof ot=="string"&&dt==="[object Array]")st=st.join(ot),st&&(st=this.extendTranslation(st,o,j,$));else{let ft=!1,gt=!1;const kt=j.count!==void 0&&typeof j.count!="string",xt=Translator.hasDefaultValue(j),_t=kt?this.pluralResolver.getSuffix(it,j.count,j):"",Ct=j.ordinal&&kt?this.pluralResolver.getSuffix(it,j.count,{ordinal:!1}):"",Rt=j[`defaultValue${_t}`]||j[`defaultValue${Ct}`]||j.defaultValue;!this.isValidLookup(st)&&xt&&(ft=!0,st=Rt),this.isValidLookup(st)||(gt=!0,st=tt);const Tt=(j.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&>?void 0:st,jt=xt&&Rt!==st&&this.options.updateMissing;if(gt||ft||jt){if(this.logger.log(jt?"updateKey":"missingKey",it,rt,tt,jt?Rt:st),et){const bt=this.resolve(tt,{...j,keySeparator:!1});bt&&bt.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 Bt=[];const Ft=this.languageUtils.getFallbackCodes(this.options.fallbackLng,j.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Ft&&Ft[0])for(let bt=0;bt{const Pt=xt&&vt!==st?vt:Tt;this.options.missingKeyHandler?this.options.missingKeyHandler(bt,rt,mt,Pt,jt,j):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(bt,rt,mt,Pt,jt,j),this.emit("missingKey",bt,rt,mt,st)};this.options.saveMissing&&(this.options.saveMissingPlurals&&kt?Bt.forEach(bt=>{this.pluralResolver.getSuffixes(bt,j).forEach(mt=>{Et([bt],tt+mt,j[`defaultValue${mt}`]||Rt)})}):Et(Bt,tt,Rt))}st=this.extendTranslation(st,o,j,ct,$),gt&&st===tt&&this.options.appendNamespaceToMissingKey&&(st=`${rt}:${tt}`),(gt||ft)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?st=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${rt}:${tt}`:tt,ft?st:void 0):st=this.options.parseMissingKeyHandler(st))}return _e?(ct.res=st,ct.usedParams=this.getUsedParamsDetails(j),ct):st}extendTranslation(o,j,$,_e,et){var tt=this;if(this.i18nFormat&&this.i18nFormat.parse)o=this.i18nFormat.parse(o,{...this.options.interpolation.defaultVariables,...$},$.lng||this.language||_e.usedLng,_e.usedNS,_e.usedKey,{resolved:_e});else if(!$.skipInterpolation){$.interpolation&&this.interpolator.init({...$,interpolation:{...this.options.interpolation,...$.interpolation}});const it=typeof o=="string"&&($&&$.interpolation&&$.interpolation.skipOnVariables!==void 0?$.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let at;if(it){const st=o.match(this.interpolator.nestingRegexp);at=st&&st.length}let ct=$.replace&&typeof $.replace!="string"?$.replace:$;if(this.options.interpolation.defaultVariables&&(ct={...this.options.interpolation.defaultVariables,...ct}),o=this.interpolator.interpolate(o,ct,$.lng||this.language,$),it){const st=o.match(this.interpolator.nestingRegexp),pt=st&&st.length;at1&&arguments[1]!==void 0?arguments[1]:{},$,_e,et,tt,nt;return typeof o=="string"&&(o=[o]),o.forEach(rt=>{if(this.isValidLookup($))return;const it=this.extractFromKey(rt,j),at=it.key;_e=at;let ct=it.namespaces;this.options.fallbackNS&&(ct=ct.concat(this.options.fallbackNS));const st=j.count!==void 0&&typeof j.count!="string",pt=st&&!j.ordinal&&j.count===0&&this.pluralResolver.shouldUseIntlApi(),ht=j.context!==void 0&&(typeof j.context=="string"||typeof j.context=="number")&&j.context!=="",dt=j.lngs?j.lngs:this.languageUtils.toResolveHierarchy(j.lng||this.language,j.fallbackLng);ct.forEach(yt=>{this.isValidLookup($)||(nt=yt,!checkedLoadedFor[`${dt[0]}-${yt}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(nt)&&(checkedLoadedFor[`${dt[0]}-${yt}`]=!0,this.logger.warn(`key "${_e}" for languages "${dt.join(", ")}" won't get resolved as namespace "${nt}" 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!!!")),dt.forEach(ot=>{if(this.isValidLookup($))return;tt=ot;const ut=[at];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(ut,at,ot,yt,j);else{let ft;st&&(ft=this.pluralResolver.getSuffix(ot,j.count,j));const gt=`${this.options.pluralSeparator}zero`,kt=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(st&&(ut.push(at+ft),j.ordinal&&ft.indexOf(kt)===0&&ut.push(at+ft.replace(kt,this.options.pluralSeparator)),pt&&ut.push(at+gt)),ht){const xt=`${at}${this.options.contextSeparator}${j.context}`;ut.push(xt),st&&(ut.push(xt+ft),j.ordinal&&ft.indexOf(kt)===0&&ut.push(xt+ft.replace(kt,this.options.pluralSeparator)),pt&&ut.push(xt+gt))}}let lt;for(;lt=ut.pop();)this.isValidLookup($)||(et=lt,$=this.getResource(ot,yt,lt,j))}))})}),{res:$,usedKey:_e,exactUsedKey:et,usedLng:tt,usedNS:nt}}isValidLookup(o){return o!==void 0&&!(!this.options.returnNull&&o===null)&&!(!this.options.returnEmptyString&&o==="")}getResource(o,j,$){let _e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(o,j,$,_e):this.resourceStore.getResource(o,j,$,_e)}getUsedParamsDetails(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const j=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],$=o.replace&&typeof o.replace!="string";let _e=$?o.replace:o;if($&&typeof o.count<"u"&&(_e.count=o.count),this.options.interpolation.defaultVariables&&(_e={...this.options.interpolation.defaultVariables,..._e}),!$){_e={..._e};for(const et of j)delete _e[et]}return _e}static hasDefaultValue(o){const j="defaultValue";for(const $ in o)if(Object.prototype.hasOwnProperty.call(o,$)&&j===$.substring(0,j.length)&&o[$]!==void 0)return!0;return!1}}function capitalize(i){return i.charAt(0).toUpperCase()+i.slice(1)}class LanguageUtil{constructor(o){this.options=o,this.supportedLngs=this.options.supportedLngs||!1,this.logger=baseLogger.create("languageUtils")}getScriptPartFromCode(o){if(o=getCleanedCode(o),!o||o.indexOf("-")<0)return null;const j=o.split("-");return j.length===2||(j.pop(),j[j.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(j.join("-"))}getLanguagePartFromCode(o){if(o=getCleanedCode(o),!o||o.indexOf("-")<0)return o;const j=o.split("-");return this.formatLanguageCode(j[0])}formatLanguageCode(o){if(typeof o=="string"&&o.indexOf("-")>-1){const j=["hans","hant","latn","cyrl","cans","mong","arab"];let $=o.split("-");return this.options.lowerCaseLng?$=$.map(_e=>_e.toLowerCase()):$.length===2?($[0]=$[0].toLowerCase(),$[1]=$[1].toUpperCase(),j.indexOf($[1].toLowerCase())>-1&&($[1]=capitalize($[1].toLowerCase()))):$.length===3&&($[0]=$[0].toLowerCase(),$[1].length===2&&($[1]=$[1].toUpperCase()),$[0]!=="sgn"&&$[2].length===2&&($[2]=$[2].toUpperCase()),j.indexOf($[1].toLowerCase())>-1&&($[1]=capitalize($[1].toLowerCase())),j.indexOf($[2].toLowerCase())>-1&&($[2]=capitalize($[2].toLowerCase()))),$.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?o.toLowerCase():o}isSupportedCode(o){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(o=this.getLanguagePartFromCode(o)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(o)>-1}getBestMatchFromCodes(o){if(!o)return null;let j;return o.forEach($=>{if(j)return;const _e=this.formatLanguageCode($);(!this.options.supportedLngs||this.isSupportedCode(_e))&&(j=_e)}),!j&&this.options.supportedLngs&&o.forEach($=>{if(j)return;const _e=this.getLanguagePartFromCode($);if(this.isSupportedCode(_e))return j=_e;j=this.options.supportedLngs.find(et=>{if(et===_e)return et;if(!(et.indexOf("-")<0&&_e.indexOf("-")<0)&&et.indexOf(_e)===0)return et})}),j||(j=this.getFallbackCodes(this.options.fallbackLng)[0]),j}getFallbackCodes(o,j){if(!o)return[];if(typeof o=="function"&&(o=o(j)),typeof o=="string"&&(o=[o]),Object.prototype.toString.apply(o)==="[object Array]")return o;if(!j)return o.default||[];let $=o[j];return $||($=o[this.getScriptPartFromCode(j)]),$||($=o[this.formatLanguageCode(j)]),$||($=o[this.getLanguagePartFromCode(j)]),$||($=o.default),$||[]}toResolveHierarchy(o,j){const $=this.getFallbackCodes(j||this.options.fallbackLng||[],o),_e=[],et=tt=>{tt&&(this.isSupportedCode(tt)?_e.push(tt):this.logger.warn(`rejecting language code not found in supportedLngs: ${tt}`))};return typeof o=="string"&&(o.indexOf("-")>-1||o.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&et(this.formatLanguageCode(o)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&et(this.getScriptPartFromCode(o)),this.options.load!=="currentOnly"&&et(this.getLanguagePartFromCode(o))):typeof o=="string"&&et(this.formatLanguageCode(o)),$.forEach(tt=>{_e.indexOf(tt)<0&&et(this.formatLanguageCode(tt))}),_e}}let sets=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],_rulesPluralsTypes={1:function(i){return+(i>1)},2:function(i){return+(i!=1)},3:function(i){return 0},4:function(i){return i%10==1&&i%100!=11?0:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?1:2},5:function(i){return i==0?0:i==1?1:i==2?2:i%100>=3&&i%100<=10?3:i%100>=11?4:5},6:function(i){return i==1?0:i>=2&&i<=4?1:2},7:function(i){return i==1?0:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?1:2},8:function(i){return i==1?0:i==2?1:i!=8&&i!=11?2:3},9:function(i){return+(i>=2)},10:function(i){return i==1?0:i==2?1:i<7?2:i<11?3:4},11:function(i){return i==1||i==11?0:i==2||i==12?1:i>2&&i<20?2:3},12:function(i){return+(i%10!=1||i%100==11)},13:function(i){return+(i!==0)},14:function(i){return i==1?0:i==2?1:i==3?2:3},15:function(i){return i%10==1&&i%100!=11?0:i%10>=2&&(i%100<10||i%100>=20)?1:2},16:function(i){return i%10==1&&i%100!=11?0:i!==0?1:2},17:function(i){return i==1||i%10==1&&i%100!=11?0:1},18:function(i){return i==0?0:i==1?1:2},19:function(i){return i==1?0:i==0||i%100>1&&i%100<11?1:i%100>10&&i%100<20?2:3},20:function(i){return i==1?0:i==0||i%100>0&&i%100<20?1:2},21:function(i){return i%100==1?1:i%100==2?2:i%100==3||i%100==4?3:0},22:function(i){return i==1?0:i==2?1:(i<0||i>10)&&i%10==0?2:3}};const nonIntlVersions=["v1","v2","v3"],intlVersions=["v4"],suffixesOrder={zero:0,one:1,two:2,few:3,many:4,other:5};function createRules(){const i={};return sets.forEach(o=>{o.lngs.forEach(j=>{i[j]={numbers:o.nr,plurals:_rulesPluralsTypes[o.fc]}})}),i}class PluralResolver{constructor(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=o,this.options=j,this.logger=baseLogger.create("pluralResolver"),(!this.options.compatibilityJSON||intlVersions.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=createRules()}addRule(o,j){this.rules[o]=j}getRule(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(getCleanedCode(o),{type:j.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[o]||this.rules[this.languageUtils.getLanguagePartFromCode(o)]}needsPlural(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const $=this.getRule(o,j);return this.shouldUseIntlApi()?$&&$.resolvedOptions().pluralCategories.length>1:$&&$.numbers.length>1}getPluralFormsOfKey(o,j){let $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(o,$).map(_e=>`${j}${_e}`)}getSuffixes(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const $=this.getRule(o,j);return $?this.shouldUseIntlApi()?$.resolvedOptions().pluralCategories.sort((_e,et)=>suffixesOrder[_e]-suffixesOrder[et]).map(_e=>`${this.options.prepend}${j.ordinal?`ordinal${this.options.prepend}`:""}${_e}`):$.numbers.map(_e=>this.getSuffix(o,_e,j)):[]}getSuffix(o,j){let $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const _e=this.getRule(o,$);return _e?this.shouldUseIntlApi()?`${this.options.prepend}${$.ordinal?`ordinal${this.options.prepend}`:""}${_e.select(j)}`:this.getSuffixRetroCompatible(_e,j):(this.logger.warn(`no plural rule found for: ${o}`),"")}getSuffixRetroCompatible(o,j){const $=o.noAbs?o.plurals(j):o.plurals(Math.abs(j));let _e=o.numbers[$];this.options.simplifyPluralSuffix&&o.numbers.length===2&&o.numbers[0]===1&&(_e===2?_e="plural":_e===1&&(_e=""));const et=()=>this.options.prepend&&_e.toString()?this.options.prepend+_e.toString():_e.toString();return this.options.compatibilityJSON==="v1"?_e===1?"":typeof _e=="number"?`_plural_${_e.toString()}`:et():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&o.numbers.length===2&&o.numbers[0]===1?et():this.options.prepend&&$.toString()?this.options.prepend+$.toString():$.toString()}shouldUseIntlApi(){return!nonIntlVersions.includes(this.options.compatibilityJSON)}}function deepFindWithDefaults(i,o,j){let $=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",_e=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,et=getPathWithDefaults(i,o,j);return!et&&_e&&typeof j=="string"&&(et=deepFind(i,j,$),et===void 0&&(et=deepFind(o,j,$))),et}class Interpolator{constructor(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=baseLogger.create("interpolator"),this.options=o,this.format=o.interpolation&&o.interpolation.format||(j=>j),this.init(o)}init(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};o.interpolation||(o.interpolation={escapeValue:!0});const j=o.interpolation;this.escape=j.escape!==void 0?j.escape:escape,this.escapeValue=j.escapeValue!==void 0?j.escapeValue:!0,this.useRawValueToEscape=j.useRawValueToEscape!==void 0?j.useRawValueToEscape:!1,this.prefix=j.prefix?regexEscape(j.prefix):j.prefixEscaped||"{{",this.suffix=j.suffix?regexEscape(j.suffix):j.suffixEscaped||"}}",this.formatSeparator=j.formatSeparator?j.formatSeparator:j.formatSeparator||",",this.unescapePrefix=j.unescapeSuffix?"":j.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":j.unescapeSuffix||"",this.nestingPrefix=j.nestingPrefix?regexEscape(j.nestingPrefix):j.nestingPrefixEscaped||regexEscape("$t("),this.nestingSuffix=j.nestingSuffix?regexEscape(j.nestingSuffix):j.nestingSuffixEscaped||regexEscape(")"),this.nestingOptionsSeparator=j.nestingOptionsSeparator?j.nestingOptionsSeparator:j.nestingOptionsSeparator||",",this.maxReplaces=j.maxReplaces?j.maxReplaces:1e3,this.alwaysFormat=j.alwaysFormat!==void 0?j.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const o=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(o,"g");const j=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(j,"g");const $=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp($,"g")}interpolate(o,j,$,_e){let et,tt,nt;const rt=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function it(ht){return ht.replace(/\$/g,"$$$$")}const at=ht=>{if(ht.indexOf(this.formatSeparator)<0){const ut=deepFindWithDefaults(j,rt,ht,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(ut,void 0,$,{..._e,...j,interpolationkey:ht}):ut}const dt=ht.split(this.formatSeparator),yt=dt.shift().trim(),ot=dt.join(this.formatSeparator).trim();return this.format(deepFindWithDefaults(j,rt,yt,this.options.keySeparator,this.options.ignoreJSONStructure),ot,$,{..._e,...j,interpolationkey:yt})};this.resetRegExp();const ct=_e&&_e.missingInterpolationHandler||this.options.missingInterpolationHandler,st=_e&&_e.interpolation&&_e.interpolation.skipOnVariables!==void 0?_e.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:ht=>it(ht)},{regex:this.regexp,safeValue:ht=>this.escapeValue?it(this.escape(ht)):it(ht)}].forEach(ht=>{for(nt=0;et=ht.regex.exec(o);){const dt=et[1].trim();if(tt=at(dt),tt===void 0)if(typeof ct=="function"){const ot=ct(o,et,_e);tt=typeof ot=="string"?ot:""}else if(_e&&Object.prototype.hasOwnProperty.call(_e,dt))tt="";else if(st){tt=et[0];continue}else this.logger.warn(`missed to pass in variable ${dt} for interpolating ${o}`),tt="";else typeof tt!="string"&&!this.useRawValueToEscape&&(tt=makeString(tt));const yt=ht.safeValue(tt);if(o=o.replace(et[0],yt),st?(ht.regex.lastIndex+=tt.length,ht.regex.lastIndex-=et[0].length):ht.regex.lastIndex=0,nt++,nt>=this.maxReplaces)break}}),o}nest(o,j){let $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},_e,et,tt;function nt(rt,it){const at=this.nestingOptionsSeparator;if(rt.indexOf(at)<0)return rt;const ct=rt.split(new RegExp(`${at}[ ]*{`));let st=`{${ct[1]}`;rt=ct[0],st=this.interpolate(st,tt);const pt=st.match(/'/g),ht=st.match(/"/g);(pt&&pt.length%2===0&&!ht||ht.length%2!==0)&&(st=st.replace(/'/g,'"'));try{tt=JSON.parse(st),it&&(tt={...it,...tt})}catch(dt){return this.logger.warn(`failed parsing options string in nesting for key ${rt}`,dt),`${rt}${at}${st}`}return delete tt.defaultValue,rt}for(;_e=this.nestingRegexp.exec(o);){let rt=[];tt={...$},tt=tt.replace&&typeof tt.replace!="string"?tt.replace:tt,tt.applyPostProcessor=!1,delete tt.defaultValue;let it=!1;if(_e[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(_e[1])){const at=_e[1].split(this.formatSeparator).map(ct=>ct.trim());_e[1]=at.shift(),rt=at,it=!0}if(et=j(nt.call(this,_e[1].trim(),tt),tt),et&&_e[0]===o&&typeof et!="string")return et;typeof et!="string"&&(et=makeString(et)),et||(this.logger.warn(`missed to resolve ${_e[1]} for nesting ${o}`),et=""),it&&(et=rt.reduce((at,ct)=>this.format(at,ct,$.lng,{...$,interpolationkey:_e[1].trim()}),et.trim())),o=o.replace(_e[0],et),this.regexp.lastIndex=0}return o}}function parseFormatStr(i){let o=i.toLowerCase().trim();const j={};if(i.indexOf("(")>-1){const $=i.split("(");o=$[0].toLowerCase().trim();const _e=$[1].substring(0,$[1].length-1);o==="currency"&&_e.indexOf(":")<0?j.currency||(j.currency=_e.trim()):o==="relativetime"&&_e.indexOf(":")<0?j.range||(j.range=_e.trim()):_e.split(";").forEach(tt=>{if(!tt)return;const[nt,...rt]=tt.split(":"),it=rt.join(":").trim().replace(/^'+|'+$/g,"");j[nt.trim()]||(j[nt.trim()]=it),it==="false"&&(j[nt.trim()]=!1),it==="true"&&(j[nt.trim()]=!0),isNaN(it)||(j[nt.trim()]=parseInt(it,10))})}return{formatName:o,formatOptions:j}}function createCachedFormatter(i){const o={};return function($,_e,et){const tt=_e+JSON.stringify(et);let nt=o[tt];return nt||(nt=i(getCleanedCode(_e),et),o[tt]=nt),nt($)}}class Formatter{constructor(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=baseLogger.create("formatter"),this.options=o,this.formats={number:createCachedFormatter((j,$)=>{const _e=new Intl.NumberFormat(j,{...$});return et=>_e.format(et)}),currency:createCachedFormatter((j,$)=>{const _e=new Intl.NumberFormat(j,{...$,style:"currency"});return et=>_e.format(et)}),datetime:createCachedFormatter((j,$)=>{const _e=new Intl.DateTimeFormat(j,{...$});return et=>_e.format(et)}),relativetime:createCachedFormatter((j,$)=>{const _e=new Intl.RelativeTimeFormat(j,{...$});return et=>_e.format(et,$.range||"day")}),list:createCachedFormatter((j,$)=>{const _e=new Intl.ListFormat(j,{...$});return et=>_e.format(et)})},this.init(o)}init(o){const $=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=$.formatSeparator?$.formatSeparator:$.formatSeparator||","}add(o,j){this.formats[o.toLowerCase().trim()]=j}addCached(o,j){this.formats[o.toLowerCase().trim()]=createCachedFormatter(j)}format(o,j,$){let _e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return j.split(this.formatSeparator).reduce((nt,rt)=>{const{formatName:it,formatOptions:at}=parseFormatStr(rt);if(this.formats[it]){let ct=nt;try{const st=_e&&_e.formatParams&&_e.formatParams[_e.interpolationkey]||{},pt=st.locale||st.lng||_e.locale||_e.lng||$;ct=this.formats[it](nt,pt,{...at,..._e,...st})}catch(st){this.logger.warn(st)}return ct}else this.logger.warn(`there was no format function for ${it}`);return nt},o)}}function removePending(i,o){i.pending[o]!==void 0&&(delete i.pending[o],i.pendingCount--)}class Connector extends EventEmitter{constructor(o,j,$){let _e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=o,this.store=j,this.services=$,this.languageUtils=$.languageUtils,this.options=_e,this.logger=baseLogger.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=_e.maxParallelReads||10,this.readingCalls=0,this.maxRetries=_e.maxRetries>=0?_e.maxRetries:5,this.retryTimeout=_e.retryTimeout>=1?_e.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init($,_e.backend,_e)}queueLoad(o,j,$,_e){const et={},tt={},nt={},rt={};return o.forEach(it=>{let at=!0;j.forEach(ct=>{const st=`${it}|${ct}`;!$.reload&&this.store.hasResourceBundle(it,ct)?this.state[st]=2:this.state[st]<0||(this.state[st]===1?tt[st]===void 0&&(tt[st]=!0):(this.state[st]=1,at=!1,tt[st]===void 0&&(tt[st]=!0),et[st]===void 0&&(et[st]=!0),rt[ct]===void 0&&(rt[ct]=!0)))}),at||(nt[it]=!0)}),(Object.keys(et).length||Object.keys(tt).length)&&this.queue.push({pending:tt,pendingCount:Object.keys(tt).length,loaded:{},errors:[],callback:_e}),{toLoad:Object.keys(et),pending:Object.keys(tt),toLoadLanguages:Object.keys(nt),toLoadNamespaces:Object.keys(rt)}}loaded(o,j,$){const _e=o.split("|"),et=_e[0],tt=_e[1];j&&this.emit("failedLoading",et,tt,j),$&&this.store.addResourceBundle(et,tt,$),this.state[o]=j?-1:2;const nt={};this.queue.forEach(rt=>{pushPath(rt.loaded,[et],tt),removePending(rt,o),j&&rt.errors.push(j),rt.pendingCount===0&&!rt.done&&(Object.keys(rt.loaded).forEach(it=>{nt[it]||(nt[it]={});const at=rt.loaded[it];at.length&&at.forEach(ct=>{nt[it][ct]===void 0&&(nt[it][ct]=!0)})}),rt.done=!0,rt.errors.length?rt.callback(rt.errors):rt.callback())}),this.emit("loaded",nt),this.queue=this.queue.filter(rt=>!rt.done)}read(o,j,$){let _e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,et=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,tt=arguments.length>5?arguments[5]:void 0;if(!o.length)return tt(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:o,ns:j,fcName:$,tried:_e,wait:et,callback:tt});return}this.readingCalls++;const nt=(it,at)=>{if(this.readingCalls--,this.waitingReads.length>0){const ct=this.waitingReads.shift();this.read(ct.lng,ct.ns,ct.fcName,ct.tried,ct.wait,ct.callback)}if(it&&at&&_e{this.read.call(this,o,j,$,_e+1,et*2,tt)},et);return}tt(it,at)},rt=this.backend[$].bind(this.backend);if(rt.length===2){try{const it=rt(o,j);it&&typeof it.then=="function"?it.then(at=>nt(null,at)).catch(nt):nt(null,it)}catch(it){nt(it)}return}return rt(o,j,nt)}prepareLoading(o,j){let $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},_e=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),_e&&_e();typeof o=="string"&&(o=this.languageUtils.toResolveHierarchy(o)),typeof j=="string"&&(j=[j]);const et=this.queueLoad(o,j,$,_e);if(!et.toLoad.length)return et.pending.length||_e(),null;et.toLoad.forEach(tt=>{this.loadOne(tt)})}load(o,j,$){this.prepareLoading(o,j,{},$)}reload(o,j,$){this.prepareLoading(o,j,{reload:!0},$)}loadOne(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const $=o.split("|"),_e=$[0],et=$[1];this.read(_e,et,"read",void 0,void 0,(tt,nt)=>{tt&&this.logger.warn(`${j}loading namespace ${et} for language ${_e} failed`,tt),!tt&&nt&&this.logger.log(`${j}loaded namespace ${et} for language ${_e}`,nt),this.loaded(o,tt,nt)})}saveMissing(o,j,$,_e,et){let tt=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},nt=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(j)){this.logger.warn(`did not save key "${$}" as the namespace "${j}" 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!!!");return}if(!($==null||$==="")){if(this.backend&&this.backend.create){const rt={...tt,isUpdate:et},it=this.backend.create.bind(this.backend);if(it.length<6)try{let at;it.length===5?at=it(o,j,$,_e,rt):at=it(o,j,$,_e),at&&typeof at.then=="function"?at.then(ct=>nt(null,ct)).catch(nt):nt(null,at)}catch(at){nt(at)}else it(o,j,$,_e,nt,rt)}!o||!o[0]||this.store.addResource(o[0],j,$,_e)}}}function get(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(o){let j={};if(typeof o[1]=="object"&&(j=o[1]),typeof o[1]=="string"&&(j.defaultValue=o[1]),typeof o[2]=="string"&&(j.tDescription=o[2]),typeof o[2]=="object"||typeof o[3]=="object"){const $=o[3]||o[2];Object.keys($).forEach(_e=>{j[_e]=$[_e]})}return j},interpolation:{escapeValue:!0,format:i=>i,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function transformOptions(i){return typeof i.ns=="string"&&(i.ns=[i.ns]),typeof i.fallbackLng=="string"&&(i.fallbackLng=[i.fallbackLng]),typeof i.fallbackNS=="string"&&(i.fallbackNS=[i.fallbackNS]),i.supportedLngs&&i.supportedLngs.indexOf("cimode")<0&&(i.supportedLngs=i.supportedLngs.concat(["cimode"])),i}function noop(){}function bindMemberFunctions(i){Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(j=>{typeof i[j]=="function"&&(i[j]=i[j].bind(i))})}class I18n extends EventEmitter{constructor(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},j=arguments.length>1?arguments[1]:void 0;if(super(),this.options=transformOptions(o),this.services={},this.logger=baseLogger,this.modules={external:[]},bindMemberFunctions(this),j&&!this.isInitialized&&!o.isClone){if(!this.options.initImmediate)return this.init(o,j),this;setTimeout(()=>{this.init(o,j)},0)}}init(){var o=this;let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},$=arguments.length>1?arguments[1]:void 0;typeof j=="function"&&($=j,j={}),!j.defaultNS&&j.defaultNS!==!1&&j.ns&&(typeof j.ns=="string"?j.defaultNS=j.ns:j.ns.indexOf("translation")<0&&(j.defaultNS=j.ns[0]));const _e=get();this.options={..._e,...this.options,...transformOptions(j)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={..._e.interpolation,...this.options.interpolation}),j.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=j.keySeparator),j.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=j.nsSeparator);function et(at){return at?typeof at=="function"?new at:at:null}if(!this.options.isClone){this.modules.logger?baseLogger.init(et(this.modules.logger),this.options):baseLogger.init(null,this.options);let at;this.modules.formatter?at=this.modules.formatter:typeof Intl<"u"&&(at=Formatter);const ct=new LanguageUtil(this.options);this.store=new ResourceStore(this.options.resources,this.options);const st=this.services;st.logger=baseLogger,st.resourceStore=this.store,st.languageUtils=ct,st.pluralResolver=new PluralResolver(ct,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),at&&(!this.options.interpolation.format||this.options.interpolation.format===_e.interpolation.format)&&(st.formatter=et(at),st.formatter.init(st,this.options),this.options.interpolation.format=st.formatter.format.bind(st.formatter)),st.interpolator=new Interpolator(this.options),st.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},st.backendConnector=new Connector(et(this.modules.backend),st.resourceStore,st,this.options),st.backendConnector.on("*",function(pt){for(var ht=arguments.length,dt=new Array(ht>1?ht-1:0),yt=1;yt1?ht-1:0),yt=1;yt{pt.init&&pt.init(this)})}if(this.format=this.options.interpolation.format,$||($=noop),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const at=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);at.length>0&&at[0]!=="dev"&&(this.options.lng=at[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(at=>{this[at]=function(){return o.store[at](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(at=>{this[at]=function(){return o.store[at](...arguments),o}});const rt=defer(),it=()=>{const at=(ct,st)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),rt.resolve(st),$(ct,st)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return at(null,this.t.bind(this));this.changeLanguage(this.options.lng,at)};return this.options.resources||!this.options.initImmediate?it():setTimeout(it,0),rt}loadResources(o){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:noop;const _e=typeof o=="string"?o:this.language;if(typeof o=="function"&&($=o),!this.options.resources||this.options.partialBundledLanguages){if(_e&&_e.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return $();const et=[],tt=nt=>{if(!nt||nt==="cimode")return;this.services.languageUtils.toResolveHierarchy(nt).forEach(it=>{it!=="cimode"&&et.indexOf(it)<0&&et.push(it)})};_e?tt(_e):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(rt=>tt(rt)),this.options.preload&&this.options.preload.forEach(nt=>tt(nt)),this.services.backendConnector.load(et,this.options.ns,nt=>{!nt&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),$(nt)})}else $(null)}reloadResources(o,j,$){const _e=defer();return o||(o=this.languages),j||(j=this.options.ns),$||($=noop),this.services.backendConnector.reload(o,j,et=>{_e.resolve(),$(et)}),_e}use(o){if(!o)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!o.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return o.type==="backend"&&(this.modules.backend=o),(o.type==="logger"||o.log&&o.warn&&o.error)&&(this.modules.logger=o),o.type==="languageDetector"&&(this.modules.languageDetector=o),o.type==="i18nFormat"&&(this.modules.i18nFormat=o),o.type==="postProcessor"&&postProcessor.addPostProcessor(o),o.type==="formatter"&&(this.modules.formatter=o),o.type==="3rdParty"&&this.modules.external.push(o),this}setResolvedLanguage(o){if(!(!o||!this.languages)&&!(["cimode","dev"].indexOf(o)>-1))for(let j=0;j-1)&&this.store.hasLanguageSomeTranslations($)){this.resolvedLanguage=$;break}}}changeLanguage(o,j){var $=this;this.isLanguageChangingTo=o;const _e=defer();this.emit("languageChanging",o);const et=rt=>{this.language=rt,this.languages=this.services.languageUtils.toResolveHierarchy(rt),this.resolvedLanguage=void 0,this.setResolvedLanguage(rt)},tt=(rt,it)=>{it?(et(it),this.translator.changeLanguage(it),this.isLanguageChangingTo=void 0,this.emit("languageChanged",it),this.logger.log("languageChanged",it)):this.isLanguageChangingTo=void 0,_e.resolve(function(){return $.t(...arguments)}),j&&j(rt,function(){return $.t(...arguments)})},nt=rt=>{!o&&!rt&&this.services.languageDetector&&(rt=[]);const it=typeof rt=="string"?rt:this.services.languageUtils.getBestMatchFromCodes(rt);it&&(this.language||et(it),this.translator.language||this.translator.changeLanguage(it),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(it)),this.loadResources(it,at=>{tt(at,it)})};return!o&&this.services.languageDetector&&!this.services.languageDetector.async?nt(this.services.languageDetector.detect()):!o&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(nt):this.services.languageDetector.detect(nt):nt(o),_e}getFixedT(o,j,$){var _e=this;const et=function(tt,nt){let rt;if(typeof nt!="object"){for(var it=arguments.length,at=new Array(it>2?it-2:0),ct=2;ct`${rt.keyPrefix}${st}${ht}`):pt=rt.keyPrefix?`${rt.keyPrefix}${st}${tt}`:tt,_e.t(pt,rt)};return typeof o=="string"?et.lng=o:et.lngs=o,et.ns=j,et.keyPrefix=$,et}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(o){this.options.defaultNS=o}hasLoadedNamespace(o){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const $=j.lng||this.resolvedLanguage||this.languages[0],_e=this.options?this.options.fallbackLng:!1,et=this.languages[this.languages.length-1];if($.toLowerCase()==="cimode")return!0;const tt=(nt,rt)=>{const it=this.services.backendConnector.state[`${nt}|${rt}`];return it===-1||it===2};if(j.precheck){const nt=j.precheck(this,tt);if(nt!==void 0)return nt}return!!(this.hasResourceBundle($,o)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||tt($,o)&&(!_e||tt(et,o)))}loadNamespaces(o,j){const $=defer();return this.options.ns?(typeof o=="string"&&(o=[o]),o.forEach(_e=>{this.options.ns.indexOf(_e)<0&&this.options.ns.push(_e)}),this.loadResources(_e=>{$.resolve(),j&&j(_e)}),$):(j&&j(),Promise.resolve())}loadLanguages(o,j){const $=defer();typeof o=="string"&&(o=[o]);const _e=this.options.preload||[],et=o.filter(tt=>_e.indexOf(tt)<0);return et.length?(this.options.preload=_e.concat(et),this.loadResources(tt=>{$.resolve(),j&&j(tt)}),$):(j&&j(),Promise.resolve())}dir(o){if(o||(o=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!o)return"rtl";const j=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],$=this.services&&this.services.languageUtils||new LanguageUtil(get());return j.indexOf($.getLanguagePartFromCode(o))>-1||o.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},j=arguments.length>1?arguments[1]:void 0;return new I18n(o,j)}cloneInstance(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:noop;const $=o.forkResourceStore;$&&delete o.forkResourceStore;const _e={...this.options,...o,isClone:!0},et=new I18n(_e);return(o.debug!==void 0||o.prefix!==void 0)&&(et.logger=et.logger.clone(o)),["store","services","language"].forEach(nt=>{et[nt]=this[nt]}),et.services={...this.services},et.services.utils={hasLoadedNamespace:et.hasLoadedNamespace.bind(et)},$&&(et.store=new ResourceStore(this.store.data,_e),et.services.resourceStore=et.store),et.translator=new Translator(et.services,_e),et.translator.on("*",function(nt){for(var rt=arguments.length,it=new Array(rt>1?rt-1:0),at=1;at()=>{if(i.isInitialized)o();else{const j=()=>{setTimeout(()=>{i.off("initialized",j)},0),o()};i.on("initialized",j)}};function loadNamespaces(i,o,j){i.loadNamespaces(o,loadedClb(i,j))}function loadLanguages(i,o,j,$){typeof j=="string"&&(j=[j]),j.forEach(_e=>{i.options.ns.indexOf(_e)<0&&i.options.ns.push(_e)}),i.loadLanguages(o,loadedClb(i,$))}function oldI18nextHasLoadedNamespace(i,o){let j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const $=o.languages[0],_e=o.options?o.options.fallbackLng:!1,et=o.languages[o.languages.length-1];if($.toLowerCase()==="cimode")return!0;const tt=(nt,rt)=>{const it=o.services.backendConnector.state[`${nt}|${rt}`];return it===-1||it===2};return j.bindI18n&&j.bindI18n.indexOf("languageChanging")>-1&&o.services.backendConnector.backend&&o.isLanguageChangingTo&&!tt(o.isLanguageChangingTo,i)?!1:!!(o.hasResourceBundle($,i)||!o.services.backendConnector.backend||o.options.resources&&!o.options.partialBundledLanguages||tt($,i)&&(!_e||tt(et,i)))}function hasLoadedNamespace(i,o){let j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!o.languages||!o.languages.length?(warnOnce("i18n.languages were undefined or empty",o.languages),!0):o.options.ignoreJSONStructure!==void 0?o.hasLoadedNamespace(i,{lng:j.lng,precheck:(_e,et)=>{if(j.bindI18n&&j.bindI18n.indexOf("languageChanging")>-1&&_e.services.backendConnector.backend&&_e.isLanguageChangingTo&&!et(_e.isLanguageChangingTo,i))return!1}}):oldI18nextHasLoadedNamespace(i,o,j)}const matchHtmlEntity=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,htmlEntities={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},unescapeHtmlEntity=i=>htmlEntities[i],unescape=i=>i.replace(matchHtmlEntity,unescapeHtmlEntity);let defaultOptions={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape};function setDefaults(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};defaultOptions={...defaultOptions,...i}}function getDefaults(){return defaultOptions}let i18nInstance;function setI18n(i){i18nInstance=i}function getI18n(){return i18nInstance}const initReactI18next={type:"3rdParty",init(i){setDefaults(i.options.react),setI18n(i)}},I18nContext=reactExports.createContext();class ReportNamespaces{constructor(){this.usedNamespaces={}}addUsedNamespaces(o){o.forEach(j=>{this.usedNamespaces[j]||(this.usedNamespaces[j]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const usePrevious=(i,o)=>{const j=reactExports.useRef();return reactExports.useEffect(()=>{j.current=o?j.current:i},[i,o]),j.current};function useTranslation(i){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:j}=o,{i18n:$,defaultNS:_e}=reactExports.useContext(I18nContext)||{},et=j||$||getI18n();if(et&&!et.reportNamespaces&&(et.reportNamespaces=new ReportNamespaces),!et){warnOnce("You will need to pass in an i18next instance by using initReactI18next");const lt=(gt,kt)=>typeof kt=="string"?kt:kt&&typeof kt=="object"&&typeof kt.defaultValue=="string"?kt.defaultValue:Array.isArray(gt)?gt[gt.length-1]:gt,ft=[lt,{},!1];return ft.t=lt,ft.i18n={},ft.ready=!1,ft}et.options.react&&et.options.react.wait!==void 0&&warnOnce("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const tt={...getDefaults(),...et.options.react,...o},{useSuspense:nt,keyPrefix:rt}=tt;let it=i||_e||et.options&&et.options.defaultNS;it=typeof it=="string"?[it]:it||["translation"],et.reportNamespaces.addUsedNamespaces&&et.reportNamespaces.addUsedNamespaces(it);const at=(et.isInitialized||et.initializedStoreOnce)&&it.every(lt=>hasLoadedNamespace(lt,et,tt));function ct(){return et.getFixedT(o.lng||null,tt.nsMode==="fallback"?it:it[0],rt)}const[st,pt]=reactExports.useState(ct);let ht=it.join();o.lng&&(ht=`${o.lng}${ht}`);const dt=usePrevious(ht),yt=reactExports.useRef(!0);reactExports.useEffect(()=>{const{bindI18n:lt,bindI18nStore:ft}=tt;yt.current=!0,!at&&!nt&&(o.lng?loadLanguages(et,o.lng,it,()=>{yt.current&&pt(ct)}):loadNamespaces(et,it,()=>{yt.current&&pt(ct)})),at&&dt&&dt!==ht&&yt.current&&pt(ct);function gt(){yt.current&&pt(ct)}return lt&&et&&et.on(lt,gt),ft&&et&&et.store.on(ft,gt),()=>{yt.current=!1,lt&&et&<.split(" ").forEach(kt=>et.off(kt,gt)),ft&&et&&ft.split(" ").forEach(kt=>et.store.off(kt,gt))}},[et,ht]);const ot=reactExports.useRef(!0);reactExports.useEffect(()=>{yt.current&&!ot.current&&pt(ct),ot.current=!1},[et,rt]);const ut=[st,et,at];if(ut.t=st,ut.i18n=et,ut.ready=at,at||!at&&!nt)return ut;throw new Promise(lt=>{o.lng?loadLanguages(et,o.lng,it,()=>lt()):loadNamespaces(et,it,()=>lt())})}const demoMode$2="Demo mode",bot$2="bot",cancel$2="Cancel",back$2="Back",close$2="Close",addMore$2="Add more",addEveryone$2="Add everyone",next$2="Next",apply$3="Apply",save$2="Save",addComment$2="Add comment",yourComment$2="Your comment...",message$2="Message",addUsers$2="Add users",matchUsers$2="Match names",willBeSaved$2="I'll remember the names later",paid$2="paid",owes$2="owes",select$2="please select...",author$2="author",added$2="added",addUser$2="Add user",pleaseMatchUsers$2="Match users",pleaseAddUsers$2="Add users",selectWhoIs$2="Select who is",selectUser$2="Select user",checkout$2="Checkout",selectCurrency$2="Select currency",lack$2="Lack",allRight$2="All right",overdo$2="Overdo",unbalanced$2="The sum above is not equal to the sum below. So I can't record the transaction.",paidSum$2="Paid",oweSum$2="owe",whoPaid$2="Who paid",forWhom$2="For whoom",selectAll$2="Select all",unselectAll$2="Unselect all",splitEqually$2="Split equally",noShares$2="Nobody here",checkAmounts$2="Check amounts",groupBalances$1="Group balances",settleUpBy$1="Settle up by",detailedSummary$1="Detailed summary",summaryBy$1="Summary by",settleUp$1="Settle up",settleUpSaved$1="Transaction successfully saved!",allSettledUp$1="You are all settled up in this group",convertAllTo$2="Convert all to",featureSoon$2="This feature will be available soon",okay$2="Okay",translationEn={demoMode:demoMode$2,bot:bot$2,cancel:cancel$2,back:back$2,close:close$2,delete:"Delete",addMore:addMore$2,addEveryone:addEveryone$2,next:next$2,apply:apply$3,save:save$2,addComment:addComment$2,yourComment:yourComment$2,message:message$2,addUsers:addUsers$2,matchUsers:matchUsers$2,willBeSaved:willBeSaved$2,paid:paid$2,owes:owes$2,select:select$2,author:author$2,added:added$2,addUser:addUser$2,pleaseMatchUsers:pleaseMatchUsers$2,pleaseAddUsers:pleaseAddUsers$2,selectWhoIs:selectWhoIs$2,selectUser:selectUser$2,checkout:checkout$2,selectCurrency:selectCurrency$2,lack:lack$2,allRight:allRight$2,overdo:overdo$2,unbalanced:unbalanced$2,paidSum:paidSum$2,oweSum:oweSum$2,whoPaid:whoPaid$2,forWhom:forWhom$2,selectAll:selectAll$2,unselectAll:unselectAll$2,splitEqually:splitEqually$2,noShares:noShares$2,checkAmounts:checkAmounts$2,groupBalances:groupBalances$1,settleUpBy:settleUpBy$1,detailedSummary:detailedSummary$1,summaryBy:summaryBy$1,settleUp:settleUp$1,settleUpSaved:settleUpSaved$1,allSettledUp:allSettledUp$1,convertAllTo:convertAllTo$2,featureSoon:featureSoon$2,okay:okay$2},demoMode$1="Демо-режим",bot$1="бот",cancel$1="Отмена",back$1="Назад",close$1="Закрыть",addMore$1="Добавить ещё",addEveryone$1="Добавить всех",next$1="Далее",apply$2="Применить",save$1="Сохранить",addComment$1="Добавьте комментарий",yourComment$1="Ваш комментарий...",message$1="Сообщение",addUsers$1="Добавьте людей",matchUsers$1="Соотнесите людей",willBeSaved$1="Со временем я запомню соотношения",paid$1="заплатил",owes$1="должен",select$1="выберите...",author$1="автор",added$1="доп.",addUser$1="Добавить человека",pleaseMatchUsers$1="Выберите людей",pleaseAddUsers$1="Добавьте людей",selectWhoIs$1="Выберите, кто",selectUser$1="Выберите",checkout$1="Проверить траты",selectCurrency$1="Выберите валюту",lack$1="Не хватает",allRight$1="Всё верно",overdo$1="Перебор",unbalanced$1="Cумма сверху не равна сумме снизу. Поэтому я не могу записать трату.",paidSum$1="Заплатили",oweSum$1="должны",whoPaid$1="Кто платил",forWhom$1="За кого платили",selectAll$1="Выбрать всех",unselectAll$1="Очистить выбор",splitEqually$1="Разделить поровну",noShares$1="Пусто",checkAmounts$1="Проверьте траты",groupBalances="Баланс группы",settleUpBy="Рассчитаться по",detailedSummary="Детализация",summaryBy="Итог по",settleUp="Рассчитаться",settleUpSaved="Транзакция успешно сохранена!",allSettledUp="Все рассчитались в этой группе",convertAllTo$1="Перевести всё в",featureSoon$1="Эта функция скоро станет доступна",okay$1="Хорошо",translationRu={demoMode:demoMode$1,bot:bot$1,cancel:cancel$1,back:back$1,close:close$1,delete:"Удалить",addMore:addMore$1,addEveryone:addEveryone$1,next:next$1,apply:apply$2,save:save$1,addComment:addComment$1,yourComment:yourComment$1,message:message$1,addUsers:addUsers$1,matchUsers:matchUsers$1,willBeSaved:willBeSaved$1,paid:paid$1,owes:owes$1,select:select$1,author:author$1,added:added$1,addUser:addUser$1,pleaseMatchUsers:pleaseMatchUsers$1,pleaseAddUsers:pleaseAddUsers$1,selectWhoIs:selectWhoIs$1,selectUser:selectUser$1,checkout:checkout$1,selectCurrency:selectCurrency$1,lack:lack$1,allRight:allRight$1,overdo:overdo$1,unbalanced:unbalanced$1,paidSum:paidSum$1,oweSum:oweSum$1,whoPaid:whoPaid$1,forWhom:forWhom$1,selectAll:selectAll$1,unselectAll:unselectAll$1,splitEqually:splitEqually$1,noShares:noShares$1,checkAmounts:checkAmounts$1,groupBalances,settleUpBy,detailedSummary,summaryBy,settleUp,settleUpSaved,allSettledUp,convertAllTo:convertAllTo$1,featureSoon:featureSoon$1,okay:okay$1},demoMode="Демо-режим",bot="бот",cancel="Відміна",back="Назад",close="Закрити",addMore="Додати ще",addEveryone="Додати всіх",next="Далі",apply$1="Застосувати",save="Зберегти",addComment="Додати коментар",yourComment="Ваш коментар...",message="Повідомлення",addUsers="Додайте людей",matchUsers="Співвіднесіть людей",willBeSaved="З часом я запам'ятаю співвідношення",paid="оплатив",owes="повинен",select="оберіть…",author="автор",added="дод.",addUser="Додати людину",pleaseMatchUsers="Виберіть людей",pleaseAddUsers="Додати людей",selectWhoIs="Оберіть хто",selectUser="Оберіть",checkout="Перевірити витрати",selectCurrency="Оберіть валюту",lack="Не вистачає",allRight="Все вірно",overdo="Перебір",unbalanced="Сума зверху не дорівнює сумі знизу. Тому я не можу записати витрати.",paidSum="Оплатили",oweSum="винні",whoPaid="Хто платив",forWhom="За кого платили",selectAll="Вибрати всіх",unselectAll="Очистити вибір",splitEqually="Розділити порівну",noShares="Пусто",checkAmounts="Перевірте витрати",convertAllTo="Перевести всё в",featureSoon="Ця функція незабаром стане доступною",okay="Добре",translationUk={demoMode,bot,cancel,back,close,delete:"Видалити",addMore,addEveryone,next,apply:apply$1,save,addComment,yourComment,message,addUsers,matchUsers,willBeSaved,paid,owes,select,author,added,addUser,pleaseMatchUsers,pleaseAddUsers,selectWhoIs,selectUser,checkout,selectCurrency,lack,allRight,overdo,unbalanced,paidSum,oweSum,whoPaid,forWhom,selectAll,unselectAll,splitEqually,noShares,checkAmounts,convertAllTo,featureSoon,okay};instance.use(initReactI18next).init({lng:"en",fallbackLng:["en","ru","uk"],supportedLngs:["en","ru","uk"],debug:!0,resources:{en:{translation:translationEn},ru:{translation:translationRu},uk:{translation:translationUk}}});const useInit=()=>{const{txId:i,setTxId:o,summaryId:j,setSummaryId:$,chat:_e,transaction:et,setTransaction:tt,isAuthorSharesInited:nt,setIsAuthorSharesInited:rt}=useStore(),it=useLocation(),[at]=M(),{users:ct,getUserById:st,addUsers:pt}=useUsers(),ht=new URLSearchParams(it.search),dt=ht.get("txid"),yt=ht.get("summaryid"),ot=at.start_param;let ut,lt;it.pathname==="/summary"?lt=ot:ut=ot,i===void 0&&o(dt||ut||null),j===void 0&&$(yt||lt||null),reactExports.useEffect(()=>{if(!nt&&at.user&&et&&et.creator_user_id===null&&et.shares.length===0&&ct.length){const ft=at.user.id;console.log("author: 0 shares, userId =",ft,"users",ct.length,ct);const gt=st(ft);console.log("author user =",gt),gt&&(console.log("author: user found"),console.log("setIsAuthorSharesInited",!0),rt(!0),console.log("author: tx...",JSON.stringify(et)),setInterval(()=>{console.log("author interval: addUsers..."),pt([gt],{isAuthor:!0})},1e3),setInterval(()=>{console.log("author interval: upd creator_user_id..."),tt({...et,creator_user_id:ft})},1e4))}},[et,ct,at,nt,rt,st,pt,tt]),reactExports.useEffect(()=>{console.log("author: tx changed",JSON.stringify(et))},[et]),_e!=null&&_e.language_code&&_e.language_code!==instance.language&&instance.languages.includes(_e.language_code)&&instance.changeLanguage(_e.language_code)},mockCurrencies$1=[{_id:"RUB",symbol:"₽",title:"Рубль",in:"В рублях"},{_id:"GEL",symbol:"₾",title:"Лари",in:"В лари"},{_id:"TRY",symbol:"₺",title:"Лира",in:"В лирах"},{_id:"EUR",symbol:"€",title:"Евро",in:"В евро"},{_id:"USD",symbol:"$",title:"Доллар",in:"В долларах"},{_id:"GBP",symbol:"£",title:"Фунт",in:"В фунтах"},{_id:"UAH",symbol:"₴",title:"Гривна",in:"В гривнах"},{_id:"BYN",symbol:"Br",title:"Бел. рубль",in:"В бел. рублях"},{_id:"KZT",symbol:"₸",title:"Тенге",in:"В тенге"},{_id:"CNY",symbol:"¥",title:"Юань",in:"В юанях"},{_id:"JPY",symbol:"¥",title:"Иена",in:"В иенах"},{_id:"CHF",symbol:"₣",title:"Франк",in:"В франках"},{_id:"CAD",symbol:"$",title:"Кан. доллар",in:"В кан. долларах"},{_id:"AUD",symbol:"$",title:"Австр. доллар",in:"В австр. долларах"},{_id:"NZD",symbol:"$",title:"Нов. доллар",in:"В нов. долларах"},{_id:"AZN",symbol:"₼",title:"Азерб. манат",in:"В азерб. манатах"},{_id:"AMD",symbol:"֏",title:"Арм. драм",in:"В арм. драмах"},{_id:"KGS",symbol:"с",title:"Сом",in:"В сомах"},{_id:"RSD",symbol:"дин",title:"Динар",in:"В динарах"},{_id:"BGN",symbol:"лв",title:"Лев",in:"В левах"}],decimals=2,visible_decimals=2,avatar0="/CalcKoala-webapp/assets/avatar-0-6b7a4992.jpg",avatar1="/CalcKoala-webapp/assets/avatar-1-07738e43.jpg",avatar2="/CalcKoala-webapp/assets/avatar-2-e805addc.jpg",avatar3="/CalcKoala-webapp/assets/avatar-3-43e75752.jpg",avatar4="/CalcKoala-webapp/assets/avatar-4-12297858.jpg",transliterate=i=>{const o={Ё:"YO",Й:"I",Ц:"TS",У:"U",К:"K",Е:"E",Н:"N",Г:"G",Ш:"SH",Щ:"SCH",З:"Z",Х:"H",Ъ:"",ё:"yo",й:"i",ц:"ts",у:"u",к:"k",е:"e",н:"n",г:"g",ш:"sh",щ:"sch",з:"z",х:"h",ъ:"",Ф:"F",Ы:"I",В:"V",А:"A",П:"P",Р:"R",О:"O",Л:"L",Д:"D",Ж:"ZH",Э:"E",ф:"f",ы:"i",в:"v",а:"a",п:"p",р:"r",о:"o",л:"l",д:"d",ж:"zh",э:"e",Я:"Ya",Ч:"CH",С:"S",М:"M",И:"I",Т:"T",Ь:"",Б:"B",Ю:"YU",я:"ya",ч:"ch",с:"s",м:"m",и:"i",т:"t",ь:"",б:"b",ю:"yu"};return i.split("").map(j=>o[j]||j).join("")},generateUser=i=>({_id:Math.round(Math.random()*1e10),first_name:i,last_name:i,username:Math.random()>.2?transliterate(i).toLowerCase():void 0,profile_photo:Math.random()<.5?null:`https://i.pravatar.cc/48/${Math.round(Math.random()*1e10)}`,_name:i}),generateName=()=>{const i=instance.language==="ru"?["Александр","Дмитрий","Максим","Сергей","Андрей","Алексей","Артём","Илья","Кирилл","Михаил","Никита","Матвей","Роман","Егор","Арсений","Иван","Денис","Евгений","Тимофей","Владислав","Игорь","Владимир","Павел","Руслан","Марк","Константин","Тимур","Олег","Ярослав","Антон","Николай","Данил","Анастасия","Мария","Анна","Виктория","Екатерина","Наталья","Марина","Полина","София","Дарья","Алиса","Ксения","Александра","Елена"]:["Isabelle","Louis","Tariq","Joyce","Zaid","Mary","Rufus","Ishaq","Lucy","Vinnie","Amelie","Jaydon","Beth","Zackary","Scott","Rhonda","Gilbert","Ayla","Dale","Moshe","Jon","Sylvie","Grover","Neil","Lukas","Amber","Shreya","Evan","Lucinda","Kareem","Reid","Owain","Liberty","Cordelia","Tony","Ophelia","Maeve","Yasir","Gary","Daniella","Keira","Umar","Sally","Oskar","Lucia","Dewi","Bethany","Marco","Amna","Micheal"];return i[Math.floor(Math.random()*i.length)]},generateNames=i=>{const o=[];do{const j=generateName();o.includes(j)||o.push(j)}while(o.length!==i);return o},_names=generateNames(6),_mockUsers=_names.map(i=>generateUser(i)),shares=_mockUsers.slice(0,4).map((i,o)=>({person_id:`Person${o}`,raw_name:i._name||"",normalized_name:i._name||"",related_user_id:Math.random()>.3?i._id:null,is_payer:o==0,amount:parseFloat((Math.round(Math.random()*1e4)/10**decimals).toFixed(decimals)),user_candidates:null}));shares.splice(1,0,{...shares[0],amount:parseFloat((shares[0].amount/3).toFixed(decimals)),is_payer:!1});shares.map(i=>`${i.normalized_name} ${i.is_payer?instance.t("paid"):instance.t("owes")} ${i.amount}`).join(", "),shares.map(i=>`${i.normalized_name} ${i.is_payer?instance.t("paid"):instance.t("owes")} ${i.amount}`).join(", "),mockCurrencies$1[0]._id;mockCurrencies$1[0]._id;const mockSummary={debts:[],url:"https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit",chat_id:0};Math.random()>.25&&_mockUsers.forEach((i,o,j)=>{oАнтон заплатил 4500 рублей за Пашу, Егора, Дашу и Карима в ресторане. Егор оставил 700 рублей чаевыми. Делим счёт поровну.":"Anton paid 45 dollars for Pavel, George, Dasha and Karim in restaurant. George left 10 dollars tips. Split bill equally.",is_confirmed:!1,currency_id:isRus?"RUB":"USD",shares:[{person_id:"Person-1",raw_name:demoUsers[1].first_name,normalized_name:demoUsers[1].first_name,related_user_id:demoUsers[1]._id,is_payer:!0,amount:isRus?4500:45,user_candidates:null},{person_id:"Person-2",raw_name:demoUsers[2].first_name,normalized_name:demoUsers[2].first_name,related_user_id:demoUsers[2]._id,is_payer:!0,amount:isRus?700:10,user_candidates:null},{person_id:"Person-0",raw_name:demoUsers[0].first_name,normalized_name:demoUsers[0].first_name,related_user_id:demoUsers[0]._id,is_payer:!1,amount:isRus?1040:11,user_candidates:null},{person_id:"Person-2",raw_name:demoUsers[2].first_name,normalized_name:demoUsers[2].first_name,related_user_id:demoUsers[2]._id,is_payer:!1,amount:isRus?1040:11,user_candidates:null},{person_id:"Person-3",raw_name:demoUsers[3].first_name,normalized_name:demoUsers[3].first_name,related_user_id:demoUsers[3]._id,is_payer:!1,amount:isRus?1040:11,user_candidates:null},{person_id:"Person-4",raw_name:demoUsers[4].first_name,normalized_name:demoUsers[4].first_name,related_user_id:demoUsers[4]._id,is_payer:!1,amount:isRus?1040:11,user_candidates:null},{person_id:"Person-1",raw_name:demoUsers[1].first_name,normalized_name:demoUsers[1].first_name,related_user_id:demoUsers[1]._id,is_payer:!1,amount:isRus?1040:11,user_candidates:null}]},demoChat={_id:0,name:"demo chat name",summary_id:"demo summary id",default_currency:isRus?"RUB":"USD",status:"administrator",welcome_message_id:-1,menu_message_id:-1,pin_message_id:-1,language_code:tgLanguageCode},mockUsers=demoUsers,mockTransaction=demoTransaction,mockChat=demoChat,apiUrl$1="https://104.248.87.96.sslip.io",staleTime=5*60*1e3,handleJsonResponse=i=>{if(!i.ok)throw new Error(`[${i.status}] ${i.statusText}`);return i.json()},useGetTx=()=>{const[,i]=M(),{setTransaction:o,txId:j}=useStore();return console.log("useGetTx txId",j),useQuery({queryKey:["tx",`tx-${j}`],queryFn:j?()=>fetch(`${apiUrl$1}/transactions/${j}`,{method:"GET",headers:{Authorization:i}}).then(handleJsonResponse):()=>mockTransaction,onSuccess:$=>{console.log("useApi: set tx",$),o($)},staleTime})},useGetUsers=i=>{const[,o]=M(),{setUsers:j}=useStore();return useQuery({queryKey:["users",`chat-${i}`],queryFn:i?()=>fetch(`${apiUrl$1}/chats/${i}/users`,{method:"GET",headers:{Authorization:o}}).then(handleJsonResponse):()=>mockUsers,onSuccess:$=>{console.log("useApi: set users",$),j($)},enabled:i!==void 0,staleTime})},useGetChat=i=>{const[,o]=M(),{setChat:j}=useStore();return useQuery({queryKey:["chat",`chat-${i}`],queryFn:i?()=>fetch(`${apiUrl$1}/chats/${i}`,{method:"GET",headers:{Authorization:o}}).then(handleJsonResponse):()=>mockChat,onSuccess:$=>{console.log("useApi: set chat",$),j($)},enabled:i!==void 0,staleTime})},useGetCurrencies=i=>{const[,o]=M(),{setCurrencies:j}=useStore();return useQuery({queryKey:["currencies"],queryFn:()=>fetch(`${apiUrl$1}/currencies/`,{method:"GET",headers:{Authorization:o}}).then(handleJsonResponse),onSuccess:$=>{console.log("useApi: set currencies",$),j($)},enabled:i!==void 0,staleTime})},usePutTransaction=()=>{const[,i]=M(),{txId:o}=useStore(),j=o?`${apiUrl$1}/transactions/${o}`:"https://jsonplaceholder.typicode.com/posts/1";return $=>fetch(j,{method:"PUT",body:JSON.stringify($),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},usePostTransaction=()=>{const[,i]=M(),{summaryId:o}=useStore(),j=o?`${apiUrl$1}/transactions/`:"https://jsonplaceholder.typicode.com/posts";return $=>fetch(j,{method:"POST",body:JSON.stringify($),headers:{"Content-type":"application/json",Authorization:i}}).then(handleJsonResponse)},useGetSummary=()=>{const[,i]=M(),{setSummary:o,summaryId:j}=useStore();return console.log("useGetSummary summaryId",j),useQuery({queryKey:["summary",`summary-${j}`],queryFn:j?()=>fetch(`${apiUrl$1}/summary/${j}`,{method:"GET",headers:{Authorization:i}}).then(handleJsonResponse):()=>mockSummary,onSuccess:$=>{console.log("useGetSummary: setSummary",$),o($)},staleTime})},useSplash=()=>{const{isLoading:i,error:o,data:j}=useGetTx(),{isLoading:$,error:_e,data:et}=useGetSummary(),tt=(j?j.chat_id:void 0)||(et?et.chat_id:void 0),{isLoading:nt,error:rt}=useGetUsers(tt),{isLoading:it,error:at}=useGetChat(tt),{isLoading:ct,error:st}=useGetCurrencies(tt),pt=i||nt||it||ct||$,{currencies:ht,txPatchError:dt}=useStore(),yt=j!=null&&j.currency_id&&ht.length&&!ht.find(ut=>ut._id===j.currency_id)?new Error(`Unknown tx currency ${j.currency_id}`):null;return{isLoading:pt,error:o||rt||at||dt||st||yt||_e}},useTheme=()=>{const[i]=C(),o=()=>{var rt;const et=((rt=window.Telegram)==null?void 0:rt.WebApp.colorScheme)==="dark"||i==="dark"||window.matchMedia("(prefers-color-scheme: dark)").matches,tt=["theme-dark","dark"],nt=["theme-light","light"];return document.body.classList.add(...et?tt:nt),document.body.classList.remove(...et?nt:tt),et},[j,$]=reactExports.useState(o()),_e=()=>{$(o())};return window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",_e),{isDark:j}},useUsers=()=>{const{users:i,transaction:o,setTransaction:j,selectPersonId:$}=useStore(),[_e,,et]=b(),tt=(o==null?void 0:o.shares)||[],nt=tt.map(ot=>ot.related_user_id),rt=i.filter(ot=>!nt.includes(ot._id)),it=[...new Set(tt.filter(ot=>!(ot.related_user_id&&i.find(ut=>ut._id===ot.related_user_id))).map(ot=>ot.person_id))].length,at=it===0,ct=tt.length>1;return{users:i,unrelatedUsers:rt,countUnrelatedPersons:it,isRelationsComplete:at,isRelationsEnough:ct,getUserById:ot=>i.find(ut=>ut._id===ot),selectUser:ot=>()=>{if($!==null){const ut=[...tt],lt=[];for(let ft=0;ft()=>{if(console.log("> addUsers",ot),$===null){const lt=tt.some(kt=>kt.is_payer);console.log("> addUsers wasPayers",lt);const ft=({isPayer:kt})=>xt=>({person_id:ut?"MESSAGE_AUTHOR":`added-person-user-${xt._id}`,raw_name:null,normalized_name:ut?"MESSAGE_AUTHOR":null,is_payer:kt,amount:0,user_candidates:null,related_user_id:xt._id}),gt=[...tt,...lt?[]:[ft({isPayer:!0})(ot[0])],...ot.map(ft({isPayer:!1}))];console.log("> addUsers transaction",o),o&&(console.log("> addUsers updShares",gt),j({...o,shares:gt}))}console.log("addUsers vibro"),et(),_e("light"),history.back()},updUsers:(ot,ut)=>()=>{if(console.log("updUsers",i),ut!==null){const lt=[...tt].filter(kt=>!(kt.is_payer===ut&&kt.related_user_id!==null&&!ot.includes(kt.related_user_id))),ft=ot.filter(kt=>!tt.find(xt=>xt.is_payer===ut&&xt.related_user_id!==null&&kt===xt.related_user_id)),gt=[...lt,...ft.map(kt=>({person_id:`added-person-user-${kt}`,raw_name:null,normalized_name:null,is_payer:ut,amount:0,user_candidates:null,related_user_id:kt}))];o&&j({...o,shares:gt})}console.log("updUsers vibro"),et(),_e("light"),history.back()},deleteUser:ot=>()=>{const ut=[...tt].filter(lt=>lt.person_id!==ot);o&&j({...o,shares:ut}),history.back()}}},SvgPlus=i=>reactExports.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},reactExports.createElement("path",{d:"M8 1C8 0.447715 7.55228 0 7 0C6.44772 0 6 0.447715 6 1V6H1C0.447715 6 0 6.44771 0 7C0 7.55228 0.447715 8 1 8H6V13C6 13.5523 6.44772 14 7 14C7.55228 14 8 13.5523 8 13V8H13C13.5523 8 14 7.55228 14 7C14 6.44772 13.5523 6 13 6H8V1Z",fill:"currentColor"}));var classnames={exports:{}};/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames diff --git a/index.html b/index.html index 5173db4..e52e2b9 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,7 @@ - +