1 line
6.1 KiB
JavaScript
1 line
6.1 KiB
JavaScript
!function(t,e){"use strict";"object"==typeof module&&module.exports?module.exports=e(require("moment")):"function"==typeof define&&define.amd?define(["moment"],e):e(t.moment)}(this,(function(t){"use strict";var e,n={},o={},r={},s={};t&&"string"==typeof t.version||A("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");var i=t.version.split("."),f=+i[0],a=+i[1];function u(t){return t>96?t-87:t>64?t-29:t-48}function c(t){var e=0,n=t.split("."),o=n[0],r=n[1]||"",s=1,i=0,f=1;for(45===t.charCodeAt(0)&&(e=1,f=-1);e<o.length;e++)i=60*i+u(o.charCodeAt(e));for(e=0;e<r.length;e++)s/=60,i+=u(r.charCodeAt(e))*s;return i*f}function h(t){for(var e=0;e<t.length;e++)t[e]=c(t[e])}function l(t,e){var n,o=[];for(n=0;n<e.length;n++)o[n]=t[e[n]];return o}function m(t){var e=t.split("|"),n=e[2].split(" "),o=e[3].split(""),r=e[4].split(" ");return h(n),h(o),h(r),function(t,e){for(var n=0;n<e;n++)t[n]=Math.round((t[n-1]||0)+6e4*t[n]);t[e-1]=1/0}(r,o.length),{name:e[0],abbrs:l(e[1].split(" "),o),offsets:l(n,o),untils:r,population:0|e[5]}}function p(t){t&&this._set(m(t))}function d(t){var e=t.toTimeString(),n=e.match(/\([a-z ]+\)/i);"GMT"===(n=n&&n[0]?(n=n[0].match(/[A-Z]/g))?n.join(""):void 0:(n=e.match(/[A-Z]{3,5}/g))?n[0]:void 0)&&(n=void 0),this.at=+t,this.abbr=n,this.offset=t.getTimezoneOffset()}function v(t){this.zone=t,this.offsetScore=0,this.abbrScore=0}function z(t,e){for(var n,o;o=6e4*((e.at-t.at)/12e4|0);)(n=new d(new Date(t.at+o))).offset===t.offset?t=n:e=n;return t}function b(t,e){return t.offsetScore!==e.offsetScore?t.offsetScore-e.offsetScore:t.abbrScore!==e.abbrScore?t.abbrScore-e.abbrScore:e.zone.population-t.zone.population}function g(t,e){var n,o;for(h(e),n=0;n<e.length;n++)o=e[n],s[o]=s[o]||{},s[o][t]=!0}function _(t){var e,n,o,i=t.length,f={},a=[];for(e=0;e<i;e++)for(n in o=s[t[e].offset]||{})o.hasOwnProperty(n)&&(f[n]=!0);for(e in f)f.hasOwnProperty(e)&&a.push(r[e]);return a}function w(t){return(t||"").toLowerCase().replace(/\//g,"_")}function y(t){var e,o,s,i;for("string"==typeof t&&(t=[t]),e=0;e<t.length;e++)i=w(o=(s=t[e].split("|"))[0]),n[i]=t[e],r[i]=o,g(i,s[2].split(" "))}function S(t,e){t=w(t);var s,i=n[t];return i instanceof p?i:"string"==typeof i?(i=new p(i),n[t]=i,i):o[t]&&e!==S&&(s=S(o[t],S))?((i=n[t]=new p)._set(s),i.name=r[t],i):null}function O(t){var e,n,s,i;for("string"==typeof t&&(t=[t]),e=0;e<t.length;e++)s=w((n=t[e].split("|"))[0]),i=w(n[1]),o[s]=i,r[s]=n[0],o[i]=s,r[i]=n[1]}function M(t){var e="X"===t._f||"x"===t._f;return!(!t._a||void 0!==t._tzm||e)}function A(t){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(t)}function j(e){var n=Array.prototype.slice.call(arguments,0,-1),o=arguments[arguments.length-1],r=S(o),s=t.utc.apply(null,n);return r&&!t.isMoment(e)&&M(s)&&s.add(r.parse(s),"minutes"),s.tz(o),s}(f<2||2===f&&a<6)&&A("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js "+t.version+". See momentjs.com"),p.prototype={_set:function(t){this.name=t.name,this.abbrs=t.abbrs,this.untils=t.untils,this.offsets=t.offsets,this.population=t.population},_index:function(t){var e,n=+t,o=this.untils;for(e=0;e<o.length;e++)if(n<o[e])return e},parse:function(t){var e,n,o,r,s=+t,i=this.offsets,f=this.untils,a=f.length-1;for(r=0;r<a;r++)if(e=i[r],n=i[r+1],o=i[r?r-1:r],e<n&&j.moveAmbiguousForward?e=n:e>o&&j.moveInvalidForward&&(e=o),s<f[r]-6e4*e)return i[r];return i[a]},abbr:function(t){return this.abbrs[this._index(t)]},offset:function(t){return A("zone.offset has been deprecated in favor of zone.utcOffset"),this.offsets[this._index(t)]},utcOffset:function(t){return this.offsets[this._index(t)]}},v.prototype.scoreOffsetAt=function(t){this.offsetScore+=Math.abs(this.zone.utcOffset(t.at)-t.offset),this.zone.abbr(t.at).replace(/[^A-Z]/g,"")!==t.abbr&&this.abbrScore++},j.version="0.5.23",j.dataVersion="",j._zones=n,j._links=o,j._names=r,j.add=y,j.link=O,j.load=function(t){y(t.zones),O(t.links),j.dataVersion=t.version},j.zone=S,j.zoneExists=function t(e){return t.didShowError||(t.didShowError=!0,A("moment.tz.zoneExists('"+e+"') has been deprecated in favor of !moment.tz.zone('"+e+"')")),!!S(e)},j.guess=function(t){return e&&!t||(e=function(){try{var t=Intl.DateTimeFormat().resolvedOptions().timeZone;if(t&&t.length>3){var e=r[w(t)];if(e)return e;A("Moment Timezone found "+t+" from the Intl api, but did not have that data loaded.")}}catch(t){}var n,o,s,i=function(){var t,e,n,o=(new Date).getFullYear()-2,r=new d(new Date(o,0,1)),s=[r];for(n=1;n<48;n++)(e=new d(new Date(o,n,1))).offset!==r.offset&&(t=z(r,e),s.push(t),s.push(new d(new Date(t.at+6e4)))),r=e;for(n=0;n<4;n++)s.push(new d(new Date(o+n,0,1))),s.push(new d(new Date(o+n,6,1)));return s}(),f=i.length,a=_(i),u=[];for(o=0;o<a.length;o++){for(n=new v(S(a[o]),f),s=0;s<f;s++)n.scoreOffsetAt(i[s]);u.push(n)}return u.sort(b),u.length>0?u[0].zone.name:void 0}()),e},j.names=function(){var t,e=[];for(t in r)r.hasOwnProperty(t)&&(n[t]||n[o[t]])&&r[t]&&e.push(r[t]);return e.sort()},j.Zone=p,j.unpack=m,j.unpackBase60=c,j.needsOffset=M,j.moveInvalidForward=!0,j.moveAmbiguousForward=!1;var T,D=t.fn;function x(t){return function(){return this._z?this._z.abbr(this):t.call(this)}}t.tz=j,t.defaultZone=null,t.updateOffset=function(e,n){var o,r=t.defaultZone;void 0===e._z&&(r&&M(e)&&!e._isUTC&&(e._d=t.utc(e._a)._d,e.utc().add(r.parse(e),"minutes")),e._z=r),e._z&&(o=e._z.utcOffset(e),Math.abs(o)<16&&(o/=60),void 0!==e.utcOffset?e.utcOffset(-o,n):e.zone(o,n))},D.tz=function(e,n){if(e){if("string"!=typeof e)throw new Error("Time zone name must be a string, got "+e+" ["+typeof e+"]");return this._z=S(e),this._z?t.updateOffset(this,n):A("Moment Timezone has no data for "+e+". See http://momentjs.com/timezone/docs/#/data-loading/."),this}if(this._z)return this._z.name},D.zoneName=x(D.zoneName),D.zoneAbbr=x(D.zoneAbbr),D.utc=(T=D.utc,function(){return this._z=null,T.apply(this,arguments)}),t.tz.setDefault=function(e){return(f<2||2===f&&a<9)&&A("Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js "+t.version+"."),t.defaultZone=e?S(e):null,t};var Z=t.momentProperties;return"[object Array]"===Object.prototype.toString.call(Z)?(Z.push("_z"),Z.push("_a")):Z&&(Z._z=null),t})); |