├── README.md ├── www ├── worker.js ├── monokai.css ├── crono.js ├── index.html └── highlight.pack.js ├── LICENSE ├── dist └── crono.js └── src └── crono.js /README.md: -------------------------------------------------------------------------------- 1 | # crono 2 | A simple and minimalistic timeago library without dependencies 3 | -------------------------------------------------------------------------------- /www/worker.js: -------------------------------------------------------------------------------- 1 | onmessage = function (event) { 2 | importScripts('highlight.pack.js') 3 | var result = self.hljs.highlightAuto(event.data) 4 | postMessage(result.value) 5 | } 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Miguel Ángel 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /www/monokai.css: -------------------------------------------------------------------------------- 1 | /* 2 | Monokai style - ported by Luigi Maselli - http://grigio.org 3 | */ 4 | 5 | .hljs { 6 | display: block; 7 | overflow-x: auto; 8 | padding: 0.5em; 9 | background: #272822; color: #ddd; 10 | } 11 | 12 | .hljs-tag, 13 | .hljs-keyword, 14 | .hljs-selector-tag, 15 | .hljs-literal, 16 | .hljs-strong, 17 | .hljs-name { 18 | color: #f92672; 19 | } 20 | 21 | .hljs-code { 22 | color: #66d9ef; 23 | } 24 | 25 | .hljs-class .hljs-title { 26 | color: white; 27 | } 28 | 29 | .hljs-attribute, 30 | .hljs-symbol, 31 | .hljs-regexp, 32 | .hljs-link { 33 | color: #bf79db; 34 | } 35 | 36 | .hljs-string, 37 | .hljs-bullet, 38 | .hljs-subst, 39 | .hljs-title, 40 | .hljs-section, 41 | .hljs-emphasis, 42 | .hljs-type, 43 | .hljs-built_in, 44 | .hljs-builtin-name, 45 | .hljs-selector-attr, 46 | .hljs-selector-pseudo, 47 | .hljs-addition, 48 | .hljs-variable, 49 | .hljs-template-tag, 50 | .hljs-template-variable { 51 | color: #a6e22e; 52 | } 53 | 54 | .hljs-comment, 55 | .hljs-quote, 56 | .hljs-deletion, 57 | .hljs-meta { 58 | color: #75715e; 59 | } 60 | 61 | .hljs-keyword, 62 | .hljs-selector-tag, 63 | .hljs-literal, 64 | .hljs-doctag, 65 | .hljs-title, 66 | .hljs-section, 67 | .hljs-type, 68 | .hljs-selector-id { 69 | font-weight: bold; 70 | } 71 | -------------------------------------------------------------------------------- /dist/crono.js: -------------------------------------------------------------------------------- 1 | (function (root, factory) { 2 | 'use strict' 3 | 4 | if (typeof define === 'function' && define.amd) { 5 | define(factory) 6 | } else { 7 | root.crono = factory() 8 | } 9 | }(this, function () { 10 | // default options for crono 11 | var defaultOptions = { 12 | locale: { 13 | prefixAgo: null, 14 | prefixFromNow: null, 15 | suffixAgo: 'ago', 16 | suffixFromNow: 'from now', 17 | inPast: 'any moment now', 18 | seconds: 'less than a minute', 19 | minute: 'about a minute', 20 | minutes: '%d minutes', 21 | hour: 'about an hour', 22 | hours: 'about %d hours', 23 | day: 'a day', 24 | days: '%d days', 25 | month: 'about a month', 26 | months: '%d months', 27 | year: 'about a year', 28 | years: '%d years', 29 | wordSeparator: ' ', 30 | numbers: [] 31 | } 32 | } 33 | 34 | function parse (iso8601) { 35 | var s = iso8601.trim() 36 | s = s.replace(/\.\d+/, '') // remove milliseconds 37 | s = s.replace(/-/, '/').replace(/-/, '/') 38 | s = s.replace(/T/, ' ').replace(/Z/, ' UTC') 39 | s = s.replace(/([\+\-]\d\d)\:?(\d\d)/, ' $1$2') // -04:00 -> -0400 40 | s = s.replace(/([\+\-]\d\d)$/, ' $100') // +09 -> +0900 41 | return new Date(s) 42 | } 43 | 44 | function distance (date) { 45 | return (new Date().getTime() - date.getTime()) 46 | } 47 | 48 | function inWords (distanceMillis, options) { 49 | var $l = options.locale 50 | var prefix = $l.prefixAgo 51 | var suffix = $l.suffixAgo 52 | 53 | var seconds = Math.abs(distanceMillis) / 1000 54 | var minutes = seconds / 60 55 | var hours = minutes / 60 56 | var days = hours / 24 57 | var years = days / 365 58 | 59 | function substitute (stringOrFunction, number) { 60 | var string = typeof stringOrFunction === 'string' ? stringOrFunction : stringOrFunction(number, distanceMillis) 61 | var value = ($l.numbers && $l.numbers[number]) || number 62 | return string.replace(/%d/i, value) 63 | } 64 | 65 | var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || 66 | seconds < 90 && substitute($l.minute, 1) || 67 | minutes < 45 && substitute($l.minutes, Math.round(minutes)) || 68 | minutes < 90 && substitute($l.hour, 1) || 69 | hours < 24 && substitute($l.hours, Math.round(hours)) || 70 | hours < 42 && substitute($l.day, 1) || 71 | days < 30 && substitute($l.days, Math.round(days)) || 72 | days < 45 && substitute($l.month, 1) || 73 | days < 365 && substitute($l.months, Math.round(days / 30)) || 74 | years < 1.5 && substitute($l.year, 1) || 75 | substitute($l.years, Math.round(years)) 76 | 77 | var separator = $l.wordSeparator || '' 78 | if ($l.wordSeparator === undefined) { separator = ' ' } 79 | return [prefix, words, suffix].join(separator).trim() 80 | } 81 | // create a variable crono 82 | return function (selector, options) { 83 | options = options || defaultOptions 84 | var elements = document.querySelectorAll(selector) 85 | console.log(elements) 86 | for (var i = 0; i < elements.length; i++) { 87 | var date = elements[i].getAttribute('datetime') 88 | var iso8601Date = parse(date) 89 | elements[i].innerHTML = inWords(distance(iso8601Date), options) 90 | } 91 | } 92 | })) 93 | -------------------------------------------------------------------------------- /www/crono.js: -------------------------------------------------------------------------------- 1 | (function (root, factory) { 2 | 'use strict' 3 | 4 | if (typeof define === 'function' && define.amd) { 5 | define(factory) 6 | } else { 7 | root.crono = factory() 8 | } 9 | }(this, function () { 10 | // default options for crono 11 | var defaultOptions = { 12 | locale: { 13 | prefixAgo: null, 14 | prefixFromNow: null, 15 | suffixAgo: 'ago', 16 | suffixFromNow: 'from now', 17 | inPast: 'any moment now', 18 | seconds: 'less than a minute', 19 | minute: 'about a minute', 20 | minutes: '%d minutes', 21 | hour: 'about an hour', 22 | hours: 'about %d hours', 23 | day: 'a day', 24 | days: '%d days', 25 | month: 'about a month', 26 | months: '%d months', 27 | year: 'about a year', 28 | years: '%d years', 29 | wordSeparator: ' ', 30 | numbers: [] 31 | } 32 | } 33 | 34 | function parse (iso8601) { 35 | var s = iso8601.trim() 36 | s = s.replace(/\.\d+/, '') // remove milliseconds 37 | s = s.replace(/-/, '/').replace(/-/, '/') 38 | s = s.replace(/T/, ' ').replace(/Z/, ' UTC') 39 | s = s.replace(/([\+\-]\d\d)\:?(\d\d)/, ' $1$2') // -04:00 -> -0400 40 | s = s.replace(/([\+\-]\d\d)$/, ' $100') // +09 -> +0900 41 | return new Date(s) 42 | } 43 | 44 | function distance (date) { 45 | return (new Date().getTime() - date.getTime()) 46 | } 47 | 48 | function inWords (distanceMillis, options) { 49 | var $l = options.locale 50 | var prefix = $l.prefixAgo 51 | var suffix = $l.suffixAgo 52 | 53 | var seconds = Math.abs(distanceMillis) / 1000 54 | var minutes = seconds / 60 55 | var hours = minutes / 60 56 | var days = hours / 24 57 | var years = days / 365 58 | 59 | function substitute (stringOrFunction, number) { 60 | var string = typeof stringOrFunction === 'string' ? stringOrFunction : stringOrFunction(number, distanceMillis) 61 | var value = ($l.numbers && $l.numbers[number]) || number 62 | return string.replace(/%d/i, value) 63 | } 64 | 65 | var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || 66 | seconds < 90 && substitute($l.minute, 1) || 67 | minutes < 45 && substitute($l.minutes, Math.round(minutes)) || 68 | minutes < 90 && substitute($l.hour, 1) || 69 | hours < 24 && substitute($l.hours, Math.round(hours)) || 70 | hours < 42 && substitute($l.day, 1) || 71 | days < 30 && substitute($l.days, Math.round(days)) || 72 | days < 45 && substitute($l.month, 1) || 73 | days < 365 && substitute($l.months, Math.round(days / 30)) || 74 | years < 1.5 && substitute($l.year, 1) || 75 | substitute($l.years, Math.round(years)) 76 | 77 | var separator = $l.wordSeparator || '' 78 | if ($l.wordSeparator === undefined) { separator = ' ' } 79 | return [prefix, words, suffix].join(separator).trim() 80 | } 81 | // create a variable crono 82 | return function (selector, options) { 83 | options = options || defaultOptions 84 | var elements = document.querySelectorAll(selector) 85 | console.log(elements) 86 | for (var i = 0; i < elements.length; i++) { 87 | var date = elements[i].getAttribute('datetime') 88 | var iso8601Date = parse(date) 89 | elements[i].innerHTML = inWords(distance(iso8601Date), options) 90 | } 91 | } 92 | })) 93 | -------------------------------------------------------------------------------- /src/crono.js: -------------------------------------------------------------------------------- 1 | (function (root, factory) { 2 | 'use strict' 3 | 4 | if (typeof window.define === 'function' && window.define.amd) { 5 | window.define(factory) 6 | } else { 7 | root.crono = factory() 8 | } 9 | }(this, function () { 10 | // default options for crono 11 | var defaultOptions = { 12 | locale: { 13 | prefixAgo: null, 14 | prefixFromNow: null, 15 | suffixAgo: 'ago', 16 | suffixFromNow: 'from now', 17 | inPast: 'any moment now', 18 | seconds: 'less than a minute', 19 | minute: 'about a minute', 20 | minutes: '%d minutes', 21 | hour: 'about an hour', 22 | hours: 'about %d hours', 23 | day: 'a day', 24 | days: '%d days', 25 | month: 'about a month', 26 | months: '%d months', 27 | year: 'about a year', 28 | years: '%d years', 29 | wordSeparator: ' ', 30 | numbers: [] 31 | } 32 | } 33 | 34 | function parse (iso8601) { 35 | var s = iso8601.trim() 36 | s = s.replace(/\.\d+/, '') // remove milliseconds 37 | s = s.replace(/-/, '/').replace(/-/, '/') 38 | s = s.replace(/T/, ' ').replace(/Z/, ' UTC') 39 | s = s.replace(/([+-]\d\d):?(\d\d)/, ' $1$2') // -04:00 -> -0400 40 | s = s.replace(/([+-]\d\d)$/, ' $100') // +09 -> +0900 41 | return new Date(s) 42 | } 43 | 44 | function distance (date) { 45 | return (new Date().getTime() - date.getTime()) 46 | } 47 | 48 | function inWords (distanceMillis, options) { 49 | var $l = options.locale 50 | var prefix = $l.prefixAgo 51 | var suffix = $l.suffixAgo 52 | 53 | var seconds = Math.abs(distanceMillis) / 1000 54 | var minutes = seconds / 60 55 | var hours = minutes / 60 56 | var days = hours / 24 57 | var years = days / 365 58 | 59 | function substitute (stringOrFunction, number) { 60 | var string = typeof stringOrFunction === 'string' 61 | ? stringOrFunction 62 | : stringOrFunction(number, distanceMillis) 63 | 64 | var value = ($l.numbers && $l.numbers[number]) || number 65 | return string.replace(/%d/i, value) 66 | } 67 | 68 | var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || 69 | seconds < 90 && substitute($l.minute, 1) || 70 | minutes < 45 && substitute($l.minutes, Math.round(minutes)) || 71 | minutes < 90 && substitute($l.hour, 1) || 72 | hours < 24 && substitute($l.hours, Math.round(hours)) || 73 | hours < 42 && substitute($l.day, 1) || 74 | days < 30 && substitute($l.days, Math.round(days)) || 75 | days < 45 && substitute($l.month, 1) || 76 | days < 365 && substitute($l.months, Math.round(days / 30)) || 77 | years < 1.5 && substitute($l.year, 1) || 78 | substitute($l.years, Math.round(years)) 79 | 80 | var separator = $l.wordSeparator || '' 81 | if ($l.wordSeparator === undefined) { separator = ' ' } 82 | return [prefix, words, suffix].join(separator).trim() 83 | } 84 | 85 | // create a variable crono 86 | return function (selector, options) { 87 | options = options || defaultOptions 88 | var elements = document.querySelectorAll(selector) 89 | console.log(elements) 90 | for (var i = 0; i < elements.length; i++) { 91 | var date = elements[i].getAttribute('datetime') 92 | var iso8601Date = parse(date) 93 | elements[i].innerHTML = inWords(distance(iso8601Date), options) 94 | } 95 | } 96 | })) 97 | -------------------------------------------------------------------------------- /www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Crono - A really minimistic timeago library 4 | 126 | 127 |
128 | 129 |

