!function(e){"object"==typeof module&&"object"==typeof module.exports?e(require,exports):"function"==typeof define&&define.amd&&define(["require","exports","tslib","../BrowserUtils","../definition/ProgramInspector"],e)}(function(c,e){"use strict";var u="object"==typeof module&&"object"==typeof module.exports;Object.defineProperty(e,"__esModule",{value:!0});var l=c("tslib"),t=c("../BrowserUtils"),s=c("../definition/ProgramInspector"),f=["cs","da","de","de-AT","en-AU","en-CA","en-GB","en-IN","en-NZ","en-US","en-ZA","fr","fr-CA","fr-CH","it","nb","nl","nl-BE","nn","pt","pt-BR"],r="",n="";function a(e){return e instanceof Date&&!isNaN(e.valueOf())}function i(e){if(/^\d+$/.test(e)&&!(4<e.length)){for(2===e.length&&(e=""+(parseInt(e,10)<=29?20:19)+e);e.length<4;)e="0"+e;return e}}function o(e){if(/^\d+$/.test(e)&&!(2<e.length)){1===e.length&&(e="0"+e);var t=parseInt(e,10);if(!(t<1||12<t))return e}}function d(e){if(/^\d+$/.test(e)&&!(2<e.length)){1===e.length&&(e="0"+e);var t=parseInt(e,10);if(!(t<1||31<t))return e}}function y(){if(r)return r;var e=new Date(1999,11,31,0,0,0);return r=(r=(r=(r=(r=e.toLocaleDateString(void 0,{year:"numeric",month:"numeric",day:"numeric"})).replace("1999","yyyy")).replace("99","yyyy")).replace("12","MM")).replace("31","dd"),r=t.isIE()?r.replace(/[^ -~]/g,""):r}function p(){if(n)return n;var e=y();return n=e[e.search(/[^dMy]/)]}function g(e){var t=y(),r=t.indexOf("yyyy"),n=t.indexOf("MM"),t=t.indexOf("dd");return"yyyy"===e?0===r?0:n<r&&t<r?2:1:"MM"===e?0===n?0:t<n&&r<n?2:1:0===t?0:n<t&&r<t?2:1}e.isValidDate=a,e.tryParseYear=i,e.tryParseMonth=o,e.tryParseDay=d,e.tryParseDateText=function(e){if(e){var t=(e=e.replace(/\\/g,"\\\\")).match(/(\d+)/g);if(t&&3===t.length){for(var e=p(),r=g("yyyy"),n=g("MM"),a=0;a<3;a++){switch(a){case r:t[a]=i(t[a]);break;case n:t[a]=o(t[a]);break;default:t[a]=d(t[a])}if(void 0===t[a])return}return""+t[0]+e+t[1]+e+t[2]}}},e.getDateFnsLocale=function(o){return l.__awaiter(this,void 0,void 0,function(){var t,n,a,i;return l.__generator(this,function(e){var r;switch(e.label){case 0:if(n=[],!(t=s.parseLocale(o)))return[2];t.territory&&n.push(t.language+"-"+t.territory),n.push(t.language),t=0,n=n,e.label=1;case 1:if(!(t<n.length))return[3,7];if(a=n[t],-1===f.indexOf(a))return[3,6];i=void 0,e.label=2;case 2:return e.trys.push([2,4,,5]),[4,(r="date-fns/locale/"+a+"/index.min",u?Promise.resolve().then(function(){return l.__importStar(c(r))}):new Promise(function(e,t){c([r],e,t)}).then(l.__importStar))];case 3:return i=e.sent(),[3,5];case 4:return e.sent(),[3,6];case 5:if(null!=i&&i.localize)return[2,i];e.label=6;case 6:return t++,[3,1];case 7:return[2]}})})},e.getLocaleDateFormat=y,e.getLocaleDateFormatSeparator=p,e.getLocaleDateFormatTokenPosition=g,e.getDateAsLocaleFormattedString=function(e){if(!a(e))return"";var t=i(e.getFullYear().toString()),r=o((e.getMonth()+1).toString()),n=d(e.getDate().toString());return e=(e=(e=(e=y()).replace("yyyy",t)).replace("MM",r)).replace("dd",n)},e.__test__setlocaleDateFormatInCache=function(e){r=e,n=""}});