-
-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathi18nextLocizeBackend.min.js
More file actions
1 lines (1 loc) · 21.9 KB
/
i18nextLocizeBackend.min.js
File metadata and controls
1 lines (1 loc) · 21.9 KB
1
!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).i18nextLocizeBackend=e()}(function(){return function n(i,s,r){function a(t,e){if(!s[t]){if(!i[t]){var o="function"==typeof require&&require;if(!e&&o)return o(t,!0);if(c)return c(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}o=s[t]={exports:{}},i[t][0].call(o.exports,function(e){return a(i[t][1][e]||e)},o,o.exports,n,i,s,r)}return s[t].exports}for(var c="function"==typeof require&&require,e=0;e<r.length;e++)a(r[e]);return a}({1:[function(e,t,o){Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var l=e("./utils.js"),f=(e=e("./request.js"))&&e.__esModule?e:{default:e};function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(e=>(e=((e,t)=>{if("object"!=d(e)||!e)return e;var o=e[Symbol.toPrimitive];if(void 0===o)return("string"===t?String:Number)(e);if("object"!=d(o=o.call(e,t||"default")))return o;throw new TypeError("@@toPrimitive must return a primitive value.")})(e,"string"),"symbol"==d(e)?e:e+""))(n.key),n)}}function p(e){return{loadPath:"https://api".concat("standard"===(e=e||"standard")?".lite":"",".locize.app/{{projectId}}/{{version}}/{{lng}}/{{ns}}"),privatePath:"https://api".concat("standard"===e?".lite":"",".locize.app/private/{{projectId}}/{{version}}/{{lng}}/{{ns}}"),getLanguagesPath:"https://api".concat("standard"===e?".lite":"",".locize.app/languages/{{projectId}}"),addPath:"https://api".concat("standard"===e?".lite":"",".locize.app/missing/{{projectId}}/{{version}}/{{lng}}/{{ns}}"),updatePath:"https://api".concat("standard"===e?".lite":"",".locize.app/update/{{projectId}}/{{version}}/{{lng}}/{{ns}}")}}try{var g="undefined"!=typeof window&&null!==window.localStorage,i="notExistingLocizeProject";window.localStorage.setItem(i,"foo"),window.localStorage.removeItem(i)}catch(e){g=!1}function h(e,t,o){var n={};return t.authorize&&t.apiKey&&(n.Authorization=t.apiKey),(o||t.setContentTypeJSON)&&(n["Content-Type"]="application/json"),{method:o?"POST":"GET",url:e,headers:n,body:o}}function v(e,t,o){if(1===e.request.length)try{var n=e.request(t);n&&"function"==typeof n.then?n.then(function(e){return o(null,e)}).catch(o):o(null,n)}catch(e){o(e)}else e.request(t,o)}function c(e){var t=.25*e,o=Math.max(0,e-t),e=e+t;return Math.floor(o+Math.random()*(e-o))}e=function e(t){var o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},i=3<arguments.length?arguments[3]:void 0,s=this,r=e;if(!(s instanceof r))throw new TypeError("Cannot call a class as a function");this.services=t,this.options=o,this.allOptions=n,this.type="backend",t&&t.projectId?this.init(null,t,n,o):this.init(t,o,n,i)},(i=[{key:"init",value:function(e){var o,n=this,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},s=3<arguments.length?arguments[3]:void 0,r=(!i.referenceLng&&t.fallbackLng&&Array.isArray(t.fallbackLng)&&"dev"!==t.fallbackLng[0]&&(i.referenceLng=t.fallbackLng[0]),this.services=e,(0,l.defaults)({},i)),a=(0,l.defaults)(i,this.options||{}),c=(c=a.cdnType,(0,l.defaults)({cdnType:c=c||"standard",noCache:!1,referenceLng:"en",crossDomain:!0,setContentTypeJSON:!1,version:"latest",private:!1,translatedPercentageThreshold:.9,failLoadingOnEmptyJSON:!1,allowedAddOrUpdateHosts:["localhost"],onSaved:!1,reloadInterval:"undefined"==typeof window&&36e5,checkForProjectTimeout:3e3,storageExpiration:36e5,writeDebounce:5e3,useCacheLayer:"undefined"==typeof window},p(c))),u=(a.reloadInterval&&a.reloadInterval<3e5&&(console.warn("Your configured reloadInterval option is to low."),a.reloadInterval=c.reloadInterval),this.options=(0,l.defaults)(i,this.options||{},c),this.allOptions=t,this.somethingLoaded=!1,this.isProjectNotExisting=!1,this.storage=(o=this.options.storageExpiration,a=function(){},c=function(){},g?(a=function(e){window.localStorage.setItem("notExistingLocizeProject_".concat(e),Date.now())},c=function(e){var t=window.localStorage.getItem("notExistingLocizeProject_".concat(e));return!(!t||Date.now()-t>o&&(window.localStorage.removeItem("notExistingLocizeProject_".concat(e)),1))}):"undefined"!=typeof document&&(a=function(e){var t=new Date,t=(t.setTime(t.getTime()+o),"; expires=".concat(t.toGMTString())),e="notExistingLocizeProject_".concat(e);try{document.cookie="".concat(e,"=").concat(Date.now()).concat(t,";path=/")}catch(e){}},c=function(e){var e="notExistingLocizeProject_".concat(e),t="".concat(e,"=");try{for(var o=document.cookie.split(";"),n=0;n<o.length;n++){for(var i=o[n];" "===i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(t))return!0}}catch(e){}return!1}),{setProjectNotExisting:a,isProjectNotExisting:c}),p(this.options.cdnType)),a=(Object.keys(u).forEach(function(e){r[e]||(n.options[e]=u[e])}),t.debug&&void 0===r.noCache&&"standard"===this.options.cdnType&&(this.options.noCache=!0),this.options.noCache&&"standard"!==this.options.cdnType&&console.warn("The 'noCache' option is not available for 'cdnType' '".concat(this.options.cdnType,"'!")),"undefined"!=typeof window&&window.location&&window.location.hostname);a?(this.isAddOrUpdateAllowed="function"==typeof this.options.allowedAddOrUpdateHosts?this.options.allowedAddOrUpdateHosts(a):-1<this.options.allowedAddOrUpdateHosts.indexOf(a),e&&e.logger&&(t.saveMissing||t.updateMissing)&&(this.isAddOrUpdateAllowed?"localhost"!==a&&e.logger.warn('locize-backend: you are using the save or update missings feature from this host "'.concat(a,'".\nMake sure you will not use it in production!\nhttps://www.locize.com/docs/going-to-production')):e.logger.warn("function"==typeof this.options.allowedAddOrUpdateHosts?'locize-backend: will not save or update missings because allowedAddOrUpdateHosts returned false for the host "'.concat(a,'".'):'locize-backend: will not save or update missings because the host "'.concat(a,'" was not in the list of allowedAddOrUpdateHosts: ').concat(this.options.allowedAddOrUpdateHosts.join(", ")," (matches need to be exact).")))):this.isAddOrUpdateAllowed=!0,"function"==typeof s&&this.getOptions(function(e,t,o){if(e)return s(e);n.options.referenceLng=i.referenceLng||t.referenceLng||n.options.referenceLng,s(null,t,o)}),this.queuedWrites={pending:{}},this.debouncedProcess=(0,l.debounce)(this.process,this.options.writeDebounce),this.interval&&clearInterval(this.interval),this.options.reloadInterval&&this.options.projectId&&(this.interval=setInterval(function(){return n.reload()},this.options.reloadInterval),"object"===d(this.interval))&&"function"==typeof this.interval.unref&&this.interval.unref()}},{key:"reload",value:function(){var t,e,o=this,n=this.services||{logger:console},i=n.backendConnector,s=n.languageUtils,r=n.logger;!i||(n=i.language)&&"cimode"===n.toLowerCase()||(t=[],(e=function(e){s.toResolveHierarchy(e).forEach(function(e){t.indexOf(e)<0&&t.push(e)})})(n),this.allOptions.preload&&this.allOptions.preload.forEach(e),t.forEach(function(n){o.allOptions.ns.forEach(function(o){i.read(n,o,"read",null,null,function(e,t){e&&r.warn("loading namespace ".concat(o," for language ").concat(n," failed"),e),!e&&t&&r.log("loaded namespace ".concat(o," for language ").concat(n),t),i.loaded("".concat(n,"|").concat(o),e,t)})})}))}},{key:"getLanguages",value:function(e){var o,r=this,t=(e||(o=(0,l.defer)(),e=function(e,t){if(e)return o.reject(e);o.resolve(t)}),(0,l.isMissingOption)(this.options,["projectId"]));return t?e(new Error(t)):(t=(0,l.interpolate)(this.options.getLanguagesPath,{projectId:this.options.projectId}),!this.isProjectNotExisting&&this.storage.isProjectNotExisting(this.options.projectId)&&(this.isProjectNotExisting=!0),this.isProjectNotExisting?e(new Error(this.isProjectNotExistingErrorMessage||"locize project ".concat(this.options.projectId," does not exist!"))):(this.getLanguagesCalls=this.getLanguagesCalls||[],this.getLanguagesCalls.push(e),1<this.getLanguagesCalls.length||this.loadUrl({},t,function(t,o,e){var i,s;!r.somethingLoaded&&e&&e.resourceNotExisting?(r.isProjectNotExisting=!0,i="locize project ".concat(r.options.projectId," does not exist!"),r.isProjectNotExistingErrorMessage=i,s="standard"===r.options.cdnType?"pro":"standard",e=p(s),e=(0,l.interpolate)(e.getLanguagesPath,{projectId:r.options.projectId}),r.loadUrl({},e,function(e,t,o){e||!t||o&&o.resourceNotExisting?!r.somethingLoaded&&o&&o.resourceNotExisting&&(r.isProjectNotExisting=!0,r.storage.setProjectNotExisting(r.options.projectId)):(i+=" It seems you're using the wrong cdnType. Your locize project is configured to use \"".concat(s,'" but here you\'ve configured "').concat(r.options.cdnType,'".'),r.isProjectNotExistingErrorMessage=i);var n=new Error(i),e=r.getLanguagesCalls;r.getLanguagesCalls=[],e.forEach(function(e){return e(n)})})):(o&&(r.loadedLanguages=Object.keys(o),e=r.loadedLanguages.reduce(function(e,t){return e=o[t].isReferenceLanguage?t:e},""))&&r.options.referenceLng!==e&&(r.options.referenceLng=e),r.somethingLoaded=!0,e=r.getLanguagesCalls,r.getLanguagesCalls=[],e.forEach(function(e){return e(t,o)}))}))),o}},{key:"getOptions",value:function(o){var n,i=this;return o||(n=(0,l.defer)(),o=function(e,t){if(e)return n.reject(e);n.resolve(t)}),this.getLanguages(function(e,n){var t;return e?o(e):(e=Object.keys(n)).length?(t=e.reduce(function(e,t){var o=n[t];return o.translated[i.options.version]&&o.translated[i.options.version]>=i.options.translatedPercentageThreshold&&e.push(t),e},[]),e=e.reduce(function(e,t){return-1<t.indexOf("-")||e},!1),void o(null,{fallbackLng:i.options.referenceLng,referenceLng:i.options.referenceLng,supportedLngs:0===t.length&&i.options.referenceLng?[i.options.referenceLng]:t,load:e?"all":"languageOnly"},n)):o(new Error("was unable to load languages via API"))}),n}},{key:"checkIfProjectExists",value:function(t){var e=this,o=(this.services||{logger:console}).logger;this.somethingLoaded?t&&t(null):this.alreadyRequestedCheckIfProjectExists?setTimeout(function(){return e.checkIfProjectExists(t)},c(this.options.checkForProjectTimeout)):(this.alreadyRequestedCheckIfProjectExists=!0,this.getLanguages(function(e){e&&e.message&&0<e.message.indexOf("does not exist")&&o&&o.error(e.message),t&&t(e)}))}},{key:"checkIfLanguagesLoaded",value:function(t){var o=(this.services||{logger:console}).logger;this.loadedLanguages?t&&t(null):this.getLanguages(function(e){e&&e.message&&0<e.message.indexOf("does not exist")&&o&&o.error(e.message),t&&t(e)})}},{key:"read",value:function(n,e,i){var s=this,r=(this.services||{logger:console}).logger,t={};if(this.options.private){var o=(0,l.isMissingOption)(this.options,["projectId","version","apiKey"]);if(o)return i(new Error(o),!1);o=(0,l.interpolate)(this.options.privatePath,{lng:n,ns:e,projectId:this.options.projectId,version:this.options.version}),t={authorize:!0}}else{var a=(0,l.isMissingOption)(this.options,["projectId","version"]);if(a)return i(new Error(a),!1);o=(0,l.interpolate)(this.options.loadPath,{lng:n,ns:e,projectId:this.options.projectId,version:this.options.version})}!this.isProjectNotExisting&&this.storage.isProjectNotExisting(this.options.projectId)&&(this.isProjectNotExisting=!0),this.isProjectNotExisting?(a=new Error(this.isProjectNotExistingErrorMessage||"locize project ".concat(this.options.projectId," does not exist!")),r&&r.error(a.message),i&&i(a)):this.warnedLanguages&&-1<this.warnedLanguages.indexOf(n)?(e=new Error('Will not continue to load language "'.concat(n,'" since it is not available in locize project ').concat(this.options.projectId,"!")),r&&r.error(e.message),i&&i(e)):this.loadUrl(t,o,function(e,t,o){o=o&&o.resourceNotExisting;o||(s.hasResourcesForLng||(s.hasResourcesForLng={}),s.hasResourcesForLng[n]=!0),!o||s.hasResourcesForLng&&s.hasResourcesForLng[n]||setTimeout(function(){s.checkIfLanguagesLoaded(function(){!s.loadedLanguages||-1<s.loadedLanguages.indexOf(n)||s.warnedLanguages&&-1<s.warnedLanguages.indexOf(n)||(s.warnedLanguages||(s.warnedLanguages=[]),s.warnedLanguages.push(n),r&&r.error('Language "'.concat(n,'" is not available in locize project ').concat(s.options.projectId,"!")))})},c(s.options.checkForProjectTimeout)),s.somethingLoaded||(o?setTimeout(function(){return s.checkIfProjectExists()},c(s.options.checkForProjectTimeout)):s.somethingLoaded=!0),i(e,t)})}},{key:"loadUrl",value:function(e,r,t,a){function o(e,t){var o,n,i=t&&t.resourceNotExisting;if(t&&(408===t.status||400===t.status))return a("failed loading "+r,!0,{resourceNotExisting:i});if(t&&(500<=t.status&&t.status<600||!t.status))return a("failed loading "+r,!0,{resourceNotExisting:i});if(t&&400<=t.status&&t.status<500)return a("failed loading "+r,!1,{resourceNotExisting:i});if(!t&&e&&e.message){var s=e.message.toLowerCase();if(["failed","fetch","network","load"].find(function(e){return-1<s.indexOf(e)}))return a("failed loading "+r+": "+e.message,!0,{resourceNotExisting:i})}if(e)return a(e,!1);try{o="string"==typeof t.data?JSON.parse(t.data):t.data}catch(e){n="failed parsing "+r+" to json"}return n?a(n,!1):c.options.failLoadingOnEmptyJSON&&!Object.keys(o).length?a("loaded result empty for "+r,!1,{resourceNotExisting:i}):void a(null,o,{resourceNotExisting:i})}var c=this;e=(0,l.defaults)(e,this.options),"function"==typeof t&&(a=t,t=void 0),a=a||function(){};if(!this.options.request||0<r.indexOf("/languages/".concat(e.projectId)))return(0,f.default)(e,r,t,o);e=h(r,e,t);v(this.options,e,o)}},{key:"create",value:function(t,o,n,i,s,r){var a=this;"function"!=typeof s&&(s=function(){}),this.checkIfProjectExists(function(e){return e?s(e):(e=(0,l.isMissingOption)(a.options,["projectId","version","apiKey","referenceLng"]))?s(new Error(e)):a.isAddOrUpdateAllowed?((t="string"==typeof t?[t]:t).filter(function(e){return e===a.options.referenceLng}).length<1&&a.services&&a.services.logger&&a.services.logger.warn('locize-backend: will not save missings because the reference language "'.concat(a.options.referenceLng,'" was not in the list of to save languages: ').concat(t.join(", ")," (open your site in the reference language to save missings).")),void t.forEach(function(e){e===a.options.referenceLng&&a.queue.call(a,a.options.referenceLng,o,n,i,s,r)})):s("host is not allowed to create key.")})}},{key:"update",value:function(t,o,n,i,s,r){var a=this;"function"!=typeof s&&(s=function(){}),this.checkIfProjectExists(function(e){return e?s(e):(e=(0,l.isMissingOption)(a.options,["projectId","version","apiKey","referenceLng"]))?s(new Error(e)):a.isAddOrUpdateAllowed?("string"==typeof t&&(t=[t]),(r=r||{}).isUpdate=!0,void t.forEach(function(e){e===a.options.referenceLng&&a.queue.call(a,a.options.referenceLng,o,n,i,s,r)})):s("host is not allowed to update key.")})}},{key:"writePage",value:function(e,t,o,n){function i(e){--d||n(e)}var s=(0,l.interpolate)(this.options.addPath,{lng:e,ns:t,projectId:this.options.projectId,version:this.options.version}),e=(0,l.interpolate)(this.options.updatePath,{lng:e,ns:t,projectId:this.options.projectId,version:this.options.version}),r=!1,a=!1,c={},u={},d=(o.forEach(function(e){var t=e.options&&e.options.tDescription?{value:e.fallbackValue||"",context:{text:e.options.tDescription}}:e.fallbackValue||"";e.options&&e.options.isUpdate?(a=a||!0,u[e.key]=t):(r=r||!0,c[e.key]=t)}),0);r&&d++,a&&d++;d||i(),r&&(this.options.request?(t=h(s,(0,l.defaults)({authorize:!0},this.options),c),v(this.options,t,i)):(0,f.default)((0,l.defaults)({authorize:!0},this.options),s,c,i)),a&&(this.options.request?(o=h(e,(0,l.defaults)({authorize:!0},this.options),u),v(this.options,o,i)):(0,f.default)((0,l.defaults)({authorize:!0},this.options),e,u,i))}},{key:"write",value:function(e,t){var o=this,n=(0,l.getPath)(this.queuedWrites,["locks",e,t]);if(!n){var i=(0,l.getPath)(this.queuedWrites,[e,t]),s=((0,l.setPath)(this.queuedWrites,[e,t],[]),i.filter(function(e){return e.callback}).map(function(e){return e.callback}));if(i.length){(0,l.setPath)(this.queuedWrites,["locks",e,t],!0);var r=function(){(0,l.setPath)(o.queuedWrites,["locks",e,t],!1),s.forEach(function(e){return e()}),o.options.onSaved&&o.options.onSaved(e,t),o.debouncedProcess(e,t)},a=i.length/1e3,c=0,u=i.splice(0,1e3);for(this.writePage(e,t,u,function(){a<=++c&&r()});1e3===u.length;)(u=i.splice(0,1e3)).length&&this.writePage(e,t,u,function(){a<=++c&&r()})}}}},{key:"process",value:function(){var o=this;Object.keys(this.queuedWrites).forEach(function(t){"locks"!==t&&Object.keys(o.queuedWrites[t]).forEach(function(e){o.queuedWrites[t][e].length&&o.write(t,e)})})}},{key:"queue",value:function(e,t,o,n,i,s){(0,l.pushPath)(this.queuedWrites,[e,t],{key:o,fallbackValue:n||"",callback:i,options:s}),this.debouncedProcess()}}])&&n(e.prototype,i),s&&n(e,s),Object.defineProperty(e,"prototype",{writable:!1});var s=e;s.type="backend",o.default=s;t.exports=o.default},{"./request.js":2,"./utils.js":3}],2:[function(e,t,o){!function(r){!function(){function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var l,f,p="function"==typeof fetch?fetch:void 0;if(void 0!==r&&r.fetch?p=r.fetch:"undefined"!=typeof window&&window.fetch&&(p=window.fetch),"function"!=typeof XMLHttpRequest&&"object"!==("undefined"==typeof XMLHttpRequest?"undefined":d(XMLHttpRequest))||(void 0!==r&&r.XMLHttpRequest?l=r.XMLHttpRequest:"undefined"!=typeof window&&window.XMLHttpRequest&&(l=window.XMLHttpRequest)),"function"==typeof ActiveXObject&&(void 0!==r&&r.ActiveXObject?f=r.ActiveXObject:"undefined"!=typeof window&&window.ActiveXObject&&(f=window.ActiveXObject)),!(p="function"!=typeof p?void 0:p)&&!l&&!f)try{p=e("cross-fetch")}catch(e){}function g(e,t,o,i){function n(t){var o,n=t.headers&&"Error from cloudfront"===t.headers.get("x-cache");return"standard"!==e.cdnType||404!==t.status||t.headers&&t.headers.get("x-cache")?t.ok?(o=t.headers&&t.headers.get("cache-control"),void t.text().then(function(e){i(null,{status:t.status,data:e,resourceNotExisting:n,cacheControl:o})}).catch(i)):i(t.statusText||"Error",{status:t.status,resourceNotExisting:n}):i(null,{status:200,data:"{}",resourceNotExisting:n=!0})}var s={};"undefined"==typeof window&&void 0!==r&&void 0!==r.process&&r.process.versions&&r.process.versions.node&&(s["User-Agent"]="i18next-locize-backend (node/".concat(r.process.version,"; ").concat(r.process.platform," ").concat(r.process.arch,")")),e.authorize&&e.apiKey&&(s.Authorization=e.apiKey),(o||e.setContentTypeJSON)&&(s["Content-Type"]="application/json"),("function"==typeof fetch?fetch:p)(t,{method:o?"POST":"GET",body:o?JSON.stringify(o):void 0,headers:s}).then(n).catch(i)}var h={};o.default=function(e,n,i,t){"function"==typeof i&&(t=i,i=void 0),t=t||function(){};var s="undefined"==typeof window&&e.useCacheLayer;if(s&&!i&&!e.noCache&&h[n]&&h[n].expires>Date.now())return t(null,h[n].data);var r=t;if(t=function(e,t){var o;s&&!e&&t&&!i&&t.cacheControl&&0<(o=(o=(o=t.cacheControl)&&o.match(/max-age=([0-9]+)/))?parseInt(o[1],10):0)&&(h[n]={data:t,expires:Date.now()+1e3*o}),r(e,t)},!i&&e.noCache&&"standard"===e.cdnType&&(n+=(0<=n.indexOf("?")?"&":"?")+"cache=no"),p)return g(e,n,i,t);if("function"==typeof XMLHttpRequest||"object"===("undefined"==typeof XMLHttpRequest?"undefined":d(XMLHttpRequest))||"function"==typeof ActiveXObject){var o=e,e=n,a=i,c=t;try{var u=l?new l:new f("MSXML2.XMLHTTP.3.0");u.open(a?"POST":"GET",e,1),o.crossDomain||u.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.authorize&&o.apiKey&&u.setRequestHeader("Authorization",o.apiKey),(a||o.setContentTypeJSON)&&u.setRequestHeader("Content-Type","application/json"),u.onreadystatechange=function(){var e="Error from cloudfront"===u.getResponseHeader("x-cache");if("standard"===o.cdnType&&404===u.status&&!u.getResponseHeader("x-cache"))return e=!0,3<u.readyState&&c(null,{status:200,data:"{}",resourceNotExisting:e});var t=u.getResponseHeader("Cache-Control");3<u.readyState&&c(400<=u.status?u.statusText:null,{status:u.status,data:u.responseText,resourceNotExisting:e,cacheControl:t})},u.send(JSON.stringify(a))}catch(e){console&&console.log(e)}}else t(new Error("No fetch and no xhr implementation found!"))};t.exports=o.default}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"cross-fetch":4}],3:[function(e,t,o){Object.defineProperty(o,"__esModule",{value:!0}),o.debounce=function(n,i,s){var r;return function(){var e=this,t=arguments,o=s&&!r;clearTimeout(r),r=setTimeout(function(){r=null,s||n.apply(e,t)},i),o&&n.apply(e,t)}},o.defaults=function(o){return n.call(i.call(arguments,1),function(e){if(e)for(var t in e)void 0===o[t]&&(o[t]=e[t])}),o},o.defer=function(){var o,n,e=new Promise(function(e,t){o=e,n=t});return e.resolve=o,e.reject=n,e},o.getPath=function(e,t){e=s(e,t),t=e.obj,e=e.k;if(t)return t[e]},o.interpolate=function(e,t,o){var n,i;for(;n=r.exec(e);)i=(i=(i="string"!=typeof(i=n[1].trim())?(e=>null==e?"":""+e)(i):i)||"").replace(/\$/g,"$$$$"),e=e.replace(n[0],t[i]||i),r.lastIndex=0;return e},o.isMissingOption=a,o.optionExist=function(e,t){return!a(e,t)},o.pushPath=function(e,t,o,n){e=s(e,t,Object),t=e.obj,e=e.k;t[e]=t[e]||[],n&&(t[e]=t[e].concat(o));n||t[e].push(o)},o.setPath=function(e,t,o){e=s(e,t,Object);e.obj[e.k]=o};var o=[],n=o.forEach,i=o.slice;function s(e,t,o){function n(e){return e&&-1<e.indexOf("###")?e.replace(/###/g,"."):e}for(var i="string"!=typeof t?[].concat(t):t.split(".");1<i.length;){if(!e)return{};var s=n(i.shift());!e[s]&&o&&(e[s]=new o),e=e[s]}return e?{obj:e,k:n(i.shift())}:{}}var r=new RegExp("{{(.+?)}}","g");function a(o,e){return e.reduce(function(e,t){return e||(!o||!o[t]||"string"!=typeof o[t]||!o[t].toLowerCase()===t.toLowerCase())&&(e='i18next-locize-backend :: got "'.concat(o[t],'" in options for ').concat(t," which is invalid."),console.warn(e),e)},!1)}},{}],4:[function(e,t,o){},{}]},{},[1])(1)});