mirror of
https://github.com/penpot/penpot.git
synced 2025-01-23 15:09:10 -05:00
1 line
No EOL
9.9 KiB
JavaScript
1 line
No EOL
9.9 KiB
JavaScript
!function(){"use strict";var e="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t=function(e){var t=new Date(e.getTime()),n=t.getTimezoneOffset();return t.setSeconds(0,0),6e4*n+t.getTime()%6e4};var n=function(e){return e instanceof Date},r=36e5,a=6e4,o=2,u=/[T ]/,i=/:/,s=/^(\d{2})$/,f=[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],c=/^(\d{4})/,l=[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],d=/^-(\d{2})$/,g=/^-?(\d{3})$/,h=/^-?(\d{2})-?(\d{2})$/,v=/^-?W(\d{2})$/,m=/^-?W(\d{2})-?(\d{1})$/,D=/^(\d{2}([.,]\d*)?)$/,M=/^(\d{2}):?(\d{2}([.,]\d*)?)$/,T=/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,p=/([Z+-].*)$/,y=/^(Z)$/,S=/^([+-])(\d{2})$/,x=/^([+-])(\d{2}):?(\d{2})$/;function Y(e,t,n){t=t||0,n=n||0;var r=new Date(0);r.setUTCFullYear(e,0,4);var a=7*t+n+1-(r.getUTCDay()||7);return r.setUTCDate(r.getUTCDate()+a),r}var w=function(e,w){if(n(e))return new Date(e.getTime());if("string"!=typeof e)return new Date(e);var b=(w||{}).additionalDigits;b=null==b?o:Number(b);var F=function(e){var t,n={},r=e.split(u);i.test(r[0])?(n.date=null,t=r[0]):(n.date=r[0],t=r[1]);if(t){var a=p.exec(t);a?(n.time=t.replace(a[1],""),n.timezone=a[1]):n.time=t}return n}(e),H=function(e,t){var n,r=f[t],a=l[t];if(n=c.exec(e)||a.exec(e)){var o=n[1];return{year:parseInt(o,10),restDateString:e.slice(o.length)}}if(n=s.exec(e)||r.exec(e)){var u=n[1];return{year:100*parseInt(u,10),restDateString:e.slice(u.length)}}return{year:null}}(F.date,b),I=H.year,X=function(e,t){if(null===t)return null;var n,r,a,o;if(0===e.length)return(r=new Date(0)).setUTCFullYear(t),r;if(n=d.exec(e))return r=new Date(0),a=parseInt(n[1],10)-1,r.setUTCFullYear(t,a),r;if(n=g.exec(e)){r=new Date(0);var u=parseInt(n[1],10);return r.setUTCFullYear(t,0,u),r}if(n=h.exec(e)){r=new Date(0),a=parseInt(n[1],10)-1;var i=parseInt(n[2],10);return r.setUTCFullYear(t,a,i),r}if(n=v.exec(e))return o=parseInt(n[1],10)-1,Y(t,o);if(n=m.exec(e)){o=parseInt(n[1],10)-1;var s=parseInt(n[2],10)-1;return Y(t,o,s)}return null}(H.restDateString,I);if(X){var W,$=X.getTime(),z=0;if(F.time&&(z=function(e){var t,n,o;if(t=D.exec(e))return(n=parseFloat(t[1].replace(",",".")))%24*r;if(t=M.exec(e))return n=parseInt(t[1],10),o=parseFloat(t[2].replace(",",".")),n%24*r+o*a;if(t=T.exec(e)){n=parseInt(t[1],10),o=parseInt(t[2],10);var u=parseFloat(t[3].replace(",","."));return n%24*r+o*a+1e3*u}return null}(F.time)),F.timezone)W=function(e){var t,n;if(t=y.exec(e))return 0;if(t=S.exec(e))return n=60*parseInt(t[2],10),"+"===t[1]?-n:n;if(t=x.exec(e))return n=60*parseInt(t[2],10)+parseInt(t[3],10),"+"===t[1]?-n:n;return 0}(F.timezone)*a;else{var G=$+z,O=new Date(G);W=t(O);var E=new Date(G);E.setDate(O.getDate()+1);var Z=t(E)-t(O);Z>0&&(W+=Z)}return new Date($+z+W)}return new Date(e)};var b=function(e){var t=w(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n};var F=function(e){var t=w(e);return t.setHours(0,0,0,0),t},H=6e4,I=864e5;var X=function(e,t){var n=F(e),r=F(t),a=n.getTime()-n.getTimezoneOffset()*H,o=r.getTime()-r.getTimezoneOffset()*H;return Math.round((a-o)/I)};var W=function(e){var t=w(e);return X(t,b(t))+1};var $=function(e,t){var n=t&&Number(t.weekStartsOn)||0,r=w(e),a=r.getDay(),o=(a<n?7:0)+a-n;return r.setDate(r.getDate()-o),r.setHours(0,0,0,0),r};var z=function(e){return $(e,{weekStartsOn:1})};var G=function(e){var t=w(e),n=t.getFullYear(),r=new Date(0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);var a=z(r),o=new Date(0);o.setFullYear(n,0,4),o.setHours(0,0,0,0);var u=z(o);return t.getTime()>=a.getTime()?n+1:t.getTime()>=u.getTime()?n:n-1};var O=function(e){var t=G(e),n=new Date(0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),z(n)},E=6048e5;var Z=function(e){var t=w(e),n=z(t).getTime()-O(t).getTime();return Math.round(n/E)+1};var A=function(e){if(n(e))return!isNaN(e);throw new TypeError(toString.call(e)+" is not an instance of Date")};var C=["M","MM","Q","D","DD","DDD","DDDD","d","E","W","WW","YY","YYYY","GG","GGGG","H","HH","h","hh","m","mm","s","ss","S","SS","SSS","Z","ZZ","X","x"];var U=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);var r=C.concat(t).sort().reverse();return new RegExp("(\\[[^\\[]*\\])|(\\\\)?("+r.join("|")+"|.)","g")};var N=function(){var e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],t=["January","February","March","April","May","June","July","August","September","October","November","December"],n=["Su","Mo","Tu","We","Th","Fr","Sa"],r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],a=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],o=["AM","PM"],u=["am","pm"],i=["a.m.","p.m."],s={MMM:function(t){return e[t.getMonth()]},MMMM:function(e){return t[e.getMonth()]},dd:function(e){return n[e.getDay()]},ddd:function(e){return r[e.getDay()]},dddd:function(e){return a[e.getDay()]},A:function(e){return e.getHours()/12>=1?o[1]:o[0]},a:function(e){return e.getHours()/12>=1?u[1]:u[0]},aa:function(e){return e.getHours()/12>=1?i[1]:i[0]}};return["M","D","DDD","d","Q","W"].forEach((function(e){s[e+"o"]=function(t,n){return function(e){var t=e%100;if(t>20||t<10)switch(t%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"}(n[e](t))}})),{formatters:s,formattingTokensRegExp:U(s)}},k={distanceInWords:function(){var e={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};return{localize:function(t,n,r){var a;return r=r||{},a="string"==typeof e[t]?e[t]:1===n?e[t].one:e[t].other.replace("{{count}}",n),r.addSuffix?r.comparison>0?"in "+a:a+" ago":a}}}(),format:N()};var J={M:function(e){return e.getMonth()+1},MM:function(e){return P(e.getMonth()+1,2)},Q:function(e){return Math.ceil((e.getMonth()+1)/3)},D:function(e){return e.getDate()},DD:function(e){return P(e.getDate(),2)},DDD:function(e){return W(e)},DDDD:function(e){return P(W(e),3)},d:function(e){return e.getDay()},E:function(e){return e.getDay()||7},W:function(e){return Z(e)},WW:function(e){return P(Z(e),2)},YY:function(e){return P(e.getFullYear(),4).substr(2)},YYYY:function(e){return P(e.getFullYear(),4)},GG:function(e){return String(G(e)).substr(2)},GGGG:function(e){return G(e)},H:function(e){return e.getHours()},HH:function(e){return P(e.getHours(),2)},h:function(e){var t=e.getHours();return 0===t?12:t>12?t%12:t},hh:function(e){return P(J.h(e),2)},m:function(e){return e.getMinutes()},mm:function(e){return P(e.getMinutes(),2)},s:function(e){return e.getSeconds()},ss:function(e){return P(e.getSeconds(),2)},S:function(e){return Math.floor(e.getMilliseconds()/100)},SS:function(e){return P(Math.floor(e.getMilliseconds()/10),2)},SSS:function(e){return P(e.getMilliseconds(),3)},Z:function(e){return Q(e.getTimezoneOffset(),":")},ZZ:function(e){return Q(e.getTimezoneOffset())},X:function(e){return Math.floor(e.getTime()/1e3)},x:function(e){return e.getTime()}};function R(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|]$/g,""):e.replace(/\\/g,"")}function Q(e,t){t=t||"";var n=e>0?"-":"+",r=Math.abs(e),a=r%60;return n+P(Math.floor(r/60),2)+t+P(a,2)}function P(e,t){for(var n=Math.abs(e).toString();n.length<t;)n="0"+n;return n}var j=function(e,t,n){var r=t?String(t):"YYYY-MM-DDTHH:mm:ss.SSSZ",a=(n||{}).locale,o=k.format.formatters,u=k.format.formattingTokensRegExp;a&&a.format&&a.format.formatters&&(o=a.format.formatters,a.format.formattingTokensRegExp&&(u=a.format.formattingTokensRegExp));var i=w(e);return A(i)?function(e,t,n){var r,a,o=e.match(n),u=o.length;for(r=0;r<u;r++)a=t[o[r]]||J[o[r]],o[r]=a||R(o[r]);return function(e){for(var t="",n=0;n<u;n++)o[n]instanceof Function?t+=o[n](e,J):t+=o[n];return t}}(r,o,u)(i):"Invalid Date"};var B=function(e,t){var n=w(e).getTime(),r=w(t).getTime();return n>r?-1:n<r?1:0};var q=function(e,t){var n=w(e),r=w(t);return n.getTime()-r.getTime()};var K=function(e,t){var n=q(e,t)/1e3;return n>0?Math.floor(n):Math.ceil(n)};var L=function(e,t){var n=w(e),r=w(t);return 12*(n.getFullYear()-r.getFullYear())+(n.getMonth()-r.getMonth())};var V=function(e,t){var n=w(e).getTime(),r=w(t).getTime();return n<r?-1:n>r?1:0};var _=function(e,t){var n=w(e),r=w(t),a=V(n,r),o=Math.abs(L(n,r));return n.setMonth(n.getMonth()-a*o),a*(o-(V(n,r)===-a))},ee=1440,te=2520,ne=43200,re=86400;var ae=function(e,t,n){var r=n||{},a=B(e,t),o=r.locale,u=k.distanceInWords.localize;o&&o.distanceInWords&&o.distanceInWords.localize&&(u=o.distanceInWords.localize);var i,s,f={addSuffix:Boolean(r.addSuffix),comparison:a};a>0?(i=w(e),s=w(t)):(i=w(t),s=w(e));var c,l=K(s,i),d=s.getTimezoneOffset()-i.getTimezoneOffset(),g=Math.round(l/60)-d;if(g<2)return r.includeSeconds?l<5?u("lessThanXSeconds",5,f):l<10?u("lessThanXSeconds",10,f):l<20?u("lessThanXSeconds",20,f):l<40?u("halfAMinute",null,f):u(l<60?"lessThanXMinutes":"xMinutes",1,f):0===g?u("lessThanXMinutes",1,f):u("xMinutes",g,f);if(g<45)return u("xMinutes",g,f);if(g<90)return u("aboutXHours",1,f);if(g<ee)return u("aboutXHours",Math.round(g/60),f);if(g<te)return u("xDays",1,f);if(g<ne)return u("xDays",Math.round(g/ee),f);if(g<re)return u("aboutXMonths",c=Math.round(g/ne),f);if((c=_(s,i))<12)return u("xMonths",Math.round(g/ne),f);var h=c%12,v=Math.floor(c/12);return h<3?u("aboutXYears",v,f):h<9?u("overXYears",v,f):u("almostXYears",v+1,f)};var oe=function(e,t){return ae(Date.now(),e,t)};if("undefined"!=typeof self)ue(self);else if(void 0!==e)ue(e);else{if("undefined"==typeof window)throw new Error("unsupported execution environment");ue(window)}function ue(e){e.dateFns={format:j,distanceInWordsToNow:oe}}}(); |