Cronojust a timeago library

130 | 131 |

132 | Crono is a timeago minimalist library that just do what you expect it has to do and without dependencies. 133 |

134 | 135 |

Code:

136 |
137 |       
138 |         <time datetime="2016-01-20T19:27:48.000Z"></time>
139 |       
140 |     
141 | 142 |

Result:

143 | 144 | 145 |

Code:

146 |
147 |       
148 |         <time datetime="2016-01-20T19:27:48.000Z"></time>
149 |       
150 |     
151 | 152 |

Result:

153 | 154 | 155 |

Code:

156 |
157 |       
158 |         <time datetime="2016-01-20T19:27:48.000Z"></time>
159 |       
160 |     
161 | 162 |

Result:

163 | 164 | 165 |

166 | Read the full documentation 167 | for more information about using GitHub Pages. 168 |

169 | 170 |
171 | GitHub Status — 172 | @midudev 173 |
174 | 175 | 178 |
179 | 180 | 189 | 190 | -------------------------------------------------------------------------------- /www/highlight.pack.js: -------------------------------------------------------------------------------- 1 | /*! highlight.js v9.9.0 | BSD3 License | git.io/hljslicense */ 2 | !function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(e){function n(e){return e.replace(/[&<>]/gm,function(e){return I[e]})}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0===t.index}function i(e){return k.test(e)}function a(e){var n,t,r,a,o=e.className+" ";if(o+=e.parentNode?e.parentNode.className:"",t=B.exec(o))return R(t[1])?t[1]:"no-highlight";for(o=o.split(/\s+/),n=0,r=o.length;r>n;n++)if(a=o[n],i(a)||R(a))return a}function o(e,n){var t,r={};for(t in e)r[t]=e[t];if(n)for(t in n)r[t]=n[t];return r}function u(e){var n=[];return function r(e,i){for(var a=e.firstChild;a;a=a.nextSibling)3===a.nodeType?i+=a.nodeValue.length:1===a.nodeType&&(n.push({event:"start",offset:i,node:a}),i=r(a,i),t(a).match(/br|hr|img|input/)||n.push({event:"stop",offset:i,node:a}));return i}(e,0),n}function c(e,r,i){function a(){return e.length&&r.length?e[0].offset!==r[0].offset?e[0].offset"}function u(e){l+=""}function c(e){("start"===e.event?o:u)(e.node)}for(var s=0,l="",f=[];e.length||r.length;){var g=a();if(l+=n(i.substring(s,g[0].offset)),s=g[0].offset,g===e){f.reverse().forEach(u);do c(g.splice(0,1)[0]),g=a();while(g===e&&g.length&&g[0].offset===s);f.reverse().forEach(o)}else"start"===g[0].event?f.push(g[0].node):f.pop(),c(g.splice(0,1)[0])}return l+n(i.substr(s))}function s(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(i,a){if(!i.compiled){if(i.compiled=!0,i.k=i.k||i.bK,i.k){var u={},c=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");u[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof i.k?c("keyword",i.k):E(i.k).forEach(function(e){c(e,i.k[e])}),i.k=u}i.lR=t(i.l||/\w+/,!0),a&&(i.bK&&(i.b="\\b("+i.bK.split(" ").join("|")+")\\b"),i.b||(i.b=/\B|\b/),i.bR=t(i.b),i.e||i.eW||(i.e=/\B|\b/),i.e&&(i.eR=t(i.e)),i.tE=n(i.e)||"",i.eW&&a.tE&&(i.tE+=(i.e?"|":"")+a.tE)),i.i&&(i.iR=t(i.i)),null==i.r&&(i.r=1),i.c||(i.c=[]);var s=[];i.c.forEach(function(e){e.v?e.v.forEach(function(n){s.push(o(e,n))}):s.push("self"===e?i:e)}),i.c=s,i.c.forEach(function(e){r(e,i)}),i.starts&&r(i.starts,a);var l=i.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([i.tE,i.i]).map(n).filter(Boolean);i.t=l.length?t(l.join("|"),!0):{exec:function(){return null}}}}r(e)}function l(e,t,i,a){function o(e,n){var t,i;for(t=0,i=n.c.length;i>t;t++)if(r(n.c[t].bR,e))return n.c[t]}function u(e,n){if(r(e.eR,n)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?u(e.parent,n):void 0}function c(e,n){return!i&&r(n.iR,e)}function g(e,n){var t=N.cI?n[0].toLowerCase():n[0];return e.k.hasOwnProperty(t)&&e.k[t]}function h(e,n,t,r){var i=r?"":y.classPrefix,a='',a+n+o}function p(){var e,t,r,i;if(!E.k)return n(B);for(i="",t=0,E.lR.lastIndex=0,r=E.lR.exec(B);r;)i+=n(B.substring(t,r.index)),e=g(E,r),e?(M+=e[1],i+=h(e[0],n(r[0]))):i+=n(r[0]),t=E.lR.lastIndex,r=E.lR.exec(B);return i+n(B.substr(t))}function d(){var e="string"==typeof E.sL;if(e&&!x[E.sL])return n(B);var t=e?l(E.sL,B,!0,L[E.sL]):f(B,E.sL.length?E.sL:void 0);return E.r>0&&(M+=t.r),e&&(L[E.sL]=t.top),h(t.language,t.value,!1,!0)}function b(){k+=null!=E.sL?d():p(),B=""}function v(e){k+=e.cN?h(e.cN,"",!0):"",E=Object.create(e,{parent:{value:E}})}function m(e,n){if(B+=e,null==n)return b(),0;var t=o(n,E);if(t)return t.skip?B+=n:(t.eB&&(B+=n),b(),t.rB||t.eB||(B=n)),v(t,n),t.rB?0:n.length;var r=u(E,n);if(r){var i=E;i.skip?B+=n:(i.rE||i.eE||(B+=n),b(),i.eE&&(B=n));do E.cN&&(k+=C),E.skip||(M+=E.r),E=E.parent;while(E!==r.parent);return r.starts&&v(r.starts,""),i.rE?0:n.length}if(c(n,E))throw new Error('Illegal lexeme "'+n+'" for mode "'+(E.cN||"")+'"');return B+=n,n.length||1}var N=R(e);if(!N)throw new Error('Unknown language: "'+e+'"');s(N);var w,E=a||N,L={},k="";for(w=E;w!==N;w=w.parent)w.cN&&(k=h(w.cN,"",!0)+k);var B="",M=0;try{for(var I,j,O=0;;){if(E.t.lastIndex=O,I=E.t.exec(t),!I)break;j=m(t.substring(O,I.index),I[0]),O=I.index+j}for(m(t.substr(O)),w=E;w.parent;w=w.parent)w.cN&&(k+=C);return{r:M,value:k,language:e,top:E}}catch(T){if(T.message&&-1!==T.message.indexOf("Illegal"))return{r:0,value:n(t)};throw T}}function f(e,t){t=t||y.languages||E(x);var r={r:0,value:n(e)},i=r;return t.filter(R).forEach(function(n){var t=l(n,e,!1);t.language=n,t.r>i.r&&(i=t),t.r>r.r&&(i=r,r=t)}),i.language&&(r.second_best=i),r}function g(e){return y.tabReplace||y.useBR?e.replace(M,function(e,n){return y.useBR&&"\n"===e?"
":y.tabReplace?n.replace(/\t/g,y.tabReplace):void 0}):e}function h(e,n,t){var r=n?L[n]:t,i=[e.trim()];return e.match(/\bhljs\b/)||i.push("hljs"),-1===e.indexOf(r)&&i.push(r),i.join(" ").trim()}function p(e){var n,t,r,o,s,p=a(e);i(p)||(y.useBR?(n=document.createElementNS("http://www.w3.org/1999/xhtml","div"),n.innerHTML=e.innerHTML.replace(/\n/g,"").replace(//g,"\n")):n=e,s=n.textContent,r=p?l(p,s,!0):f(s),t=u(n),t.length&&(o=document.createElementNS("http://www.w3.org/1999/xhtml","div"),o.innerHTML=r.value,r.value=c(t,u(o),s)),r.value=g(r.value),e.innerHTML=r.value,e.className=h(e.className,p,r.language),e.result={language:r.language,re:r.r},r.second_best&&(e.second_best={language:r.second_best.language,re:r.second_best.r}))}function d(e){y=o(y,e)}function b(){if(!b.called){b.called=!0;var e=document.querySelectorAll("pre code");w.forEach.call(e,p)}}function v(){addEventListener("DOMContentLoaded",b,!1),addEventListener("load",b,!1)}function m(n,t){var r=x[n]=t(e);r.aliases&&r.aliases.forEach(function(e){L[e]=n})}function N(){return E(x)}function R(e){return e=(e||"").toLowerCase(),x[e]||x[L[e]]}var w=[],E=Object.keys,x={},L={},k=/^(no-?highlight|plain|text)$/i,B=/\blang(?:uage)?-([\w-]+)\b/i,M=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,C="
",y={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},I={"&":"&","<":"<",">":">"};return e.highlight=l,e.highlightAuto=f,e.fixMarkup=g,e.highlightBlock=p,e.configure=d,e.initHighlighting=b,e.initHighlightingOnLoad=v,e.registerLanguage=m,e.listLanguages=N,e.getLanguage=R,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},e.C=function(n,t,r){var i=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return i.c.push(e.PWM),i.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),i},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e});hljs.registerLanguage("xml",function(s){var e="[A-Za-z0-9\\._:-]+",t={eW:!0,i:/`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist"],cI:!0,c:[{cN:"meta",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},s.C("",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0}]},{cN:"tag",b:"|$)",e:">",k:{name:"style"},c:[t],starts:{e:"",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"|$)",e:">",k:{name:"script"},c:[t],starts:{e:"",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"meta",v:[{b:/<\?xml/,e:/\?>/,r:10},{b:/<\?\w+/,e:/\?>/}]},{cN:"tag",b:"",c:[{cN:"name",b:/[^\/><\s]+/,r:0},t]}]}});hljs.registerLanguage("css",function(e){var c="[a-zA-Z-][a-zA-Z0-9_-]*",t={b:/[A-Z\_\.\-]+\s*:/,rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:/\S/,e:":",eE:!0,starts:{eW:!0,eE:!0,c:[{b:/[\w-]+\(/,rB:!0,c:[{cN:"built_in",b:/[\w-]+/},{b:/\(/,e:/\)/,c:[e.ASM,e.QSM]}]},e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"number",b:"#[0-9A-Fa-f]+"},{cN:"meta",b:"!important"}]}}]};return{cI:!0,i:/[=\/|'\$]/,c:[e.CBCM,{cN:"selector-id",b:/#[A-Za-z0-9_-]+/},{cN:"selector-class",b:/\.[A-Za-z0-9_-]+/},{cN:"selector-attr",b:/\[/,e:/\]/,i:"$"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{b:"@",e:"[{;]",i:/:/,c:[{cN:"keyword",b:/\w+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[e.ASM,e.QSM,e.CSSNM]}]},{cN:"selector-tag",b:c,r:0},{b:"{",e:"}",i:/\S/,c:[e.CBCM,t]}]}});hljs.registerLanguage("json",function(e){var i={literal:"true false null"},n=[e.QSM,e.CNM],r={e:",",eW:!0,eE:!0,c:n,k:i},t={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(r,{b:/:/})],i:"\\S"},c={b:"\\[",e:"\\]",c:[e.inherit(r)],i:"\\S"};return n.splice(n.length,0,t,c),{c:n,k:i,i:"\\S"}});hljs.registerLanguage("javascript",function(e){var r="[A-Za-z$_][0-9A-Za-z$_]*",t={keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},a={cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},n={cN:"subst",b:"\\$\\{",e:"\\}",k:t,c:[]},c={cN:"string",b:"`",e:"`",c:[e.BE,n]};n.c=[e.ASM,e.QSM,c,a,e.RM];var s=n.c.concat([e.CBCM,e.CLCM]);return{aliases:["js","jsx"],k:t,c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,c,e.CLCM,e.CBCM,a,{b:/[{,]\s*/,r:0,c:[{b:r+"\\s*:",rB:!0,r:0,c:[{cN:"attr",b:r,r:0}]}]},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{cN:"function",b:"(\\(.*?\\)|"+r+")\\s*=>",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:r},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,c:s}]}]},{b://,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:[{b:/<\w+\s*\/>/,skip:!0},"self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:r}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:s}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}}); --------------------------------------------------------------------------------