coffeescript-ui
Version:
Coffeescript User Interface System
1 lines • 1.13 MB
JavaScript
!function webpackUniversalModuleDefinition(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.CUI=e():t.CUI=e()}(this,function(){return function(t){function __webpack_require__(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,__webpack_require__),i.l=!0,i.exports}var e={};return __webpack_require__.m=t,__webpack_require__.c=e,__webpack_require__.i=function(t){return t},__webpack_require__.d=function(t,e,n){__webpack_require__.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},__webpack_require__.n=function(t){var e=t&&t.__esModule?function getDefault(){return t.default}:function getModuleExports(){return t};return __webpack_require__.d(e,"a",e),e},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=163)}([function(t,e,n){var i,o;o=n(2),i=function(){function CUI(){}return CUI.__readyFuncs=[],CUI.__themes=[],CUI.__ng__=!0,CUI.start=function(){var t,e;return e=function(t){return function(){return CUI.Events.trigger({type:"viewport-resize"})}}(),CUI.Events.listen({type:"resize",node:window,call:function(t){return function(t,n){CUI.browser.ie?CUI.scheduleCallback({ms:500,call:e}):e()}}()}),CUI.Events.listen({type:"drop",node:document.documentElement,call:function(t){return t.preventDefault()}}),CUI.Events.listen({type:"keyup",node:window,capture:!0,call:function(t){if("C+U+I"===t.getKeyboard())return CUI.toaster({text:"CUI!"})}}),CUI.Events.listen({type:"keydown",node:window,call:function(t){var e,n,i,o,r;if("c+"===t.getKeyboard()&&CUI.toaster({text:"CUI!"}),8===t.keyCode()){for(o=CUI.dom.elementsUntil(t.getTarget(),null,document.documentElement),e=0,n=o.length;e<n;e++){if(i=o[e],"INPUT"===(r=i.tagName)||"TEXTAREA"===r)return;if("true"===i.getAttribute("contenteditable"))return}t.preventDefault()}}}),document.body.scrollTop=0,t=n(203),CUI.Template.loadText(t),CUI.Template.load(),this.chainedCall.apply(this,this.__readyFuncs).always(function(t){return function(){return t.__ready=!0}}(this)),this},CUI.getPathToScript=function(){var t,e,n;return this.__pathToScript||(n=document.getElementsByTagName("script"),t=n[n.length-1],(e=t.src.match("(.*/).*?.js$"))?this.__pathToScript=e[1]:CUI.util.assert(this.__pathToScript,"CUI","Could not determine script path.")),this.__pathToScript},CUI.ready=function(t){return this.__ready?t.call(this):this.__readyFuncs.push(t)},CUI.defaults={FileUpload:{name:"files[]"},debug:!0,asserts:!0,asserts_alert:"js",class:{}},CUI.resolvedPromise=function(){var t;return t=new CUI.Deferred,t.resolve.apply(t,arguments),t.promise()},CUI.rejectedPromise=function(){var t;return t=new CUI.Deferred,t.reject.apply(t,arguments),t.promise()},CUI.chainedCall=function(){var t,e,n,i,o,r,s,a;return r=0,t=this,i=function(t){var e,n,i,o;for(e=[],i=0,o=t.length;i<o;i++)n=t[i],e.push(n);return e},o=function(t){var e;return e=i(t),0===e.length?void 0:1===e.length?e[0]:e},e=i(arguments),a=[],s=function(i){return function(){var i;if(r===e.length)return void n.resolve.apply(n,a);i=CUI.util.isFunction(e[r])?t!==CUI?e[r].call(t):e[r]():e[r],r++,CUI.util.isPromise(i)?i.done(function(){return a.push(o(arguments)),s()}).fail(function(){return a.push(o(arguments)),n.reject.apply(n,a)}):(a.push(i),s())}}(),n=new CUI.Deferred,s(),n.promise()},CUI.chunkWork=function(t){var e,n,i,o,r,s,a;return null==t&&(t={}),s=CUI.Element.readOpts(t,"CUI.chunkWork",{items:{mandatory:!0,check:function(t){return CUI.util.isArray(t)}},chunk_size:{mandatory:!0,default:10,check:function(t){return t>=1}},timeout:{mandatory:!0,default:0,check:function(t){return t>=-1}},call:{mandatory:!0,check:function(t){return t instanceof Function}}}),e=s.chunk_size,a=s.timeout,CUI.util.assert(this!==CUI,"CUI.chunkWork","Cannot call CUI.chunkWork with 'this' not set to the caller."),i=0,o=s.items.length,r=function(t){return function(){var c,l,u;if(l=i+1+" - "+Math.min(o,i+e)+" / "+o,n.notify({progress:l,idx:i,len:o,chunk_size:e}),c=function(){i+e>=o?n.resolve():(i+=e,-1===a?r():CUI.setTimeout({ms:a,call:r}))},!1===(u=s.call.call(t,s.items.slice(i,i+s.chunk_size),i,o)))return void n.reject();CUI.util.isPromise(u)?u.fail(n.reject).done(c):c()}}(this),n=new CUI.Deferred,CUI.setTimeout({ms:Math.min(0,a),call:function(t){return function(){return o>0?r():n.resolve()}}()}),n.promise()},CUI.chunkWorkOLD=function(t,e,n){var i,o,r;return null==e&&(e=10),null==n&&(n=0),i=new CUI.Deferred,r=0,o=function(s){return function(){var s;for(s=0;r<t.length&&(s<e||0===e);){if("rejected"===i.state())return;if(i.notify(t[r],r),r===t.length-1)return void i.resolve();r++,s++}if(r<t.length)return CUI.setTimeout(o,n)}}(),0===t.length?CUI.setTimeout(function(t){return function(){if("rejected"!==i.state())return i.resolve()}}()):CUI.setTimeout(o),i},CUI.proxyMethods=function(t,e,n){var i,o,r,s;for(s=[],i=0,r=n.length;i<r;i++)o=n[i],s.push(t.prototype[o]=e.prototype[o]);return s},CUI.__timeouts=[],CUI.__timeoutCallbacks=[],CUI.__callTimeoutChangeCallbacks=function(){var t,e,n,i;for(i=this.countTimeouts(),n=this.__timeoutCallbacks,t=0,e=n.length;t<e;t++)(0,n[t])(i)},CUI.__removeTimeout=function(t){CUI.util.removeFromArray(t,this.__timeouts)&&t.track&&this.__callTimeoutChangeCallbacks()},CUI.__getTimeoutById=function(t,e){var n,i,o,r;for(null==e&&(e=!1),o=this.__timeouts,n=0,i=o.length;n<i;n++)if(r=o[n],r.id===t)return r;return CUI.util.assert(e,"CUI.__getTimeoutById","Timeout #"+t+" not found."),null},CUI.resetTimeout=function(t){var e;return e=this.__getTimeoutById(t),CUI.util.assert(!e.__isRunning,"CUI.resetTimeout","Timeout "+t+" cannot be resetted while running.",{timeout:e}),"function"==typeof e.onReset&&e.onReset(e),window.clearTimeout(e.real_id),e.real_id,this.__startTimeout(e)},CUI.registerTimeoutChangeCallback=function(t){return this.__timeoutCallbacks.push(t)},CUI.setTimeout=function(t,e,n){var i,o,r,s;return null==e&&(e=0),CUI.util.isPlainObject(t)?(e=t.ms||0,n=t.track,i=t.call,o=t.onDone,r=t.onReset):i=t,CUI.util.isNull(n)&&(n=0!==e),CUI.util.assert(CUI.util.isFunction(i),"CUI.setTimeout","Function needs to be a Function (opts.call)",{parameter:t}),s={call:function(t){return function(){return s.__isRunning=!0,i(),t.__removeTimeout(s),"function"==typeof s.onDone?s.onDone(s):void 0}}(this),ms:e,func:i,track:n,onDone:o,onReset:r},this.__timeouts.push(s),n&&e>0&&this.__callTimeoutChangeCallbacks(),this.__startTimeout(s)},CUI.__scheduledCallbacks=[],CUI.scheduleCallback=function(t){var e,n,i,o,r;return o=CUI.Element.readOpts(t,"CUI.scheduleCallback",{call:{mandatory:!0,check:Function},ms:{default:0,check:function(t){return CUI.util.isInteger(t)&&t>=0}},track:{default:!1,check:Boolean}}),i=CUI.util.idxInArray(o.call,this.__scheduledCallbacks,function(t){return t.call===o.call}),i>-1&&CUI.isTimeoutRunning(this.__scheduledCallbacks[i].timeoutID)&&(i=-1),-1!==i?(CUI.resetTimeout(this.__scheduledCallbacks[i].timeoutID),this.__scheduledCallbacks[i].promise):(i=this.__scheduledCallbacks.length,n=new CUI.Deferred,r=CUI.setTimeout({ms:o.ms,track:o.track,call:function(t){return function(){return o.call(),n.resolve()}}()}),e=this.__scheduledCallbacks[i]={call:o.call,timeoutID:r,promise:n.promise()},n.done(function(t){return function(){return CUI.util.removeFromArray(o.call,t.__scheduledCallbacks,function(t){return t.call===o.call})}}(this)),e.promise)},CUI.scheduleCallbackCancel=function(t){var e,n;return n=CUI.Element.readOpts(t,"CUI.scheduleCallbackCancel",{call:{mandatory:!0,check:Function}}),(e=CUI.util.idxInArray(n.call,this.__scheduledCallbacks,function(t){return t.call===n.call}))>-1&&!CUI.isTimeoutRunning(this.__scheduledCallbacks[e].timeoutID)&&(CUI.clearTimeout(this.__scheduledCallbacks[e].timeoutID),this.__scheduledCallbacks.splice(e,1),!0)},CUI.utf8ArrayBufferToString=function(t){var e,n,i,o,r,s,a;for(a=[],e=new Uint8Array(t),s=e.length,r=0;r<s;)switch((n=e[r++])>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a.push(String.fromCharCode(n));break;case 12:case 13:i=e[r++],a.push(String.fromCharCode((31&n)<<6|63&i));break;case 14:i=e[r++],o=e[r++],a.push(String.fromCharCode((15&n)<<12|(63&i)<<6|(63&o)<<0))}return a.join("")},CUI.__startTimeout=function(t){var e;return e=window.setTimeout(t.call,t.ms),t.id||(t.id=e),t.real_id=e,t.id},CUI.countTimeouts=function(){var t,e,n,i,o;for(o=0,n=this.__timeouts,t=0,e=n.length;t<e;t++)i=n[t],i.track&&o++;return o},CUI.clearTimeout=function(t){var e;if(e=this.__getTimeoutById(t,!0))return window.clearTimeout(e.real_id),this.__removeTimeout(e),e.id},CUI.isTimeoutRunning=function(t){var e;return!(null==(e=this.__getTimeoutById(t,!0))||!e.__isRunning)},CUI.setInterval=function(t,e){return window.setInterval(t,e)},CUI.clearInterval=function(t){return window.clearInterval(t)},CUI.startWebdriverTest=function(){var t;return t="body",CUI.dom.addClass(t,"cui-webdriver-test")},CUI.getParameterByName=function(t,e){var n,i;return null==e&&(e=document.location.search),t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),n=new RegExp("[\\?&]"+t+"=([^&#]*)"),i=n.exec(e),null===i?"":decodeURIComponent(i[1].replace(/\+/g," "))},CUI.setSessionStorage=function(t,e){return this.__setStorage("sessionStorage",t,e)},CUI.getSessionStorage=function(t){return null==t&&(t=null),this.__getStorage("sessionStorage",t)},CUI.clearSessionStorage=function(){return this.__clearStorage("sessionStorage")},CUI.setLocalStorage=function(t,e){return this.__setStorage("localStorage",t,e)},CUI.getLocalStorage=function(t){return null==t&&(t=null),this.__getStorage("localStorage",t)},CUI.clearLocalStorage=function(){return this.__clearStorage("localStorage")},CUI.__storage={localStorage:null,sessionStorage:null},CUI.__setStorage=function(t,e,n){var i,o;i=this.__getStorage(t),void 0===n?delete i[e]:i[e]=n;try{window[t].setItem("CUI",JSON.stringify(i))}catch(e){o=e,console.warn("CUI.__setStorage: Storage not available.",o),this.__storage[t]=JSON.stringify(i)}return i},CUI.__getStorage=function(t,e){var n,i,o;null==e&&(e=null);try{i=window[t].getItem("CUI")}catch(e){o=e,console.warn("CUI.__getStorage: Storage not available.",o),i=this.__storage[t]}return n=i?JSON.parse(i):{},null!==e?n[e]:n},CUI.__clearStorage=function(t){var e;try{return window[t].removeItem("CUI")}catch(n){return e=n,console.warn("CUI.__clearStorage: Storage not available.",e),this.__storage[t]=null}},CUI.encodeUrlData=function(t,e,n,i){var o,r,s,a,c,l,u;null==e&&(e=null),null==n&&(n="&"),null==i&&(i="="),l=[],r=e?CUI.util.isFunction(e)?e:function(t){return CUI.util.stringMapReplace(t+"",replace_map)}:function(t){return encodeURIComponent(t)};for(a in t)if(u=t[a],CUI.util.isArray(u))for(s=0,c=u.length;s<c;s++)o=u[s],l.push(r(a)+i+r(o));else CUI.util.isEmpty(u)?void 0!==u&&l.push(r(a)):l.push(r(a)+i+r(u));return l.join(n)},CUI.encodeURIComponentNicely=function(t){var e,n,i,o,r,s,a,c,l,u,p;for(null==t&&(t=""),l=[],a=(t+"").split(","),e=i=0,r=a.length;i<r;e=++i)for(u=a[e],e>0&&l.push(","),c=u.split(":"),n=o=0,s=c.length;o<s;n=++o)p=c[n],n>0&&l.push(":"),l.push(encodeURIComponent(p));return l.join("")},CUI.decodeURIComponentNicely=function(t){return decodeURIComponent(t)},CUI.decodeUrlData=function(t,e,n,i,o){var r,s,a,c,l,u,p,h,d;for(null==e&&(e=null),null==n&&(n="&"),null==i&&(i="="),null==o&&(o=!1),u={},r=e?CUI.util.isFunction(e)?e:function(t){return CUI.util.stringMapReplace(t+"",e)}:function(t){return decodeURIComponent(t)},h=t.split(n),s=0,c=h.length;s<c;s++)p=h[s],0!==p.length&&(p.indexOf(i)>-1?(l=p.split(i),a=r(l[0]),d=r(l[1])):(a=r(p),d=""),o?(u[a]||(u[a]=[]),u[a].push(d)):u[a]=d);return u},CUI.decodeUrlDataArray=function(t,e,n,i){return null==e&&(e=null),null==n&&(n="&"),null==i&&(i="="),this.decodeUrlData(t,e,n,i,!0)},CUI.mergeMap=function(t,e){var n,i;for(n in e)i=e[n],t.hasOwnProperty(n)?CUI.util.isPlainObject(t[n])&&CUI.util.isPlainObject(i)&&CUI.util.mergeMap(t[n],i):t[n]=i;return t},CUI.revertMap=function(t){var e,n,i;n={};for(e in t)i=t[e],n[i]=e;return n},CUI.stringMapReplace=function(t,e){var n,i;i=[];for(n in e)CUI.util.isEmpty(n)||i.push(n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"));return i.length>0?t.replace(new RegExp(i.join("|"),"g"),function(t){return e[t]}):t},CUI.isFunction=function(t){return t&&"function"==typeof t},CUI.isPlainObject=function(t){var e;return t&&"object"==typeof t&&(null!=(e=t.constructor)?e.prototype.hasOwnProperty("isPrototypeOf"):void 0)},CUI.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},CUI.isMap=function(t){return this.isPlainObject(t)},CUI.isArray=function(t){return Array.isArray(t)},CUI.inArray=function(t,e){return e.indexOf(t)},CUI.isString=function(t){return"string"==typeof t},CUI.downloadData=function(t,e){var n,i;return n=new Blob([t],{type:"octet/stream"}),window.navigator.msSaveOrOpenBlob?window.navigator.msSaveOrOpenBlob(n,e):(i=window.URL.createObjectURL(n),this.__downloadDataElement.href=i,this.__downloadDataElement.download=e,this.__downloadDataElement.click(),window.URL.revokeObjectURL(i))},CUI.urlRegex=new RegExp("^(?:(?:(sftp|ftp|ftps|https|http))://|)(?:(\\S+?)(?::(\\S*))?@)?((?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:[a-z0-9\\u00a1-\\uffff](?:|[a-z\\u00a1-\\uffff0-9-]*[a-z0-9\\u00a1-\\uffff])\\.)*(?:[a-z\\u00a1-\\uffff]{2,})|(?:[a-z0-9\\u00a1-\\uffff][a-z0-9-\\u00a1-\\uffff]*[a-z0-9\\u00a1-\\uffff])))|)(?::(\\d{2,5}))?(?:([/?#]\\S*))?$","i"),CUI.evalCode=function(t){var e;return e=document.createElement("script"),e.text=t,document.head.appendChild(e).parentNode.removeChild(e)},CUI.appendToUrl=function(t,e){var n,i;for(n in e)void 0!==(i=e[n])&&(t.match(/\?/)?t+="&":t+="?",t+=encodeURIComponent(n)+"="+encodeURIComponent(i));return t},CUI.parseLocation=function(t){var e,n,i;return CUI.util.isFunction(null!=t?t.match:void 0)&&0!==t.length&&(n=t.match(this.urlRegex))?(i={protocol:n[1]||"",user:n[2]||"",password:n[3]||"",hostname:n[4]||"",port:n[5]||"",path:n[6]||"",origin:""},i.hostname?(i.protocol||(i.protocol="http"),i.origin=i.protocol+"://"+i.hostname,i.port&&(i.origin+=":"+i.port),i.url=i.protocol+"://",i.user&&(i.url=i.url+i.user+":"+i.password+"@"),i.url=i.url+i.hostname,i.port&&(i.url=i.url+":"+i.port)):i.url="",i.path.length>0?(e=i.path.match(/(.*?)(|\?.*?)(|\#.*)$/),i.pathname=e[1],i.search=e[2],"?"===i.search&&(i.search=""),i.fragment=e[3]):(i.search="",i.pathname="",i.fragment=""),i.href=i.origin+i.path,i.hash=i.fragment,i.login&&(i.auth=btoa(i.user+":"+i.password)),i.url=i.url+i.path,i):null},CUI.escapeAttribute=function(t){return CUI.util.isNull(t)||!CUI.util.isString(t)?"":t=t.replace(/"/g,""").replace(/\'/g,"'")},CUI.loadScript=function(t){var e,n;return e=new CUI.Deferred,n=CUI.dom.element("script",{charset:"utf-8",src:t}),CUI.Events.listen({type:"load",node:n,instance:n,call:function(t){return function(t){e.resolve(t)}}()}),CUI.Events.listen({type:"error",node:n,instance:n,call:function(t){return function(t){document.head.removeChild(n),e.reject(t)}}()}),e.always(function(t){return function(){return CUI.Events.ignore({instance:n})}}()),document.head.appendChild(n),e.promise()},CUI.browser=function(){var t;return t={opera:!!window.opr&&!!opr.addons||!!window.opera||navigator.userAgent.indexOf(" OPR/")>=0,firefox:"undefined"!=typeof InstallTrigger,safari:Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0,ie:!!document.documentMode,chrome:!!window.chrome&&!!window.chrome.webstore},t.edge=!t.ie&&!!window.StyleMedia,t.blink=(t.chrome||t.opera)&&!!window.CSS,t}(),CUI}(),i.ready(function(t){return function(){var t,e;for(t in i.browser)i.browser[t]&&document.body.classList.add("cui-browser-"+t);return i.defaults.marked_opts={renderer:new o.Renderer,gfm:!0,tables:!0,breaks:!1,pedantic:!1,smartLists:!0,smartypants:!1},o.setOptions(i.defaults.marked_opts),e=i.dom.htmlToNodes("\x3c!-- CUI.CUI --\x3e<a style='display: none;'></a>\x3c!-- /CUI.CUI --\x3e"),i.__downloadDataElement=e[1],i.dom.append(document.body,e)}}()),window.addEventListener?window.addEventListener("load",function(t){return function(){return i.start()}}()):alert("Your browser is not supported. Please update to a current version of Google Chrome, Mozilla Firefox or Internet Explorer."),t.exports=i},function(t,e,n){(function(t){!function(e,n){t.exports=n()}(0,function(){"use strict";function hooks(){return e.apply(null,arguments)}function isArray(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function isObject(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function isObjectEmpty(t){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(t).length;var e;for(e in t)if(t.hasOwnProperty(e))return!1;return!0}function isUndefined(t){return void 0===t}function isNumber(t){return"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t)}function isDate(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function map(t,e){var n,i=[];for(n=0;n<t.length;++n)i.push(e(t[n],n));return i}function hasOwnProp(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function extend(t,e){for(var n in e)hasOwnProp(e,n)&&(t[n]=e[n]);return hasOwnProp(e,"toString")&&(t.toString=e.toString),hasOwnProp(e,"valueOf")&&(t.valueOf=e.valueOf),t}function createUTC(t,e,n,i){return createLocalOrUTC(t,e,n,i,!0).utc()}function defaultParsingFlags(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function getParsingFlags(t){return null==t._pf&&(t._pf=defaultParsingFlags()),t._pf}function isValid(t){if(null==t._isValid){var e=getParsingFlags(t),n=i.call(e.parsedDateParts,function(t){return null!=t}),o=!isNaN(t._d.getTime())&&e.overflow<0&&!e.empty&&!e.invalidMonth&&!e.invalidWeekday&&!e.weekdayMismatch&&!e.nullInput&&!e.invalidFormat&&!e.userInvalidated&&(!e.meridiem||e.meridiem&&n);if(t._strict&&(o=o&&0===e.charsLeftOver&&0===e.unusedTokens.length&&void 0===e.bigHour),null!=Object.isFrozen&&Object.isFrozen(t))return o;t._isValid=o}return t._isValid}function createInvalid(t){var e=createUTC(NaN);return null!=t?extend(getParsingFlags(e),t):getParsingFlags(e).userInvalidated=!0,e}function copyConfig(t,e){var n,i,r;if(isUndefined(e._isAMomentObject)||(t._isAMomentObject=e._isAMomentObject),isUndefined(e._i)||(t._i=e._i),isUndefined(e._f)||(t._f=e._f),isUndefined(e._l)||(t._l=e._l),isUndefined(e._strict)||(t._strict=e._strict),isUndefined(e._tzm)||(t._tzm=e._tzm),isUndefined(e._isUTC)||(t._isUTC=e._isUTC),isUndefined(e._offset)||(t._offset=e._offset),isUndefined(e._pf)||(t._pf=getParsingFlags(e)),isUndefined(e._locale)||(t._locale=e._locale),o.length>0)for(n=0;n<o.length;n++)i=o[n],r=e[i],isUndefined(r)||(t[i]=r);return t}function Moment(t){copyConfig(this,t),this._d=new Date(null!=t._d?t._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===r&&(r=!0,hooks.updateOffset(this),r=!1)}function isMoment(t){return t instanceof Moment||null!=t&&null!=t._isAMomentObject}function absFloor(t){return t<0?Math.ceil(t)||0:Math.floor(t)}function toInt(t){var e=+t,n=0;return 0!==e&&isFinite(e)&&(n=absFloor(e)),n}function compareArrays(t,e,n){var i,o=Math.min(t.length,e.length),r=Math.abs(t.length-e.length),s=0;for(i=0;i<o;i++)(n&&t[i]!==e[i]||!n&&toInt(t[i])!==toInt(e[i]))&&s++;return s+r}function warn(t){!1===hooks.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+t)}function deprecate(t,e){var n=!0;return extend(function(){if(null!=hooks.deprecationHandler&&hooks.deprecationHandler(null,t),n){for(var i,o=[],r=0;r<arguments.length;r++){if(i="","object"==typeof arguments[r]){i+="\n["+r+"] ";for(var s in arguments[0])i+=s+": "+arguments[0][s]+", ";i=i.slice(0,-2)}else i=arguments[r];o.push(i)}warn(t+"\nArguments: "+Array.prototype.slice.call(o).join("")+"\n"+(new Error).stack),n=!1}return e.apply(this,arguments)},e)}function deprecateSimple(t,e){null!=hooks.deprecationHandler&&hooks.deprecationHandler(t,e),s[t]||(warn(e),s[t]=!0)}function isFunction(t){return t instanceof Function||"[object Function]"===Object.prototype.toString.call(t)}function set(t){var e,n;for(n in t)e=t[n],isFunction(e)?this[n]=e:this["_"+n]=e;this._config=t,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function mergeConfigs(t,e){var n,i=extend({},t);for(n in e)hasOwnProp(e,n)&&(isObject(t[n])&&isObject(e[n])?(i[n]={},extend(i[n],t[n]),extend(i[n],e[n])):null!=e[n]?i[n]=e[n]:delete i[n]);for(n in t)hasOwnProp(t,n)&&!hasOwnProp(e,n)&&isObject(t[n])&&(i[n]=extend({},i[n]));return i}function Locale(t){null!=t&&this.set(t)}function calendar(t,e,n){var i=this._calendar[t]||this._calendar.sameElse;return isFunction(i)?i.call(e,n):i}function longDateFormat(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t])}function invalidDate(){return this._invalidDate}function ordinal(t){return this._ordinal.replace("%d",t)}function relativeTime(t,e,n,i){var o=this._relativeTime[n];return isFunction(o)?o(t,e,n,i):o.replace(/%d/i,t)}function pastFuture(t,e){var n=this._relativeTime[t>0?"future":"past"];return isFunction(n)?n(e):n.replace(/%s/i,e)}function addUnitAlias(t,e){var n=t.toLowerCase();h[n]=h[n+"s"]=h[e]=t}function normalizeUnits(t){return"string"==typeof t?h[t]||h[t.toLowerCase()]:void 0}function normalizeObjectUnits(t){var e,n,i={};for(n in t)hasOwnProp(t,n)&&(e=normalizeUnits(n))&&(i[e]=t[n]);return i}function addUnitPriority(t,e){d[t]=e}function getPrioritizedUnits(t){var e=[];for(var n in t)e.push({unit:n,priority:d[n]});return e.sort(function(t,e){return t.priority-e.priority}),e}function zeroFill(t,e,n){var i=""+Math.abs(t),o=e-i.length;return(t>=0?n?"+":"":"-")+Math.pow(10,Math.max(0,o)).toString().substr(1)+i}function addFormatToken(t,e,n,i){var o=i;"string"==typeof i&&(o=function(){return this[i]()}),t&&(g[t]=o),e&&(g[e[0]]=function(){return zeroFill(o.apply(this,arguments),e[1],e[2])}),n&&(g[n]=function(){return this.localeData().ordinal(o.apply(this,arguments),t)})}function removeFormattingTokens(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function makeFormatFunction(t){var e,n,i=t.match(_);for(e=0,n=i.length;e<n;e++)g[i[e]]?i[e]=g[i[e]]:i[e]=removeFormattingTokens(i[e]);return function(e){var o,r="";for(o=0;o<n;o++)r+=isFunction(i[o])?i[o].call(e,t):i[o];return r}}function formatMoment(t,e){return t.isValid()?(e=expandFormat(e,t.localeData()),m[e]=m[e]||makeFormatFunction(e),m[e](t)):t.localeData().invalidDate()}function expandFormat(t,e){function replaceLongDateFormatTokens(t){return e.longDateFormat(t)||t}var n=5;for(f.lastIndex=0;n>=0&&f.test(t);)t=t.replace(f,replaceLongDateFormatTokens),f.lastIndex=0,n-=1;return t}function addRegexToken(t,e,n){E[t]=isFunction(e)?e:function(t,i){return t&&n?n:e}}function getParseRegexForToken(t,e){return hasOwnProp(E,t)?E[t](e._strict,e._locale):new RegExp(unescapeFormat(t))}function unescapeFormat(t){return regexEscape(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,n,i,o){return e||n||i||o}))}function regexEscape(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function addParseToken(t,e){var n,i=e;for("string"==typeof t&&(t=[t]),isNumber(e)&&(i=function(t,n){n[e]=toInt(t)}),n=0;n<t.length;n++)R[t[n]]=i}function addWeekParseToken(t,e){addParseToken(t,function(t,n,i,o){i._w=i._w||{},e(t,i._w,i,o)})}function addTimeToArrayFromToken(t,e,n){null!=e&&hasOwnProp(R,t)&&R[t](e,n._a,n,t)}function daysInYear(t){return isLeapYear(t)?366:365}function isLeapYear(t){return t%4==0&&t%100!=0||t%400==0}function getIsLeapYear(){return isLeapYear(this.year())}function makeGetSet(t,e){return function(n){return null!=n?(set$1(this,t,n),hooks.updateOffset(this,e),this):get(this,t)}}function get(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function set$1(t,e,n){t.isValid()&&!isNaN(n)&&("FullYear"===e&&isLeapYear(t.year())&&1===t.month()&&29===t.date()?t._d["set"+(t._isUTC?"UTC":"")+e](n,t.month(),daysInMonth(n,t.month())):t._d["set"+(t._isUTC?"UTC":"")+e](n))}function stringGet(t){return t=normalizeUnits(t),isFunction(this[t])?this[t]():this}function stringSet(t,e){if("object"==typeof t){t=normalizeObjectUnits(t);for(var n=getPrioritizedUnits(t),i=0;i<n.length;i++)this[n[i].unit](t[n[i].unit])}else if(t=normalizeUnits(t),isFunction(this[t]))return this[t](e);return this}function mod(t,e){return(t%e+e)%e}function daysInMonth(t,e){if(isNaN(t)||isNaN(e))return NaN;var n=mod(e,12);return t+=(e-n)/12,1===n?isLeapYear(t)?29:28:31-n%7%2}function localeMonths(t,e){return t?isArray(this._months)?this._months[t.month()]:this._months[(this._months.isFormat||G).test(e)?"format":"standalone"][t.month()]:isArray(this._months)?this._months:this._months.standalone}function localeMonthsShort(t,e){return t?isArray(this._monthsShort)?this._monthsShort[t.month()]:this._monthsShort[G.test(e)?"format":"standalone"][t.month()]:isArray(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function handleStrictParse(t,e,n){var i,o,r,s=t.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],i=0;i<12;++i)r=createUTC([2e3,i]),this._shortMonthsParse[i]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[i]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===e?(o=U.call(this._shortMonthsParse,s),-1!==o?o:null):(o=U.call(this._longMonthsParse,s),-1!==o?o:null):"MMM"===e?-1!==(o=U.call(this._shortMonthsParse,s))?o:(o=U.call(this._longMonthsParse,s),-1!==o?o:null):-1!==(o=U.call(this._longMonthsParse,s))?o:(o=U.call(this._shortMonthsParse,s),-1!==o?o:null)}function localeMonthsParse(t,e,n){var i,o,r;if(this._monthsParseExact)return handleStrictParse.call(this,t,e,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),i=0;i<12;i++){if(o=createUTC([2e3,i]),n&&!this._longMonthsParse[i]&&(this._longMonthsParse[i]=new RegExp("^"+this.months(o,"").replace(".","")+"$","i"),this._shortMonthsParse[i]=new RegExp("^"+this.monthsShort(o,"").replace(".","")+"$","i")),n||this._monthsParse[i]||(r="^"+this.months(o,"")+"|^"+this.monthsShort(o,""),this._monthsParse[i]=new RegExp(r.replace(".",""),"i")),n&&"MMMM"===e&&this._longMonthsParse[i].test(t))return i;if(n&&"MMM"===e&&this._shortMonthsParse[i].test(t))return i;if(!n&&this._monthsParse[i].test(t))return i}}function setMonth(t,e){var n;if(!t.isValid())return t;if("string"==typeof e)if(/^\d+$/.test(e))e=toInt(e);else if(e=t.localeData().monthsParse(e),!isNumber(e))return t;return n=Math.min(t.date(),daysInMonth(t.year(),e)),t._d["set"+(t._isUTC?"UTC":"")+"Month"](e,n),t}function getSetMonth(t){return null!=t?(setMonth(this,t),hooks.updateOffset(this,!0),this):get(this,"Month")}function getDaysInMonth(){return daysInMonth(this.year(),this.month())}function monthsShortRegex(t){return this._monthsParseExact?(hasOwnProp(this,"_monthsRegex")||computeMonthsParse.call(this),t?this._monthsShortStrictRegex:this._monthsShortRegex):(hasOwnProp(this,"_monthsShortRegex")||(this._monthsShortRegex=J),this._monthsShortStrictRegex&&t?this._monthsShortStrictRegex:this._monthsShortRegex)}function monthsRegex(t){return this._monthsParseExact?(hasOwnProp(this,"_monthsRegex")||computeMonthsParse.call(this),t?this._monthsStrictRegex:this._monthsRegex):(hasOwnProp(this,"_monthsRegex")||(this._monthsRegex=$),this._monthsStrictRegex&&t?this._monthsStrictRegex:this._monthsRegex)}function computeMonthsParse(){function cmpLenRev(t,e){return e.length-t.length}var t,e,n=[],i=[],o=[];for(t=0;t<12;t++)e=createUTC([2e3,t]),n.push(this.monthsShort(e,"")),i.push(this.months(e,"")),o.push(this.months(e,"")),o.push(this.monthsShort(e,""));for(n.sort(cmpLenRev),i.sort(cmpLenRev),o.sort(cmpLenRev),t=0;t<12;t++)n[t]=regexEscape(n[t]),i[t]=regexEscape(i[t]);for(t=0;t<24;t++)o[t]=regexEscape(o[t]);this._monthsRegex=new RegExp("^("+o.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+n.join("|")+")","i")}function createDate(t,e,n,i,o,r,s){var a;return t<100&&t>=0?(a=new Date(t+400,e,n,i,o,r,s),isFinite(a.getFullYear())&&a.setFullYear(t)):a=new Date(t,e,n,i,o,r,s),a}function createUTCDate(t){var e;if(t<100&&t>=0){var n=Array.prototype.slice.call(arguments);n[0]=t+400,e=new Date(Date.UTC.apply(null,n)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t)}else e=new Date(Date.UTC.apply(null,arguments));return e}function firstWeekOffset(t,e,n){var i=7+e-n;return-(7+createUTCDate(t,0,i).getUTCDay()-e)%7+i-1}function dayOfYearFromWeeks(t,e,n,i,o){var r,s,a=(7+n-i)%7,c=firstWeekOffset(t,i,o),l=1+7*(e-1)+a+c;return l<=0?(r=t-1,s=daysInYear(r)+l):l>daysInYear(t)?(r=t+1,s=l-daysInYear(t)):(r=t,s=l),{year:r,dayOfYear:s}}function weekOfYear(t,e,n){var i,o,r=firstWeekOffset(t.year(),e,n),s=Math.floor((t.dayOfYear()-r-1)/7)+1;return s<1?(o=t.year()-1,i=s+weeksInYear(o,e,n)):s>weeksInYear(t.year(),e,n)?(i=s-weeksInYear(t.year(),e,n),o=t.year()+1):(o=t.year(),i=s),{week:i,year:o}}function weeksInYear(t,e,n){var i=firstWeekOffset(t,e,n),o=firstWeekOffset(t+1,e,n);return(daysInYear(t)-i+o)/7}function localeWeek(t){return weekOfYear(t,this._week.dow,this._week.doy).week}function localeFirstDayOfWeek(){return this._week.dow}function localeFirstDayOfYear(){return this._week.doy}function getSetWeek(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")}function getSetISOWeek(t){var e=weekOfYear(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")}function parseWeekday(t,e){return"string"!=typeof t?t:isNaN(t)?(t=e.weekdaysParse(t),"number"==typeof t?t:null):parseInt(t,10)}function parseIsoWeekday(t,e){return"string"==typeof t?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function shiftWeekdays(t,e){return t.slice(e,7).concat(t.slice(0,e))}function localeWeekdays(t,e){var n=isArray(this._weekdays)?this._weekdays:this._weekdays[t&&!0!==t&&this._weekdays.isFormat.test(e)?"format":"standalone"];return!0===t?shiftWeekdays(n,this._week.dow):t?n[t.day()]:n}function localeWeekdaysShort(t){return!0===t?shiftWeekdays(this._weekdaysShort,this._week.dow):t?this._weekdaysShort[t.day()]:this._weekdaysShort}function localeWeekdaysMin(t){return!0===t?shiftWeekdays(this._weekdaysMin,this._week.dow):t?this._weekdaysMin[t.day()]:this._weekdaysMin}function handleStrictParse$1(t,e,n){var i,o,r,s=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],i=0;i<7;++i)r=createUTC([2e3,1]).day(i),this._minWeekdaysParse[i]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[i]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[i]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===e?(o=U.call(this._weekdaysParse,s),-1!==o?o:null):"ddd"===e?(o=U.call(this._shortWeekdaysParse,s),-1!==o?o:null):(o=U.call(this._minWeekdaysParse,s),-1!==o?o:null):"dddd"===e?-1!==(o=U.call(this._weekdaysParse,s))?o:-1!==(o=U.call(this._shortWeekdaysParse,s))?o:(o=U.call(this._minWeekdaysParse,s),-1!==o?o:null):"ddd"===e?-1!==(o=U.call(this._shortWeekdaysParse,s))?o:-1!==(o=U.call(this._weekdaysParse,s))?o:(o=U.call(this._minWeekdaysParse,s),-1!==o?o:null):-1!==(o=U.call(this._minWeekdaysParse,s))?o:-1!==(o=U.call(this._weekdaysParse,s))?o:(o=U.call(this._shortWeekdaysParse,s),-1!==o?o:null)}function localeWeekdaysParse(t,e,n){var i,o,r;if(this._weekdaysParseExact)return handleStrictParse$1.call(this,t,e,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),i=0;i<7;i++){if(o=createUTC([2e3,1]).day(i),n&&!this._fullWeekdaysParse[i]&&(this._fullWeekdaysParse[i]=new RegExp("^"+this.weekdays(o,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[i]=new RegExp("^"+this.weekdaysShort(o,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[i]=new RegExp("^"+this.weekdaysMin(o,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[i]||(r="^"+this.weekdays(o,"")+"|^"+this.weekdaysShort(o,"")+"|^"+this.weekdaysMin(o,""),this._weekdaysParse[i]=new RegExp(r.replace(".",""),"i")),n&&"dddd"===e&&this._fullWeekdaysParse[i].test(t))return i;if(n&&"ddd"===e&&this._shortWeekdaysParse[i].test(t))return i;if(n&&"dd"===e&&this._minWeekdaysParse[i].test(t))return i;if(!n&&this._weekdaysParse[i].test(t))return i}}function getSetDayOfWeek(t){if(!this.isValid())return null!=t?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=parseWeekday(t,this.localeData()),this.add(t-e,"d")):e}function getSetLocaleDayOfWeek(t){if(!this.isValid())return null!=t?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")}function getSetISODayOfWeek(t){if(!this.isValid())return null!=t?this:NaN;if(null!=t){var e=parseIsoWeekday(t,this.localeData());return this.day(this.day()%7?e:e-7)}return this.day()||7}function weekdaysRegex(t){return this._weekdaysParseExact?(hasOwnProp(this,"_weekdaysRegex")||computeWeekdaysParse.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(hasOwnProp(this,"_weekdaysRegex")||(this._weekdaysRegex=it),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}function weekdaysShortRegex(t){return this._weekdaysParseExact?(hasOwnProp(this,"_weekdaysRegex")||computeWeekdaysParse.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(hasOwnProp(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=ot),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function weekdaysMinRegex(t){return this._weekdaysParseExact?(hasOwnProp(this,"_weekdaysRegex")||computeWeekdaysParse.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(hasOwnProp(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=rt),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function computeWeekdaysParse(){function cmpLenRev(t,e){return e.length-t.length}var t,e,n,i,o,r=[],s=[],a=[],c=[];for(t=0;t<7;t++)e=createUTC([2e3,1]).day(t),n=this.weekdaysMin(e,""),i=this.weekdaysShort(e,""),o=this.weekdays(e,""),r.push(n),s.push(i),a.push(o),c.push(n),c.push(i),c.push(o);for(r.sort(cmpLenRev),s.sort(cmpLenRev),a.sort(cmpLenRev),c.sort(cmpLenRev),t=0;t<7;t++)s[t]=regexEscape(s[t]),a[t]=regexEscape(a[t]),c[t]=regexEscape(c[t]);this._weekdaysRegex=new RegExp("^("+c.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+r.join("|")+")","i")}function hFormat(){return this.hours()%12||12}function kFormat(){return this.hours()||24}function meridiem(t,e){addFormatToken(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}function matchMeridiem(t,e){return e._meridiemParse}function localeIsPM(t){return"p"===(t+"").toLowerCase().charAt(0)}function localeMeridiem(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"}function normalizeLocale(t){return t?t.toLowerCase().replace("_","-"):t}function chooseLocale(t){for(var e,n,i,o,r=0;r<t.length;){for(o=normalizeLocale(t[r]).split("-"),e=o.length,n=normalizeLocale(t[r+1]),n=n?n.split("-"):null;e>0;){if(i=loadLocale(o.slice(0,e).join("-")))return i;if(n&&n.length>=e&&compareArrays(o,n,!0)>=e-1)break;e--}r++}return st}function loadLocale(e){var i=null;if(!ut[e]&&void 0!==t&&t&&t.exports)try{i=st._abbr;n(202)("./"+e),getSetGlobalLocale(i)}catch(t){}return ut[e]}function getSetGlobalLocale(t,e){var n;return t&&(n=isUndefined(e)?getLocale(t):defineLocale(t,e),n?st=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+t+" not found. Did you forget to load it?")),st._abbr}function defineLocale(t,e){if(null!==e){var n,i=lt;if(e.abbr=t,null!=ut[t])deprecateSimple("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),i=ut[t]._config;else if(null!=e.parentLocale)if(null!=ut[e.parentLocale])i=ut[e.parentLocale]._config;else{if(null==(n=loadLocale(e.parentLocale)))return pt[e.parentLocale]||(pt[e.parentLocale]=[]),pt[e.parentLocale].push({name:t,config:e}),null;i=n._config}return ut[t]=new Locale(mergeConfigs(i,e)),pt[t]&&pt[t].forEach(function(t){defineLocale(t.name,t.config)}),getSetGlobalLocale(t),ut[t]}return delete ut[t],null}function updateLocale(t,e){if(null!=e){var n,i,o=lt;i=loadLocale(t),null!=i&&(o=i._config),e=mergeConfigs(o,e),n=new Locale(e),n.parentLocale=ut[t],ut[t]=n,getSetGlobalLocale(t)}else null!=ut[t]&&(null!=ut[t].parentLocale?ut[t]=ut[t].parentLocale:null!=ut[t]&&delete ut[t]);return ut[t]}function getLocale(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return st;if(!isArray(t)){if(e=loadLocale(t))return e;t=[t]}return chooseLocale(t)}function listLocales(){return a(ut)}function checkOverflow(t){var e,n=t._a;return n&&-2===getParsingFlags(t).overflow&&(e=n[P]<0||n[P]>11?P:n[W]<1||n[W]>daysInMonth(n[I],n[P])?W:n[q]<0||n[q]>24||24===n[q]&&(0!==n[F]||0!==n[Y]||0!==n[X])?q:n[F]<0||n[F]>59?F:n[Y]<0||n[Y]>59?Y:n[X]<0||n[X]>999?X:-1,getParsingFlags(t)._overflowDayOfYear&&(e<I||e>W)&&(e=W),getParsingFlags(t)._overflowWeeks&&-1===e&&(e=V),getParsingFlags(t)._overflowWeekday&&-1===e&&(e=H),getParsingFlags(t).overflow=e),t}function defaults(t,e,n){return null!=t?t:null!=e?e:n}function currentDateArray(t){var e=new Date(hooks.now());return t._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}function configFromArray(t){var e,n,i,o,r,s=[];if(!t._d){for(i=currentDateArray(t),t._w&&null==t._a[W]&&null==t._a[P]&&dayOfYearFromWeekInfo(t),null!=t._dayOfYear&&(r=defaults(t._a[I],i[I]),(t._dayOfYear>daysInYear(r)||0===t._dayOfYear)&&(getParsingFlags(t)._overflowDayOfYear=!0),n=createUTCDate(r,0,t._dayOfYear),t._a[P]=n.getUTCMonth(),t._a[W]=n.getUTCDate()),e=0;e<3&&null==t._a[e];++e)t._a[e]=s[e]=i[e];for(;e<7;e++)t._a[e]=s[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[q]&&0===t._a[F]&&0===t._a[Y]&&0===t._a[X]&&(t._nextDay=!0,t._a[q]=0),t._d=(t._useUTC?createUTCDate:createDate).apply(null,s),o=t._useUTC?t._d.getUTCDay():t._d.getDay(),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[q]=24),t._w&&void 0!==t._w.d&&t._w.d!==o&&(getParsingFlags(t).weekdayMismatch=!0)}}function dayOfYearFromWeekInfo(t){var e,n,i,o,r,s,a,c;if(e=t._w,null!=e.GG||null!=e.W||null!=e.E)r=1,s=4,n=defaults(e.GG,t._a[I],weekOfYear(createLocal(),1,4).year),i=defaults(e.W,1),((o=defaults(e.E,1))<1||o>7)&&(c=!0);else{r=t._locale._week.dow,s=t._locale._week.doy;var l=weekOfYear(createLocal(),r,s);n=defaults(e.gg,t._a[I],l.year),i=defaults(e.w,l.week),null!=e.d?((o=e.d)<0||o>6)&&(c=!0):null!=e.e?(o=e.e+r,(e.e<0||e.e>6)&&(c=!0)):o=r}i<1||i>weeksInYear(n,r,s)?getParsingFlags(t)._overflowWeeks=!0:null!=c?getParsingFlags(t)._overflowWeekday=!0:(a=dayOfYearFromWeeks(n,i,o,r,s),t._a[I]=a.year,t._dayOfYear=a.dayOfYear)}function configFromISO(t){var e,n,i,o,r,s,a=t._i,c=ht.exec(a)||dt.exec(a);if(c){for(getParsingFlags(t).iso=!0,e=0,n=ft.length;e<n;e++)if(ft[e][1].exec(c[1])){o=ft[e][0],i=!1!==ft[e][2];break}if(null==o)return void(t._isValid=!1);if(c[3]){for(e=0,n=mt.length;e<n;e++)if(mt[e][1].exec(c[3])){r=(c[2]||" ")+mt[e][0];break}if(null==r)return void(t._isValid=!1)}if(!i&&null!=r)return void(t._isValid=!1);if(c[4]){if(!_t.exec(c[4]))return void(t._isValid=!1);s="Z"}t._f=o+(r||"")+(s||""),configFromStringAndFormat(t)}else t._isValid=!1}function extractFromRFC2822Strings(t,e,n,i,o,r){var s=[untruncateYear(t),K.indexOf(e),parseInt(n,10),parseInt(i,10),parseInt(o,10)];return r&&s.push(parseInt(r,10)),s}function untruncateYear(t){var e=parseInt(t,10);return e<=49?2e3+e:e<=999?1900+e:e}function preprocessRFC2822(t){return t.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function checkWeekday(t,e,n){if(t){if(et.indexOf(t)!==new Date(e[0],e[1],e[2]).getDay())return getParsingFlags(n).weekdayMismatch=!0,n._isValid=!1,!1}return!0}function calculateOffset(t,e,n){if(t)return yt[t];if(e)return 0;var i=parseInt(n,10),o=i%100;return(i-o)/100*60+o}function configFromRFC2822(t){var e=Mt.exec(preprocessRFC2822(t._i));if(e){var n=extractFromRFC2822Strings(e[4],e[3],e[2],e[5],e[6],e[7]);if(!checkWeekday(e[1],n,t))return;t._a=n,t._tzm=calculateOffset(e[8],e[9],e[10]),t._d=createUTCDate.apply(null,t._a),t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),getParsingFlags(t).rfc2822=!0}else t._isValid=!1}function configFromString(t){var e=gt.exec(t._i);if(null!==e)return void(t._d=new Date(+e[1]));configFromISO(t),!1===t._isValid&&(delete t._isValid,configFromRFC2822(t),!1===t._isValid&&(delete t._isValid,hooks.createFromInputFallback(t)))}function configFromStringAndFormat(t){if(t._f===hooks.ISO_8601)return void configFromISO(t);if(t._f===hooks.RFC_2822)return void configFromRFC2822(t);t._a=[],getParsingFlags(t).empty=!0;var e,n,i,o,r,s=""+t._i,a=s.length,c=0;for(i=expandFormat(t._f,t._locale).match(_)||[],e=0;e<i.length;e++)o=i[e],n=(s.match(getParseRegexForToken(o,t))||[])[0],n&&(r=s.substr(0,s.indexOf(n)),r.length>0&&getParsingFlags(t).unusedInput.push(r),s=s.slice(s.indexOf(n)+n.length),c+=n.length),g[o]?(n?getParsingFlags(t).empty=!1:getParsingFlags(t).unusedTokens.push(o),addTimeToArrayFromToken(o,n,t)):t._strict&&!n&&getParsingFlags(t).unusedTokens.push(o);getParsingFlags(t).charsLeftOver=a-c,s.length>0&&getParsingFlags(t).unusedInput.push(s),t._a[q]<=12&&!0===getParsingFlags(t).bigHour&&t._a[q]>0&&(getParsingFlags(t).bigHour=void 0),getParsingFlags(t).parsedDateParts=t._a.slice(0),getParsingFlags(t).meridiem=t._meridiem,t._a[q]=meridiemFixWrap(t._locale,t._a[q],t._meridiem),configFromArray(t),checkOverflow(t)}function meridiemFixWrap(t,e,n){var i;return null==n?e:null!=t.meridiemHour?t.meridiemHour(e,n):null!=t.isPM?(i=t.isPM(n),i&&e<12&&(e+=12),i||12!==e||(e=0),e):e}function configFromStringAndArray(t){var e,n,i,o,r;if(0===t._f.length)return getParsingFlags(t).invalidFormat=!0,void(t._d=new Date(NaN));for(o=0;o<t._f.length;o++)r=0,e=copyConfig({},t),null!=t._useUTC&&(e._useUTC=t._useUTC),e._f=t._f[o],configFromStringAndFormat(e),isValid(e)&&(r+=getParsingFlags(e).charsLeftOver,r+=10*getParsingFlags(e).unusedTokens.length,getParsingFlags(e).score=r,(null==i||r<i)&&(i=r,n=e));extend(t,n||e)}function configFromObject(t){if(!t._d){var e=normalizeObjectUnits(t._i);t._a=map([e.year,e.month,e.day||e.date,e.hour,e.minute,e.second,e.millisecond],function(t){return t&&parseInt(t,10)}),configFromArray(t)}}function createFromConfig(t){var e=new Moment(checkOverflow(prepareConfig(t)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}function prepareConfig(t){var e=t._i,n=t._f;return t._locale=t._locale||getLocale(t._l),null===e||void 0===n&&""===e?createInvalid({nullInput:!0}):("string"==typeof e&&(t._i=e=t._locale.preparse(e)),isMoment(e)?new Moment(checkOverflow(e)):(isDate(e)?t._d=e:isArray(n)?configFromStringAndArray(t):n?configFromStringAndFormat(t):configFromInput(t),isValid(t)||(t._d=null),t))}function configFromInput(t){var e=t._i;isUndefined(e)?t._d=new Date(hooks.now()):isDate(e)?t._d=new Date(e.valueOf()):"string"==typeof e?configFromString(t):isArray(e)?(t._a=map(e.slice(0),function(t){return parseInt(t,10)}),configFromArray(t)):isObject(e)?configFromObject(t):isNumber(e)?t._d=new Date(e):hooks.createFromInputFallback(t)}function createLocalOrUTC(t,e,n,i,o){var r={};return!0!==n&&!1!==n||(i=n,n=void 0),(isObject(t)&&isObjectEmpty(t)||isArray(t)&&0===t.length)&&(t=void 0),r._isAMomentObject=!0,r._useUTC=r._isUTC=o,r._l=n,r._i=t,r._f=e,r._strict=i,createFromConfig(r)}function createLocal(t,e,n,i){return createLocalOrUTC(t,e,n,i,!1)}function pickBy(t,e){var n,i;if(1===e.length&&isArray(e[0])&&(e=e[0]),!e.length)return createLocal();for(n=e[0],i=1;i<e.length;++i)e[i].isValid()&&!e[i][t](n)||(n=e[i]);return n}function min(){return pickBy("isBefore",[].slice.call(arguments,0))}function max(){return pickBy("isAfter",[].slice.call(arguments,0))}function isDurationValid(t){for(var e in t)if(-1===U.call(Ot,e)||null!=t[e]&&isNaN(t[e]))return!1;for(var n=!1,i=0;i<Ot.length;++i)if(t[Ot[i]]){if(n)return!1;parseFloat(t[Ot[i]])!==toInt(t[Ot[i]])&&(n=!0)}return!0}function isValid$1(){return this._isValid}function createInvalid$1(){return createDuration(NaN)}function Duration(t){var e=normalizeObjectUnits(t),n=e.year||0,i=e.quarter||0,o=e.month||0,r=e.week||e.isoWeek||0,s=e.day||0,a=e.hour||0,c=e.minute||0,l=e.second||0,u=e.millisecond||0;this._isValid=isDurationValid(e),this._milliseconds=+u+1e3*l+6e4*c+1e3*a*60*60,this._days=+s+7*r,this._months=+o+3*i+12*n,this._data={},this._locale=getLocale(),this._bubble()}function isDuration(t){return t instanceof Duration}function absRound(t){return t<0?-1*Math.round(-1*t):Math.round(t)}function offset(t,e){addFormatToken(t,0,0,function(){var t=this.utcOffset(),n="+";return t<0&&(t=-t,n="-"),n+zeroFill(~~(t/60),2)+e+zeroFill(~~t%60,2)})}function offsetFromString(t,e){var n=(e||"").match(t);if(null===n)return null;var i=n[n.length-1]||[],o=(i+"").match(zt)||["-",0,0],r=60*o[1]+toInt(o[2]);return 0===r?0:"+"===o[0]?r:-r}function cloneWithOffset(t,e){var n,i;return e._isUTC?(n=e.clone(),i=(isMoment(t)||isDate(t)?t.valueOf():createLocal(t).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+i),hooks.updateOffset(n,!1),n):createLocal(t).local()}function getDateOffset(t){return 15*-Math.round(t._d.getTimezoneOffset()/15)}function getSetOffset(t,e,n){var i,o=this._offset||0;if(!this.isValid())return null!=t?this:NaN;if(null!=t){if("string"==typeof t){if(null===(t=offsetFromString(S,t)))return this}else Math.abs(t)<16&&!n&&(t*=60);return!this._isUTC&&e&&(i=getDateOffset(this)),this._offset=t,this._isUTC=!0,null!=i&&this.add(i,"m"),o!==t&&(!e||this._changeInProgress?addSubtract(this,createDuration(t-o,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,hooks.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?o:getDateOffset(this)}function getSetZone(t,e){return null!=t?("string"!=typeof t&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()}function setOffsetToUTC(t){return this.utcOffset(0,t)}function setOffsetToLocal(t){return this._isUTC&&(this.utcOffset(0,t),this._isUTC=!1,t&&this.subtract(getDateOffset(this),"m")),this}function setOffsetToParsedOffset(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var t=offsetFromString(x,this._i);null!=t?this.utcOffset(t):this.utcOffset(0,!0)}return this}function hasAlignedHourOffset(t){return!!this.isValid()&&(t=t?createLocal(t).utcOffset():0,(this.utcOffset()-t)%60==0)}function isDaylightSavingTime(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function isDaylightSavingTimeShifted(){if(!isUndefined(this._isDSTShifted))return this._isDSTShifted;var t={};if(copyConfig(t,this),t=prepareConfig(t),t._a){var e=t._isUTC?createUTC(t._a):createLocal(t._a);this._isDSTShifted=this.isValid()&&compareArrays(t._a,e.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function isLocal(){return!!this.isValid()&&!this._isUTC}function isUtcOffset(){return!!this.isValid()&&this._isUTC}function isUtc(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function createDuration(t,e){var n,i,o,r=t,s=null;return isDuration(t)?r={ms:t._milliseconds,d:t._days,M:t._months}:isNumber(t)?(r={},e?r[e]=t:r.milliseconds=t):(s=At.exec(t))?(n="-"===s[1]?-1:1,r={y:0,d:toInt(s[W])*n,h:toInt(s[q])*n,m:toInt(s[F])*n,s:toInt(s[Y])*n,ms:toInt(absRound(1e3*s[X]))*n}):(s=Lt.exec(t))?(n="-"===s[1]?-1:1,r={y:parseIso(s[2],n),M:parseIso(s[3],n),w:parseIso(s[4],n),d:parseIso(s[5],n),h:parseIso(s[6],n),m:parseIso(s[7],n),s:parseIso(s[8],n)}):null==r?r={}:"object"==typeof r&&("from"in r||"to"in r)&&(o=momentsDifference(createLocal(r.from),createLocal(r.to)),r={},r.ms=o.milliseconds,r.M=o.months),i=new Duration(r),isDuration(t)&&hasOwnProp(t,"_locale")&&(i._locale=t._locale),i}function parseIso(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function positiveMomentsDifference(t,e){var n={};return n.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function momentsDifference(t,e){var n;return t.isValid()&&e.isValid()?(e=cloneWithOffset(e,t),t.isBefore(e)?n=positiveMomentsDifference(t,e):(n=positiveMomentsDifference(e,t),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function createAdder(t,e){return function(n,i){var o,r;return null===i||isNaN(+i)||(deprecateSimple(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),r=n,n=i,i=r),n="string"==typeof n?+n:n,o=createDuration(n,i),addSubtract(this,o,t),this}}function addSubtract(t,e,n,i){var o=e._milliseconds,r=absRound(e._days),s=absRound(e._months);t.isValid()&&(i=null==i||i,s&&setMonth(t,get(t,"Month")+s*n),r&&set$1(t,"Date",get(t,"Date")+r*n),o&&t._d.setTime(t._d.valueOf()+o*n),i&&hooks.updateOffset(t,r||s))}function getCalendarFormat(t,e){var n=t.diff(e,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"}function