UNPKG

citation-js

Version:

Citation.js converts formats like BibTeX, Wikidata JSON and ContentMine JSON to CSL-JSON to convert to other formats like APA, Vancouver and back to BibTeX.

805 lines (776 loc) 3.45 MB
require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; function async(data, options, callback) { if (typeof options === 'function' && !callback) { callback = options; options = undefined; } var promise = new this().setAsync(data, options); if (typeof callback === 'function') { promise.then(callback); return undefined; } else { return promise; } } var _default = exports["default"] = async; },{}],2:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } Object.defineProperty(exports, "__esModule", { value: true }); exports.format = format; exports.get = get; exports.getIds = getIds; var _validate = require("./validate.js"); var _output = require("../plugins/output.js"); var _csl = require("../plugins/input/csl.js"); function getIds() { return this.data.map(function (entry) { return entry.id; }); } function format(format) { for (var _len = arguments.length, options = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { options[_key - 1] = arguments[_key]; } return (0, _output.format).apply(void 0, [format, (0, _csl.clean)(this.data)].concat(options)); } function get() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; (0, _validate.validateOutputOptions)(options); var parsedOptions = Object.assign({}, this.defaultOptions, this._options.output, options); var type = parsedOptions.type, style = parsedOptions.style; var _style$split = style.split('-'), _style$split2 = _slicedToArray(_style$split, 2), styleType = _style$split2[0], styleFormat = _style$split2[1]; var newStyle = styleType === 'citation' ? 'bibliography' : styleType === 'csl' ? 'data' : styleType; var newType = type === 'string' ? 'text' : type === 'json' ? 'object' : type; var formatOptions; switch (newStyle) { case 'bibliography': { var lang = parsedOptions.lang, append = parsedOptions.append, prepend = parsedOptions.prepend; formatOptions = { template: styleFormat, lang: lang, format: newType, append: append, prepend: prepend }; break; } case 'data': case 'bibtex': case 'bibtxt': case 'ndjson': case 'ris': formatOptions = { type: newType }; break; default: throw new Error("Invalid style \"".concat(newStyle, "\"")); } var result = this.format(newStyle, Object.assign(formatOptions, options._newOptions)); var format = parsedOptions.format; if (format === 'real' && newType === 'html' && typeof document !== 'undefined' && typeof document.createElement === 'function') { var tmp = document.createElement('div'); tmp.innerHTML = result; return tmp.firstChild; } else if (format === 'string' && _typeof(result) === 'object') { return JSON.stringify(result); } else { return result; } } },{"../plugins/input/csl.js":25,"../plugins/output.js":33,"./validate.js":9}],3:[function(require,module,exports){ "use strict"; function _regeneratorRuntime() { "use strict"; _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; } function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var log = _interopRequireWildcard(require("./log.js")); var options = _interopRequireWildcard(require("./options.js")); var set = _interopRequireWildcard(require("./set.js")); var sort = _interopRequireWildcard(require("./sort.js")); var get = _interopRequireWildcard(require("./get.js")); var staticMethods = _interopRequireWildcard(require("./static.js")); function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } function Cite(data) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; if (!(this instanceof Cite)) { return new Cite(data, options); } this._options = options; this.log = []; this.data = []; this.set(data, options); this.options(options); return this; } Object.assign(Cite.prototype, log, options, set, sort, get); Cite.prototype[Symbol.iterator] = _regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: return _context.delegateYield(this.data, "t0", 1); case 1: case "end": return _context.stop(); } }, _callee, this); }); Object.assign(Cite, staticMethods); var _default = exports["default"] = Cite; },{"./get.js":2,"./log.js":4,"./options.js":5,"./set.js":6,"./sort.js":7,"./static.js":8}],4:[function(require,module,exports){ "use strict"; function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } Object.defineProperty(exports, "__esModule", { value: true }); exports.currentVersion = currentVersion; exports.retrieveLastVersion = retrieveLastVersion; exports.retrieveVersion = retrieveVersion; exports.save = save; exports.undo = undo; function currentVersion() { return this.log.length; } function retrieveVersion() { var versnum = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; if (versnum <= 0 || versnum > this.currentVersion()) { return null; } else { var _this$log = _slicedToArray(this.log[versnum - 1], 2), data = _this$log[0], options = _this$log[1]; var image = new this.constructor(JSON.parse(data), JSON.parse(options)); image.log = this.log.slice(0, versnum); return image; } } function undo() { var number = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; return this.retrieveVersion(this.currentVersion() - number); } function retrieveLastVersion() { return this.retrieveVersion(this.currentVersion()); } function save() { this.log.push([JSON.stringify(this.data), JSON.stringify(this._options)]); return this; } },{}],5:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.defaultOptions = void 0; exports.options = options; var _validate = require("./validate.js"); var defaultOptions = exports.defaultOptions = { format: 'real', type: 'json', style: 'csl', lang: 'en-US' }; function options(options, log) { (0, _validate.validateOutputOptions)(options); if (log) { this.save(); } Object.assign(this._options, options); return this; } },{"./validate.js":9}],6:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _regeneratorRuntime() { "use strict"; _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; } function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); } function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } Object.defineProperty(exports, "__esModule", { value: true }); exports.add = add; exports.addAsync = addAsync; exports.reset = reset; exports.set = set; exports.setAsync = setAsync; var _index = require("../plugins/input/index.js"); var _fetchId = _interopRequireDefault(require("../util/fetchId.js")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } function add(data) { var _this$data, _this = this; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var log = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; if (options === true || log === true) { this.save(); } (_this$data = this.data).push.apply(_this$data, _toConsumableArray((0, _index.chain)(data, options))); this.data.filter(function (entry) { return !Object.prototype.hasOwnProperty.call(entry, 'id'); }).forEach(function (entry) { entry.id = (0, _fetchId["default"])(_this.getIds(), 'temp_id_'); }); return this; } function addAsync(_x) { return _addAsync.apply(this, arguments); } function _addAsync() { _addAsync = _asyncToGenerator(_regeneratorRuntime().mark(function _callee(data) { var _this$data2, _this2 = this; var options, log, _args = arguments; return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {}; log = _args.length > 2 && _args[2] !== undefined ? _args[2] : false; if (options === true || log === true) { this.save(); } _context.t0 = (_this$data2 = this.data).push; _context.t1 = _this$data2; _context.t2 = _toConsumableArray; _context.next = 8; return (0, _index.chainAsync)(data, options); case 8: _context.t3 = _context.sent; _context.t4 = (0, _context.t2)(_context.t3); _context.t0.apply.call(_context.t0, _context.t1, _context.t4); this.data.filter(function (entry) { return !Object.prototype.hasOwnProperty.call(entry, 'id'); }).forEach(function (entry) { entry.id = (0, _fetchId["default"])(_this2.getIds(), 'temp_id_'); }); return _context.abrupt("return", this); case 13: case "end": return _context.stop(); } }, _callee, this); })); return _addAsync.apply(this, arguments); } function set(data) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var log = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; if (options === true || log === true) { this.save(); } this.data = []; return typeof options !== 'boolean' ? this.add(data, options) : this.add(data); } function setAsync(_x2) { return _setAsync.apply(this, arguments); } function _setAsync() { _setAsync = _asyncToGenerator(_regeneratorRuntime().mark(function _callee2(data) { var options, log, _args2 = arguments; return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {}; log = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : false; if (options === true || log === true) { this.save(); } this.data = []; return _context2.abrupt("return", typeof options !== 'boolean' ? this.addAsync(data, options) : this.addAsync(data)); case 5: case "end": return _context2.stop(); } }, _callee2, this); })); return _setAsync.apply(this, arguments); } function reset(log) { if (log) { this.save(); } this.data = []; this._options = {}; return this; } },{"../plugins/input/index.js":29,"../util/fetchId.js":37}],7:[function(require,module,exports){ "use strict"; function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } Object.defineProperty(exports, "__esModule", { value: true }); exports.sort = sort; var _label = require("../plugin-common/output/label.js"); var _name = require("@citation-js/name"); function getComparisonValue(obj, prop) { var label = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : prop === 'label'; var value = label ? (0, _label.getLabel)(obj) : obj[prop]; switch (prop) { case 'author': case 'editor': return value.map(function (name) { return name.literal || name.family || (0, _name.format)(name); }); case 'accessed': case 'issued': return value['date-parts'][0]; case 'page': return value.split('-').map(function (num) { return parseInt(num); }); case 'edition': case 'issue': case 'volume': value = parseInt(value); return !isNaN(value) ? value : -Infinity; default: return value || -Infinity; } } function compareProp(entryA, entryB, prop) { var flip = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : /^!/.test(prop); prop = prop.replace(/^!/, ''); var a = getComparisonValue(entryA, prop); var b = getComparisonValue(entryB, prop); return (flip ? -1 : 1) * (a > b ? 1 : a < b ? -1 : 0); } function getSortCallback() { for (var _len = arguments.length, props = new Array(_len), _key = 0; _key < _len; _key++) { props[_key] = arguments[_key]; } return function (a, b) { var keys = props.slice(); var output = 0; while (!output && keys.length) { output = compareProp(a, b, keys.shift()); } return output; }; } function sort() { var method = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var log = arguments.length > 1 ? arguments[1] : undefined; if (log) { this.save(); } this.data.sort(typeof method === 'function' ? method : getSortCallback.apply(void 0, _toConsumableArray(method).concat(['label']))); return this; } },{"../plugin-common/output/label.js":20,"@citation-js/name":47}],8:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _exportNames = { async: true }; Object.defineProperty(exports, "async", { enumerable: true, get: function get() { return _async["default"]; } }); var _async = _interopRequireDefault(require("./async.js")); var _validate = require("./validate.js"); Object.keys(_validate).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _validate[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function get() { return _validate[key]; } }); }); function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } },{"./async.js":1,"./validate.js":9}],9:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.validateOptions = validateOptions; exports.validateOutputOptions = validateOutputOptions; var formats = ['real', 'string']; var types = ['json', 'html', 'string', 'rtf']; var styles = ['csl', 'bibtex', 'bibtxt', 'citation-*', 'ris', 'ndjson']; var wrapperTypes = ['string', 'function']; function validateOutputOptions(options) { if (_typeof(options) !== 'object') { throw new TypeError('Options not an object!'); } var format = options.format, type = options.type, style = options.style, lang = options.lang, append = options.append, prepend = options.prepend; if (format && !formats.includes(format)) { throw new TypeError("Option format (\"".concat(format, "\") should be one of: ").concat(formats)); } else if (type && !types.includes(type)) { throw new TypeError("Option type (\"".concat(type, "\") should be one of: ").concat(types)); } else if (style && !styles.includes(style) && !/^citation/.test(style)) { throw new TypeError("Option style (\"".concat(style, "\") should be one of: ").concat(styles)); } else if (lang && typeof lang !== 'string') { throw new TypeError("Option lang should be a string, but is a ".concat(_typeof(lang))); } else if (prepend && !wrapperTypes.includes(_typeof(prepend))) { throw new TypeError("Option prepend should be a string or a function, but is a ".concat(_typeof(prepend))); } else if (append && !wrapperTypes.includes(_typeof(append))) { throw new TypeError("Option append should be a string or a function, but is a ".concat(_typeof(append))); } if (/^citation/.test(style) && type === 'json') { throw new Error("Combination type/style of json/citation-* is not valid: ".concat(type, "/").concat(style)); } return true; } function validateOptions(options) { if (_typeof(options) !== 'object') { throw new TypeError('Options should be an object'); } if (options.output) { validateOutputOptions(options.output); } else if (options.maxChainLength && typeof options.maxChainLength !== 'number') { throw new TypeError('Option maxChainLength should be a number'); } else if (options.forceType && typeof options.forceType !== 'string') { throw new TypeError('Option forceType should be a string'); } else if (options.generateGraph != null && typeof options.generateGraph !== 'boolean') { throw new TypeError('Option generateGraph should be a boolean'); } else if (options.strict != null && typeof options.strict !== 'boolean') { throw new TypeError('Option strict should be a boolean'); } else if (options.target != null && typeof options.target !== 'string') { throw new TypeError('Option target should be a boolean'); } return true; } },{}],10:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "Cite", { enumerable: true, get: function get() { return _index["default"]; } }); Object.defineProperty(exports, "logger", { enumerable: true, get: function get() { return _logger["default"]; } }); exports.version = exports.util = exports.plugins = void 0; var _index = _interopRequireDefault(require("./Cite/index.js")); var plugins = _interopRequireWildcard(require("./plugins/index.js")); exports.plugins = plugins; var util = _interopRequireWildcard(require("./util/index.js")); exports.util = util; var _logger = _interopRequireDefault(require("./logger.js")); var _package = _interopRequireDefault(require("../package.json")); require("./plugin-common/index.js"); function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } var version = exports.version = _package["default"].version; },{"../package.json":43,"./Cite/index.js":3,"./logger.js":11,"./plugin-common/index.js":12,"./plugins/index.js":23,"./util/index.js":39}],11:[function(require,module,exports){ (function (process){(function (){ "use strict"; function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; } function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var logger = { _output: function _output(level, scope, msg) { var _this$_console; this._log.push(scope, msg); if (this._levels.indexOf(level) < this._levels.indexOf(this.level)) { return; } (_this$_console = this._console).log.apply(_this$_console, [scope].concat(_toConsumableArray(msg))); }, _console: null, _log: [], _levels: ['http', 'debug', 'unmapped', 'info', 'warn', 'error', 'silent'], level: 'silent' }; var _iterator = _createForOfIteratorHelper(logger._levels), _step; try { var _loop = function _loop() { var level = _step.value; logger[level] = function (scope) { for (var _len = arguments.length, msg = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { msg[_key - 1] = arguments[_key]; } return logger._output(level, scope, msg); }; }; for (_iterator.s(); !(_step = _iterator.n()).done;) { _loop(); } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } if (typeof console.Console === 'function') { logger._console = new console.Console(process.stderr); } else { logger._console = console; } var _default = exports["default"] = logger; }).call(this)}).call(this,require('_process')) },{"_process":704}],12:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } var plugins = _interopRequireWildcard(require("../plugins")); var _input = require("./input/"); var _output = _interopRequireDefault(require("./output/")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } plugins.add(_input.ref, { input: _input.formats, output: _output["default"] }); },{"../plugins":23,"./input/":15,"./output/":18}],13:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parse = parse; function parse() { return []; } },{}],14:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parse = parse; function parse(input) { return input.value || input.textContent; } },{}],15:[function(require,module,exports){ "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.ref = exports.parsers = exports.formats = void 0; var empty = _interopRequireWildcard(require("./empty.js")); var json = _interopRequireWildcard(require("./json.js")); var jquery = _interopRequireWildcard(require("./jquery.js")); var html = _interopRequireWildcard(require("./html.js")); function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } var ref = exports.ref = '@else'; var parsers = exports.parsers = { empty: empty, json: json, jquery: jquery, html: html }; var formats = exports.formats = { '@empty/text': { parse: empty.parse, parseType: { dataType: 'String', predicate: function predicate(input) { return input === ''; } } }, '@empty/whitespace+text': { parse: empty.parse, parseType: { dataType: 'String', predicate: /^\s+$/ } }, '@empty': { parse: empty.parse, parseType: { dataType: 'Primitive', predicate: function predicate(input) { return input == null; } } }, '@else/json': { parse: json.parse, parseType: { dataType: 'String', predicate: /^\s*(\{[\S\s]*\}|\[[\S\s]*\])\s*$/ } }, '@else/url': { parseType: { dataType: 'String', predicate: /^https?:\/\/(([\w-]+\.)*[\w-]+)(:\d+)?(\/[^?/]*)*(\?[^#]*)?(#.*)?$/i } }, '@else/jquery': { parse: jquery.parse, parseType: { dataType: 'ComplexObject', predicate: function predicate(input) { return typeof jQu