Commit df11fd2c authored by Boris Kocherov's avatar Boris Kocherov

Merge branch 'bk_xmla_client.dev.171108' into merge_jio_xmla.171114

parents 18ff98e7 38f7f1ee
...@@ -54,6 +54,8 @@ require.config({ ...@@ -54,6 +54,8 @@ require.config({
jmousewheel : '../vendor/perfect-scrollbar/src/jquery.mousewheel', jmousewheel : '../vendor/perfect-scrollbar/src/jquery.mousewheel',
xregexp : '../vendor/xregexp/xregexp-all-min', xregexp : '../vendor/xregexp/xregexp-all-min',
sockjs : '../vendor/sockjs/sockjs.min', sockjs : '../vendor/sockjs/sockjs.min',
Xmla : '../vendor/xmla4js/Xmla-compiled',
RSVP : '../vendor/rsvp/rsvp.min',
jszip : '../vendor/jszip/jszip.min', jszip : '../vendor/jszip/jszip.min',
jsziputils : '../vendor/jszip-utils/jszip-utils.min', jsziputils : '../vendor/jszip-utils/jszip-utils.min',
jsrsasign : '../vendor/jsrsasign/jsrsasign-latest-all-min', jsrsasign : '../vendor/jsrsasign/jsrsasign-latest-all-min',
...@@ -109,6 +111,8 @@ require.config({ ...@@ -109,6 +111,8 @@ require.config({
'allfonts', 'allfonts',
'xregexp', 'xregexp',
'sockjs', 'sockjs',
'window!Xmla',
'RSVP',
'jszip', 'jszip',
'jsziputils' 'jsziputils'
] ]
......
...@@ -54,6 +54,8 @@ require.config({ ...@@ -54,6 +54,8 @@ require.config({
jmousewheel : '../vendor/perfect-scrollbar/src/jquery.mousewheel', jmousewheel : '../vendor/perfect-scrollbar/src/jquery.mousewheel',
xregexp : '../vendor/xregexp/xregexp-all-min', xregexp : '../vendor/xregexp/xregexp-all-min',
sockjs : '../vendor/sockjs/sockjs.min', sockjs : '../vendor/sockjs/sockjs.min',
Xmla : '../vendor/xmla4js/Xmla-compiled',
RSVP : '../vendor/rsvp/rsvp.min',
jszip : '../vendor/jszip/jszip.min', jszip : '../vendor/jszip/jszip.min',
jsziputils : '../vendor/jszip-utils/jszip-utils.min', jsziputils : '../vendor/jszip-utils/jszip-utils.min',
api : 'api/documents/api', api : 'api/documents/api',
......
...@@ -272,6 +272,8 @@ ...@@ -272,6 +272,8 @@
<script type="text/javascript" src="../../../vendor/jquery/jquery.min.js"></script> <script type="text/javascript" src="../../../vendor/jquery/jquery.min.js"></script>
<script type="text/javascript" src="../../../vendor/xregexp/xregexp-all-min.js"></script> <script type="text/javascript" src="../../../vendor/xregexp/xregexp-all-min.js"></script>
<script type="text/javascript" src="../../../vendor/rsvp/rsvp.min.js"></script>
<script type="text/javascript" src="../../../vendor/xmla4js/Xmla-compiled.js"></script>
<script type="text/javascript" src="../sdk_dev_scripts.js"></script> <script type="text/javascript" src="../sdk_dev_scripts.js"></script>
<script> <script>
......
/*jslint browser:true, indent:2*/
/*global define, require*/ // Require.JS
define(function () {
'use strict';
return {
/**
* @param {String} name This is the name of the desired resource module.
* @param {Function} req Provides a "require" to load other modules.
* @param {Function} load Pass the module's result to this function.
* @param {Object} config Provides the optimizer's configuration.
*/
load: function (name, req, load) { // , config
req([name], function (result) {
if (typeof(window) !== 'undefined') {
window[name] = result;
}
load(result);
});
}
};
});
...@@ -110,6 +110,8 @@ module.exports = function(grunt) { ...@@ -110,6 +110,8 @@ module.exports = function(grunt) {
doRegisterTask('megapixel'); doRegisterTask('megapixel');
doRegisterTask('jquery'); doRegisterTask('jquery');
doRegisterTask('underscore'); doRegisterTask('underscore');
doRegisterTask('xmla4js');
doRegisterTask('rsvp');
doRegisterTask('zeroclipboard'); doRegisterTask('zeroclipboard');
doRegisterTask('bootstrap'); doRegisterTask('bootstrap');
doRegisterTask('jszip'); doRegisterTask('jszip');
...@@ -369,6 +371,8 @@ module.exports = function(grunt) { ...@@ -369,6 +371,8 @@ module.exports = function(grunt) {
grunt.registerTask('deploy-xregexp', ['xregexp-init', 'clean', 'copy']); grunt.registerTask('deploy-xregexp', ['xregexp-init', 'clean', 'copy']);
grunt.registerTask('deploy-megapixel', ['megapixel-init', 'clean', 'copy']); grunt.registerTask('deploy-megapixel', ['megapixel-init', 'clean', 'copy']);
grunt.registerTask('deploy-jquery', ['jquery-init', 'clean', 'copy']); grunt.registerTask('deploy-jquery', ['jquery-init', 'clean', 'copy']);
grunt.registerTask('deploy-xmla4js', ['xmla4js-init', 'clean', 'copy']);
grunt.registerTask('deploy-rsvp', ['rsvp-init', 'clean', 'copy']);
grunt.registerTask('deploy-underscore', ['underscore-init', 'clean', 'copy']); grunt.registerTask('deploy-underscore', ['underscore-init', 'clean', 'copy']);
grunt.registerTask('deploy-bootstrap', ['bootstrap-init', 'clean', 'copy']); grunt.registerTask('deploy-bootstrap', ['bootstrap-init', 'clean', 'copy']);
grunt.registerTask('deploy-jszip', ['jszip-init', 'clean', 'copy']); grunt.registerTask('deploy-jszip', ['jszip-init', 'clean', 'copy']);
......
...@@ -140,6 +140,28 @@ ...@@ -140,6 +140,28 @@
} }
} }
}, },
"xmla4js": {
"clean": [
"../deploy/web-apps/vendor/xmla4js"
],
"copy": {
"script": {
"src": "../vendor/xmla4js/Xmla-compiled.js",
"dest": "../deploy/web-apps/vendor/xmla4js/Xmla-compiled.js"
}
}
},
"rsvp": {
"clean": [
"../deploy/web-apps/vendor/rsvp"
],
"copy": {
"script": {
"src": "../vendor/rsvp/rsvp.min.js",
"dest": "../deploy/web-apps/vendor/rsvp/rsvp.min.js"
}
}
},
"jszip": { "jszip": {
"clean": [ "clean": [
"../deploy/web-apps/vendor/jszip" "../deploy/web-apps/vendor/jszip"
...@@ -190,6 +212,8 @@ ...@@ -190,6 +212,8 @@
"deploy-sockjs", "deploy-sockjs",
"deploy-xregexp", "deploy-xregexp",
"deploy-requirejs", "deploy-requirejs",
"deploy-xmla4js",
"deploy-rsvp",
"deploy-megapixel", "deploy-megapixel",
"deploy-jquery", "deploy-jquery",
"deploy-underscore", "deploy-underscore",
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
"perfectscrollbar": "common/main/lib/mods/perfect-scrollbar", "perfectscrollbar": "common/main/lib/mods/perfect-scrollbar",
"jmousewheel": "../vendor/perfect-scrollbar/src/jquery.mousewheel", "jmousewheel": "../vendor/perfect-scrollbar/src/jquery.mousewheel",
"xregexp": "empty:", "xregexp": "empty:",
"Xmla": "empty:",
"RSVP": "empty:",
"sockjs": "empty:", "sockjs": "empty:",
"jszip": "empty:", "jszip": "empty:",
"jszip-utils": "empty:", "jszip-utils": "empty:",
...@@ -83,6 +85,8 @@ ...@@ -83,6 +85,8 @@
"allfonts", "allfonts",
"xregexp", "xregexp",
"sockjs", "sockjs",
"window!Xmla",
"RSVP",
"jszip", "jszip",
"jszip-utils" "jszip-utils"
] ]
...@@ -203,6 +207,8 @@ ...@@ -203,6 +207,8 @@
"framework7": "../vendor/framework7/js/framework7", "framework7": "../vendor/framework7/js/framework7",
"text": "../vendor/requirejs-text/text", "text": "../vendor/requirejs-text/text",
"xregexp": "empty:", "xregexp": "empty:",
"Xmla": "empty:",
"RSVP": "empty:",
"sockjs": "empty:", "sockjs": "empty:",
"jszip": "empty:", "jszip": "empty:",
"jszip-utils": "empty:", "jszip-utils": "empty:",
...@@ -261,6 +267,8 @@ ...@@ -261,6 +267,8 @@
"coapisettings", "coapisettings",
"allfonts", "allfonts",
"xregexp", "xregexp",
"window!Xmla",
"RSVP",
"sockjs", "sockjs",
"jszip", "jszip",
"jszip-utils" "jszip-utils"
......
(function(globals) {
var define, requireModule;
(function() {
var registry = {}, seen = {};
define = function(name, deps, callback) {
registry[name] = { deps: deps, callback: callback };
};
requireModule = function(name) {
if (seen[name]) { return seen[name]; }
seen[name] = {};
var mod = registry[name];
if (!mod) {
throw new Error("Module '" + name + "' not found.");
}
var deps = mod.deps,
callback = mod.callback,
reified = [],
exports;
for (var i=0, l=deps.length; i<l; i++) {
if (deps[i] === 'exports') {
reified.push(exports = {});
} else {
reified.push(requireModule(deps[i]));
}
}
var value = callback.apply(this, reified);
return seen[name] = exports || value;
};
})();
define("rsvp/all",
["rsvp/promise","exports"],
function(__dependency1__, __exports__) {
"use strict";
var Promise = __dependency1__.Promise;
/* global toString */
function promiseAtLeast(expected_count, promises) {
if (Object.prototype.toString.call(promises) !== "[object Array]") {
throw new TypeError('You must pass an array to all.');
}
function canceller() {
var promise;
for (var i = 0; i < promises.length; i++) {
promise = promises[i];
if (promise && typeof promise.then === 'function' &&
typeof promise.cancel === 'function') {
promise.cancel();
}
}
}
return new Promise(function(resolve, reject, notify) {
var results = [], remaining = promises.length,
promise, remaining_count = promises.length - expected_count;
if (remaining === 0) {
if (expected_count === 1) {
resolve();
} else {
resolve([]);
}
}
function resolver(index) {
return function(value) {
resolveAll(index, value);
};
}
function resolveAll(index, value) {
results[index] = value;
if (--remaining === remaining_count) {
if (remaining_count === 0) {
resolve(results);
} else {
resolve(value);
canceller();
}
}
}
function notifier(index) {
return function(value) {
notify({"index": index, "value": value});
};
}
function cancelAll(rejectionValue) {
reject(rejectionValue);
canceller();
}
for (var i = 0; i < promises.length; i++) {
promise = promises[i];
if (promise && typeof promise.then === 'function') {
promise.then(resolver(i), cancelAll, notifier(i));
} else {
resolveAll(i, promise);
}
}
}, canceller
);
}
function all(promises) {
return promiseAtLeast(promises.length, promises);
}
function any(promises) {
return promiseAtLeast(1, promises);
}
__exports__.all = all;
__exports__.any = any;
});
define("rsvp/async",
["exports"],
function(__exports__) {
"use strict";
var browserGlobal = (typeof window !== 'undefined') ? window : {};
var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
var async;
var local = (typeof global !== 'undefined') ? global : this;
function checkNativePromise() {
if (typeof Promise === "function" &&
typeof Promise.resolve === "function") {
try {
/* global Promise */
var promise = new Promise(function(){});
if ({}.toString.call(promise) === "[object Promise]") {
return true;
}
} catch (e) {}
}
return false;
}
function useNativePromise() {
var nativePromise = Promise.resolve();
return function(callback, arg) {
nativePromise.then(function () {
callback(arg);
});
};
}
// old node
function useNextTick() {
return function(callback, arg) {
process.nextTick(function() {
callback(arg);
});
};
}
// node >= 0.10.x
function useSetImmediate() {
return function(callback, arg) {
/* global setImmediate */
setImmediate(function(){
callback(arg);
});
};
}
function useMutationObserver() {
var queue = [];
var observer = new BrowserMutationObserver(function() {
var toProcess = queue.slice();
queue = [];
toProcess.forEach(function(tuple) {
var callback = tuple[0], arg= tuple[1];
callback(arg);
});
});
var element = document.createElement('div');
observer.observe(element, { attributes: true });
// Chrome Memory Leak: https://bugs.webkit.org/show_bug.cgi?id=93661
window.addEventListener('unload', function(){
observer.disconnect();
observer = null;
}, false);
return function(callback, arg) {
queue.push([callback, arg]);
element.setAttribute('drainQueue', 'drainQueue');
};
}
function useSetTimeout() {
return function(callback, arg) {
local.setTimeout(function() {
callback(arg);
}, 1);
};
}
if (typeof setImmediate === 'function') {
async = useSetImmediate();
} else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
async = useNextTick();
} else if (BrowserMutationObserver) {
async = useMutationObserver();
} else if (checkNativePromise()) {
async = useNativePromise();
} else {
async = useSetTimeout();
}
__exports__.async = async;
});
define("rsvp/cancellation_error",
["exports"],
function(__exports__) {
"use strict";
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error
function CancellationError(message) {
this.name = "cancel";
if ((message !== undefined) && (typeof message !== "string")) {
throw new TypeError('You must pass a string.');
}
this.message = message || "Default Message";
}
CancellationError.prototype = new Error();
CancellationError.prototype.constructor = CancellationError;
__exports__.CancellationError = CancellationError;
});
define("rsvp/config",
["rsvp/async","exports"],
function(__dependency1__, __exports__) {
"use strict";
var async = __dependency1__.async;
var config = {};
config.async = async;
__exports__.config = config;
});
define("rsvp/defer",
["rsvp/promise","exports"],
function(__dependency1__, __exports__) {
"use strict";
var Promise = __dependency1__.Promise;
function defer() {
var deferred = {
// pre-allocate shape
resolve: undefined,
reject: undefined,
promise: undefined
};
deferred.promise = new Promise(function(resolve, reject) {
deferred.resolve = resolve;
deferred.reject = reject;
});
return deferred;
}
__exports__.defer = defer;
});
define("rsvp/events",
["exports"],
function(__exports__) {
"use strict";
var Event = function(type, options) {
this.type = type;
for (var option in options) {
if (!options.hasOwnProperty(option)) { continue; }
this[option] = options[option];
}
};
var indexOf = function(callbacks, callback) {
for (var i=0, l=callbacks.length; i<l; i++) {
if (callbacks[i][0] === callback) { return i; }
}
return -1;
};
var callbacksFor = function(object) {
var callbacks = object._promiseCallbacks;
if (!callbacks) {
callbacks = object._promiseCallbacks = {};
}
return callbacks;
};
var EventTarget = {
mixin: function(object) {
object.on = this.on;
object.off = this.off;
object.trigger = this.trigger;
return object;
},
on: function(eventNames, callback, binding) {
var allCallbacks = callbacksFor(this), callbacks, eventName;
eventNames = eventNames.split(/\s+/);
binding = binding || this;
while (eventName = eventNames.shift()) {
callbacks = allCallbacks[eventName];
if (!callbacks) {
callbacks = allCallbacks[eventName] = [];
}
if (indexOf(callbacks, callback) === -1) {
callbacks.push([callback, binding]);
}
}
},
off: function(eventNames, callback) {
var allCallbacks = callbacksFor(this), callbacks, eventName, index;
eventNames = eventNames.split(/\s+/);
while (eventName = eventNames.shift()) {
if (!callback) {
allCallbacks[eventName] = [];
continue;
}
callbacks = allCallbacks[eventName];
index = indexOf(callbacks, callback);
if (index !== -1) { callbacks.splice(index, 1); }
}
},
trigger: function(eventName, options) {
var allCallbacks = callbacksFor(this),
callbacks, callbackTuple, callback, binding, event;
if (callbacks = allCallbacks[eventName]) {
// Don't cache the callbacks.length since it may grow
for (var i=0; i<callbacks.length; i++) {
callbackTuple = callbacks[i];
callback = callbackTuple[0];
binding = callbackTuple[1];
if (typeof options !== 'object') {
options = { detail: options };
}
event = new Event(eventName, options);
callback.call(binding, event);
}
}
}
};
__exports__.EventTarget = EventTarget;
});
define("rsvp/hash",
["rsvp/defer","exports"],
function(__dependency1__, __exports__) {
"use strict";
var defer = __dependency1__.defer;
function size(object) {
var s = 0;
for (var prop in object) {
s++;
}
return s;
}
function hash(promises) {
var results = {}, deferred = defer(), remaining = size(promises);
if (remaining === 0) {
deferred.resolve({});
}
var resolver = function(prop) {
return function(value) {
resolveAll(prop, value);
};
};
var resolveAll = function(prop, value) {
results[prop] = value;
if (--remaining === 0) {
deferred.resolve(results);
}
};
var rejectAll = function(error) {
deferred.reject(error);
};
for (var prop in promises) {
if (promises[prop] && typeof promises[prop].then === 'function') {
promises[prop].then(resolver(prop), rejectAll);
} else {
resolveAll(prop, promises[prop]);
}
}
return deferred.promise;
}
__exports__.hash = hash;
});
define("rsvp/node",
["rsvp/promise","rsvp/all","exports"],
function(__dependency1__, __dependency2__, __exports__) {
"use strict";
var Promise = __dependency1__.Promise;
var all = __dependency2__.all;
function makeNodeCallbackFor(resolve, reject) {
return function (error, value) {
if (error) {
reject(error);
} else if (arguments.length > 2) {
resolve(Array.prototype.slice.call(arguments, 1));
} else {
resolve(value);
}
};
}
function denodeify(nodeFunc) {
return function() {
var nodeArgs = Array.prototype.slice.call(arguments), resolve, reject;
var thisArg = this;
var promise = new Promise(function(nodeResolve, nodeReject) {
resolve = nodeResolve;
reject = nodeReject;
});
all(nodeArgs).then(function(nodeArgs) {
nodeArgs.push(makeNodeCallbackFor(resolve, reject));
try {
nodeFunc.apply(thisArg, nodeArgs);
} catch(e) {
reject(e);
}
});
return promise;
};
}
__exports__.denodeify = denodeify;
});
define("rsvp/promise",
["rsvp/config","rsvp/events","rsvp/cancellation_error","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
"use strict";
var config = __dependency1__.config;
var EventTarget = __dependency2__.EventTarget;
var CancellationError = __dependency3__.CancellationError;
function objectOrFunction(x) {
return isFunction(x) || (typeof x === "object" && x !== null);
}
function isFunction(x){
return typeof x === "function";
}
var Promise = function(resolver, canceller) {
var promise = this,
resolved = false;
if (typeof resolver !== 'function') {
throw new TypeError('You must pass a resolver function as the sole argument to the promise constructor');
}
if ((canceller !== undefined) && (typeof canceller !== 'function')) {
throw new TypeError('You can only pass a canceller function' +
' as the second argument to the promise constructor');
}
if (!(promise instanceof Promise)) {
return new Promise(resolver, canceller);
}
var resolvePromise = function(value) {
if (resolved) { return; }
resolved = true;
resolve(promise, value);
};
var rejectPromise = function(value) {
if (resolved) { return; }
resolved = true;
reject(promise, value);
};
var notifyPromise = function(value) {
if (resolved) { return; }
notify(promise, value);
};
this.on('promise:failed', function(event) {
this.trigger('error', { detail: event.detail });
}, this);
this.on('error', onerror);
this.cancel = function () {
// For now, simply reject the promise and does not propagate the cancel
// to parent or children
if (resolved) { return; }
if (canceller !== undefined) {
try {
canceller();
} catch (e) {
rejectPromise(e);
return;
}
}
// Trigger cancel?
rejectPromise(new CancellationError());
};
try {
resolver(resolvePromise, rejectPromise, notifyPromise);
} catch(e) {
rejectPromise(e);
}
};
function onerror(event) {
if (config.onerror) {
config.onerror(event.detail);
}
}
var invokeCallback = function(type, promise, callback, event) {
var hasCallback = isFunction(callback),
value, error, succeeded, failed;
if (promise.isFulfilled) { return; }
if (promise.isRejected) { return; }
if (hasCallback) {
try {
value = callback(event.detail);
succeeded = true;
} catch(e) {
failed = true;
error = e;
}
} else {
value = event.detail;
succeeded = true;
}
if (handleThenable(promise, value)) {
return;
} else if (hasCallback && succeeded) {
resolve(promise, value);
} else if (failed) {
reject(promise, error);
} else if (type === 'resolve') {
resolve(promise, value);
} else if (type === 'reject') {
reject(promise, value);
}
};
var invokeNotifyCallback = function(promise, callback, event) {
var value;
if (typeof callback === 'function') {
try {
value = callback(event.detail);
} catch (e) {
// stop propagating
return;
}
notify(promise, value);
} else {
notify(promise, event.detail);
}
};
Promise.prototype = {
constructor: Promise,
isRejected: undefined,
isFulfilled: undefined,
rejectedReason: undefined,
fulfillmentValue: undefined,
then: function(done, fail, progress) {
this.off('error', onerror);
var thenPromise = new this.constructor(function() {},
function () {
thenPromise.trigger('promise:cancelled', {});
});
if (this.isFulfilled) {
config.async(function(promise) {
invokeCallback('resolve', thenPromise, done, { detail: promise.fulfillmentValue });
}, this);
}
if (this.isRejected) {
config.async(function(promise) {
invokeCallback('reject', thenPromise, fail, { detail: promise.rejectedReason });
}, this);
}
this.on('promise:resolved', function(event) {
invokeCallback('resolve', thenPromise, done, event);
});
this.on('promise:failed', function(event) {
invokeCallback('reject', thenPromise, fail, event);
});
this.on('promise:notified', function (event) {
invokeNotifyCallback(thenPromise, progress, event);
});
return thenPromise;
},
fail: function(fail) {
return this.then(null, fail);
},
always: function(fail) {
return this.then(fail, fail);
}
};
EventTarget.mixin(Promise.prototype);
function resolve(promise, value) {
if (promise === value) {
fulfill(promise, value);
} else if (!handleThenable(promise, value)) {
fulfill(promise, value);
}
}
function handleThenable(promise, value) {
var then = null,
resolved;
try {
if (promise === value) {
throw new TypeError("A promises callback cannot return that same promise.");
}
if (objectOrFunction(value)) {
then = value.then;
if (isFunction(then)) {
if (isFunction(value.on)) {
value.on('promise:notified', function (event) {
notify(promise, event.detail);
});
}
promise.on('promise:cancelled', function(event) {
if (isFunction(value.cancel)) {
value.cancel();
}
});
then.call(value, function(val) {
if (resolved) { return true; }
resolved = true;
if (value !== val) {
resolve(promise, val);
} else {
fulfill(promise, val);
}
}, function(val) {
if (resolved) { return true; }
resolved = true;
reject(promise, val);
});
return true;
}
}
} catch (error) {
reject(promise, error);
return true;
}
return false;
}
function fulfill(promise, value) {
config.async(function() {
if (promise.isFulfilled) { return; }
if (promise.isRejected) { return; }
promise.trigger('promise:resolved', { detail: value });
promise.isFulfilled = true;
promise.fulfillmentValue = value;
});
}
function reject(promise, value) {
config.async(function() {
if (promise.isFulfilled) { return; }
if (promise.isRejected) { return; }
promise.trigger('promise:failed', { detail: value });
promise.isRejected = true;
promise.rejectedReason = value;
});
}
function notify(promise, value) {
config.async(function() {
promise.trigger('promise:notified', { detail: value });
});
}
__exports__.Promise = Promise;
});
define("rsvp/queue",
["rsvp/promise","rsvp/resolve","exports"],
function(__dependency1__, __dependency2__, __exports__) {
"use strict";
var Promise = __dependency1__.Promise;
var resolve = __dependency2__.resolve;
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error
function ResolvedQueueError(message) {
this.name = "resolved";
if ((message !== undefined) && (typeof message !== "string")) {
throw new TypeError('You must pass a string.');
}
this.message = message || "Default Message";
}
ResolvedQueueError.prototype = new Error();
ResolvedQueueError.prototype.constructor = ResolvedQueueError;
var Queue = function() {
var queue = this,
promise_list = [],
promise,
fulfill,
reject,
notify,
resolved;
if (!(this instanceof Queue)) {
return new Queue();
}
function canceller() {
for (var i = 0; i < 2; i++) {
promise_list[i].cancel();
}
}
promise = new Promise(function(done, fail, progress) {
fulfill = function (fulfillmentValue) {
if (resolved) {return;}
queue.isFulfilled = true;
queue.fulfillmentValue = fulfillmentValue;
resolved = true;
return done(fulfillmentValue);
};
reject = function (rejectedReason) {
if (resolved) {return;}
queue.isRejected = true;
queue.rejectedReason = rejectedReason ;
resolved = true;
return fail(rejectedReason);
};
notify = progress;
}, canceller);
promise_list.push(resolve());
promise_list.push(promise_list[0].then(function () {
promise_list.splice(0, 2);
if (promise_list.length === 0) {
fulfill();
}
}));
queue.cancel = function () {
if (resolved) {return;}
resolved = true;
promise.cancel();
promise.fail(function (rejectedReason) {
queue.isRejected = true;
queue.rejectedReason = rejectedReason;
});
};
queue.then = function () {
return promise.then.apply(promise, arguments);
};
queue.push = function(done, fail, progress) {
var last_promise = promise_list[promise_list.length - 1],
next_promise;
if (resolved) {
throw new ResolvedQueueError();
}
next_promise = last_promise.then(done, fail, progress);
promise_list.push(next_promise);
// Handle pop
last_promise = next_promise.then(function (fulfillmentValue) {
promise_list.splice(0, 2);
if (promise_list.length === 0) {
fulfill(fulfillmentValue);
} else {
return fulfillmentValue;
}
}, function (rejectedReason) {
promise_list.splice(0, 2);
if (promise_list.length === 0) {
reject(rejectedReason);
} else {
throw rejectedReason;
}
}, function (notificationValue) {
if (promise_list[promise_list.length - 1] === last_promise) {
notify(notificationValue);
}
return notificationValue;
});
promise_list.push(last_promise);
return this;
};
};
Queue.prototype = Object.create(Promise.prototype);
Queue.prototype.constructor = Queue;
__exports__.Queue = Queue;
__exports__.ResolvedQueueError = ResolvedQueueError;
});
define("rsvp/reject",
["rsvp/promise","exports"],
function(__dependency1__, __exports__) {
"use strict";
var Promise = __dependency1__.Promise;
function reject(reason) {
return new Promise(function (resolve, reject) {
reject(reason);
});
}
__exports__.reject = reject;
});
define("rsvp/resolve",
["rsvp/promise","exports"],
function(__dependency1__, __exports__) {
"use strict";
var Promise = __dependency1__.Promise;
function resolve(thenable) {
return new Promise(function(resolve, reject) {
if (typeof thenable === "object" && thenable !== null) {
var then = thenable.then;
if ((then !== undefined) && (typeof then === "function")) {
return then.apply(thenable, [resolve, reject]);
}
}
return resolve(thenable);
}, function () {
if ((thenable !== undefined) && (thenable.cancel !== undefined)) {
thenable.cancel();
}
});
}
__exports__.resolve = resolve;
});
define("rsvp/rethrow",
["exports"],
function(__exports__) {
"use strict";
var local = (typeof global === "undefined") ? this : global;
function rethrow(reason) {
local.setTimeout(function() {
throw reason;
});
throw reason;
}
__exports__.rethrow = rethrow;
});
define("rsvp/timeout",
["rsvp/promise","exports"],
function(__dependency1__, __exports__) {
"use strict";
var Promise = __dependency1__.Promise;
function promiseSetTimeout(millisecond, should_reject, message) {
var timeout_id;
function resolver(resolve, reject) {
timeout_id = setTimeout(function () {
if (should_reject) {
reject(message);
} else {
resolve(message);
}
}, millisecond);
}
function canceller() {
clearTimeout(timeout_id);
}
return new Promise(resolver, canceller);
}
function delay(millisecond, message) {
return promiseSetTimeout(millisecond, false, message);
}
function timeout(millisecond) {
return promiseSetTimeout(millisecond, true,
"Timed out after " + millisecond + " ms");
}
Promise.prototype.delay = function(millisecond) {
return this.then(function (fulfillmentValue) {
return delay(millisecond, fulfillmentValue);
});
};
__exports__.delay = delay;
__exports__.timeout = timeout;
});
define("rsvp",
["rsvp/events","rsvp/cancellation_error","rsvp/promise","rsvp/node","rsvp/all","rsvp/queue","rsvp/timeout","rsvp/hash","rsvp/rethrow","rsvp/defer","rsvp/config","rsvp/resolve","rsvp/reject","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __dependency13__, __exports__) {
"use strict";
var EventTarget = __dependency1__.EventTarget;
var CancellationError = __dependency2__.CancellationError;
var Promise = __dependency3__.Promise;
var denodeify = __dependency4__.denodeify;
var all = __dependency5__.all;
var any = __dependency5__.any;
var Queue = __dependency6__.Queue;
var ResolvedQueueError = __dependency6__.ResolvedQueueError;
var delay = __dependency7__.delay;
var timeout = __dependency7__.timeout;
var hash = __dependency8__.hash;
var rethrow = __dependency9__.rethrow;
var defer = __dependency10__.defer;
var config = __dependency11__.config;
var resolve = __dependency12__.resolve;
var reject = __dependency13__.reject;
function configure(name, value) {
config[name] = value;
}
__exports__.CancellationError = CancellationError;
__exports__.Promise = Promise;
__exports__.EventTarget = EventTarget;
__exports__.all = all;
__exports__.any = any;
__exports__.Queue = Queue;
__exports__.ResolvedQueueError = ResolvedQueueError;
__exports__.delay = delay;
__exports__.timeout = timeout;
__exports__.hash = hash;
__exports__.rethrow = rethrow;
__exports__.defer = defer;
__exports__.denodeify = denodeify;
__exports__.configure = configure;
__exports__.resolve = resolve;
__exports__.reject = reject;
});
window.RSVP = requireModule("rsvp");
})(window);
\ No newline at end of file
!function(a){var b,c;!function(){var a={},d={};b=function(b,c,d){a[b]={deps:c,callback:d}},c=function(b){if(d[b])return d[b];d[b]={};var e=a[b];if(!e)throw new Error("Module '"+b+"' not found.");for(var f,g=e.deps,h=e.callback,i=[],j=0,k=g.length;k>j;j++)"exports"===g[j]?i.push(f={}):i.push(c(g[j]));var l=h.apply(this,i);return d[b]=f||l}}(),b("rsvp/all",["rsvp/promise","exports"],function(a,b){"use strict";function c(a,b){function c(){for(var a,c=0;c<b.length;c++)a=b[c],a&&"function"==typeof a.then&&"function"==typeof a.cancel&&a.cancel()}if("[object Array]"!==Object.prototype.toString.call(b))throw new TypeError("You must pass an array to all.");return new f(function(d,e,f){function g(a){return function(b){h(a,b)}}function h(a,b){l[a]=b,--m===n&&(0===n?d(l):(d(b),c()))}function i(a){return function(b){f({index:a,value:b})}}function j(a){e(a),c()}var k,l=[],m=b.length,n=b.length-a;0===m&&(1===a?d():d([]));for(var o=0;o<b.length;o++)k=b[o],k&&"function"==typeof k.then?k.then(g(o),j,i(o)):h(o,k)},c)}function d(a){return c(a.length,a)}function e(a){return c(1,a)}var f=a.Promise;b.all=d,b.any=e}),b("rsvp/async",["exports"],function(a){"use strict";function b(){if("function"==typeof Promise&&"function"==typeof Promise.resolve)try{var a=new Promise(function(){});if("[object Promise]"==={}.toString.call(a))return!0}catch(b){}return!1}function c(){var a=Promise.resolve();return function(b,c){a.then(function(){b(c)})}}function d(){return function(a,b){process.nextTick(function(){a(b)})}}function e(){return function(a,b){setImmediate(function(){a(b)})}}function f(){var a=[],b=new j(function(){var b=a.slice();a=[],b.forEach(function(a){var b=a[0],c=a[1];b(c)})}),c=document.createElement("div");return b.observe(c,{attributes:!0}),window.addEventListener("unload",function(){b.disconnect(),b=null},!1),function(b,d){a.push([b,d]),c.setAttribute("drainQueue","drainQueue")}}function g(){return function(a,b){k.setTimeout(function(){a(b)},1)}}var h,i="undefined"!=typeof window?window:{},j=i.MutationObserver||i.WebKitMutationObserver,k="undefined"!=typeof global?global:this;h="function"==typeof setImmediate?e():"undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?d():j?f():b()?c():g(),a.async=h}),b("rsvp/cancellation_error",["exports"],function(a){"use strict";function b(a){if(this.name="cancel",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}b.prototype=new Error,b.prototype.constructor=b,a.CancellationError=b}),b("rsvp/config",["rsvp/async","exports"],function(a,b){"use strict";var c=a.async,d={};d.async=c,b.config=d}),b("rsvp/defer",["rsvp/promise","exports"],function(a,b){"use strict";function c(){var a={resolve:void 0,reject:void 0,promise:void 0};return a.promise=new d(function(b,c){a.resolve=b,a.reject=c}),a}var d=a.Promise;b.defer=c}),b("rsvp/events",["exports"],function(a){"use strict";var b=function(a,b){this.type=a;for(var c in b)b.hasOwnProperty(c)&&(this[c]=b[c])},c=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c][0]===b)return c;return-1},d=function(a){var b=a._promiseCallbacks;return b||(b=a._promiseCallbacks={}),b},e={mixin:function(a){return a.on=this.on,a.off=this.off,a.trigger=this.trigger,a},on:function(a,b,e){var f,g,h=d(this);for(a=a.split(/\s+/),e=e||this;g=a.shift();)f=h[g],f||(f=h[g]=[]),-1===c(f,b)&&f.push([b,e])},off:function(a,b){var e,f,g,h=d(this);for(a=a.split(/\s+/);f=a.shift();)b?(e=h[f],g=c(e,b),-1!==g&&e.splice(g,1)):h[f]=[]},trigger:function(a,c){var e,f,g,h,i,j=d(this);if(e=j[a])for(var k=0;k<e.length;k++)f=e[k],g=f[0],h=f[1],"object"!=typeof c&&(c={detail:c}),i=new b(a,c),g.call(h,i)}};a.EventTarget=e}),b("rsvp/hash",["rsvp/defer","exports"],function(a,b){"use strict";function c(a){var b=0;for(var c in a)b++;return b}function d(a){var b={},d=e(),f=c(a);0===f&&d.resolve({});var g=function(a){return function(b){h(a,b)}},h=function(a,c){b[a]=c,0===--f&&d.resolve(b)},i=function(a){d.reject(a)};for(var j in a)a[j]&&"function"==typeof a[j].then?a[j].then(g(j),i):h(j,a[j]);return d.promise}var e=a.defer;b.hash=d}),b("rsvp/node",["rsvp/promise","rsvp/all","exports"],function(a,b,c){"use strict";function d(a,b){return function(c,d){c?b(c):a(arguments.length>2?Array.prototype.slice.call(arguments,1):d)}}function e(a){return function(){var b,c,e=Array.prototype.slice.call(arguments),h=this,i=new f(function(a,d){b=a,c=d});return g(e).then(function(e){e.push(d(b,c));try{a.apply(h,e)}catch(f){c(f)}}),i}}var f=a.Promise,g=b.all;c.denodeify=e}),b("rsvp/promise",["rsvp/config","rsvp/events","rsvp/cancellation_error","exports"],function(a,b,c,d){"use strict";function e(a){return f(a)||"object"==typeof a&&null!==a}function f(a){return"function"==typeof a}function g(a){m.onerror&&m.onerror(a.detail)}function h(a,b){a===b?j(a,b):i(a,b)||j(a,b)}function i(a,b){var c,d=null;try{if(a===b)throw new TypeError("A promises callback cannot return that same promise.");if(e(b)&&(d=b.then,f(d)))return f(b.on)&&b.on("promise:notified",function(b){l(a,b.detail)}),a.on("promise:cancelled",function(a){f(b.cancel)&&b.cancel()}),d.call(b,function(d){return c?!0:(c=!0,void(b!==d?h(a,d):j(a,d)))},function(b){return c?!0:(c=!0,void k(a,b))}),!0}catch(g){return k(a,g),!0}return!1}function j(a,b){m.async(function(){a.isFulfilled||a.isRejected||(a.trigger("promise:resolved",{detail:b}),a.isFulfilled=!0,a.fulfillmentValue=b)})}function k(a,b){m.async(function(){a.isFulfilled||a.isRejected||(a.trigger("promise:failed",{detail:b}),a.isRejected=!0,a.rejectedReason=b)})}function l(a,b){m.async(function(){a.trigger("promise:notified",{detail:b})})}var m=a.config,n=b.EventTarget,o=c.CancellationError,p=function(a,b){var c=this,d=!1;if("function"!=typeof a)throw new TypeError("You must pass a resolver function as the sole argument to the promise constructor");if(void 0!==b&&"function"!=typeof b)throw new TypeError("You can only pass a canceller function as the second argument to the promise constructor");if(!(c instanceof p))return new p(a,b);var e=function(a){d||(d=!0,h(c,a))},f=function(a){d||(d=!0,k(c,a))},i=function(a){d||l(c,a)};this.on("promise:failed",function(a){this.trigger("error",{detail:a.detail})},this),this.on("error",g),this.cancel=function(){if(!d){if(void 0!==b)try{b()}catch(a){return void f(a)}f(new o)}};try{a(e,f,i)}catch(j){f(j)}},q=function(a,b,c,d){var e,g,j,l,m=f(c);if(!b.isFulfilled&&!b.isRejected){if(m)try{e=c(d.detail),j=!0}catch(n){l=!0,g=n}else e=d.detail,j=!0;i(b,e)||(m&&j?h(b,e):l?k(b,g):"resolve"===a?h(b,e):"reject"===a&&k(b,e))}},r=function(a,b,c){var d;if("function"==typeof b){try{d=b(c.detail)}catch(e){return}l(a,d)}else l(a,c.detail)};p.prototype={constructor:p,isRejected:void 0,isFulfilled:void 0,rejectedReason:void 0,fulfillmentValue:void 0,then:function(a,b,c){this.off("error",g);var d=new this.constructor(function(){},function(){d.trigger("promise:cancelled",{})});return this.isFulfilled&&m.async(function(b){q("resolve",d,a,{detail:b.fulfillmentValue})},this),this.isRejected&&m.async(function(a){q("reject",d,b,{detail:a.rejectedReason})},this),this.on("promise:resolved",function(b){q("resolve",d,a,b)}),this.on("promise:failed",function(a){q("reject",d,b,a)}),this.on("promise:notified",function(a){r(d,c,a)}),d},fail:function(a){return this.then(null,a)},always:function(a){return this.then(a,a)}},n.mixin(p.prototype),d.Promise=p}),b("rsvp/queue",["rsvp/promise","rsvp/resolve","exports"],function(a,b,c){"use strict";function d(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}var e=a.Promise,f=b.resolve;d.prototype=new Error,d.prototype.constructor=d;var g=function(){function a(){for(var a=0;2>a;a++)l[a].cancel()}var b,c,h,i,j,k=this,l=[];return this instanceof g?(b=new e(function(a,b,d){c=function(b){return j?void 0:(k.isFulfilled=!0,k.fulfillmentValue=b,j=!0,a(b))},h=function(a){return j?void 0:(k.isRejected=!0,k.rejectedReason=a,j=!0,b(a))},i=d},a),l.push(f()),l.push(l[0].then(function(){l.splice(0,2),0===l.length&&c()})),k.cancel=function(){j||(j=!0,b.cancel(),b.fail(function(a){k.isRejected=!0,k.rejectedReason=a}))},k.then=function(){return b.then.apply(b,arguments)},void(k.push=function(a,b,e){var f,g=l[l.length-1];if(j)throw new d;return f=g.then(a,b,e),l.push(f),g=f.then(function(a){return l.splice(0,2),0!==l.length?a:void c(a)},function(a){if(l.splice(0,2),0!==l.length)throw a;h(a)},function(a){return l[l.length-1]===g&&i(a),a}),l.push(g),this})):new g};g.prototype=Object.create(e.prototype),g.prototype.constructor=g,c.Queue=g,c.ResolvedQueueError=d}),b("rsvp/reject",["rsvp/promise","exports"],function(a,b){"use strict";function c(a){return new d(function(b,c){c(a)})}var d=a.Promise;b.reject=c}),b("rsvp/resolve",["rsvp/promise","exports"],function(a,b){"use strict";function c(a){return new d(function(b,c){if("object"==typeof a&&null!==a){var d=a.then;if(void 0!==d&&"function"==typeof d)return d.apply(a,[b,c])}return b(a)},function(){void 0!==a&&void 0!==a.cancel&&a.cancel()})}var d=a.Promise;b.resolve=c}),b("rsvp/rethrow",["exports"],function(a){"use strict";function b(a){throw c.setTimeout(function(){throw a}),a}var c="undefined"==typeof global?this:global;a.rethrow=b}),b("rsvp/timeout",["rsvp/promise","exports"],function(a,b){"use strict";function c(a,b,c){function d(d,e){g=setTimeout(function(){b?e(c):d(c)},a)}function e(){clearTimeout(g)}var g;return new f(d,e)}function d(a,b){return c(a,!1,b)}function e(a){return c(a,!0,"Timed out after "+a+" ms")}var f=a.Promise;f.prototype.delay=function(a){return this.then(function(b){return d(a,b)})},b.delay=d,b.timeout=e}),b("rsvp",["rsvp/events","rsvp/cancellation_error","rsvp/promise","rsvp/node","rsvp/all","rsvp/queue","rsvp/timeout","rsvp/hash","rsvp/rethrow","rsvp/defer","rsvp/config","rsvp/resolve","rsvp/reject","exports"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){"use strict";function o(a,b){C[a]=b}var p=a.EventTarget,q=b.CancellationError,r=c.Promise,s=d.denodeify,t=e.all,u=e.any,v=f.Queue,w=f.ResolvedQueueError,x=g.delay,y=g.timeout,z=h.hash,A=i.rethrow,B=j.defer,C=k.config,D=l.resolve,E=m.reject;n.CancellationError=q,n.Promise=r,n.EventTarget=p,n.all=t,n.any=u,n.Queue=v,n.ResolvedQueueError=w,n.delay=x,n.timeout=y,n.hash=z,n.rethrow=A,n.defer=B,n.denodeify=s,n.configure=o,n.resolve=D,n.reject=E}),window.RSVP=c("rsvp")}(window);
\ No newline at end of file
!function(a){var b,c;!function(){var a={},d={};b=function(b,c,d){a[b]={deps:c,callback:d}},c=function(b){if(d[b])return d[b];d[b]={};var e=a[b];if(!e)throw new Error("Module '"+b+"' not found.");for(var f,g=e.deps,h=e.callback,i=[],j=0,k=g.length;k>j;j++)"exports"===g[j]?i.push(f={}):i.push(c(g[j]));var l=h.apply(this,i);return d[b]=f||l}}(),b("rsvp/all",["rsvp/promise","exports"],function(a,b){"use strict";function c(a,b){function c(){for(var a,c=0;c<b.length;c++)a=b[c],a&&"function"==typeof a.then&&"function"==typeof a.cancel&&a.cancel()}if("[object Array]"!==Object.prototype.toString.call(b))throw new TypeError("You must pass an array to all.");return new f(function(d,e,f){function g(a){return function(b){h(a,b)}}function h(a,b){l[a]=b,--m===n&&(0===n?d(l):(d(b),c()))}function i(a){return function(b){f({index:a,value:b})}}function j(a){e(a),c()}var k,l=[],m=b.length,n=b.length-a;0===m&&(1===a?d():d([]));for(var o=0;o<b.length;o++)k=b[o],k&&"function"==typeof k.then?k.then(g(o),j,i(o)):h(o,k)},c)}function d(a){return c(a.length,a)}function e(a){return c(1,a)}var f=a.Promise;b.all=d,b.any=e}),b("rsvp/async",["exports"],function(a){"use strict";function b(){if("function"==typeof Promise&&"function"==typeof Promise.resolve)try{var a=new Promise(function(){});if("[object Promise]"==={}.toString.call(a))return!0}catch(b){}return!1}function c(){var a=Promise.resolve();return function(b,c){a.then(function(){b(c)})}}function d(){return function(a,b){process.nextTick(function(){a(b)})}}function e(){return function(a,b){setImmediate(function(){a(b)})}}function f(){var a=[],b=new j(function(){var b=a.slice();a=[],b.forEach(function(a){var b=a[0],c=a[1];b(c)})}),c=document.createElement("div");return b.observe(c,{attributes:!0}),window.addEventListener("unload",function(){b.disconnect(),b=null},!1),function(b,d){a.push([b,d]),c.setAttribute("drainQueue","drainQueue")}}function g(){return function(a,b){k.setTimeout(function(){a(b)},1)}}var h,i="undefined"!=typeof window?window:{},j=i.MutationObserver||i.WebKitMutationObserver,k="undefined"!=typeof global?global:this;h="function"==typeof setImmediate?e():"undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?d():j?f():b()?c():g(),a.async=h}),b("rsvp/cancellation_error",["exports"],function(a){"use strict";function b(a){if(this.name="cancel",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}b.prototype=new Error,b.prototype.constructor=b,a.CancellationError=b}),b("rsvp/config",["rsvp/async","exports"],function(a,b){"use strict";var c=a.async,d={};d.async=c,b.config=d}),b("rsvp/defer",["rsvp/promise","exports"],function(a,b){"use strict";function c(){var a={resolve:void 0,reject:void 0,promise:void 0};return a.promise=new d(function(b,c){a.resolve=b,a.reject=c}),a}var d=a.Promise;b.defer=c}),b("rsvp/events",["exports"],function(a){"use strict";var b=function(a,b){this.type=a;for(var c in b)b.hasOwnProperty(c)&&(this[c]=b[c])},c=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c][0]===b)return c;return-1},d=function(a){var b=a._promiseCallbacks;return b||(b=a._promiseCallbacks={}),b},e={mixin:function(a){return a.on=this.on,a.off=this.off,a.trigger=this.trigger,a},on:function(a,b,e){var f,g,h=d(this);for(a=a.split(/\s+/),e=e||this;g=a.shift();)f=h[g],f||(f=h[g]=[]),-1===c(f,b)&&f.push([b,e])},off:function(a,b){var e,f,g,h=d(this);for(a=a.split(/\s+/);f=a.shift();)b?(e=h[f],g=c(e,b),-1!==g&&e.splice(g,1)):h[f]=[]},trigger:function(a,c){var e,f,g,h,i,j=d(this);if(e=j[a])for(var k=0;k<e.length;k++)f=e[k],g=f[0],h=f[1],"object"!=typeof c&&(c={detail:c}),i=new b(a,c),g.call(h,i)}};a.EventTarget=e}),b("rsvp/hash",["rsvp/defer","exports"],function(a,b){"use strict";function c(a){var b=0;for(var c in a)b++;return b}function d(a){var b={},d=e(),f=c(a);0===f&&d.resolve({});var g=function(a){return function(b){h(a,b)}},h=function(a,c){b[a]=c,0===--f&&d.resolve(b)},i=function(a){d.reject(a)};for(var j in a)a[j]&&"function"==typeof a[j].then?a[j].then(g(j),i):h(j,a[j]);return d.promise}var e=a.defer;b.hash=d}),b("rsvp/node",["rsvp/promise","rsvp/all","exports"],function(a,b,c){"use strict";function d(a,b){return function(c,d){c?b(c):a(arguments.length>2?Array.prototype.slice.call(arguments,1):d)}}function e(a){return function(){var b,c,e=Array.prototype.slice.call(arguments),h=this,i=new f(function(a,d){b=a,c=d});return g(e).then(function(e){e.push(d(b,c));try{a.apply(h,e)}catch(f){c(f)}}),i}}var f=a.Promise,g=b.all;c.denodeify=e}),b("rsvp/promise",["rsvp/config","rsvp/events","rsvp/cancellation_error","exports"],function(a,b,c,d){"use strict";function e(a){return f(a)||"object"==typeof a&&null!==a}function f(a){return"function"==typeof a}function g(a){m.onerror&&m.onerror(a.detail)}function h(a,b){a===b?j(a,b):i(a,b)||j(a,b)}function i(a,b){var c,d=null;try{if(a===b)throw new TypeError("A promises callback cannot return that same promise.");if(e(b)&&(d=b.then,f(d)))return f(b.on)&&b.on("promise:notified",function(b){l(a,b.detail)}),a.on("promise:cancelled",function(a){f(b.cancel)&&b.cancel()}),d.call(b,function(d){return c?!0:(c=!0,void(b!==d?h(a,d):j(a,d)))},function(b){return c?!0:(c=!0,void k(a,b))}),!0}catch(g){return k(a,g),!0}return!1}function j(a,b){m.async(function(){a.isFulfilled||a.isRejected||(a.trigger("promise:resolved",{detail:b}),a.isFulfilled=!0,a.fulfillmentValue=b)})}function k(a,b){m.async(function(){a.isFulfilled||a.isRejected||(a.trigger("promise:failed",{detail:b}),a.isRejected=!0,a.rejectedReason=b)})}function l(a,b){m.async(function(){a.trigger("promise:notified",{detail:b})})}var m=a.config,n=b.EventTarget,o=c.CancellationError,p=function(a,b){var c=this,d=!1;if("function"!=typeof a)throw new TypeError("You must pass a resolver function as the sole argument to the promise constructor");if(void 0!==b&&"function"!=typeof b)throw new TypeError("You can only pass a canceller function as the second argument to the promise constructor");if(!(c instanceof p))return new p(a,b);var e=function(a){d||(d=!0,h(c,a))},f=function(a){d||(d=!0,k(c,a))},i=function(a){d||l(c,a)};this.on("promise:failed",function(a){this.trigger("error",{detail:a.detail})},this),this.on("error",g),this.cancel=function(){if(!d){if(void 0!==b)try{b()}catch(a){return void f(a)}f(new o)}};try{a(e,f,i)}catch(j){f(j)}},q=function(a,b,c,d){var e,g,j,l,m=f(c);if(!b.isFulfilled&&!b.isRejected){if(m)try{e=c(d.detail),j=!0}catch(n){l=!0,g=n}else e=d.detail,j=!0;i(b,e)||(m&&j?h(b,e):l?k(b,g):"resolve"===a?h(b,e):"reject"===a&&k(b,e))}},r=function(a,b,c){var d;if("function"==typeof b){try{d=b(c.detail)}catch(e){return}l(a,d)}else l(a,c.detail)};p.prototype={constructor:p,isRejected:void 0,isFulfilled:void 0,rejectedReason:void 0,fulfillmentValue:void 0,then:function(a,b,c){this.off("error",g);var d=new this.constructor(function(){},function(){d.trigger("promise:cancelled",{})});return this.isFulfilled&&m.async(function(b){q("resolve",d,a,{detail:b.fulfillmentValue})},this),this.isRejected&&m.async(function(a){q("reject",d,b,{detail:a.rejectedReason})},this),this.on("promise:resolved",function(b){q("resolve",d,a,b)}),this.on("promise:failed",function(a){q("reject",d,b,a)}),this.on("promise:notified",function(a){r(d,c,a)}),d},fail:function(a){return this.then(null,a)},always:function(a){return this.then(a,a)}},n.mixin(p.prototype),d.Promise=p}),b("rsvp/queue",["rsvp/promise","rsvp/resolve","exports"],function(a,b,c){"use strict";function d(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}var e=a.Promise,f=b.resolve;d.prototype=new Error,d.prototype.constructor=d;var g=function(){function a(){for(var a=0;2>a;a++)l[a].cancel()}var b,c,h,i,j,k=this,l=[];return this instanceof g?(b=new e(function(a,b,d){c=function(b){return j?void 0:(k.isFulfilled=!0,k.fulfillmentValue=b,j=!0,a(b))},h=function(a){return j?void 0:(k.isRejected=!0,k.rejectedReason=a,j=!0,b(a))},i=d},a),l.push(f()),l.push(l[0].then(function(){l.splice(0,2),0===l.length&&c()})),k.cancel=function(){j||(j=!0,b.cancel(),b.fail(function(a){k.isRejected=!0,k.rejectedReason=a}))},k.then=function(){return b.then.apply(b,arguments)},void(k.push=function(a,b,e){var f,g=l[l.length-1];if(j)throw new d;return f=g.then(a,b,e),l.push(f),g=f.then(function(a){return l.splice(0,2),0!==l.length?a:void c(a)},function(a){if(l.splice(0,2),0!==l.length)throw a;h(a)},function(a){return l[l.length-1]===g&&i(a),a}),l.push(g),this})):new g};g.prototype=Object.create(e.prototype),g.prototype.constructor=g,c.Queue=g,c.ResolvedQueueError=d}),b("rsvp/reject",["rsvp/promise","exports"],function(a,b){"use strict";function c(a){return new d(function(b,c){c(a)})}var d=a.Promise;b.reject=c}),b("rsvp/resolve",["rsvp/promise","exports"],function(a,b){"use strict";function c(a){return new d(function(b,c){if("object"==typeof a&&null!==a){var d=a.then;if(void 0!==d&&"function"==typeof d)return d.apply(a,[b,c])}return b(a)},function(){void 0!==a&&void 0!==a.cancel&&a.cancel()})}var d=a.Promise;b.resolve=c}),b("rsvp/rethrow",["exports"],function(a){"use strict";function b(a){throw c.setTimeout(function(){throw a}),a}var c="undefined"==typeof global?this:global;a.rethrow=b}),b("rsvp/timeout",["rsvp/promise","exports"],function(a,b){"use strict";function c(a,b,c){function d(d,e){g=setTimeout(function(){b?e(c):d(c)},a)}function e(){clearTimeout(g)}var g;return new f(d,e)}function d(a,b){return c(a,!1,b)}function e(a){return c(a,!0,"Timed out after "+a+" ms")}var f=a.Promise;f.prototype.delay=function(a){return this.then(function(b){return d(a,b)})},b.delay=d,b.timeout=e}),b("rsvp",["rsvp/events","rsvp/cancellation_error","rsvp/promise","rsvp/node","rsvp/all","rsvp/queue","rsvp/timeout","rsvp/hash","rsvp/rethrow","rsvp/defer","rsvp/config","rsvp/resolve","rsvp/reject","exports"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){"use strict";function o(a,b){C[a]=b}var p=a.EventTarget,q=b.CancellationError,r=c.Promise,s=d.denodeify,t=e.all,u=e.any,v=f.Queue,w=f.ResolvedQueueError,x=g.delay,y=g.timeout,z=h.hash,A=i.rethrow,B=j.defer,C=k.config,D=l.resolve,E=m.reject;n.CancellationError=q,n.Promise=r,n.EventTarget=p,n.all=t,n.any=u,n.Queue=v,n.ResolvedQueueError=w,n.delay=x,n.timeout=y,n.hash=z,n.rethrow=A,n.defer=B,n.denodeify=s,n.configure=o,n.resolve=D,n.reject=E}),window.RSVP=c("rsvp")}(window);
\ No newline at end of file
(function(y){function T(a){var c,d,e,f=!1,g=function(){f=!0;switch(c.readyState){case 0:A(a.aborted)&&a.aborted(c);break;case 4:if(200===c.status)a.complete(c);else{var d=b.Exception._newError("HTTP_ERROR","_ajax",{request:a,status:this.status,statusText:this.statusText,xhr:c});a.error(d)}}};c=D();d=["POST",a.url,a.async];a.username&&a.password&&(d=d.concat([a.username,a.password]));c.open.apply(c,d);m(a.requestTimeout)||!a.async&&y&&y.document||(c.timeout=a.requestTimeout);c.onreadystatechange=g;
c.setRequestHeader("Accept","text/xml, application/xml, application/soap+xml");c.setRequestHeader("Content-Type","text/xml");if(d=a.headers)for(e in d)c.setRequestHeader(e,d[e]);c.send(a.data);a.async||f||g.call(c);return c}function m(a){return"undefined"===typeof a}function u(a){return a&&a.constructor===Array}function A(a){return"function"===typeof a}function G(a){switch(typeof a){case "string":a=a.replace(/\&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");break;case "undefined":a="";break;
case "object":null===a&&(a="")}return a}function M(a){return a.replace(/_x(\d\d\d\d)_/g,function(a,b,e){return String.fromCharCode(parseInt(b,16))})}function H(a,b,d){a=a.childNodes;if(!a)return b;for(var c,f=0,g=a.length;f<g;f++)c=a[f],d&&!0===d.call(null,c)&&b.push(c),H(c,b,d)}function p(a){var b;p=b="textContent"in a?function(a){return a.textContent}:"nodeTypedValue"in a?function(a){return a.nodeTypedValue}:"innerText"in a?function(a){return a.innerText}:"normalize"in a?function(a){a.normalize();
return a.firstChild?a.firstChild.data:null}:function(a){var b=[],c=a.childNodes,d,h=c?c.length:0;for(d=0;d<h;d++)a=c[d],null!==a.data&&b.push(a.data);return b.length?b.join(""):null};return b(a)}function I(a,b,d,e){e||(e="");var c,g,h,t,z,l="\n"+e+"<"+a+">";if(d){l+="\n"+e+" <"+b+">";for(t in d)if(d.hasOwnProperty(t)){z=d[t];l+="\n"+e+" <"+t+">";if(u(z))for(c=z.length,g=0;g<c;g++)h=z[g],l+="<Value>"+G(h)+"</Value>";else l+=G(z);l+="</"+t+">"}l+="\n"+e+" </"+b+">"}return l+("\n"+e+"</"+a+">")}function k(a,
b,d){b&&!a&&(a={});for(var c in b)b.hasOwnProperty(c)&&(d||m(a[c]))&&(a[c]=b[c]);return a}function J(a){function b(){q.push(l);var a=new function(){};a.constructor.prototype=l;l=new a.constructor;v.namespaces=l;k=!0}function d(a){return a.replace(/&((\w+)|#(x?)([0-9a-fA-F]+));/g,function(a,b,c,d,e,f,g){if(c){if(a={lt:"<",gt:">",amp:"&",apos:"'",quot:'"'}[c])return a;throw"Illegal named entity: "+c;}return String.fromCharCode(parseInt(e,d?16:10))})}var e=/<(((([\w\-\.]+):)?([\w\-\.]+))([^>]+)?|\/((([\w\-\.]+):)?([\w\-\.]+))|\?(\w+)([^\?]+)?\?|(!--([^\-]|-[^\-])*--))>|([^<>]+)/ig,
f,g,h,t,z,l={"":""},k,n,r,w,q=[],p,v=null;for(r=w={nodeType:9,childNodes:[]};f=e.exec(a);){v=null;if(g=f[5]){k=!1;p=v={offset:f.index,parentNode:w,nodeType:1,nodeName:g};if(g=f[6]){g.length&&"/"===g.substr(g.length-1,1)&&(p=v.parentNode,l===v.namespaces&&(l=q.pop()),g=g.substr(0,g.length-1));for(var x,u=/((([\w\-]+):)?([\w\-]+))\s*=\s*('([^']*)'|"([^"]*)")/g;x=u.exec(g);){n=x[3]||"";var y=x[x[6]?6:7];if(x[1].indexOf("xmlns")){v.attributes||(v.attributes=[]);x={nodeType:2,prefix:n,nodeName:x[4],value:d(y)};
n=""===n?"":l[n];if(m(n))throw'Unrecognized namespace with prefix "'+h+'"';x.namespaceURI=n;v.attributes.push(x)}else k||b(),l[x[3]?x[4]:""]=y}u.lastIndex=0}h=f[4]||"";v.prefix=h;n=l[h];if(m(n))throw'Unrecognized namespace with prefix "'+h+'"';v.namespaceURI=n}else if(g=f[10])if(f=f[9]||"",w.nodeName===g&&w.prefix===f)p=w.parentNode,l===w.namespaces&&(l=q.pop());else throw"Unclosed tag "+f+":"+g;else(t=f[11])?v={offset:f.index,parentNode:w,target:t,data:f[12],nodeType:7}:f[13]?v={offset:f.index,parentNode:w,
nodeType:8,data:f[14]}:(z=f[15])&&!/^\s+$/.test(z)&&(v={offset:f.index,parentNode:w,nodeType:3,data:d(z)});v&&(w.childNodes||(w.childNodes=[]),w.childNodes.push(v));p&&(w=p)}return r}function K(a,b){var c=n(a,"http://www.w3.org/2001/XMLSchema","xsd","complexType"),e=c.length,f,g;for(g=0;g<e;g++)if(f=c[g],r(f,"name")===b)return f;return null}function N(a){return"true"===a?!0:!1}function q(a){return parseInt(a,10)}function E(a){return parseFloat(a,10)}function F(a){return a}function O(a){return Date.parse(a)}
function P(a){return a}function L(a,b){var c=[],e=a.length,f,g;for(f=0;f<e;f++)g=a[f],c.push(b(p(g)));return c}function Q(a){var b;return(b=B[a])?b:F}function R(a){var b=p(a);if(a=C(a,"http://www.w3.org/2001/XMLSchema-instance","xsi","type"))if(a=B[a])return a(b);return b}function U(a){return"get"+(/^[A-Z]+[a-z]+[A-Za-z]*$/g.test(a)?a:a.charAt(0).toUpperCase()+a.substr(1).toLowerCase().replace(/_[a-z]/g,function(a){return a.charAt(1).toUpperCase()}))}var b,D;y.XMLHttpRequest?D=function(){return new y.XMLHttpRequest}:
y.ActiveXObject?D=function(){return new y.ActiveXObject("MSXML2.XMLHTTP.3.0")}:"function"===typeof require?D=function(){var a;(a=function(){this.readyState=0;this.status=-1;this.statusText="Not sent";this.responseText=null}).prototype={changeStatus:function(a,b){this.statusText=this.status=a;this.readyState=b;A(this.onreadystatechange)&&this.onreadystatechange.call(this,this)},open:function(a,b,e,f,g){if(!0!==e)throw"Synchronous mode not supported in this environment.";a=require("url").parse(b);a.host.length>
a.hostname.length&&(a.host=a.hostname,delete a.hostname);!a.path&&a.pathname&&(a.path=a.pathname+(a.search||""));a.method="POST";a.headers={};f&&(a.headers.Authorization="Basic "+(new Buffer(f+":"+(g||""))).toString("base64"));this.options=a;this.changeStatus(-1,1)},send:function(a){var b=this,c=b.options,f;c.headers["Content-Length"]=Buffer.byteLength(a);switch(c.protocol){case "http:":f=require("http");c.port||(c.port="80");break;case "https:":f=require("https");c.port||(c.port="443");break;default:throw"Unsupported protocol "+
c.protocol;}b.responseText="";c=f.request(c,function(a){a.setEncoding("utf8");b.changeStatus(-1,2);a.on("data",function(c){b.responseText+=c;b.changeStatus(a.statusCode,3)});a.on("error",function(c){b.changeStatus(a.statusCode,4)});a.on("end",function(){b.changeStatus(a.statusCode,4)})});c.on("error",function(a){b.responseText=a;b.changeStatus(500,4)});a&&c.write(a);c.end()},setRequestHeader:function(a,b){this.options.headers[a]=b}};return new a}:b.Exception._newError("ERROR_INSTANTIATING_XMLHTTPREQUEST",
"_ajax",null)._throw();var S=function(a,b){var c;if("getElementsByTagName"in a)c=function(a,b){return a.getElementsByTagName(b)};else{var e=function(a){if(1!==a.nodeType)return!1;(a=""===a.namespaceURI?"":a.prefix)&&(a+=":");return a+b===b};c=function(a,b){var c=[];H(a,c,"*"===b?null:e);return c}}return(S=c)(a,b)},n=function(a,b,d,e){var c;n=c="getElementsByTagNameNS"in a?function(a,b,c,d){return a.getElementsByTagNameNS(b,d)}:"getElementsByTagName"in a?function(a,b,c,d){return a.getElementsByTagName((c?
c+":":"")+d)}:function(a,b,c,d){c=[];H(a,c,"*"===d?function(a){return 1===a.nodeType&&a.namespaceURI===b}:function(a){return 1===a.nodeType&&a.namespaceURI===b&&a.nodeName===d});return c};return c(a,b,d,e)},C=function(a,b,d,e){return(C="getAttributeNS"in a?function(a,b,c,d){return a.getAttributeNS(b,d)}:"getAttribute"in a?function(a,b,c,d){return a.getAttribute((c?c+":":"")+d)}:function(a,b,c,d){a=a.attributes;if(!a)return null;for(var e=0,f=a.length;e<f;e++)if(c=a[e],c.namespaceURI===b&&c.nodeName===
d)return c.value;return null})(a,b,d,e)},r=function(a,b){return(r="getAttribute"in a?function(a,b){return a.getAttribute(b)}:function(a,b){var c=a.attributes;if(!c)return null;for(var d,e=0,t=c.length;e<t;e++)if(d=c[e],d.nodeName===b)return d.value;return null})(a,b)};b=function(a){this.listeners={};this.listeners[b.EVENT_REQUEST]=[];this.listeners[b.EVENT_SUCCESS]=[];this.listeners[b.EVENT_ERROR]=[];this.listeners[b.EVENT_DISCOVER]=[];this.listeners[b.EVENT_DISCOVER_SUCCESS]=[];this.listeners[b.EVENT_DISCOVER_ERROR]=
[];this.listeners[b.EVENT_EXECUTE]=[];this.listeners[b.EVENT_EXECUTE_SUCCESS]=[];this.listeners[b.EVENT_EXECUTE_ERROR]=[];this.options=k(k({},b.defaultOptions,!0),a,!0);(a=this.options.listeners)&&this.addListener(a);return this};b.defaultOptions={requestTimeout:3E4,async:!1,addFieldGetters:!0,forceResponseXMLEmulation:!1};b.METHOD_DISCOVER="Discover";b.METHOD_EXECUTE="Execute";b.DISCOVER_DATASOURCES="DISCOVER_DATASOURCES";b.DISCOVER_PROPERTIES="DISCOVER_PROPERTIES";b.DISCOVER_SCHEMA_ROWSETS="DISCOVER_SCHEMA_ROWSETS";
b.DISCOVER_ENUMERATORS="DISCOVER_ENUMERATORS";b.DISCOVER_KEYWORDS="DISCOVER_KEYWORDS";b.DISCOVER_LITERALS="DISCOVER_LITERALS";b.DBSCHEMA_CATALOGS="DBSCHEMA_CATALOGS";b.DBSCHEMA_COLUMNS="DBSCHEMA_COLUMNS";b.DBSCHEMA_PROVIDER_TYPES="DBSCHEMA_PROVIDER_TYPES";b.DBSCHEMA_SCHEMATA="DBSCHEMA_SCHEMATA";b.DBSCHEMA_TABLES="DBSCHEMA_TABLES";b.DBSCHEMA_TABLES_INFO="DBSCHEMA_TABLES_INFO";b.MDSCHEMA_ACTIONS="MDSCHEMA_ACTIONS";b.MDSCHEMA_CUBES="MDSCHEMA_CUBES";b.MDSCHEMA_DIMENSIONS="MDSCHEMA_DIMENSIONS";b.MDSCHEMA_FUNCTIONS=
"MDSCHEMA_FUNCTIONS";b.MDSCHEMA_HIERARCHIES="MDSCHEMA_HIERARCHIES";b.MDSCHEMA_LEVELS="MDSCHEMA_LEVELS";b.MDSCHEMA_MEASURES="MDSCHEMA_MEASURES";b.MDSCHEMA_MEMBERS="MDSCHEMA_MEMBERS";b.MDSCHEMA_PROPERTIES="MDSCHEMA_PROPERTIES";b.MDSCHEMA_SETS="MDSCHEMA_SETS";b.EVENT_REQUEST="request";b.EVENT_SUCCESS="success";b.EVENT_ERROR="error";b.EVENT_EXECUTE="execute";b.EVENT_EXECUTE_SUCCESS="executesuccess";b.EVENT_EXECUTE_ERROR="executeerror";b.EVENT_DISCOVER="discover";b.EVENT_DISCOVER_SUCCESS="discoversuccess";
b.EVENT_DISCOVER_ERROR="discovererror";b.EVENT_GENERAL=[b.EVENT_REQUEST,b.EVENT_SUCCESS,b.EVENT_ERROR];b.EVENT_DISCOVER_ALL=[b.EVENT_DISCOVER,b.EVENT_DISCOVER_SUCCESS,b.EVENT_DISCOVER_ERROR];b.EVENT_EXECUTE_ALL=[b.EVENT_EXECUTE,b.EVENT_EXECUTE_SUCCESS,b.EVENT_EXECUTE_ERROR];b.EVENT_ALL=[].concat(b.EVENT_GENERAL,b.EVENT_DISCOVER_ALL,b.EVENT_EXECUTE_ALL);b.PROP_DATASOURCEINFO="DataSourceInfo";b.PROP_CATALOG="Catalog";b.PROP_CUBE="Cube";b.PROP_FORMAT="Format";b.PROP_FORMAT_TABULAR="Tabular";b.PROP_FORMAT_MULTIDIMENSIONAL=
"Multidimensional";b.PROP_AXISFORMAT="AxisFormat";b.PROP_AXISFORMAT_TUPLE="TupleFormat";b.PROP_AXISFORMAT_CLUSTER="ClusterFormat";b.PROP_AXISFORMAT_CUSTOM="CustomFormat";b.PROP_CONTENT="Content";b.PROP_CONTENT_DATA="Data";b.PROP_CONTENT_NONE="None";b.PROP_CONTENT_SCHEMA="Schema";b.PROP_CONTENT_SCHEMADATA="SchemaData";b.prototype={listeners:null,soapMessage:null,response:null,responseText:null,responseXML:null,getResponseXML:function(){if(!0!==this.options.forceResponseXMLEmulation)return this.responseXML;
if(this.responseText===this._responseTextForResponseXML&&this.responseXML)return this.responseXML;this.responseXML=J(this.responseText);this._responseTextForResponseXML=this.responseText;return this.responseXML},setOptions:function(a){k(this.options,a,!0)},addListener:function(){var a=arguments.length,c;switch(a){case 0:b.Exception._newError("NO_EVENTS_SPECIFIED","Xmla.addListener",null)._throw();case 1:var d=arguments[0];if(d&&"object"===typeof d){var e;if(u(d))this._addListeners(d);else if(e=d.events||
d.event)for("string"===typeof e&&(e="all"===e?b.EVENT_ALL:e.split(",")),u(e)||b.Exception._newError("WRONG_EVENTS_FORMAT","Xmla.addListener",d)._throw(),a=e.length,c=0;c<a;c++)this._addListener(e[c],d);else for(e in a=d.scope,m(a)?a=null:delete d.scope,d)c=d[e],m(c.scope)&&(c.scope=a),this._addListener(e,c)}else b.Exception._newError("WRONG_EVENTS_FORMAT","Xmla.addListener",d)._throw();break;case 2:case 3:d=arguments[0];a=arguments[2];c=arguments[1];"string"===typeof d&&(A(c)||c&&"object"===typeof c)?
this._addListener(d,c,a):(d=[d,c],a&&d.push(a),this.addListener(d));break;default:this._addListeners(arguments)}},_addListeners:function(a){var b,d=a.length;for(b=0;b<d;b++)this.addListener(a[b])},_addListener:function(a,c,d){var e=this.listeners[a];e||b.Exception._newError("UNKNOWN_EVENT","Xmla.addListener",{event:a,handler:c,scope:d})._throw();d||(d=null);switch(typeof c){case "function":e.push({handler:c,scope:d});break;case "object":var f=c.handler||c.handlers;c.scope&&(d=c.scope);if(A(f))e.push({handler:f,
scope:d});else if(u(f))for(e=f.length,c=0;c<e;c++)this._addListener(a,f[c],d)}},_fireEvent:function(a,c,d){var e=this.listeners[a];e||b.Exception._newError("UNKNOWN_EVENT","Xmla._fireEvent",a)._throw();var f=e.length,g=!0;if(f){var h,t;for(t=0;t<f;t++)if(h=e[t],h=h.handler.call(h.scope,a,c,this),d&&!1===h){g=!1;break}}else a!==b.EVENT_ERROR||A(c.error)||A(c.callback)||c.exception._throw();return g},getXmlaSoapMessage:function(a){var c=a.method,d='<?xml version="1.0" encoding="UTF-8"?>\n<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">\n <SOAP-ENV:Body>\n <'+
c+' xmlns="urn:schemas-microsoft-com:xml-analysis" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">';switch(c){case b.METHOD_DISCOVER:a.requestType||b.Exception._newError("MISSING_REQUEST_TYPE","Xmla._getXmlaSoapMessage",a)._throw();d+="\n <RequestType>"+a.requestType+"</RequestType>"+I("Restrictions","RestrictionList",a.restrictions," ")+I("Properties","PropertyList",a.properties," ");break;case b.METHOD_EXECUTE:a.statement||b.Exception._newError("MISSING_REQUEST_TYPE","Xmla._getXmlaSoapMessage",
a)._throw(),d+="\n <Command>\n <Statement>"+G(a.statement)+"</Statement>\n </Command>"+I("Properties","PropertyList",a.properties," ")}return d+("\n </"+c+">\n </SOAP-ENV:Body>\n</SOAP-ENV:Envelope>")},request:function(a){var c,d=this;this.responseXML=this.responseText=this.response=null;a=k(a,this.options,!1);a.url||(c=b.Exception._newError("MISSING_URL","Xmla.request",a),c._throw());a.properties=k(a.properties,this.options.properties,!1);a.restrictions=k(a.restrictions,this.options.restrictions,
!1);delete a.exception;if(!this._fireEvent(b.EVENT_REQUEST,a,!0)||a.method==b.METHOD_DISCOVER&&!this._fireEvent(b.EVENT_DISCOVER,a)||a.method==b.METHOD_EXECUTE&&!this._fireEvent(b.EVENT_EXECUTE,a))return!1;this.soapMessage=c=this.getXmlaSoapMessage(a);c={async:a.async,timeout:a.requestTimeout,data:c,error:function(b){a.exception=b;d._requestError(a,b)},complete:function(b){a.xhr=b;d._requestSuccess(a)},url:a.url};a.username&&(c.username=a.username);a.password&&(c.password=a.password);var e={};this.options.headers&&
(e=k(e,this.options.headers));a.headers&&(e=k(e,a.headers,!0));c.headers=e;T(c);return this.response},_requestError:function(a,c){a.error&&a.error.call(a.scope?a.scope:null,this,a,c);a.callback&&a.callback.call(a.scope?a.scope:null,b.EVENT_ERROR,this,a,c);this._fireEvent(b.EVENT_ERROR,a)},_parseSoapFault:function(a){var b={},d,e,f=a.childNodes,g=f.length,h;for(e=0;e<g;e++)if(h=f[e],1===h.nodeType){a=h.nodeName;switch(a){case "faultactor":case "faultstring":case "faultcode":d=p(h);break;case "detail":var t;
d=[];var k=h.childNodes,l=k.length;for(t=0;t<l;t++)if(h=k[t],1===h.nodeType)switch(h.nodeName){case "Error":d.push({ErrorCode:r(h,"ErrorCode"),Description:r(h,"Description"),Source:r(h,"Source"),HelpFile:r(h,"HelpFile")})}break;default:d=null}d&&(b[a]=d)}return b},_requestSuccess:function(a){var c=a.xhr,d;!0!==a.forceResponseXMLEmulation&&(this.responseXML=c.responseXML);this.responseText=c.responseText;c=a.method;try{var e=this.getResponseXML();e||(a.exception=new b.Exception(b.Exception.TYPE_ERROR,
b.Exception.ERROR_PARSING_RESPONSE_CDE,"Response is not an XML document."));var f=n(e,"http://schemas.xmlsoap.org/soap/envelope/","SOAP-ENV","Fault");if(f.length)f=f[0],f=this._parseSoapFault(f),a.exception=new b.Exception(b.Exception.TYPE_ERROR,f.faultcode,f.faultstring,null,"_requestSuccess",a,null,f.detail,f.faultactor);else{switch(c){case b.METHOD_DISCOVER:a.rowset=d=new b.Rowset(e,a.requestType,this);break;case b.METHOD_EXECUTE:var g=f=null;switch(a.properties[b.PROP_FORMAT]){case b.PROP_FORMAT_TABULAR:d=
f=new b.Rowset(e,null,this);break;case b.PROP_FORMAT_MULTIDIMENSIONAL:d=g=new b.Dataset(e)}a.resultset=f;a.dataset=g}this.response=d}}catch(h){a.exception=h}if(a.exception){switch(c){case b.METHOD_DISCOVER:this._fireEvent(b.EVENT_DISCOVER_ERROR,a);break;case b.METHOD_EXECUTE:this._fireEvent(b.EVENT_EXECUTE_ERROR,a)}a.error&&a.error.call(a.scope?a.scope:null,this,a,a.exception);a.callback&&a.callback.call(a.scope?a.scope:null,b.EVENT_ERROR,this,a,a.exception);this._fireEvent(b.EVENT_ERROR,a)}else{switch(c){case b.METHOD_DISCOVER:this._fireEvent(b.EVENT_DISCOVER_SUCCESS,
a);break;case b.METHOD_EXECUTE:this._fireEvent(b.EVENT_EXECUTE_SUCCESS,a)}a.success&&a.success.call(a.scope?a.scope:null,this,a,d);a.callback&&a.callback.call(a.scope?a.scope:null,b.EVENT_SUCCESS,this,a,d);this._fireEvent(b.EVENT_SUCCESS,a)}},execute:function(a){var c=a.properties;c||(c={},a.properties=c);k(c,this.options.properties,!1);c[b.PROP_CONTENT]||(c[b.PROP_CONTENT]=b.PROP_CONTENT_SCHEMADATA);c[b.PROP_FORMAT]||(a.properties[b.PROP_FORMAT]=b.PROP_FORMAT_MULTIDIMENSIONAL);a=k(a,{method:b.METHOD_EXECUTE},
!0);return this.request(a)},executeTabular:function(a){a.properties||(a.properties={});a.properties[b.PROP_FORMAT]=b.PROP_FORMAT_TABULAR;return this.execute(a)},executeMultiDimensional:function(a){a.properties||(a.properties={});a.properties[b.PROP_FORMAT]=b.PROP_FORMAT_MULTIDIMENSIONAL;return this.execute(a)},discover:function(a){a=k(a,{method:b.METHOD_DISCOVER},!0);a.requestType||(a.requestType=this.options.requestType);a.properties||(a.properties={});a.properties[b.PROP_FORMAT]=b.PROP_FORMAT_TABULAR;
return this.request(a)},discoverDataSources:function(a){a=k(a,{requestType:b.DISCOVER_DATASOURCES},!0);return this.discover(a)},discoverProperties:function(a){a=k(a,{requestType:b.DISCOVER_PROPERTIES},!0);return this.discover(a)},discoverSchemaRowsets:function(a){a=k(a,{requestType:b.DISCOVER_SCHEMA_ROWSETS},!0);return this.discover(a)},discoverEnumerators:function(a){a=k(a,{requestType:b.DISCOVER_ENUMERATORS},!0);return this.discover(a)},discoverKeywords:function(a){a=k(a,{requestType:b.DISCOVER_KEYWORDS},
!0);return this.discover(a)},discoverLiterals:function(a){a=k(a,{requestType:b.DISCOVER_LITERALS},!0);return this.discover(a)},discoverDBCatalogs:function(a){a=k(a,{requestType:b.DBSCHEMA_CATALOGS},!0);return this.discover(a)},discoverDBColumns:function(a){a=k(a,{requestType:b.DBSCHEMA_COLUMNS},!0);return this.discover(a)},discoverDBProviderTypes:function(a){a=k(a,{requestType:b.DBSCHEMA_PROVIDER_TYPES},!0);return this.discover(a)},discoverDBSchemata:function(a){a=k(a,{requestType:b.DBSCHEMA_SCHEMATA},
!0);return this.discover(a)},discoverDBTables:function(a){a=k(a,{requestType:b.DBSCHEMA_TABLES},!0);return this.discover(a)},discoverDBTablesInfo:function(a){a=k(a,{requestType:b.DBSCHEMA_TABLES_INFO},!0);return this.discover(a)},discoverMDActions:function(a){a=k(a,{requestType:b.MDSCHEMA_ACTIONS},!0);return this.discover(a)},discoverMDCubes:function(a){a=k(a,{requestType:b.MDSCHEMA_CUBES},!0);return this.discover(a)},discoverMDDimensions:function(a){a=k(a,{requestType:b.MDSCHEMA_DIMENSIONS},!0);
return this.discover(a)},discoverMDFunctions:function(a){a=k(a,{requestType:b.MDSCHEMA_FUNCTIONS},!0);return this.discover(a)},discoverMDHierarchies:function(a){a=k(a,{requestType:b.MDSCHEMA_HIERARCHIES},!0);return this.discover(a)},discoverMDLevels:function(a){a=k(a,{requestType:b.MDSCHEMA_LEVELS},!0);return this.discover(a)},discoverMDMeasures:function(a){a=k(a,{requestType:b.MDSCHEMA_MEASURES},!0);return this.discover(a)},discoverMDMembers:function(a){a=k(a,{requestType:b.MDSCHEMA_MEMBERS},!0);
return this.discover(a)},discoverMDProperties:function(a){a=k(a,{requestType:b.MDSCHEMA_PROPERTIES},!0);return this.discover(a)},discoverMDSets:function(a){a=k(a,{requestType:b.MDSCHEMA_SETS},!0);return this.discover(a)}};b.Rowset=function(a,b,d){"string"===typeof a&&(a=J(a));this._node=a;this._type=b;this._xmla=d;this._initData();return this};b.Rowset.MD_DIMTYPE_UNKNOWN=0;b.Rowset.MD_DIMTYPE_TIME=1;b.Rowset.MD_DIMTYPE_MEASURE=2;b.Rowset.MD_DIMTYPE_OTHER=3;b.Rowset.MD_DIMTYPE_QUANTITATIVE=5;b.Rowset.MD_DIMTYPE_ACCOUNTS=
6;b.Rowset.MD_DIMTYPE_CUSTOMERS=7;b.Rowset.MD_DIMTYPE_PRODUCTS=8;b.Rowset.MD_DIMTYPE_SCENARIO=9;b.Rowset.MD_DIMTYPE_UTILIY=10;b.Rowset.MD_DIMTYPE_CURRENCY=11;b.Rowset.MD_DIMTYPE_RATES=12;b.Rowset.MD_DIMTYPE_CHANNEL=13;b.Rowset.MD_DIMTYPE_PROMOTION=14;b.Rowset.MD_DIMTYPE_ORGANIZATION=15;b.Rowset.MD_DIMTYPE_BILL_OF_MATERIALS=16;b.Rowset.MD_DIMTYPE_GEOGRAPHY=17;b.Rowset.MD_STRUCTURE_FULLYBALANCED=0;b.Rowset.MD_STRUCTURE_RAGGEDBALANCED=1;b.Rowset.MD_STRUCTURE_UNBALANCED=2;b.Rowset.MD_STRUCTURE_NETWORK=
3;b.Rowset.MD_USER_DEFINED=1;b.Rowset.MD_SYSTEM_ENABLED=2;b.Rowset.MD_SYSTEM_INTERNAL=4;b.Rowset.MDMEMBER_TYPE_REGULAR=1;b.Rowset.MDMEMBER_TYPE_ALL=2;b.Rowset.MDMEMBER_TYPE_FORMULA=3;b.Rowset.MDMEMBER_TYPE_MEASURE=4;b.Rowset.MDMEMBER_TYPE_UNKNOWN=0;b.Rowset.MDMEASURE_AGGR_SUM=1;b.Rowset.MDMEASURE_AGGR_COUNT=2;b.Rowset.MDMEASURE_AGGR_MIN=3;b.Rowset.MDMEASURE_AGGR_MAX=4;b.Rowset.MDMEASURE_AGGR_AVG=5;b.Rowset.MDMEASURE_AGGR_VAR=6;b.Rowset.MDMEASURE_AGGR_STD=7;b.Rowset.MDMEASURE_AGGR_DST=8;b.Rowset.MDMEASURE_AGGR_NONE=
9;b.Rowset.MDMEASURE_AGGR_AVGCHILDREN=10;b.Rowset.MDMEASURE_AGGR_FIRSTCHILD=11;b.Rowset.MDMEASURE_AGGR_LASTCHILD=12;b.Rowset.MDMEASURE_AGGR_FIRSTNONEMPTY=13;b.Rowset.MDMEASURE_AGGR_LASTNONEMPTY=14;b.Rowset.MDMEASURE_AGGR_BYACCOUNT=15;b.Rowset.MDMEASURE_AGGR_CALCULATED=127;b.Rowset.MDMEASURE_AGGR_UNKNOWN=0;b.Rowset.MDPROP_MEMBER=1;b.Rowset.MDPROP_CELL=2;b.Rowset.MDPROP_SYSTEM=4;b.Rowset.MDPROP_BLOB=8;b.Rowset.KEYS={};b.Rowset.KEYS[b.DBSCHEMA_CATALOGS]=["CATALOG_NAME"];b.Rowset.KEYS[b.DBSCHEMA_COLUMNS]=
["TABLE_CATALOG","TABLE_SCHEMA","TABLE_NAME","COLUMN_NAME"];b.Rowset.KEYS[b.DBSCHEMA_PROVIDER_TYPES]=["TYPE_NAME"];b.Rowset.KEYS[b.DBSCHEMA_SCHEMATA]=["CATALOG_NAME","SCHEMA_NAME"];b.Rowset.KEYS[b.DBSCHEMA_TABLES]=["TABLE_CATALOG","TABLE_SCHEMA","TABLE_NAME"];b.Rowset.KEYS[b.DBSCHEMA_TABLES_INFO]=["TABLE_CATALOG","TABLE_SCHEMA","TABLE_NAME"];b.Rowset.KEYS[b.DISCOVER_DATASOURCES]=["DataSourceName"];b.Rowset.KEYS[b.DISCOVER_ENUMERATORS]=["EnumName","ElementName"];b.Rowset.KEYS[b.DISCOVER_KEYWORDS]=
["Keyword"];b.Rowset.KEYS[b.DISCOVER_LITERALS]=["LiteralName"];b.Rowset.KEYS[b.DISCOVER_PROPERTIES]=["PropertyName"];b.Rowset.KEYS[b.DISCOVER_SCHEMA_ROWSETS]=["SchemaName"];b.Rowset.KEYS[b.MDSCHEMA_ACTIONS]=["CATALOG_NAME","SCHEMA_NAME","CUBE_NAME","ACTION_NAME"];b.Rowset.KEYS[b.MDSCHEMA_CUBES]=["CATALOG_NAME","SCHEMA_NAME","CUBE_NAME"];b.Rowset.KEYS[b.MDSCHEMA_DIMENSIONS]=["CATALOG_NAME","SCHEMA_NAME","CUBE_NAME","DIMENSION_UNIQUE_NAME"];b.Rowset.KEYS[b.MDSCHEMA_FUNCTIONS]=["FUNCTION_NAME","PARAMETER_LIST"];
b.Rowset.KEYS[b.MDSCHEMA_HIERARCHIES]=["CATALOG_NAME","SCHEMA_NAME","CUBE_NAME","DIMENSION_UNIQUE_NAME","HIERARCHY_UNIQUE_NAME"];b.Rowset.KEYS[b.MDSCHEMA_LEVELS]="CATALOG_NAME SCHEMA_NAME CUBE_NAME DIMENSION_UNIQUE_NAME HIERARCHY_UNIQUE_NAME LEVEL_UNIQUE_NAME".split(" ");b.Rowset.KEYS[b.MDSCHEMA_MEASURES]=["CATALOG_NAME","SCHEMA_NAME","CUBE_NAME","MEASURE_NAME"];b.Rowset.KEYS[b.MDSCHEMA_MEMBERS]="CATALOG_NAME SCHEMA_NAME CUBE_NAME DIMENSION_UNIQUE_NAME HIERARCHY_UNIQUE_NAME LEVEL_UNIQUE_NAME MEMBER_UNIQUE_NAME".split(" ");
b.Rowset.KEYS[b.MDSCHEMA_PROPERTIES]="CATALOG_NAME SCHEMA_NAME CUBE_NAME DIMENSION_UNIQUE_NAME HIERARCHY_UNIQUE_NAME LEVEL_UNIQUE_NAME MEMBER_UNIQUE_NAME PROPERTY_NAME".split(" ");b.Rowset.KEYS[b.MDSCHEMA_SETS]=["CATALOG_NAME","SCHEMA_NAME","CUBE_NAME","SET_NAME"];N.jsType="boolean";q.jsType="number";E.jsType="number";F.jsType="string";O.jsType="object";P.jsType="object";L.jsType="object";var B={"xsd:boolean":N,"xsd:decimal":E,"xsd:double":E,"xsd:float":E,"xsd:int":q,"xsd:integer":q,"xsd:nonPositiveInteger":q,
"xsd:negativeInteger":q,"xsd:nonNegativeInteger":q,"xsd:positiveInteger":q,"xsd:short":q,"xsd:byte":q,"xsd:long":q,"xsd:unsignedLong":q,"xsd:unsignedInt":q,"xsd:unsignedShort":q,"xsd:unsignedByte":q,"xsd:string":F,"xsd:dateTime":O,Restrictions:P};b.Rowset.prototype={_node:null,_type:null,_row:null,_rows:null,numRows:null,fieldOrder:null,fields:null,_fieldCount:null,_initData:function(){this.numRows=(this._rows=n(this._node,"urn:schemas-microsoft-com:xml-analysis:rowset",null,"row"))?this._rows.length:
0;this.reset();this.fieldOrder=[];this.fields={};this._fieldCount=0;var a=K(this._node,"row");if(a){var c=(a=n(a,"http://www.w3.org/2001/XMLSchema","xsd","sequence")[0].childNodes)?a.length:0,d,e,f,g,h,t,k,l=this._xmla.options.addFieldGetters,m;for(m=0;m<c;m++)d=a[m],1===d.nodeType&&(e=C(d,"urn:schemas-microsoft-com:xml-sql","sql","field"),f=r(d,"name"),h=r(d,"type"),null===h&&this._row&&(g=S(this._row,f),g.length&&(h=C(g[0],"http://www.w3.org/2001/XMLSchema-instance","xsi","type"))),h||this._type!=
b.DISCOVER_SCHEMA_ROWSETS||"Restrictions"!==f||(h="Restrictions"),g=(g=r(d,"minOccurs"))?parseInt(g,10):1,(d=r(d,"maxOccurs"))?"unbounded"===d?d=Infinity:g=parseInt(d,10):d=1,t=Q(h),k=this._createFieldGetter(f,t,g,d),l&&(this[U(f)]=k),this.fields[e]={name:f,label:e,index:this._fieldCount++,type:h,jsType:t.jsType,minOccurs:g,maxOccurs:d,getter:k},this.fieldOrder.push(e))}else b.Exception._newError("ERROR_PARSING_RESPONSE","Xmla.Rowset",this._node)._throw()},_createFieldGetter:function(a,b,d,e){var c;
1===e?1===d?c=function(){var c=n(this._row,"urn:schemas-microsoft-com:xml-analysis:rowset",null,a);if(c.length)return b(p(c[0]));m(console.error)||console.error('Field "'+a+"\" is supposed to be present in the rowset but isn't. Are you running on SAP / HANA?");return null}:0===d&&(c=function(){var c=n(this._row,"urn:schemas-microsoft-com:xml-analysis:rowset",null,a);return c.length?b(p(c[0])):null}):1===d?c=function(){var c=n(this._row,"urn:schemas-microsoft-com:xml-analysis:rowset",null,a);return L(c,
b)}:0===d&&(c=function(){var c=n(this._row,"urn:schemas-microsoft-com:xml-analysis:rowset",null,a);return c.length?L(c,b):null});return c},getType:function(){return this._type},getFields:function(){var a=[],b,d=this._fieldCount,e=this.fieldOrder;for(b=0;b<d;b++)a[b]=this.fieldDef(e[b]);return a},getFieldNames:function(){var a=[],b,d=this._fieldCount;for(b=0;b<d;b++)a[b]=this.fieldOrder[b];return a},hasMoreRows:function(){return this.numRows>this.rowIndex},nextRow:function(){this.rowIndex++;this._row=
this._rows[this.rowIndex];return this.rowIndex},next:function(){return this.nextRow()},eachRow:function(a,b,d){m(b)&&(b=this);var c=[null];m(d)||(u(d)||(d=[d]),c=c.concat(d));for(;this.hasMoreRows();){c[0]=this.readAsObject();if(!1===a.apply(b,c))return!1;this.nextRow()}return!0},currRow:function(){return this.rowIndex},rowCount:function(){return this.numRows},reset:function(){this.rowIndex=0;this._row=this.hasMoreRows()?this._rows[this.rowIndex]:null},fieldDef:function(a){var c=this.fields[a];c||
b.Exception._newError("INVALID_FIELD","Xmla.Rowset.fieldDef",a)._throw();return c},fieldIndex:function(a){return this.fieldDef(a).index},fieldName:function(a){var c=this.fieldOrder[a];c||b.Exception._newError("INVALID_FIELD","Xmla.Rowset.fieldDef",a)._throw();return c},fieldVal:function(a){"number"===typeof a&&(a=this.fieldName(a));return this.fieldDef(a).getter.call(this)},fieldCount:function(){return this._fieldCount},close:function(){this._rows=this._row=this._node=null},readAsArray:function(a){var b=
this.fields,d,e;a||(a=[]);for(d in b)b.hasOwnProperty(d)&&(e=b[d],a[e.index]=e.getter.call(this));return a},fetchAsArray:function(a){this.hasMoreRows()?(a=this.readAsArray(a),this.nextRow()):a=!1;return a},readAsObject:function(a){var b=this.fields,d,e;a||(a={});for(d in b)b.hasOwnProperty(d)&&(e=b[d],a[d]=e.getter.call(this));return a},fetchAsObject:function(a){this.hasMoreRows()?(a=this.readAsObject(a),this.nextRow()):a=!1;return a},fetchCustom:function(a,b){var c;this.hasMoreRows()?(c=a.call(this,
b),this.nextRow()):c=!1;return c},fetchAllAsArray:function(a){var b;for(a||(a=[]);b=this.fetchAsArray();)a.push(b);return a},fetchAllAsObject:function(a){var b;for(a||(a=[]);b=this.fetchAsObject();)a.push(b);return a},fetchAllCustom:function(a,b,d){var c;for(a||(a=[]);c=this.fetchCustom(b,d);)a.push(c);return a},mapAsObject:function(a,b,d){var c,f,g=b.length,h=g-1,k=a;for(a=0;a<g;a++)c=b[a],c=d[c],(f=k[c])?a===h?u(f)?f.push(d):k[c]=[f,d]:k=f:a===h?k[c]=d:k=k[c]={}},mapAllAsObject:function(a,b){b||
(b={});a||(a=this.getKey());for(var c;c=this.fetchAsObject();)this.mapAsObject(b,a,c);return b},getKey:function(){return this._type?b.Rowset.KEYS[this._type]:this.getFieldNames()}};b.Dataset=function(a){"string"===typeof a&&(a=J(a));this._initDataset(a);return this};b.Dataset.AXIS_COLUMNS=0;b.Dataset.AXIS_ROWS=1;b.Dataset.AXIS_PAGES=2;b.Dataset.AXIS_SECTIONS=3;b.Dataset.AXIS_CHAPTERS=4;b.Dataset.AXIS_SLICER="SlicerAxis";b.Dataset.prototype={_root:null,_axes:null,_axesOrder:null,_numAxes:null,_slicer:null,
_cellset:null,_initDataset:function(a){this._initRoot(a);this.cubeName=p(n(this._root,"urn:schemas-microsoft-com:xml-analysis:mddataset","","CubeName")[0]);this._initAxes();this._initCells()},_initRoot:function(a){var c=n(a,"urn:schemas-microsoft-com:xml-analysis:mddataset","","root");c.length?this._root=c[0]:b.Exception._newError("ERROR_PARSING_RESPONSE","Xmla.Dataset._initData",a)._throw()},_initAxes:function(){var a,c,d,e,f,g={};this._axes={};this._axesOrder=[];e=n(this._root,"urn:schemas-microsoft-com:xml-analysis:mddataset",
"","AxisInfo");f=e.length;for(a=0;a<f;a++)c=e[a],d=r(c,"name"),g[d]=c;e=n(this._root,"urn:schemas-microsoft-com:xml-analysis:mddataset","","Axis");f=e.length;for(a=0;a<f;a++)c=e[a],d=r(c,"name"),c=new b.Dataset.Axis(this,g[d],c,d,a),d===b.Dataset.AXIS_SLICER?this._slicer=c:(this._axes[d]=c,this._axesOrder.push(c));this._numAxes=this._axesOrder.length},_initCells:function(){this._cellset=new b.Dataset.Cellset(this)},axisCount:function(){return this._numAxes},_getAxis:function(a){var c;switch(typeof a){case "number":c=
this._axesOrder[a];break;case "string":c=void 0===b.Dataset.AXIS_SLICER?this._slicer:this._axes[void 0]}return c},getAxis:function(a){if(a===b.Dataset.AXIS_SLICER)return this._slicer;var c=this._getAxis(a);c||b.Exception._newError("INVALID_AXIS","Xmla.Dataset.getAxis",a)._throw();return c},hasAxis:function(a){a=this._getAxis(a);return!m(a)},getColumnAxis:function(){return this.getAxis(b.Dataset.AXIS_COLUMNS)},hasColumnAxis:function(){return this.hasAxis(b.Dataset.AXIS_COLUMNS)},getRowAxis:function(){return this.getAxis(b.Dataset.AXIS_ROWS)},
hasRowAxis:function(){return this.hasAxis(b.Dataset.AXIS_ROWS)},getPageAxis:function(){return this.getAxis(b.Dataset.AXIS_PAGES)},hasPageAxis:function(){return this.hasAxis(b.Dataset.AXIS_PAGES)},getChapterAxis:function(){return this.getAxis(b.Dataset.AXIS_CHAPTERS)},hasChapterAxis:function(){return this.hasAxis(b.Dataset.AXIS_CHAPTERS)},getSectionAxis:function(){return this.getAxis(b.Dataset.AXIS_SECTIONS)},hasSectionAxis:function(){return this.hasAxis(b.Dataset.AXIS_SECTIONS)},getSlicerAxis:function(){return this._slicer},
hasSlicerAxis:function(){return null!==this._slicer},getCellset:function(){return this._cellset},cellOrdinalForTupleIndexes:function(){var a=this._numAxes,b=this._axesOrder,d=0,e,f,g,h;e=0;for(--a;0<=a;a--,e++){f=arguments[e];h=1;for(g=a-1;0<=g;g--)h*=b[g].tupleCount();d+=f*h}return d},fetchAsObject:function(){var a=function(a){a.getHierarchies();var b=[],c,d=a.numHierarchies;for(c=0;c<d;c++)b.push(a.hierarchy(c));return b},b=[],d;d=[];var e=[],f,g,h;f=1;var k=0;g=0;for(h=this.axisCount();g<h;g++)d=
this.getAxis(g),f*=d.tupleCount(),b.push({positions:d.fetchAllAsObject(),hierarchies:a(d)});this.hasSlicerAxis?(d=this.getSlicerAxis(),a={positions:d.fetchAllAsObject(),hierarchies:a(d)}):a={positions:{},hierarchies:[]};d=this.getCellset();g=0;for(h=f;g<h;g++){f=d.readCell();if(k===f.ordinal){if(e.push(f),-1===d.nextCell())break}else e.push({Value:null,FmtValue:null,FormatString:null,ordinal:k});k++}d.reset();return{cubeName:this.cubeName,axes:b,filterAxis:a,cells:e}},reset:function(){this._cellset&&
this._cellset.reset();if(this._axes){var a,b;a=0;for(b=this.axisCount();a<b;a++)this.getAxis(a).reset()}},close:function(){this._slicer&&this._slicer.close();var a,b=this._numAxes;for(a=0;a<b;a++)this.getAxis(a).close();this._cellset.close();this._slicer=this._numAxes=this._axesOrder=this._axes=this._root=this._cellset=null}};b.Dataset.Axis=function(a,b,d,e,f){this._dataset=a;this._initAxis(b,d);this.name=e;this.id=f;return this};b.Dataset.Axis.MEMBER_UNIQUE_NAME="UName";b.Dataset.Axis.MEMBER_CAPTION=
"Caption";b.Dataset.Axis.MEMBER_LEVEL_NAME="LName";b.Dataset.Axis.MEMBER_LEVEL_NUMBER="LNum";b.Dataset.Axis.MEMBER_DISPLAY_INFO="DisplayInfo";b.Dataset.Axis.DefaultMemberProperties=[b.Dataset.Axis.MEMBER_UNIQUE_NAME,b.Dataset.Axis.MEMBER_CAPTION,b.Dataset.Axis.MEMBER_LEVEL_NAME,b.Dataset.Axis.MEMBER_LEVEL_NUMBER,b.Dataset.Axis.MEMBER_DISPLAY_INFO];b.Dataset.Axis.MDDISPINFO_CHILDREN_CARDINALITY=65535;b.Dataset.Axis.MDDISPINFO_DRILLED_DOWN=65536;b.Dataset.Axis.MDDISPINFO_SAME_PARENT_AS_PREV=131072;
b.Dataset.Axis.prototype={id:-1,name:null,_dataset:null,_tuples:null,_members:null,_memberProperties:null,numTuples:null,numHierarchies:null,_tupleIndex:null,_hierarchyIndex:null,_hierarchyOrder:null,_hierarchyDefs:null,_hierarchyIndexes:null,_initHierarchies:function(a){a=n(a,"urn:schemas-microsoft-com:xml-analysis:mddataset","","HierarchyInfo");var c=a.length,d,e,f,g,h,k,m,l,q,p,u,w=this._memberProperties;this._hierarchyDefs={};this._hierarchyOrder=[];this._hierarchyIndexes={};this.numHierarchies=
c;for(d=0;d<c;d++){e=a[d];f=r(e,"name");this._hierarchyOrder[d]=f;this._hierarchyIndexes[f]=d;g={index:d,name:f,properties:h={}};m=n(e,"urn:schemas-microsoft-com:xml-analysis:mddataset","","*");k=m.length;for(e=0;e<k;e++){l=m[e];q=l.nodeName;p=r(l,"type");if(!p)if(u=w[q])p=u.type;else switch(q){case b.Dataset.Axis.MEMBER_LEVEL_NUMBER:case b.Dataset.Axis.MEMBER_DISPLAY_INFO:p="xsd:int"}(p=B[p])||(p=F);u=M(q);switch(u){case b.Dataset.Axis.MEMBER_UNIQUE_NAME:case b.Dataset.Axis.MEMBER_CAPTION:case b.Dataset.Axis.MEMBER_LEVEL_NAME:case b.Dataset.Axis.MEMBER_LEVEL_NUMBER:case b.Dataset.Axis.MEMBER_DISPLAY_INFO:l=
u;break;default:if(l=r(l,"name"))l=l.split("."),l=l[l.length-1],"["===l.charAt(0)&&"]"===l.charAt(l.length-1)&&(l=l.substr(1,l.length-2))}h[q]={converter:p,name:u,propertyName:l}}this._hierarchyDefs[f]=g}},_initMembers:function(){var a=this._dataset._root,c,d,e,f,g=this._memberProperties={};(c=K(a,"MemberType"))||b.Exception._newError("ERROR_PARSING_RESPONSE","Xmla.DataSet.Axis",a)._throw();c=n(c,"http://www.w3.org/2001/XMLSchema","xsd","sequence");if(c.length)for(c=c[0],a=n(c,"http://www.w3.org/2001/XMLSchema",
"xsd","element"),c=a.length,f=0;f<c;f++)d=a[f],e=r(d,"type"),d=r(d,"name"),g[d]={type:e,converter:B[e],name:M(d)};else m(console.error)||console.error("MemberType in schema does not define any child elements. Are you running on Jedox/Palo?")},_initAxis:function(a,b){this.name=r(b,"name");this._initMembers();this._initHierarchies(a);this._tuples=n(b,"urn:schemas-microsoft-com:xml-analysis:mddataset","","Tuple");this.numTuples=this._tuples.length;this.reset()},close:function(){this.numTuples=-1;this._members=
this._hierarchyIndexes=this._hierarchyOrder=this._hierarchyDefs=this._tuples=null},_getMembers:function(){return this.hasMoreTuples()?n(this._tuples[this._tupleIndex],"urn:schemas-microsoft-com:xml-analysis:mddataset","","Member"):null},reset:function(){this._tupleIndex=this._hierarchyIndex=0;this._members=this._getMembers()},hasMoreHierarchies:function(){return this.numHierarchies>this._hierarchyIndex},nextHierarchy:function(){return this._hierarchyIndex++},eachHierarchy:function(a,b,d){var c=[null];
b||(b=this);d&&(u(d)||(d=[d]),c=c.concat(d));for(;this.hasMoreHierarchies();){c[0]=this._hierarchyDefs[this._hierarchyOrder[this._hierarchyIndex]];if(!1===a.apply(b,c))return!1;this.nextHierarchy()}this._hierarchyIndex=0;return!0},hasMoreTuples:function(){return this.numTuples>this._tupleIndex},nextTuple:function(){this._tupleIndex++;this._members=this._getMembers();return this._tupleIndex},tupleCount:function(){return this.numTuples},tupleIndex:function(){return this._tupleIndex},getTuple:function(){var a,
b=this.numHierarchies,d={},e,f=[],g={index:this._tupleIndex,hierarchies:d,members:f};for(a=0;a<b;a++)e=this._member(a),d[this._hierarchyOrder[a]]=e,f.push(e);return g},eachTuple:function(a,b,d){var c=[null];b||(b=this);for(d&&(u(d)?c.concat(d):c.push(d));this.hasMoreTuples();){c[0]=this.getTuple();if(!1===a.apply(b,c))return!1;this.nextTuple()}this._tupleIndex=0;this._members=this._getMembers();return!0},getHierarchies:function(){return this._hierarchyDefs},getHierarchyNames:function(){var a=[],b,
d=this.numHierarchies;for(b=0;b<d;b++)a[b]=this._hierarchyOrder[b];return a},hierarchyCount:function(){return this.numHierarchies},hierarchyIndex:function(a){if(m(a))return this._hierarchyIndex;var c=this._hierarchyIndexes[a];m(c)&&b.Exception._newError("INVALID_HIERARCHY","Xmla.Dataset.Axis.hierarchyDef",a)._throw();return c},hierarchyName:function(a){m(a)&&(a=this._hierarchyIndex);(a!==parseInt(a,10)||a>=this.numHierarchies)&&b.Exception._newError("INVALID_HIERARCHY","Xmla.Dataset.Axis.hierarchyDef",
a)._throw();return this._hierarchyOrder[a]},hierarchy:function(a){m(a);var c;"number"===typeof a&&((a!==parseInt(a,10)||a>=this.numHierarchies)&&b.Exception._newError("INVALID_HIERARCHY","Xmla.Dataset.Axis.hierarchyDef",a)._throw(),a=this.hierarchyName(a));c=this._hierarchyDefs[a];m(c)&&b.Exception._newError("INVALID_HIERARCHY","Xmla.Dataset.Axis.hierarchyDef",a)._throw();return c},member:function(a){m(a)&&(c=this._hierarchyIndex);var c;switch(typeof a){case "string":c=this.hierarchyIndex(a);break;
case "number":(a!==parseInt(a,10)||a>=this.numHierarchies)&&b.Exception._newError("INVALID_HIERARCHY","Xmla.Dataset.Axis.hierarchyDef",a)._throw(),c=a}return this._member(c)},_member:function(a){var b=this._members[a].childNodes,d=b.length,e=this.hierarchyName(a),f=this._hierarchyDefs[e].properties,g={index:a,hierarchy:e},h;for(a=0;a<d;a++)h=b[a],1===h.nodeType&&(e=f[h.nodeName])&&(g[e.propertyName||e.name]=e.converter(p(h)));return g},hasMemberProperty:function(a){return!m(this._memberProperties[a])},
readAsArray:function(a){a||(a=[]);var b,d=this.numHierarchies;for(b=0;b<d;b++)a[b]=this._member(b);return a},readAsObject:function(a){a||(a={});var b,d=this.numHierarchies;for(b=0;b<d;b++)a[this._hierarchyOrder[b]]=this._member(b);return a},fetchAsArray:function(a){this.hasMoreTuples()?(a=this.readAsArray(a),this.nextTuple()):a=!1;return a},fetchAsObject:function(a){this.hasMoreTuples(a)?(a=this.readAsObject(),this.nextTuple()):a=!1;return a},fetchAllAsArray:function(a){var b;for(a||(a=[]);b=this.fetchAsArray();)a.push(b);
this.reset();return a},fetchAllAsObject:function(a){var b;for(a||(a=[]);b=this.fetchAsObject();)a.push(b);this.reset();return a}};b.Dataset.Cellset=function(a){this._dataset=a;this._initCellset();return this};b.Dataset.Cellset.prototype={_dataset:null,_cellNodes:null,_cellCount:null,_cellNode:null,_cellProperties:null,_idx:null,_cellOrd:null,_initCellset:function(){var a=this._dataset._root,c,d,e,f,g,h,k,m,l;(c=K(a,"CellData"))||b.Exception._newError("ERROR_PARSING_RESPONSE","Xmla.Dataset.Cellset",
a)._throw();c=n(c,"http://www.w3.org/2001/XMLSchema","xsd","element");d=c.length;(f=n(a,"urn:schemas-microsoft-com:xml-analysis:mddataset","","CellInfo"))&&0!==f.length||b.Exception._newError("ERROR_PARSING_RESPONSE","Xmla.Rowset",a)._throw();f=n(f[0],"urn:schemas-microsoft-com:xml-analysis:mddataset","","*");this._cellProperties={};k=f.length;var p=this,q=function(a){p["cell"+a]=function(){return this.cellProperty(a)}};for(m=0;m<k;m++){g=f[m];h=g.nodeName;for(l=0;l<d;l++)if(e=c[l],r(e,"name")===
h){e=r(e,"type");this._cellProperties[h]=B[e];q(h);break}this._cellProperties[h]||((e=r(g,"type"))||(e="Value"===h?"xs:decimal":"xs:string"),this._cellProperties[h]=B[e],q(h))}this._cellNodes=n(a,"urn:schemas-microsoft-com:xml-analysis:mddataset","","Cell");this._cellCount=this._cellNodes.length;this.reset()},_getCellNode:function(a){m(a)||(this._idx=a);this._cellNode=this._cellNodes[this._idx];this._cellOrd=this._getCellOrdinal(this._cellNode)},_getCellOrdinal:function(a){return parseInt(r(a,"CellOrdinal"),
10)},cellCount:function(){return this._cellNodes.length},reset:function(a){this._idx=a?a:0;this.hasMoreCells()&&this._getCellNode()},hasMoreCells:function(){return this._idx<this._cellCount},nextCell:function(){this._idx+=1;return this.hasMoreCells()?(this._getCellNode(),this._cellOrd):this._idx=-1},curr:function(){return this._idx},hasCellProperty:function(a){return!m(this._cellProperties[a])},cellProperty:function(a){var b,d;d=n(this._cellNode,"urn:schemas-microsoft-com:xml-analysis:mddataset",
"",a);d.length?(d=d[0],b=R(d),a=this._cellProperties[a],a||(d=C(d,"http://www.w3.org/2001/XMLSchema-instance","xsi","type"),a=Q(d)),b=a(b)):b=null;return b},cellOrdinal:function(){return this._cellOrd},_readCell:function(a,b){var c,e,f;for(c in this._cellProperties)if(e=n(a,"urn:schemas-microsoft-com:xml-analysis:mddataset","",c)[0])f=this._cellProperties[c],b[c]=f?f(p(e)):"Value"===c?R(e):p(e);b.ordinal=this._getCellOrdinal(a);return b},readCell:function(a){a||(a={});return this._readCell(this._cellNode,
a)},eachCell:function(a,b,d){var c=[null];b||(b=this);d&&(u(d)||(d=[d]),c=c.concat(d));for(var f;-1!==f&&this.hasMoreCells();)if(f=this.nextCell(),c[0]=this.readCell(),!1===a.apply(b,c))return!1;this._idx=0;return!0},getByIndex:function(a,b){this._getCellNode(a);return this.readCell(b)},getByOrdinal:function(a,b){var c,e;e=this.cellCount()-1;for(e=a>e?e:a;;){c=this._cellNodes[e];c=this._getCellOrdinal(c);if(c===a)return this.getByIndex(e,b);if(c>a)e--;else return null}},indexForOrdinal:function(a){for(var b=
this._cellNodes,d=Math.min(a,b.length-1),e;0<=d;){e=b[d];e=this._getCellOrdinal(e);if(e===a)return d;if(e>a)d--;else break}return-1},fetchRangeAsArray:function(a,b){var c=[],e=this._cellNodes,f=e.length;if(0===f)return c;var g;if(m(b)||-1===b)b=this._getCellOrdinal(e[f-1]);if(m(a)||-1===a)a=this._getCellOrdinal(e[0]);for(f=Math.min(b,f-1);0<=f;){g=e[f];g=this._getCellOrdinal(g);if(g<=b)break;--f}if(-1===f||g<a)return c;for(var h=Math.min(f,a);0<=h;){g=e[h];g=this._getCellOrdinal(g);if(g<=a){g<a&&
(h+=1);break}--h}for(-1===h&&(h=0);h<=f;h++)g=e[h],c.push(this._readCell(g,{}));return c},cellOrdinalForTupleIndexes:function(){return this._dataset.cellOrdinalForTupleIndexes.apply(this._dataset,arguments)},getByTupleIndexes:function(){return this.getByOrdinal(this.cellOrdinalForTupleIndexes.apply(this,arguments))},close:function(){this._cellNode=this._cellNodes=this._dataset=null}};b.Exception=function(a,b,d,e,f,g,h,k,m){this.type=a;this.code=b;this.message=d;this.source=f;this.helpfile=e;this.data=
g;this.args=h;this.detail=k;this.actor=m;return this};b.Exception.TYPE_WARNING="warning";b.Exception.TYPE_ERROR="error";b.Exception.MISSING_REQUEST_TYPE_CDE=-1;b.Exception.MISSING_REQUEST_TYPE_MSG="Missing_Request_Type";b.Exception.MISSING_REQUEST_TYPE_HLP="http://code.google.com/p/xmla4js/wiki/ExceptionCodes#"+b.Exception.MISSING_REQUEST_TYPE_CDE+"_"+b.Exception.MISSING_REQUEST_TYPE_MSG;b.Exception.MISSING_STATEMENT_CDE=-2;b.Exception.MISSING_STATEMENT_MSG="Missing_Statement";b.Exception.MISSING_STATEMENT_HLP=
"http://code.google.com/p/xmla4js/wiki/ExceptionCodes#"+b.Exception.MISSING_STATEMENT_CDE+"_"+b.Exception.MISSING_STATEMENT_MSG;b.Exception.MISSING_URL_CDE=-3;b.Exception.MISSING_URL_MSG="Missing_URL";b.Exception.MISSING_URL_HLP="http://code.google.com/p/xmla4js/wiki/ExceptionCodes#"+b.Exception.MISSING_URL_CDE+"_"+b.Exception.MISSING_URL_MSG;b.Exception.NO_EVENTS_SPECIFIED_CDE=-4;b.Exception.NO_EVENTS_SPECIFIED_MSG="No_Events_Specified";b.Exception.NO_EVENTS_SPECIFIED_HLP="http://code.google.com/p/xmla4js/wiki/ExceptionCodes#"+
b.Exception.NO_EVENTS_SPECIFIED_CDE+"_"+b.Exception.NO_EVENTS_SPECIFIED_MSG;b.Exception.WRONG_EVENTS_FORMAT_CDE=-5;b.Exception.WRONG_EVENTS_FORMAT_MSG="Wrong_Events_Format";b.Exception.WRONG_EVENTS_FORMAT_HLP="http://code.google.com/p/xmla4js/wiki/ExceptionCodes#"+b.Exception.NO_EVENTS_SPECIFIED_CDE+"_"+b.Exception.NO_EVENTS_SPECIFIED_MSG;b.Exception.UNKNOWN_EVENT_CDE=-6;b.Exception.UNKNOWN_EVENT_MSG="Unknown_Event";b.Exception.UNKNOWN_EVENT_HLP="http://code.google.com/p/xmla4js/wiki/ExceptionCodes#"+
b.Exception.UNKNOWN_EVENT_CDE+"_"+b.Exception.UNKNOWN_EVENT_MSG;b.Exception.INVALID_EVENT_HANDLER_CDE=-7;b.Exception.INVALID_EVENT_HANDLER_MSG="Invalid_Events_Handler";b.Exception.INVALID_EVENT_HANDLER_HLP="http://code.google.com/p/xmla4js/wiki/ExceptionCodes#"+b.Exception.INVALID_EVENT_HANDLER_CDE+"_"+b.Exception.INVALID_EVENT_HANDLER_MSG;b.Exception.ERROR_PARSING_RESPONSE_CDE=-8;b.Exception.ERROR_PARSING_RESPONSE_MSG="Error_Parsing_Response";b.Exception.ERROR_PARSING_RESPONSE_HLP="http://code.google.com/p/xmla4js/wiki/ExceptionCodes#"+
b.Exception.ERROR_PARSING_RESPONSE_CDE+"_"+b.Exception.ERROR_PARSING_RESPONSE_MSG;b.Exception.INVALID_FIELD_CDE=-9;b.Exception.INVALID_FIELD_MSG="Invalid_Field";b.Exception.INVALID_FIELD_HLP="http://code.google.com/p/xmla4js/wiki/ExceptionCodes#"+b.Exception.INVALID_FIELD_CDE+"_"+b.Exception.INVALID_FIELD_MSG;b.Exception.HTTP_ERROR_CDE=-10;b.Exception.HTTP_ERROR_MSG="HTTP Error";b.Exception.HTTP_ERROR_HLP="http://code.google.com/p/xmla4js/wiki/ExceptionCodes#"+b.Exception.HTTP_ERROR_CDE+"_"+b.Exception.HTTP_ERROR_MSG;
b.Exception.INVALID_HIERARCHY_CDE=-11;b.Exception.INVALID_HIERARCHY_MSG="Invalid_Hierarchy";b.Exception.INVALID_HIERARCHY_HLP="http://code.google.com/p/xmla4js/wiki/ExceptionCodes#"+b.Exception.INVALID_HIERARCHY_CDE+"_"+b.Exception.INVALID_HIERARCHY_MSG;b.Exception.UNEXPECTED_ERROR_READING_MEMBER_CDE=-12;b.Exception.UNEXPECTED_ERROR_READING_MEMBER_MSG="Error_Reading_Member";b.Exception.UNEXPECTED_ERROR_READING_MEMBER_HLP="http://code.google.com/p/xmla4js/wiki/ExceptionCodes#"+b.Exception.UNEXPECTED_ERROR_READING_MEMBER_CDE+
"_"+b.Exception.UNEXPECTED_ERROR_READING_MEMBER_MSG;b.Exception.INVALID_AXIS_CDE=-13;b.Exception.INVALID_AXIS_MSG="The requested axis does not exist.";b.Exception.INVALID_AXIS_HLP="http://code.google.com/p/xmla4js/wiki/ExceptionCodes#"+b.Exception.INVALID_AXIS_CDE+"_"+b.Exception.INVALID_AXIS_MSG;b.Exception.ILLEGAL_ARGUMENT_CDE=-14;b.Exception.ILLEGAL_ARGUMENT_MSG="Illegal arguments";b.Exception.ILLEGAL_ARGUMENT_HLP="http://code.google.com/p/xmla4js/wiki/ExceptionCodes#"+b.Exception.ILLEGAL_ARGUMENT_CDE+
"_"+b.Exception.ILLEGAL_ARGUMENT_MSG;b.Exception.ERROR_INSTANTIATING_XMLHTTPREQUEST_CDE=-15;b.Exception.ERROR_INSTANTIATING_XMLHTTPREQUEST_MSG="Error creating XML Http Request";b.Exception.ERROR_INSTANTIATING_XMLHTTPREQUEST_HLP="http://code.google.com/p/xmla4js/wiki/ExceptionCodes#"+b.Exception.ERROR_INSTANTIATING_XMLHTTPREQUEST_CDE+"_"+b.Exception.ERROR_INSTANTIATING_XMLHTTPREQUEST_MSG;b.Exception._newError=function(a,c,d){return new b.Exception(b.Exception.TYPE_ERROR,b.Exception[a+"_CDE"],b.Exception[a+
"_MSG"],b.Exception[a+"_HLP"],c,d)};b.Exception.prototype={type:null,code:null,message:null,source:null,helpfile:null,data:null,_throw:function(){throw this;},args:null,toString:function(){return this.type+" "+this.code+": "+this.message+" (source: "+this.source+", actor: "+this.actor+")"},getStackTrace:function(){if(this.args)for(var a=this.args.callee;a;)a=a.caller;return""}};"function"===typeof define&&define.amd?define(function(){return b}):y.Xmla=b;return b})("undefined"===typeof exports?window:
exports);
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment