syriastreet.com/assets/js/lib/underscore.js
2023-10-11 18:20:29 +00:00

1 line
No EOL
14 KiB
JavaScript

!function(){function l(n){return null==n?E.identity:E.isFunction(n)?n:E.property(n)}function n(o){return function(r,e,i){var u={};return e=l(e),F(r,function(n,t){t=e.call(i,n,t,r);o(u,t,n)}),u}}function e(n,t,r){return t&&E.every(n,E.isArray)?h.apply(r,n):(F(n,function(n){E.isArray(n)||E.isArguments(n)?t?f.apply(r,n):e(n,t,r):r.push(n)}),r)}function o(){}function s(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof E&&(n=n._wrapped),t instanceof E&&(t=t._wrapped);var i=y.call(n);if(i!=y.call(t))return!1;switch(i){case"[object String]":return n==String(t);case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var u=r.length;u--;)if(r[u]==n)return e[u]==t;var o=n.constructor,c=t.constructor;if(o!==c&&!(E.isFunction(o)&&o instanceof o&&E.isFunction(c)&&c instanceof c)&&"constructor"in n&&"constructor"in t)return!1;r.push(n),e.push(t);var l=0,a=!0;if("[object Array]"==i){if(a=(l=n.length)==t.length)for(;l--&&(a=s(n[l],t[l],r,e)););}else{for(var f in n)if(E.has(n,f)&&(l++,!(a=E.has(t,f)&&s(n[f],t[f],r,e))))break;if(a){for(f in t)if(E.has(t,f)&&!l--)break;a=!l}}return r.pop(),e.pop(),a}var t=this,r=t._,c={},i=Array.prototype,u=Object.prototype,a=Function.prototype,f=i.push,p=i.slice,h=i.concat,y=u.toString,d=u.hasOwnProperty,v=i.forEach,g=i.map,m=i.reduce,b=i.reduceRight,x=i.filter,w=i.every,_=i.some,j=i.indexOf,A=i.lastIndexOf,u=Array.isArray,O=Object.keys,k=a.bind,E=function(n){return n instanceof E?n:this instanceof E?void(this._wrapped=n):new E(n)},F=("undefined"!=typeof exports?(exports="undefined"!=typeof module&&module.exports?module.exports=E:exports)._=E:t._=E,E.VERSION="1.6.0",E.each=E.forEach=function(n,t,r){if(null!=n)if(v&&n.forEach===v)n.forEach(t,r);else if(n.length===+n.length){for(var e=0,i=n.length;e<i;e++)if(t.call(r,n[e],e,n)===c)return}else for(var u=E.keys(n),e=0,i=u.length;e<i;e++)if(t.call(r,n[u[e]],u[e],n)===c)return;return n}),M=(E.map=E.collect=function(n,e,i){var u=[];if(null!=n){if(g&&n.map===g)return n.map(e,i);F(n,function(n,t,r){u.push(e.call(i,n,t,r))})}return u},"Reduce of empty array with no initial value"),R=(E.reduce=E.foldl=E.inject=function(n,e,i,u){var o=2<arguments.length;if(null==n&&(n=[]),m&&n.reduce===m)return u&&(e=E.bind(e,u)),o?n.reduce(e,i):n.reduce(e);if(F(n,function(n,t,r){o?i=e.call(u,i,n,t,r):(i=n,o=!0)}),o)return i;throw new TypeError(M)},E.reduceRight=E.foldr=function(e,i,u,o){var c=2<arguments.length;if(null==e&&(e=[]),b&&e.reduceRight===b)return o&&(i=E.bind(i,o)),c?e.reduceRight(i,u):e.reduceRight(i);var l,a=e.length;if(a!==+a&&(l=E.keys(e),a=l.length),F(e,function(n,t,r){t=l?l[--a]:--a,c?u=i.call(o,u,e[t],t,r):(u=e[t],c=!0)}),c)return u;throw new TypeError(M)},E.find=E.detect=function(n,e,i){var u;return R(n,function(n,t,r){if(e.call(i,n,t,r))return u=n,!0}),u},E.filter=E.select=function(n,e,i){var u=[];if(null!=n){if(x&&n.filter===x)return n.filter(e,i);F(n,function(n,t,r){e.call(i,n,t,r)&&u.push(n)})}return u},E.reject=function(n,e,i){return E.filter(n,function(n,t,r){return!e.call(i,n,t,r)},i)},E.every=E.all=function(n,e,i){e=e||E.identity;var u=!0;return null==n?u:w&&n.every===w?n.every(e,i):(F(n,function(n,t,r){if(!(u=u&&e.call(i,n,t,r)))return c}),!!u)},E.some=E.any=function(n,e,i){e=e||E.identity;var u=!1;return null==n?u:_&&n.some===_?n.some(e,i):(F(n,function(n,t,r){if(u=u||e.call(i,n,t,r))return c}),!!u)}),S=(E.contains=E.include=function(n,t){return null!=n&&(j&&n.indexOf===j?-1!=n.indexOf(t):R(n,function(n){return n===t}))},E.invoke=function(n,t){var r=p.call(arguments,2),e=E.isFunction(t);return E.map(n,function(n){return(e?t:n[t]).apply(n,r)})},E.pluck=function(n,t){return E.map(n,E.property(t))},E.where=function(n,t){return E.filter(n,E.matches(t))},E.findWhere=function(n,t){return E.find(n,E.matches(t))},E.max=function(n,e,i){var u,o;return!e&&E.isArray(n)&&n[0]===+n[0]&&n.length<65535?Math.max.apply(Math,n):(o=u=-1/0,F(n,function(n,t,r){t=e?e.call(i,n,t,r):n;o<t&&(u=n,o=t)}),u)},E.min=function(n,e,i){var u,o;return!e&&E.isArray(n)&&n[0]===+n[0]&&n.length<65535?Math.min.apply(Math,n):(o=u=1/0,F(n,function(n,t,r){t=e?e.call(i,n,t,r):n;t<o&&(u=n,o=t)}),u)},E.shuffle=function(n){var t,r=0,e=[];return F(n,function(n){t=E.random(r++),e[r-1]=e[t],e[t]=n}),e},E.sample=function(n,t,r){return null==t||r?(n=n.length!==+n.length?E.values(n):n)[E.random(n.length-1)]:E.shuffle(n).slice(0,Math.max(0,t))},E.sortBy=function(n,e,i){return e=l(e),E.pluck(E.map(n,function(n,t,r){return{value:n,index:t,criteria:e.call(i,n,t,r)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(e<r||void 0===r)return 1;if(r<e||void 0===e)return-1}return n.index-t.index}),"value")},E.groupBy=n(function(n,t,r){E.has(n,t)?n[t].push(r):n[t]=[r]}),E.indexBy=n(function(n,t,r){n[t]=r}),E.countBy=n(function(n,t){E.has(n,t)?n[t]++:n[t]=1}),E.sortedIndex=function(n,t,r,e){for(var i=(r=l(r)).call(e,t),u=0,o=n.length;u<o;){var c=u+o>>>1;r.call(e,n[c])<i?u=1+c:o=c}return u},E.toArray=function(n){return n?E.isArray(n)?p.call(n):n.length===+n.length?E.map(n,E.identity):E.values(n):[]},E.size=function(n){return null==n?0:(n.length===+n.length?n:E.keys(n)).length},E.first=E.head=E.take=function(n,t,r){if(null!=n)return null==t||r?n[0]:t<0?[]:p.call(n,0,t)},E.initial=function(n,t,r){return p.call(n,0,n.length-(null==t||r?1:t))},E.last=function(n,t,r){if(null!=n)return null==t||r?n[n.length-1]:p.call(n,Math.max(n.length-t,0))},E.rest=E.tail=E.drop=function(n,t,r){return p.call(n,null==t||r?1:t)},E.compact=function(n){return E.filter(n,E.identity)},E.flatten=function(n,t){return e(n,t,[])},E.without=function(n){return E.difference(n,p.call(arguments,1))},E.partition=function(n,t){var r=[],e=[];return F(n,function(n){(t(n)?r:e).push(n)}),[r,e]},E.uniq=E.unique=function(r,e,n,t){E.isFunction(e)&&(t=n,n=e,e=!1);var n=n?E.map(r,n,t):r,i=[],u=[];return F(n,function(n,t){(e?t&&u[u.length-1]===n:E.contains(u,n))||(u.push(n),i.push(r[t]))}),i},E.union=function(){return E.uniq(E.flatten(arguments,!0))},E.intersection=function(n){var r=p.call(arguments,1);return E.filter(E.uniq(n),function(t){return E.every(r,function(n){return E.contains(n,t)})})},E.difference=function(n){var t=h.apply(i,p.call(arguments,1));return E.filter(n,function(n){return!E.contains(t,n)})},E.zip=function(){for(var n=E.max(E.pluck(arguments,"length").concat(0)),t=new Array(n),r=0;r<n;r++)t[r]=E.pluck(arguments,""+r);return t},E.object=function(n,t){if(null==n)return{};for(var r={},e=0,i=n.length;e<i;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},E.indexOf=function(n,t,r){if(null!=n){var e=0,i=n.length;if(r){if("number"!=typeof r)return n[e=E.sortedIndex(n,t)]===t?e:-1;e=r<0?Math.max(0,i+r):r}if(j&&n.indexOf===j)return n.indexOf(t,r);for(;e<i;e++)if(n[e]===t)return e}return-1},E.lastIndexOf=function(n,t,r){if(null!=n){var e=null!=r;if(A&&n.lastIndexOf===A)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var i=e?r:n.length;i--;)if(n[i]===t)return i}return-1},E.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),i=0,u=new Array(e);i<e;)u[i++]=n,n+=r;return u},E.bind=function(r,e){var i,u;if(k&&r.bind===k)return k.apply(r,p.call(arguments,1));if(E.isFunction(r))return i=p.call(arguments,2),u=function(){if(!(this instanceof u))return r.apply(e,i.concat(p.call(arguments)));o.prototype=r.prototype;var n=new o,t=(o.prototype=null,r.apply(n,i.concat(p.call(arguments))));return Object(t)===t?t:n};throw new TypeError},E.partial=function(i){var u=p.call(arguments,1);return function(){for(var n=0,t=u.slice(),r=0,e=t.length;r<e;r++)t[r]===E&&(t[r]=arguments[n++]);for(;n<arguments.length;)t.push(arguments[n++]);return i.apply(this,t)}},E.bindAll=function(t){var n=p.call(arguments,1);if(0===n.length)throw new Error("bindAll must be passed function names");return F(n,function(n){t[n]=E.bind(t[n],t)}),t},E.memoize=function(t,r){var e={};return r=r||E.identity,function(){var n=r.apply(this,arguments);return E.has(e,n)?e[n]:e[n]=t.apply(this,arguments)}},E.delay=function(n,t){var r=p.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},E.defer=function(n){return E.delay.apply(E,[n,1].concat(p.call(arguments,1)))},E.throttle=function(r,e,i){function u(){f=!1===i.leading?0:E.now(),a=null,l=r.apply(o,c),o=c=null}var o,c,l,a=null,f=0;i=i||{};return function(){var n=E.now(),t=(f||!1!==i.leading||(f=n),e-(n-f));return o=this,c=arguments,t<=0?(clearTimeout(a),a=null,f=n,l=r.apply(o,c),o=c=null):a||!1===i.trailing||(a=setTimeout(u,t)),l}},E.debounce=function(t,r,e){function i(){var n=E.now()-l;n<r?u=setTimeout(i,r-n):(u=null,e||(a=t.apply(c,o),c=o=null))}var u,o,c,l,a;return function(){c=this,o=arguments,l=E.now();var n=e&&!u;return u=u||setTimeout(i,r),n&&(a=t.apply(c,o),c=o=null),a}},E.once=function(n){var t,r=!1;return function(){return r||(r=!0,t=n.apply(this,arguments),n=null),t}},E.wrap=function(n,t){return E.partial(t,n)},E.compose=function(){var r=arguments;return function(){for(var n=arguments,t=r.length-1;0<=t;t--)n=[r[t].apply(this,n)];return n[0]}},E.after=function(n,t){return function(){if(--n<1)return t.apply(this,arguments)}},E.keys=function(n){if(!E.isObject(n))return[];if(O)return O(n);var t,r=[];for(t in n)E.has(n,t)&&r.push(t);return r},E.values=function(n){for(var t=E.keys(n),r=t.length,e=new Array(r),i=0;i<r;i++)e[i]=n[t[i]];return e},E.pairs=function(n){for(var t=E.keys(n),r=t.length,e=new Array(r),i=0;i<r;i++)e[i]=[t[i],n[t[i]]];return e},E.invert=function(n){for(var t={},r=E.keys(n),e=0,i=r.length;e<i;e++)t[n[r[e]]]=r[e];return t},E.functions=E.methods=function(n){var t,r=[];for(t in n)E.isFunction(n[t])&&r.push(t);return r.sort()},E.extend=function(r){return F(p.call(arguments,1),function(n){if(n)for(var t in n)r[t]=n[t]}),r},E.pick=function(t){var r={},n=h.apply(i,p.call(arguments,1));return F(n,function(n){n in t&&(r[n]=t[n])}),r},E.omit=function(n){var t,r={},e=h.apply(i,p.call(arguments,1));for(t in n)E.contains(e,t)||(r[t]=n[t]);return r},E.defaults=function(r){return F(p.call(arguments,1),function(n){if(n)for(var t in n)void 0===r[t]&&(r[t]=n[t])}),r},E.clone=function(n){return E.isObject(n)?E.isArray(n)?n.slice():E.extend({},n):n},E.tap=function(n,t){return t(n),n},E.isEqual=function(n,t){return s(n,t,[],[])},E.isEmpty=function(n){if(null!=n){if(E.isArray(n)||E.isString(n))return 0===n.length;for(var t in n)if(E.has(n,t))return!1}return!0},E.isElement=function(n){return!(!n||1!==n.nodeType)},E.isArray=u||function(n){return"[object Array]"==y.call(n)},E.isObject=function(n){return n===Object(n)},F(["Arguments","Function","String","Number","Date","RegExp"],function(t){E["is"+t]=function(n){return y.call(n)=="[object "+t+"]"}}),E.isArguments(arguments)||(E.isArguments=function(n){return!(!n||!E.has(n,"callee"))}),"function"!=typeof/./&&(E.isFunction=function(n){return"function"==typeof n}),E.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},E.isNaN=function(n){return E.isNumber(n)&&n!=+n},E.isBoolean=function(n){return!0===n||!1===n||"[object Boolean]"==y.call(n)},E.isNull=function(n){return null===n},E.isUndefined=function(n){return void 0===n},E.has=function(n,t){return d.call(n,t)},E.noConflict=function(){return t._=r,this},E.identity=function(n){return n},E.constant=function(n){return function(){return n}},E.property=function(t){return function(n){return n[t]}},E.matches=function(r){return function(n){if(n!==r)for(var t in r)if(r[t]!==n[t])return!1;return!0}},E.times=function(n,t,r){for(var e=Array(Math.max(0,n)),i=0;i<n;i++)e[i]=t.call(r,i);return e},E.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},E.now=Date.now||function(){return(new Date).getTime()},{escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}}),T=(S.unescape=E.invert(S.escape),{escape:new RegExp("["+E.keys(S.escape).join("")+"]","g"),unescape:new RegExp("("+E.keys(S.unescape).join("|")+")","g")}),q=(E.each(["escape","unescape"],function(t){E[t]=function(n){return null==n?"":(""+n).replace(T[t],function(n){return S[t][n]})}}),E.result=function(n,t){if(null!=n)return t=n[t],E.isFunction(t)?t.call(n):t},E.mixin=function(r){F(E.functions(r),function(n){var t=E[n]=r[n];E.prototype[n]=function(){var n=[this._wrapped];return f.apply(n,arguments),N.call(this,t.apply(E,n))}})},0),I=(E.uniqueId=function(n){var t=++q+"";return n?n+t:t},E.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},/(.)^/),B={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g,N=(E.template=function(u,n,t){t=E.defaults({},t,E.templateSettings);var r,e=new RegExp([(t.escape||I).source,(t.interpolate||I).source,(t.evaluate||I).source].join("|")+"|$","g"),o=0,c="__p+='";u.replace(e,function(n,t,r,e,i){return c+=u.slice(o,i).replace(D,function(n){return"\\"+B[n]}),t&&(c+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'"),r&&(c+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),e&&(c+="';\n"+e+"\n__p+='"),o=i+n.length,n}),c+="';\n",c="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+(c=t.variable?c:"with(obj||{}){\n"+c+"}\n")+"return __p;\n";try{r=new Function(t.variable||"obj","_",c)}catch(n){throw n.source=c,n}return n?r(n,E):((e=function(n){return r.call(this,n,E)}).source="function("+(t.variable||"obj")+"){\n"+c+"}",e)},E.chain=function(n){return E(n).chain()},function(n){return this._chain?E(n).chain():n});E.mixin(E),F(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var r=i[t];E.prototype[t]=function(){var n=this._wrapped;return r.apply(n,arguments),"shift"!=t&&"splice"!=t||0!==n.length||delete n[0],N.call(this,n)}}),F(["concat","join","slice"],function(n){var t=i[n];E.prototype[n]=function(){return N.call(this,t.apply(this._wrapped,arguments))}}),E.extend(E.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define(function(){return E})}.call(this);