@aidc-toolkit/utility 1.0.46 → 1.0.47-beta
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/dist/character-set.d.ts +242 -0
- package/dist/character-set.d.ts.map +1 -0
- package/dist/character-set.js +542 -0
- package/dist/character-set.js.map +1 -0
- package/dist/exclusion.d.ts +26 -0
- package/dist/exclusion.d.ts.map +1 -0
- package/dist/exclusion.js +18 -0
- package/dist/exclusion.js.map +1 -0
- package/dist/index.d.ts +26 -699
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -0
- package/dist/iterable-utility.d.ts +39 -0
- package/dist/iterable-utility.d.ts.map +1 -0
- package/dist/iterable-utility.js +35 -0
- package/dist/iterable-utility.js.map +1 -0
- package/dist/locale/en/locale-resources.d.ts +33 -0
- package/dist/locale/en/locale-resources.d.ts.map +1 -0
- package/dist/locale/en/locale-resources.js +32 -0
- package/dist/locale/en/locale-resources.js.map +1 -0
- package/dist/locale/fr/locale-resources.d.ts +33 -0
- package/dist/locale/fr/locale-resources.d.ts.map +1 -0
- package/dist/locale/fr/locale-resources.js +32 -0
- package/dist/locale/fr/locale-resources.js.map +1 -0
- package/dist/locale/i18n.d.ts +27 -0
- package/dist/locale/i18n.d.ts.map +1 -0
- package/dist/locale/i18n.js +34 -0
- package/dist/locale/i18n.js.map +1 -0
- package/dist/record.d.ts +37 -0
- package/dist/record.d.ts.map +1 -0
- package/dist/record.js +58 -0
- package/dist/record.js.map +1 -0
- package/dist/reg-exp.d.ts +40 -0
- package/dist/reg-exp.d.ts.map +1 -0
- package/dist/reg-exp.js +55 -0
- package/dist/reg-exp.js.map +1 -0
- package/dist/sequence.d.ts +45 -0
- package/dist/sequence.d.ts.map +1 -0
- package/dist/sequence.js +96 -0
- package/dist/sequence.js.map +1 -0
- package/dist/string.d.ts +25 -0
- package/dist/string.d.ts.map +1 -0
- package/dist/string.js +2 -0
- package/dist/string.js.map +1 -0
- package/dist/transformer.d.ts +191 -0
- package/dist/transformer.d.ts.map +1 -0
- package/dist/transformer.js +459 -0
- package/dist/transformer.js.map +1 -0
- package/dist/version.d.ts +5 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/package.json +3 -3
- package/src/version.ts +1 -1
- package/tsconfig-src.tsbuildinfo +1 -1
- package/dist/index.cjs +0 -17
- package/dist/index.d.cts +0 -699
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,kBAAkB,CAAC;AAEjC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AAEjC,mBAAmB,aAAa,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import{i18nCoreInit as et,i18nInit as tt}from"@aidc-toolkit/core";var p=a=>typeof a=="string",H=()=>{let a,e,t=new Promise((i,n)=>{a=i,e=n});return t.resolve=a,t.reject=e,t},Se=a=>a==null?"":""+a,Be=(a,e,t)=>{a.forEach(i=>{e[i]&&(t[i]=e[i])})},je=/###/g,Le=a=>a&&a.indexOf("###")>-1?a.replace(je,"."):a,Oe=a=>!a||p(a),q=(a,e,t)=>{let i=p(e)?e.split("."):e,n=0;for(;n<i.length-1;){if(Oe(a))return{};let r=Le(i[n]);!a[r]&&t&&(a[r]=new t),Object.prototype.hasOwnProperty.call(a,r)?a=a[r]:a={},++n}return Oe(a)?{}:{obj:a,k:Le(i[n])}},we=(a,e,t)=>{let{obj:i,k:n}=q(a,e,Object);if(i!==void 0||e.length===1){i[n]=t;return}let r=e[e.length-1],s=e.slice(0,e.length-1),o=q(a,s,Object);for(;o.obj===void 0&&s.length;)r=`${s[s.length-1]}.${r}`,s=s.slice(0,s.length-1),o=q(a,s,Object),o?.obj&&typeof o.obj[`${o.k}.${r}`]<"u"&&(o.obj=void 0);o.obj[`${o.k}.${r}`]=t},De=(a,e,t,i)=>{let{obj:n,k:r}=q(a,e,Object);n[r]=n[r]||[],n[r].push(t)},_=(a,e)=>{let{obj:t,k:i}=q(a,e);if(t&&Object.prototype.hasOwnProperty.call(t,i))return t[i]},Ue=(a,e,t)=>{let i=_(a,t);return i!==void 0?i:_(e,t)},ve=(a,e,t)=>{for(let i in e)i!=="__proto__"&&i!=="constructor"&&(i in a?p(a[i])||a[i]instanceof String||p(e[i])||e[i]instanceof String?t&&(a[i]=e[i]):ve(a[i],e[i],t):a[i]=e[i]);return a},B=a=>a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),Ke={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},He=a=>p(a)?a.replace(/[&<>"'\/]/g,e=>Ke[e]):a,se=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let 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}},qe=[" ",",","?","!",";"],Ge=new se(20),ze=(a,e,t)=>{e=e||"",t=t||"";let i=qe.filter(s=>e.indexOf(s)<0&&t.indexOf(s)<0);if(i.length===0)return!0;let n=Ge.getRegExp(`(${i.map(s=>s==="?"?"\\?":s).join("|")})`),r=!n.test(a);if(!r){let s=a.indexOf(t);s>0&&!n.test(a.substring(0,s))&&(r=!0)}return r},ae=(a,e,t=".")=>{if(!a)return;if(a[e])return Object.prototype.hasOwnProperty.call(a,e)?a[e]:void 0;let i=e.split(t),n=a;for(let r=0;r<i.length;){if(!n||typeof n!="object")return;let s,o="";for(let l=r;l<i.length;++l)if(l!==r&&(o+=t),o+=i[l],s=n[o],s!==void 0){if(["string","number","boolean"].indexOf(typeof s)>-1&&l<i.length-1)continue;r+=l-r+1;break}n=s}return n},G=a=>a?.replace("_","-"),Ze={type:"logger",log(a){this.output("log",a)},warn(a){this.output("warn",a)},error(a){this.output("error",a)},output(a,e){console?.[a]?.apply?.(console,e)}},oe=class a{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||Ze,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,n){return n&&!this.debug?null:(p(e[0])&&(e[0]=`${i}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new a(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new a(this.logger,e)}},I=new oe,j=class{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(i=>{this.observers[i]||(this.observers[i]=new Map);let n=this.observers[i].get(t)||0;this.observers[i].set(t,n+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(([n,r])=>{for(let s=0;s<r;s++)n(...t)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([n,r])=>{for(let s=0;s<r;s++)n.apply(n,[e,...t])})}},X=class extends j{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){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,i,n={}){let r=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,s=n.ignoreJSONStructure!==void 0?n.ignoreJSONStructure:this.options.ignoreJSONStructure,o;e.indexOf(".")>-1?o=e.split("."):(o=[e,t],i&&(Array.isArray(i)?o.push(...i):p(i)&&r?o.push(...i.split(r)):o.push(i)));let l=_(this.data,o);return!l&&!t&&!i&&e.indexOf(".")>-1&&(e=o[0],t=o[1],i=o.slice(2).join(".")),l||!s||!p(i)?l:ae(this.data?.[e]?.[t],i,r)}addResource(e,t,i,n,r={silent:!1}){let s=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,o=[e,t];i&&(o=o.concat(s?i.split(s):i)),e.indexOf(".")>-1&&(o=e.split("."),n=t,t=o[1]),this.addNamespaces(t),we(this.data,o,n),r.silent||this.emit("added",e,t,i,n)}addResources(e,t,i,n={silent:!1}){for(let r in i)(p(i[r])||Array.isArray(i[r]))&&this.addResource(e,t,r,i[r],{silent:!0});n.silent||this.emit("added",e,t,i)}addResourceBundle(e,t,i,n,r,s={silent:!1,skipCopy:!1}){let o=[e,t];e.indexOf(".")>-1&&(o=e.split("."),n=i,i=t,t=o[1]),this.addNamespaces(t);let l=_(this.data,o)||{};s.skipCopy||(i=JSON.parse(JSON.stringify(i))),n?ve(l,i,r):l={...l,...i},we(this.data,o,l),s.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){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(n=>t[n]&&Object.keys(t[n]).length>0)}toJSON(){return this.data}},Ae={processors:{},addPostProcessor(a){this.processors[a.name]=a},handle(a,e,t,i,n){return a.forEach(r=>{e=this.processors[r]?.process(e,t,i,n)??e}),e}},Me=Symbol("i18next/PATH_KEY");function Je(){let a=[],e=Object.create(null),t;return e.get=(i,n)=>(t?.revoke?.(),n===Me?a:(a.push(n),t=Proxy.revocable(i,e),t.proxy)),Proxy.revocable(Object.create(null),e).proxy}function le(a,e){let{[Me]:t}=a(Je());return t.join(e?.keySeparator??".")}var Te={},ne=a=>!p(a)&&typeof a!="boolean"&&typeof a!="number",W=class a extends j{constructor(e,t={}){super(),Be(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=I.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let i={...t};if(e==null)return!1;let n=this.resolve(e,i);if(n?.res===void 0)return!1;let r=ne(n.res);return!(i.returnObjects===!1&&r)}extractFromKey(e,t){let i=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;i===void 0&&(i=":");let n=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator,r=t.ns||this.options.defaultNS||[],s=i&&e.indexOf(i)>-1,o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!ze(e,i,n);if(s&&!o){let l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:p(r)?[r]:r};let u=e.split(i);(i!==n||i===n&&this.options.ns.indexOf(u[0])>-1)&&(r=u.shift()),e=u.join(n)}return{key:e,namespaces:p(r)?[r]:r}}translate(e,t,i){let n=typeof t=="object"?{...t}:t;if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),e==null)return"";typeof e=="function"&&(e=le(e,{...this.options,...n})),Array.isArray(e)||(e=[String(e)]);let r=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:o,namespaces:l}=this.extractFromKey(e[e.length-1],n),u=l[l.length-1],h=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;h===void 0&&(h=":");let c=n.lng||this.language,d=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c?.toLowerCase()==="cimode")return d?r?{res:`${u}${h}${o}`,usedKey:o,exactUsedKey:o,usedLng:c,usedNS:u,usedParams:this.getUsedParamsDetails(n)}:`${u}${h}${o}`:r?{res:o,usedKey:o,exactUsedKey:o,usedLng:c,usedNS:u,usedParams:this.getUsedParamsDetails(n)}:o;let f=this.resolve(e,n),g=f?.res,x=f?.usedKey||o,L=f?.exactUsedKey||o,T=["[object Number]","[object Function]","[object RegExp]"],y=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,P=!this.i18nFormat||this.i18nFormat.handleAsObject,w=n.count!==void 0&&!p(n.count),A=a.hasDefaultValue(n),k=w?this.pluralResolver.getSuffix(c,n.count,n):"",$=n.ordinal&&w?this.pluralResolver.getSuffix(c,n.count,{ordinal:!1}):"",me=w&&!n.ordinal&&n.count===0,M=me&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${k}`]||n[`defaultValue${$}`]||n.defaultValue,N=g;P&&!g&&A&&(N=M);let ke=ne(N),$e=Object.prototype.toString.apply(N);if(P&&N&&ke&&T.indexOf($e)<0&&!(p(y)&&Array.isArray(N))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let R=this.options.returnedObjectHandler?this.options.returnedObjectHandler(x,N,{...n,ns:l}):`key '${o} (${this.language})' returned an object instead of string.`;return r?(f.res=R,f.usedParams=this.getUsedParamsDetails(n),f):R}if(s){let R=Array.isArray(N),C=R?[]:{},be=R?L:x;for(let E in N)if(Object.prototype.hasOwnProperty.call(N,E)){let v=`${be}${s}${E}`;A&&!g?C[E]=this.translate(v,{...n,defaultValue:ne(M)?M[E]:void 0,joinArrays:!1,ns:l}):C[E]=this.translate(v,{...n,joinArrays:!1,ns:l}),C[E]===v&&(C[E]=N[E])}g=C}}else if(P&&p(y)&&Array.isArray(g))g=g.join(y),g&&(g=this.extendTranslation(g,e,n,i));else{let R=!1,C=!1;!this.isValidLookup(g)&&A&&(R=!0,g=M),this.isValidLookup(g)||(C=!0,g=o);let E=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:g,v=A&&M!==g&&this.options.updateMissing;if(C||R||v){if(this.logger.log(v?"updateKey":"missingKey",c,u,o,v?M:g),s){let O=this.resolve(o,{...n,keySeparator:!1});O&&O.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 U=[],Z=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Z&&Z[0])for(let O=0;O<Z.length;O++)U.push(Z[O]);else this.options.saveMissingTo==="all"?U=this.languageUtils.toResolveHierarchy(n.lng||this.language):U.push(n.lng||this.language);let xe=(O,V,K)=>{let ye=A&&K!==g?K:E;this.options.missingKeyHandler?this.options.missingKeyHandler(O,u,V,ye,v,n):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(O,u,V,ye,v,n),this.emit("missingKey",O,u,V,g)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?U.forEach(O=>{let V=this.pluralResolver.getSuffixes(O,n);me&&n[`defaultValue${this.options.pluralSeparator}zero`]&&V.indexOf(`${this.options.pluralSeparator}zero`)<0&&V.push(`${this.options.pluralSeparator}zero`),V.forEach(K=>{xe([O],o+K,n[`defaultValue${K}`]||M)})}):xe(U,o,M))}g=this.extendTranslation(g,e,n,f,i),C&&g===o&&this.options.appendNamespaceToMissingKey&&(g=`${u}${h}${o}`),(C||R)&&this.options.parseMissingKeyHandler&&(g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${h}${o}`:o,R?g:void 0,n))}return r?(f.res=g,f.usedParams=this.getUsedParamsDetails(n),f):g}extendTranslation(e,t,i,n,r){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...i},i.lng||this.language||n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init({...i,interpolation:{...this.options.interpolation,...i.interpolation}});let l=p(e)&&(i?.interpolation?.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),u;if(l){let c=e.match(this.interpolator.nestingRegexp);u=c&&c.length}let h=i.replace&&!p(i.replace)?i.replace:i;if(this.options.interpolation.defaultVariables&&(h={...this.options.interpolation.defaultVariables,...h}),e=this.interpolator.interpolate(e,h,i.lng||this.language||n.usedLng,i),l){let c=e.match(this.interpolator.nestingRegexp),d=c&&c.length;u<d&&(i.nest=!1)}!i.lng&&n&&n.res&&(i.lng=this.language||n.usedLng),i.nest!==!1&&(e=this.interpolator.nest(e,(...c)=>r?.[0]===c[0]&&!i.context?(this.logger.warn(`It seems you are nesting recursively key: ${c[0]} in key: ${t[0]}`),null):this.translate(...c,t),i)),i.interpolation&&this.interpolator.reset()}let s=i.postProcess||this.options.postProcess,o=p(s)?[s]:s;return e!=null&&o?.length&&i.applyPostProcessor!==!1&&(e=Ae.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...n,usedParams:this.getUsedParamsDetails(i)},...i}:i,this)),e}resolve(e,t={}){let i,n,r,s,o;return p(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(i))return;let u=this.extractFromKey(l,t),h=u.key;n=h;let c=u.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));let d=t.count!==void 0&&!p(t.count),f=d&&!t.ordinal&&t.count===0,g=t.context!==void 0&&(p(t.context)||typeof t.context=="number")&&t.context!=="",x=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);c.forEach(L=>{this.isValidLookup(i)||(o=L,!Te[`${x[0]}-${L}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(Te[`${x[0]}-${L}`]=!0,this.logger.warn(`key "${n}" 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(T=>{if(this.isValidLookup(i))return;s=T;let y=[h];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(y,h,T,L,t);else{let w;d&&(w=this.pluralResolver.getSuffix(T,t.count,t));let A=`${this.options.pluralSeparator}zero`,k=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(t.ordinal&&w.indexOf(k)===0&&y.push(h+w.replace(k,this.options.pluralSeparator)),y.push(h+w),f&&y.push(h+A)),g){let $=`${h}${this.options.contextSeparator||"_"}${t.context}`;y.push($),d&&(t.ordinal&&w.indexOf(k)===0&&y.push($+w.replace(k,this.options.pluralSeparator)),y.push($+w),f&&y.push($+A))}}let P;for(;P=y.pop();)this.isValidLookup(i)||(r=P,i=this.getResource(T,L,P,t))}))})}),{res:i,usedKey:n,exactUsedKey:r,usedLng:s,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,i,n={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,i,n):this.resourceStore.getResource(e,t,i,n)}getUsedParamsDetails(e={}){let t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],i=e.replace&&!p(e.replace),n=i?e.replace:e;if(i&&typeof e.count<"u"&&(n.count=e.count),this.options.interpolation.defaultVariables&&(n={...this.options.interpolation.defaultVariables,...n}),!i){n={...n};for(let r of t)delete n[r]}return n}static hasDefaultValue(e){let t="defaultValue";for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&t===i.substring(0,t.length)&&e[i]!==void 0)return!0;return!1}},Y=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=I.create("languageUtils")}getScriptPartFromCode(e){if(e=G(e),!e||e.indexOf("-")<0)return null;let t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=G(e),!e||e.indexOf("-")<0)return e;let t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(p(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}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;let n=this.formatLanguageCode(i);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(i=>{if(t)return;let n=this.getScriptPartFromCode(i);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(i);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(s=>{if(s===r)return s;if(!(s.indexOf("-")<0&&r.indexOf("-")<0)&&(s.indexOf("-")>0&&r.indexOf("-")<0&&s.substring(0,s.indexOf("-"))===r||s.indexOf(r)===0&&r.length>1))return s})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),p(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){let i=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),n=[],r=s=>{s&&(this.isSupportedCode(s)?n.push(s):this.logger.warn(`rejecting language code not found in supportedLngs: ${s}`))};return p(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&r(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&r(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&r(this.getLanguagePartFromCode(e))):p(e)&&r(this.formatLanguageCode(e)),i.forEach(s=>{n.indexOf(s)<0&&r(this.formatLanguageCode(s))}),n}},Ce={zero:0,one:1,two:2,few:3,many:4,other:5},Ne={select:a=>a===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})},ue=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=I.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let i=G(e==="dev"?"en":e),n=t.ordinal?"ordinal":"cardinal",r=JSON.stringify({cleanedCode:i,type:n});if(r in this.pluralRulesCache)return this.pluralRulesCache[r];let s;try{s=new Intl.PluralRules(i,{type:n})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Ne;if(!e.match(/-|_/))return Ne;let l=this.languageUtils.getLanguagePartFromCode(e);s=this.getRule(l,t)}return this.pluralRulesCache[r]=s,s}needsPlural(e,t={}){let i=this.getRule(e,t);return i||(i=this.getRule("dev",t)),i?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,i={}){return this.getSuffixes(e,i).map(n=>`${t}${n}`)}getSuffixes(e,t={}){let i=this.getRule(e,t);return i||(i=this.getRule("dev",t)),i?i.resolvedOptions().pluralCategories.sort((n,r)=>Ce[n]-Ce[r]).map(n=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${n}`):[]}getSuffix(e,t,i={}){let n=this.getRule(e,i);return n?`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${n.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,i))}},Re=(a,e,t,i=".",n=!0)=>{let r=Ue(a,e,t);return!r&&n&&p(t)&&(r=ae(a,t,i),r===void 0&&(r=ae(e,t,i))),r},ie=a=>a.replace(/\$/g,"$$$$"),Q=class{constructor(e={}){this.logger=I.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(t=>t),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});let{escape:t,escapeValue:i,useRawValueToEscape:n,prefix:r,prefixEscaped:s,suffix:o,suffixEscaped:l,formatSeparator:u,unescapeSuffix:h,unescapePrefix:c,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:g,nestingSuffixEscaped:x,nestingOptionsSeparator:L,maxReplaces:T,alwaysFormat:y}=e.interpolation;this.escape=t!==void 0?t:He,this.escapeValue=i!==void 0?i:!0,this.useRawValueToEscape=n!==void 0?n:!1,this.prefix=r?B(r):s||"{{",this.suffix=o?B(o):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=h?"":c||"-",this.unescapeSuffix=this.unescapePrefix?"":h||"",this.nestingPrefix=d?B(d):f||B("$t("),this.nestingSuffix=g?B(g):x||B(")"),this.nestingOptionsSeparator=L||",",this.maxReplaces=T||1e3,this.alwaysFormat=y!==void 0?y:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(t,i)=>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,n){let r,s,o,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=f=>{if(f.indexOf(this.formatSeparator)<0){let T=Re(t,l,f,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(T,void 0,i,{...n,...t,interpolationkey:f}):T}let g=f.split(this.formatSeparator),x=g.shift().trim(),L=g.join(this.formatSeparator).trim();return this.format(Re(t,l,x,this.options.keySeparator,this.options.ignoreJSONStructure),L,i,{...n,...t,interpolationkey:x})};this.resetRegExp();let h=n?.missingInterpolationHandler||this.options.missingInterpolationHandler,c=n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:f=>ie(f)},{regex:this.regexp,safeValue:f=>this.escapeValue?ie(this.escape(f)):ie(f)}].forEach(f=>{for(o=0;r=f.regex.exec(e);){let g=r[1].trim();if(s=u(g),s===void 0)if(typeof h=="function"){let L=h(e,r,n);s=p(L)?L:""}else if(n&&Object.prototype.hasOwnProperty.call(n,g))s="";else if(c){s=r[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${e}`),s="";else!p(s)&&!this.useRawValueToEscape&&(s=Se(s));let x=f.safeValue(s);if(e=e.replace(r[0],x),c?(f.regex.lastIndex+=s.length,f.regex.lastIndex-=r[0].length):f.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,i={}){let n,r,s,o=(l,u)=>{let h=this.nestingOptionsSeparator;if(l.indexOf(h)<0)return l;let c=l.split(new RegExp(`${h}[ ]*{`)),d=`{${c[1]}`;l=c[0],d=this.interpolate(d,s);let f=d.match(/'/g),g=d.match(/"/g);((f?.length??0)%2===0&&!g||g.length%2!==0)&&(d=d.replace(/'/g,'"'));try{s=JSON.parse(d),u&&(s={...u,...s})}catch(x){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,x),`${l}${h}${d}`}return s.defaultValue&&s.defaultValue.indexOf(this.prefix)>-1&&delete s.defaultValue,l};for(;n=this.nestingRegexp.exec(e);){let l=[];s={...i},s=s.replace&&!p(s.replace)?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let u=/{.*}/.test(n[1])?n[1].lastIndexOf("}")+1:n[1].indexOf(this.formatSeparator);if(u!==-1&&(l=n[1].slice(u).split(this.formatSeparator).map(h=>h.trim()).filter(Boolean),n[1]=n[1].slice(0,u)),r=t(o.call(this,n[1].trim(),s),s),r&&n[0]===e&&!p(r))return r;p(r)||(r=Se(r)),r||(this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`),r=""),l.length&&(r=l.reduce((h,c)=>this.format(h,c,i.lng,{...i,interpolationkey:n[1].trim()}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}},_e=a=>{let e=a.toLowerCase().trim(),t={};if(a.indexOf("(")>-1){let i=a.split("(");e=i[0].toLowerCase().trim();let n=i[1].substring(0,i[1].length-1);e==="currency"&&n.indexOf(":")<0?t.currency||(t.currency=n.trim()):e==="relativetime"&&n.indexOf(":")<0?t.range||(t.range=n.trim()):n.split(";").forEach(s=>{if(s){let[o,...l]=s.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),h=o.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}},Ee=a=>{let e={};return(t,i,n)=>{let r=n;n&&n.interpolationkey&&n.formatParams&&n.formatParams[n.interpolationkey]&&n[n.interpolationkey]&&(r={...r,[n.interpolationkey]:void 0});let s=i+JSON.stringify(r),o=e[s];return o||(o=a(G(i),n),e[s]=o),o(t)}},Xe=a=>(e,t,i)=>a(G(t),i)(e),ce=class{constructor(e={}){this.logger=I.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";let i=t.cacheInBuiltFormats?Ee:Xe;this.formats={number:i((n,r)=>{let s=new Intl.NumberFormat(n,{...r});return o=>s.format(o)}),currency:i((n,r)=>{let s=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>s.format(o)}),datetime:i((n,r)=>{let s=new Intl.DateTimeFormat(n,{...r});return o=>s.format(o)}),relativetime:i((n,r)=>{let s=new Intl.RelativeTimeFormat(n,{...r});return o=>s.format(o,r.range||"day")}),list:i((n,r)=>{let s=new Intl.ListFormat(n,{...r});return o=>s.format(o)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Ee(t)}format(e,t,i,n={}){let r=t.split(this.formatSeparator);if(r.length>1&&r[0].indexOf("(")>1&&r[0].indexOf(")")<0&&r.find(o=>o.indexOf(")")>-1)){let o=r.findIndex(l=>l.indexOf(")")>-1);r[0]=[r[0],...r.splice(1,o)].join(this.formatSeparator)}return r.reduce((o,l)=>{let{formatName:u,formatOptions:h}=_e(l);if(this.formats[u]){let c=o;try{let d=n?.formatParams?.[n.interpolationkey]||{},f=d.locale||d.lng||n.locale||n.lng||i;c=this.formats[u](o,f,{...h,...n,...d})}catch(d){this.logger.warn(d)}return c}else this.logger.warn(`there was no format function for ${u}`);return o},e)}},We=(a,e)=>{a.pending[e]!==void 0&&(delete a.pending[e],a.pendingCount--)},he=class extends j{constructor(e,t,i,n={}){super(),this.backend=e,this.store=t,this.services=i,this.languageUtils=i.languageUtils,this.options=n,this.logger=I.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=n.maxParallelReads||10,this.readingCalls=0,this.maxRetries=n.maxRetries>=0?n.maxRetries:5,this.retryTimeout=n.retryTimeout>=1?n.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(i,n.backend,n)}queueLoad(e,t,i,n){let r={},s={},o={},l={};return e.forEach(u=>{let h=!0;t.forEach(c=>{let d=`${u}|${c}`;!i.reload&&this.store.hasResourceBundle(u,c)?this.state[d]=2:this.state[d]<0||(this.state[d]===1?s[d]===void 0&&(s[d]=!0):(this.state[d]=1,h=!1,s[d]===void 0&&(s[d]=!0),r[d]===void 0&&(r[d]=!0),l[c]===void 0&&(l[c]=!0)))}),h||(o[u]=!0)}),(Object.keys(r).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:n}),{toLoad:Object.keys(r),pending:Object.keys(s),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(l)}}loaded(e,t,i){let n=e.split("|"),r=n[0],s=n[1];t&&this.emit("failedLoading",r,s,t),!t&&i&&this.store.addResourceBundle(r,s,i,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&i&&(this.state[e]=0);let o={};this.queue.forEach(l=>{De(l.loaded,[r],s),We(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{o[u]||(o[u]={});let h=l.loaded[u];h.length&&h.forEach(c=>{o[u][c]===void 0&&(o[u][c]=!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,i,n=0,r=this.retryTimeout,s){if(!e.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:i,tried:n,wait:r,callback:s});return}this.readingCalls++;let o=(u,h)=>{if(this.readingCalls--,this.waitingReads.length>0){let c=this.waitingReads.shift();this.read(c.lng,c.ns,c.fcName,c.tried,c.wait,c.callback)}if(u&&h&&n<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,i,n+1,r*2,s)},r);return}s(u,h)},l=this.backend[i].bind(this.backend);if(l.length===2){try{let u=l(e,t);u&&typeof u.then=="function"?u.then(h=>o(null,h)).catch(o):o(null,u)}catch(u){o(u)}return}return l(e,t,o)}prepareLoading(e,t,i={},n){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),n&&n();p(e)&&(e=this.languageUtils.toResolveHierarchy(e)),p(t)&&(t=[t]);let r=this.queueLoad(e,t,i,n);if(!r.toLoad.length)return r.pending.length||n(),null;r.toLoad.forEach(s=>{this.loadOne(s)})}load(e,t,i){this.prepareLoading(e,t,{},i)}reload(e,t,i){this.prepareLoading(e,t,{reload:!0},i)}loadOne(e,t=""){let i=e.split("|"),n=i[0],r=i[1];this.read(n,r,"read",void 0,void 0,(s,o)=>{s&&this.logger.warn(`${t}loading namespace ${r} for language ${n} failed`,s),!s&&o&&this.logger.log(`${t}loaded namespace ${r} for language ${n}`,o),this.loaded(e,s,o)})}saveMissing(e,t,i,n,r,s={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.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(this.backend?.create){let l={...s,isUpdate:r},u=this.backend.create.bind(this.backend);if(u.length<6)try{let h;u.length===5?h=u(e,t,i,n,l):h=u(e,t,i,n),h&&typeof h.then=="function"?h.then(c=>o(null,c)).catch(o):o(null,h)}catch(h){o(h)}else u(e,t,i,n,o,l)}!e||!e[0]||this.store.addResource(e[0],t,i,n)}}},re=()=>({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:a=>{let e={};if(typeof a[1]=="object"&&(e=a[1]),p(a[1])&&(e.defaultValue=a[1]),p(a[2])&&(e.tDescription=a[2]),typeof a[2]=="object"||typeof a[3]=="object"){let t=a[3]||a[2];Object.keys(t).forEach(i=>{e[i]=t[i]})}return e},interpolation:{escapeValue:!0,format:a=>a,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Ie=a=>(p(a.ns)&&(a.ns=[a.ns]),p(a.fallbackLng)&&(a.fallbackLng=[a.fallbackLng]),p(a.fallbackNS)&&(a.fallbackNS=[a.fallbackNS]),a.supportedLngs?.indexOf?.("cimode")<0&&(a.supportedLngs=a.supportedLngs.concat(["cimode"])),typeof a.initImmediate=="boolean"&&(a.initAsync=a.initImmediate),a),J=()=>{},Ye=a=>{Object.getOwnPropertyNames(Object.getPrototypeOf(a)).forEach(t=>{typeof a[t]=="function"&&(a[t]=a[t].bind(a))})},Qe=a=>!!(a?.modules?.backend?.name?.indexOf("Locize")>0||a?.modules?.backend?.constructor?.name?.indexOf("Locize")>0||a?.options?.backend?.backends&&a.options.backend.backends.some(e=>e?.name?.indexOf("Locize")>0||e?.constructor?.name?.indexOf("Locize")>0)),de=class a extends j{constructor(e={},t){if(super(),this.options=Ie(e),this.services={},this.logger=I,this.modules={external:[]},Ye(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&&(p(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));let i=re();this.options={...i,...this.options,...Ie(e)},this.options.interpolation={...i.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=i.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!Qe(this)&&typeof console<"u"&&typeof console.info<"u"&&console.info("\u{1F310} i18next is maintained with support from locize.com \u2014 consider powering your project with managed localization (AI, CDN, integrations): https://locize.com \u{1F499}");let n=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?I.init(n(this.modules.logger),this.options):I.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=ce;let h=new Y(this.options);this.store=new X(this.options.resources,this.options);let c=this.services;c.logger=I,c.resourceStore=this.store,c.languageUtils=h,c.pluralResolver=new ue(h,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==i.interpolation.format&&this.logger.deprecate("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)&&(c.formatter=n(u),c.formatter.init&&c.formatter.init(c,this.options),this.options.interpolation.format=c.formatter.format.bind(c.formatter)),c.interpolator=new Q(this.options),c.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},c.backendConnector=new he(n(this.modules.backend),c.resourceStore,c,this.options),c.backendConnector.on("*",(f,...g)=>{this.emit(f,...g)}),this.modules.languageDetector&&(c.languageDetector=n(this.modules.languageDetector),c.languageDetector.init&&c.languageDetector.init(c,this.options.detection,this.options)),this.modules.i18nFormat&&(c.i18nFormat=n(this.modules.i18nFormat),c.i18nFormat.init&&c.i18nFormat.init(this)),this.translator=new W(this.services,this.options),this.translator.on("*",(f,...g)=>{this.emit(f,...g)}),this.modules.external.forEach(f=>{f.init&&f.init(this)})}if(this.format=this.options.interpolation.format,t||(t=J),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let 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)});let o=H(),l=()=>{let u=(h,c)=>{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(c),t(h,c)};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=J){let i=t,n=p(e)?e:this.language;if(typeof e=="function"&&(i=e),!this.options.resources||this.options.partialBundledLanguages){if(n?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return i();let r=[],s=o=>{if(!o||o==="cimode")return;this.services.languageUtils.toResolveHierarchy(o).forEach(u=>{u!=="cimode"&&r.indexOf(u)<0&&r.push(u)})};n?s(n):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>s(l)),this.options.preload?.forEach?.(o=>s(o)),this.services.backendConnector.load(r,this.options.ns,o=>{!o&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),i(o)})}else i(null)}reloadResources(e,t,i){let n=H();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=J),this.services.backendConnector.reload(e,t,r=>{n.resolve(),i(r)}),n}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"&&Ae.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++){let 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;let i=H();this.emit("languageChanging",e);let n=o=>{this.language=o,this.languages=this.services.languageUtils.toResolveHierarchy(o),this.resolvedLanguage=void 0,this.setResolvedLanguage(o)},r=(o,l)=>{l?this.isLanguageChangingTo===e&&(n(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(o,(...u)=>this.t(...u))},s=o=>{!e&&!o&&this.services.languageDetector&&(o=[]);let l=p(o)?o:o&&o[0],u=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(p(o)?[o]:o);u&&(this.language||n(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector?.cacheUserLanguage?.(u)),this.loadResources(u,h=>{r(h,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(e),i}getFixedT(e,t,i){let n=(r,s,...o)=>{let l;typeof s!="object"?l=this.options.overloadTranslationOptionHandler([r,s].concat(o)):l={...s},l.lng=l.lng||n.lng,l.lngs=l.lngs||n.lngs,l.ns=l.ns||n.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||i||n.keyPrefix);let u=this.options.keySeparator||".",h;return l.keyPrefix&&Array.isArray(r)?h=r.map(c=>(typeof c=="function"&&(c=le(c,{...this.options,...s})),`${l.keyPrefix}${u}${c}`)):(typeof r=="function"&&(r=le(r,{...this.options,...s})),h=l.keyPrefix?`${l.keyPrefix}${u}${r}`:r),this.t(h,l)};return p(e)?n.lng=e:n.lngs=e,n.ns=t,n.keyPrefix=i,n}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.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;let i=t.lng||this.resolvedLanguage||this.languages[0],n=this.options?this.options.fallbackLng:!1,r=this.languages[this.languages.length-1];if(i.toLowerCase()==="cimode")return!0;let s=(o,l)=>{let u=this.services.backendConnector.state[`${o}|${l}`];return u===-1||u===0||u===2};if(t.precheck){let o=t.precheck(this,s);if(o!==void 0)return o}return!!(this.hasResourceBundle(i,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||s(i,e)&&(!n||s(r,e)))}loadNamespaces(e,t){let i=H();return this.options.ns?(p(e)&&(e=[e]),e.forEach(n=>{this.options.ns.indexOf(n)<0&&this.options.ns.push(n)}),this.loadResources(n=>{i.resolve(),t&&t(n)}),i):(t&&t(),Promise.resolve())}loadLanguages(e,t){let i=H();p(e)&&(e=[e]);let n=this.options.preload||[],r=e.filter(s=>n.indexOf(s)<0&&this.services.languageUtils.isSupportedCode(s));return r.length?(this.options.preload=n.concat(r),this.loadResources(s=>{i.resolve(),t&&t(s)}),i):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{let n=new Intl.Locale(e);if(n&&n.getTextInfo){let r=n.getTextInfo();if(r&&r.direction)return r.direction}}catch{}let 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=this.services?.languageUtils||new Y(re());return e.toLowerCase().indexOf("-latn")>1?"ltr":t.indexOf(i.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){let i=new a(e,t);return i.createInstance=a.createInstance,i}cloneInstance(e={},t=J){let i=e.forkResourceStore;i&&delete e.forkResourceStore;let n={...this.options,...e,isClone:!0},r=new a(n);if((e.debug!==void 0||e.prefix!==void 0)&&(r.logger=r.logger.clone(e)),["store","services","language"].forEach(o=>{r[o]=this[o]}),r.services={...this.services},r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},i){let o=Object.keys(this.store.data).reduce((l,u)=>(l[u]={...this.store.data[u]},l[u]=Object.keys(l[u]).reduce((h,c)=>(h[c]={...l[u][c]},h),l[u]),l),{});r.store=new X(o,n),r.services.resourceStore=r.store}if(e.interpolation){let l={...re().interpolation,...this.options.interpolation,...e.interpolation},u={...n,interpolation:l};r.services.interpolator=new Q(u)}return r.translator=new W(r.services,n),r.translator.on("*",(o,...l)=>{r.emit(o,...l)}),r.init(n,t),r.translator.options=n,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}},S=de.createInstance(),lt=S.createInstance,ut=S.dir,ct=S.init,ht=S.loadResources,dt=S.reloadResources,ft=S.use,gt=S.changeLanguage,pt=S.getFixedT,mt=S.t,bt=S.exists,xt=S.setDefaultNamespace,yt=S.hasLoadedNamespace,St=S.loadNamespaces,Lt=S.loadLanguages;var Pe={Transformer:{domainMustBeGreaterThanZero:"Domain {{domain, number}} must be greater than 0",tweakMustBeGreaterThanOrEqualToZero:"Tweak {{tweak, number}} must be greater than or equal to 0",valueMustBeGreaterThanOrEqualToZero:"Value {{value, number}} must be greater than or equal to 0",valueMustBeLessThan:"Value {{value, number}} must be less than {{domain, number}}",minimumValueMustBeGreaterThanOrEqualToZero:"Minimum value {{minimumValue, number}} must be greater than or equal to 0",maximumValueMustBeLessThan:"Maximum value {{maximumValue, number}} must be less than {{domain, number}}"},RegExpValidator:{stringDoesNotMatchPattern:"String {{s}} does not match pattern"},CharacterSetValidator:{firstZeroFirstCharacter:"Character set must support zero as first character",allNumericAllNumericCharacters:"Character set must support all numeric characters in sequence",stringMustNotBeAllNumeric:"String must not be all numeric",lengthMustBeGreaterThanOrEqualTo:"Length {{length, number}} must be greater than or equal to {{minimumLength, number}}",lengthMustBeLessThanOrEqualTo:"Length {{length, number}} must be less than or equal to {{maximumLength, number}}",lengthMustBeEqualTo:"Length {{length, number}} must be equal to {{exactLength, number}}",lengthOfComponentMustBeGreaterThanOrEqualTo:"Length {{length, number}} of {{component}} must be greater than or equal to {{minimumLength, number}}",lengthOfComponentMustBeLessThanOrEqualTo:"Length {{length, number}} of {{component}} must be less than or equal to {{maximumLength, number}}",lengthOfComponentMustBeEqualTo:"Length {{length, number}} of {{component}} must be equal to {{exactLength, number}}",invalidCharacterAtPosition:"Invalid character '{{c}}' at position {{position, number}}",invalidCharacterAtPositionOfComponent:"Invalid character '{{c}}' at position {{position, number}} of {{component}}",exclusionNotSupported:"Exclusion value of {{exclusion, number}} is not supported",endSequenceValueMustBeLessThanOrEqualTo:"End sequence value (start sequence value + count - 1) must be less than {{domain, number}}"},RecordValidator:{typeNameKeyNotFound:'{{typeName}} "{{key}}" not found'}};var Ve={Transformer:{domainMustBeGreaterThanZero:"Le domaine {{domain, number}} doit \xEAtre sup\xE9rieur \xE0 0",tweakMustBeGreaterThanOrEqualToZero:"Le r\xE9glage {{tweak, number}} doit \xEAtre sup\xE9rieur ou \xE9gal \xE0 0",valueMustBeGreaterThanOrEqualToZero:"La valeur {{value, number}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 0",valueMustBeLessThan:"La valeur {{value, number}} doit \xEAtre inf\xE9rieure \xE0 {{domain, number}}",minimumValueMustBeGreaterThanOrEqualToZero:"La valeur minimale {{minimumValue, number}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 0",maximumValueMustBeLessThan:"La valeur maximale {{maximumValue, number}} doit \xEAtre inf\xE9rieure \xE0 {{domain, number}}"},RegExpValidator:{stringDoesNotMatchPattern:"La cha\xEEne {{s}} ne correspond pas au mod\xE8le"},CharacterSetValidator:{firstZeroFirstCharacter:"Le jeu de caract\xE8res doit prendre en charge z\xE9ro comme premier caract\xE8re",allNumericAllNumericCharacters:"Le jeu de caract\xE8res doit prendre en charge tous les caract\xE8res num\xE9riques en s\xE9quence",stringMustNotBeAllNumeric:"La cha\xEEne ne doit pas \xEAtre enti\xE8rement num\xE9rique",lengthMustBeGreaterThanOrEqualTo:"La longueur {{length, number}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 {{minimumLength, number}}",lengthMustBeLessThanOrEqualTo:"La longueur {{length, number}} doit \xEAtre inf\xE9rieure ou \xE9gale \xE0 {{maximumLength, number}}",lengthMustBeEqualTo:"La longueur {{length, number}} doit \xEAtre \xE9gale \xE0 {{exactLength, number}}",lengthOfComponentMustBeGreaterThanOrEqualTo:"La longueur {{length, number}} de {{component}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 {{minimumLength, number}}",lengthOfComponentMustBeLessThanOrEqualTo:"La longueur {{length, number}} de {{component}} doit \xEAtre inf\xE9rieure ou \xE9gale \xE0 {{maximumLength, number}}",lengthOfComponentMustBeEqualTo:"La longueur {{length, number}} de {{component}} doit \xEAtre \xE9gale \xE0 {{exactLength, number}}",invalidCharacterAtPosition:"Caract\xE8re non valide '{{c}}' \xE0 la position {{position, number}}",invalidCharacterAtPositionOfComponent:"Caract\xE8re non valide '{{c}}' \xE0 la position {{position, number}} de {{component}}",exclusionNotSupported:"La valeur d'exclusion de {{exclusion, number}} n'est pas prise en charge",endSequenceValueMustBeLessThanOrEqualTo:"La valeur de la s\xE9quence de fin (valeur de la s\xE9quence de d\xE9but + nombre - 1) doit \xEAtre inf\xE9rieure \xE0 {{domain, number}}"},RecordValidator:{typeNameKeyNotFound:"{{typeName}} \xAB\xA0{{key}}\xA0\xBB introuvable"}};var nt="aidct_utility",it={en:{aidct_utility:Pe},fr:{aidct_utility:Ve}},m=S.createInstance();async function It(a,e=!1){return tt(m,a,e,nt,it,et)}var ee=class{#t;#e;#r;#i;#n;#s;constructor(e,t){this.#t=BigInt(e),this.#e=this.#t+BigInt(t),this.#r=t,t>=0?(this.#i=1n,this.#n=this.#t,this.#s=this.#e-1n):(this.#i=-1n,this.#n=this.#e+1n,this.#s=this.#t)}get startValue(){return this.#t}get endValue(){return this.#e}get count(){return this.#r}get minimumValue(){return this.#n}get maximumValue(){return this.#s}*[Symbol.iterator](){for(let e=this.#t;e!==this.#e;e+=this.#i)yield e}};function z(a,e){return{*[Symbol.iterator](){let t=0;for(let i of a)yield e(i,t++)}}}var F=class a{static#t=new Map;#e;constructor(e){if(this.#e=BigInt(e),this.#e<=0n)throw new RangeError(m.t("Transformer.domainMustBeGreaterThanZero",{domain:e}))}static get(e,t){let i=BigInt(e),n=a.#t.get(i);n===void 0&&(n=new Map,a.#t.set(i,n));let r=t===void 0?void 0:BigInt(t),s=n.get(r);return s===void 0&&(s=r===void 0?new fe(i):new ge(i,r),n.set(r,s)),s}get domain(){return this.#e}#r(e){if(e<0n)throw new RangeError(m.t("Transformer.valueMustBeGreaterThanOrEqualToZero",{value:e}));if(e>=this.domain)throw new RangeError(m.t("Transformer.valueMustBeLessThan",{value:e,domain:this.domain}))}#i(e){let t=BigInt(e);return this.#r(t),this.doForward(t)}#n(e,t,i){return e(this.#i(t),i)}forward(e,t){let i;if(typeof e!="object")i=t===void 0?this.#i(e):this.#n(t,e);else if(e instanceof ee){if(e.minimumValue<0n)throw new RangeError(m.t("Transformer.minimumValueMustBeGreaterThanOrEqualToZero",{minimumValue:e.minimumValue}));if(e.maximumValue>=this.domain)throw new RangeError(m.t("Transformer.maximumValueMustBeLessThan",{maximumValue:e.maximumValue,domain:this.domain}));i=t===void 0?z(e,n=>this.doForward(n)):z(e,(n,r)=>t(this.doForward(n),r))}else i=t===void 0?z(e,n=>this.#i(n)):z(e,(n,r)=>this.#n(t,n,r));return i}reverse(e){let t=BigInt(e);return this.#r(t),this.doReverse(t)}},fe=class extends F{doForward(e){return e}doReverse(e){return e}},ge=class a extends F{static#t=603868999n;static#e=new Uint8Array([1,2,4,8,16,32,64,128]);static#r=new Uint8Array([254,253,251,247,239,223,191,127]);#i;#n;#s;#o;#a;constructor(e,t){if(super(e),t<0n)throw new RangeError(m.t("Transformer.tweakMustBeGreaterThanOrEqualToZero",{tweak:t}));let i=0;for(let o=this.domain-1n;o!==0n;o>>=8n)i++;this.#i=i;let n=[],r=[],s=[];for(let o=this.domain*BigInt(t)*a.#t;o!==0n;o>>=8n){n.unshift(Number(BigInt.asUintN(8,o)));let l=Number(BigInt.asUintN(3,o));r.push(a.#e[l]),s.push(a.#r[l])}if(i===1){let o=a.#e.filter(l=>l<e).reduce((l,u)=>l|u,0);this.#n=new Uint8Array([n.reduce((l,u)=>l^u,0)&o]),this.#s=new Uint8Array([a.#e[0]]),this.#o=new Uint8Array([a.#r[0]]),this.#a=1}else this.#n=new Uint8Array(n),this.#s=new Uint8Array(r),this.#o=new Uint8Array(s),this.#a=n.length}#l(e){let t=new Uint8Array(this.#i);for(let i=this.#i-1,n=e;i>=0&&n!==0n;i--,n>>=8n)t[i]=Number(BigInt.asUintN(8,n));return t}static#u(e){return e.reduce((t,i)=>t<<8n|BigInt(i),0n)}#c(e,t,i){let n=e.length,r=new Uint8Array(n),s=[],o=[],l=this.#s[t];e.forEach((c,d)=>{let f=c&l;r[d]=f,(f!==0?s:o).push(d)});let u=this.#o[t],h=new Uint8Array(n);return[...s,...o].forEach((c,d)=>{i?h[d]=e[c]&u|r[d]:h[c]=e[d]&u|r[c]}),h}#h(e,t,i){let n=this.#n[t];return e.map(r=>{let s=r^n;return n=i?s:r,s})}doForward(e){let t=this.#l(e),i;do{for(let n=0;n<this.#a;n++)t=this.#h(this.#c(t,n,!0),n,!0);i=a.#u(t)}while(i>=this.domain);return i}doReverse(e){let t=this.#l(e),i;do{for(let n=this.#a-1;n>=0;n--)t=this.#c(this.#h(t,n,!1),n,!1);i=a.#u(t)}while(i>=this.domain);return i}};var te=class{#t;constructor(e){this.#t=e}get regExp(){return this.#t}createErrorMessage(e){return m.t("RegExpValidator.stringDoesNotMatchPattern",{s:e})}validate(e){if(!this.#t.test(e))throw new RangeError(this.createErrorMessage(e))}};var Fe=class{#t;#e;constructor(e,t){this.#t=e,this.#e=t}get typeName(){return this.#t}get record(){return this.#e}validate(e){if(!(e in this.record))throw new RangeError(m.t("RecordValidator.typeNameKeyNotFound",{typeName:this.typeName,key:e}))}};var b={None:0,FirstZero:1,AllNumeric:2};var pe=class a{static#t=new class extends te{createErrorMessage(e){return m.t("CharacterSetValidator.stringMustNotBeAllNumeric")}}(/\D/u);#e;#r;#i;constructor(e,...t){this.#e=e;let i=new Map;e.forEach((n,r)=>{i.set(n,r)}),this.#r=i,this.#i=t}get characterSet(){return this.#e}get characterSetSize(){return this.#e.length}get exclusionSupport(){return this.#i}character(e){return this.#e[e]}characterIndex(e){return this.#r.get(e)}characterIndexes(e){return Array.from(e).map(t=>this.#r.get(t))}static#n(e){return typeof e=="function"?e():e}validateExclusion(e){if(e!==void 0&&e!==b.None&&!this.#i.includes(e))throw new RangeError(m.t("CharacterSetValidator.exclusionNotSupported",{exclusion:e}))}validate(e,t){let i=e.length,n=t?.minimumLength,r=t?.maximumLength;if(n!==void 0&&i<n){let o;throw r!==void 0&&r===n?o=m.t(t?.component===void 0?"CharacterSetValidator.lengthMustBeEqualTo":"CharacterSetValidator.lengthOfComponentMustBeEqualTo",{component:a.#n(t?.component),length:i,exactLength:n}):o=m.t(t?.component===void 0?"CharacterSetValidator.lengthMustBeGreaterThanOrEqualTo":"CharacterSetValidator.lengthOfComponentMustBeGreaterThanOrEqualTo",{component:a.#n(t?.component),length:i,minimumLength:n}),new RangeError(o)}if(r!==void 0&&i>r)throw new RangeError(m.t(t?.component===void 0?"CharacterSetValidator.lengthMustBeLessThanOrEqualTo":"CharacterSetValidator.lengthOfComponentMustBeLessThanOrEqualTo",{component:a.#n(t?.component),length:i,maximumLength:r}));let s=this.characterIndexes(e).findIndex(o=>o===void 0);if(s!==-1)throw new RangeError(m.t(t?.component===void 0?"CharacterSetValidator.invalidCharacterAtPosition":"CharacterSetValidator.invalidCharacterAtPositionOfComponent",{component:a.#n(t?.component),c:e.charAt(s),position:s+(t?.positionOffset??0)+1}));if(t?.exclusion!==void 0)switch(this.validateExclusion(t.exclusion),t.exclusion){case b.None:break;case b.FirstZero:if(e.startsWith("0"))throw new RangeError(m.t(t.component===void 0?"CharacterSetValidator.invalidCharacterAtPosition":"CharacterSetValidator.invalidCharacterAtPositionOfComponent",{component:a.#n(t.component),c:"0",position:(t.positionOffset??0)+1}));break;case b.AllNumeric:a.#t.validate(e);break}}},D=class a extends pe{static MAXIMUM_STRING_LENGTH=40;static#t;static#e(e){let t=new Array(this.MAXIMUM_STRING_LENGTH+1),i=BigInt(e);for(let n=0,r=1n;n<=this.MAXIMUM_STRING_LENGTH;n++,r*=i)t[n]=r;return t}static powerOf10(e){return a.#t??=a.#e(10),a.#t[e]}#r;#i;#n;#s;constructor(e,...t){super(e,...t),this.#r=BigInt(this.characterSetSize),this.#i=BigInt(this.characterSetSize-1);let i=[],n=a.#e(this.characterSetSize);if(i[b.None]=n,t.includes(b.FirstZero)){if(e[0]!=="0")throw new RangeError(m.t("CharacterSetValidator.firstZeroFirstCharacter"));let s=new Array(a.MAXIMUM_STRING_LENGTH+1);s[0]=0n;for(let o=1;o<=a.MAXIMUM_STRING_LENGTH;o++)s[o]=this.#i*n[o-1];i[b.FirstZero]=s}if(t.includes(b.AllNumeric)){let o=function(d){let f=d[0];for(let g of d){if(g===void 0||g!==f)throw new RangeError(m.t("CharacterSetValidator.allNumericAllNumericCharacters"));f=g+1}};var r=o;let s=new Array(a.MAXIMUM_STRING_LENGTH+1),l=this.characterIndexes("0123456789");o(l);let u=BigInt(l[0]),h=new Array(a.MAXIMUM_STRING_LENGTH+1),c=0n;for(let d=0;d<=a.MAXIMUM_STRING_LENGTH;d++)s[d]=n[d]-a.powerOf10(d),h[d]=c,c=c*this.#r+u;this.#s=h,i[b.AllNumeric]=s}else this.#s=[];this.#n=i}#o(e){return this.#n[b.None][e]}#a(e,t,i){let n;if(t===0){if(!e&&i<10n)throw new RangeError(m.t("CharacterSetValidator.stringMustNotBeAllNumeric"));n=10n}else{let r=this.#o(t),s=a.powerOf10(t),o=e?r-s:r,l=i/o;l>=10n?n=a.powerOf10(t+1):n=l*s+this.#a(e,t-1,i-l*o)}return n}#l(e){if(e<0)throw new RangeError(m.t("CharacterSetValidator.lengthMustBeGreaterThanOrEqualTo",{length:e,minimumLength:0}));if(e>a.MAXIMUM_STRING_LENGTH)throw new RangeError(m.t("CharacterSetValidator.lengthMustBeLessThanOrEqualTo",{length:e,maximumLength:a.MAXIMUM_STRING_LENGTH}))}create(e,t,i,n,r){this.#l(e),this.validateExclusion(i);let s=i===b.AllNumeric?this.#s[e]:0n;return F.get(this.#n[i??b.None][e],n).forward(t,(l,u)=>{let h="";if(e!==0){let c=l;i===b.AllNumeric&&c>=s&&(c+=this.#a(!0,e,c-s));for(let d=e-1;d>0;d--){let f=c/this.#r;h=this.character(Number(c-f*this.#r))+h,c=f}h=this.character(i===b.FirstZero?Number(c%this.#i)+1:Number(c%this.#r))+h}return r===void 0?h:r(h,u)})}valueFor(e,t,i){let n=e.length;this.#l(n),this.validateExclusion(t);let r=BigInt(this.characterSetSize),s=this.characterIndexes(e).reduce((o,l,u)=>{if(l===void 0)throw new RangeError(m.t("CharacterSetValidator.invalidCharacterAtPosition",{c:e.charAt(u),position:u+1}));let h;if(u===0&&t===b.FirstZero){if(l===0)throw new RangeError(m.t("CharacterSetValidator.invalidCharacterAtPosition",{c:"0",position:1}));h=BigInt(l-1)}else h=o*r+BigInt(l);return h},0n);if(t===b.AllNumeric){let o=this.#s[n];s>=o&&(s-=this.#a(!1,n,s-o))}return F.get(this.#n[t??b.None][n],i).reverse(s)}},rt=new D(["0","1","2","3","4","5","6","7","8","9"],b.FirstZero),zt=rt,st=new D(["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"],b.FirstZero,b.AllNumeric),Zt=st,at=new D(["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]),Jt=at,ot=new D(["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],b.FirstZero,b.AllNumeric),_t=ot;export{at as ALPHABETIC_CREATOR,Jt as ALPHABETIC_VALIDATOR,ot as ALPHANUMERIC_CREATOR,_t as ALPHANUMERIC_VALIDATOR,D as CharacterSetCreator,pe as CharacterSetValidator,ge as EncryptionTransformer,b as Exclusions,st as HEXADECIMAL_CREATOR,Zt as HEXADECIMAL_VALIDATOR,fe as IdentityTransformer,rt as NUMERIC_CREATOR,zt as NUMERIC_VALIDATOR,Fe as RecordValidator,te as RegExpValidator,ee as Sequence,F as Transformer,It as i18nUtilityInit,m as i18nextUtility,z as mapIterable,nt as utilityNS,it as utilityResourceBundle};
|
|
2
1
|
/*!
|
|
3
2
|
* Copyright © 2024-2026 Dolphin Data Development Ltd. and AIDC Toolkit
|
|
4
3
|
* contributors
|
|
@@ -15,3 +14,12 @@ import{i18nCoreInit as et,i18nInit as tt}from"@aidc-toolkit/core";var p=a=>typeo
|
|
|
15
14
|
* See the License for the specific language governing permissions and
|
|
16
15
|
* limitations under the License.
|
|
17
16
|
*/
|
|
17
|
+
export * from "./locale/i18n.js";
|
|
18
|
+
export * from "./sequence.js";
|
|
19
|
+
export * from "./iterable-utility.js";
|
|
20
|
+
export * from "./transformer.js";
|
|
21
|
+
export * from "./reg-exp.js";
|
|
22
|
+
export * from "./record.js";
|
|
23
|
+
export * from "./exclusion.js";
|
|
24
|
+
export * from "./character-set.js";
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,kBAAkB,CAAC;AAEjC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Indexed callback, used to map an input and optionally its index in an iterable to an output.
|
|
3
|
+
*
|
|
4
|
+
* @template TInput
|
|
5
|
+
* Input type.
|
|
6
|
+
*
|
|
7
|
+
* @template TOutput
|
|
8
|
+
* Output type.
|
|
9
|
+
*
|
|
10
|
+
* @param input
|
|
11
|
+
* Input value.
|
|
12
|
+
*
|
|
13
|
+
* @param index
|
|
14
|
+
* Index in iterable or undefined for single mapping).
|
|
15
|
+
*
|
|
16
|
+
* @returns
|
|
17
|
+
* Output value.
|
|
18
|
+
*/
|
|
19
|
+
export type IndexedCallback<TInput, TOutput> = (input: TInput, index?: number) => TOutput;
|
|
20
|
+
/**
|
|
21
|
+
* Map an input iterable to an output iterable that applies a transformer callback to each value in the input.
|
|
22
|
+
*
|
|
23
|
+
* @template TInput
|
|
24
|
+
* Input type.
|
|
25
|
+
*
|
|
26
|
+
* @template TOutput
|
|
27
|
+
* Output type.
|
|
28
|
+
*
|
|
29
|
+
* @param values
|
|
30
|
+
* Input values iterable.
|
|
31
|
+
*
|
|
32
|
+
* @param indexedCallback
|
|
33
|
+
* Callback to transform input value to output value.
|
|
34
|
+
*
|
|
35
|
+
* @returns
|
|
36
|
+
* Output values iterable.
|
|
37
|
+
*/
|
|
38
|
+
export declare function mapIterable<TInput, TOutput>(values: Iterable<TInput>, indexedCallback: IndexedCallback<TInput, TOutput>): Iterable<TOutput>;
|
|
39
|
+
//# sourceMappingURL=iterable-utility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iterable-utility.d.ts","sourceRoot":"","sources":["../src/iterable-utility.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,eAAe,CAAC,MAAM,EAAE,OAAO,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;AAE1F;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAgB3I"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map an input iterable to an output iterable that applies a transformer callback to each value in the input.
|
|
3
|
+
*
|
|
4
|
+
* @template TInput
|
|
5
|
+
* Input type.
|
|
6
|
+
*
|
|
7
|
+
* @template TOutput
|
|
8
|
+
* Output type.
|
|
9
|
+
*
|
|
10
|
+
* @param values
|
|
11
|
+
* Input values iterable.
|
|
12
|
+
*
|
|
13
|
+
* @param indexedCallback
|
|
14
|
+
* Callback to transform input value to output value.
|
|
15
|
+
*
|
|
16
|
+
* @returns
|
|
17
|
+
* Output values iterable.
|
|
18
|
+
*/
|
|
19
|
+
export function mapIterable(values, indexedCallback) {
|
|
20
|
+
return {
|
|
21
|
+
/**
|
|
22
|
+
* Iterable implementation.
|
|
23
|
+
*
|
|
24
|
+
* @yields
|
|
25
|
+
* Next output value.
|
|
26
|
+
*/
|
|
27
|
+
*[Symbol.iterator]() {
|
|
28
|
+
let index = 0;
|
|
29
|
+
for (const value of values) {
|
|
30
|
+
yield indexedCallback(value, index++);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=iterable-utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iterable-utility.js","sourceRoot":"","sources":["../src/iterable-utility.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,WAAW,CAAkB,MAAwB,EAAE,eAAiD;IACpH,OAAO;QACH;;;;;WAKG;QACH,CAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;YACf,IAAI,KAAK,GAAG,CAAC,CAAC;YAEd,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;gBACzB,MAAM,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;YAC1C,CAAC;QACL,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
Transformer: {
|
|
3
|
+
domainMustBeGreaterThanZero: string;
|
|
4
|
+
tweakMustBeGreaterThanOrEqualToZero: string;
|
|
5
|
+
valueMustBeGreaterThanOrEqualToZero: string;
|
|
6
|
+
valueMustBeLessThan: string;
|
|
7
|
+
minimumValueMustBeGreaterThanOrEqualToZero: string;
|
|
8
|
+
maximumValueMustBeLessThan: string;
|
|
9
|
+
};
|
|
10
|
+
RegExpValidator: {
|
|
11
|
+
stringDoesNotMatchPattern: string;
|
|
12
|
+
};
|
|
13
|
+
CharacterSetValidator: {
|
|
14
|
+
firstZeroFirstCharacter: string;
|
|
15
|
+
allNumericAllNumericCharacters: string;
|
|
16
|
+
stringMustNotBeAllNumeric: string;
|
|
17
|
+
lengthMustBeGreaterThanOrEqualTo: string;
|
|
18
|
+
lengthMustBeLessThanOrEqualTo: string;
|
|
19
|
+
lengthMustBeEqualTo: string;
|
|
20
|
+
lengthOfComponentMustBeGreaterThanOrEqualTo: string;
|
|
21
|
+
lengthOfComponentMustBeLessThanOrEqualTo: string;
|
|
22
|
+
lengthOfComponentMustBeEqualTo: string;
|
|
23
|
+
invalidCharacterAtPosition: string;
|
|
24
|
+
invalidCharacterAtPositionOfComponent: string;
|
|
25
|
+
exclusionNotSupported: string;
|
|
26
|
+
endSequenceValueMustBeLessThanOrEqualTo: string;
|
|
27
|
+
};
|
|
28
|
+
RecordValidator: {
|
|
29
|
+
typeNameKeyNotFound: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export default _default;
|
|
33
|
+
//# sourceMappingURL=locale-resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale-resources.d.ts","sourceRoot":"","sources":["../../../src/locale/en/locale-resources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBA8BE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
Transformer: {
|
|
3
|
+
domainMustBeGreaterThanZero: "Domain {{domain, number}} must be greater than 0",
|
|
4
|
+
tweakMustBeGreaterThanOrEqualToZero: "Tweak {{tweak, number}} must be greater than or equal to 0",
|
|
5
|
+
valueMustBeGreaterThanOrEqualToZero: "Value {{value, number}} must be greater than or equal to 0",
|
|
6
|
+
valueMustBeLessThan: "Value {{value, number}} must be less than {{domain, number}}",
|
|
7
|
+
minimumValueMustBeGreaterThanOrEqualToZero: "Minimum value {{minimumValue, number}} must be greater than or equal to 0",
|
|
8
|
+
maximumValueMustBeLessThan: "Maximum value {{maximumValue, number}} must be less than {{domain, number}}"
|
|
9
|
+
},
|
|
10
|
+
RegExpValidator: {
|
|
11
|
+
stringDoesNotMatchPattern: "String {{s}} does not match pattern"
|
|
12
|
+
},
|
|
13
|
+
CharacterSetValidator: {
|
|
14
|
+
firstZeroFirstCharacter: "Character set must support zero as first character",
|
|
15
|
+
allNumericAllNumericCharacters: "Character set must support all numeric characters in sequence",
|
|
16
|
+
stringMustNotBeAllNumeric: "String must not be all numeric",
|
|
17
|
+
lengthMustBeGreaterThanOrEqualTo: "Length {{length, number}} must be greater than or equal to {{minimumLength, number}}",
|
|
18
|
+
lengthMustBeLessThanOrEqualTo: "Length {{length, number}} must be less than or equal to {{maximumLength, number}}",
|
|
19
|
+
lengthMustBeEqualTo: "Length {{length, number}} must be equal to {{exactLength, number}}",
|
|
20
|
+
lengthOfComponentMustBeGreaterThanOrEqualTo: "Length {{length, number}} of {{component}} must be greater than or equal to {{minimumLength, number}}",
|
|
21
|
+
lengthOfComponentMustBeLessThanOrEqualTo: "Length {{length, number}} of {{component}} must be less than or equal to {{maximumLength, number}}",
|
|
22
|
+
lengthOfComponentMustBeEqualTo: "Length {{length, number}} of {{component}} must be equal to {{exactLength, number}}",
|
|
23
|
+
invalidCharacterAtPosition: "Invalid character '{{c}}' at position {{position, number}}",
|
|
24
|
+
invalidCharacterAtPositionOfComponent: "Invalid character '{{c}}' at position {{position, number}} of {{component}}",
|
|
25
|
+
exclusionNotSupported: "Exclusion value of {{exclusion, number}} is not supported",
|
|
26
|
+
endSequenceValueMustBeLessThanOrEqualTo: "End sequence value (start sequence value + count - 1) must be less than {{domain, number}}"
|
|
27
|
+
},
|
|
28
|
+
RecordValidator: {
|
|
29
|
+
typeNameKeyNotFound: "{{typeName}} \"{{key}}\" not found"
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=locale-resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale-resources.js","sourceRoot":"","sources":["../../../src/locale/en/locale-resources.ts"],"names":[],"mappings":"AAAA,eAAe;IACX,WAAW,EAAE;QACT,2BAA2B,EAAE,kDAAkD;QAC/E,mCAAmC,EAAE,4DAA4D;QACjG,mCAAmC,EAAE,4DAA4D;QACjG,mBAAmB,EAAE,8DAA8D;QACnF,0CAA0C,EAAE,2EAA2E;QACvH,0BAA0B,EAAE,6EAA6E;KAC5G;IACD,eAAe,EAAE;QACb,yBAAyB,EAAE,qCAAqC;KACnE;IACD,qBAAqB,EAAE;QACnB,uBAAuB,EAAE,oDAAoD;QAC7E,8BAA8B,EAAE,+DAA+D;QAC/F,yBAAyB,EAAE,gCAAgC;QAC3D,gCAAgC,EAAE,sFAAsF;QACxH,6BAA6B,EAAE,mFAAmF;QAClH,mBAAmB,EAAE,oEAAoE;QACzF,2CAA2C,EAAE,uGAAuG;QACpJ,wCAAwC,EAAE,oGAAoG;QAC9I,8BAA8B,EAAE,qFAAqF;QACrH,0BAA0B,EAAE,4DAA4D;QACxF,qCAAqC,EAAE,6EAA6E;QACpH,qBAAqB,EAAE,2DAA2D;QAClF,uCAAuC,EAAE,4FAA4F;KACxI;IACD,eAAe,EAAE;QACb,mBAAmB,EAAE,oCAAoC;KAC5D;CACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
Transformer: {
|
|
3
|
+
domainMustBeGreaterThanZero: string;
|
|
4
|
+
tweakMustBeGreaterThanOrEqualToZero: string;
|
|
5
|
+
valueMustBeGreaterThanOrEqualToZero: string;
|
|
6
|
+
valueMustBeLessThan: string;
|
|
7
|
+
minimumValueMustBeGreaterThanOrEqualToZero: string;
|
|
8
|
+
maximumValueMustBeLessThan: string;
|
|
9
|
+
};
|
|
10
|
+
RegExpValidator: {
|
|
11
|
+
stringDoesNotMatchPattern: string;
|
|
12
|
+
};
|
|
13
|
+
CharacterSetValidator: {
|
|
14
|
+
firstZeroFirstCharacter: string;
|
|
15
|
+
allNumericAllNumericCharacters: string;
|
|
16
|
+
stringMustNotBeAllNumeric: string;
|
|
17
|
+
lengthMustBeGreaterThanOrEqualTo: string;
|
|
18
|
+
lengthMustBeLessThanOrEqualTo: string;
|
|
19
|
+
lengthMustBeEqualTo: string;
|
|
20
|
+
lengthOfComponentMustBeGreaterThanOrEqualTo: string;
|
|
21
|
+
lengthOfComponentMustBeLessThanOrEqualTo: string;
|
|
22
|
+
lengthOfComponentMustBeEqualTo: string;
|
|
23
|
+
invalidCharacterAtPosition: string;
|
|
24
|
+
invalidCharacterAtPositionOfComponent: string;
|
|
25
|
+
exclusionNotSupported: string;
|
|
26
|
+
endSequenceValueMustBeLessThanOrEqualTo: string;
|
|
27
|
+
};
|
|
28
|
+
RecordValidator: {
|
|
29
|
+
typeNameKeyNotFound: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export default _default;
|
|
33
|
+
//# sourceMappingURL=locale-resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale-resources.d.ts","sourceRoot":"","sources":["../../../src/locale/fr/locale-resources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBA8BE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
Transformer: {
|
|
3
|
+
domainMustBeGreaterThanZero: "Le domaine {{domain, number}} doit être supérieur à 0",
|
|
4
|
+
tweakMustBeGreaterThanOrEqualToZero: "Le réglage {{tweak, number}} doit être supérieur ou égal à 0",
|
|
5
|
+
valueMustBeGreaterThanOrEqualToZero: "La valeur {{value, number}} doit être supérieure ou égale à 0",
|
|
6
|
+
valueMustBeLessThan: "La valeur {{value, number}} doit être inférieure à {{domain, number}}",
|
|
7
|
+
minimumValueMustBeGreaterThanOrEqualToZero: "La valeur minimale {{minimumValue, number}} doit être supérieure ou égale à 0",
|
|
8
|
+
maximumValueMustBeLessThan: "La valeur maximale {{maximumValue, number}} doit être inférieure à {{domain, number}}"
|
|
9
|
+
},
|
|
10
|
+
RegExpValidator: {
|
|
11
|
+
stringDoesNotMatchPattern: "La chaîne {{s}} ne correspond pas au modèle"
|
|
12
|
+
},
|
|
13
|
+
CharacterSetValidator: {
|
|
14
|
+
firstZeroFirstCharacter: "Le jeu de caractères doit prendre en charge zéro comme premier caractère",
|
|
15
|
+
allNumericAllNumericCharacters: "Le jeu de caractères doit prendre en charge tous les caractères numériques en séquence",
|
|
16
|
+
stringMustNotBeAllNumeric: "La chaîne ne doit pas être entièrement numérique",
|
|
17
|
+
lengthMustBeGreaterThanOrEqualTo: "La longueur {{length, number}} doit être supérieure ou égale à {{minimumLength, number}}",
|
|
18
|
+
lengthMustBeLessThanOrEqualTo: "La longueur {{length, number}} doit être inférieure ou égale à {{maximumLength, number}}",
|
|
19
|
+
lengthMustBeEqualTo: "La longueur {{length, number}} doit être égale à {{exactLength, number}}",
|
|
20
|
+
lengthOfComponentMustBeGreaterThanOrEqualTo: "La longueur {{length, number}} de {{component}} doit être supérieure ou égale à {{minimumLength, number}}",
|
|
21
|
+
lengthOfComponentMustBeLessThanOrEqualTo: "La longueur {{length, number}} de {{component}} doit être inférieure ou égale à {{maximumLength, number}}",
|
|
22
|
+
lengthOfComponentMustBeEqualTo: "La longueur {{length, number}} de {{component}} doit être égale à {{exactLength, number}}",
|
|
23
|
+
invalidCharacterAtPosition: "Caractère non valide '{{c}}' à la position {{position, number}}",
|
|
24
|
+
invalidCharacterAtPositionOfComponent: "Caractère non valide '{{c}}' à la position {{position, number}} de {{component}}",
|
|
25
|
+
exclusionNotSupported: "La valeur d'exclusion de {{exclusion, number}} n'est pas prise en charge",
|
|
26
|
+
endSequenceValueMustBeLessThanOrEqualTo: "La valeur de la séquence de fin (valeur de la séquence de début + nombre - 1) doit être inférieure à {{domain, number}}"
|
|
27
|
+
},
|
|
28
|
+
RecordValidator: {
|
|
29
|
+
typeNameKeyNotFound: "{{typeName}} « {{key}} » introuvable"
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=locale-resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale-resources.js","sourceRoot":"","sources":["../../../src/locale/fr/locale-resources.ts"],"names":[],"mappings":"AAAA,eAAe;IACX,WAAW,EAAE;QACT,2BAA2B,EAAE,uDAAuD;QACpF,mCAAmC,EAAE,8DAA8D;QACnG,mCAAmC,EAAE,+DAA+D;QACpG,mBAAmB,EAAE,uEAAuE;QAC5F,0CAA0C,EAAE,+EAA+E;QAC3H,0BAA0B,EAAE,uFAAuF;KACtH;IACD,eAAe,EAAE;QACb,yBAAyB,EAAE,6CAA6C;KAC3E;IACD,qBAAqB,EAAE;QACnB,uBAAuB,EAAE,0EAA0E;QACnG,8BAA8B,EAAE,wFAAwF;QACxH,yBAAyB,EAAE,kDAAkD;QAC7E,gCAAgC,EAAE,0FAA0F;QAC5H,6BAA6B,EAAE,0FAA0F;QACzH,mBAAmB,EAAE,0EAA0E;QAC/F,2CAA2C,EAAE,2GAA2G;QACxJ,wCAAwC,EAAE,2GAA2G;QACrJ,8BAA8B,EAAE,2FAA2F;QAC3H,0BAA0B,EAAE,iEAAiE;QAC7F,qCAAqC,EAAE,kFAAkF;QACzH,qBAAqB,EAAE,0EAA0E;QACjG,uCAAuC,EAAE,yHAAyH;KACrK;IACD,eAAe,EAAE;QACb,mBAAmB,EAAE,sCAAsC;KAC9D;CACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type I18nLanguageDetector } from "@aidc-toolkit/core";
|
|
2
|
+
import { type i18n, type Resource } from "i18next";
|
|
3
|
+
import enLocaleResources from "./en/locale-resources.js";
|
|
4
|
+
export declare const utilityNS = "aidct_utility";
|
|
5
|
+
/**
|
|
6
|
+
* Locale strings type is extracted from the English locale strings object.
|
|
7
|
+
*/
|
|
8
|
+
export type UtilityLocaleResources = typeof enLocaleResources;
|
|
9
|
+
/**
|
|
10
|
+
* Utility resource bundle.
|
|
11
|
+
*/
|
|
12
|
+
export declare const utilityResourceBundle: Resource;
|
|
13
|
+
export declare const i18nextUtility: i18n;
|
|
14
|
+
/**
|
|
15
|
+
* Initialize internationalization.
|
|
16
|
+
*
|
|
17
|
+
* @param languageDetector
|
|
18
|
+
* Language detector.
|
|
19
|
+
*
|
|
20
|
+
* @param debug
|
|
21
|
+
* Debug setting.
|
|
22
|
+
*
|
|
23
|
+
* @returns
|
|
24
|
+
* Utility resource bundle.
|
|
25
|
+
*/
|
|
26
|
+
export declare function i18nUtilityInit(languageDetector: I18nLanguageDetector, debug?: boolean): Promise<Resource>;
|
|
27
|
+
//# sourceMappingURL=i18n.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/locale/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAgB,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,iBAAiB,MAAM,0BAA0B,CAAC;AAGzD,eAAO,MAAM,SAAS,kBAAkB,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,iBAAiB,CAAC;AAE9D;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,QAOnC,CAAC;AAGF,eAAO,MAAM,cAAc,EAAE,IAA+B,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CAAC,gBAAgB,EAAE,oBAAoB,EAAE,KAAK,UAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAE9G"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { i18nCoreInit, i18nInit } from "@aidc-toolkit/core";
|
|
2
|
+
import i18next from "i18next";
|
|
3
|
+
import enLocaleResources from "./en/locale-resources.js";
|
|
4
|
+
import frLocaleResources from "./fr/locale-resources.js";
|
|
5
|
+
export const utilityNS = "aidct_utility";
|
|
6
|
+
/**
|
|
7
|
+
* Utility resource bundle.
|
|
8
|
+
*/
|
|
9
|
+
export const utilityResourceBundle = {
|
|
10
|
+
en: {
|
|
11
|
+
aidct_utility: enLocaleResources
|
|
12
|
+
},
|
|
13
|
+
fr: {
|
|
14
|
+
aidct_utility: frLocaleResources
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
// Explicit type is necessary because type can't be inferred without additional references.
|
|
18
|
+
export const i18nextUtility = i18next.createInstance();
|
|
19
|
+
/**
|
|
20
|
+
* Initialize internationalization.
|
|
21
|
+
*
|
|
22
|
+
* @param languageDetector
|
|
23
|
+
* Language detector.
|
|
24
|
+
*
|
|
25
|
+
* @param debug
|
|
26
|
+
* Debug setting.
|
|
27
|
+
*
|
|
28
|
+
* @returns
|
|
29
|
+
* Utility resource bundle.
|
|
30
|
+
*/
|
|
31
|
+
export async function i18nUtilityInit(languageDetector, debug = false) {
|
|
32
|
+
return i18nInit(i18nextUtility, languageDetector, debug, utilityNS, utilityResourceBundle, i18nCoreInit);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=i18n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/locale/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAA6B,MAAM,oBAAoB,CAAC;AACvF,OAAO,OAAqC,MAAM,SAAS,CAAC;AAC5D,OAAO,iBAAiB,MAAM,0BAA0B,CAAC;AACzD,OAAO,iBAAiB,MAAM,0BAA0B,CAAC;AAEzD,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAC;AAOzC;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAa;IAC3C,EAAE,EAAE;QACA,aAAa,EAAE,iBAAiB;KACnC;IACD,EAAE,EAAE;QACA,aAAa,EAAE,iBAAiB;KACnC;CACJ,CAAC;AAEF,2FAA2F;AAC3F,MAAM,CAAC,MAAM,cAAc,GAAS,OAAO,CAAC,cAAc,EAAE,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,gBAAsC,EAAE,KAAK,GAAG,KAAK;IACvF,OAAO,QAAQ,CAAC,cAAc,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,EAAE,qBAAqB,EAAE,YAAY,CAAC,CAAC;AAC7G,CAAC"}
|
package/dist/record.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { StringValidator } from "./string.js";
|
|
2
|
+
/**
|
|
3
|
+
* Record validator. Validation is performed against a record with a string key type and throws an error if the key is
|
|
4
|
+
* not found.
|
|
5
|
+
*
|
|
6
|
+
* @template T
|
|
7
|
+
* Property type.
|
|
8
|
+
*/
|
|
9
|
+
export declare class RecordValidator<T> implements StringValidator {
|
|
10
|
+
#private;
|
|
11
|
+
/**
|
|
12
|
+
* Constructor.
|
|
13
|
+
*
|
|
14
|
+
* @param typeName
|
|
15
|
+
* Type name for error message.
|
|
16
|
+
*
|
|
17
|
+
* @param record
|
|
18
|
+
* Record in which to look up keys.
|
|
19
|
+
*/
|
|
20
|
+
constructor(typeName: string, record: Readonly<Record<string, T>>);
|
|
21
|
+
/**
|
|
22
|
+
* Get the type name.
|
|
23
|
+
*/
|
|
24
|
+
get typeName(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Get the record.
|
|
27
|
+
*/
|
|
28
|
+
get record(): Readonly<Record<string, T>>;
|
|
29
|
+
/**
|
|
30
|
+
* Validate a key by looking it up in the record.
|
|
31
|
+
*
|
|
32
|
+
* @param key
|
|
33
|
+
* Record key.
|
|
34
|
+
*/
|
|
35
|
+
validate(key: string): void;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=record.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../src/record.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;GAMG;AACH,qBAAa,eAAe,CAAC,CAAC,CAAE,YAAW,eAAe;;IAWtD;;;;;;;;OAQG;gBACS,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAKjE;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAExC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAQ9B"}
|
package/dist/record.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { i18nextUtility } from "./locale/i18n.js";
|
|
2
|
+
/**
|
|
3
|
+
* Record validator. Validation is performed against a record with a string key type and throws an error if the key is
|
|
4
|
+
* not found.
|
|
5
|
+
*
|
|
6
|
+
* @template T
|
|
7
|
+
* Property type.
|
|
8
|
+
*/
|
|
9
|
+
export class RecordValidator {
|
|
10
|
+
/**
|
|
11
|
+
* Type name for error message.
|
|
12
|
+
*/
|
|
13
|
+
#typeName;
|
|
14
|
+
/**
|
|
15
|
+
* Record in which to look up keys.
|
|
16
|
+
*/
|
|
17
|
+
#record;
|
|
18
|
+
/**
|
|
19
|
+
* Constructor.
|
|
20
|
+
*
|
|
21
|
+
* @param typeName
|
|
22
|
+
* Type name for error message.
|
|
23
|
+
*
|
|
24
|
+
* @param record
|
|
25
|
+
* Record in which to look up keys.
|
|
26
|
+
*/
|
|
27
|
+
constructor(typeName, record) {
|
|
28
|
+
this.#typeName = typeName;
|
|
29
|
+
this.#record = record;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get the type name.
|
|
33
|
+
*/
|
|
34
|
+
get typeName() {
|
|
35
|
+
return this.#typeName;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Get the record.
|
|
39
|
+
*/
|
|
40
|
+
get record() {
|
|
41
|
+
return this.#record;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Validate a key by looking it up in the record.
|
|
45
|
+
*
|
|
46
|
+
* @param key
|
|
47
|
+
* Record key.
|
|
48
|
+
*/
|
|
49
|
+
validate(key) {
|
|
50
|
+
if (!(key in this.record)) {
|
|
51
|
+
throw new RangeError(i18nextUtility.t("RecordValidator.typeNameKeyNotFound", {
|
|
52
|
+
typeName: this.typeName,
|
|
53
|
+
key
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record.js","sourceRoot":"","sources":["../src/record.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;;;;;GAMG;AACH,MAAM,OAAO,eAAe;IACxB;;OAEG;IACM,SAAS,CAAS;IAE3B;;OAEG;IACM,OAAO,CAA8B;IAE9C;;;;;;;;OAQG;IACH,YAAY,QAAgB,EAAE,MAAmC;QAC7D,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAI,QAAQ;QACR,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,GAAW;QAChB,IAAI,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,qCAAqC,EAAE;gBACzE,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,GAAG;aACN,CAAC,CAAC,CAAC;QACR,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { StringValidator } from "./string.js";
|
|
2
|
+
/**
|
|
3
|
+
* Regular expression validator. The regular expression applies to the full string only if constructed as such. For
|
|
4
|
+
* example, <code>/\d*/</code> (0 or more digits) matches every string, <code>/\d+/</code> (1
|
|
5
|
+
* or more digits) matches strings with at least one digit, <code>/^\d*$/</code> matches strings that are
|
|
6
|
+
* all digits or empty, and <code>/^\d+$/</code> matches strings that are all digits and not empty.
|
|
7
|
+
*
|
|
8
|
+
* Clients of this class are recommended to override the {@linkcode createErrorMessage | createErrorMessage()} method
|
|
9
|
+
* to create a more suitable error message for their use case.
|
|
10
|
+
*/
|
|
11
|
+
export declare class RegExpValidator implements StringValidator {
|
|
12
|
+
#private;
|
|
13
|
+
/**
|
|
14
|
+
* Constructor.
|
|
15
|
+
*
|
|
16
|
+
* @param regExp
|
|
17
|
+
* Regular expression. See {@link RegExpValidator | class documentation} for notes.
|
|
18
|
+
*/
|
|
19
|
+
constructor(regExp: RegExp);
|
|
20
|
+
/**
|
|
21
|
+
* Get the regular expression.
|
|
22
|
+
*/
|
|
23
|
+
get regExp(): RegExp;
|
|
24
|
+
/**
|
|
25
|
+
* Create an error message for a string. The generic error message is sufficient for many use cases but a more
|
|
26
|
+
* domain-specific error message, possibly including the pattern itself, is often required.
|
|
27
|
+
*
|
|
28
|
+
* @param s
|
|
29
|
+
* String.
|
|
30
|
+
*
|
|
31
|
+
* @returns
|
|
32
|
+
* Error message.
|
|
33
|
+
*/
|
|
34
|
+
protected createErrorMessage(s: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* @inheritDoc
|
|
37
|
+
*/
|
|
38
|
+
validate(s: string): void;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=reg-exp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reg-exp.d.ts","sourceRoot":"","sources":["../src/reg-exp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;;;GAQG;AACH,qBAAa,eAAgB,YAAW,eAAe;;IAMnD;;;;;OAKG;gBACS,MAAM,EAAE,MAAM;IAI1B;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;;;;;;;;OASG;IACH,SAAS,CAAC,kBAAkB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAM/C;;OAEG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;CAK5B"}
|