@sv-print/plugin-i18n 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +702 -675
- package/dist/index.umd.js +1 -1
- package/dist/translate-option.d.ts +2 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -35,6 +35,24 @@ const plugins = [
|
|
|
35
35
|
];
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
## 参数配置
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import type { InitOptions } from "i18next";
|
|
42
|
+
// 支持 i18next 所有参数
|
|
43
|
+
export type i18nOptions = InitOptions & {
|
|
44
|
+
optionsSelectorList?: string[]; // 参数选择器
|
|
45
|
+
onElementSelected?: (element: any) => void; // 元素选中回调
|
|
46
|
+
onPanelSelected?: () => void; // 面板选中回调
|
|
47
|
+
onDesigned?: (designerUtils: any) => void; // 设计回调
|
|
48
|
+
onDesignedDelay?: number; // 设计回调延迟时间(部分UI调整后,再翻译) 默认 600ms
|
|
49
|
+
onSettings?: (opts: any) => void; // 设置回调
|
|
50
|
+
onSettingsDelay?: number; // 设置回调延迟时间(部分UI调整后,再翻译) 默认 0ms
|
|
51
|
+
onPreview?: (element: any) => void; // 预览回调
|
|
52
|
+
onPreviewDelay?: number; // 预览回调延迟时间 默认 0ms
|
|
53
|
+
};
|
|
54
|
+
```
|
|
55
|
+
|
|
38
56
|
## License
|
|
39
57
|
|
|
40
58
|
LGPL
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import type { PluginOptions } from "sv-print";
|
|
2
2
|
import type { i18n, InitOptions, TFunction } from "i18next";
|
|
3
3
|
import { translateBySelector } from "./translate-option";
|
|
4
|
-
export type i18nOptions = InitOptions & {
|
|
4
|
+
export type i18nOptions = InitOptions & {
|
|
5
|
+
optionsSelectorList?: string[];
|
|
6
|
+
onElementSelected?: (element: any) => void;
|
|
7
|
+
onPanelSelected?: () => void;
|
|
8
|
+
onDesigned?: (designerUtils: any) => void;
|
|
9
|
+
onDesignedDelay?: number;
|
|
10
|
+
onSettings?: (opts: any) => void;
|
|
11
|
+
onSettingsDelay?: number;
|
|
12
|
+
onPreview?: (element: any) => void;
|
|
13
|
+
onPreviewDelay?: number;
|
|
14
|
+
};
|
|
5
15
|
export type i18nCallback = (i18next: i18n, t: TFunction, err: any) => void;
|
|
6
16
|
export { translateBySelector };
|
|
7
17
|
export default function plugin(config?: i18nOptions, callBack?: i18nCallback): PluginOptions;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Pe=Object.defineProperty,Re=Object.defineProperties;var ke=Object.getOwnPropertyDescriptors;var re=Object.getOwnPropertySymbols;var Ne=Object.prototype.hasOwnProperty,Fe=Object.prototype.propertyIsEnumerable;var ae=(o,e,t)=>e in o?Pe(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,p=(o,e)=>{for(var t in e||(e={}))Ne.call(e,t)&&ae(o,t,e[t]);if(re)for(var t of re(e))Fe.call(e,t)&&ae(o,t,e[t]);return o},O=(o,e)=>Re(o,ke(e));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=o=>typeof o=="string",M=()=>{let o,e;const t=new Promise((i,s)=>{o=i,e=s});return t.resolve=o,t.reject=e,t},oe=o=>o==null?"":""+o,je=(o,e,t)=>{o.forEach(i=>{e[i]&&(t[i]=e[i])})},Te=/###/g,le=o=>o&&o.indexOf("###")>-1?o.replace(Te,"."):o,ue=o=>!o||g(o),B=(o,e,t)=>{const i=g(e)?e.split("."):e;let s=0;for(;s<i.length-1;){if(ue(o))return{};const n=le(i[s]);!o[n]&&t&&(o[n]=new t),Object.prototype.hasOwnProperty.call(o,n)?o=o[n]:o={},++s}return ue(o)?{}:{obj:o,k:le(i[s])}},fe=(o,e,t)=>{const{obj:i,k:s}=B(o,e,Object);if(i!==void 0||e.length===1){i[s]=t;return}let n=e[e.length-1],r=e.slice(0,e.length-1),a=B(o,r,Object);for(;a.obj===void 0&&r.length;)n=`${r[r.length-1]}.${n}`,r=r.slice(0,r.length-1),a=B(o,r,Object),a!=null&&a.obj&&typeof a.obj[`${a.k}.${n}`]!="undefined"&&(a.obj=void 0);a.obj[`${a.k}.${n}`]=t},Ee=(o,e,t,i)=>{const{obj:s,k:n}=B(o,e,Object);s[n]=s[n]||[],s[n].push(t)},Q=(o,e)=>{const{obj:t,k:i}=B(o,e);if(t&&Object.prototype.hasOwnProperty.call(t,i))return t[i]},Ie=(o,e,t)=>{const i=Q(o,t);return i!==void 0?i:Q(e,t)},we=(o,e,t)=>{for(const i in e)i!=="__proto__"&&i!=="constructor"&&(i in o?g(o[i])||o[i]instanceof String||g(e[i])||e[i]instanceof String?t&&(o[i]=e[i]):we(o[i],e[i],t):o[i]=e[i]);return o},V=o=>o.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var De={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const Ve=o=>g(o)?o.replace(/[&<>"'\/]/g,e=>De[e]):o;class Ae{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(t!==void 0)return t;const i=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,i),this.regExpQueue.push(e),i}}const Ke=[" ",",","?","!",";"],Ue=new Ae(20),Me=(o,e,t)=>{e=e||"",t=t||"";const i=Ke.filter(r=>e.indexOf(r)<0&&t.indexOf(r)<0);if(i.length===0)return!0;const s=Ue.getRegExp(`(${i.map(r=>r==="?"?"\\?":r).join("|")})`);let n=!s.test(o);if(!n){const r=o.indexOf(t);r>0&&!s.test(o.substring(0,r))&&(n=!0)}return n},ee=(o,e,t=".")=>{if(!o)return;if(o[e])return Object.prototype.hasOwnProperty.call(o,e)?o[e]:void 0;const i=e.split(t);let s=o;for(let n=0;n<i.length;){if(!s||typeof s!="object")return;let r,a="";for(let l=n;l<i.length;++l)if(l!==n&&(a+=t),a+=i[l],r=s[a],r!==void 0){if(["string","number","boolean"].indexOf(typeof r)>-1&&l<i.length-1)continue;n+=l-n+1;break}s=r}return s},z=o=>o==null?void 0:o.replace("_","-"),He={type:"logger",log(o){this.output("log",o)},warn(o){this.output("warn",o)},error(o){this.output("error",o)},output(o,e){var t,i;(i=(t=console==null?void 0:console[o])==null?void 0:t.apply)==null||i.call(t,console,e)}};class G{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||He,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,i,s){return s&&!this.debug?null:(g(e[0])&&(e[0]=`${i}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new G(this.logger,p({prefix:`${this.prefix}:${e}:`},this.options))}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new G(this.logger,e)}}var F=new G;class X{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(i=>{this.observers[i]||(this.observers[i]=new Map);const s=this.observers[i].get(t)||0;this.observers[i].set(t,s+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([s,n])=>{for(let r=0;r<n;r++)s(...t)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([s,n])=>{for(let r=0;r<n;r++)s.apply(s,[e,...t])})}}class he extends X{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,i,s={}){var u,h;const n=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,r=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;e.indexOf(".")>-1?a=e.split("."):(a=[e,t],i&&(Array.isArray(i)?a.push(...i):g(i)&&n?a.push(...i.split(n)):a.push(i)));const l=Q(this.data,a);return!l&&!t&&!i&&e.indexOf(".")>-1&&(e=a[0],t=a[1],i=a.slice(2).join(".")),l||!r||!g(i)?l:ee((h=(u=this.data)==null?void 0:u[e])==null?void 0:h[t],i,n)}addResource(e,t,i,s,n={silent:!1}){const r=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let a=[e,t];i&&(a=a.concat(r?i.split(r):i)),e.indexOf(".")>-1&&(a=e.split("."),s=t,t=a[1]),this.addNamespaces(t),fe(this.data,a,s),n.silent||this.emit("added",e,t,i,s)}addResources(e,t,i,s={silent:!1}){for(const n in i)(g(i[n])||Array.isArray(i[n]))&&this.addResource(e,t,n,i[n],{silent:!0});s.silent||this.emit("added",e,t,i)}addResourceBundle(e,t,i,s,n,r={silent:!1,skipCopy:!1}){let a=[e,t];e.indexOf(".")>-1&&(a=e.split("."),s=i,i=t,t=a[1]),this.addNamespaces(t);let l=Q(this.data,a)||{};r.skipCopy||(i=JSON.parse(JSON.stringify(i))),s?we(l,i,n):l=p(p({},l),i),fe(this.data,a,l),r.silent||this.emit("added",e,t,i)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(s=>t[s]&&Object.keys(t[s]).length>0)}toJSON(){return this.data}}var ve={processors:{},addPostProcessor(o){this.processors[o.name]=o},handle(o,e,t,i,s){return o.forEach(n=>{var r,a;e=(a=(r=this.processors[n])==null?void 0:r.process(e,t,i,s))!=null?a:e}),e}};const ce={},de=o=>!g(o)&&typeof o!="boolean"&&typeof o!="number";class Z extends X{constructor(e,t={}){super(),je(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=F.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const i=p({},t);if(e==null)return!1;const s=this.resolve(e,i);return(s==null?void 0:s.res)!==void 0}extractFromKey(e,t){let i=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;i===void 0&&(i=":");const s=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let n=t.ns||this.options.defaultNS||[];const r=i&&e.indexOf(i)>-1,a=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!Me(e,i,s);if(r&&!a){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:g(n)?[n]:n};const u=e.split(i);(i!==s||i===s&&this.options.ns.indexOf(u[0])>-1)&&(n=u.shift()),e=u.join(s)}return{key:e,namespaces:g(n)?[n]:n}}translate(e,t,i){let s=typeof t=="object"?p({},t):t;if(typeof s!="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),typeof options=="object"&&(s=p({},s)),s||(s={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const n=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,r=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(e[e.length-1],s),u=l[l.length-1];let h=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;h===void 0&&(h=":");const f=s.lng||this.language,m=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((f==null?void 0:f.toLowerCase())==="cimode")return m?n?{res:`${u}${h}${a}`,usedKey:a,exactUsedKey:a,usedLng:f,usedNS:u,usedParams:this.getUsedParamsDetails(s)}:`${u}${h}${a}`:n?{res:a,usedKey:a,exactUsedKey:a,usedLng:f,usedNS:u,usedParams:this.getUsedParamsDetails(s)}:a;const d=this.resolve(e,s);let c=d==null?void 0:d.res;const x=(d==null?void 0:d.usedKey)||a,S=(d==null?void 0:d.exactUsedKey)||a,P=["[object Number]","[object Function]","[object RegExp]"],C=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,I=!this.i18nFormat||this.i18nFormat.handleAsObject,L=s.count!==void 0&&!g(s.count),j=Z.hasDefaultValue(s),W=L?this.pluralResolver.getSuffix(f,s.count,s):"",T=s.ordinal&&L?this.pluralResolver.getSuffix(f,s.count,{ordinal:!1}):"",A=L&&!s.ordinal&&s.count===0,w=A&&s[`defaultValue${this.options.pluralSeparator}zero`]||s[`defaultValue${W}`]||s[`defaultValue${T}`]||s.defaultValue;let b=c;I&&!c&&j&&(b=w);const Ce=de(b),$e=Object.prototype.toString.apply(b);if(I&&b&&Ce&&P.indexOf($e)<0&&!(g(C)&&Array.isArray(b))){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const k=this.options.returnedObjectHandler?this.options.returnedObjectHandler(x,b,O(p({},s),{ns:l})):`key '${a} (${this.language})' returned an object instead of string.`;return n?(d.res=k,d.usedParams=this.getUsedParamsDetails(s),d):k}if(r){const k=Array.isArray(b),R=k?[]:{},te=k?S:x;for(const N in b)if(Object.prototype.hasOwnProperty.call(b,N)){const E=`${te}${r}${N}`;j&&!c?R[N]=this.translate(E,O(p({},s),{defaultValue:de(w)?w[N]:void 0,joinArrays:!1,ns:l})):R[N]=this.translate(E,O(p({},s),{joinArrays:!1,ns:l})),R[N]===E&&(R[N]=b[N])}c=R}}else if(I&&g(C)&&Array.isArray(c))c=c.join(C),c&&(c=this.extendTranslation(c,e,s,i));else{let k=!1,R=!1;!this.isValidLookup(c)&&j&&(k=!0,c=w),this.isValidLookup(c)||(R=!0,c=a);const N=(s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&R?void 0:c,E=j&&w!==c&&this.options.updateMissing;if(R||k||E){if(this.logger.log(E?"updateKey":"missingKey",f,u,a,E?w:c),r){const v=this.resolve(a,O(p({},s),{keySeparator:!1}));v&&v.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 K=[];const _=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&_&&_[0])for(let v=0;v<_.length;v++)K.push(_[v]);else this.options.saveMissingTo==="all"?K=this.languageUtils.toResolveHierarchy(s.lng||this.language):K.push(s.lng||this.language);const ie=(v,D,U)=>{var ne;const se=j&&U!==c?U:N;this.options.missingKeyHandler?this.options.missingKeyHandler(v,u,D,se,E,s):(ne=this.backendConnector)!=null&&ne.saveMissing&&this.backendConnector.saveMissing(v,u,D,se,E,s),this.emit("missingKey",v,u,D,c)};this.options.saveMissing&&(this.options.saveMissingPlurals&&L?K.forEach(v=>{const D=this.pluralResolver.getSuffixes(v,s);A&&s[`defaultValue${this.options.pluralSeparator}zero`]&&D.indexOf(`${this.options.pluralSeparator}zero`)<0&&D.push(`${this.options.pluralSeparator}zero`),D.forEach(U=>{ie([v],a+U,s[`defaultValue${U}`]||w)})}):ie(K,a,w))}c=this.extendTranslation(c,e,s,d,i),R&&c===a&&this.options.appendNamespaceToMissingKey&&(c=`${u}${h}${a}`),(R||k)&&this.options.parseMissingKeyHandler&&(c=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${h}${a}`:a,k?c:void 0,s))}return n?(d.res=c,d.usedParams=this.getUsedParamsDetails(s),d):c}extendTranslation(e,t,i,s,n){var l,u;if((l=this.i18nFormat)!=null&&l.parse)e=this.i18nFormat.parse(e,p(p({},this.options.interpolation.defaultVariables),i),i.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init(O(p({},i),{interpolation:p(p({},this.options.interpolation),i.interpolation)}));const h=g(e)&&(((u=i==null?void 0:i.interpolation)==null?void 0:u.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let f;if(h){const d=e.match(this.interpolator.nestingRegexp);f=d&&d.length}let m=i.replace&&!g(i.replace)?i.replace:i;if(this.options.interpolation.defaultVariables&&(m=p(p({},this.options.interpolation.defaultVariables),m)),e=this.interpolator.interpolate(e,m,i.lng||this.language||s.usedLng,i),h){const d=e.match(this.interpolator.nestingRegexp),c=d&&d.length;f<c&&(i.nest=!1)}!i.lng&&s&&s.res&&(i.lng=this.language||s.usedLng),i.nest!==!1&&(e=this.interpolator.nest(e,(...d)=>(n==null?void 0:n[0])===d[0]&&!i.context?(this.logger.warn(`It seems you are nesting recursively key: ${d[0]} in key: ${t[0]}`),null):this.translate(...d,t),i)),i.interpolation&&this.interpolator.reset()}const r=i.postProcess||this.options.postProcess,a=g(r)?[r]:r;return e!=null&&(a!=null&&a.length)&&i.applyPostProcessor!==!1&&(e=ve.handle(a,e,t,this.options&&this.options.postProcessPassResolved?p({i18nResolved:O(p({},s),{usedParams:this.getUsedParamsDetails(i)})},i):i,this)),e}resolve(e,t={}){let i,s,n,r,a;return g(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(i))return;const u=this.extractFromKey(l,t),h=u.key;s=h;let f=u.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const m=t.count!==void 0&&!g(t.count),d=m&&!t.ordinal&&t.count===0,c=t.context!==void 0&&(g(t.context)||typeof t.context=="number")&&t.context!=="",x=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);f.forEach(S=>{var P,C;this.isValidLookup(i)||(a=S,!ce[`${x[0]}-${S}`]&&((P=this.utils)!=null&&P.hasLoadedNamespace)&&!((C=this.utils)!=null&&C.hasLoadedNamespace(a))&&(ce[`${x[0]}-${S}`]=!0,this.logger.warn(`key "${s}" for languages "${x.join(", ")}" won't get resolved as namespace "${a}" 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!!!")),x.forEach(I=>{var W;if(this.isValidLookup(i))return;r=I;const L=[h];if((W=this.i18nFormat)!=null&&W.addLookupKeys)this.i18nFormat.addLookupKeys(L,h,I,S,t);else{let T;m&&(T=this.pluralResolver.getSuffix(I,t.count,t));const A=`${this.options.pluralSeparator}zero`,w=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(m&&(L.push(h+T),t.ordinal&&T.indexOf(w)===0&&L.push(h+T.replace(w,this.options.pluralSeparator)),d&&L.push(h+A)),c){const b=`${h}${this.options.contextSeparator}${t.context}`;L.push(b),m&&(L.push(b+T),t.ordinal&&T.indexOf(w)===0&&L.push(b+T.replace(w,this.options.pluralSeparator)),d&&L.push(b+A))}}let j;for(;j=L.pop();)this.isValidLookup(i)||(n=j,i=this.getResource(I,S,j,t))}))})}),{res:i,usedKey:s,exactUsedKey:n,usedLng:r,usedNS:a}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,i,s={}){var n;return(n=this.i18nFormat)!=null&&n.getResource?this.i18nFormat.getResource(e,t,i,s):this.resourceStore.getResource(e,t,i,s)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],i=e.replace&&!g(e.replace);let s=i?e.replace:e;if(i&&typeof e.count!="undefined"&&(s.count=e.count),this.options.interpolation.defaultVariables&&(s=p(p({},this.options.interpolation.defaultVariables),s)),!i){s=p({},s);for(const n of t)delete s[n]}return s}static hasDefaultValue(e){const t="defaultValue";for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&t===i.substring(0,t.length)&&e[i]!==void 0)return!0;return!1}}class pe{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=F.create("languageUtils")}getScriptPartFromCode(e){if(e=z(e),!e||e.indexOf("-")<0)return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=z(e),!e||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(g(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(i){}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(i=>{if(t)return;const s=this.formatLanguageCode(i);(!this.options.supportedLngs||this.isSupportedCode(s))&&(t=s)}),!t&&this.options.supportedLngs&&e.forEach(i=>{if(t)return;const s=this.getScriptPartFromCode(i);if(this.isSupportedCode(s))return t=s;const n=this.getLanguagePartFromCode(i);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find(r=>{if(r===n)return r;if(!(r.indexOf("-")<0&&n.indexOf("-")<0)&&(r.indexOf("-")>0&&n.indexOf("-")<0&&r.substring(0,r.indexOf("-"))===n||r.indexOf(n)===0&&n.length>1))return r})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),g(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let i=e[t];return i||(i=e[this.getScriptPartFromCode(t)]),i||(i=e[this.formatLanguageCode(t)]),i||(i=e[this.getLanguagePartFromCode(t)]),i||(i=e.default),i||[]}toResolveHierarchy(e,t){const i=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),s=[],n=r=>{r&&(this.isSupportedCode(r)?s.push(r):this.logger.warn(`rejecting language code not found in supportedLngs: ${r}`))};return g(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&n(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&n(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&n(this.getLanguagePartFromCode(e))):g(e)&&n(this.formatLanguageCode(e)),i.forEach(r=>{s.indexOf(r)<0&&n(this.formatLanguageCode(r))}),s}}const ge={zero:0,one:1,two:2,few:3,many:4,other:5},me={select:o=>o===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Be{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=F.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const i=z(e==="dev"?"en":e),s=t.ordinal?"ordinal":"cardinal",n=JSON.stringify({cleanedCode:i,type:s});if(n in this.pluralRulesCache)return this.pluralRulesCache[n];let r;try{r=new Intl.PluralRules(i,{type:s})}catch(a){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),me;if(!e.match(/-|_/))return me;const l=this.languageUtils.getLanguagePartFromCode(e);r=this.getRule(l,t)}return this.pluralRulesCache[n]=r,r}needsPlural(e,t={}){let i=this.getRule(e,t);return i||(i=this.getRule("dev",t)),(i==null?void 0:i.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,t,i={}){return this.getSuffixes(e,i).map(s=>`${t}${s}`)}getSuffixes(e,t={}){let i=this.getRule(e,t);return i||(i=this.getRule("dev",t)),i?i.resolvedOptions().pluralCategories.sort((s,n)=>ge[s]-ge[n]).map(s=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${s}`):[]}getSuffix(e,t,i={}){const s=this.getRule(e,i);return s?`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${s.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,i))}}const xe=(o,e,t,i=".",s=!0)=>{let n=Ie(o,e,t);return!n&&s&&g(t)&&(n=ee(o,t,i),n===void 0&&(n=ee(e,t,i))),n},q=o=>o.replace(/\$/g,"$$$$");class ze{constructor(e={}){var t;this.logger=F.create("interpolator"),this.options=e,this.format=((t=e==null?void 0:e.interpolation)==null?void 0:t.format)||(i=>i),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:i,useRawValueToEscape:s,prefix:n,prefixEscaped:r,suffix:a,suffixEscaped:l,formatSeparator:u,unescapeSuffix:h,unescapePrefix:f,nestingPrefix:m,nestingPrefixEscaped:d,nestingSuffix:c,nestingSuffixEscaped:x,nestingOptionsSeparator:S,maxReplaces:P,alwaysFormat:C}=e.interpolation;this.escape=t!==void 0?t:Ve,this.escapeValue=i!==void 0?i:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=n?V(n):r||"{{",this.suffix=a?V(a):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=h?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":h||"",this.nestingPrefix=m?V(m):d||V("$t("),this.nestingSuffix=c?V(c):x||V(")"),this.nestingOptionsSeparator=S||",",this.maxReplaces=P||1e3,this.alwaysFormat=C!==void 0?C:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,i)=>(t==null?void 0:t.source)===i?(t.lastIndex=0,t):new RegExp(i,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,t,i,s){var d;let n,r,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=c=>{if(c.indexOf(this.formatSeparator)<0){const C=xe(t,l,c,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(C,void 0,i,O(p(p({},s),t),{interpolationkey:c})):C}const x=c.split(this.formatSeparator),S=x.shift().trim(),P=x.join(this.formatSeparator).trim();return this.format(xe(t,l,S,this.options.keySeparator,this.options.ignoreJSONStructure),P,i,O(p(p({},s),t),{interpolationkey:S}))};this.resetRegExp();const h=(s==null?void 0:s.missingInterpolationHandler)||this.options.missingInterpolationHandler,f=((d=s==null?void 0:s.interpolation)==null?void 0:d.skipOnVariables)!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:c=>q(c)},{regex:this.regexp,safeValue:c=>this.escapeValue?q(this.escape(c)):q(c)}].forEach(c=>{for(a=0;n=c.regex.exec(e);){const x=n[1].trim();if(r=u(x),r===void 0)if(typeof h=="function"){const P=h(e,n,s);r=g(P)?P:""}else if(s&&Object.prototype.hasOwnProperty.call(s,x))r="";else if(f){r=n[0];continue}else this.logger.warn(`missed to pass in variable ${x} for interpolating ${e}`),r="";else!g(r)&&!this.useRawValueToEscape&&(r=oe(r));const S=c.safeValue(r);if(e=e.replace(n[0],S),f?(c.regex.lastIndex+=r.length,c.regex.lastIndex-=n[0].length):c.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,t,i={}){let s,n,r;const a=(l,u)=>{var x;const h=this.nestingOptionsSeparator;if(l.indexOf(h)<0)return l;const f=l.split(new RegExp(`${h}[ ]*{`));let m=`{${f[1]}`;l=f[0],m=this.interpolate(m,r);const d=m.match(/'/g),c=m.match(/"/g);(((x=d==null?void 0:d.length)!=null?x:0)%2===0&&!c||c.length%2!==0)&&(m=m.replace(/'/g,'"'));try{r=JSON.parse(m),u&&(r=p(p({},u),r))}catch(S){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,S),`${l}${h}${m}`}return r.defaultValue&&r.defaultValue.indexOf(this.prefix)>-1&&delete r.defaultValue,l};for(;s=this.nestingRegexp.exec(e);){let l=[];r=p({},i),r=r.replace&&!g(r.replace)?r.replace:r,r.applyPostProcessor=!1,delete r.defaultValue;const u=/{.*}/.test(s[1])?s[1].lastIndexOf("}")+1:s[1].indexOf(this.formatSeparator);if(u!==-1&&(l=s[1].slice(u).split(this.formatSeparator).map(h=>h.trim()).filter(Boolean),s[1]=s[1].slice(0,u)),n=t(a.call(this,s[1].trim(),r),r),n&&s[0]===e&&!g(n))return n;g(n)||(n=oe(n)),n||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`),n=""),l.length&&(n=l.reduce((h,f)=>this.format(h,f,i.lng,O(p({},i),{interpolationkey:s[1].trim()})),n.trim())),e=e.replace(s[0],n),this.regexp.lastIndex=0}return e}}const Je=o=>{let e=o.toLowerCase().trim();const t={};if(o.indexOf("(")>-1){const i=o.split("(");e=i[0].toLowerCase().trim();const s=i[1].substring(0,i[1].length-1);e==="currency"&&s.indexOf(":")<0?t.currency||(t.currency=s.trim()):e==="relativetime"&&s.indexOf(":")<0?t.range||(t.range=s.trim()):s.split(";").forEach(r=>{if(r){const[a,...l]=r.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),h=a.trim();t[h]||(t[h]=u),u==="false"&&(t[h]=!1),u==="true"&&(t[h]=!0),isNaN(u)||(t[h]=parseInt(u,10))}})}return{formatName:e,formatOptions:t}},ye=o=>{const e={};return(t,i,s)=>{let n=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(n=O(p({},n),{[s.interpolationkey]:void 0}));const r=i+JSON.stringify(n);let a=e[r];return a||(a=o(z(i),s),e[r]=a),a(t)}},We=o=>(e,t,i)=>o(z(t),i)(e);class _e{constructor(e={}){this.logger=F.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const i=t.cacheInBuiltFormats?ye:We;this.formats={number:i((s,n)=>{const r=new Intl.NumberFormat(s,p({},n));return a=>r.format(a)}),currency:i((s,n)=>{const r=new Intl.NumberFormat(s,O(p({},n),{style:"currency"}));return a=>r.format(a)}),datetime:i((s,n)=>{const r=new Intl.DateTimeFormat(s,p({},n));return a=>r.format(a)}),relativetime:i((s,n)=>{const r=new Intl.RelativeTimeFormat(s,p({},n));return a=>r.format(a,n.range||"day")}),list:i((s,n)=>{const r=new Intl.ListFormat(s,p({},n));return a=>r.format(a)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=ye(t)}format(e,t,i,s={}){const n=t.split(this.formatSeparator);if(n.length>1&&n[0].indexOf("(")>1&&n[0].indexOf(")")<0&&n.find(a=>a.indexOf(")")>-1)){const a=n.findIndex(l=>l.indexOf(")")>-1);n[0]=[n[0],...n.splice(1,a)].join(this.formatSeparator)}return n.reduce((a,l)=>{var f;const{formatName:u,formatOptions:h}=Je(l);if(this.formats[u]){let m=a;try{const d=((f=s==null?void 0:s.formatParams)==null?void 0:f[s.interpolationkey])||{},c=d.locale||d.lng||s.locale||s.lng||i;m=this.formats[u](a,c,p(p(p({},h),s),d))}catch(d){this.logger.warn(d)}return m}else this.logger.warn(`there was no format function for ${u}`);return a},e)}}const Ye=(o,e)=>{o.pending[e]!==void 0&&(delete o.pending[e],o.pendingCount--)};class Qe extends X{constructor(e,t,i,s={}){var n,r;super(),this.backend=e,this.store=t,this.services=i,this.languageUtils=i.languageUtils,this.options=s,this.logger=F.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],(r=(n=this.backend)==null?void 0:n.init)==null||r.call(n,i,s.backend,s)}queueLoad(e,t,i,s){const n={},r={},a={},l={};return e.forEach(u=>{let h=!0;t.forEach(f=>{const m=`${u}|${f}`;!i.reload&&this.store.hasResourceBundle(u,f)?this.state[m]=2:this.state[m]<0||(this.state[m]===1?r[m]===void 0&&(r[m]=!0):(this.state[m]=1,h=!1,r[m]===void 0&&(r[m]=!0),n[m]===void 0&&(n[m]=!0),l[f]===void 0&&(l[f]=!0)))}),h||(a[u]=!0)}),(Object.keys(n).length||Object.keys(r).length)&&this.queue.push({pending:r,pendingCount:Object.keys(r).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(n),pending:Object.keys(r),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(e,t,i){const s=e.split("|"),n=s[0],r=s[1];t&&this.emit("failedLoading",n,r,t),!t&&i&&this.store.addResourceBundle(n,r,i,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&i&&(this.state[e]=0);const a={};this.queue.forEach(l=>{Ee(l.loaded,[n],r),Ye(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{a[u]||(a[u]={});const h=l.loaded[u];h.length&&h.forEach(f=>{a[u][f]===void 0&&(a[u][f]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(e,t,i,s=0,n=this.retryTimeout,r){if(!e.length)return r(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:i,tried:s,wait:n,callback:r});return}this.readingCalls++;const a=(u,h)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(u&&h&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,i,s+1,n*2,r)},n);return}r(u,h)},l=this.backend[i].bind(this.backend);if(l.length===2){try{const u=l(e,t);u&&typeof u.then=="function"?u.then(h=>a(null,h)).catch(a):a(null,u)}catch(u){a(u)}return}return l(e,t,a)}prepareLoading(e,t,i={},s){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();g(e)&&(e=this.languageUtils.toResolveHierarchy(e)),g(t)&&(t=[t]);const n=this.queueLoad(e,t,i,s);if(!n.toLoad.length)return n.pending.length||s(),null;n.toLoad.forEach(r=>{this.loadOne(r)})}load(e,t,i){this.prepareLoading(e,t,{},i)}reload(e,t,i){this.prepareLoading(e,t,{reload:!0},i)}loadOne(e,t=""){const i=e.split("|"),s=i[0],n=i[1];this.read(s,n,"read",void 0,void 0,(r,a)=>{r&&this.logger.warn(`${t}loading namespace ${n} for language ${s} failed`,r),!r&&a&&this.logger.log(`${t}loaded namespace ${n} for language ${s}`,a),this.loaded(e,r,a)})}saveMissing(e,t,i,s,n,r={},a=()=>{}){var l,u,h,f,m;if((u=(l=this.services)==null?void 0:l.utils)!=null&&u.hasLoadedNamespace&&!((f=(h=this.services)==null?void 0:h.utils)!=null&&f.hasLoadedNamespace(t))){this.logger.warn(`did not save key "${i}" as the namespace "${t}" 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(!(i==null||i==="")){if((m=this.backend)!=null&&m.create){const d=O(p({},r),{isUpdate:n}),c=this.backend.create.bind(this.backend);if(c.length<6)try{let x;c.length===5?x=c(e,t,i,s,d):x=c(e,t,i,s),x&&typeof x.then=="function"?x.then(S=>a(null,S)).catch(a):a(null,x)}catch(x){a(x)}else c(e,t,i,s,a,d)}!e||!e[0]||this.store.addResource(e[0],t,i,s)}}}const Se=()=>({debug:!1,initAsync:!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:o=>{let e={};if(typeof o[1]=="object"&&(e=o[1]),g(o[1])&&(e.defaultValue=o[1]),g(o[2])&&(e.tDescription=o[2]),typeof o[2]=="object"||typeof o[3]=="object"){const t=o[3]||o[2];Object.keys(t).forEach(i=>{e[i]=t[i]})}return e},interpolation:{escapeValue:!0,format:o=>o,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),be=o=>{var e,t;return g(o.ns)&&(o.ns=[o.ns]),g(o.fallbackLng)&&(o.fallbackLng=[o.fallbackLng]),g(o.fallbackNS)&&(o.fallbackNS=[o.fallbackNS]),((t=(e=o.supportedLngs)==null?void 0:e.indexOf)==null?void 0:t.call(e,"cimode"))<0&&(o.supportedLngs=o.supportedLngs.concat(["cimode"])),typeof o.initImmediate=="boolean"&&(o.initAsync=o.initImmediate),o},Y=()=>{},Ge=o=>{Object.getOwnPropertyNames(Object.getPrototypeOf(o)).forEach(t=>{typeof o[t]=="function"&&(o[t]=o[t].bind(o))})};class J extends X{constructor(e={},t){if(super(),this.options=be(e),this.services={},this.logger=F,this.modules={external:[]},Ge(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e=="function"&&(t=e,e={}),e.defaultNS==null&&e.ns&&(g(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const i=Se();this.options=p(p(p({},i),this.options),be(e)),this.options.interpolation=p(p({},i.interpolation),this.options.interpolation),e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator);const s=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?F.init(s(this.modules.logger),this.options):F.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=_e;const h=new pe(this.options);this.store=new he(this.options.resources,this.options);const f=this.services;f.logger=F,f.resourceStore=this.store,f.languageUtils=h,f.pluralResolver=new Be(h,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==i.interpolation.format&&this.logger.warn("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),u&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=s(u),f.formatter.init&&f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new ze(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new Qe(s(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",(d,...c)=>{this.emit(d,...c)}),this.modules.languageDetector&&(f.languageDetector=s(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=s(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new Z(this.services,this.options),this.translator.on("*",(d,...c)=>{this.emit(d,...c)}),this.modules.external.forEach(d=>{d.init&&d.init(this)})}if(this.format=this.options.interpolation.format,t||(t=Y),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[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(u=>{this[u]=(...h)=>this.store[u](...h)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=(...h)=>(this.store[u](...h),this)});const a=M(),l=()=>{const u=(h,f)=>{this.isInitializing=!1,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),a.resolve(f),t(h,f)};if(this.languages&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),a}loadResources(e,t=Y){var n,r;let i=t;const s=g(e)?e:this.language;if(typeof e=="function"&&(i=e),!this.options.resources||this.options.partialBundledLanguages){if((s==null?void 0:s.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return i();const a=[],l=u=>{if(!u||u==="cimode")return;this.services.languageUtils.toResolveHierarchy(u).forEach(f=>{f!=="cimode"&&a.indexOf(f)<0&&a.push(f)})};s?l(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(h=>l(h)),(r=(n=this.options.preload)==null?void 0:n.forEach)==null||r.call(n,u=>l(u)),this.services.backendConnector.load(a,this.options.ns,u=>{!u&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),i(u)})}else i(null)}reloadResources(e,t,i){const s=M();return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),i||(i=Y),this.services.backendConnector.reload(e,t,n=>{s.resolve(),i(n)}),s}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&ve.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let t=0;t<this.languages.length;t++){const i=this.languages[t];if(!(["cimode","dev"].indexOf(i)>-1)&&this.store.hasLanguageSomeTranslations(i)){this.resolvedLanguage=i;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;const i=M();this.emit("languageChanging",e);const s=a=>{this.language=a,this.languages=this.services.languageUtils.toResolveHierarchy(a),this.resolvedLanguage=void 0,this.setResolvedLanguage(a)},n=(a,l)=>{l?this.isLanguageChangingTo===e&&(s(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,i.resolve((...u)=>this.t(...u)),t&&t(a,(...u)=>this.t(...u))},r=a=>{var h,f;!e&&!a&&this.services.languageDetector&&(a=[]);const l=g(a)?a:a&&a[0],u=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(g(a)?[a]:a);u&&(this.language||s(u),this.translator.language||this.translator.changeLanguage(u),(f=(h=this.services.languageDetector)==null?void 0:h.cacheUserLanguage)==null||f.call(h,u)),this.loadResources(u,m=>{n(m,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?r(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(r):this.services.languageDetector.detect(r):r(e),i}getFixedT(e,t,i){const s=(n,r,...a)=>{let l;typeof r!="object"?l=this.options.overloadTranslationOptionHandler([n,r].concat(a)):l=p({},r),l.lng=l.lng||s.lng,l.lngs=l.lngs||s.lngs,l.ns=l.ns||s.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||i||s.keyPrefix);const u=this.options.keySeparator||".";let h;return l.keyPrefix&&Array.isArray(n)?h=n.map(f=>`${l.keyPrefix}${u}${f}`):h=l.keyPrefix?`${l.keyPrefix}${u}${n}`:n,this.t(h,l)};return g(e)?s.lng=e:s.lngs=e,s.ns=t,s.keyPrefix=i,s}t(...e){var t;return(t=this.translator)==null?void 0:t.translate(...e)}exists(...e){var t;return(t=this.translator)==null?void 0:t.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){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 i=t.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,n=this.languages[this.languages.length-1];if(i.toLowerCase()==="cimode")return!0;const r=(a,l)=>{const u=this.services.backendConnector.state[`${a}|${l}`];return u===-1||u===0||u===2};if(t.precheck){const a=t.precheck(this,r);if(a!==void 0)return a}return!!(this.hasResourceBundle(i,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||r(i,e)&&(!s||r(n,e)))}loadNamespaces(e,t){const i=M();return this.options.ns?(g(e)&&(e=[e]),e.forEach(s=>{this.options.ns.indexOf(s)<0&&this.options.ns.push(s)}),this.loadResources(s=>{i.resolve(),t&&t(s)}),i):(t&&t(),Promise.resolve())}loadLanguages(e,t){const i=M();g(e)&&(e=[e]);const s=this.options.preload||[],n=e.filter(r=>s.indexOf(r)<0&&this.services.languageUtils.isSupportedCode(r));return n.length?(this.options.preload=s.concat(n),this.loadResources(r=>{i.resolve(),t&&t(r)}),i):(t&&t(),Promise.resolve())}dir(e){var s,n;if(e||(e=this.resolvedLanguage||(((s=this.languages)==null?void 0:s.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const r=new Intl.Locale(e);if(r&&r.getTextInfo){const a=r.getTextInfo();if(a&&a.direction)return a.direction}}catch(r){}const t=["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"],i=((n=this.services)==null?void 0:n.languageUtils)||new pe(Se());return e.toLowerCase().indexOf("-latn")>1?"ltr":t.indexOf(i.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){return new J(e,t)}cloneInstance(e={},t=Y){const i=e.forkResourceStore;i&&delete e.forkResourceStore;const s=O(p(p({},this.options),e),{isClone:!0}),n=new J(s);if((e.debug!==void 0||e.prefix!==void 0)&&(n.logger=n.logger.clone(e)),["store","services","language"].forEach(a=>{n[a]=this[a]}),n.services=p({},this.services),n.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},i){const a=Object.keys(this.store.data).reduce((l,u)=>(l[u]=p({},this.store.data[u]),l[u]=Object.keys(l[u]).reduce((h,f)=>(h[f]=p({},l[u][f]),h),l[u]),l),{});n.store=new he(a,s),n.services.resourceStore=n.store}return n.translator=new Z(n.services,s),n.translator.on("*",(a,...l)=>{n.emit(a,...l)}),n.init(s,t),n.translator.options=s,n.translator.backendConnector.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},n}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const y=J.createInstance();y.createInstance=J.createInstance;y.createInstance;y.dir;y.init;y.loadResources;y.reloadResources;y.use;y.changeLanguage;y.getFixedT;y.t;y.exists;y.setDefaultNamespace;y.hasLoadedNamespace;y.loadNamespaces;y.loadLanguages;const Ze=(o,e)=>{for(const t of e){const i=o.find(t);i&&i.each((s,n)=>{const r=$(n);if(r.attr("data-i18n"))return;const a=r.text().trim();a&&(r.attr({"data-i18n":a}),r.text(y.t(a)));const l=r.attr("placeholder");l&&(r.attr({"data-i18n":"[placeholder]"+l}),r.attr({placeholder:y.t(l)}))})}},H=o=>{for(const e of o){const t=$(e);t&&t.each((i,s)=>{const n=$(s);if(n.attr("data-i18n"))return;const r=n.text().trim();r&&(n.attr({"data-i18n":r}),n.text(y.t(r)));const a=n.attr("placeholder");a&&(n.attr({"data-i18n":"[placeholder]"+a}),n.attr({placeholder:y.t(a)}))})}},Xe=(o,e)=>{Ze(e,[".hiprint-option-item-label","textarea","input","select option",".option","button","label",".hiprint-option-title",".hiprint-option-item-desc"])},qe=()=>{document.querySelectorAll("[data-i18n]").forEach(o=>{const e=o.getAttribute("data-i18n");if(!e.includes("[")){o.textContent=y.t(e);return}const t=e.match(/\[([^\]]+)\](.+)/);if(t&&t.length===3){const i=t[1],s=t[2];o.setAttribute(i,y.t(s))}})};let Le=!1;const Oe=o=>{if(Le)return;Le=!0,globalThis.hiprint.i18next=y,globalThis.hiprint.t=y.t;const e=Object.keys(o.resources||{});globalThis.hiprint.languages=["简体中文",...e],globalThis.hiprint.changeLanguage=(t,i)=>{y.changeLanguage(t,(s,n)=>{i&&i(s,n),qe()})}};function et(o,e){y.init(p({},o),(i,s)=>{e&&e(y,s,i)});let t=[];return{name:"i18n",description:"i18next",hooks:[{hook:"ready",name:"i18n set",description:"添加 i18n 方法",priority:1,run:()=>{Oe(o)}},{hook:"getOptionItem",name:"i18n options",description:"渲染元素属性时做多语言处理",priority:1,run:i=>{if(i){if(!i._translationWrapped){i._translationWrapped=!0;const s=i.createTarget;i.createTarget=function(...n){const r=s.call(i,...n);return t.indexOf(i.name)!==-1&&r.attr("data-name")||(r.attr({"data-name":i.name}),Xe(i,r)),r}}return t.indexOf(i.name)===-1&&t.push(i.name),i}}},{hook:"onDesigned",name:"i18n other selector",description:"其他UI选择器多语言处理",priority:1,run:({hiprint:i,designerUtils:s})=>{var a;Oe(o);const n=(a=s.printTemplate)==null?void 0:a.id;n&&(globalThis.hinnn.event.on("PrintElementSelectEventKey_"+n,l=>{setTimeout(()=>{H([".printSetting .prop-tab-items .tab-title"])},0)}),$(".hiprint-printPaper.design").on("contextmenu",()=>{H([".hicontextmenu .hicontextmenuitem .title span",".hicontextmenu .hicontextmenuitem .nav"])})),H([".svp-header p",".svp-tools .tool-name",".svp-dragbox .header span",".preview-bar button span",".printer-list-txt"])}},{hook:"onPreview",name:"i18n preview selector",description:"组件内预览选择器多语言处理",priority:1,run:i=>{setTimeout(()=>{H([".preview-bar button span",".printer-list-txt"])},0)}}],leastHiprintVersion:"0.1.28"}}exports.default=et;exports.translateBySelector=H;
|
|
1
|
+
"use strict";var Ne=Object.defineProperty,Te=Object.defineProperties;var Fe=Object.getOwnPropertyDescriptors;var re=Object.getOwnPropertySymbols;var Ee=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable;var ae=(r,e,t)=>e in r?Ne(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,p=(r,e)=>{for(var t in e||(e={}))Ee.call(e,t)&&ae(r,t,e[t]);if(re)for(var t of re(e))je.call(e,t)&&ae(r,t,e[t]);return r},O=(r,e)=>Te(r,Fe(e));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=r=>typeof r=="string",H=()=>{let r,e;const t=new Promise((s,i)=>{r=s,e=i});return t.resolve=r,t.reject=e,t},oe=r=>r==null?"":""+r,Ie=(r,e,t)=>{r.forEach(s=>{e[s]&&(t[s]=e[s])})},De=/###/g,le=r=>r&&r.indexOf("###")>-1?r.replace(De,"."):r,ue=r=>!r||g(r),B=(r,e,t)=>{const s=g(e)?e.split("."):e;let i=0;for(;i<s.length-1;){if(ue(r))return{};const n=le(s[i]);!r[n]&&t&&(r[n]=new t),Object.prototype.hasOwnProperty.call(r,n)?r=r[n]:r={},++i}return ue(r)?{}:{obj:r,k:le(s[i])}},he=(r,e,t)=>{const{obj:s,k:i}=B(r,e,Object);if(s!==void 0||e.length===1){s[i]=t;return}let n=e[e.length-1],a=e.slice(0,e.length-1),o=B(r,a,Object);for(;o.obj===void 0&&a.length;)n=`${a[a.length-1]}.${n}`,a=a.slice(0,a.length-1),o=B(r,a,Object),o!=null&&o.obj&&typeof o.obj[`${o.k}.${n}`]!="undefined"&&(o.obj=void 0);o.obj[`${o.k}.${n}`]=t},Ve=(r,e,t,s)=>{const{obj:i,k:n}=B(r,e,Object);i[n]=i[n]||[],i[n].push(t)},Q=(r,e)=>{const{obj:t,k:s}=B(r,e);if(t&&Object.prototype.hasOwnProperty.call(t,s))return t[s]},Ae=(r,e,t)=>{const s=Q(r,t);return s!==void 0?s:Q(e,t)},ve=(r,e,t)=>{for(const s in e)s!=="__proto__"&&s!=="constructor"&&(s in r?g(r[s])||r[s]instanceof String||g(e[s])||e[s]instanceof String?t&&(r[s]=e[s]):ve(r[s],e[s],t):r[s]=e[s]);return r},A=r=>r.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Ke={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const Me=r=>g(r)?r.replace(/[&<>"'\/]/g,e=>Ke[e]):r;class Ue{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(t!==void 0)return t;const s=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,s),this.regExpQueue.push(e),s}}const He=[" ",",","?","!",";"],Be=new Ue(20),ze=(r,e,t)=>{e=e||"",t=t||"";const s=He.filter(a=>e.indexOf(a)<0&&t.indexOf(a)<0);if(s.length===0)return!0;const i=Be.getRegExp(`(${s.map(a=>a==="?"?"\\?":a).join("|")})`);let n=!i.test(r);if(!n){const a=r.indexOf(t);a>0&&!i.test(r.substring(0,a))&&(n=!0)}return n},ee=(r,e,t=".")=>{if(!r)return;if(r[e])return Object.prototype.hasOwnProperty.call(r,e)?r[e]:void 0;const s=e.split(t);let i=r;for(let n=0;n<s.length;){if(!i||typeof i!="object")return;let a,o="";for(let l=n;l<s.length;++l)if(l!==n&&(o+=t),o+=s[l],a=i[o],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&l<s.length-1)continue;n+=l-n+1;break}i=a}return i},z=r=>r==null?void 0:r.replace("_","-"),Je={type:"logger",log(r){this.output("log",r)},warn(r){this.output("warn",r)},error(r){this.output("error",r)},output(r,e){var t,s;(s=(t=console==null?void 0:console[r])==null?void 0:t.apply)==null||s.call(t,console,e)}};class G{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||Je,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,s,i){return i&&!this.debug?null:(g(e[0])&&(e[0]=`${s}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new G(this.logger,p({prefix:`${this.prefix}:${e}:`},this.options))}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new G(this.logger,e)}}var T=new G;class X{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(s=>{this.observers[s]||(this.observers[s]=new Map);const i=this.observers[s].get(t)||0;this.observers[s].set(t,i+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([i,n])=>{for(let a=0;a<n;a++)i(...t)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([i,n])=>{for(let a=0;a<n;a++)i.apply(i,[e,...t])})}}class fe extends X{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,s,i={}){var u,f;const n=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,a=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let o;e.indexOf(".")>-1?o=e.split("."):(o=[e,t],s&&(Array.isArray(s)?o.push(...s):g(s)&&n?o.push(...s.split(n)):o.push(s)));const l=Q(this.data,o);return!l&&!t&&!s&&e.indexOf(".")>-1&&(e=o[0],t=o[1],s=o.slice(2).join(".")),l||!a||!g(s)?l:ee((f=(u=this.data)==null?void 0:u[e])==null?void 0:f[t],s,n)}addResource(e,t,s,i,n={silent:!1}){const a=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=[e,t];s&&(o=o.concat(a?s.split(a):s)),e.indexOf(".")>-1&&(o=e.split("."),i=t,t=o[1]),this.addNamespaces(t),he(this.data,o,i),n.silent||this.emit("added",e,t,s,i)}addResources(e,t,s,i={silent:!1}){for(const n in s)(g(s[n])||Array.isArray(s[n]))&&this.addResource(e,t,n,s[n],{silent:!0});i.silent||this.emit("added",e,t,s)}addResourceBundle(e,t,s,i,n,a={silent:!1,skipCopy:!1}){let o=[e,t];e.indexOf(".")>-1&&(o=e.split("."),i=s,s=t,t=o[1]),this.addNamespaces(t);let l=Q(this.data,o)||{};a.skipCopy||(s=JSON.parse(JSON.stringify(s))),i?ve(l,s,n):l=p(p({},l),s),he(this.data,o,l),a.silent||this.emit("added",e,t,s)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(i=>t[i]&&Object.keys(t[i]).length>0)}toJSON(){return this.data}}var Ce={processors:{},addPostProcessor(r){this.processors[r.name]=r},handle(r,e,t,s,i){return r.forEach(n=>{var a,o;e=(o=(a=this.processors[n])==null?void 0:a.process(e,t,s,i))!=null?o:e}),e}};const ce={},de=r=>!g(r)&&typeof r!="boolean"&&typeof r!="number";class Z extends X{constructor(e,t={}){super(),Ie(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=T.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const s=p({},t);if(e==null)return!1;const i=this.resolve(e,s);return(i==null?void 0:i.res)!==void 0}extractFromKey(e,t){let s=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");const i=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let n=t.ns||this.options.defaultNS||[];const a=s&&e.indexOf(s)>-1,o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!ze(e,s,i);if(a&&!o){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:g(n)?[n]:n};const u=e.split(s);(s!==i||s===i&&this.options.ns.indexOf(u[0])>-1)&&(n=u.shift()),e=u.join(i)}return{key:e,namespaces:g(n)?[n]:n}}translate(e,t,s){let i=typeof t=="object"?p({},t):t;if(typeof i!="object"&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof options=="object"&&(i=p({},i)),i||(i={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const n=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,a=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,{key:o,namespaces:l}=this.extractFromKey(e[e.length-1],i),u=l[l.length-1];let f=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;f===void 0&&(f=":");const h=i.lng||this.language,m=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((h==null?void 0:h.toLowerCase())==="cimode")return m?n?{res:`${u}${f}${o}`,usedKey:o,exactUsedKey:o,usedLng:h,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:`${u}${f}${o}`:n?{res:o,usedKey:o,exactUsedKey:o,usedLng:h,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:o;const d=this.resolve(e,i);let c=d==null?void 0:d.res;const x=(d==null?void 0:d.usedKey)||o,S=(d==null?void 0:d.exactUsedKey)||o,P=["[object Number]","[object Function]","[object RegExp]"],C=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,I=!this.i18nFormat||this.i18nFormat.handleAsObject,L=i.count!==void 0&&!g(i.count),F=Z.hasDefaultValue(i),_=L?this.pluralResolver.getSuffix(h,i.count,i):"",E=i.ordinal&&L?this.pluralResolver.getSuffix(h,i.count,{ordinal:!1}):"",K=L&&!i.ordinal&&i.count===0,w=K&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${_}`]||i[`defaultValue${E}`]||i.defaultValue;let b=c;I&&!c&&F&&(b=w);const Re=de(b),ke=Object.prototype.toString.apply(b);if(I&&b&&Re&&P.indexOf(ke)<0&&!(g(C)&&Array.isArray(b))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const k=this.options.returnedObjectHandler?this.options.returnedObjectHandler(x,b,O(p({},i),{ns:l})):`key '${o} (${this.language})' returned an object instead of string.`;return n?(d.res=k,d.usedParams=this.getUsedParamsDetails(i),d):k}if(a){const k=Array.isArray(b),R=k?[]:{},te=k?S:x;for(const N in b)if(Object.prototype.hasOwnProperty.call(b,N)){const j=`${te}${a}${N}`;F&&!c?R[N]=this.translate(j,O(p({},i),{defaultValue:de(w)?w[N]:void 0,joinArrays:!1,ns:l})):R[N]=this.translate(j,O(p({},i),{joinArrays:!1,ns:l})),R[N]===j&&(R[N]=b[N])}c=R}}else if(I&&g(C)&&Array.isArray(c))c=c.join(C),c&&(c=this.extendTranslation(c,e,i,s));else{let k=!1,R=!1;!this.isValidLookup(c)&&F&&(k=!0,c=w),this.isValidLookup(c)||(R=!0,c=o);const N=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&R?void 0:c,j=F&&w!==c&&this.options.updateMissing;if(R||k||j){if(this.logger.log(j?"updateKey":"missingKey",h,u,o,j?w:c),a){const v=this.resolve(o,O(p({},i),{keySeparator:!1}));v&&v.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 M=[];const W=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&W&&W[0])for(let v=0;v<W.length;v++)M.push(W[v]);else this.options.saveMissingTo==="all"?M=this.languageUtils.toResolveHierarchy(i.lng||this.language):M.push(i.lng||this.language);const se=(v,D,U)=>{var ne;const ie=F&&U!==c?U:N;this.options.missingKeyHandler?this.options.missingKeyHandler(v,u,D,ie,j,i):(ne=this.backendConnector)!=null&&ne.saveMissing&&this.backendConnector.saveMissing(v,u,D,ie,j,i),this.emit("missingKey",v,u,D,c)};this.options.saveMissing&&(this.options.saveMissingPlurals&&L?M.forEach(v=>{const D=this.pluralResolver.getSuffixes(v,i);K&&i[`defaultValue${this.options.pluralSeparator}zero`]&&D.indexOf(`${this.options.pluralSeparator}zero`)<0&&D.push(`${this.options.pluralSeparator}zero`),D.forEach(U=>{se([v],o+U,i[`defaultValue${U}`]||w)})}):se(M,o,w))}c=this.extendTranslation(c,e,i,d,s),R&&c===o&&this.options.appendNamespaceToMissingKey&&(c=`${u}${f}${o}`),(R||k)&&this.options.parseMissingKeyHandler&&(c=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${f}${o}`:o,k?c:void 0,i))}return n?(d.res=c,d.usedParams=this.getUsedParamsDetails(i),d):c}extendTranslation(e,t,s,i,n){var l,u;if((l=this.i18nFormat)!=null&&l.parse)e=this.i18nFormat.parse(e,p(p({},this.options.interpolation.defaultVariables),s),s.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init(O(p({},s),{interpolation:p(p({},this.options.interpolation),s.interpolation)}));const f=g(e)&&(((u=s==null?void 0:s.interpolation)==null?void 0:u.skipOnVariables)!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let h;if(f){const d=e.match(this.interpolator.nestingRegexp);h=d&&d.length}let m=s.replace&&!g(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables&&(m=p(p({},this.options.interpolation.defaultVariables),m)),e=this.interpolator.interpolate(e,m,s.lng||this.language||i.usedLng,s),f){const d=e.match(this.interpolator.nestingRegexp),c=d&&d.length;h<c&&(s.nest=!1)}!s.lng&&i&&i.res&&(s.lng=this.language||i.usedLng),s.nest!==!1&&(e=this.interpolator.nest(e,(...d)=>(n==null?void 0:n[0])===d[0]&&!s.context?(this.logger.warn(`It seems you are nesting recursively key: ${d[0]} in key: ${t[0]}`),null):this.translate(...d,t),s)),s.interpolation&&this.interpolator.reset()}const a=s.postProcess||this.options.postProcess,o=g(a)?[a]:a;return e!=null&&(o!=null&&o.length)&&s.applyPostProcessor!==!1&&(e=Ce.handle(o,e,t,this.options&&this.options.postProcessPassResolved?p({i18nResolved:O(p({},i),{usedParams:this.getUsedParamsDetails(s)})},s):s,this)),e}resolve(e,t={}){let s,i,n,a,o;return g(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(s))return;const u=this.extractFromKey(l,t),f=u.key;i=f;let h=u.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));const m=t.count!==void 0&&!g(t.count),d=m&&!t.ordinal&&t.count===0,c=t.context!==void 0&&(g(t.context)||typeof t.context=="number")&&t.context!=="",x=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);h.forEach(S=>{var P,C;this.isValidLookup(s)||(o=S,!ce[`${x[0]}-${S}`]&&((P=this.utils)!=null&&P.hasLoadedNamespace)&&!((C=this.utils)!=null&&C.hasLoadedNamespace(o))&&(ce[`${x[0]}-${S}`]=!0,this.logger.warn(`key "${i}" for languages "${x.join(", ")}" won't get resolved as namespace "${o}" 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!!!")),x.forEach(I=>{var _;if(this.isValidLookup(s))return;a=I;const L=[f];if((_=this.i18nFormat)!=null&&_.addLookupKeys)this.i18nFormat.addLookupKeys(L,f,I,S,t);else{let E;m&&(E=this.pluralResolver.getSuffix(I,t.count,t));const K=`${this.options.pluralSeparator}zero`,w=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(m&&(L.push(f+E),t.ordinal&&E.indexOf(w)===0&&L.push(f+E.replace(w,this.options.pluralSeparator)),d&&L.push(f+K)),c){const b=`${f}${this.options.contextSeparator}${t.context}`;L.push(b),m&&(L.push(b+E),t.ordinal&&E.indexOf(w)===0&&L.push(b+E.replace(w,this.options.pluralSeparator)),d&&L.push(b+K))}}let F;for(;F=L.pop();)this.isValidLookup(s)||(n=F,s=this.getResource(I,S,F,t))}))})}),{res:s,usedKey:i,exactUsedKey:n,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,s,i={}){var n;return(n=this.i18nFormat)!=null&&n.getResource?this.i18nFormat.getResource(e,t,s,i):this.resourceStore.getResource(e,t,s,i)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=e.replace&&!g(e.replace);let i=s?e.replace:e;if(s&&typeof e.count!="undefined"&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i=p(p({},this.options.interpolation.defaultVariables),i)),!s){i=p({},i);for(const n of t)delete i[n]}return i}static hasDefaultValue(e){const t="defaultValue";for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t===s.substring(0,t.length)&&e[s]!==void 0)return!0;return!1}}class pe{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=T.create("languageUtils")}getScriptPartFromCode(e){if(e=z(e),!e||e.indexOf("-")<0)return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=z(e),!e||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(g(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(s){}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(s=>{if(t)return;const i=this.formatLanguageCode(s);(!this.options.supportedLngs||this.isSupportedCode(i))&&(t=i)}),!t&&this.options.supportedLngs&&e.forEach(s=>{if(t)return;const i=this.getScriptPartFromCode(s);if(this.isSupportedCode(i))return t=i;const n=this.getLanguagePartFromCode(s);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find(a=>{if(a===n)return a;if(!(a.indexOf("-")<0&&n.indexOf("-")<0)&&(a.indexOf("-")>0&&n.indexOf("-")<0&&a.substring(0,a.indexOf("-"))===n||a.indexOf(n)===0&&n.length>1))return a})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),g(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let s=e[t];return s||(s=e[this.getScriptPartFromCode(t)]),s||(s=e[this.formatLanguageCode(t)]),s||(s=e[this.getLanguagePartFromCode(t)]),s||(s=e.default),s||[]}toResolveHierarchy(e,t){const s=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),i=[],n=a=>{a&&(this.isSupportedCode(a)?i.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return g(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&n(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&n(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&n(this.getLanguagePartFromCode(e))):g(e)&&n(this.formatLanguageCode(e)),s.forEach(a=>{i.indexOf(a)<0&&n(this.formatLanguageCode(a))}),i}}const ge={zero:0,one:1,two:2,few:3,many:4,other:5},me={select:r=>r===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class _e{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=T.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const s=z(e==="dev"?"en":e),i=t.ordinal?"ordinal":"cardinal",n=JSON.stringify({cleanedCode:s,type:i});if(n in this.pluralRulesCache)return this.pluralRulesCache[n];let a;try{a=new Intl.PluralRules(s,{type:i})}catch(o){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),me;if(!e.match(/-|_/))return me;const l=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(l,t)}return this.pluralRulesCache[n]=a,a}needsPlural(e,t={}){let s=this.getRule(e,t);return s||(s=this.getRule("dev",t)),(s==null?void 0:s.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,t,s={}){return this.getSuffixes(e,s).map(i=>`${t}${i}`)}getSuffixes(e,t={}){let s=this.getRule(e,t);return s||(s=this.getRule("dev",t)),s?s.resolvedOptions().pluralCategories.sort((i,n)=>ge[i]-ge[n]).map(i=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(e,t,s={}){const i=this.getRule(e,s);return i?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${i.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,s))}}const xe=(r,e,t,s=".",i=!0)=>{let n=Ae(r,e,t);return!n&&i&&g(t)&&(n=ee(r,t,s),n===void 0&&(n=ee(e,t,s))),n},q=r=>r.replace(/\$/g,"$$$$");class We{constructor(e={}){var t;this.logger=T.create("interpolator"),this.options=e,this.format=((t=e==null?void 0:e.interpolation)==null?void 0:t.format)||(s=>s),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:s,useRawValueToEscape:i,prefix:n,prefixEscaped:a,suffix:o,suffixEscaped:l,formatSeparator:u,unescapeSuffix:f,unescapePrefix:h,nestingPrefix:m,nestingPrefixEscaped:d,nestingSuffix:c,nestingSuffixEscaped:x,nestingOptionsSeparator:S,maxReplaces:P,alwaysFormat:C}=e.interpolation;this.escape=t!==void 0?t:Me,this.escapeValue=s!==void 0?s:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=n?A(n):a||"{{",this.suffix=o?A(o):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=f?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":f||"",this.nestingPrefix=m?A(m):d||A("$t("),this.nestingSuffix=c?A(c):x||A(")"),this.nestingOptionsSeparator=S||",",this.maxReplaces=P||1e3,this.alwaysFormat=C!==void 0?C:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,s)=>(t==null?void 0:t.source)===s?(t.lastIndex=0,t):new RegExp(s,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,t,s,i){var d;let n,a,o;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=c=>{if(c.indexOf(this.formatSeparator)<0){const C=xe(t,l,c,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(C,void 0,s,O(p(p({},i),t),{interpolationkey:c})):C}const x=c.split(this.formatSeparator),S=x.shift().trim(),P=x.join(this.formatSeparator).trim();return this.format(xe(t,l,S,this.options.keySeparator,this.options.ignoreJSONStructure),P,s,O(p(p({},i),t),{interpolationkey:S}))};this.resetRegExp();const f=(i==null?void 0:i.missingInterpolationHandler)||this.options.missingInterpolationHandler,h=((d=i==null?void 0:i.interpolation)==null?void 0:d.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:c=>q(c)},{regex:this.regexp,safeValue:c=>this.escapeValue?q(this.escape(c)):q(c)}].forEach(c=>{for(o=0;n=c.regex.exec(e);){const x=n[1].trim();if(a=u(x),a===void 0)if(typeof f=="function"){const P=f(e,n,i);a=g(P)?P:""}else if(i&&Object.prototype.hasOwnProperty.call(i,x))a="";else if(h){a=n[0];continue}else this.logger.warn(`missed to pass in variable ${x} for interpolating ${e}`),a="";else!g(a)&&!this.useRawValueToEscape&&(a=oe(a));const S=c.safeValue(a);if(e=e.replace(n[0],S),h?(c.regex.lastIndex+=a.length,c.regex.lastIndex-=n[0].length):c.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,s={}){let i,n,a;const o=(l,u)=>{var x;const f=this.nestingOptionsSeparator;if(l.indexOf(f)<0)return l;const h=l.split(new RegExp(`${f}[ ]*{`));let m=`{${h[1]}`;l=h[0],m=this.interpolate(m,a);const d=m.match(/'/g),c=m.match(/"/g);(((x=d==null?void 0:d.length)!=null?x:0)%2===0&&!c||c.length%2!==0)&&(m=m.replace(/'/g,'"'));try{a=JSON.parse(m),u&&(a=p(p({},u),a))}catch(S){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,S),`${l}${f}${m}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,l};for(;i=this.nestingRegexp.exec(e);){let l=[];a=p({},s),a=a.replace&&!g(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;const u=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(u!==-1&&(l=i[1].slice(u).split(this.formatSeparator).map(f=>f.trim()).filter(Boolean),i[1]=i[1].slice(0,u)),n=t(o.call(this,i[1].trim(),a),a),n&&i[0]===e&&!g(n))return n;g(n)||(n=oe(n)),n||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),n=""),l.length&&(n=l.reduce((f,h)=>this.format(f,h,s.lng,O(p({},s),{interpolationkey:i[1].trim()})),n.trim())),e=e.replace(i[0],n),this.regexp.lastIndex=0}return e}}const Ye=r=>{let e=r.toLowerCase().trim();const t={};if(r.indexOf("(")>-1){const s=r.split("(");e=s[0].toLowerCase().trim();const i=s[1].substring(0,s[1].length-1);e==="currency"&&i.indexOf(":")<0?t.currency||(t.currency=i.trim()):e==="relativetime"&&i.indexOf(":")<0?t.range||(t.range=i.trim()):i.split(";").forEach(a=>{if(a){const[o,...l]=a.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),f=o.trim();t[f]||(t[f]=u),u==="false"&&(t[f]=!1),u==="true"&&(t[f]=!0),isNaN(u)||(t[f]=parseInt(u,10))}})}return{formatName:e,formatOptions:t}},ye=r=>{const e={};return(t,s,i)=>{let n=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(n=O(p({},n),{[i.interpolationkey]:void 0}));const a=s+JSON.stringify(n);let o=e[a];return o||(o=r(z(s),i),e[a]=o),o(t)}},Qe=r=>(e,t,s)=>r(z(t),s)(e);class Ge{constructor(e={}){this.logger=T.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const s=t.cacheInBuiltFormats?ye:Qe;this.formats={number:s((i,n)=>{const a=new Intl.NumberFormat(i,p({},n));return o=>a.format(o)}),currency:s((i,n)=>{const a=new Intl.NumberFormat(i,O(p({},n),{style:"currency"}));return o=>a.format(o)}),datetime:s((i,n)=>{const a=new Intl.DateTimeFormat(i,p({},n));return o=>a.format(o)}),relativetime:s((i,n)=>{const a=new Intl.RelativeTimeFormat(i,p({},n));return o=>a.format(o,n.range||"day")}),list:s((i,n)=>{const a=new Intl.ListFormat(i,p({},n));return o=>a.format(o)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=ye(t)}format(e,t,s,i={}){const n=t.split(this.formatSeparator);if(n.length>1&&n[0].indexOf("(")>1&&n[0].indexOf(")")<0&&n.find(o=>o.indexOf(")")>-1)){const o=n.findIndex(l=>l.indexOf(")")>-1);n[0]=[n[0],...n.splice(1,o)].join(this.formatSeparator)}return n.reduce((o,l)=>{var h;const{formatName:u,formatOptions:f}=Ye(l);if(this.formats[u]){let m=o;try{const d=((h=i==null?void 0:i.formatParams)==null?void 0:h[i.interpolationkey])||{},c=d.locale||d.lng||i.locale||i.lng||s;m=this.formats[u](o,c,p(p(p({},f),i),d))}catch(d){this.logger.warn(d)}return m}else this.logger.warn(`there was no format function for ${u}`);return o},e)}}const Ze=(r,e)=>{r.pending[e]!==void 0&&(delete r.pending[e],r.pendingCount--)};class Xe extends X{constructor(e,t,s,i={}){var n,a;super(),this.backend=e,this.store=t,this.services=s,this.languageUtils=s.languageUtils,this.options=i,this.logger=T.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],(a=(n=this.backend)==null?void 0:n.init)==null||a.call(n,s,i.backend,i)}queueLoad(e,t,s,i){const n={},a={},o={},l={};return e.forEach(u=>{let f=!0;t.forEach(h=>{const m=`${u}|${h}`;!s.reload&&this.store.hasResourceBundle(u,h)?this.state[m]=2:this.state[m]<0||(this.state[m]===1?a[m]===void 0&&(a[m]=!0):(this.state[m]=1,f=!1,a[m]===void 0&&(a[m]=!0),n[m]===void 0&&(n[m]=!0),l[h]===void 0&&(l[h]=!0)))}),f||(o[u]=!0)}),(Object.keys(n).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(n),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(l)}}loaded(e,t,s){const i=e.split("|"),n=i[0],a=i[1];t&&this.emit("failedLoading",n,a,t),!t&&s&&this.store.addResourceBundle(n,a,s,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&s&&(this.state[e]=0);const o={};this.queue.forEach(l=>{Ve(l.loaded,[n],a),Ze(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{o[u]||(o[u]={});const f=l.loaded[u];f.length&&f.forEach(h=>{o[u][h]===void 0&&(o[u][h]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",o),this.queue=this.queue.filter(l=>!l.done)}read(e,t,s,i=0,n=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:s,tried:i,wait:n,callback:a});return}this.readingCalls++;const o=(u,f)=>{if(this.readingCalls--,this.waitingReads.length>0){const h=this.waitingReads.shift();this.read(h.lng,h.ns,h.fcName,h.tried,h.wait,h.callback)}if(u&&f&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,s,i+1,n*2,a)},n);return}a(u,f)},l=this.backend[s].bind(this.backend);if(l.length===2){try{const u=l(e,t);u&&typeof u.then=="function"?u.then(f=>o(null,f)).catch(o):o(null,u)}catch(u){o(u)}return}return l(e,t,o)}prepareLoading(e,t,s={},i){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();g(e)&&(e=this.languageUtils.toResolveHierarchy(e)),g(t)&&(t=[t]);const n=this.queueLoad(e,t,s,i);if(!n.toLoad.length)return n.pending.length||i(),null;n.toLoad.forEach(a=>{this.loadOne(a)})}load(e,t,s){this.prepareLoading(e,t,{},s)}reload(e,t,s){this.prepareLoading(e,t,{reload:!0},s)}loadOne(e,t=""){const s=e.split("|"),i=s[0],n=s[1];this.read(i,n,"read",void 0,void 0,(a,o)=>{a&&this.logger.warn(`${t}loading namespace ${n} for language ${i} failed`,a),!a&&o&&this.logger.log(`${t}loaded namespace ${n} for language ${i}`,o),this.loaded(e,a,o)})}saveMissing(e,t,s,i,n,a={},o=()=>{}){var l,u,f,h,m;if((u=(l=this.services)==null?void 0:l.utils)!=null&&u.hasLoadedNamespace&&!((h=(f=this.services)==null?void 0:f.utils)!=null&&h.hasLoadedNamespace(t))){this.logger.warn(`did not save key "${s}" as the namespace "${t}" 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(!(s==null||s==="")){if((m=this.backend)!=null&&m.create){const d=O(p({},a),{isUpdate:n}),c=this.backend.create.bind(this.backend);if(c.length<6)try{let x;c.length===5?x=c(e,t,s,i,d):x=c(e,t,s,i),x&&typeof x.then=="function"?x.then(S=>o(null,S)).catch(o):o(null,x)}catch(x){o(x)}else c(e,t,s,i,o,d)}!e||!e[0]||this.store.addResource(e[0],t,s,i)}}}const Se=()=>({debug:!1,initAsync:!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:r=>{let e={};if(typeof r[1]=="object"&&(e=r[1]),g(r[1])&&(e.defaultValue=r[1]),g(r[2])&&(e.tDescription=r[2]),typeof r[2]=="object"||typeof r[3]=="object"){const t=r[3]||r[2];Object.keys(t).forEach(s=>{e[s]=t[s]})}return e},interpolation:{escapeValue:!0,format:r=>r,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),be=r=>{var e,t;return g(r.ns)&&(r.ns=[r.ns]),g(r.fallbackLng)&&(r.fallbackLng=[r.fallbackLng]),g(r.fallbackNS)&&(r.fallbackNS=[r.fallbackNS]),((t=(e=r.supportedLngs)==null?void 0:e.indexOf)==null?void 0:t.call(e,"cimode"))<0&&(r.supportedLngs=r.supportedLngs.concat(["cimode"])),typeof r.initImmediate=="boolean"&&(r.initAsync=r.initImmediate),r},Y=()=>{},qe=r=>{Object.getOwnPropertyNames(Object.getPrototypeOf(r)).forEach(t=>{typeof r[t]=="function"&&(r[t]=r[t].bind(r))})};class J extends X{constructor(e={},t){if(super(),this.options=be(e),this.services={},this.logger=T,this.modules={external:[]},qe(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e=="function"&&(t=e,e={}),e.defaultNS==null&&e.ns&&(g(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const s=Se();this.options=p(p(p({},s),this.options),be(e)),this.options.interpolation=p(p({},s.interpolation),this.options.interpolation),e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator);const i=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?T.init(i(this.modules.logger),this.options):T.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=Ge;const f=new pe(this.options);this.store=new fe(this.options.resources,this.options);const h=this.services;h.logger=T,h.resourceStore=this.store,h.languageUtils=f,h.pluralResolver=new _e(f,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==s.interpolation.format&&this.logger.warn("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),u&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(h.formatter=i(u),h.formatter.init&&h.formatter.init(h,this.options),this.options.interpolation.format=h.formatter.format.bind(h.formatter)),h.interpolator=new We(this.options),h.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},h.backendConnector=new Xe(i(this.modules.backend),h.resourceStore,h,this.options),h.backendConnector.on("*",(d,...c)=>{this.emit(d,...c)}),this.modules.languageDetector&&(h.languageDetector=i(this.modules.languageDetector),h.languageDetector.init&&h.languageDetector.init(h,this.options.detection,this.options)),this.modules.i18nFormat&&(h.i18nFormat=i(this.modules.i18nFormat),h.i18nFormat.init&&h.i18nFormat.init(this)),this.translator=new Z(this.services,this.options),this.translator.on("*",(d,...c)=>{this.emit(d,...c)}),this.modules.external.forEach(d=>{d.init&&d.init(this)})}if(this.format=this.options.interpolation.format,t||(t=Y),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[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(u=>{this[u]=(...f)=>this.store[u](...f)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=(...f)=>(this.store[u](...f),this)});const o=H(),l=()=>{const u=(f,h)=>{this.isInitializing=!1,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),o.resolve(h),t(f,h)};if(this.languages&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),o}loadResources(e,t=Y){var n,a;let s=t;const i=g(e)?e:this.language;if(typeof e=="function"&&(s=e),!this.options.resources||this.options.partialBundledLanguages){if((i==null?void 0:i.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return s();const o=[],l=u=>{if(!u||u==="cimode")return;this.services.languageUtils.toResolveHierarchy(u).forEach(h=>{h!=="cimode"&&o.indexOf(h)<0&&o.push(h)})};i?l(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(f=>l(f)),(a=(n=this.options.preload)==null?void 0:n.forEach)==null||a.call(n,u=>l(u)),this.services.backendConnector.load(o,this.options.ns,u=>{!u&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),s(u)})}else s(null)}reloadResources(e,t,s){const i=H();return typeof e=="function"&&(s=e,e=void 0),typeof t=="function"&&(s=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),s||(s=Y),this.services.backendConnector.reload(e,t,n=>{i.resolve(),s(n)}),i}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&Ce.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let t=0;t<this.languages.length;t++){const s=this.languages[t];if(!(["cimode","dev"].indexOf(s)>-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;const s=H();this.emit("languageChanging",e);const i=o=>{this.language=o,this.languages=this.services.languageUtils.toResolveHierarchy(o),this.resolvedLanguage=void 0,this.setResolvedLanguage(o)},n=(o,l)=>{l?this.isLanguageChangingTo===e&&(i(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,s.resolve((...u)=>this.t(...u)),t&&t(o,(...u)=>this.t(...u))},a=o=>{var f,h;!e&&!o&&this.services.languageDetector&&(o=[]);const l=g(o)?o:o&&o[0],u=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(g(o)?[o]:o);u&&(this.language||i(u),this.translator.language||this.translator.changeLanguage(u),(h=(f=this.services.languageDetector)==null?void 0:f.cacheUserLanguage)==null||h.call(f,u)),this.loadResources(u,m=>{n(m,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),s}getFixedT(e,t,s){const i=(n,a,...o)=>{let l;typeof a!="object"?l=this.options.overloadTranslationOptionHandler([n,a].concat(o)):l=p({},a),l.lng=l.lng||i.lng,l.lngs=l.lngs||i.lngs,l.ns=l.ns||i.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||s||i.keyPrefix);const u=this.options.keySeparator||".";let f;return l.keyPrefix&&Array.isArray(n)?f=n.map(h=>`${l.keyPrefix}${u}${h}`):f=l.keyPrefix?`${l.keyPrefix}${u}${n}`:n,this.t(f,l)};return g(e)?i.lng=e:i.lngs=e,i.ns=t,i.keyPrefix=s,i}t(...e){var t;return(t=this.translator)==null?void 0:t.translate(...e)}exists(...e){var t;return(t=this.translator)==null?void 0:t.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){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 s=t.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,n=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;const a=(o,l)=>{const u=this.services.backendConnector.state[`${o}|${l}`];return u===-1||u===0||u===2};if(t.precheck){const o=t.precheck(this,a);if(o!==void 0)return o}return!!(this.hasResourceBundle(s,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(s,e)&&(!i||a(n,e)))}loadNamespaces(e,t){const s=H();return this.options.ns?(g(e)&&(e=[e]),e.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{s.resolve(),t&&t(i)}),s):(t&&t(),Promise.resolve())}loadLanguages(e,t){const s=H();g(e)&&(e=[e]);const i=this.options.preload||[],n=e.filter(a=>i.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return n.length?(this.options.preload=i.concat(n),this.loadResources(a=>{s.resolve(),t&&t(a)}),s):(t&&t(),Promise.resolve())}dir(e){var i,n;if(e||(e=this.resolvedLanguage||(((i=this.languages)==null?void 0:i.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const a=new Intl.Locale(e);if(a&&a.getTextInfo){const o=a.getTextInfo();if(o&&o.direction)return o.direction}}catch(a){}const t=["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"],s=((n=this.services)==null?void 0:n.languageUtils)||new pe(Se());return e.toLowerCase().indexOf("-latn")>1?"ltr":t.indexOf(s.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){return new J(e,t)}cloneInstance(e={},t=Y){const s=e.forkResourceStore;s&&delete e.forkResourceStore;const i=O(p(p({},this.options),e),{isClone:!0}),n=new J(i);if((e.debug!==void 0||e.prefix!==void 0)&&(n.logger=n.logger.clone(e)),["store","services","language"].forEach(o=>{n[o]=this[o]}),n.services=p({},this.services),n.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},s){const o=Object.keys(this.store.data).reduce((l,u)=>(l[u]=p({},this.store.data[u]),l[u]=Object.keys(l[u]).reduce((f,h)=>(f[h]=p({},l[u][h]),f),l[u]),l),{});n.store=new fe(o,i),n.services.resourceStore=n.store}return n.translator=new Z(n.services,i),n.translator.on("*",(o,...l)=>{n.emit(o,...l)}),n.init(i,t),n.translator.options=i,n.translator.backendConnector.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},n}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const y=J.createInstance();y.createInstance=J.createInstance;y.createInstance;y.dir;y.init;y.loadResources;y.reloadResources;y.use;y.changeLanguage;y.getFixedT;y.t;y.exists;y.setDefaultNamespace;y.hasLoadedNamespace;y.loadNamespaces;y.loadLanguages;const et=(r,e)=>{for(const t of e){const s=r.find(t);s&&s.each((i,n)=>{const a=$(n);if(a.attr("data-i18n"))return;const o=a.text().trim();o&&(a.attr({"data-i18n":o}),a.text(y.t(o)));const l=a.attr("placeholder");l&&(a.attr({"data-i18n":"[placeholder]"+l}),a.attr({placeholder:y.t(l)}))})}},V=r=>{for(const e of r){const t=$(e);t&&t.each((s,i)=>{const n=$(i);if(n.attr("data-i18n"))return;const a=n.text().trim();a&&(n.attr({"data-i18n":a}),n.text(y.t(a)));const o=n.attr("placeholder");o&&(n.attr({"data-i18n":"[placeholder]"+o}),n.attr({placeholder:y.t(o)}))})}},Pe=[".hiprint-option-item-label","textarea","input","select option",".option","button","label",".hiprint-option-title",".hiprint-option-item-desc",".hiprint-multiselect-search",".hiprint-multiselect-custom-input",".hiprint-multiselect-trigger .hiprint-multiselect-text",".hiprint-multiselect-item span",".hiprint-multiselect-actions button"],tt=(r,e,t=Pe)=>{et(e,t)},$e=(r="[data-i18n]")=>{document.querySelectorAll(r).forEach(e=>{const t=e.getAttribute("data-i18n");if(!t.includes("[")){e.textContent=y.t(t);return}const s=t.match(/\[([^\]]+)\](.+)/);if(s&&s.length===3){const i=s[1],n=s[2];e.setAttribute(i,y.t(n))}})};let Le=!1;const Oe=r=>{if(Le)return;Le=!0,globalThis.hiprint.i18next=y,globalThis.hiprint.t=y.t;const e=Object.keys(r.resources||{});globalThis.hiprint.languages=["简体中文",...e],globalThis.hiprint.changeLanguage=(t,s)=>{y.changeLanguage(t,(i,n)=>{s&&s(i,n),$e()})}},we=r=>{setTimeout(()=>{$e(".printSetting .hiprint-multiselect [data-i18n]"),$(".printSetting .hiprint-multiselect").length&&$(".printSetting .hiprint-multiselect-trigger").off("click.multiselect-trigger").on("click.multiselect-trigger",()=>{console.log("click multiselect"),setTimeout(()=>{V((r==null?void 0:r.optionsSelectorList)||Pe)},0)})},0)};function st(r,e){y.init(p({},r),(s,i)=>{e&&e(y,i,s)});let t=[];return{name:"i18n",description:"i18next",hooks:[{hook:"ready",name:"i18n set",description:"添加 i18n 方法",priority:1,run:()=>{Oe(r)}},{hook:"getOptionItem",name:"i18n options",description:"渲染元素属性时做多语言处理",priority:1,run:s=>{if(s){if(!s._translationWrapped){s._translationWrapped=!0;const i=s.createTarget;s.createTarget=function(...n){const a=i.call(s,...n);return t.indexOf(s.name)!==-1&&a.attr("data-name")||(a.attr({"data-name":s.name}),tt(s,a,r==null?void 0:r.optionsSelectorList)),a}}return t.indexOf(s.name)===-1&&t.push(s.name),s}}},{hook:"onDesigned",name:"i18n other selector",description:"其他UI选择器多语言处理",priority:9,run:({hiprint:s,designerUtils:i})=>{Oe(r),setTimeout(()=>{var o;const n=(o=i.printTemplate)==null?void 0:o.id;n&&(r!=null&&r.onDesigned&&(r==null||r.onDesigned(i)),globalThis.hinnn.event.on("BuildCustomOptionSettingEventKey_"+n,l=>{r!=null&&r.onPanelSelected&&(r==null||r.onPanelSelected()),we(r)}),globalThis.hinnn.event.on("PrintElementSelectEventKey_"+n,l=>{setTimeout(()=>{V([".printSetting .prop-tab-items .tab-title"]),we(r),r!=null&&r.onElementSelected&&(r==null||r.onElementSelected(l))},0)}),$(".hiprint-printPaper.design").on("contextmenu",()=>{V([".hicontextmenu .hicontextmenuitem .title span",".hicontextmenu .hicontextmenuitem .nav"])})),V([".svp-header p",".svp-tools .tool-name",".svp-dragbox .header span",".preview-bar button span",".printer-list-txt"])},(r==null?void 0:r.onDesignedDelay)||600)}},{hook:"onSettings",name:"i18n settings",description:"设置选择器多语言处理",priority:1,run:s=>{s.type=="show"&&setTimeout(()=>{V([".settings-body .svp-tab"])},0),r!=null&&r.onSettings&&(r==null||r.onSettings(s))}},{hook:"onPreview",name:"i18n preview selector",description:"组件内预览选择器多语言处理",priority:1,run:s=>{setTimeout(()=>{V([".preview-bar button span",".printer-list-txt"])},(r==null?void 0:r.onPreviewDelay)||0),r!=null&&r.onPreview&&(r==null||r.onPreview(s))}}],leastHiprintVersion:"0.1.28"}}exports.default=st;exports.translateBySelector=V;
|