UNPKG

@voerkai18n/runtime

Version:
8 lines 39.8 kB
/*** * ---=== VoerkaI18n Runtime ===--- * https://zhangfisher.github.io/voerka-i18n/* */ var Le=Object.defineProperty;var at=(s,e,t)=>e in s?Le(s,e,{enumerable:true,configurable:true,writable:true,value:t}):s[e]=t;var o=(s,e)=>Le(s,"name",{value:e,configurable:true}),_=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var h=(s,e,t)=>at(s,typeof e!="symbol"?e+"":e,t);var S,Me=(S=class{constructor(e){this._listeners=new Map,this._lastMessage={},this.options=Object.assign({ignoreError:false},e);}get listeners(){return this._listeners}on(){let e=arguments[0],t=arguments[1],r=arguments[2],{objectify:n=true,count:i=-1}=Object.assign({},r);this._listeners.has(e)||this._listeners.set(e,new Map);let a=++S.listenerSeqId,l=this._listeners.get(e);return l?.set(a,[t,i]),this._emitRetainEvent(e,a,l),n?{off:o(()=>{l?.delete(a),l?.size==0&&this._listeners.delete(e);},"off")}:a}onAny(e,t){return this.on("*",e,t)}_emitRetainEvent(e,t,r){e in this._lastMessage&&this._executeListener(t,r,this._lastMessage[e]);}once(e,t,r){return this.on(e,t,Object.assign({},r,{count:1}))}_forEachListeners(e){let t=false;for(let[r,n]of this._listeners.entries()){if(t)break;for(let[i,[a,l]]of n.entries()){if(t)break;t=e({event:r,listenerId:i,listener:a,count:l,eventListeners:n})===false;}}}_forEachEventListeners(e,t){let r=false,n=[[e,this._listeners.get(e)]];for(let[i,a]of n)if(a)for(let[l,[c,u]]of a){if(r)break;r=t({event:i,listenerId:l,listener:c,count:u,eventListeners:a})===false;}}off(){if(arguments.length==1){if(typeof arguments[0]=="number")this._forEachListeners(({listenerId:e,eventListeners:t,event:r})=>{if(e==arguments[0])return t.delete(e),this._listeners.get(r)?.size==0&&this._listeners.delete(r),false});else if(typeof arguments[0]=="function"){let e=arguments[0];this._forEachListeners(({listenerId:t,listener:r,eventListeners:n,event:i})=>{r==e&&(n.delete(t),this._listeners.get(i)?.size==0&&this._listeners.delete(i));});}}else arguments.length==2&&typeof arguments[0]=="string"&&typeof arguments[1]=="function"&&this._forEachEventListeners(arguments[0],({event:e,listenerId:t,listener:r,eventListeners:n})=>{e==arguments[0]&&r==arguments[1]&&(n.delete(t),this._listeners.get(e)?.size==0&&this._listeners.delete(e));});}waitFor(e,t=0){return new Promise((r,n)=>{let i,a=false,l;t>0&&(i=setTimeout(()=>{a=true,this.off(l),n(new Error("Timeout"));},t)),l=this.once(e,c=>{a||(clearTimeout(i),r(c));});})}offAll(e){e?this._listeners.delete(e):this._listeners.clear();}_executeListener(e,t,r){if(!t)return;let n=t.get(e);if(n)try{return n[0](r)}catch(i){if(!this.options.ignoreError)throw i}finally{n[1]>-1&&(n[1]=n[1]-1,n[1]==0&&t.delete(e));}}_executeListeners(e,t,r){let n=[];return this._forEachEventListeners(e,({event:i,listenerId:a,eventListeners:l})=>{n.push(this._executeListener(a,l,t)),typeof r=="function"&&r(a),l.size==0&&this._listeners.delete(i);}),n}emit(e,t,r){return r&&(this._lastMessage[e]=t),this._executeListeners(e,t)}async emitAsync(e,t,r){return await Promise.allSettled(this.emit(e,t,r))}},o(S,"l"),S);Me.listenerSeqId=0;var q=Me;(s=>typeof _<"u"?_:typeof Proxy<"u"?new Proxy(s,{get:o((e,t)=>(typeof _<"u"?_:e)[t],"get")}):s)(function(s){if(typeof _<"u")return _.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});function Ae(){return Date.now().toString()+parseInt(String(Math.random()*1e3))}o(Ae,"getId");function L(s,e=false){if(typeof s=="number")return true;if(typeof s!="string"||e)return false;try{if(s.includes(".")){let t=parseFloat(s);return s.endsWith(".")?!isNaN(t)&&String(t).length===s.length-1:!isNaN(t)&&String(t).length===s.length}else {let t=parseInt(s);return !isNaN(t)&&String(t).length===s.length}}catch{return false}}o(L,"r");function W(s){return L(s)}o(W,"isMessageId");function je(s){return s&&typeof s=="object"&&s.__VoerkaI18nScope__}o(je,"isI18nScope");async function Te(s){let e=await s.call(this);return e&&"__esModule"in e||Symbol.toStringTag in e?e.default:e}o(Te,"loadAsyncModule");function Ie(s){return s&&typeof s.get=="function"&&typeof s.set=="function"&&typeof s.remove=="function"}o(Ie,"isStorage");async function Fe(s){return (await Promise.allSettled(s)).map(t=>t.status==="fulfilled"?t.value:t.reason)}o(Fe,"execAsyncs");function ie(){try{return typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"}catch{return false}}o(ie,"isBrowser");var E=class E extends q{constructor(t){super();h(this,"__VoerkaI18nManager__",true);h(this,"_scopes",[]);h(this,"_appScope");if(E.instance)return E.instance;if(!t)throw new Error("create VoerkaI18nManager failed, appScope is required");this._registerAppScope(t),this._registerScopes(),this._loadPlugins(),E.instance=this,globalThis.VoerkaI18n=this;}get debug(){return this.scope.debug}get logger(){return this.scope.logger}get scopes(){return this._scopes}get activeLanguage(){return this._appScope.activeLanguage}get defaultLanguage(){return this._appScope.defaultLanguage}get loader(){return this._appScope.loader}get storage(){return this.scope.storage}get languages(){return this.scope.languages}get scope(){return this._appScope}_registerScopes(){let t=globalThis.__VoerkaI18nScopes__;t&&Array.isArray(t)&&t.forEach(r=>this.register(r)),delete globalThis.__VoerkaI18nScopes__;}getScope(t){return this._scopes.find(r=>r.id===t)}_loadPlugins(){let t=globalThis.__VoerkaI18nPlugins__;t&&Array.isArray(t)&&t.forEach(r=>r(this)),delete globalThis.__VoerkaI18nPlugins__;}registerPlugin(t){typeof t=="function"&&t(this);}_registerAppScope(t){this._scopes.push(t),this._appScope=t,this.logger.debug("VoerkaI18nScope<"+t.id+"> is registered as appScope"),this.emitAsync("init",()=>this._appScope.activeLanguage,true);}register(t){if(!je(t))throw new Error("register scope failed, invalid scope");this._scopes.push(t),t.bind(this),this.logger.debug(`VoerkaI18nScope<${t.id}> is registered`);}async change(t){await this._refreshScopes(t);let r=this._appScope.activeLanguage;return this.scope.saveLanguage(),this.emit("change",r,true),this.logger.info("language changed to: "+r),r}async _refreshScopes(t){let r=this._scopes.map(n=>n.refresh(t));await Fe(r);}async refresh(){return await this._refreshScopes(this.activeLanguage)}ready(t,r){return this.waitFor("ready",r).then(n=>{t&&t.call(this,n);})}clearPatchedMessages(){this._scopes.forEach(t=>t.clearPatchedMessages());}hasLanguage(t){return this.languages.findIndex(r=>r.name==t)!=-1}clearLanguage(){this.scope.clearLanguage();}saveLanguage(){this.scope.saveLanguage();}restoreLanguage(){this.scope.restoreLanguage();}};o(E,"VoerkaI18nManager"),h(E,"instance");var M=E;var G={get(s){if(globalThis.localStorage)return globalThis.localStorage.getItem(s)},set(s,e){globalThis.localStorage&&globalThis.localStorage.setItem(s,e);},remove(s){globalThis.localStorage&&globalThis.localStorage.removeItem(s);}};var kr="en",Ce=[{name:"zh",title:"\u4E2D\u6587",default:true,active:true},{name:"en",title:"\u82F1\u6587"}],Nr=["String","Number","Boolean","Object","Array","Function","Error","Symbol","RegExp","Date","Null","Undefined","Set","Map","WeakSet","WeakMap"],Dr=Symbol("VoerkaI18nFormatter"),Vr=Symbol("VoerkaI18nFormatterBuilder"),Rr={debug:true,storage:G,languages:[{name:"zh",title:"\u4E2D\u6587",default:true,active:true},{name:"en",title:"\u82F1\u6587"}]},qr="vt-msg",Wr="data-id",Kr="data-scope";var Ve=o((s,e,t=[])=>{let r=Object.getOwnPropertyDescriptors(e);for(let n of t)delete r[n];Object.defineProperties(s,r);},"copyProps"),A=o((s,e=[s])=>{let t=Object.getPrototypeOf(s);return t===null?e:A(t,[...e,t])},"protoChain"),lt=o((...s)=>{if(s.length===0)return;let e,t=s.map(r=>A(r));for(;t.every(r=>r.length>0);){let r=t.map(i=>i.pop()),n=r[0];if(r.every(i=>i===n))e=n;else break}return e},"nearestCommonProto"),$e=o((s,e,t=[])=>{var r;let n=(r=lt(...s))!==null&&r!==void 0?r:Object.prototype,i=Object.create(n),a=A(n);for(let l of s){let c=A(l);for(let u=c.length-1;u>=0;u--){let f=c[u];a.indexOf(f)===-1&&(Ve(i,f,["constructor",...t]),a.push(f));}}return i.constructor=e,i},"hardMixProtos"),oe=o(s=>s.filter((e,t)=>s.indexOf(e)==t),"unique"),J=o((s,e)=>{let t=e.map(i=>A(i)),r=0,n=true;for(;n;){n=false;for(let i=e.length-1;i>=0;i--){let a=t[i][r];if(a!=null&&(n=true,Object.getOwnPropertyDescriptor(a,s)!=null))return t[i][0]}r++;}},"getIngredientWithProp"),Re=o((s,e=Object.prototype)=>new Proxy({},{getPrototypeOf(){return e},setPrototypeOf(){throw Error("Cannot set prototype of Proxies created by ts-mixer")},getOwnPropertyDescriptor(t,r){return Object.getOwnPropertyDescriptor(J(r,s)||{},r)},defineProperty(){throw new Error("Cannot define new properties on Proxies created by ts-mixer")},has(t,r){return J(r,s)!==void 0||e[r]!==void 0},get(t,r){return (J(r,s)||e)[r]},set(t,r,n){let i=J(r,s);if(i===void 0)throw new Error("Cannot set new properties on Proxies created by ts-mixer");return i[r]=n,true},deleteProperty(){throw new Error("Cannot delete properties on Proxies created by ts-mixer")},ownKeys(){return s.map(Object.getOwnPropertyNames).reduce((t,r)=>r.concat(t.filter(n=>r.indexOf(n)<0)))}}),"proxyMix");o((s,e)=>Re([...s,{constructor:e}]),"softMixProtos");var qe=new WeakMap,ut=o(s=>qe.get(s),"getMixinsForClass"),ft=o((s,e)=>qe.set(s,e),"registerMixins");var ke=o((s,e)=>{var t,r;let n=oe([...Object.getOwnPropertyNames(s),...Object.getOwnPropertyNames(e)]),i={};for(let a of n)i[a]=oe([...(t=s?.[a])!==null&&t!==void 0?t:[],...(r=e?.[a])!==null&&r!==void 0?r:[]]);return i},"mergeObjectsOfDecorators"),Ne=o((s,e)=>{var t,r,n,i;return {property:ke((t=s?.property)!==null&&t!==void 0?t:{},(r=e?.property)!==null&&r!==void 0?r:{}),method:ke((n=s?.method)!==null&&n!==void 0?n:{},(i=e?.method)!==null&&i!==void 0?i:{})}},"mergePropertyAndMethodDecorators"),We=o((s,e)=>{var t,r,n,i,a,l;return {class:oe([...(t=s?.class)!==null&&t!==void 0?t:[],...(r=e?.class)!==null&&r!==void 0?r:[]]),static:Ne((n=s?.static)!==null&&n!==void 0?n:{},(i=e?.static)!==null&&i!==void 0?i:{}),instance:Ne((a=s?.instance)!==null&&a!==void 0?a:{},(l=e?.instance)!==null&&l!==void 0?l:{})}},"mergeDecorators"),ae=new Map,ht=o((...s)=>{var e;let t=new Set,r=new Set([...s]);for(;r.size>0;)for(let n of r){let i=A(n.prototype).map(u=>u.constructor),a=(e=ut(n))!==null&&e!==void 0?e:[],c=[...i,...a].filter(u=>!t.has(u));for(let u of c)r.add(u);t.add(n),r.delete(n);}return [...t]},"findAllConstituentClasses"),gt=o((...s)=>{let e=ht(...s).map(t=>ae.get(t)).filter(t=>!!t);return e.length==0?{}:e.length==1?e[0]:e.reduce((t,r)=>We(t,r))},"deepDecoratorSearch");o((...s)=>{let e=s.map(t=>dt(t));return e.length===0?{}:e.length===1?e[0]:e.reduce((t,r)=>We(t,r))},"directDecoratorSearch");var dt=o(s=>{let e=ae.get(s);return e||(e={},ae.set(s,e)),e},"getDecoratorsForClass");function Ke(...s){var e,t,r;let n=s.map(c=>c.prototype);function a(...c){for(let u of s)Ve(this,new u(...c));}o(a,"MixedClass"),a.prototype=$e(n,a),Object.setPrototypeOf(a,$e(s,null,["prototype"]));let l=a;{let c=gt(...s);for(let u of (e=c?.class)!==null&&e!==void 0?e:[]){let f=u(l);f&&(l=f);}De((t=c?.static)!==null&&t!==void 0?t:{},l),De((r=c?.instance)!==null&&r!==void 0?r:{},l.prototype);}return ft(l,s),l}o(Ke,"Mixin");var De=o((s,e)=>{let t=s.property,r=s.method;if(t)for(let n in t)for(let i of t[n])i(e,n);if(r)for(let n in r)for(let i of r[n])i(e,n,Object.getOwnPropertyDescriptor(e,n));},"applyPropAndMethodDecorators");var le=class le{constructor(){h(this,"_eventEmitter");}_getEventEmitter(){return this.attached?this.manager:(this._eventEmitter||(this._eventEmitter=new q),this._eventEmitter)}on(e,t){return this._getEventEmitter().on(e,t)}once(e,t){return this._getEventEmitter().once(e,t)}off(e,t){return this._getEventEmitter().off(e,t)}waitFor(e,t){return this._getEventEmitter().waitFor(e,t)}async emit(e,t,r){return await this._getEventEmitter().emitAsync(e,t,r)}};o(le,"EventEmitterMixin");var U=le;function y(s){return s&&typeof s=="function"}o(y,"t");function b(s){if(typeof s!="object"||s===null)return false;var e=Object.getPrototypeOf(s);if(e===null)return true;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return e===t}o(b,"o");var j,ze=(j=class extends Error{},o(j,"m"),j),mt=0;function ce(s,e={timeout:0}){let t=false,r=false,n=false,i,a,l=0,c,u=++mt,f=o(function(){clearTimeout(l),t=false,r=false,n=false,c=new Promise((p,x)=>{i=p,a=x;});},"g");f();async function g(p=0,x){if(typeof s=="function"&&s()){t=true;return}return (t||r)&&f(),p>0&&(l=setTimeout(()=>{t=true;try{x instanceof Error?a(x):i(x);}catch{}},p)),n=true,c}return o(g,"o"),g.id=u,g.resolve=p=>{if(clearTimeout(l),!!n&&!(t||r)){if(typeof s=="function"&&s())if(s())i(p);else return;else i(p);t=true;}},g.reject=p=>{clearTimeout(l),n&&(t||r||(a(typeof p=="string"?new Error(p):p instanceof Error?p:new Error),r=true));},g.destroy=()=>{clearTimeout(l),n&&a(new ze),t=false,n=false,r=false,c=null;},g.reset=f,g.isResolved=()=>t,g.isRejected=()=>r,g.isPending=()=>n,g}o(ce,"p");var ue=class ue{constructor(){h(this,"_patching");}_getPatchKey(e){return `voerkai18n_${this.id}_${e}_patched_messages`}clearPatchedMessages(e){if(this.storage){let t=e?[e]:this.languages.map(r=>r.name);for(let r of t)this.storage.remove(this._getPatchKey(r));}}async _patch(e){this._patching=ce(),e||(e=this.activeLanguage),this._restorePatchedMessages(this.activeMessages,e);try{if(y(this.loader)){let t=await this._loadMessagesFromLoader(e);b(t)&&(Object.assign(this._activeMessages,t),this._setPatchedMessages(t,e),this.emit("patched",{language:e,scope:this.id}));}}catch(t){this.logger.warn(`\u4ECE\u8FDC\u7A0B\u52A0\u8F7D\u8BED\u8A00\u8865\u4E01\u5305<${e}>\u65F6\u51FA\u9519: ${t.stack}(scope=${this.id})`);}finally{this._patching?.resolve(),this._patching=void 0;}}_restorePatchedMessages(e,t){let r=this._getPatchedMessages(t);b(r)&&(Object.assign(e,r),this.emit("restore",{language:t,scope:this.id}),this.logger.debug(`\u6210\u529F\u6062\u590D\u8865\u4E01\u8BED\u8A00\u5305<${t}>(scope=${this.id})`));}_setPatchedMessages(e,t){if(!(!this.attached&&!this.storage))try{this.storage&&this.storage.set(this._getPatchKey(t),JSON.stringify(e));}catch(r){this.logger.error(`\u4FDD\u5B58\u8BED\u8A00\u5305\u8865\u4E01(${t})\u65F6\u51FA\u9519: ${r.stack}(scope=${this.id})`);}}_getPatchedMessages(e){try{return this.storage&&this.options.cachePatch?this.storage.get(this._getPatchKey(e)):{}}catch(t){return this.logger.error(`\u8BFB\u53D6\u8BED\u8A00\u5305\u8865\u4E01(${e})\u65F6\u51FA\u9519:${t.stack}(scope=${this.id})`),{}}}};o(ue,"PatchMessageMixin");var H=ue;var _t=o((s,e,t)=>new Promise((r,n)=>{var i=o(c=>{try{l(t.next(c));}catch(u){n(u);}},"f"),a=o(c=>{try{l(t.throw(c));}catch(u){n(u);}},"p"),l=o(c=>c.done?r(c.value):Promise.resolve(c.value).then(i,a),"y");l((t=t.apply(s,e)).next());}),"A"),T,vt=(T=class extends Error{},o(T,"E"),T),bt=0;function Be(s,e){let t=Object.assign({autoReset:false,timeout:0},e),r=false,n=false,i=false,a,l,c=0,u,f=++bt,g=[],p=[],x=o(function(){clearTimeout(c),r=false,n=false,i=false,p.splice(0,p.length),u=new Promise((d,m)=>{a=d,l=m;});},"v");x();function v(){return _t(this,arguments,function*(d=t.timeout,m){if(typeof s=="function"&&s()){r=true;return}return t.autoReset&&(r||n)&&x(),d>0&&(c=setTimeout(()=>{r=true;try{m instanceof Error?(V(m),l(m)):(V(void 0,m),a(m));}catch{}},d)),i=true,u})}o(v,"l"),v.id=f;let V=o((d,m)=>{try{g.forEach(R=>{R(d,m);}),p.forEach(R=>{R(d,m);}),p.splice(0,p.length);}catch{}},"b");return v.resolve=d=>{if(clearTimeout(c),!!i&&!(r||n)){if(typeof s=="function")if(s())V(void 0,d),a(d);else return;else V(void 0,d),a(d);r=true;}},v.reject=d=>{if(clearTimeout(c),!i||r||n)return;let m=typeof d=="string"?new Error(d):d instanceof Error?d:new Error;V(m),l(m),n=true;},v.destroy=()=>{clearTimeout(c),i&&l(new vt),g.splice(0,g.length),p.splice(0,p.length),r=false,i=false,n=false,u=null;},v.reset=x,v.isResolved=()=>r,v.isRejected=()=>n,v.isPending=()=>i,v.on=d=>{g.push(d);},v.once=d=>{p.push(d);},v.off=d=>{let m=g.indexOf(d);m>-1&&g.splice(m,1),m=p.indexOf(d),m>-1&&g.splice(m,1);},v}o(Be,"L");var fe=class fe extends Error{};o(fe,"VoerkaI18nError");var w=fe,he=class he extends w{};o(he,"VoerkaI18nInvalidLanguageError");var Ge=he,ge=class ge extends w{};o(ge,"VoerkaI18nOnlyOneAppScopeError");var Je=ge,pe=class pe extends w{};o(pe,"VoerkaI18nChangeLanguageError");var Ue=pe,de=class de extends w{};o(de,"VoerkaI18nLoadLanguageError");var z=de;var me=class me{constructor(){h(this,"_refreshSignal");}async refresh(e,t){this._refreshSignal||(this._refreshSignal=Be()),e||(e=this.activeLanguage);let r=e,n,{patch:i,fallback:a}=Object.assign({fallback:false,patch:true},t);try{n=await this._loadLanguageMessages(e),this._activeMessages=n,n&&!n.$remote&&i&&await this._patch(e);}catch(l){if(l&&l instanceof w){let c=this.getFallbackLanguage(e);c&&c!==e&&(r=await this.refresh(c,{patch:i,fallback:true}));}}finally{a||(this._activeLanguage=r,(typeof this.messages[r]=="function"||!(r in this.messages))&&(this.messages[r]=this._activeMessages),this._activeParagraphs=this.paragraphs[r],this._refreshSignal.resolve(),this._refreshSignal=void 0,await this.emit("scope/change",r,true));}return this._setLanguageAttr(),r}async _loadLanguageMessages(e){this.logger.debug(`\u51C6\u5907\u52A0\u8F7D\u8BED\u8A00\u5305:${e}`);let t=this.messages[e],r;if(b(t))r=t;else if(y(t))try{r=await Te.call(this,t);}catch(n){this.logger.error(`\u52A0\u8F7D\u5F02\u6B65\u8BED\u8A00\u5305<${e}>\u5931\u8D25:${n.message}`),r=void 0;}if(!r&&y(this.loader))try{let n=await this._loadMessagesFromLoader(e);b(n)?r=Object.assign({$remote:!0},this.messages[this.defaultLanguage],n):this.logger.error(`\u9519\u8BEF\u7684\u8BED\u8A00\u5305<${e}>\u6570\u636E:${n}`);}catch(n){throw new z(n.message)}if(!b(r))throw new z(e);return r}async _loadMessagesFromLoader(e){if(y(this.loader))return await this.loader.call(this,e,this)}ready(){let e=typeof arguments[0]=="function"?arguments[0]:void 0,t=typeof arguments[0]=="number"?arguments[0]:arguments[1];if(typeof e=="function")this.manager.ready(e,t);else return new Promise(r=>{this.manager.ready(r,t);})}async changing(e){!this._refreshSignal&&!this._patching||await Promise.all([this._refreshSignal?.(e),this._patching?.(e)]);}};o(me,"ChangeLanguageMixin");var X=me;var wt={warn:console.warn,error:console.error,info:console.info,debug:console.debug};function He(s){let e,t=[],r=o((n,...i)=>{let a=i.join(" ");if(e){if(!e.debug)return;e.emit("log",{level:n,message:a});}else if(e=globalThis.VoerkaI18n,e&&e instanceof M)if(e.debug){t.push([n,a]);let l=o((c,u)=>{s?s(c,u):wt[c](u);},"log");e.on("log",({level:c,message:u})=>l(c,u)),t.forEach(([c,u])=>l(c,u));}else t.splice(0,t.length);else t.push([n,a]);},"logOutput");return {warn:o((...n)=>r("warn",...n),"warn"),error:o((...n)=>r("error",...n),"error"),info:o((...n)=>r("info",...n),"info"),debug:o((...n)=>r("debug",...n),"debug")}}o(He,"createLogger");var ye=class ye extends Error{constructor(e){super(`Formatters of language<${e}> is not loaded,try to call load()`);}};o(ye,"FormattersNotLoadedError");var Xe=ye,_e=class _e{constructor(e){h(this,"_formatters",[]);h(this,"_scope");this._scope=e,this._formatters=e?.options.formatters,this._registerFormatters();}get scope(){return this._scope}get formatters(){return this._formatters}_registerFormatters(){this._formatters&&this._formatters.forEach(e=>{Array.isArray(e)?this.register.apply(this,e):this.register.apply(this,[e]);});}_addFormatter(e){try{if(this.scope.interpolator.addFilter(e),e){let t=this.scope.manager.scope;t.id!==this.scope.id&&t.interpolator.addFilter(e);}}catch(t){this.scope.logger.error(`fail while register formatter<${e.name}>\uFF1A${t.stack}`);}}register(e,t,r){let n=this.scope,i=e.next;e.next=function(a,l,c){let u=c.getConfig;return c.getConfig=()=>Object.assign({},r,t?.[n.activeLanguage],u(e.name)),i.call(this,a,l,c)},this._addFormatter(e);}};o(_e,"VoerkaI18nFormatterManager");var Q=_e;function Qe(s){return s&&typeof s=="object"&&s.__VoerkaI18nManager__}o(Qe,"isI18nManger");var ve=class ve{getLanguage(e){let t=this.languages.findIndex(r=>r.name==e);if(t!==-1)return this.languages[t]}getFallbackLanguage(e){let t=this.getLanguage(e);return t&&t.fallback||this.options.fallback||this._defaultLanguage}hasLanguage(e){return this.languages.findIndex(t=>t.name==e)!=-1}};o(ve,"LanguageMixin");var Y=ve;var be=class be{_getPluraMessage(e,t){try{return Array.isArray(e)?e.length>t?e[t]:e[e.length-1]:e}catch{return Array.isArray(e)?e[0]:e}}_getPluraValue(e){let t=null,r=[];if(b(e)){let n=e;for(let[i,a]of Object.entries(n)){if(y(a))try{n[i]=a();}catch{n[i]=a;}let l=typeof n[i]=="number";(t==null&&l||i.startsWith("$")&&l)&&(t=n[i]);}r=[n];}else Array.isArray(e)?r=e.map(n=>{try{n=y(n)?n():n,L(n)&&!t&&(t=parseInt(n));}catch{return String(n)}return n}):e!==void 0&&(t=L(e)?parseInt(e):0,r=[e]);return [t,r]}_getTranslateComponent(){if(!this._translateComponent){let e=this.options.component||this.appScope.options.component;typeof e=="function"?this._translateComponent=e.call(this,this):(this._translateComponent=()=>{},this.logger.warn("No translate component builder configured"));}return this._translateComponent}_getTranslateTransformer(){if(!this._translateTransformer){let e=this.options.transform||this.appScope.options.transform;typeof e=="function"&&(this._translateTransformer=e.call(this,this));}return this._translateTransformer}_getActiveMessages(e){return typeof this.messages[e]=="function"?(this.logger.warn(`When the t function specifies the language <${e}> , only synchronized language packs can be used`),this.activeMessages):this.messages[e]}translate(e,t,r){if(typeof e!="string")return this.logger.debug(`failed to translate message:${e},it is not a string`),"";let n=r?.language||this.activeLanguage,i=this._getActiveMessages(n);e=e.replace(/\n/g,"\\n");let a=e;if(typeof e!="string")return e;let l=t===void 0?[]:y(t)?t():t;try{if(W(e))a=i[e]||e;else {let f=this.idMap[e];a=i[f]||i[e]||e;}let[c,u]=this._getPluraValue(l);Array.isArray(a)&&a.length>0&&(c!==null?a=this._getPluraMessage(a,c):a=a[0]),l.length,a=this.interpolator.replace(a,...u),y(this.options.onTranslated)&&(a=this.options.onTranslated(a)),this._translateTransformer&&r?.transform&&(a=this._translateTransformer(a,u,r));}catch(c){this.logger.error(`\u7FFB\u8BD1\u5931\u8D25\uFF1A${c.stack}`);}return a}};o(be,"TranslateMixin");var Z=be;var xe=class xe{_getStorage(){let e=this.storage;return Ie(e)?e:void 0}_getStorageKey(){return this.options.storageKey.replace("{scope}",this.id)}restoreLanguage(){let e=this._getStorage();if(e){let t=this._getStorageKey(),r=e.get(t);if(!r||!this.hasLanguage(r))return;this._activeLanguage=r,this.logger.debug(`\u4ECE\u5B58\u50A8<${t}>\u4E2D\u6062\u590D\u4FDD\u5B58\u7684\u8BED\u8A00\uFF1A${r}`);}}saveLanguage(){let e=this._getStorage();if(e){if(!this._activeLanguage)return;let t=this._getStorageKey();e.set(t,this.activeLanguage),this.logger.debug(`\u5F53\u524D\u8BED\u8A00\u5DF2\u4FDD\u5B58\u5230\u5B58\u50A8${t}=${this.activeLanguage}`);}}clearLanguage(){let e=this._getStorage();e&&e.remove(this._getStorageKey());}};o(xe,"RestoreMixin");var ee=xe;var St=Object.defineProperty,Ye=Object.getOwnPropertySymbols,Et=Object.prototype.hasOwnProperty,Ot=Object.prototype.propertyIsEnumerable,Ze=o((s,e,t)=>e in s?St(s,e,{enumerable:true,configurable:true,writable:true,value:t}):s[e]=t,"R"),et=o((s,e)=>{for(var t in e||(e={}))Et.call(e,t)&&Ze(s,t,e[t]);if(Ye)for(var t of Ye(e))Ot.call(e,t)&&Ze(s,t,e[t]);return s},"b"),I=(s=>typeof _<"u"?_:typeof Proxy<"u"?new Proxy(s,{get:o((e,t)=>(typeof _<"u"?_:e)[t],"get")}):s)(function(s){if(typeof _<"u")return _.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')}),O={Abort:Symbol("Abort"),Throw:Symbol("Throw"),Ignore:Symbol("Ignore")},F,D=(F=class extends Error{constructor(e){super(),this.value=e;}},o(F,"a"),F);var C,P=(C=class extends D{},o(C,"p"),C),$,se=($=class extends D{},o($,"x"),$),k,Se=(k=class extends D{},o(k,"g"),k),Pt={name:"error",priority:"before",args:["operate","value"],default:{operate:"ignore"},next(s,e,t){let r=e.operate.toLowerCase(),n=e.value;return t.onError=(i,a,l,c)=>{if(!(i instanceof Error)||i instanceof D)throw i;if(r=="throw")throw n?new Error(n):i;if(r=="abort")throw new P(n);if(r=="ignore")throw new se(n);return a},s}},Lt={name:"empty",priority:"before",args:["operate","value"],default:{operate:"abort",value:""},next(s,e,t){let r=e.operate.toLowerCase(),n=e.value;return t.onEmpty=()=>{if(r=="throw")throw new Se;if(r=="abort")throw new P(n);if(r=="ignore")throw new se;return r},s}};function te(s,...e){if(e.length===0)return s;let t=e.map((r,n)=>{let i=Object.entries(r||{});return i.some(([a,l])=>l===void 0)?i.reduce((a,[l,c])=>(c!==void 0&&(a[l]=c),a),{}):r});return Object.assign(s,...t)}o(te,"F");(s=>typeof I<"u"?I:typeof Proxy<"u"?new Proxy(s,{get:o((e,t)=>(typeof I<"u"?I:e)[t],"get")}):s)(function(s){if(typeof I<"u")return I.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});function st(s){if(typeof s!="object"||s===null)return false;var e=Object.getPrototypeOf(s);if(e===null)return true;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return e===t}o(st,"y");function Mt(s){return s&&typeof s=="function"}o(Mt,"v");function nt(s,e,t){if(typeof e=="string"){let r=0,n;for(;(n=s.indexOf(e,r))>-1;){let i=typeof t=="function"?t(e):t,a=s.length;s=s.substring(0,n)+i+s.substring(n+e.length),r=n+i.length+s.length-a;}}else {let r;if(!e.global||!e.multiline)throw new Error("The search parameter must be enabled '/gm' option");for(;(r=e.exec(s))!==null;){r.index===e.lastIndex&&e.lastIndex++;let n=s.length,i=r[0].length,a=typeof t=="function"?t(r[0],...r):t;s=s.substring(0,r.index)+a+s.substring(r.index+i),e.lastIndex+=s.length-n;}}return s}o(nt,"w");String.prototype.replaceAll||(String.prototype.replaceAll=function(s,e){return nt(this,s,e)});function re(s){return s.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}o(re,"m");function At(s,e=false){if(typeof s=="number")return true;if(typeof s!="string"||e)return false;try{if(s.includes(".")){let t=parseFloat(s);return s.endsWith(".")?!isNaN(t)&&String(t).length===s.length-1:!isNaN(t)&&String(t).length===s.length}else {let t=parseInt(s);return !isNaN(t)&&String(t).length===s.length}}catch{return false}}o(At,"C");var jt=/\n/gm,Tt=/(["'])(.*?)(\1)/gm,It=/([\s\[\,\{])(\w+)(\s*\:)/gm;function Ft(s,e){try{return JSON.parse(s,(r,n)=>e?e(r,n):n)}catch{}let t=s.replace(jt,(r,n,i)=>{let a=i.slice(0,n).trim(),l=i.slice(n+1).trim();return !/,$/.test(a)&&!/[\[\{\}]$/.test(a)&&!/^\}/.test(l)?`, `:` `});return t=t.replaceAll(Tt,(r,n,i)=>`"${encodeURI(i)}"`),t=t.replaceAll(It,(r,n,i,a)=>`${n}"${i}"${a}`),t=t.replaceAll("\uFF0C",",").replaceAll("\u201C",'"').replaceAll("\u201D",'"'),JSON.parse(t,(r,n)=>(typeof n=="string"&&(n=decodeURI(n)),n))}o(Ft,"V");function Ct(s,e="{",t="}"){let r=0,n=0;for(;r<s.length;){let i=s.slice(r,r+e.length),a=s.slice(r,r+t.length);if(i==e){n++,s=s.substring(0,r+e.length)+`${n}%`+s.substring(r+e.length),r+=e.length+String(n).length+1;continue}if(a==t){n>0&&(s=s.substring(0,r)+`%${n}`+s.substring(r)),r+=t.length+String(n).length+1,n--;continue}r++;}return s}o(Ct,"J");function $t(s,...e){return e.length==0&&(e.push(["{","}"]),e.push(["[","]"])),e.forEach(t=>{s.includes(t[0])&&s.includes(t[1])&&(s=Ct(s,...t));}),s}o($t,"H");function kt(s,e,t){return [[e,new RegExp(re(e)+"\\d+%")],[t,new RegExp("%\\d+"+re(t))]].forEach(([r,n])=>{let i;for(;(i=n.exec(s))!==null;)i.index===n.lastIndex&&n.lastIndex++,s=s.replace(n,r);}),s}o(kt,"G");function we(s,...e){return e.length==0&&(e.push(["{","}"]),e.push(["[","]"])),e.forEach(([t,r])=>{s.includes(t)&&s.includes(r)&&(s=kt(s,t,r));}),s}o(we,"E");function Nt(s){return s?s.trim().substring(1).trim().split("|").map(e=>e.trim()).map(e=>{if(e=="")return null;let t=e.indexOf("("),r=e.lastIndexOf(")");if(t!==-1&&r!==-1){let n=e.substring(t+1,r).trim(),i=Rt(n);return [e.substring(0,t),i]}else return [e,[]]}).filter(e=>Array.isArray(e)):[]}o(Nt,"M");function Dt(...s){s.length==0&&(s.push(["{","}"]),s.push(["[","]"]));let e=s.map(([t,r])=>`(${re(t)}1%.*?%1${re(r)})`);return Vt.replace("__TAG_REGEXP__",e.length>0?e.join("|")+"|":"")}o(Dt,"z");var Vt=String.raw`((([\'\"])(.*?)\3))|__TAG_REGEXP__([\d]+\.?[\d]?)|((true|false|null)(?=[,\b\s]))|([\w\.]+)|((?<=,)\s*(?=,))(?<=\s*[,\)]?\s*)`;function Rt(s){let e=[],t;s=$t(s);try{let r=new RegExp(Dt(),"g");for(;(t=r.exec(s))!==null;){t.index===r.lastIndex&&r.lastIndex++;let n=t[0];if(n.trim()=="")n=void 0;else if(n.startsWith("'")&&n.endsWith("'")||n.startsWith('"')&&n.endsWith('"'))n=n.substring(1,n.length-1),n=we(n);else if(n.startsWith("{")&&n.endsWith("}")||n.startsWith("[")&&n.endsWith("]"))try{n=we(n),n=Ft(n);}catch{}else ["true","false","null"].includes(n)?n=JSON.parse(n):At(n)?n=parseFloat(n):n=we(String(n));e.push(n);}}catch{}return e}o(Rt,"U");var qt=new RegExp("(?<!\\\\)\\{([\\S]+\\s)?\\s*(\\w+)?((\\s*\\|\\s*\\w*(\\(.*?\\)){0,1}\\s*)*)\\s*(\\s[\\S]+)?\\}","gm");function tt(s,e,t={}){let r=s,n,i=Object.assign({replaceAll:true},t),a=qt;for(a.lastIndex=0;(n=a.exec(r))!==null;){n.index===a.lastIndex&&a.lastIndex++;let l=n[2]||"",c=(n[1]||"").trim(),u=(n[6]||"").trim(),f=r.length,g=Nt(n[3]||"");if(Mt(e)){let p=e(l,c,u,g,n[0]);i.replaceAll?r=nt(r,n[0],p):r=r.replace(n[0],p),a.lastIndex+=r.length-f;}}return r}o(tt,"O");function rt(s,e){let t=e.value;if(s.length>0){let r=Gt.call(this,s,e);for(let n of r)try{t=n.call(this,t);}catch(i){if(i instanceof Se)throw i;if(i instanceof D){if(i.value!=null&&(t=i.value),i instanceof P)break}else throw i}}return this.options.isEmpty(t)||(t=`${e.prefix}${t}${e.suffix}`),t}o(rt,"I");function Wt(s,e,t,r){if(!this.options.isEmpty(s))return s;let n=r.onEmpty||t.onEmpty||this.options.onEmpty;if(typeof n!="function")return s;let i=n.call(this,s,e,r);throw i instanceof Error?i:i==O.Abort?new P:i==O.Ignore?new se:i==O.Throw?new Se:new P(i)}o(Wt,"K");function Kt(s,e,t,r,n){let i=n.onError||r.onError||this.options.onError;if(typeof i!="function")return e;let a=i.call(this,s,e,t,n);throw a instanceof Error?a:a==O.Abort?new P:a==O.Ignore?new se:a==O.Throw?s:new P(a)}o(Kt,"Q");function zt(s,e,t){var r;let n=Object.assign({},typeof s.default=="function"?s.default():s.default);return e.length==1&&st(e[0])?te(n,e[0]):s.args&&((r=s.args)==null?void 0:r.length)>0&&s.args.forEach((i,a)=>{e[a]!==void 0&&(n[i]=e[a]);}),i=>{let a;try{t.args=e,a=s.next.call(this,i,n,t),a=Wt.call(this,a,n,s,t);}catch(l){if(l.filter=s.name,l instanceof D)throw l;return this.log(`\u5F53\u6267\u884C\u8FC7\u6EE4\u5668\u5668<${t.match}:${s.name}>\u65F6\u51FA\u9519:${l.stack}`),Kt.call(this,l,i,n,s,t)}return String(a)}}o(zt,"Y");function Bt(s){let e=[],t=s.map(([r,n])=>[this.getFilter.call(this,r),n]).filter(([r])=>r!=null);return t=t.reduce((r,[n,i])=>(n&&(n.priority=="before"?r.unshift([n,i]):n.priority=="after"?e.push([n,i]):r.push([n,i])),r),[]),t.concat(e)}o(Bt,"Z");function Gt(s,e){let t=Bt.call(this,s),r=[];for(let[n,i]of t)r.push(zt.call(this,n,i,e));return r}o(Gt,"ee");var N,it=(N=class{constructor(e){this.options=te({log:console.log,filters:{},missing:"default",filterContext:{}},e),this.addDefaultHandlers(),this.addBuildinFilters(),this.normalizeFilters();}get filters(){return this.options.filters}addDefaultHandlers(){this.options.onError=()=>O.Ignore,this.options.onEmpty=()=>"",this.options.isEmpty=e=>e===null||e==="";}addFilter(e){if(!e.name)throw new Error("Filter name cannot be empty");if(typeof e.next!="function")throw new Error("The filter must provide a next function");return e=te({priority:"normal"},e),this.filters[e.name]=e}removeFilter(e){delete this.filters[e];}getFilter(e){var t;if(e in this.options.filters)return this.options.filters[e];{let r=(t=this.options.getFilter)==null?void 0:t.call(this,e);return typeof r=="function"?{name:e,next:r}:e in String.prototype?{name:e,next:o((n,i,a)=>n[e](...a.args),"next")}:r}}addBuildinFilters(){this.addFilter(Pt),this.addFilter(Lt);}normalizeFilters(){Object.entries(this.options.filters).forEach(([e,t])=>{let r=te({name:e,priority:"normal",args:null,next:o(n=>n,"next")},typeof t=="function"?{filter:t}:t);this.options.filters[e]=r;});}getMissingValue(e,t){let r=this.options.missing;if(r=="default")return "";if(r=="ignore")return t;if(typeof r=="function")return r.call(this,e)}replace(e,...t){if(t.length===0)return e;if(t.length===1&&typeof t[0]=="function"&&(t[0]=t[0].call(this)),t.length===1&&st(t[0])){let r=t[0];return tt.call(this,e,(n,i,a,l,c)=>{let u=n in r?r[n]:this.getMissingValue(n,c);return typeof u=="function"&&(u=u.call(this)),rt.call(this,l,et({name:n,value:u,prefix:i,suffix:a,template:e,match:c,args:[]},this.options.filterContext))})}else {let r=t.length===1&&Array.isArray(t[0])?[...t[0]]:t,n=0;return tt.call(this,e,(i,a,l,c,u)=>{let f=r.length>n?r[n++]:this.getMissingValue(n,u);return typeof f=="function"&&(f=f.call(this)),rt.call(this,c,et({name:i,value:f,prefix:a,suffix:l,template:e,match:u,args:[]},this.options.filterContext))},{replaceAll:false})}}log(e,...t){this.options.debug&&this.options.log(e,...t);}},o(N,"$"),N);function Ee(s,e,t){let{defaultValue:r,delimiter:n,matched:i}=Object.assign({delimiter:"."},t);if(!s||typeof e!="string")return r;if(!e)return s;let a=e.split(n),l=s,c,u;try{for(let f of a)if(l instanceof Map||l instanceof WeakMap){if(!l.has(f))return r;c=l,u=f,l=l.get(f);}else if(l instanceof Set){let g=parseInt(f,10);if(g>=l.size)return r;c=l,u=g,l=[...l][g];}else if(l&&typeof l=="object"&&f in l)c=l,u=Array.isArray(l)?parseInt(f):f,l=l[f];else return r}catch{return r}return typeof i=="function"&&i({value:l,parent:c,indexOrKey:u}),l}o(Ee,"u");var Oe=class Oe{constructor(){h(this,"_flexVars");}_initInterpolators(){this._flexVars=new it({filterContext:{getConfig:o(e=>{let t=this.activeMessages.$config||{};return e?Ee(t,e):t},"getConfig"),scope:this}});}};o(Oe,"InterpolatorMixin");var ne=Oe;function Pe(s,...e){if(e.length===0)return s;let t=e.map((r,n)=>{let i=Object.entries(r||{});return i.some(([a,l])=>l===void 0)?i.reduce((a,[l,c])=>(c!==void 0&&(a[l]=c),a),{}):r});return Object.assign(s,...t)}o(Pe,"u");var B=class B extends Ke(U,H,X,Y,Z,ne,ee){constructor(t){super();h(this,"__VoerkaI18nScope__",true);h(this,"_options");h(this,"_manager");h(this,"_formatterManager",null);h(this,"_logger");h(this,"_defaultLanguage","zh-CN");h(this,"_activeLanguage","zh-CN");h(this,"_activeMessages",{});h(this,"_patchedMessages",{});h(this,"_translateComponent");h(this,"_translateTransformer");h(this,"_activeParagraphs",{});h(this,"$id",++B.idSeq);this._options=Pe({id:Ae(),library:false,debug:false,injectLangAttr:true,languages:[],messages:{},paragraphs:{},idMap:{},formatters:[],attached:true,storageKey:"language",cachePatch:true},t),this._init();}get id(){return this._options.id}get options(){return this._options}get attached(){return this._options.attached}get debug(){return this._options.debug}get library(){return this._options.library}get formatters(){return this._formatterManager}get defaultLanguage(){return this._defaultLanguage}get defaultMessages(){return this.messages[this.defaultLanguage]}get messages(){return this._options.messages}get paragraphs(){return this._options.paragraphs}get idMap(){return this._options.idMap}get languages(){return this._options.languages}get manager(){return this._manager}get appScope(){return this._manager.scope}get interpolator(){return this._flexVars}get logger(){return this._logger}get t(){return this.translate.bind(this)}set t(t){this.translate=t.bind(this);}get Translate(){return this._getTranslateComponent()}get activeMessages(){return this._activeMessages}get activeParagraphs(){return this._activeParagraphs}get activeLanguage(){return this._activeLanguage}get storage(){return this.getScopeOption("storage")}get loader(){return this.getScopeOption("loader")}get $t(){return (t,r,n)=>(this._getTranslateTransformer(),n||(n={}),n.transform=true,this.translate(t,r,n))}getScopeOption(t){let r=this._options;return this.attached?r[t]||(this.library?this._manager[t]:void 0):r[t]}_initOptions(){if(!Array.isArray(this.languages))this.logger.warn("[VoerkaI18n] invalid language settings, will use default language settings."),this._options.languages=Object.assign([],Ce);else if(this.languages.length==0)throw new Error("[VoerkaI18n] must provide valid language settings.");let t,r;this.languages.forEach(i=>{i.default&&(r=i.name),i.active&&(t=i.name);});let n=this._options.messages;if(r in n||(r=Object.keys(n)[0]),t in n||(t=r),!(r in n))throw new Error("[VoerkaI18n] invalid language configuration, must provide valid default and active languages.");if(this._activeLanguage=t,this._defaultLanguage=r,!this._options.library&&!this._options.storage&&(this._options.storage=G),y(this.messages[this._defaultLanguage]))throw new Error("[VoerkaI18n] default language pack must be static content, can't use async load way.");this._activeMessages=this.messages[this._activeLanguage],this._activeParagraphs=this.paragraphs[this._activeLanguage];}_init(){this._logger=He(this._options.log),this._initOptions(),this.library||this.restoreLanguage(),this._initInterpolators(),this.registerToManager(),this._formatterManager=new Q(this);}bind(t){this._manager=t,this._manager.once("init",this._initRefresh.bind(this));}_initRefresh(t){if(this.library)this.refresh(t&&t());else {let r=[];(this._defaultLanguage!==this._activeLanguage||y(this.activeMessages))&&r.push(this.refresh(void 0,{patch:false})),r.push(this._patch()),Promise.all(r).then(()=>{this.emit("ready",this.activeLanguage,true),this._setLanguageAttr();});}}registerToManager(){if(!this.attached)return;let t=!this.options.library;t&&(globalThis.VoerkaI18n&&globalThis.VoerkaI18n.scope&&ie()&&console.warn("Only can have one i18nScope with library=false"),this._manager=new M(this));let r=globalThis.VoerkaI18n;r&&Qe(r)?t?this._initRefresh():r.register(this):(globalThis.__VoerkaI18nScopes__||(globalThis.__VoerkaI18nScopes__=[]),globalThis.__VoerkaI18nScopes__.push(this));}async change(t){let r=this.activeLanguage;return this.attached?r=await this._manager.change(t):r=await this.refresh(t),r}_setLanguageAttr(){if(!(this.library||!ie()))try{let t=this._options.injectLangAttr;if(!t)return;let r=t===!0?document.body:document.body.querySelector(t);r&&r.setAttribute("lang",this.activeLanguage);}catch{}}getRawMessage(t){if(W(t)){if(t in this.defaultMessages)return this.defaultMessages[t]}else return t}getMessageId(t){if(W(t))return t;if(t in this.idMap)return this.idMap[t]}};o(B,"VoerkaI18nScope"),h(B,"idSeq",0);var ot=B;function Fn(s,e,t){return r=>{let n=s.next;return s.next=function(i,a,l){let c=l.getConfig;return l.getConfig=()=>Object.assign({},t,e?.[r.activeLanguage],c(s.name)),n.call(this,i,a,l)},s}}o(Fn,"createFormatter");function Rn(s){let e=globalThis.VoerkaI18n;e?e.registerPlugin(s):(globalThis.__VoerkaI18nPlugins__||(globalThis.__VoerkaI18nPlugins__=[]),globalThis.__VoerkaI18nPlugins__.push(s));}o(Rn,"definePlugin");export{Nr as DataTypes,kr as DefaultFallbackLanguage,Ce as DefaultLanguageSettings,Xe as FormattersNotLoadedError,G as LocalStorage,qr as TEleClassName,Wr as TEleMsgIdAttr,Kr as TEleScopeIdAttr,Dr as VOERKAI18N_FORMATTER,Vr as VOERKAI18N_FORMATTER_BUILDER,Ue as VoerkaI18nChangeLanguageError,w as VoerkaI18nError,Q as VoerkaI18nFormatterManager,Ge as VoerkaI18nInvalidLanguageError,z as VoerkaI18nLoadLanguageError,M as VoerkaI18nManager,Je as VoerkaI18nOnlyOneAppScopeError,ot as VoerkaI18nScope,Fn as createFormatter,Rr as defaultLanguageSettings,Rn as definePlugin,Fe as execAsyncs,Ae as getId,ie as isBrowser,je as isI18nScope,W as isMessageId,Ie as isStorage,Te as loadAsyncModule};//# sourceMappingURL=index.mjs.map //# sourceMappingURL=index.mjs.map