diff --git a/build/datamanager.js b/build/datamanager.js index 7ac6ed2..dae678f 100644 --- a/build/datamanager.js +++ b/build/datamanager.js @@ -171,7 +171,7 @@ function remove(arr, func) { module.exports = Asset; -},{"./util":7,"halfred":10,"locale":16}],2:[function(require,module,exports){ +},{"./util":7,"halfred":10,"locale":15}],2:[function(require,module,exports){ 'use strict'; var halfred = require('halfred'); @@ -836,7 +836,7 @@ DataManager.prototype._requestOptions = function(additionalHeaders) { module.exports = DataManager; -},{"./Asset":1,"./Entry":3,"./Model":4,"./Tag":5,"./User":6,"./util":7,"es6-promise":9,"halfred":10,"shiro-trie":20,"superagent":21,"traverson":63,"traverson-hal":22}],3:[function(require,module,exports){ +},{"./Asset":1,"./Entry":3,"./Model":4,"./Tag":5,"./User":6,"./util":7,"es6-promise":9,"halfred":10,"shiro-trie":18,"superagent":19,"traverson":61,"traverson-hal":20}],3:[function(require,module,exports){ 'use strict'; var halfred = require('halfred'); @@ -1187,7 +1187,7 @@ function makeNestedToResource(entry, dm, model) { module.exports = Model; -},{"./Asset":1,"./Entry":3,"./util":7,"halfred":10,"superagent":21,"traverson":63}],5:[function(require,module,exports){ +},{"./Asset":1,"./Entry":3,"./util":7,"halfred":10,"superagent":19,"traverson":61}],5:[function(require,module,exports){ 'use strict'; var halfred = require('halfred'); @@ -1265,7 +1265,7 @@ Tag.prototype._getTraversal = function() { module.exports = Tag; -},{"./util":7,"halfred":10,"traverson":63}],6:[function(require,module,exports){ +},{"./util":7,"halfred":10,"traverson":61}],6:[function(require,module,exports){ 'use strict'; // TODO document @@ -2483,7 +2483,7 @@ Emitter.prototype.hasListeners = function(event){ }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":17}],10:[function(require,module,exports){ +},{"_process":64}],10:[function(require,module,exports){ var Parser = require('./lib/parser') , Resource = require('./lib/resource') , validationFlag = false; @@ -2891,17 +2891,6 @@ Resource.prototype.validation = Resource.prototype.validationIssues; module.exports = Resource; },{}],14:[function(require,module,exports){ - -var indexOf = [].indexOf; - -module.exports = function(arr, obj){ - if (indexOf) return arr.indexOf(obj); - for (var i = 0; i < arr.length; ++i) { - if (arr[i] === obj) return i; - } - return -1; -}; -},{}],15:[function(require,module,exports){ /*global exports, require*/ /* eslint-disable no-eval */ /* JSONPath 0.8.0 - XPath for JSON @@ -3357,7 +3346,7 @@ else { } }(typeof require === 'undefined' ? null : require)); -},{"vm":65}],16:[function(require,module,exports){ +},{"vm":65}],15:[function(require,module,exports){ (function (process){ // Generated by CoffeeScript 1.6.3 (function() { @@ -3516,100 +3505,7 @@ else { }).call(this); }).call(this,require('_process')) -},{"_process":17}],17:[function(require,module,exports){ -// shim for using process in browser - -var process = module.exports = {}; -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = setTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - clearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - setTimeout(drainQueue, 0); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; - -},{}],18:[function(require,module,exports){ +},{"_process":64}],16:[function(require,module,exports){ /** * Reduce `arr` with `fn`. @@ -3634,7 +3530,7 @@ module.exports = function(arr, fn, initial){ return curr; }; -},{}],19:[function(require,module,exports){ +},{}],17:[function(require,module,exports){ // Copyright 2014 Simon Lydell // X11 (“MIT”) Licensed. (See LICENSE.) @@ -3683,7 +3579,7 @@ void (function(root, factory) { })); -},{}],20:[function(require,module,exports){ +},{}],18:[function(require,module,exports){ 'use strict'; function uniq(arr) { @@ -3911,7 +3807,7 @@ module.exports = { _expand: _expand, }; -},{}],21:[function(require,module,exports){ +},{}],19:[function(require,module,exports){ /** * Module dependencies. */ @@ -5104,7 +5000,7 @@ request.put = function(url, data, fn){ module.exports = request; -},{"emitter":8,"reduce":18}],22:[function(require,module,exports){ +},{"emitter":8,"reduce":16}],20:[function(require,module,exports){ 'use strict'; var halfred = require('halfred'); @@ -5428,7 +5324,7 @@ JsonHalAdapter.prototype._handleHeader = function(httpResponse, link) { module.exports = JsonHalAdapter; -},{"halfred":23}],23:[function(require,module,exports){ +},{"halfred":21}],21:[function(require,module,exports){ var Parser = require('./lib/parser') , validationFlag = false; @@ -5447,13 +5343,13 @@ module.exports = { } }; -},{"./lib/parser":25}],24:[function(require,module,exports){ +},{"./lib/parser":23}],22:[function(require,module,exports){ arguments[4][11][0].apply(exports,arguments) -},{"dup":11}],25:[function(require,module,exports){ +},{"dup":11}],23:[function(require,module,exports){ arguments[4][12][0].apply(exports,arguments) -},{"./immutable_stack":24,"./resource":26,"dup":12}],26:[function(require,module,exports){ +},{"./immutable_stack":22,"./resource":24,"dup":12}],24:[function(require,module,exports){ arguments[4][13][0].apply(exports,arguments) -},{"dup":13}],27:[function(require,module,exports){ +},{"dup":13}],25:[function(require,module,exports){ 'use strict'; // TODO Replace by a proper lightweight logging module, suited for the browser @@ -5504,7 +5400,7 @@ minilog.enable = function() { module.exports = minilog; -},{}],28:[function(require,module,exports){ +},{}],26:[function(require,module,exports){ 'use strict'; module.exports = { @@ -5516,7 +5412,7 @@ module.exports = { } }; -},{}],29:[function(require,module,exports){ +},{}],27:[function(require,module,exports){ 'use strict'; var superagent = require('superagent'); @@ -5642,7 +5538,7 @@ function handleResponse(callback) { module.exports = new Request(); -},{"superagent":21}],30:[function(require,module,exports){ +},{"superagent":19}],28:[function(require,module,exports){ 'use strict'; /* @@ -5686,7 +5582,7 @@ var _s = { module.exports = _s; -},{}],31:[function(require,module,exports){ +},{}],29:[function(require,module,exports){ 'use strict'; var resolveUrl = require('resolve-url'); @@ -5695,7 +5591,7 @@ exports.resolve = function(from, to) { return resolveUrl(from, to); }; -},{"resolve-url":19}],32:[function(require,module,exports){ +},{"resolve-url":17}],30:[function(require,module,exports){ 'use strict'; var minilog = require('minilog') @@ -5733,7 +5629,7 @@ exports.abortError = function abortError() { return error; }; -},{"minilog":27}],33:[function(require,module,exports){ +},{"minilog":25}],31:[function(require,module,exports){ 'use strict'; var minilog = require('minilog') @@ -5869,7 +5765,7 @@ function createTraversalHandle(t) { }; } -},{"./abort_traversal":32,"./http_requests":35,"./is_continuation":36,"./transforms/apply_transforms":42,"./transforms/check_http_status":43,"./transforms/continuation_to_doc":44,"./transforms/continuation_to_response":45,"./transforms/convert_embedded_doc_to_response":46,"./transforms/execute_http_request":48,"./transforms/execute_last_http_request":49,"./transforms/extract_doc":50,"./transforms/extract_response":51,"./transforms/extract_url":52,"./transforms/fetch_last_resource":53,"./transforms/parse":56,"./walker":62,"minilog":27}],34:[function(require,module,exports){ +},{"./abort_traversal":30,"./http_requests":33,"./is_continuation":34,"./transforms/apply_transforms":40,"./transforms/check_http_status":41,"./transforms/continuation_to_doc":42,"./transforms/continuation_to_response":43,"./transforms/convert_embedded_doc_to_response":44,"./transforms/execute_http_request":46,"./transforms/execute_last_http_request":47,"./transforms/extract_doc":48,"./transforms/extract_response":49,"./transforms/extract_url":50,"./transforms/fetch_last_resource":51,"./transforms/parse":54,"./walker":60,"minilog":25}],32:[function(require,module,exports){ 'use strict'; var minilog = require('minilog') @@ -6513,7 +6409,7 @@ function shallowCloneArray(array) { module.exports = Builder; -},{"./abort_traversal":32,"./actions":33,"./media_type_registry":38,"./media_types":39,"./merge_recursive":40,"minilog":27,"request":29,"util":28}],35:[function(require,module,exports){ +},{"./abort_traversal":30,"./actions":31,"./media_type_registry":36,"./media_types":37,"./merge_recursive":38,"minilog":25,"request":27,"util":26}],33:[function(require,module,exports){ (function (process){ 'use strict'; var minilog = require('minilog') @@ -6619,14 +6515,14 @@ exports.executeHttpRequest = function(t, request, method, callback) { }; }).call(this,require('_process')) -},{"./abort_traversal":32,"./transforms/detect_content_type":47,"./transforms/get_options_for_step":55,"_process":17,"minilog":27}],36:[function(require,module,exports){ +},{"./abort_traversal":30,"./transforms/detect_content_type":45,"./transforms/get_options_for_step":53,"_process":64,"minilog":25}],34:[function(require,module,exports){ 'use strict'; module.exports = function isContinuation(t) { return t.continuation && t.step && t.step.response; }; -},{}],37:[function(require,module,exports){ +},{}],35:[function(require,module,exports){ 'use strict'; var jsonpath = require('jsonpath-plus') @@ -6731,7 +6627,7 @@ JsonAdapter.prototype._handleHeader = function(httpResponse, link) { module.exports = JsonAdapter; -},{"jsonpath-plus":15,"minilog":27,"underscore.string":30}],38:[function(require,module,exports){ +},{"jsonpath-plus":14,"minilog":25,"underscore.string":28}],36:[function(require,module,exports){ 'use strict'; var mediaTypes = require('./media_types'); @@ -6750,7 +6646,7 @@ exports.register(mediaTypes.CONTENT_NEGOTIATION, require('./negotiation_adapter')); exports.register(mediaTypes.JSON, require('./json_adapter')); -},{"./json_adapter":37,"./media_types":39,"./negotiation_adapter":41}],39:[function(require,module,exports){ +},{"./json_adapter":35,"./media_types":37,"./negotiation_adapter":39}],37:[function(require,module,exports){ 'use strict'; module.exports = { @@ -6759,7 +6655,7 @@ module.exports = { JSON_HAL: 'application/hal+json', }; -},{}],40:[function(require,module,exports){ +},{}],38:[function(require,module,exports){ 'use strict'; // TODO Maybe replace with https://github.com/Raynos/xtend @@ -6796,7 +6692,7 @@ function merge(obj1, obj2, key) { module.exports = mergeRecursive; -},{}],41:[function(require,module,exports){ +},{}],39:[function(require,module,exports){ 'use strict'; function NegotiationAdapter(log) {} @@ -6807,7 +6703,7 @@ NegotiationAdapter.prototype.findNextStep = function(doc, link) { module.exports = NegotiationAdapter; -},{}],42:[function(require,module,exports){ +},{}],40:[function(require,module,exports){ (function (process){ /* jshint loopfunc: true */ 'use strict'; @@ -6849,7 +6745,7 @@ function applyTransforms(transforms, t, callback) { module.exports = applyTransforms; }).call(this,require('_process')) -},{"_process":17,"minilog":27}],43:[function(require,module,exports){ +},{"_process":64,"minilog":25}],41:[function(require,module,exports){ 'use strict'; var minilog = require('minilog') @@ -6903,7 +6799,7 @@ function httpError(url, httpStatus, body) { return error; } -},{"../is_continuation":36,"minilog":27}],44:[function(require,module,exports){ +},{"../is_continuation":34,"minilog":25}],42:[function(require,module,exports){ 'use strict'; var minilog = require('minilog') @@ -6925,7 +6821,7 @@ module.exports = function continuationToDoc(t) { return true; }; -},{"../is_continuation":36,"minilog":27}],45:[function(require,module,exports){ +},{"../is_continuation":34,"minilog":25}],43:[function(require,module,exports){ 'use strict'; var minilog = require('minilog') @@ -6950,7 +6846,7 @@ module.exports = function continuationToResponse(t) { return true; }; -},{"../is_continuation":36,"./convert_embedded_doc_to_response":46,"minilog":27}],46:[function(require,module,exports){ +},{"../is_continuation":34,"./convert_embedded_doc_to_response":44,"minilog":25}],44:[function(require,module,exports){ 'use strict'; var minilog = require('minilog') @@ -6970,7 +6866,7 @@ module.exports = function convertEmbeddedDocToResponse(t) { return true; }; -},{"minilog":27}],47:[function(require,module,exports){ +},{"minilog":25}],45:[function(require,module,exports){ 'use strict'; var minilog = require('minilog') @@ -6996,7 +6892,7 @@ module.exports = function detectContentType(t, callback) { return true; }; -},{"../media_type_registry":38,"minilog":27}],48:[function(require,module,exports){ +},{"../media_type_registry":36,"minilog":25}],46:[function(require,module,exports){ 'use strict'; var minilog = require('minilog') @@ -7038,7 +6934,7 @@ executeLastHttpRequest.isAsync = true; module.exports = executeLastHttpRequest; -},{"../abort_traversal":32,"../http_requests":35,"minilog":27}],49:[function(require,module,exports){ +},{"../abort_traversal":30,"../http_requests":33,"minilog":25}],47:[function(require,module,exports){ 'use strict'; var minilog = require('minilog') @@ -7067,7 +6963,7 @@ executeLastHttpRequest.isAsync = true; module.exports = executeLastHttpRequest; -},{"../abort_traversal":32,"../http_requests":35,"minilog":27}],50:[function(require,module,exports){ +},{"../abort_traversal":30,"../http_requests":33,"minilog":25}],48:[function(require,module,exports){ 'use strict'; var minilog = require('minilog') @@ -7096,7 +6992,7 @@ module.exports = function extractDoc(t) { return false; }; -},{"minilog":27}],51:[function(require,module,exports){ +},{"minilog":25}],49:[function(require,module,exports){ 'use strict'; var minilog = require('minilog') @@ -7126,7 +7022,7 @@ module.exports = function extractDoc(t) { return false; }; -},{"minilog":27}],52:[function(require,module,exports){ +},{"minilog":25}],50:[function(require,module,exports){ 'use strict'; var minilog = require('minilog') @@ -7156,7 +7052,7 @@ module.exports = function extractDoc(t) { } }; -},{"minilog":27,"url":31}],53:[function(require,module,exports){ +},{"minilog":25,"url":29}],51:[function(require,module,exports){ 'use strict'; // TODO Only difference to lib/transform/fetch_resource is the continuation @@ -7194,7 +7090,7 @@ fetchLastResource.isAsync = true; module.exports = fetchLastResource; -},{"../abort_traversal":32,"../http_requests":35,"minilog":27}],54:[function(require,module,exports){ +},{"../abort_traversal":30,"../http_requests":33,"minilog":25}],52:[function(require,module,exports){ (function (process){ 'use strict'; @@ -7252,7 +7148,7 @@ function fetchViaHttp(t, callback) { module.exports = fetchResource; }).call(this,require('_process')) -},{"../abort_traversal":32,"../http_requests":35,"../is_continuation":36,"_process":17,"minilog":27}],55:[function(require,module,exports){ +},{"../abort_traversal":30,"../http_requests":33,"../is_continuation":34,"_process":64,"minilog":25}],53:[function(require,module,exports){ 'use strict'; var minilog = require('minilog') @@ -7268,7 +7164,7 @@ module.exports = function getOptionsForStep(t) { return options; }; -},{"minilog":27,"util":28}],56:[function(require,module,exports){ +},{"minilog":25,"util":26}],54:[function(require,module,exports){ 'use strict'; var minilog = require('minilog') @@ -7319,7 +7215,7 @@ function jsonError(url, body) { return error; } -},{"../is_continuation":36,"minilog":27}],57:[function(require,module,exports){ +},{"../is_continuation":34,"minilog":25}],55:[function(require,module,exports){ 'use strict'; var isContinuation = require('../is_continuation'); @@ -7334,7 +7230,7 @@ module.exports = function resetLastStep(t) { return true; }; -},{"../is_continuation":36}],58:[function(require,module,exports){ +},{"../is_continuation":34}],56:[function(require,module,exports){ 'use strict'; var isContinuation = require('../is_continuation'); @@ -7349,7 +7245,7 @@ module.exports = function resetLastStep(t) { return true; }; -},{"../is_continuation":36}],59:[function(require,module,exports){ +},{"../is_continuation":34}],57:[function(require,module,exports){ 'use strict'; var minilog = require('minilog') @@ -7382,7 +7278,7 @@ module.exports = function resolveNextUrl(t) { return true; }; -},{"minilog":27,"underscore.string":30,"url":31}],60:[function(require,module,exports){ +},{"minilog":25,"underscore.string":28,"url":29}],58:[function(require,module,exports){ 'use strict'; var minilog = require('minilog') @@ -7415,7 +7311,7 @@ module.exports = function resolveUriTemplate(t) { -},{"minilog":27,"underscore.string":30,"url-template":64,"util":28}],61:[function(require,module,exports){ +},{"minilog":25,"underscore.string":28,"url-template":62,"util":26}],59:[function(require,module,exports){ 'use strict'; var minilog = require('minilog') @@ -7454,7 +7350,7 @@ function findNextStep(t, link) { } } -},{"minilog":27}],62:[function(require,module,exports){ +},{"minilog":25}],60:[function(require,module,exports){ 'use strict'; var minilog = require('minilog') @@ -7531,7 +7427,7 @@ function isAborted(t) { return t.aborted; } -},{"./abort_traversal":32,"./is_continuation":36,"./transforms/apply_transforms":42,"./transforms/check_http_status":43,"./transforms/fetch_resource":54,"./transforms/parse":56,"./transforms/reset_continuation":57,"./transforms/reset_last_step":58,"./transforms/resolve_next_url":59,"./transforms/resolve_uri_template":60,"./transforms/switch_to_next_step":61,"minilog":27}],63:[function(require,module,exports){ +},{"./abort_traversal":30,"./is_continuation":34,"./transforms/apply_transforms":40,"./transforms/check_http_status":41,"./transforms/fetch_resource":52,"./transforms/parse":54,"./transforms/reset_continuation":55,"./transforms/reset_last_step":56,"./transforms/resolve_next_url":57,"./transforms/resolve_uri_template":58,"./transforms/switch_to_next_step":59,"minilog":25}],61:[function(require,module,exports){ (function (process){ 'use strict'; @@ -7605,7 +7501,7 @@ exports.registerMediaType = mediaTypeRegistry.register; exports.mediaTypes = mediaTypes; }).call(this,require('_process')) -},{"./lib/builder":34,"./lib/media_type_registry":38,"./lib/media_types":39,"_process":17,"minilog":27}],64:[function(require,module,exports){ +},{"./lib/builder":32,"./lib/media_type_registry":36,"./lib/media_types":37,"_process":64,"minilog":25}],62:[function(require,module,exports){ (function (root, factory) { if (typeof exports === 'object') { module.exports = factory(); @@ -7786,6 +7682,110 @@ exports.mediaTypes = mediaTypes; return new UrlTemplate(); })); +},{}],63:[function(require,module,exports){ + +var indexOf = [].indexOf; + +module.exports = function(arr, obj){ + if (indexOf) return arr.indexOf(obj); + for (var i = 0; i < arr.length; ++i) { + if (arr[i] === obj) return i; + } + return -1; +}; +},{}],64:[function(require,module,exports){ +// shim for using process in browser + +var process = module.exports = {}; +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = setTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + clearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + setTimeout(drainQueue, 0); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + },{}],65:[function(require,module,exports){ var indexOf = require('indexof'); @@ -7926,7 +7926,7 @@ exports.createContext = Script.createContext = function (context) { return copy; }; -},{"indexof":14}],"ec.datamanager.js":[function(require,module,exports){ +},{"indexof":63}],"ec.datamanager.js":[function(require,module,exports){ 'use strict'; module.exports = require('./lib/DataManager'); diff --git a/build/datamanager.min.js b/build/datamanager.min.js index 0f5afbe..15f89e7 100644 --- a/build/datamanager.min.js +++ b/build/datamanager.min.js @@ -1,3 +1,3 @@ -!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.DataManager=a()}}(function(){var define,module,exports;return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;gd;++d)Object.prototype.hasOwnProperty.call(b,a[d])||(c.push(a[d]),b[a[d]]=1);return c}function e(a){for(var b=[],c=0;c0&&(i.files=l)}if(!a&&!b&&"image"!==i.type)return i.files[0].url;var m=i.files[0];if(i.files=f(i.files,function(a){return null===a.resolution}),0===i.files.length)return m.url;i.files.sort(function(a,b){var c=Math.max(a.resolution.height,a.resolution.width),d=Math.max(b.resolution.height,b.resolution.width);return d>c?1:c>d?-1:0});var n=i.files.filter(function(a){return b?-1!==a.url.indexOf("_thumb"):-1===a.url.indexOf("_thumb")}),o=n[0];return c&&(n=n.filter(function(a){return a.resolution.height>=c||a.resolution.width>=c}),n=n.slice(-1)),n.length>0?n[0].url:o.url},b.exports=j},{"./util":7,halfred:10,locale:16}],2:[function(a,b,c){"use strict";var d=a("halfred"),e=a("superagent"),f=a("shiro-trie"),g=a("traverson"),h=a("traverson-hal"),i=a("./Asset"),j=(a("./Entry"),a("./Model")),k=a("./User"),l=a("./Tag"),m=a("./util");a("es6-promise").polyfill(),g.registerMediaType(h.mediaType,h);var n=function(a){if(!a||!a.hasOwnProperty("url")&&!a.hasOwnProperty("id"))throw new Error("ec_sdk_no_url_or_id_set");if(a.hasOwnProperty("url")?this.url=a.url:(this.id=a.id,this.url="https://datamanager.entrecode.de/api/"+this.id),"/"===this.url.slice(-1)&&(this.url=this.url.substr(0,this.url.length-1)),this.id||(this.id=this.url.split("/").reverse()[0]),this._fileUrl=this.url.replace("api/"+this.id,"files"),this._modelCache={},!/^[a-f0-9]+$/i.test(this.id))throw new Error("ec_sdk_invalid_url");a.hasOwnProperty("accessToken")&&(this.accessToken=a.accessToken),a.hasOwnProperty("clientID")&&(this.clientID=a.clientID),a.hasOwnProperty("errorHandler")&&(this.errorHandler=a.errorHandler),m._dm=this};n._fileUrl="https://datamanager.entrecode.de/files",n._getFileUrl=function(a,b,c){return new Promise(function(d,f){if(!a)return f(new Error("ec_sdk_no_assetid_provided"));var g=e.get(c+"/"+a+"/url");b&&g.set("Accept-Language",b),g.end(function(a,b){return a?f(a):b.body.hasOwnProperty("url")?d(b.body.url):f(new Error("ec_sdk_could_not_get_url_for_file"))})})},n._getImageUrl=function(a,b,c,d){return new Promise(function(f,g){if(!a)return g(new Error("ec_sdk_no_assetid_provided"));var h=e.get(d+"/"+a+"/url");c&&h.set("Accept-Language",c),b&&h.query({size:b}),h.end(function(a,b){return a?g(a):b.body.hasOwnProperty("url")?f(b.body.url):g(new Error("ec_sdk_could_not_get_url_for_file"))})})},n._getImageThumbUrl=function(a,b,c,d){return new Promise(function(f,g){if(!a)return g(new Error("ec_sdk_no_assetid_provided"));b=b&&50>=b?50:b&&100>=b?100:b&&200>=b?200:400;var h=e.get(d+"/"+a+"/url");c&&h.set("Accept-Language",c),h.query({size:b,thumb:!0}),h.end(function(a,b){return a?g(a):b.body.hasOwnProperty("url")?f(b.body.url):g(new Error("ec_sdk_could_not_get_url_for_file"))})})},n.getFileUrl=function(a,b){return n._getFileUrl(a,b,n._fileUrl)},n.getImageUrl=function(a,b,c){return n._getImageUrl(a,b,c,n._fileUrl)},n.getImageThumbUrl=function(a,b,c){return n._getImageThumbUrl(a,b,c,n._fileUrl)},n.prototype.getFileUrl=function(a,b){return n._getFileUrl(a,b,this._fileUrl)},n.prototype.getImageUrl=function(a,b,c){return n._getImageUrl(a,b,c,this._fileUrl)},n.prototype.getImageThumbUrl=function(a,b,c){return n._getImageThumbUrl(a,b,c,this._fileUrl)},n.prototype.resolve=function(){var a=this;return new Promise(function(b,c){g.from(a.url).jsonHal().withRequestOptions(a._requestOptions()).get(function(e,f,g){m.checkResponse(e,f).then(function(c){var e=d.parse(JSON.parse(c.body));return a._rootTraversal=g,a.metadata=e,b(a)})["catch"](c)})})},n.prototype.modelList=function(){var a=this;return new Promise(function(b,c){g.from(a.url).jsonHal().withRequestOptions(a._requestOptions()).get(function(d,e,f){m.checkResponse(d,e).then(function(c){var d=JSON.parse(c.body),e={};for(var g in d.models)e[d.models[g].title]=new j(d.models[g].title,d.models[g],a);return a._modelCache=e,a._rootTraversal=f,b(e)})["catch"](c)})})},n.prototype.model=function(a,b){var c=this;return c._modelCache[a]?c._modelCache[a]:c._modelCache[a]=new j(a,b,c)},n.prototype.assetList=function(a){var b=this;return new Promise(function(c,e){b._getTraversal().then(function(f){var g=f["continue"]().newRequest().follow("ec:api/assets");a&&g.withTemplateParameters(m.optionsToQueryParameter(a)),g.withRequestOptions(b._requestOptions()).get(function(a,f,g){m.checkResponse(a,f).then(function(a){var e=d.parse(JSON.parse(a.body));if(e.hasOwnProperty("count")&&0===e.count&&e.hasOwnProperty("total"))return c({assets:[],count:e.count,total:e.total});var f=e.embeddedArray("ec:api/asset"),g=[];if(f)for(var h in f)f.hasOwnProperty(h)&&g.push(new i(f[h],b));else g.push(new i(e,b));return c({assets:g,count:e.count,total:e.total})})["catch"](e)})})})},n.prototype.assets=function(a){var b=this;return new Promise(function(c,d){b.assetList(a).then(function(a){return c(a.assets)})["catch"](d)})},n.prototype.asset=function(a){var b=this;return new Promise(function(c,e){if(!a)return e(new Error("ec_sdk_no_assetid_provided"));var f={};"string"==typeof a?f.filter={assetID:{exact:a}}:f=a,b._getTraversal().then(function(a){a["continue"]().newRequest().follow("ec:api/assets").withTemplateParameters(m.optionsToQueryParameter(f)).withRequestOptions(b._requestOptions()).get(function(a,f,g){m.checkResponse(a,f).then(function(a){var f=d.parse(JSON.parse(a.body));if(f.hasOwnProperty("count")&&f.hasOwnProperty("total")){var h=f.embeddedResource("ec:api/asset");return h?c(new i(h,b,g)):e(new Error("ec_sdk_no_match_due_to_filter"))}return c(new i(f,b,g))})["catch"](e)})})})},n.prototype.createAsset=function(a){var b=this;return new Promise(function(c,f){b._getTraversal().then(function(g){g["continue"]().newRequest().follow("ec:api/assets").getUrl(function(g,h){if(g)return f(g);var i=e.post(h);if(b.accessToken&&i.set("Authorization","Bearer "+b.accessToken),"string"==typeof a)i.attach("file",a);else if(Array.isArray(a))for(var j in a)i.attach("file",a[j]);else i.send(a);i.end(function(a,e){m.checkResponse(a,e).then(function(a){var e=/^.*\?assetID=([0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12})$/,f=d.parse(a.body),g=f.linkArray("ec:asset"),h=[];for(var i in g)h.push(b.asset(e.exec(g[i].href)[1]));return c(h)})["catch"](f)})})})["catch"](f)})},n.prototype.tagList=function(a){var b=this;return new Promise(function(c,e){b._getTraversal().then(function(f){f["continue"]().newRequest().follow("ec:api/assets","ec:api/tags").withTemplateParameters([null,null,m.optionsToQueryParameter(a)]).withRequestOptions(b._requestOptions()).get(function(a,f,g){m.checkResponse(a,f).then(function(a){var e=d.parse(JSON.parse(a.body));if(e.hasOwnProperty("count")&&0===e.count&&e.hasOwnProperty("total"))return c({tags:[],count:e.count,total:e.total});var f=e.embeddedArray("ec:api/tag"),g=[];if(f)for(var h in f)g.push(new l(f[h],b));else g.push(new l(e,b));return c({tags:g,count:e.count,total:e.total})})["catch"](e)})})})},n.prototype.tags=function(a){var b=this;return new Promise(function(c,d){b.tagList(a).then(function(a){return c(a.tags)})["catch"](d)})},n.prototype.tag=function(a){var b=this;return new Promise(function(c,e){if(!a)return e(new Error("ec_sdk_no_tag_name_provided"));var f={};"string"==typeof a?f.filter={tag:{exact:a}}:f=a,b._getTraversal().then(function(a){a["continue"]().newRequest().follow("ec:api/assets","ec:api/tags").withTemplateParameters([null,null,m.optionsToQueryParameter(f)]).withRequestOptions(b._requestOptions()).get(function(a,f,g){m.checkResponse(a,f).then(function(a){var f=d.parse(JSON.parse(a.body));if(f.hasOwnProperty("count")&&f.hasOwnProperty("total")){var h=f.embeddedResource("ec:api/tag");return h?c(new l(h,b,g)):e(new Error("ec_sdk_no_match_due_to_filter"))}return c(new l(f,b,g))})["catch"](e)})})})},n.prototype.registerAnonymous=function(a){var b=this;return new Promise(function(c,d){b._getTraversal().then(function(e){var f=e["continue"]().newRequest().follow(b.id+":_auth/anonymous");a&&f.withTemplateParameters({validUntil:a}),f.post({},function(a,e,f){m.checkResponse(a,e).then(function(a){var d=JSON.parse(a.body);return b.accessToken=d.jwt,b._user=new k(!0,d,b,f),c(b._user)})["catch"](d)})})})},n.prototype.account=function(){var a=this;return new Promise(function(b,c){return a.accessToken?void g.from(a.url).jsonHal().withRequestOptions(a._requestOptions()).get(function(e,f,g){m.checkResponse(e,f).then(function(c){var e=d.parse(JSON.parse(c.body));return a._rootTraversal=g,a.metadata=e,b(a.metadata.account)})["catch"](c)}):c(new Error("ec_sdk_not_logged_in"))})},n.prototype.getAuthLink=function(a,b){var c=this;return new Promise(function(d,e){c.clientID&&(b||(b={}),b.hasOwnProperty("clientID")||(b.clientID=c.clientID)),c._getTraversal().then(function(f){var g=f["continue"]().newRequest().follow(c.id+":_auth/"+a);b&&g.withTemplateParameters(b),g.getUrl(function(a,b){return a?e(a):d(b)})})["catch"](e)})},n.prototype.emailAvailable=function(a){var b=this;return new Promise(function(c,d){b._getTraversal().then(function(e){e["continue"]().newRequest().follow(b.id+":_auth/email-available").withTemplateParameters({email:a}).get(function(a,b){m.checkResponse(a,b).then(function(a){return c(JSON.parse(a.body).available)})["catch"](d)})})})},n.prototype.can=function(a){var b=this,c=a.split(":")[0];return new Promise(function(e,g){b._getTraversal().then(function(h){h["continue"]().newRequest().follow(b.id+":"+c+"/_permissions").withRequestOptions(b._requestOptions()).get(function(b,c){m.checkResponse(b,c).then(function(b){var c=d.parse(JSON.parse(b.body)),h=f["new"]();return h.add(c.permissions),h.check(a)?e(!0):g(new Error("permission_denied"))})["catch"](g)})})["catch"](g)})},n.prototype.logout=function(){this.accessToken=null,this._rootTraversal=null},n.prototype._getTraversal=function(){var a=this;return new Promise(function(b,c){return a._rootTraversal?b(a._rootTraversal):void g.from(a.url).jsonHal().withRequestOptions(a._requestOptions()).get(function(d,e,f){m.checkResponse(d,e).then(function(c){return a._rootTraversal=f,b(f)})["catch"](c)})})},n.prototype._requestOptions=function(a){var b={};if(b.headers={},this.accessToken&&(b.headers.Authorization="Bearer "+this.accessToken),a)for(var c in a)b.headers[c]=a[c];return b},b.exports=n},{"./Asset":1,"./Entry":3,"./Model":4,"./Tag":5,"./User":6,"./util":7,"es6-promise":9,halfred:10,"shiro-trie":20,superagent:21,traverson:63,"traverson-hal":22}],3:[function(a,b,c){"use strict";var d=a("halfred"),e=a("./util"),f=function(a,b,c,d){this.value=a,this._dm=b,this._model=c,this._traversal=d};f.prototype.save=function(){var a=this;return new Promise(function(b,c){a._model._getTraversal().then(function(f){delete a.value._curies,delete a.value._curiesMap,delete a.value._resolvedCuriesMap,delete a.value._validation,delete a.value._original,delete a.value._embedded,f["continue"]().newRequest().follow(a._dm.id+":"+a._model.title).withTemplateParameters({_id:a.value._id}).withRequestOptions(a._dm._requestOptions({"Content-Type":"application/json"})).put(a.value,function(f,g,h){e.checkResponse(f,g).then(function(c){return 204===c.statusCode?b(!0):(a.value=d.parse(JSON.parse(c.body)),a._traversal=h,b(a))})["catch"](c)})})["catch"](c)})},f.prototype["delete"]=function(){var a=this;return new Promise(function(b,c){a._model._getTraversal().then(function(d){d["continue"]().newRequest().follow(a._dm.id+":"+a._model.title).withTemplateParameters({_id:a.value._id}).withRequestOptions(a._dm._requestOptions())["delete"](function(a,d){e.checkResponse(a,d).then(function(){return b(!0)})["catch"](c)})})["catch"](c)})},f.prototype.getTitle=function(a){var b=this.value.linkArray(this._dm.id+":"+this._model.title+"/"+a);if(b){if(1===b.length)return b[0].title;var c=[];for(var d in b)b.hasOwnProperty(d)&&c.push(b[d].title);return c}},b.exports=f},{"./util":7,halfred:10}],4:[function(a,b,c){"use strict";function d(a,b,c){for(var f in a.value._links){var g=/^[a-f0-9]{8}:.+\/(.+)$/.exec(f);g&&(Array.isArray(a.value[g[1]])?a.value[g[1]]=a.value[g[1]].map(function(a){if(a.hasOwnProperty("assetID"))return new h(e.parse(a),b);var f=new i(e.parse(a),b,c);return d(f,b,c),f}):(a.value[g[1]].hasOwnProperty("assetID")&&(a.value[g[1]]=new h(e.parse(a.value[g[1]]),b)),a.value[g[1]]=new i(e.parse(a.value[g[1]]),b,c),d(a.value[g[1]],b,c)))}}var e=a("halfred"),f=a("superagent"),g=a("traverson"),h=a("./Asset"),i=a("./Entry"),j=a("./util"),k=function(a,b,c){this.id=a,this.title=a,this.metadata=b,this._traversal=null,this._dm=c};k.prototype._getTraversal=function(){var a=this;return new Promise(function(b,c){return a._traversal?b(a._traversal):(a._dm._rootTraversal&&a._dm._rootTraversal["continue"]().newRequest().withRequestOptions(a._dm._requestOptions()).get(function(d,e,f){j.checkResponse(d,e).then(function(){return a._traversal=f,b(f)})["catch"](c)}),void g.from(a._dm.url).jsonHal().withRequestOptions(a._dm._requestOptions()).get(function(d,e,f){j.checkResponse(d,e).then(function(c){return a._traversal=f,b(f)})["catch"](c)}))})},k.prototype.resolve=function(){var a=this;return new Promise(function(b,c){g.from(a._dm.url).jsonHal().withRequestOptions(a._dm._requestOptions()).get(function(d,e,f){j.checkResponse(d,e).then(function(d){for(var e=JSON.parse(d.body),g=0;g=200&&b.statusCode<=299?d(b):e(JSON.parse(b.body))})},b.exports=d},{}],8:[function(a,b,c){function d(a){return a?e(a):void 0}function e(a){for(var b in d.prototype)a[b]=d.prototype[b];return a}b.exports=d,d.prototype.on=d.prototype.addEventListener=function(a,b){return this._callbacks=this._callbacks||{},(this._callbacks["$"+a]=this._callbacks["$"+a]||[]).push(b),this},d.prototype.once=function(a,b){function c(){this.off(a,c),b.apply(this,arguments)}return c.fn=b,this.on(a,c),this},d.prototype.off=d.prototype.removeListener=d.prototype.removeAllListeners=d.prototype.removeEventListener=function(a,b){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var c=this._callbacks["$"+a];if(!c)return this;if(1==arguments.length)return delete this._callbacks["$"+a],this;for(var d,e=0;ed;++d)c[d].apply(this,b)}return this},d.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks["$"+a]||[]},d.prototype.hasListeners=function(a){return!!this.listeners(a).length}},{}],9:[function(a,b,c){(function(c,d){(function(){"use strict";function e(a){return"function"==typeof a||"object"==typeof a&&null!==a}function f(a){return"function"==typeof a}function g(a){T=a}function h(a){X=a}function i(){return function(){c.nextTick(n)}}function j(){return function(){S(n)}}function k(){var a=0,b=new $(n),c=document.createTextNode("");return b.observe(c,{characterData:!0}),function(){c.data=a=++a%2}}function l(){var a=new MessageChannel;return a.port1.onmessage=n,function(){a.port2.postMessage(0)}}function m(){return function(){setTimeout(n,1)}}function n(){for(var a=0;W>a;a+=2){var b=ba[a],c=ba[a+1];b(c),ba[a]=void 0,ba[a+1]=void 0}W=0}function o(){try{var b=a,c=b("vertx");return S=c.runOnLoop||c.runOnContext,j()}catch(d){return m()}}function p(a,b){var c=this,d=c._state;if(d===fa&&!a||d===ga&&!b)return this;var e=new this.constructor(r),f=c._result;if(d){var g=arguments[d-1];X(function(){H(d,e,g,f)})}else D(c,e,a,b);return e}function q(a){var b=this;if(a&&"object"==typeof a&&a.constructor===b)return a;var c=new b(r);return z(c,a),c}function r(){}function s(){return new TypeError("You cannot resolve a promise with itself")}function t(){return new TypeError("A promises callback cannot return that same promise.")}function u(a){try{return a.then}catch(b){return ha.error=b,ha}}function v(a,b,c,d){try{a.call(b,c,d)}catch(e){return e}}function w(a,b,c){X(function(a){var d=!1,e=v(c,b,function(c){d||(d=!0,b!==c?z(a,c):B(a,c))},function(b){d||(d=!0,C(a,b))},"Settle: "+(a._label||" unknown promise"));!d&&e&&(d=!0,C(a,e))},a)}function x(a,b){b._state===fa?B(a,b._result):b._state===ga?C(a,b._result):D(b,void 0,function(b){z(a,b)},function(b){C(a,b)})}function y(a,b,c){b.constructor===a.constructor&&c===ca&&constructor.resolve===da?x(a,b):c===ha?C(a,ha.error):void 0===c?B(a,b):f(c)?w(a,b,c):B(a,b)}function z(a,b){a===b?C(a,s()):e(b)?y(a,b,u(b)):B(a,b)}function A(a){a._onerror&&a._onerror(a._result),E(a)}function B(a,b){a._state===ea&&(a._result=b,a._state=fa,0!==a._subscribers.length&&X(E,a))}function C(a,b){a._state===ea&&(a._state=ga,a._result=b,X(A,a))}function D(a,b,c,d){var e=a._subscribers,f=e.length;a._onerror=null,e[f]=b,e[f+fa]=c,e[f+ga]=d,0===f&&a._state&&X(E,a)}function E(a){var b=a._subscribers,c=a._state;if(0!==b.length){for(var d,e,f=a._result,g=0;gg;g++)D(d.resolve(a[g]),void 0,b,c);return e}function L(a){var b=this,c=new b(r);return C(c,a),c}function M(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function N(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function O(a){this._id=ma++,this._state=void 0,this._result=void 0,this._subscribers=[],r!==a&&("function"!=typeof a&&M(),this instanceof O?I(this,a):N())}function P(a,b){this._instanceConstructor=a,this.promise=new a(r),Array.isArray(b)?(this._input=b,this.length=b.length,this._remaining=b.length,this._result=new Array(this.length),0===this.length?B(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&B(this.promise,this._result))):C(this.promise,this._validationError())}function Q(){var a;if("undefined"!=typeof d)a=d;else if("undefined"!=typeof self)a=self;else try{a=Function("return this")()}catch(b){throw new Error("polyfill failed because global object is unavailable in this environment")}var c=a.Promise;(!c||"[object Promise]"!==Object.prototype.toString.call(c.resolve())||c.cast)&&(a.Promise=na)}var R;R=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)};var S,T,U,V=R,W=0,X=function(a,b){ba[W]=a,ba[W+1]=b,W+=2,2===W&&(T?T(n):U())},Y="undefined"!=typeof window?window:void 0,Z=Y||{},$=Z.MutationObserver||Z.WebKitMutationObserver,_="undefined"!=typeof c&&"[object process]"==={}.toString.call(c),aa="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,ba=new Array(1e3);U=_?i():$?k():aa?l():void 0===Y&&"function"==typeof a?o():m();var ca=p,da=q,ea=void 0,fa=1,ga=2,ha=new F,ia=new F,ja=J,ka=K,la=L,ma=0,na=O;O.all=ja,O.race=ka,O.resolve=da,O.reject=la,O._setScheduler=g,O._setAsap=h,O._asap=X,O.prototype={constructor:O,then:ca,"catch":function(a){return this.then(null,a)}};var oa=P;P.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},P.prototype._enumerate=function(){for(var a=this.length,b=this._input,c=0;this._state===ea&&a>c;c++)this._eachEntry(b[c],c)},P.prototype._eachEntry=function(a,b){var c=this._instanceConstructor,d=c.resolve;if(d===da){var e=u(a);if(e===ca&&a._state!==ea)this._settledAt(a._state,b,a._result);else if("function"!=typeof e)this._remaining--,this._result[b]=a;else if(c===na){var f=new c(r);y(f,a,e),this._willSettleAt(f,b)}else this._willSettleAt(new c(function(b){b(a)}),b)}else this._willSettleAt(d(a),b)},P.prototype._settledAt=function(a,b,c){var d=this.promise;d._state===ea&&(this._remaining--,a===ga?C(d,c):this._result[b]=c),0===this._remaining&&B(d,this._result)},P.prototype._willSettleAt=function(a,b){var c=this;D(a,void 0,function(a){c._settledAt(fa,b,a)},function(a){c._settledAt(ga,b,a)})};var pa=Q,qa={Promise:na,polyfill:pa};"function"==typeof define&&define.amd?define(function(){return qa}):"undefined"!=typeof b&&b.exports?b.exports=qa:"undefined"!=typeof this&&(this.ES6Promise=qa),pa()}).call(this)}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:17}],10:[function(a,b,c){var d=a("./lib/parser"),e=a("./lib/resource"),f=!1;b.exports={parse:function(a){return(new d).parse(a,f)},enableValidation:function(a){f=null!=a?a:!0},disableValidation:function(){f=!1},Resource:e}},{"./lib/parser":12,"./lib/resource":13}],11:[function(a,b,c){"use strict";function d(){arguments.length>=1?this._array=arguments[0]:this._array=[]}d.prototype.array=function(){return this._array},d.prototype.isEmpty=function(a){return 0===this._array.length},d.prototype.push=function(a){var b=this._array.slice(0);return b.push(a),new d(b)},d.prototype.pop=function(){var a=this._array.slice(0,this._array.length-1);return new d(a)},d.prototype.peek=function(){if(this.isEmpty())throw new Error("can't peek on empty stack");return this._array[this._array.length-1]},b.exports=d},{}],12:[function(a,b,c){"use strict";function d(){}function e(a,b,c){if(null==a)return a;var d=f(a._links,b,c.push("_links")),e=g(d),j=h(a._embedded,b,c.push("_embedded")),k=new t(d,e,j,b);return i(a,k),k._original=a,k}function f(a,b,c){return a=j(a,l,b,c),(null==a||null==a.self)&&p("Resource does not have a self link",b,c),a}function g(a){return a?a.curies:[]}function h(a,b,c){var d=j(a,o,b,c);return null==d?d:(Object.keys(d).forEach(function(a){d[a]=d[a].map(function(d){var f=null!=b?[]:null,g=e(d,f,c.push(a));return g._original=d,g})}),d)}function i(a,b){Object.keys(a).forEach(function(c){"_links"!==c&&"_embedded"!==c&&(b[c]=a[c])})}function j(a,b,c,d){if(null==a)return a;var e={};return Object.keys(a).forEach(function(f){e[f]=k(f,a[f],b,c,d)}),e}function k(a,b,c,d,e){return m(b)?b.map(function(b){return c(a,b,d,e)}):[c(a,b,d,e)]}function l(a,b,c,d){if(!n(b))throw new Error("Link object is not an actual object: "+b+" ["+typeof b+"]");var e=r(b);return Object.keys(v).forEach(function(b){null==e[b]&&(v[b].required&&p("Link misses required property "+b+".",c,d.push(a)),null!=v[b].defaultValue&&(e[b]=v[b].defaultValue))}),e.deprecation&&q("Warning: Link "+s(d.push(a))+" is deprecated, see "+e.deprecation),e.templated!==!0&&e.templated!==!1&&(e.templated=!1),c?(e.href&&e.href.indexOf("{")>=0&&!e.templated&&p('Link seems to be an URI template but its "templated" property is not set to true.',c,d.push(a)),e):e}function m(a){return"[object Array]"===Object.prototype.toString.call(a)}function n(a){return"object"==typeof a}function o(a,b){return b}function p(a,b,c){b&&b.push({path:s(c),message:a})}function q(a){"undefined"!=typeof console&&"function"==typeof console.log&&console.log(a)}function r(a){var b={};return Object.keys(a).forEach(function(c){ -b[c]=a[c]}),b}function s(a){for(var b="$.",c=0;c=1?d[c]:null}d.prototype._initCuries=function(a){if(this._curiesMap={},a){this._curies=a;for(var b=0;b=1){var e=a.href.replace(/(.*){(.*)}(.*)/,"$1"+c[1]+"$3");this._resolvedCuriesMap[e]=b}else this._resolvedCuriesMap[a.href]=b},d.prototype.allLinkArrays=function(){return this._links},d.prototype.linkArray=function(a){return e(this._links,a)},d.prototype.link=function(a,b){return f(this._links,a,b)},d.prototype.hasCuries=function(a){return this._curies.length>0},d.prototype.curieArray=function(a){return this._curies},d.prototype.curie=function(a){return this._curiesMap[a]},d.prototype.reverseResolveCurie=function(a){return this._resolvedCuriesMap[a]},d.prototype.allEmbeddedResourceArrays=function(){return this._embedded},d.prototype.embeddedResourceArray=function(a){return e(this._embedded,a)},d.prototype.embeddedResource=function(a,b){return f(this._embedded,a,b)},d.prototype.original=function(){return this._original},d.prototype.validationIssues=function(){return this._validation},d.prototype.allLinks=d.prototype.allLinkArrays,d.prototype.allEmbeddedArrays=d.prototype.allEmbeddedResources=d.prototype.allEmbeddedResourceArrays,d.prototype.embeddedArray=d.prototype.embeddedResourceArray,d.prototype.embedded=d.prototype.embeddedResource,d.prototype.validation=d.prototype.validationIssues,b.exports=d},{}],14:[function(a,b,c){var d=[].indexOf;b.exports=function(a,b){if(d)return a.indexOf(b);for(var c=0;c1&&j.shift();var k=this._trace(j,b,["$"],h,i,c);return k=k.filter(function(a){return a&&!a.isParentSelector}),k.length?1!==k.length||g||Array.isArray(k[0].value)?k.reduce(function(a,b){var c=e._getPreferredOutput(b);return f&&Array.isArray(c)?a=a.concat(c):a.push(c),a},[]):this._getPreferredOutput(k[0]):g?[]:void 0}},JSONPath.prototype._getPreferredOutput=function(a){var b=this.currResultType;switch(b){case"all":return a.path="string"==typeof a.path?a.path:JSONPath.toPathString(a.path),a;case"value":case"parent":case"parentProperty":return a[b];case"path":return JSONPath.toPathString(a[b]);case"pointer":return JSONPath.toPointer(a.path)}},JSONPath.prototype._handleCallback=function(a,b,c){if(b){var d=this._getPreferredOutput(a);a.path="string"==typeof a.path?a.path:JSONPath.toPathString(a.path),b(d,c,a)}},JSONPath.prototype._trace=function(a,b,c,d,e,f){function g(a){l=l.concat(a)}var h,i=this;if(!a.length)return h={path:c,value:b,parent:d,parentProperty:e},this._handleCallback(h,f,"value"),h;var j=a[0],k=a.slice(1),l=[];if(b&&Object.prototype.hasOwnProperty.call(b,j))g(this._trace(k,b[j],push(c,j),b,j,f));else if("*"===j)this._walk(j,k,b,c,d,e,f,function(a,b,c,d,e,f,h,j){g(i._trace(unshift(a,c),d,e,f,h,j))});else if(".."===j)g(this._trace(k,b,c,d,e,f)),this._walk(j,k,b,c,d,e,f,function(a,b,c,d,e,f,h,j){"object"==typeof d[a]&&g(i._trace(unshift(b,c),d[a],push(e,a),d,a,j))});else if("("===j[0]){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");g(this._trace(unshift(this._eval(j,b,c[c.length-1],c.slice(0,-1),d,e),k),b,c,d,e,f))}else{if("^"===j)return c.length?{path:c.slice(0,-1),expr:k,isParentSelector:!0}:[];if("~"===j)return h={path:push(c,j),value:e,parent:d,parentProperty:null},this._handleCallback(h,f,"property"),h;if("$"===j)g(this._trace(k,b,c,null,null,f));else if(0===j.indexOf("?(")){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");this._walk(j,k,b,c,d,e,f,function(a,b,c,d,e,f,h,j){i._eval(b.replace(/^\?\((.*?)\)$/,"$1"),d[a],a,e,f,h)&&g(i._trace(unshift(a,c),d,e,f,h,j))})}else if(j.indexOf(",")>-1){var m,n;for(m=j.split(","),n=0;ni;i++)h(i,a,b,c,d,e,f,g);else if("object"==typeof c)for(k in c)Object.prototype.hasOwnProperty.call(c,k)&&h(k,a,b,c,d,e,f,g)},JSONPath.prototype._slice=function(a,b,c,d,e,f,g){if(Array.isArray(c)){var h,i=c.length,j=a.split(":"),k=j[0]&&parseInt(j[0],10)||0,l=j[1]&&parseInt(j[1],10)||i,m=j[2]&&parseInt(j[2],10)||1;k=0>k?Math.max(0,k+i):Math.min(i,k),l=0>l?Math.max(0,l+i):Math.min(i,l);var n=[];for(h=k;l>h;h+=m)n=n.concat(this._trace(unshift(h,b),c,d,e,f,g));return n}},JSONPath.prototype._eval=function(a,b,c,d,e,f){if(!this._obj||!b)return!1;a.indexOf("@parentProperty")>-1&&(this.currSandbox._$_parentProperty=f,a=a.replace(/@parentProperty/g,"_$_parentProperty")),a.indexOf("@parent")>-1&&(this.currSandbox._$_parent=e,a=a.replace(/@parent/g,"_$_parent")),a.indexOf("@property")>-1&&(this.currSandbox._$_property=c,a=a.replace(/@property/g,"_$_property")),a.indexOf("@path")>-1&&(this.currSandbox._$_path=JSONPath.toPathString(d.concat([c])),a=a.replace(/@path/g,"_$_path")),a.match(/@([\.\s\)\[])/)&&(this.currSandbox._$_v=b,a=a.replace(/@([\.\s\)\[])/g,"_$_v$1"));try{return vm.runInNewContext(a,this.currSandbox)}catch(g){throw console.log(g),new Error("jsonPath: "+g.message+": "+a)}},JSONPath.cache={},JSONPath.toPathString=function(a){var b,c,d=a,e="$";for(b=1,c=d.length;c>b;b++)/^(~|\^|@.*?\(\))$/.test(d[b])||(e+=/^[0-9*]+$/.test(d[b])?"["+d[b]+"]":"['"+d[b]+"']");return e},JSONPath.toPointer=function(a){var b,c,d=a,e="";for(b=1,c=d.length;c>b;b++)/^(~|\^|@.*?\(\))$/.test(d[b])||(e+="/"+d[b].toString().replace(/\~/g,"~0").replace(/\//g,"~1"));return e},JSONPath.toPathArray=function(a){var b=JSONPath.cache;if(b[a])return b[a];var c=[],d=a.replace(/@(?:null|boolean|number|string|array|object|integer|undefined|nonFinite|function|other)\(\)/g,";$&;").replace(/[\['](\??\(.*?\))[\]']/g,function(a,b){return"[#"+(c.push(b)-1)+"]"}).replace(/\['([^'\]]*)'\]/g,function(a,b){return"['"+b.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/'?\.'?(?![^\[]*\])|\['?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(a,b){return";"+b.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),e=d.split(";").map(function(a){var b=a.match(/#([0-9]+)/);return b&&b[1]?c[b[1]]:a});return b[a]=e,b[a]},JSONPath.eval=function(a,b,c){return JSONPath(c,b,a)},"function"==typeof define&&define.amd?define(function(){return JSONPath}):isNode?module.exports=JSONPath:(self.jsonPath={eval:JSONPath.eval},self.JSONPath=JSONPath)}("undefined"==typeof require?null:require)},{vm:65}],16:[function(a,b,c){(function(a){(function(){var c,d,e,f,g=[].slice;e=function(a){return a instanceof d||(a=new d(a),a.index()),function(b,c,e){var f,g;return g=new d(b.headers["accept-language"]),f=g.best(a),b.locale=String(f),b.rawLocale=f,e()}},e.Locale=function(){function b(a){var b,c,d,e;(d=null!=a?a.match(/[a-z]+/gi):void 0)&&(c=d[0],b=d[1],this.code=a,this.language=c.toLowerCase(),b&&(this.country=b.toUpperCase()),e=[this.language],this.country&&e.push(this.country),this.normalized=e.join("_"))}var c;return b["default"]=new b(a.env.LANG||"en_US"),c=function(){return this.language?this.code:null},b.prototype.toString=c,b.prototype.toJSON=c,b}(),e.Locales=function(){function a(a){var b,d,e,f,g,h,i;if(a){for(h=String(a).split(","),f=0,g=h.length;g>f;f++)b=h[f],i=b.split(";"),d=i[0],e=i[1],d=new c(d.trim()),d.score=e?+e.slice(2)||0:1,this.push(d);this.sort(function(a,b){return b.score-a.score})}}var b;return a.prototype.length=0,a.prototype._index=null,a.prototype.sort=Array.prototype.sort,a.prototype.push=Array.prototype.push,a.prototype.index=function(){var a,b,c,d;if(!this._index)for(this._index={},a=c=0,d=this.length;d>c;a=++c)b=this[a],this._index[b.normalized]=a;return this._index},a.prototype.best=function(a){var b,d,e,f,g,h,i,j,k,l,m;if(i=function(a){var b;return b=a,b.defaulted=!1,b},g=c["default"],g.defaulted=!0,!a)return this[0]&&(g=this[0],g.defaulted=!0),g;for(b=a.index(),j=0,l=this.length;l>j;j++){if(d=this[j],h=b[d.normalized],f=b[d.language],null!=h)return i(a[h]);if(null!=f)return i(a[f]);for(k=0,m=a.length;m>k;k++)if(e=a[k],e.language===d.language)return i(e)}return g},b=function(){return g.call(this)},a.prototype.toJSON=b,a.prototype.toString=function(){return String(this.toJSON())},a}(),f=b.exports=e,c=f.Locale,d=f.Locales}).call(this)}).call(this,a("_process"))},{_process:17}],17:[function(a,b,c){function d(){k=!1,h.length?j=h.concat(j):l=-1,j.length&&e()}function e(){if(!k){var a=setTimeout(d);k=!0;for(var b=j.length;b;){for(h=j,j=[];++l1)for(var c=1;cd;)f=b.call(null,f,a[d],++d,a);return f}},{}],19:[function(a,b,c){void function(a,d){"function"==typeof define&&define.amd?define(d):"object"==typeof c?b.exports=d():a.resolveUrl=d()}(this,function(){function a(){var a=arguments.length;if(0===a)throw new Error("resolveUrl requires at least one argument; got none.");var b=document.createElement("base");if(b.href=arguments[0],1===a)return b.href;var c=document.getElementsByTagName("head")[0];c.insertBefore(b,c.firstChild);for(var d,e=document.createElement("a"),f=1;a>f;f++)e.href=arguments[f],d=e.href,b.href=d;return c.removeChild(b),d}return a})},{}],20:[function(a,b,c){"use strict";function d(a){for(var b={},c=[],d=0,e=a.length;e>d;++d)Object.prototype.hasOwnProperty.call(b,a[d])||(c.push(a[d]),b[a[d]]=1);return c}function e(a,b){var c,d,f,g,h,i;for(f=a,i=!1,c=0;c1?(i=i||b.slice(c+1),f[h[d]]=e(f[h[d]],i),c=b.length):(g=f,f=f[h[d]]);return i||g&&g.hasOwnProperty("*")||(f["*"]={}),a}function f(a,b){var c,d;for(d=a,(b.length<1||"*"!==b[b.length-1])&&b.push("*"),c=0;c0&&"$"!==b[0]&&(e=e.filter(function(c){return f(a[c],b)})),e;if("$"===c){e=[],Object.keys(a).forEach(function(c){e=e.concat(g(a[c],[].concat(b)))});for(var h=d(e),i=h.length-1;i>=0;i--)"*"===h[i]&&h.splice(i,1);return h}return a.hasOwnProperty(c)?g(a[c],b):[]}function h(a){var b,c,e=[],f=a.split(":");for(b=0;bf;++f)c=e[f],b=c.split("="),d[decodeURIComponent(b[0])]=decodeURIComponent(b[1]);return d}function j(a){var b,c,d,e,f=a.split(/\r?\n/),g={};f.pop();for(var h=0,i=f.length;i>h;++h)c=f[h],b=c.indexOf(":"),d=c.slice(0,b).toLowerCase(),e=u(c.slice(b+1)),g[d]=e;return g}function k(a){return/[\/+]json\b/.test(a)}function l(a){return a.split(/ *; */).shift()}function m(a){return t(a.split(/ *; */),function(a,b){var c=b.split(/ *= */),d=c.shift(),e=c.shift();return d&&e&&(a[d]=e),a},{})}function n(a,b){b=b||{},this.req=a,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||"undefined"==typeof this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText,this.setStatusProperties(this.xhr.status),this.header=this.headers=j(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this.setHeaderProperties(this.header),this.body="HEAD"!=this.req.method?this.parseBody(this.text?this.text:this.xhr.response):null}function o(a,b){var c=this;s.call(this),this._query=this._query||[],this.method=a,this.url=b,this.header={},this._header={},this.on("end",function(){var a=null,b=null;try{b=new n(c)}catch(d){return a=new Error("Parser is unable to parse the response"),a.parse=!0,a.original=d,a.rawResponse=c.xhr&&c.xhr.responseText?c.xhr.responseText:null,c.callback(a)}if(c.emit("response",b),a)return c.callback(a,b);if(b.status>=200&&b.status<300)return c.callback(a,b);var e=new Error(b.statusText||"Unsuccessful HTTP response");e.original=a,e.response=b,e.status=b.status,c.callback(e,b)})}function p(a,b){return"function"==typeof b?new o("GET",a).end(b):1==arguments.length?new o("GET",a):new o(a,b)}function q(a,b){var c=p("DELETE",a);return b&&c.end(b),c}var r,s=a("emitter"),t=a("reduce");r="undefined"!=typeof window?window:"undefined"!=typeof self?self:this,p.getXHR=function(){if(!(!r.XMLHttpRequest||r.location&&"file:"==r.location.protocol&&r.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(a){}return!1};var u="".trim?function(a){return a.trim()}:function(a){return a.replace(/(^\s*|\s*$)/g,"")};p.serializeObject=g,p.parseString=i,p.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},p.serialize={"application/x-www-form-urlencoded":g,"application/json":JSON.stringify},p.parse={"application/x-www-form-urlencoded":i,"application/json":JSON.parse},n.prototype.get=function(a){return this.header[a.toLowerCase()]},n.prototype.setHeaderProperties=function(a){var b=this.header["content-type"]||"";this.type=l(b);var c=m(b);for(var d in c)this[d]=c[d]},n.prototype.parseBody=function(a){var b=p.parse[this.type];return b&&a&&(a.length||a instanceof Object)?b(a):null},n.prototype.setStatusProperties=function(a){1223===a&&(a=204);var b=a/100|0;this.status=this.statusCode=a,this.statusType=b,this.info=1==b,this.ok=2==b,this.clientError=4==b,this.serverError=5==b,this.error=4==b||5==b?this.toError():!1,this.accepted=202==a,this.noContent=204==a,this.badRequest=400==a,this.unauthorized=401==a,this.notAcceptable=406==a,this.notFound=404==a,this.forbidden=403==a},n.prototype.toError=function(){var a=this.req,b=a.method,c=a.url,d="cannot "+b+" "+c+" ("+this.status+")",e=new Error(d);return e.status=this.status,e.method=b,e.url=c,e},p.Response=n,s(o.prototype),o.prototype.use=function(a){return a(this),this},o.prototype.timeout=function(a){return this._timeout=a,this},o.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},o.prototype.abort=function(){return this.aborted?void 0:(this.aborted=!0,this.xhr.abort(),this.clearTimeout(),this.emit("abort"),this)},o.prototype.set=function(a,b){if(f(a)){for(var c in a)this.set(c,a[c]);return this}return this._header[a.toLowerCase()]=b,this.header[a]=b,this},o.prototype.unset=function(a){return delete this._header[a.toLowerCase()],delete this.header[a],this},o.prototype.getHeader=function(a){return this._header[a.toLowerCase()]},o.prototype.type=function(a){return this.set("Content-Type",p.types[a]||a),this},o.prototype.parse=function(a){return this._parser=a,this},o.prototype.accept=function(a){return this.set("Accept",p.types[a]||a),this},o.prototype.auth=function(a,b){var c=btoa(a+":"+b);return this.set("Authorization","Basic "+c),this},o.prototype.query=function(a){return"string"!=typeof a&&(a=g(a)),a&&this._query.push(a),this},o.prototype.field=function(a,b){return this._formData||(this._formData=new r.FormData),this._formData.append(a,b),this},o.prototype.attach=function(a,b,c){return this._formData||(this._formData=new r.FormData),this._formData.append(a,b,c||b.name),this},o.prototype.send=function(a){var b=f(a),c=this.getHeader("Content-Type");if(b&&f(this._data))for(var d in a)this._data[d]=a[d];else"string"==typeof a?(c||this.type("form"),c=this.getHeader("Content-Type"),"application/x-www-form-urlencoded"==c?this._data=this._data?this._data+"&"+a:a:this._data=(this._data||"")+a):this._data=a;return!b||e(a)?this:(c||this.type("json"),this)},o.prototype.callback=function(a,b){var c=this._callback;this.clearTimeout(),c(a,b)},o.prototype.crossDomainError=function(){var a=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");a.crossDomain=!0,a.status=this.status,a.method=this.method,a.url=this.url,this.callback(a)},o.prototype.timeoutError=function(){var a=this._timeout,b=new Error("timeout of "+a+"ms exceeded");b.timeout=a,this.callback(b)},o.prototype.withCredentials=function(){return this._withCredentials=!0,this},o.prototype.end=function(a){var b=this,c=this.xhr=p.getXHR(),f=this._query.join("&"),g=this._timeout,h=this._formData||this._data;this._callback=a||d,c.onreadystatechange=function(){if(4==c.readyState){var a;try{a=c.status}catch(d){a=0}if(0==a){if(b.timedout)return b.timeoutError();if(b.aborted)return;return b.crossDomainError()}b.emit("end")}};var i=function(a){a.total>0&&(a.percent=a.loaded/a.total*100),a.direction="download",b.emit("progress",a)};this.hasListeners("progress")&&(c.onprogress=i);try{c.upload&&this.hasListeners("progress")&&(c.upload.onprogress=i)}catch(j){}if(g&&!this._timer&&(this._timer=setTimeout(function(){b.timedout=!0,b.abort()},g)),f&&(f=p.serializeObject(f),this.url+=~this.url.indexOf("?")?"&"+f:"?"+f),c.open(this.method,this.url,!0),this._withCredentials&&(c.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof h&&!e(h)){var l=this.getHeader("Content-Type"),m=this._parser||p.serialize[l?l.split(";")[0]:""];!m&&k(l)&&(m=p.serialize["application/json"]),m&&(h=m(h))}for(var n in this.header)null!=this.header[n]&&c.setRequestHeader(n,this.header[n]);return this.emit("request",this),c.send("undefined"!=typeof h?h:null),this},o.prototype.then=function(a,b){return this.end(function(c,d){c?b(c):a(d)})},p.Request=o,p.get=function(a,b,c){var d=p("GET",a);return"function"==typeof b&&(c=b,b=null),b&&d.query(b),c&&d.end(c),d},p.head=function(a,b,c){var d=p("HEAD",a);return"function"==typeof b&&(c=b,b=null),b&&d.send(b),c&&d.end(c),d},p.del=q,p["delete"]=q,p.patch=function(a,b,c){var d=p("PATCH",a);return"function"==typeof b&&(c=b,b=null),b&&d.send(b),c&&d.end(c),d},p.post=function(a,b,c){var d=p("POST",a);return"function"==typeof b&&(c=b,b=null),b&&d.send(b),c&&d.end(c),d},p.put=function(a,b,c){var d=p("PUT",a);return"function"==typeof b&&(c=b,b=null),b&&d.send(b),c&&d.end(c),d},b.exports=p},{emitter:8,reduce:18}],22:[function(a,b,c){"use strict";function d(a){this.log=a}function e(a,b,c){var d;if(d=c||"all"===a.parsedKey.mode?a.embeddedStep||a.linkStep:a.linkStep||a.embeddedStep)return d;var e="Could not find a matching link nor an embedded document for "+b+".";throw a.linkError&&(e+=" Error while resolving linked documents: "+a.linkError),a.embeddedError&&(e+=" Error while resolving embedded documents: "+a.embeddedError),e+=" Document: "+JSON.stringify(a.doc),new Error(e)}function f(a){var b=a.match(/(.*)\[(.*):(.*)\]/);return b?{mode:"secondary",key:b[1],secondaryKey:b[2],secondaryValue:b[3],index:null}:(b=a.match(/(.*)\[(\d+)\]/))?{mode:"index",key:b[1],secondaryKey:null,secondaryValue:null,index:b[2]}:(b=a.match(/(.*)\[\$all\]/),b?{mode:"all",key:b[1],secondaryKey:null,secondaryValue:null,index:null}:{mode:"first",key:a,secondaryKey:null,secondaryValue:null,index:null})}function g(a){a.halResource.hasCuries()&&(a.parsedKey.curie=a.halResource.reverseResolveCurie(a.parsedKey.key))}function h(a,b){var c=a.halResource.linkArray(a.parsedKey.key);if(c||(c=a.halResource.linkArray(a.parsedKey.curie)),c&&0!==c.length)switch(a.parsedKey.mode){case"secondary":i(a,c,b);break;case"index":j(a,c,b);break;case"first":k(a,c,b);break;case"all":break;default:throw new Error("Illegal mode: "+a.parsedKey.mode)}}function i(a,b,c){for(var d=0;d1&&c.warn("Found HAL link array with more than one element for key "+a.parsedKey.key+", arbitrarily choosing index "+e+", because it was the first that had a href attribute."),c.debug("found hal link: "+d.href),a.linkStep={url:d.href})}function l(a,b){b.debug("checking for embedded: "+a.parsedKey.key+(a.parsedKey.index?a.parsedKey.index:""));var c=a.halResource.embeddedArray(a.parsedKey.key);if((!c||0===c.length)&&"all"!==a.parsedKey.mode)return null;switch(b.debug("Found an array of embedded resource for: "+a.parsedKey.key),a.parsedKey.mode){case"secondary":m(a,c,b);break;case"index":n(a,c,b);break;case"all":o(a,c,b);break;case"first":p(a,c,b);break;default:throw new Error("Illegal mode: "+a.parsedKey.mode)}}function m(a,b,c){for(var d=0;d1&&c.warn("Found HAL embedded resource array with more than one element for key "+a.parsedKey.key+", arbitrarily choosing first element."),a.embeddedStep={doc:b[0].original()}}var q=a("halfred");d.mediaType="application/hal+json",d.prototype.findNextStep=function(a,b){if("undefined"==typeof b||null===b)throw new Error("Link object is null or undefined.");if("object"!=typeof b)throw new Error("Links must be objects, not "+typeof b+": ",b);if(!b.type)throw new Error("Link objects has no type attribute.",b);switch(b.type){case"link-rel":return this._handleLinkRel(a,b);case"header":return this._handleHeader(a.lastStep.response,b);default:throw new Error("Link objects with type "+b.type+" are not supported by this adapter.",b)}},d.prototype._handleLinkRel=function(a,b){var c=a.lastStep.doc,d=b.value,i=a.preferEmbedded;this.log.debug("parsing hal");var j={doc:c,halResource:q.parse(c),parsedKey:f(d),linkStep:null,embeddedStep:null};return g(j),h(j,this.log),l(j,this.log),e(j,d,i)},d.prototype._handleHeader=function(a,b){switch(b.value){case"location":var c=a.headers.location;if(!c)throw new Error("Following the location header but there was no location header in the last response.");return{url:c};default:throw new Error("Link objects with type header and value "+b.value+" are not supported by this adapter.",b)}},b.exports=d},{halfred:23}],23:[function(a,b,c){var d=a("./lib/parser"),e=!1;b.exports={parse:function(a){return(new d).parse(a,e)},enableValidation:function(a){e=null!=a?a:!0},disableValidation:function(){e=!1}}},{"./lib/parser":25}],24:[function(a,b,c){arguments[4][11][0].apply(c,arguments)},{dup:11}],25:[function(a,b,c){arguments[4][12][0].apply(c,arguments)},{"./immutable_stack":24,"./resource":26,dup:12}],26:[function(a,b,c){arguments[4][13][0].apply(c,arguments)},{dup:13}],27:[function(a,b,c){"use strict";function d(a){null==a&&(a=""),this.id=a}function e(a){return new d(a)}var f=!1;d.prototype.enable=function(){this.enabled=!0},d.prototype.debug=function(a){f&&console.log(this.id+"/debug: "+a)},d.prototype.info=function(a){f&&console.log(this.id+"/info: "+a)},d.prototype.warn=function(a){f&&console.log(this.id+"/warn: "+a)},d.prototype.error=function(a){f&&console.log(this.id+"/error: "+a)},e.enable=function(){f=!0},b.exports=e},{}],28:[function(a,b,c){"use strict";b.exports={isArray:function(a){return null==a?!1:"[object Array]"===Object.prototype.toString.call(a)}}},{}],29:[function(a,b,c){"use strict";function d(){}function e(a,b){return b=b||{},f(a,b),g(a,b),h(a,b),i(a,b),j(a,b),k(a,b),a}function f(a,b){var c=b.qs;null!=c&&(a=a.query(c))}function g(a,b){var c=b.headers;null!=c&&(a=a.set(c))}function h(a,b){var c=b.auth;null!=c&&(a=a.auth(c.user||c.username,c.pass||c.password))}function i(a,b){if(null!=b){var c=b.body;null!=c&&(a=a.send(c))}}function j(a,b){ -if(null!=b){var c=b.form;null!=c&&(a=a.send(c),a=a.set("Content-Type","application/x-www-form-urlencoded"))}}function k(a,b){if(null!=b){var c=b.withCredentials;c===!0&&a.withCredentials()}}function l(a){return a.body=a.text,a.statusCode=a.status,a}function m(a){return function(b,c){if(b){if(!c)return a(b);a(null,l(c))}else a(null,l(c))}}var n=a("superagent");d.prototype.get=function(a,b,c){return e(n.get(a),b).end(m(c))},d.prototype.post=function(a,b,c){return e(n.post(a),b).end(m(c))},d.prototype.put=function(a,b,c){return e(n.put(a),b).end(m(c))},d.prototype.patch=function(a,b,c){return e(n.patch(a),b).end(m(c))},d.prototype.del=function(a,b,c){return e(n.del(a),b).end(m(c))},b.exports=new d},{superagent:21}],30:[function(a,b,c){"use strict";var d={startsWith:function(a,b){return""===b?!0:null==a||null==b?!1:(a=String(a),b=String(b),a.length>=b.length&&a.slice(0,b.length)===b)},endsWith:function(a,b){return""===b?!0:null==a||null==b?!1:(a=String(a),b=String(b),a.length>=b.length&&a.slice(a.length-b.length)===b)},splice:function(a,b,c,e){var f=d.chars(a);return f.splice(~~b,~~c,e),f.join("")},contains:function(a,b){return""===b?!0:null==a?!1:-1!==String(a).indexOf(b)},chars:function(a){return null==a?[]:String(a).split("")}};b.exports=d},{}],31:[function(a,b,c){"use strict";var d=a("resolve-url");c.resolve=function(a,b){return d(a,b)}},{"resolve-url":19}],32:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson");c.abortTraversal=function(){e.debug("aborting link traversal"),this.aborted=!0,this.currentRequest&&(e.debug("request in progress. trying to abort it, too."),this.currentRequest.abort())},c.registerAbortListener=function(a,b){a.currentRequest&&a.currentRequest.on("abort",function(){c.callCallbackOnAbort(a)})},c.callCallbackOnAbort=function(a){e.debug("link traversal aborted"),a.callbackHasBeenCalledAfterAbort||(a.callbackHasBeenCalledAfterAbort=!0,a.callback(c.abortError(),a))},c.abortError=function(){var a=new Error("Link traversal process has been aborted.");return a.name="AbortError",a.aborted=!0,a}},{minilog:27}],33:[function(a,b,c){"use strict";function d(a,b,c,d){var e;e=a.convertResponseToObject?[q,h,r,l]:[p],a.lastMethod=c,g.walk(a,e,d)}function e(a){return{abort:a.abortTraversal}}var f=a("minilog"),g=(f("traverson"),a("./abort_traversal"),a("./transforms/apply_transforms"),a("./http_requests"),a("./is_continuation"),a("./walker")),h=a("./transforms/check_http_status"),i=a("./transforms/continuation_to_doc"),j=a("./transforms/continuation_to_response"),k=a("./transforms/convert_embedded_doc_to_response"),l=a("./transforms/extract_doc"),m=a("./transforms/extract_response"),n=a("./transforms/extract_url"),o=a("./transforms/fetch_last_resource"),p=a("./transforms/execute_last_http_request"),q=a("./transforms/execute_http_request"),r=a("./transforms/parse");c.get=function(a,b){var c;return c=a.convertResponseToObject?[i,o,h,r,l]:[j,o,k,m],g.walk(a,c,b),e(a)},c.getUrl=function(a,b){return g.walk(a,[n],b),e(a)},c.post=function(a,b){return d(a,a.requestModuleInstance,a.requestModuleInstance.post,b),e(a)},c.put=function(a,b){return d(a,a.requestModuleInstance,a.requestModuleInstance.put,b),e(a)},c.patch=function(a,b){return d(a,a.requestModuleInstance,a.requestModuleInstance.patch,b),e(a)},c["delete"]=function(a,b){return d(a,a.requestModuleInstance,a.requestModuleInstance.del,b),e(a)}},{"./abort_traversal":32,"./http_requests":35,"./is_continuation":36,"./transforms/apply_transforms":42,"./transforms/check_http_status":43,"./transforms/continuation_to_doc":44,"./transforms/continuation_to_response":45,"./transforms/convert_embedded_doc_to_response":46,"./transforms/execute_http_request":48,"./transforms/execute_last_http_request":49,"./transforms/extract_doc":50,"./transforms/extract_response":51,"./transforms/extract_url":52,"./transforms/fetch_last_resource":53,"./transforms/parse":56,"./walker":62,minilog:27}],34:[function(a,b,c){"use strict";function d(a){this.mediaType=a||t.CONTENT_NEGOTIATION,this.adapter=this._createAdapter(this.mediaType),this.contentNegotiation=!0,this.convertResponseToObjectFlag=!1,this.links=[],this.jsonParser=JSON.parse,this.requestModuleInstance=o,this.requestOptions={},this.resolveRelativeFlag=!1,this.preferEmbedded=!1,this.lastTraversalState=null,this.continuation=null}function e(a,b){for(var c=0;c continuing finished traversal process"),a.continuation={step:b.step,action:d},a.continuation.step.index=0,j(a,b),a}})}}function j(a,b){a.aborted=!1,a.adapter=b.adapter,a.body=b.body,a.callbackHasBeenCalledAfterAbort=!1,a.contentNegotiation=b.contentNegotiation,a.convertResponseToObjectFlag=b.convertResponseToObject,a.links=[],a.jsonParser=b.jsonParser,a.requestModuleInstance=b.requestModuleInstance,a.requestOptions=b.requestOptions,a.resolveRelativeFlag=b.resolveRelative,a.preferEmbedded=b.preferEmbedded,a.startUrl=b.startUrl,a.templateParameters=b.templateParameters}function k(a){return p.isArray(a)?m(a):"object"==typeof a?l(a):a}function l(a){return u(null,a)}function m(a){return a?a.slice(0):a}var n=a("minilog"),o=a("request"),p=a("util"),q=a("./actions"),r=a("./abort_traversal").abortTraversal,s=a("./media_type_registry"),t=a("./media_types"),u=a("./merge_recursive"),v=n("traverson");d.prototype._createAdapter=function(a){var b=s.get(a);if(!b)throw new Error("Unknown or unsupported media type: "+a);return v.debug("creating new "+b.name),new b(v)},d.prototype.newRequest=function(){var a=new d(this.getMediaType());return a.contentNegotiation=this.doesContentNegotiation(),a.convertResponseToObject(this.convertsResponseToObject()),a.from(m(this.getFrom())),a.withTemplateParameters(k(this.getTemplateParameters())),a.withRequestOptions(k(this.getRequestOptions())),a.withRequestLibrary(this.getRequestLibrary()),a.parseResponseBodiesWith(this.getJsonParser()),a.resolveRelative(this.doesResolveRelative()),a.preferEmbeddedResources(this.doesPreferEmbeddedResources()),a.continuation=this.continuation,a},d.prototype.setMediaType=function(a){return this.mediaType=a||t.CONTENT_NEGOTIATION,this.adapter=this._createAdapter(a),this.contentNegotiation=a===t.CONTENT_NEGOTIATION,this},d.prototype.json=function(){return this.setMediaType(t.JSON),this},d.prototype.jsonHal=function(){return this.setMediaType(t.JSON_HAL),this},d.prototype.useContentNegotiation=function(){return this.setMediaType(t.CONTENT_NEGOTIATION),this.contentNegotiation=!0,this},d.prototype.from=function(a){return this.startUrl=a,this},d.prototype.follow=function(){for(var a=Array.prototype.slice.apply(1===arguments.length&&p.isArray(arguments[0])?arguments[0]:arguments),b=0;b1?new Error("JSONPath expression "+b+" returned more than one match in document:\n"+JSON.stringify(a)):new Error("JSONPath expression "+b+" returned no match in document:\n"+JSON.stringify(a))},d.prototype._handleHeader=function(a,b){switch(b.value){case"location":var c=a.headers.location;if(!c)throw new Error("Following the location header but there was no location header in the last response.");return{url:c};default:throw new Error("Link objects with type header and value "+b.value+" are not supported by this adapter.",b)}},b.exports=d},{"jsonpath-plus":15,minilog:27,"underscore.string":30}],38:[function(a,b,c){"use strict";var d=a("./media_types"),e={};c.register=function(a,b){e[a]=b},c.get=function(a){return e[a]},c.register(d.CONTENT_NEGOTIATION,a("./negotiation_adapter")),c.register(d.JSON,a("./json_adapter"))},{"./json_adapter":37,"./media_types":39,"./negotiation_adapter":41}],39:[function(a,b,c){"use strict";b.exports={CONTENT_NEGOTIATION:"content-negotiation",JSON:"application/json",JSON_HAL:"application/hal+json"}},{}],40:[function(a,b,c){"use strict";function d(a,b){!a&&b&&(a={});for(var c in b)b.hasOwnProperty(c)&&e(a,b,c);return a}function e(a,b,c){"object"==typeof b[c]?(a[c]&&"object"==typeof a[c]||(a[c]={}),d(a[c],b[c])):"function"!=typeof b[c]&&(a[c]=b[c])}b.exports=d},{}],41:[function(a,b,c){"use strict";function d(a){}d.prototype.findNextStep=function(a,b){throw new Error("Content negotiation did not happen")},b.exports=d},{}],42:[function(a,b,c){(function(c){"use strict";function d(a,b,e){f.debug("applying",a.length,"transforms");for(var g=0;gb||b>=300)){var c=d(a.step.url,b,a.step.response.body);return f.error("unexpected http status code"),f.error(c),a.callback(c),!1}return f.debug("http status code ok ("+b+")"),!0}},{"../is_continuation":36,minilog:27}],44:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson"),f=a("../is_continuation");b.exports=function(a){return f(a)?(e.debug("continuing from last traversal process (actions)"),a.continuation=null,a.callback(null,a.step.doc),!1):!0}},{"../is_continuation":36,minilog:27}],45:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson"),f=a("./convert_embedded_doc_to_response"),g=a("../is_continuation");b.exports=function(a){return g(a)?(e.debug("continuing from last traversal process (actions)"),a.continuation=null,f(a),a.callback(null,a.step.response),!1):!0}},{"../is_continuation":36,"./convert_embedded_doc_to_response":46,minilog:27}],46:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson");b.exports=function(a){return!a.step.response&&a.step.doc&&(e.debug("faking HTTP response for embedded resource"),a.step.response={statusCode:200,body:JSON.stringify(a.step.doc),remark:"This is not an actual HTTP response. The resource you requested was an embedded resource, so no HTTP request was made to acquire it."}),!0}},{minilog:27}],47:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson"),f=a("../media_type_registry");b.exports=function(a,b){if(a.contentNegotiation&&a.step.response&&a.step.response.headers&&a.step.response.headers["content-type"]){var c=a.step.response.headers["content-type"].split(/[; ]/)[0],d=f.get(c);if(!d)return b(new Error("Unknown content type for content type detection: "+c)),!1;a.adapter=new d(e)}return!0}},{"../media_type_registry":38,minilog:27}],48:[function(a,b,c){"use strict";function d(a,b){return a.aborted?g.callCallbackOnAbort(a):void h.executeHttpRequest(a,a.requestModuleInstance,a.lastMethod,function(c,d){return c?(c.aborted||(f.debug("error while processing step ",a.step),f.error(c)),a.callback(c)):void b(a)})}var e=a("minilog"),f=e("traverson"),g=a("../abort_traversal"),h=a("../http_requests");d.isAsync=!0,b.exports=d},{"../abort_traversal":32,"../http_requests":35,minilog:27}],49:[function(a,b,c){"use strict";function d(a,b){return a.aborted?f.callCallbackOnAbort(a):void g.executeHttpRequest(a,a.requestModuleInstance,a.lastMethod,a.callback)}var e=a("minilog"),f=(e("traverson"),a("../abort_traversal")),g=a("../http_requests");d.isAsync=!0,b.exports=d},{"../abort_traversal":32,"../http_requests":35,minilog:27}],50:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson");b.exports=function(a){return e.debug("walker.walk has finished"),a.callback(null,a.step.doc),!1}},{minilog:27}],51:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson");b.exports=function(a){return e.debug("walker.walk has finished"),a.callback(null,a.step.response),!1}},{minilog:27}],52:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson"),f=a("url");b.exports=function(a){return e.debug("walker.walk has finished"),a.step.url?a.callback(null,a.step.url):a.step.doc&&a.step.doc._links&&a.step.doc._links.self&&a.step.doc._links.self.href?a.callback(null,f.resolve(a.startUrl,a.step.doc._links.self.href)):a.callback(new Error('You requested an URL but the last resource is an embedded resource and has no URL of its own (that is, it has no link with rel="self"'))}},{minilog:27,url:31}],53:[function(a,b,c){"use strict";function d(a,b){return a.aborted?g.callCallbackOnAbort(a):void h.fetchResource(a,function(a,c){return f.debug("fetchResource returned (fetchLastResource)."),a?(a.aborted||(f.debug("error while processing step ",c.step),f.error(a)),c.callback(a)):void b(c)})}var e=a("minilog"),f=e("traverson"),g=a("../abort_traversal"),h=a("../http_requests");d.isAsync=!0,b.exports=d},{"../abort_traversal":32,"../http_requests":35,minilog:27}],54:[function(a,b,c){(function(c){"use strict";function d(a,b){j(a)?e(a,b):f(a,b)}function e(a,b){h.debug("continuing from last traversal process (walker)"),c.nextTick(function(){b(a)})}function f(a,b){return a.aborted?i.callCallbackOnAbort(a):void k.fetchResource(a,function(a,c){return h.debug("fetchResource returned"),a?(a.aborted||(h.debug("error while processing step ",c.step),h.error(a)),c.callback(a)):void b(c)})}var g=a("minilog"),h=g("traverson"),i=a("../abort_traversal"),j=a("../is_continuation"),k=a("../http_requests");d.isAsync=!0,b.exports=d}).call(this,a("_process"))},{"../abort_traversal":32,"../http_requests":35,"../is_continuation":36,_process:17,minilog:27}],55:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson"),f=a("util");b.exports=function(a){var b=a.requestOptions;return f.isArray(a.requestOptions)&&(b=a.requestOptions[a.step.index]||{}),e.debug("options: ",b),b}},{minilog:27,util:28}],56:[function(a,b,c){"use strict";function d(a,b){var c=new Error("The document at "+a+" could not be parsed as JSON: "+b);return c.name="JSONError",c.url=a,c.body=b,c}var e=a("minilog"),f=e("traverson"),g=a("../is_continuation");b.exports=function(a){if(g(a)&&(f.debug("continuing from last traversal process (transforms/parse)"),"getResource"===a.continuation.action))return!0;if(a.step.doc)return f.debug("no parsing necessary, probably an embedded document"),!0;try{return f.debug("parsing response body"),a.step.doc=a.jsonParser(a.step.response.body),!0}catch(b){var c=b;return"SyntaxError"===b.name&&(c=d(a.step.url,a.step.response.body)),f.error("parsing failed"),f.error(c),a.callback(c),!1}}},{"../is_continuation":36,minilog:27}],57:[function(a,b,c){"use strict";var d=a("../is_continuation");b.exports=function(a){return d(a)?!0:(a.continuation=null,!0)}},{"../is_continuation":36}],58:[function(a,b,c){"use strict";var d=a("../is_continuation");b.exports=function(a){return d(a)?!0:(a.lastStep=null,!0)}},{"../is_continuation":36}],59:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson"),f=a("underscore.string"),g=a("url"),h=/https?:\/\//i;b.exports=function(a){return a.step.url&&0!==a.step.url.search(h)&&(e.debug("found non full qualified URL"),a.resolveRelative&&a.lastStep&&a.lastStep.url?(e.debug("resolving URL relative"),f.startsWith(a.step.url,"/")&&f.endsWith(a.lastStep.url,"/")&&(a.step.url=f.splice(a.step.url,0,1)),a.step.url=a.lastStep.url+a.step.url):a.step.url=g.resolve(a.startUrl,a.step.url)),!0}},{minilog:27,"underscore.string":30,url:31}],60:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson"),f=a("underscore.string"),g=a("url-template"),h=a("util");b.exports=function(a){if(a.step.url){var b=a.templateParameters;if(h.isArray(b)&&(b=b[a.step.index]),b=b||{},f.contains(a.step.url,"{")){e.debug("resolving URI template");var c=g.parse(a.step.url),d=c.expand(b);e.debug("resolved to ",d),a.step.url=d}}return!0}},{minilog:27,"underscore.string":30,"url-template":64,util:28}],61:[function(a,b,c){"use strict";function d(a,b){try{return a.adapter.findNextStep(a,b)}catch(c){return f.error("could not find next step"),f.error(c),a.callback(c),null}}var e=a("minilog"),f=e("traverson");b.exports=function(a){var b=a.links[a.step.index];return f.debug("next link: "+b),a.lastStep=a.step,a.step=d(a,b),a.step?(f.debug("found next step",a.step),a.step.url=a.step.url||a.step.uri,a.step.index=a.lastStep.index+1,!0):!1}},{minilog:27}],62:[function(a,b,c){"use strict";function d(a,b){if(h.debug("processing next step"),e(a)&&!f(a))j(l,a,function(a){h.debug("successfully processed step"),d(a,b)});else{if(f(a))return i.callCallbackOnAbort(a);h.debug("link array exhausted"),j(b,a,function(a){return a.callback()})}}function e(a){return a.step.indexd;++d)Object.prototype.hasOwnProperty.call(b,a[d])||(c.push(a[d]),b[a[d]]=1);return c}function e(a){for(var b=[],c=0;c0&&(i.files=l)}if(!a&&!b&&"image"!==i.type)return i.files[0].url;var m=i.files[0];if(i.files=f(i.files,function(a){return null===a.resolution}),0===i.files.length)return m.url;i.files.sort(function(a,b){var c=Math.max(a.resolution.height,a.resolution.width),d=Math.max(b.resolution.height,b.resolution.width);return d>c?1:c>d?-1:0});var n=i.files.filter(function(a){return b?-1!==a.url.indexOf("_thumb"):-1===a.url.indexOf("_thumb")}),o=n[0];return c&&(n=n.filter(function(a){return a.resolution.height>=c||a.resolution.width>=c}),n=n.slice(-1)),n.length>0?n[0].url:o.url},b.exports=j},{"./util":7,halfred:10,locale:15}],2:[function(a,b,c){"use strict";var d=a("halfred"),e=a("superagent"),f=a("shiro-trie"),g=a("traverson"),h=a("traverson-hal"),i=a("./Asset"),j=(a("./Entry"),a("./Model")),k=a("./User"),l=a("./Tag"),m=a("./util");a("es6-promise").polyfill(),g.registerMediaType(h.mediaType,h);var n=function(a){if(!a||!a.hasOwnProperty("url")&&!a.hasOwnProperty("id"))throw new Error("ec_sdk_no_url_or_id_set");if(a.hasOwnProperty("url")?this.url=a.url:(this.id=a.id,this.url="https://datamanager.entrecode.de/api/"+this.id),"/"===this.url.slice(-1)&&(this.url=this.url.substr(0,this.url.length-1)),this.id||(this.id=this.url.split("/").reverse()[0]),this._fileUrl=this.url.replace("api/"+this.id,"files"),this._modelCache={},!/^[a-f0-9]+$/i.test(this.id))throw new Error("ec_sdk_invalid_url");a.hasOwnProperty("accessToken")&&(this.accessToken=a.accessToken),a.hasOwnProperty("clientID")&&(this.clientID=a.clientID),a.hasOwnProperty("errorHandler")&&(this.errorHandler=a.errorHandler),m._dm=this};n._fileUrl="https://datamanager.entrecode.de/files",n._getFileUrl=function(a,b,c){return new Promise(function(d,f){if(!a)return f(new Error("ec_sdk_no_assetid_provided"));var g=e.get(c+"/"+a+"/url");b&&g.set("Accept-Language",b),g.end(function(a,b){return a?f(a):b.body.hasOwnProperty("url")?d(b.body.url):f(new Error("ec_sdk_could_not_get_url_for_file"))})})},n._getImageUrl=function(a,b,c,d){return new Promise(function(f,g){if(!a)return g(new Error("ec_sdk_no_assetid_provided"));var h=e.get(d+"/"+a+"/url");c&&h.set("Accept-Language",c),b&&h.query({size:b}),h.end(function(a,b){return a?g(a):b.body.hasOwnProperty("url")?f(b.body.url):g(new Error("ec_sdk_could_not_get_url_for_file"))})})},n._getImageThumbUrl=function(a,b,c,d){return new Promise(function(f,g){if(!a)return g(new Error("ec_sdk_no_assetid_provided"));b=b&&50>=b?50:b&&100>=b?100:b&&200>=b?200:400;var h=e.get(d+"/"+a+"/url");c&&h.set("Accept-Language",c),h.query({size:b,thumb:!0}),h.end(function(a,b){return a?g(a):b.body.hasOwnProperty("url")?f(b.body.url):g(new Error("ec_sdk_could_not_get_url_for_file"))})})},n.getFileUrl=function(a,b){return n._getFileUrl(a,b,n._fileUrl)},n.getImageUrl=function(a,b,c){return n._getImageUrl(a,b,c,n._fileUrl)},n.getImageThumbUrl=function(a,b,c){return n._getImageThumbUrl(a,b,c,n._fileUrl)},n.prototype.getFileUrl=function(a,b){return n._getFileUrl(a,b,this._fileUrl)},n.prototype.getImageUrl=function(a,b,c){return n._getImageUrl(a,b,c,this._fileUrl)},n.prototype.getImageThumbUrl=function(a,b,c){return n._getImageThumbUrl(a,b,c,this._fileUrl)},n.prototype.resolve=function(){var a=this;return new Promise(function(b,c){g.from(a.url).jsonHal().withRequestOptions(a._requestOptions()).get(function(e,f,g){m.checkResponse(e,f).then(function(c){var e=d.parse(JSON.parse(c.body));return a._rootTraversal=g,a.metadata=e,b(a)})["catch"](c)})})},n.prototype.modelList=function(){var a=this;return new Promise(function(b,c){g.from(a.url).jsonHal().withRequestOptions(a._requestOptions()).get(function(d,e,f){m.checkResponse(d,e).then(function(c){var d=JSON.parse(c.body),e={};for(var g in d.models)e[d.models[g].title]=new j(d.models[g].title,d.models[g],a);return a._modelCache=e,a._rootTraversal=f,b(e)})["catch"](c)})})},n.prototype.model=function(a,b){var c=this;return c._modelCache[a]?c._modelCache[a]:c._modelCache[a]=new j(a,b,c)},n.prototype.assetList=function(a){var b=this;return new Promise(function(c,e){b._getTraversal().then(function(f){var g=f["continue"]().newRequest().follow("ec:api/assets");a&&g.withTemplateParameters(m.optionsToQueryParameter(a)),g.withRequestOptions(b._requestOptions()).get(function(a,f,g){m.checkResponse(a,f).then(function(a){var e=d.parse(JSON.parse(a.body));if(e.hasOwnProperty("count")&&0===e.count&&e.hasOwnProperty("total"))return c({assets:[],count:e.count,total:e.total});var f=e.embeddedArray("ec:api/asset"),g=[];if(f)for(var h in f)f.hasOwnProperty(h)&&g.push(new i(f[h],b));else g.push(new i(e,b));return c({assets:g,count:e.count,total:e.total})})["catch"](e)})})})},n.prototype.assets=function(a){var b=this;return new Promise(function(c,d){b.assetList(a).then(function(a){return c(a.assets)})["catch"](d)})},n.prototype.asset=function(a){var b=this;return new Promise(function(c,e){if(!a)return e(new Error("ec_sdk_no_assetid_provided"));var f={};"string"==typeof a?f.filter={assetID:{exact:a}}:f=a,b._getTraversal().then(function(a){a["continue"]().newRequest().follow("ec:api/assets").withTemplateParameters(m.optionsToQueryParameter(f)).withRequestOptions(b._requestOptions()).get(function(a,f,g){m.checkResponse(a,f).then(function(a){var f=d.parse(JSON.parse(a.body));if(f.hasOwnProperty("count")&&f.hasOwnProperty("total")){var h=f.embeddedResource("ec:api/asset");return h?c(new i(h,b,g)):e(new Error("ec_sdk_no_match_due_to_filter"))}return c(new i(f,b,g))})["catch"](e)})})})},n.prototype.createAsset=function(a){var b=this;return new Promise(function(c,f){b._getTraversal().then(function(g){g["continue"]().newRequest().follow("ec:api/assets").getUrl(function(g,h){if(g)return f(g);var i=e.post(h);if(b.accessToken&&i.set("Authorization","Bearer "+b.accessToken),"string"==typeof a)i.attach("file",a);else if(Array.isArray(a))for(var j in a)i.attach("file",a[j]);else i.send(a);i.end(function(a,e){m.checkResponse(a,e).then(function(a){var e=/^.*\?assetID=([0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12})$/,f=d.parse(a.body),g=f.linkArray("ec:asset"),h=[];for(var i in g)h.push(b.asset(e.exec(g[i].href)[1]));return c(h)})["catch"](f)})})})["catch"](f)})},n.prototype.tagList=function(a){var b=this;return new Promise(function(c,e){b._getTraversal().then(function(f){f["continue"]().newRequest().follow("ec:api/assets","ec:api/tags").withTemplateParameters([null,null,m.optionsToQueryParameter(a)]).withRequestOptions(b._requestOptions()).get(function(a,f,g){m.checkResponse(a,f).then(function(a){var e=d.parse(JSON.parse(a.body));if(e.hasOwnProperty("count")&&0===e.count&&e.hasOwnProperty("total"))return c({tags:[],count:e.count,total:e.total});var f=e.embeddedArray("ec:api/tag"),g=[];if(f)for(var h in f)g.push(new l(f[h],b));else g.push(new l(e,b));return c({tags:g,count:e.count,total:e.total})})["catch"](e)})})})},n.prototype.tags=function(a){var b=this;return new Promise(function(c,d){b.tagList(a).then(function(a){return c(a.tags)})["catch"](d)})},n.prototype.tag=function(a){var b=this;return new Promise(function(c,e){if(!a)return e(new Error("ec_sdk_no_tag_name_provided"));var f={};"string"==typeof a?f.filter={tag:{exact:a}}:f=a,b._getTraversal().then(function(a){a["continue"]().newRequest().follow("ec:api/assets","ec:api/tags").withTemplateParameters([null,null,m.optionsToQueryParameter(f)]).withRequestOptions(b._requestOptions()).get(function(a,f,g){m.checkResponse(a,f).then(function(a){var f=d.parse(JSON.parse(a.body));if(f.hasOwnProperty("count")&&f.hasOwnProperty("total")){var h=f.embeddedResource("ec:api/tag");return h?c(new l(h,b,g)):e(new Error("ec_sdk_no_match_due_to_filter"))}return c(new l(f,b,g))})["catch"](e)})})})},n.prototype.registerAnonymous=function(a){var b=this;return new Promise(function(c,d){b._getTraversal().then(function(e){var f=e["continue"]().newRequest().follow(b.id+":_auth/anonymous");a&&f.withTemplateParameters({validUntil:a}),f.post({},function(a,e,f){m.checkResponse(a,e).then(function(a){var d=JSON.parse(a.body);return b.accessToken=d.jwt,b._user=new k(!0,d,b,f),c(b._user)})["catch"](d)})})})},n.prototype.account=function(){var a=this;return new Promise(function(b,c){return a.accessToken?void g.from(a.url).jsonHal().withRequestOptions(a._requestOptions()).get(function(e,f,g){m.checkResponse(e,f).then(function(c){var e=d.parse(JSON.parse(c.body));return a._rootTraversal=g,a.metadata=e,b(a.metadata.account)})["catch"](c)}):c(new Error("ec_sdk_not_logged_in"))})},n.prototype.getAuthLink=function(a,b){var c=this;return new Promise(function(d,e){c.clientID&&(b||(b={}),b.hasOwnProperty("clientID")||(b.clientID=c.clientID)),c._getTraversal().then(function(f){var g=f["continue"]().newRequest().follow(c.id+":_auth/"+a);b&&g.withTemplateParameters(b),g.getUrl(function(a,b){return a?e(a):d(b)})})["catch"](e)})},n.prototype.emailAvailable=function(a){var b=this;return new Promise(function(c,d){b._getTraversal().then(function(e){e["continue"]().newRequest().follow(b.id+":_auth/email-available").withTemplateParameters({email:a}).get(function(a,b){m.checkResponse(a,b).then(function(a){return c(JSON.parse(a.body).available)})["catch"](d)})})})},n.prototype.can=function(a){var b=this,c=a.split(":")[0];return new Promise(function(e,g){b._getTraversal().then(function(h){h["continue"]().newRequest().follow(b.id+":"+c+"/_permissions").withRequestOptions(b._requestOptions()).get(function(b,c){m.checkResponse(b,c).then(function(b){var c=d.parse(JSON.parse(b.body)),h=f["new"]();return h.add(c.permissions),h.check(a)?e(!0):g(new Error("permission_denied"))})["catch"](g)})})["catch"](g)})},n.prototype.logout=function(){this.accessToken=null,this._rootTraversal=null},n.prototype._getTraversal=function(){var a=this;return new Promise(function(b,c){return a._rootTraversal?b(a._rootTraversal):void g.from(a.url).jsonHal().withRequestOptions(a._requestOptions()).get(function(d,e,f){m.checkResponse(d,e).then(function(c){return a._rootTraversal=f,b(f)})["catch"](c)})})},n.prototype._requestOptions=function(a){var b={};if(b.headers={},this.accessToken&&(b.headers.Authorization="Bearer "+this.accessToken),a)for(var c in a)b.headers[c]=a[c];return b},b.exports=n},{"./Asset":1,"./Entry":3,"./Model":4,"./Tag":5,"./User":6,"./util":7,"es6-promise":9,halfred:10,"shiro-trie":18,superagent:19,traverson:61,"traverson-hal":20}],3:[function(a,b,c){"use strict";var d=a("halfred"),e=a("./util"),f=function(a,b,c,d){this.value=a,this._dm=b,this._model=c,this._traversal=d};f.prototype.save=function(){var a=this;return new Promise(function(b,c){a._model._getTraversal().then(function(f){delete a.value._curies,delete a.value._curiesMap,delete a.value._resolvedCuriesMap,delete a.value._validation,delete a.value._original,delete a.value._embedded,f["continue"]().newRequest().follow(a._dm.id+":"+a._model.title).withTemplateParameters({_id:a.value._id}).withRequestOptions(a._dm._requestOptions({"Content-Type":"application/json"})).put(a.value,function(f,g,h){e.checkResponse(f,g).then(function(c){return 204===c.statusCode?b(!0):(a.value=d.parse(JSON.parse(c.body)),a._traversal=h,b(a))})["catch"](c)})})["catch"](c)})},f.prototype["delete"]=function(){var a=this;return new Promise(function(b,c){a._model._getTraversal().then(function(d){d["continue"]().newRequest().follow(a._dm.id+":"+a._model.title).withTemplateParameters({_id:a.value._id}).withRequestOptions(a._dm._requestOptions())["delete"](function(a,d){e.checkResponse(a,d).then(function(){return b(!0)})["catch"](c)})})["catch"](c)})},f.prototype.getTitle=function(a){var b=this.value.linkArray(this._dm.id+":"+this._model.title+"/"+a);if(b){if(1===b.length)return b[0].title;var c=[];for(var d in b)b.hasOwnProperty(d)&&c.push(b[d].title);return c}},b.exports=f},{"./util":7,halfred:10}],4:[function(a,b,c){"use strict";function d(a,b,c){for(var f in a.value._links){var g=/^[a-f0-9]{8}:.+\/(.+)$/.exec(f);g&&(Array.isArray(a.value[g[1]])?a.value[g[1]]=a.value[g[1]].map(function(a){if(a.hasOwnProperty("assetID"))return new h(e.parse(a),b);var f=new i(e.parse(a),b,c);return d(f,b,c),f}):(a.value[g[1]].hasOwnProperty("assetID")&&(a.value[g[1]]=new h(e.parse(a.value[g[1]]),b)),a.value[g[1]]=new i(e.parse(a.value[g[1]]),b,c),d(a.value[g[1]],b,c)))}}var e=a("halfred"),f=a("superagent"),g=a("traverson"),h=a("./Asset"),i=a("./Entry"),j=a("./util"),k=function(a,b,c){this.id=a,this.title=a,this.metadata=b,this._traversal=null,this._dm=c};k.prototype._getTraversal=function(){var a=this;return new Promise(function(b,c){return a._traversal?b(a._traversal):(a._dm._rootTraversal&&a._dm._rootTraversal["continue"]().newRequest().withRequestOptions(a._dm._requestOptions()).get(function(d,e,f){j.checkResponse(d,e).then(function(){return a._traversal=f,b(f)})["catch"](c)}),void g.from(a._dm.url).jsonHal().withRequestOptions(a._dm._requestOptions()).get(function(d,e,f){j.checkResponse(d,e).then(function(c){return a._traversal=f,b(f)})["catch"](c)}))})},k.prototype.resolve=function(){var a=this;return new Promise(function(b,c){g.from(a._dm.url).jsonHal().withRequestOptions(a._dm._requestOptions()).get(function(d,e,f){j.checkResponse(d,e).then(function(d){for(var e=JSON.parse(d.body),g=0;g=200&&b.statusCode<=299?d(b):e(JSON.parse(b.body))})},b.exports=d},{}],8:[function(a,b,c){function d(a){return a?e(a):void 0}function e(a){for(var b in d.prototype)a[b]=d.prototype[b];return a}b.exports=d,d.prototype.on=d.prototype.addEventListener=function(a,b){return this._callbacks=this._callbacks||{},(this._callbacks["$"+a]=this._callbacks["$"+a]||[]).push(b),this},d.prototype.once=function(a,b){function c(){this.off(a,c),b.apply(this,arguments)}return c.fn=b,this.on(a,c),this},d.prototype.off=d.prototype.removeListener=d.prototype.removeAllListeners=d.prototype.removeEventListener=function(a,b){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var c=this._callbacks["$"+a];if(!c)return this;if(1==arguments.length)return delete this._callbacks["$"+a],this;for(var d,e=0;ed;++d)c[d].apply(this,b)}return this},d.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks["$"+a]||[]},d.prototype.hasListeners=function(a){return!!this.listeners(a).length}},{}],9:[function(a,b,c){(function(c,d){(function(){"use strict";function e(a){return"function"==typeof a||"object"==typeof a&&null!==a}function f(a){return"function"==typeof a}function g(a){T=a}function h(a){X=a}function i(){return function(){c.nextTick(n)}}function j(){return function(){S(n)}}function k(){var a=0,b=new $(n),c=document.createTextNode("");return b.observe(c,{characterData:!0}),function(){c.data=a=++a%2}}function l(){var a=new MessageChannel;return a.port1.onmessage=n,function(){a.port2.postMessage(0)}}function m(){return function(){setTimeout(n,1)}}function n(){for(var a=0;W>a;a+=2){var b=ba[a],c=ba[a+1];b(c),ba[a]=void 0,ba[a+1]=void 0}W=0}function o(){try{var b=a,c=b("vertx");return S=c.runOnLoop||c.runOnContext,j()}catch(d){return m()}}function p(a,b){var c=this,d=c._state;if(d===fa&&!a||d===ga&&!b)return this;var e=new this.constructor(r),f=c._result;if(d){var g=arguments[d-1];X(function(){H(d,e,g,f)})}else D(c,e,a,b);return e}function q(a){var b=this;if(a&&"object"==typeof a&&a.constructor===b)return a;var c=new b(r);return z(c,a),c}function r(){}function s(){return new TypeError("You cannot resolve a promise with itself")}function t(){return new TypeError("A promises callback cannot return that same promise.")}function u(a){try{return a.then}catch(b){return ha.error=b,ha}}function v(a,b,c,d){try{a.call(b,c,d)}catch(e){return e}}function w(a,b,c){X(function(a){var d=!1,e=v(c,b,function(c){d||(d=!0,b!==c?z(a,c):B(a,c))},function(b){d||(d=!0,C(a,b))},"Settle: "+(a._label||" unknown promise"));!d&&e&&(d=!0,C(a,e))},a)}function x(a,b){b._state===fa?B(a,b._result):b._state===ga?C(a,b._result):D(b,void 0,function(b){z(a,b)},function(b){C(a,b)})}function y(a,b,c){b.constructor===a.constructor&&c===ca&&constructor.resolve===da?x(a,b):c===ha?C(a,ha.error):void 0===c?B(a,b):f(c)?w(a,b,c):B(a,b)}function z(a,b){a===b?C(a,s()):e(b)?y(a,b,u(b)):B(a,b)}function A(a){a._onerror&&a._onerror(a._result),E(a)}function B(a,b){a._state===ea&&(a._result=b,a._state=fa,0!==a._subscribers.length&&X(E,a))}function C(a,b){a._state===ea&&(a._state=ga,a._result=b,X(A,a))}function D(a,b,c,d){var e=a._subscribers,f=e.length;a._onerror=null,e[f]=b,e[f+fa]=c,e[f+ga]=d,0===f&&a._state&&X(E,a)}function E(a){var b=a._subscribers,c=a._state;if(0!==b.length){for(var d,e,f=a._result,g=0;gg;g++)D(d.resolve(a[g]),void 0,b,c);return e}function L(a){var b=this,c=new b(r);return C(c,a),c}function M(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function N(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function O(a){this._id=ma++,this._state=void 0,this._result=void 0,this._subscribers=[],r!==a&&("function"!=typeof a&&M(),this instanceof O?I(this,a):N())}function P(a,b){this._instanceConstructor=a,this.promise=new a(r),Array.isArray(b)?(this._input=b,this.length=b.length,this._remaining=b.length,this._result=new Array(this.length),0===this.length?B(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&B(this.promise,this._result))):C(this.promise,this._validationError())}function Q(){var a;if("undefined"!=typeof d)a=d;else if("undefined"!=typeof self)a=self;else try{a=Function("return this")()}catch(b){throw new Error("polyfill failed because global object is unavailable in this environment")}var c=a.Promise;(!c||"[object Promise]"!==Object.prototype.toString.call(c.resolve())||c.cast)&&(a.Promise=na)}var R;R=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)};var S,T,U,V=R,W=0,X=function(a,b){ba[W]=a,ba[W+1]=b,W+=2,2===W&&(T?T(n):U())},Y="undefined"!=typeof window?window:void 0,Z=Y||{},$=Z.MutationObserver||Z.WebKitMutationObserver,_="undefined"!=typeof c&&"[object process]"==={}.toString.call(c),aa="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,ba=new Array(1e3);U=_?i():$?k():aa?l():void 0===Y&&"function"==typeof a?o():m();var ca=p,da=q,ea=void 0,fa=1,ga=2,ha=new F,ia=new F,ja=J,ka=K,la=L,ma=0,na=O;O.all=ja,O.race=ka,O.resolve=da,O.reject=la,O._setScheduler=g,O._setAsap=h,O._asap=X,O.prototype={constructor:O,then:ca,"catch":function(a){return this.then(null,a)}};var oa=P;P.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},P.prototype._enumerate=function(){for(var a=this.length,b=this._input,c=0;this._state===ea&&a>c;c++)this._eachEntry(b[c],c)},P.prototype._eachEntry=function(a,b){var c=this._instanceConstructor,d=c.resolve;if(d===da){var e=u(a);if(e===ca&&a._state!==ea)this._settledAt(a._state,b,a._result);else if("function"!=typeof e)this._remaining--,this._result[b]=a;else if(c===na){var f=new c(r);y(f,a,e),this._willSettleAt(f,b)}else this._willSettleAt(new c(function(b){b(a)}),b)}else this._willSettleAt(d(a),b)},P.prototype._settledAt=function(a,b,c){var d=this.promise;d._state===ea&&(this._remaining--,a===ga?C(d,c):this._result[b]=c),0===this._remaining&&B(d,this._result)},P.prototype._willSettleAt=function(a,b){var c=this;D(a,void 0,function(a){c._settledAt(fa,b,a)},function(a){c._settledAt(ga,b,a)})};var pa=Q,qa={Promise:na,polyfill:pa};"function"==typeof define&&define.amd?define(function(){return qa}):"undefined"!=typeof b&&b.exports?b.exports=qa:"undefined"!=typeof this&&(this.ES6Promise=qa),pa()}).call(this)}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:64}],10:[function(a,b,c){var d=a("./lib/parser"),e=a("./lib/resource"),f=!1;b.exports={parse:function(a){return(new d).parse(a,f)},enableValidation:function(a){f=null!=a?a:!0},disableValidation:function(){f=!1},Resource:e}},{"./lib/parser":12,"./lib/resource":13}],11:[function(a,b,c){"use strict";function d(){arguments.length>=1?this._array=arguments[0]:this._array=[]}d.prototype.array=function(){return this._array},d.prototype.isEmpty=function(a){return 0===this._array.length},d.prototype.push=function(a){var b=this._array.slice(0);return b.push(a),new d(b)},d.prototype.pop=function(){var a=this._array.slice(0,this._array.length-1);return new d(a)},d.prototype.peek=function(){if(this.isEmpty())throw new Error("can't peek on empty stack");return this._array[this._array.length-1]},b.exports=d},{}],12:[function(a,b,c){"use strict";function d(){}function e(a,b,c){if(null==a)return a;var d=f(a._links,b,c.push("_links")),e=g(d),j=h(a._embedded,b,c.push("_embedded")),k=new t(d,e,j,b);return i(a,k),k._original=a,k}function f(a,b,c){return a=j(a,l,b,c),(null==a||null==a.self)&&p("Resource does not have a self link",b,c),a}function g(a){return a?a.curies:[]}function h(a,b,c){var d=j(a,o,b,c);return null==d?d:(Object.keys(d).forEach(function(a){d[a]=d[a].map(function(d){var f=null!=b?[]:null,g=e(d,f,c.push(a));return g._original=d,g})}),d)}function i(a,b){Object.keys(a).forEach(function(c){"_links"!==c&&"_embedded"!==c&&(b[c]=a[c])})}function j(a,b,c,d){if(null==a)return a;var e={};return Object.keys(a).forEach(function(f){e[f]=k(f,a[f],b,c,d)}),e}function k(a,b,c,d,e){return m(b)?b.map(function(b){return c(a,b,d,e)}):[c(a,b,d,e)]}function l(a,b,c,d){if(!n(b))throw new Error("Link object is not an actual object: "+b+" ["+typeof b+"]");var e=r(b);return Object.keys(v).forEach(function(b){null==e[b]&&(v[b].required&&p("Link misses required property "+b+".",c,d.push(a)),null!=v[b].defaultValue&&(e[b]=v[b].defaultValue))}),e.deprecation&&q("Warning: Link "+s(d.push(a))+" is deprecated, see "+e.deprecation),e.templated!==!0&&e.templated!==!1&&(e.templated=!1),c?(e.href&&e.href.indexOf("{")>=0&&!e.templated&&p('Link seems to be an URI template but its "templated" property is not set to true.',c,d.push(a)),e):e}function m(a){return"[object Array]"===Object.prototype.toString.call(a)}function n(a){return"object"==typeof a}function o(a,b){return b}function p(a,b,c){b&&b.push({path:s(c),message:a})}function q(a){"undefined"!=typeof console&&"function"==typeof console.log&&console.log(a)}function r(a){var b={};return Object.keys(a).forEach(function(c){ +b[c]=a[c]}),b}function s(a){for(var b="$.",c=0;c=1?d[c]:null}d.prototype._initCuries=function(a){if(this._curiesMap={},a){this._curies=a;for(var b=0;b=1){var e=a.href.replace(/(.*){(.*)}(.*)/,"$1"+c[1]+"$3");this._resolvedCuriesMap[e]=b}else this._resolvedCuriesMap[a.href]=b},d.prototype.allLinkArrays=function(){return this._links},d.prototype.linkArray=function(a){return e(this._links,a)},d.prototype.link=function(a,b){return f(this._links,a,b)},d.prototype.hasCuries=function(a){return this._curies.length>0},d.prototype.curieArray=function(a){return this._curies},d.prototype.curie=function(a){return this._curiesMap[a]},d.prototype.reverseResolveCurie=function(a){return this._resolvedCuriesMap[a]},d.prototype.allEmbeddedResourceArrays=function(){return this._embedded},d.prototype.embeddedResourceArray=function(a){return e(this._embedded,a)},d.prototype.embeddedResource=function(a,b){return f(this._embedded,a,b)},d.prototype.original=function(){return this._original},d.prototype.validationIssues=function(){return this._validation},d.prototype.allLinks=d.prototype.allLinkArrays,d.prototype.allEmbeddedArrays=d.prototype.allEmbeddedResources=d.prototype.allEmbeddedResourceArrays,d.prototype.embeddedArray=d.prototype.embeddedResourceArray,d.prototype.embedded=d.prototype.embeddedResource,d.prototype.validation=d.prototype.validationIssues,b.exports=d},{}],14:[function(require,module,exports){var module;!function(require){"use strict";function push(a,b){return a=a.slice(),a.push(b),a}function unshift(a,b){return b=b.slice(),b.unshift(a),b}function NewError(a){this.avoidNew=!0,this.value=a,this.message='JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'}function JSONPath(a,b,c,d,e){if(!(this instanceof JSONPath))try{return new JSONPath(a,b,c,d,e)}catch(f){if(!f.avoidNew)throw f;return f.value}"string"==typeof a&&(e=d,d=c,c=b,b=a,a={}),a=a||{};var g=a.hasOwnProperty("json")&&a.hasOwnProperty("path");if(this.json=a.json||c,this.path=a.path||b,this.resultType=a.resultType&&a.resultType.toLowerCase()||"value",this.flatten=a.flatten||!1,this.wrap=a.hasOwnProperty("wrap")?a.wrap:!0,this.sandbox=a.sandbox||{},this.preventEval=a.preventEval||!1,this.parent=a.parent||null,this.parentProperty=a.parentProperty||null,this.callback=a.callback||d||null,this.otherTypeCallback=a.otherTypeCallback||e||function(){throw new Error("You must supply an otherTypeCallback callback option with the @other() operator.")},a.autostart!==!1){var h=this.evaluate({path:g?a.path:b,json:g?a.json:c});if(!h||"object"!=typeof h)throw new NewError(h);return h}}var isNode=module&&!!module.exports,allowedResultTypes=["value","path","pointer","parent","parentProperty","all"],vm=isNode?require("vm"):{runInNewContext:function(expr,context){return eval(Object.keys(context).reduce(function(a,b){return"var "+b+"="+JSON.stringify(context[b]).replace(/\u2028|\u2029/g,function(a){return"\\u202"+("\u2028"===a?"8":"9")})+";"+a},expr))}};JSONPath.prototype.evaluate=function(a,b,c,d){var e=this,f=this.flatten,g=this.wrap,h=this.parent,i=this.parentProperty;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,c=c||this.callback,this.currOtherTypeCallback=d||this.otherTypeCallback,b=b||this.json,a=a||this.path,a&&"object"==typeof a){if(!a.path)throw new Error('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');b=a.hasOwnProperty("json")?a.json:b,f=a.hasOwnProperty("flatten")?a.flatten:f,this.currResultType=a.hasOwnProperty("resultType")?a.resultType:this.currResultType,this.currSandbox=a.hasOwnProperty("sandbox")?a.sandbox:this.currSandbox,g=a.hasOwnProperty("wrap")?a.wrap:g,this.currPreventEval=a.hasOwnProperty("preventEval")?a.preventEval:this.currPreventEval,c=a.hasOwnProperty("callback")?a.callback:c,this.currOtherTypeCallback=a.hasOwnProperty("otherTypeCallback")?a.otherTypeCallback:this.currOtherTypeCallback,h=a.hasOwnProperty("parent")?a.parent:h,i=a.hasOwnProperty("parentProperty")?a.parentProperty:i,a=a.path}if(h=h||null,i=i||null,Array.isArray(a)&&(a=JSONPath.toPathString(a)),a&&b&&-1!==allowedResultTypes.indexOf(this.currResultType)){this._obj=b;var j=JSONPath.toPathArray(a);"$"===j[0]&&j.length>1&&j.shift();var k=this._trace(j,b,["$"],h,i,c);return k=k.filter(function(a){return a&&!a.isParentSelector}),k.length?1!==k.length||g||Array.isArray(k[0].value)?k.reduce(function(a,b){var c=e._getPreferredOutput(b);return f&&Array.isArray(c)?a=a.concat(c):a.push(c),a},[]):this._getPreferredOutput(k[0]):g?[]:void 0}},JSONPath.prototype._getPreferredOutput=function(a){var b=this.currResultType;switch(b){case"all":return a.path="string"==typeof a.path?a.path:JSONPath.toPathString(a.path),a;case"value":case"parent":case"parentProperty":return a[b];case"path":return JSONPath.toPathString(a[b]);case"pointer":return JSONPath.toPointer(a.path)}},JSONPath.prototype._handleCallback=function(a,b,c){if(b){var d=this._getPreferredOutput(a);a.path="string"==typeof a.path?a.path:JSONPath.toPathString(a.path),b(d,c,a)}},JSONPath.prototype._trace=function(a,b,c,d,e,f){function g(a){l=l.concat(a)}var h,i=this;if(!a.length)return h={path:c,value:b,parent:d,parentProperty:e},this._handleCallback(h,f,"value"),h;var j=a[0],k=a.slice(1),l=[];if(b&&Object.prototype.hasOwnProperty.call(b,j))g(this._trace(k,b[j],push(c,j),b,j,f));else if("*"===j)this._walk(j,k,b,c,d,e,f,function(a,b,c,d,e,f,h,j){g(i._trace(unshift(a,c),d,e,f,h,j))});else if(".."===j)g(this._trace(k,b,c,d,e,f)),this._walk(j,k,b,c,d,e,f,function(a,b,c,d,e,f,h,j){"object"==typeof d[a]&&g(i._trace(unshift(b,c),d[a],push(e,a),d,a,j))});else if("("===j[0]){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");g(this._trace(unshift(this._eval(j,b,c[c.length-1],c.slice(0,-1),d,e),k),b,c,d,e,f))}else{if("^"===j)return c.length?{path:c.slice(0,-1),expr:k,isParentSelector:!0}:[];if("~"===j)return h={path:push(c,j),value:e,parent:d,parentProperty:null},this._handleCallback(h,f,"property"),h;if("$"===j)g(this._trace(k,b,c,null,null,f));else if(0===j.indexOf("?(")){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");this._walk(j,k,b,c,d,e,f,function(a,b,c,d,e,f,h,j){i._eval(b.replace(/^\?\((.*?)\)$/,"$1"),d[a],a,e,f,h)&&g(i._trace(unshift(a,c),d,e,f,h,j))})}else if(j.indexOf(",")>-1){var m,n;for(m=j.split(","),n=0;ni;i++)h(i,a,b,c,d,e,f,g);else if("object"==typeof c)for(k in c)Object.prototype.hasOwnProperty.call(c,k)&&h(k,a,b,c,d,e,f,g)},JSONPath.prototype._slice=function(a,b,c,d,e,f,g){if(Array.isArray(c)){var h,i=c.length,j=a.split(":"),k=j[0]&&parseInt(j[0],10)||0,l=j[1]&&parseInt(j[1],10)||i,m=j[2]&&parseInt(j[2],10)||1;k=0>k?Math.max(0,k+i):Math.min(i,k),l=0>l?Math.max(0,l+i):Math.min(i,l);var n=[];for(h=k;l>h;h+=m)n=n.concat(this._trace(unshift(h,b),c,d,e,f,g));return n}},JSONPath.prototype._eval=function(a,b,c,d,e,f){if(!this._obj||!b)return!1;a.indexOf("@parentProperty")>-1&&(this.currSandbox._$_parentProperty=f,a=a.replace(/@parentProperty/g,"_$_parentProperty")),a.indexOf("@parent")>-1&&(this.currSandbox._$_parent=e,a=a.replace(/@parent/g,"_$_parent")),a.indexOf("@property")>-1&&(this.currSandbox._$_property=c,a=a.replace(/@property/g,"_$_property")),a.indexOf("@path")>-1&&(this.currSandbox._$_path=JSONPath.toPathString(d.concat([c])),a=a.replace(/@path/g,"_$_path")),a.match(/@([\.\s\)\[])/)&&(this.currSandbox._$_v=b,a=a.replace(/@([\.\s\)\[])/g,"_$_v$1"));try{return vm.runInNewContext(a,this.currSandbox)}catch(g){throw console.log(g),new Error("jsonPath: "+g.message+": "+a)}},JSONPath.cache={},JSONPath.toPathString=function(a){var b,c,d=a,e="$";for(b=1,c=d.length;c>b;b++)/^(~|\^|@.*?\(\))$/.test(d[b])||(e+=/^[0-9*]+$/.test(d[b])?"["+d[b]+"]":"['"+d[b]+"']");return e},JSONPath.toPointer=function(a){var b,c,d=a,e="";for(b=1,c=d.length;c>b;b++)/^(~|\^|@.*?\(\))$/.test(d[b])||(e+="/"+d[b].toString().replace(/\~/g,"~0").replace(/\//g,"~1"));return e},JSONPath.toPathArray=function(a){var b=JSONPath.cache;if(b[a])return b[a];var c=[],d=a.replace(/@(?:null|boolean|number|string|array|object|integer|undefined|nonFinite|function|other)\(\)/g,";$&;").replace(/[\['](\??\(.*?\))[\]']/g,function(a,b){return"[#"+(c.push(b)-1)+"]"}).replace(/\['([^'\]]*)'\]/g,function(a,b){return"['"+b.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/'?\.'?(?![^\[]*\])|\['?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(a,b){return";"+b.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),e=d.split(";").map(function(a){var b=a.match(/#([0-9]+)/);return b&&b[1]?c[b[1]]:a});return b[a]=e,b[a]},JSONPath.eval=function(a,b,c){return JSONPath(c,b,a)},"function"==typeof define&&define.amd?define(function(){return JSONPath}):isNode?module.exports=JSONPath:(self.jsonPath={eval:JSONPath.eval},self.JSONPath=JSONPath)}("undefined"==typeof require?null:require)},{vm:65}],15:[function(a,b,c){(function(a){(function(){var c,d,e,f,g=[].slice;e=function(a){return a instanceof d||(a=new d(a),a.index()),function(b,c,e){var f,g;return g=new d(b.headers["accept-language"]),f=g.best(a),b.locale=String(f),b.rawLocale=f,e()}},e.Locale=function(){function b(a){var b,c,d,e;(d=null!=a?a.match(/[a-z]+/gi):void 0)&&(c=d[0],b=d[1],this.code=a,this.language=c.toLowerCase(),b&&(this.country=b.toUpperCase()),e=[this.language],this.country&&e.push(this.country),this.normalized=e.join("_"))}var c;return b["default"]=new b(a.env.LANG||"en_US"),c=function(){return this.language?this.code:null},b.prototype.toString=c,b.prototype.toJSON=c,b}(),e.Locales=function(){function a(a){var b,d,e,f,g,h,i;if(a){for(h=String(a).split(","),f=0,g=h.length;g>f;f++)b=h[f],i=b.split(";"),d=i[0],e=i[1],d=new c(d.trim()),d.score=e?+e.slice(2)||0:1,this.push(d);this.sort(function(a,b){return b.score-a.score})}}var b;return a.prototype.length=0,a.prototype._index=null,a.prototype.sort=Array.prototype.sort,a.prototype.push=Array.prototype.push,a.prototype.index=function(){var a,b,c,d;if(!this._index)for(this._index={},a=c=0,d=this.length;d>c;a=++c)b=this[a],this._index[b.normalized]=a;return this._index},a.prototype.best=function(a){var b,d,e,f,g,h,i,j,k,l,m;if(i=function(a){var b;return b=a,b.defaulted=!1,b},g=c["default"],g.defaulted=!0,!a)return this[0]&&(g=this[0],g.defaulted=!0),g;for(b=a.index(),j=0,l=this.length;l>j;j++){if(d=this[j],h=b[d.normalized],f=b[d.language],null!=h)return i(a[h]);if(null!=f)return i(a[f]);for(k=0,m=a.length;m>k;k++)if(e=a[k],e.language===d.language)return i(e)}return g},b=function(){return g.call(this)},a.prototype.toJSON=b,a.prototype.toString=function(){return String(this.toJSON())},a}(),f=b.exports=e,c=f.Locale,d=f.Locales}).call(this)}).call(this,a("_process"))},{_process:64}],16:[function(a,b,c){b.exports=function(a,b,c){for(var d=0,e=a.length,f=3==arguments.length?c:a[d++];e>d;)f=b.call(null,f,a[d],++d,a);return f}},{}],17:[function(a,b,c){void function(a,d){"function"==typeof define&&define.amd?define(d):"object"==typeof c?b.exports=d():a.resolveUrl=d()}(this,function(){function a(){var a=arguments.length;if(0===a)throw new Error("resolveUrl requires at least one argument; got none.");var b=document.createElement("base");if(b.href=arguments[0],1===a)return b.href;var c=document.getElementsByTagName("head")[0];c.insertBefore(b,c.firstChild);for(var d,e=document.createElement("a"),f=1;a>f;f++)e.href=arguments[f],d=e.href,b.href=d;return c.removeChild(b),d}return a})},{}],18:[function(a,b,c){"use strict";function d(a){for(var b={},c=[],d=0,e=a.length;e>d;++d)Object.prototype.hasOwnProperty.call(b,a[d])||(c.push(a[d]),b[a[d]]=1);return c}function e(a,b){var c,d,f,g,h,i;for(f=a,i=!1,c=0;c1?(i=i||b.slice(c+1),f[h[d]]=e(f[h[d]],i),c=b.length):(g=f,f=f[h[d]]);return i||g&&g.hasOwnProperty("*")||(f["*"]={}),a}function f(a,b){var c,d;for(d=a,(b.length<1||"*"!==b[b.length-1])&&b.push("*"),c=0;c0&&"$"!==b[0]&&(e=e.filter(function(c){return f(a[c],b)})),e;if("$"===c){e=[],Object.keys(a).forEach(function(c){e=e.concat(g(a[c],[].concat(b)))});for(var h=d(e),i=h.length-1;i>=0;i--)"*"===h[i]&&h.splice(i,1);return h}return a.hasOwnProperty(c)?g(a[c],b):[]}function h(a){var b,c,e=[],f=a.split(":");for(b=0;bf;++f)c=e[f],b=c.split("="),d[decodeURIComponent(b[0])]=decodeURIComponent(b[1]);return d}function j(a){var b,c,d,e,f=a.split(/\r?\n/),g={};f.pop();for(var h=0,i=f.length;i>h;++h)c=f[h],b=c.indexOf(":"),d=c.slice(0,b).toLowerCase(),e=u(c.slice(b+1)),g[d]=e;return g}function k(a){return/[\/+]json\b/.test(a)}function l(a){return a.split(/ *; */).shift()}function m(a){return t(a.split(/ *; */),function(a,b){var c=b.split(/ *= */),d=c.shift(),e=c.shift();return d&&e&&(a[d]=e),a},{})}function n(a,b){b=b||{},this.req=a,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||"undefined"==typeof this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText,this.setStatusProperties(this.xhr.status),this.header=this.headers=j(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this.setHeaderProperties(this.header),this.body="HEAD"!=this.req.method?this.parseBody(this.text?this.text:this.xhr.response):null}function o(a,b){var c=this;s.call(this),this._query=this._query||[],this.method=a,this.url=b,this.header={},this._header={},this.on("end",function(){var a=null,b=null;try{b=new n(c)}catch(d){return a=new Error("Parser is unable to parse the response"),a.parse=!0,a.original=d,a.rawResponse=c.xhr&&c.xhr.responseText?c.xhr.responseText:null,c.callback(a)}if(c.emit("response",b),a)return c.callback(a,b);if(b.status>=200&&b.status<300)return c.callback(a,b);var e=new Error(b.statusText||"Unsuccessful HTTP response");e.original=a,e.response=b,e.status=b.status,c.callback(e,b)})}function p(a,b){return"function"==typeof b?new o("GET",a).end(b):1==arguments.length?new o("GET",a):new o(a,b)}function q(a,b){var c=p("DELETE",a);return b&&c.end(b),c}var r,s=a("emitter"),t=a("reduce");r="undefined"!=typeof window?window:"undefined"!=typeof self?self:this,p.getXHR=function(){if(!(!r.XMLHttpRequest||r.location&&"file:"==r.location.protocol&&r.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(a){}return!1};var u="".trim?function(a){return a.trim()}:function(a){return a.replace(/(^\s*|\s*$)/g,"")};p.serializeObject=g,p.parseString=i,p.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},p.serialize={"application/x-www-form-urlencoded":g,"application/json":JSON.stringify},p.parse={"application/x-www-form-urlencoded":i,"application/json":JSON.parse},n.prototype.get=function(a){return this.header[a.toLowerCase()]},n.prototype.setHeaderProperties=function(a){var b=this.header["content-type"]||"";this.type=l(b);var c=m(b);for(var d in c)this[d]=c[d]},n.prototype.parseBody=function(a){var b=p.parse[this.type];return b&&a&&(a.length||a instanceof Object)?b(a):null},n.prototype.setStatusProperties=function(a){1223===a&&(a=204);var b=a/100|0;this.status=this.statusCode=a,this.statusType=b,this.info=1==b,this.ok=2==b,this.clientError=4==b,this.serverError=5==b,this.error=4==b||5==b?this.toError():!1,this.accepted=202==a,this.noContent=204==a,this.badRequest=400==a,this.unauthorized=401==a,this.notAcceptable=406==a,this.notFound=404==a,this.forbidden=403==a},n.prototype.toError=function(){var a=this.req,b=a.method,c=a.url,d="cannot "+b+" "+c+" ("+this.status+")",e=new Error(d);return e.status=this.status,e.method=b,e.url=c,e},p.Response=n,s(o.prototype),o.prototype.use=function(a){return a(this),this},o.prototype.timeout=function(a){return this._timeout=a,this},o.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},o.prototype.abort=function(){return this.aborted?void 0:(this.aborted=!0,this.xhr.abort(),this.clearTimeout(),this.emit("abort"),this)},o.prototype.set=function(a,b){if(f(a)){for(var c in a)this.set(c,a[c]);return this}return this._header[a.toLowerCase()]=b,this.header[a]=b,this},o.prototype.unset=function(a){return delete this._header[a.toLowerCase()],delete this.header[a],this},o.prototype.getHeader=function(a){return this._header[a.toLowerCase()]},o.prototype.type=function(a){return this.set("Content-Type",p.types[a]||a),this},o.prototype.parse=function(a){return this._parser=a,this},o.prototype.accept=function(a){return this.set("Accept",p.types[a]||a),this},o.prototype.auth=function(a,b){var c=btoa(a+":"+b);return this.set("Authorization","Basic "+c),this},o.prototype.query=function(a){return"string"!=typeof a&&(a=g(a)),a&&this._query.push(a),this},o.prototype.field=function(a,b){return this._formData||(this._formData=new r.FormData),this._formData.append(a,b),this},o.prototype.attach=function(a,b,c){return this._formData||(this._formData=new r.FormData),this._formData.append(a,b,c||b.name),this},o.prototype.send=function(a){var b=f(a),c=this.getHeader("Content-Type");if(b&&f(this._data))for(var d in a)this._data[d]=a[d];else"string"==typeof a?(c||this.type("form"),c=this.getHeader("Content-Type"),"application/x-www-form-urlencoded"==c?this._data=this._data?this._data+"&"+a:a:this._data=(this._data||"")+a):this._data=a;return!b||e(a)?this:(c||this.type("json"),this)},o.prototype.callback=function(a,b){var c=this._callback;this.clearTimeout(),c(a,b)},o.prototype.crossDomainError=function(){var a=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");a.crossDomain=!0,a.status=this.status,a.method=this.method,a.url=this.url,this.callback(a)},o.prototype.timeoutError=function(){var a=this._timeout,b=new Error("timeout of "+a+"ms exceeded");b.timeout=a,this.callback(b)},o.prototype.withCredentials=function(){return this._withCredentials=!0,this},o.prototype.end=function(a){var b=this,c=this.xhr=p.getXHR(),f=this._query.join("&"),g=this._timeout,h=this._formData||this._data;this._callback=a||d,c.onreadystatechange=function(){if(4==c.readyState){var a;try{a=c.status}catch(d){a=0}if(0==a){if(b.timedout)return b.timeoutError();if(b.aborted)return;return b.crossDomainError()}b.emit("end")}};var i=function(a){a.total>0&&(a.percent=a.loaded/a.total*100),a.direction="download",b.emit("progress",a)};this.hasListeners("progress")&&(c.onprogress=i);try{c.upload&&this.hasListeners("progress")&&(c.upload.onprogress=i)}catch(j){}if(g&&!this._timer&&(this._timer=setTimeout(function(){b.timedout=!0,b.abort()},g)),f&&(f=p.serializeObject(f),this.url+=~this.url.indexOf("?")?"&"+f:"?"+f),c.open(this.method,this.url,!0),this._withCredentials&&(c.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof h&&!e(h)){var l=this.getHeader("Content-Type"),m=this._parser||p.serialize[l?l.split(";")[0]:""];!m&&k(l)&&(m=p.serialize["application/json"]),m&&(h=m(h))}for(var n in this.header)null!=this.header[n]&&c.setRequestHeader(n,this.header[n]);return this.emit("request",this),c.send("undefined"!=typeof h?h:null),this},o.prototype.then=function(a,b){return this.end(function(c,d){c?b(c):a(d)})},p.Request=o,p.get=function(a,b,c){var d=p("GET",a);return"function"==typeof b&&(c=b,b=null),b&&d.query(b),c&&d.end(c),d},p.head=function(a,b,c){var d=p("HEAD",a);return"function"==typeof b&&(c=b,b=null),b&&d.send(b),c&&d.end(c),d},p.del=q,p["delete"]=q,p.patch=function(a,b,c){var d=p("PATCH",a);return"function"==typeof b&&(c=b,b=null),b&&d.send(b),c&&d.end(c),d},p.post=function(a,b,c){var d=p("POST",a);return"function"==typeof b&&(c=b,b=null),b&&d.send(b),c&&d.end(c),d},p.put=function(a,b,c){var d=p("PUT",a);return"function"==typeof b&&(c=b,b=null),b&&d.send(b),c&&d.end(c),d},b.exports=p},{emitter:8,reduce:16}],20:[function(a,b,c){"use strict";function d(a){this.log=a}function e(a,b,c){var d;if(d=c||"all"===a.parsedKey.mode?a.embeddedStep||a.linkStep:a.linkStep||a.embeddedStep)return d;var e="Could not find a matching link nor an embedded document for "+b+".";throw a.linkError&&(e+=" Error while resolving linked documents: "+a.linkError),a.embeddedError&&(e+=" Error while resolving embedded documents: "+a.embeddedError),e+=" Document: "+JSON.stringify(a.doc),new Error(e)}function f(a){var b=a.match(/(.*)\[(.*):(.*)\]/);return b?{mode:"secondary",key:b[1],secondaryKey:b[2],secondaryValue:b[3],index:null}:(b=a.match(/(.*)\[(\d+)\]/))?{mode:"index",key:b[1],secondaryKey:null,secondaryValue:null,index:b[2]}:(b=a.match(/(.*)\[\$all\]/),b?{mode:"all",key:b[1],secondaryKey:null,secondaryValue:null,index:null}:{mode:"first",key:a,secondaryKey:null,secondaryValue:null,index:null})}function g(a){a.halResource.hasCuries()&&(a.parsedKey.curie=a.halResource.reverseResolveCurie(a.parsedKey.key))}function h(a,b){var c=a.halResource.linkArray(a.parsedKey.key);if(c||(c=a.halResource.linkArray(a.parsedKey.curie)),c&&0!==c.length)switch(a.parsedKey.mode){case"secondary":i(a,c,b);break;case"index":j(a,c,b);break;case"first":k(a,c,b);break;case"all":break;default:throw new Error("Illegal mode: "+a.parsedKey.mode)}}function i(a,b,c){for(var d=0;d1&&c.warn("Found HAL link array with more than one element for key "+a.parsedKey.key+", arbitrarily choosing index "+e+", because it was the first that had a href attribute."),c.debug("found hal link: "+d.href),a.linkStep={url:d.href})}function l(a,b){b.debug("checking for embedded: "+a.parsedKey.key+(a.parsedKey.index?a.parsedKey.index:""));var c=a.halResource.embeddedArray(a.parsedKey.key);if((!c||0===c.length)&&"all"!==a.parsedKey.mode)return null;switch(b.debug("Found an array of embedded resource for: "+a.parsedKey.key),a.parsedKey.mode){case"secondary":m(a,c,b);break;case"index":n(a,c,b);break;case"all":o(a,c,b);break;case"first":p(a,c,b);break;default:throw new Error("Illegal mode: "+a.parsedKey.mode)}}function m(a,b,c){for(var d=0;d1&&c.warn("Found HAL embedded resource array with more than one element for key "+a.parsedKey.key+", arbitrarily choosing first element."),a.embeddedStep={doc:b[0].original()}}var q=a("halfred");d.mediaType="application/hal+json",d.prototype.findNextStep=function(a,b){if("undefined"==typeof b||null===b)throw new Error("Link object is null or undefined.");if("object"!=typeof b)throw new Error("Links must be objects, not "+typeof b+": ",b);if(!b.type)throw new Error("Link objects has no type attribute.",b);switch(b.type){case"link-rel":return this._handleLinkRel(a,b);case"header":return this._handleHeader(a.lastStep.response,b);default:throw new Error("Link objects with type "+b.type+" are not supported by this adapter.",b)}},d.prototype._handleLinkRel=function(a,b){var c=a.lastStep.doc,d=b.value,i=a.preferEmbedded;this.log.debug("parsing hal");var j={doc:c,halResource:q.parse(c),parsedKey:f(d),linkStep:null,embeddedStep:null};return g(j),h(j,this.log),l(j,this.log),e(j,d,i)},d.prototype._handleHeader=function(a,b){switch(b.value){case"location":var c=a.headers.location;if(!c)throw new Error("Following the location header but there was no location header in the last response.");return{url:c};default:throw new Error("Link objects with type header and value "+b.value+" are not supported by this adapter.",b)}},b.exports=d},{halfred:21}],21:[function(a,b,c){var d=a("./lib/parser"),e=!1;b.exports={parse:function(a){return(new d).parse(a,e)},enableValidation:function(a){e=null!=a?a:!0},disableValidation:function(){e=!1}}},{"./lib/parser":23}],22:[function(a,b,c){arguments[4][11][0].apply(c,arguments)},{dup:11}],23:[function(a,b,c){arguments[4][12][0].apply(c,arguments)},{"./immutable_stack":22,"./resource":24,dup:12}],24:[function(a,b,c){arguments[4][13][0].apply(c,arguments)},{dup:13}],25:[function(a,b,c){"use strict";function d(a){null==a&&(a=""),this.id=a}function e(a){return new d(a)}var f=!1;d.prototype.enable=function(){this.enabled=!0},d.prototype.debug=function(a){f&&console.log(this.id+"/debug: "+a)},d.prototype.info=function(a){f&&console.log(this.id+"/info: "+a)},d.prototype.warn=function(a){f&&console.log(this.id+"/warn: "+a)},d.prototype.error=function(a){f&&console.log(this.id+"/error: "+a)},e.enable=function(){f=!0},b.exports=e},{}],26:[function(a,b,c){"use strict";b.exports={isArray:function(a){return null==a?!1:"[object Array]"===Object.prototype.toString.call(a)}}},{}],27:[function(a,b,c){"use strict";function d(){}function e(a,b){return b=b||{},f(a,b),g(a,b),h(a,b),i(a,b),j(a,b),k(a,b),a}function f(a,b){var c=b.qs;null!=c&&(a=a.query(c))}function g(a,b){var c=b.headers;null!=c&&(a=a.set(c))}function h(a,b){var c=b.auth;null!=c&&(a=a.auth(c.user||c.username,c.pass||c.password))}function i(a,b){if(null!=b){var c=b.body;null!=c&&(a=a.send(c))}}function j(a,b){if(null!=b){var c=b.form;null!=c&&(a=a.send(c),a=a.set("Content-Type","application/x-www-form-urlencoded"))}}function k(a,b){if(null!=b){var c=b.withCredentials;c===!0&&a.withCredentials()}}function l(a){return a.body=a.text,a.statusCode=a.status,a}function m(a){return function(b,c){if(b){if(!c)return a(b);a(null,l(c))}else a(null,l(c))}}var n=a("superagent");d.prototype.get=function(a,b,c){return e(n.get(a),b).end(m(c))},d.prototype.post=function(a,b,c){return e(n.post(a),b).end(m(c))},d.prototype.put=function(a,b,c){return e(n.put(a),b).end(m(c))},d.prototype.patch=function(a,b,c){return e(n.patch(a),b).end(m(c))},d.prototype.del=function(a,b,c){return e(n.del(a),b).end(m(c))},b.exports=new d},{superagent:19}],28:[function(a,b,c){"use strict";var d={startsWith:function(a,b){return""===b?!0:null==a||null==b?!1:(a=String(a),b=String(b),a.length>=b.length&&a.slice(0,b.length)===b)},endsWith:function(a,b){return""===b?!0:null==a||null==b?!1:(a=String(a),b=String(b),a.length>=b.length&&a.slice(a.length-b.length)===b)},splice:function(a,b,c,e){var f=d.chars(a);return f.splice(~~b,~~c,e), +f.join("")},contains:function(a,b){return""===b?!0:null==a?!1:-1!==String(a).indexOf(b)},chars:function(a){return null==a?[]:String(a).split("")}};b.exports=d},{}],29:[function(a,b,c){"use strict";var d=a("resolve-url");c.resolve=function(a,b){return d(a,b)}},{"resolve-url":17}],30:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson");c.abortTraversal=function(){e.debug("aborting link traversal"),this.aborted=!0,this.currentRequest&&(e.debug("request in progress. trying to abort it, too."),this.currentRequest.abort())},c.registerAbortListener=function(a,b){a.currentRequest&&a.currentRequest.on("abort",function(){c.callCallbackOnAbort(a)})},c.callCallbackOnAbort=function(a){e.debug("link traversal aborted"),a.callbackHasBeenCalledAfterAbort||(a.callbackHasBeenCalledAfterAbort=!0,a.callback(c.abortError(),a))},c.abortError=function(){var a=new Error("Link traversal process has been aborted.");return a.name="AbortError",a.aborted=!0,a}},{minilog:25}],31:[function(a,b,c){"use strict";function d(a,b,c,d){var e;e=a.convertResponseToObject?[q,h,r,l]:[p],a.lastMethod=c,g.walk(a,e,d)}function e(a){return{abort:a.abortTraversal}}var f=a("minilog"),g=(f("traverson"),a("./abort_traversal"),a("./transforms/apply_transforms"),a("./http_requests"),a("./is_continuation"),a("./walker")),h=a("./transforms/check_http_status"),i=a("./transforms/continuation_to_doc"),j=a("./transforms/continuation_to_response"),k=a("./transforms/convert_embedded_doc_to_response"),l=a("./transforms/extract_doc"),m=a("./transforms/extract_response"),n=a("./transforms/extract_url"),o=a("./transforms/fetch_last_resource"),p=a("./transforms/execute_last_http_request"),q=a("./transforms/execute_http_request"),r=a("./transforms/parse");c.get=function(a,b){var c;return c=a.convertResponseToObject?[i,o,h,r,l]:[j,o,k,m],g.walk(a,c,b),e(a)},c.getUrl=function(a,b){return g.walk(a,[n],b),e(a)},c.post=function(a,b){return d(a,a.requestModuleInstance,a.requestModuleInstance.post,b),e(a)},c.put=function(a,b){return d(a,a.requestModuleInstance,a.requestModuleInstance.put,b),e(a)},c.patch=function(a,b){return d(a,a.requestModuleInstance,a.requestModuleInstance.patch,b),e(a)},c["delete"]=function(a,b){return d(a,a.requestModuleInstance,a.requestModuleInstance.del,b),e(a)}},{"./abort_traversal":30,"./http_requests":33,"./is_continuation":34,"./transforms/apply_transforms":40,"./transforms/check_http_status":41,"./transforms/continuation_to_doc":42,"./transforms/continuation_to_response":43,"./transforms/convert_embedded_doc_to_response":44,"./transforms/execute_http_request":46,"./transforms/execute_last_http_request":47,"./transforms/extract_doc":48,"./transforms/extract_response":49,"./transforms/extract_url":50,"./transforms/fetch_last_resource":51,"./transforms/parse":54,"./walker":60,minilog:25}],32:[function(a,b,c){"use strict";function d(a){this.mediaType=a||t.CONTENT_NEGOTIATION,this.adapter=this._createAdapter(this.mediaType),this.contentNegotiation=!0,this.convertResponseToObjectFlag=!1,this.links=[],this.jsonParser=JSON.parse,this.requestModuleInstance=o,this.requestOptions={},this.resolveRelativeFlag=!1,this.preferEmbedded=!1,this.lastTraversalState=null,this.continuation=null}function e(a,b){for(var c=0;c continuing finished traversal process"),a.continuation={step:b.step,action:d},a.continuation.step.index=0,j(a,b),a}})}}function j(a,b){a.aborted=!1,a.adapter=b.adapter,a.body=b.body,a.callbackHasBeenCalledAfterAbort=!1,a.contentNegotiation=b.contentNegotiation,a.convertResponseToObjectFlag=b.convertResponseToObject,a.links=[],a.jsonParser=b.jsonParser,a.requestModuleInstance=b.requestModuleInstance,a.requestOptions=b.requestOptions,a.resolveRelativeFlag=b.resolveRelative,a.preferEmbedded=b.preferEmbedded,a.startUrl=b.startUrl,a.templateParameters=b.templateParameters}function k(a){return p.isArray(a)?m(a):"object"==typeof a?l(a):a}function l(a){return u(null,a)}function m(a){return a?a.slice(0):a}var n=a("minilog"),o=a("request"),p=a("util"),q=a("./actions"),r=a("./abort_traversal").abortTraversal,s=a("./media_type_registry"),t=a("./media_types"),u=a("./merge_recursive"),v=n("traverson");d.prototype._createAdapter=function(a){var b=s.get(a);if(!b)throw new Error("Unknown or unsupported media type: "+a);return v.debug("creating new "+b.name),new b(v)},d.prototype.newRequest=function(){var a=new d(this.getMediaType());return a.contentNegotiation=this.doesContentNegotiation(),a.convertResponseToObject(this.convertsResponseToObject()),a.from(m(this.getFrom())),a.withTemplateParameters(k(this.getTemplateParameters())),a.withRequestOptions(k(this.getRequestOptions())),a.withRequestLibrary(this.getRequestLibrary()),a.parseResponseBodiesWith(this.getJsonParser()),a.resolveRelative(this.doesResolveRelative()),a.preferEmbeddedResources(this.doesPreferEmbeddedResources()),a.continuation=this.continuation,a},d.prototype.setMediaType=function(a){return this.mediaType=a||t.CONTENT_NEGOTIATION,this.adapter=this._createAdapter(a),this.contentNegotiation=a===t.CONTENT_NEGOTIATION,this},d.prototype.json=function(){return this.setMediaType(t.JSON),this},d.prototype.jsonHal=function(){return this.setMediaType(t.JSON_HAL),this},d.prototype.useContentNegotiation=function(){return this.setMediaType(t.CONTENT_NEGOTIATION),this.contentNegotiation=!0,this},d.prototype.from=function(a){return this.startUrl=a,this},d.prototype.follow=function(){for(var a=Array.prototype.slice.apply(1===arguments.length&&p.isArray(arguments[0])?arguments[0]:arguments),b=0;b1?new Error("JSONPath expression "+b+" returned more than one match in document:\n"+JSON.stringify(a)):new Error("JSONPath expression "+b+" returned no match in document:\n"+JSON.stringify(a))},d.prototype._handleHeader=function(a,b){switch(b.value){case"location":var c=a.headers.location;if(!c)throw new Error("Following the location header but there was no location header in the last response.");return{url:c};default:throw new Error("Link objects with type header and value "+b.value+" are not supported by this adapter.",b)}},b.exports=d},{"jsonpath-plus":14,minilog:25,"underscore.string":28}],36:[function(a,b,c){"use strict";var d=a("./media_types"),e={};c.register=function(a,b){e[a]=b},c.get=function(a){return e[a]},c.register(d.CONTENT_NEGOTIATION,a("./negotiation_adapter")),c.register(d.JSON,a("./json_adapter"))},{"./json_adapter":35,"./media_types":37,"./negotiation_adapter":39}],37:[function(a,b,c){"use strict";b.exports={CONTENT_NEGOTIATION:"content-negotiation",JSON:"application/json",JSON_HAL:"application/hal+json"}},{}],38:[function(a,b,c){"use strict";function d(a,b){!a&&b&&(a={});for(var c in b)b.hasOwnProperty(c)&&e(a,b,c);return a}function e(a,b,c){"object"==typeof b[c]?(a[c]&&"object"==typeof a[c]||(a[c]={}),d(a[c],b[c])):"function"!=typeof b[c]&&(a[c]=b[c])}b.exports=d},{}],39:[function(a,b,c){"use strict";function d(a){}d.prototype.findNextStep=function(a,b){throw new Error("Content negotiation did not happen")},b.exports=d},{}],40:[function(a,b,c){(function(c){"use strict";function d(a,b,e){f.debug("applying",a.length,"transforms");for(var g=0;gb||b>=300)){var c=d(a.step.url,b,a.step.response.body);return f.error("unexpected http status code"),f.error(c),a.callback(c),!1}return f.debug("http status code ok ("+b+")"),!0}},{"../is_continuation":34,minilog:25}],42:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson"),f=a("../is_continuation");b.exports=function(a){return f(a)?(e.debug("continuing from last traversal process (actions)"),a.continuation=null,a.callback(null,a.step.doc),!1):!0}},{"../is_continuation":34,minilog:25}],43:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson"),f=a("./convert_embedded_doc_to_response"),g=a("../is_continuation");b.exports=function(a){return g(a)?(e.debug("continuing from last traversal process (actions)"),a.continuation=null,f(a),a.callback(null,a.step.response),!1):!0}},{"../is_continuation":34,"./convert_embedded_doc_to_response":44,minilog:25}],44:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson");b.exports=function(a){return!a.step.response&&a.step.doc&&(e.debug("faking HTTP response for embedded resource"),a.step.response={statusCode:200,body:JSON.stringify(a.step.doc),remark:"This is not an actual HTTP response. The resource you requested was an embedded resource, so no HTTP request was made to acquire it."}),!0}},{minilog:25}],45:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson"),f=a("../media_type_registry");b.exports=function(a,b){if(a.contentNegotiation&&a.step.response&&a.step.response.headers&&a.step.response.headers["content-type"]){var c=a.step.response.headers["content-type"].split(/[; ]/)[0],d=f.get(c);if(!d)return b(new Error("Unknown content type for content type detection: "+c)),!1;a.adapter=new d(e)}return!0}},{"../media_type_registry":36,minilog:25}],46:[function(a,b,c){"use strict";function d(a,b){return a.aborted?g.callCallbackOnAbort(a):void h.executeHttpRequest(a,a.requestModuleInstance,a.lastMethod,function(c,d){return c?(c.aborted||(f.debug("error while processing step ",a.step),f.error(c)),a.callback(c)):void b(a)})}var e=a("minilog"),f=e("traverson"),g=a("../abort_traversal"),h=a("../http_requests");d.isAsync=!0,b.exports=d},{"../abort_traversal":30,"../http_requests":33,minilog:25}],47:[function(a,b,c){"use strict";function d(a,b){return a.aborted?f.callCallbackOnAbort(a):void g.executeHttpRequest(a,a.requestModuleInstance,a.lastMethod,a.callback)}var e=a("minilog"),f=(e("traverson"),a("../abort_traversal")),g=a("../http_requests");d.isAsync=!0,b.exports=d},{"../abort_traversal":30,"../http_requests":33,minilog:25}],48:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson");b.exports=function(a){return e.debug("walker.walk has finished"),a.callback(null,a.step.doc),!1}},{minilog:25}],49:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson");b.exports=function(a){return e.debug("walker.walk has finished"),a.callback(null,a.step.response),!1}},{minilog:25}],50:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson"),f=a("url");b.exports=function(a){return e.debug("walker.walk has finished"),a.step.url?a.callback(null,a.step.url):a.step.doc&&a.step.doc._links&&a.step.doc._links.self&&a.step.doc._links.self.href?a.callback(null,f.resolve(a.startUrl,a.step.doc._links.self.href)):a.callback(new Error('You requested an URL but the last resource is an embedded resource and has no URL of its own (that is, it has no link with rel="self"'))}},{minilog:25,url:29}],51:[function(a,b,c){"use strict";function d(a,b){return a.aborted?g.callCallbackOnAbort(a):void h.fetchResource(a,function(a,c){return f.debug("fetchResource returned (fetchLastResource)."),a?(a.aborted||(f.debug("error while processing step ",c.step),f.error(a)),c.callback(a)):void b(c)})}var e=a("minilog"),f=e("traverson"),g=a("../abort_traversal"),h=a("../http_requests");d.isAsync=!0,b.exports=d},{"../abort_traversal":30,"../http_requests":33,minilog:25}],52:[function(a,b,c){(function(c){"use strict";function d(a,b){j(a)?e(a,b):f(a,b)}function e(a,b){h.debug("continuing from last traversal process (walker)"),c.nextTick(function(){b(a)})}function f(a,b){return a.aborted?i.callCallbackOnAbort(a):void k.fetchResource(a,function(a,c){return h.debug("fetchResource returned"),a?(a.aborted||(h.debug("error while processing step ",c.step),h.error(a)),c.callback(a)):void b(c)})}var g=a("minilog"),h=g("traverson"),i=a("../abort_traversal"),j=a("../is_continuation"),k=a("../http_requests");d.isAsync=!0,b.exports=d}).call(this,a("_process"))},{"../abort_traversal":30,"../http_requests":33,"../is_continuation":34,_process:64,minilog:25}],53:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson"),f=a("util");b.exports=function(a){var b=a.requestOptions;return f.isArray(a.requestOptions)&&(b=a.requestOptions[a.step.index]||{}),e.debug("options: ",b),b}},{minilog:25,util:26}],54:[function(a,b,c){"use strict";function d(a,b){var c=new Error("The document at "+a+" could not be parsed as JSON: "+b);return c.name="JSONError",c.url=a,c.body=b,c}var e=a("minilog"),f=e("traverson"),g=a("../is_continuation");b.exports=function(a){if(g(a)&&(f.debug("continuing from last traversal process (transforms/parse)"),"getResource"===a.continuation.action))return!0;if(a.step.doc)return f.debug("no parsing necessary, probably an embedded document"),!0;try{return f.debug("parsing response body"),a.step.doc=a.jsonParser(a.step.response.body),!0}catch(b){var c=b;return"SyntaxError"===b.name&&(c=d(a.step.url,a.step.response.body)),f.error("parsing failed"),f.error(c),a.callback(c),!1}}},{"../is_continuation":34,minilog:25}],55:[function(a,b,c){"use strict";var d=a("../is_continuation");b.exports=function(a){return d(a)?!0:(a.continuation=null,!0)}},{"../is_continuation":34}],56:[function(a,b,c){"use strict";var d=a("../is_continuation");b.exports=function(a){return d(a)?!0:(a.lastStep=null,!0)}},{"../is_continuation":34}],57:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson"),f=a("underscore.string"),g=a("url"),h=/https?:\/\//i;b.exports=function(a){return a.step.url&&0!==a.step.url.search(h)&&(e.debug("found non full qualified URL"),a.resolveRelative&&a.lastStep&&a.lastStep.url?(e.debug("resolving URL relative"),f.startsWith(a.step.url,"/")&&f.endsWith(a.lastStep.url,"/")&&(a.step.url=f.splice(a.step.url,0,1)),a.step.url=a.lastStep.url+a.step.url):a.step.url=g.resolve(a.startUrl,a.step.url)),!0}},{minilog:25,"underscore.string":28,url:29}],58:[function(a,b,c){"use strict";var d=a("minilog"),e=d("traverson"),f=a("underscore.string"),g=a("url-template"),h=a("util");b.exports=function(a){if(a.step.url){var b=a.templateParameters;if(h.isArray(b)&&(b=b[a.step.index]),b=b||{},f.contains(a.step.url,"{")){e.debug("resolving URI template");var c=g.parse(a.step.url),d=c.expand(b);e.debug("resolved to ",d),a.step.url=d}}return!0}},{minilog:25,"underscore.string":28,"url-template":62,util:26}],59:[function(a,b,c){"use strict";function d(a,b){try{return a.adapter.findNextStep(a,b)}catch(c){return f.error("could not find next step"),f.error(c),a.callback(c),null}}var e=a("minilog"),f=e("traverson");b.exports=function(a){var b=a.links[a.step.index];return f.debug("next link: "+b),a.lastStep=a.step,a.step=d(a,b),a.step?(f.debug("found next step",a.step),a.step.url=a.step.url||a.step.uri,a.step.index=a.lastStep.index+1,!0):!1}},{minilog:25}],60:[function(a,b,c){"use strict";function d(a,b){if(h.debug("processing next step"),e(a)&&!f(a))j(l,a,function(a){h.debug("successfully processed step"),d(a,b)});else{if(f(a))return i.callCallbackOnAbort(a);h.debug("link array exhausted"),j(b,a,function(a){return a.callback()})}}function e(a){return a.step.index1)for(var c=1;c