mirror of
https://github.com/zulip/zulip.git
synced 2026-06-18 21:01:52 +08:00
This was "npm update handlebars" followed by copying runtime.js into the static directory and restoring the copyright header. (imported from commit 69d30cbfcb3b776cdfdcffa17a87704540eab76a)
531 lines
16 KiB
JavaScript
531 lines
16 KiB
JavaScript
/*!
|
|
|
|
handlebars v1.3.0
|
|
|
|
Copyright (C) 2011 by Yehuda Katz
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
all copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
THE SOFTWARE.
|
|
|
|
@license
|
|
*/
|
|
/* exported Handlebars */
|
|
var Handlebars = (function() {
|
|
// handlebars/safe-string.js
|
|
var __module3__ = (function() {
|
|
"use strict";
|
|
var __exports__;
|
|
// Build out our basic SafeString type
|
|
function SafeString(string) {
|
|
this.string = string;
|
|
}
|
|
|
|
SafeString.prototype.toString = function() {
|
|
return "" + this.string;
|
|
};
|
|
|
|
__exports__ = SafeString;
|
|
return __exports__;
|
|
})();
|
|
|
|
// handlebars/utils.js
|
|
var __module2__ = (function(__dependency1__) {
|
|
"use strict";
|
|
var __exports__ = {};
|
|
/*jshint -W004 */
|
|
var SafeString = __dependency1__;
|
|
|
|
var escape = {
|
|
"&": "&",
|
|
"<": "<",
|
|
">": ">",
|
|
'"': """,
|
|
"'": "'",
|
|
"`": "`"
|
|
};
|
|
|
|
var badChars = /[&<>"'`]/g;
|
|
var possible = /[&<>"'`]/;
|
|
|
|
function escapeChar(chr) {
|
|
return escape[chr] || "&";
|
|
}
|
|
|
|
function extend(obj, value) {
|
|
for(var key in value) {
|
|
if(Object.prototype.hasOwnProperty.call(value, key)) {
|
|
obj[key] = value[key];
|
|
}
|
|
}
|
|
}
|
|
|
|
__exports__.extend = extend;var toString = Object.prototype.toString;
|
|
__exports__.toString = toString;
|
|
// Sourced from lodash
|
|
// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
|
|
var isFunction = function(value) {
|
|
return typeof value === 'function';
|
|
};
|
|
// fallback for older versions of Chrome and Safari
|
|
if (isFunction(/x/)) {
|
|
isFunction = function(value) {
|
|
return typeof value === 'function' && toString.call(value) === '[object Function]';
|
|
};
|
|
}
|
|
var isFunction;
|
|
__exports__.isFunction = isFunction;
|
|
var isArray = Array.isArray || function(value) {
|
|
return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false;
|
|
};
|
|
__exports__.isArray = isArray;
|
|
|
|
function escapeExpression(string) {
|
|
// don't escape SafeStrings, since they're already safe
|
|
if (string instanceof SafeString) {
|
|
return string.toString();
|
|
} else if (!string && string !== 0) {
|
|
return "";
|
|
}
|
|
|
|
// Force a string conversion as this will be done by the append regardless and
|
|
// the regex test will do this transparently behind the scenes, causing issues if
|
|
// an object's to string has escaped characters in it.
|
|
string = "" + string;
|
|
|
|
if(!possible.test(string)) { return string; }
|
|
return string.replace(badChars, escapeChar);
|
|
}
|
|
|
|
__exports__.escapeExpression = escapeExpression;function isEmpty(value) {
|
|
if (!value && value !== 0) {
|
|
return true;
|
|
} else if (isArray(value) && value.length === 0) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
__exports__.isEmpty = isEmpty;
|
|
return __exports__;
|
|
})(__module3__);
|
|
|
|
// handlebars/exception.js
|
|
var __module4__ = (function() {
|
|
"use strict";
|
|
var __exports__;
|
|
|
|
var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
|
|
|
|
function Exception(message, node) {
|
|
var line;
|
|
if (node && node.firstLine) {
|
|
line = node.firstLine;
|
|
|
|
message += ' - ' + line + ':' + node.firstColumn;
|
|
}
|
|
|
|
var tmp = Error.prototype.constructor.call(this, message);
|
|
|
|
// Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
|
|
for (var idx = 0; idx < errorProps.length; idx++) {
|
|
this[errorProps[idx]] = tmp[errorProps[idx]];
|
|
}
|
|
|
|
if (line) {
|
|
this.lineNumber = line;
|
|
this.column = node.firstColumn;
|
|
}
|
|
}
|
|
|
|
Exception.prototype = new Error();
|
|
|
|
__exports__ = Exception;
|
|
return __exports__;
|
|
})();
|
|
|
|
// handlebars/base.js
|
|
var __module1__ = (function(__dependency1__, __dependency2__) {
|
|
"use strict";
|
|
var __exports__ = {};
|
|
var Utils = __dependency1__;
|
|
var Exception = __dependency2__;
|
|
|
|
var VERSION = "1.3.0";
|
|
__exports__.VERSION = VERSION;var COMPILER_REVISION = 4;
|
|
__exports__.COMPILER_REVISION = COMPILER_REVISION;
|
|
var REVISION_CHANGES = {
|
|
1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
|
|
2: '== 1.0.0-rc.3',
|
|
3: '== 1.0.0-rc.4',
|
|
4: '>= 1.0.0'
|
|
};
|
|
__exports__.REVISION_CHANGES = REVISION_CHANGES;
|
|
var isArray = Utils.isArray,
|
|