@arc-js/intl 0.0.95 → 0.0.96

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.
@@ -931,8 +931,6 @@ const mergeDeep = (target, source) => {
931
931
  };
932
932
 
933
933
  const loadBaseTranslations = (locale, translationsConfig) => __awaiter(void 0, void 0, void 0, function* () {
934
- console.log('📥 LOADING base translations for:', locale);
935
- console.log('📊 Config available:', translationsConfig ? 'YES' : 'NO');
936
934
  if (!(translationsConfig === null || translationsConfig === void 0 ? void 0 : translationsConfig.base[locale])) {
937
935
  console.warn(`❌ No base translations found for locale: ${locale}`);
938
936
  console.warn('Available locales:', (translationsConfig === null || translationsConfig === void 0 ? void 0 : translationsConfig.base) ? Object.keys(translationsConfig.base) : 'none');
@@ -941,7 +939,6 @@ const loadBaseTranslations = (locale, translationsConfig) => __awaiter(void 0, v
941
939
  try {
942
940
  const loader = translationsConfig.base[locale];
943
941
  const result = yield loader();
944
- console.log(`✅ Base translations loaded for ${locale}:`, Object.keys(result));
945
942
  return result;
946
943
  }
947
944
  catch (error) {
@@ -977,7 +974,6 @@ const loadModulesTranslations = (locale, translationsConfig) => __awaiter(void 0
977
974
  });
978
975
  const loadModuleTranslations = (moduleName, locale, translationsConfig) => __awaiter(void 0, void 0, void 0, function* () {
979
976
  var _a, _b, _c;
980
- console.log('📥 LOADING module translations:', { moduleName, locale });
981
977
  if (!((_b = (_a = translationsConfig === null || translationsConfig === void 0 ? void 0 : translationsConfig.modules) === null || _a === void 0 ? void 0 : _a[moduleName]) === null || _b === void 0 ? void 0 : _b[locale])) {
982
978
  console.warn(`❌ No translations config found for module "${moduleName}" and locale "${locale}"`);
983
979
  console.warn('Available modules:', (translationsConfig === null || translationsConfig === void 0 ? void 0 : translationsConfig.modules) ? Object.keys(translationsConfig.modules) : 'none');
@@ -989,7 +985,6 @@ const loadModuleTranslations = (moduleName, locale, translationsConfig) => __awa
989
985
  try {
990
986
  const loader = translationsConfig.modules[moduleName][locale];
991
987
  const translations = yield loader();
992
- console.log(`✅ Module ${moduleName} translations loaded for ${locale}:`, Object.keys(translations));
993
988
  return {
994
989
  moduleName,
995
990
  translations
@@ -1039,15 +1034,10 @@ class TranslationService {
1039
1034
  }
1040
1035
  }
1041
1036
  setTranslationsConfig(config) {
1042
- console.log('🔄 Setting translations config in TranslationService', {
1043
- baseLocales: Object.keys(config.base),
1044
- modules: Object.keys(config.modules || {})
1045
- });
1046
1037
  this.translationsConfig = config;
1047
1038
  }
1048
1039
  initialize(locale) {
1049
1040
  return __awaiter(this, void 0, void 0, function* () {
1050
- console.log('🚀 Initializing TranslationService with locale:', locale);
1051
1041
  if (!this.translationsConfig) {
1052
1042
  console.error('❌ No translations config set in TranslationService');
1053
1043
  throw new Error('Translations config not set');
@@ -1058,7 +1048,6 @@ class TranslationService {
1058
1048
  }
1059
1049
  loadLocale(locale) {
1060
1050
  return __awaiter(this, void 0, void 0, function* () {
1061
- console.log(`📥 LOADING LOCALE: ${locale}`);
1062
1051
  if (!this.supportedLocales.includes(locale)) {
1063
1052
  console.warn(`⚠️ Locale ${locale} is not supported`);
1064
1053
  return;
@@ -1068,21 +1057,15 @@ class TranslationService {
1068
1057
  return;
1069
1058
  }
1070
1059
  const base = yield loadBaseTranslations(locale, this.translationsConfig);
1071
- console.log('✅ Base translations loaded for', locale, ':', Object.keys(base));
1072
1060
  const allModules = yield loadModulesTranslations(locale, this.translationsConfig);
1073
- console.log('✅ Modules loaded:', allModules.map(m => m.moduleName));
1074
1061
  this.resources[locale] = allModules.reduce((acc, { moduleName, translations }) => {
1075
1062
  return mergeDeep(acc, { [moduleName]: translations });
1076
1063
  }, { core: base });
1077
- console.log(`✅ LOCALE ${locale} LOADED - Resources:`, Object.keys(this.resources[locale]));
1078
1064
  });
1079
1065
  }
1080
1066
  loadModule(moduleName) {
1081
1067
  return __awaiter(this, void 0, void 0, function* () {
1082
- console.log(`📦 LOADING MODULE: ${moduleName}`);
1083
- console.log(`📊 Already loaded modules:`, Array.from(this.loadedModules));
1084
1068
  if (this.loadedModules.has(moduleName)) {
1085
- console.log(`✅ Module ${moduleName} already loaded`);
1086
1069
  return;
1087
1070
  }
1088
1071
  if (!this.translationsConfig) {
@@ -1090,23 +1073,18 @@ class TranslationService {
1090
1073
  return;
1091
1074
  }
1092
1075
  for (const locale of this.supportedLocales) {
1093
- console.log(`📥 Loading module ${moduleName} for locale ${locale}...`);
1094
1076
  const moduleData = yield loadModuleTranslations(moduleName, locale, this.translationsConfig);
1095
1077
  if (moduleData === null || moduleData === void 0 ? void 0 : moduleData.translations) {
1096
- console.log(`✅ Found translations for ${moduleName} in ${locale}`);
1097
1078
  if (!this.resources[locale]) {
1098
- console.log(`📝 Creating resources for locale ${locale}`);
1099
1079
  this.resources[locale] = { core: {} };
1100
1080
  }
1101
1081
  this.resources[locale][moduleName] = moduleData.translations;
1102
- console.log(`📊 Resources for ${locale}:`, Object.keys(this.resources[locale]));
1103
1082
  }
1104
1083
  else {
1105
1084
  console.warn(`⚠️ No translations found for module ${moduleName} in locale ${locale}`);
1106
1085
  }
1107
1086
  }
1108
1087
  this.loadedModules.add(moduleName);
1109
- console.log(`✅ MODULE ${moduleName} LOADED successfully`);
1110
1088
  });
1111
1089
  }
1112
1090
  t(key, params = {}, options = {}) {
@@ -1,2 +1,2 @@
1
- function __awaiter(e,t,s,o){return new(s=s||Promise)(function(a,t){function i(e){try{n(o.next(e))}catch(e){t(e)}}function r(e){try{n(o.throw(e))}catch(e){t(e)}}function n(e){var t;e.done?a(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(i,r)}n((o=o.apply(e,[])).next())})}var hasRequiredTimez,hasRequiredCooks,cooks={},timez={};function requireTimez(){if(!hasRequiredTimez){hasRequiredTimez=1,Object.defineProperty(timez,"__esModule",{value:!0});class m{constructor(e,t=!1){!1===this.dateChecker(e)?this._date=void 0:e instanceof m&&e&&null!=e&&e._date?this._date=new Date(null==e?void 0:e._date):e instanceof Date?this._date=new Date(e):"string"==typeof e?this._date=m.parseString(e,t):"number"==typeof e?this._date=new Date(e):null==e||"number"==typeof e&&isNaN(e)?this._date=new Date:this._date=void 0}static now(){return new m}static parse(e,t){return"string"==typeof t&&0<t.length&&(e instanceof m&&e&&null!=e&&e._date||e instanceof Date||"string"==typeof e||"number"==typeof e||null==e||"number"==typeof e&&isNaN(e))&&m.parseWithFormat(e,t)||new m(e)}static unix(e){return new m(1e3*e)}static utc(){var e=new Date;return new m(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()))}year(){var e;return null==(e=this._date)?void 0:e.getFullYear()}month(){return this._date?this._date.getMonth()+1:void 0}date(){var e;return null==(e=this._date)?void 0:e.getDate()}hour(){var e;return null==(e=this._date)?void 0:e.getHours()}minute(){var e;return null==(e=this._date)?void 0:e.getMinutes()}second(){var e;return null==(e=this._date)?void 0:e.getSeconds()}millisecond(){var e;return null==(e=this._date)?void 0:e.getMilliseconds()}day(){var e;return null==(e=this._date)?void 0:e.getDay()}add(e,t){if(!this._date)return new m(void 0);var a=new Date(this._date);switch(t){case"years":a.setFullYear(a.getFullYear()+e);break;case"months":a.setMonth(a.getMonth()+e);break;case"days":a.setDate(a.getDate()+e);break;case"hours":a.setHours(a.getHours()+e);break;case"minutes":a.setMinutes(a.getMinutes()+e);break;case"seconds":a.setSeconds(a.getSeconds()+e);break;case"milliseconds":a.setMilliseconds(a.getMilliseconds()+e)}return new m(a)}subtract(e,t){return this.add(-e,t)}startOf(e){if(!this._date)return new m(void 0);var t=new Date(this._date);switch(e){case"year":t.setMonth(0,1),t.setHours(0,0,0,0);break;case"month":t.setDate(1),t.setHours(0,0,0,0);break;case"day":t.setHours(0,0,0,0);break;case"hour":t.setMinutes(0,0,0);break;case"minute":t.setSeconds(0,0);break;case"second":t.setMilliseconds(0)}return new m(t)}endOf(e){var t=this.startOf(e);switch(e){case"year":return t.add(1,"years").subtract(1,"milliseconds");case"month":return t.add(1,"months").subtract(1,"milliseconds");case"day":return t.add(1,"days").subtract(1,"milliseconds");case"hour":return t.add(1,"hours").subtract(1,"milliseconds");case"minute":return t.add(1,"minutes").subtract(1,"milliseconds");case"second":return t.add(1,"seconds").subtract(1,"milliseconds");default:return t}}isBefore(e,t="()"){t="]"===t[1],e=e instanceof m?e:new m(e);return!(!this._date||!e._date)&&(!t&&this._date<e._date||!!t&&this._date<=e._date)}isAfter(e,t="()"){t="["===t[0],e=e instanceof m?e:new m(e);return!(!this._date||!e._date)&&(!t&&this._date>e._date||!!t&&this._date>=e._date)}isSame(e,t){var a,e=e instanceof m?e:new m(e);return!t&&this._date&&e._date?this._date.getTime()===e._date.getTime():(a=t?this.startOf(t):void 0,e=t?e.startOf(t):void 0,!!(a&&null!=a&&a._date&&e&&null!=e&&e._date)&&a._date.getTime()===e._date.getTime())}isBetween(e,t,a="()"){var e=e instanceof m?e:new m(e),t=t instanceof m?t:new m(t),i="["===a[0],a="]"===a[1],i=i&&this.isSame(e)||this.isAfter(e),e=a&&this.isSame(t)||this.isBefore(t);return i&&e}format(e){if(!e)return this.toISOString();var t,a,i=m.PREDEFINED_FORMATS[e];if(i)return this.format(i);let r="",n=0;for(;n<e.length;)"["===e[n]?-1===(a=e.indexOf("]",n))?(r+=e[n],n++):(t=e.substring(n+1,a),r+=t,n=a+1):"%"===e[n]&&n+1<e.length?(t="%"+e[n+1],a=m.FORMAT_TOKENS[t],r+=a?a(this):t,n+=2):(r+=e[n],n++);return r}setTimezone(e){var t;return this._date?(t=this._date.getTimezoneOffset(),e=this.parseTimezoneOffset(e),e=new Date(this._date.getTime()+6e4*(e-t)),new m(e)):new m(void 0)}utc(){return this._date?new m(new Date(Date.UTC(this._date.getUTCFullYear(),this._date.getUTCMonth(),this._date.getUTCDate(),this._date.getUTCHours(),this._date.getUTCMinutes(),this._date.getUTCSeconds(),this._date.getUTCMilliseconds()))):new m(void 0)}local(){return this._date?new m(new Date(this._date.getFullYear(),this._date.getMonth(),this._date.getDate(),this._date.getHours(),this._date.getMinutes(),this._date.getSeconds(),this._date.getMilliseconds())):new m(void 0)}toString(){var e;return null==(e=this._date)?void 0:e.toString()}toISOString(){var e;return null==(e=this._date)?void 0:e.toISOString()}toDate(){return this._date?new Date(this._date):void 0}valueOf(){var e;return null==(e=this._date)?void 0:e.getTime()}unix(){return this._date?Math.floor(this._date.getTime()/1e3):void 0}utcOffset(){return this._date?-this._date.getTimezoneOffset():void 0}isCorrect(){return!!this._date&&!isNaN(this._date.getTime())}timezone(){if(this._date)try{return(new Intl.DateTimeFormat).resolvedOptions().timeZone||void 0}catch(e){return this.timezoneFromOffset()}}timezoneAbbr(){if(this._date)try{var e=new Intl.DateTimeFormat("en",{timeZoneName:"short"}).formatToParts(this._date).find(e=>"timeZoneName"===e.type);return(null==e?void 0:e.value)||void 0}catch(e){return this.timezoneAbbrFromOffset()}}timezoneName(){if(this._date)try{var e=new Intl.DateTimeFormat("en",{timeZoneName:"long"}).formatToParts(this._date).find(e=>"timeZoneName"===e.type);return(null==e?void 0:e.value)||void 0}catch(e){return this.timezoneNameFromOffset()}}timezoneOffsetString(){var e=this.utcOffset();if(void 0!==e)return(0<=e?"+":"-")+Math.floor(Math.abs(e)/60).toString().padStart(2,"0")+":"+(Math.abs(e)%60).toString().padStart(2,"0")}dateChecker(e){return e instanceof m&&!!e&&!(null==e||!e._date)||e instanceof Date||"string"==typeof e||"number"==typeof e||null==e||"number"==typeof e&&isNaN(e)}timezoneFromOffset(){var e=this.utcOffset();if(void 0!==e)return{0:"Etc/UTC",60:"Europe/Paris",120:"Europe/Athens",180:"Europe/Moscow",240:"Asia/Dubai",270:"Asia/Tehran",300:"Asia/Karachi",330:"Asia/Kolkata",345:"Asia/Rangoon",360:"Asia/Dhaka",390:"Asia/Yangon",420:"Asia/Bangkok",480:"Asia/Shanghai",525:"Asia/Kathmandu",540:"Asia/Tokyo",570:"Australia/Adelaide",600:"Australia/Sydney",630:"Australia/Lord_Howe",660:"Pacific/Noumea",675:"Australia/Eucla",720:"Pacific/Auckland",780:"Pacific/Chatham","-60":"Atlantic/Azores","-120":"America/Noronha","-180":"America/Argentina/Buenos_Aires","-210":"America/St_Johns","-240":"America/Halifax","-270":"America/Caracas","-300":"America/New_York","-360":"America/Chicago","-420":"America/Denver","-480":"America/Los_Angeles","-540":"America/Anchorage","-600":"Pacific/Honolulu","-660":"Pacific/Pago_Pago","-720":"Pacific/Kiritimati"}[e]||"Etc/GMT"+(0<=e?"-":"+")+Math.abs(e)/60}timezoneAbbrFromOffset(){var e=this.utcOffset();if(void 0!==e)return{0:"GMT",60:"CET","-300":"EST","-360":"CST","-420":"MST","-480":"PST"}[e]||"GMT"+(0<=e?"+":"")+e/60}timezoneNameFromOffset(){var e=this.utcOffset();if(void 0!==e)return{0:"Greenwich Mean Time",60:"Central European Time","-300":"Eastern Standard Time","-360":"Central Standard Time","-420":"Mountain Standard Time","-480":"Pacific Standard Time"}[e]||"GMT"+(0<=e?"+":"")+e/60}isDST(){if(this._date)try{var e=new Date(this._date.getFullYear(),0,1),t=new Date(this._date.getFullYear(),6,1),a=Math.max(e.getTimezoneOffset(),t.getTimezoneOffset());return this._date.getTimezoneOffset()<a}catch(e){}}static parseString(e,t=!1){var a=new Date(e);if(!isNaN(a.getTime()))return a;var i,r=[/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})\.(\d{3})Z$/,/^(\d{4})-(\d{2})-(\d{2})$/,/^(\d{4})\/(\d{2})\/(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/];for(i of r){var n=e.match(i);if(n){n=n.slice(1).map(Number);if(i===r[0])return new Date(Date.UTC(n[0],n[1]-1,n[2],n[3],n[4],n[5],n[6]));if(i===r[1])return new Date(n[0],n[1]-1,n[2]);if(i===r[2])return new Date(n[0],n[1]-1,n[2],n[3],n[4],n[5]);if(i===r[3])return new Date(n[0],n[1]-1,n[2],n[3],n[4],n[5])}}a=new Date(e);if(!isNaN(a.getTime()))return a;if(t)throw new Error("Unable to parse date string: "+e)}static parseWithFormat(e,r){if(e&&r){var n=String(e).trim();if(n){var s={Y:{regex:/\d{4}/,extract:e=>parseInt(e,10)},y:{regex:/\d{2}/,extract:e=>{e=parseInt(e,10);return 70<=e?1900+e:2e3+e}},m:{regex:/\d{1,2}/,extract:e=>parseInt(e,10)},d:{regex:/\d{1,2}/,extract:e=>parseInt(e,10)},H:{regex:/\d{1,2}/,extract:e=>parseInt(e,10)},M:{regex:/\d{1,2}/,extract:e=>parseInt(e,10)},S:{regex:/\d{1,2}/,extract:e=>parseInt(e,10)},f:{regex:/\d{1,3}/,extract:e=>parseInt(e,10)}},o={year:(new Date).getFullYear(),month:1,day:1,hour:0,minute:0,second:0,millisecond:0};let e=0,t=0,a=!1,i="";for(;t<r.length&&e<n.length;){var d=r[t];if("["===d)a=!0,i="",t++;else if("]"===d&&a){if(n.substring(e,e+i.length)!==i)return;e+=i.length,a=!1,i="",t++}else if(a)i+=d,t++;else if("%"===d&&t+1<r.length){var l=r[t+1],u=s[l];if(u){var c=n.substring(e).match(u.regex);if(!c||0!==c.index)return;var c=c[0],h=u.extract(c);switch(l){case"Y":case"y":o.year=h;break;case"m":o.month=h;break;case"d":o.day=h;break;case"H":o.hour=h;break;case"M":o.minute=h;break;case"S":o.second=h;break;case"f":o.millisecond=h}e+=c.length}else e++;t+=2}else{if(d!==n[e])return;e++,t++}}if(!(o.month<1||12<o.month||o.day<1||31<o.day||o.hour<0||23<o.hour||o.minute<0||59<o.minute||o.second<0||59<o.second||o.millisecond<0||999<o.millisecond))try{var f=new Date(o.year,o.month-1,o.day,o.hour,o.minute,o.second,o.millisecond);if(!isNaN(f.getTime()))return new m(f)}catch(e){}}}}static getTokenLength(e){return{Y:4,y:2,m:2,d:2,H:2,M:2,S:2,f:3,z:5}[e]||1}parseTimezoneOffset(e){var t={UTC:0,EST:-300,EDT:-240,CST:-360,CDT:-300,PST:-480,PDT:-420};return void 0!==t[e.toUpperCase()]?t[e.toUpperCase()]:(t=e.match(/^([+-])(\d{1,2}):?(\d{2})?$/))?("+"===t[1]?1:-1)*(60*parseInt(t[2],10)+(t[3]?parseInt(t[3],10):0)):this._date?-this._date.getTimezoneOffset():0}static get FORMATS(){return Object.assign({},m.PREDEFINED_FORMATS)}static exposeToGlobal(){"undefined"!=typeof window&&(window.Timez=m)}}m.FORMAT_TOKENS={"%Y":e=>null==(e=e.year())?void 0:e.toString().padStart(4,"0"),"%y":e=>null==(e=e.year())?void 0:e.toString().slice(-2).padStart(2,"0"),"%m":e=>null==(e=e.month())?void 0:e.toString().padStart(2,"0"),"%d":e=>null==(e=e.date())?void 0:e.toString().padStart(2,"0"),"%H":e=>null==(e=e.hour())?void 0:e.toString().padStart(2,"0"),"%M":e=>null==(e=e.minute())?void 0:e.toString().padStart(2,"0"),"%S":e=>null==(e=e.second())?void 0:e.toString().padStart(2,"0"),"%f":e=>null==(e=e.millisecond())?void 0:e.toString().padStart(3,"0"),"%z":e=>{e=e.utcOffset();if(e)return(0<=e?"+":"-")+Math.floor(Math.abs(e)/60).toString().padStart(2,"0")+(Math.abs(e)%60).toString().padStart(2,"0")},"%s":e=>{e=e.valueOf();return e?Math.floor(e/1e3).toString():void 0}},m.PREDEFINED_FORMATS={ISO:"%Y-%m-%dT%H:%M:%S.%fZ",ISO_DATE:"%Y-%m-%d",ISO_TIME:"%H:%M:%S.%fZ",COMPACT:"%Y%m%d%H%M%S",SLASH_DATETIME:"%Y/%m/%d %H:%M:%S.%fZ",SLASH_DATETIME_SEC:"%Y/%m/%d %H:%M:%S",SLASH_DATETIME_MIN:"%Y/%m/%d %H:%M",EUROPEAN:"%d/%m/%Y %H:%M:%S GMT%z",SLASH_DATE:"%Y/%m/%d",TIME_MICRO:"%H:%M:%S.%fZ",TIME_SEC:"%H:%M:%S",CUSTOM_GREETING:"[Bonjour celestin, ][la date actuelle est:: le] %d/%m/%Y [à] %H:%M:%S.%f[Z]"},"undefined"!=typeof window&&(window.Timez=m),timez.Timez=m,timez.default=m}return timez}function requireCooks(){if(!hasRequiredCooks){hasRequiredCooks=1,Object.defineProperty(cooks,"__esModule",{value:!0});var r=requireTimez(),e=["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"];[...e,...e.map(e=>e.toUpperCase())];class t{static set(e,t,a={}){if(this.isBrowser())try{var i=this.serialize(t),r=encodeURIComponent(i),n=this.buildCookieString(e,r,a);document.cookie=n}catch(e){}}static get(e){if(!this.isBrowser())return null;try{var t,a=this.getAllCookies()[e];return a?(t=decodeURIComponent(a),this.deserialize(t)):null}catch(e){return null}}static remove(e,t="/",a){this.isBrowser()&&(t={expires:new Date(0),path:t,domain:a},this.set(e,"",t))}static has(e){return null!==this.get(e)}static keys(){var e;return this.isBrowser()?(e=this.getAllCookies(),Object.keys(e)):[]}static clear(){var e;this.isBrowser()&&(e=this.getAllCookies(),Object.keys(e).forEach(e=>{this.remove(e)}))}static serialize(e){return e instanceof Date?JSON.stringify({__type:"Date",__value:e.toISOString()}):JSON.stringify(e)}static deserialize(e){e=JSON.parse(e);return e&&"object"==typeof e&&"Date"===e.__type?new Date(e.__value):e}static buildCookieString(e,t,a){a=Object.assign(Object.assign({},this.DEFAULT_OPTIONS),a);let i=e+"="+t;if(void 0!==a.expires){let e;e="number"==typeof a.expires?(new r.Timez).add(a.expires,"seconds").toDate()||new Date:a.expires,i+="; expires="+e.toUTCString()}return a.path&&(i+="; path="+a.path),a.domain&&(i+="; domain="+a.domain),a.secure&&(i+="; secure"),a.sameSite&&(i+="; samesite="+a.sameSite),i}static getAllCookies(){return document.cookie.split(";").reduce((e,t)=>{var[t,a]=t.split("=").map(e=>e.trim());return t&&(e[t]=a||""),e},{})}static isBrowser(){return"undefined"!=typeof window&&"undefined"!=typeof document}static exposeToGlobal(){"undefined"!=typeof window&&(window.Cooks=t)}}t.DEFAULT_OPTIONS={path:"/",secure:!0,sameSite:"lax"},"undefined"!=typeof window&&(window.Cooks=t),cooks.Cooks=t,cooks.default=t}return cooks}requireCooks();let DEFAULT_LOCALE="en",SUPPORTED_LOCALES=["en","fr"],mergeDeep=(e,t)=>{if("object"!=typeof e||"object"!=typeof t)return t;var a,i=Object.assign({},e);for(a in t)t.hasOwnProperty(a)&&(e.hasOwnProperty(a)?i[a]=mergeDeep(e[a],t[a]):i[a]=t[a]);return i},loadBaseTranslations=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){if(null==a||!a.base[t])return{};try{var e=yield(0,a.base[t])();return e}catch(e){return{}}}),loadModulesTranslations=(r,n)=>__awaiter(void 0,void 0,void 0,function*(){var e=[];if(null!=n&&n.modules)for(var[t,a]of Object.entries(n.modules))if(a[r])try{var i=yield(0,a[r])();e.push({moduleName:t,translations:i})}catch(e){}return e}),loadModuleTranslations=(a,i,r)=>__awaiter(void 0,void 0,void 0,function*(){var e;if(null!=(e=null==(e=null==r?void 0:r.modules)?void 0:e[a])&&e[i])try{var t=yield(0,r.modules[a][i])();return{moduleName:a,translations:t}}catch(e){}else null!=(e=null==r?void 0:r.modules)&&e[a]});class TranslationService{constructor(e=SUPPORTED_LOCALES,t){Object.defineProperty(this,"resources",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"currentLocale",{enumerable:!0,configurable:!0,writable:!0,value:DEFAULT_LOCALE}),Object.defineProperty(this,"loadedModules",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"supportedLocales",{enumerable:!0,configurable:!0,writable:!0,value:SUPPORTED_LOCALES}),Object.defineProperty(this,"translationsConfig",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.supportedLocales=e,t&&(this.translationsConfig=t)}setTranslationsConfig(e){this.translationsConfig=e}initialize(e){return __awaiter(this,void 0,void 0,function*(){if(!this.translationsConfig)throw new Error("Translations config not set");this.currentLocale=e,yield this.loadLocale(e)})}loadLocale(a){return __awaiter(this,void 0,void 0,function*(){var e,t;this.supportedLocales.includes(a)&&this.translationsConfig&&(e=yield loadBaseTranslations(a,this.translationsConfig),t=yield loadModulesTranslations(a,this.translationsConfig),this.resources[a]=t.reduce((e,{moduleName:t,translations:a})=>mergeDeep(e,{[t]:a}),{core:e}))})}loadModule(a){return __awaiter(this,void 0,void 0,function*(){if(!this.loadedModules.has(a)&&this.translationsConfig){for(var e of this.supportedLocales){var t=yield loadModuleTranslations(a,e,this.translationsConfig);null!=t&&t.translations&&(this.resources[e]||(this.resources[e]={core:{}}),this.resources[e][a]=t.translations)}this.loadedModules.add(a)}})}t(e,t={},a={}){var{moduleName:a="core",defaultValue:i=e,count:r,context:n}=a,e=this.findTranslation(e,a,n,r)||i;return this.interpolate(e,t)}findTranslation(t,a,i,r){var n=this.resources[this.currentLocale];if(n&&n[a]){let e=i?t+"_"+i:t;return void 0!==r&&(e=this.pluralizeKey(e,r)),t.split(".").reduce((e,t)=>e&&void 0!==e[t]?e[t]:void 0,n[a])}}pluralizeKey(e,t){return e+"_"+new Intl.PluralRules(this.currentLocale).select(t)}interpolate(e,t){return Object.entries(t).reduce((e,[t,a])=>e.replace(new RegExp(`\\{${t}\\}`,"g"),String(a)),e)}setLocale(e){this.supportedLocales.includes(e)&&(this.currentLocale=e)}getCurrentLocale(){return this.currentLocale}}export{TranslationService};
1
+ function __awaiter(e,t,s,o){return new(s=s||Promise)(function(a,t){function i(e){try{n(o.next(e))}catch(e){t(e)}}function r(e){try{n(o.throw(e))}catch(e){t(e)}}function n(e){var t;e.done?a(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(i,r)}n((o=o.apply(e,[])).next())})}var hasRequiredTimez,hasRequiredCooks,cooks={},timez={};function requireTimez(){if(!hasRequiredTimez){hasRequiredTimez=1,Object.defineProperty(timez,"__esModule",{value:!0});class m{constructor(e,t=!1){!1===this.dateChecker(e)?this._date=void 0:e instanceof m&&e&&null!=e&&e._date?this._date=new Date(null==e?void 0:e._date):e instanceof Date?this._date=new Date(e):"string"==typeof e?this._date=m.parseString(e,t):"number"==typeof e?this._date=new Date(e):null==e||"number"==typeof e&&isNaN(e)?this._date=new Date:this._date=void 0}static now(){return new m}static parse(e,t){return"string"==typeof t&&0<t.length&&(e instanceof m&&e&&null!=e&&e._date||e instanceof Date||"string"==typeof e||"number"==typeof e||null==e||"number"==typeof e&&isNaN(e))&&m.parseWithFormat(e,t)||new m(e)}static unix(e){return new m(1e3*e)}static utc(){var e=new Date;return new m(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()))}year(){var e;return null==(e=this._date)?void 0:e.getFullYear()}month(){return this._date?this._date.getMonth()+1:void 0}date(){var e;return null==(e=this._date)?void 0:e.getDate()}hour(){var e;return null==(e=this._date)?void 0:e.getHours()}minute(){var e;return null==(e=this._date)?void 0:e.getMinutes()}second(){var e;return null==(e=this._date)?void 0:e.getSeconds()}millisecond(){var e;return null==(e=this._date)?void 0:e.getMilliseconds()}day(){var e;return null==(e=this._date)?void 0:e.getDay()}add(e,t){if(!this._date)return new m(void 0);var a=new Date(this._date);switch(t){case"years":a.setFullYear(a.getFullYear()+e);break;case"months":a.setMonth(a.getMonth()+e);break;case"days":a.setDate(a.getDate()+e);break;case"hours":a.setHours(a.getHours()+e);break;case"minutes":a.setMinutes(a.getMinutes()+e);break;case"seconds":a.setSeconds(a.getSeconds()+e);break;case"milliseconds":a.setMilliseconds(a.getMilliseconds()+e)}return new m(a)}subtract(e,t){return this.add(-e,t)}startOf(e){if(!this._date)return new m(void 0);var t=new Date(this._date);switch(e){case"year":t.setMonth(0,1),t.setHours(0,0,0,0);break;case"month":t.setDate(1),t.setHours(0,0,0,0);break;case"day":t.setHours(0,0,0,0);break;case"hour":t.setMinutes(0,0,0);break;case"minute":t.setSeconds(0,0);break;case"second":t.setMilliseconds(0)}return new m(t)}endOf(e){var t=this.startOf(e);switch(e){case"year":return t.add(1,"years").subtract(1,"milliseconds");case"month":return t.add(1,"months").subtract(1,"milliseconds");case"day":return t.add(1,"days").subtract(1,"milliseconds");case"hour":return t.add(1,"hours").subtract(1,"milliseconds");case"minute":return t.add(1,"minutes").subtract(1,"milliseconds");case"second":return t.add(1,"seconds").subtract(1,"milliseconds");default:return t}}isBefore(e,t="()"){t="]"===t[1],e=e instanceof m?e:new m(e);return!(!this._date||!e._date)&&(!t&&this._date<e._date||!!t&&this._date<=e._date)}isAfter(e,t="()"){t="["===t[0],e=e instanceof m?e:new m(e);return!(!this._date||!e._date)&&(!t&&this._date>e._date||!!t&&this._date>=e._date)}isSame(e,t){var a,e=e instanceof m?e:new m(e);return!t&&this._date&&e._date?this._date.getTime()===e._date.getTime():(a=t?this.startOf(t):void 0,e=t?e.startOf(t):void 0,!!(a&&null!=a&&a._date&&e&&null!=e&&e._date)&&a._date.getTime()===e._date.getTime())}isBetween(e,t,a="()"){var e=e instanceof m?e:new m(e),t=t instanceof m?t:new m(t),i="["===a[0],a="]"===a[1],i=i&&this.isSame(e)||this.isAfter(e),e=a&&this.isSame(t)||this.isBefore(t);return i&&e}format(e){if(!e)return this.toISOString();var t,a,i=m.PREDEFINED_FORMATS[e];if(i)return this.format(i);let r="",n=0;for(;n<e.length;)"["===e[n]?-1===(a=e.indexOf("]",n))?(r+=e[n],n++):(t=e.substring(n+1,a),r+=t,n=a+1):"%"===e[n]&&n+1<e.length?(t="%"+e[n+1],a=m.FORMAT_TOKENS[t],r+=a?a(this):t,n+=2):(r+=e[n],n++);return r}setTimezone(e){var t;return this._date?(t=this._date.getTimezoneOffset(),e=this.parseTimezoneOffset(e),e=new Date(this._date.getTime()+6e4*(e-t)),new m(e)):new m(void 0)}utc(){return this._date?new m(new Date(Date.UTC(this._date.getUTCFullYear(),this._date.getUTCMonth(),this._date.getUTCDate(),this._date.getUTCHours(),this._date.getUTCMinutes(),this._date.getUTCSeconds(),this._date.getUTCMilliseconds()))):new m(void 0)}local(){return this._date?new m(new Date(this._date.getFullYear(),this._date.getMonth(),this._date.getDate(),this._date.getHours(),this._date.getMinutes(),this._date.getSeconds(),this._date.getMilliseconds())):new m(void 0)}toString(){var e;return null==(e=this._date)?void 0:e.toString()}toISOString(){var e;return null==(e=this._date)?void 0:e.toISOString()}toDate(){return this._date?new Date(this._date):void 0}valueOf(){var e;return null==(e=this._date)?void 0:e.getTime()}unix(){return this._date?Math.floor(this._date.getTime()/1e3):void 0}utcOffset(){return this._date?-this._date.getTimezoneOffset():void 0}isCorrect(){return!!this._date&&!isNaN(this._date.getTime())}timezone(){if(this._date)try{return(new Intl.DateTimeFormat).resolvedOptions().timeZone||void 0}catch(e){return this.timezoneFromOffset()}}timezoneAbbr(){if(this._date)try{var e=new Intl.DateTimeFormat("en",{timeZoneName:"short"}).formatToParts(this._date).find(e=>"timeZoneName"===e.type);return(null==e?void 0:e.value)||void 0}catch(e){return this.timezoneAbbrFromOffset()}}timezoneName(){if(this._date)try{var e=new Intl.DateTimeFormat("en",{timeZoneName:"long"}).formatToParts(this._date).find(e=>"timeZoneName"===e.type);return(null==e?void 0:e.value)||void 0}catch(e){return this.timezoneNameFromOffset()}}timezoneOffsetString(){var e=this.utcOffset();if(void 0!==e)return(0<=e?"+":"-")+Math.floor(Math.abs(e)/60).toString().padStart(2,"0")+":"+(Math.abs(e)%60).toString().padStart(2,"0")}dateChecker(e){return e instanceof m&&!!e&&!(null==e||!e._date)||e instanceof Date||"string"==typeof e||"number"==typeof e||null==e||"number"==typeof e&&isNaN(e)}timezoneFromOffset(){var e=this.utcOffset();if(void 0!==e)return{0:"Etc/UTC",60:"Europe/Paris",120:"Europe/Athens",180:"Europe/Moscow",240:"Asia/Dubai",270:"Asia/Tehran",300:"Asia/Karachi",330:"Asia/Kolkata",345:"Asia/Rangoon",360:"Asia/Dhaka",390:"Asia/Yangon",420:"Asia/Bangkok",480:"Asia/Shanghai",525:"Asia/Kathmandu",540:"Asia/Tokyo",570:"Australia/Adelaide",600:"Australia/Sydney",630:"Australia/Lord_Howe",660:"Pacific/Noumea",675:"Australia/Eucla",720:"Pacific/Auckland",780:"Pacific/Chatham","-60":"Atlantic/Azores","-120":"America/Noronha","-180":"America/Argentina/Buenos_Aires","-210":"America/St_Johns","-240":"America/Halifax","-270":"America/Caracas","-300":"America/New_York","-360":"America/Chicago","-420":"America/Denver","-480":"America/Los_Angeles","-540":"America/Anchorage","-600":"Pacific/Honolulu","-660":"Pacific/Pago_Pago","-720":"Pacific/Kiritimati"}[e]||"Etc/GMT"+(0<=e?"-":"+")+Math.abs(e)/60}timezoneAbbrFromOffset(){var e=this.utcOffset();if(void 0!==e)return{0:"GMT",60:"CET","-300":"EST","-360":"CST","-420":"MST","-480":"PST"}[e]||"GMT"+(0<=e?"+":"")+e/60}timezoneNameFromOffset(){var e=this.utcOffset();if(void 0!==e)return{0:"Greenwich Mean Time",60:"Central European Time","-300":"Eastern Standard Time","-360":"Central Standard Time","-420":"Mountain Standard Time","-480":"Pacific Standard Time"}[e]||"GMT"+(0<=e?"+":"")+e/60}isDST(){if(this._date)try{var e=new Date(this._date.getFullYear(),0,1),t=new Date(this._date.getFullYear(),6,1),a=Math.max(e.getTimezoneOffset(),t.getTimezoneOffset());return this._date.getTimezoneOffset()<a}catch(e){}}static parseString(e,t=!1){var a=new Date(e);if(!isNaN(a.getTime()))return a;var i,r=[/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})\.(\d{3})Z$/,/^(\d{4})-(\d{2})-(\d{2})$/,/^(\d{4})\/(\d{2})\/(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/];for(i of r){var n=e.match(i);if(n){n=n.slice(1).map(Number);if(i===r[0])return new Date(Date.UTC(n[0],n[1]-1,n[2],n[3],n[4],n[5],n[6]));if(i===r[1])return new Date(n[0],n[1]-1,n[2]);if(i===r[2])return new Date(n[0],n[1]-1,n[2],n[3],n[4],n[5]);if(i===r[3])return new Date(n[0],n[1]-1,n[2],n[3],n[4],n[5])}}a=new Date(e);if(!isNaN(a.getTime()))return a;if(t)throw new Error("Unable to parse date string: "+e)}static parseWithFormat(e,r){if(e&&r){var n=String(e).trim();if(n){var s={Y:{regex:/\d{4}/,extract:e=>parseInt(e,10)},y:{regex:/\d{2}/,extract:e=>{e=parseInt(e,10);return 70<=e?1900+e:2e3+e}},m:{regex:/\d{1,2}/,extract:e=>parseInt(e,10)},d:{regex:/\d{1,2}/,extract:e=>parseInt(e,10)},H:{regex:/\d{1,2}/,extract:e=>parseInt(e,10)},M:{regex:/\d{1,2}/,extract:e=>parseInt(e,10)},S:{regex:/\d{1,2}/,extract:e=>parseInt(e,10)},f:{regex:/\d{1,3}/,extract:e=>parseInt(e,10)}},o={year:(new Date).getFullYear(),month:1,day:1,hour:0,minute:0,second:0,millisecond:0};let e=0,t=0,a=!1,i="";for(;t<r.length&&e<n.length;){var d=r[t];if("["===d)a=!0,i="",t++;else if("]"===d&&a){if(n.substring(e,e+i.length)!==i)return;e+=i.length,a=!1,i="",t++}else if(a)i+=d,t++;else if("%"===d&&t+1<r.length){var l=r[t+1],u=s[l];if(u){var c=n.substring(e).match(u.regex);if(!c||0!==c.index)return;var c=c[0],h=u.extract(c);switch(l){case"Y":case"y":o.year=h;break;case"m":o.month=h;break;case"d":o.day=h;break;case"H":o.hour=h;break;case"M":o.minute=h;break;case"S":o.second=h;break;case"f":o.millisecond=h}e+=c.length}else e++;t+=2}else{if(d!==n[e])return;e++,t++}}if(!(o.month<1||12<o.month||o.day<1||31<o.day||o.hour<0||23<o.hour||o.minute<0||59<o.minute||o.second<0||59<o.second||o.millisecond<0||999<o.millisecond))try{var f=new Date(o.year,o.month-1,o.day,o.hour,o.minute,o.second,o.millisecond);if(!isNaN(f.getTime()))return new m(f)}catch(e){}}}}static getTokenLength(e){return{Y:4,y:2,m:2,d:2,H:2,M:2,S:2,f:3,z:5}[e]||1}parseTimezoneOffset(e){var t={UTC:0,EST:-300,EDT:-240,CST:-360,CDT:-300,PST:-480,PDT:-420};return void 0!==t[e.toUpperCase()]?t[e.toUpperCase()]:(t=e.match(/^([+-])(\d{1,2}):?(\d{2})?$/))?("+"===t[1]?1:-1)*(60*parseInt(t[2],10)+(t[3]?parseInt(t[3],10):0)):this._date?-this._date.getTimezoneOffset():0}static get FORMATS(){return Object.assign({},m.PREDEFINED_FORMATS)}static exposeToGlobal(){"undefined"!=typeof window&&(window.Timez=m)}}m.FORMAT_TOKENS={"%Y":e=>null==(e=e.year())?void 0:e.toString().padStart(4,"0"),"%y":e=>null==(e=e.year())?void 0:e.toString().slice(-2).padStart(2,"0"),"%m":e=>null==(e=e.month())?void 0:e.toString().padStart(2,"0"),"%d":e=>null==(e=e.date())?void 0:e.toString().padStart(2,"0"),"%H":e=>null==(e=e.hour())?void 0:e.toString().padStart(2,"0"),"%M":e=>null==(e=e.minute())?void 0:e.toString().padStart(2,"0"),"%S":e=>null==(e=e.second())?void 0:e.toString().padStart(2,"0"),"%f":e=>null==(e=e.millisecond())?void 0:e.toString().padStart(3,"0"),"%z":e=>{e=e.utcOffset();if(e)return(0<=e?"+":"-")+Math.floor(Math.abs(e)/60).toString().padStart(2,"0")+(Math.abs(e)%60).toString().padStart(2,"0")},"%s":e=>{e=e.valueOf();return e?Math.floor(e/1e3).toString():void 0}},m.PREDEFINED_FORMATS={ISO:"%Y-%m-%dT%H:%M:%S.%fZ",ISO_DATE:"%Y-%m-%d",ISO_TIME:"%H:%M:%S.%fZ",COMPACT:"%Y%m%d%H%M%S",SLASH_DATETIME:"%Y/%m/%d %H:%M:%S.%fZ",SLASH_DATETIME_SEC:"%Y/%m/%d %H:%M:%S",SLASH_DATETIME_MIN:"%Y/%m/%d %H:%M",EUROPEAN:"%d/%m/%Y %H:%M:%S GMT%z",SLASH_DATE:"%Y/%m/%d",TIME_MICRO:"%H:%M:%S.%fZ",TIME_SEC:"%H:%M:%S",CUSTOM_GREETING:"[Bonjour celestin, ][la date actuelle est:: le] %d/%m/%Y [à] %H:%M:%S.%f[Z]"},"undefined"!=typeof window&&(window.Timez=m),timez.Timez=m,timez.default=m}return timez}function requireCooks(){if(!hasRequiredCooks){hasRequiredCooks=1,Object.defineProperty(cooks,"__esModule",{value:!0});var r=requireTimez(),e=["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"];[...e,...e.map(e=>e.toUpperCase())];class t{static set(e,t,a={}){if(this.isBrowser())try{var i=this.serialize(t),r=encodeURIComponent(i),n=this.buildCookieString(e,r,a);document.cookie=n}catch(e){}}static get(e){if(!this.isBrowser())return null;try{var t,a=this.getAllCookies()[e];return a?(t=decodeURIComponent(a),this.deserialize(t)):null}catch(e){return null}}static remove(e,t="/",a){this.isBrowser()&&(t={expires:new Date(0),path:t,domain:a},this.set(e,"",t))}static has(e){return null!==this.get(e)}static keys(){var e;return this.isBrowser()?(e=this.getAllCookies(),Object.keys(e)):[]}static clear(){var e;this.isBrowser()&&(e=this.getAllCookies(),Object.keys(e).forEach(e=>{this.remove(e)}))}static serialize(e){return e instanceof Date?JSON.stringify({__type:"Date",__value:e.toISOString()}):JSON.stringify(e)}static deserialize(e){e=JSON.parse(e);return e&&"object"==typeof e&&"Date"===e.__type?new Date(e.__value):e}static buildCookieString(e,t,a){a=Object.assign(Object.assign({},this.DEFAULT_OPTIONS),a);let i=e+"="+t;if(void 0!==a.expires){let e;e="number"==typeof a.expires?(new r.Timez).add(a.expires,"seconds").toDate()||new Date:a.expires,i+="; expires="+e.toUTCString()}return a.path&&(i+="; path="+a.path),a.domain&&(i+="; domain="+a.domain),a.secure&&(i+="; secure"),a.sameSite&&(i+="; samesite="+a.sameSite),i}static getAllCookies(){return document.cookie.split(";").reduce((e,t)=>{var[t,a]=t.split("=").map(e=>e.trim());return t&&(e[t]=a||""),e},{})}static isBrowser(){return"undefined"!=typeof window&&"undefined"!=typeof document}static exposeToGlobal(){"undefined"!=typeof window&&(window.Cooks=t)}}t.DEFAULT_OPTIONS={path:"/",secure:!0,sameSite:"lax"},"undefined"!=typeof window&&(window.Cooks=t),cooks.Cooks=t,cooks.default=t}return cooks}requireCooks();let DEFAULT_LOCALE="en",SUPPORTED_LOCALES=["en","fr"],mergeDeep=(e,t)=>{if("object"!=typeof e||"object"!=typeof t)return t;var a,i=Object.assign({},e);for(a in t)t.hasOwnProperty(a)&&(e.hasOwnProperty(a)?i[a]=mergeDeep(e[a],t[a]):i[a]=t[a]);return i},loadBaseTranslations=(e,t)=>__awaiter(void 0,void 0,void 0,function*(){if(null==t||!t.base[e])return{};try{return yield(0,t.base[e])()}catch(e){return{}}}),loadModulesTranslations=(r,n)=>__awaiter(void 0,void 0,void 0,function*(){var e=[];if(null!=n&&n.modules)for(var[t,a]of Object.entries(n.modules))if(a[r])try{var i=yield(0,a[r])();e.push({moduleName:t,translations:i})}catch(e){}return e}),loadModuleTranslations=(a,i,r)=>__awaiter(void 0,void 0,void 0,function*(){var e;if(null!=(e=null==(e=null==r?void 0:r.modules)?void 0:e[a])&&e[i])try{var t=yield(0,r.modules[a][i])();return{moduleName:a,translations:t}}catch(e){}else null!=(e=null==r?void 0:r.modules)&&e[a]});class TranslationService{constructor(e=SUPPORTED_LOCALES,t){Object.defineProperty(this,"resources",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"currentLocale",{enumerable:!0,configurable:!0,writable:!0,value:DEFAULT_LOCALE}),Object.defineProperty(this,"loadedModules",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"supportedLocales",{enumerable:!0,configurable:!0,writable:!0,value:SUPPORTED_LOCALES}),Object.defineProperty(this,"translationsConfig",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.supportedLocales=e,t&&(this.translationsConfig=t)}setTranslationsConfig(e){this.translationsConfig=e}initialize(e){return __awaiter(this,void 0,void 0,function*(){if(!this.translationsConfig)throw new Error("Translations config not set");this.currentLocale=e,yield this.loadLocale(e)})}loadLocale(a){return __awaiter(this,void 0,void 0,function*(){var e,t;this.supportedLocales.includes(a)&&this.translationsConfig&&(e=yield loadBaseTranslations(a,this.translationsConfig),t=yield loadModulesTranslations(a,this.translationsConfig),this.resources[a]=t.reduce((e,{moduleName:t,translations:a})=>mergeDeep(e,{[t]:a}),{core:e}))})}loadModule(a){return __awaiter(this,void 0,void 0,function*(){if(!this.loadedModules.has(a)&&this.translationsConfig){for(var e of this.supportedLocales){var t=yield loadModuleTranslations(a,e,this.translationsConfig);null!=t&&t.translations&&(this.resources[e]||(this.resources[e]={core:{}}),this.resources[e][a]=t.translations)}this.loadedModules.add(a)}})}t(e,t={},a={}){var{moduleName:a="core",defaultValue:i=e,count:r,context:n}=a,e=this.findTranslation(e,a,n,r)||i;return this.interpolate(e,t)}findTranslation(t,a,i,r){var n=this.resources[this.currentLocale];if(n&&n[a]){let e=i?t+"_"+i:t;return void 0!==r&&(e=this.pluralizeKey(e,r)),t.split(".").reduce((e,t)=>e&&void 0!==e[t]?e[t]:void 0,n[a])}}pluralizeKey(e,t){return e+"_"+new Intl.PluralRules(this.currentLocale).select(t)}interpolate(e,t){return Object.entries(t).reduce((e,[t,a])=>e.replace(new RegExp(`\\{${t}\\}`,"g"),String(a)),e)}setLocale(e){this.supportedLocales.includes(e)&&(this.currentLocale=e)}getCurrentLocale(){return this.currentLocale}}export{TranslationService};
2
2
  //# sourceMappingURL=TranslationService.min.js.map
@@ -20,7 +20,6 @@ export function useTranslation(moduleName) {
20
20
  if (moduleName && !moduleLoaded && !arcIntl.isLoading) {
21
21
  setIsModuleLoading(true);
22
22
  arcIntl.loadModuleTranslations(moduleName).then(() => {
23
- console.log(`✅ Module ${moduleName} loaded via useTranslation hook`);
24
23
  setModuleLoaded(true);
25
24
  }).catch(error => {
26
25
  console.error(`❌ Failed to load module ${moduleName}:`, error);
@@ -25,7 +25,6 @@ export function useTranslation(moduleName?: string) {
25
25
  setIsModuleLoading(true);
26
26
  arcIntl.loadModuleTranslations(moduleName)
27
27
  .then(() => {
28
- console.log(`✅ Module ${moduleName} loaded via useTranslation hook`);
29
28
  setModuleLoaded(true);
30
29
  })
31
30
  .catch(error => {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.0.95",
6
+ "version": "0.0.96",
7
7
  "description": "INTL est un système de gestion d'internationalisation (i18n) modulaire et performant pour les applications React avec TypeScript/JavaScript. Il fournit une gestion avancée des traductions, un chargement dynamique des modules, et une intégration transparente avec l'écosystème Arc.",
8
8
  "main": "index.js",
9
9
  "keywords": [],
@@ -11,15 +11,12 @@ const useArcIntlValue = (translationsConfig, supportedLocales = SUPPORTED_LOCALE
11
11
 
12
12
  useEffect(() => {
13
13
  const initialize = async () => {
14
- console.log('🚀 INITIALIZING TranslationService...');
15
14
  setIsLoading(true);
16
15
  try {
17
16
  if (!initialized) {
18
- console.log('📝 First time initialization');
19
17
  await service.initialize(currentLocale);
20
18
  setInitialized(true);
21
19
  } else {
22
- console.log('🔄 Re-initializing with locale:', currentLocale);
23
20
  await service.initialize(currentLocale);
24
21
  }
25
22
  } catch (error) {
@@ -38,13 +35,10 @@ const useArcIntlValue = (translationsConfig, supportedLocales = SUPPORTED_LOCALE
38
35
  useEffect(() => {
39
36
  if (!initialized || isLoading || !translationsConfig.modules) return;
40
37
  const loadAllModules = async () => {
41
- console.log('📦 Loading all modules from config...');
42
38
  const moduleNames = Object.keys(translationsConfig.modules || {});
43
39
  for (const moduleName of moduleNames) {
44
40
  try {
45
- console.log(`📥 Loading module: ${moduleName}`);
46
41
  await service.loadModule(moduleName);
47
- console.log(`✅ Module ${moduleName} loaded`);
48
42
  } catch (error) {
49
43
  console.error(`❌ Failed to load module ${moduleName}:`, error);
50
44
  }
@@ -60,11 +54,9 @@ const useArcIntlValue = (translationsConfig, supportedLocales = SUPPORTED_LOCALE
60
54
  if (locale === currentLocale) return;
61
55
  setIsLoading(true);
62
56
  try {
63
- console.log(`🔄 Changing locale from ${currentLocale} to ${locale}`);
64
57
  await service.initialize(locale);
65
58
  setCurrentLocale(locale);
66
59
  saveLocale(locale);
67
- console.log(`✅ Locale changed to ${locale}`);
68
60
  } catch (error) {
69
61
  console.error('❌ Failed to change locale:', error);
70
62
  } finally {
@@ -74,9 +66,7 @@ const useArcIntlValue = (translationsConfig, supportedLocales = SUPPORTED_LOCALE
74
66
  const loadModuleTranslations = useCallback(async moduleName => {
75
67
  setIsLoading(true);
76
68
  try {
77
- console.log(`📥 Manually loading module: ${moduleName}`);
78
69
  await service.loadModule(moduleName);
79
- console.log(`✅ Module ${moduleName} loaded manually`);
80
70
  } catch (error) {
81
71
  console.error(`❌ Failed to load module ${moduleName}:`, error);
82
72
  throw error;
@@ -86,7 +76,6 @@ const useArcIntlValue = (translationsConfig, supportedLocales = SUPPORTED_LOCALE
86
76
  }, [service]);
87
77
  const t = useCallback((key, params, options) => {
88
78
  const result = service.t(key, params || {}, options || {});
89
- console.log(`🌐 Translation: key="${key}", result="${result}", locale=${service.getCurrentLocale()}`);
90
79
  return result;
91
80
  }, [service]);
92
81
  return {
@@ -103,10 +92,6 @@ export const ArcIntlProvider = ({
103
92
  supportedLocales,
104
93
  children
105
94
  }) => {
106
- console.log('🎬 ArcIntlProvider rendering with translations:', {
107
- baseLocales: Object.keys(translations.base),
108
- modules: Object.keys(translations.modules || {})
109
- });
110
95
  const value = useArcIntlValue(translations, typeof supportedLocales === 'object' && !!Array.isArray(supportedLocales) && supportedLocales.length > 0 ? supportedLocales : SUPPORTED_LOCALES);
111
96
  return React.createElement(ArcIntlContext.Provider, {
112
97
  value: value
@@ -17,15 +17,12 @@ const useArcIntlValue = (
17
17
 
18
18
  useEffect(() => {
19
19
  const initialize = async () => {
20
- console.log('🚀 INITIALIZING TranslationService...');
21
20
  setIsLoading(true);
22
21
  try {
23
22
  if (!initialized) {
24
- console.log('📝 First time initialization');
25
23
  await service.initialize(currentLocale);
26
24
  setInitialized(true);
27
25
  } else {
28
- console.log('🔄 Re-initializing with locale:', currentLocale);
29
26
  await service.initialize(currentLocale);
30
27
  }
31
28
  } catch (error) {
@@ -48,14 +45,11 @@ const useArcIntlValue = (
48
45
  if (!initialized || isLoading || !translationsConfig.modules) return;
49
46
 
50
47
  const loadAllModules = async () => {
51
- console.log('📦 Loading all modules from config...');
52
48
  const moduleNames = Object.keys(translationsConfig.modules || {});
53
49
 
54
50
  for (const moduleName of moduleNames) {
55
51
  try {
56
- console.log(`📥 Loading module: ${moduleName}`);
57
52
  await service.loadModule(moduleName);
58
- console.log(`✅ Module ${moduleName} loaded`);
59
53
  } catch (error) {
60
54
  console.error(`❌ Failed to load module ${moduleName}:`, error);
61
55
  }
@@ -75,11 +69,9 @@ const useArcIntlValue = (
75
69
 
76
70
  setIsLoading(true);
77
71
  try {
78
- console.log(`🔄 Changing locale from ${currentLocale} to ${locale}`);
79
72
  await service.initialize(locale);
80
73
  setCurrentLocale(locale);
81
74
  saveLocale(locale);
82
- console.log(`✅ Locale changed to ${locale}`);
83
75
  } catch (error) {
84
76
  console.error('❌ Failed to change locale:', error);
85
77
  } finally {
@@ -90,9 +82,7 @@ const useArcIntlValue = (
90
82
  const loadModuleTranslations = useCallback(async (moduleName: string) => {
91
83
  setIsLoading(true);
92
84
  try {
93
- console.log(`📥 Manually loading module: ${moduleName}`);
94
85
  await service.loadModule(moduleName);
95
- console.log(`✅ Module ${moduleName} loaded manually`);
96
86
  } catch (error) {
97
87
  console.error(`❌ Failed to load module ${moduleName}:`, error);
98
88
  throw error;
@@ -103,7 +93,6 @@ const useArcIntlValue = (
103
93
 
104
94
  const t = useCallback((key: string, params?: Record<string, any>, options?: any) => {
105
95
  const result = service.t(key, params || {}, options || {});
106
- console.log(`🌐 Translation: key="${key}", result="${result}", locale=${service.getCurrentLocale()}`);
107
96
  return result;
108
97
  }, [service]);
109
98
 
@@ -126,10 +115,6 @@ export const ArcIntlProvider: React.FC<{
126
115
  supportedLocales,
127
116
  children,
128
117
  }) => {
129
- console.log('🎬 ArcIntlProvider rendering with translations:', {
130
- baseLocales: Object.keys(translations.base),
131
- modules: Object.keys(translations.modules || {})
132
- });
133
118
 
134
119
  const value = useArcIntlValue(
135
120
  translations,
package/utils/loaders.js CHANGED
@@ -18,8 +18,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
18
18
  };
19
19
 
20
20
  const loadBaseTranslations = (locale, translationsConfig) => __awaiter(void 0, void 0, void 0, function* () {
21
- console.log('📥 LOADING base translations for:', locale);
22
- console.log('📊 Config available:', translationsConfig ? 'YES' : 'NO');
23
21
  if (!(translationsConfig === null || translationsConfig === void 0 ? void 0 : translationsConfig.base[locale])) {
24
22
  console.warn(`❌ No base translations found for locale: ${locale}`);
25
23
  console.warn('Available locales:', (translationsConfig === null || translationsConfig === void 0 ? void 0 : translationsConfig.base) ? Object.keys(translationsConfig.base) : 'none');
@@ -28,7 +26,6 @@ const loadBaseTranslations = (locale, translationsConfig) => __awaiter(void 0, v
28
26
  try {
29
27
  const loader = translationsConfig.base[locale];
30
28
  const result = yield loader();
31
- console.log(`✅ Base translations loaded for ${locale}:`, Object.keys(result));
32
29
  return result;
33
30
  }
34
31
  catch (error) {
@@ -64,7 +61,6 @@ const loadModulesTranslations = (locale, translationsConfig) => __awaiter(void 0
64
61
  });
65
62
  const loadModuleTranslations = (moduleName, locale, translationsConfig) => __awaiter(void 0, void 0, void 0, function* () {
66
63
  var _a, _b, _c;
67
- console.log('📥 LOADING module translations:', { moduleName, locale });
68
64
  if (!((_b = (_a = translationsConfig === null || translationsConfig === void 0 ? void 0 : translationsConfig.modules) === null || _a === void 0 ? void 0 : _a[moduleName]) === null || _b === void 0 ? void 0 : _b[locale])) {
69
65
  console.warn(`❌ No translations config found for module "${moduleName}" and locale "${locale}"`);
70
66
  console.warn('Available modules:', (translationsConfig === null || translationsConfig === void 0 ? void 0 : translationsConfig.modules) ? Object.keys(translationsConfig.modules) : 'none');
@@ -76,7 +72,6 @@ const loadModuleTranslations = (moduleName, locale, translationsConfig) => __awa
76
72
  try {
77
73
  const loader = translationsConfig.modules[moduleName][locale];
78
74
  const translations = yield loader();
79
- console.log(`✅ Module ${moduleName} translations loaded for ${locale}:`, Object.keys(translations));
80
75
  return {
81
76
  moduleName,
82
77
  translations
@@ -1,2 +1,2 @@
1
- function __awaiter(n,o,i,r){return new(i=i||Promise)(function(a,o){function t(n){try{l(r.next(n))}catch(n){o(n)}}function e(n){try{l(r.throw(n))}catch(n){o(n)}}function l(n){var o;n.done?a(n.value):((o=n.value)instanceof i?o:new i(function(n){n(o)})).then(t,e)}l((r=r.apply(n,[])).next())})}let loadBaseTranslations=(o,a)=>__awaiter(void 0,void 0,void 0,function*(){if(null==a||!a.base[o])return{};try{var n=yield(0,a.base[o])();return n}catch(n){return{}}}),loadModulesTranslations=(e,l)=>__awaiter(void 0,void 0,void 0,function*(){var n=[];if(null!=l&&l.modules)for(var[o,a]of Object.entries(l.modules))if(a[e])try{var t=yield(0,a[e])();n.push({moduleName:o,translations:t})}catch(n){}return n}),loadModuleTranslations=(a,t,e)=>__awaiter(void 0,void 0,void 0,function*(){var n;if(null!=(n=null==(n=null==e?void 0:e.modules)?void 0:n[a])&&n[t])try{var o=yield(0,e.modules[a][t])();return{moduleName:a,translations:o}}catch(n){}else null!=(n=null==e?void 0:e.modules)&&n[a]});export{loadBaseTranslations,loadModuleTranslations,loadModulesTranslations};
1
+ function __awaiter(n,o,i,r){return new(i=i||Promise)(function(a,o){function t(n){try{l(r.next(n))}catch(n){o(n)}}function e(n){try{l(r.throw(n))}catch(n){o(n)}}function l(n){var o;n.done?a(n.value):((o=n.value)instanceof i?o:new i(function(n){n(o)})).then(t,e)}l((r=r.apply(n,[])).next())})}let loadBaseTranslations=(n,o)=>__awaiter(void 0,void 0,void 0,function*(){if(null==o||!o.base[n])return{};try{return yield(0,o.base[n])()}catch(n){return{}}}),loadModulesTranslations=(e,l)=>__awaiter(void 0,void 0,void 0,function*(){var n=[];if(null!=l&&l.modules)for(var[o,a]of Object.entries(l.modules))if(a[e])try{var t=yield(0,a[e])();n.push({moduleName:o,translations:t})}catch(n){}return n}),loadModuleTranslations=(a,t,e)=>__awaiter(void 0,void 0,void 0,function*(){var n;if(null!=(n=null==(n=null==e?void 0:e.modules)?void 0:n[a])&&n[t])try{var o=yield(0,e.modules[a][t])();return{moduleName:a,translations:o}}catch(n){}else null!=(n=null==e?void 0:e.modules)&&n[a]});export{loadBaseTranslations,loadModuleTranslations,loadModulesTranslations};
2
2
  //# sourceMappingURL=loaders.min.js.map